Seduction animation
authorunc0rr
Tue, 23 Sep 2008 06:27:53 +0000
changeset 1286 a02a5345b91e
parent 1285 993845ea5c8d
child 1287 4a0cbcbe3521
Seduction animation
hedgewars/GSHandlers.inc
hedgewars/HHHandlers.inc
hedgewars/uConsts.pas
hedgewars/uGears.pas
share/hedgewars/Data/Graphics/Censored.png
share/hedgewars/Data/Graphics/HHDress.png
--- a/hedgewars/GSHandlers.inc	Tue Sep 23 06:09:13 2008 +0000
+++ b/hedgewars/GSHandlers.inc	Tue Sep 23 06:27:53 2008 +0000
@@ -1711,19 +1711,37 @@
 		begin
 		Gear^.dX.isNegative:= not Gear^.dX.isNegative;
 		Gear^.dY.isNegative:= not Gear^.dY.isNegative;
-		Gear^.dY:= Gear^.dY - _0_2;
+		Gear^.dX:= Gear^.dX * _1_5;
+		Gear^.dY:= Gear^.dY * _1_5 - _0_3;
 		AmmoShove(Gear, 0, 40);
+		AfterAttack;
 		DeleteGear(Gear)
 		end
 	else
 else
+	begin
+	AfterAttack;
 	DeleteGear(Gear)
+	end
+end;
+
+procedure doStepSeductionWear(Gear: PGear);
+begin
+AllInactive:= false;
+inc(Gear^.Timer);
+if Gear^.Timer > 250 then
+	begin
+	Gear^.Timer:= 0;
+	inc(Gear^.Pos)
+	end;
+	
+if Gear^.Pos = 8 then
+	Gear^.doStep:= @doStepSeductionWork
 end;
 
 procedure doStepSeduction(Gear: PGear);
-var x, y: LongInt;
 begin
 AllInactive:= false;
 DeleteCI(PHedgehog(Gear^.Hedgehog)^.Gear);
-Gear^.doStep:= @doStepSeductionWork
+Gear^.doStep:= @doStepSeductionWear
 end;
--- a/hedgewars/HHHandlers.inc	Tue Sep 23 06:09:13 2008 +0000
+++ b/hedgewars/HHHandlers.inc	Tue Sep 23 06:27:53 2008 +0000
@@ -166,7 +166,7 @@
                                  CurAmmoGear:= AddGear(hwRound(X) + hwSign(dX) * 3, hwRound(Y), gtCake, 0, xx, _0, 0);
                                  PlaySound(sndLaugh, false)
                                  end;
-                    amSeduction: FollowGear:= AddGear(hwRound(X + xx * cHHRadius * 2), hwRound(Y + yy * cHHRadius * 2), gtSeduction, 0, xx * _0_4, yy * _0_4, 0);
+                    amSeduction: CurAmmoGear:= AddGear(hwRound(X + xx * cHHRadius * 2), hwRound(Y + yy * cHHRadius * 2), gtSeduction, 0, xx * _0_4, yy * _0_4, 0);
                    amWatermelon: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtWatermelon,  0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, Ammo^[CurSlot, CurAmmo].Timer);
                   amHellishBomb: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtHellishBomb,    0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 5000);
                   end;
@@ -192,19 +192,19 @@
 procedure AfterAttack;
 begin
 with CurrentHedgehog^.Gear^,
