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