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