author | mbait |
Mon, 10 May 2010 04:41:19 +0000 | |
changeset 3454 | a9bef74bd6e0 |
parent 3440 | dee31c5149e0 |
child 3455 | f33e7ad2261c |
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); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
20 |
var |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
21 |
gi: PGear; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
22 |
d: LongInt; |
2647 | 23 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
24 |
gi := GearsList; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
25 |
while gi <> nil do |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
26 |
begin |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
27 |
if (gi^.Kind = gtHedgehog) then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
28 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
29 |
d := r - hwRound(Distance(gi^.X - x, gi^.Y - y)); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
30 |
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
|
31 |
begin |
3143 | 32 |
if (CurrentHedgehog^.Gear = gi) then |
33 |
PlaySound(sndOops, PHedgehog(gi^.Hedgehog)^.Team^.voicepack) |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
34 |
else |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
35 |
begin |
3143 | 36 |
if (gi^.State and gstMoving) = 0 then |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
37 |
gi^.State := gi^.State or gstLoser; |
3143 | 38 |
if d > r div 2 then |
39 |
PlaySound(sndNooo, PHedgehog(gi^.Hedgehog)^.Team^.voicepack) |
|
40 |
else |
|
41 |
PlaySound(sndUhOh, PHedgehog(gi^.Hedgehog)^.Team^.voicepack); |
|
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 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
45 |
gi := gi^.NextGear |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
46 |
end; |
2647 | 47 |
end; |
48 |
//////////////////////////////////////////////////////////////////////////////// |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
49 |
procedure doStepDrowningGear(Gear: PGear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
50 |
forward; |
4 | 51 |
|
52 |
function CheckGearDrowning(Gear: PGear): boolean; |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
53 |
var |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
54 |
skipSpeed, skipAngle, skipDecay: hwFloat; |
2982 | 55 |
i, maxDrops: LongInt; |
56 |
particle: PVisualGear; |
|
4 | 57 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
58 |
// probably needs tweaking. might need to be in a case statement based upon gear type |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
59 |
if cWaterLine < hwRound(Gear^.Y) + Gear^.Radius then |
1918 | 60 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
61 |
skipSpeed := _0_25; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
62 |
skipAngle := _1_9; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
63 |
skipDecay := _0_87; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
64 |
// this could perhaps be a tiny bit higher. |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
65 |
if (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) > skipSpeed) and |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
66 |
(hwAbs(Gear^.dX) > skipAngle * hwAbs(Gear^.dY)) then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
67 |
begin |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
68 |
Gear^.dY.isNegative := true; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
69 |
Gear^.dY := Gear^.dY * skipDecay; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
70 |
Gear^.dX := Gear^.dX * skipDecay; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
71 |
CheckGearDrowning := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
72 |
PlaySound(sndSkip) |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
73 |
end |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
74 |
else |
1918 | 75 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
76 |
CheckGearDrowning := true; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
77 |
Gear^.State := gstDrowning; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
78 |
Gear^.RenderTimer := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
79 |
if (Gear^.Kind <> gtSniperRifleShot) and (Gear^.Kind <> gtShotgunShot) and (Gear^.Kind <> gtDEagleShot) and (Gear^.Kind <> gtSineGunShot) then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
80 |
Gear^.doStep := @doStepDrowningGear; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
81 |
if Gear^.Kind = gtHedgehog then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
82 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
83 |
Gear^.State := Gear^.State and (not gstHHDriven); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
84 |
AddCaption(Format(GetEventString(eidDrowned), PHedgehog(Gear^.Hedgehog)^.Name), |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
85 |
cWhiteColor, capgrpMessage); |
3359 | 86 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
87 |
if hwRound(Gear^.Y) < cWaterLine + 64 + Gear^.Radius then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
88 |
// don't play splash if they are already way past the surface |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
89 |
PlaySound(sndSplash) |
1918 | 90 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
91 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
92 |
if not cReducedQuality and (hwRound(Gear^.Y) < cWaterLine + 64 + Gear^.Radius) then |
2982 | 93 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
94 |
AddVisualGear(hwRound(Gear^.X), cWaterLine, vgtSplash); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
95 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
96 |
maxDrops := (Gear^.Radius div 2) + hwRound(Gear^.dX * Gear^.Radius * 2) + hwRound(Gear^. |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
97 |
dY * Gear^.Radius * 2); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
98 |
for i:= max(maxDrops div 3, min(32, Random(maxDrops))) downto 0 do |
2982 | 99 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
100 |
particle := AddVisualGear(hwRound(Gear^.X) - 3 + Random(6), cWaterLine, vgtDroplet); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
101 |
if particle <> nil then |
2982 | 102 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
103 |
particle^.dX := particle^.dX - (Gear^.dX / 10); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
104 |
particle^.dY := particle^.dY - (Gear^.dY / 5) |
2982 | 105 |
end |
106 |
end |
|
107 |
end; |
|
1918 | 108 |
end |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
109 |
else |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
110 |
CheckGearDrowning := false |
4 | 111 |
end; |
112 |
||
113 |
procedure CheckCollision(Gear: PGear); |
|
114 |
begin |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
115 |
if TestCollisionXwithGear(Gear, hwSign(Gear^.X)) or TestCollisionYwithGear(Gear, hwSign(Gear^.Y) |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
116 |
) |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
117 |
then Gear^.State := Gear^.State or gstCollision |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
118 |
else Gear^.State := Gear^.State and not gstCollision |
4 | 119 |
end; |
120 |
||
121 |
procedure CheckHHDamage(Gear: PGear); |
|
2848 | 122 |
var |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
123 |
dmg: Longword; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
124 |
i: LongInt; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
125 |
particle: PVisualGear; |
4 | 126 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
127 |
if _0_4 < Gear^.dY then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
128 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
129 |
dmg := ModifyDamage(1 + hwRound((hwAbs(Gear^.dY) - _0_4) * 70), Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
130 |
if dmg < 1 then exit; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
131 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
132 |
for i:= min(12, (3 + dmg div 10)) downto 0 do |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
133 |
begin |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
134 |
particle := AddVisualGear(hwRound(Gear^.X) - 5 + Random(10), hwRound(Gear^.Y) + 12, |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
135 |
vgtDust); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
136 |
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
|
137 |
end; |
2871
eec42a0b7014
rearrange fall damage a bit so invulnerability still causes dust
nemo
parents:
2859
diff
changeset
|
138 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
139 |
if (Gear^.Invulnerable) then exit; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
140 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
141 |
if _0_6 < Gear^.dY then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
142 |
PlaySound(sndOw4, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack) |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
143 |
else |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
144 |
PlaySound(sndOw1, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
145 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
146 |
ApplyDamage(Gear, dmg); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
147 |
end |
4 | 148 |
end; |
149 |
||
150 |
//////////////////////////////////////////////////////////////////////////////// |
|
151 |
//////////////////////////////////////////////////////////////////////////////// |
|
152 |
procedure CalcRotationDirAngle(Gear: PGear); |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
153 |
var |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
154 |
dAngle: real; |
4 | 155 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
156 |
dAngle := (Gear^.dX.QWordValue + Gear^.dY.QWordValue) / $80000000; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
157 |
if not Gear^.dX.isNegative then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
158 |
Gear^.DirAngle := Gear^.DirAngle + dAngle |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
159 |
else |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
160 |
Gear^.DirAngle := Gear^.DirAngle - dAngle; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
161 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
162 |
if Gear^.DirAngle < 0 then Gear^.DirAngle := Gear^.DirAngle + 360 |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
163 |
else if 360 < Gear^.DirAngle then Gear^.DirAngle := Gear^.DirAngle - 360 |
4 | 164 |
end; |
165 |
||
166 |
//////////////////////////////////////////////////////////////////////////////// |
|
167 |
procedure doStepDrowningGear(Gear: PGear); |
|
168 |
begin |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
169 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
170 |
Gear^.Y := Gear^.Y + cDrownSpeed; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
171 |
Gear^.X := Gear^.X + Gear^.dX * cDrownSpeed; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
172 |
if (cWaterOpacity > $FE) or (hwRound(Gear^.Y) > Gear^.Radius + cWaterLine + cVisibleWater) then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
173 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
174 |
// Create some bubbles (0.5% might be better but causes too few bubbles sometimes) |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
175 |
if (cWaterOpacity < $FF) and ((GameTicks and $1F) = 0) then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
176 |
if (Gear^.Kind = gtHedgehog) and (Random(4) = 0) then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
177 |
AddVisualGear(hwRound(Gear^.X) - Gear^.Radius, hwRound(Gear^.Y) - Gear^.Radius, |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
178 |
vgtBubble) |
2225 | 179 |
else if Random(12) = 0 then |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
180 |
AddVisualGear(hwRound(Gear^.X) - Gear^.Radius, hwRound(Gear^.Y) - Gear^.Radius, |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
181 |
vgtBubble) |
4 | 182 |
end; |
183 |
||
184 |
//////////////////////////////////////////////////////////////////////////////// |
|
185 |
procedure doStepFallingGear(Gear: PGear); |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
186 |
var |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
187 |
isFalling: boolean; |
3020 | 188 |
//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
|
189 |
tdX, tdY: hwFloat; |
3001 | 190 |
collV, collH: LongInt; |
4 | 191 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
192 |
if Gear^.dX > _0_995 then Gear^.dX := _0_995; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
193 |
if Gear^.dY > _0_995 then Gear^.dY := _0_995; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
194 |
Gear^.State := Gear^.State and not gstCollision; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
195 |
collV := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
196 |
collH := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
197 |
tdX := Gear^.dX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
198 |
tdY := Gear^.dY; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
199 |
|
503 | 200 |
|
3359 | 201 |
// might need some testing/adjustments - just to avoid projectiles to fly forever (accelerated by wind/skips) |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
202 |
if (hwRound(Gear^.X) < LAND_WIDTH div -2) or (hwRound(Gear^.X) > LAND_WIDTH * 3 div 2) then |
3359 | 203 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
204 |
Gear^.State := Gear^.State or gstCollision; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
205 |
exit |
3359 | 206 |
end; |
207 |
||
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
208 |
if Gear^.dY.isNegative then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
209 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
210 |
isFalling := true; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
211 |
if TestCollisionYwithGear(Gear, -1) then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
212 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
213 |
collV := -1; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
214 |
Gear^.dX := Gear^.dX * Gear^.Friction; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
215 |
Gear^.dY := - Gear^.dY * Gear^.Elasticity; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
216 |
Gear^.State := Gear^.State or gstCollision |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
217 |
end |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
218 |
else if (Gear^.AdvBounce=1) and TestCollisionYwithGear(Gear, 1) then collV := 1; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
219 |
end |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
220 |
else if TestCollisionYwithGear(Gear, 1) then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
221 |
begin |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
222 |
collV := 1; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
223 |
isFalling := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
224 |
Gear^.dX := Gear^.dX * Gear^.Friction; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
225 |
Gear^.dY := - Gear^.dY * Gear^.Elasticity; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
226 |
Gear^.State := Gear^.State or gstCollision |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
227 |
end |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
228 |
else |
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
|
229 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
230 |
isFalling := true; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
231 |
if (Gear^.AdvBounce=1) and not Gear^.dY.isNegative and TestCollisionYwithGear(Gear, -1) then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
232 |
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
|
233 |
end; |
503 | 234 |
|
2989
b49d87499398
Add back sheepluva's 45° patch for some weapons. Rescale Tiy's latest icons to his specifications.
nemo
parents:
2983
diff
changeset
|
235 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
236 |
if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
237 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
238 |
collH := hwSign(Gear^.dX); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
239 |
Gear^.dX := - Gear^.dX * Gear^.Elasticity; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
240 |
Gear^.dY := Gear^.dY * Gear^.Elasticity; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
241 |
Gear^.State := Gear^.State or gstCollision |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
242 |
end |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
243 |
else if (Gear^.AdvBounce=1) and TestCollisionXwithGear(Gear, -hwSign(Gear^.dX)) then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
244 |
collH := -hwSign(Gear^.dX); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
245 |
//if Gear^.AdvBounce and (collV <>0) and (collH <> 0) and (hwSqr(tdX) + hwSqr(tdY) > _0_08) then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
246 |
if (Gear^.AdvBounce=1) and (collV <>0) and (collH <> 0) and ((collV=-1) or ((tdX.QWordValue + |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
247 |
tdY.QWordValue) > _0_2.QWordValue)) then |
3001 | 248 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
249 |
Gear^.dX := tdY*Gear^.Elasticity*Gear^.Friction; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
250 |
Gear^.dY := tdX*Gear^.Elasticity; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
251 |
//*Gear^.Friction; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
252 |
Gear^.dY.isNegative := not tdY.isNegative; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
253 |
isFalling := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
254 |
Gear^.AdvBounce := 10; |
3001 | 255 |
end; |
503 | 256 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
257 |
if Gear^.AdvBounce > 1 then dec(Gear^.AdvBounce); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
258 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
259 |
if isFalling then Gear^.dY := Gear^.dY + cGravity; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
260 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
261 |
Gear^.X := Gear^.X + Gear^.dX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
262 |
Gear^.Y := Gear^.Y + Gear^.dY; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
263 |
CheckGearDrowning(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
264 |
//if (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) < _0_0002) and |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
265 |
if ((Gear^.dX.QWordValue + Gear^.dY.QWordValue) < _0_02.QWordValue) and |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
266 |
(not isFalling) then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
267 |
Gear^.State := Gear^.State and not gstMoving |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
268 |
else |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
269 |
Gear^.State := Gear^.State or gstMoving; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
270 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
271 |
if (Gear^.nImpactSounds > 0) then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
272 |
if ((Gear^.Damage <> 0) or ((Gear^.State and (gstCollision or gstMoving)) = (gstCollision or |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
273 |
gstMoving))) and |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
274 |
((Gear^.dX.QWordValue > _0_1.QWordValue) or (Gear^.dY.QWordValue > _0_1.QWordValue)) then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
275 |
PlaySound(TSound(ord(Gear^.ImpactSound) + LongInt(GetRandom(Gear^.nImpactSounds))), true |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
276 |
); |
4 | 277 |
end; |
278 |
||
279 |
//////////////////////////////////////////////////////////////////////////////// |
|
280 |
procedure doStepBomb(Gear: PGear); |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
281 |
var |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
282 |
i, x, y: LongInt; |
919 | 283 |
dX, dY: hwFloat; |
2538
661079b00177
Just checking this in so prg can try it. May back it out
nemo
parents:
2524
diff
changeset
|
284 |
Fire: PGear; |
4 | 285 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
286 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
287 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
288 |
doStepFallingGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
289 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
290 |
dec(Gear^.Timer); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
291 |
if Gear^.Timer = 1000 then // might need adjustments |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
292 |
case Gear^.Kind of |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
293 |
gtAmmo_Bomb: makeHogsWorry(Gear^.X, Gear^.Y, 50); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
294 |
gtClusterBomb: makeHogsWorry(Gear^.X, Gear^.Y, 20); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
295 |
gtWatermelon: makeHogsWorry(Gear^.X, Gear^.Y, 75); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
296 |
gtHellishBomb: makeHogsWorry(Gear^.X, Gear^.Y, 90); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
297 |
gtGasBomb: makeHogsWorry(Gear^.X, Gear^.Y, 50); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
298 |
end; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
299 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
300 |
if (Gear^.Kind = gtBall) and ((Gear^.State and gstTmpFlag) <> 0) then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
301 |
begin |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
302 |
CheckCollision(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
303 |
if (Gear^.State and gstCollision) <> 0 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
304 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 20, EXPLDontDraw or EXPLNoGfx); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
305 |
end; |
3004 | 306 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
307 |
if Gear^.Timer = 0 then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
308 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
309 |
case Gear^.Kind of |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
310 |
gtAmmo_Bomb: doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
311 |
gtBall: doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 40, EXPLAutoSound); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
312 |
gtClusterBomb: |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
313 |
begin |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
314 |
x := hwRound(Gear^.X); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
315 |
y := hwRound(Gear^.Y); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
316 |
doMakeExplosion(x, y, 20, EXPLAutoSound); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
317 |
for i:= 0 to 4 do |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
318 |
begin |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
319 |
dX := rndSign(GetRandom * _0_1); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
320 |
dY := (GetRandom - _3) * _0_08; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
321 |
AddGear(x, y, gtCluster, 0, dX, dY, 25); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
322 |
end |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
323 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
324 |
gtWatermelon: |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
325 |
begin |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
326 |
x := hwRound(Gear^.X); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
327 |
y := hwRound(Gear^.Y); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
328 |
doMakeExplosion(x, y, 75, EXPLAutoSound); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
329 |
for i:= 0 to 5 do |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
330 |
begin |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
331 |
dX := rndSign(GetRandom * _0_1); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
332 |
dY := (GetRandom - _1_5) * _0_3; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
333 |
AddGear(x, y, gtMelonPiece, 0, dX, dY, 75)^.DirAngle := i * 60; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
334 |
end |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
335 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
336 |
gtHellishBomb: |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
337 |
begin |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
338 |
x := hwRound(Gear^.X); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
339 |
y := hwRound(Gear^.Y); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
340 |
doMakeExplosion(x, y, 90, EXPLAutoSound); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
341 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
342 |
for i:= 0 to 127 do |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
343 |
begin |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
344 |
dX := AngleCos(i * 16) * _0_5 * (GetRandom + _1); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
345 |
dY := AngleSin(i * 16) * _0_5 * (GetRandom + _1); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
346 |
Fire := AddGear(x, y, gtFlame, 0, dX, dY, 0); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
347 |
if i mod 2 = 0 then Fire^.State := Fire^.State or gsttmpFlag; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
348 |
Fire := AddGear(x, y, gtFlame, 0, dX, -dY, 0); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
349 |
if i mod 2 <> 0 then Fire^.State := Fire^.State or gsttmpFlag; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
350 |
end |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
351 |
end; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
352 |
gtGasBomb: doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound or EXPLPoisoned); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
353 |
end; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
354 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
355 |
exit |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
356 |
end; |
1263 | 357 |
|
4 | 358 |
CalcRotationDirAngle(Gear); |
1263 | 359 |
|
360 |
if Gear^.Kind = gtHellishBomb then |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
361 |
begin |
3118 | 362 |
|
363 |
if Gear^.Timer = 3000 then |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
364 |
begin |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
365 |
Gear^.nImpactSounds := 0; |
3118 | 366 |
PlaySound(sndHellish); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
367 |
end; |
1279 | 368 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
369 |
if (GameTicks and $3F) = 0 then |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
370 |
if (Gear^.State and gstCollision) = 0 then |
3440
dee31c5149e0
* gtHealthTag, gtSmokeTrace, gtEvilTrace, gtExplosion and gtBigExplosion are visual gears now (vgt*)
sheepluva
parents:
3431
diff
changeset
|
371 |
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtEvilTrace); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
372 |
end; |
4 | 373 |
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
|
374 |
//////////////////////////////////////////////////////////////////////////////// |
ecf0c7e7995b
Initial molotov cocktail. Still needs graphics, tweaking of fire behaviour. Also changed probabilities for default weapon sets
nemo
parents:
2455
diff
changeset
|
375 |
procedure doStepMolotov(Gear: PGear); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
376 |
var |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
377 |
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
|
378 |
dX, dY: hwFloat; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
379 |
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
|
380 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
381 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
382 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
383 |
doStepFallingGear(Gear); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
384 |
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
|
385 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
386 |
if (Gear^.State and gstCollision) <> 0 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
387 |
begin |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
388 |
PlaySound(sndMolotov); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
389 |
gX := hwRound(Gear^.X); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
390 |
gY := hwRound(Gear^.Y); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
391 |
//doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 5, EXPLAutoSound); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
392 |
for i:= 0 to 20 do |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
393 |
begin |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
394 |
dX := AngleCos(i * 2) * ((_0_1*(i div 5))) * (GetRandom + _1); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
395 |
dY := AngleSin(i * 8) * _0_5 * (GetRandom + _1); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
396 |
Fire := AddGear(gX, gY, gtFlame, 0, dX, dY, 0); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
397 |
Fire^.State := Fire^.State or gsttmpFlag; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
398 |
Fire := AddGear(gX, gY, gtFlame, 0, dX, -dY, 0); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
399 |
Fire^.State := Fire^.State or gsttmpFlag; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
400 |
Fire := AddGear(gX, gY, gtFlame, 0, -dX, dY, 0); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
401 |
Fire^.State := Fire^.State or gsttmpFlag; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
402 |
Fire := AddGear(gX, gY, gtFlame, 0, -dX, -dY, 0); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
403 |
Fire^.State := Fire^.State or gsttmpFlag; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
404 |
end; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
405 |
DeleteGear(Gear); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
406 |
exit |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
407 |
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
|
408 |
end; |
4 | 409 |
|
1279 | 410 |
procedure doStepWatermelon(Gear: PGear); |
411 |
begin |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
412 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
413 |
Gear^.doStep := @doStepBomb |
1279 | 414 |
end; |
415 |
||
78 | 416 |
procedure doStepCluster(Gear: PGear); |
417 |
begin |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
418 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
419 |
doStepFallingGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
420 |
if (Gear^.State and gstCollision) <> 0 then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
421 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
422 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Timer, EXPLAutoSound); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
423 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
424 |
exit |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
425 |
end; |
1262 | 426 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
427 |
if (Gear^.Kind = gtMelonPiece) or (Gear^.Kind = gtBall) then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
428 |
CalcRotationDirAngle(Gear) |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
429 |
else if (GameTicks and $1F) = 0 then |
3440
dee31c5149e0
* gtHealthTag, gtSmokeTrace, gtEvilTrace, gtExplosion and gtBigExplosion are visual gears now (vgt*)
sheepluva
parents:
3431
diff
changeset
|
430 |
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace) |
78 | 431 |
end; |
432 |
||
4 | 433 |
//////////////////////////////////////////////////////////////////////////////// |
434 |
procedure doStepGrenade(Gear: PGear); |
|
435 |
begin |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
436 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
437 |
Gear^.dX := Gear^.dX + cWindSpeed; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
438 |
doStepFallingGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
439 |
if (Gear^.State and gstCollision) <> 0 then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
440 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
441 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
442 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
443 |
exit |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
444 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
445 |
if (GameTicks and $3F) = 0 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
446 |
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace); |
95 | 447 |
end; |
448 |
||
4 | 449 |
//////////////////////////////////////////////////////////////////////////////// |
450 |
procedure doStepGrave(Gear: PGear); |
|
451 |
begin |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
452 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
453 |
if Gear^.dY.isNegative then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
454 |
if TestCollisionY(Gear, -1) then Gear^.dY := _0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
455 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
456 |
if not Gear^.dY.isNegative then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
457 |
if TestCollisionY(Gear, 1) then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
458 |
begin |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
459 |
Gear^.dY := - Gear^.dY * Gear^.Elasticity; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
460 |
if Gear^.dY > - _1div1024 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
461 |
begin |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
462 |
Gear^.Active := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
463 |
exit |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
464 |
end |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
465 |
else if Gear^.dY < - _0_03 then PlaySound(Gear^.ImpactSound) |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
466 |
end; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
467 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
468 |
Gear^.Y := Gear^.Y + Gear^.dY; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
469 |
CheckGearDrowning(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
470 |
Gear^.dY := Gear^.dY + cGravity |
4 | 471 |
end; |
472 |
||
473 |
//////////////////////////////////////////////////////////////////////////////// |
|
3080 | 474 |
procedure doStepBeeWork(Gear: PGear); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
475 |
var |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
476 |
t: hwFloat; |
3143 | 477 |
gX,gY: LongInt; |
3139 | 478 |
nuw: boolean; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
479 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
480 |
const uw: boolean = false; |
4 | 481 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
482 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
483 |
gX := hwRound(Gear^.X); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
484 |
gY := hwRound(Gear^.Y); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
485 |
nuw := (cWaterLine < hwRound(Gear^.Y) + Gear^.Radius); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
486 |
if nuw and not uw then |
3139 | 487 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
488 |
AddVisualGear(gX, cWaterLine, vgtSplash); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
489 |
AddVisualGear(gX - 3 + Random(6), cWaterLine, vgtDroplet); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
490 |
AddVisualGear(gX - 3 + Random(6), cWaterLine, vgtDroplet); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
491 |
AddVisualGear(gX - 3 + Random(6), cWaterLine, vgtDroplet); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
492 |
AddVisualGear(gX - 3 + Random(6), cWaterLine, vgtDroplet); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
493 |
StopSound(Gear^.SoundChannel); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
494 |
Gear^.SoundChannel := LoopSound(sndBeeWater); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
495 |
uw := nuw |
3139 | 496 |
end |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
497 |
else if not nuw and uw then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
498 |
begin |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
499 |
AddVisualGear(gX, cWaterLine, vgtSplash); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
500 |
StopSound(Gear^.SoundChannel); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
501 |
Gear^.SoundChannel := LoopSound(sndBee); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
502 |
uw := nuw |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
503 |
end; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
504 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
505 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
506 |
t := Distance(Gear^.dX, Gear^.dY); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
507 |
Gear^.dX := Gear^.Elasticity * (Gear^.dX + _0_000004 * (TargetPoint.X - gX)); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
508 |
Gear^.dY := Gear^.Elasticity * (Gear^.dY + _0_000004 * (TargetPoint.Y - gY)); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
509 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
510 |
t := t / Distance(Gear^.dX, Gear^.dY); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
511 |
Gear^.dX := Gear^.dX * t; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
512 |
Gear^.dY := Gear^.dY * t; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
513 |
Gear^.X := Gear^.X + Gear^.dX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
514 |
Gear^.Y := Gear^.Y + Gear^.dY; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
515 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
516 |
if (GameTicks and $3F) = 0 then |
3139 | 517 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
518 |
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtBeeTrace); |
3139 | 519 |
end; |
520 |
||
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
521 |
CheckCollision(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
522 |
dec(Gear^.Timer); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
523 |
if ((Gear^.State and gstCollision) <> 0) or (Gear^.Timer = 0) then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
524 |
begin |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
525 |
StopSound(Gear^.SoundChannel); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
526 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
527 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
528 |
end; |
4 | 529 |
end; |
530 |
||
3080 | 531 |
procedure doStepBee(Gear: PGear); |
4 | 532 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
533 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
534 |
Gear^.X := Gear^.X + Gear^.dX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
535 |
Gear^.Y := Gear^.Y + Gear^.dY; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
536 |
Gear^.dY := Gear^.dY + cGravity; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
537 |
CheckCollision(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
538 |
if (Gear^.State and gstCollision) <> 0 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
539 |
begin |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
540 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
541 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
542 |
exit |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
543 |
end; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
544 |
dec(Gear^.Timer); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
545 |
if Gear^.Timer = 0 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
546 |
begin |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
547 |
Gear^.SoundChannel := LoopSound(sndBee); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
548 |
Gear^.Timer := 5000; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
549 |
Gear^.doStep := @doStepBeeWork |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
550 |
end; |
4 | 551 |
end; |
552 |
||
553 |
//////////////////////////////////////////////////////////////////////////////// |
|
876 | 554 |
procedure doStepShotIdle(Gear: PGear); |
555 |
begin |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
556 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
557 |
inc(Gear^.Timer); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
558 |
if Gear^.Timer > 75 then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
559 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
560 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
561 |
AfterAttack |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
562 |
end |
876 | 563 |
end; |
564 |
||
4 | 565 |
procedure doStepShotgunShot(Gear: PGear); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
566 |
var |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
567 |
i: LongWord; |
2828 | 568 |
shell: PVisualGear; |
4 | 569 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
570 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
571 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
572 |
if ((Gear^.State and gstAnimation) = 0) then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
573 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
574 |
dec(Gear^.Timer); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
575 |
if Gear^.Timer = 0 then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
576 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
577 |
PlaySound(sndShotgunFire); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
578 |
shell := AddVisualGear(hwRound(Gear^.x), hwRound(Gear^.y), vgtShell); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
579 |
if shell <> nil then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
580 |
begin |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
581 |
shell^.dX := gear^.dX / -4; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
582 |
shell^.dY := gear^.dY / -4; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
583 |
shell^.Frame := 0 |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
584 |
end; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
585 |
Gear^.State := Gear^.State or gstAnimation |
2858 | 586 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
587 |
exit |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
588 |
end |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
589 |
else inc(Gear^.Timer); |
876 | 590 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
591 |
i := 200; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
592 |
repeat |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
593 |
Gear^.X := Gear^.X + Gear^.dX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
594 |
Gear^.Y := Gear^.Y + Gear^.dY; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
595 |
CheckCollision(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
596 |
if (Gear^.State and gstCollision) <> 0 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
597 |
begin |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
598 |
Gear^.X := Gear^.X + Gear^.dX * 8; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
599 |
Gear^.Y := Gear^.Y + Gear^.dY * 8; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
600 |
ShotgunShot(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
601 |
Gear^.doStep := @doStepShotIdle; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
602 |
exit |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
603 |
end; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
604 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
605 |
CheckGearDrowning(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
606 |
if (Gear^.State and gstDrowning) <> 0 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
607 |
begin |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
608 |
Gear^.doStep := @doStepShotIdle; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
609 |
exit |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
610 |
end; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
611 |
dec(i) |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
612 |
until i = 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
613 |
if (hwRound(Gear^.X) and LAND_WIDTH_MASK <> 0) or (hwRound(Gear^.Y) and LAND_HEIGHT_MASK <> 0) |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
614 |
then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
615 |
Gear^.doStep := @doStepShotIdle |
4 | 616 |
end; |
617 |
||
618 |
//////////////////////////////////////////////////////////////////////////////// |
|
2023
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset
|
619 |
procedure doStepBulletWork(Gear: PGear); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
620 |
var |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
621 |
i, x, y: LongWord; |
351 | 622 |
oX, oY: hwFloat; |
38 | 623 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
624 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
625 |
inc(Gear^.Timer); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
626 |
i := 80; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
627 |
oX := Gear^.X; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
628 |
oY := Gear^.Y; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
629 |
repeat |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
630 |
Gear^.X := Gear^.X + Gear^.dX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
631 |
Gear^.Y := Gear^.Y + Gear^.dY; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
632 |
x := hwRound(Gear^.X); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
633 |
y := hwRound(Gear^.Y); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
634 |
if ((y and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
635 |
and (Land[y, x] <> 0) then inc(Gear^.Damage); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
636 |
if Gear^.Damage > 5 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
637 |
if Gear^.Ammo^.AmmoType = amDEagle then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
638 |
AmmoShove(Gear, 7, 20) |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
639 |
else |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
640 |
AmmoShove(Gear, Gear^.Timer, 20); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
641 |
CheckGearDrowning(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
642 |
dec(i) |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
643 |
until (i = 0) or (Gear^.Damage > Gear^.Health) or ((Gear^.State and gstDrowning) <> 0); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
644 |
if Gear^.Damage > 0 then |
2994
7ae3067546f2
Palewolf adds bubbles and splashes when firing bullets into the water
nemo
parents:
2989
diff
changeset
|
645 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
646 |
DrawTunnel(oX, oY, Gear^.dX, Gear^.dY, 82 - i, 1); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
647 |
dec(Gear^.Health, Gear^.Damage); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
648 |
Gear^.Damage := 0 |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
649 |
end; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
650 |
if ((Gear^.State and gstDrowning) <> 0) and (Gear^.Damage < Gear^.Health) and (cWaterOpacity < $FF) then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
651 |
begin |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
652 |
for i:=(Gear^.Health - Gear^.Damage) * 4 downto 0 do |
2994
7ae3067546f2
Palewolf adds bubbles and splashes when firing bullets into the water
nemo
parents:
2989
diff
changeset
|
653 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
654 |
if Random(6) = 0 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
655 |
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtBubble); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
656 |
Gear^.X := Gear^.X + Gear^.dX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
657 |
Gear^.Y := Gear^.Y + Gear^.dY; |
2994
7ae3067546f2
Palewolf adds bubbles and splashes when firing bullets into the water
nemo
parents:
2989
diff
changeset
|
658 |
end; |
7ae3067546f2
Palewolf adds bubbles and splashes when firing bullets into the water
nemo
parents:
2989
diff
changeset
|
659 |
end; |
1760 | 660 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
661 |
if (Gear^.Health <= 0) |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
662 |
or (hwRound(Gear^.X) and LAND_WIDTH_MASK <> 0) |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
663 |
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
|
664 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
665 |
if (Gear^.Kind = gtSniperRifleShot) and ((GameFlags and gfLaserSight) = 0) then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
666 |
cLaserSighting := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
667 |
if (Gear^.Ammo^.NumPerTurn <= CurrentHedgehog^.MultiShootAttacks) and |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
668 |
((GameFlags and gfArtillery) = 0) then cArtillery := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
669 |
Gear^.doStep := @doStepShotIdle |
2031
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2029
diff
changeset
|
670 |
end; |
37 | 671 |
end; |
672 |
||
559 | 673 |
procedure doStepDEagleShot(Gear: PGear); |
674 |
begin |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
675 |
PlaySound(sndGun); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
676 |
Gear^.doStep := @doStepBulletWork |
2023
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset
|
677 |
end; |
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset
|
678 |
|
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset
|
679 |
procedure doStepSniperRifleShot(Gear: PGear); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
680 |
var |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
681 |
HHGear: PGear; |
2828 | 682 |
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
|
683 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
684 |
cArtillery := true; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
685 |
HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
686 |
HHGear^.State := HHGear^.State or gstNotKickable; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
687 |
HedgehogChAngle(HHGear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
688 |
if not cLaserSighting then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
689 |
// 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
|
690 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
691 |
cLaserSighting := true; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
692 |
HHGear^.Message := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
693 |
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
|
694 |
end; |
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2029
diff
changeset
|
695 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
696 |
if (HHGear^.Message and gm_Attack) <> 0 then |
2031
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2029
diff
changeset
|
697 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
698 |
shell := AddVisualGear(hwRound(Gear^.x), hwRound(Gear^.y), vgtShell); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
699 |
if shell <> nil then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
700 |
begin |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
701 |
shell^.dX := gear^.dX / -2; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
702 |
shell^.dY := gear^.dY / -2; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
703 |
shell^.Frame := 1 |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
704 |
end; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
705 |
Gear^.State := Gear^.State or gstAnimation; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
706 |
Gear^.dX := SignAs(AngleSin(HHGear^.Angle), HHGear^.dX) * _0_5; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
707 |
Gear^.dY := -AngleCos(HHGear^.Angle) * _0_5; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
708 |
PlaySound(sndGun); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
709 |
Gear^.doStep := @doStepBulletWork; |
2024
2985f3bd18b7
Disable long jump in artillery mode, make snipre rifle single shot
nemo
parents:
2023
diff
changeset
|
710 |
end |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
711 |
else |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
712 |
if (GameTicks mod 32) = 0 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
713 |
if (GameTicks mod 4096) < 2048 then |
2052 | 714 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
715 |
if (HHGear^.Angle + 1 <= cMaxAngle) then inc(HHGear^.Angle) |
2052 | 716 |
end |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
717 |
else |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
718 |
if (HHGear^.Angle - 1 >= 0) then dec(HHGear^.Angle); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
719 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
720 |
if (TurnTimeLeft > 0) then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
721 |
dec(TurnTimeLeft) |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
722 |
else |
2058 | 723 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
724 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
725 |
AfterAttack |
2058 | 726 |
end; |
559 | 727 |
end; |
728 |
||
37 | 729 |
//////////////////////////////////////////////////////////////////////////////// |
4 | 730 |
procedure doStepActionTimer(Gear: PGear); |
731 |
begin |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
732 |
dec(Gear^.Timer); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
733 |
case Gear^.Kind of |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
734 |
gtATStartGame: |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
735 |
begin |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
736 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
737 |
if Gear^.Timer = 0 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
738 |
begin |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
739 |
AddCaption(trmsg[sidStartFight], cWhiteColor, capgrpGameState); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
740 |
end |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
741 |
end; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
742 |
gtATSmoothWindCh: |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
743 |
begin |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
744 |
if Gear^.Timer = 0 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
745 |
begin |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
746 |
if WindBarWidth < Gear^.Tag then inc(WindBarWidth) |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
747 |
else if WindBarWidth > Gear^.Tag then dec(WindBarWidth); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
748 |
if WindBarWidth <> Gear^.Tag then Gear^.Timer := 10; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
749 |
end |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
750 |
end; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
751 |
gtATFinishGame: |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
752 |
begin |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
753 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
754 |
if Gear^.Timer = 1000 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
755 |
begin |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
756 |
ScreenFade := sfToBlack; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
757 |
ScreenFadeValue := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
758 |
ScreenFadeSpeed := 1; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
759 |
end; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
760 |
if Gear^.Timer = 0 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
761 |
begin |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
762 |
SendIPC('N'); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
763 |
SendIPC('q'); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
764 |
GameState := gsExit |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
765 |
end |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
766 |
end; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
767 |
end; |
351 | 768 |
if Gear^.Timer = 0 then DeleteGear(Gear) |
4 | 769 |
end; |
770 |
||
771 |
//////////////////////////////////////////////////////////////////////////////// |
|
772 |
procedure doStepPickHammerWork(Gear: PGear); |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
773 |
var |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
774 |
i, ei: LongInt; |
4 | 775 |
HHGear: PGear; |
776 |
begin |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
777 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
778 |
HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
779 |
dec(Gear^.Timer); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
780 |
if (Gear^.Timer = 0)or((Gear^.Message and gm_Destroy) <> 0)or((HHGear^.State and gstHHDriven) = |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
781 |
0) then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
782 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
783 |
StopSound(Gear^.SoundChannel); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
784 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
785 |
AfterAttack; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
786 |
exit |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
787 |
end; |
845 | 788 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
789 |
if (Gear^.Timer mod 33) = 0 then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
790 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
791 |
HHGear^.State := HHGear^.State or gstNoDamage; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
792 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y) + 7, 6, EXPLDontDraw); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
793 |
HHGear^.State := HHGear^.State and not gstNoDamage |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
794 |
end; |
422 | 795 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
796 |
if (Gear^.Timer mod 47) = 0 then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
797 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
798 |
i := hwRound(Gear^.X) - Gear^.Radius - LongInt(GetRandom(2)); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
799 |
ei := hwRound(Gear^.X) + Gear^.Radius + LongInt(GetRandom(2)); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
800 |
while i <= ei do |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
801 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
802 |
DrawExplosion(i, hwRound(Gear^.Y) + 3, 3); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
803 |
inc(i, 1) |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
804 |
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
|
805 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
806 |
if CheckLandValue(hwRound(Gear^.X + Gear^.dX + SignAs(_6,Gear^.dX)), hwRound(Gear^.Y + _1_9) |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
807 |
, 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
|
808 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
809 |
Gear^.X := Gear^.X + Gear^.dX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
810 |
Gear^.Y := Gear^.Y + _1_9; |
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
|
811 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
812 |
SetAllHHToActive; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
813 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
814 |
if TestCollisionYwithGear(Gear, 1) then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
815 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
816 |
Gear^.dY := _0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
817 |
SetLittle(HHGear^.dX); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
818 |
HHGear^.dY := _0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
819 |
end |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
820 |
else |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
821 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
822 |
Gear^.dY := Gear^.dY + cGravity; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
823 |
Gear^.Y := Gear^.Y + Gear^.dY; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
824 |
if hwRound(Gear^.Y) > cWaterLine then Gear^.Timer := 1 |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
825 |
end; |
4 | 826 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
827 |
Gear^.X := Gear^.X + HHGear^.dX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
828 |
HHGear^.X := Gear^.X; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
829 |
HHGear^.Y := Gear^.Y - int2hwFloat(cHHRadius); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
830 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
831 |
if (Gear^.Message and gm_Attack) <> 0 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
832 |
if (Gear^.State and gsttmpFlag) <> 0 then Gear^.Timer := 1 |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
833 |
else |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
834 |
else |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
835 |
if (Gear^.State and gsttmpFlag) = 0 then Gear^.State := Gear^.State or gsttmpFlag; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
836 |
if ((Gear^.Message and gm_Left) <> 0) then Gear^.dX := - _0_3 |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
837 |
else |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
838 |
if ((Gear^.Message and gm_Right) <> 0) then Gear^.dX := _0_3 |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
839 |
else Gear^.dX := _0; |
4 | 840 |
end; |
841 |
||
842 |
procedure doStepPickHammer(Gear: PGear); |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
843 |
var |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
844 |
i, y: LongInt; |
4 | 845 |
ar: TRangeArray; |
911
b709fe13ed69
Fix issue with hedgehog on top of the hedgehog with pickhammer
unc0rr
parents:
883
diff
changeset
|
846 |
HHGear: PGear; |
4 | 847 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
848 |
i := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
849 |
HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
850 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
851 |
y := hwRound(Gear^.Y) - cHHRadius * 2; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
852 |
while y < hwRound(Gear^.Y) do |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
853 |
begin |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
854 |
ar[i].Left := hwRound(Gear^.X) - Gear^.Radius - LongInt(GetRandom(2)); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
855 |
ar[i].Right := hwRound(Gear^.X) + Gear^.Radius + LongInt(GetRandom(2)); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
856 |
inc(y, 2); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
857 |
inc(i) |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
858 |
end; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
859 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
860 |
DrawHLinesExplosions(@ar, 3, hwRound(Gear^.Y) - cHHRadius * 2, 2, Pred(i)); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
861 |
Gear^.dY := HHGear^.dY; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
862 |
DeleteCI(HHGear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
863 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
864 |
Gear^.SoundChannel := LoopSound(sndPickhammer); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
865 |
doStepPickHammerWork(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
866 |
Gear^.doStep := @doStepPickHammerWork |
4 | 867 |
end; |
868 |
||
869 |
//////////////////////////////////////////////////////////////////////////////// |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
870 |
var |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
871 |
BTPrevAngle, BTSteps: LongInt; |
302 | 872 |
|
303
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
873 |
procedure doStepBlowTorchWork(Gear: PGear); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
874 |
var |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
875 |
HHGear: PGear; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
876 |
b: boolean; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
877 |
prevX: LongInt; |
302 | 878 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
879 |
AllInactive := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
880 |
dec(Gear^.Timer); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
881 |
HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
882 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
883 |
HedgehogChAngle(HHGear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
884 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
885 |
b := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
886 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
887 |
if abs(LongInt(HHGear^.Angle) - BTPrevAngle) > 7 then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
888 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
889 |
Gear^.dX := SignAs(AngleSin(HHGear^.Angle) * _0_5, HHGear^.dX); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
890 |
Gear^.dY := AngleCos(HHGear^.Angle) * ( - _0_5); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
891 |
BTPrevAngle := HHGear^.Angle; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
892 |
b := true |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
893 |
end; |
1528 | 894 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
895 |
if ((HHGear^.State and gstMoving) <> 0) then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
896 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
897 |
doStepHedgehogMoving(HHGear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
898 |
if (HHGear^.State and gstHHDriven) = 0 then Gear^.Timer := 0 |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
899 |
end; |
305 | 900 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
901 |
if Gear^.Timer mod cHHStepTicks = 0 then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
902 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
903 |
b := true; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
904 |
if Gear^.dX.isNegative then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
905 |
HHGear^.Message := (HHGear^.Message and (gm_Attack or gm_Up or gm_Down)) or gm_Left |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
906 |
else |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
907 |
HHGear^.Message := (HHGear^.Message and (gm_Attack or gm_Up or gm_Down)) or gm_Right; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
908 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
909 |
if ((HHGear^.State and gstMoving) = 0) then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
910 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
911 |
HHGear^.State := HHGear^.State and not gstAttacking; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
912 |
prevX := hwRound(HHGear^.X); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
913 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
914 |
// why the call to HedgehogStep then a further increment of X? |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
915 |
if (prevX = hwRound(HHGear^.X)) and |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
916 |
CheckLandValue(hwRound(HHGear^.X + SignAs(_6, HHGear^.dX)), hwRound(HHGear^.Y), |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
917 |
COLOR_INDESTRUCTIBLE) then HedgehogStep(HHGear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
918 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
919 |
if (prevX = hwRound(HHGear^.X)) and |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
920 |
CheckLandValue(hwRound(HHGear^.X + SignAs(_6, HHGear^.dX)), hwRound(HHGear^.Y), |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
921 |
COLOR_INDESTRUCTIBLE) then HHGear^.X := HHGear^.X + SignAs(_1, HHGear^.dX); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
922 |
HHGear^.State := HHGear^.State or gstAttacking |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
923 |
end; |
305 | 924 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
925 |
inc(BTSteps); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
926 |
if BTSteps = 7 then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
927 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
928 |
BTSteps := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
929 |
if CheckLandValue(hwRound(HHGear^.X + Gear^.dX * (cHHRadius + cBlowTorchC) + SignAs(_6, |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
930 |
Gear^.dX)), hwRound(HHGear^.Y + Gear^.dY * (cHHRadius + cBlowTorchC)), |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
931 |
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
|
932 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
933 |
Gear^.X := HHGear^.X + Gear^.dX * (cHHRadius + cBlowTorchC); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
934 |
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
|
935 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
936 |
HHGear^.State := HHGear^.State or gstNoDamage; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
937 |
AmmoShove(Gear, 2, 15); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
938 |
HHGear^.State := HHGear^.State and not gstNoDamage |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
939 |
end; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
940 |
end; |
305 | 941 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
942 |
if b then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
943 |
DrawTunnel(HHGear^.X - Gear^.dX * cHHRadius, HHGear^.Y - _4 - Gear^.dY * cHHRadius + hwAbs( |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
944 |
Gear^.dY) * 7, |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
945 |
Gear^.dX, Gear^.dY, |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
946 |
cHHRadius * 5, cHHRadius * 2 + 7); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
947 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
948 |
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
|
949 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
950 |
HHGear^.Message := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
951 |
HHGear^.State := HHGear^.State and (not gstNotKickable); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
952 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
953 |
AfterAttack |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
954 |
end |
302 | 955 |
end; |
956 |
||
303
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
957 |
procedure doStepBlowTorch(Gear: PGear); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
958 |
var |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
959 |
HHGear: PGear; |
303
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
960 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
961 |
BTPrevAngle := High(LongInt); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
962 |
BTSteps := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
963 |
HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
964 |
HHGear^.Message := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
965 |
HHGear^.State := HHGear^.State or gstNotKickable; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
966 |
Gear^.doStep := @doStepBlowTorchWork |
303
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
967 |
end; |
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
968 |
|
302 | 969 |
//////////////////////////////////////////////////////////////////////////////// |
970 |
||
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
971 |
procedure doStepRope(Gear: PGear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
972 |
forward; |
1781 | 973 |
|
974 |
procedure doStepRopeAfterAttack(Gear: PGear); |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
975 |
var |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
976 |
HHGear: PGear; |
1781 | 977 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
978 |
HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
979 |
if ((HHGear^.State and gstHHDriven) = 0) |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
980 |
or (CheckGearDrowning(HHGear)) |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
981 |
or TestCollisionYwithGear(HHGear, 1) then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
982 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
983 |
DeleteGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
984 |
isCursorVisible := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
985 |
ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
986 |
exit |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
987 |
end; |
1781 | 988 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
989 |
HedgehogChAngle(HHGear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
990 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
991 |
if TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then SetLittle(HHGear^.dX); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
992 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
993 |
if HHGear^.dY.isNegative and TestCollisionYwithGear(HHGear, -1) then HHGear^.dY := _0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
994 |
HHGear^.X := HHGear^.X + HHGear^.dX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
995 |
HHGear^.Y := HHGear^.Y + HHGear^.dY; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
996 |
HHGear^.dY := HHGear^.dY + cGravity; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
997 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
998 |
if (Gear^.Message and gm_Attack) <> 0 then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
999 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1000 |
Gear^.X := HHGear^.X; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1001 |
Gear^.Y := HHGear^.Y; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1002 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1003 |
ApplyAngleBounds(PHedgehog(Gear^.Hedgehog)^, amRope); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1004 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1005 |
Gear^.dX := SignAs(AngleSin(HHGear^.Angle), HHGear^.dX); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1006 |
Gear^.dY := -AngleCos(HHGear^.Angle); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1007 |
Gear^.Friction := _450; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1008 |
Gear^.Elasticity := _0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1009 |
Gear^.State := Gear^.State and not gsttmpflag; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1010 |
Gear^.doStep := @doStepRope; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1011 |
end |
1781 | 1012 |
end; |
1013 |
||
4 | 1014 |
procedure doStepRopeWork(Gear: PGear); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1015 |
var |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1016 |
HHGear: PGear; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1017 |
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
|
1018 |
lx, ly: LongInt; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1019 |
haveCollision, |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1020 |
haveDivided: boolean; |
4 | 1021 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1022 |
procedure DeleteMe; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1023 |
begin |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1024 |
with HHGear^ do |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1025 |
begin |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1026 |
Message := Message and not gm_Attack; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1027 |
State := (State or gstMoving) and not gstWinner; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1028 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1029 |
DeleteGear(Gear) |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1030 |
end; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1031 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1032 |
procedure WaitCollision; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1033 |
begin |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1034 |
with HHGear^ do |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1035 |
begin |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1036 |
Message := Message and not gm_Attack; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1037 |
State := State or gstMoving; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1038 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1039 |
RopePoints.Count := 0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1040 |
Gear^.Elasticity := _0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1041 |
Gear^.doStep := @doStepRopeAfterAttack |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1042 |
end; |
1781 | 1043 |
|
4 | 1044 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1045 |
HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1046 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1047 |
if ((HHGear^.State and gstHHDriven) = 0) |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1048 |
or (CheckGearDrowning(HHGear)) then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1049 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1050 |
PlaySound(sndRopeRelease); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1051 |
DeleteMe; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1052 |
exit |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1053 |
end; |
928
b9064b48b001
Some preparation work for attacking from rope, parachute and etc.
unc0rr
parents:
925
diff
changeset
|
1054 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1055 |
if (Gear^.Message and gm_Left <> 0) then HHGear^.dX := HHGear^.dX - _0_0002 |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1056 |
else |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1057 |
if (Gear^.Message and gm_Right <> 0) then HHGear^.dX := HHGear^.dX + _0_0002; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1058 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1059 |
if not TestCollisionYwithGear(HHGear, 1) then HHGear^.dY := HHGear^.dY + cGravity; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1060 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1061 |
ropeDx := HHGear^.X - Gear^.X; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1062 |
// vector between hedgehog and rope attaching point |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1063 |
ropeDy := HHGear^.Y - Gear^.Y; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1064 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1065 |
mdX := ropeDx + HHGear^.dX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1066 |
mdY := ropeDy + HHGear^.dY; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1067 |
len := _1 / Distance(mdX, mdY); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1068 |
mdX := mdX * len; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1069 |
// rope vector plus hedgehog direction vector normalized |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1070 |
mdY := mdY * len; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1071 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1072 |
Gear^.dX := mdX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1073 |
// for visual purposes only |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1074 |
Gear^.dY := mdY; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1075 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1076 |
///// |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1077 |
tx := HHGear^.X; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1078 |
ty := HHGear^.Y; |
4 | 1079 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1080 |
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
|
1081 |
if not (TestCollisionXwithGear(HHGear, hwSign(ropeDx)) |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1082 |
or TestCollisionYwithGear(HHGear, hwSign(ropeDy))) then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1083 |
Gear^.Elasticity := Gear^.Elasticity + _0_3; |
1652 | 1084 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1085 |
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
|
1086 |
if not (TestCollisionXwithGear(HHGear, -hwSign(ropeDx)) |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1087 |
or TestCollisionYwithGear(HHGear, -hwSign(ropeDy))) then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1088 |
Gear^.Elasticity := Gear^.Elasticity - _0_3; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1089 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1090 |
HHGear^.X := Gear^.X + mdX * Gear^.Elasticity; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1091 |
HHGear^.Y := Gear^.Y + mdY * Gear^.Elasticity; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1092 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1093 |
HHGear^.dX := HHGear^.X - tx; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1094 |
HHGear^.dY := HHGear^.Y - ty; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1095 |
//// |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1096 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1097 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1098 |
haveDivided := false; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1099 |
// check whether rope needs dividing |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1100 |
len := _1 / Distance(ropeDx, ropeDy); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1101 |
// old rope pos |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1102 |
nx := ropeDx * len; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1103 |
ny := ropeDy * len; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1104 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1105 |
len := Gear^.Elasticity - _5; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1106 |
while len > _3 do |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1107 |
begin |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1108 |
lx := hwRound(Gear^.X + mdX * len); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1109 |
ly := hwRound(Gear^.Y + mdY * len); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1110 |
if ((ly and LAND_HEIGHT_MASK) = 0) and ((lx and LAND_WIDTH_MASK) = 0) and (Land[ly, lx] <> 0 |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1111 |
) then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1112 |
begin |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1113 |
with RopePoints.ar[RopePoints.Count] do |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1114 |
begin |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1115 |
X := Gear^.X; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1116 |
Y := Gear^.Y; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1117 |
if RopePoints.Count = 0 then RopePoints.HookAngle := DxDy2Angle(Gear^.dY, Gear^.dX); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1118 |
b := (nx * HHGear^.dY) > (ny * HHGear^.dX); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1119 |
dLen := len |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1120 |
end; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1121 |
with RopePoints.rounded[RopePoints.Count] do |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1122 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1123 |
X := hwRound(Gear^.X); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1124 |
Y := hwRound(Gear^.Y); |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1125 |
end; |
1553
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset
|
1126 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1127 |
Gear^.X := Gear^.X + nx * len; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1128 |
Gear^.Y := Gear^.Y + ny * len; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1129 |
inc(RopePoints.Count); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1130 |
TryDo(RopePoints.Count <= MAXROPEPOINTS, 'Rope points overflow', true); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1131 |
Gear^.Elasticity := Gear^.Elasticity - len; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1132 |
Gear^.Friction := Gear^.Friction - len; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1133 |
haveDivided := true; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1134 |
break |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1135 |
end; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1136 |
len := len - _0_3 // should be the same as increase step |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1137 |
end; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1138 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1139 |
if not haveDivided then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1140 |
if RopePoints.Count > 0 then // check whether the last dividing point could be removed |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1141 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1142 |
tx := RopePoints.ar[Pred(RopePoints.Count)].X; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1143 |
ty := RopePoints.ar[Pred(RopePoints.Count)].Y; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1144 |
mdX := tx - Gear^.X; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1145 |
mdY := ty - Gear^.Y; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1146 |
if RopePoints.ar[Pred(RopePoints.Count)].b xor (mdX * (ty - HHGear^.Y) > (tx - HHGear^.X |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1147 |
) * mdY) then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1148 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1149 |
dec(RopePoints.Count); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1150 |
Gear^.X := RopePoints.ar[RopePoints.Count].X; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1151 |
Gear^.Y := RopePoints.ar[RopePoints.Count].Y; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1152 |
Gear^.Elasticity := Gear^.Elasticity + RopePoints.ar[RopePoints.Count].dLen; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1153 |
Gear^.Friction := Gear^.Friction + RopePoints.ar[RopePoints.Count].dLen; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1154 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1155 |
// restore hog position |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1156 |
len := _1 / Distance(mdX, mdY); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1157 |
mdX := mdX * len; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1158 |
mdY := mdY * len; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1159 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1160 |
HHGear^.X := Gear^.X - mdX * Gear^.Elasticity; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1161 |
HHGear^.Y := Gear^.Y - mdY * Gear^.Elasticity; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1162 |
end |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1163 |
end; |
4 | 1164 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1165 |
haveCollision := false; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1166 |
if TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1167 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1168 |
HHGear^.dX := -_0_6 * HHGear^.dX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1169 |
haveCollision := true |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1170 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1171 |
if TestCollisionYwithGear(HHGear, hwSign(HHGear^.dY)) then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1172 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1173 |
HHGear^.dY := -_0_6 * HHGear^.dY; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1174 |
haveCollision := true |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1175 |
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
|
1176 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1177 |
if haveCollision |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1178 |
and (Gear^.Message and (gm_Left or gm_Right) <> 0) |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1179 |
and (Gear^.Message and (gm_Up or gm_Down) <> 0) then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1180 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1181 |
HHGear^.dX := SignAs(hwAbs(HHGear^.dX) + _0_2, HHGear^.dX); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1182 |
HHGear^.dY := SignAs(hwAbs(HHGear^.dY) + _0_2, HHGear^.dY) |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1183 |
end; |
4 | 1184 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1185 |
len := Distance(HHGear^.dX, HHGear^.dY); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1186 |
if len > _0_8 then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1187 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1188 |
len := _0_8 / len; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1189 |
HHGear^.dX := HHGear^.dX * len; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1190 |
HHGear^.dY := HHGear^.dY * len; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1191 |
end; |
789 | 1192 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1193 |
if (Gear^.Message and gm_Attack) <> 0 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1194 |
if (Gear^.State and gsttmpFlag) <> 0 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1195 |
with PHedgehog(Gear^.Hedgehog)^ do |
3320 | 1196 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1197 |
PlaySound(sndRopeRelease); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1198 |
if Ammo^[CurSlot, CurAmmo].AmmoType <> amParachute then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1199 |
WaitCollision |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1200 |
else |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1201 |
DeleteMe |
3320 | 1202 |
end |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1203 |
else |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1204 |
else |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1205 |
if (Gear^.State and gsttmpFlag) = 0 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1206 |
Gear^.State := Gear^.State or gsttmpFlag; |
4 | 1207 |
end; |
1208 |
||
1209 |
procedure doStepRopeAttach(Gear: PGear); |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1210 |
var |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1211 |
HHGear: PGear; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1212 |
tx, ty, tt: hwFloat; |
1781 | 1213 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1214 |
procedure RemoveFromAmmo; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1215 |
begin |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1216 |
if (Gear^.State and gstAttacked) = 0 then |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1217 |
begin |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1218 |
OnUsedAmmo(PHedgehog(HHGear^.Hedgehog)^); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1219 |
Gear^.State := Gear^.State or gstAttacked |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1220 |
end; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1221 |
ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^) |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1222 |
end; |
2376 | 1223 |
|
4 | 1224 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1225 |
Gear^.X := Gear^.X - Gear^.dX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1226 |
Gear^.Y := Gear^.Y - Gear^.dY; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1227 |
Gear^.Elasticity := Gear^.Elasticity + _1; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1228 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1229 |
HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1230 |
DeleteCI(HHGear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1231 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1232 |
if (HHGear^.State and gstMoving) <> 0 then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1233 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1234 |
if TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then SetLittle(HHGear^.dX); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1235 |
if HHGear^.dY.isNegative and TestCollisionYwithGear(HHGear, -1) then HHGear^.dY := _0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1236 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1237 |
HHGear^.X := HHGear^.X + HHGear^.dX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1238 |
Gear^.X := Gear^.X + HHGear^.dX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1239 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1240 |
if TestCollisionYwithGear(HHGear, 1) then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1241 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1242 |
CheckHHDamage(HHGear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1243 |
HHGear^.dY := _0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1244 |
//HHGear^.State:= HHGear^.State and not (gstHHJumping or gstHHHJump); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1245 |
end |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1246 |
else |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1247 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1248 |
HHGear^.Y := HHGear^.Y + HHGear^.dY; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1249 |
Gear^.Y := Gear^.Y + HHGear^.dY; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1250 |
HHGear^.dY := HHGear^.dY + cGravity; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1251 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1252 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1253 |
tt := Gear^.Elasticity; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1254 |
tx := _0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1255 |
ty := _0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1256 |
while tt > _20 do |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1257 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1258 |
if TestCollisionXwithXYShift(Gear, tx, hwRound(ty), -hwSign(Gear^.dX)) |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1259 |
or TestCollisionYwithXYShift(Gear, hwRound(tx), hwRound(ty), -hwSign(Gear^.dY)) then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1260 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1261 |
Gear^.X := Gear^.X + tx; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1262 |
Gear^.Y := Gear^.Y + ty; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1263 |
Gear^.Elasticity := tt; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1264 |
Gear^.doStep := @doStepRopeWork; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1265 |
PlaySound(sndRopeAttach); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1266 |
with HHGear^ do |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1267 |
State := State and not (gstAttacking or gstHHJumping or gstHHHJump); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1268 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1269 |
RemoveFromAmmo; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1270 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1271 |
tt := _0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1272 |
exit |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1273 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1274 |
tx := tx + Gear^.dX + Gear^.dX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1275 |
ty := ty + Gear^.dY + Gear^.dY; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1276 |
tt := tt - _2; |
2948
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 |
end; |
929
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1279 |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1280 |
CheckCollision(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1281 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1282 |
if (Gear^.State and gstCollision) <> 0 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1283 |
if Gear^.Elasticity < _10 then |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1284 |
Gear^.Elasticity := _10000 |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1285 |
else |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1286 |
begin |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1287 |
Gear^.doStep := @doStepRopeWork; |
3320 | 1288 |
PlaySound(sndRopeAttach); |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1289 |
with HHGear^ do |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1290 |
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
|
1291 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1292 |
RemoveFromAmmo; |
2376 | 1293 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1294 |
exit |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1295 |
end; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1296 |
|
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1297 |
if (Gear^.Elasticity > Gear^.Friction) |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1298 |
or ((Gear^.Message and gm_Attack) = 0) |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1299 |
or ((HHGear^.State and gstHHDriven) = 0) |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1300 |
or (HHGear^.Damage > 0) then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1301 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1302 |
with PHedgehog(Gear^.Hedgehog)^.Gear^ do |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1303 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1304 |
State := State and not gstAttacking; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1305 |
Message := Message and not gm_Attack |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1306 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1307 |
DeleteGear(Gear) |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1308 |
end |
4 | 1309 |
end; |
1310 |
||
1311 |
procedure doStepRope(Gear: PGear); |
|
1312 |
begin |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1313 |
Gear^.dX := - Gear^.dX; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1314 |
Gear^.dY := - Gear^.dY; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1315 |
Gear^.doStep := @doStepRopeAttach; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1316 |
PlaySound(sndRopeShot) |
4 | 1317 |
end; |
1318 |
||
1319 |
//////////////////////////////////////////////////////////////////////////////// |
|
10 | 1320 |
procedure doStepMine(Gear: PGear); |
1321 |
begin |
|
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1322 |
if (Gear^.State and gstMoving) <> 0 then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1323 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1324 |
DeleteCI(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1325 |
doStepFallingGear(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1326 |
if (Gear^.State and gstMoving) = 0 then |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1327 |
begin |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1328 |
AddGearCI(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1329 |
Gear^.dX := _0; |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1330 |
Gear^.dY := _0 |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2944
diff
changeset
|
1331 |
end; |
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1332 |
CalcRotationDirAngle(Gear); |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|
1333 |
AllInactive := false |
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
|