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