author  nemo 
Wed, 24 Feb 2010 13:46:02 +0000  
changeset 2858  4c5c4bc0ae35 
parent 2857  768dfbe276a5 
child 2859  d44ae883896b 
permissions  rwrr 
4  1 
(* 
1066  2 
* Hedgewars, a free turn based strategy game 
1689  3 
* Copyright (c) 20042009 Andrey Korotaev <unC0Rr@gmail.com> 
4  4 
* 
183  5 
* This program is free software; you can redistribute it and/or modify 
6 
* it under the terms of the GNU General Public License as published by 

7 
* the Free Software Foundation; version 2 of the License 

4  8 
* 
183  9 
* This program is distributed in the hope that it will be useful, 
10 
* but WITHOUT ANY WARRANTY; without even the implied warranty of 

11 
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 

12 
* GNU General Public License for more details. 

4  13 
* 
183  14 
* You should have received a copy of the GNU General Public License 
15 
* along with this program; if not, write to the Free Software 

16 
* Foundation, Inc., 59 Temple Place  Suite 330, Boston, MA 021111307, USA 

4  17 
*) 
18 

2647  19 
procedure makeHogsWorry(x, y: hwFloat; r: LongInt); 
20 
var gi: PGear; 

21 
d: LongInt; 

22 
begin 

23 
gi:= GearsList; 

24 
while gi <> nil do 

25 
begin 

26 
d:= r  hwRound(Distance(gi^.X  x, gi^.Y  y)); 

27 
if (d > 1) and (gi^.Kind = gtHedgehog) and not gi^.Invulnerable and (GetRandom(2) = 0) then 

28 
begin 

29 
if (CurrentHedgehog^.Gear = gi) then 

2745  30 
PlaySound(sndOops, PHedgehog(gi^.Hedgehog)^.Team^.voicepack) 
2647  31 
else 
32 
begin 

33 
if (gi^.State and gstMoving) = 0 then 

34 
gi^.State:= gi^.State or gstLoser; 

35 
if d > r div 2 then 

2745  36 
PlaySound(sndNooo, PHedgehog(gi^.Hedgehog)^.Team^.voicepack) 
2647  37 
else 
2745  38 
PlaySound(sndUhOh, PHedgehog(gi^.Hedgehog)^.Team^.voicepack); 
2647  39 
end; 
40 
end; 

41 
gi:= gi^.NextGear 

42 
end; 

43 
end; 

44 
//////////////////////////////////////////////////////////////////////////////// 

4  45 
procedure doStepDrowningGear(Gear: PGear); forward; 
46 

47 
function CheckGearDrowning(Gear: PGear): boolean; 

1918  48 
var skipSpeed, skipAngle, skipDecay: hwFloat; 
4  49 
begin 
1918  50 
// probably needs tweaking. might need to be in a case statement based upon gear type 
51 
//(not Gear^.dY.isNegative) and this should not be necessary 

498  52 
if cWaterLine < hwRound(Gear^.Y) + Gear^.Radius then 
1918  53 
begin 
54 
skipSpeed:= _0_25; // was 0.36  couldn't manage baseball bat. Tiy's build is 0.36... 

55 
skipAngle:= _1 + _0_9; // these should perhaps also be constants, once work out what proper values are 

56 
skipDecay:= _0_87; // this could perhaps be a tiny bit higher. 

1919  57 
if (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) > skipSpeed) and 
1920  58 
(hwAbs(Gear^.dX) > skipAngle * hwAbs(Gear^.dY)) then 
1918  59 
begin 
60 
Gear^.dY.isNegative:= true; 

1919  61 
Gear^.dY:= Gear^.dY * skipDecay; 
62 
Gear^.dX:= Gear^.dX * skipDecay; 

1918  63 
CheckGearDrowning:= false 
64 
end 

65 
else 

66 
begin 

67 
CheckGearDrowning:= true; 

68 
Gear^.State:= gstDrowning; 

2429  69 
Gear^.RenderTimer:= false; 
1918  70 
Gear^.doStep:= @doStepDrowningGear; 
2367
86c9aadea817
Remove gstHHDriven flag when hedgehog get into the water. Fixes some odd cases.
unc0rr
parents:
2365
diff
changeset

71 
if Gear^.Kind = gtHedgehog then 
86c9aadea817
Remove gstHHDriven flag when hedgehog get into the water. Fixes some odd cases.
unc0rr
parents:
2365
diff
changeset

72 
begin 
86c9aadea817
Remove gstHHDriven flag when hedgehog get into the water. Fixes some odd cases.
unc0rr
parents:
2365
diff
changeset

73 
Gear^.State:= Gear^.State and (not gstHHDriven); 
2619  74 
AddCaption(Format(GetEventString(eidDrowned), PHedgehog(Gear^.Hedgehog)^.Name), cWhiteColor, capgrpMessage); 
2367
86c9aadea817
Remove gstHHDriven flag when hedgehog get into the water. Fixes some odd cases.
unc0rr
parents:
2365
diff
changeset

75 
end 
1918  76 
end; 
2745  77 
PlaySound(sndSplash) 
1918  78 
end 
79 
else 

1133  80 
CheckGearDrowning:= false 
4  81 
end; 
82 

83 
procedure CheckCollision(Gear: PGear); 

84 
begin 

351  85 
if TestCollisionXwithGear(Gear, hwSign(Gear^.X)) or TestCollisionYwithGear(Gear, hwSign(Gear^.Y)) 
1133  86 
then Gear^.State:= Gear^.State or gstCollision 
87 
else Gear^.State:= Gear^.State and not gstCollision 

4  88 
end; 
89 

90 
procedure CheckHHDamage(Gear: PGear); 

2848  91 
var 
92 
dmg: Longword; 

93 
i: LongInt; 

94 
particle: PVisualGear; 

4  95 
begin 
1849  96 
if(Gear^.Invulnerable) then exit; 
522  97 
if _0_4 < Gear^.dY then 
1123  98 
begin 
2730
f56592281526
Remove king invulnerability, disable everything but teleport instead.
nemo
parents:
2726
diff
changeset

99 
dmg:= ModifyDamage(1 + hwRound((hwAbs(Gear^.dY)  _0_4) * 70), Gear); 
f56592281526
Remove king invulnerability, disable everything but teleport instead.
nemo
parents:
2726
diff
changeset

100 
if dmg < 1 then exit; 
f56592281526
Remove king invulnerability, disable everything but teleport instead.
nemo
parents:
2726
diff
changeset

101 

1123  102 
if _0_6 < Gear^.dY then 
2745  103 
PlaySound(sndOw4, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack) 
1123  104 
else 
2745  105 
PlaySound(sndOw1, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack); 
1123  106 

2848  107 
for i:= min(12, (3 + dmg div 10)) downto 0 do begin 
108 
particle := AddVisualGear(hwRound(Gear^.X)  5 + Random(10), hwRound(Gear^.Y) + 12, vgtDust); 

2857
768dfbe276a5
Fix spectator crash due to missing nil check in new dust gear, init Ammo to nil in World prior to nil check
nemo
parents:
2848
diff
changeset

109 
if particle <> nil then particle^.dX := particle^.dX + (Gear^.dX / 5); 
2848  110 
end; 
111 

112 
ApplyDamage(Gear, dmg); 

1123  113 
end 
4  114 
end; 
115 

116 
//////////////////////////////////////////////////////////////////////////////// 

117 
//////////////////////////////////////////////////////////////////////////////// 

118 
procedure CalcRotationDirAngle(Gear: PGear); 

776
8fc7e59d9cb4
Convert the rest of rotated sprites to be rotated by OpenGL
unc0rr
parents:
764
diff
changeset

119 
var dAngle: real; 
4  120 
begin 
776
8fc7e59d9cb4
Convert the rest of rotated sprites to be rotated by OpenGL
unc0rr
parents:
764
diff
changeset

121 
dAngle:= (hwAbs(Gear^.dX) + hwAbs(Gear^.dY)).QWordValue / $80000000; 
1133  122 
if not Gear^.dX.isNegative then 
123 
Gear^.DirAngle:= Gear^.DirAngle + dAngle 

124 
else 

125 
Gear^.DirAngle:= Gear^.DirAngle  dAngle; 

126 

776
8fc7e59d9cb4
Convert the rest of rotated sprites to be rotated by OpenGL
unc0rr
parents:
764
diff
changeset

127 
if Gear^.DirAngle < 0 then Gear^.DirAngle:= Gear^.DirAngle + 360 
8fc7e59d9cb4
Convert the rest of rotated sprites to be rotated by OpenGL
unc0rr
parents:
764
diff
changeset

128 
else if 360 < Gear^.DirAngle then Gear^.DirAngle:= Gear^.DirAngle  360 
4  129 
end; 
130 

131 
//////////////////////////////////////////////////////////////////////////////// 

132 
procedure doStepDrowningGear(Gear: PGear); 

133 
begin 

134 
AllInactive:= false; 

351  135 
Gear^.Y:= Gear^.Y + cDrownSpeed; 
2228  136 
Gear^.X:= Gear^.X + Gear^.dX * cDrownSpeed; 
2840
bb9117753fe4
Skip drawing some stuff if water is opaque. Affects simulation.
nemo
parents:
2828
diff
changeset

137 
if (cWaterOpacity > $FE) or (hwRound(Gear^.Y) > Gear^.Radius + cWaterLine + cVisibleWater) then DeleteGear(Gear); 
2143
ad05f6b2d1c0
New baseball bat sound, steam when fire lands on water (needs new hiss sound), bubbles when hedgehog drowns, more messages on
nemo
parents:
2142
diff
changeset

138 
// Create some bubbles (0.5% might be better but causes too few bubbles sometimes) 
2840
bb9117753fe4
Skip drawing some stuff if water is opaque. Affects simulation.
nemo
parents:
2828
diff
changeset

139 
if (cWaterOpacity < $FF) and ((GameTicks and $1F) = 0) then 
2376  140 
if (Gear^.Kind = gtHedgehog) and (Random(4) = 0) then 
2225  141 
AddVisualGear(hwRound(Gear^.X)  Gear^.Radius, hwRound(Gear^.Y)  Gear^.Radius, vgtBubble) 
142 
else if Random(12) = 0 then 

143 
AddVisualGear(hwRound(Gear^.X)  Gear^.Radius, hwRound(Gear^.Y)  Gear^.Radius, vgtBubble) 

4  144 
end; 
145 

146 
//////////////////////////////////////////////////////////////////////////////// 

147 
procedure doStepFallingGear(Gear: PGear); 

2455
cc54dd148cc2
Remove sheepluva's simple 45 deg bouncing from r2472, add various flame sizes for Tiy
nemo
parents:
2440
diff
changeset

148 
var isFalling: boolean; 
4  149 
begin 
503  150 
Gear^.State:= Gear^.State and not gstCollision; 
151 

152 
if Gear^.dY.isNegative then 

1133  153 
begin 
154 
isFalling:= true; 

155 
if TestCollisionYwithGear(Gear, 1) then 

156 
begin 

157 
Gear^.dX:= Gear^.dX * Gear^.Friction; 

158 
Gear^.dY:=  Gear^.dY * Gear^.Elasticity; 

159 
Gear^.State:= Gear^.State or gstCollision 

160 
end 

161 
end else 

162 
if TestCollisionYwithGear(Gear, 1) then 

163 
begin 

164 
isFalling:= false; 

