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