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