165 
Gear^.dX:= Gear^.dX * Gear^.Friction; 

166 
Gear^.dY:=  Gear^.dY * Gear^.Elasticity; 

167 
Gear^.State:= Gear^.State or gstCollision 

168 
end else isFalling:= true; 

503  169 

351  170 
if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then 
1133  171 
begin 
172 
Gear^.dX:=  Gear^.dX * Gear^.Elasticity; 

173 
Gear^.dY:= Gear^.dY * Gear^.Elasticity; 

174 
Gear^.State:= Gear^.State or gstCollision 

175 
end; 

503  176 

542  177 
if isFalling then Gear^.dY:= Gear^.dY + cGravity; 
503  178 

351  179 
Gear^.X:= Gear^.X + Gear^.dX; 
180 
Gear^.Y:= Gear^.Y + Gear^.dY; 

4  181 
CheckGearDrowning(Gear); 
503  182 
if (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) < _0_0002) and 
1133  183 
(not isFalling) then 
184 
Gear^.State:= Gear^.State and not gstMoving 

185 
else 

186 
Gear^.State:= Gear^.State or gstMoving 

4  187 
end; 
188 

189 
//////////////////////////////////////////////////////////////////////////////// 

190 
procedure doStepBomb(Gear: PGear); 

371  191 
var i: LongInt; 
919  192 
dX, dY: hwFloat; 
2538
661079b00177
Just checking this in so prg can try it. May back it out
nemo
parents:
2524
diff
changeset

193 
Fire: PGear; 
4  194 
begin 
195 
AllInactive:= false; 

1263  196 

4  197 
doStepFallingGear(Gear); 
1263  198 

351  199 
dec(Gear^.Timer); 
2647  200 
if Gear^.Timer = 1000 then // might need adjustments 
201 
case Gear^.Kind of 

202 
gtAmmo_Bomb: makeHogsWorry(Gear^.X, Gear^.Y, 50); 

203 
gtClusterBomb: makeHogsWorry(Gear^.X, Gear^.Y, 20); 

204 
gtWatermelon: makeHogsWorry(Gear^.X, Gear^.Y, 75); 

205 
gtHellishBomb: makeHogsWorry(Gear^.X, Gear^.Y, 90); 

206 
end; 

351  207 
if Gear^.Timer = 0 then 
1133  208 
begin 
209 
case Gear^.Kind of 

210 
gtAmmo_Bomb: doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound); 

1603  211 
gtBall: doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 40, EXPLAutoSound); 
1133  212 
gtClusterBomb: begin 
213 
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 20, EXPLAutoSound); 

214 
for i:= 0 to 4 do 

215 
begin 

216 
dX:= rndSign(GetRandom * _0_1); 

217 
dY:= (GetRandom  _3) * _0_08; 

1261  218 
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtCluster, 0, dX, dY, 25); 
219 
end 

220 
end; 

221 
gtWatermelon: begin 

222 
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 75, EXPLAutoSound); 

223 
for i:= 0 to 5 do 

224 
begin 

225 
dX:= rndSign(GetRandom * _0_1); 

1496  226 
dY:= (GetRandom  _1_5) * _0_3; 
1262  227 
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtMelonPiece, 0, dX, dY, 75)^.DirAngle:= i * 60; 
1133  228 
end 
1263  229 
end; 
1555  230 
gtHellishBomb: begin 
231 
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 90, EXPLAutoSound); 

232 
for i:= 0 to 127 do 

233 
begin 

234 
dX:= AngleCos(i * 16) * _0_5 * (GetRandom + _1); 

235 
dY:= AngleSin(i * 16) * _0_5 * (GetRandom + _1); 

2538
661079b00177
Just checking this in so prg can try it. May back it out
nemo
parents:
2524
diff
changeset

236 
Fire:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtFlame, 0, dX, dY, 0); 
661079b00177
Just checking this in so prg can try it. May back it out
nemo
parents:
2524
diff
changeset

237 
if i mod 2 = 0 then Fire^.State:= Fire^.State or gsttmpFlag; 
661079b00177
Just checking this in so prg can try it. May back it out
nemo
parents:
2524
diff
changeset

238 
Fire:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtFlame, 0, dX, dY, 0); 
661079b00177
Just checking this in so prg can try it. May back it out
nemo
parents:
2524
diff
changeset

239 
if i mod 2 <> 0 then Fire^.State:= Fire^.State or gsttmpFlag; 
1555  240 
end 
241 
end; 

1133  242 
end; 
243 
DeleteGear(Gear); 

244 
exit 

245 
end; 

1263  246 

4  247 
CalcRotationDirAngle(Gear); 
1263  248 

249 
if Gear^.Kind = gtHellishBomb then 

1279  250 
begin 
2745  251 
if Gear^.Timer = 3000 then PlaySound(sndHellish); 
1279  252 

1263  253 
if (GameTicks and $3F) = 0 then 
254 
if (Gear^.State and gstCollision) = 0 then 

255 
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtEvilTrace, 0, _0, _0, 0); 

1279  256 
end; 
1263  257 

1158  258 
if (Gear^.State and (gstCollision or gstMoving)) = (gstCollision or gstMoving) then 
259 
if (hwAbs(Gear^.dX) > _0_1) or 

260 
(hwAbs(Gear^.dY) > _0_1) then 

2745  261 
PlaySound(sndGrenadeImpact) 
4  262 
end; 
2457
ecf0c7e7995b
Initial molotov cocktail. Still needs graphics, tweaking of fire behaviour. Also changed probabilities for default weapon sets
nemo
parents:
2455
diff
changeset

263 
//////////////////////////////////////////////////////////////////////////////// 
ecf0c7e7995b
Initial molotov cocktail. Still needs graphics, tweaking of fire behaviour. Also changed probabilities for default weapon sets
nemo
parents:
2455
diff
changeset

264 
procedure doStepMolotov(Gear: PGear); 
ecf0c7e7995b
Initial molotov cocktail. Still needs graphics, tweaking of fire behaviour. Also changed probabilities for default weapon sets
nemo
parents:
2455
diff
changeset

265 
var i: LongInt; 
ecf0c7e7995b
Initial molotov cocktail. Still needs graphics, tweaking of fire behaviour. Also changed probabilities for default weapon sets
nemo
parents:
2455
diff
changeset

266 
dX, dY: hwFloat; 
ecf0c7e7995b
Initial molotov cocktail. Still needs graphics, tweaking of fire behaviour. Also changed probabilities for default weapon sets
nemo
parents:
2455
diff
changeset

267 
Fire: PGear; 
ecf0c7e7995b
Initial molotov cocktail. Still needs graphics, tweaking of fire behaviour. Also changed probabilities for default weapon sets
nemo
parents:
2455
diff
changeset

268 
begin 
ecf0c7e7995b
Initial molotov cocktail. Still needs graphics, tweaking of fire behaviour. Also changed probabilities for default weapon sets
nemo
parents:
2455
diff
changeset

269 
AllInactive:= false; 
ecf0c7e7995b
Initial molotov cocktail. Still needs graphics, tweaking of fire behaviour. Also changed probabilities for default weapon sets
nemo
parents:
2455
diff
changeset

270 

ecf0c7e7995b
Initial molotov cocktail. Still needs graphics, tweaking of fire behaviour. Also changed probabilities for default weapon sets
nemo
parents:
2455
diff
changeset

271 
doStepFallingGear(Gear); 
ecf0c7e7995b
Initial molotov cocktail. Still needs graphics, tweaking of fire behaviour. Also changed probabilities for default weapon sets
nemo
parents:
2455
diff
changeset

272 
CalcRotationDirAngle(Gear); 
ecf0c7e7995b
Initial molotov cocktail. Still needs graphics, tweaking of fire behaviour. Also changed probabilities for default weapon sets
nemo
parents:
2455
diff
changeset

273 

ecf0c7e7995b
Initial molotov cocktail. Still needs graphics, tweaking of fire behaviour. Also changed probabilities for default weapon sets
nemo
parents:
2455
diff
changeset

274 
if (Gear^.State and gstCollision) <> 0 then begin 
2745  275 
PlaySound(sndMolotov); 
2470  276 
//doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 5, EXPLAutoSound); 
2492
9e80b7fc4017
Tweak of molotov based on burp's play, a little bit more specificity in homerun.
nemo
parents:
2480
diff
changeset

277 
for i:= 0 to 20 do begin 
2512  278 
dX:= AngleCos(i * 2) * ((_0_1*(i div 5))) * (GetRandom + _1); 
2468
0b62498c201a
openal fix, training map selection and rcplane adjustments from Smaxx (untested, but look reasonable). Bunch of new graphics from Tiy, new translation for ptpt from inu_
nemo
parents:
2462
diff
changeset

279 
dY:= AngleSin(i * 8) * _0_5 * (GetRandom + _1); 
0b62498c201a
openal fix, training map selection and rcplane adjustments from Smaxx (untested, but look reasonable). Bunch of new graphics from Tiy, new translation for ptpt from inu_
nemo
parents:
2462
diff
changeset

280 
Fire:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtFlame, 0, dX, dY, 0); 
0b62498c201a
openal fix, training map selection and rcplane adjustments from Smaxx (untested, but look reasonable). Bunch of new graphics from Tiy, new translation for ptpt from inu_
nemo
parents:
2462
diff
changeset

281 
Fire^.State:= Fire^.State or gsttmpFlag; 
0b62498c201a
openal fix, training map selection and rcplane adjustments from Smaxx (untested, but look reasonable). Bunch of new graphics from Tiy, new translation for ptpt from inu_
nemo
parents:
2462
diff
changeset

282 
Fire:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtFlame, 0, dX, dY, 0); 
0b62498c201a
openal fix, training map selection and rcplane adjustments from Smaxx (untested, but look reasonable). Bunch of new graphics from Tiy, new translation for ptpt from inu_
nemo
parents:
2462
diff
changeset

283 
Fire^.State:= Fire^.State or gsttmpFlag; 
0b62498c201a
openal fix, training map selection and rcplane adjustments from Smaxx (untested, but look reasonable). Bunch of new graphics from Tiy, new translation for ptpt from inu_
nemo
parents:
2462
diff
changeset

284 
Fire:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtFlame, 0, dX, dY, 0); 
0b62498c201a
openal fix, training map selection and rcplane adjustments from Smaxx (untested, but look reasonable). Bunch of new graphics from Tiy, new translation for ptpt from inu_
nemo
parents:
2462
diff
changeset

285 
Fire^.State:= Fire^.State or gsttmpFlag; 
0b62498c201a
openal fix, training map selection and rcplane adjustments from Smaxx (untested, but look reasonable). Bunch of new graphics from Tiy, new translation for ptpt from inu_
nemo
parents:
2462
diff
changeset

286 
Fire:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtFlame, 0, dX, dY, 0); 
0b62498c201a
openal fix, training map selection and rcplane adjustments from Smaxx (untested, but look reasonable). Bunch of new graphics from Tiy, new translation for ptpt from inu_
nemo
parents:
2462
diff
changeset

287 
Fire^.State:= Fire^.State or gsttmpFlag; 
2457
ecf0c7e7995b
Initial molotov cocktail. Still needs graphics, tweaking of fire behaviour. Also changed probabilities for default weapon sets
nemo
parents:
2455
diff
changeset

288 
end; 
ecf0c7e7995b
Initial molotov cocktail. Still needs graphics, tweaking of fire behaviour. Also changed probabilities for default weapon sets
nemo
parents:
2455
diff
changeset

