author | unc0rr |
Sun, 27 Sep 2009 14:33:59 +0000 | |
changeset 2397 | 2ca4ca6b4bab |
parent 2376 | ece7b87f1334 |
child 2424 | b52344de23ae |
permissions | -rw-r--r-- |
4 | 1 |
(* |
1066 | 2 |
* Hedgewars, a free turn based strategy game |
1689 | 3 |
* Copyright (c) 2004-2009 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 02111-1307, USA |
|
4 | 17 |
*) |
18 |
||
19 |
procedure doStepDrowningGear(Gear: PGear); forward; |
|
20 |
||
21 |
function CheckGearDrowning(Gear: PGear): boolean; |
|
1918 | 22 |
var skipSpeed, skipAngle, skipDecay: hwFloat; |
4 | 23 |
begin |
1918 | 24 |
// probably needs tweaking. might need to be in a case statement based upon gear type |
25 |
//(not Gear^.dY.isNegative) and this should not be necessary |
|
498 | 26 |
if cWaterLine < hwRound(Gear^.Y) + Gear^.Radius then |
1918 | 27 |
begin |
28 |
skipSpeed:= _0_25; // was 0.36 - couldn't manage baseball bat. Tiy's build is 0.36... |
|
29 |
skipAngle:= _1 + _0_9; // these should perhaps also be constants, once work out what proper values are |
|
30 |
skipDecay:= _0_87; // this could perhaps be a tiny bit higher. |
|
1919 | 31 |
if (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) > skipSpeed) and |
1920 | 32 |
(hwAbs(Gear^.dX) > skipAngle * hwAbs(Gear^.dY)) then |
1918 | 33 |
begin |
34 |
Gear^.dY.isNegative:= true; |
|
1919 | 35 |
Gear^.dY:= Gear^.dY * skipDecay; |
36 |
Gear^.dX:= Gear^.dX * skipDecay; |
|
1918 | 37 |
CheckGearDrowning:= false |
38 |
end |
|
39 |
else |
|
40 |
begin |
|
41 |
CheckGearDrowning:= true; |
|
42 |
Gear^.State:= gstDrowning; |
|
43 |
Gear^.doStep:= @doStepDrowningGear; |
|
2367
86c9aadea817
Remove gstHHDriven flag when hedgehog get into the water. Fixes some odd cases.
unc0rr
parents:
2365
diff
changeset
|
44 |
if Gear^.Kind = gtHedgehog then |
86c9aadea817
Remove gstHHDriven flag when hedgehog get into the water. Fixes some odd cases.
unc0rr
parents:
2365
diff
changeset
|
45 |
begin |
86c9aadea817
Remove gstHHDriven flag when hedgehog get into the water. Fixes some odd cases.
unc0rr
parents:
2365
diff
changeset
|
46 |
Gear^.State:= Gear^.State and (not gstHHDriven); |
86c9aadea817
Remove gstHHDriven flag when hedgehog get into the water. Fixes some odd cases.
unc0rr
parents:
2365
diff
changeset
|
47 |
AddCaption(Format(GetEventString(eidDrowned), PHedgehog(Gear^.Hedgehog)^.Name), $FFFFFF, capgrpMessage); |
86c9aadea817
Remove gstHHDriven flag when hedgehog get into the water. Fixes some odd cases.
unc0rr
parents:
2365
diff
changeset
|
48 |
end |
1918 | 49 |
end; |
50 |
PlaySound(sndSplash, false, nil) |
|
51 |
end |
|
52 |
else |
|
1133 | 53 |
CheckGearDrowning:= false |
4 | 54 |
end; |
55 |
||
56 |
procedure CheckCollision(Gear: PGear); |
|
57 |
begin |
|
351 | 58 |
if TestCollisionXwithGear(Gear, hwSign(Gear^.X)) or TestCollisionYwithGear(Gear, hwSign(Gear^.Y)) |
1133 | 59 |
then Gear^.State:= Gear^.State or gstCollision |
60 |
else Gear^.State:= Gear^.State and not gstCollision |
|
4 | 61 |
end; |
62 |
||
63 |
procedure CheckHHDamage(Gear: PGear); |
|
522 | 64 |
var dmg: Longword; |
4 | 65 |
begin |
1849 | 66 |
if(Gear^.Invulnerable) then exit; |
522 | 67 |
if _0_4 < Gear^.dY then |
1123 | 68 |
begin |
69 |
if _0_6 < Gear^.dY then |
|
1669 | 70 |
PlaySound(sndOw4, false, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack) |
1123 | 71 |
else |
1669 | 72 |
PlaySound(sndOw1, false, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack); |
1123 | 73 |
|
1861 | 74 |
dmg:= modifyDamage(1 + hwRound((hwAbs(Gear^.dY) - _0_4) * 70)); |
2017 | 75 |
ApplyDamage(Gear, dmg); |
1123 | 76 |
end |
4 | 77 |
end; |
78 |
||
79 |
//////////////////////////////////////////////////////////////////////////////// |
|
80 |
//////////////////////////////////////////////////////////////////////////////// |
|
81 |
procedure CalcRotationDirAngle(Gear: PGear); |
|
776
8fc7e59d9cb4
Convert the rest of rotated sprites to be rotated by OpenGL
unc0rr
parents:
764
diff
changeset
|
82 |
var dAngle: real; |
4 | 83 |
begin |
776
8fc7e59d9cb4
Convert the rest of rotated sprites to be rotated by OpenGL
unc0rr
parents:
764
diff
changeset
|
84 |
dAngle:= (hwAbs(Gear^.dX) + hwAbs(Gear^.dY)).QWordValue / $80000000; |
1133 | 85 |
if not Gear^.dX.isNegative then |
86 |
Gear^.DirAngle:= Gear^.DirAngle + dAngle |
|
87 |
else |
|
88 |
Gear^.DirAngle:= Gear^.DirAngle - dAngle; |
|
89 |
||
776
8fc7e59d9cb4
Convert the rest of rotated sprites to be rotated by OpenGL
unc0rr
parents:
764
diff
changeset
|
90 |
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
|
91 |
else if 360 < Gear^.DirAngle then Gear^.DirAngle:= Gear^.DirAngle - 360 |
4 | 92 |
end; |
93 |
||
94 |
//////////////////////////////////////////////////////////////////////////////// |
|
95 |
procedure doStepDrowningGear(Gear: PGear); |
|
96 |
begin |
|
97 |
AllInactive:= false; |
|
351 | 98 |
Gear^.Y:= Gear^.Y + cDrownSpeed; |
2228 | 99 |
Gear^.X:= Gear^.X + Gear^.dX * cDrownSpeed; |
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
|
100 |
if hwRound(Gear^.Y) > Gear^.Radius + cWaterLine + cVisibleWater then DeleteGear(Gear); |
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
|
101 |
// Create some bubbles (0.5% might be better but causes too few bubbles sometimes) |
2225 | 102 |
if (GameTicks and $1F) = 0 then |
2376 | 103 |
if (Gear^.Kind = gtHedgehog) and (Random(4) = 0) then |
2225 | 104 |
AddVisualGear(hwRound(Gear^.X) - Gear^.Radius, hwRound(Gear^.Y) - Gear^.Radius, vgtBubble) |
105 |
else if Random(12) = 0 then |
|
106 |
AddVisualGear(hwRound(Gear^.X) - Gear^.Radius, hwRound(Gear^.Y) - Gear^.Radius, vgtBubble) |
|
4 | 107 |
end; |
108 |
||
109 |
//////////////////////////////////////////////////////////////////////////////// |
|
110 |
procedure doStepFallingGear(Gear: PGear); |
|
542 | 111 |
var isFalling: boolean; |
4 | 112 |
begin |
503 | 113 |
Gear^.State:= Gear^.State and not gstCollision; |
114 |
||
115 |
if Gear^.dY.isNegative then |
|
1133 | 116 |
begin |
117 |
isFalling:= true; |
|
118 |
if TestCollisionYwithGear(Gear, -1) then |
|
119 |
begin |
|
120 |
Gear^.dX:= Gear^.dX * Gear^.Friction; |
|
121 |
Gear^.dY:= - Gear^.dY * Gear^.Elasticity; |
|
122 |
Gear^.State:= Gear^.State or gstCollision |
|
123 |
end |
|
124 |
end else |
|
125 |
if TestCollisionYwithGear(Gear, 1) then |
|
126 |
begin |
|
127 |
isFalling:= false; |
|
128 |
Gear^.dX:= Gear^.dX * Gear^.Friction; |
|
129 |
Gear^.dY:= - Gear^.dY * Gear^.Elasticity; |
|
130 |
Gear^.State:= Gear^.State or gstCollision |
|
131 |
end else isFalling:= true; |
|
503 | 132 |
|
351 | 133 |
if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then |
1133 | 134 |
begin |
135 |
Gear^.dX:= - Gear^.dX * Gear^.Elasticity; |
|
136 |
Gear^.dY:= Gear^.dY * Gear^.Elasticity; |
|
137 |
Gear^.State:= Gear^.State or gstCollision |
|
138 |
end; |
|
503 | 139 |
|
542 | 140 |
if isFalling then Gear^.dY:= Gear^.dY + cGravity; |
503 | 141 |
|
351 | 142 |
Gear^.X:= Gear^.X + Gear^.dX; |
143 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
|
4 | 144 |
CheckGearDrowning(Gear); |
503 | 145 |
if (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) < _0_0002) and |
1133 | 146 |
(not isFalling) then |
147 |
Gear^.State:= Gear^.State and not gstMoving |
|
148 |
else |
|
149 |
Gear^.State:= Gear^.State or gstMoving |
|
4 | 150 |
end; |
151 |
||
152 |
//////////////////////////////////////////////////////////////////////////////// |
|
153 |
procedure doStepBomb(Gear: PGear); |
|
371 | 154 |
var i: LongInt; |
919 | 155 |
dX, dY: hwFloat; |
4 | 156 |
begin |
157 |
AllInactive:= false; |
|
1263 | 158 |
|
4 | 159 |
doStepFallingGear(Gear); |
1263 | 160 |
|
351 | 161 |
dec(Gear^.Timer); |
162 |
if Gear^.Timer = 0 then |
|
1133 | 163 |
begin |
164 |
case Gear^.Kind of |
|
165 |
gtAmmo_Bomb: doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound); |
|
1603 | 166 |
gtBall: doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 40, EXPLAutoSound); |
1133 | 167 |
gtClusterBomb: begin |
168 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 20, EXPLAutoSound); |
|
169 |
for i:= 0 to 4 do |
|
170 |
begin |
|
171 |
dX:= rndSign(GetRandom * _0_1); |
|
172 |
dY:= (GetRandom - _3) * _0_08; |
|
1261 | 173 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtCluster, 0, dX, dY, 25); |
174 |
end |
|
175 |
end; |
|
176 |
gtWatermelon: begin |
|
177 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 75, EXPLAutoSound); |
|
178 |
for i:= 0 to 5 do |
|
179 |
begin |
|
180 |
dX:= rndSign(GetRandom * _0_1); |
|
1496 | 181 |
dY:= (GetRandom - _1_5) * _0_3; |
1262 | 182 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtMelonPiece, 0, dX, dY, 75)^.DirAngle:= i * 60; |
1133 | 183 |
end |
1263 | 184 |
end; |
1555 | 185 |
gtHellishBomb: begin |
186 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 90, EXPLAutoSound); |
|
187 |
for i:= 0 to 127 do |
|
188 |
begin |
|
189 |
dX:= AngleCos(i * 16) * _0_5 * (GetRandom + _1); |
|
190 |
dY:= AngleSin(i * 16) * _0_5 * (GetRandom + _1); |
|
191 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtFlame, 0, dX, dY, 0); |
|
192 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtFlame, 0, dX, -dY, 0); |
|
193 |
end |
|
194 |
end; |
|
1133 | 195 |
end; |
196 |
DeleteGear(Gear); |
|
197 |
exit |
|
198 |
end; |
|
1263 | 199 |
|
4 | 200 |
CalcRotationDirAngle(Gear); |
1263 | 201 |
|
202 |
if Gear^.Kind = gtHellishBomb then |
|
1279 | 203 |
begin |
1669 | 204 |
if Gear^.Timer = 3000 then PlaySound(sndHellish, false, nil); |
1279 | 205 |
|
1263 | 206 |
if (GameTicks and $3F) = 0 then |
207 |
if (Gear^.State and gstCollision) = 0 then |
|
208 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtEvilTrace, 0, _0, _0, 0); |
|
1279 | 209 |
end; |
1263 | 210 |
|
1158 | 211 |
if (Gear^.State and (gstCollision or gstMoving)) = (gstCollision or gstMoving) then |
212 |
if (hwAbs(Gear^.dX) > _0_1) or |
|
213 |
(hwAbs(Gear^.dY) > _0_1) then |
|
1669 | 214 |
PlaySound(sndGrenadeImpact, false, nil) |
4 | 215 |
end; |
216 |
||
1279 | 217 |
procedure doStepWatermelon(Gear: PGear); |
218 |
begin |
|
219 |
AllInactive:= false; |
|
1669 | 220 |
PlaySound(sndMelon, false, nil); |
1279 | 221 |
Gear^.doStep:= @doStepBomb |
222 |
end; |
|
223 |
||
78 | 224 |
procedure doStepCluster(Gear: PGear); |
225 |
begin |
|
226 |
AllInactive:= false; |
|
227 |
doStepFallingGear(Gear); |
|
351 | 228 |
if (Gear^.State and gstCollision) <> 0 then |
1133 | 229 |
begin |
1261 | 230 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Timer, EXPLAutoSound); |
1133 | 231 |
DeleteGear(Gear); |
232 |
exit |
|
233 |
end; |
|
1262 | 234 |
|
235 |
if Gear^.Kind = gtMelonPiece then |
|
236 |
CalcRotationDirAngle(Gear) |
|
237 |
else |
|
238 |
if (GameTicks and $1F) = 0 then |
|
239 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtSmokeTrace, 0, _0, _0, 0) |
|
78 | 240 |
end; |
241 |
||
4 | 242 |
//////////////////////////////////////////////////////////////////////////////// |
243 |
procedure doStepGrenade(Gear: PGear); |
|
244 |
begin |
|
245 |
AllInactive:= false; |
|
351 | 246 |
Gear^.dX:= Gear^.dX + cWindSpeed; |
4 | 247 |
doStepFallingGear(Gear); |
351 | 248 |
if (Gear^.State and gstCollision) <> 0 then |
1133 | 249 |
begin |
250 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound); |
|
251 |
DeleteGear(Gear); |
|
252 |
exit |
|
253 |
end; |
|
4 | 254 |
if (GameTicks and $3F) = 0 then |
1133 | 255 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtSmokeTrace, 0, _0, _0, 0) |
4 | 256 |
end; |
257 |
||
258 |
//////////////////////////////////////////////////////////////////////////////// |
|
95 | 259 |
procedure doStepHealthTagWork(Gear: PGear); |
4 | 260 |
begin |
522 | 261 |
if Gear^.Kind = gtHealthTag then |
1505 | 262 |
AllInactive:= false; |
263 |
||
351 | 264 |
dec(Gear^.Timer); |
522 | 265 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
1505 | 266 |
|
351 | 267 |
if Gear^.Timer = 0 then |
1133 | 268 |
begin |
2017 | 269 |
if (Gear^.Kind = gtHealthTag) and (PHedgehog(Gear^.Hedgehog)^.Gear <> nil) then |
1133 | 270 |
PHedgehog(Gear^.Hedgehog)^.Gear^.Active:= true; // to let current hh die |
271 |
DeleteGear(Gear) |
|
272 |
end |
|
4 | 273 |
end; |
274 |
||
263 | 275 |
procedure doStepHealthTagWorkUnderWater(Gear: PGear); |
276 |
begin |
|
1505 | 277 |
AllInactive:= false; |
1495 | 278 |
|
351 | 279 |
Gear^.Y:= Gear^.Y - _0_08; |
1495 | 280 |
|
498 | 281 |
if hwRound(Gear^.Y) < cWaterLine + 10 then |
1505 | 282 |
DeleteGear(Gear) |
263 | 283 |
end; |
284 |
||
95 | 285 |
procedure doStepHealthTag(Gear: PGear); |
286 |
var s: shortstring; |
|
287 |
begin |
|
1505 | 288 |
AllInactive:= false; |
289 |
Gear^.dY:= -_0_08; |
|
522 | 290 |
|
351 | 291 |
str(Gear^.State, s); |
1505 | 292 |
Gear^.Tex:= RenderStringTex(s, PHedgehog(Gear^.Hedgehog)^.Team^.Clan^.Color, fnt16); |
293 |
||
294 |
if hwRound(Gear^.Y) < cWaterLine then |
|
295 |
Gear^.doStep:= @doStepHealthTagWork |
|
296 |
else |
|
297 |
Gear^.doStep:= @doStepHealthTagWorkUnderWater; |
|
298 |
||
762 | 299 |
Gear^.Y:= Gear^.Y - int2hwFloat(Gear^.Tex^.h) |
95 | 300 |
end; |
301 |
||
4 | 302 |
//////////////////////////////////////////////////////////////////////////////// |
303 |
procedure doStepGrave(Gear: PGear); |
|
304 |
begin |
|
305 |
AllInactive:= false; |
|
498 | 306 |
if Gear^.dY.isNegative then |
307 |
if TestCollisionY(Gear, -1) then Gear^.dY:= _0; |
|
4 | 308 |
|
351 | 309 |
if not Gear^.dY.isNegative then |
68 | 310 |
if TestCollisionY(Gear, 1) then |
4 | 311 |
begin |
351 | 312 |
Gear^.dY:= - Gear^.dY * Gear^.Elasticity; |
313 |
if Gear^.dY > - _1div1024 then |
|
4 | 314 |
begin |
351 | 315 |
Gear^.Active:= false; |
4 | 316 |
exit |
1669 | 317 |
end else if Gear^.dY < - _0_03 then PlaySound(sndGraveImpact, false, nil) |
4 | 318 |
end; |
1505 | 319 |
|
351 | 320 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
4 | 321 |
CheckGearDrowning(Gear); |
351 | 322 |
Gear^.dY:= Gear^.dY + cGravity |
4 | 323 |
end; |
324 |
||
325 |
//////////////////////////////////////////////////////////////////////////////// |
|
326 |
procedure doStepUFOWork(Gear: PGear); |
|
351 | 327 |
var t: hwFloat; |
374 | 328 |
y: LongInt; |
4 | 329 |
begin |
330 |
AllInactive:= false; |
|
351 | 331 |
t:= Distance(Gear^.dX, Gear^.dY); |
332 |
Gear^.dX:= Gear^.Elasticity * (Gear^.dX + _0_000004 * (TargetPoint.X - hwRound(Gear^.X))); |
|
333 |
Gear^.dY:= Gear^.Elasticity * (Gear^.dY + _0_000004 * (TargetPoint.Y - hwRound(Gear^.Y))); |
|
334 |
t:= t / Distance(Gear^.dX, Gear^.dY); |
|
335 |
Gear^.dX:= Gear^.dX * t; |
|
336 |
Gear^.dY:= Gear^.dY * t; |
|
337 |
Gear^.X:= Gear^.X + Gear^.dX; |
|
338 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
|
374 | 339 |
|
340 |
if (GameTicks and $3F) = 0 then |
|
341 |
begin |
|
342 |
y:= hwRound(Gear^.Y); |
|
343 |
if y + Gear^.Radius < cWaterLine then |
|
498 | 344 |
AddGear(hwRound(Gear^.X), y, gtSmokeTrace, 0, _0, _0, 0); |
374 | 345 |
end; |
346 |
||
4 | 347 |
CheckCollision(Gear); |
351 | 348 |
dec(Gear^.Timer); |
349 |
if ((Gear^.State and gstCollision) <> 0) or (Gear^.Timer = 0) then |
|
4 | 350 |
begin |
560 | 351 |
StopSound(sndUFO); |
351 | 352 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound); |
4 | 353 |
DeleteGear(Gear); |
354 |
end; |
|
355 |
end; |
|
356 |
||
357 |
procedure doStepUFO(Gear: PGear); |
|
358 |
begin |
|
359 |
AllInactive:= false; |
|
351 | 360 |
Gear^.X:= Gear^.X + Gear^.dX; |
361 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
|
362 |
Gear^.dY:= Gear^.dY + cGravity; |
|
4 | 363 |
CheckCollision(Gear); |
351 | 364 |
if (Gear^.State and gstCollision) <> 0 then |
4 | 365 |
begin |
351 | 366 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound); |
4 | 367 |
DeleteGear(Gear); |
368 |
exit |
|
369 |
end; |
|
351 | 370 |
dec(Gear^.Timer); |
371 |
if Gear^.Timer = 0 then |
|
4 | 372 |
begin |
1669 | 373 |
PlaySound(sndUFO, true, nil); |
351 | 374 |
Gear^.Timer:= 5000; |
375 |
Gear^.doStep:= @doStepUFOWork |
|
4 | 376 |
end; |
377 |
end; |
|
378 |
||
379 |
//////////////////////////////////////////////////////////////////////////////// |
|
876 | 380 |
procedure doStepShotIdle(Gear: PGear); |
381 |
begin |
|
382 |
AllInactive:= false; |
|
383 |
inc(Gear^.Timer); |
|
384 |
if Gear^.Timer > 75 then |
|
385 |
begin |
|
386 |
DeleteGear(Gear); |
|
387 |
AfterAttack |
|
388 |
end |
|
389 |
end; |
|
390 |
||
4 | 391 |
procedure doStepShotgunShot(Gear: PGear); |
392 |
var i: LongWord; |
|
393 |
begin |
|
394 |
AllInactive:= false; |
|
876 | 395 |
|
396 |
if ((Gear^.State and gstAnimation) = 0) then |
|
397 |
begin |
|
398 |
dec(Gear^.Timer); |
|
399 |
if Gear^.Timer = 0 then |
|
400 |
begin |
|
1669 | 401 |
PlaySound(sndShotgunFire, false, nil); |
876 | 402 |
Gear^.State:= Gear^.State or gstAnimation |
403 |
end; |
|
404 |
exit |
|
405 |
end |
|
406 |
else inc(Gear^.Timer); |
|
407 |
||
4 | 408 |
i:= 200; |
409 |
repeat |
|
351 | 410 |
Gear^.X:= Gear^.X + Gear^.dX; |
411 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
|
4 | 412 |
CheckCollision(Gear); |
351 | 413 |
if (Gear^.State and gstCollision) <> 0 then |
876 | 414 |
begin |
415 |
Gear^.X:= Gear^.X + Gear^.dX * 8; |
|
416 |
Gear^.Y:= Gear^.Y + Gear^.dY * 8; |
|
417 |
ShotgunShot(Gear); |
|
418 |
Gear^.doStep:= @doStepShotIdle; |
|
419 |
exit |
|
420 |
end; |
|
4 | 421 |
dec(i) |
422 |
until i = 0; |
|
1760 | 423 |
if (hwRound(Gear^.X) and LAND_WIDTH_MASK <> 0) or (hwRound(Gear^.Y) and LAND_HEIGHT_MASK <> 0) then |
876 | 424 |
Gear^.doStep:= @doStepShotIdle |
4 | 425 |
end; |
426 |
||
427 |
//////////////////////////////////////////////////////////////////////////////// |
|
2023
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset
|
428 |
procedure doStepBulletWork(Gear: PGear); |
38 | 429 |
var i, x, y: LongWord; |
351 | 430 |
oX, oY: hwFloat; |
38 | 431 |
begin |
432 |
AllInactive:= false; |
|
876 | 433 |
inc(Gear^.Timer); |
37 | 434 |
i:= 80; |
351 | 435 |
oX:= Gear^.X; |
436 |
oY:= Gear^.Y; |
|
37 | 437 |
repeat |
351 | 438 |
Gear^.X:= Gear^.X + Gear^.dX; |
439 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
|
440 |
x:= hwRound(Gear^.X); |
|
441 |
y:= hwRound(Gear^.Y); |
|
1753 | 442 |
if ((y and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) |
351 | 443 |
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
|
444 |
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
|
445 |
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
|
446 |
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
|
447 |
else |
2031
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2029
diff
changeset
|
448 |
AmmoShove(Gear, Gear^.Timer, 20); |
38 | 449 |
dec(i) |
351 | 450 |
until (i = 0) or (Gear^.Damage > Gear^.Health); |
451 |
if Gear^.Damage > 0 then |
|
37 | 452 |
begin |
351 | 453 |
DrawTunnel(oX, oY, Gear^.dX, Gear^.dY, 82 - i, 1); |
454 |
dec(Gear^.Health, Gear^.Damage); |
|
455 |
Gear^.Damage:= 0 |
|
37 | 456 |
end; |
1760 | 457 |
|
458 |
if (Gear^.Health <= 0) |
|
459 |
or (hwRound(Gear^.X) and LAND_WIDTH_MASK <> 0) |
|
460 |
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
|
461 |
begin |
2087 | 462 |
if (Gear^.Kind = gtSniperRifleShot) and ((GameFlags and gfLaserSight) = 0) then cLaserSighting:= false; |
2033 | 463 |
if (Gear^.Ammo^.NumPerTurn <= CurrentHedgehog^.AttacksNum) and |
2031
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2029
diff
changeset
|
464 |
((GameFlags and gfArtillery) = 0) then cArtillery:= false; |
876 | 465 |
Gear^.doStep:= @doStepShotIdle |
2031
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2029
diff
changeset
|
466 |
end; |
37 | 467 |
end; |
468 |
||
559 | 469 |
procedure doStepDEagleShot(Gear: PGear); |
470 |
begin |
|
1669 | 471 |
PlaySound(sndGun, false, nil); |
2023
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset
|
472 |
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
|
473 |
end; |
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset
|
474 |
|
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset
|
475 |
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
|
476 |
var HHGear: PGear; |
2023
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset
|
477 |
begin |
2024
2985f3bd18b7
Disable long jump in artillery mode, make snipre rifle single shot
nemo
parents:
2023
diff
changeset
|
478 |
cArtillery:= true; |
2031
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2029
diff
changeset
|
479 |
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
|
480 |
HHGear^.State:= HHGear^.State or gstNotKickable; |
2033 | 481 |
HedgehogChAngle(HHGear); |
2220 | 482 |
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
|
483 |
begin |
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset
|
484 |
cLaserSighting:= true; |
2031
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2029
diff
changeset
|
485 |
HHGear^.Message:= 0; |
2052 | 486 |
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
|
487 |
end; |
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2029
diff
changeset
|
488 |
|
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2029
diff
changeset
|
489 |
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
|
490 |
begin |
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2029
diff
changeset
|
491 |
Gear^.State:= Gear^.State or gstAnimation; |
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2029
diff
changeset
|
492 |
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
|
493 |
Gear^.dY:= -AngleCos(HHGear^.Angle) * _0_5; |
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2029
diff
changeset
|
494 |
PlaySound(sndGun, false, nil); |
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2029
diff
changeset
|
495 |
Gear^.doStep:= @doStepBulletWork; |
2024
2985f3bd18b7
Disable long jump in artillery mode, make snipre rifle single shot
nemo
parents:
2023
diff
changeset
|
496 |
end |
2985f3bd18b7
Disable long jump in artillery mode, make snipre rifle single shot
nemo
parents:
2023
diff
changeset
|
497 |
else |
2031
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2029
diff
changeset
|
498 |
if (GameTicks mod 32) = 0 then |
2376 | 499 |
if (GameTicks mod 4096) < 2048 then |
2052 | 500 |
begin |
501 |
if(HHGear^.Angle + 1 <= cMaxAngle) then inc(HHGear^.Angle) |
|
502 |
end |
|
503 |
else |
|
504 |
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
|
505 |
|
2376 | 506 |
if (TurnTimeLeft > 0) then |
2058 | 507 |
dec(TurnTimeLeft) |
508 |
else |
|
509 |
begin |
|
2139
5a083e71a71d
Properly decrement sniper rifle if timed out. Try to get camera position straight for once.
nemo
parents:
2090
diff
changeset
|
510 |
PHedgehog(Gear^.Hedgehog)^.AttacksNum:= Gear^.Ammo^.NumPerTurn+1; |
2058 | 511 |
DeleteGear(Gear); |
2059 | 512 |
AfterAttack; |
513 |
TurnTimeLeft:= 0 |
|
2058 | 514 |
end; |
559 | 515 |
end; |
516 |
||
37 | 517 |
//////////////////////////////////////////////////////////////////////////////// |
4 | 518 |
procedure doStepActionTimer(Gear: PGear); |
519 |
begin |
|
351 | 520 |
dec(Gear^.Timer); |
521 |
case Gear^.Kind of |
|
83 | 522 |
gtATStartGame: begin |
4 | 523 |
AllInactive:= false; |
351 | 524 |
if Gear^.Timer = 0 then |
83 | 525 |
AddCaption(trmsg[sidStartFight], $FFFFFF, capgrpGameState); |
4 | 526 |
end; |
83 | 527 |
gtATSmoothWindCh: begin |
351 | 528 |
if Gear^.Timer = 0 then |
6 | 529 |
begin |
351 | 530 |
if WindBarWidth < Gear^.Tag then inc(WindBarWidth) |
531 |
else if WindBarWidth > Gear^.Tag then dec(WindBarWidth); |
|
532 |
if WindBarWidth <> Gear^.Tag then Gear^.Timer:= 10; |
|
83 | 533 |
end |
534 |
end; |
|
535 |
gtATFinishGame: begin |
|
536 |
AllInactive:= false; |
|
351 | 537 |
if Gear^.Timer = 0 then |
113 | 538 |
begin |
539 |
SendIPC('N'); |
|
324
f4c109c82a0c
Don't show game stats in case of interrupted by command '/quit' game
unc0rr
parents:
306
diff
changeset
|
540 |
SendIPC('q'); |
83 | 541 |
GameState:= gsExit |
113 | 542 |
end |
6 | 543 |
end; |
4 | 544 |
end; |
351 | 545 |
if Gear^.Timer = 0 then DeleteGear(Gear) |
4 | 546 |
end; |
547 |
||
548 |
//////////////////////////////////////////////////////////////////////////////// |
|
549 |
procedure doStepPickHammerWork(Gear: PGear); |
|
371 | 550 |
var i, ei: LongInt; |
4 | 551 |
HHGear: PGear; |
552 |
begin |
|
70 | 553 |
AllInactive:= false; |
351 | 554 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
555 |
dec(Gear^.Timer); |
|
556 |
if (Gear^.Timer = 0)or((Gear^.Message and gm_Destroy) <> 0)or((HHGear^.State and gstHHDriven) = 0) then |
|
1200 | 557 |
begin |
558 |
StopSound(sndPickhammer); |
|
559 |
DeleteGear(Gear); |
|
560 |
AfterAttack; |
|
561 |
exit |
|
562 |
end; |
|
845 | 563 |
|
422 | 564 |
if (Gear^.Timer mod 33) = 0 then |
1200 | 565 |
begin |
566 |
HHGear^.State:= HHGear^.State or gstNoDamage; |
|
567 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y) + 7, 6, EXPLDontDraw); |
|
568 |
HHGear^.State:= HHGear^.State and not gstNoDamage |
|
569 |
end; |
|
422 | 570 |
|
571 |
if (Gear^.Timer mod 47) = 0 then |
|
1200 | 572 |
begin |
573 |
i:= hwRound(Gear^.X) - Gear^.Radius - LongInt(GetRandom(2)); |
|
574 |
ei:= hwRound(Gear^.X) + Gear^.Radius + LongInt(GetRandom(2)); |
|
575 |
while i <= ei do |
|
576 |
begin |
|
577 |
DrawExplosion(i, hwRound(Gear^.Y) + 3, 3); |
|
578 |
inc(i, 1) |
|
579 |
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
|
580 |
|
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
|
581 |
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
|
582 |
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
|
583 |
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
|
584 |
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
|
585 |
end; |
1200 | 586 |
SetAllHHToActive; |
587 |
end; |
|
4 | 588 |
if TestCollisionYwithGear(Gear, 1) then |
1200 | 589 |
begin |
590 |
Gear^.dY:= _0; |
|
591 |
SetLittle(HHGear^.dX); |
|
592 |
HHGear^.dY:= _0; |
|
593 |
end else |
|
594 |
begin |
|
595 |
Gear^.dY:= Gear^.dY + cGravity; |
|
596 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
|
1417 | 597 |
if hwRound(Gear^.Y) > cWaterLine then Gear^.Timer:= 1 |
1200 | 598 |
end; |
4 | 599 |
|
351 | 600 |
Gear^.X:= Gear^.X + HHGear^.dX; |
601 |
HHGear^.X:= Gear^.X; |
|
498 | 602 |
HHGear^.Y:= Gear^.Y - int2hwFloat(cHHRadius); |
4 | 603 |
|
351 | 604 |
if (Gear^.Message and gm_Attack) <> 0 then |
605 |
if (Gear^.State and gsttmpFlag) <> 0 then Gear^.Timer:= 1 else else |
|
606 |
if (Gear^.State and gsttmpFlag) = 0 then Gear^.State:= Gear^.State or gsttmpFlag; |
|
607 |
if ((Gear^.Message and gm_Left) <> 0) then Gear^.dX:= - _0_3 else |
|
608 |
if ((Gear^.Message and gm_Right) <> 0) then Gear^.dX:= _0_3 |
|
498 | 609 |
else Gear^.dX:= _0; |
4 | 610 |
end; |
611 |
||
612 |
procedure doStepPickHammer(Gear: PGear); |
|
371 | 613 |
var i, y: LongInt; |
4 | 614 |
ar: TRangeArray; |
911
b709fe13ed69
Fix issue with hedgehog on top of the hedgehog with pickhammer
unc0rr
parents:
883
diff
changeset
|
615 |
HHGear: PGear; |
4 | 616 |
begin |
617 |
i:= 0; |
|
911
b709fe13ed69
Fix issue with hedgehog on top of the hedgehog with pickhammer
unc0rr
parents:
883
diff
changeset
|
618 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
b709fe13ed69
Fix issue with hedgehog on top of the hedgehog with pickhammer
unc0rr
parents:
883
diff
changeset
|
619 |
|
498 | 620 |
y:= hwRound(Gear^.Y) - cHHRadius * 2; |
351 | 621 |
while y < hwRound(Gear^.Y) do |
4 | 622 |
begin |
371 | 623 |
ar[i].Left := hwRound(Gear^.X) - Gear^.Radius - LongInt(GetRandom(2)); |
624 |
ar[i].Right:= hwRound(Gear^.X) + Gear^.Radius + LongInt(GetRandom(2)); |
|
4 | 625 |
inc(y, 2); |
626 |
inc(i) |
|
627 |
end; |
|
911
b709fe13ed69
Fix issue with hedgehog on top of the hedgehog with pickhammer
unc0rr
parents:
883
diff
changeset
|
628 |
|
498 | 629 |
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
|
630 |
Gear^.dY:= HHGear^.dY; |
b709fe13ed69
Fix issue with hedgehog on top of the hedgehog with pickhammer
unc0rr
parents:
883
diff
changeset
|
631 |
DeleteCI(HHGear); |
b709fe13ed69
Fix issue with hedgehog on top of the hedgehog with pickhammer
unc0rr
parents:
883
diff
changeset
|
632 |
|
1669 | 633 |
PlaySound(sndPickhammer, true, nil); |
4 | 634 |
doStepPickHammerWork(Gear); |
351 | 635 |
Gear^.doStep:= @doStepPickHammerWork |
4 | 636 |
end; |
637 |
||
638 |
//////////////////////////////////////////////////////////////////////////////// |
|
371 | 639 |
var BTPrevAngle, BTSteps: LongInt; |
302 | 640 |
|
303
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
641 |
procedure doStepBlowTorchWork(Gear: PGear); |
302 | 642 |
var HHGear: PGear; |
1528 | 643 |
b: boolean; |
644 |
prevX: LongInt; |
|
302 | 645 |
begin |
646 |
AllInactive:= false; |
|
351 | 647 |
dec(Gear^.Timer); |
648 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
303
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
649 |
|
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
650 |
HedgehogChAngle(HHGear); |
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
651 |
|
305 | 652 |
b:= false; |
653 |
||
371 | 654 |
if abs(LongInt(HHGear^.Angle) - BTPrevAngle) > 7 then |
1528 | 655 |
begin |
656 |
Gear^.dX:= SignAs(AngleSin(HHGear^.Angle) * _0_5, HHGear^.dX); |
|
657 |
Gear^.dY:= AngleCos(HHGear^.Angle) * ( - _0_5); |
|
658 |
BTPrevAngle:= HHGear^.Angle; |
|
659 |
b:= true |
|
660 |
end; |
|
661 |
||
662 |
if ((HHGear^.State and gstMoving) <> 0) then |
|
663 |
begin |
|
664 |
doStepHedgehogMoving(HHGear); |
|
1736 | 665 |
if (HHGear^.State and gstHHDriven) = 0 then Gear^.Timer:= 0 |
1528 | 666 |
end; |
305 | 667 |
|
351 | 668 |
if Gear^.Timer mod cHHStepTicks = 0 then |
1528 | 669 |
begin |
670 |
b:= true; |
|
671 |
if Gear^.dX.isNegative then |
|
1547 | 672 |
HHGear^.Message:= (HHGear^.Message and (gm_Attack or gm_Up or gm_Down)) or gm_Left |
1528 | 673 |
else |
1547 | 674 |
HHGear^.Message:= (HHGear^.Message and (gm_Attack or gm_Up or gm_Down)) or gm_Right; |
305 | 675 |
|
1528 | 676 |
if ((HHGear^.State and gstMoving) = 0) then |
677 |
begin |
|
678 |
HHGear^.State:= HHGear^.State and not gstAttacking; |
|
679 |
prevX:= hwRound(HHGear^.X); |
|
2376 | 680 |
|
681 |
// why the call to HedgehogStep then a further increment of X? |
|
682 |
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
|
683 |
CheckLandValue(hwRound(HHGear^.X + SignAs(_6, HHGear^.dX)), hwRound(HHGear^.Y), COLOR_INDESTRUCTIBLE) then HedgehogStep(HHGear); |
2376 | 684 |
|
685 |
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
|
686 |
CheckLandValue(hwRound(HHGear^.X + SignAs(_6, HHGear^.dX)), hwRound(HHGear^.Y), COLOR_INDESTRUCTIBLE) then HHGear^.X:= HHGear^.X + SignAs(_1, HHGear^.dX); |
1528 | 687 |
HHGear^.State:= HHGear^.State or gstAttacking |
688 |
end; |
|
305 | 689 |
|
1528 | 690 |
inc(BTSteps); |
691 |
if BTSteps = 7 then |
|
692 |
begin |
|
693 |
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
|
694 |
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
|
695 |
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
|
696 |
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
|
697 |
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
|
698 |
end; |
1528 | 699 |
HHGear^.State:= HHGear^.State or gstNoDamage; |
1643 | 700 |
AmmoShove(Gear, 2, 15); |
1528 | 701 |
HHGear^.State:= HHGear^.State and not gstNoDamage |
702 |
end; |
|
703 |
end; |
|
305 | 704 |
|
705 |
if b then |
|
498 | 706 |
DrawTunnel(HHGear^.X - Gear^.dX * cHHRadius, HHGear^.Y - _4 - Gear^.dY * cHHRadius + hwAbs(Gear^.dY) * 7, |
351 | 707 |
Gear^.dX, Gear^.dY, |
1501 | 708 |
cHHRadius * 5, cHHRadius * 2 + 7); |
305 | 709 |
|
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
|
710 |
if (Gear^.Timer = 0) or ((HHGear^.Message and gm_Attack) <> 0) then |
1528 | 711 |
begin |
712 |
HHGear^.Message:= 0; |
|
713 |
HHGear^.State:= HHGear^.State and (not gstNotKickable); |
|
714 |
DeleteGear(Gear); |
|
715 |
AfterAttack |
|
716 |
end |
|
302 | 717 |
end; |
718 |
||
303
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
719 |
procedure doStepBlowTorch(Gear: PGear); |
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
720 |
var HHGear: PGear; |
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
721 |
begin |
371 | 722 |
BTPrevAngle:= High(LongInt); |
305 | 723 |
BTSteps:= 0; |
351 | 724 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
725 |
HHGear^.Message:= 0; |
|
1528 | 726 |
HHGear^.State:= HHGear^.State or gstNotKickable; |
351 | 727 |
Gear^.doStep:= @doStepBlowTorchWork |
303
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
728 |
end; |
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
729 |
|
302 | 730 |
//////////////////////////////////////////////////////////////////////////////// |
731 |
||
1781 | 732 |
procedure doStepRope(Gear: PGear); forward; |
733 |
||
734 |
procedure doStepRopeAfterAttack(Gear: PGear); |
|
735 |
var HHGear: PGear; |
|
736 |
begin |
|
737 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
738 |
if ((HHGear^.State and gstHHDriven) = 0) |
|
739 |
or (CheckGearDrowning(HHGear)) |
|
740 |
or TestCollisionYwithGear(HHGear, 1) then |
|
741 |
begin |
|
742 |
DeleteGear(Gear); |
|
2060
3e9e5e1be6f5
fix crash in parachute/rope if drowning with active girder/teleport
nemo
parents:
2059
diff
changeset
|
743 |
isCursorVisible:= false; |
1781 | 744 |
exit |
745 |
end; |
|
746 |
||
1785 | 747 |
HedgehogChAngle(HHGear); |
748 |
||
2283 | 749 |
if TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then SetLittle(HHGear^.dX); |
2029 | 750 |
|
1781 | 751 |
if HHGear^.dY.isNegative and TestCollisionYwithGear(HHGear, -1) then HHGear^.dY:= _0; |
752 |
HHGear^.X:= HHGear^.X + HHGear^.dX; |
|
753 |
HHGear^.Y:= HHGear^.Y + HHGear^.dY; |
|
754 |
HHGear^.dY:= HHGear^.dY + cGravity; |
|
755 |
||
756 |
if (Gear^.Message and gm_Attack) <> 0 then |
|
757 |
begin |
|
758 |
Gear^.X:= HHGear^.X; |
|
759 |
Gear^.Y:= HHGear^.Y; |
|
1964 | 760 |
|
761 |
ApplyAngleBounds(PHedgehog(Gear^.Hedgehog)^, amRope); |
|
2376 | 762 |
|
1781 | 763 |
Gear^.dX:= SignAs(AngleSin(HHGear^.Angle), HHGear^.dX); |
764 |
Gear^.dY:= -AngleCos(HHGear^.Angle); |
|
765 |
Gear^.Friction:= _450; |
|
766 |
Gear^.Elasticity:= _0; |
|
767 |
Gear^.State:= Gear^.State and not gsttmpflag; |
|
768 |
Gear^.doStep:= @doStepRope |
|
769 |
end |
|
770 |
end; |
|
771 |
||
4 | 772 |
procedure doStepRopeWork(Gear: PGear); |
773 |
var HHGear: PGear; |
|
1669 | 774 |
len, tx, ty, nx, ny, ropeDx, ropeDy, mdX, mdY: hwFloat; |
1504 | 775 |
lx, ly: LongInt; |
1553
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset
|
776 |
haveCollision, |
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset
|
777 |
haveDivided: boolean; |
4 | 778 |
|
1504 | 779 |
procedure DeleteMe; |
780 |
begin |
|
781 |
with HHGear^ do |
|
782 |
begin |
|
783 |
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
|
784 |
State:= (State or gstMoving) and not gstWinner; |
1504 | 785 |
end; |
786 |
DeleteGear(Gear) |
|
787 |
end; |
|
4 | 788 |
|
1781 | 789 |
procedure WaitCollision; |
790 |
begin |
|
791 |
with HHGear^ do |
|
792 |
begin |
|
793 |
Message:= Message and not gm_Attack; |
|
794 |
State:= State or gstMoving; |
|
795 |
end; |
|
796 |
RopePoints.Count:= 0; |
|
797 |
Gear^.Elasticity:= _0; |
|
798 |
Gear^.doStep:= @doStepRopeAfterAttack |
|
799 |
end; |
|
800 |
||
4 | 801 |
begin |
351 | 802 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
108 | 803 |
|
351 | 804 |
if ((HHGear^.State and gstHHDriven) = 0) |
1504 | 805 |
or (CheckGearDrowning(HHGear)) then |
806 |
begin |
|
807 |
DeleteMe; |
|
808 |
exit |
|
809 |
end; |
|
928
b9064b48b001
Some preparation work for attacking from rope, parachute and etc.
unc0rr
parents:
925
diff
changeset
|
810 |
|
351 | 811 |
if (Gear^.Message and gm_Left <> 0) then HHGear^.dX:= HHGear^.dX - _0_0002 else |
812 |
if (Gear^.Message and gm_Right <> 0) then HHGear^.dX:= HHGear^.dX + _0_0002; |
|
4 | 813 |
|
351 | 814 |
if not TestCollisionYwithGear(HHGear, 1) then HHGear^.dY:= HHGear^.dY + cGravity; |
4 | 815 |
|
1652 | 816 |
ropeDx:= HHGear^.X - Gear^.X; // vector between hedgehog and rope attaching point |
817 |
ropeDy:= HHGear^.Y - Gear^.Y; |
|
818 |
||
819 |
mdX:= ropeDx + HHGear^.dX; |
|
820 |
mdY:= ropeDy + HHGear^.dY; |
|
821 |
len:= _1 / Distance(mdX, mdY); |
|
822 |
mdX:= mdX * len; // rope vector plus hedgehog direction vector normalized |
|
823 |
mdY:= mdY * len; |
|
824 |
||
825 |
Gear^.dX:= mdX; // for visual purposes only |
|
826 |
Gear^.dY:= mdY; |
|
827 |
||
828 |
///// |
|
829 |
tx:= HHGear^.X; |
|
830 |
ty:= HHGear^.Y; |
|
4 | 831 |
|
1652 | 832 |
if ((Gear^.Message and gm_Down) <> 0) and (Gear^.Elasticity < Gear^.Friction) then |
833 |
if not (TestCollisionXwithGear(HHGear, hwSign(ropeDx)) |
|
834 |
or TestCollisionYwithGear(HHGear, hwSign(ropeDy))) then |
|
835 |
Gear^.Elasticity:= Gear^.Elasticity + _0_3; |
|
836 |
||
837 |
if ((Gear^.Message and gm_Up) <> 0) and (Gear^.Elasticity > _30) then |
|
838 |
if not (TestCollisionXwithGear(HHGear, -hwSign(ropeDx)) |
|
839 |
or TestCollisionYwithGear(HHGear, -hwSign(ropeDy))) then |
|
840 |
Gear^.Elasticity:= Gear^.Elasticity - _0_3; |
|
841 |
||
842 |
HHGear^.X:= Gear^.X + mdX * Gear^.Elasticity; |
|
843 |
HHGear^.Y:= Gear^.Y + mdY * Gear^.Elasticity; |
|
844 |
||
845 |
HHGear^.dX:= HHGear^.X - tx; |
|
846 |
HHGear^.dY:= HHGear^.Y - ty; |
|
847 |
//// |
|
848 |
||
1554 | 849 |
|
1922 | 850 |
haveDivided:= false; |
1553
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset
|
851 |
// check whether rope needs dividing |
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset
|
852 |
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
|
853 |
nx:= ropeDx * len; |
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset
|
854 |
ny:= ropeDy * len; |
2376 | 855 |
|
1652 | 856 |
len:= Gear^.Elasticity - _0_3x70; |
2365 | 857 |
while len > _3 do |
1504 | 858 |
begin |
1652 | 859 |
lx:= hwRound(Gear^.X + mdX * len); |
860 |
ly:= hwRound(Gear^.Y + mdY * len); |
|
1753 | 861 |
if ((ly and LAND_HEIGHT_MASK) = 0) and ((lx and LAND_WIDTH_MASK) = 0) and (Land[ly, lx] <> 0) then |
1504 | 862 |
begin |
863 |
with RopePoints.ar[RopePoints.Count] do |
|
864 |
begin |
|
865 |
X:= Gear^.X; |
|
866 |
Y:= Gear^.Y; |
|
1553
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset
|
867 |
if RopePoints.Count = 0 then RopePoints.HookAngle:= DxDy2Angle(Gear^.dY, Gear^.dX); |
1652 | 868 |
b:= (nx * HHGear^.dY) > (ny * HHGear^.dX); |
1504 | 869 |
dLen:= len |
870 |
end; |
|
2365 | 871 |
with RopePoints.rounded[RopePoints.Count] do |
872 |
begin |
|
873 |
X:= hwRound(Gear^.X); |
|
874 |
Y:= hwRound(Gear^.Y); |
|
875 |
end; |
|
2376 | 876 |
|
1553
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset
|
877 |
Gear^.X:= Gear^.X + nx * len; |
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset
|
878 |
Gear^.Y:= Gear^.Y + ny * len; |
1504 | 879 |
inc(RopePoints.Count); |
880 |
TryDo(RopePoints.Count <= MAXROPEPOINTS, 'Rope points overflow', true); |
|
881 |
Gear^.Elasticity:= Gear^.Elasticity - len; |
|
882 |
Gear^.Friction:= Gear^.Friction - len; |
|
1553
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset
|
883 |
haveDivided:= true; |
1504 | 884 |
break |
885 |
end; |
|
1553
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset
|
886 |
len:= len - _0_3 // should be the same as increase step |
1504 | 887 |
end; |
1553
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset
|
888 |
|
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset
|
889 |
if not haveDivided then |
1504 | 890 |
if RopePoints.Count > 0 then // check whether the last dividing point could be removed |
891 |
begin |
|
892 |
tx:= RopePoints.ar[Pred(RopePoints.Count)].X; |
|
893 |
ty:= RopePoints.ar[Pred(RopePoints.Count)].Y; |
|
894 |
if RopePoints.ar[Pred(RopePoints.Count)].b xor ((tx - Gear^.X) * (ty - HHGear^.Y) > (tx - HHGear^.X) * (ty - Gear^.Y)) then |
|
895 |
begin |
|
896 |
dec(RopePoints.Count); |
|
1652 | 897 |
Gear^.X:= RopePoints.ar[RopePoints.Count].X; |
898 |
Gear^.Y:= RopePoints.ar[RopePoints.Count].Y; |
|
1504 | 899 |
Gear^.Elasticity:= Gear^.Elasticity + RopePoints.ar[RopePoints.Count].dLen; |
900 |
Gear^.Friction:= Gear^.Friction + RopePoints.ar[RopePoints.Count].dLen |
|
901 |
end |
|
902 |
end; |
|
4 | 903 |
|
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
|
904 |
haveCollision:= false; |
351 | 905 |
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
|
906 |
begin |
1504 | 907 |
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
|
908 |
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
|
909 |
end; |
351 | 910 |
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
|
911 |
begin |
1504 | 912 |
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
|
913 |
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
|
914 |
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
|
915 |
|
1579
2f581b1f289e
More bouncy rope, but you need to press vertical arrow and horizontal keys at once to bounce
unc0rr
parents:
1573
diff
changeset
|
916 |
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
|
917 |
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
|
918 |
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
|
919 |
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
|
920 |
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
|
921 |
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
|
922 |
end; |
4 | 923 |
|
789 | 924 |
len:= Distance(HHGear^.dX, HHGear^.dY); |
940 | 925 |
if len > _0_8 then |
1504 | 926 |
begin |
927 |
len:= _0_8 / len; |
|
928 |
HHGear^.dX:= HHGear^.dX * len; |
|
929 |
HHGear^.dY:= HHGear^.dY * len; |
|
930 |
end; |
|
789 | 931 |
|
351 | 932 |
if (Gear^.Message and gm_Attack) <> 0 then |
1504 | 933 |
if (Gear^.State and gsttmpFlag) <> 0 then |
1922 | 934 |
with PHedgehog(Gear^.Hedgehog)^ do |
1964 | 935 |
if Ammo^[CurSlot, CurAmmo].AmmoType <> amParachute then |
1922 | 936 |
WaitCollision |
937 |
else |
|
938 |
DeleteMe |
|
1504 | 939 |
else |
940 |
else |
|
941 |
if (Gear^.State and gsttmpFlag) = 0 then |
|
942 |
Gear^.State:= Gear^.State or gsttmpFlag; |
|
4 | 943 |
end; |
944 |
||
945 |
procedure doStepRopeAttach(Gear: PGear); |
|
946 |
var HHGear: PGear; |
|
1781 | 947 |
tx, ty, tt: hwFloat; |
948 |
||
949 |
procedure RemoveFromAmmo; |
|
950 |
begin |
|
951 |
if (Gear^.State and gstAttacked) = 0 then |
|
952 |
begin |
|
953 |
OnUsedAmmo(PHedgehog(HHGear^.Hedgehog)^); |
|
954 |
Gear^.State:= Gear^.State or gstAttacked |
|
1964 | 955 |
end; |
956 |
ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^) |
|
1781 | 957 |
end; |
2376 | 958 |
|
4 | 959 |
begin |
351 | 960 |
Gear^.X:= Gear^.X - Gear^.dX; |
961 |
Gear^.Y:= Gear^.Y - Gear^.dY; |
|
498 | 962 |
Gear^.Elasticity:= Gear^.Elasticity + _1; |
351 | 963 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
517 | 964 |
DeleteCI(HHGear); |
542 | 965 |
if (HHGear^.State and gstMoving) <> 0 then |
1433 | 966 |
begin |
2282 | 967 |
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
|
968 |
if HHGear^.dY.isNegative and TestCollisionYwithGear(HHGear, -1) then HHGear^.dY:= _0; |
2376 | 969 |
|
1433 | 970 |
HHGear^.X:= HHGear^.X + HHGear^.dX; |
971 |
Gear^.X:= Gear^.X + HHGear^.dX; |
|
2281
3217f0d8c420
Fix hedgehog stopping to slide when throwing rope (not tested)
unc0rr
parents:
2280
diff
changeset
|
972 |
|
3217f0d8c420
Fix hedgehog stopping to slide when throwing rope (not tested)
unc0rr
parents:
2280
diff
changeset
|
973 |
if TestCollisionYwithGear(HHGear, 1) then |
3217f0d8c420
Fix hedgehog stopping to slide when throwing rope (not tested)
unc0rr
parents:
2280
diff
changeset
|
974 |
begin |
3217f0d8c420
Fix hedgehog stopping to slide when throwing rope (not tested)
unc0rr
parents:
2280
diff
changeset
|
975 |
CheckHHDamage(HHGear); |
3217f0d8c420
Fix hedgehog stopping to slide when throwing rope (not tested)
unc0rr
parents:
2280
diff
changeset
|
976 |
HHGear^.dY:= _0; |
2339 | 977 |
//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
|
978 |
end else |
1433 | 979 |
begin |
2281
3217f0d8c420
Fix hedgehog stopping to slide when throwing rope (not tested)
unc0rr
parents:
2280
diff
changeset
|
980 |
HHGear^.Y:= HHGear^.Y + HHGear^.dY; |
3217f0d8c420
Fix hedgehog stopping to slide when throwing rope (not tested)
unc0rr
parents:
2280
diff
changeset
|
981 |
Gear^.Y:= Gear^.Y + HHGear^.dY; |
3217f0d8c420
Fix hedgehog stopping to slide when throwing rope (not tested)
unc0rr
parents:
2280
diff
changeset
|
982 |
HHGear^.dY:= HHGear^.dY + cGravity; |
3217f0d8c420
Fix hedgehog stopping to slide when throwing rope (not tested)
unc0rr
parents:
2280
diff
changeset
|
983 |
tt:= Gear^.Elasticity; |
3217f0d8c420
Fix hedgehog stopping to slide when throwing rope (not tested)
unc0rr
parents:
2280
diff
changeset
|
984 |
tx:= _0; |
3217f0d8c420
Fix hedgehog stopping to slide when throwing rope (not tested)
unc0rr
parents:
2280
diff
changeset
|
985 |
ty:= _0; |
3217f0d8c420
Fix hedgehog stopping to slide when throwing rope (not tested)
unc0rr
parents:
2280
diff
changeset
|
986 |
while tt > _20 do |
1433 | 987 |
begin |
2281
3217f0d8c420
Fix hedgehog stopping to slide when throwing rope (not tested)
unc0rr
parents:
2280
diff
changeset
|
988 |
if TestCollisionXwithXYShift(Gear, tx, hwRound(ty), -hwSign(Gear^.dX)) |
3217f0d8c420
Fix hedgehog stopping to slide when throwing rope (not tested)
unc0rr
parents:
2280
diff
changeset
|
989 |
or TestCollisionYwithXYShift(Gear, hwRound(tx), hwRound(ty), -hwSign(Gear^.dY)) then |
3217f0d8c420
Fix hedgehog stopping to slide when throwing rope (not tested)
unc0rr
parents:
2280
diff
changeset
|
990 |
begin |
3217f0d8c420
Fix hedgehog stopping to slide when throwing rope (not tested)
unc0rr
parents:
2280
diff
changeset
|
991 |
Gear^.X:= Gear^.X + tx; |
3217f0d8c420
Fix hedgehog stopping to slide when throwing rope (not tested)
unc0rr
parents:
2280
diff
changeset
|
992 |
Gear^.Y:= Gear^.Y + ty; |
3217f0d8c420
Fix hedgehog stopping to slide when throwing rope (not tested)
unc0rr
parents:
2280
diff
changeset
|
993 |
Gear^.Elasticity:= tt; |
3217f0d8c420
Fix hedgehog stopping to slide when throwing rope (not tested)
unc0rr
parents:
2280
diff
changeset
|
994 |
Gear^.doStep:= @doStepRopeWork; |
2339 | 995 |
with HHGear^ do State:= State and not (gstAttacking or gstHHJumping or gstHHHJump); |
2376 | 996 |
|
2281
3217f0d8c420
Fix hedgehog stopping to slide when throwing rope (not tested)
unc0rr
parents:
2280
diff
changeset
|
997 |
RemoveFromAmmo; |
2376 | 998 |
|
2281
3217f0d8c420
Fix hedgehog stopping to slide when throwing rope (not tested)
unc0rr
parents:
2280
diff
changeset
|
999 |
tt:= _0; |
3217f0d8c420
Fix hedgehog stopping to slide when throwing rope (not tested)
unc0rr
parents:
2280
diff
changeset
|
1000 |
exit |
3217f0d8c420
Fix hedgehog stopping to slide when throwing rope (not tested)
unc0rr
parents:
2280
diff
changeset
|
1001 |
end; |
3217f0d8c420
Fix hedgehog stopping to slide when throwing rope (not tested)
unc0rr
parents:
2280
diff
changeset
|
1002 |
tx:= tx + Gear^.dX + Gear^.dX; |
3217f0d8c420
Fix hedgehog stopping to slide when throwing rope (not tested)
unc0rr
parents:
2280
diff
changeset
|
1003 |
ty:= ty + Gear^.dY + Gear^.dY; |
3217f0d8c420
Fix hedgehog stopping to slide when throwing rope (not tested)
unc0rr
parents:
2280
diff
changeset
|
1004 |
tt:= tt - _2; |
1433 | 1005 |
end; |
1006 |
end; |
|
1007 |
end; |
|
929
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1008 |
|
4 | 1009 |
CheckCollision(Gear); |
929
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1010 |
|
351 | 1011 |
if (Gear^.State and gstCollision) <> 0 then |
2068 | 1012 |
if Gear^.Elasticity < _10 then |
1013 |
Gear^.Elasticity:= _10000 |
|
1014 |
else |
|
1015 |
begin |
|
1016 |
Gear^.doStep:= @doStepRopeWork; |
|
2339 | 1017 |
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
|
1018 |
|
2068 | 1019 |
RemoveFromAmmo; |
2376 | 1020 |
|
2068 | 1021 |
exit |
1022 |
end; |
|
4 | 1023 |
|
1634
486a89f0e843
Fix rope bug which allowed hedgehog to go into land
unc0rr
parents:
1633
diff
changeset
|
1024 |
if (Gear^.Elasticity > Gear^.Friction) |
486a89f0e843
Fix rope bug which allowed hedgehog to go into land
unc0rr
parents:
1633
diff
changeset
|
1025 |
or ((Gear^.Message and gm_Attack) = 0) |
2280 | 1026 |
or ((HHGear^.State and gstHHDriven) = 0) |
1634
486a89f0e843
Fix rope bug which allowed hedgehog to go into land
unc0rr
parents:
1633
diff
changeset
|
1027 |
or (HHGear^.Damage > 0) then |
1433 | 1028 |
begin |
1029 |
with PHedgehog(Gear^.Hedgehog)^.Gear^ do |
|
1030 |
begin |
|
1031 |
State:= State and not gstAttacking; |
|
1032 |
Message:= Message and not gm_Attack |
|
1033 |
end; |
|
1034 |
DeleteGear(Gear) |
|
1035 |
end |
|
4 | 1036 |
end; |
1037 |
||
1038 |
procedure doStepRope(Gear: PGear); |
|
1039 |
begin |
|
351 | 1040 |
Gear^.dX:= - Gear^.dX; |
1041 |
Gear^.dY:= - Gear^.dY; |
|
1042 |
Gear^.doStep:= @doStepRopeAttach |
|
4 | 1043 |
end; |
1044 |
||
1045 |
//////////////////////////////////////////////////////////////////////////////// |
|
1046 |
procedure doStepSmokeTrace(Gear: PGear); |
|
1047 |
begin |
|
351 | 1048 |
inc(Gear^.Timer); |
1049 |
if Gear^.Timer > 64 then |
|
1133 | 1050 |
begin |
1051 |
Gear^.Timer:= 0; |
|
1052 |
dec(Gear^.State) |
|
1053 |
end; |
|
351 | 1054 |
Gear^.dX:= Gear^.dX + cWindSpeed; |
1055 |
Gear^.X:= Gear^.X + Gear^.dX; |
|
1056 |
if Gear^.State = 0 then DeleteGear(Gear) |
|
4 | 1057 |
end; |
9 | 1058 |
|
1059 |
//////////////////////////////////////////////////////////////////////////////// |
|
1045 | 1060 |
procedure doStepExplosionWork(Gear: PGear); |
9 | 1061 |
begin |
351 | 1062 |
inc(Gear^.Timer); |
1063 |
if Gear^.Timer > 75 then |
|
1133 | 1064 |
begin |
1065 |
inc(Gear^.State); |
|
1066 |
Gear^.Timer:= 0; |
|
1067 |
if Gear^.State > 5 then DeleteGear(Gear) |
|
1068 |
end; |
|
9 | 1069 |
end; |
10 | 1070 |
|
1045 | 1071 |
procedure doStepExplosion(Gear: PGear); |
1072 |
var i: LongWord; |
|
1073 |
begin |
|
1047 | 1074 |
for i:= 0 to 31 do AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtFire); |
1075 |
for i:= 0 to 8 do AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtExplPart); |
|
1076 |
for i:= 0 to 8 do AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtExplPart2); |
|
1045 | 1077 |
Gear^.doStep:= @doStepExplosionWork |
1078 |
end; |
|
1079 |
||
10 | 1080 |
//////////////////////////////////////////////////////////////////////////////// |
1081 |
procedure doStepMine(Gear: PGear); |
|
1082 |
begin |
|
542 | 1083 |
if (Gear^.State and gstMoving) <> 0 then |
914 | 1084 |
begin |
1085 |
DeleteCI(Gear); |
|
1086 |
doStepFallingGear(Gear); |
|
1087 |
if (Gear^.State and gstMoving) = 0 then |
|
1088 |
begin |
|
1089 |
AddGearCI(Gear); |
|
1090 |
Gear^.dX:= _0; |
|
1091 |
Gear^.dY:= _0 |
|
1092 |
end; |
|
1093 |
CalcRotationDirAngle(Gear); |
|
1094 |
AllInactive:= false |
|
1095 |
end else |
|
1096 |
if ((GameTicks and $3F) = 25) then |
|
1097 |
doStepFallingGear(Gear); |
|
351 | 1098 |
|
1099 |
if ((Gear^.State and gsttmpFlag) <> 0) then |
|
1133 | 1100 |
if ((Gear^.State and gstAttacking) = 0) then |
1101 |
begin |
|
1102 |
if ((GameTicks and $1F) = 0) then |
|
1103 |
if CheckGearNear(Gear, gtHedgehog, 46, 32) <> nil then Gear^.State:= Gear^.State or gstAttacking |
|
1104 |
end else // gstAttacking <> 0 |
|
1105 |
begin |
|
1106 |
AllInactive:= false; |
|
1669 | 1107 |
if (Gear^.Timer and $FF) = 0 then PlaySound(sndMineTick, false, nil); |
1133 | 1108 |
if Gear^.Timer = 0 then |
1109 |
begin |
|
1110 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound); |
|
1111 |
DeleteGear(Gear); |
|
1112 |
exit |
|
1113 |
end; |
|
1114 |
dec(Gear^.Timer); |
|
1115 |
end else // gsttmpFlag = 0 |
|
1116 |
if TurnTimeLeft = 0 then Gear^.State:= Gear^.State or gsttmpFlag; |
|
10 | 1117 |
end; |
57 | 1118 |
|
39 | 1119 |
//////////////////////////////////////////////////////////////////////////////// |
1120 |
procedure doStepDynamite(Gear: PGear); |
|
1121 |
begin |
|
43 | 1122 |
doStepFallingGear(Gear); |
1123 |
AllInactive:= false; |
|
351 | 1124 |
if Gear^.Timer mod 166 = 0 then inc(Gear^.Tag); |
1125 |
if Gear^.Timer = 0 then |
|
1133 | 1126 |
begin |
1127 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 75, EXPLAutoSound); |
|
1128 |
DeleteGear(Gear); |
|
1129 |
exit |
|
1130 |
end; |
|
351 | 1131 |
dec(Gear^.Timer); |
39 | 1132 |
end; |
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
1133 |
|
351 | 1134 |
/////////////////////////////////////////////////////////////////////////////// |
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
1135 |
procedure doStepCase(Gear: PGear); |
371 | 1136 |
var i, x, y: LongInt; |
1436 | 1137 |
k: TGearType; |
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
1138 |
begin |
351 | 1139 |
if (Gear^.Message and gm_Destroy) > 0 then |
1133 | 1140 |
begin |
1141 |
DeleteGear(Gear); |
|
1142 |
FreeActionsList; |
|
1143 |
SetAllToActive; // something (hh, mine, etc...) could be on top of the case |
|
1144 |
with CurrentHedgehog^ do |
|
1145 |
if Gear <> nil then Gear^.Message:= Gear^.Message and not (gm_LJump or gm_HJump); |
|
1146 |
exit |
|
1147 |
end; |
|
15 | 1148 |
|
351 | 1149 |
if Gear^.Damage > 0 then |
1133 | 1150 |
begin |
1151 |
x:= hwRound(Gear^.X); |
|
1152 |
y:= hwRound(Gear^.Y); |
|
1436 | 1153 |
k:= Gear^.Kind; |
1154 |
DeleteGear(Gear); // <-- delete gear! |
|
2376 | 1155 |
|
1436 | 1156 |
if k = gtCase then |
1133 | 1157 |
begin |
1158 |
doMakeExplosion(x, y, 25, EXPLAutoSound); |
|
1159 |
for i:= 0 to 63 do |
|
1160 |
AddGear(x, y, gtFlame, 0, _0, _0, 0); |
|
1161 |
end; |
|
1162 |
exit |
|
1163 |
end; |
|
79 | 1164 |
|
351 | 1165 |
if (Gear^.dY.QWordValue <> 0) or (not TestCollisionYwithGear(Gear, 1)) then |
1133 | 1166 |
begin |
1167 |
AllInactive:= false; |
|
1168 |
Gear^.dY:= Gear^.dY + cGravity; |
|
1169 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
|
1170 |
if (Gear^.dY.isNegative) and TestCollisionYwithGear(Gear, -1) then Gear^.dY:= _0 else |
|
1171 |
if (not Gear^.dY.isNegative) and TestCollisionYwithGear(Gear, 1) then |
|
1172 |
begin |
|
1173 |
Gear^.dY:= - Gear^.dY * Gear^.Elasticity; |
|
1174 |
if Gear^.dY > - _0_001 then Gear^.dY:= _0 |
|
1669 | 1175 |
else if Gear^.dY < - _0_03 then PlaySound(sndGraveImpact, false, nil); |
1133 | 1176 |
end; |
1177 |
CheckGearDrowning(Gear); |
|
1178 |
end; |
|
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
1179 |
|
511 | 1180 |
if (Gear^.dY.QWordValue = 0) then AddGearCI(Gear) |
1133 | 1181 |
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
|
1182 |
end; |
49 | 1183 |
|
1184 |
//////////////////////////////////////////////////////////////////////////////// |
|
854 | 1185 |
procedure doStepIdle(Gear: PGear); |
1186 |
begin |
|
1187 |
AllInactive:= false; |
|
925 | 1188 |
dec(Gear^.Timer); |
854 | 1189 |
if Gear^.Timer = 0 then |
1190 |
begin |
|
1191 |
DeleteGear(Gear); |
|
1192 |
AfterAttack |
|
1193 |
end |
|
1194 |
end; |
|
1195 |
||
79 | 1196 |
procedure doStepShover(Gear: PGear); |
1197 |
var HHGear: PGear; |
|
1198 |
begin |
|
351 | 1199 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
1200 |
HHGear^.State:= HHGear^.State or gstNoDamage; |
|
980
20128e98988b
Don't push attacking hedgehog when using whip or baseball
unc0rr
parents:
979
diff
changeset
|
1201 |
DeleteCI(HHGear); |
20128e98988b
Don't push attacking hedgehog when using whip or baseball
unc0rr
parents:
979
diff
changeset
|
1202 |
|
79 | 1203 |
AmmoShove(Gear, 30, 115); |
980
20128e98988b
Don't push attacking hedgehog when using whip or baseball
unc0rr
parents:
979
diff
changeset
|
1204 |
|
351 | 1205 |
HHGear^.State:= HHGear^.State and not gstNoDamage; |
854 | 1206 |
Gear^.Timer:= 250; |
1207 |
Gear^.doStep:= @doStepIdle |
|
79 | 1208 |
end; |
1209 |
||
1210 |
//////////////////////////////////////////////////////////////////////////////// |
|
925 | 1211 |
procedure doStepWhip(Gear: PGear); |
1212 |
var HHGear: PGear; |
|
1213 |
i: LongInt; |
|
1214 |
begin |
|
1215 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
1216 |
HHGear^.State:= HHGear^.State or gstNoDamage; |
|
980
20128e98988b
Don't push attacking hedgehog when using whip or baseball
unc0rr
parents:
979
diff
changeset
|
1217 |
DeleteCI(HHGear); |
925 | 1218 |
|
1219 |
for i:= 0 to 3 do |
|
1220 |
begin |
|
1221 |
AmmoShove(Gear, 30, 25); |
|
1222 |
Gear^.X:= Gear^.X + Gear^.dX * 5 |
|
1223 |
end; |
|
1224 |
||
1225 |
HHGear^.State:= HHGear^.State and not gstNoDamage; |
|
1226 |
Gear^.Timer:= 250; |
|
1227 |
Gear^.doStep:= @doStepIdle |
|
1228 |
end; |
|
1229 |
||
1230 |
//////////////////////////////////////////////////////////////////////////////// |
|
79 | 1231 |
procedure doStepFlame(Gear: PGear); |
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
|
1232 |
var i: Integer; |
79 | 1233 |
begin |
1234 |
AllInactive:= false; |
|
1433 | 1235 |
|
79 | 1236 |
if not TestCollisionYwithGear(Gear, 1) then |
1133 | 1237 |
begin |
1586 | 1238 |
if hwAbs(Gear^.dX) > _0_01 then |
1239 |
Gear^.dX:= Gear^.dX * _0_995; |
|
1297 | 1240 |
|
1133 | 1241 |
Gear^.dY:= Gear^.dY + cGravity; |
1830 | 1242 |
if hwAbs(Gear^.dY) > _0_2 then Gear^.dY:= Gear^.dY * _0_995; |
2376 | 1243 |
|
1830 | 1244 |
Gear^.X:= Gear^.X + Gear^.dX + cWindSpeed * 640; |
1133 | 1245 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
2376 | 1246 |
|
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
|
1247 |
if (hwRound(Gear^.Y) > cWaterLine) then |
1133 | 1248 |
begin |
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
|
1249 |
for i:= 0 to 3 do |
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
|
1250 |
begin |
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
|
1251 |
AddVisualGear(hwRound(Gear^.X) - 16 + Random(32), hwRound(Gear^.Y) - 16 + Random(16), vgtSteam); |
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
|
1252 |
PlaySound(sndVaporize, false, nil); |
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
|
1253 |
end; |
1133 | 1254 |
DeleteGear(Gear); |
1255 |
exit |
|
1256 |
end |
|
1257 |
end else begin |
|
1258 |
if Gear^.Timer > 0 then dec(Gear^.Timer) |
|
1259 |
else begin |
|
1586 | 1260 |
Gear^.Radius:= 9; |
1261 |
AmmoShove(Gear, 4, 100); |
|
1297 | 1262 |
Gear^.Radius:= 1; |
1263 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 4, EXPLNoDamage); |
|
1133 | 1264 |
dec(Gear^.Health); |
1586 | 1265 |
Gear^.Timer:= 450 - Gear^.Tag * 8 |
1133 | 1266 |
end |
1267 |
end; |
|
79 | 1268 |
|
1295 | 1269 |
//if (((GameTicks div 8) mod 64) = Gear^.Tag) then |
1270 |
// AmmoFlameWork(Gear); |
|
79 | 1271 |
|
351 | 1272 |
if Gear^.Health = 0 then |
1133 | 1273 |
DeleteGear(Gear) |
79 | 1274 |
end; |
82 | 1275 |
|
1276 |
//////////////////////////////////////////////////////////////////////////////// |
|
1277 |
procedure doStepFirePunchWork(Gear: PGear); |
|
1278 |
var HHGear: PGear; |
|
1279 |
begin |
|
1280 |
AllInactive:= false; |
|
351 | 1281 |
if ((Gear^.Message and gm_Destroy) <> 0) then |
1133 | 1282 |
begin |
1283 |
DeleteGear(Gear); |
|
1284 |
AfterAttack; |
|
1285 |
exit |
|
1286 |
end; |
|
82 | 1287 |
|
351 | 1288 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
1289 |
if hwRound(HHGear^.Y) <= Gear^.Tag - 2 then |
|
1133 | 1290 |
begin |
1291 |
Gear^.Tag:= hwRound(HHGear^.Y); |
|
1292 |
DrawTunnel(HHGear^.X - int2hwFloat(cHHRadius), HHGear^.Y - _1, _0_5, _0, cHHRadius * 4, 2); |
|
1293 |
HHGear^.State:= HHGear^.State or gstNoDamage; |
|
1294 |
Gear^.Y:= HHGear^.Y; |
|
1295 |
AmmoShove(Gear, 30, 40); |
|
1296 |
HHGear^.State:= HHGear^.State and not gstNoDamage |
|
1297 |
end; |
|
351 | 1298 |
|
1299 |
HHGear^.dY:= HHGear^.dY + cGravity; |
|
1300 |
if not (HHGear^.dY.isNegative) then |
|
1133 | 1301 |
begin |
1302 |
HHGear^.State:= HHGear^.State or gstMoving; |
|
1303 |
DeleteGear(Gear); |
|
1304 |
AfterAttack; |
|
1305 |
exit |
|
1306 |
end; |
|
2089 | 1307 |
|
2376 | 1308 |
if CheckLandValue(hwRound(HHGear^.X), hwRound(HHGear^.Y + HHGear^.dY + SignAs(_6,Gear^.dY)), COLOR_INDESTRUCTIBLE) then |
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
|
1309 |
HHGear^.Y:= HHGear^.Y + HHGear^.dY |
82 | 1310 |
end; |
1311 |
||
1312 |
procedure doStepFirePunch(Gear: PGear); |
|
1313 |
var HHGear: PGear; |
|
1314 |
begin |
|
1315 |
AllInactive:= false; |
|
351 | 1316 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
514 | 1317 |
DeleteCI(HHGear); |
498 | 1318 |
HHGear^.X:= int2hwFloat(hwRound(HHGear^.X)) - _0_5; |
1014
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
992
diff
changeset
|
1319 |
HHGear^.dX:= SignAs(cLittle, Gear^.dX); |
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
992
diff
changeset
|
1320 |
|
351 | 1321 |
HHGear^.dY:= - _0_3; |
82 | 1322 |
|
351 | 1323 |
Gear^.X:= HHGear^.X; |
979
edb8f208c1d9
Fix firepunch direction when attacking from high jump
unc0rr
parents:
974
diff
changeset
|
1324 |
Gear^.dX:= SignAs(_0_45, Gear^.dX); |
351 | 1325 |
Gear^.dY:= - _0_9; |
1326 |
Gear^.doStep:= @doStepFirePunchWork; |
|
498 | 1327 |
DrawTunnel(HHGear^.X - int2hwFloat(cHHRadius), HHGear^.Y + _1, _0_5, _0, cHHRadius * 4, 5); |
1279 | 1328 |
|
1669 | 1329 |
PlaySound(TSound(ord(sndFirePunch1) + GetRandom(6)), false, PHedgehog(HHGear^.Hedgehog)^.Team^.voicepack) |
82 | 1330 |
end; |
1331 |
||
263 | 1332 |
//////////////////////////////////////////////////////////////////////////////// |
1333 |
||
929
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1334 |
procedure doStepParachuteWork(Gear: PGear); |
211 | 1335 |
var HHGear: PGear; |
1336 |
begin |
|
351 | 1337 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
82 | 1338 |
|
516 | 1339 |
inc(Gear^.Timer); |
1340 |
||
212 | 1341 |
if TestCollisionYwithGear(HHGear, 1) |
1133 | 1342 |
or ((HHGear^.State and gstHHDriven) = 0) |
1343 |
or CheckGearDrowning(HHGear) |
|
1344 |
or ((Gear^.Message and gm_Attack) <> 0) then |
|
1345 |
begin |
|
1346 |
with HHGear^ do |
|
1347 |
begin |
|
1348 |
Message:= 0; |
|
1349 |
SetLittle(dX); |
|
1350 |
dY:= _0; |
|
1351 |
State:= State or gstMoving; |
|
1352 |
end; |
|
1353 |
DeleteGear(Gear); |
|
2060
3e9e5e1be6f5
fix crash in parachute/rope if drowning with active girder/teleport
nemo
parents:
2059
diff
changeset
|
1354 |
isCursorVisible:= false; |
1133 | 1355 |
exit |
1356 |
end; |
|
211 | 1357 |
|
351 | 1358 |
if not TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then |
1133 | 1359 |
HHGear^.X:= HHGear^.X + cWindSpeed * 200; |
211 | 1360 |
|
351 | 1361 |
if (Gear^.Message and gm_Left) <> 0 then HHGear^.X:= HHGear^.X - cMaxWindSpeed * 40 |
1362 |
else if (Gear^.Message and gm_Right) <> 0 then HHGear^.X:= HHGear^.X + cMaxWindSpeed * 40; |
|
1363 |
if (Gear^.Message and gm_Up) <> 0 then HHGear^.Y:= HHGear^.Y - cGravity * 40 |
|
1364 |
else if (Gear^.Message and gm_Down) <> 0 then HHGear^.Y:= HHGear^.Y + cGravity * 40; |
|
211 | 1365 |
|
351 | 1366 |
HHGear^.Y:= HHGear^.Y + cGravity * 100; |
568 | 1367 |
Gear^.X:= HHGear^.X; |
1368 |
Gear^.Y:= HHGear^.Y |
|
263 | 1369 |
end; |
211 | 1370 |
|
929
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1371 |
procedure doStepParachute(Gear: PGear); |
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1372 |
var HHGear: PGear; |
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1373 |
begin |
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1374 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1375 |
|
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1376 |
DeleteCI(HHGear); |
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1377 |
|
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1378 |
OnUsedAmmo(PHedgehog(HHGear^.Hedgehog)^); |
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1379 |
ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^); |
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1380 |
|
931 | 1381 |
HHGear^.State:= HHGear^.State and not (gstAttacking or gstAttacked or gstMoving); |
929
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1382 |
HHGear^.Message:= HHGear^.Message and not gm_Attack; |
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1383 |
|
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1384 |
Gear^.doStep:= @doStepParachuteWork; |
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1385 |
|
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1386 |
Gear^.Message:= HHGear^.Message; |
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1387 |
doStepParachuteWork(Gear) |
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1388 |
end; |
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1389 |
|
263 | 1390 |
//////////////////////////////////////////////////////////////////////////////// |
1391 |
procedure doStepAirAttackWork(Gear: PGear); |
|
1507 | 1392 |
var i: Longint; |
263 | 1393 |
begin |
1394 |
AllInactive:= false; |
|
498 | 1395 |
Gear^.X:= Gear^.X + cAirPlaneSpeed * Gear^.Tag; |
1124 | 1396 |
|
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
1397 |
if (Gear^.Health > 0)and(not (Gear^.X < Gear^.dX))and(Gear^.X < Gear^.dX + cAirPlaneSpeed) then |
1124 | 1398 |
begin |
1399 |
dec(Gear^.Health); |
|
1400 |
case Gear^.State of |
|
1401 |
0: FollowGear:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtAirBomb, 0, cBombsSpeed * Gear^.Tag, _0, 0); |
|
1402 |
1: FollowGear:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtMine, 0, cBombsSpeed * Gear^.Tag, _0, 0); |
|
1586 | 1403 |
2: for i:= -19 to 19 do |
1404 |
FollowGear:= AddGear(hwRound(Gear^.X) + i div 3, hwRound(Gear^.Y), gtFlame, 0, _0_001 * i, _0, 0); |
|
1124 | 1405 |
end; |
1406 |
Gear^.dX:= Gear^.dX + int2hwFloat(30 * Gear^.Tag) |
|
1407 |
end; |
|
1408 |
||
1409 |
if (GameTicks and $3F) = 0 then |
|
1410 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtSmokeTrace, 0, _0, _0, 0); |
|
1411 |
||
1753 | 1412 |
if (hwRound(Gear^.X) > (LAND_WIDTH+1024)) or (hwRound(Gear^.X) < -1024) then DeleteGear(Gear) |
263 | 1413 |
end; |
1414 |
||
1415 |
procedure doStepAirAttack(Gear: PGear); |
|
1416 |
begin |
|
1417 |
AllInactive:= false; |
|
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
1418 |
|
1507 | 1419 |
if Gear^.X.QWordValue = 0 then |
1771 | 1420 |
begin |
1421 |
Gear^.Tag:= 1; |
|
1422 |
Gear^.X:= -_1024; |
|
1423 |
end |
|
1507 | 1424 |
else |
1771 | 1425 |
begin |
1507 | 1426 |
Gear^.Tag:= -1; |
1771 | 1427 |
Gear^.X:= int2hwFloat(LAND_WIDTH + 1024); |
1428 |
end; |
|
1507 | 1429 |
|
1784 | 1430 |
Gear^.Y:= int2hwFloat(topY-300); |
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
1431 |
Gear^.dX:= int2hwFloat(TargetPoint.X - 5 * Gear^.Tag * 15); |
357 | 1432 |
|
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
1433 |
if int2hwFloat(TargetPoint.Y) - Gear^.Y > _0 then |
1133 | 1434 |
Gear^.dX:= Gear^.dX - cBombsSpeed * hwSqrt((int2hwFloat(TargetPoint.Y) - Gear^.Y) * 2 / cGravity) * Gear^.Tag; |
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
1435 |
|
351 | 1436 |
Gear^.Health:= 6; |
801 | 1437 |
Gear^.doStep:= @doStepAirAttackWork; |
1669 | 1438 |
PlaySound(sndIncoming, false, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack) |
263 | 1439 |
end; |
1440 |
||
1441 |
//////////////////////////////////////////////////////////////////////////////// |
|
1442 |
||
1443 |
procedure doStepAirBomb(Gear: PGear); |
|
1444 |
begin |
|
1445 |
AllInactive:= false; |
|
1446 |
doStepFallingGear(Gear); |
|
351 | 1447 |
if (Gear^.State and gstCollision) <> 0 then |
1133 | 1448 |
begin |
1449 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, EXPLAutoSound); |
|
1450 |
DeleteGear(Gear); |
|
1451 |
exit |
|
1452 |
end; |
|
263 | 1453 |
if (GameTicks and $3F) = 0 then |
1133 | 1454 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtSmokeTrace, 0, _0, _0, 0) |
211 | 1455 |
end; |
409 | 1456 |
|
1457 |
//////////////////////////////////////////////////////////////////////////////// |
|
1458 |
||
1459 |
procedure doStepGirder(Gear: PGear); |
|
415 | 1460 |
var HHGear: PGear; |
1915 | 1461 |
x, y, tx, ty: hwFloat; |
409 | 1462 |
begin |
1463 |
AllInactive:= false; |
|
415 | 1464 |
|
1465 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
1915 | 1466 |
tx:= int2hwFloat(TargetPoint.X); |
1467 |
ty:= int2hwFloat(TargetPoint.Y); |
|
1468 |
x:= HHGear^.X; |
|
1469 |
y:= HHGear^.Y; |
|
1909 | 1470 |
|
1915 | 1471 |
if (Distance(tx - x, ty - y) > _256) or |
1472 |
not TryPlaceOnLand(TargetPoint.X - SpritesData[sprAmGirder].Width div 2, |
|
1473 |
TargetPoint.Y - SpritesData[sprAmGirder].Height div 2, |
|
520 | 1474 |
sprAmGirder, Gear^.State, true) then |
1133 | 1475 |
begin |
1914 | 1476 |
PlaySound(sndDenied, false, nil); |
1477 |
HHGear^.Message:= HHGear^.Message and not gm_Attack; |
|
1478 |
HHGear^.State:= HHGear^.State and not gstAttacking; |
|
1133 | 1479 |
HHGear^.State:= HHGear^.State or gstHHChooseTarget; |
1914 | 1480 |
isCursorVisible:= true; |
1481 |
DeleteGear(Gear) |
|
1133 | 1482 |
end |
1483 |
else begin |
|
1914 | 1484 |
PlaySound(sndPlaced, false, nil); |
1133 | 1485 |
DeleteGear(Gear); |
1909 | 1486 |
OnUsedAmmo(PHedgehog(HHGear^.Hedgehog)^); |
1914 | 1487 |
ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^) |
1488 |
end; |
|
1489 |
||
1909 | 1490 |
HHGear^.State:= HHGear^.State and not (gstAttacking or gstAttacked); |
1491 |
HHGear^.Message:= HHGear^.Message and not gm_Attack; |
|
415 | 1492 |
TargetPoint.X:= NoPointX |
409 | 1493 |
end; |
520 | 1494 |
|
1495 |
//////////////////////////////////////////////////////////////////////////////// |
|
525 | 1496 |
procedure doStepTeleportAfter(Gear: PGear); |
912 | 1497 |
var HHGear: PGear; |
1498 |
begin |
|
1499 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
1500 |
HHGear^.Y:= HHGear^.Y + HHGear^.dY; // hedgehog falling to collect cases |
|
1501 |
HHGear^.dY:= HHGear^.dY + cGravity; |
|
945
4ead9cde4e14
- Start chat implementation: chat strings are on the screen
unc0rr
parents:
940
diff
changeset
|
1502 |
if TestCollisionYwithGear(HHGear, 1) |
1133 | 1503 |
or CheckGearDrowning(HHGear) then |
1504 |
begin |
|
1505 |
DeleteGear(Gear); |
|
1506 |
AfterAttack |
|
1507 |
end |
|
912 | 1508 |
end; |
1509 |
||
1510 |
procedure doStepTeleportAnim(Gear: PGear); |
|
525 | 1511 |
begin |
853 | 1512 |
inc(Gear^.Timer); |
1513 |
if Gear^.Timer = 65 then |
|
1514 |
begin |
|
1515 |
Gear^.Timer:= 0; |
|
1516 |
inc(Gear^.Pos); |
|
1517 |
if Gear^.Pos = 11 then |
|
912 | 1518 |
Gear^.doStep:= @doStepTeleportAfter |
2217 | 1519 |
end; |
525 | 1520 |
end; |
520 | 1521 |
|
1522 |
procedure doStepTeleport(Gear: PGear); |
|
1523 |
var HHGear: PGear; |
|
1524 |
begin |
|
1525 |
AllInactive:= false; |
|
1526 |
||
1527 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
1528 |
if not TryPlaceOnLand(TargetPoint.X - SpritesData[sprHHTelepMask].Width div 2, |
|
1529 |
TargetPoint.Y - SpritesData[sprHHTelepMask].Height div 2, |
|
1530 |
sprHHTelepMask, 0, false) then |
|
853 | 1531 |
begin |
1532 |
HHGear^.Message:= HHGear^.Message and not gm_Attack; |
|
1533 |
HHGear^.State:= HHGear^.State and not gstAttacking; |
|
1534 |
HHGear^.State:= HHGear^.State or gstHHChooseTarget; |
|
1535 |
DeleteGear(Gear); |
|
2227 | 1536 |
isCursorVisible:= true; |
1537 |
PlaySound(sndDenied, false, nil); |
|
853 | 1538 |
end |
1539 |
else begin |
|
1540 |
DeleteCI(HHGear); |
|
1541 |
SetAllHHToActive; |
|
912 | 1542 |
Gear^.doStep:= @doStepTeleportAnim; |
853 | 1543 |
Gear^.X:= HHGear^.X; |
1544 |
Gear^.Y:= HHGear^.Y; |
|
1545 |
HHGear^.X:= int2hwFloat(TargetPoint.X); |
|
1546 |
HHGear^.Y:= int2hwFloat(TargetPoint.Y); |
|
2227 | 1547 |
HHGear^.State:= HHGear^.State or gstMoving; |
1548 |
playSound(sndWarp, false, nil); |
|
853 | 1549 |
end; |
2217 | 1550 |
TargetPoint.X:= NoPointX; |
1551 |
||
520 | 1552 |
end; |
534 | 1553 |
|
1554 |
//////////////////////////////////////////////////////////////////////////////// |
|
1555 |
procedure doStepSwitcherWork(Gear: PGear); |
|
1556 |
var HHGear: PGear; |
|
1557 |
Msg, State: Longword; |
|
1558 |
begin |
|
1559 |
AllInactive:= false; |
|
1560 |
||
540 | 1561 |
if ((Gear^.Message and not gm_Switch) <> 0) or (TurnTimeLeft = 0) then |
1133 | 1562 |
begin |
1563 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
1564 |
Msg:= Gear^.Message and not gm_Switch; |
|
1565 |
DeleteGear(Gear); |
|
1566 |
OnUsedAmmo(PHedgehog(HHGear^.Hedgehog)^); |
|
1567 |
ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^); |
|
534 | 1568 |
|
1133 | 1569 |
HHGear:= CurrentHedgehog^.Gear; |
1570 |
ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^); |
|
1571 |
HHGear^.Message:= Msg; |
|
1572 |
exit |
|
1573 |
end; |
|
534 | 1574 |
|
1575 |
if (Gear^.Message and gm_Switch) <> 0 then |
|
1133 | 1576 |
begin |
1577 |
HHGear:= CurrentHedgehog^.Gear; |
|
1578 |
HHGear^.Message:= HHGear^.Message and not gm_Switch; |
|
1579 |
Gear^.Message:= Gear^.Message and not gm_Switch; |
|
1580 |
State:= HHGear^.State; |
|
1581 |
HHGear^.State:= 0; |
|
1582 |
HHGear^.Active:= false; |
|
1583 |
HHGear^.Z:= cHHZ; |
|
1584 |
RemoveGearFromList(HHGear); |
|
1585 |
InsertGearToList(HHGear); |
|
534 | 1586 |
|
1133 | 1587 |
repeat |
1588 |
CurrentTeam^.CurrHedgehog:= Succ(CurrentTeam^.CurrHedgehog) mod (CurrentTeam^.HedgehogsNumber); |
|
1589 |
until (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil); |
|
652 | 1590 |
|
1133 | 1591 |
CurrentHedgehog:= @CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog]; |
534 | 1592 |
|
1133 | 1593 |
HHGear:= CurrentHedgehog^.Gear; |
1594 |
HHGear^.State:= State; |
|
1595 |
HHGear^.Active:= true; |
|
1596 |
FollowGear:= HHGear; |
|
1597 |
HHGear^.Z:= cCurrHHZ; |
|
1598 |
RemoveGearFromList(HHGear); |
|
1599 |
InsertGearToList(HHGear); |
|
1600 |
Gear^.X:= HHGear^.X; |
|
1601 |
Gear^.Y:= HHGear^.Y |
|
1602 |
end; |
|
534 | 1603 |
end; |
1604 |
||
1605 |
procedure doStepSwitcher(Gear: PGear); |
|
1606 |
var HHGear: PGear; |
|
1607 |
begin |
|
1608 |
Gear^.doStep:= @doStepSwitcherWork; |
|
1609 |
||
1610 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
1611 |
with HHGear^ do |
|
1133 | 1612 |
begin |
1613 |
State:= State and not gstAttacking; |
|
1614 |
Message:= Message and not gm_Attack |
|
1615 |
end |
|
534 | 1616 |
end; |
924 | 1617 |
|
1618 |
//////////////////////////////////////////////////////////////////////////////// |
|
1619 |
procedure doStepMortar(Gear: PGear); |
|
1620 |
var dX, dY: hwFloat; |
|
1621 |
i: LongInt; |
|
963 | 1622 |
dxn, dyn: boolean; |
924 | 1623 |
begin |
1624 |
AllInactive:= false; |
|
963 | 1625 |
dxn:= Gear^.dX.isNegative; |
1626 |
dyn:= Gear^.dY.isNegative; |
|
1627 |
||
924 | 1628 |
doStepFallingGear(Gear); |
1629 |
if (Gear^.State and gstCollision) <> 0 then |
|
1630 |
begin |
|
1631 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 20, EXPLAutoSound); |
|
2262 | 1632 |
soundFadeOut(sndMortar,10,nil); |
963 | 1633 |
|
1634 |
Gear^.dX.isNegative:= not dxn; |
|
1635 |
Gear^.dY.isNegative:= not dyn; |
|
924 | 1636 |
for i:= 0 to 4 do |
1637 |
begin |
|
963 | 1638 |
dX:= Gear^.dX + (GetRandom - _0_5) * _0_03; |
1639 |
dY:= Gear^.dY + (GetRandom - _0_5) * _0_03; |
|
1273 | 1640 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtCluster, 0, dX, dY, 25); |
924 | 1641 |
end; |
2376 | 1642 |
|
924 | 1643 |
DeleteGear(Gear); |
1644 |
exit |
|
1645 |
end; |
|
963 | 1646 |
|
924 | 1647 |
if (GameTicks and $3F) = 0 then |
1648 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtSmokeTrace, 0, _0, _0, 0) |
|
1649 |
end; |
|
984 | 1650 |
|
1651 |
//////////////////////////////////////////////////////////////////////////////// |
|
1652 |
procedure doStepKamikazeWork(Gear: PGear); |
|
1653 |
const upd: Longword = 0; |
|
987 | 1654 |
var i: LongWord; |
984 | 1655 |
HHGear: PGear; |
1656 |
begin |
|
1657 |
AllInactive:= false; |
|
1658 |
||
1659 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
1660 |
HHGear^.State:= HHGear^.State or gstNoDamage; |
|
1661 |
DeleteCI(HHGear); |
|
1662 |
||
1663 |
i:= 2; |
|
1664 |
repeat |
|
1665 |
Gear^.X:= Gear^.X + HHGear^.dX; |
|
1666 |
Gear^.Y:= Gear^.Y + HHGear^.dY; |
|
1667 |
HHGear^.X:= Gear^.X; |
|
1668 |
HHGear^.Y:= Gear^.Y; |
|
1669 |
||
1670 |
inc(Gear^.Damage, 2); |
|
1671 |
||
1200 | 1672 |
// if TestCollisionXwithGear(HHGear, hwSign(Gear^.dX)) |
1673 |
// or TestCollisionYwithGear(HHGear, hwSign(Gear^.dY)) then inc(Gear^.Damage, 3); |
|
984 | 1674 |
|
1675 |
dec(i) |
|
1676 |
until (i = 0) or (Gear^.Damage > Gear^.Health); |
|
1677 |
||
1678 |
inc(upd); |
|
1679 |
if upd > 3 then |
|
1680 |
begin |
|
987 | 1681 |
if Gear^.Health < 1500 then Gear^.Pos:= 2; |
2376 | 1682 |
|
984 | 1683 |
AmmoShove(Gear, 30, 40); |
2376 | 1684 |
|
984 | 1685 |
DrawTunnel(HHGear^.X - HHGear^.dX * 10, |
1200 | 1686 |
HHGear^.Y - _2 - HHGear^.dY * 10 + hwAbs(HHGear^.dY) * 2, |
984 | 1687 |
HHGear^.dX, |
1688 |
HHGear^.dY, |
|
1689 |
20 + cHHRadius * 2, |
|
1200 | 1690 |
cHHRadius * 2 + 6); |
2376 | 1691 |
|
984 | 1692 |
upd:= 0 |
1693 |
end; |
|
1694 |
||
1695 |
if Gear^.Health < Gear^.Damage then |
|
1696 |
begin |
|
1697 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, EXPLAutoSound); |
|
1698 |
AfterAttack; |
|
1699 |
DeleteGear(Gear); |
|
1700 |
DeleteGear(HHGear); |
|
1701 |
end else |
|
1702 |
begin |
|
1703 |
dec(Gear^.Health, Gear^.Damage); |
|
1704 |
Gear^.Damage:= 0 |
|
1705 |
end |
|
1706 |
end; |
|
1707 |
||
987 | 1708 |
procedure doStepKamikazeIdle(Gear: PGear); |
1709 |
begin |
|
1710 |
AllInactive:= false; |
|
1711 |
dec(Gear^.Timer); |
|
1712 |
if Gear^.Timer = 0 then |
|
1713 |
begin |
|
1714 |
Gear^.Pos:= 1; |
|
1669 | 1715 |
PlaySound(sndKamikaze, false, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack); |
987 | 1716 |
Gear^.doStep:= @doStepKamikazeWork |
1717 |
end |
|
1718 |
end; |
|
1719 |
||
984 | 1720 |
procedure doStepKamikaze(Gear: PGear); |
1721 |
var HHGear: PGear; |
|
1722 |
begin |
|
1723 |
AllInactive:= false; |
|
1724 |
||
1725 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
1726 |
||
1727 |
HHGear^.dX:= Gear^.dX; |
|
1728 |
HHGear^.dY:= Gear^.dY; |
|
1729 |
||
1730 |
Gear^.dX:= SignAs(_0_45, Gear^.dX); |
|
1731 |
Gear^.dY:= - _0_9; |
|
1732 |
||
987 | 1733 |
Gear^.Timer:= 550; |
1734 |
||
1735 |
Gear^.doStep:= @doStepKamikazeIdle |
|
984 | 1736 |
end; |
1737 |
||
1103 | 1738 |
//////////////////////////////////////////////////////////////////////////////// |
1739 |
const cakeh = 27; |
|
1110 | 1740 |
cakeDmg = 75; |
1103 | 1741 |
var CakePoints: array[0..Pred(cakeh)] of record x, y: hwFloat; end; |
1742 |
CakeI: Longword; |
|
1743 |
||
1110 | 1744 |
procedure doStepCakeExpl(Gear: PGear); |
1745 |
begin |
|
2141 | 1746 |
AllInactive:= false; |
1747 |
||
1110 | 1748 |
inc(Gear^.Tag); |
1749 |
if Gear^.Tag < 2250 then exit; |
|
1750 |
||
1751 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), cakeDmg, EXPLAutoSound); |
|
1752 |
AfterAttack; |
|
1753 |
DeleteGear(Gear) |
|
1754 |
end; |
|
1755 |
||
1109 | 1756 |
procedure doStepCakeDown(Gear: PGear); |
1133 | 1757 |
var gi: PGear; |
1758 |
dmg: LongInt; |
|
1109 | 1759 |
begin |
1760 |
AllInactive:= false; |
|
1761 |
||
1762 |
inc(Gear^.Tag); |
|
1763 |
if Gear^.Tag < 100 then exit; |
|
1764 |
Gear^.Tag:= 0; |
|
1765 |
||
1766 |
if Gear^.Pos = 0 then |
|
1767 |
begin |
|
1110 | 1768 |
gi:= GearsList; |
1769 |
while gi <> nil do |
|
1770 |
begin |
|
1771 |
dmg:= cakeDmg * 2 - hwRound(Distance(gi^.X - Gear^.X, gi^.Y - Gear^.Y)); |
|
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1861
diff
changeset
|
1772 |
if (dmg > 1) and (gi^.Kind = gtHedgehog) then |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1861
diff
changeset
|
1773 |
if (CurrentHedgehog^.Gear = gi) and (not gi^.Invulnerable) then |
1867 | 1774 |
gi^.State:= gi^.State or gstLoser |
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1861
diff
changeset
|
1775 |
else |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1861
diff
changeset
|
1776 |
gi^.State:= gi^.State or gstWinner; |
1110 | 1777 |
gi:= gi^.NextGear |
1778 |
end; |
|
1779 |
Gear^.doStep:= @doStepCakeExpl; |
|
1669 | 1780 |
PlaySound(sndCake, false, nil) |
1109 | 1781 |
end else dec(Gear^.Pos) |
1782 |
end; |
|
1783 |
||
1784 |
||
1089 | 1785 |
procedure doStepCakeWork(Gear: PGear); |
1786 |
const dirs: array[0..3] of TPoint = ((x: 0; y: -1), (x: 1; y: 0),(x: 0; y: 1),(x: -1; y: 0)); |
|
1787 |
var xx, yy, xxn, yyn: LongInt; |
|
1788 |
da: LongInt; |
|
1103 | 1789 |
tdx, tdy: hwFloat; |
1089 | 1790 |
|
1791 |
procedure PrevAngle; |
|
1792 |
begin |
|
1133 | 1793 |
Gear^.Angle:= (LongInt(Gear^.Angle) + 4 - dA) mod 4 |
1089 | 1794 |
end; |
2376 | 1795 |
|
1089 | 1796 |
procedure NextAngle; |
1797 |
begin |
|
1133 | 1798 |
Gear^.Angle:= (LongInt(Gear^.Angle) + 4 + dA) mod 4 |
1089 | 1799 |
end; |
2376 | 1800 |
|
1088 | 1801 |
begin |
2141 | 1802 |
AllInactive:= false; |
1803 |
||
1089 | 1804 |
inc(Gear^.Tag); |
1108 | 1805 |
if Gear^.Tag < 7 then exit; |
1089 | 1806 |
|
1807 |
dA:= hwSign(Gear^.dX); |
|
1808 |
xx:= dirs[Gear^.Angle].x; |
|
1809 |
yy:= dirs[Gear^.Angle].y; |
|
1133 | 1810 |
xxn:= dirs[(LongInt(Gear^.Angle) + 4 + dA) mod 4].x; |
1811 |
yyn:= dirs[(LongInt(Gear^.Angle) + 4 + dA) mod 4].y; |
|
1089 | 1812 |
|
1813 |
if (xx = 0) then |
|
1814 |
if TestCollisionYwithGear(Gear, yy) then |
|
1815 |
PrevAngle |
|
1816 |
else begin |
|
1817 |
Gear^.Tag:= 0; |
|
1818 |
Gear^.Y:= Gear^.Y + int2hwFloat(yy); |
|
1635
cc5976f292f9
Cake makes a step after turn. This fixes cake stucking in air
unc0rr
parents:
1634
diff
changeset
|
1819 |
if not TestCollisionXwithGear(Gear, xxn) then |
cc5976f292f9
Cake makes a step after turn. This fixes cake stucking in air
unc0rr
parents:
1634
diff
changeset
|
1820 |
begin |
cc5976f292f9
Cake makes a step after turn. This fixes cake stucking in air
unc0rr
parents:
1634
diff
changeset
|
1821 |
Gear^.X:= Gear^.X + int2hwFloat(xxn); |
cc5976f292f9
Cake makes a step after turn. This fixes cake stucking in air
unc0rr
parents:
1634
diff
changeset
|
1822 |
NextAngle |
cc5976f292f9
Cake makes a step after turn. This fixes cake stucking in air
unc0rr
parents:
1634
diff
changeset
|
1823 |
end; |
1089 | 1824 |
end; |
1825 |
||
1826 |
if (yy = 0) then |
|
1827 |
if TestCollisionXwithGear(Gear, xx) then |
|
1828 |
PrevAngle |
|
1829 |
else begin |
|
1830 |
Gear^.Tag:= 0; |
|
1831 |
Gear^.X:= Gear^.X + int2hwFloat(xx); |
|
1635
cc5976f292f9
Cake makes a step after turn. This fixes cake stucking in air
unc0rr
parents:
1634
diff
changeset
|
1832 |
if not TestCollisionYwithGear(Gear, yyn) then |
cc5976f292f9
Cake makes a step after turn. This fixes cake stucking in air
unc0rr
parents:
1634
diff
changeset
|
1833 |
begin |
cc5976f292f9
Cake makes a step after turn. This fixes cake stucking in air
unc0rr
parents:
1634
diff
changeset
|
1834 |
Gear^.Y:= Gear^.Y + int2hwFloat(yyn); |
cc5976f292f9
Cake makes a step after turn. This fixes cake stucking in air
unc0rr
parents:
1634
diff
changeset
|
1835 |
NextAngle |
cc5976f292f9
Cake makes a step after turn. This fixes cake stucking in air
unc0rr
parents:
1634
diff
changeset
|
1836 |
end; |
1089 | 1837 |
end; |
1838 |
||
1103 | 1839 |
if Gear^.Tag = 0 then |
1840 |
begin |
|
1841 |
CakeI:= (CakeI + 1) mod cakeh; |
|
1842 |
tdx:= CakePoints[CakeI].x - Gear^.X; |
|
1843 |
tdy:= - CakePoints[CakeI].y + Gear^.Y; |
|
1844 |
CakePoints[CakeI].x:= Gear^.X; |
|
1845 |
CakePoints[CakeI].y:= Gear^.Y; |
|
1846 |
Gear^.DirAngle:= DxDy2Angle(tdx, tdy); |
|
1847 |
end; |
|
1848 |
||
1089 | 1849 |
dec(Gear^.Health); |
2208
7d1a084d11ab
disable timers on a few silly items, trying out a timer on cake
nemo
parents:
2204
diff
changeset
|
1850 |
Gear^.Timer:= Gear^.Health*10; // This is not seconds, but at least it is *some* feedback |
1090 | 1851 |
if (Gear^.Health = 0) or ((Gear^.Message and gm_Attack) <> 0) then |
1089 | 1852 |
begin |
1109 | 1853 |
FollowGear:= Gear; |
2358 | 1854 |
Gear^.RenderTimer:= false; |
1109 | 1855 |
Gear^.doStep:= @doStepCakeDown |
1089 | 1856 |
end |
1088 | 1857 |
end; |
1089 | 1858 |
|
1103 | 1859 |
procedure doStepCakeUp(Gear: PGear); |
1860 |
var i: Longword; |
|
1861 |
begin |
|
1862 |
AllInactive:= false; |
|
1863 |
||
1108 | 1864 |
inc(Gear^.Tag); |
1109 | 1865 |
if Gear^.Tag < 100 then exit; |
1108 | 1866 |
Gear^.Tag:= 0; |
1867 |
||
1109 | 1868 |
if Gear^.Pos = 6 then |
1103 | 1869 |
begin |
1870 |
for i:= 0 to Pred(cakeh) do |
|
1871 |
begin |
|
1872 |
CakePoints[i].x:= Gear^.X; |
|
1873 |
CakePoints[i].y:= Gear^.Y |
|
1874 |
end; |
|
1875 |
CakeI:= 0; |
|
1876 |
Gear^.doStep:= @doStepCakeWork |
|
1109 | 1877 |
end else inc(Gear^.Pos) |
1103 | 1878 |
end; |
1879 |
||
1089 | 1880 |
procedure doStepCakeFall(Gear: PGear); |
1881 |
begin |
|
1882 |
AllInactive:= false; |
|
1883 |
||
1884 |
Gear^.dY:= Gear^.dY + cGravity; |
|
1885 |
if TestCollisionYwithGear(Gear, 1) then |
|
1103 | 1886 |
Gear^.doStep:= @doStepCakeUp |
1089 | 1887 |
else |
1888 |
begin |
|
1889 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
|
1890 |
if CheckGearDrowning(Gear) then AfterAttack |
|
1891 |
end |
|
1892 |
end; |
|
1893 |
||
1894 |
procedure doStepCake(Gear: PGear); |
|
1895 |
var HHGear: PGear; |
|
1896 |
begin |
|
1897 |
AllInactive:= false; |
|
1898 |
||
1899 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
1103 | 1900 |
HHGear^.Message:= HHGear^.Message and (not gm_Attack); |
1089 | 1901 |
DeleteCI(HHGear); |
1902 |
||
1106 | 1903 |
FollowGear:= Gear; |
1904 |
||
1089 | 1905 |
Gear^.doStep:= @doStepCakeFall |
1906 |
end; |
|
1907 |
||
1259 | 1908 |
//////////////////////////////////////////////////////////////////////////////// |
1284 | 1909 |
procedure doStepSeductionWork(Gear: PGear); |
1910 |
var x, y: LongInt; |
|
1259 | 1911 |
begin |
1912 |
AllInactive:= false; |
|
1284 | 1913 |
|
1914 |
Gear^.X:= Gear^.X + Gear^.dX; |
|
1915 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
|
1916 |
x:= hwRound(Gear^.X); |
|
1917 |
y:= hwRound(Gear^.Y); |
|
1259 | 1918 |
|
1753 | 1919 |
if ((y and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) then |
1284 | 1920 |
if (Land[y, x] <> 0) then |
1921 |
begin |
|
1922 |
Gear^.dX.isNegative:= not Gear^.dX.isNegative; |
|
1923 |
Gear^.dY.isNegative:= not Gear^.dY.isNegative; |
|
1286 | 1924 |
Gear^.dX:= Gear^.dX * _1_5; |
1925 |
Gear^.dY:= Gear^.dY * _1_5 - _0_3; |
|
1284 | 1926 |
AmmoShove(Gear, 0, 40); |
1286 | 1927 |
AfterAttack; |
1284 | 1928 |
DeleteGear(Gear) |
1929 |
end |
|
1930 |
else |
|
1931 |
else |
|
1286 | 1932 |
begin |
1933 |
AfterAttack; |
|
1284 | 1934 |
DeleteGear(Gear) |
1286 | 1935 |
end |
1936 |
end; |
|
1937 |
||
1938 |
procedure doStepSeductionWear(Gear: PGear); |
|
1939 |
begin |
|
1940 |
AllInactive:= false; |
|
1941 |
inc(Gear^.Timer); |
|
1942 |
if Gear^.Timer > 250 then |
|
1943 |
begin |
|
1944 |
Gear^.Timer:= 0; |
|
1388 | 1945 |
inc(Gear^.Pos); |
1946 |
if Gear^.Pos = 5 then |
|
1669 | 1947 |
PlaySound(sndYoohoo, false, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack) |
1286 | 1948 |
end; |
1367 | 1949 |
|
1950 |
if Gear^.Pos = 14 then |
|
1286 | 1951 |
Gear^.doStep:= @doStepSeductionWork |
1259 | 1952 |
end; |
1284 | 1953 |
|
1954 |
procedure doStepSeduction(Gear: PGear); |
|
1955 |
begin |
|
1956 |
AllInactive:= false; |
|
1957 |
DeleteCI(PHedgehog(Gear^.Hedgehog)^.Gear); |
|
1286 | 1958 |
Gear^.doStep:= @doStepSeductionWear |
1284 | 1959 |
end; |
1298 | 1960 |
|
1961 |
//////////////////////////////////////////////////////////////////////////////// |
|
1962 |
procedure doStepWaterUp(Gear: PGear); |
|
1963 |
var i: LongWord; |
|
1964 |
begin |
|
1965 |
AllInactive:= false; |
|
1966 |
||
1967 |
inc(Gear^.Timer); |
|
1968 |
if Gear^.Timer = 17 then |
|
1969 |
Gear^.Timer:= 0 |
|
1970 |
else |
|
1971 |
exit; |
|
1972 |
||
1973 |
if cWaterLine > 0 then |
|
1974 |
begin |
|
1975 |
dec(cWaterLine); |
|
1760 | 1976 |
for i:= 0 to LAND_WIDTH - 1 do |
1298 | 1977 |
Land[cWaterLine, i]:= 0; |
1978 |
SetAllToActive |
|
1979 |
end; |
|
1980 |
||
1981 |
inc(Gear^.Tag); |
|
1343 | 1982 |
if (Gear^.Tag = 47) or (cWaterLine = 0) then |
1298 | 1983 |
DeleteGear(Gear) |
1984 |
end; |
|
1573 | 1985 |
|
1986 |
//////////////////////////////////////////////////////////////////////////////// |
|
1590 | 1987 |
procedure doStepDrillDrilling(Gear: PGear); |
1633 | 1988 |
var t: PGearArray; |
1989 |
ox, oy: hwFloat; |
|
1573 | 1990 |
begin |
1590 | 1991 |
AllInactive:= false; |
1992 |
||
1633 | 1993 |
if (Gear^.Timer > 0) and ((Gear^.Timer mod 10) = 0) then |
1590 | 1994 |
begin |
1573 | 1995 |
ox:= Gear^.X; |
1996 |
oy:= Gear^.Y; |
|
1997 |
Gear^.X:= Gear^.X + Gear^.dX; |
|
1998 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
|
1999 |
DrawTunnel(oX, oY, Gear^.dX, Gear^.dY, 2, 6); |
|
2000 |
CheckGearDrowning(Gear); |
|
1590 | 2001 |
end; |
2002 |
||
1633 | 2003 |
t:= CheckGearsCollision(Gear); //fixes drill not exploding when touching HH bug |
1590 | 2004 |
if (Gear^.Timer = 0) |
1633 | 2005 |
or (t^.Count <> 0) |
1590 | 2006 |
or (not TestCollisionYWithGear(Gear, hwSign(Gear^.dY)) |
1784 | 2007 |
and not TestCollisionXWithGear(Gear, hwSign(Gear^.dX))) |
2008 |
or (Land[hwRound(Gear^.Y), hwRound(Gear^.X)] = COLOR_INDESTRUCTIBLE) then |
|
1590 | 2009 |
begin //out of time or exited ground |
2010 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound); |
|
2011 |
DeleteGear(Gear); |
|
2012 |
exit |
|
2013 |
end; |
|
2014 |
||
2015 |
dec(Gear^.Timer); |
|
1573 | 2016 |
end; |
2017 |
||
2018 |
procedure doStepDrill(Gear: PGear); |
|
1590 | 2019 |
var t: PGearArray; |
1633 | 2020 |
oldDx, oldDy: hwFloat; |
2021 |
t2: hwFloat; |
|
1573 | 2022 |
begin |
1590 | 2023 |
AllInactive:= false; |
1573 | 2024 |
|
1590 | 2025 |
Gear^.dX:= Gear^.dX + cWindSpeed; |
2026 |
oldDx:= Gear^.dX; |
|
2027 |
oldDy:= Gear^.dY; |
|
2028 |
||
2029 |
doStepFallingGear(Gear); |
|
2030 |
||
2031 |
if (GameTicks and $3F) = 0 then |
|
2032 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtSmokeTrace, 0, _0, _0, 0); |
|
1573 | 2033 |
|
1633 | 2034 |
if ((Gear^.State and gstCollision) <> 0) then begin //hit |
1590 | 2035 |
Gear^.dX:= oldDx; |
2036 |
Gear^.dY:= oldDy; |
|
1633 | 2037 |
|
1590 | 2038 |
t:= CheckGearsCollision(Gear); |
1633 | 2039 |
if (t^.Count = 0) then begin //hit the ground not the HH |
2040 |
t2 := _0_5 / Distance(Gear^.dX, Gear^.dY); |
|
2041 |
Gear^.dX:= Gear^.dX * t2; |
|
2042 |
Gear^.dY:= Gear^.dY * t2; |
|
2043 |
end else begin //explode right on contact with HH |
|
2044 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound); |
|
2045 |
DeleteGear(Gear); |
|
2046 |
exit; |
|
2047 |
end; |
|
2376 | 2048 |
|
1590 | 2049 |
Gear^.doStep:= @doStepDrillDrilling; |
1633 | 2050 |
dec(Gear^.Timer) |
1590 | 2051 |
end |
2052 |
end; |
|
1601 | 2053 |
|
1633 | 2054 |
//////////////////////////////////////////////////////////////////////////////// |
1601 | 2055 |
procedure doStepBallgunWork(Gear: PGear); |
2056 |
var HHGear: PGear; |
|
1630 | 2057 |
rx, ry: hwFloat; |
1601 | 2058 |
begin |
2059 |
AllInactive:= false; |
|
2060 |
dec(Gear^.Timer); |
|
2061 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
2062 |
HedgehogChAngle(HHGear); |
|
2063 |
if (Gear^.Timer mod 100) = 0 then |
|
2064 |
begin |
|
1630 | 2065 |
rx:= rndSign(getRandom * _0_1); |
2066 |
ry:= rndSign(getRandom * _0_1); |
|
2376 | 2067 |
|
1630 | 2068 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtBall, 0, |
2069 |
SignAs(AngleSin(HHGear^.Angle) * _0_8, HHGear^.dX) + rx, |
|
2070 |
AngleCos(HHGear^.Angle) * ( - _0_8) + ry, |
|
2071 |
0); |
|
2376 | 2072 |
|
1669 | 2073 |
PlaySound(sndGun, false, nil); |
1601 | 2074 |
end; |
2075 |
||
1643 | 2076 |
if (Gear^.Timer = 0) or (HHGear^.Damage <> 0) then |
1601 | 2077 |
begin |
2078 |
DeleteGear(Gear); |
|
1643 | 2079 |
AfterAttack |
2080 |
end |
|
1601 | 2081 |
end; |
2082 |
||
2083 |
procedure doStepBallgun(Gear: PGear); |
|
2084 |
var HHGear: PGear; |
|
2085 |
begin |
|
2086 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
2087 |
HHGear^.Message:= HHGear^.Message and not (gm_Up or gm_Down); |
|
2088 |
HHGear^.State:= HHGear^.State or gstNotKickable; |
|
2089 |
Gear^.doStep:= @doStepBallgunWork |
|
1633 | 2090 |
end; |
1689 | 2091 |
|
1696 | 2092 |
//////////////////////////////////////////////////////////////////////////////// |
1689 | 2093 |
procedure doStepRCPlaneWork(Gear: PGear); |
2094 |
const cAngleSpeed = 3; |
|
2095 |
var HHGear: PGear; |
|
2096 |
i: LongInt; |
|
2097 |
dX, dY: hwFloat; |
|
2098 |
fChanged: boolean; |
|
2099 |
trueAngle: Longword; |
|
2100 |
t: PGear; |
|
2101 |
begin |
|
2102 |
AllInactive:= false; |
|
2103 |
||
1696 | 2104 |
if Gear^.Timer > 0 then dec(Gear^.Timer); |
1689 | 2105 |
|
2106 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
2107 |
FollowGear:= Gear; |
|
2108 |
||
2109 |
fChanged:= false; |
|
1696 | 2110 |
if ((HHGear^.State and gstHHDriven) = 0) or (Gear^.Timer = 0) then |
1689 | 2111 |
begin |
2112 |
fChanged:= true; |
|
1696 | 2113 |
if Gear^.Angle > 2048 then dec(Gear^.Angle) else |
2114 |
if Gear^.Angle < 2048 then inc(Gear^.Angle) else fChanged:= false |
|
2115 |
end |
|
2116 |
else |
|
2117 |
begin |
|
2118 |
if ((Gear^.Message and gm_Left) <> 0) then |
|
2119 |
begin |
|
2120 |
fChanged:= true; |
|
2121 |
Gear^.Angle:= (Gear^.Angle + (4096 - cAngleSpeed)) mod 4096 |
|
2122 |
end; |
|
1689 | 2123 |
|
1696 | 2124 |
if ((Gear^.Message and gm_Right) <> 0) then |
2125 |
begin |
|
2126 |
fChanged:= true; |
|
2127 |
Gear^.Angle:= (Gear^.Angle + cAngleSpeed) mod 4096 |
|
2128 |
end |
|
1689 | 2129 |
end; |
2130 |
||
2131 |
if fChanged then |
|
2132 |
begin |
|
2133 |
Gear^.dX.isNegative:= (Gear^.Angle > 2048); |
|
2134 |
if Gear^.dX.isNegative then |
|
2135 |
trueAngle:= 4096 - Gear^.Angle |
|
2136 |
else |
|
2137 |
trueAngle:= Gear^.Angle; |
|
2138 |
||
2139 |
Gear^.dX:= SignAs(AngleSin(trueAngle), Gear^.dX) * _0_25; |
|
2140 |
Gear^.dY:= AngleCos(trueAngle) * -_0_25; |
|
2141 |
end; |
|
2142 |
||
2143 |
Gear^.X:= Gear^.X + Gear^.dX; |
|
2144 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
|
2145 |
||
2146 |
if (GameTicks and $FF) = 0 then |
|
1698 | 2147 |
if Gear^.Timer < 3500 then |
1696 | 2148 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtEvilTrace, 0, _0, _0, 0) |
2149 |
else |
|
2150 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtSmokeTrace, 0, _0, _0, 0); |
|
1689 | 2151 |
|
1696 | 2152 |
if ((HHGear^.Message and gm_Attack) <> 0) and (Gear^.Health <> 0) then |
1689 | 2153 |
begin |
2154 |
HHGear^.Message := HHGear^.Message and not gm_Attack; |
|
1708 | 2155 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtAirBomb, 0, Gear^.dX * _0_5, Gear^.dY * _0_5, 0); |
1689 | 2156 |
dec(Gear^.Health) |
1712 | 2157 |
end; |
2158 |
||
2159 |
if ((HHGear^.Message and gm_LJump) <> 0) |
|
2160 |
and ((Gear^.State and gsttmpFlag) = 0) then |
|
2161 |
begin |
|
2162 |
Gear^.State:= Gear^.State or gsttmpFlag; |
|
2163 |
PauseMusic; |
|
2164 |
playSound(sndRideOfTheValkyries, false, nil); |
|
2165 |
end; |
|
1689 | 2166 |
|
2167 |
// pickup bonuses |
|
2168 |
t:= CheckGearNear(Gear, gtCase, 36, 36); |
|
2169 |
if t <> nil then |
|
2170 |
PickUp(HHGear, t); |
|
2171 |
||
2172 |
CheckCollision(Gear); |
|
2173 |
||
1712 | 2174 |
if ((Gear^.State and gstCollision) <> 0) |
2175 |
or CheckGearDrowning(Gear) then |
|
1689 | 2176 |
begin |
1712 | 2177 |
StopSound(sndRCPlane); |
2178 |
StopSound(sndRideOfTheValkyries); |
|
2179 |
ResumeMusic; |
|
2376 | 2180 |
|
1712 | 2181 |
if ((Gear^.State and gstCollision) <> 0) then |
1689 | 2182 |
begin |
1712 | 2183 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 25, EXPLAutoSound); |
1714 | 2184 |
for i:= 0 to 32 do |
1712 | 2185 |
begin |
1714 | 2186 |
dX:= AngleCos(i * 64) * _0_5 * (GetRandom + _1); |
2187 |
dY:= AngleSin(i * 64) * _0_5 * (GetRandom + _1); |
|
1712 | 2188 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtFlame, 0, dX, dY, 0); |
2189 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtFlame, 0, dX, -dY, 0); |
|
2190 |
end; |
|
2191 |
DeleteGear(Gear) |
|
1689 | 2192 |
end; |
1713 | 2193 |
|
1689 | 2194 |
AfterAttack; |
1713 | 2195 |
CurAmmoGear:= nil; |
1697 | 2196 |
TurnTimeLeft:= 14 * 125; |
1712 | 2197 |
HHGear^.Message:= 0; |
1697 | 2198 |
ParseCommand('/taunt '#1, true) |
2199 |
end |
|
1689 | 2200 |
end; |
2201 |
||
2202 |
procedure doStepRCPlane(Gear: PGear); |
|
2203 |
var HHGear: PGear; |
|
2204 |
begin |
|
2205 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
2206 |
HHGear^.Message:= 0; |
|
2207 |
HHGear^.State:= HHGear^.State or gstNotKickable; |
|
2208 |
Gear^.Angle:= HHGear^.Angle; |
|
1696 | 2209 |
Gear^.Tag:= hwSign(HHGear^.dX); |
1689 | 2210 |
if HHGear^.dX.isNegative then Gear^.Angle:= 4096 - Gear^.Angle; |
2211 |
Gear^.doStep:= @doStepRCPlaneWork |
|
1712 | 2212 |
end; |
2177
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2213 |
|
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2214 |
procedure doStepJetpackWork(Gear: PGear); |
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2215 |
var HHGear: PGear; |
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2216 |
fuel: LongInt; |
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2217 |
move: hwFloat; |
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2218 |
begin |
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2219 |
AllInactive:= false; |
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2220 |
HHGear:=PHedgehog(Gear^.Hedgehog)^.Gear; |
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2221 |
//dec(Gear^.Timer); |
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2222 |
move:= _0_2; |
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2223 |
fuel:= 50; |
2182
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2181
diff
changeset
|
2224 |
(*if (HHGear^.Message and gm_Precise) <> 0 then |
2177
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2225 |
begin |
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2226 |
move:= _0_02; |
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2227 |
fuel:= 5; |
2182
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2181
diff
changeset
|
2228 |
end;*) |
2177
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2229 |
|
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2230 |
if (HHGear^.Message and gm_Up) <> 0 then |
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2231 |
begin |
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2232 |
HHGear^.dY:= HHGear^.dY - move; |
2182
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2181
diff
changeset
|
2233 |
dec(Gear^.Health, fuel); |
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2181
diff
changeset
|
2234 |
Gear^.MsgParam:= Gear^.MsgParam or gm_Up; |
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2181
diff
changeset
|
2235 |
Gear^.Timer:= GameTicks |
2177
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2236 |
end; |
2187
66c0f9b3bd6f
set vector to negative *after* applying upward vector
nemo
parents:
2186
diff
changeset
|
2237 |
if (HHGear^.Message and gm_Left) <> 0 then move.isNegative:= true; |
2177
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2238 |
if (HHGear^.Message and (gm_Left or gm_Right)) <> 0 then |
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2239 |
begin |
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2240 |
HHGear^.dX:= HHGear^.dX + (move * _0_2); |
2182
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2181
diff
changeset
|
2241 |
dec(Gear^.Health, fuel div 5); |
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2181
diff
changeset
|
2242 |
Gear^.MsgParam:= Gear^.MsgParam or (HHGear^.Message and (gm_Left or gm_Right)); |
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2181
diff
changeset
|
2243 |
Gear^.Timer:= GameTicks |
2177
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2244 |
end; |
2182
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2181
diff
changeset
|
2245 |
|
2376 | 2246 |
// erases them all at once :-/ |
2182
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2181
diff
changeset
|
2247 |
if (Gear^.Timer <> 0) and (GameTicks - Gear^.Timer > 250) then |
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2181
diff
changeset
|
2248 |
begin |
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2181
diff
changeset
|
2249 |
Gear^.Timer:= 0; |
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2181
diff
changeset
|
2250 |
Gear^.MsgParam:= 0 |
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2181
diff
changeset
|
2251 |
end; |
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2181
diff
changeset
|
2252 |
|
2177
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2253 |
if Gear^.Health < 0 then Gear^.Health:= 0; |
2376 | 2254 |
if (GameTicks and $3F) = 0 then |
2204
526f8165acce
Smaxx' idea of timers, reworked just a tad. Might need variable for offset, but seems ok for now
nemo
parents:
2202
diff
changeset
|
2255 |
begin |
526f8165acce
Smaxx' idea of timers, reworked just a tad. Might need variable for offset, but seems ok for now
nemo
parents:
2202
diff
changeset
|
2256 |
//AddCaption('Fuel: '+inttostr(round(Gear^.Health/20))+'%', $FFFFFF, capgrpAmmostate); |
526f8165acce
Smaxx' idea of timers, reworked just a tad. Might need variable for offset, but seems ok for now
nemo
parents:
2202
diff
changeset
|
2257 |
if Gear^.Tex <> nil then FreeTexture(Gear^.Tex); |
526f8165acce
Smaxx' idea of timers, reworked just a tad. Might need variable for offset, but seems ok for now
nemo
parents:
2202
diff
changeset
|
2258 |
Gear^.Tex:= RenderStringTex(trmsg[sidFuel] + ': ' + inttostr(round(Gear^.Health / 20)) + '%', $FFFFFFFF, fntSmall) |
526f8165acce
Smaxx' idea of timers, reworked just a tad. Might need variable for offset, but seems ok for now
nemo
parents:
2202
diff
changeset
|
2259 |
end; |
2177
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2260 |
|
2278
28519f4f3f21
requested change by Tiy to Flying Saucer start (hover until first keypress)
nemo
parents:
2267
diff
changeset
|
2261 |
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; |
2177
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2262 |
HHGear^.Message:= HHGear^.Message and not (gm_Up or gm_Precise or gm_Left or gm_Right); |
2376 | 2263 |
HHGear^.State:= HHGear^.State or gstMoving; |
2177
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2264 |
|
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2265 |
Gear^.X:= HHGear^.X; |
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2266 |
Gear^.Y:= HHGear^.Y; |
2196 | 2267 |
// For some reason I need to reapply followgear here, something else grabs it otherwise. |
2226
e35b62cb7a1c
Try turning off follow gear while ammo menu is open - needs testing w/ rope/parachute/jetpack
nemo
parents:
2225
diff
changeset
|
2268 |
if not bShowAmmoMenu then FollowGear:= HHGear; |
2278
28519f4f3f21
requested change by Tiy to Flying Saucer start (hover until first keypress)
nemo
parents:
2267
diff
changeset
|
2269 |
|
28519f4f3f21
requested change by Tiy to Flying Saucer start (hover until first keypress)
nemo
parents:
2267
diff
changeset
|
2270 |
if ((Gear^.State and gsttmpFlag) = 0) or (HHGear^.dY < _0) then doStepHedgehogMoving(HHGear); |
2177
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2271 |
|
2179 | 2272 |
if (Gear^.Health = 0) |
2180
6c5a339f8e28
Use different group to not erase messages, restore gear deletion on hog damage.
nemo
parents:
2179
diff
changeset
|
2273 |
or (HHGear^.Damage <> 0) |
2179 | 2274 |
or CheckGearDrowning(HHGear) |
2376 | 2275 |
or (TurnTimeLeft = 0) |
2189 | 2276 |
// allow brief ground touches - to be fair on this, might need another counter |
2190 | 2277 |
or (((GameTicks and $1FF) = 0) and (not HHGear^.dY.isNegative) and TestCollisionYwithGear(HHGear, 1)) |
2179 | 2278 |
or ((Gear^.Message and gm_Attack) <> 0) then |
2177
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2279 |
begin |
2179 | 2280 |
with HHGear^ do |
2281 |
begin |
|
2282 |
Message:= 0; |
|
2283 |
Active:= true; |
|
2284 |
State:= State or gstMoving |
|
2285 |
end; |
|
2177
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2286 |
DeleteGear(Gear); |
2179 | 2287 |
isCursorVisible:= false; |
2204
526f8165acce
Smaxx' idea of timers, reworked just a tad. Might need variable for offset, but seems ok for now
nemo
parents:
2202
diff
changeset
|
2288 |
// if Gear^.Tex <> nil then FreeTexture(Gear^.Tex); |
526f8165acce
Smaxx' idea of timers, reworked just a tad. Might need variable for offset, but seems ok for now
nemo
parents:
2202
diff
changeset
|
2289 |
// Gear^.Tex:= RenderStringTex(trmsg[sidFuel] + ': ' + inttostr(round(Gear^.Health / 20)) + '%', $FFFFFFFF, fntSmall) |
526f8165acce
Smaxx' idea of timers, reworked just a tad. Might need variable for offset, but seems ok for now
nemo
parents:
2202
diff
changeset
|
2290 |
//AddCaption(trmsg[sidFuel]+': '+inttostr(round(Gear^.Health/20))+'%', $FFFFFF, capgrpAmmostate); |
2177
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2291 |
end |
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2292 |
end; |
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2293 |
|
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2294 |
procedure doStepJetpack(Gear: PGear); |
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2295 |
var HHGear: PGear; |
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2296 |
begin |
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2297 |
Gear^.doStep:= @doStepJetpackWork; |
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2298 |
|
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2299 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2300 |
FollowGear:= HHGear; |
2179 | 2301 |
OnUsedAmmo(PHedgehog(HHGear^.Hedgehog)^); |
2302 |
ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^); |
|
2177
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2303 |
with HHGear^ do |
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2304 |
begin |
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2305 |
State:= State and not gstAttacking; |
2278
28519f4f3f21
requested change by Tiy to Flying Saucer start (hover until first keypress)
nemo
parents:
2267
diff
changeset
|
2306 |
Message:= Message and not (gm_Attack or gm_Up or gm_Precise or gm_Left or gm_Right); |
2301 | 2307 |
if (dY < _0_1) and (dY > -_0_1) then |
2308 |
begin |
|
2309 |
Gear^.State:= Gear^.State or gsttmpFlag; |
|
2310 |
dY:= dY - _0_2 |
|
2311 |
end |
|
2177
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2312 |
end |
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2313 |
end; |