RobotiX
|
 |
Posted on: January 17, 2015, 10:18:52 pm |
|
|
 Location: Pomona, CA Joined: Jan 2015
Posts: 5
|
Hey all,
I have lots of GM experience but only recently started with ENIGMA. I started a project from scratch in LGM, it's the newest ENIGMA portable, I have jdk 8, running Windows 7. Basically I have:
image = sprite_add(file_name, 0, false, false, 0, 0) show_message(string(image)) And then in the draw event:
draw_sprite(image, 0, x, y) I get the message and it shows the sprite index but when it tries to call the draw function the game crashes. Any help would be appreciated.
RobotiX
|
|
|
Logged
|
|
|
|
|
RobotiX
|
 |
Reply #2 Posted on: January 18, 2015, 02:21:57 am |
|
|
 Location: Pomona, CA Joined: Jan 2015
Posts: 5
|
It works perfectly in GM 8.
EDIT: Ok so I managed to get an error in the console, it said something along the lines as "incorrect PNG signature, it's no PNG or corrupted" So i thought maybe ENIGMA can only handle pngs. No problem, I just converted my image to a png. Still crashes, no error message this time. So I just ran gdb on it and got this:
Program received signal SIGFPE, Arithmetic exception. 0x004de1de in enigma::sprite_add_to_index (ns=0x6b391f8, filename=..., imgnumb=0, precise=false, transparent=false, smooth=false, x_offset=0, y_offset=0, mipmap=false) at Universal_System/spritestruct.cpp:285 285 unsigned cellwidth = width/imgnumb; and the backtrace:
#0 0x004de1de in enigma::sprite_add_to_index (ns=0x6b391f8, filename=..., imgnumb=0, precise=false, transparent=false, smooth=false, x_offset=0, y_offset=0, mipmap=false) at Universal_System/spritestruct.cpp:285 #1 0x004dd066 in enigma_user::sprite_add (filename=..., imgnumb=0, precise=false, transparent=false, smooth=false, preload=true, x_offset=0, y_offset=0, mipmap=false) at Universal_System/spritestruct.cpp:68 #2 0x004dd1b6 in enigma_user::sprite_add (filename=..., imgnumb=0, transparent=false, smooth=false, x_offset=0, y_offset=0, mipmap=false) at Universal_System/spritestruct.cpp:74 #3 0x0040351b in enigma::OBJ_obj_0::myevent_create (this=0x6b38d78) at C:/ProgramData/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectfu nctionality.h:43 #4 0x004e61c1 in enigma::roomstruct::gotome ( this=0x7ef3e0 <enigma::grd_rooms>, gamestart=true) at Universal_System/roomsystem.cpp:193 #5 0x004ea4e9 in enigma::game_start () at Universal_System/roomsystem.cpp:841 #6 0x004b2a0f in enigma::initialize_everything () at Universal_System/loading.cpp:120 #7 0x00407a76 in WinMain@16 (hInstance=0x400000, hPrevInstance=0x0, lpCmdLine=0x1ed6386 "", iCmdShow=10) at Platforms/Win32/WINDOWSmain.cpp:255 #8 0x0076a48d in main () It looks like a problem with ENIGMA.
EDIT AGAIN: Fixed it. looking at the error it says "Arithmetic exception." and "width/imgnumb" I put two and two together and guessed that it was a divide-by-zero error, I changed image_num to 1 instead of 0 and it didn't crash. Thanks Obama.
|
|
« Last Edit: January 18, 2015, 05:28:46 am by RobotiX »
|
Logged
|
|
|
|
|
|
|
Goombert
|
 |
Reply #6 Posted on: January 18, 2015, 06:21:12 pm |
|
|
 Location: Cappuccino, CA Joined: Jan 2013
Posts: 2991
|
Thanks Obama. lol, Howdy, I am Robert and I have done a lot of contributing here so I may be able to clarify some things for you. Currently OpenAL attempts to implement both the basic sound functions and DirectSound functions, however we eventually plan to drop support for the sound_* functions unless you use the DirectSound system. audio_* functions are from GM: Studio which uses OpenAL and is better for both cross-platform development as well as positional audio, DirectSound is deprecated by Microsoft. The original sound_* functions from GM 8.1 and earlier were implemented with DirectSound and mp3 files were played using DirectMusic which is an interface for Windows Media Player (hence the old option to use an external media player). ENIGMA's DirectSound system does not implement DirectMusic yet so it only supports basic WAV formats. I am certain our OpenAL system supports OGG, WAV, and MP3 because we built it with those codecs. I am sorry you encountered the bug ENIGMA certainly needs better error handling, and there is discussion about the interface design for it but that is mainly in the context of compile-time errors and not run-time errors. There have been some things I have been planning regarding ENIGMA's run-time exceptions and that is mainly to provide a stack trace with line numbers in the function show_debug_message like LateralGM's exception dialog. One place we have improved recently is that undefined variables can actually report scope in debug mode, which was a huge improvement.
|
|
« Last Edit: January 18, 2015, 06:33:07 pm by Robert B Colton »
|
Logged
|
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect. 
|
|
|
|
Darkstar2
|
 |
