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