hedgewars/uScript.pas
changeset 13221 95311e220eb6
parent 13175 98a0edb4bb5a
child 13275 969aacfa229c
--- a/hedgewars/uScript.pas	Thu Mar 15 03:29:31 2018 +0100
+++ b/hedgewars/uScript.pas	Thu Mar 15 04:33:11 2018 +0100
@@ -100,7 +100,7 @@
     ScriptLoaded : boolean;
     mapDims : boolean;
     PointsBuffer: shortstring;
-    prevCursorPoint: TPoint;  // why is tpoint still in sdlh...
+    PrevCursorX, PrevCursorY: LongInt;
 
 {$IFDEF USE_LUA_SCRIPT}
 procedure ScriptPrepareAmmoStore; forward;
@@ -3139,8 +3139,8 @@
     exit;
 
 // push game variables so they may be modified by the script
-ScriptSetInteger('CursorX', CursorPoint.X);
-ScriptSetInteger('CursorY', CursorPoint.Y);
+ScriptSetInteger('CursorX', NoPointX);
+ScriptSetInteger('CursorY', NoPointX);
 ScriptSetInteger('GameFlags', GameFlags);
 ScriptSetInteger('WorldEdge', ord(WorldEdge));
 ScriptSetString('Seed', cSeed);
@@ -3380,6 +3380,7 @@
 end;
 
 procedure SetGlobals;
+var x, y: LongInt;
 begin
 ScriptSetInteger('TurnTimeLeft', TurnTimeLeft);
 ScriptSetInteger('ReadyTimeLeft', ReadyTimeLeft);
@@ -3388,21 +3389,23 @@
 ScriptSetInteger('WaterLine', cWaterLine);
 if isCursorVisible and (not bShowAmmoMenu) then
     begin
-    if (prevCursorPoint.X <> CursorPoint.X) or
-       (prevCursorPoint.Y <> CursorPoint.Y) then
+    x:= CursorPoint.X - WorldDx;
+    y:= cScreenHeight - CursorPoint.Y - WorldDy;
+    if (PrevCursorX <> x) or
+       (PrevCursorY <> y) then
         begin
-        ScriptSetInteger('CursorX', CursorPoint.X - WorldDx);
-        ScriptSetInteger('CursorY', cScreenHeight - CursorPoint.Y- WorldDy);
-        prevCursorPoint.X:= CursorPoint.X;
-        prevCursorPoint.Y:= CursorPoint.Y;
+        ScriptSetInteger('CursorX', x);
+        ScriptSetInteger('CursorY', y);
+        PrevCursorX:= x;
+        PrevCursorY:= y;
         end
     end
 else
     begin
     ScriptSetInteger('CursorX', NoPointX);
     ScriptSetInteger('CursorY', NoPointX);
-    prevCursorPoint.X:= NoPointX;
-    prevCursorPoint.Y:= NoPointX
+    PrevCursorX:= NoPointX;
+    PrevCursorY:= NoPointX
     end;
 
 if not mapDims then
@@ -4023,8 +4026,8 @@
 begin
 mapDims:= false;
 PointsBuffer:= '';
-prevCursorPoint.X:= NoPointX;
-prevCursorPoint.Y:= 0;
+PrevCursorX:= NoPointX;
+PrevCursorY:= NoPointX;
 end;
 
 procedure freeModule;