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