289 
DeleteGear(Gear); 
ecf0c7e7995b
Initial molotov cocktail. Still needs graphics, tweaking of fire behaviour. Also changed probabilities for default weapon sets
nemo
parents:
2455
diff
changeset

290 
exit 
ecf0c7e7995b
Initial molotov cocktail. Still needs graphics, tweaking of fire behaviour. Also changed probabilities for default weapon sets
nemo
parents:
2455
diff
changeset

291 
end; 
ecf0c7e7995b
Initial molotov cocktail. Still needs graphics, tweaking of fire behaviour. Also changed probabilities for default weapon sets
nemo
parents:
2455
diff
changeset

292 
end; 
4  293 

1279  294 
procedure doStepWatermelon(Gear: PGear); 
295 
begin 

296 
AllInactive:= false; 

297 
Gear^.doStep:= @doStepBomb 

298 
end; 

299 

78  300 
procedure doStepCluster(Gear: PGear); 
301 
begin 

302 
AllInactive:= false; 

303 
doStepFallingGear(Gear); 

351  304 
if (Gear^.State and gstCollision) <> 0 then 
1133  305 
begin 
1261  306 
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Timer, EXPLAutoSound); 
1133  307 
DeleteGear(Gear); 
308 
exit 

309 
end; 

1262  310 

311 
if Gear^.Kind = gtMelonPiece then 

312 
CalcRotationDirAngle(Gear) 

313 
else 

314 
if (GameTicks and $1F) = 0 then 

315 
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtSmokeTrace, 0, _0, _0, 0) 

78  316 
end; 
317 

4  318 
//////////////////////////////////////////////////////////////////////////////// 
319 
procedure doStepGrenade(Gear: PGear); 

320 
begin 

321 
AllInactive:= false; 

351  322 
Gear^.dX:= Gear^.dX + cWindSpeed; 
4  323 
doStepFallingGear(Gear); 
351  324 
if (Gear^.State and gstCollision) <> 0 then 
1133  325 
begin 
326 
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound); 

327 
DeleteGear(Gear); 

328 
exit 

329 
end; 

4  330 
if (GameTicks and $3F) = 0 then 
1133  331 
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtSmokeTrace, 0, _0, _0, 0) 
4  332 
end; 
333 

334 
//////////////////////////////////////////////////////////////////////////////// 

95  335 
procedure doStepHealthTagWork(Gear: PGear); 
4  336 
begin 
522  337 
if Gear^.Kind = gtHealthTag then 
1505  338 
AllInactive:= false; 
339 

351  340 
dec(Gear^.Timer); 
522  341 
Gear^.Y:= Gear^.Y + Gear^.dY; 
1505  342 

351  343 
if Gear^.Timer = 0 then 
1133  344 
begin 
2017  345 
if (Gear^.Kind = gtHealthTag) and (PHedgehog(Gear^.Hedgehog)^.Gear <> nil) then 
1133  346 
PHedgehog(Gear^.Hedgehog)^.Gear^.Active:= true; // to let current hh die 
347 
DeleteGear(Gear) 

348 
end 

4  349 
end; 
350 

263  351 
procedure doStepHealthTagWorkUnderWater(Gear: PGear); 
352 
begin 

1505  353 
AllInactive:= false; 
1495  354 

351  355 
Gear^.Y:= Gear^.Y  _0_08; 
1495  356 

498  357 
if hwRound(Gear^.Y) < cWaterLine + 10 then 
1505  358 
DeleteGear(Gear) 
263  359 
end; 
360 

95  361 
procedure doStepHealthTag(Gear: PGear); 
362 
var s: shortstring; 

363 
begin 

1505  364 
AllInactive:= false; 
365 
Gear^.dY:= _0_08; 

522  366 

351  367 
str(Gear^.State, s); 
1505  368 
Gear^.Tex:= RenderStringTex(s, PHedgehog(Gear^.Hedgehog)^.Team^.Clan^.Color, fnt16); 
369 

370 
if hwRound(Gear^.Y) < cWaterLine then 

371 
Gear^.doStep:= @doStepHealthTagWork 

372 
else 

373 
Gear^.doStep:= @doStepHealthTagWorkUnderWater; 

374 

762  375 
Gear^.Y:= Gear^.Y  int2hwFloat(Gear^.Tex^.h) 
95  376 
end; 
377 

4  378 
//////////////////////////////////////////////////////////////////////////////// 
379 
procedure doStepGrave(Gear: PGear); 

380 
begin 

381 
AllInactive:= false; 

498  382 
if Gear^.dY.isNegative then 
383 
if TestCollisionY(Gear, 1) then Gear^.dY:= _0; 

4  384 

351  385 
if not Gear^.dY.isNegative then 
68  386 
if TestCollisionY(Gear, 1) then 
4  387 
begin 
351  388 
Gear^.dY:=  Gear^.dY * Gear^.Elasticity; 
389 
if Gear^.dY >  _1div1024 then 

4  390 
begin 
351  391 
Gear^.Active:= false; 
4  392 
exit 
2745  393 
end else if Gear^.dY <  _0_03 then PlaySound(sndGraveImpact) 
4  394 
end; 
1505  395 

351  396 
Gear^.Y:= Gear^.Y + Gear^.dY; 
4  397 
CheckGearDrowning(Gear); 
351  398 
Gear^.dY:= Gear^.dY + cGravity 
4  399 
end; 
400 

401 
//////////////////////////////////////////////////////////////////////////////// 

402 
procedure doStepUFOWork(Gear: PGear); 

351  403 
var t: hwFloat; 
374  404 
y: LongInt; 
4  405 
begin 
406 
AllInactive:= false; 

351  407 
t:= Distance(Gear^.dX, Gear^.dY); 
408 
Gear^.dX:= Gear^.Elasticity * (Gear^.dX + _0_000004 * (TargetPoint.X  hwRound(Gear^.X))); 

409 
Gear^.dY:= Gear^.Elasticity * (Gear^.dY + _0_000004 * (TargetPoint.Y  hwRound(Gear^.Y))); 

410 
t:= t / Distance(Gear^.dX, Gear^.dY); 

411 
Gear^.dX:= Gear^.dX * t; 

412 
Gear^.dY:= Gear^.dY * t; 

413 
Gear^.X:= Gear^.X + Gear^.dX; 

414 
Gear^.Y:= Gear^.Y + Gear^.dY; 

374  415 

416 
if (GameTicks and $3F) = 0 then 

417 
begin 

418 
y:= hwRound(Gear^.Y); 

419 
if y + Gear^.Radius < cWaterLine then 

498  420 
AddGear(hwRound(Gear^.X), y, gtSmokeTrace, 0, _0, _0, 0); 
374  421 
end; 
422 

4  423 
CheckCollision(Gear); 
351  424 
dec(Gear^.Timer); 
425 
if ((Gear^.State and gstCollision) <> 0) or (Gear^.Timer = 0) then 

4  426 
begin 
2745  427 
StopSound(Gear^.SoundChannel); 
351  428 
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound); 
4  429 
DeleteGear(Gear); 
430 
end; 

431 
end; 

432 

433 
procedure doStepUFO(Gear: PGear); 

434 
begin 

435 
AllInactive:= false; 

351  436 
Gear^.X:= Gear^.X + Gear^.dX; 
437 
Gear^.Y:= Gear^.Y + Gear^.dY; 

438 
Gear^.dY:= Gear^.dY + cGravity; 

4  439 
CheckCollision(Gear); 
351  440 
if (Gear^.State and gstCollision) <> 0 then 
4  441 
begin 
351  442 
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound); 
4  443 
DeleteGear(Gear); 
444 
exit 

445 
end; 

351  446 
dec(Gear^.Timer); 
447 
if Gear^.Timer = 0 then 

4  448 
begin 
2745  449 
Gear^.SoundChannel:= LoopSound(sndUFO); 
351  450 
Gear^.Timer:= 5000; 
451 
Gear^.doStep:= @doStepUFOWork 

4  452 
end; 
453 
end; 

454 

455 
//////////////////////////////////////////////////////////////////////////////// 

876  456 
procedure doStepShotIdle(Gear: PGear); 
457 
begin 

458 
AllInactive:= false; 

459 
inc(Gear^.Timer); 

460 
if Gear^.Timer > 75 then 

461 
begin 

462 
DeleteGear(Gear); 

463 
AfterAttack 

464 
end 

465 
end; 

466 

4  467 
procedure doStepShotgunShot(Gear: PGear); 
468 
var i: LongWord; 

2828  469 
shell: PVisualGear; 
4  470 
begin 
471 
AllInactive:= false; 

876  472 

473 
if ((Gear^.State and gstAnimation) = 0) then 

474 
begin 

475 
dec(Gear^.Timer); 

476 
if Gear^.Timer = 0 then 

477 
begin 

2745  478 
PlaySound(sndShotgunFire); 
2828  479 
shell:= AddVisualGear(hwRound(Gear^.x), hwRound(Gear^.y), vgtShell); 
2858  480 
if shell <> nil then 
481 
begin 

482 
shell^.dX:= gear^.dX / 4; 

483 
shell^.dY:= gear^.dY / 4; 

484 
shell^.Frame:= 0 

485 
end; 

876  486 
Gear^.State:= Gear^.State or gstAnimation 
487 
end; 

488 
exit 

489 
end 

490 
else inc(Gear^.Timer); 

491 

4  492 
i:= 200; 
493 
repeat 

351  494 
Gear^.X:= Gear^.X + Gear^.dX; 
495 
Gear^.Y:= Gear^.Y + Gear^.dY; 

4  496 
CheckCollision(Gear); 
351  497 
if (Gear^.State and gstCollision) <> 0 then 
876  498 
begin 
499 
Gear^.X:= Gear^.X + Gear^.dX * 8; 

500 
Gear^.Y:= Gear^.Y + Gear^.dY * 8; 

501 
ShotgunShot(Gear); 

502 
Gear^.doStep:= @doStepShotIdle; 

503 
exit 

504 
end; 

4  505 
dec(i) 
506 
until i = 0; 

1760  507 
if (hwRound(Gear^.X) and LAND_WIDTH_MASK <> 0) or (hwRound(Gear^.Y) and LAND_HEIGHT_MASK <> 0) then 
876  508 
Gear^.doStep:= @doStepShotIdle 
4  509 
end; 
510 

511 
//////////////////////////////////////////////////////////////////////////////// 

2023
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset

512 
procedure doStepBulletWork(Gear: PGear); 
38  513 
var i, x, y: LongWord; 
351  514 
oX, oY: hwFloat; 
38  515 
begin 
516 
AllInactive:= false; 

876  517 
inc(Gear^.Timer); 
37  518 
i:= 80; 
351  519 
oX:= Gear^.X; 
520 
oY:= Gear^.Y; 

37  521 
repeat 
351  522 
Gear^.X:= Gear^.X + Gear^.dX; 
523 
Gear^.Y:= Gear^.Y + Gear^.dY; 

524 
x:= hwRound(Gear^.X); 

525 
y:= hwRound(Gear^.Y); 