-     CurrentHedgehog^ do
-     begin
-        Inc(AttacksNum);
-        State:= State and not gstAttacking;
-        if (Ammo^[CurSlot, CurAmmo].NumPerTurn >= AttacksNum) or
-           ((GameFlags and gfMultiWeapon) <> 0) then isInMultiShoot:= true
-           else begin
-           TurnTimeLeft:= Ammoz[Ammo^[CurSlot, CurAmmo].AmmoType].TimeAfterTurn;
-           State:= State or gstAttacked;
-           OnUsedAmmo(CurrentHedgehog^)
-           end;
-     AttackBar:= 0;
-     end
+		CurrentHedgehog^ do
+	begin
+		Inc(AttacksNum);
+		State:= State and not gstAttacking;
+		if (Ammo^[CurSlot, CurAmmo].NumPerTurn >= AttacksNum) or
+		((GameFlags and gfMultiWeapon) <> 0) then isInMultiShoot:= true
+		else begin
+		TurnTimeLeft:= Ammoz[Ammo^[CurSlot, CurAmmo].AmmoType].TimeAfterTurn;
+		State:= State or gstAttacked;
+		OnUsedAmmo(CurrentHedgehog^)
+		end;
+	AttackBar:= 0;
+	end
 end;
 
 ////////////////////////////////////////////////////////////////////////////////
--- a/hedgewars/uConsts.pas	Tue Sep 23 06:09:13 2008 +0000
+++ b/hedgewars/uConsts.pas	Tue Sep 23 06:27:53 2008 +0000
@@ -48,7 +48,8 @@
 			sprKamikaze, sprWhip, sprKowtow, sprSad, sprWave,
 			sprHurrah, sprLemonade, sprExplPart, sprExplPart2,
 			sprCakeWalk, sprCakeDown, sprAMAmmosBW, sprWatermelon,
-			sprEvilTrace, sprHellishBomb, sprSeduction);
+			sprEvilTrace, sprHellishBomb, sprSeduction, sprDress,
+			sprCensored);
 
 	TGearType = (gtAmmo_Bomb, gtHedgehog, gtAmmo_Grenade, gtHealthTag,
 			gtGrave, gtUFO, gtShotgunShot, gtPickHammer, gtRope,
@@ -437,7 +438,11 @@
 			(FileName:'HellishBomb'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
 			Width:  16; Height: 16; saveSurf: false),// sprHellishBomb
 			(FileName:  'Seduction'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
-			Width:  32; Height: 32; saveSurf: false) // sprSeduction
+			Width:  32; Height: 32; saveSurf: false),// sprSeduction
+			(FileName:    'HHDress'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
+			Width:  64; Height: 64; saveSurf: false),// sprDress
+			(FileName:   'Censored'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
+			Width:  64; Height: 16; saveSurf: false) // sprCensored
 			);
 
 	Wavez: array [TWave] of record
--- a/hedgewars/uGears.pas	Tue Sep 23 06:09:13 2008 +0000
+++ b/hedgewars/uGears.pas	Tue Sep 23 06:27:53 2008 +0000
@@ -702,22 +702,41 @@
 				defaultPos:= false
 				end;
 			gtKamikaze: begin
-						if CurAmmoGear^.Pos = 0 then
-							DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy,
-									hwSign(Gear^.dX),
-									1,
-									6,
-									0)
-						else
-							DrawRotatedF(sprKamikaze,
-									hwRound(Gear^.X) + WorldDx,
-									hwRound(Gear^.Y) + WorldDy,
-									CurAmmoGear^.Pos - 1,
-									1,
-									DxDy2Angle(Gear^.dY, Gear^.dX));
+				if CurAmmoGear^.Pos = 0 then
+					DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy,
+							hwSign(Gear^.dX),
+							1,
+							6,
+							0)
+				else
+					DrawRotatedF(sprKamikaze,
+							hwRound(Gear^.X) + WorldDx,
+							hwRound(Gear^.Y) + WorldDy,
+							CurAmmoGear^.Pos - 1,
+							1,
+							DxDy2Angle(Gear^.dY, Gear^.dX));
 
-						defaultPos:= false
-						end;
+				defaultPos:= false
+				end;
+			gtSeduction: begin
+				if CurAmmoGear^.Pos >= 6 then
+					DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy,
+							hwSign(Gear^.dX),
+							2,
+							2,
+							0)
+				else
+					begin
+					DrawRotatedF(sprDress,
+							hwRound(Gear^.X) + WorldDx,
+							hwRound(Gear^.Y) + WorldDy,
+							CurAmmoGear^.Pos,
+							hwSign(Gear^.dX),
+							0);
+					DrawSprite(sprCensored, hwRound(Gear^.X) - 32 + WorldDx, hwRound(Gear^.Y) - 20 + WorldDy, 0)
+					end;
+				defaultPos:= false
+				end;
 		end;
 
 		case CurAmmoGear^.Kind of
