--- a/hedgewars/GSHandlers.inc Sat Mar 27 17:03:27 2010 +0000
+++ b/hedgewars/GSHandlers.inc Sat Mar 27 17:22:33 2010 +0000
@@ -1359,7 +1359,7 @@
inc(Gear^.Damage, hwRound(Gear^.dY * -_50))
else if Gear^.dX.isNegative and (Gear^.dX < -_0_03) and TestCollisionXwithGear(Gear, -1) then
inc(Gear^.Damage, hwRound(Gear^.dX * -_50));
-
+
doStepFallingGear(Gear);
CalcRotationDirAngle(Gear);
CheckGearDrowning(Gear)
@@ -2794,10 +2794,10 @@
if (HHGear^.Message and gm_Attack <> 0) then begin
HHGear^.Message := HHGear^.Message and not gm_Attack;
- if Gear^.FlightTime > 0 then begin
- AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtEgg, 0, Gear^.dX * _0_5, Gear^.dY, 0);
- dec(Gear^.FlightTime)
- end;
+ if Gear^.FlightTime > 0 then begin
+ AddGear(hwRound(Gear^.X), hwRound(Gear^.Y) + 32, gtEgg, 0, Gear^.dX * _0_5, Gear^.dY, 0);
+ dec(Gear^.FlightTime)
+ end;
end;
if HHGear^.Message and (gm_Up or gm_Precise or gm_Left or gm_Right) <> 0 then Gear^.State:= Gear^.State and not gsttmpFlag;
@@ -2910,16 +2910,30 @@
////////////////////////////////////////////////////////////////////////////////
procedure doStepEggWork(Gear: PGear);
+var vg: PVisualGear;
+ i: LongInt;
begin
- AllInactive:= false;
- Gear^.dX:= Gear^.dX;
- doStepFallingGear(Gear);
- if (Gear^.State and gstCollision) <> 0 then
- begin
- doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 40, EXPLAutoSound + EXPLPoisoned);
- DeleteGear(Gear);
- exit
- end;
- if (GameTicks and $3F) = 0 then
- AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtSmokeTrace, 0, _0, _0, 0)
+ AllInactive:= false;
+ Gear^.dX:= Gear^.dX;
+ doStepFallingGear(Gear);
+ CheckGearDrowning(Gear);
+ CalcRotationDirAngle(Gear);
+
+ if (Gear^.State and gstCollision) <> 0 then
+ begin
+ doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 10, EXPLPoisoned or EXPLNoGfx);
+ doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 10, EXPLPoisoned or EXPLNoGfx);
+ PlaySound(sndEggBreak);
+ AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtEgg);
+ vg:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtEgg);
+ if vg <> nil then vg^.Frame:= 2;
+
+ for i:= 10 downto 0 do begin
+ vg := AddVisualGear(hwRound(Gear^.X) - 3 + Random(6), hwRound(Gear^.Y) - 3 + Random(6), vgtDust);
+ if vg <> nil then vg^.dX := vg^.dX + (Gear^.dX / 5);
+ end;
+
+ DeleteGear(Gear);
+ exit
+ end;
end;
--- a/hedgewars/uConsts.pas Sat Mar 27 17:03:27 2010 +0000
+++ b/hedgewars/uConsts.pas Sat Mar 27 17:22:33 2010 +0000
@@ -93,7 +93,8 @@
TVisualGearType = (vgtFlake, vgtCloud, vgtExplPart, vgtExplPart2, vgtFire,
vgtSmallDamageTag, vgtTeamHealthSorter, vgtSpeechBubble, vgtBubble,
vgtSteam, vgtAmmo, vgtSmoke, vgtSmokeWhite, vgtHealth, vgtShell,
- vgtDust, vgtSplash, vgtDroplet, vgtSmokeRing, vgtBeeTrace);
+ vgtDust, vgtSplash, vgtDroplet, vgtSmokeRing, vgtBeeTrace,
+ vgtEgg);
TGearsType = set of TGearType;
@@ -113,8 +114,8 @@
sndHomerun, sndMolotov, sndCover, sndUhOh, sndOops,
sndNooo, sndHello, sndRopeShot, sndRopeAttach, sndRopeRelease,
sndSwitchHog, sndVictory, sndSniperReload, sndSteps, sndLowGravity,
- sndHellishImpact,
- sndMelonImpact, sndDroplet1, sndDroplet2, sndDroplet3);
+ sndHellishImpact, sndMelonImpact, sndDroplet1, sndDroplet2, sndDroplet3,
+ sndEggBreak);
TAmmoType = (amNothing, amGrenade, amClusterBomb, amBazooka, amBee, amShotgun, amPickHammer,
amSkip, amRope, amMine, amDEagle, amDynamite, amFirePunch, amWhip,
@@ -728,7 +729,7 @@
(FileName: 'BeeTrace'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false), // sprBeeTrace
(FileName: 'Egg'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
- Width: 8; Height: 8; imageWidth: 0; imageHeight: 0; saveSurf: false), // sprEgg
+ Width: 16; Height: 16; imageWidth: 0; imageHeight: 0; saveSurf: false), // sprEgg
(FileName: 'TargetBee'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false), // sprTargetBee
(FileName: 'amBee'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil;
@@ -829,11 +830,12 @@
(FileName: 'sniperreload.ogg'; Path: ptSounds),// sndSniperReload
(FileName: 'steps.ogg'; Path: ptSounds),// sndSteps
(FileName: 'lowgravity.ogg'; Path: ptSounds),// sndLowGravity
- (FileName: 'hellishimpact.ogg'; Path: ptSounds), // sndHellishImpact
- (FileName: 'melonimpact.ogg'; Path: ptSounds), // sndMelonImpact
+ (FileName: 'hellishimpact.ogg'; Path: ptSounds),// sndHellishImpact
+ (FileName: 'melonimpact.ogg'; Path: ptSounds),// sndMelonImpact
(FileName: 'Droplet1.ogg'; Path: ptSounds),// sndDroplet1
(FileName: 'Droplet2.ogg'; Path: ptSounds),// sndDroplet2
- (FileName: 'Droplet3.ogg'; Path: ptSounds) // sndDroplet3
+ (FileName: 'Droplet3.ogg'; Path: ptSounds),// sndDroplet3
+ (FileName: ''; Path: ptSounds) // sndEggBreak
);
Ammoz: array [TAmmoType] of record
--- a/hedgewars/uGears.pas Sat Mar 27 17:03:27 2010 +0000
+++ b/hedgewars/uGears.pas Sat Mar 27 17:22:33 2010 +0000
@@ -449,13 +449,13 @@
gtBirdy: begin
gear^.Radius:= 16; // todo: check
gear^.Timer:= 500;
- gear^.Health := 2000;
+ gear^.Health := 2000;
gear^.FlightTime := 2;
end;
gtBigExplosion: begin
gear^.Angle:= random(360);
end;
- gtEgg: begin
+ gtEgg: begin
gear^.Radius:= 4;
gear^.Elasticity:= _0_6;
gear^.Friction:= _0_96;
@@ -1703,7 +1703,7 @@
DrawRotatedTextureF(SpritesData[sprBigExplosion].Texture, 0.85 * (-power(2, -4 * Int(Gear^.Timer)/250) + 1) + 0.4, 0, 0, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, 1, 385, 385, Gear^.Angle);
glColor4f(1, 1, 1, 1);
end;
- gtEgg: DrawRotated(sprEgg, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle);
+ gtEgg: DrawRotatedTextureF(SpritesData[sprEgg].Texture, 1, 0, 0, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, 1, 16, 16, Gear^.DirAngle);
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
--- a/hedgewars/uMisc.pas Sat Mar 27 17:03:27 2010 +0000
+++ b/hedgewars/uMisc.pas Sat Mar 27 17:22:33 2010 +0000
@@ -128,8 +128,8 @@
TextureList : PTexture;
ScreenFade : TScreenFade;
- ScreenFadeValue : Longword;
- ScreenFadeSpeed : Longword;
+ ScreenFadeValue : LongInt;
+ ScreenFadeSpeed : LongInt;
procedure initModule;
--- a/hedgewars/uVisualGears.pas Sat Mar 27 17:03:27 2010 +0000
+++ b/hedgewars/uVisualGears.pas Sat Mar 27 17:22:33 2010 +0000
@@ -176,6 +176,21 @@
else dec(Gear^.FrameTicks, Steps)
end;
+procedure doStepEgg(Gear: PVisualGear; Steps: Longword);
+begin
+Gear^.X:= Gear^.X + Gear^.dX * Steps;
+
+Gear^.Y:= Gear^.Y + Gear^.dY * Steps;
+Gear^.dY:= Gear^.dY + cGravity * Steps;
+
+Gear^.Angle:= round(Gear^.Angle + Steps) mod cMaxAngle;
+
+if Gear^.FrameTicks <= Steps then
+ DeleteVisualGear(Gear)
+else
+ dec(Gear^.FrameTicks, Steps)
+end;
+
procedure doStepFire(Gear: PVisualGear; Steps: Longword);
begin
Gear^.X:= Gear^.X + Gear^.dX * Steps;
@@ -470,7 +485,8 @@
@doStepSplash,
@doStepDroplet,
@doStepSmokeRing,
- @doStepBeeTrace
+ @doStepBeeTrace,
+ @doStepEgg
);
function AddVisualGear(X, Y: LongInt; Kind: TVisualGearType): PVisualGear;
@@ -545,6 +561,16 @@
FrameTicks:= 650 + random(250);
Frame:= random(8)
end;
+ vgtEgg: begin
+ t:= random(1024);
+ sp:= _0_001 * (random(85) + 95);
+ dx:= AngleSin(t) * sp;
+ dx.isNegative:= random(2) = 0;
+ dy:= AngleCos(t) * sp;
+ dy.isNegative:= random(2) = 0;
+ FrameTicks:= 650 + random(250);
+ Frame:= 1
+ end;
vgtShell: FrameTicks:= 500;
vgtSmallDamageTag: begin
gear^.FrameTicks:= 1100
@@ -741,6 +767,13 @@
if Gear^.FrameTicks < 250 then
glColor4f(1, 1, 1, 1);
end;
+ vgtEgg: begin
+ if Gear^.FrameTicks < 250 then
+ glColor4f(1, 1, 1, Gear^.FrameTicks / 250);
+ DrawRotatedF(sprEgg, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
+ if Gear^.FrameTicks < 250 then
+ glColor4f(1, 1, 1, 1);
+ end;
vgtSplash: DrawSprite(sprSplash, hwRound(Gear^.X) + WorldDx - 64, hwRound(Gear^.Y) + WorldDy - 72, 19 - (Gear^.FrameTicks div 37));
vgtDroplet: DrawSprite(sprDroplet, hwRound(Gear^.X) + WorldDx - 8, hwRound(Gear^.Y) + WorldDy - 8, Gear^.Frame);
vgtBeeTrace: begin
Binary file share/hedgewars/Data/Graphics/Egg.png has changed