free up power for use by script
authornemo
Wed, 04 Jul 2012 12:41:47 -0400
changeset 7339 5984b749ad9b
parent 7337 c224cd2d32f3
child 7341 d70478d265ec
free up power for use by script
hedgewars/GSHandlers.inc
hedgewars/uGearsHedgehog.pas
hedgewars/uGearsRender.pas
hedgewars/uScript.pas
--- a/hedgewars/GSHandlers.inc	Wed Jul 04 10:56:42 2012 -0400
+++ b/hedgewars/GSHandlers.inc	Wed Jul 04 12:41:47 2012 -0400
@@ -2120,15 +2120,14 @@
    voices. Reinforcements voices is heard for active team, not team-to-be.  Either that or change crate spawn from end of turn to start, although that
    has its own complexities. *)
             // Abuse a couple of gear values to track origin
-            Gear^.Angle:= hwRound(Gear^.X);
-            Gear^.Power:= hwRound(Gear^.Y);
+            Gear^.Angle:= hwRound(Gear^.Y);
             Gear^.Tag:= random(2);
             inc(Gear^.Timer)
             end;
         if Gear^.Timer < 1833 then inc(Gear^.Timer);
         if Gear^.Timer = 1000 then
             begin
-            sparkles:= AddVisualGear(Gear^.Angle, Gear^.Power, vgtDust, 1);
+            sparkles:= AddVisualGear(hwRound(Gear^.X), Gear^.Angle, vgtDust, 1);
             if sparkles <> nil then
                 begin
                 sparkles^.dX:= 0;
--- a/hedgewars/uGearsHedgehog.pas	Wed Jul 04 10:56:42 2012 -0400
+++ b/hedgewars/uGearsHedgehog.pas	Wed Jul 04 12:41:47 2012 -0400
@@ -605,7 +605,10 @@
                     or (HH^.Hedgehog^.Team^.Clan^.ClanIndex = LocalClan)
                     or (GameType = gmtDemo)  then
                         begin
-                        s:= trammo[Ammoz[a].NameId] + ' (+' + IntToStr(Ammoz[a].NumberInCase) + ')';
+                        if Gear^.Power <> 0 then
+                            s:= trammo[Ammoz[a].NameId] + ' (+' + IntToStr(Gear^.Power) + ')'
+                        else
+                            s:= trammo[Ammoz[a].NameId] + ' (+' + IntToStr(Ammoz[a].NumberInCase) + ')';
                         AddCaption(s, HH^.Hedgehog^.Team^.Clan^.Color, capgrpAmmoinfo);
 
                         // show ammo icon
--- a/hedgewars/uGearsRender.pas	Wed Jul 04 10:56:42 2012 -0400
+++ b/hedgewars/uGearsRender.pas	Wed Jul 04 12:41:47 2012 -0400
@@ -1018,7 +1018,7 @@
                     if Gear^.Timer < 1833 then
                         begin
                         DrawTextureRotatedF(SpritesData[sprPortal].texture, min(abs(1.25 - (Gear^.Timer mod 1333) / 400), 1.25), 0, 0,
-                                            Gear^.Angle+WorldDx, Gear^.Power+WorldDy-16, 4+Gear^.Tag, 1, 32, 32, 270);
+                                            x, Gear^.Angle+WorldDy-16, 4+Gear^.Tag, 1, 32, 32, 270);
                         end
                     end;
       gtExplosives: begin
--- a/hedgewars/uScript.pas	Wed Jul 04 10:56:42 2012 -0400
+++ b/hedgewars/uScript.pas	Wed Jul 04 12:41:47 2012 -0400
@@ -341,7 +341,7 @@
         end
     else
         begin
-        if (lua_gettop(L) <> 3) then 
+        if (lua_gettop(L) = 3) then 
              gear := SpawnCustomCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2), AmmoCrate, lua_tointeger(L, 3), 0)
         else gear := SpawnCustomCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2), AmmoCrate, lua_tointeger(L, 3), lua_tointeger(L, 4));
         if gear <> nil then
@@ -362,7 +362,7 @@
         end
     else
         begin
-        if (lua_gettop(L) <> 3) then
+        if (lua_gettop(L) = 3) then
              gear := SpawnCustomCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2), UtilityCrate, lua_tointeger(L, 3), 0)
         else gear := SpawnCustomCrateAt(lua_tointeger(L, 1), lua_tointeger(L, 2), UtilityCrate, lua_tointeger(L, 3), lua_tointeger(L, 4));
         if gear <> nil then