--- a/hedgewars/GSHandlers.inc Sat Mar 13 14:30:41 2010 +0000
+++ b/hedgewars/GSHandlers.inc Sun Mar 14 14:18:31 2010 +0000
@@ -2667,3 +2667,134 @@
end
end
end;
+
+////////////////////////////////////////////////////////////////////////////////
+procedure doStepBirdyVanish(Gear: PGear);
+begin
+Gear^.Pos:= 0;
+if Gear^.Timer < 500 then
+ inc(Gear^.Timer, 1)
+else
+ DeleteGear(Gear);
+end;
+
+////////////////////////////////////////////////////////////////////////////////
+procedure doStepBirdyFly(Gear: PGear);
+var HHGear: PGear;
+ fuel: LongInt;
+ move: hwFloat;
+begin
+HHGear:=PHedgehog(Gear^.Hedgehog)^.Gear;
+
+move:= _0_1;
+fuel:= 50;
+
+if Gear^.Pos > 0 then
+ dec(Gear^.Pos, 1)
+else if (HHGear^.Message and (gm_Left or gm_Right or gm_Up)) <> 0 then
+ Gear^.Pos:= 500;
+
+if HHGear^.dX.isNegative then
+ Gear^.Tag:= -1
+else
+ Gear^.Tag:= 1;
+
+if (HHGear^.Message and gm_Up) <> 0 then
+ begin
+ if (not HHGear^.dY.isNegative) or (HHGear^.Y > -_256) then
+ HHGear^.dY:= HHGear^.dY - move;
+ HHGear^.dY:= HHGear^.dY - move;
+ dec(Gear^.Health, fuel);
+ Gear^.MsgParam:= Gear^.MsgParam or gm_Up;
+ end;
+if (HHGear^.Message and gm_Left) <> 0 then move.isNegative:= true;
+if (HHGear^.Message and (gm_Left or gm_Right)) <> 0 then
+ begin
+ HHGear^.dX:= HHGear^.dX + (move * _0_2);
+ dec(Gear^.Health, fuel div 5);
+ Gear^.MsgParam:= Gear^.MsgParam or (HHGear^.Message and (gm_Left or gm_Right));
+ end;
+
+if Gear^.Health < 0 then Gear^.Health:= 0;
+if (GameTicks and $3F) = 0 then
+ begin
+ if Gear^.Tex <> nil then FreeTexture(Gear^.Tex);
+ Gear^.Tex:= RenderStringTex(trmsg[sidFuel] + ': ' + inttostr(round(Gear^.Health / 20)) + '%', cWhiteColor, fntSmall)
+ end;
+
+if HHGear^.Message and (gm_Attack or gm_Up or gm_Precise or gm_Left or gm_Right) <> 0 then Gear^.State:= Gear^.State and not gsttmpFlag;
+HHGear^.Message:= HHGear^.Message and not (gm_Up or gm_Precise or gm_Left or gm_Right);
+HHGear^.State:= HHGear^.State or gstMoving;
+
+Gear^.X:= HHGear^.X;
+Gear^.Y:= HHGear^.Y - int2hwFloat(32);
+// For some reason I need to reapply followgear here, something else grabs it otherwise.
+if not bShowAmmoMenu then FollowGear:= HHGear;
+
+if ((Gear^.State and gsttmpFlag) = 0) or (HHGear^.dY < _0) then doStepHedgehogMoving(HHGear);
+
+if (Gear^.Health = 0)
+ or (HHGear^.Damage <> 0)
+ or CheckGearDrowning(HHGear)
+ or (TurnTimeLeft = 0)
+ // allow brief ground touches - to be fair on this, might need another counter
+ or (((GameTicks and $1FF) = 0) and (not HHGear^.dY.isNegative) and TestCollisionYwithGear(HHGear, 1))
+ or ((Gear^.Message and gm_Attack) <> 0) then
+ begin
+ with HHGear^ do
+ begin
+ Message:= 0;
+ Active:= true;
+ State:= State or gstMoving
+ end;
+ Gear^.doStep:= @doStepBirdyVanish;
+ isCursorVisible:= false;
+ end
+end;
+
+////////////////////////////////////////////////////////////////////////////////
+procedure doStepBirdyDescend(Gear: PGear);
+var HHGear: PGear;
+begin
+HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear;
+AllInactive:= false;
+if Gear^.Timer > 0 then
+ dec(Gear^.Timer, 1)
+else if CurrentHedgehog = nil then
+ begin
+ Gear^.doStep:= @doStepBirdyVanish;
+ end;
+HHGear^.Message:= HHGear^.Message and not (gm_Up or gm_Precise or gm_Left or gm_Right);
+if abs(hwRound(HHGear^.Y - Gear^.Y)) > 32 then
+ begin
+ if Gear^.Pos = 0 then
+ Gear^.Y:= Gear^.Y + _0_1
+ end
+else
+ begin
+ Gear^.doStep:= @doStepBirdyFly;
+ HHGear^.dY:= -_0_2
+ end
+end;
+
+////////////////////////////////////////////////////////////////////////////////
+procedure doStepBirdy(Gear: PGear);
+var HHGear: PGear;
+begin
+Gear^.doStep:= @doStepBirdyDescend;
+HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear;
+if HHGear^.dX.isNegative then
+ Gear^.Tag:= -1
+else
+ Gear^.Tag:= 1;
+Gear^.Pos:= 0;
+AllInactive:= false;
+FollowGear:= HHGear;
+OnUsedAmmo(PHedgehog(HHGear^.Hedgehog)^);
+ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^);
+with HHGear^ do
+ begin
+ State:= State and not gstAttacking;
+ Message:= Message and not (gm_Attack or gm_Up or gm_Precise or gm_Left or gm_Right)
+ end
+end;
--- a/hedgewars/uConsts.pas Sat Mar 13 14:30:41 2010 +0000
+++ b/hedgewars/uConsts.pas Sun Mar 14 14:18:31 2010 +0000
@@ -73,7 +73,7 @@
sprShoutCorner, sprShoutEdge, sprShoutTail,
sprSniperRifle, sprBubbles, sprJetpack, sprHealth, sprHandMolotov, sprMolotov,
sprSmoke, sprSmokeWhite, sprShell, sprDust, sprExplosives, sprExplosivesRoll,
- sprAmTeleport, sprSplash, sprDroplet);
+ sprAmTeleport, sprSplash, sprDroplet, sprBirdy);
TGearType = (gtAmmo_Bomb, gtHedgehog, gtAmmo_Grenade, gtHealthTag, // 3
gtGrave, gtUFO, gtShotgunShot, gtPickHammer, gtRope, // 8
@@ -84,7 +84,7 @@
gtTeleport, gtSwitcher, gtTarget, gtMortar, // 31
gtWhip, gtKamikaze, gtCake, gtSeduction, gtWatermelon, gtMelonPiece, // 37
gtHellishBomb, gtEvilTrace, gtWaterUp, gtDrill, gtBallGun, gtBall,gtRCPlane,
- gtSniperRifleShot, gtJetpack, gtMolotov, gtExplosives);
+ gtSniperRifleShot, gtJetpack, gtMolotov, gtExplosives, gtBirdy);
TVisualGearType = (vgtFlake, vgtCloud, vgtExplPart, vgtExplPart2, vgtFire,
vgtSmallDamageTag, vgtTeamHealthSorter, vgtSpeechBubble, vgtBubble,
@@ -386,7 +386,6 @@
cTargetPointRef : TPoint = (X: NoPointX; Y: 0);
// hog tag mask
- // hog tag mask
htNone = $00;
htTeamName = $01;
htName = $02;
@@ -682,7 +681,9 @@
(FileName: 'Splash'; Path: ptCurrTheme; AltPath: ptGraphics; Texture: nil; Surface: nil;
Width: 128; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false), // sprSplash
(FileName: 'Droplet'; Path: ptCurrTheme; AltPath: ptGraphics; Texture: nil; Surface: nil;
- Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false) // sprDroplet
+ Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false), // sprDroplet
+ (FileName: 'Birdy'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
+ Width: 75; Height: 75; imageWidth: 0; imageHeight: 0; saveSurf: false)// sprBirdy
);
Wavez: array [TWave] of record
--- a/hedgewars/uGears.pas Sat Mar 13 14:30:41 2010 +0000
+++ b/hedgewars/uGears.pas Sun Mar 14 14:18:31 2010 +0000
@@ -181,7 +181,8 @@
@doStepSniperRifleShot,
@doStepJetpack,
@doStepMolotov,
- @doStepCase
+ @doStepCase,
+ @doStepBirdy
);
procedure InsertGearToList(Gear: PGear);
@@ -432,6 +433,11 @@
gtMolotov: begin
gear^.Radius:= 6;
end;
+ gtBirdy: begin
+ gear^.Radius:= 16; // todo: check
+ gear^.Timer:= 500;
+ gear^.Health:= 2000;
+ end;
end;
InsertGearToList(gear);
AddGear:= gear;
@@ -586,13 +592,9 @@
AllInactive:= true;
if (StepSoundTimer > 0) and (StepSoundChannel < 0) then
- begin
- WriteLnToConsole('playsteps ...');
StepSoundChannel:= LoopSound(sndSteps)
- end
else if (StepSoundTimer = 0) and (StepSoundChannel > -1) then
begin
- WriteLnToConsole('stopsteps ...');
StopSound(StepSoundChannel);
StepSoundChannel:= -1;
end;
@@ -1635,6 +1637,7 @@
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);
gtEvilTrace: if Gear^.State < 8 then DrawSprite(sprEvilTrace, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.State);
+ gtBirdy: DrawTextureF(SpritesData[sprBirdy].Texture, 1 - Gear^.Timer / 500, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, ((Gear^.Pos shr 6) or (RealTicks shr 8)) mod 2, Gear^.Tag, 75, 75);
end;
if Gear^.RenderTimer and (Gear^.Tex <> nil) then DrawCentered(hwRound(Gear^.X) + 8 + WorldDx, hwRound(Gear^.Y) + 8 + WorldDy, Gear^.Tex);
Gear:= Gear^.NextGear
Binary file share/hedgewars/Data/Graphics/Birdy.png has changed