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