bug fixes and python enhancements

This forum is currently in read-only mode.
From the Asset Store
Match same tiles with each other as fast as you can and earn more score during a limited time!
  • I have several more fixes here:

    #1

    Problem: Rotation is accelerated when using corner filters on sprites.

    Example: http://www.box.net/shared/565m9reptj

    Fix: "Runtime\RenderLayer.cpp" (line 213) "angle" was not converted to radians.

    	//quad q((r - hotspot).rotate_to_quad(angle, r.topleft()));
    	quad q((r - hotspot).rotate_to_quad(cr::to_radians(angle), r.topleft()));[/code:9dbubh4w]
    
    [h2]#2[/h2]
    [b]Problem:[/b] When using python many of the actions in "System" are different in the IDE editor than at runtime.  The "action" names as listed in the IDE are defined in "IDE\Structure\SystemObject.cpp" and the "action" names used at runtime are defined in "Runtime\System.cpp"(lines 209-265).
    
    [b]Fix:[/b] I tweaked the files so that the names match.
    Here's the modified  "IDE\Structure\SystemObject.cpp" file: [url=http://www.box.net/shared/uce9q0xxj6]SystemObject.cpp[/url]
    and here is the section of code to replace "Runtime\System.cpp"(lines 209-265): [url=http://www.box.net/shared/mggln3dmon]fixSystem.cpp[/url]
    
    [h2]#3[/h2]
    [b]Problem:[/b] I didn't modify any of the expression names in "IDE\Structure\SystemObject.cpp"(line 694-788) as it looks like they are the names used it construct itself outside of python.  In "Runtime\System.cpp" (lines 436-512) the runtime uses the same expression names as the IDE but in all lowercase.  Which is fine except for "global" on line 444.  "global" is a reserved name in python.
    
    [b]Fix:[/b] change "IDE\Structure\SystemObject.cpp"(line 444) to:
    [code:9dbubh4w]	{"globalvar", &SystemObject::eGlobalValue},[/code:9dbubh4w]
    
    [h2]#4[/h2]
    [b]Problem:[/b] Accessing private variables in python don't work and cause crashes.  Global variable are accessible but only by an integer.  It seems that for private variables the parameter type is checked and only works if the type is "EXPTYPE_VARIABLENAME" otherwise it uses "-1" as an index, which explains the crashes because python will never return a "EXPTYPE_VARIABLENAME" and "-1" is out of bounds.
    
    [b]Fix:[/b] I made it so variables can be accessed via vaiablename, integer or string.
    Outline of changes: [url=http://www.box.net/shared/ruecof4lqp]variableFixes[/url]
    I added 2 functions to simplify: 
    [i]GetVariableIndexFromName[/i]: which is just an overloaded function of the same name but takes takes CRunObjType instead of CRunObject as a parameter. 
    [i]getGlobalVarIndex[/i]: to group the type checking for global variables in one place.
    
    PS:
    I hope this is easy enough to follow, but if it isn't let me know.  Also is there a better or preferred method to submit fixes to construct's source code.
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • great work rojo

  • Well it's finally all committed to the SVN.

    Had to rework some of the fixes, but now they're working good now.

    All that's left to do now is wait... or fix more stuff.

    cheers

  • *High five*

    People like you deserve cookies. By any chance, do you look into bugs by request?

  • Cookies indeed! great work!

  • Thanks for the cookies. As for requests, the short answer is no. But as I get more familiar with construct's code I will be able to do more, time permitting.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)