CRPL Bug: Negative Pixel Coordinates (V2.08)

Started by ParkourPenguin, July 28, 2014, 01:37:25 PM

Previous topic - Next topic

ParkourPenguin

I was having some really strange behavior in this one script that I was making, and I traced it down to a possible glitch dealing with unit coordinates. It's slightly different in the x direction and the y direction, however.

In the x-direction, if you set a unit's CurrentX less than 0, any attempts to get the CurrentX will result in a value 1 greater than what you originally set it at. SSCCE:
once
ClearTraceLog
ShowTraceLog
2 ->counter
endonce

<-counter SetCurrentX

"counter:" <-counter Trace2
"CurrentX:" CurrentX Trace2
"---------------" Trace

<-counter 1 sub ->counter

(Hit 'n' when the game is paused to advance it by 1 frame)

In the y-direction, if you set a unit's CurrentY greater than or equal to the value returned by MapHeight, any attempts to get the CurrentY will result in a value 1 less than what you originally set it at. SSCCE:
once
ClearTraceLog
ShowTraceLog
MapHeight 3 sub ->counter
"MapHeight: " MapHeight Trace2
endonce

<-counter SetCurrentY

"counter:" <-counter Trace2
"CurrentY:" CurrentY Trace2
"---------------" Trace

<-counter 1 add ->counter


For all intents and purposes, "counter" and CurrentX / CurrentY should trace the same value, but they don't when counter < 1  /  counter >= MapHeight (respectively).

In edit mode within the map editor, you can also see similar behavior if you move your mouse beyond the left/bottom side of the map. An image is attached below showing this. Because of this behavior, I believe it has something to do with negative pixel coordinates more than the base coordinate system.
"Only a life lived for others is a life worthwhile."
-Albert Einstein