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