1753  526 
if ((y and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) 
351  527 
and (Land[y, x] <> 0) then inc(Gear^.Damage); 
2023
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset

528 
if Gear^.Damage > 5 then 
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset

529 
if Gear^.Ammo^.AmmoType = amDEagle then 
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset

530 
AmmoShove(Gear, 7, 20) 
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset

531 
else 
2031
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2029
diff
changeset

532 
AmmoShove(Gear, Gear^.Timer, 20); 
38  533 
dec(i) 
351  534 
until (i = 0) or (Gear^.Damage > Gear^.Health); 
535 
if Gear^.Damage > 0 then 

37  536 
begin 
351  537 
DrawTunnel(oX, oY, Gear^.dX, Gear^.dY, 82  i, 1); 
538 
dec(Gear^.Health, Gear^.Damage); 

539 
Gear^.Damage:= 0 

37  540 
end; 
1760  541 

542 
if (Gear^.Health <= 0) 

543 
or (hwRound(Gear^.X) and LAND_WIDTH_MASK <> 0) 

544 
or (hwRound(Gear^.Y) and LAND_HEIGHT_MASK <> 0) then 

2031
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2029
diff
changeset

545 
begin 
2087  546 
if (Gear^.Kind = gtSniperRifleShot) and ((GameFlags and gfLaserSight) = 0) then cLaserSighting:= false; 
2608  547 
if (Gear^.Ammo^.NumPerTurn <= CurrentHedgehog^.MultiShootAttacks) and 
2031
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2029
diff
changeset

548 
((GameFlags and gfArtillery) = 0) then cArtillery:= false; 
876  549 
Gear^.doStep:= @doStepShotIdle 
2031
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2029
diff
changeset

550 
end; 
37  551 
end; 
552 

559  553 
procedure doStepDEagleShot(Gear: PGear); 
554 
begin 

2745  555 
PlaySound(sndGun); 
2023
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset

556 
Gear^.doStep:= @doStepBulletWork 
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset

557 
end; 
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset

558 

41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset

559 
procedure doStepSniperRifleShot(Gear: PGear); 
2031
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2029
diff
changeset

560 
var HHGear: PGear; 
2828  561 
shell: PVisualGear; 
2023
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset

562 
begin 
2024
2985f3bd18b7
Disable long jump in artillery mode, make snipre rifle single shot
nemo
parents:
2023
diff
changeset

563 
cArtillery:= true; 
2031
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2029
diff
changeset

564 
HHGear:=PHedgehog(Gear^.Hedgehog)^.Gear; 
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2029
diff
changeset

565 
HHGear^.State:= HHGear^.State or gstNotKickable; 
2033  566 
HedgehogChAngle(HHGear); 
2220  567 
if not cLaserSighting then // game does not have default laser sight. turn it on and give them a chance to aim 
2023
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset

568 
begin 
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset

569 
cLaserSighting:= true; 
2031
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2029
diff
changeset

570 
HHGear^.Message:= 0; 
2052  571 
if(HHGear^.Angle  32 >= 0) then dec(HHGear^.Angle,32) 
2031
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2029
diff
changeset

572 
end; 
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2029
diff
changeset

573 

b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2029
diff
changeset

574 
if (HHGear^.Message and gm_Attack) <> 0 then 
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2029
diff
changeset

575 
begin 
2828  576 
shell:= AddVisualGear(hwRound(Gear^.x), hwRound(Gear^.y), vgtShell); 
577 
shell^.dX:= gear^.dX / 2; 

578 
shell^.dY:= gear^.dY / 2; 

579 
shell^.Frame:= 1; 

580 
Gear^.State:= Gear^.State or gstAnimation; 

2031
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2029
diff
changeset

581 
Gear^.dX:= SignAs(AngleSin(HHGear^.Angle), HHGear^.dX) * _0_5; 
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2029
diff
changeset

582 
Gear^.dY:= AngleCos(HHGear^.Angle) * _0_5; 
2745  583 
PlaySound(sndGun); 
2031
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2029
diff
changeset

584 
Gear^.doStep:= @doStepBulletWork; 
2024
2985f3bd18b7
Disable long jump in artillery mode, make snipre rifle single shot
nemo
parents:
2023
diff
changeset

585 
end 
2985f3bd18b7
Disable long jump in artillery mode, make snipre rifle single shot
nemo
parents:
2023
diff
changeset

586 
else 
2031
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2029
diff
changeset

587 
if (GameTicks mod 32) = 0 then 
2376  588 
if (GameTicks mod 4096) < 2048 then 
2052  589 
begin 
590 
if(HHGear^.Angle + 1 <= cMaxAngle) then inc(HHGear^.Angle) 

591 
end 

592 
else 

593 
if(HHGear^.Angle  1 >= 0) then dec(HHGear^.Angle); 

2024
2985f3bd18b7
Disable long jump in artillery mode, make snipre rifle single shot
nemo
parents:
2023
diff
changeset

594 

2376  595 
if (TurnTimeLeft > 0) then 
2058  596 
dec(TurnTimeLeft) 
597 
else 

598 
begin 

599 
DeleteGear(Gear); 

2608  600 
AfterAttack 
2058  601 
end; 
559  602 
end; 
603 

37  604 
//////////////////////////////////////////////////////////////////////////////// 
4  605 
procedure doStepActionTimer(Gear: PGear); 
606 
begin 

351  607 
dec(Gear^.Timer); 
608 
case Gear^.Kind of 

83  609 
gtATStartGame: begin 
4  610 
AllInactive:= false; 
351  611 
if Gear^.Timer = 0 then 
2619  612 
AddCaption(trmsg[sidStartFight], cWhiteColor, capgrpGameState); 
4  613 
end; 
83  614 
gtATSmoothWindCh: begin 
351  615 
if Gear^.Timer = 0 then 
6  616 
begin 
351  617 
if WindBarWidth < Gear^.Tag then inc(WindBarWidth) 
618 
else if WindBarWidth > Gear^.Tag then dec(WindBarWidth); 

619 
if WindBarWidth <> Gear^.Tag then Gear^.Timer:= 10; 

83  620 
end 
621 
end; 

622 
gtATFinishGame: begin 

623 
AllInactive:= false; 

351  624 
if Gear^.Timer = 0 then 
113  625 
begin 
626 
SendIPC('N'); 

324
f4c109c82a0c
Don't show game stats in case of interrupted by command '/quit' game
unc0rr
parents:
306
diff
changeset

627 
SendIPC('q'); 
83  628 
GameState:= gsExit 
113  629 
end 
6  630 
end; 
4  631 
end; 
351  632 
if Gear^.Timer = 0 then DeleteGear(Gear) 
4  633 
end; 
634 

635 
//////////////////////////////////////////////////////////////////////////////// 

636 
procedure doStepPickHammerWork(Gear: PGear); 

371  637 
var i, ei: LongInt; 
4  638 
HHGear: PGear; 
639 
begin 

70  640 
AllInactive:= false; 
351  641 
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; 
642 
dec(Gear^.Timer); 

643 
if (Gear^.Timer = 0)or((Gear^.Message and gm_Destroy) <> 0)or((HHGear^.State and gstHHDriven) = 0) then 

1200  644 
begin 
2745  645 
StopSound(Gear^.SoundChannel); 
1200  646 
DeleteGear(Gear); 
647 
AfterAttack; 

648 
exit 

649 
end; 

845  650 

422  651 
if (Gear^.Timer mod 33) = 0 then 
1200  652 
begin 
653 
HHGear^.State:= HHGear^.State or gstNoDamage; 

654 
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y) + 7, 6, EXPLDontDraw); 

655 
HHGear^.State:= HHGear^.State and not gstNoDamage 

656 
end; 

422  657 

658 
if (Gear^.Timer mod 47) = 0 then 

1200  659 
begin 
660 
i:= hwRound(Gear^.X)  Gear^.Radius  LongInt(GetRandom(2)); 

661 
ei:= hwRound(Gear^.X) + Gear^.Radius + LongInt(GetRandom(2)); 

662 
while i <= ei do 

663 
begin 

664 
DrawExplosion(i, hwRound(Gear^.Y) + 3, 3); 

665 
inc(i, 1) 

666 
end; 

2331
e4941a7986d6
Another try at keeping blowtorch/firepunch/jackhammer from going through indestructible stuff. Shame these routines don't use hedgehog movement
nemo
parents:
2329
diff
changeset

667 

e4941a7986d6
Another try at keeping blowtorch/firepunch/jackhammer from going through indestructible stuff. Shame these routines don't use hedgehog movement
nemo
parents:
2329
diff
changeset

668 
if CheckLandValue(hwRound(Gear^.X + Gear^.dX + SignAs(_6,Gear^.dX)), hwRound(Gear^.Y + _1_9), COLOR_INDESTRUCTIBLE) then 
2090
4edb0d49a42d
prevent unc0rr from getting clever with jackhammer too. bring blowtorch into line with the other  should be more fun anyway
nemo
parents:
2089
diff
changeset

669 
begin 
4edb0d49a42d
prevent unc0rr from getting clever with jackhammer too. bring blowtorch into line with the other  should be more fun anyway
nemo
parents:
2089
diff
changeset

670 
Gear^.X:= Gear^.X + Gear^.dX; 
4edb0d49a42d
prevent unc0rr from getting clever with jackhammer too. bring blowtorch into line with the other  should be more fun anyway
nemo
parents:
2089
diff
changeset

671 
Gear^.Y:= Gear^.Y + _1_9; 
4edb0d49a42d
prevent unc0rr from getting clever with jackhammer too. bring blowtorch into line with the other  should be more fun anyway
nemo
parents:
2089
diff
changeset

672 
end; 
1200  673 
SetAllHHToActive; 
674 
end; 

4  675 
if TestCollisionYwithGear(Gear, 1) then 
1200  676 
begin 
677 
Gear^.dY:= _0; 

678 
SetLittle(HHGear^.dX); 

679 
HHGear^.dY:= _0; 

680 
end else 

681 
begin 

682 
Gear^.dY:= Gear^.dY + cGravity; 

683 
Gear^.Y:= Gear^.Y + Gear^.dY; 

1417  684 
if hwRound(Gear^.Y) > cWaterLine then Gear^.Timer:= 1 
1200  685 
end; 
4  686 

351  687 
Gear^.X:= Gear^.X + HHGear^.dX; 
688 
HHGear^.X:= Gear^.X; 

498  689 
HHGear^.Y:= Gear^.Y  int2hwFloat(cHHRadius); 
4  690 

351  691 
if (Gear^.Message and gm_Attack) <> 0 then 
692 
if (Gear^.State and gsttmpFlag) <> 0 then Gear^.Timer:= 1 else else 

693 
if (Gear^.State and gsttmpFlag) = 0 then Gear^.State:= Gear^.State or gsttmpFlag; 

694 
if ((Gear^.Message and gm_Left) <> 0) then Gear^.dX:=  _0_3 else 

695 
if ((Gear^.Message and gm_Right) <> 0) then Gear^.dX:= _0_3 

498  696 
else Gear^.dX:= _0; 
4  697 
end; 
698 

699 
procedure doStepPickHammer(Gear: PGear); 

371  700 
var i, y: LongInt; 
4  701 
ar: TRangeArray; 
911
b709fe13ed69
Fix issue with hedgehog on top of the hedgehog with pickhammer
unc0rr
parents:
883
diff
changeset

702 
HHGear: PGear; 
4  703 
begin 
704 
i:= 0; 

911
b709fe13ed69
Fix issue with hedgehog on top of the hedgehog with pickhammer
unc0rr
parents:
883
diff
changeset

705 
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; 
b709fe13ed69
Fix issue with hedgehog on top of the hedgehog with pickhammer
unc0rr
parents:
883
diff
changeset

