author | nemo |
Thu, 15 Oct 2009 17:42:21 +0000 | |
changeset 2457 | ecf0c7e7995b |
parent 2455 | cc54dd148cc2 |
child 2460 | ac0c497fb842 |
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 |
//////////////////////////////////////////////////////////////////////////////// |
|
854 | 1209 |
procedure doStepIdle(Gear: PGear); |
1210 |
begin |
|
1211 |
AllInactive:= false; |
|
925 | 1212 |
dec(Gear^.Timer); |
854 | 1213 |
if Gear^.Timer = 0 then |
1214 |
begin |
|
1215 |
DeleteGear(Gear); |
|
1216 |
AfterAttack |
|
1217 |
end |
|
1218 |
end; |
|
1219 |
||
79 | 1220 |
procedure doStepShover(Gear: PGear); |
1221 |
var HHGear: PGear; |
|
1222 |
begin |
|
351 | 1223 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
1224 |
HHGear^.State:= HHGear^.State or gstNoDamage; |
|
980
20128e98988b
Don't push attacking hedgehog when using whip or baseball
unc0rr
parents:
979
diff
changeset
|
1225 |
DeleteCI(HHGear); |
20128e98988b
Don't push attacking hedgehog when using whip or baseball
unc0rr
parents:
979
diff
changeset
|
1226 |
|
79 | 1227 |
AmmoShove(Gear, 30, 115); |
980
20128e98988b
Don't push attacking hedgehog when using whip or baseball
unc0rr
parents:
979
diff
changeset
|
1228 |
|
351 | 1229 |
HHGear^.State:= HHGear^.State and not gstNoDamage; |
854 | 1230 |
Gear^.Timer:= 250; |
1231 |
Gear^.doStep:= @doStepIdle |
|
79 | 1232 |
end; |
1233 |
||
1234 |
//////////////////////////////////////////////////////////////////////////////// |
|
925 | 1235 |
procedure doStepWhip(Gear: PGear); |
1236 |
var HHGear: PGear; |
|
1237 |
i: LongInt; |
|
1238 |
begin |
|
1239 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
1240 |
HHGear^.State:= HHGear^.State or gstNoDamage; |
|
980
20128e98988b
Don't push attacking hedgehog when using whip or baseball
unc0rr
parents:
979
diff
changeset
|
1241 |
DeleteCI(HHGear); |
925 | 1242 |
|
1243 |
for i:= 0 to 3 do |
|
1244 |
begin |
|
1245 |
AmmoShove(Gear, 30, 25); |
|
1246 |
Gear^.X:= Gear^.X + Gear^.dX * 5 |
|
1247 |
end; |
|
1248 |
||
1249 |
HHGear^.State:= HHGear^.State and not gstNoDamage; |
|
1250 |
Gear^.Timer:= 250; |
|
1251 |
Gear^.doStep:= @doStepIdle |
|
1252 |
end; |
|
1253 |
||
1254 |
//////////////////////////////////////////////////////////////////////////////// |
|
79 | 1255 |
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
|
1256 |
var i: Integer; |
79 | 1257 |
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
|
1258 |
if (Gear^.State and gsttmpFlag) = 0 then AllInactive:= false; |
1433 | 1259 |
|
79 | 1260 |
if not TestCollisionYwithGear(Gear, 1) then |
1133 | 1261 |
begin |
1586 | 1262 |
if hwAbs(Gear^.dX) > _0_01 then |
1263 |
Gear^.dX:= Gear^.dX * _0_995; |
|
1297 | 1264 |
|
1133 | 1265 |
Gear^.dY:= Gear^.dY + cGravity; |
1830 | 1266 |
if hwAbs(Gear^.dY) > _0_2 then Gear^.dY:= Gear^.dY * _0_995; |
2376 | 1267 |
|
1830 | 1268 |
Gear^.X:= Gear^.X + Gear^.dX + cWindSpeed * 640; |
1133 | 1269 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
2376 | 1270 |
|
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
|
1271 |
if (hwRound(Gear^.Y) > cWaterLine) then |
1133 | 1272 |
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
|
1273 |
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
|
1274 |
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
|
1275 |
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
|
1276 |
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
|
1277 |
end; |
1133 | 1278 |
DeleteGear(Gear); |
1279 |
exit |
|
1280 |
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
|
1281 |
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
|
1282 |
if (Gear^.State and gsttmpFlag) <> 0 then |
b52344de23ae
In progress, trying to make a fire for molotov cocktail. Normal fire should still work fairly normally.
nemo
parents:
2376
diff
changeset
|
1283 |
begin |
b52344de23ae
In progress, trying to make a fire for molotov cocktail. Normal fire should still work fairly normally.
nemo
parents:
2376
diff
changeset
|
1284 |
Gear^.Radius:= 9; |
b52344de23ae
In progress, trying to make a fire for molotov cocktail. Normal fire should still work fairly normally.
nemo
parents:
2376
diff
changeset
|
1285 |
AmmoShove(Gear, 4, 100); |
b52344de23ae
In progress, trying to make a fire for molotov cocktail. Normal fire should still work fairly normally.
nemo
parents:
2376
diff
changeset
|
1286 |
Gear^.Radius:= 1 |
b52344de23ae
In progress, trying to make a fire for molotov cocktail. Normal fire should still work fairly normally.
nemo
parents:
2376
diff
changeset
|
1287 |
end; |
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^.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
|
1289 |
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
|
1290 |
// 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
|
1291 |
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
|
1292 |
begin |
b52344de23ae
In progress, trying to make a fire for molotov cocktail. Normal fire should still work fairly normally.
nemo
parents:
2376
diff
changeset
|
1293 |
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
|
1294 |
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
|
1295 |
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
|
1296 |
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
|
1297 |
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
|
1298 |
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
|
1299 |
end |
b52344de23ae
In progress, trying to make a fire for molotov cocktail. Normal fire should still work fairly normally.
nemo
parents:
2376
diff
changeset
|
1300 |
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
|
1301 |
// 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
|
1302 |
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
|
1303 |
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
|
1304 |
// 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
|
1305 |
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
|
1306 |
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
|
1307 |
end |
b52344de23ae
In progress, trying to make a fire for molotov cocktail. Normal fire should still work fairly normally.
nemo
parents:
2376
diff
changeset
|
1308 |
end |
b52344de23ae
In progress, trying to make a fire for molotov cocktail. Normal fire should still work fairly normally.
nemo
parents:
2376
diff
changeset
|
1309 |
end; |
351 | 1310 |
if Gear^.Health = 0 then |
1133 | 1311 |
DeleteGear(Gear) |
79 | 1312 |
end; |
82 | 1313 |
|
1314 |
//////////////////////////////////////////////////////////////////////////////// |
|
1315 |
procedure doStepFirePunchWork(Gear: PGear); |
|
1316 |
var HHGear: PGear; |
|
1317 |
begin |
|
1318 |
AllInactive:= false; |
|
351 | 1319 |
if ((Gear^.Message and gm_Destroy) <> 0) then |
1133 | 1320 |
begin |
1321 |
DeleteGear(Gear); |
|
1322 |
AfterAttack; |
|
1323 |
exit |
|
1324 |
end; |
|
82 | 1325 |
|
351 | 1326 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
1327 |
if hwRound(HHGear^.Y) <= Gear^.Tag - 2 then |
|
1133 | 1328 |
begin |
1329 |
Gear^.Tag:= hwRound(HHGear^.Y); |
|
1330 |
DrawTunnel(HHGear^.X - int2hwFloat(cHHRadius), HHGear^.Y - _1, _0_5, _0, cHHRadius * 4, 2); |
|
1331 |
HHGear^.State:= HHGear^.State or gstNoDamage; |
|
1332 |
Gear^.Y:= HHGear^.Y; |
|
1333 |
AmmoShove(Gear, 30, 40); |
|
1334 |
HHGear^.State:= HHGear^.State and not gstNoDamage |
|
1335 |
end; |
|
351 | 1336 |
|
1337 |
HHGear^.dY:= HHGear^.dY + cGravity; |
|
1338 |
if not (HHGear^.dY.isNegative) then |
|
1133 | 1339 |
begin |
1340 |
HHGear^.State:= HHGear^.State or gstMoving; |
|
1341 |
DeleteGear(Gear); |
|
1342 |
AfterAttack; |
|
1343 |
exit |
|
1344 |
end; |
|
2089 | 1345 |
|
2376 | 1346 |
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
|
1347 |
HHGear^.Y:= HHGear^.Y + HHGear^.dY |
82 | 1348 |
end; |
1349 |
||
1350 |
procedure doStepFirePunch(Gear: PGear); |
|
1351 |
var HHGear: PGear; |
|
1352 |
begin |
|
1353 |
AllInactive:= false; |
|
351 | 1354 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
514 | 1355 |
DeleteCI(HHGear); |
498 | 1356 |
HHGear^.X:= int2hwFloat(hwRound(HHGear^.X)) - _0_5; |
1014
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
992
diff
changeset
|
1357 |
HHGear^.dX:= SignAs(cLittle, Gear^.dX); |
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
992
diff
changeset
|
1358 |
|
351 | 1359 |
HHGear^.dY:= - _0_3; |
82 | 1360 |
|
351 | 1361 |
Gear^.X:= HHGear^.X; |
979
edb8f208c1d9
Fix firepunch direction when attacking from high jump
unc0rr
parents:
974
diff
changeset
|
1362 |
Gear^.dX:= SignAs(_0_45, Gear^.dX); |
351 | 1363 |
Gear^.dY:= - _0_9; |
1364 |
Gear^.doStep:= @doStepFirePunchWork; |
|
498 | 1365 |
DrawTunnel(HHGear^.X - int2hwFloat(cHHRadius), HHGear^.Y + _1, _0_5, _0, cHHRadius * 4, 5); |
1279 | 1366 |
|
1669 | 1367 |
PlaySound(TSound(ord(sndFirePunch1) + GetRandom(6)), false, PHedgehog(HHGear^.Hedgehog)^.Team^.voicepack) |
82 | 1368 |
end; |
1369 |
||
263 | 1370 |
//////////////////////////////////////////////////////////////////////////////// |
1371 |
||
929
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1372 |
procedure doStepParachuteWork(Gear: PGear); |
211 | 1373 |
var HHGear: PGear; |
1374 |
begin |
|
351 | 1375 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
82 | 1376 |
|
516 | 1377 |
inc(Gear^.Timer); |
1378 |
||
212 | 1379 |
if TestCollisionYwithGear(HHGear, 1) |
1133 | 1380 |
or ((HHGear^.State and gstHHDriven) = 0) |
1381 |
or CheckGearDrowning(HHGear) |
|
1382 |
or ((Gear^.Message and gm_Attack) <> 0) then |
|
1383 |
begin |
|
1384 |
with HHGear^ do |
|
1385 |
begin |
|
1386 |
Message:= 0; |
|
1387 |
SetLittle(dX); |
|
1388 |
dY:= _0; |
|
1389 |
State:= State or gstMoving; |
|
1390 |
end; |
|
1391 |
DeleteGear(Gear); |
|
2060
3e9e5e1be6f5
fix crash in parachute/rope if drowning with active girder/teleport
nemo
parents:
2059
diff
changeset
|
1392 |
isCursorVisible:= false; |
1133 | 1393 |
exit |
1394 |
end; |
|
211 | 1395 |
|
351 | 1396 |
if not TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then |
1133 | 1397 |
HHGear^.X:= HHGear^.X + cWindSpeed * 200; |
211 | 1398 |
|
351 | 1399 |
if (Gear^.Message and gm_Left) <> 0 then HHGear^.X:= HHGear^.X - cMaxWindSpeed * 40 |
1400 |
else if (Gear^.Message and gm_Right) <> 0 then HHGear^.X:= HHGear^.X + cMaxWindSpeed * 40; |
|
1401 |
if (Gear^.Message and gm_Up) <> 0 then HHGear^.Y:= HHGear^.Y - cGravity * 40 |
|
1402 |
else if (Gear^.Message and gm_Down) <> 0 then HHGear^.Y:= HHGear^.Y + cGravity * 40; |
|
211 | 1403 |
|
351 | 1404 |
HHGear^.Y:= HHGear^.Y + cGravity * 100; |
568 | 1405 |
Gear^.X:= HHGear^.X; |
1406 |
Gear^.Y:= HHGear^.Y |
|
263 | 1407 |
end; |
211 | 1408 |
|
929
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1409 |
procedure doStepParachute(Gear: PGear); |
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1410 |
var HHGear: PGear; |
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1411 |
begin |
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1412 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1413 |
|
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1414 |
DeleteCI(HHGear); |
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1415 |
|
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1416 |
OnUsedAmmo(PHedgehog(HHGear^.Hedgehog)^); |
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1417 |
ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^); |
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1418 |
|
931 | 1419 |
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
|
1420 |
HHGear^.Message:= HHGear^.Message and not gm_Attack; |
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1421 |
|
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1422 |
Gear^.doStep:= @doStepParachuteWork; |
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1423 |
|
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1424 |
Gear^.Message:= HHGear^.Message; |
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1425 |
doStepParachuteWork(Gear) |
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1426 |
end; |
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1427 |
|
263 | 1428 |
//////////////////////////////////////////////////////////////////////////////// |
1429 |
procedure doStepAirAttackWork(Gear: PGear); |
|
1507 | 1430 |
var i: Longint; |
263 | 1431 |
begin |
1432 |
AllInactive:= false; |
|
498 | 1433 |
Gear^.X:= Gear^.X + cAirPlaneSpeed * Gear^.Tag; |
1124 | 1434 |
|
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
1435 |
if (Gear^.Health > 0)and(not (Gear^.X < Gear^.dX))and(Gear^.X < Gear^.dX + cAirPlaneSpeed) then |
1124 | 1436 |
begin |
1437 |
dec(Gear^.Health); |
|
1438 |
case Gear^.State of |
|
1439 |
0: FollowGear:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtAirBomb, 0, cBombsSpeed * Gear^.Tag, _0, 0); |
|
1440 |
1: FollowGear:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtMine, 0, cBombsSpeed * Gear^.Tag, _0, 0); |
|
1586 | 1441 |
2: for i:= -19 to 19 do |
1442 |
FollowGear:= AddGear(hwRound(Gear^.X) + i div 3, hwRound(Gear^.Y), gtFlame, 0, _0_001 * i, _0, 0); |
|
1124 | 1443 |
end; |
1444 |
Gear^.dX:= Gear^.dX + int2hwFloat(30 * Gear^.Tag) |
|
1445 |
end; |
|
1446 |
||
1447 |
if (GameTicks and $3F) = 0 then |
|
1448 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtSmokeTrace, 0, _0, _0, 0); |
|
1449 |
||
1753 | 1450 |
if (hwRound(Gear^.X) > (LAND_WIDTH+1024)) or (hwRound(Gear^.X) < -1024) then DeleteGear(Gear) |
263 | 1451 |
end; |
1452 |
||
1453 |
procedure doStepAirAttack(Gear: PGear); |
|
1454 |
begin |
|
1455 |
AllInactive:= false; |
|
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
1456 |
|
1507 | 1457 |
if Gear^.X.QWordValue = 0 then |
1771 | 1458 |
begin |
1459 |
Gear^.Tag:= 1; |
|
1460 |
Gear^.X:= -_1024; |
|
1461 |
end |
|
1507 | 1462 |
else |
1771 | 1463 |
begin |
1507 | 1464 |
Gear^.Tag:= -1; |
1771 | 1465 |
Gear^.X:= int2hwFloat(LAND_WIDTH + 1024); |
1466 |
end; |
|
1507 | 1467 |
|
1784 | 1468 |
Gear^.Y:= int2hwFloat(topY-300); |
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
1469 |
Gear^.dX:= int2hwFloat(TargetPoint.X - 5 * Gear^.Tag * 15); |
357 | 1470 |
|
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
1471 |
if int2hwFloat(TargetPoint.Y) - Gear^.Y > _0 then |
1133 | 1472 |
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
|
1473 |
|
351 | 1474 |
Gear^.Health:= 6; |
801 | 1475 |
Gear^.doStep:= @doStepAirAttackWork; |
1669 | 1476 |
PlaySound(sndIncoming, false, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack) |
263 | 1477 |
end; |
1478 |
||
1479 |
//////////////////////////////////////////////////////////////////////////////// |
|
1480 |
||
1481 |
procedure doStepAirBomb(Gear: PGear); |
|
1482 |
begin |
|
1483 |
AllInactive:= false; |
|
1484 |
doStepFallingGear(Gear); |
|
351 | 1485 |
if (Gear^.State and gstCollision) <> 0 then |
1133 | 1486 |
begin |
1487 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, EXPLAutoSound); |
|
1488 |
DeleteGear(Gear); |
|
1489 |
exit |
|
1490 |
end; |
|
263 | 1491 |
if (GameTicks and $3F) = 0 then |
1133 | 1492 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtSmokeTrace, 0, _0, _0, 0) |
211 | 1493 |
end; |
409 | 1494 |
|
1495 |
//////////////////////////////////////////////////////////////////////////////// |
|
1496 |
||
1497 |
procedure doStepGirder(Gear: PGear); |
|
415 | 1498 |
var HHGear: PGear; |
1915 | 1499 |
x, y, tx, ty: hwFloat; |
409 | 1500 |
begin |
1501 |
AllInactive:= false; |
|
415 | 1502 |
|
1503 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
1915 | 1504 |
tx:= int2hwFloat(TargetPoint.X); |
1505 |
ty:= int2hwFloat(TargetPoint.Y); |
|
1506 |
x:= HHGear^.X; |
|
1507 |
y:= HHGear^.Y; |
|
1909 | 1508 |
|
1915 | 1509 |
if (Distance(tx - x, ty - y) > _256) or |
1510 |
not TryPlaceOnLand(TargetPoint.X - SpritesData[sprAmGirder].Width div 2, |
|
1511 |
TargetPoint.Y - SpritesData[sprAmGirder].Height div 2, |
|
520 | 1512 |
sprAmGirder, Gear^.State, true) then |
1133 | 1513 |
begin |
1914 | 1514 |
PlaySound(sndDenied, false, nil); |
1515 |
HHGear^.Message:= HHGear^.Message and not gm_Attack; |
|
1516 |
HHGear^.State:= HHGear^.State and not gstAttacking; |
|
1133 | 1517 |
HHGear^.State:= HHGear^.State or gstHHChooseTarget; |
1914 | 1518 |
isCursorVisible:= true; |
1519 |
DeleteGear(Gear) |
|
1133 | 1520 |
end |
1521 |
else begin |
|
1914 | 1522 |
PlaySound(sndPlaced, false, nil); |
1133 | 1523 |
DeleteGear(Gear); |
1909 | 1524 |
OnUsedAmmo(PHedgehog(HHGear^.Hedgehog)^); |
1914 | 1525 |
ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^) |
1526 |
end; |
|
1527 |
||
1909 | 1528 |
HHGear^.State:= HHGear^.State and not (gstAttacking or gstAttacked); |
1529 |
HHGear^.Message:= HHGear^.Message and not gm_Attack; |
|
415 | 1530 |
TargetPoint.X:= NoPointX |
409 | 1531 |
end; |
520 | 1532 |
|
1533 |
//////////////////////////////////////////////////////////////////////////////// |
|
525 | 1534 |
procedure doStepTeleportAfter(Gear: PGear); |
912 | 1535 |
var HHGear: PGear; |
1536 |
begin |
|
1537 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
1538 |
HHGear^.Y:= HHGear^.Y + HHGear^.dY; // hedgehog falling to collect cases |
|
1539 |
HHGear^.dY:= HHGear^.dY + cGravity; |
|
945
4ead9cde4e14
- Start chat implementation: chat strings are on the screen
unc0rr
parents:
940
diff
changeset
|
1540 |
if TestCollisionYwithGear(HHGear, 1) |
1133 | 1541 |
or CheckGearDrowning(HHGear) then |
1542 |
begin |
|
1543 |
DeleteGear(Gear); |
|
1544 |
AfterAttack |
|
1545 |
end |
|
912 | 1546 |
end; |
1547 |
||
1548 |
procedure doStepTeleportAnim(Gear: PGear); |
|
525 | 1549 |
begin |
853 | 1550 |
inc(Gear^.Timer); |
1551 |
if Gear^.Timer = 65 then |
|
1552 |
begin |
|
1553 |
Gear^.Timer:= 0; |
|
1554 |
inc(Gear^.Pos); |
|
1555 |
if Gear^.Pos = 11 then |
|
912 | 1556 |
Gear^.doStep:= @doStepTeleportAfter |
2217 | 1557 |
end; |
525 | 1558 |
end; |
520 | 1559 |
|
1560 |
procedure doStepTeleport(Gear: PGear); |
|
1561 |
var HHGear: PGear; |
|
1562 |
begin |
|
1563 |
AllInactive:= false; |
|
1564 |
||
1565 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
1566 |
if not TryPlaceOnLand(TargetPoint.X - SpritesData[sprHHTelepMask].Width div 2, |
|
1567 |
TargetPoint.Y - SpritesData[sprHHTelepMask].Height div 2, |
|
1568 |
sprHHTelepMask, 0, false) then |
|
853 | 1569 |
begin |
1570 |
HHGear^.Message:= HHGear^.Message and not gm_Attack; |
|
1571 |
HHGear^.State:= HHGear^.State and not gstAttacking; |
|
1572 |
HHGear^.State:= HHGear^.State or gstHHChooseTarget; |
|
1573 |
DeleteGear(Gear); |
|
2227 | 1574 |
isCursorVisible:= true; |
1575 |
PlaySound(sndDenied, false, nil); |
|
853 | 1576 |
end |
1577 |
else begin |
|
1578 |
DeleteCI(HHGear); |
|
1579 |
SetAllHHToActive; |
|
912 | 1580 |
Gear^.doStep:= @doStepTeleportAnim; |
853 | 1581 |
Gear^.X:= HHGear^.X; |
1582 |
Gear^.Y:= HHGear^.Y; |
|
1583 |
HHGear^.X:= int2hwFloat(TargetPoint.X); |
|
1584 |
HHGear^.Y:= int2hwFloat(TargetPoint.Y); |
|
2227 | 1585 |
HHGear^.State:= HHGear^.State or gstMoving; |
1586 |
playSound(sndWarp, false, nil); |
|
853 | 1587 |
end; |
2217 | 1588 |
TargetPoint.X:= NoPointX; |
1589 |
||
520 | 1590 |
end; |
534 | 1591 |
|
1592 |
//////////////////////////////////////////////////////////////////////////////// |
|
1593 |
procedure doStepSwitcherWork(Gear: PGear); |
|
1594 |
var HHGear: PGear; |
|
1595 |
Msg, State: Longword; |
|
1596 |
begin |
|
1597 |
AllInactive:= false; |
|
1598 |
||
540 | 1599 |
if ((Gear^.Message and not gm_Switch) <> 0) or (TurnTimeLeft = 0) then |
1133 | 1600 |
begin |
1601 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
1602 |
Msg:= Gear^.Message and not gm_Switch; |
|
1603 |
DeleteGear(Gear); |
|
1604 |
OnUsedAmmo(PHedgehog(HHGear^.Hedgehog)^); |
|
1605 |
ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^); |
|
534 | 1606 |
|
1133 | 1607 |
HHGear:= CurrentHedgehog^.Gear; |
1608 |
ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^); |
|
1609 |
HHGear^.Message:= Msg; |
|
1610 |
exit |
|
1611 |
end; |
|
534 | 1612 |
|
1613 |
if (Gear^.Message and gm_Switch) <> 0 then |
|
1133 | 1614 |
begin |
1615 |
HHGear:= CurrentHedgehog^.Gear; |
|
1616 |
HHGear^.Message:= HHGear^.Message and not gm_Switch; |
|
1617 |
Gear^.Message:= Gear^.Message and not gm_Switch; |
|
1618 |
State:= HHGear^.State; |
|
1619 |
HHGear^.State:= 0; |
|
1620 |
HHGear^.Active:= false; |
|
1621 |
HHGear^.Z:= cHHZ; |
|
1622 |
RemoveGearFromList(HHGear); |
|
1623 |
InsertGearToList(HHGear); |
|
534 | 1624 |
|
1133 | 1625 |
repeat |
1626 |
CurrentTeam^.CurrHedgehog:= Succ(CurrentTeam^.CurrHedgehog) mod (CurrentTeam^.HedgehogsNumber); |
|
1627 |
until (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil); |
|
652 | 1628 |
|
1133 | 1629 |
CurrentHedgehog:= @CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog]; |
534 | 1630 |
|
1133 | 1631 |
HHGear:= CurrentHedgehog^.Gear; |
1632 |
HHGear^.State:= State; |
|
1633 |
HHGear^.Active:= true; |
|
1634 |
FollowGear:= HHGear; |
|
1635 |
HHGear^.Z:= cCurrHHZ; |
|
1636 |
RemoveGearFromList(HHGear); |
|
1637 |
InsertGearToList(HHGear); |
|
1638 |
Gear^.X:= HHGear^.X; |
|
1639 |
Gear^.Y:= HHGear^.Y |
|
1640 |
end; |
|
534 | 1641 |
end; |
1642 |
||
1643 |
procedure doStepSwitcher(Gear: PGear); |
|
1644 |
var HHGear: PGear; |
|
1645 |
begin |
|
1646 |
Gear^.doStep:= @doStepSwitcherWork; |
|
1647 |
||
1648 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
1649 |
with HHGear^ do |
|
1133 | 1650 |
begin |
1651 |
State:= State and not gstAttacking; |
|
1652 |
Message:= Message and not gm_Attack |
|
1653 |
end |
|
534 | 1654 |
end; |
924 | 1655 |
|
1656 |
//////////////////////////////////////////////////////////////////////////////// |
|
1657 |
procedure doStepMortar(Gear: PGear); |
|
1658 |
var dX, dY: hwFloat; |
|
1659 |
i: LongInt; |
|
963 | 1660 |
dxn, dyn: boolean; |
924 | 1661 |
begin |
1662 |
AllInactive:= false; |
|
963 | 1663 |
dxn:= Gear^.dX.isNegative; |
1664 |
dyn:= Gear^.dY.isNegative; |
|
1665 |
||
924 | 1666 |
doStepFallingGear(Gear); |
1667 |
if (Gear^.State and gstCollision) <> 0 then |
|
1668 |
begin |
|
1669 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 20, EXPLAutoSound); |
|
2262 | 1670 |
soundFadeOut(sndMortar,10,nil); |
963 | 1671 |
|
1672 |
Gear^.dX.isNegative:= not dxn; |
|
1673 |
Gear^.dY.isNegative:= not dyn; |
|
924 | 1674 |
for i:= 0 to 4 do |
1675 |
begin |
|
963 | 1676 |
dX:= Gear^.dX + (GetRandom - _0_5) * _0_03; |
1677 |
dY:= Gear^.dY + (GetRandom - _0_5) * _0_03; |
|
1273 | 1678 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtCluster, 0, dX, dY, 25); |
924 | 1679 |
end; |
2376 | 1680 |
|
924 | 1681 |
DeleteGear(Gear); |
1682 |
exit |
|
1683 |
end; |
|
963 | 1684 |
|
924 | 1685 |
if (GameTicks and $3F) = 0 then |
1686 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtSmokeTrace, 0, _0, _0, 0) |
|
1687 |
end; |
|
984 | 1688 |
|
1689 |
//////////////////////////////////////////////////////////////////////////////// |
|
1690 |
procedure doStepKamikazeWork(Gear: PGear); |
|
1691 |
const upd: Longword = 0; |
|
987 | 1692 |
var i: LongWord; |
984 | 1693 |
HHGear: PGear; |
1694 |
begin |
|
1695 |
AllInactive:= false; |
|
1696 |
||
1697 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
1698 |
HHGear^.State:= HHGear^.State or gstNoDamage; |
|
1699 |
DeleteCI(HHGear); |
|
1700 |
||
1701 |
i:= 2; |
|
1702 |
repeat |
|
1703 |
Gear^.X:= Gear^.X + HHGear^.dX; |
|
1704 |
Gear^.Y:= Gear^.Y + HHGear^.dY; |
|
1705 |
HHGear^.X:= Gear^.X; |
|
1706 |
HHGear^.Y:= Gear^.Y; |
|
1707 |
||
1708 |
inc(Gear^.Damage, 2); |
|
1709 |
||
1200 | 1710 |
// if TestCollisionXwithGear(HHGear, hwSign(Gear^.dX)) |
1711 |
// or TestCollisionYwithGear(HHGear, hwSign(Gear^.dY)) then inc(Gear^.Damage, 3); |
|
984 | 1712 |
|
1713 |
dec(i) |
|
1714 |
until (i = 0) or (Gear^.Damage > Gear^.Health); |
|
1715 |
||
1716 |
inc(upd); |
|
1717 |
if upd > 3 then |
|
1718 |
begin |
|
987 | 1719 |
if Gear^.Health < 1500 then Gear^.Pos:= 2; |
2376 | 1720 |
|
984 | 1721 |
AmmoShove(Gear, 30, 40); |
2376 | 1722 |
|
984 | 1723 |
DrawTunnel(HHGear^.X - HHGear^.dX * 10, |
1200 | 1724 |
HHGear^.Y - _2 - HHGear^.dY * 10 + hwAbs(HHGear^.dY) * 2, |
984 | 1725 |
HHGear^.dX, |
1726 |
HHGear^.dY, |
|
1727 |
20 + cHHRadius * 2, |
|
1200 | 1728 |
cHHRadius * 2 + 6); |
2376 | 1729 |
|
984 | 1730 |
upd:= 0 |
1731 |
end; |
|
1732 |
||
1733 |
if Gear^.Health < Gear^.Damage then |
|
1734 |
begin |
|
1735 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, EXPLAutoSound); |
|
1736 |
AfterAttack; |
|
1737 |
DeleteGear(Gear); |
|
1738 |
DeleteGear(HHGear); |
|
1739 |
end else |
|
1740 |
begin |
|
1741 |
dec(Gear^.Health, Gear^.Damage); |
|
1742 |
Gear^.Damage:= 0 |
|
1743 |
end |
|
1744 |
end; |
|
1745 |
||
987 | 1746 |
procedure doStepKamikazeIdle(Gear: PGear); |
1747 |
begin |
|
1748 |
AllInactive:= false; |
|
1749 |
dec(Gear^.Timer); |
|
1750 |
if Gear^.Timer = 0 then |
|
1751 |
begin |
|
1752 |
Gear^.Pos:= 1; |
|
1669 | 1753 |
PlaySound(sndKamikaze, false, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack); |
987 | 1754 |
Gear^.doStep:= @doStepKamikazeWork |
1755 |
end |
|
1756 |
end; |
|
1757 |
||
984 | 1758 |
procedure doStepKamikaze(Gear: PGear); |
1759 |
var HHGear: PGear; |
|
1760 |
begin |
|
1761 |
AllInactive:= false; |
|
1762 |
||
1763 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
1764 |
||
1765 |
HHGear^.dX:= Gear^.dX; |
|
1766 |
HHGear^.dY:= Gear^.dY; |
|
1767 |
||
1768 |
Gear^.dX:= SignAs(_0_45, Gear^.dX); |
|
1769 |
Gear^.dY:= - _0_9; |
|
1770 |
||
987 | 1771 |
Gear^.Timer:= 550; |
1772 |
||
1773 |
Gear^.doStep:= @doStepKamikazeIdle |
|
984 | 1774 |
end; |
1775 |
||
1103 | 1776 |
//////////////////////////////////////////////////////////////////////////////// |
1777 |
const cakeh = 27; |
|
1110 | 1778 |
cakeDmg = 75; |
1103 | 1779 |
var CakePoints: array[0..Pred(cakeh)] of record x, y: hwFloat; end; |
1780 |
CakeI: Longword; |
|
1781 |
||
1110 | 1782 |
procedure doStepCakeExpl(Gear: PGear); |
1783 |
begin |
|
2141 | 1784 |
AllInactive:= false; |
1785 |
||
1110 | 1786 |
inc(Gear^.Tag); |
1787 |
if Gear^.Tag < 2250 then exit; |
|
1788 |
||
1789 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), cakeDmg, EXPLAutoSound); |
|
1790 |
AfterAttack; |
|
1791 |
DeleteGear(Gear) |
|
1792 |
end; |
|
1793 |
||
1109 | 1794 |
procedure doStepCakeDown(Gear: PGear); |
1133 | 1795 |
var gi: PGear; |
1796 |
dmg: LongInt; |
|
1109 | 1797 |
begin |
1798 |
AllInactive:= false; |
|
1799 |
||
1800 |
inc(Gear^.Tag); |
|
1801 |
if Gear^.Tag < 100 then exit; |
|
1802 |
Gear^.Tag:= 0; |
|
1803 |
||
1804 |
if Gear^.Pos = 0 then |
|
1805 |
begin |
|
1110 | 1806 |
gi:= GearsList; |
1807 |
while gi <> nil do |
|
1808 |
begin |
|
1809 |
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
|
1810 |
if (dmg > 1) and (gi^.Kind = gtHedgehog) then |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1861
diff
changeset
|
1811 |
if (CurrentHedgehog^.Gear = gi) and (not gi^.Invulnerable) then |
1867 | 1812 |
gi^.State:= gi^.State or gstLoser |
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1861
diff
changeset
|
1813 |
else |
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1861
diff
changeset
|
1814 |
gi^.State:= gi^.State or gstWinner; |
1110 | 1815 |
gi:= gi^.NextGear |
1816 |
end; |
|
1817 |
Gear^.doStep:= @doStepCakeExpl; |
|
1669 | 1818 |
PlaySound(sndCake, false, nil) |
1109 | 1819 |
end else dec(Gear^.Pos) |
1820 |
end; |
|
1821 |
||
1822 |
||
1089 | 1823 |
procedure doStepCakeWork(Gear: PGear); |
1824 |
const dirs: array[0..3] of TPoint = ((x: 0; y: -1), (x: 1; y: 0),(x: 0; y: 1),(x: -1; y: 0)); |
|
1825 |
var xx, yy, xxn, yyn: LongInt; |
|
1826 |
da: LongInt; |
|
1103 | 1827 |
tdx, tdy: hwFloat; |
1089 | 1828 |
|
1829 |
procedure PrevAngle; |
|
1830 |
begin |
|
1133 | 1831 |
Gear^.Angle:= (LongInt(Gear^.Angle) + 4 - dA) mod 4 |
1089 | 1832 |
end; |
2376 | 1833 |
|
1089 | 1834 |
procedure NextAngle; |
1835 |
begin |
|
1133 | 1836 |
Gear^.Angle:= (LongInt(Gear^.Angle) + 4 + dA) mod 4 |
1089 | 1837 |
end; |
2376 | 1838 |
|
1088 | 1839 |
begin |
2141 | 1840 |
AllInactive:= false; |
1841 |
||
1089 | 1842 |
inc(Gear^.Tag); |
1108 | 1843 |
if Gear^.Tag < 7 then exit; |
1089 | 1844 |
|
1845 |
dA:= hwSign(Gear^.dX); |
|
1846 |
xx:= dirs[Gear^.Angle].x; |
|
1847 |
yy:= dirs[Gear^.Angle].y; |
|
1133 | 1848 |
xxn:= dirs[(LongInt(Gear^.Angle) + 4 + dA) mod 4].x; |
1849 |
yyn:= dirs[(LongInt(Gear^.Angle) + 4 + dA) mod 4].y; |
|
1089 | 1850 |
|
1851 |
if (xx = 0) then |
|
1852 |
if TestCollisionYwithGear(Gear, yy) then |
|
1853 |
PrevAngle |
|
1854 |
else begin |
|
1855 |
Gear^.Tag:= 0; |
|
1856 |
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
|
1857 |
if not TestCollisionXwithGear(Gear, xxn) then |
cc5976f292f9
Cake makes a step after turn. This fixes cake stucking in air
unc0rr
parents:
1634
diff
changeset
|
1858 |
begin |
cc5976f292f9
Cake makes a step after turn. This fixes cake stucking in air
unc0rr
parents:
1634
diff
changeset
|
1859 |
Gear^.X:= Gear^.X + int2hwFloat(xxn); |
cc5976f292f9
Cake makes a step after turn. This fixes cake stucking in air
unc0rr
parents:
1634
diff
changeset
|
1860 |
NextAngle |
cc5976f292f9
Cake makes a step after turn. This fixes cake stucking in air
unc0rr
parents:
1634
diff
changeset
|
1861 |
end; |
1089 | 1862 |
end; |
1863 |
||
1864 |
if (yy = 0) then |
|
1865 |
if TestCollisionXwithGear(Gear, xx) then |
|
1866 |
PrevAngle |
|
1867 |
else begin |
|
1868 |
Gear^.Tag:= 0; |
|
1869 |
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
|
1870 |
if not TestCollisionYwithGear(Gear, yyn) then |
cc5976f292f9
Cake makes a step after turn. This fixes cake stucking in air
unc0rr
parents:
1634
diff
changeset
|
1871 |
begin |
cc5976f292f9
Cake makes a step after turn. This fixes cake stucking in air
unc0rr
parents:
1634
diff
changeset
|
1872 |
Gear^.Y:= Gear^.Y + int2hwFloat(yyn); |
cc5976f292f9
Cake makes a step after turn. This fixes cake stucking in air
unc0rr
parents:
1634
diff
changeset
|
1873 |
NextAngle |
cc5976f292f9
Cake makes a step after turn. This fixes cake stucking in air
unc0rr
parents:
1634
diff
changeset
|
1874 |
end; |
1089 | 1875 |
end; |
1876 |
||
1103 | 1877 |
if Gear^.Tag = 0 then |
1878 |
begin |
|
1879 |
CakeI:= (CakeI + 1) mod cakeh; |
|
1880 |
tdx:= CakePoints[CakeI].x - Gear^.X; |
|
1881 |
tdy:= - CakePoints[CakeI].y + Gear^.Y; |
|
1882 |
CakePoints[CakeI].x:= Gear^.X; |
|
1883 |
CakePoints[CakeI].y:= Gear^.Y; |
|
1884 |
Gear^.DirAngle:= DxDy2Angle(tdx, tdy); |
|
1885 |
end; |
|
1886 |
||
1089 | 1887 |
dec(Gear^.Health); |
2208
7d1a084d11ab
disable timers on a few silly items, trying out a timer on cake
nemo
parents:
2204
diff
changeset
|
1888 |
Gear^.Timer:= Gear^.Health*10; // This is not seconds, but at least it is *some* feedback |
1090 | 1889 |
if (Gear^.Health = 0) or ((Gear^.Message and gm_Attack) <> 0) then |
1089 | 1890 |
begin |
1109 | 1891 |
FollowGear:= Gear; |
2358 | 1892 |
Gear^.RenderTimer:= false; |
1109 | 1893 |
Gear^.doStep:= @doStepCakeDown |
1089 | 1894 |
end |
1088 | 1895 |
end; |
1089 | 1896 |
|
1103 | 1897 |
procedure doStepCakeUp(Gear: PGear); |
1898 |
var i: Longword; |
|
1899 |
begin |
|
1900 |
AllInactive:= false; |
|
1901 |
||
1108 | 1902 |
inc(Gear^.Tag); |
1109 | 1903 |
if Gear^.Tag < 100 then exit; |
1108 | 1904 |
Gear^.Tag:= 0; |
1905 |
||
1109 | 1906 |
if Gear^.Pos = 6 then |
1103 | 1907 |
begin |
1908 |
for i:= 0 to Pred(cakeh) do |
|
1909 |
begin |
|
1910 |
CakePoints[i].x:= Gear^.X; |
|
1911 |
CakePoints[i].y:= Gear^.Y |
|
1912 |
end; |
|
1913 |
CakeI:= 0; |
|
1914 |
Gear^.doStep:= @doStepCakeWork |
|
1109 | 1915 |
end else inc(Gear^.Pos) |
1103 | 1916 |
end; |
1917 |
||
1089 | 1918 |
procedure doStepCakeFall(Gear: PGear); |
1919 |
begin |
|
1920 |
AllInactive:= false; |
|
1921 |
||
1922 |
Gear^.dY:= Gear^.dY + cGravity; |
|
1923 |
if TestCollisionYwithGear(Gear, 1) then |
|
1103 | 1924 |
Gear^.doStep:= @doStepCakeUp |
1089 | 1925 |
else |
1926 |
begin |
|
1927 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
|
1928 |
if CheckGearDrowning(Gear) then AfterAttack |
|
1929 |
end |
|
1930 |
end; |
|
1931 |
||
1932 |
procedure doStepCake(Gear: PGear); |
|
1933 |
var HHGear: PGear; |
|
1934 |
begin |
|
1935 |
AllInactive:= false; |
|
1936 |
||
1937 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
1103 | 1938 |
HHGear^.Message:= HHGear^.Message and (not gm_Attack); |
1089 | 1939 |
DeleteCI(HHGear); |
1940 |
||
1106 | 1941 |
FollowGear:= Gear; |
1942 |
||
1089 | 1943 |
Gear^.doStep:= @doStepCakeFall |
1944 |
end; |
|
1945 |
||
1259 | 1946 |
//////////////////////////////////////////////////////////////////////////////// |
1284 | 1947 |
procedure doStepSeductionWork(Gear: PGear); |
1948 |
var x, y: LongInt; |
|
1259 | 1949 |
begin |
1950 |
AllInactive:= false; |
|
1284 | 1951 |
|
1952 |
Gear^.X:= Gear^.X + Gear^.dX; |
|
1953 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
|
1954 |
x:= hwRound(Gear^.X); |
|
1955 |
y:= hwRound(Gear^.Y); |
|
1259 | 1956 |
|
1753 | 1957 |
if ((y and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) then |
1284 | 1958 |
if (Land[y, x] <> 0) then |
1959 |
begin |
|
1960 |
Gear^.dX.isNegative:= not Gear^.dX.isNegative; |
|
1961 |
Gear^.dY.isNegative:= not Gear^.dY.isNegative; |
|
1286 | 1962 |
Gear^.dX:= Gear^.dX * _1_5; |
1963 |
Gear^.dY:= Gear^.dY * _1_5 - _0_3; |
|
1284 | 1964 |
AmmoShove(Gear, 0, 40); |
1286 | 1965 |
AfterAttack; |
1284 | 1966 |
DeleteGear(Gear) |
1967 |
end |
|
1968 |
else |
|
1969 |
else |
|
1286 | 1970 |
begin |
1971 |
AfterAttack; |
|
1284 | 1972 |
DeleteGear(Gear) |
1286 | 1973 |
end |
1974 |
end; |
|
1975 |
||
1976 |
procedure doStepSeductionWear(Gear: PGear); |
|
1977 |
begin |
|
1978 |
AllInactive:= false; |
|
1979 |
inc(Gear^.Timer); |
|
1980 |
if Gear^.Timer > 250 then |
|
1981 |
begin |
|
1982 |
Gear^.Timer:= 0; |
|
1388 | 1983 |
inc(Gear^.Pos); |
1984 |
if Gear^.Pos = 5 then |
|
1669 | 1985 |
PlaySound(sndYoohoo, false, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack) |
1286 | 1986 |
end; |
1367 | 1987 |
|
1988 |
if Gear^.Pos = 14 then |
|
1286 | 1989 |
Gear^.doStep:= @doStepSeductionWork |
1259 | 1990 |
end; |
1284 | 1991 |
|
1992 |
procedure doStepSeduction(Gear: PGear); |
|
1993 |
begin |
|
1994 |
AllInactive:= false; |
|
1995 |
DeleteCI(PHedgehog(Gear^.Hedgehog)^.Gear); |
|
1286 | 1996 |
Gear^.doStep:= @doStepSeductionWear |
1284 | 1997 |
end; |
1298 | 1998 |
|
1999 |
//////////////////////////////////////////////////////////////////////////////// |
|
2000 |
procedure doStepWaterUp(Gear: PGear); |
|
2001 |
var i: LongWord; |
|
2002 |
begin |
|
2003 |
AllInactive:= false; |
|
2004 |
||
2005 |
inc(Gear^.Timer); |
|
2006 |
if Gear^.Timer = 17 then |
|
2007 |
Gear^.Timer:= 0 |
|
2008 |
else |
|
2009 |
exit; |
|
2010 |
||
2011 |
if cWaterLine > 0 then |
|
2012 |
begin |
|
2013 |
dec(cWaterLine); |
|
1760 | 2014 |
for i:= 0 to LAND_WIDTH - 1 do |
1298 | 2015 |
Land[cWaterLine, i]:= 0; |
2016 |
SetAllToActive |
|
2017 |
end; |
|
2018 |
||
2019 |
inc(Gear^.Tag); |
|
1343 | 2020 |
if (Gear^.Tag = 47) or (cWaterLine = 0) then |
1298 | 2021 |
DeleteGear(Gear) |
2022 |
end; |
|
1573 | 2023 |
|
2024 |
//////////////////////////////////////////////////////////////////////////////// |
|
1590 | 2025 |
procedure doStepDrillDrilling(Gear: PGear); |
1633 | 2026 |
var t: PGearArray; |
2027 |
ox, oy: hwFloat; |
|
1573 | 2028 |
begin |
1590 | 2029 |
AllInactive:= false; |
2030 |
||
1633 | 2031 |
if (Gear^.Timer > 0) and ((Gear^.Timer mod 10) = 0) then |
1590 | 2032 |
begin |
1573 | 2033 |
ox:= Gear^.X; |
2034 |
oy:= Gear^.Y; |
|
2035 |
Gear^.X:= Gear^.X + Gear^.dX; |
|
2036 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
|
2037 |
DrawTunnel(oX, oY, Gear^.dX, Gear^.dY, 2, 6); |
|
2038 |
CheckGearDrowning(Gear); |
|
1590 | 2039 |
end; |
2040 |
||
1633 | 2041 |
t:= CheckGearsCollision(Gear); //fixes drill not exploding when touching HH bug |
1590 | 2042 |
if (Gear^.Timer = 0) |
1633 | 2043 |
or (t^.Count <> 0) |
1590 | 2044 |
or (not TestCollisionYWithGear(Gear, hwSign(Gear^.dY)) |
1784 | 2045 |
and not TestCollisionXWithGear(Gear, hwSign(Gear^.dX))) |
2046 |
or (Land[hwRound(Gear^.Y), hwRound(Gear^.X)] = COLOR_INDESTRUCTIBLE) then |
|
1590 | 2047 |
begin //out of time or exited ground |
2048 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound); |
|
2049 |
DeleteGear(Gear); |
|
2050 |
exit |
|
2051 |
end; |
|
2052 |
||
2053 |
dec(Gear^.Timer); |
|
1573 | 2054 |
end; |
2055 |
||
2056 |
procedure doStepDrill(Gear: PGear); |
|
1590 | 2057 |
var t: PGearArray; |
1633 | 2058 |
oldDx, oldDy: hwFloat; |
2059 |
t2: hwFloat; |
|
1573 | 2060 |
begin |
1590 | 2061 |
AllInactive:= false; |
1573 | 2062 |
|
1590 | 2063 |
Gear^.dX:= Gear^.dX + cWindSpeed; |
2064 |
oldDx:= Gear^.dX; |
|
2065 |
oldDy:= Gear^.dY; |
|
2066 |
||
2067 |
doStepFallingGear(Gear); |
|
2068 |
||
2069 |
if (GameTicks and $3F) = 0 then |
|
2070 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtSmokeTrace, 0, _0, _0, 0); |
|
1573 | 2071 |
|
1633 | 2072 |
if ((Gear^.State and gstCollision) <> 0) then begin //hit |
1590 | 2073 |
Gear^.dX:= oldDx; |
2074 |
Gear^.dY:= oldDy; |
|
1633 | 2075 |
|
1590 | 2076 |
t:= CheckGearsCollision(Gear); |
1633 | 2077 |
if (t^.Count = 0) then begin //hit the ground not the HH |
2078 |
t2 := _0_5 / Distance(Gear^.dX, Gear^.dY); |
|
2079 |
Gear^.dX:= Gear^.dX * t2; |
|
2080 |
Gear^.dY:= Gear^.dY * t2; |
|
2081 |
end else begin //explode right on contact with HH |
|
2082 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound); |
|
2083 |
DeleteGear(Gear); |
|
2084 |
exit; |
|
2085 |
end; |
|
2376 | 2086 |
|
1590 | 2087 |
Gear^.doStep:= @doStepDrillDrilling; |
1633 | 2088 |
dec(Gear^.Timer) |
1590 | 2089 |
end |
2090 |
end; |
|
1601 | 2091 |
|
1633 | 2092 |
//////////////////////////////////////////////////////////////////////////////// |
1601 | 2093 |
procedure doStepBallgunWork(Gear: PGear); |
2094 |
var HHGear: PGear; |
|
1630 | 2095 |
rx, ry: hwFloat; |
1601 | 2096 |
begin |
2097 |
AllInactive:= false; |
|
2098 |
dec(Gear^.Timer); |
|
2099 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
2100 |
HedgehogChAngle(HHGear); |
|
2101 |
if (Gear^.Timer mod 100) = 0 then |
|
2102 |
begin |
|
1630 | 2103 |
rx:= rndSign(getRandom * _0_1); |
2104 |
ry:= rndSign(getRandom * _0_1); |
|
2376 | 2105 |
|
1630 | 2106 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtBall, 0, |
2107 |
SignAs(AngleSin(HHGear^.Angle) * _0_8, HHGear^.dX) + rx, |
|
2108 |
AngleCos(HHGear^.Angle) * ( - _0_8) + ry, |
|
2109 |
0); |
|
2376 | 2110 |
|
1669 | 2111 |
PlaySound(sndGun, false, nil); |
1601 | 2112 |
end; |
2113 |
||
1643 | 2114 |
if (Gear^.Timer = 0) or (HHGear^.Damage <> 0) then |
1601 | 2115 |
begin |
2116 |
DeleteGear(Gear); |
|
1643 | 2117 |
AfterAttack |
2118 |
end |
|
1601 | 2119 |
end; |
2120 |
||
2121 |
procedure doStepBallgun(Gear: PGear); |
|
2122 |
var HHGear: PGear; |
|
2123 |
begin |
|
2124 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
2125 |
HHGear^.Message:= HHGear^.Message and not (gm_Up or gm_Down); |
|
2126 |
HHGear^.State:= HHGear^.State or gstNotKickable; |
|
2127 |
Gear^.doStep:= @doStepBallgunWork |
|
1633 | 2128 |
end; |
1689 | 2129 |
|
1696 | 2130 |
//////////////////////////////////////////////////////////////////////////////// |
1689 | 2131 |
procedure doStepRCPlaneWork(Gear: PGear); |
2132 |
const cAngleSpeed = 3; |
|
2133 |
var HHGear: PGear; |
|
2134 |
i: LongInt; |
|
2135 |
dX, dY: hwFloat; |
|
2136 |
fChanged: boolean; |
|
2137 |
trueAngle: Longword; |
|
2138 |
t: PGear; |
|
2139 |
begin |
|
2140 |
AllInactive:= false; |
|
2141 |
||
2428 | 2142 |
if ((TrainingFlags and tfRCPlane) = 0) and (Gear^.Timer > 0) then dec(Gear^.Timer); |
2143 |
||
2144 |
if ((TrainingFlags and tfRCPlane) <> 0) and ((TrainingFlags and tfTimeTrial) <> 0 ) and (TimeTrialStartTime = 0) then TimeTrialStartTime:= RealTicks; |
|
1689 | 2145 |
|
2146 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
2147 |
FollowGear:= Gear; |
|
2148 |
||
2149 |
fChanged:= false; |
|
1696 | 2150 |
if ((HHGear^.State and gstHHDriven) = 0) or (Gear^.Timer = 0) then |
1689 | 2151 |
begin |
2152 |
fChanged:= true; |
|
1696 | 2153 |
if Gear^.Angle > 2048 then dec(Gear^.Angle) else |
2154 |
if Gear^.Angle < 2048 then inc(Gear^.Angle) else fChanged:= false |
|
2155 |
end |
|
2156 |
else |
|
2157 |
begin |
|
2158 |
if ((Gear^.Message and gm_Left) <> 0) then |
|
2159 |
begin |
|
2160 |
fChanged:= true; |
|
2161 |
Gear^.Angle:= (Gear^.Angle + (4096 - cAngleSpeed)) mod 4096 |
|
2162 |
end; |
|
1689 | 2163 |
|
1696 | 2164 |
if ((Gear^.Message and gm_Right) <> 0) then |
2165 |
begin |
|
2166 |
fChanged:= true; |
|
2167 |
Gear^.Angle:= (Gear^.Angle + cAngleSpeed) mod 4096 |
|
2168 |
end |
|
1689 | 2169 |
end; |
2170 |
||
2171 |
if fChanged then |
|
2172 |
begin |
|
2173 |
Gear^.dX.isNegative:= (Gear^.Angle > 2048); |
|
2174 |
if Gear^.dX.isNegative then |
|
2175 |
trueAngle:= 4096 - Gear^.Angle |
|
2176 |
else |
|
2177 |
trueAngle:= Gear^.Angle; |
|
2178 |
||
2179 |
Gear^.dX:= SignAs(AngleSin(trueAngle), Gear^.dX) * _0_25; |
|
2180 |
Gear^.dY:= AngleCos(trueAngle) * -_0_25; |
|
2181 |
end; |
|
2182 |
||
2183 |
Gear^.X:= Gear^.X + Gear^.dX; |
|
2184 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
|
2185 |
||
2428 | 2186 |
if (TrainingFlags and tfRCPlane) = 0 then |
2187 |
begin |
|
2188 |
if (GameTicks and $FF) = 0 then |
|
2189 |
if Gear^.Timer < 3500 then |
|
2190 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtEvilTrace, 0, _0, _0, 0) |
|
2191 |
else |
|
2192 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtSmokeTrace, 0, _0, _0, 0); |
|
2193 |
||
2194 |
if ((HHGear^.Message and gm_Attack) <> 0) and (Gear^.Health <> 0) then |
|
2195 |
begin |
|
2196 |
HHGear^.Message := HHGear^.Message and not gm_Attack; |
|
2197 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtAirBomb, 0, Gear^.dX * _0_5, Gear^.dY * _0_5, 0); |
|
2198 |
dec(Gear^.Health) |
|
2199 |
end; |
|
2200 |
||
2201 |
if ((HHGear^.Message and gm_LJump) <> 0) |
|
2202 |
and ((Gear^.State and gsttmpFlag) = 0) then |
|
2203 |
begin |
|
2204 |
Gear^.State:= Gear^.State or gsttmpFlag; |
|
2205 |
PauseMusic; |
|
2206 |
playSound(sndRideOfTheValkyries, false, nil); |
|
2207 |
end; |
|
2208 |
||
2209 |
// pickup bonuses |
|
2210 |
t:= CheckGearNear(Gear, gtCase, 36, 36); |
|
2211 |
if t <> nil then |
|
2212 |
PickUp(HHGear, t); |
|
2213 |
end |
|
2214 |
else |
|
2215 |
begin |
|
2216 |
if (GameTicks and $FF) = 0 then |
|
1696 | 2217 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtSmokeTrace, 0, _0, _0, 0); |
1689 | 2218 |
|
2428 | 2219 |
// pickup targets |
2220 |
t:= CheckGearNear(Gear, gtTarget, 36, 36); |
|
2221 |
if t <> nil then |
|
2222 |
begin; |
|
2223 |
// TODO: Sound! |
|
2224 |
PlaySound(sndGraveImpact, false, nil); |
|
2225 |
DeleteGear(t); |
|
2226 |
TrainingTargetGear:= AddGear(0, 0, gtTarget, 0, _0, _0, 0); |
|
2227 |
FindPlace(TrainingTargetGear, false, 0, LAND_WIDTH); |
|
2228 |
inc(TurnTimeLeft, TrainingTimeInc); |
|
2229 |
||
2230 |
if TrainingTimeInc > TrainingTimeInM then |
|
2231 |
dec(TrainingTimeInc, TrainingTimeInD); |
|
2232 |
if TurnTimeLeft > TrainingTimeMax then TurnTimeLeft:= TrainingTimeMax; |
|
2233 |
end; |
|
1712 | 2234 |
|
2428 | 2235 |
if (TurnTimeLeft > 0) then |
2236 |
dec(TurnTimeLeft) |
|
2237 |
else |
|
2238 |
begin |
|
2239 |
if ((TrainingFlags and tfTimeTrial) <>0) and (TimeTrialStopTime = 0) then TimeTrialStopTime:= RealTicks; |
|
2240 |
StopSound(sndRCPlane); |
|
2241 |
ResumeMusic; |
|
2242 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 25, EXPLAutoSound); |
|
2243 |
for i:= 0 to 32 do |
|
2244 |
begin |
|
2245 |
dX:= AngleCos(i * 64) * _0_5 * (GetRandom + _1); |
|
2246 |
dY:= AngleSin(i * 64) * _0_5 * (GetRandom + _1); |
|
2247 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtFlame, 0, dX, dY, 0); |
|
2248 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtFlame, 0, dX, -dY, 0); |
|
2249 |
end; |
|
2250 |
DeleteGear(Gear); |
|
2251 |
AfterAttack; |
|
2252 |
TurnTimeLeft:= 0; |
|
2253 |
CurAmmoGear:= nil; |
|
2254 |
HHGear^.Message:= 0; |
|
2255 |
ParseCommand('/taunt '#1, true); |
|
2256 |
exit; |
|
2257 |
end; |
|
1689 | 2258 |
|
2428 | 2259 |
end; |
2260 |
||
1689 | 2261 |
CheckCollision(Gear); |
2262 |
||
1712 | 2263 |
if ((Gear^.State and gstCollision) <> 0) |
2264 |
or CheckGearDrowning(Gear) then |
|
1689 | 2265 |
begin |
2428 | 2266 |
if ((TrainingFlags and tfRCPlane) <> 0) and ((TrainingFlags and tfTimeTrial) <> 0 ) and (TimeTrialStopTime = 0) then TimeTrialStopTime:= RealTicks; |
1712 | 2267 |
StopSound(sndRCPlane); |
2268 |
StopSound(sndRideOfTheValkyries); |
|
2269 |
ResumeMusic; |
|
2376 | 2270 |
|
1712 | 2271 |
if ((Gear^.State and gstCollision) <> 0) then |
1689 | 2272 |
begin |
1712 | 2273 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 25, EXPLAutoSound); |
1714 | 2274 |
for i:= 0 to 32 do |
1712 | 2275 |
begin |
1714 | 2276 |
dX:= AngleCos(i * 64) * _0_5 * (GetRandom + _1); |
2277 |
dY:= AngleSin(i * 64) * _0_5 * (GetRandom + _1); |
|
1712 | 2278 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtFlame, 0, dX, dY, 0); |
2279 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtFlame, 0, dX, -dY, 0); |
|
2280 |
end; |
|
2281 |
DeleteGear(Gear) |
|
1689 | 2282 |
end; |
1713 | 2283 |
|
1689 | 2284 |
AfterAttack; |
1713 | 2285 |
CurAmmoGear:= nil; |
1697 | 2286 |
TurnTimeLeft:= 14 * 125; |
1712 | 2287 |
HHGear^.Message:= 0; |
1697 | 2288 |
ParseCommand('/taunt '#1, true) |
2289 |
end |
|
1689 | 2290 |
end; |
2291 |
||
2292 |
procedure doStepRCPlane(Gear: PGear); |
|
2293 |
var HHGear: PGear; |
|
2294 |
begin |
|
2295 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
2296 |
HHGear^.Message:= 0; |
|
2297 |
HHGear^.State:= HHGear^.State or gstNotKickable; |
|
2298 |
Gear^.Angle:= HHGear^.Angle; |
|
1696 | 2299 |
Gear^.Tag:= hwSign(HHGear^.dX); |
1689 | 2300 |
if HHGear^.dX.isNegative then Gear^.Angle:= 4096 - Gear^.Angle; |
2301 |
Gear^.doStep:= @doStepRCPlaneWork |
|
1712 | 2302 |
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
|
2303 |
|
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2304 |
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
|
2305 |
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
|
2306 |
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
|
2307 |
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
|
2308 |
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
|
2309 |
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
|
2310 |
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
|
2311 |
//dec(Gear^.Timer); |
2440 | 2312 |
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
|
2313 |
fuel:= 50; |
2182
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2181
diff
changeset
|
2314 |
(*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
|
2315 |
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
|
2316 |
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
|
2317 |
fuel:= 5; |
2182
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2181
diff
changeset
|
2318 |
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
|
2319 |
|
c045698e044f
Initial attempt at jetpack. Pluses, more like lunar lander (takes fall damage). Minuses, can't seem to cancel it or use alt weapon
nemo
parents:
2143
diff
changeset
|
2320 |
if (HHGear^.Message and gm_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
|
2321 |
begin |
2433 | 2322 |
if (not HHGear^.dY.isNegative) or (HHGear^.Y > -_256) then |
2323 |
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
|
2324 |
HHGear^.dY:= HHGear^.dY - move; |
2182
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2181
diff
changeset
|
2325 |
dec(Gear^.Health, fuel); |
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2181
diff
changeset
|
2326 |
Gear^.MsgParam:= Gear^.MsgParam or gm_Up; |
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2181
diff
changeset
|
2327 |
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
|
2328 |
end; |
2187
66c0f9b3bd6f
set vector to negative *after* applying upward vector
nemo
parents:
2186
diff
changeset
|
2329 |
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
|
2330 |
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
|
2331 |
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
|
2332 |
HHGear^.dX:= HHGear^.dX + (move * _0_2); |
2182
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2181
diff
changeset
|
2333 |
dec(Gear^.Health, fuel div 5); |
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2181
diff
changeset
|
2334 |
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
|
2335 |
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
|
2336 |
end; |
2182
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2181
diff
changeset
|
2337 |
|
2376 | 2338 |
// erases them all at once :-/ |
2182
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2181
diff
changeset
|
2339 |
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
|
2340 |
begin |
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2181
diff
changeset
|
2341 |
Gear^.Timer:= 0; |
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2181
diff
changeset
|
2342 |
Gear^.MsgParam:= 0 |
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2181
diff
changeset
|
2343 |
end; |
ed7e7eb3f9ed
Ugly graphic for jetpack - jetpack should be essentially functional.
nemo
parents:
2181
diff
changeset
|
2344 |
|
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
|
2345 |
if Gear^.Health < 0 then Gear^.Health:= 0; |
2376 | 2346 |
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
|
2347 |
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
|
2348 |
//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
|
2349 |
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
|
2350 |
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
|
2351 |
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
|
2352 |
|
2278
28519f4f3f21
requested change by Tiy to Flying Saucer start (hover until first keypress)
nemo
parents:
2267
diff
changeset
|
2353 |
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
|
2354 |
HHGear^.Message:= HHGear^.Message and not (gm_Up or gm_Precise or gm_Left or gm_Right); |
2376 | 2355 |
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
|
2356 |
|
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
|
2357 |
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
|
2358 |
Gear^.Y:= HHGear^.Y; |
2196 | 2359 |
// 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
|
2360 |
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
|
2361 |
|
28519f4f3f21
requested change by Tiy to Flying Saucer start (hover until first keypress)
nemo
parents:
2267
diff
changeset
|
2362 |
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
|
2363 |
|
2179 | 2364 |
if (Gear^.Health = 0) |
2180
6c5a339f8e28
Use different group to not erase messages, restore gear deletion on hog damage.
nemo
parents:
2179
diff
changeset
|
2365 |
or (HHGear^.Damage <> 0) |
2179 | 2366 |
or CheckGearDrowning(HHGear) |
2376 | 2367 |
or (TurnTimeLeft = 0) |
2189 | 2368 |
// allow brief ground touches - to be fair on this, might need another counter |
2190 | 2369 |
or (((GameTicks and $1FF) = 0) and (not HHGear^.dY.isNegative) and TestCollisionYwithGear(HHGear, 1)) |
2179 | 2370 |
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
|
2371 |
begin |
2179 | 2372 |
with HHGear^ do |
2373 |
begin |
|
2374 |
Message:= 0; |
|
2375 |
Active:= true; |
|
2376 |
State:= State or gstMoving |
|
2377 |
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
|
2378 |
DeleteGear(Gear); |
2179 | 2379 |
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
|
2380 |
// 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
|
2381 |
// 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
|
2382 |
//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
|
2383 |
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
|
2384 |
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
|
2385 |
|
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 |
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
|
2387 |
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
|
2388 |
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
|
2389 |
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
|
2390 |
|
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 |
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
|
2392 |
FollowGear:= HHGear; |
2179 | 2393 |
OnUsedAmmo(PHedgehog(HHGear^.Hedgehog)^); |
2394 |
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
|
2395 |
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
|
2396 |
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
|
2397 |
State:= State and not gstAttacking; |
2278
28519f4f3f21
requested change by Tiy to Flying Saucer start (hover until first keypress)
nemo
parents:
2267
diff
changeset
|
2398 |
Message:= Message and not (gm_Attack or gm_Up or gm_Precise or gm_Left or gm_Right); |
2301 | 2399 |
if (dY < _0_1) and (dY > -_0_1) then |
2400 |
begin |
|
2401 |
Gear^.State:= Gear^.State or gsttmpFlag; |
|
2402 |
dY:= dY - _0_2 |
|
2403 |
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
|
2404 |
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
|
2405 |
end; |