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