Reply #8 Posted on: January 19, 2015, 11:23:05 am |
|
|
 Joined: Jan 2014
Posts: 1238
|
Since the topic was about sprite_add,
Robert, any idea why sprite_add no longer works ? It used to.
I also tried it, it crashes, it works only with GIF, but with PNG it crashes, and yes I am using proper settings, tried all possible combinations, different PNG, etc.
After months of not using ENIGMA, I started playing around with it and notice how far more unstable it has become, just after half a dozen save/updating I get memory access JVM errors in LGM and crashing/closing.......I have 16GB of RAM, 14GB free, and yes I use the 1000 max in settings.ini, and some functions that used to work fine now either don't work at all or fail/crash. sprite_add one of them.
|
|
|
Logged
|
|
|
|
Goombert
|
 |
Reply #9 Posted on: January 19, 2015, 03:06:27 pm |
|
|
 Location: Cappuccino, CA Joined: Jan 2013
Posts: 2991
|
Robert, any idea why sprite_add no longer works ? It used to. Does this answer your question? EDIT AGAIN: Fixed it. looking at the error it says "Arithmetic exception." and "width/imgnumb" I put two and two together and guessed that it was a divide-by-zero error, I changed image_num to 1 instead of 0 and it didn't crash. Thanks Obama. It's not broke and it hasn't been broke since I broke it to fix it. I get a "Unknown function or script `sound_fade'" error regardless of which sound system I'm using. It looks like we never actually even outlined the function. I can give you the basic steps to add it though. First outline the function in the general header https://github.com/enigma-dev/enigma-dev/blob/master/ENIGMAsystem/SHELL/Audio_Systems/General/ASbasic.h#L62it should be the same path in your local enigma-dev copy regardless of how you installed. By outlining it there it ensures the parameter and return types are the same for every system. Then you just add the body of the function in https://github.com/enigma-dev/enigma-dev/blob/master/ENIGMAsystem/SHELL/Audio_Systems/DirectSound/DSbasic.cpp#L92or https://github.com/enigma-dev/enigma-dev/blob/master/ENIGMAsystem/SHELL/Audio_Systems/OpenAL/ALbasic.cpp#L152for OpenAL. That's really all you need to do and the function will be usable, you could also send us a pull request on GitHub and we may merge it so long as you write the code neatly to match the other functions in the files. sound_fade(index,value,time) Changes the volume for the indicated sound to the new value(0 = low, 1 = high) during the indicated time (in milliseconds). This can be used to fade out or fade in music.
|
|
« Last Edit: January 19, 2015, 03:11:36 pm by Robert B Colton »
|
Logged
|
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect. 
|
|
|
|
Goombert
|
 |
Reply #11 Posted on: January 19, 2015, 09:54:52 pm |
|
|
 Location: Cappuccino, CA Joined: Jan 2013
Posts: 2991
|
Do you have the PNG? I'll test myself, Project Mario uses extensive BMP and PNG loading. Also the code that you are trying to load it with.
|
|
|
Logged
|
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect. 
|
|
|
Darkstar2
|
 |
Reply #12 Posted on: January 19, 2015, 09:58:18 pm |
|
|
 Joined: Jan 2014
Posts: 1238
|
Do you have the PNG? I'll test myself, Project Mario uses extensive BMP and PNG loading. Also the code that you are trying to load it with.
Here  and the code is the SAME code as the OP, I just used my file instead, tried it with 0 and with 1 same thing. if I make this into a GIF, it worked fine.
|
|
|
Logged
|
|
|
|
|
TheExDeus
|
 |
Reply #14 Posted on: January 20, 2015, 04:45:48 am |
|
|
 Joined: Apr 2008
Posts: 1860
|
I just tested loading and drawing in my ENIGMA (which is very up to date and only few commits behind) and it's working fine:  Code: spr = sprite_add("C:\001.png",1,0,0,0,0); draw_sprite(spr,-1,mouse_x,mouse_y); edit: I tested both GL1 and GL3. Can you maybe try GDB and post the bt?
|
|
« Last Edit: January 20, 2015, 04:48:10 am by TheExDeus »
|
Logged
|
|
|
|
|