706 

498  707 
y:= hwRound(Gear^.Y)  cHHRadius * 2; 
351  708 
while y < hwRound(Gear^.Y) do 
4  709 
begin 
371  710 
ar[i].Left := hwRound(Gear^.X)  Gear^.Radius  LongInt(GetRandom(2)); 
711 
ar[i].Right:= hwRound(Gear^.X) + Gear^.Radius + LongInt(GetRandom(2)); 

4  712 
inc(y, 2); 
713 
inc(i) 

714 
end; 

911
b709fe13ed69
Fix issue with hedgehog on top of the hedgehog with pickhammer
unc0rr
parents:
883
diff
changeset

715 

498  716 
DrawHLinesExplosions(@ar, 3, hwRound(Gear^.Y)  cHHRadius * 2, 2, Pred(i)); 
911
b709fe13ed69
Fix issue with hedgehog on top of the hedgehog with pickhammer
unc0rr
parents:
883
diff
changeset

717 
Gear^.dY:= HHGear^.dY; 
b709fe13ed69
Fix issue with hedgehog on top of the hedgehog with pickhammer
unc0rr
parents:
883
diff
changeset

718 
DeleteCI(HHGear); 
b709fe13ed69
Fix issue with hedgehog on top of the hedgehog with pickhammer
unc0rr
parents:
883
diff
changeset

719 

2745  720 
Gear^.SoundChannel:= LoopSound(sndPickhammer); 
4  721 
doStepPickHammerWork(Gear); 
351  722 
Gear^.doStep:= @doStepPickHammerWork 
4  723 
end; 
724 

725 
//////////////////////////////////////////////////////////////////////////////// 

371  726 
var BTPrevAngle, BTSteps: LongInt; 
302  727 

303
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset

728 
procedure doStepBlowTorchWork(Gear: PGear); 
302  729 
var HHGear: PGear; 
1528  730 
b: boolean; 
731 
prevX: LongInt; 

302  732 
begin 
733 
AllInactive:= false; 

351  734 
dec(Gear^.Timer); 
735 
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; 

303
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset

736 

1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset

737 
HedgehogChAngle(HHGear); 
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset

738 

305  739 
b:= false; 
740 

371  741 
if abs(LongInt(HHGear^.Angle)  BTPrevAngle) > 7 then 
1528  742 
begin 
743 
Gear^.dX:= SignAs(AngleSin(HHGear^.Angle) * _0_5, HHGear^.dX); 

744 
Gear^.dY:= AngleCos(HHGear^.Angle) * (  _0_5); 

745 
BTPrevAngle:= HHGear^.Angle; 

746 
b:= true 

747 
end; 

748 

749 
if ((HHGear^.State and gstMoving) <> 0) then 

750 
begin 

751 
doStepHedgehogMoving(HHGear); 

1736  752 
if (HHGear^.State and gstHHDriven) = 0 then Gear^.Timer:= 0 
1528  753 
end; 
305  754 

351  755 
if Gear^.Timer mod cHHStepTicks = 0 then 
1528  756 
begin 
757 
b:= true; 

758 
if Gear^.dX.isNegative then 

1547  759 
HHGear^.Message:= (HHGear^.Message and (gm_Attack or gm_Up or gm_Down)) or gm_Left 
1528  760 
else 
1547  761 
HHGear^.Message:= (HHGear^.Message and (gm_Attack or gm_Up or gm_Down)) or gm_Right; 
305  762 

1528  763 
if ((HHGear^.State and gstMoving) = 0) then 
764 
begin 

765 
HHGear^.State:= HHGear^.State and not gstAttacking; 

766 
prevX:= hwRound(HHGear^.X); 

2376  767 

768 
// why the call to HedgehogStep then a further increment of X? 

769 
if (prevX = hwRound(HHGear^.X)) and 

2331
e4941a7986d6
Another try at keeping blowtorch/firepunch/jackhammer from going through indestructible stuff. Shame these routines don't use hedgehog movement
nemo
parents:
2329
diff
changeset

770 
CheckLandValue(hwRound(HHGear^.X + SignAs(_6, HHGear^.dX)), hwRound(HHGear^.Y), COLOR_INDESTRUCTIBLE) then HedgehogStep(HHGear); 
2376  771 

772 
if (prevX = hwRound(HHGear^.X)) and 

2331
e4941a7986d6
Another try at keeping blowtorch/firepunch/jackhammer from going through indestructible stuff. Shame these routines don't use hedgehog movement
nemo
parents:
2329
diff
changeset

773 
CheckLandValue(hwRound(HHGear^.X + SignAs(_6, HHGear^.dX)), hwRound(HHGear^.Y), COLOR_INDESTRUCTIBLE) then HHGear^.X:= HHGear^.X + SignAs(_1, HHGear^.dX); 
1528  774 
HHGear^.State:= HHGear^.State or gstAttacking 
775 
end; 

305  776 

1528  777 
inc(BTSteps); 
778 
if BTSteps = 7 then 

779 
begin 

780 
BTSteps:= 0; 

2331
e4941a7986d6
Another try at keeping blowtorch/firepunch/jackhammer from going through indestructible stuff. Shame these routines don't use hedgehog movement
nemo
parents:
2329
diff
changeset

781 
if CheckLandValue(hwRound(HHGear^.X + Gear^.dX * (cHHRadius + cBlowTorchC) + SignAs(_6,Gear^.dX)), hwRound(HHGear^.Y + Gear^.dY * (cHHRadius + cBlowTorchC)), COLOR_INDESTRUCTIBLE) then 
2090
4edb0d49a42d
prevent unc0rr from getting clever with jackhammer too. bring blowtorch into line with the other  should be more fun anyway
nemo
parents:
2089
diff
changeset

782 
begin 
2331
e4941a7986d6
Another try at keeping blowtorch/firepunch/jackhammer from going through indestructible stuff. Shame these routines don't use hedgehog movement
nemo
parents:
2329
diff
changeset

783 
Gear^.X:= HHGear^.X + Gear^.dX * (cHHRadius + cBlowTorchC); 
e4941a7986d6
Another try at keeping blowtorch/firepunch/jackhammer from going through indestructible stuff. Shame these routines don't use hedgehog movement
nemo
parents:
2329
diff
changeset

784 
Gear^.Y:= HHGear^.Y + Gear^.dY * (cHHRadius + cBlowTorchC); 
2090
4edb0d49a42d
prevent unc0rr from getting clever with jackhammer too. bring blowtorch into line with the other  should be more fun anyway
nemo
parents:
2089
diff
changeset

785 
end; 
1528  786 
HHGear^.State:= HHGear^.State or gstNoDamage; 
1643  787 
AmmoShove(Gear, 2, 15); 
1528  788 
HHGear^.State:= HHGear^.State and not gstNoDamage 
789 
end; 

790 
end; 

305  791 

792 
if b then 

498  793 
DrawTunnel(HHGear^.X  Gear^.dX * cHHRadius, HHGear^.Y  _4  Gear^.dY * cHHRadius + hwAbs(Gear^.dY) * 7, 
351  794 
Gear^.dX, Gear^.dY, 
1501  795 
cHHRadius * 5, cHHRadius * 2 + 7); 
305  796 

2090
4edb0d49a42d
prevent unc0rr from getting clever with jackhammer too. bring blowtorch into line with the other  should be more fun anyway
nemo
parents:
2089
diff
changeset

797 
if (Gear^.Timer = 0) or ((HHGear^.Message and gm_Attack) <> 0) then 
1528  798 
begin 
799 
HHGear^.Message:= 0; 

800 
HHGear^.State:= HHGear^.State and (not gstNotKickable); 

801 
DeleteGear(Gear); 

802 
AfterAttack 

803 
end 

302  804 
end; 
805 

303
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset

806 
procedure doStepBlowTorch(Gear: PGear); 
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset

807 
var HHGear: PGear; 
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset

808 
begin 
371  809 
BTPrevAngle:= High(LongInt); 
305  810 
BTSteps:= 0; 
351  811 
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; 
812 
HHGear^.Message:= 0; 

1528  813 
HHGear^.State:= HHGear^.State or gstNotKickable; 
351  814 
Gear^.doStep:= @doStepBlowTorchWork 
303
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset

815 
end; 
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset

816 

302  817 
//////////////////////////////////////////////////////////////////////////////// 
818 

1781  819 
procedure doStepRope(Gear: PGear); forward; 
820 

821 
procedure doStepRopeAfterAttack(Gear: PGear); 

822 
var HHGear: PGear; 

823 
begin 

824 
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; 

825 
if ((HHGear^.State and gstHHDriven) = 0) 

826 
or (CheckGearDrowning(HHGear)) 

827 
or TestCollisionYwithGear(HHGear, 1) then 

828 
begin 

829 
DeleteGear(Gear); 

2060
3e9e5e1be6f5
fix crash in parachute/rope if drowning with active girder/teleport
nemo
parents:
2059
diff
changeset

830 
isCursorVisible:= false; 
1781  831 
exit 
832 
end; 

833 

1785  834 
HedgehogChAngle(HHGear); 
835 

2283  836 
if TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then SetLittle(HHGear^.dX); 
2029  837 

1781  838 
if HHGear^.dY.isNegative and TestCollisionYwithGear(HHGear, 1) then HHGear^.dY:= _0; 
839 
HHGear^.X:= HHGear^.X + HHGear^.dX; 

840 
HHGear^.Y:= HHGear^.Y + HHGear^.dY; 

841 
HHGear^.dY:= HHGear^.dY + cGravity; 

842 

843 
if (Gear^.Message and gm_Attack) <> 0 then 

844 
begin 

845 
Gear^.X:= HHGear^.X; 

846 
Gear^.Y:= HHGear^.Y; 

1964  847 

848 
ApplyAngleBounds(PHedgehog(Gear^.Hedgehog)^, amRope); 

2376  849 

1781  850 
Gear^.dX:= SignAs(AngleSin(HHGear^.Angle), HHGear^.dX); 
851 
Gear^.dY:= AngleCos(HHGear^.Angle); 

852 
Gear^.Friction:= _450; 

853 
Gear^.Elasticity:= _0; 

854 
Gear^.State:= Gear^.State and not gsttmpflag; 

855 
Gear^.doStep:= @doStepRope 

856 
end 

857 
end; 

858 

4  859 
procedure doStepRopeWork(Gear: PGear); 
860 
var HHGear: PGear; 

1669  861 
len, tx, ty, nx, ny, ropeDx, ropeDy, mdX, mdY: hwFloat; 
1504  862 
lx, ly: LongInt; 
1553
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset

863 
haveCollision, 
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset

864 
haveDivided: boolean; 
4  865 

1504  866 
procedure DeleteMe; 
867 
begin 

868 
with HHGear^ do 

869 
begin 

870 
Message:= Message and not gm_Attack; 

2025
692308790912
Adjust routines impacted by DrawRotatedF modification, clear gstHHHJump in rope to avoid crosshair/hat drawing bug.
nemo
parents:
2024
diff
changeset

871 
State:= (State or gstMoving) and not gstWinner; 
1504  872 
end; 
873 
DeleteGear(Gear) 

874 
end; 

4  875 

1781  876 
procedure WaitCollision; 
877 
begin 

878 
with HHGear^ do 

879 
begin 

880 
Message:= Message and not gm_Attack; 

881 
State:= State or gstMoving; 

882 
end; 

