Avoid promoting violence to hedgehogs. At least once a year.
authornemo
Sat, 22 Nov 2014 10:22:07 -0500
changeset 10526 b43d175d1577
parent 10525 019b4fbb21d4
child 10527 285b428f391c
Avoid promoting violence to hedgehogs. At least once a year.
hedgewars/uGearsRender.pas
hedgewars/uGearsUtils.pas
hedgewars/uStore.pas
hedgewars/uVariables.pas
hedgewars/uVisualGearsHandlers.pas
--- a/hedgewars/uGearsRender.pas	Sat Nov 22 04:15:16 2014 +0100
+++ b/hedgewars/uGearsRender.pas	Sat Nov 22 10:22:07 2014 -0500
@@ -797,13 +797,17 @@
         if (Gear^.Damage > 0) and (HH^.Effects[heFrozen] = 0)
         and (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) > _0_003) then
             begin
-            DrawHedgehog(sx, sy,
-                sign,
-                2,
-                1,
-                Gear^.DirAngle);
-            defaultPos:= false
-            end else
+            defaultPos:= false;
+                DrawHedgehog(sx, sy,
+                    sign,
+                    2,
+                    1,
+                    Gear^.DirAngle);
+            if AprilOne and (curhat <> nil) then
+                DrawTextureRotatedF(curhat, 1.0, -1.0, 0, sx, sy, 18, sign, 32, 32,
+                    sign*Gear^.DirAngle)
+            end;
+            
 
         if ((Gear^.State and gstHHJumping) <> 0) then
             begin
--- a/hedgewars/uGearsUtils.pas	Sat Nov 22 04:15:16 2014 +0100
+++ b/hedgewars/uGearsUtils.pas	Sat Nov 22 10:22:07 2014 -0500
@@ -205,7 +205,7 @@
    (Gear^.Hedgehog^.King or (Gear^.Hedgehog^.Effects[heFrozen] > 0)) then
     ModifyDamage:= hwRound(cDamageModifier * dmg * i * cDamagePercent * _0_5 * _0_01)
 else
-    ModifyDamage:= hwRound(cDamageModifier * dmg * i * cDamagePercent * _0_01)
+    ModifyDamage:= hwRound(cDamageModifier * dmg * i * cDamagePercent * _0_01);
 end;
 
 procedure ApplyDamage(Gear: PGear; AttackerHog: PHedgehog; Damage: Longword; Source: TDamageSource);
@@ -262,6 +262,27 @@
             end;
         uStats.HedgehogDamaged(Gear, AttackerHog, Damage, false);
         end;
+
+	if AprilOne and (Gear^.Hedgehog^.Hat = 'fr_tomato') and (Damage > 2) then
+	    for i := 0 to random(min(Damage,20))+5 do
+		begin
+		vg:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtStraightShot);
+		if vg <> nil then
+		    with vg^ do
+			begin
+			dx:= 0.001 * (random(100)+10);
+			dy:= 0.001 * (random(100)+10);
+			tdy:= -cGravityf;
+			if random(2) = 0 then
+			    dx := -dx;
+			//if random(2) = 0 then
+			//    dy := -dy;
+			FrameTicks:= random(500) + 1000;
+			State:= ord(sprBubbles);
+			//Tint:= $bd2f03ff
+			Tint:= $ff0000ff
+			end
+	end
     end else
     //else if Gear^.Kind <> gtStructure then // not gtHedgehog nor gtStructure
         Gear^.Hedgehog:= AttackerHog;
@@ -283,6 +304,7 @@
 procedure HHHurt(Hedgehog: PHedgehog; Source: TDamageSource);
 begin
 if Hedgehog^.Effects[heFrozen] <> 0 then exit;
+
 if (Source = dsFall) or (Source = dsExplosion) then
     case random(3) of
         0: PlaySoundV(sndOoff1, Hedgehog^.Team^.voicepack);
--- a/hedgewars/uStore.pas	Sat Nov 22 04:15:16 2014 +0100
+++ b/hedgewars/uStore.pas	Sat Nov 22 10:22:07 2014 -0500
@@ -273,6 +273,11 @@
                         else if (month = 10) and (md = 31) then
                             Hat := 'fr_pumpkin'; // Halloween/Hedgewars' birthday
                         end;
+                    if (month = 4) and (md = 1) then
+                        begin
+                        AprilOne:= true;
+                        Hat := 'fr_tomato'; // avoid promoting violence to hedgehogs. see http://hedgewars.org/node/5818
+                        end;
 
                     if Hat <> 'NoHat' then
                         begin
--- a/hedgewars/uVariables.pas	Sat Nov 22 04:15:16 2014 +0100
+++ b/hedgewars/uVariables.pas	Sat Nov 22 10:22:07 2014 -0500
@@ -37,6 +37,7 @@
     cNewScreenHeight   : LongInt;
     cScreenResizeDelay : LongWord;
     ipcPort            : Word;
+    AprilOne           : boolean;
     cFullScreen        : boolean;
     cLocaleFName       : shortstring;
     cLocale            : shortstring;
@@ -2651,6 +2652,7 @@
     LocalMessage:= 0;
 
     cViewLimitsDebug:= false;
+    AprilOne := false;
 end;
 
 procedure freeModule;
--- a/hedgewars/uVisualGearsHandlers.pas	Sat Nov 22 04:15:16 2014 +0100
+++ b/hedgewars/uVisualGearsHandlers.pas	Sat Nov 22 10:22:07 2014 -0500
@@ -887,6 +887,9 @@
 Gear^.X:= Gear^.X + Gear^.dX * Steps;
 Gear^.Y:= Gear^.Y - Gear^.dY * Steps;
 
+Gear^.dY:= Gear^.dY + Gear^.tdY * Steps;
+Gear^.dX:= Gear^.dX + Gear^.tdX * Steps;
+
 if Gear^.FrameTicks <= Steps then
     DeleteVisualGear(Gear)
 else