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