883 
RopePoints.Count:= 0; 

884 
Gear^.Elasticity:= _0; 

885 
Gear^.doStep:= @doStepRopeAfterAttack 

886 
end; 

887 

4  888 
begin 
351  889 
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; 
108  890 

351  891 
if ((HHGear^.State and gstHHDriven) = 0) 
1504  892 
or (CheckGearDrowning(HHGear)) then 
893 
begin 

894 
DeleteMe; 

895 
exit 

896 
end; 

928
b9064b48b001
Some preparation work for attacking from rope, parachute and etc.
unc0rr
parents:
925
diff
changeset

897 

351  898 
if (Gear^.Message and gm_Left <> 0) then HHGear^.dX:= HHGear^.dX  _0_0002 else 
899 
if (Gear^.Message and gm_Right <> 0) then HHGear^.dX:= HHGear^.dX + _0_0002; 

4  900 

351  901 
if not TestCollisionYwithGear(HHGear, 1) then HHGear^.dY:= HHGear^.dY + cGravity; 
4  902 

1652  903 
ropeDx:= HHGear^.X  Gear^.X; // vector between hedgehog and rope attaching point 
904 
ropeDy:= HHGear^.Y  Gear^.Y; 

905 

906 
mdX:= ropeDx + HHGear^.dX; 

907 
mdY:= ropeDy + HHGear^.dY; 

908 
len:= _1 / Distance(mdX, mdY); 

909 
mdX:= mdX * len; // rope vector plus hedgehog direction vector normalized 

910 
mdY:= mdY * len; 

911 

912 
Gear^.dX:= mdX; // for visual purposes only 

913 
Gear^.dY:= mdY; 

914 

915 
///// 

916 
tx:= HHGear^.X; 

917 
ty:= HHGear^.Y; 

4  918 

1652  919 
if ((Gear^.Message and gm_Down) <> 0) and (Gear^.Elasticity < Gear^.Friction) then 
920 
if not (TestCollisionXwithGear(HHGear, hwSign(ropeDx)) 

921 
or TestCollisionYwithGear(HHGear, hwSign(ropeDy))) then 

922 
Gear^.Elasticity:= Gear^.Elasticity + _0_3; 

923 

924 
if ((Gear^.Message and gm_Up) <> 0) and (Gear^.Elasticity > _30) then 

925 
if not (TestCollisionXwithGear(HHGear, hwSign(ropeDx)) 

926 
or TestCollisionYwithGear(HHGear, hwSign(ropeDy))) then 

927 
Gear^.Elasticity:= Gear^.Elasticity  _0_3; 

928 

929 
HHGear^.X:= Gear^.X + mdX * Gear^.Elasticity; 

930 
HHGear^.Y:= Gear^.Y + mdY * Gear^.Elasticity; 

931 

932 
HHGear^.dX:= HHGear^.X  tx; 

933 
HHGear^.dY:= HHGear^.Y  ty; 

934 
//// 

935 

1554  936 

1922  937 
haveDivided:= false; 
1553
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset

938 
// check whether rope needs dividing 
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset

939 
len:= _1 / Distance(ropeDx, ropeDy); // old rope pos 
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset

940 
nx:= ropeDx * len; 
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset

941 
ny:= ropeDy * len; 
2376  942 

1652  943 
len:= Gear^.Elasticity  _0_3x70; 
2365  944 
while len > _3 do 
1504  945 
begin 
1652  946 
lx:= hwRound(Gear^.X + mdX * len); 
947 
ly:= hwRound(Gear^.Y + mdY * len); 

1753  948 
if ((ly and LAND_HEIGHT_MASK) = 0) and ((lx and LAND_WIDTH_MASK) = 0) and (Land[ly, lx] <> 0) then 
1504  949 
begin 
950 
with RopePoints.ar[RopePoints.Count] do 

951 
begin 

952 
X:= Gear^.X; 

953 
Y:= Gear^.Y; 

1553
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset

954 
if RopePoints.Count = 0 then RopePoints.HookAngle:= DxDy2Angle(Gear^.dY, Gear^.dX); 
1652  955 
b:= (nx * HHGear^.dY) > (ny * HHGear^.dX); 
1504  956 
dLen:= len 
957 
end; 

2365  958 
with RopePoints.rounded[RopePoints.Count] do 
959 
begin 

960 
X:= hwRound(Gear^.X); 

961 
Y:= hwRound(Gear^.Y); 

962 
end; 

2376  963 

1553
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset

964 
Gear^.X:= Gear^.X + nx * len; 
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset

965 
Gear^.Y:= Gear^.Y + ny * len; 
1504  966 
inc(RopePoints.Count); 
967 
TryDo(RopePoints.Count <= MAXROPEPOINTS, 'Rope points overflow', true); 

968 
Gear^.Elasticity:= Gear^.Elasticity  len; 

969 
Gear^.Friction:= Gear^.Friction  len; 

1553
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset

970 
haveDivided:= true; 
1504  971 
break 
972 
end; 

1553
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset

973 
len:= len  _0_3 // should be the same as increase step 
1504  974 
end; 
1553
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset

975 

77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset

976 
if not haveDivided then 
1504  977 
if RopePoints.Count > 0 then // check whether the last dividing point could be removed 
978 
begin 

979 
tx:= RopePoints.ar[Pred(RopePoints.Count)].X; 

980 
ty:= RopePoints.ar[Pred(RopePoints.Count)].Y; 

981 
if RopePoints.ar[Pred(RopePoints.Count)].b xor ((tx  Gear^.X) * (ty  HHGear^.Y) > (tx  HHGear^.X) * (ty  Gear^.Y)) then 

982 
begin 

983 
dec(RopePoints.Count); 

1652  984 
Gear^.X:= RopePoints.ar[RopePoints.Count].X; 
985 
Gear^.Y:= RopePoints.ar[RopePoints.Count].Y; 

1504  986 
Gear^.Elasticity:= Gear^.Elasticity + RopePoints.ar[RopePoints.Count].dLen; 
987 
Gear^.Friction:= Gear^.Friction + RopePoints.ar[RopePoints.Count].dLen 

988 
end 

989 
end; 

4  990 

1551
c747e69f98f3
Add some speed to hedgehog on rope when colliding with land and pressing left or right arrow key
unc0rr
parents:
1548
diff
changeset

991 
haveCollision:= false; 
351  992 
if TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then 
1551
c747e69f98f3
Add some speed to hedgehog on rope when colliding with land and pressing left or right arrow key
unc0rr
parents:
1548
diff
changeset

993 
begin 
1504  994 
HHGear^.dX:= _0_6 * HHGear^.dX; 
1551
c747e69f98f3
Add some speed to hedgehog on rope when colliding with land and pressing left or right arrow key
unc0rr
parents:
1548
diff
changeset

995 
haveCollision:= true 
c747e69f98f3
Add some speed to hedgehog on rope when colliding with land and pressing left or right arrow key
unc0rr
parents:
1548
diff
changeset

996 
end; 
351  997 
if TestCollisionYwithGear(HHGear, hwSign(HHGear^.dY)) then 
1551
c747e69f98f3
Add some speed to hedgehog on rope when colliding with land and pressing left or right arrow key
unc0rr
parents:
1548
diff
changeset

998 
begin 
1504  999 
HHGear^.dY:= _0_6 * HHGear^.dY; 
1551
c747e69f98f3
Add some speed to hedgehog on rope when colliding with land and pressing left or right arrow key
unc0rr
parents:
1548
diff
changeset

1000 
haveCollision:= true 
c747e69f98f3
Add some speed to hedgehog on rope when colliding with land and pressing left or right arrow key
unc0rr
parents:
1548
diff
changeset

1001 
end; 
c747e69f98f3
Add some speed to hedgehog on rope when colliding with land and pressing left or right arrow key
unc0rr
parents:
1548
diff
changeset

1002 

1579
2f581b1f289e
More bouncy rope, but you need to press vertical arrow and horizontal keys at once to bounce
unc0rr
parents:
1573
diff
changeset

1003 
if haveCollision 
2f581b1f289e
More bouncy rope, but you need to press vertical arrow and horizontal keys at once to bounce
unc0rr
parents:
1573
diff
changeset

1004 
and (Gear^.Message and (gm_Left or gm_Right) <> 0) 
2f581b1f289e
More bouncy rope, but you need to press vertical arrow and horizontal keys at once to bounce
unc0rr
parents:
1573
diff
changeset

1005 
and (Gear^.Message and (gm_Up or gm_Down) <> 0) then 
1551
c747e69f98f3
Add some speed to hedgehog on rope when colliding with land and pressing left or right arrow key
unc0rr
parents:
1548
diff
changeset

1006 
begin 
1579
2f581b1f289e
More bouncy rope, but you need to press vertical arrow and horizontal keys at once to bounce
unc0rr
parents:
1573
diff
changeset

1007 
HHGear^.dX:= SignAs(hwAbs(HHGear^.dX) + _0_2, HHGear^.dX); 
2f581b1f289e
More bouncy rope, but you need to press vertical arrow and horizontal keys at once to bounce
unc0rr
parents:
1573
diff
changeset

1008 
HHGear^.dY:= SignAs(hwAbs(HHGear^.dY) + _0_2, HHGear^.dY) 
1551
c747e69f98f3
Add some speed to hedgehog on rope when colliding with land and pressing left or right arrow key
unc0rr
parents:
1548
diff
changeset

1009 
end; 
4  1010 

789  1011 
len:= Distance(HHGear^.dX, HHGear^.dY); 
940  1012 
if len > _0_8 then 
1504  1013 
begin 
1014 
len:= _0_8 / len; 

1015 
HHGear^.dX:= HHGear^.dX * len; 

1016 
HHGear^.dY:= HHGear^.dY * len; 

1017 
end; 

789  1018 

351  1019 
if (Gear^.Message and gm_Attack) <> 0 then 
1504  1020 
if (Gear^.State and gsttmpFlag) <> 0 then 
1922  1021 
with PHedgehog(Gear^.Hedgehog)^ do 
1964  1022 
if Ammo^[CurSlot, CurAmmo].AmmoType <> amParachute then 
1922  1023 
WaitCollision 
1024 
else 

1025 
DeleteMe 

1504  1026 
else 
1027 
else 

1028 
if (Gear^.State and gsttmpFlag) = 0 then 

1029 
Gear^.State:= Gear^.State or gsttmpFlag; 

4  1030 
end; 
1031 

1032 
procedure doStepRopeAttach(Gear: PGear); 

1033 
var HHGear: PGear; 

1781  1034 
tx, ty, tt: hwFloat; 
1035 

1036 
procedure RemoveFromAmmo; 

1037 
begin 

1038 
if (Gear^.State and gstAttacked) = 0 then 

1039 
begin 

1040 
OnUsedAmmo(PHedgehog(HHGear^.Hedgehog)^); 

1041 
Gear^.State:= Gear^.State or gstAttacked 

1964  1042 
end; 
1043 
ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^) 

1781  1044 
end; 
2376  1045 

4  1046 
begin 
351  1047 
Gear^.X:= Gear^.X  Gear^.dX; 
1048 
Gear^.Y:= Gear^.Y  Gear^.dY; 

498  1049 
Gear^.Elasticity:= Gear^.Elasticity + _1; 
2524
0b075d38fee5
Fix bug when rope goes through land when hedgehog is sliding
unc0rr
parents:
2515
diff
changeset

1050 

