Start implementing waves
authorunc0rr
Thu, 26 Jun 2008 19:39:26 +0000
changeset 1033 622c5de38d72
parent 1032 bf6f5122baf7
child 1034 05f003ad3caa
Start implementing waves
hedgewars/HHHandlers.inc
hedgewars/uChat.pas
hedgewars/uConsts.pas
hedgewars/uGears.pas
share/hedgewars/Data/Graphics/Hedgehog/Kowtow.png
--- a/hedgewars/HHHandlers.inc	Wed Jun 25 15:10:12 2008 +0000
+++ b/hedgewars/HHHandlers.inc	Thu Jun 26 19:39:26 2008 +0000
@@ -276,6 +276,15 @@
           exit
           end;
 
+	if ((Gear^.Message and gm_Animate) <> 0) then
+		begin
+		Gear^.Message:= 0;
+		Gear^.State:= Gear^.State or gstAnimation;
+		Gear^.Tag:= Gear^.MsgParam;
+		Gear^.Timer:= 0;
+		Gear^.Pos:= 0
+		end;
+
    if ((Gear^.Message and gm_LJump ) <> 0) then
       begin
       Gear^.Message:= Gear^.Message and not gm_LJump;
@@ -471,6 +480,21 @@
 else
    Gear^.Message:= 0;
 
+if (Gear^.State and gstAnimation) <> 0 then
+	begin
+	Gear^.Message:= 0;
+	inc(Gear^.Timer);
+	if Gear^.Timer = 125 then
+		begin
+		Gear^.Timer:= 0;
+		inc(Gear^.Pos);
+		if Gear^.Pos = 12 then
+			Gear^.State:= Gear^.State and not gstAnimation
+		end;
+	exit
+	end;
+
+
 if (TurnTimeLeft = 0) or (Gear^.Damage > 0) then
    begin
    TurnTimeLeft:= 0;
@@ -554,11 +578,11 @@
    exit
    end;
 
-   if not isInMultiShoot then
-      begin
-      if StepTicks > 0 then dec(StepTicks);
-      if (StepTicks = 0) then HedgehogStep(Gear)
-      end
+	if not isInMultiShoot then
+		begin
+		if StepTicks > 0 then dec(StepTicks);
+		if (StepTicks = 0) then HedgehogStep(Gear)
+		end
 end;
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -589,10 +613,10 @@
 	exit
 	end;
 
-if ((Gear^.State and gstAnimation) = 0) and
+if ((Gear^.State and gstWait) = 0) and
 	(prevState <> Gear^.State) then
 	begin
-	Gear^.State:= gstAnimation;
+	Gear^.State:= gstWait;
 	Gear^.Timer:= 150
 	end else
 	begin
--- a/hedgewars/uChat.pas	Wed Jun 25 15:10:12 2008 +0000
+++ b/hedgewars/uChat.pas	Thu Jun 26 19:39:26 2008 +0000
@@ -28,7 +28,7 @@
 	showAll: boolean = false;
 
 implementation
-uses uMisc, uStore, uConsts, SDLh, uConsole, uKeys;
+uses uMisc, uStore, uConsts, SDLh, uConsole, uKeys, uGears, uTeams;
 
 const MaxStrIndex = 27;
 
@@ -117,6 +117,18 @@
 	DrawTexture(8, visibleCount * 16 + 10, InputStr.Tex);
 end;
 
+procedure AcceptChatString(s: shortstring);
+begin
+if (s = '/rollup') and not CurrentTeam^.ExtDriven then
+	with CurrentHedgehog^.Gear^ do
+		begin
+		Message:= Message or gm_Animate;
+		MsgParam:= Longword(sprKowtow)
+		end
+else
+	ParseCommand('/say ' + s, true);
+end;
+
 procedure KeyPressChat(Key: Longword);
 const firstByteMark: array[1..4] of byte = (0, $C0, $E0, $F0);
 var i, btw: integer;
@@ -133,7 +145,7 @@
 		13, 271: begin
 			if Length(InputStr.s) > 0 then
 				begin
-				ParseCommand('/say ' + InputStr.s, true);
+				AcceptChatString(InputStr.s);
 				SetLine(InputStr, '', false)
 				end;
 			FreezeEnterKey;
--- a/hedgewars/uConsts.pas	Wed Jun 25 15:10:12 2008 +0000
+++ b/hedgewars/uConsts.pas	Thu Jun 26 19:39:26 2008 +0000
@@ -45,7 +45,7 @@
                    sprHandDEagle, sprHandAirAttack, sprHandBaseball, sprPHammer,
                    sprHandBlowTorch, sprBlowTorch, sprTeleport, sprHHDeath,
                    sprShotgun, sprDEagle, sprHHIdle, sprMortar, sprTurnsLeft,
