# HG changeset patch
# User nemo
# Date 1267755423 0
# Node ID 02af54eb7e1e7085266fd75de0c1cb255b7065b1
# Parent 9bc0cf3c7ac1270518c04671306cc4f5fb96bb78
Experiment with barrels. Add rolling.
diff -r 9bc0cf3c7ac1 -r 02af54eb7e1e hedgewars/GSHandlers.inc
--- a/hedgewars/GSHandlers.inc Thu Mar 04 19:35:27 2010 +0000
+++ b/hedgewars/GSHandlers.inc Fri Mar 05 02:17:03 2010 +0000
@@ -1243,9 +1243,11 @@
var i, x, y: LongInt;
k: TGearType;
exBoom: boolean;
- dX, dY: HWFloat;
+ dX, dY, V: HWFloat;
begin
+k:= Gear^.Kind;
exBoom:= false;
+V:= _0;
if (Gear^.Message and gm_Destroy) > 0 then
begin
@@ -1257,8 +1259,18 @@
exit
end;
-if Gear^.Kind = gtExplosives then
+if k = gtExplosives then
begin
+ V:= hwSqr(Gear^.dX) + hwSqr(Gear^.dY);
+ if V > _0_03 then Gear^.State:= Gear^.State or gstAnimation;
+ if ((Gear^.State and gstAnimation) <> 0) and (Gear^.dX.QWordValue <> 0) and (Gear^.dY.QWordValue <> 0) then
+ begin
+ AllInactive:= false;
+ doStepFallingGear(Gear);
+ CalcRotationDirAngle(Gear)
+ end;
+ if V < _0_001 then Gear^.dX:= _0;
+
if ((Gear^.Health * 100 div cBarrelHealth) < random(90)) and ((GameTicks and $FF) = 0) then
AddVisualGear(hwRound(Gear^.X) - 16 + Random(32), hwRound(Gear^.Y) - 2, vgtSmoke);
dec(Gear^.Health, Gear^.Damage);
@@ -1271,7 +1283,6 @@
begin
x:= hwRound(Gear^.X);
y:= hwRound(Gear^.Y);
- k:= Gear^.Kind;
DeleteGear(Gear); // <-- delete gear!
if k = gtCase then
@@ -1297,12 +1308,18 @@
if (Gear^.dY.QWordValue <> 0) or (not TestCollisionYwithGear(Gear, 1)) then
begin
AllInactive:= false;
- Gear^.dY:= Gear^.dY + cGravity;
- Gear^.Y:= Gear^.Y + Gear^.dY;
- if (not Gear^.dY.isNegative) and (Gear^.Kind = gtExplosives) then SetAllHHToActive;
- if (Gear^.dY.isNegative) and TestCollisionYwithGear(Gear, -1) then Gear^.dY:= _0 else
+ if not ((k = gtExplosives) and ((Gear^.State and gstAnimation) <> 0)) then
+ begin
+ Gear^.dY:= Gear^.dY + cGravity;
+ Gear^.Y:= Gear^.Y + Gear^.dY;
+ if (Gear^.dY.isNegative) and TestCollisionYwithGear(Gear, -1) then Gear^.dY:= _0
+ end;
+ if V > _0_001 then SetAllHHToActive;
if (not Gear^.dY.isNegative) and TestCollisionYwithGear(Gear, 1) then
begin
+ if (V > _0_02) and (k = gtExplosives) and ((Gear^.State and gstAnimation) <> 0) then
+ inc(Gear^.Damage, hwRound(V * _70));
+
if Gear^.dY > _0_2 then
for i:= min(12, hwRound(Gear^.dY*_10)) downto 0 do
AddVisualGear(hwRound(Gear^.X) - 5 + Random(10), hwRound(Gear^.Y) + 12, vgtDust);
diff -r 9bc0cf3c7ac1 -r 02af54eb7e1e hedgewars/uConsts.pas
--- a/hedgewars/uConsts.pas Thu Mar 04 19:35:27 2010 +0000
+++ b/hedgewars/uConsts.pas Fri Mar 05 02:17:03 2010 +0000
@@ -72,7 +72,7 @@
sprThoughtCorner, sprThoughtEdge, sprThoughtTail,
sprShoutCorner, sprShoutEdge, sprShoutTail,
sprSniperRifle, sprBubbles, sprJetpack, sprHealth, sprHandMolotov, sprMolotov,
- sprSmoke, sprShell, sprDust, sprExplosives, sprAmTeleport);
+ sprSmoke, sprShell, sprDust, sprExplosives, sprExplosivesRoll, sprAmTeleport);
TGearType = (gtAmmo_Bomb, gtHedgehog, gtAmmo_Grenade, gtHealthTag, // 3
gtGrave, gtUFO, gtShotgunShot, gtPickHammer, gtRope, // 8
@@ -676,6 +676,8 @@
Width: 22; Height: 22; imageWidth: 0; imageHeight: 0; saveSurf: false),// sprDust
(FileName: 'Explosives'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
Width: 48; Height: 48; imageWidth: 0; imageHeight: 0; saveSurf: false),// sprExplosives
+ (FileName: 'ExplosivesRoll'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
+ Width: 48; Height: 48; imageWidth: 0; imageHeight: 0; saveSurf: false),// sprExplosivesRoll
(FileName: 'amTeleport'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil;
Width: 64; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false) // sprAmTeleport
);
diff -r 9bc0cf3c7ac1 -r 02af54eb7e1e hedgewars/uFloat.pas
--- a/hedgewars/uFloat.pas Thu Mar 04 19:35:27 2010 +0000
+++ b/hedgewars/uFloat.pas Fri Mar 05 02:17:03 2010 +0000
@@ -123,6 +123,7 @@
_0_3x70: hwFloat = (isNegative: false; QWordValue: 1288490189 * 70);
_25: hwFloat = (isNegative: false; QWordValue: 4294967296 * 25);
_30: hwFloat = (isNegative: false; QWordValue: 4294967296 * 30);
+ _70: hwFloat = (isNegative: false; QWordValue: 4294967296 * 70);
_128: hwFloat = (isNegative: false; QWordValue: 4294967296 * 128);
_256: hwFloat = (isNegative: false; QWordValue: 4294967296 * 256);
_300: hwFloat = (isNegative: false; QWordValue: 4294967296 * 300);
diff -r 9bc0cf3c7ac1 -r 02af54eb7e1e hedgewars/uGears.pas
--- a/hedgewars/uGears.pas Thu Mar 04 19:35:27 2010 +0000
+++ b/hedgewars/uGears.pas Fri Mar 05 02:17:03 2010 +0000
@@ -328,7 +328,8 @@
end;
gtExplosives: begin
gear^.Radius:= 16;
- gear^.Elasticity:= _0_3;
+ gear^.Elasticity:= _0_4;
+ gear^.Friction:= _1;
gear^.Health:= cBarrelHealth
end;
gtDEagleShot: begin
@@ -1585,7 +1586,10 @@
gtExplosives: begin
i:= (GameTicks shr 6) mod 64;
if i > 18 then i:= 0;
- DrawSprite(sprExplosives, hwRound(Gear^.X) - 24 + WorldDx, hwRound(Gear^.Y) - 24 + WorldDy, i);
+ if Gear^.State and gstAnimation = 0 then
+ DrawSprite(sprExplosives, hwRound(Gear^.X) - 24 + WorldDx, hwRound(Gear^.Y) - 24 + WorldDy, i)
+ else
+ DrawRotatedF(sprExplosivesRoll, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) +4 + WorldDy, i, 0, Gear^.DirAngle);
end;
gtDynamite: DrawSprite2(sprDynamite, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 25 + WorldDy, Gear^.Tag and 1, Gear^.Tag shr 1);
gtClusterBomb: DrawRotated(sprClusterBomb, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, Gear^.DirAngle);
diff -r 9bc0cf3c7ac1 -r 02af54eb7e1e share/hedgewars/Data/Graphics/Explosives.png
Binary file share/hedgewars/Data/Graphics/Explosives.png has changed
diff -r 9bc0cf3c7ac1 -r 02af54eb7e1e share/hedgewars/Data/Graphics/Explosives.svg
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/share/hedgewars/Data/Graphics/Explosives.svg Fri Mar 05 02:17:03 2010 +0000
@@ -0,0 +1,4627 @@
+
+
+
+
diff -r 9bc0cf3c7ac1 -r 02af54eb7e1e share/hedgewars/Data/Graphics/ExplosivesRoll.png
Binary file share/hedgewars/Data/Graphics/ExplosivesRoll.png has changed
diff -r 9bc0cf3c7ac1 -r 02af54eb7e1e share/hedgewars/Data/Graphics/ExplosivesRoll.svg
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/share/hedgewars/Data/Graphics/ExplosivesRoll.svg Fri Mar 05 02:17:03 2010 +0000
@@ -0,0 +1,4590 @@
+
+
+
+