351  1051 
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; 
517  1052 
DeleteCI(HHGear); 
2524
0b075d38fee5
Fix bug when rope goes through land when hedgehog is sliding
unc0rr
parents:
2515
diff
changeset

1053 

542  1054 
if (HHGear^.State and gstMoving) <> 0 then 
1433  1055 
begin 
2282  1056 
if TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then SetLittle(HHGear^.dX); 
2329
1cfb7d184ee1
Fix bug with hedgehog getting into ground while throwing rope (http://hedgewars.org/node/1722)
unc0rr
parents:
2301
diff
changeset

1057 
if HHGear^.dY.isNegative and TestCollisionYwithGear(HHGear, 1) then HHGear^.dY:= _0; 
2376  1058 

1433  1059 
HHGear^.X:= HHGear^.X + HHGear^.dX; 
1060 
Gear^.X:= Gear^.X + HHGear^.dX; 

2281
3217f0d8c420
Fix hedgehog stopping to slide when throwing rope (not tested)
unc0rr
parents:
2280
diff
changeset

1061 

3217f0d8c420
Fix hedgehog stopping to slide when throwing rope (not tested)
unc0rr
parents:
2280
diff
changeset

1062 
if TestCollisionYwithGear(HHGear, 1) then 
3217f0d8c420
Fix hedgehog stopping to slide when throwing rope (not tested)
unc0rr
parents:
2280
diff
changeset

1063 
begin 
3217f0d8c420
Fix hedgehog stopping to slide when throwing rope (not tested)
unc0rr
parents:
2280
diff
changeset

1064 
CheckHHDamage(HHGear); 
3217f0d8c420
Fix hedgehog stopping to slide when throwing rope (not tested)
unc0rr
parents:
2280
diff
changeset

1065 
HHGear^.dY:= _0; 
2339  1066 
//HHGear^.State:= HHGear^.State and not (gstHHJumping or gstHHHJump); 
2281
3217f0d8c420
Fix hedgehog stopping to slide when throwing rope (not tested)
unc0rr
parents:
2280
diff
changeset

1067 
end else 
1433  1068 
begin 
2281
3217f0d8c420
Fix hedgehog stopping to slide when throwing rope (not tested)
unc0rr
parents:
2280
diff
changeset

1069 
HHGear^.Y:= HHGear^.Y + HHGear^.dY; 
3217f0d8c420
Fix hedgehog stopping to slide when throwing rope (not tested)
unc0rr
parents:
2280
diff
changeset

1070 
Gear^.Y:= Gear^.Y + HHGear^.dY; 
3217f0d8c420
Fix hedgehog stopping to slide when throwing rope (not tested)
unc0rr
parents:
2280
diff
changeset

1071 
HHGear^.dY:= HHGear^.dY + cGravity; 
2524
0b075d38fee5
Fix bug when rope goes through land when hedgehog is sliding
unc0rr
parents:
2515
diff
changeset

1072 
end; 
0b075d38fee5
Fix bug when rope goes through land when hedgehog is sliding
unc0rr
parents:
2515
diff
changeset

1073 

0b075d38fee5
Fix bug when rope goes through land when hedgehog is sliding
unc0rr
parents:
2515
diff
changeset

1074 
tt:= Gear^.Elasticity; 
0b075d38fee5
Fix bug when rope goes through land when hedgehog is sliding
unc0rr
parents:
2515
diff
changeset

1075 
tx:= _0; 
0b075d38fee5
Fix bug when rope goes through land when hedgehog is sliding
unc0rr
parents:
2515
diff
changeset

1076 
ty:= _0; 
0b075d38fee5
Fix bug when rope goes through land when hedgehog is sliding
unc0rr
parents:
2515
diff
changeset

1077 
while tt > _20 do 
0b075d38fee5
Fix bug when rope goes through land when hedgehog is sliding
unc0rr
parents:
2515
diff
changeset

1078 
begin 
0b075d38fee5
Fix bug when rope goes through land when hedgehog is sliding
unc0rr
parents:
2515
diff
changeset

1079 
if TestCollisionXwithXYShift(Gear, tx, hwRound(ty), hwSign(Gear^.dX)) 
0b075d38fee5
Fix bug when rope goes through land when hedgehog is sliding
unc0rr
parents:
2515
diff
changeset

1080 
or TestCollisionYwithXYShift(Gear, hwRound(tx), hwRound(ty), hwSign(Gear^.dY)) then 
1433  1081 
begin 
2524
0b075d38fee5
Fix bug when rope goes through land when hedgehog is sliding
unc0rr
parents:
2515
diff
changeset

1082 
Gear^.X:= Gear^.X + tx; 
0b075d38fee5
Fix bug when rope goes through land when hedgehog is sliding
unc0rr
parents:
2515
diff
changeset

1083 
Gear^.Y:= Gear^.Y + ty; 
0b075d38fee5
Fix bug when rope goes through land when hedgehog is sliding
unc0rr
parents:
2515
diff
changeset

1084 
Gear^.Elasticity:= tt; 
0b075d38fee5
Fix bug when rope goes through land when hedgehog is sliding
unc0rr
parents:
2515
diff
changeset

1085 
Gear^.doStep:= @doStepRopeWork; 
0b075d38fee5
Fix bug when rope goes through land when hedgehog is sliding
unc0rr
parents:
2515
diff
changeset

1086 
with HHGear^ do State:= State and not (gstAttacking or gstHHJumping or gstHHHJump); 
2376  1087 

2524
0b075d38fee5
Fix bug when rope goes through land when hedgehog is sliding
unc0rr
parents:
2515
diff
changeset

1088 
RemoveFromAmmo; 
2376  1089 

2524
0b075d38fee5
Fix bug when rope goes through land when hedgehog is sliding
unc0rr
parents:
2515
diff
changeset

1090 
tt:= _0; 
0b075d38fee5
Fix bug when rope goes through land when hedgehog is sliding
unc0rr
parents:
2515
diff
changeset

1091 
exit 
1433  1092 
end; 
2524
0b075d38fee5
Fix bug when rope goes through land when hedgehog is sliding
unc0rr
parents:
2515
diff
changeset

1093 
tx:= tx + Gear^.dX + Gear^.dX; 
0b075d38fee5
Fix bug when rope goes through land when hedgehog is sliding
unc0rr
parents:
2515
diff
changeset

1094 
ty:= ty + Gear^.dY + Gear^.dY; 
0b075d38fee5
Fix bug when rope goes through land when hedgehog is sliding
unc0rr
parents:
2515
diff
changeset

1095 
tt:= tt  _2; 
1433  1096 
end; 
1097 
end; 

929
9456e1e77369
 Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset

1098 

4  1099 
CheckCollision(Gear); 
929
9456e1e77369
 Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset

1100 

351  1101 
if (Gear^.State and gstCollision) <> 0 then 
2068  1102 
if Gear^.Elasticity < _10 then 
1103 
Gear^.Elasticity:= _10000 

1104 
else 

1105 
begin 

1106 
Gear^.doStep:= @doStepRopeWork; 

2339  1107 
with HHGear^ do State:= State and not (gstAttacking or gstHHJumping or gstHHHJump); 
929
9456e1e77369
 Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset

1108 

2068  1109 
RemoveFromAmmo; 
2376  1110 

2068  1111 
exit 
1112 
end; 

4  1113 

1634
486a89f0e843
Fix rope bug which allowed hedgehog to go into land
unc0rr
parents:
1633
diff
changeset

1114 
if (Gear^.Elasticity > Gear^.Friction) 
486a89f0e843
Fix rope bug which allowed hedgehog to go into land
unc0rr
parents:
1633
diff
changeset

1115 
or ((Gear^.Message and gm_Attack) = 0) 
2280  1116 
or ((HHGear^.State and gstHHDriven) = 0) 
1634
486a89f0e843
Fix rope bug which allowed hedgehog to go into land
unc0rr
parents:
1633
diff
changeset

1117 
or (HHGear^.Damage > 0) then 
1433  1118 
begin 
1119 
with PHedgehog(Gear^.Hedgehog)^.Gear^ do 

1120 
begin 

1121 
State:= State and not gstAttacking; 

1122 
Message:= Message and not gm_Attack 

1123 
end; 

1124 
DeleteGear(Gear) 

1125 
end 

4  1126 
end; 
1127 

1128 
procedure doStepRope(Gear: PGear); 

1129 
begin 

351  1130 
Gear^.dX:=  Gear^.dX; 
1131 
Gear^.dY:=  Gear^.dY; 

1132 
Gear^.doStep:= @doStepRopeAttach 

4  1133 
end; 
1134 

1135 
//////////////////////////////////////////////////////////////////////////////// 

1136 
procedure doStepSmokeTrace(Gear: PGear); 

1137 
begin 

351  1138 
inc(Gear^.Timer); 
1139 
if Gear^.Timer > 64 then 

1133  1140 
begin 
1141 
Gear^.Timer:= 0; 

1142 
dec(Gear^.State) 

1143 
end; 

351  1144 
Gear^.dX:= Gear^.dX + cWindSpeed; 
1145 
Gear^.X:= Gear^.X + Gear^.dX; 

1146 
if Gear^.State = 0 then DeleteGear(Gear) 

4  1147 
end; 
9  1148 

1149 
//////////////////////////////////////////////////////////////////////////////// 

1045  1150 
procedure doStepExplosionWork(Gear: PGear); 
9  1151 
begin 
351  1152 
inc(Gear^.Timer); 
1153 
if Gear^.Timer > 75 then 

1133  1154 
begin 
1155 
inc(Gear^.State); 

1156 
Gear^.Timer:= 0; 

1157 
if Gear^.State > 5 then DeleteGear(Gear) 

1158 
end; 

9  1159 
end; 
10  1160 

1045  1161 
procedure doStepExplosion(Gear: PGear); 
1162 
var i: LongWord; 

1163 
begin 

1047  1164 
for i:= 0 to 31 do AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtFire); 
1165 
for i:= 0 to 8 do AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtExplPart); 

1166 
for i:= 0 to 8 do AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtExplPart2); 

1045  1167 
Gear^.doStep:= @doStepExplosionWork 
1168 
end; 

1169 

10  1170 
//////////////////////////////////////////////////////////////////////////////// 
1171 
procedure doStepMine(Gear: PGear); 

1172 
begin 

542  1173 
if (Gear^.State and gstMoving) <> 0 then 
914  1174 
begin 
1175 
DeleteCI(Gear); 

1176 
doStepFallingGear(Gear); 

1177 
if (Gear^.State and gstMoving) = 0 then 

1178 
begin 

1179 
AddGearCI(Gear); 

1180 
Gear^.dX:= _0; 

1181 
Gear^.dY:= _0 

1182 
end; 

1183 
CalcRotationDirAngle(Gear); 

1184 
AllInactive:= false 

1185 
end else 

1186 
if ((GameTicks and $3F) = 25) then 

1187 
doStepFallingGear(Gear); 

351  1188 

1189 
if ((Gear^.State and gsttmpFlag) <> 0) then 

1133  1190 
if ((Gear^.State and gstAttacking) = 0) then 
1191 
begin 

1192 
if ((GameTicks and $1F) = 0) then 

1193 
if CheckGearNear(Gear, gtHedgehog, 46, 32) <> nil then Gear^.State:= Gear^.State or gstAttacking 

1194 
end else // gstAttacking <> 0 

1195 
begin 

1196 
AllInactive:= false; 

