ENIGMA Forums

Contributing to ENIGMA => Proposals => Topic started by: polygone on January 25, 2011, 05:45:38 am

Title: 2 bugged GM files
Post by: polygone on January 25, 2011, 05:45:38 am
I was just going through some old examples. Can someone else please test these GM files to clarify.

http://www.box.net/shared/zk9oi4trrj

In this file the object is not visible for some reason.

Tracker Reference:
http://enigma-dev.org/tracker/ticket.php?id=80


----------------
#RESOLVED#
http://www.box.net/shared/vh554hae7j

In this file the first time you open the object properties, then click save the object name gets cleared. Also it will not run while the action_move icon is in the creation event, it just does nothing upon trying to execute.
Title: Re: 2 bugged GM files
Post by: IsmAvatar on January 25, 2011, 12:01:00 pm
Please run from the terminal and see if it outputs any kind of errors or strange output.

Also, when you say the object is not visible, *where* is the object not visible? In the LGM resource tree? In the LGM room editor? In the game when running?
Title: Re: 2 bugged GM files
Post by: polygone on January 25, 2011, 12:13:12 pm
Please run from the terminal and see if it outputs any kind of errors or strange output.
Yes, I don't know why I didn't do that..

This is error is being thrown when trying to run:
Quote
Exception in thread "Thread-19" java.util.regex.PatternSyntaxException: Unexpected internal error near index 1\
 ^
        at java.util.regex.Pattern.error(Unknown Source)
        at java.util.regex.Pattern.compile(Unknown Source)
        at java.util.regex.Pattern.<init>(Unknown Source)
        at java.util.regex.Pattern.compile(Unknown Source)
        at java.lang.String.replaceAll(Unknown Source)
        at org.enigma.EnigmaWriter.toString(EnigmaWriter.java:906)
        at org.enigma.EnigmaWriter.getActionsCode(EnigmaWriter.java:883)
        at org.enigma.EnigmaWriter.populateObjects(EnigmaWriter.java:582)
        at org.enigma.EnigmaWriter.populateStruct(EnigmaWriter.java:124)
        at org.enigma.EnigmaWriter.prepareStruct(EnigmaWriter.java:109)
        at org.enigma.EnigmaRunner$3.run(EnigmaRunner.java:513)
And I see what the issue is with the object name being cleared. It's because there is a space used in the object resource name, which apparently makes LGM just clear it.

Quote
Also, when you say the object is not visible, *where* is the object not visible? In the LGM resource tree? In the LGM room editor? In the game when running?
When running the game. I think it might have something to do with the background but I'm not entirely sure what it is.
Title: Re: 2 bugged GM files
Post by: IsmAvatar on January 25, 2011, 03:08:26 pm
PatternSyntaxException will be corrected in the next revision. Thanks for the report.
Resource names should allow spaces in LGM, so the behavior you describe is not desired. I'll investigate.
Problems during game run are Josh's area. It may be a depth-related issue - e.g. it is being drawn, but something else is drawn overtop of it so you can't see it.
Title: Re: 2 bugged GM files
Post by: TheExDeus on January 25, 2011, 06:06:56 pm
Quote
Resource names should allow spaces in LGM, so the behavior you describe is not desired.
Actually it could be desired (like showing an error). Because yeah, GM allows this too, but then assigning this resource is impossible. Like if you have "object 0" you will not be able to get the id for that object like so:
Code: [Select]
with (object 0){}That will clearly show an error, and so maybe this should not be encouraged? On the other hand, while writing this I kind of guess that it is up to the user, and if the system allows this, then be it. On the other hand if LGM or ENIGMA should of be rewritten just to allow this, then I wouldn't see the point.
Title: Re: 2 bugged GM files
Post by: polygone on January 26, 2011, 07:11:33 am
Quote
Resource names should allow spaces in LGM, so the behavior you describe is not desired.
Actually it could be desired (like showing an error). Because yeah, GM allows this too, but then assigning this resource is impossible. Like if you have "object 0" you will not be able to get the id for that object like so:
Code: [Select]
with (object 0){}That will clearly show an error, and so maybe this should not be encouraged? On the other hand, while writing this I kind of guess that it is up to the user, and if the system allows this, then be it. On the other hand if LGM or ENIGMA should of be rewritten just to allow this, then I wouldn't see the point.
It's still possible to reference the index using D&D or control in GML via parenting. Note the same issue exists with duplicate resource names which GM also allows.

Spaces certainly do not appear to be allowed in LGM at the moment though.
Title: Re: 2 bugged GM files
Post by: IsmAvatar on January 26, 2011, 11:39:06 am
After looking it over, it appears that the textfield does not allow you to type the space character, and attempting to add a space to the tree node will cause the space to be removed once editing has finished. This behavior is appropriate. However the behavior of clearing the name entirely because [a loaded game contained a resource with a space] is completely inappropriate and should be fixed as soon as I get a chance.
Title: Re: 2 bugged GM files
Post by: polygone on January 27, 2011, 02:09:26 pm
OK that other file is definitely a bug with the background. It's drawing the purple background in the foreground regardless.
Title: Re: 2 bugged GM files
Post by: polygone on March 05, 2011, 03:13:02 am
I have been trying to debug this myself. I have found that the result of this bug is actually due to two issues:

1) background_showcolor is not used

In roomsystem.c (https://enigma-dev.svn.sourceforge.net/svnroot/enigma-dev/trunk/ENIGMAsystem/SHELL/Universal_System/roomsystem.cpp) background_color is defined using:

Code: (C++) [Select]
background_showcolor = (backcolor!=-1);Instead of from the background_showcolor boolean from LGM.

Note that when this is fixed GSscreen.cpp (https://enigma-dev.svn.sourceforge.net/svnroot/enigma-dev/trunk/ENIGMAsystem/SHELL/Graphics_Systems/OpenGL/GSscreen.cpp) also needs updating. It uses (in 2 places):

Code: (C++) [Select]
      if (background_showcolor)
      {
         int clearcolor=((int)background_color)&0xFFFFFF;
         glClearColor(__GETR(clearcolor)/255.0,__GETG(clearcolor)/255.0,__GETB(clearcolor)/255.0, 1);
         glClear(GL_COLOR_BUFFER_BIT);
      }
An else statement should be added to this clearing the screen in black (as GM does).


2) The instance's parent draw code is not being executed in my particular file.

EDIT: No longer a problem.
Title: Re: 2 bugged GM files
Post by: IsmAvatar on March 05, 2011, 02:09:43 pm
Make sure that sprite_index is populated. If it is not, then the default value will always be 0, regardless of inheritance or sprite settings. A good trick might be to duplicate your sprite0, and then replace the original with a red X, and never use it. That way, if you ever do try to draw a sprite and the index is accidentally 0, you'll know right away.
Title: Re: 2 bugged GM files
Post by: polygone on March 05, 2011, 02:54:58 pm
EDIT:

Found the issue once and for all. The sprite_width has not been set and thus is equal to 0. I was dividing by it and assigning to image_angle which is why the sprite was not shown.

That means the only problem actually is:
1) background_showcolor is not used