99 ScriptAmmoDelay : shortstring; |
100 ScriptAmmoDelay : shortstring; |
100 ScriptAmmoReinforcement : shortstring; |
101 ScriptAmmoReinforcement : shortstring; |
101 ScriptLoaded : boolean; |
102 ScriptLoaded : boolean; |
102 mapDims : boolean; |
103 mapDims : boolean; |
103 PointsBuffer: shortstring; |
104 PointsBuffer: shortstring; |
|
105 prevCursorPoint: TPoint; // why is tpoint still in sdlh... |
104 |
106 |
105 procedure ScriptPrepareAmmoStore; forward; |
107 procedure ScriptPrepareAmmoStore; forward; |
106 procedure ScriptApplyAmmoStore; forward; |
108 procedure ScriptApplyAmmoStore; forward; |
107 procedure ScriptSetAmmo(ammo : TAmmoType; count, probability, delay, reinforcement: Byte); forward; |
109 procedure ScriptSetAmmo(ammo : TAmmoType; count, probability, delay, reinforcement: Byte); forward; |
108 procedure ScriptSetAmmoDelay(ammo : TAmmoType; delay: Byte); forward; |
110 procedure ScriptSetAmmoDelay(ammo : TAmmoType; delay: Byte); forward; |
2613 // not required if there is no script to run |
2615 // not required if there is no script to run |
2614 if not ScriptLoaded then |
2616 if not ScriptLoaded then |
2615 exit; |
2617 exit; |
2616 |
2618 |
2617 // push game variables so they may be modified by the script |
2619 // push game variables so they may be modified by the script |
|
2620 ScriptSetInteger('CursorX', CursorPoint.X); |
|
2621 ScriptSetInteger('CursorY', CursorPoint.Y); |
2618 ScriptSetInteger('BorderColor', ExplosionBorderColor); |
2622 ScriptSetInteger('BorderColor', ExplosionBorderColor); |
2619 ScriptSetInteger('GameFlags', GameFlags); |
2623 ScriptSetInteger('GameFlags', GameFlags); |
2620 ScriptSetString('Seed', cSeed); |
2624 ScriptSetString('Seed', cSeed); |
2621 ScriptSetInteger('TemplateFilter', cTemplateFilter); |
2625 ScriptSetInteger('TemplateFilter', cTemplateFilter); |
2622 ScriptSetInteger('TemplateNumber', LuaTemplateNumber); |
2626 ScriptSetInteger('TemplateNumber', LuaTemplateNumber); |
2771 begin |
2775 begin |
2772 ScriptSetInteger('TurnTimeLeft', TurnTimeLeft); |
2776 ScriptSetInteger('TurnTimeLeft', TurnTimeLeft); |
2773 ScriptSetInteger('GameTime', GameTicks); |
2777 ScriptSetInteger('GameTime', GameTicks); |
2774 ScriptSetInteger('TotalRounds', TotalRounds); |
2778 ScriptSetInteger('TotalRounds', TotalRounds); |
2775 ScriptSetInteger('WaterLine', cWaterLine); |
2779 ScriptSetInteger('WaterLine', cWaterLine); |
|
2780 if isCursorVisible and (not bShowAmmoMenu) then |
|
2781 if (prevCursorPoint.X <> CursorPoint.X) or |
|
2782 (prevCursorPoint.Y <> CursorPoint.Y) then |
|
2783 begin |
|
2784 ScriptSetInteger('CursorX', CursorPoint.X - WorldDx); |
|
2785 ScriptSetInteger('CursorY', cScreenHeight - CursorPoint.Y- WorldDy); |
|
2786 prevCursorPoint.X:= CursorPoint.X; |
|
2787 prevCursorPoint.Y:= CursorPoint.Y; |
|
2788 end |
|
2789 else |
|
2790 begin |
|
2791 ScriptSetInteger('CursorX', NoPointX); |
|
2792 ScriptSetInteger('CursorY', NoPointX); |
|
2793 prevCursorPoint.X:= NoPointX; |
|
2794 prevCursorPoint.Y:= NoPointX |
|
2795 end; |
|
2796 |
2776 if not mapDims then |
2797 if not mapDims then |
2777 begin |
2798 begin |
2778 mapDims:= true; |
2799 mapDims:= true; |
2779 ScriptSetInteger('LAND_WIDTH', LAND_WIDTH); |
2800 ScriptSetInteger('LAND_WIDTH', LAND_WIDTH); |
2780 ScriptSetInteger('LAND_HEIGHT', LAND_HEIGHT); |
2801 ScriptSetInteger('LAND_HEIGHT', LAND_HEIGHT); |