author | unc0rr |
Sat, 17 May 2008 22:21:45 +0000 | |
changeset 940 | 769adb0ad082 |
parent 931 | ab4d98858a40 |
child 941 | b5222ddafe1f |
permissions | -rw-r--r-- |
4 | 1 |
(* |
2 |
* Hedgewars, a worms-like game |
|
883 | 3 |
* Copyright (c) 2004-2008 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 |
||
37 | 19 |
//////////////////////////////////////////////////////////////////////////////// |
783 | 20 |
procedure ChangeAmmo(Gear: PGear); |
21 |
var slot: Longword; |
|
22 |
begin |
|
23 |
slot:= Gear^.MsgParam; |
|
24 |
||
25 |
with PHedgehog(Gear^.Hedgehog)^ do |
|
927
2c1675344a6f
Remove AltSlot and AltAmmo fields of Hedgehog record, as they are not actually needed
unc0rr
parents:
926
diff
changeset
|
26 |
begin |
928
b9064b48b001
Some preparation work for attacking from rope, parachute and etc.
unc0rr
parents:
927
diff
changeset
|
27 |
if ((Gear^.State and (gstAttacking or gstAttacked)) <> 0) |
b9064b48b001
Some preparation work for attacking from rope, parachute and etc.
unc0rr
parents:
927
diff
changeset
|
28 |
or (AttacksNum > 0) |
927
2c1675344a6f
Remove AltSlot and AltAmmo fields of Hedgehog record, as they are not actually needed
unc0rr
parents:
926
diff
changeset
|
29 |
or ((Gear^.State and gstHHDriven) = 0) then exit; |
783 | 30 |
|
927
2c1675344a6f
Remove AltSlot and AltAmmo fields of Hedgehog record, as they are not actually needed
unc0rr
parents:
926
diff
changeset
|
31 |
Gear^.Message:= Gear^.Message and not (gm_LJump or gm_HJump or gm_Slot); |
783 | 32 |
|
927
2c1675344a6f
Remove AltSlot and AltAmmo fields of Hedgehog record, as they are not actually needed
unc0rr
parents:
926
diff
changeset
|
33 |
if CurSlot = slot then |
2c1675344a6f
Remove AltSlot and AltAmmo fields of Hedgehog record, as they are not actually needed
unc0rr
parents:
926
diff
changeset
|
34 |
begin |
2c1675344a6f
Remove AltSlot and AltAmmo fields of Hedgehog record, as they are not actually needed
unc0rr
parents:
926
diff
changeset
|
35 |
inc(CurAmmo); |
2c1675344a6f
Remove AltSlot and AltAmmo fields of Hedgehog record, as they are not actually needed
unc0rr
parents:
926
diff
changeset
|
36 |
if (CurAmmo > cMaxSlotAmmoIndex) or (Ammo^[slot, CurAmmo].Count = 0) then CurAmmo:= 0 |
2c1675344a6f
Remove AltSlot and AltAmmo fields of Hedgehog record, as they are not actually needed
unc0rr
parents:
926
diff
changeset
|
37 |
end else |
2c1675344a6f
Remove AltSlot and AltAmmo fields of Hedgehog record, as they are not actually needed
unc0rr
parents:
926
diff
changeset
|
38 |
if Ammo^[slot, 0].Count > 0 then |
2c1675344a6f
Remove AltSlot and AltAmmo fields of Hedgehog record, as they are not actually needed
unc0rr
parents:
926
diff
changeset
|
39 |
begin |
2c1675344a6f
Remove AltSlot and AltAmmo fields of Hedgehog record, as they are not actually needed
unc0rr
parents:
926
diff
changeset
|
40 |
CurSlot:= slot; |
2c1675344a6f
Remove AltSlot and AltAmmo fields of Hedgehog record, as they are not actually needed
unc0rr
parents:
926
diff
changeset
|
41 |
CurAmmo:= 0 |
2c1675344a6f
Remove AltSlot and AltAmmo fields of Hedgehog record, as they are not actually needed
unc0rr
parents:
926
diff
changeset
|
42 |
end; |
2c1675344a6f
Remove AltSlot and AltAmmo fields of Hedgehog record, as they are not actually needed
unc0rr
parents:
926
diff
changeset
|
43 |
end; |
2c1675344a6f
Remove AltSlot and AltAmmo fields of Hedgehog record, as they are not actually needed
unc0rr
parents:
926
diff
changeset
|
44 |
|
783 | 45 |
ApplyAmmoChanges(PHedgehog(Gear^.Hedgehog)^) |
46 |
end; |
|
47 |
||
48 |
procedure HHSetWeapon(Gear: PGear); |
|
49 |
var t: LongInt; |
|
50 |
weap: TAmmoType; |
|
51 |
begin |
|
52 |
weap:= TAmmoType(Gear^.MsgParam); |
|
53 |
Gear^.MsgParam:= Ammoz[weap].Slot; |
|
54 |
||
55 |
t:= cMaxSlotAmmoIndex; |
|
56 |
||
57 |
Gear^.Message:= Gear^.Message and not gm_Weapon; |
|
58 |
||
59 |
with PHedgehog(Gear^.Hedgehog)^ do |
|
926
d231e007452a
Timer as hedgehog message (avoid possible desync in very rare cases)
unc0rr
parents:
925
diff
changeset
|
60 |
while (Ammo^[CurSlot, CurAmmo].AmmoType <> weap) and (t >= 0) do |
d231e007452a
Timer as hedgehog message (avoid possible desync in very rare cases)
unc0rr
parents:
925
diff
changeset
|
61 |
begin |
d231e007452a
Timer as hedgehog message (avoid possible desync in very rare cases)
unc0rr
parents:
925
diff
changeset
|
62 |
ChangeAmmo(Gear); |
d231e007452a
Timer as hedgehog message (avoid possible desync in very rare cases)
unc0rr
parents:
925
diff
changeset
|
63 |
dec(t) |
d231e007452a
Timer as hedgehog message (avoid possible desync in very rare cases)
unc0rr
parents:
925
diff
changeset
|
64 |
end |
783 | 65 |
end; |
66 |
||
926
d231e007452a
Timer as hedgehog message (avoid possible desync in very rare cases)
unc0rr
parents:
925
diff
changeset
|
67 |
procedure HHSetTimer(Gear: PGear); |
d231e007452a
Timer as hedgehog message (avoid possible desync in very rare cases)
unc0rr
parents:
925
diff
changeset
|
68 |
begin |
d231e007452a
Timer as hedgehog message (avoid possible desync in very rare cases)
unc0rr
parents:
925
diff
changeset
|
69 |
Gear^.Message:= Gear^.Message and not gm_Timer; |
d231e007452a
Timer as hedgehog message (avoid possible desync in very rare cases)
unc0rr
parents:
925
diff
changeset
|
70 |
with PHedgehog(Gear^.Hedgehog)^ do |
d231e007452a
Timer as hedgehog message (avoid possible desync in very rare cases)
unc0rr
parents:
925
diff
changeset
|
71 |
if (Ammo^[CurSlot, CurAmmo].Propz and ammoprop_Timerable) <> 0 then |
d231e007452a
Timer as hedgehog message (avoid possible desync in very rare cases)
unc0rr
parents:
925
diff
changeset
|
72 |
begin |
d231e007452a
Timer as hedgehog message (avoid possible desync in very rare cases)
unc0rr
parents:
925
diff
changeset
|
73 |
Ammo^[CurSlot, CurAmmo].Timer:= 1000 * Gear^.MsgParam; |
d231e007452a
Timer as hedgehog message (avoid possible desync in very rare cases)
unc0rr
parents:
925
diff
changeset
|
74 |
with CurrentTeam^ do |
d231e007452a
Timer as hedgehog message (avoid possible desync in very rare cases)
unc0rr
parents:
925
diff
changeset
|
75 |
ApplyAmmoChanges(Hedgehogs[CurrHedgehog]); |
d231e007452a
Timer as hedgehog message (avoid possible desync in very rare cases)
unc0rr
parents:
925
diff
changeset
|
76 |
end; |
d231e007452a
Timer as hedgehog message (avoid possible desync in very rare cases)
unc0rr
parents:
925
diff
changeset
|
77 |
end; |
d231e007452a
Timer as hedgehog message (avoid possible desync in very rare cases)
unc0rr
parents:
925
diff
changeset
|
78 |
|
d231e007452a
Timer as hedgehog message (avoid possible desync in very rare cases)
unc0rr
parents:
925
diff
changeset
|
79 |
|
32
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
16
diff
changeset
|
80 |
procedure Attack(Gear: PGear); |
351 | 81 |
var xx, yy: hwFloat; |
32
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
16
diff
changeset
|
82 |
begin |
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
16
diff
changeset
|
83 |
with Gear^, |
351 | 84 |
PHedgehog(Gear^.Hedgehog)^ do |
32
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
16
diff
changeset
|
85 |
begin |
95 | 86 |
if ((State and gstHHDriven) <> 0)and |
542 | 87 |
((State and (gstAttacked or gstHHChooseTarget)) = 0)and |
836 | 88 |
(((State and gstMoving) = 0) or ((Ammo^[CurSlot, CurAmmo].Propz and ammoprop_AttackInMove) <> 0))and |
89 |
((TargetPoint.X <> NoPointX) or ((Ammo^[CurSlot, CurAmmo].Propz and ammoprop_NeedTarget) = 0)) then |
|
32
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
16
diff
changeset
|
90 |
begin |
95 | 91 |
State:= State or gstAttacking; |
92 |
if Power = cMaxPower then Message:= Message and not gm_Attack |
|
351 | 93 |
else if (Ammo^[CurSlot, CurAmmo].Propz and ammoprop_Power) = 0 then Message:= Message and not gm_Attack |
95 | 94 |
else begin |
95 |
if Power = 0 then |
|
96 |
begin |
|
351 | 97 |
AttackBar:= CurrentTeam^.AttackBar; |
98 |
PlaySound(sndThrowPowerUp, false) |
|
95 | 99 |
end; |
100 |
inc(Power) |
|
101 |
end; |
|
102 |
if ((Message and gm_Attack) <> 0) then exit; |
|
351 | 103 |
|
104 |
if (Ammo^[CurSlot, CurAmmo].Propz and ammoprop_Power) <> 0 then |
|
32
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
16
diff
changeset
|
105 |
begin |
282 | 106 |
StopSound(sndThrowPowerUp); |
351 | 107 |
PlaySound(sndThrowRelease, false); |
32
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
16
diff
changeset
|
108 |
end; |
519 | 109 |
xx:= SignAs(AngleSin(Angle), dX); |
900 | 110 |
yy:= -AngleCos(Angle); |
111 |
||
112 |
if ((Gear^.State and gstHHHJump) <> 0) then xx:= - xx; |
|
351 | 113 |
case Ammo^[CurSlot, CurAmmo].AmmoType of |
114 |
amGrenade: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtAmmo_Bomb, 0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, Ammo^[CurSlot, CurAmmo].Timer); |
|
115 |
amClusterBomb: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtClusterBomb, 0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, Ammo^[CurSlot, CurAmmo].Timer); |
|
116 |
amBazooka: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtAmmo_Grenade, 0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 0); |
|
117 |
amUFO: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtUFO, 0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 0); |
|
32
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
16
diff
changeset
|
118 |
amShotgun: begin |
351 | 119 |
PlaySound(sndShotgunReload, false); |
120 |
CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtShotgunShot, 0, xx * _0_5, yy * _0_5, 0); |
|
32
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
16
diff
changeset
|
121 |
end; |
498 | 122 |
amPickHammer: CurAmmoGear:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y) + cHHRadius, gtPickHammer, 0, _0, _0, 0); |
866 | 123 |
amSkip: ParseCommand('/skip', true); |
351 | 124 |
amRope: CurAmmoGear:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtRope, 0, xx, yy, 0); |
800 | 125 |
amMine: begin |
126 |
AddGear(hwRound(X) + hwSign(dX) * 7, hwRound(Y), gtMine, 0, SignAs(_0_02, dX), _0, 3000); |
|
127 |
PlaySound(sndLaugh, false) |
|
128 |
end; |
|
876 | 129 |
amDEagle: CurAmmoGear:= AddGear(hwRound(X + xx * cHHRadius), hwRound(Y + yy * cHHRadius), gtDEagleShot, 0, xx * _0_5, yy * _0_5, 0); |
498 | 130 |
amDynamite: AddGear(hwRound(X) + hwSign(dX) * 7, hwRound(Y), gtDynamite, 0, SignAs(_0_03, dX), _0, 5000); |
925 | 131 |
amFirePunch: CurAmmoGear:= AddGear(hwRound(X) + hwSign(dX) * 10, hwRound(Y), gtFirePunch, 0, _0, _0, 0); |
132 |
amWhip: CurAmmoGear:= AddGear(hwRound(X) + hwSign(dX) * 10, hwRound(Y), gtWhip, 0, SignAs(_1, dX), - _0_8, 0); |
|
854 | 133 |
amBaseballBat: CurAmmoGear:= AddGear(hwRound(X) + hwSign(dX) * 10, hwRound(Y), gtShover, 0, xx * _0_5, yy * _0_5, 0); |
498 | 134 |
amParachute: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtParachute, 0, _0, _0, 0); |
135 |
amAirAttack: AddGear(Ammo^[CurSlot, CurAmmo].Pos, 0, gtAirAttack, 0, _0, _0, 0); |
|
136 |
amMineStrike: AddGear(Ammo^[CurSlot, CurAmmo].Pos, 0, gtAirAttack, 1, _0, _0, 0); |
|
137 |
amBlowTorch: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtBlowTorch, 0, SignAs(_0_5, dX), _0, 0); |
|
138 |
amGirder: CurAmmoGear:= AddGear(0, 0, gtGirder, Ammo^[CurSlot, CurAmmo].Pos, _0, _0, 0); |
|
520 | 139 |
amTeleport: CurAmmoGear:= AddGear(0, 0, gtTeleport, 0, _0, _0, 0); |
534 | 140 |
amSwitch: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtSwitcher, 0, _0, _0, 0); |
924 | 141 |
amMortar: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtMortar, 0, xx*cMaxPower/cPowerDivisor, yy*cMaxPower/cPowerDivisor, 0); |
32
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
16
diff
changeset
|
142 |
end; |
829 | 143 |
|
144 |
uStats.AmmoUsed(Ammo^[CurSlot, CurAmmo].AmmoType); |
|
145 |
||
32
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
16
diff
changeset
|
146 |
Power:= 0; |
930 | 147 |
if (CurAmmoGear <> nil) |
148 |
and (((Ammo^[CurSlot, CurAmmo].Propz) and ammoprop_AltUse) = 0){check for dropping ammo from rope} then |
|
32
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
16
diff
changeset
|
149 |
begin |
930 | 150 |
CurAmmoGear^.Ammo:= @(Ammo^[CurSlot, CurAmmo]); |
82 | 151 |
Message:= Message or gm_Attack; |
351 | 152 |
CurAmmoGear^.Message:= Message |
82 | 153 |
end else begin |
351 | 154 |
if not CurrentTeam^.ExtDriven and |
155 |
((Ammo^[CurSlot, CurAmmo].Propz and ammoprop_Power) <> 0) then SendIPC('a'); |
|
82 | 156 |
AfterAttack |
157 |
end |
|
95 | 158 |
end else Message:= Message and not gm_Attack |
32
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
16
diff
changeset
|
159 |
end |
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
16
diff
changeset
|
160 |
end; |
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
16
diff
changeset
|
161 |
|
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
16
diff
changeset
|
162 |
procedure AfterAttack; |
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
16
diff
changeset
|
163 |
begin |
602 | 164 |
with CurrentHedgehog^.Gear^, |
165 |
CurrentHedgehog^ do |
|
32
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
16
diff
changeset
|
166 |
begin |
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
16
diff
changeset
|
167 |
Inc(AttacksNum); |
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
16
diff
changeset
|
168 |
State:= State and not gstAttacking; |
614 | 169 |
if (Ammo^[CurSlot, CurAmmo].NumPerTurn >= AttacksNum) or |
170 |
((GameFlags and gfMultiWeapon) <> 0) then isInMultiShoot:= true |
|
32
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
16
diff
changeset
|
171 |
else begin |
351 | 172 |
TurnTimeLeft:= Ammoz[Ammo^[CurSlot, CurAmmo].AmmoType].TimeAfterTurn; |
32
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
16
diff
changeset
|
173 |
State:= State or gstAttacked; |
602 | 174 |
OnUsedAmmo(CurrentHedgehog^) |
32
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
16
diff
changeset
|
175 |
end; |
95 | 176 |
AttackBar:= 0; |
32
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
16
diff
changeset
|
177 |
end |
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
16
diff
changeset
|
178 |
end; |
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
16
diff
changeset
|
179 |
|
42 | 180 |
//////////////////////////////////////////////////////////////////////////////// |
863 | 181 |
procedure doStepHedgehogDead(Gear: PGear); |
868 | 182 |
const frametime = 200; |
183 |
timertime = frametime * 6; |
|
863 | 184 |
begin |
185 |
if Gear^.Timer > 1 then |
|
186 |
begin |
|
187 |
AllInactive:= false; |
|
868 | 188 |
dec(Gear^.Timer); |
189 |
if (Gear^.Timer mod frametime) = 0 then inc(Gear^.Pos) |
|
863 | 190 |
end else |
191 |
if Gear^.Timer = 1 then |
|
192 |
begin |
|
193 |
Gear^.State:= Gear^.State or gstNoDamage; |
|
194 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, EXPLAutoSound); |
|
195 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtGrave, 0, _0, _0, 0)^.Hedgehog:= Gear^.Hedgehog; |
|
196 |
DeleteGear(Gear); |
|
197 |
SetAllToActive |
|
198 |
end else // Gear^.Timer = 0 |
|
199 |
begin |
|
200 |
AllInactive:= false; |
|
868 | 201 |
Gear^.Z:= cCurrHHZ; |
202 |
RemoveGearFromList(Gear); |
|
203 |
InsertGearToList(Gear); |
|
863 | 204 |
PlaySound(sndByeBye, false); |
868 | 205 |
Gear^.Pos:= 0; |
206 |
Gear^.Timer:= timertime |
|
863 | 207 |
end |
208 |
end; |
|
209 |
||
210 |
//////////////////////////////////////////////////////////////////////////////// |
|
42 | 211 |
procedure PickUp(HH, Gear: PGear); |
295 | 212 |
var s: shortstring; |
213 |
a: TAmmoType; |
|
42 | 214 |
begin |
351 | 215 |
Gear^.Message:= gm_Destroy; |
216 |
case Gear^.Pos of |
|
295 | 217 |
posCaseAmmo: begin |
351 | 218 |
a:= TAmmoType(Gear^.State); |
553
5478386d935f
- Switch to bazooka (or whatever) after use of some weapon (fixes problem with bots)
unc0rr
parents:
549
diff
changeset
|
219 |
AddAmmo(PHedgehog(HH^.Hedgehog)^, a); |
836 | 220 |
if not (PHedgehog(HH^.Hedgehog)^.Team^.ExtDriven |
221 |
or (PHedgehog(HH^.Hedgehog)^.BotLevel > 0)) then |
|
222 |
begin |
|
223 |
s:= trammo[Ammoz[a].NameId] + '(+' + IntToStr(Ammoz[a].NumberInCase) + ')'; |
|
224 |
AddCaption(s, PHedgehog(HH^.Hedgehog)^.Team^.Clan^.Color, capgrpAmmoinfo); |
|
225 |
end |
|
295 | 226 |
end; |
42 | 227 |
posCaseHealth: begin |
351 | 228 |
inc(HH^.Health, Gear^.Health); |
229 |
str(Gear^.Health, s); |
|
295 | 230 |
s:= '+' + s; |
549 | 231 |
AddCaption(s, PHedgehog(HH^.Hedgehog)^.Team^.Clan^.Color, capgrpAmmoinfo); |
351 | 232 |
RenderHealth(PHedgehog(HH^.Hedgehog)^); |
233 |
RecountTeamHealth(PHedgehog(HH^.Hedgehog)^.Team) |
|
42 | 234 |
end; |
435 | 235 |
end |
42 | 236 |
end; |
32
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
16
diff
changeset
|
237 |
|
4 | 238 |
const StepTicks: LongWord = 0; |
239 |
||
302 | 240 |
procedure HedgehogStep(Gear: PGear); |
371 | 241 |
var PrevdX: LongInt; |
302 | 242 |
begin |
542 | 243 |
if ((Gear^.State and (gstAttacking or gstMoving)) = 0) then |
4 | 244 |
begin |
408 | 245 |
if isCursorVisible then |
246 |
with PHedgehog(Gear^.Hedgehog)^ do |
|
247 |
with Ammo^[CurSlot, CurAmmo] do |
|
248 |
begin |
|
542 | 249 |
if (Gear^.Message and gm_Left ) <> 0 then |
408 | 250 |
Pos:= (Pos + Ammoz[AmmoType].PosCount - 1) mod Ammoz[AmmoType].PosCount |
251 |
else |
|
542 | 252 |
if (Gear^.Message and gm_Right ) <> 0 then |
408 | 253 |
Pos:= (Pos + 1) mod Ammoz[AmmoType].PosCount |
254 |
else exit; |
|
423 | 255 |
StepTicks:= 200; |
408 | 256 |
exit |
257 |
end; |
|
505
fcba7d7aea0d
Fix old bug with grenade(bomd, etc..) not colliding with attacking hedgehog
unc0rr
parents:
498
diff
changeset
|
258 |
|
351 | 259 |
if ((Gear^.Message and gm_LJump ) <> 0) then |
4 | 260 |
begin |
542 | 261 |
Gear^.Message:= Gear^.Message and not gm_LJump; |
505
fcba7d7aea0d
Fix old bug with grenade(bomd, etc..) not colliding with attacking hedgehog
unc0rr
parents:
498
diff
changeset
|
262 |
DeleteCI(Gear); |
68 | 263 |
if not TestCollisionYwithGear(Gear, -1) then |
498 | 264 |
if not TestCollisionXwithXYShift(Gear, _0, -2, hwSign(Gear^.dX)) then Gear^.Y:= Gear^.Y - _2 else |
265 |
if not TestCollisionXwithXYShift(Gear, _0, -1, hwSign(Gear^.dX)) then Gear^.Y:= Gear^.Y - _1; |
|
351 | 266 |
if not (TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) |
68 | 267 |
or TestCollisionYwithGear(Gear, -1)) then |
4 | 268 |
begin |
351 | 269 |
Gear^.dY:= -_0_15; |
498 | 270 |
Gear^.dX:= SignAs(_0_15, Gear^.dX); |
542 | 271 |
Gear^.State:= Gear^.State or gstMoving or gstHHJumping; |
799 | 272 |
PlaySound(sndJump1, false); |
4 | 273 |
exit |
274 |
end; |
|
275 |
end; |
|
505
fcba7d7aea0d
Fix old bug with grenade(bomd, etc..) not colliding with attacking hedgehog
unc0rr
parents:
498
diff
changeset
|
276 |
|
351 | 277 |
if ((Gear^.Message and gm_HJump ) <> 0) then |
4 | 278 |
begin |
505
fcba7d7aea0d
Fix old bug with grenade(bomd, etc..) not colliding with attacking hedgehog
unc0rr
parents:
498
diff
changeset
|
279 |
DeleteCI(Gear); |
542 | 280 |
Gear^.Message:= Gear^.Message and not gm_HJump; |
855
8842c71d16bf
- Fix too long delay between shotgun and deagle shots
unc0rr
parents:
854
diff
changeset
|
281 |
|
8842c71d16bf
- Fix too long delay between shotgun and deagle shots
unc0rr
parents:
854
diff
changeset
|
282 |
Gear^.dY:= -_0_2; |
8842c71d16bf
- Fix too long delay between shotgun and deagle shots
unc0rr
parents:
854
diff
changeset
|
283 |
SetLittle(Gear^.dX); |
8842c71d16bf
- Fix too long delay between shotgun and deagle shots
unc0rr
parents:
854
diff
changeset
|
284 |
Gear^.State:= Gear^.State or gstMoving or gstHHJumping; |
8842c71d16bf
- Fix too long delay between shotgun and deagle shots
unc0rr
parents:
854
diff
changeset
|
285 |
PlaySound(sndJump3, false); |
8842c71d16bf
- Fix too long delay between shotgun and deagle shots
unc0rr
parents:
854
diff
changeset
|
286 |
exit |
4 | 287 |
end; |
505
fcba7d7aea0d
Fix old bug with grenade(bomd, etc..) not colliding with attacking hedgehog
unc0rr
parents:
498
diff
changeset
|
288 |
|
351 | 289 |
PrevdX:= hwSign(Gear^.dX); |
290 |
if (Gear^.Message and gm_Left )<>0 then Gear^.dX:= -cLittle else |
|
291 |
if (Gear^.Message and gm_Right )<>0 then Gear^.dX:= cLittle else exit; |
|
505
fcba7d7aea0d
Fix old bug with grenade(bomd, etc..) not colliding with attacking hedgehog
unc0rr
parents:
498
diff
changeset
|
292 |
|
74 | 293 |
StepTicks:= cHHStepTicks; |
610 | 294 |
if PrevdX <> hwSign(Gear^.dX) then |
295 |
begin |
|
296 |
FollowGear:= Gear; |
|
297 |
exit |
|
298 |
end; |
|
299 |
DeleteCI(Gear); // must be after exit!! (see previous line) |
|
838 | 300 |
|
351 | 301 |
PHedgehog(Gear^.Hedgehog)^.visStepPos:= (PHedgehog(Gear^.Hedgehog)^.visStepPos + 1) and 7; |
302 |
if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then |
|
4 | 303 |
begin |
498 | 304 |
if not (TestCollisionXwithXYShift(Gear, _0, -6, hwSign(Gear^.dX)) |
305 |
or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; |
|
306 |
if not (TestCollisionXwithXYShift(Gear, _0, -5, hwSign(Gear^.dX)) |
|
307 |
or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; |
|
308 |
if not (TestCollisionXwithXYShift(Gear, _0, -4, hwSign(Gear^.dX)) |
|
309 |
or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; |
|
310 |
if not (TestCollisionXwithXYShift(Gear, _0, -3, hwSign(Gear^.dX)) |
|
311 |
or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; |
|
312 |
if not (TestCollisionXwithXYShift(Gear, _0, -2, hwSign(Gear^.dX)) |
|
313 |
or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; |
|
314 |
if not (TestCollisionXwithXYShift(Gear, _0, -1, hwSign(Gear^.dX)) |
|
315 |
or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; |
|
4 | 316 |
end; |
498 | 317 |
if not TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then Gear^.X:= Gear^.X + SignAs(_1, Gear^.dX); |
300 | 318 |
|
62 | 319 |
SetAllHHToActive; |
37 | 320 |
|
68 | 321 |
if not TestCollisionYwithGear(Gear, 1) then |
4 | 322 |
begin |
498 | 323 |
Gear^.Y:= Gear^.Y + _1; |
68 | 324 |
if not TestCollisionYwithGear(Gear, 1) then |
4 | 325 |
begin |
498 | 326 |
Gear^.Y:= Gear^.Y + _1; |
68 | 327 |
if not TestCollisionYwithGear(Gear, 1) then |
4 | 328 |
begin |
498 | 329 |
Gear^.Y:= Gear^.Y + _1; |
68 | 330 |
if not TestCollisionYwithGear(Gear, 1) then |
4 | 331 |
begin |
498 | 332 |
Gear^.Y:= Gear^.Y + _1; |
68 | 333 |
if not TestCollisionYwithGear(Gear, 1) then |
4 | 334 |
begin |
498 | 335 |
Gear^.Y:= Gear^.Y + _1; |
68 | 336 |
if not TestCollisionYwithGear(Gear, 1) then |
4 | 337 |
begin |
498 | 338 |
Gear^.Y:= Gear^.Y + _1; |
68 | 339 |
if not TestCollisionYwithGear(Gear, 1) then |
4 | 340 |
begin |
498 | 341 |
Gear^.Y:= Gear^.Y - _6; |
342 |
Gear^.dY:= _0; |
|
542 | 343 |
Gear^.State:= Gear^.State or gstMoving; |
505
fcba7d7aea0d
Fix old bug with grenade(bomd, etc..) not colliding with attacking hedgehog
unc0rr
parents:
498
diff
changeset
|
344 |
exit |
4 | 345 |
end; |
346 |
end |
|
347 |
end |
|
348 |
end |
|
349 |
end |
|
350 |
end |
|
505
fcba7d7aea0d
Fix old bug with grenade(bomd, etc..) not colliding with attacking hedgehog
unc0rr
parents:
498
diff
changeset
|
351 |
end; |
fcba7d7aea0d
Fix old bug with grenade(bomd, etc..) not colliding with attacking hedgehog
unc0rr
parents:
498
diff
changeset
|
352 |
AddGearCI(Gear) |
4 | 353 |
end |
354 |
end; |
|
355 |
||
303
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
356 |
procedure HedgehogChAngle(Gear: PGear); |
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
357 |
begin |
542 | 358 |
if ((Gear^.State and gstMoving) = 0) then |
351 | 359 |
if (Gear^.Message and gm_Up )<>0 then if Gear^.Angle > CurMinAngle then dec(Gear^.Angle) |
303
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
360 |
else else |
351 | 361 |
if (Gear^.Message and gm_Down )<>0 then if Gear^.Angle < CurMaxAngle then inc(Gear^.Angle); |
303
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
362 |
end; |
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
363 |
|
302 | 364 |
procedure doStepHedgehog(Gear: PGear); forward; |
365 |
//////////////////////////////////////////////////////////////////////////////// |
|
538 | 366 |
procedure doStepHedgehogMoving(Gear: PGear); |
545 | 367 |
var isFalling: boolean; |
538 | 368 |
begin |
855
8842c71d16bf
- Fix too long delay between shotgun and deagle shots
unc0rr
parents:
854
diff
changeset
|
369 |
isFalling:= (Gear^.dY.isNegative) or not TestCollisionYKick(Gear, 1); |
542 | 370 |
if isFalling then |
538 | 371 |
begin |
372 |
if (Gear^.dY.isNegative) and TestCollisionYKick(Gear, -1) then Gear^.dY:= _0; |
|
542 | 373 |
Gear^.State:= Gear^.State or gstMoving; |
538 | 374 |
Gear^.dY:= Gear^.dY + cGravity |
375 |
end else |
|
376 |
begin |
|
377 |
if ((hwAbs(Gear^.dX) + hwAbs(Gear^.dY)) < _0_55) |
|
378 |
and ((Gear^.State and gstHHJumping) <> 0) then SetLittle(Gear^.dX); |
|
379 |
||
540 | 380 |
if not Gear^.dY.isNegative then |
381 |
begin |
|
382 |
CheckHHDamage(Gear); |
|
790
a6f442173822
Make high jump behaviour like in worms (back somersault)
unc0rr
parents:
783
diff
changeset
|
383 |
|
a6f442173822
Make high jump behaviour like in worms (back somersault)
unc0rr
parents:
783
diff
changeset
|
384 |
if ((Gear^.State and gstHHHJump) <> 0) and |
a6f442173822
Make high jump behaviour like in worms (back somersault)
unc0rr
parents:
783
diff
changeset
|
385 |
(Gear^.dX.QWordValue < _0_02.QWordValue) then Gear^.dX.isNegative:= not Gear^.dX.isNegative; // landing after high jump |
a6f442173822
Make high jump behaviour like in worms (back somersault)
unc0rr
parents:
783
diff
changeset
|
386 |
|
542 | 387 |
Gear^.State:= Gear^.State and not (gstHHJumping or gstHHHJump); |
540 | 388 |
Gear^.dY:= _0; |
389 |
end else Gear^.dY:= Gear^.dY + cGravity; |
|
538 | 390 |
|
391 |
if ((Gear^.State and gstMoving) <> 0) then Gear^.dX:= Gear^.dX * Gear^.Friction |
|
392 |
end; |
|
393 |
||
394 |
if (Gear^.State <> 0) then DeleteCI(Gear); |
|
783 | 395 |
|
538 | 396 |
if (Gear^.State and gstMoving) <> 0 then |
397 |
if TestCollisionXKick(Gear, hwSign(Gear^.dX)) then |
|
542 | 398 |
if not isFalling then |
538 | 399 |
if hwAbs(Gear^.dX) > _0_01 then |
400 |
if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -1, hwSign(Gear^.dX)) then begin Gear^.X:= Gear^.X + Gear^.dX; Gear^.dX:= Gear^.dX * _0_96; Gear^.Y:= Gear^.Y - _1 end else |
|
401 |
if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -2, hwSign(Gear^.dX)) then begin Gear^.X:= Gear^.X + Gear^.dX; Gear^.dX:= Gear^.dX * _0_93; Gear^.Y:= Gear^.Y - _2 end else |
|
402 |
if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -3, hwSign(Gear^.dX)) then begin Gear^.X:= Gear^.X + Gear^.dX; Gear^.dX:= Gear^.dX * _0_9 ; Gear^.Y:= Gear^.Y - _3 end else |
|
403 |
if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -4, hwSign(Gear^.dX)) then begin Gear^.X:= Gear^.X + Gear^.dX; Gear^.dX:= Gear^.dX * _0_87; Gear^.Y:= Gear^.Y - _4 end else |
|
404 |
if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -5, hwSign(Gear^.dX)) then begin Gear^.X:= Gear^.X + Gear^.dX; Gear^.dX:= Gear^.dX * _0_84; Gear^.Y:= Gear^.Y - _5 end else |
|
405 |
if hwAbs(Gear^.dX) > _0_02 then Gear^.dX:= -Gear^.Elasticity * Gear^.dX |
|
406 |
else begin |
|
407 |
Gear^.State:= Gear^.State and not gstMoving; |
|
408 |
SetLittle(Gear^.dX) |
|
409 |
end |
|
410 |
else begin |
|
411 |
Gear^.State:= Gear^.State and not gstMoving; |
|
412 |
SetLittle(Gear^.dX) |
|
413 |
end |
|
414 |
else if hwAbs(Gear^.dX) > cLittle then Gear^.dX:= -Gear^.Elasticity * Gear^.dX |
|
415 |
else SetLittle(Gear^.dX); |
|
416 |
||
542 | 417 |
if (not isFalling) and |
538 | 418 |
(hwAbs(Gear^.dX) + hwAbs(Gear^.dY) < _0_03) then |
419 |
begin |
|
420 |
Gear^.State:= Gear^.State and not gstMoving; |
|
421 |
SetLittle(Gear^.dX); |
|
422 |
Gear^.dY:= _0 |
|
423 |
end else Gear^.State:= Gear^.State or gstMoving; |
|
424 |
||
425 |
if (Gear^.State and gstMoving) <> 0 then |
|
426 |
begin |
|
427 |
Gear^.State:= Gear^.State and not gstAnimation; |
|
428 |
Gear^.X:= Gear^.X + Gear^.dX; |
|
429 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
|
430 |
if (not Gear^.dY.isNegative) and |
|
431 |
(not TestCollisionYKick(Gear, 1)) and |
|
432 |
TestCollisionYwithXYShift(Gear, 0, 1, 1) then |
|
433 |
begin |
|
434 |
CheckHHDamage(Gear); |
|
435 |
Gear^.dY:= _0; |
|
436 |
Gear^.Y:= Gear^.Y + _1 |
|
437 |
end; |
|
438 |
CheckGearDrowning(Gear) |
|
439 |
end |
|
440 |
end; |
|
441 |
||
302 | 442 |
procedure doStepHedgehogDriven(Gear: PGear); |
443 |
var t: PGear; |
|
444 |
begin |
|
558
b2b840eeb10a
Fix bug when hedgehog moves not right after it is kicked
unc0rr
parents:
553
diff
changeset
|
445 |
if not isInMultiShoot then |
b2b840eeb10a
Fix bug when hedgehog moves not right after it is kicked
unc0rr
parents:
553
diff
changeset
|
446 |
AllInactive:= false |
b2b840eeb10a
Fix bug when hedgehog moves not right after it is kicked
unc0rr
parents:
553
diff
changeset
|
447 |
else |
b2b840eeb10a
Fix bug when hedgehog moves not right after it is kicked
unc0rr
parents:
553
diff
changeset
|
448 |
Gear^.Message:= 0; |
505
fcba7d7aea0d
Fix old bug with grenade(bomd, etc..) not colliding with attacking hedgehog
unc0rr
parents:
498
diff
changeset
|
449 |
|
351 | 450 |
if (TurnTimeLeft = 0) or (Gear^.Damage > 0) then |
302 | 451 |
begin |
452 |
TurnTimeLeft:= 0; |
|
351 | 453 |
Gear^.State:= Gear^.State and not gstHHDriven; |
454 |
if Gear^.Damage > 0 then |
|
424 | 455 |
Gear^.State:= Gear^.State and not (gstHHJumping or gstHHHJump); |
302 | 456 |
exit |
457 |
end; |
|
542 | 458 |
|
836 | 459 |
if ((Gear^.State and gstMoving) <> 0) |
460 |
or (StepTicks = cHHStepTicks) |
|
835
6f567934cc44
Automatically use parachute when vertical speed is high enough
unc0rr
parents:
829
diff
changeset
|
461 |
or (CurAmmoGear <> nil) then // we're moving |
836 | 462 |
begin |
839 | 463 |
with PHedgehog(Gear^.Hedgehog)^ do |
464 |
if (CurAmmoGear = nil) |
|
465 |
and (Gear^.dY > _0_39) |
|
466 |
and (Ammo^[CurSlot, CurAmmo].AmmoType = amParachute) then Gear^.Message:= Gear^.Message or gm_Attack; |
|
836 | 467 |
// check for case with ammo |
468 |
t:= CheckGearNear(Gear, gtCase, 36, 36); |
|
469 |
if t <> nil then |
|
470 |
PickUp(Gear, t) |
|
855
8842c71d16bf
- Fix too long delay between shotgun and deagle shots
unc0rr
parents:
854
diff
changeset
|
471 |
end; |
302 | 472 |
|
930 | 473 |
if (CurAmmoGear = nil) then |
474 |
if (((Gear^.Message and gm_Attack) <> 0) |
|
475 |
or ((Gear^.State and gstAttacking) <> 0)) then |
|
476 |
Attack(Gear) // should be before others to avoid desync with '/put' msg and changing weapon msgs |
|
477 |
else |
|
478 |
else with PHedgehog(Gear^.Hedgehog)^ do |
|
931 | 479 |
if ((CurAmmoGear^.Ammo^.Propz and ammoprop_AltAttack) <> 0) |
930 | 480 |
and ((Gear^.Message and gm_LJump) <> 0) |
931 | 481 |
and (((Ammo^[CurSlot, CurAmmo].Propz) and ammoprop_AltUse) <> 0) then |
482 |
begin |
|
483 |
Gear^.Message:= Gear^.Message and not gm_LJump; |
|
484 |
Attack(Gear) |
|
485 |
end; |
|
930 | 486 |
|
487 |
if (CurAmmoGear = nil) |
|
488 |
or ((CurAmmoGear^.Ammo^.Propz and ammoprop_AltAttack) <> 0) then |
|
489 |
begin |
|
490 |
if ((Gear^.Message and gm_Slot) <> 0) then ChangeAmmo(Gear); |
|
491 |
||
492 |
if ((Gear^.Message and gm_Weapon) <> 0) then HHSetWeapon(Gear); |
|
493 |
||
494 |
if ((Gear^.Message and gm_Timer) <> 0) then HHSetTimer(Gear); |
|
495 |
end; |
|
496 |
||
302 | 497 |
if CurAmmoGear <> nil then |
498 |
begin |
|
351 | 499 |
CurAmmoGear^.Message:= Gear^.Message; |
302 | 500 |
exit |
501 |
end; |
|
502 |
||
926
d231e007452a
Timer as hedgehog message (avoid possible desync in very rare cases)
unc0rr
parents:
925
diff
changeset
|
503 |
|
542 | 504 |
if (Gear^.State and gstMoving) <> 0 then |
302 | 505 |
begin |
424 | 506 |
if ((Gear^.Message and gm_HJump) <> 0) and |
507 |
((Gear^.State and gstHHJumping) <> 0) and |
|
508 |
((Gear^.State and gstHHHJump) = 0) then |
|
509 |
if (not (hwAbs(Gear^.dX) > cLittle)) and (Gear^.dY < -_0_02) then |
|
302 | 510 |
begin |
542 | 511 |
Gear^.State:= Gear^.State or gstHHHJump or gstMoving; |
351 | 512 |
Gear^.dY:= -_0_25; |
799 | 513 |
Gear^.dX:= -SignAs(_0_02, Gear^.dX); |
514 |
PlaySound(sndJump2, false) |
|
302 | 515 |
end; |
351 | 516 |
Gear^.Message:= Gear^.Message and not (gm_LJump or gm_HJump); |
538 | 517 |
|
518 |
if ((Gear^.State and gstHHJumping) <> 0) and |
|
519 |
TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then SetLittle(Gear^.dX); |
|
520 |
||
521 |
doStepHedgehogMoving(Gear); |
|
542 | 522 |
|
523 |
if (Gear^.State and gstMoving) = 0 then |
|
302 | 524 |
begin |
505
fcba7d7aea0d
Fix old bug with grenade(bomd, etc..) not colliding with attacking hedgehog
unc0rr
parents:
498
diff
changeset
|
525 |
AddGearCI(Gear); |
542 | 526 |
StepTicks:= 350 |
302 | 527 |
end; |
528 |
exit |
|
538 | 529 |
end; |
302 | 530 |
|
558
b2b840eeb10a
Fix bug when hedgehog moves not right after it is kicked
unc0rr
parents:
553
diff
changeset
|
531 |
if not isInMultiShoot then |
b2b840eeb10a
Fix bug when hedgehog moves not right after it is kicked
unc0rr
parents:
553
diff
changeset
|
532 |
begin |
b2b840eeb10a
Fix bug when hedgehog moves not right after it is kicked
unc0rr
parents:
553
diff
changeset
|
533 |
HedgehogChAngle(Gear); |
b2b840eeb10a
Fix bug when hedgehog moves not right after it is kicked
unc0rr
parents:
553
diff
changeset
|
534 |
if StepTicks > 0 then dec(StepTicks); |
b2b840eeb10a
Fix bug when hedgehog moves not right after it is kicked
unc0rr
parents:
553
diff
changeset
|
535 |
if (StepTicks = 0) then HedgehogStep(Gear) |
b2b840eeb10a
Fix bug when hedgehog moves not right after it is kicked
unc0rr
parents:
553
diff
changeset
|
536 |
end |
302 | 537 |
end; |
538 |
||
4 | 539 |
//////////////////////////////////////////////////////////////////////////////// |
540 |
procedure doStepHedgehogFree(Gear: PGear); |
|
511 | 541 |
var prevState: Longword; |
4 | 542 |
begin |
511 | 543 |
prevState:= Gear^.State; |
4 | 544 |
|
538 | 545 |
doStepHedgehogMoving(Gear); |
4 | 546 |
|
865 | 547 |
if (Gear^.State and gstMoving) <> 0 then |
548 |
begin |
|
549 |
AllInactive:= false; |
|
550 |
exit |
|
551 |
end; |
|
4 | 552 |
|
863 | 553 |
if (Gear^.Health = 0) then |
554 |
begin |
|
868 | 555 |
if PrvInactive then |
864 | 556 |
begin |
557 |
Gear^.Timer:= 0; |
|
868 | 558 |
Gear^.State:= Gear^.State or gstHHDeath; |
559 |
Gear^.doStep:= @doStepHedgehogDead; |
|
560 |
PrvInactive:= false; |
|
561 |
AllInactive:= false |
|
864 | 562 |
end; |
863 | 563 |
exit |
564 |
end; |
|
4 | 565 |
|
863 | 566 |
if ((Gear^.State and gstAnimation) = 0) and |
567 |
(prevState <> Gear^.State) then |
|
568 |
begin |
|
569 |
Gear^.State:= gstAnimation; |
|
570 |
Gear^.Timer:= 150 |
|
571 |
end else |
|
572 |
begin |
|
573 |
if Gear^.Timer = 0 then |
|
574 |
begin |
|
575 |
Gear^.State:= 0; |
|
576 |
Gear^.Active:= false; |
|
577 |
AddGearCI(Gear); |
|
578 |
exit |
|
579 |
end else dec(Gear^.Timer) |
|
580 |
end; |
|
581 |
||
582 |
AllInactive:= false |
|
4 | 583 |
end; |
584 |
||
585 |
//////////////////////////////////////////////////////////////////////////////// |
|
586 |
procedure doStepHedgehog(Gear: PGear); |
|
587 |
begin |
|
351 | 588 |
if (Gear^.Message and gm_Destroy) <> 0 then |
4 | 589 |
begin |
590 |
DeleteGear(Gear); |
|
591 |
exit |
|
592 |
end; |
|
351 | 593 |
if (Gear^.State and gstHHDriven) = 0 then doStepHedgehogFree(Gear) |
511 | 594 |
else doStepHedgehogDriven(Gear) |
4 | 595 |
end; |