author | nemo |
Mon, 06 Sep 2010 16:23:47 -0400 | |
changeset 3836 | 833c0f32e326 |
parent 3768 | 39947624dabb |
child 3837 | 47a623d9cdaa |
permissions | -rw-r--r-- |
4 | 1 |
(* |
1066 | 2 |
* Hedgewars, a free turn based strategy game |
3236
4ab3917d7d44
Update (c) lines to 2010 as unc0rr requested - they all had varying values so I just took the first year mentioned, then tacked on -2010
nemo
parents:
3196
diff
changeset
|
3 |
* Copyright (c) 2004-2010 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 |
//////////////////////////////////////////////////////////////////////////////// |
3682 | 20 |
|
21 |
procedure HHHurt(Hedgehog: PHedgehog; Source: TDamageSource); |
|
22 |
begin |
|
23 |
if (Source = dsFall) or (Source = dsExplosion) then |
|
24 |
case random(3) of |
|
25 |
0: PlaySound(sndOoff1, Hedgehog^.Team^.voicepack); |
|
26 |
1: PlaySound(sndOoff2, Hedgehog^.Team^.voicepack); |
|
27 |
2: PlaySound(sndOoff3, Hedgehog^.Team^.voicepack); |
|
28 |
end |
|
29 |
else if (Source = dsPoison) then |
|
30 |
case random(2) of |
|
31 |
0: PlaySound(sndPoisonCough, Hedgehog^.Team^.voicepack); |
|
32 |
1: PlaySound(sndPoisonMoan, Hedgehog^.Team^.voicepack); |
|
33 |
end |
|
34 |
else |
|
35 |
case random(4) of |
|
36 |
0: PlaySound(sndOw1, Hedgehog^.Team^.voicepack); |
|
37 |
1: PlaySound(sndOw2, Hedgehog^.Team^.voicepack); |
|
38 |
2: PlaySound(sndOw3, Hedgehog^.Team^.voicepack); |
|
39 |
3: PlaySound(sndOw4, Hedgehog^.Team^.voicepack); |
|
40 |
end |
|
41 |
end; |
|
42 |
||
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
43 |
// Shouldn't more of this ammo switching stuff be moved to uAmmos ? |
783 | 44 |
procedure ChangeAmmo(Gear: PGear); |
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
45 |
var slot, ammoidx, i: Longword; |
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
46 |
CurWeapon: PAmmo; |
783 | 47 |
begin |
48 |
slot:= Gear^.MsgParam; |
|
49 |
||
50 |
with PHedgehog(Gear^.Hedgehog)^ do |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
51 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
52 |
Gear^.Message:= Gear^.Message and not gm_Slot; |
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
53 |
ammoidx:= 0; |
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
54 |
while (ammoidx < cMaxSlotAmmoIndex) and (Ammo^[slot, ammoidx].AmmoType <> CurAmmoType) do inc(ammoidx); |
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
55 |
CurWeapon:= @Ammo^[slot, ammoidx]; |
2376 | 56 |
|
3396
e5b3e5f2818e
More portal changes. Allows for a multishoot utility. Hopefully not breaking anything.
nemo
parents:
3391
diff
changeset
|
57 |
if ((Gear^.State and (gstAttacking or gstAttacked)) <> 0) or |
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
58 |
((MultiShootAttacks > 0) and ((CurWeapon^.Propz and ammoprop_NoRoundEndHint) = 0)) or |
3396
e5b3e5f2818e
More portal changes. Allows for a multishoot utility. Hopefully not breaking anything.
nemo
parents:
3391
diff
changeset
|
59 |
((Gear^.State and gstHHDriven) = 0) then exit; |
783 | 60 |
|
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
61 |
if ((CurWeapon^.Propz and ammoprop_NoRoundEndHint) <> 0) and (MultiShootAttacks > 0) then OnUsedAmmo(PHedgehog(Gear^.Hedgehog)^); |
3430 | 62 |
|
3396
e5b3e5f2818e
More portal changes. Allows for a multishoot utility. Hopefully not breaking anything.
nemo
parents:
3391
diff
changeset
|
63 |
MultiShootAttacks:= 0; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
64 |
Gear^.Message:= Gear^.Message and not (gm_LJump or gm_HJump); |
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
65 |
|
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
66 |
if Ammoz[CurAmmoType].Slot = slot then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
67 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
68 |
i:= 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
69 |
repeat |
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
70 |
inc(ammoidx); |
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
71 |
if (ammoidx > cMaxSlotAmmoIndex) then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
72 |
begin |
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
73 |
ammoidx:= 0; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
74 |
inc(i); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
75 |
TryDo(i < 2, 'Engine bug: no ammo in current slot', true) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
76 |
end; |
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
77 |
until (Ammo^[slot, ammoidx].Count > 0) and (Team^.Clan^.TurnNumber > Ammoz[Ammo^[slot, ammoidx].AmmoType].SkipTurns) |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
78 |
end else |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
79 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
80 |
i:= 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
81 |
// check whether there is ammo in slot |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
82 |
while (i <= cMaxSlotAmmoIndex) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
83 |
and ((Ammo^[slot, i].Count = 0) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
84 |
or (Team^.Clan^.TurnNumber <= Ammoz[Ammo^[slot, i].AmmoType].SkipTurns)) do inc(i); |
2376 | 85 |
|
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
86 |
if i <= cMaxSlotAmmoIndex then ammoidx:= i |
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
87 |
end; |
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
88 |
CurAmmoType:= Ammo^[slot, ammoidx].AmmoType; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
89 |
end |
783 | 90 |
end; |
91 |
||
92 |
procedure HHSetWeapon(Gear: PGear); |
|
93 |
var t: LongInt; |
|
94 |
weap: TAmmoType; |
|
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
95 |
Hedgehog: PHedgehog; |
783 | 96 |
begin |
97 |
weap:= TAmmoType(Gear^.MsgParam); |
|
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
98 |
Hedgehog:= PHedgehog(Gear^.Hedgehog); |
941
b5222ddafe1f
- Fix bug with picking up ammos from cases, when total ammo count may become more than AMMO_INFINITE
unc0rr
parents:
931
diff
changeset
|
99 |
|
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
100 |
if Hedgehog^.Team^.Clan^.TurnNumber <= Ammoz[weap].SkipTurns then exit; // weapon is not activated yet |
941
b5222ddafe1f
- Fix bug with picking up ammos from cases, when total ammo count may become more than AMMO_INFINITE
unc0rr
parents:
931
diff
changeset
|
101 |
|
783 | 102 |
Gear^.MsgParam:= Ammoz[weap].Slot; |
103 |
||
104 |
t:= cMaxSlotAmmoIndex; |
|
105 |
||
106 |
Gear^.Message:= Gear^.Message and not gm_Weapon; |
|
107 |
||
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
108 |
with Hedgehog^ do |
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
109 |
while (CurAmmoType <> weap) and (t >= 0) do |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
110 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
111 |
ChangeAmmo(Gear); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
112 |
dec(t) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
113 |
end; |
1710
cecb3cc93251
Fix angle restriction applying to rc plane when choosing via ammomenu
unc0rr
parents:
1689
diff
changeset
|
114 |
|
cecb3cc93251
Fix angle restriction applying to rc plane when choosing via ammomenu
unc0rr
parents:
1689
diff
changeset
|
115 |
ApplyAmmoChanges(PHedgehog(Gear^.Hedgehog)^) |
783 | 116 |
end; |
117 |
||
926
d231e007452a
Timer as hedgehog message (avoid possible desync in very rare cases)
unc0rr
parents:
925
diff
changeset
|
118 |
procedure HHSetTimer(Gear: PGear); |
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
119 |
var CurWeapon: PAmmo; |
926
d231e007452a
Timer as hedgehog message (avoid possible desync in very rare cases)
unc0rr
parents:
925
diff
changeset
|
120 |
begin |
d231e007452a
Timer as hedgehog message (avoid possible desync in very rare cases)
unc0rr
parents:
925
diff
changeset
|
121 |
Gear^.Message:= Gear^.Message and not gm_Timer; |
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
122 |
CurWeapon:= GetAmmoEntry(PHedgehog(Gear^.Hedgehog)^); |
926
d231e007452a
Timer as hedgehog message (avoid possible desync in very rare cases)
unc0rr
parents:
925
diff
changeset
|
123 |
with PHedgehog(Gear^.Hedgehog)^ do |
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
124 |
if (CurWeapon^.Propz and ammoprop_Timerable) <> 0 then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
125 |
begin |
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
126 |
CurWeapon^.Timer:= 1000 * Gear^.MsgParam; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
127 |
with CurrentTeam^ do |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
128 |
ApplyAmmoChanges(Hedgehogs[CurrHedgehog]); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
129 |
end; |
926
d231e007452a
Timer as hedgehog message (avoid possible desync in very rare cases)
unc0rr
parents:
925
diff
changeset
|
130 |
end; |
d231e007452a
Timer as hedgehog message (avoid possible desync in very rare cases)
unc0rr
parents:
925
diff
changeset
|
131 |
|
d231e007452a
Timer as hedgehog message (avoid possible desync in very rare cases)
unc0rr
parents:
925
diff
changeset
|
132 |
|
32
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
16
diff
changeset
|
133 |
procedure Attack(Gear: PGear); |
3483 | 134 |
var xx, yy, lx, ly: hwFloat; |
2042
905c554d62e6
Move Speech to visual gears. This checkin CRASHES on deletion of visual gear outside the doStep
nemo
parents:
2041
diff
changeset
|
135 |
tmpGear: PVisualGear; |
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
136 |
CurWeapon: PAmmo; |
32
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
16
diff
changeset
|
137 |
begin |
2807 | 138 |
bShowFinger:= false; |
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
139 |
CurWeapon:= GetAmmoEntry(PHedgehog(Gear^.Hedgehog)^); |
32
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
16
diff
changeset
|
140 |
with Gear^, |
351 | 141 |
PHedgehog(Gear^.Hedgehog)^ do |
32
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
16
diff
changeset
|
142 |
begin |
95 | 143 |
if ((State and gstHHDriven) <> 0)and |
2223
e009fee03c96
allow attacks while moving on ammo with alt attack (parachute/rope/jetpack) - needs testing.
nemo
parents:
2221
diff
changeset
|
144 |
((State and (gstAttacked or gstHHChooseTarget)) = 0) and |
2376 | 145 |
(((State and gstMoving) = 0) or |
2223
e009fee03c96
allow attacks while moving on ammo with alt attack (parachute/rope/jetpack) - needs testing.
nemo
parents:
2221
diff
changeset
|
146 |
// Allow attacks while moving on ammo with AltAttack |
3302
0973c5af5141
Add reference to ammo at time of gear creation to allow switching to work on jetpack/parachute
nemo
parents:
3236
diff
changeset
|
147 |
((CurAmmoGear <> nil) and ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0)) or |
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
148 |
((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AttackInMove) <> 0)) and |
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
149 |
((TargetPoint.X <> NoPointX) or ((Ammoz[CurAmmoType].Ammo.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
|
150 |
begin |
95 | 151 |
State:= State or gstAttacking; |
152 |
if Power = cMaxPower then Message:= Message and not gm_Attack |
|
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
153 |
else if (Ammoz[CurAmmoType].Ammo.Propz and ammoprop_Power) = 0 then Message:= Message and not gm_Attack |
95 | 154 |
else begin |
155 |
if Power = 0 then |
|
156 |
begin |
|
351 | 157 |
AttackBar:= CurrentTeam^.AttackBar; |
2745 | 158 |
PlaySound(sndThrowPowerUp) |
95 | 159 |
end; |
160 |
inc(Power) |
|
161 |
end; |
|
162 |
if ((Message and gm_Attack) <> 0) then exit; |
|
351 | 163 |
|
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
164 |
if (Ammoz[CurAmmoType].Ammo.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
|
165 |
begin |
282 | 166 |
StopSound(sndThrowPowerUp); |
2745 | 167 |
PlaySound(sndThrowRelease); |
32
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
16
diff
changeset
|
168 |
end; |
1922 | 169 |
|
519 | 170 |
xx:= SignAs(AngleSin(Angle), dX); |
900 | 171 |
yy:= -AngleCos(Angle); |
172 |
||
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
173 |
lx:= X + int2hwfloat(round(GetLaunchX(CurAmmoType, hwSign(dX), Angle))); |
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
174 |
ly:= Y + int2hwfloat(round(GetLaunchY(CurAmmoType, Angle))); |
3483 | 175 |
|
3469 | 176 |
if ((Gear^.State and gstHHHJump) <> 0) and (not cArtillery) then xx:= - xx; |
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
177 |
if Ammoz[CurAmmoType].Ammo.AttackVoice <> sndNone then |
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
178 |
PlaySound(Ammoz[CurAmmoType].Ammo.AttackVoice, CurrentTeam^.voicepack); |
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
179 |
case CurAmmoType of |
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
180 |
amGrenade: FollowGear:= AddGear(hwRound(lx), hwRound(ly), gtAmmo_Bomb, 0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, CurWeapon^.Timer); |
3483 | 181 |
amMolotov: FollowGear:= AddGear(hwRound(lx), hwRound(ly), gtMolotov, 0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 0); |
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
182 |
amClusterBomb: FollowGear:= AddGear(hwRound(lx), hwRound(ly), gtClusterBomb, 0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, CurWeapon^.Timer); |
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
183 |
amGasBomb: FollowGear:= AddGear(hwRound(lx), hwRound(ly), gtGasBomb, 0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, CurWeapon^.Timer); |
3483 | 184 |
amBazooka: FollowGear:= AddGear(hwRound(lx), hwRound(ly), gtAmmo_Grenade, 0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 0); |
185 |
amBee: FollowGear:= AddGear(hwRound(lx), hwRound(ly), gtBee, 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
|
186 |
amShotgun: begin |
2745 | 187 |
PlaySound(sndShotgunReload); |
3483 | 188 |
CurAmmoGear:= AddGear(hwRound(lx), hwRound(ly), 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
|
189 |
end; |
3483 | 190 |
amPickHammer: CurAmmoGear:= AddGear(hwRound(lx), hwRound(ly) + cHHRadius, gtPickHammer, 0, _0, _0, 0); |
866 | 191 |
amSkip: ParseCommand('/skip', true); |
3483 | 192 |
amRope: CurAmmoGear:= AddGear(hwRound(lx), hwRound(ly), gtRope, 0, xx, yy, 0); |
193 |
amMine: AddGear(hwRound(lx) + hwSign(dX) * 7, hwRound(ly), gtMine, gstWait, SignAs(_0_02, dX), _0, 3000); |
|
3710 | 194 |
amSMine: FollowGear:= AddGear(hwRound(lx), hwRound(ly), gtSMine, 0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 0); |
3483 | 195 |
amDEagle: CurAmmoGear:= AddGear(hwRound(lx + xx * cHHRadius), hwRound(ly + yy * cHHRadius), gtDEagleShot, 0, xx * _0_5, yy * _0_5, 0); |
196 |
amSineGun: CurAmmoGear:= AddGear(hwRound(lx + xx * cHHRadius), hwRound(ly + yy * cHHRadius), gtSineGunShot, 0, xx * _0_5, yy * _0_5, 0); |
|
197 |
amPortalGun: AddGear(hwRound(lx + xx * cHHRadius), hwRound(ly + yy * cHHRadius), gtPortal, 0, xx * _0_6, yy * _0_6, 0); |
|
2827 | 198 |
amSniperRifle: begin |
199 |
PlaySound(sndSniperReload); |
|
3483 | 200 |
CurAmmoGear:= AddGear(hwRound(lx + xx * cHHRadius), hwRound(ly + yy * cHHRadius), gtSniperRifleShot, 0, xx * _0_5, yy * _0_5, 0); |
2827 | 201 |
end; |
3483 | 202 |
amDynamite: AddGear(hwRound(lx) + hwSign(dX) * 7, hwRound(ly), gtDynamite, 0, SignAs(_0_03, dX), _0, 5000); |
203 |
amFirePunch: CurAmmoGear:= AddGear(hwRound(lx) + hwSign(dX) * 10, hwRound(ly), gtFirePunch, 0, xx, _0, 0); |
|
1712 | 204 |
amWhip: begin |
3483 | 205 |
CurAmmoGear:= AddGear(hwRound(lx) + hwSign(dX) * 10, hwRound(ly), gtWhip, 0, SignAs(_1, dX), - _0_8, 0); |
2745 | 206 |
PlaySound(sndWhipCrack) |
1712 | 207 |
end; |
3717 | 208 |
amHammer: begin |
209 |
CurAmmoGear:= AddGear(hwRound(lx) + hwSign(dX) * 10, hwRound(ly), gtHammer, 0, SignAs(_1, dX), - _0_8, 0); |
|
210 |
PlaySound(sndWhack) |
|
211 |
end; |
|
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
|
212 |
amBaseballBat: begin |
3483 | 213 |
CurAmmoGear:= AddGear(hwRound(lx) + hwSign(dX) * 10, hwRound(ly), gtShover, gsttmpFlag, xx * _0_5, yy * _0_5, 0); |
2996 | 214 |
PlaySound(sndBaseballBat) // TODO: Only play if something is hit? |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
215 |
end; |
3483 | 216 |
amParachute: CurAmmoGear:= AddGear(hwRound(lx), hwRound(ly), gtParachute, 0, _0, _0, 0); |
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
217 |
// we save CurWeapon^.Pos (in this case: cursor direction) by using it as (otherwise irrelevant) X value of the new gear. |
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
218 |
amAirAttack: AddGear(CurWeapon^.Pos, 0, gtAirAttack, 0, _0, _0, 0); |
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
219 |
amMineStrike: AddGear(CurWeapon^.Pos, 0, gtAirAttack, 1, _0, _0, 0); |
3483 | 220 |
amBlowTorch: CurAmmoGear:= AddGear(hwRound(lx), hwRound(ly), gtBlowTorch, 0, SignAs(_0_5, dX), _0, 0); |
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
221 |
amGirder: CurAmmoGear:= AddGear(0, 0, gtGirder, CurWeapon^.Pos, _0, _0, 0); |
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
222 |
amTeleport: CurAmmoGear:= AddGear(CurWeapon^.Pos, 0, gtTeleport, 0, _0, _0, 0); |
3483 | 223 |
amSwitch: CurAmmoGear:= AddGear(hwRound(lx), hwRound(ly), gtSwitcher, 0, _0, _0, 0); |
2262 | 224 |
amMortar: begin |
3483 | 225 |
playSound(sndMortar); |
226 |
FollowGear:= AddGear(hwRound(lx), hwRound(ly), gtMortar, 0, xx*cMaxPower/cPowerDivisor, yy*cMaxPower/cPowerDivisor, 0); |
|
227 |
end; |
|
1712 | 228 |
amRCPlane: begin |
3483 | 229 |
CurAmmoGear:= AddGear(hwRound(lx), hwRound(ly), gtRCPlane, 0, xx * cMaxPower / cPowerDivisor / 4, yy * cMaxPower / cPowerDivisor / 4, 0); |
2745 | 230 |
CurAmmoGear^.SoundChannel:= LoopSound(sndRCPlane, nil) |
1712 | 231 |
end; |
3483 | 232 |
amKamikaze: CurAmmoGear:= AddGear(hwRound(lx), hwRound(ly), gtKamikaze, 0, xx * _0_5, yy * _0_5, 0); |
233 |
amCake: CurAmmoGear:= AddGear(hwRound(lx) + hwSign(dX) * 3, hwRound(ly), gtCake, 0, xx, _0, 0); |
|
234 |
amSeduction: CurAmmoGear:= AddGear(hwRound(lx + xx * cHHRadius * 2), hwRound(ly + yy * cHHRadius * 2), gtSeduction, 0, xx * _0_4, yy * _0_4, 0); |
|
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
235 |
amWatermelon: FollowGear:= AddGear(hwRound(lx), hwRound(ly), gtWatermelon, 0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, CurWeapon^.Timer); |
3483 | 236 |
amHellishBomb: FollowGear:= AddGear(hwRound(lx), hwRound(ly), gtHellishBomb, 0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 0); |
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
237 |
amNapalm: AddGear(CurWeapon^.Pos, 0, gtAirAttack, 2, _0, _0, 0); |
3483 | 238 |
amDrill: FollowGear:= AddGear(hwRound(lx), hwRound(ly), gtDrill, 0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 0); |
3484 | 239 |
amBallgun: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtBallgun, 0, xx * _0_5, yy * _0_5, 0); |
3483 | 240 |
amJetpack: CurAmmoGear:= AddGear(hwRound(lx), hwRound(ly), gtJetpack, 0, _0, _0, 0); |
3123 | 241 |
amBirdy: begin |
242 |
PlaySound(sndWhistle); |
|
3483 | 243 |
CurAmmoGear:= AddGear(hwRound(lx), hwRound(ly) - 32, gtBirdy, 0, _0, _0, 0); |
3123 | 244 |
end; |
2908 | 245 |
amLowGravity: begin |
246 |
PlaySound(sndLowGravity); |
|
3355
dc9e61e67484
cWindSpeed recalculation assumed GetRandom returns a value between 0.0-1.0 while in fact is in the 0.0-0.5 range; Halve cMaxWindSpeed to compensate.
palewolf
parents:
3351
diff
changeset
|
247 |
cGravity:= cMaxWindSpeed |
2908 | 248 |
end; |
1849 | 249 |
amExtraDamage: cDamageModifier:= _1_5; |
250 |
amInvulnerable: Invulnerable:= true; |
|
251 |
amExtraTime: TurnTimeLeft:= TurnTimeLeft + 30000; |
|
1854 | 252 |
amLaserSight: cLaserSighting:= true; |
3483 | 253 |
amVampiric: begin |
254 |
PlaySound(sndOw1, Team^.voicepack); |
|
255 |
cVampiric:= true; |
|
256 |
end; |
|
3351 | 257 |
amPiano: begin |
3399 | 258 |
// Tuck the hedgehog away until the piano attack is completed |
259 |
Unplaced:= true; |
|
260 |
X:= _0; |
|
261 |
Y:= _0; |
|
3351 | 262 |
FollowGear:= AddGear(TargetPoint.X, 0, gtPiano, 0, _0, _0, 0); |
263 |
PauseMusic |
|
264 |
end; |
|
3484 | 265 |
amFlamethrower: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtFlamethrower, 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
|
266 |
end; |
829 | 267 |
|
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
268 |
uStats.AmmoUsed(CurAmmoType); |
829 | 269 |
|
2017 | 270 |
if not (SpeechText = '') then |
271 |
begin |
|
2042
905c554d62e6
Move Speech to visual gears. This checkin CRASHES on deletion of visual gear outside the doStep
nemo
parents:
2041
diff
changeset
|
272 |
tmpGear:= AddVisualGear(0, 0, vgtSpeechBubble); |
2115 | 273 |
if tmpGear <> nil then |
274 |
begin |
|
275 |
tmpGear^.Text:= SpeechText; |
|
276 |
tmpGear^.Hedgehog:= Gear^.Hedgehog; |
|
277 |
tmpGear^.FrameTicks:= SpeechType; |
|
278 |
end; |
|
2017 | 279 |
SpeechText:= '' |
280 |
end; |
|
281 |
||
32
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
16
diff
changeset
|
282 |
Power:= 0; |
930 | 283 |
if (CurAmmoGear <> nil) |
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
284 |
and ((Ammoz[CurAmmoType].Ammo.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
|
285 |
begin |
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
286 |
CurAmmoGear^.AmmoType:= CurAmmoType; |
82 | 287 |
Message:= Message or gm_Attack; |
351 | 288 |
CurAmmoGear^.Message:= Message |
82 | 289 |
end else begin |
351 | 290 |
if not CurrentTeam^.ExtDriven and |
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
291 |
((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_Power) <> 0) then SendIPC('a'); |
1849 | 292 |
AfterAttack; |
82 | 293 |
end |
1849 | 294 |
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
|
295 |
end |
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
16
diff
changeset
|
296 |
end; |
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
16
diff
changeset
|
297 |
|
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
16
diff
changeset
|
298 |
procedure AfterAttack; |
2502 | 299 |
var s: shortstring; |
32
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
16
diff
changeset
|
300 |
begin |
602 | 301 |
with CurrentHedgehog^.Gear^, |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
302 |
CurrentHedgehog^ do |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
303 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
304 |
State:= State and not gstAttacking; |
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
305 |
if (Ammoz[CurAmmoType].Ammo.Propz and ammoprop_Effect) = 0 then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
306 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
307 |
Inc(MultiShootAttacks); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
308 |
|
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
309 |
if (Ammoz[CurAmmoType].Ammo.NumPerTurn >= MultiShootAttacks) then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
310 |
begin |
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
311 |
s:= inttostr(Ammoz[CurAmmoType].Ammo.NumPerTurn - MultiShootAttacks + 1); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
312 |
AddCaption(format(trmsg[sidRemaining], s), cWhiteColor, capgrpAmmostate); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
313 |
end; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
314 |
|
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
315 |
if (Ammoz[CurAmmoType].Ammo.NumPerTurn >= MultiShootAttacks) or |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
316 |
((GameFlags and gfMultiWeapon) <> 0) then |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
317 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
318 |
isInMultiShoot:= true |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
319 |
end |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
320 |
else |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
321 |
begin |
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
322 |
if (Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoRoundEndHint) = 0 then |
3396
e5b3e5f2818e
More portal changes. Allows for a multishoot utility. Hopefully not breaking anything.
nemo
parents:
3391
diff
changeset
|
323 |
begin |
3431 | 324 |
OnUsedAmmo(CurrentHedgehog^); |
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
325 |
TurnTimeLeft:= Ammoz[CurAmmoType].TimeAfterTurn; |
3396
e5b3e5f2818e
More portal changes. Allows for a multishoot utility. Hopefully not breaking anything.
nemo
parents:
3391
diff
changeset
|
326 |
State:= State or gstAttacked |
3430 | 327 |
end |
328 |
else |
|
3431 | 329 |
begin |
330 |
OnUsedAmmo(CurrentHedgehog^); |
|
331 |
ApplyAmmoChanges(CurrentHedgehog^) |
|
332 |
end |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
333 |
end; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
334 |
end |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
335 |
else |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
336 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
337 |
OnUsedAmmo(CurrentHedgehog^); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
338 |
ApplyAmmoChanges(CurrentHedgehog^); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
339 |
end; |
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
340 |
AttackBar:= 0 |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
341 |
end |
32
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
16
diff
changeset
|
342 |
end; |
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
16
diff
changeset
|
343 |
|
42 | 344 |
//////////////////////////////////////////////////////////////////////////////// |
863 | 345 |
procedure doStepHedgehogDead(Gear: PGear); |
868 | 346 |
const frametime = 200; |
347 |
timertime = frametime * 6; |
|
863 | 348 |
begin |
2769
82bfcc006afb
Some handling of interaction between king mode and place hogs mode.
nemo
parents:
2762
diff
changeset
|
349 |
if PHedgehog(Gear^.Hedgehog)^.Unplaced then exit; |
863 | 350 |
if Gear^.Timer > 1 then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
351 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
352 |
AllInactive:= false; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
353 |
dec(Gear^.Timer); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
354 |
if (Gear^.Timer mod frametime) = 0 then inc(Gear^.Pos) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
355 |
end else |
863 | 356 |
if Gear^.Timer = 1 then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
357 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
358 |
Gear^.State:= Gear^.State or gstNoDamage; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
359 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, EXPLAutoSound); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
360 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtGrave, 0, _0, _0, 0)^.Hedgehog:= Gear^.Hedgehog; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
361 |
DeleteGear(Gear); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
362 |
SetAllToActive |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
363 |
end else // Gear^.Timer = 0 |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
364 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
365 |
AllInactive:= false; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
366 |
Gear^.Z:= cCurrHHZ; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
367 |
RemoveGearFromList(Gear); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
368 |
InsertGearToList(Gear); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
369 |
PlaySound(sndByeBye, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
370 |
Gear^.Pos:= 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
371 |
Gear^.Timer:= timertime |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
372 |
end |
863 | 373 |
end; |
374 |
||
375 |
//////////////////////////////////////////////////////////////////////////////// |
|
3310 | 376 |
procedure doStepHedgehogGone(Gear: PGear); |
377 |
const frametime = 65; |
|
378 |
timertime = frametime * 11; |
|
379 |
begin |
|
380 |
if PHedgehog(Gear^.Hedgehog)^.Unplaced then exit; |
|
381 |
if Gear^.Timer > 1 then |
|
382 |
begin |
|
383 |
AllInactive:= false; |
|
384 |
dec(Gear^.Timer); |
|
385 |
if (Gear^.Timer mod frametime) = 0 then inc(Gear^.Pos) |
|
386 |
end else |
|
387 |
if Gear^.Timer = 1 then |
|
388 |
begin |
|
389 |
DeleteGear(Gear); |
|
390 |
SetAllToActive |
|
391 |
end else // Gear^.Timer = 0 |
|
392 |
begin |
|
393 |
AllInactive:= false; |
|
394 |
Gear^.Z:= cCurrHHZ; |
|
395 |
RemoveGearFromList(Gear); |
|
396 |
InsertGearToList(Gear); |
|
397 |
PlaySound(sndByeBye, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack); |
|
398 |
PlaySound(sndWarp); |
|
399 |
Gear^.Pos:= 0; |
|
400 |
Gear^.Timer:= timertime |
|
401 |
end |
|
402 |
end; |
|
403 |
||
404 |
//////////////////////////////////////////////////////////////////////////////// |
|
42 | 405 |
procedure PickUp(HH, Gear: PGear); |
295 | 406 |
var s: shortstring; |
407 |
a: TAmmoType; |
|
3169
c8c6ac44f51b
prophylactic removal of some Integer references, raise a few of the template islands up a bit so they work inverted without triggering border
nemo
parents:
3161
diff
changeset
|
408 |
i: LongInt; |
2972
82828fd23dea
Patch by soreau (polished by me): show floating away ammo icon when you pick up a crate
unc0rr
parents:
2948
diff
changeset
|
409 |
vga: PVisualGear; |
42 | 410 |
begin |
351 | 411 |
Gear^.Message:= gm_Destroy; |
2745 | 412 |
PlaySound(sndShotgunReload); |
351 | 413 |
case Gear^.Pos of |
1964 | 414 |
posCaseUtility, |
295 | 415 |
posCaseAmmo: begin |
351 | 416 |
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
|
417 |
AddAmmo(PHedgehog(HH^.Hedgehog)^, a); |
2853
953a6d71396f
Restore shared clan ammo (still needs flag), add ammo info message if the person who picked up the ammo was a member of your clan
nemo
parents:
2827
diff
changeset
|
418 |
// Possibly needs to check shared clan ammo game flag once added. |
953a6d71396f
Restore shared clan ammo (still needs flag), add ammo info message if the person who picked up the ammo was a member of your clan
nemo
parents:
2827
diff
changeset
|
419 |
// On the other hand, no obvious reason that clan members shouldn't know what ammo another clan member picked up |
953a6d71396f
Restore shared clan ammo (still needs flag), add ammo info message if the person who picked up the ammo was a member of your clan
nemo
parents:
2827
diff
changeset
|
420 |
if (not (PHedgehog(HH^.Hedgehog)^.Team^.ExtDriven |
1072 | 421 |
or (PHedgehog(HH^.Hedgehog)^.BotLevel > 0))) |
2972
82828fd23dea
Patch by soreau (polished by me): show floating away ammo icon when you pick up a crate
unc0rr
parents:
2948
diff
changeset
|
422 |
or (PHedgehog(HH^.Hedgehog)^.Team^.Clan^.ClanIndex = LocalClan) |
82828fd23dea
Patch by soreau (polished by me): show floating away ammo icon when you pick up a crate
unc0rr
parents:
2948
diff
changeset
|
423 |
or (GameType = gmtDemo) then |
82828fd23dea
Patch by soreau (polished by me): show floating away ammo icon when you pick up a crate
unc0rr
parents:
2948
diff
changeset
|
424 |
begin |
3196 | 425 |
s:= trammo[Ammoz[a].NameId] + ' (+' + IntToStr(Ammoz[a].NumberInCase) + ')'; |
2972
82828fd23dea
Patch by soreau (polished by me): show floating away ammo icon when you pick up a crate
unc0rr
parents:
2948
diff
changeset
|
426 |
AddCaption(s, PHedgehog(HH^.Hedgehog)^.Team^.Clan^.Color, capgrpAmmoinfo); |
82828fd23dea
Patch by soreau (polished by me): show floating away ammo icon when you pick up a crate
unc0rr
parents:
2948
diff
changeset
|
427 |
|
82828fd23dea
Patch by soreau (polished by me): show floating away ammo icon when you pick up a crate
unc0rr
parents:
2948
diff
changeset
|
428 |
// show ammo icon |
82828fd23dea
Patch by soreau (polished by me): show floating away ammo icon when you pick up a crate
unc0rr
parents:
2948
diff
changeset
|
429 |
vga:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtAmmo); |
82828fd23dea
Patch by soreau (polished by me): show floating away ammo icon when you pick up a crate
unc0rr
parents:
2948
diff
changeset
|
430 |
if vga <> nil then |
82828fd23dea
Patch by soreau (polished by me): show floating away ammo icon when you pick up a crate
unc0rr
parents:
2948
diff
changeset
|
431 |
vga^.Frame:= Longword(a); |
82828fd23dea
Patch by soreau (polished by me): show floating away ammo icon when you pick up a crate
unc0rr
parents:
2948
diff
changeset
|
432 |
end; |
82828fd23dea
Patch by soreau (polished by me): show floating away ammo icon when you pick up a crate
unc0rr
parents:
2948
diff
changeset
|
433 |
|
295 | 434 |
end; |
42 | 435 |
posCaseHealth: begin |
351 | 436 |
inc(HH^.Health, Gear^.Health); |
3112 | 437 |
PHedgehog(HH^.Hedgehog)^.Effects[hePoisoned] := false; |
351 | 438 |
str(Gear^.Health, s); |
295 | 439 |
s:= '+' + s; |
549 | 440 |
AddCaption(s, PHedgehog(HH^.Hedgehog)^.Team^.Clan^.Color, capgrpAmmoinfo); |
351 | 441 |
RenderHealth(PHedgehog(HH^.Hedgehog)^); |
2428 | 442 |
RecountTeamHealth(PHedgehog(HH^.Hedgehog)^.Team); |
443 |
||
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
444 |
i:= 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
445 |
while i < Gear^.Health do |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
446 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
447 |
AddVisualGear(hwRound(HH^.X), hwRound(HH^.Y), vgtHealth); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
448 |
inc(i, 5); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
449 |
end; |
42 | 450 |
end; |
435 | 451 |
end |
42 | 452 |
end; |
32
78bff13b11c0
With this patch the game doesn't crash when gaming by net
unc0rr
parents:
16
diff
changeset
|
453 |
|
4 | 454 |
const StepTicks: LongWord = 0; |
455 |
||
302 | 456 |
procedure HedgehogStep(Gear: PGear); |
371 | 457 |
var PrevdX: LongInt; |
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
458 |
CurWeapon: PAmmo; |
302 | 459 |
begin |
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
460 |
CurWeapon:= GetAmmoEntry(PHedgehog(Gear^.Hedgehog)^); |
542 | 461 |
if ((Gear^.State and (gstAttacking or gstMoving)) = 0) then |
4 | 462 |
begin |
408 | 463 |
if isCursorVisible then |
464 |
with PHedgehog(Gear^.Hedgehog)^ do |
|
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
465 |
with CurWeapon^ do |
408 | 466 |
begin |
542 | 467 |
if (Gear^.Message and gm_Left ) <> 0 then |
3407 | 468 |
Pos:= (Pos - 1 + Ammoz[AmmoType].PosCount) mod Ammoz[AmmoType].PosCount |
408 | 469 |
else |
542 | 470 |
if (Gear^.Message and gm_Right ) <> 0 then |
408 | 471 |
Pos:= (Pos + 1) mod Ammoz[AmmoType].PosCount |
472 |
else exit; |
|
423 | 473 |
StepTicks:= 200; |
408 | 474 |
exit |
475 |
end; |
|
505
fcba7d7aea0d
Fix old bug with grenade(bomd, etc..) not colliding with attacking hedgehog
unc0rr
parents:
498
diff
changeset
|
476 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
477 |
if ((Gear^.Message and gm_Animate) <> 0) then |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
478 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
479 |
Gear^.Message:= 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
480 |
Gear^.State:= Gear^.State or gstAnimation; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
481 |
Gear^.Tag:= Gear^.MsgParam; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
482 |
Gear^.Timer:= 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
483 |
Gear^.Pos:= 0 |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
484 |
end; |
1033 | 485 |
|
351 | 486 |
if ((Gear^.Message and gm_LJump ) <> 0) then |
4 | 487 |
begin |
542 | 488 |
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
|
489 |
DeleteCI(Gear); |
68 | 490 |
if not TestCollisionYwithGear(Gear, -1) then |
498 | 491 |
if not TestCollisionXwithXYShift(Gear, _0, -2, hwSign(Gear^.dX)) then Gear^.Y:= Gear^.Y - _2 else |
492 |
if not TestCollisionXwithXYShift(Gear, _0, -1, hwSign(Gear^.dX)) then Gear^.Y:= Gear^.Y - _1; |
|
351 | 493 |
if not (TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) |
68 | 494 |
or TestCollisionYwithGear(Gear, -1)) then |
4 | 495 |
begin |
351 | 496 |
Gear^.dY:= -_0_15; |
2024
2985f3bd18b7
Disable long jump in artillery mode, make snipre rifle single shot
nemo
parents:
2023
diff
changeset
|
497 |
if not cArtillery then Gear^.dX:= SignAs(_0_15, Gear^.dX); |
542 | 498 |
Gear^.State:= Gear^.State or gstMoving or gstHHJumping; |
2745 | 499 |
PlaySound(sndJump1, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack); |
4 | 500 |
exit |
501 |
end; |
|
502 |
end; |
|
505
fcba7d7aea0d
Fix old bug with grenade(bomd, etc..) not colliding with attacking hedgehog
unc0rr
parents:
498
diff
changeset
|
503 |
|
351 | 504 |
if ((Gear^.Message and gm_HJump ) <> 0) then |
4 | 505 |
begin |
505
fcba7d7aea0d
Fix old bug with grenade(bomd, etc..) not colliding with attacking hedgehog
unc0rr
parents:
498
diff
changeset
|
506 |
DeleteCI(Gear); |
542 | 507 |
Gear^.Message:= Gear^.Message and not gm_HJump; |
855
8842c71d16bf
- Fix too long delay between shotgun and deagle shots
unc0rr
parents:
854
diff
changeset
|
508 |
|
8842c71d16bf
- Fix too long delay between shotgun and deagle shots
unc0rr
parents:
854
diff
changeset
|
509 |
Gear^.dY:= -_0_2; |
8842c71d16bf
- Fix too long delay between shotgun and deagle shots
unc0rr
parents:
854
diff
changeset
|
510 |
SetLittle(Gear^.dX); |
8842c71d16bf
- Fix too long delay between shotgun and deagle shots
unc0rr
parents:
854
diff
changeset
|
511 |
Gear^.State:= Gear^.State or gstMoving or gstHHJumping; |
2745 | 512 |
PlaySound(sndJump3, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack); |
855
8842c71d16bf
- Fix too long delay between shotgun and deagle shots
unc0rr
parents:
854
diff
changeset
|
513 |
exit |
4 | 514 |
end; |
505
fcba7d7aea0d
Fix old bug with grenade(bomd, etc..) not colliding with attacking hedgehog
unc0rr
parents:
498
diff
changeset
|
515 |
|
351 | 516 |
PrevdX:= hwSign(Gear^.dX); |
2603 | 517 |
if (Gear^.Message and gm_Left )<>0 then Gear^.dX:= -cLittle else |
518 |
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
|
519 |
|
2940 | 520 |
if (Gear^.Message and (gm_Left or gm_Right)) <> 0 then |
521 |
begin |
|
522 |
StepSoundTimer:= cHHStepTicks; |
|
523 |
end; |
|
524 |
||
74 | 525 |
StepTicks:= cHHStepTicks; |
610 | 526 |
if PrevdX <> hwSign(Gear^.dX) then |
527 |
begin |
|
528 |
FollowGear:= Gear; |
|
529 |
exit |
|
530 |
end; |
|
531 |
DeleteCI(Gear); // must be after exit!! (see previous line) |
|
838 | 532 |
|
351 | 533 |
PHedgehog(Gear^.Hedgehog)^.visStepPos:= (PHedgehog(Gear^.Hedgehog)^.visStepPos + 1) and 7; |
534 |
if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then |
|
4 | 535 |
begin |
498 | 536 |
if not (TestCollisionXwithXYShift(Gear, _0, -6, hwSign(Gear^.dX)) |
537 |
or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; |
|
538 |
if not (TestCollisionXwithXYShift(Gear, _0, -5, hwSign(Gear^.dX)) |
|
539 |
or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; |
|
540 |
if not (TestCollisionXwithXYShift(Gear, _0, -4, hwSign(Gear^.dX)) |
|
541 |
or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; |
|
542 |
if not (TestCollisionXwithXYShift(Gear, _0, -3, hwSign(Gear^.dX)) |
|
543 |
or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; |
|
544 |
if not (TestCollisionXwithXYShift(Gear, _0, -2, hwSign(Gear^.dX)) |
|
545 |
or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; |
|
546 |
if not (TestCollisionXwithXYShift(Gear, _0, -1, hwSign(Gear^.dX)) |
|
547 |
or TestCollisionYwithGear(Gear, -1)) then Gear^.Y:= Gear^.Y - _1; |
|
4 | 548 |
end; |
1528 | 549 |
|
2585
0899ce8ad77f
Smaxx: only allow change direction when shift key is pressed
unc0rr
parents:
2502
diff
changeset
|
550 |
if (not cArtillery) and ((Gear^.Message and gm_Precise) = 0) and (not TestCollisionXwithGear(Gear, hwSign(Gear^.dX))) then |
0899ce8ad77f
Smaxx: only allow change direction when shift key is pressed
unc0rr
parents:
2502
diff
changeset
|
551 |
Gear^.X:= Gear^.X + SignAs(_1, Gear^.dX); |
0899ce8ad77f
Smaxx: only allow change direction when shift key is pressed
unc0rr
parents:
2502
diff
changeset
|
552 |
|
62 | 553 |
SetAllHHToActive; |
37 | 554 |
|
68 | 555 |
if not TestCollisionYwithGear(Gear, 1) then |
4 | 556 |
begin |
498 | 557 |
Gear^.Y:= Gear^.Y + _1; |
68 | 558 |
if not TestCollisionYwithGear(Gear, 1) then |
4 | 559 |
begin |
498 | 560 |
Gear^.Y:= Gear^.Y + _1; |
68 | 561 |
if not TestCollisionYwithGear(Gear, 1) then |
4 | 562 |
begin |
498 | 563 |
Gear^.Y:= Gear^.Y + _1; |
68 | 564 |
if not TestCollisionYwithGear(Gear, 1) then |
4 | 565 |
begin |
498 | 566 |
Gear^.Y:= Gear^.Y + _1; |
68 | 567 |
if not TestCollisionYwithGear(Gear, 1) then |
4 | 568 |
begin |
498 | 569 |
Gear^.Y:= Gear^.Y + _1; |
68 | 570 |
if not TestCollisionYwithGear(Gear, 1) then |
4 | 571 |
begin |
498 | 572 |
Gear^.Y:= Gear^.Y + _1; |
68 | 573 |
if not TestCollisionYwithGear(Gear, 1) then |
4 | 574 |
begin |
498 | 575 |
Gear^.Y:= Gear^.Y - _6; |
576 |
Gear^.dY:= _0; |
|
542 | 577 |
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
|
578 |
exit |
4 | 579 |
end; |
580 |
end |
|
581 |
end |
|
582 |
end |
|
583 |
end |
|
584 |
end |
|
505
fcba7d7aea0d
Fix old bug with grenade(bomd, etc..) not colliding with attacking hedgehog
unc0rr
parents:
498
diff
changeset
|
585 |
end; |
fcba7d7aea0d
Fix old bug with grenade(bomd, etc..) not colliding with attacking hedgehog
unc0rr
parents:
498
diff
changeset
|
586 |
AddGearCI(Gear) |
4 | 587 |
end |
588 |
end; |
|
589 |
||
303
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
590 |
procedure HedgehogChAngle(Gear: PGear); |
958 | 591 |
var da: LongWord; |
303
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
592 |
begin |
958 | 593 |
with PHedgehog(Gear^.Hedgehog)^ do |
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
594 |
if (CurAmmoType = amRope) |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
595 |
and ((Gear^.State and (gstMoving or gstHHJumping)) = gstMoving) then da:= 2 else da:= 1; |
958 | 596 |
|
1639 | 597 |
if (((Gear^.Message and gm_Precise) = 0) or ((GameTicks mod 5) = 1)) then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
598 |
if ((Gear^.Message and gm_Up) <> 0) and (Gear^.Angle >= CurMinAngle + da) then dec(Gear^.Angle, da) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
599 |
else |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
600 |
if ((Gear^.Message and gm_Down) <> 0) and (Gear^.Angle + da <= CurMaxAngle) then inc(Gear^.Angle, da) |
303
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
601 |
end; |
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
602 |
|
302 | 603 |
procedure doStepHedgehog(Gear: PGear); forward; |
604 |
//////////////////////////////////////////////////////////////////////////////// |
|
538 | 605 |
procedure doStepHedgehogMoving(Gear: PGear); |
545 | 606 |
var isFalling: boolean; |
538 | 607 |
begin |
3396
e5b3e5f2818e
More portal changes. Allows for a multishoot utility. Hopefully not breaking anything.
nemo
parents:
3391
diff
changeset
|
608 |
if Gear^.dX > _0_995 then Gear^.dX:= _0_995; |
e5b3e5f2818e
More portal changes. Allows for a multishoot utility. Hopefully not breaking anything.
nemo
parents:
3391
diff
changeset
|
609 |
if Gear^.dY > _0_995 then Gear^.dY:= _0_995; |
2762
2fbc8d35eb52
Mode to place hogs at start of game. Will probably need a bit more testing.
nemo
parents:
2745
diff
changeset
|
610 |
if PHedgehog(Gear^.Hedgehog)^.Unplaced then |
2fbc8d35eb52
Mode to place hogs at start of game. Will probably need a bit more testing.
nemo
parents:
2745
diff
changeset
|
611 |
begin |
2fbc8d35eb52
Mode to place hogs at start of game. Will probably need a bit more testing.
nemo
parents:
2745
diff
changeset
|
612 |
Gear^.dY:= _0; |
2fbc8d35eb52
Mode to place hogs at start of game. Will probably need a bit more testing.
nemo
parents:
2745
diff
changeset
|
613 |
Gear^.dX:= _0; |
2fbc8d35eb52
Mode to place hogs at start of game. Will probably need a bit more testing.
nemo
parents:
2745
diff
changeset
|
614 |
Gear^.State:= Gear^.State and not gstMoving; |
2fbc8d35eb52
Mode to place hogs at start of game. Will probably need a bit more testing.
nemo
parents:
2745
diff
changeset
|
615 |
exit |
2fbc8d35eb52
Mode to place hogs at start of game. Will probably need a bit more testing.
nemo
parents:
2745
diff
changeset
|
616 |
end; |
855
8842c71d16bf
- Fix too long delay between shotgun and deagle shots
unc0rr
parents:
854
diff
changeset
|
617 |
isFalling:= (Gear^.dY.isNegative) or not TestCollisionYKick(Gear, 1); |
542 | 618 |
if isFalling then |
538 | 619 |
begin |
620 |
if (Gear^.dY.isNegative) and TestCollisionYKick(Gear, -1) then Gear^.dY:= _0; |
|
542 | 621 |
Gear^.State:= Gear^.State or gstMoving; |
538 | 622 |
Gear^.dY:= Gear^.dY + cGravity |
623 |
end else |
|
624 |
begin |
|
625 |
if ((hwAbs(Gear^.dX) + hwAbs(Gear^.dY)) < _0_55) |
|
626 |
and ((Gear^.State and gstHHJumping) <> 0) then SetLittle(Gear^.dX); |
|
627 |
||
540 | 628 |
if not Gear^.dY.isNegative then |
629 |
begin |
|
630 |
CheckHHDamage(Gear); |
|
790
a6f442173822
Make high jump behaviour like in worms (back somersault)
unc0rr
parents:
783
diff
changeset
|
631 |
|
2137 | 632 |
if ((Gear^.State and gstHHHJump) <> 0) and (not cArtillery) and |
790
a6f442173822
Make high jump behaviour like in worms (back somersault)
unc0rr
parents:
783
diff
changeset
|
633 |
(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
|
634 |
|
542 | 635 |
Gear^.State:= Gear^.State and not (gstHHJumping or gstHHHJump); |
540 | 636 |
Gear^.dY:= _0; |
637 |
end else Gear^.dY:= Gear^.dY + cGravity; |
|
538 | 638 |
|
639 |
if ((Gear^.State and gstMoving) <> 0) then Gear^.dX:= Gear^.dX * Gear^.Friction |
|
640 |
end; |
|
641 |
||
642 |
if (Gear^.State <> 0) then DeleteCI(Gear); |
|
783 | 643 |
|
538 | 644 |
if (Gear^.State and gstMoving) <> 0 then |
645 |
if TestCollisionXKick(Gear, hwSign(Gear^.dX)) then |
|
542 | 646 |
if not isFalling then |
538 | 647 |
if hwAbs(Gear^.dX) > _0_01 then |
648 |
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 |
|
649 |
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 |
|
650 |
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 |
|
651 |
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 |
|
652 |
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 |
|
653 |
if hwAbs(Gear^.dX) > _0_02 then Gear^.dX:= -Gear^.Elasticity * Gear^.dX |
|
654 |
else begin |
|
655 |
Gear^.State:= Gear^.State and not gstMoving; |
|
656 |
SetLittle(Gear^.dX) |
|
657 |
end |
|
658 |
else begin |
|
659 |
Gear^.State:= Gear^.State and not gstMoving; |
|
660 |
SetLittle(Gear^.dX) |
|
661 |
end |
|
1518 | 662 |
else if (hwAbs(Gear^.dX) > cLittle) |
663 |
and ((Gear^.State and gstHHJumping) = 0) |
|
664 |
then Gear^.dX:= -Gear^.Elasticity * Gear^.dX |
|
665 |
else SetLittle(Gear^.dX); |
|
538 | 666 |
|
542 | 667 |
if (not isFalling) and |
538 | 668 |
(hwAbs(Gear^.dX) + hwAbs(Gear^.dY) < _0_03) then |
669 |
begin |
|
1865
ebc6dfca60d4
- nemo's patch: some animations, zero probability for infinite weapons
unc0rr
parents:
1861
diff
changeset
|
670 |
Gear^.State:= Gear^.State and not gstWinner; |
538 | 671 |
Gear^.State:= Gear^.State and not gstMoving; |
672 |
SetLittle(Gear^.dX); |
|
673 |
Gear^.dY:= _0 |
|
674 |
end else Gear^.State:= Gear^.State or gstMoving; |
|
675 |
||
676 |
if (Gear^.State and gstMoving) <> 0 then |
|
677 |
begin |
|
678 |
Gear^.State:= Gear^.State and not gstAnimation; |
|
2017 | 679 |
// ARTILLERY but not being moved by explosions |
538 | 680 |
Gear^.X:= Gear^.X + Gear^.dX; |
681 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
|
682 |
if (not Gear^.dY.isNegative) and |
|
683 |
(not TestCollisionYKick(Gear, 1)) and |
|
684 |
TestCollisionYwithXYShift(Gear, 0, 1, 1) then |
|
685 |
begin |
|
686 |
CheckHHDamage(Gear); |
|
687 |
Gear^.dY:= _0; |
|
688 |
Gear^.Y:= Gear^.Y + _1 |
|
689 |
end; |
|
1658
208a3258afdf
Fix a bug with visible cursor when hedgehog is dead
unc0rr
parents:
1645
diff
changeset
|
690 |
CheckGearDrowning(Gear); |
208a3258afdf
Fix a bug with visible cursor when hedgehog is dead
unc0rr
parents:
1645
diff
changeset
|
691 |
if (Gear^.State and gstDrowning) <> 0 then isCursorVisible:= false |
2428 | 692 |
end; |
693 |
||
3003 | 694 |
if (hwAbs(Gear^.dY) > _0) and (Gear^.FlightTime > 0) and ((GameFlags and gfLowGravity) = 0) then |
2428 | 695 |
begin |
696 |
inc(Gear^.FlightTime, 1); |
|
3174 | 697 |
if Gear^.FlightTime = 3000 then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
698 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
699 |
AddCaption(GetEventString(eidHomerun), cWhiteColor, capgrpMessage); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
700 |
PlaySound(sndHomerun) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
701 |
end; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
702 |
end |
2428 | 703 |
else |
704 |
begin |
|
705 |
Gear^.FlightTime:= 0; |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
706 |
end; |
2428 | 707 |
|
538 | 708 |
end; |
709 |
||
302 | 710 |
procedure doStepHedgehogDriven(Gear: PGear); |
711 |
var t: PGear; |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
712 |
wasJumping: boolean; |
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
713 |
Hedgehog: PHedgehog; |
302 | 714 |
begin |
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
715 |
Hedgehog:= PHedgehog(Gear^.Hedgehog); |
558
b2b840eeb10a
Fix bug when hedgehog moves not right after it is kicked
unc0rr
parents:
553
diff
changeset
|
716 |
if not isInMultiShoot then |
b2b840eeb10a
Fix bug when hedgehog moves not right after it is kicked
unc0rr
parents:
553
diff
changeset
|
717 |
AllInactive:= false |
b2b840eeb10a
Fix bug when hedgehog moves not right after it is kicked
unc0rr
parents:
553
diff
changeset
|
718 |
else |
b2b840eeb10a
Fix bug when hedgehog moves not right after it is kicked
unc0rr
parents:
553
diff
changeset
|
719 |
Gear^.Message:= 0; |
505
fcba7d7aea0d
Fix old bug with grenade(bomd, etc..) not colliding with attacking hedgehog
unc0rr
parents:
498
diff
changeset
|
720 |
|
1035 | 721 |
if (TurnTimeLeft = 0) or (Gear^.Damage > 0) then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
722 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
723 |
TurnTimeLeft:= 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
724 |
isCursorVisible:= false; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
725 |
Gear^.State:= Gear^.State and not (gstHHDriven or gstAnimation or gstAttacking); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
726 |
AttackBar:= 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
727 |
if Gear^.Damage > 0 then |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
728 |
Gear^.State:= Gear^.State and not (gstHHJumping or gstHHHJump); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
729 |
exit |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
730 |
end; |
1035 | 731 |
|
1033 | 732 |
if (Gear^.State and gstAnimation) <> 0 then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
733 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
734 |
Gear^.Message:= 0; |
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
735 |
if (Gear^.Pos = Wavez[TWave(Gear^.Tag)].VoiceDelay) and (Gear^.Timer = 0) then PlaySound(Wavez[TWave(Gear^.Tag)].Voice, Hedgehog^.Team^.voicepack); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
736 |
inc(Gear^.Timer); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
737 |
if Gear^.Timer = Wavez[TWave(Gear^.Tag)].Interval then |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
738 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
739 |
Gear^.Timer:= 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
740 |
inc(Gear^.Pos); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
741 |
if Gear^.Pos = Wavez[TWave(Gear^.Tag)].FramesCount then |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
742 |
Gear^.State:= Gear^.State and not gstAnimation |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
743 |
end; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
744 |
exit |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
745 |
end; |
1033 | 746 |
|
836 | 747 |
if ((Gear^.State and gstMoving) <> 0) |
748 |
or (StepTicks = cHHStepTicks) |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
749 |
or (CurAmmoGear <> nil) then // we are moving |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
750 |
begin |
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
751 |
with Hedgehog^ do |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
752 |
if (CurAmmoGear = nil) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
753 |
and (Gear^.dY > _0_39) |
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
754 |
and (CurAmmoType = amParachute) then Gear^.Message:= Gear^.Message or gm_Attack; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
755 |
// check for case with ammo |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
756 |
t:= CheckGearNear(Gear, gtCase, 36, 36); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
757 |
if t <> nil then |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
758 |
PickUp(Gear, t) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
759 |
end; |
302 | 760 |
|
930 | 761 |
if (CurAmmoGear = nil) then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
762 |
if (((Gear^.Message and gm_Attack) <> 0) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
763 |
or ((Gear^.State and gstAttacking) <> 0)) then |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
764 |
Attack(Gear) // should be before others to avoid desync with '/put' msg and changing weapon msgs |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
765 |
else |
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
766 |
else |
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
767 |
with Hedgehog^ do |
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
768 |
if ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0) |
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
769 |
and ((Gear^.Message and gm_LJump) <> 0) |
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
770 |
and ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) then |
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
771 |
begin |
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
772 |
Gear^.Message:= Gear^.Message and not gm_LJump; |
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
773 |
Attack(Gear) |
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
774 |
end; |
930 | 775 |
|
776 |
if (CurAmmoGear = nil) |
|
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
777 |
or ((Ammoz[Hedgehog^.CurAmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0) then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
778 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
779 |
if ((Gear^.Message and gm_Slot) <> 0) then |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
780 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
781 |
ChangeAmmo(Gear); |
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
782 |
ApplyAmmoChanges(Hedgehog^) |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
783 |
end; |
930 | 784 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
785 |
if ((Gear^.Message and gm_Weapon) <> 0) then HHSetWeapon(Gear); |
930 | 786 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
787 |
if ((Gear^.Message and gm_Timer) <> 0) then HHSetTimer(Gear); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
788 |
end; |
930 | 789 |
|
302 | 790 |
if CurAmmoGear <> nil then |
791 |
begin |
|
351 | 792 |
CurAmmoGear^.Message:= Gear^.Message; |
302 | 793 |
exit |
794 |
end; |
|
795 |
||
952 | 796 |
if not isInMultiShoot then |
797 |
HedgehogChAngle(Gear); |
|
926
d231e007452a
Timer as hedgehog message (avoid possible desync in very rare cases)
unc0rr
parents:
925
diff
changeset
|
798 |
|
542 | 799 |
if (Gear^.State and gstMoving) <> 0 then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
800 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
801 |
wasJumping:= ((Gear^.State and gstHHJumping) <> 0); |
2376 | 802 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
803 |
if ((Gear^.Message and gm_HJump) <> 0) and |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
804 |
wasJumping and |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
805 |
((Gear^.State and gstHHHJump) = 0) then |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
806 |
if (not (hwAbs(Gear^.dX) > cLittle)) and (Gear^.dY < -_0_02) then |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
807 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
808 |
Gear^.State:= Gear^.State or gstHHHJump; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
809 |
Gear^.dY:= -_0_25; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
810 |
if not cArtillery then Gear^.dX:= -SignAs(_0_02, Gear^.dX); |
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3768
diff
changeset
|
811 |
PlaySound(sndJump2, Hedgehog^.Team^.voicepack) |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
812 |
end; |
2376 | 813 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
814 |
Gear^.Message:= Gear^.Message and not (gm_LJump or gm_HJump); |
538 | 815 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
816 |
if (not cArtillery) and wasJumping and |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
817 |
TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then SetLittle(Gear^.dX); |
538 | 818 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
819 |
doStepHedgehogMoving(Gear); |
542 | 820 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
821 |
if ((Gear^.State and (gstMoving or gstDrowning)) = 0) then |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
822 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
823 |
AddGearCI(Gear); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
824 |
if wasJumping then |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
825 |
StepTicks:= 410 |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
826 |
else |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
827 |
StepTicks:= 95 |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
828 |
end; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
829 |
exit |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
830 |
end; |
302 | 831 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
832 |
if not isInMultiShoot then |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
833 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
834 |
if StepTicks > 0 then dec(StepTicks); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
835 |
if (StepTicks = 0) then HedgehogStep(Gear) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
836 |
end |
302 | 837 |
end; |
838 |
||
4 | 839 |
//////////////////////////////////////////////////////////////////////////////// |
840 |
procedure doStepHedgehogFree(Gear: PGear); |
|
511 | 841 |
var prevState: Longword; |
4 | 842 |
begin |
511 | 843 |
prevState:= Gear^.State; |
4 | 844 |
|
538 | 845 |
doStepHedgehogMoving(Gear); |
4 | 846 |
|
1002 | 847 |
if (Gear^.State and (gstMoving or gstDrowning)) <> 0 then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
848 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
849 |
if Gear^.Damage > 0 then CalcRotationDirAngle(Gear); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
850 |
AllInactive:= false; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
851 |
exit |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
852 |
end; |
4 | 853 |
|
863 | 854 |
if (Gear^.Health = 0) then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
855 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
856 |
if PrvInactive then |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
857 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
858 |
Gear^.Timer:= 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
859 |
FollowGear:= Gear; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
860 |
PrvInactive:= false; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
861 |
AllInactive:= false; |
2140 | 862 |
|
3310 | 863 |
if not PHedgehog(Gear^.Hedgehog)^.Team^.hasGone then |
864 |
begin |
|
3768 | 865 |
if PHedgehog(Gear^.Hedgehog)^.Effects[heResurrectable] then begin |
866 |
ResurrectHedgehog(Gear); |
|
867 |
end else begin |
|
868 |
Gear^.State:= Gear^.State or gstHHDeath; |
|
869 |
Gear^.doStep:= @doStepHedgehogDead; |
|
870 |
// Death message |
|
871 |
AddCaption(Format(GetEventString(eidDied), PHedgehog(Gear^.Hedgehog)^.Name), cWhiteColor, capgrpMessage); |
|
872 |
end; |
|
3310 | 873 |
end |
874 |
else |
|
875 |
begin |
|
876 |
Gear^.State:= Gear^.State or gstHHGone; |
|
877 |
Gear^.doStep:= @doStepHedgehogGone; |
|
878 |
// Gone message |
|
879 |
AddCaption(Format(GetEventString(eidGone), PHedgehog(Gear^.Hedgehog)^.Name), cWhiteColor, capgrpMessage); |
|
880 |
end |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
881 |
end; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
882 |
exit |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
883 |
end; |
4 | 884 |
|
1033 | 885 |
if ((Gear^.State and gstWait) = 0) and |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
886 |
(prevState <> Gear^.State) then |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
887 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
888 |
Gear^.State:= gstWait; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
889 |
Gear^.Timer:= 150 |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
890 |
end else |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
891 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
892 |
if Gear^.Timer = 0 then |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
893 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
894 |
Gear^.State:= 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
895 |
Gear^.Active:= false; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
896 |
AddGearCI(Gear); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
897 |
exit |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
898 |
end else dec(Gear^.Timer) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
899 |
end; |
863 | 900 |
|
901 |
AllInactive:= false |
|
4 | 902 |
end; |
903 |
||
904 |
//////////////////////////////////////////////////////////////////////////////// |
|
905 |
procedure doStepHedgehog(Gear: PGear); |
|
906 |
begin |
|
351 | 907 |
if (Gear^.Message and gm_Destroy) <> 0 then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
908 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
909 |
DeleteGear(Gear); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
910 |
exit |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
911 |
end; |
1505 | 912 |
|
2040 | 913 |
if (Gear^.State and gstHHDriven) = 0 then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
914 |
doStepHedgehogFree(Gear) |
2040 | 915 |
else |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
916 |
begin |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
917 |
with PHedgehog(Gear^.Hedgehog)^ do |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
918 |
if Team^.hasGone then TeamGoneEffect(Team^); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
919 |
doStepHedgehogDriven(Gear) |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2940
diff
changeset
|
920 |
end; |
2585
0899ce8ad77f
Smaxx: only allow change direction when shift key is pressed
unc0rr
parents:
2502
diff
changeset
|
921 |
end; |