-                   sprHat, sprKamikaze, sprWhip);
+                   sprHat, sprKamikaze, sprWhip, sprKowtow);
 
      TGearType  = (gtAmmo_Bomb, gtHedgehog, gtAmmo_Grenade, gtHealthTag,
                    gtGrave, gtUFO, gtShotgunShot, gtPickHammer, gtRope,
@@ -117,150 +117,152 @@
       msgGettingConfig     = 'Getting game config...';
 
 const
-      cMaxPower     = 1500;
-      cMaxAngle     = 2048;
-      cPowerDivisor = 1500;
+	cMaxPower     = 1500;
+	cMaxAngle     = 2048;
+	cPowerDivisor = 1500;
 
-      MAXNAMELEN = 32;
+	MAXNAMELEN = 32;
 
-      COLOR_LAND = $00FFFFFF;
+	COLOR_LAND = $00FFFFFF;
 
-      cifRandomize = $00000001;
-      cifTheme     = $00000002;
-      cifMap       = $00000002; // either theme or map (or map+theme)
-      cifAllInited = cifRandomize or
-                     cifTheme or
-                     cifMap;
+	cifRandomize = $00000001;
+	cifTheme     = $00000002;
+	cifMap       = $00000002; // either theme or map (or map+theme)
+	cifAllInited = cifRandomize or
+					cifTheme or
+					cifMap;
 
-      cTransparentColor: Longword = $000000;
+	cTransparentColor: Longword = $000000;
 
-      cMaxTeams        = 6;
-      cMaxHHIndex      = 7;
-      cMaxHHs          = 30;
-      cMaxSpawnPoints  = 1024;
+	cMaxTeams        = 6;
+	cMaxHHIndex      = 7;
+	cMaxHHs          = 30;
+	cMaxSpawnPoints  = 1024;
 
-      cMaxEdgePoints = 16384;
+	cMaxEdgePoints = 16384;
 
-      cHHRadius = 9;
-      cHHStepTicks = 38;
+	cHHRadius = 9;
+	cHHStepTicks = 38;
 
-      cHHZ = 1000;
-      cCurrHHZ = Succ(cHHZ);
+	cHHZ = 1000;
+	cCurrHHZ = Succ(cHHZ);
 
-      cShotgunRadius = 22;
-      cBlowTorchC    = 6;
+	cShotgunRadius = 22;
+	cBlowTorchC    = 6;
 
-      cKeyMaxIndex = 1023;
+	cKeyMaxIndex = 1023;
 
-      cMaxCaptions = 4;
+	cMaxCaptions = 4;
 
-      gfForts       = $00000001;
-      gfMultiWeapon = $00000002;
-      gfSolidLand   = $00000004;
-      gfOneClanMode = $10000000;
+	gfForts       = $00000001;
+	gfMultiWeapon = $00000002;
+	gfSolidLand   = $00000004;
+	gfOneClanMode = $10000000;
 
-      gstDrowning       = $00000001;
-      gstHHDriven       = $00000002;
-      gstMoving         = $00000004;
-      gstAttacked       = $00000008;
-      gstAttacking      = $00000010;
-      gstCollision      = $00000020;
-      gstHHChooseTarget = $00000040;
-      gstHHJumping      = $00000100;
-      gsttmpFlag        = $00000200;
-      gstHHThinking     = $00000800;
-      gstNoDamage       = $00001000;
-      gstHHHJump        = $00002000;
-      gstAnimation      = $00004000;
-      gstHHDeath        = $00008000;
-      gstWinner         = $00010000;
+	gstDrowning       = $00000001;
+	gstHHDriven       = $00000002;
+	gstMoving         = $00000004;
+	gstAttacked       = $00000008;
+	gstAttacking      = $00000010;
+	gstCollision      = $00000020;
+	gstHHChooseTarget = $00000040;
+	gstHHJumping      = $00000100;
+	gsttmpFlag        = $00000200;
+	gstHHThinking     = $00000800;
+	gstNoDamage       = $00001000;
+	gstHHHJump        = $00002000;
+	gstAnimation      = $00004000;
+	gstHHDeath        = $00008000;
+	gstWinner         = $00010000;
+	gstWait           = $00020000;
 
-      gm_Left   = $00000001;
-      gm_Right  = $00000002;
-      gm_Up     = $00000004;
-      gm_Down   = $00000008;
-      gm_Switch = $00000010;
-      gm_Attack = $00000020;
-      gm_LJump  = $00000040;
-      gm_HJump  = $00000080;
-      gm_Destroy= $00000100;
-      gm_Slot   = $00000200; // with param
-      gm_Weapon = $00000400; // with param
-      gm_Timer  = $00000800; // with param
-      gmAllStoppable = gm_Left or gm_Right or gm_Up or gm_Down or gm_Attack;
+	gm_Left   = $00000001;
+	gm_Right  = $00000002;
+	gm_Up     = $00000004;
+	gm_Down   = $00000008;
+	gm_Switch = $00000010;
+	gm_Attack = $00000020;
+	gm_LJump  = $00000040;
+	gm_HJump  = $00000080;
+	gm_Destroy= $00000100;
+	gm_Slot   = $00000200; // with param
+	gm_Weapon = $00000400; // with param
+	gm_Timer  = $00000800; // with param
+	gm_Animate= $00001000; // with param
+	gmAllStoppable = gm_Left or gm_Right or gm_Up or gm_Down or gm_Attack;
 
-      cMaxSlotIndex       = 8;
-      cMaxSlotAmmoIndex   = 3;
+	cMaxSlotIndex       = 8;
+	cMaxSlotAmmoIndex   = 3;
 
-      ammoprop_Timerable    = $00000001;
-      ammoprop_Power        = $00000002;
-      ammoprop_NeedTarget   = $00000004;
-      ammoprop_ForwMsgs     = $00000008;
-      ammoprop_AttackInMove = $00000010;
-      ammoprop_NoCrosshair  = $00000040;
-      ammoprop_AttackingPut = $00000080;
-      ammoprop_DontHold     = $00000100;
-      ammoprop_AltAttack    = $00000200;
-      ammoprop_AltUse       = $00000400;
+	ammoprop_Timerable    = $00000001;
+	ammoprop_Power        = $00000002;
+	ammoprop_NeedTarget   = $00000004;
+	ammoprop_ForwMsgs     = $00000008;
+	ammoprop_AttackInMove = $00000010;
+	ammoprop_NoCrosshair  = $00000040;
+	ammoprop_AttackingPut = $00000080;
+	ammoprop_DontHold     = $00000100;
+	ammoprop_AltAttack    = $00000200;
+	ammoprop_AltUse       = $00000400;
 
-      AMMO_INFINITE = 9;
+	AMMO_INFINITE = 9;
 
-      EXPLAllDamageInRadius = $00000001;
-      EXPLAutoSound         = $00000002;
-      EXPLNoDamage          = $00000004;
-      EXPLDoNotTouchHH      = $00000008;
-      EXPLDontDraw          = $00000010;
+	EXPLAllDamageInRadius = $00000001;
+	EXPLAutoSound         = $00000002;
+	EXPLNoDamage          = $00000004;
+	EXPLDoNotTouchHH      = $00000008;
+	EXPLDontDraw          = $00000010;
 
-      posCaseAmmo    = $00000001;
-      posCaseHealth  = $00000002;
+	posCaseAmmo    = $00000001;
+	posCaseHealth  = $00000002;
 
-      NoPointX = Low(LongInt);
+	NoPointX = Low(LongInt);
 
-      cHHFileName   = 'Hedgehog';
-      cCHFileName   = 'Crosshair';
-      cThemeCFGFilename = 'theme.cfg';
+	cHHFileName   = 'Hedgehog';
+	cCHFileName   = 'Crosshair';
+	cThemeCFGFilename = 'theme.cfg';
 
-      Fontz: array[THWFont] of THHFont = (
-                                         (Handle: nil;
-                                          Height: 12;
-                                          style: TTF_STYLE_NORMAL;
-                                          Name: 'DejaVuSans.ttf'),
-                                         (Handle: nil;
-                                          Height: 24;
-                                          style: TTF_STYLE_NORMAL;
-                                          Name: 'DejaVuSans.ttf'),
-                                         (Handle: nil;
-                                          Height: 10;
-                                          style: TTF_STYLE_NORMAL;
-                                          Name: 'DejaVuSans.ttf')
-                                         );
+	Fontz: array[THWFont] of THHFont = (
+			(Handle: nil;
+			Height: 12;
+			style: TTF_STYLE_NORMAL;
+			Name: 'DejaVuSans.ttf'),
+			(Handle: nil;
+			Height: 24;
+			style: TTF_STYLE_NORMAL;
+			Name: 'DejaVuSans.ttf'),
+			(Handle: nil;
+			Height: 10;
+			style: TTF_STYLE_NORMAL;
+			Name: 'DejaVuSans.ttf')
+			);
 
-      FontBorder = 2;
+	FontBorder = 2;
 
-      PathPrefix: string = './';
-      Pathz: array[TPathType] of string      = (
-                                               '',                              // ptNone
-                                               '',                              // ptData
-                                               'Graphics',                      // ptGraphics
-                                               'Themes',                        // ptThemes
-                                               'Themes/avematan',               // ptCurrTheme
-                                               'Teams',                         // ptTeams
-                                               'Maps',                          // ptMaps
-                                               '',                              // ptMapCurrent
-                                               'Demos',                         // ptDemos
-                                               'Sounds',                        // ptSounds
-                                               'Graphics/Graves',               // ptGraves
-                                               'Fonts',                         // ptFonts
-                                               'Forts',                         // ptForts
-                                               'Locale',                        // ptLocale
-                                               'Graphics/AmmoMenu',             // ptAmmoMenu
-                                               'Graphics/Hedgehog',             // ptHedgehog
-                                               'Sounds/voices',                 // ptVoices
-                                               'Graphics/Hats'                  // ptHats
-                                               );
+	PathPrefix: string = './';
+	Pathz: array[TPathType] of String = (
+			'',                              // ptNone
+			'',                              // ptData
+			'Graphics',                      // ptGraphics
+			'Themes',                        // ptThemes
+			'Themes/avematan',               // ptCurrTheme
+			'Teams',                         // ptTeams
+			'Maps',                          // ptMaps
+			'',                              // ptMapCurrent
+			'Demos',                         // ptDemos
+			'Sounds',                        // ptSounds
+			'Graphics/Graves',               // ptGraves
+			'Fonts',                         // ptFonts
+			'Forts',                         // ptForts
+			'Locale',                        // ptLocale
+			'Graphics/AmmoMenu',             // ptAmmoMenu
+			'Graphics/Hedgehog',             // ptHedgehog
+			'Sounds/voices',                 // ptVoices
+			'Graphics/Hats'                  // ptHats
+			);
 
       SpritesData: array[TSprite] of record
-                     FileName: String[31];
+                     FileName: String[12];
                      Path, AltPath: TPathType;
                      Texture: PTexture;
                      Surface: PSDL_Surface;
@@ -269,7 +271,7 @@
                      end = (
                      (FileName:  'BlueWater'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
                       Width: 256; Height: 32; saveSurf: false),// sprWater
-                     (FileName: 'Clouds'; Path: ptCurrTheme;AltPath: ptGraphics; Texture: nil; Surface: nil;
+                     (FileName:     'Clouds'; Path: ptCurrTheme;AltPath: ptGraphics; Texture: nil; Surface: nil;
                       Width: 256; Height:128; saveSurf: false),// sprCloud
                      (FileName:       'Bomb'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
                       Width:   8; Height:  8; saveSurf: false),// sprBomb
@@ -396,11 +398,13 @@
                      (FileName: 'amKamikaze'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
                       Width: 256; Height: 32; saveSurf: false),// sprKamikaze
                      (FileName:     'amWhip'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
-                      Width: 128; Height: 32; saveSurf: false) // sprWhip
+                      Width: 128; Height: 32; saveSurf: false),// sprWhip
+                     (FileName:     'Kowtow'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
+                      Width:  32; Height: 32; saveSurf: false) // sprWhip
                      );
 
       Soundz: array[TSound] of record
-                FileName: String[31];
+                FileName: String[19];
                 Path    : TPathType;
                 id      : PMixChunk;
                 lastChan: LongInt;
--- a/hedgewars/uGears.pas	Wed Jun 25 15:10:12 2008 +0000
+++ b/hedgewars/uGears.pas	Thu Jun 26 19:39:26 2008 +0000
@@ -654,6 +654,17 @@
 		end
 	else
 
+	if ((Gear^.State and gstAnimation) <> 0) then
+		begin
+		DrawRotatedF(TSprite(Gear^.Tag),
+				hwRound(Gear^.X) + 1 + WorldDx,
+				hwRound(Gear^.Y) - 3 + WorldDy,
+				Gear^.Pos,
+				hwSign(Gear^.dX),
+				0.0);
+		defaultPos:= false
+		end
+	else
 	if ((Gear^.State and gstAttacked) = 0) then
 	begin
 		amt:= CurrentHedgehog^.Ammo^[CurrentHedgehog^.CurSlot, CurrentHedgehog^.CurAmmo].AmmoType;
@@ -790,7 +801,7 @@
 			if (Gear^.State and gstHHThinking) <> 0 then
 				DrawSprite(sprQuestion, hwRound(Gear^.X) - 10 + WorldDx, hwRound(Gear^.Y) - cHHRadius - 34 + WorldDy, 0)
 				else
-				if ShowCrosshair and ((Gear^.State and gstAttacked) = 0) then
+				if ShowCrosshair and ((Gear^.State and (gstAttacked or gstAnimation)) = 0) then
 					begin
 					if ((Gear^.State and gstHHHJump) <> 0) then m:= -1 else m:= 1;
 					DrawRotatedTex(Team^.CrosshairTex,
Binary file share/hedgewars/Data/Graphics/Hedgehog/Kowtow.png has changed