2745  1197 
if (Gear^.Timer and $FF) = 0 then PlaySound(sndMineTick); 
1133  1198 
if Gear^.Timer = 0 then 
1199 
begin 

1200 
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound); 

1201 
DeleteGear(Gear); 

1202 
exit 

1203 
end; 

1204 
dec(Gear^.Timer); 

1205 
end else // gsttmpFlag = 0 

1206 
if TurnTimeLeft = 0 then Gear^.State:= Gear^.State or gsttmpFlag; 

10  1207 
end; 
57  1208 

39  1209 
//////////////////////////////////////////////////////////////////////////////// 
1210 
procedure doStepDynamite(Gear: PGear); 

1211 
begin 

43  1212 
doStepFallingGear(Gear); 
1213 
AllInactive:= false; 

351  1214 
if Gear^.Timer mod 166 = 0 then inc(Gear^.Tag); 
2647  1215 
if Gear^.Timer = 1000 then // might need better timing 
1216 
makeHogsWorry(Gear^.X, Gear^.Y, 75); 

351  1217 
if Gear^.Timer = 0 then 
1133  1218 
begin 
1219 
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 75, EXPLAutoSound); 

1220 
DeleteGear(Gear); 

1221 
exit 

1222 
end; 

351  1223 
dec(Gear^.Timer); 
39  1224 
end; 
14
81f125629b25
 Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset

1225 

351  1226 
/////////////////////////////////////////////////////////////////////////////// 
14
81f125629b25
 Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset

1227 
procedure doStepCase(Gear: PGear); 
371  1228 
var i, x, y: LongInt; 
1436  1229 
k: TGearType; 
14
81f125629b25
 Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset

1230 
begin 
351  1231 
if (Gear^.Message and gm_Destroy) > 0 then 
1133  1232 
begin 
1233 
DeleteGear(Gear); 

1234 
FreeActionsList; 

1235 
SetAllToActive; // something (hh, mine, etc...) could be on top of the case 

1236 
with CurrentHedgehog^ do 

1237 
if Gear <> nil then Gear^.Message:= Gear^.Message and not (gm_LJump or gm_HJump); 

1238 
exit 

1239 
end; 

15  1240 

351  1241 
if Gear^.Damage > 0 then 
1133  1242 
begin 
1243 
x:= hwRound(Gear^.X); 

1244 
y:= hwRound(Gear^.Y); 

1436  1245 
k:= Gear^.Kind; 
1246 
DeleteGear(Gear); // < delete gear! 

2376  1247 

1436  1248 
if k = gtCase then 
1133  1249 
begin 
1250 
doMakeExplosion(x, y, 25, EXPLAutoSound); 

1251 
for i:= 0 to 63 do 

1252 
AddGear(x, y, gtFlame, 0, _0, _0, 0); 

1253 
end; 

1254 
exit 

1255 
end; 

79  1256 

351  1257 
if (Gear^.dY.QWordValue <> 0) or (not TestCollisionYwithGear(Gear, 1)) then 
1133  1258 
begin 
1259 
AllInactive:= false; 

1260 
Gear^.dY:= Gear^.dY + cGravity; 

1261 
Gear^.Y:= Gear^.Y + Gear^.dY; 

1262 
if (Gear^.dY.isNegative) and TestCollisionYwithGear(Gear, 1) then Gear^.dY:= _0 else 

1263 
if (not Gear^.dY.isNegative) and TestCollisionYwithGear(Gear, 1) then 

1264 
begin 

1265 
Gear^.dY:=  Gear^.dY * Gear^.Elasticity; 

1266 
if Gear^.dY >  _0_001 then Gear^.dY:= _0 

2745  1267 
else if Gear^.dY <  _0_03 then PlaySound(sndGraveImpact); 
1133  1268 
end; 
1269 
CheckGearDrowning(Gear); 

1270 
end; 

14
81f125629b25
 Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset

1271 

511  1272 
if (Gear^.dY.QWordValue = 0) then AddGearCI(Gear) 
1133  1273 
else if (Gear^.dY.QWordValue <> 0) then DeleteCI(Gear) 
14
81f125629b25
 Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset

1274 
end; 
49  1275 

1276 
//////////////////////////////////////////////////////////////////////////////// 

2460  1277 

1278 
procedure doStepTarget(Gear: PGear); 

1279 
begin 

1280 
if (Gear^.Timer = 0) and (Gear^.Tag = 0) then 

2745  1281 
PlaySound(sndWarp); 
2460  1282 

1283 
if (Gear^.Tag = 0) and (Gear^.Timer < 1000) then 

1284 
inc(Gear^.Timer) 

1285 
else if Gear^.Tag = 1 then 

2468
0b62498c201a
openal fix, training map selection and rcplane adjustments from Smaxx (untested, but look reasonable). Bunch of new graphics from Tiy, new translation for ptpt from inu_
nemo
parents:
2462
diff
changeset

1286 
begin 
0b62498c201a
openal fix, training map selection and rcplane adjustments from Smaxx (untested, but look reasonable). Bunch of new graphics from Tiy, new translation for ptpt from inu_
nemo
parents:
2462
diff
changeset

1287 
Gear^.Tag:= 2; 
0b62498c201a
openal fix, training map selection and rcplane adjustments from Smaxx (untested, but look reasonable). Bunch of new graphics from Tiy, new translation for ptpt from inu_
nemo
parents:
2462
diff
changeset

1288 
if (TrainingFlags and tfTimeTrial) <> 0 then 
0b62498c201a
openal fix, training map selection and rcplane adjustments from Smaxx (untested, but look reasonable). Bunch of new graphics from Tiy, new translation for ptpt from inu_
nemo
parents:
2462
diff
changeset

1289 
begin 
2460  1290 
inc(TurnTimeLeft, TrainingTimeInc); 
1291 

1292 
if TrainingTimeInc > TrainingTimeInM then 

1293 
dec(TrainingTimeInc, TrainingTimeInD); 

1294 
if TurnTimeLeft > TrainingTimeMax then 

1295 
TurnTimeLeft:= TrainingTimeMax; 

2468
0b62498c201a
openal fix, training map selection and rcplane adjustments from Smaxx (untested, but look reasonable). Bunch of new graphics from Tiy, new translation for ptpt from inu_
nemo
parents:
2462
diff
changeset

1296 
end; 
0b62498c201a
openal fix, training map selection and rcplane adjustments from Smaxx (untested, but look reasonable). Bunch of new graphics from Tiy, new translation for ptpt from inu_
nemo
parents:
2462
diff
changeset

1297 
end 
0b62498c201a
openal fix, training map selection and rcplane adjustments from Smaxx (untested, but look reasonable). Bunch of new graphics from Tiy, new translation for ptpt from inu_
nemo
parents:
2462
diff
changeset

1298 
else if Gear^.Tag = 2 then 
0b62498c201a
openal fix, training map selection and rcplane adjustments from Smaxx (untested, but look reasonable). Bunch of new graphics from Tiy, new translation for ptpt from inu_
nemo
parents:
2462
diff
changeset

1299 
if Gear^.Timer > 0 then 
0b62498c201a
openal fix, training map selection and rcplane adjustments from Smaxx (untested, but look reasonable). Bunch of new graphics from Tiy, new translation for ptpt from inu_
nemo
parents:
2462
diff
changeset

1300 
dec(Gear^.Timer) 
0b62498c201a
openal fix, training map selection and rcplane adjustments from Smaxx (untested, but look reasonable). Bunch of new graphics from Tiy, new translation for ptpt from inu_
nemo
parents:
2462
diff
changeset

1301 
else 
0b62498c201a
openal fix, training map selection and rcplane adjustments from Smaxx (untested, but look reasonable). Bunch of new graphics from Tiy, new translation for ptpt from inu_
nemo
parents:
2462
diff
changeset

1302 
begin 
0b62498c201a
openal fix, training map selection and rcplane adjustments from Smaxx (untested, but look reasonable). Bunch of new graphics from Tiy, new translation for ptpt from inu_
nemo
parents:
2462
diff
changeset

1303 
if (TrainingFlags and tfTargetRespawn) <> 0 then 
0b62498c201a
openal fix, training map selection and rcplane adjustments from Smaxx (untested, but look reasonable). Bunch of new graphics from Tiy, new translation for ptpt from inu_
nemo
parents:
2462
diff
changeset

1304 
begin 
0b62498c201a
openal fix, training map selection and rcplane adjustments from Smaxx (untested, but look reasonable). Bunch of new graphics from Tiy, new translation for ptpt from inu_
nemo
parents:
2462
diff
changeset

1305 
TrainingTargetGear:= AddGear(0, 0, gtTarget, 0, _0, _0, 0); 
0b62498c201a
openal fix, training map selection and rcplane adjustments from Smaxx (untested, but look reasonable). Bunch of new graphics from Tiy, new translation for ptpt from inu_
nemo
parents:
2462
diff
changeset

1306 
FindPlace(TrainingTargetGear, false, 0, LAND_WIDTH); 
0b62498c201a
openal fix, training map selection and rcplane adjustments from Smaxx (untested, but look reasonable). Bunch of new graphics from Tiy, new translation for ptpt from inu_
nemo
parents:
2462
diff
changeset

1307 
end; 
2460  1308 
DeleteGear(Gear); 
1309 
exit; 

1310 
end; 

1311 

1312 
doStepCase(Gear) 

1313 
end; 

1314 

1315 
//////////////////////////////////////////////////////////////////////////////// 

854  1316 
procedure doStepIdle(Gear: PGear); 
1317 
begin 

1318 
AllInactive:= false; 

925  1319 
dec(Gear^.Timer); 
854  1320 
if Gear^.Timer = 0 then 
1321 
begin 

1322 
DeleteGear(Gear); 

1323 
AfterAttack 

1324 
end 

1325 
end; 

1326 

79  1327 
procedure doStepShover(Gear: PGear); 
1328 
var HHGear: PGear; 

1329 
begin 

351  1330 
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; 
1331 
HHGear^.State:= HHGear^.State or gstNoDamage; 

980
20128e98988b
Don't push attacking hedgehog when using whip or baseball
unc0rr
parents:
979
diff
changeset

1332 
DeleteCI(HHGear); 
20128e98988b
Don't push attacking hedgehog when using whip or baseball
unc0rr
parents:
979
diff
changeset

1333 

79  1334 
AmmoShove(Gear, 30, 115); 
980
20128e98988b
Don't push attacking hedgehog when using whip or baseball
unc0rr
parents:
979
diff
changeset

1335 

351  1336 
HHGear^.State:= HHGear^.State and not gstNoDamage; 
854  1337 
Gear^.Timer:= 250; 
1338 
Gear^.doStep:= @doStepIdle 

79  1339 
end; 
1340 

1341 
//////////////////////////////////////////////////////////////////////////////// 

925  1342 
procedure doStepWhip(Gear: PGear); 
1343 
var HHGear: PGear; 

1344 
i: LongInt; 

1345 
begin 

1346 
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; 

1347 
HHGear^.State:= HHGear^.State or gstNoDamage; 

980
20128e98988b
Don't push attacking hedgehog when using whip or baseball
unc0rr
parents:
979
diff
changeset

1348 
DeleteCI(HHGear); 
925  1349 

1350 
for i:= 0 to 3 do 

1351 
begin 

1352 
AmmoShove(Gear, 30, 25); 

1353 
Gear^.X:= Gear^.X + Gear^.dX * 5 
