Land sprayer tweaks, make land spray and mudball not end turn
authornemo
Sat, 19 Mar 2011 19:41:59 -0400
changeset 5025 ac1691d35cf2
parent 5024 1e332947147c
child 5026 e83d4552625f
Land sprayer tweaks, make land spray and mudball not end turn
hedgewars/GSHandlers.inc
hedgewars/uGearsRender.pas
hedgewars/uVariables.pas
share/hedgewars/Data/Locale/en.txt
--- a/hedgewars/GSHandlers.inc	Sat Mar 19 17:49:27 2011 -0400
+++ b/hedgewars/GSHandlers.inc	Sat Mar 19 19:41:59 2011 -0400
@@ -141,8 +141,12 @@
                             AddCaption(Format(GetEventString(eidDrowned), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage);
                             end
                         end
-                    else
-                        Gear^.doStep := @doStepDrowningGear
+                    else if Gear^.Kind = gtFlake then
+                        begin
+                        DeleteGear(Gear);
+                        exit
+                        end
+                    else Gear^.doStep := @doStepDrowningGear
             end;
             if ((not isSubmersible) and (hwRound(Gear^.Y) < cWaterLine + 64 + Gear^.Radius)) or
                (isSubmersible and (hwRound(Gear^.Y) < cWaterLine + 2 + Gear^.Radius) and ((CurAmmoGear^.Pos = 0) and (CurAmmoGear^.dY < _0_01))) then
@@ -568,14 +572,15 @@
 
 procedure doStepSnowflake(Gear: PGear);
 var xx, yy, px, py, i: LongInt;
-    move, draw, allpx: Boolean;
+    move, draw, allpx, gun: Boolean;
     s: PSDL_Surface;
     p: PLongwordArray;
     oAlpha, nAlpha: byte;
 begin
+gun:= (Gear^.State and gstTmpFlag) <> 0;
 move:= false;
 draw:= false;
-if (Gear^.State and gstTmpFlag) <> 0 then
+if gun then
     begin
     doStepFallingGear(Gear);
     CheckCollision(Gear);
@@ -652,7 +657,7 @@
         if (CurAmmoGear = nil) or (CurAmmoGear^.Kind <> gtRope) then
             begin
 ////////////////////////////////// TODO - ASK UNC0RR FOR A GOOD HOME FOR THIS ////////////////////////////////////
-            if (State and gstTmpFlag) = 0 then
+            if not gun then
                 begin
                 dec(yy,3);
                 dec(xx,1)
@@ -665,17 +670,23 @@
                 for px:= 0 to Pred(s^.w) do
                     if ((((yy + py) and LAND_HEIGHT_MASK) = 0) and (((xx + px) and LAND_WIDTH_MASK) = 0)) and ((Land[yy + py, xx + px] and $FF) = 0) then
                         begin
+                        if gun then
+                            begin
+                            // try to avoid speckles. might need disabling
+                            LandDirty[yy div 32, xx div 32]:= 1;
+                            Land[yy + py, xx + px]:= Land[yy + py, xx + px] or lfDamaged;
+                            end;
                         Land[yy + py, xx + px]:= Land[yy + py, xx + px] or lfObject;
                         if (cReducedQuality and rqBlurryLand) = 0 then
                             begin
-                            if (State and gstTmpFlag) <> 0 then
-                                LandPixels[yy + py, xx + px]:= addBgColor(LandPixels[yy + py, xx + px], (cExplosionBorderColor and $00FFFFFF) or (p^[px] and $FF000000))
+                            if gun then
+                                LandPixels[yy + py, xx + px]:= (cExplosionBorderColor and $00FFFFFF) or (p^[px] and $FF000000)
                             else LandPixels[yy + py, xx + px]:= addBgColor(LandPixels[yy + py, xx + px], p^[px]);
                             end
                         else
                             begin
-                            if (State and gstTmpFlag) <> 0 then
-                                LandPixels[(yy + py) div 2, (xx + px) div 2]:= addBgColor(LandPixels[(yy + py) div 2, (xx + px) div 2], (cExplosionBorderColor and $00FFFFFF) or (p^[px] and $FF000000))
+                            if gun then
+                                LandPixels[(yy + py) div 2, (xx + px) div 2]:= (cExplosionBorderColor and $00FFFFFF) or (p^[px] and $FF000000)
                             else LandPixels[(yy + py) div 2, (xx + px) div 2]:= addBgColor(LandPixels[(yy + py) div 2, (xx + px) div 2], p^[px]);
                             end;
                         end
@@ -702,7 +713,7 @@
 
 if move then
     begin
-    if ((Gear^.State and gstTmpFlag) <> 0) then
+    if gun then
         begin
         DeleteGear(Gear);
         exit
@@ -4410,8 +4421,9 @@
         Gear^.Timer:= Gear^.Tag
         end;
 
-    if (Gear^.Health = 0) or (HHGear^.Damage <> 0) then
+    if (Gear^.Health = 0) or (HHGear^.Damage <> 0) or ((HHGear^.Message and gmAttack) <> 0) then
         begin
+        HHGear^.Message:= HHGear^.Message and not gmAttack;
         DeleteGear(Gear);
         AfterAttack
         end
@@ -4433,7 +4445,7 @@
     HHGear: PGear;
 begin
     HHGear := Gear^.Hedgehog^.Gear;
-    HHGear^.Message := HHGear^.Message and not (gmUp or gmDown or gmLeft or gmRight);
+    HHGear^.Message := HHGear^.Message and not (gmUp or gmDown or gmLeft or gmRight or gmAttack);
     HHGear^.State := HHGear^.State or gstNotKickable;
     Gear^.doStep := @doStepLandGunWork
 end;
--- a/hedgewars/uGearsRender.pas	Sat Mar 19 17:49:27 2011 -0400
+++ b/hedgewars/uGearsRender.pas	Sat Mar 19 19:41:59 2011 -0400
@@ -489,7 +489,9 @@
                     DrawRotatedF(sprHandFlamethrower, hx, hy, (RealTicks div 125) mod 4, sign, aangle);
                     if CurAmmoGear^.Tex <> nil then DrawCentered(sx, sy - 40, CurAmmoGear^.Tex)
                     end;
-                gtLandGun: DrawRotated(sprHandBallgun, hx, hy, sign, aangle);
+                gtLandGun: begin DrawRotated(sprHandBallgun, hx, hy, sign, aangle);
+                    if CurAmmoGear^.Tex <> nil then DrawCentered(sx, sy - 40, CurAmmoGear^.Tex)
+                    end;
             end;
 
             case CurAmmoGear^.Kind of
@@ -1040,7 +1042,9 @@
                         //DrawRotatedTextureF(SpritesData[sprSnowBall].Texture, 1, 0, 0, x, y, 0, 1, 8, 8, Gear^.DirAngle)
                         begin
                         Tint(cExplosionBorderColor);
-                        DrawRotated(sprSnow, x, y, 0, Gear^.DirAngle);
+                        //DrawRotated(sprSnow, x, y, 0, Gear^.DirAngle);
+                        // Needs a nicer white texture to tint
+                        DrawTexture(x, y, SpritesData[sprVampiric].Texture, 0.1);
                         Tint($FF, $FF, $FF, $FF);
                         end
                     else if not isInLag then
--- a/hedgewars/uVariables.pas	Sat Mar 19 17:49:27 2011 -0400
+++ b/hedgewars/uVariables.pas	Sat Mar 19 19:41:59 2011 -0400
@@ -2008,7 +2008,9 @@
             NameTex: nil;
             Probability: 0;
             NumberInCase: 1;
-            Ammo: (Propz: ammoprop_Power or ammoprop_AltUse;
+            Ammo: (Propz: ammoprop_Power or 
+                          ammoprop_AltUse or
+                          ammoprop_NoRoundEnd;
                 Count: 2;
                 NumPerTurn: 0;
                 Timer: 0;
@@ -2086,7 +2088,8 @@
             NameTex: nil;
             Probability: 20;
             NumberInCase: 1;
-            Ammo: (Propz:  ammoprop_ForwMsgs or ammoprop_DontHold;
+            Ammo: (Propz: ammoprop_NoRoundEnd or
+                          ammoprop_Utility;
                 Count: 1;
                 NumPerTurn: 0;
                 Timer: 5001;
--- a/share/hedgewars/Data/Locale/en.txt	Sat Mar 19 17:49:27 2011 -0400
+++ b/share/hedgewars/Data/Locale/en.txt	Sat Mar 19 19:41:59 2011 -0400
@@ -55,7 +55,7 @@
 00:52=No weapon selected
 00:53=TARDIS
 00:54=Structure
-00:55=Land Gun
+00:55=Land Spray
 
 01:00=Let's fight!
 01:01=Round draw