@@ -811,11 +830,6 @@
 						0,
 						hwSign(Gear^.dX),
 						0);
-			amSeduction: DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy,
-						hwSign(Gear^.dX),
-						2,
-						2,
-						0);
 		else
 			DrawHedgehog(hwRound(Gear^.X) + 1 + WorldDx, hwRound(Gear^.Y) - 3 + WorldDy,
 				hwSign(Gear^.dX),
@@ -1096,7 +1110,7 @@
                      DrawRotatedf(sprCakeWalk, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, (GameTicks div 40) mod 6, hwSign(Gear^.dX), Gear^.DirAngle + hwSign(Gear^.dX) * 90)
                   else
                      DrawRotatedf(sprCakeDown, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 5 - Gear^.Pos, hwSign(Gear^.dX), 0);
-       gtSeduction: DrawSprite(sprSeduction, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 16 + WorldDy, 0);
+       gtSeduction: if Gear^.Pos >= 6 then DrawSprite(sprSeduction, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 16 + WorldDy, 0);
       gtWatermelon: DrawRotatedf(sprWatermelon, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, 0, Gear^.DirAngle);
       gtMelonPiece: DrawRotatedf(sprWatermelon, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 1, 0, Gear^.DirAngle);
      gtHellishBomb: DrawRotated(sprHellishBomb, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle);
@@ -1191,33 +1205,33 @@
 Gear^.Radius:= cShotgunRadius;
 t:= GearsList;
 while t <> nil do
-    begin
-    dmg:= min(Gear^.Radius + t^.Radius - hwRound(Distance(Gear^.X - t^.X, Gear^.Y - t^.Y)), 25);
-    if dmg > 0 then
-       case t^.Kind of
-           gtHedgehog,
-               gtMine,
-               gtCase,
-             gtTarget: begin
-                       inc(t^.Damage, dmg);
+	begin
+	dmg:= min(Gear^.Radius + t^.Radius - hwRound(Distance(Gear^.X - t^.X, Gear^.Y - t^.Y)), 25);
+	if dmg > 0 then
+	case t^.Kind of
+		gtHedgehog,
+			gtMine,
+			gtCase,
+			gtTarget: begin
+					inc(t^.Damage, dmg);
 
-                       if t^.Kind = gtHedgehog then
-                          AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), dmg, t);
+					if t^.Kind = gtHedgehog then
+							AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y), dmg, t);
 
-                       DeleteCI(t);
-                       t^.dX:= t^.dX + Gear^.dX * dmg * _0_01 + SignAs(cHHKick, Gear^.dX);
-                       t^.dY:= t^.dY + Gear^.dY * dmg * _0_01;
-                       t^.State:= t^.State or gstMoving;
-                       t^.Active:= true;
-                       FollowGear:= t
-                       end;
-              gtGrave: begin
-                       t^.dY:= - _0_1;
-                       t^.Active:= true
-                       end;
-           end;
-    t:= t^.NextGear
-    end;
+					DeleteCI(t);
+					t^.dX:= t^.dX + Gear^.dX * dmg * _0_01 + SignAs(cHHKick, Gear^.dX);
+					t^.dY:= t^.dY + Gear^.dY * dmg * _0_01;
+					t^.State:= t^.State or gstMoving;
+					t^.Active:= true;
+					FollowGear:= t
+					end;
+			gtGrave: begin
+					t^.dY:= - _0_1;
+					t^.Active:= true
+					end;
+		end;
+	t:= t^.NextGear
+	end;
 if (GameFlags and gfSolidLand) = 0 then DrawExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), cShotgunRadius)
 end;
 
Binary file share/hedgewars/Data/Graphics/Censored.png has changed
Binary file share/hedgewars/Data/Graphics/HHDress.png has changed