author  Palewolf 
Fri, 31 Dec 2010 00:37:39 +0100  
changeset 4791  458d9854c679 
parent 4790  4cb3f7890fbd 
child 4792  68f9b331014a 
permissions  rwrr 
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) 20042010 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 021111307, USA 

4  17 
*) 
18 

3569  19 
procedure doStepPerPixel(Gear: PGear; step: TGearStepProcedure; onlyCheckIfChanged: boolean); 
20 
var 

21 
dX, dY, sX, sY: hwFloat; 

22 
i, steps: LongWord; 

23 
caller: TGearStepProcedure; 

24 
begin 

25 
dX:= Gear^.dX; 

26 
dY:= Gear^.dY; 

27 
steps:= max(abs(hwRound(Gear^.X+dX)hwRound(Gear^.X)), abs(hwRound(Gear^.Y+dY)hwRound(Gear^.Y))); 

28 

29 
// Gear is still on the same Pixel it was before 

30 
if steps < 1 then 

4578  31 
begin 
3569  32 
if onlyCheckIfChanged then 
4578  33 
begin 
3569  34 
Gear^.X := Gear^.X + dX; 
35 
Gear^.Y := Gear^.Y + dY; 

36 
EXIT; 

4578  37 
end 
3569  38 
else 
39 
steps := 1; 

4578  40 
end; 
3569  41 

42 
if steps > 1 then 

4578  43 
begin 
3569  44 
sX:= dX / steps; 
45 
sY:= dY / steps; 

4578  46 
end 
3569  47 
else 
4578  48 
begin 
3569  49 
sX:= dX; 
50 
sY:= dY; 

4578  51 
end; 
3569  52 

53 
caller:= Gear^.doStep; 

54 

55 
for i:= 1 to steps do 

4578  56 
begin 
3569  57 
Gear^.X := Gear^.X + sX; 
58 
Gear^.Y := Gear^.Y + sY; 

59 
step(Gear); 

60 
if (Gear^.doStep <> caller) 

61 
or ((Gear^.State and gstCollision) <> 0) 

62 
or ((Gear^.State and gstMoving) = 0) then 

63 
break; 

4578  64 
end; 
3569  65 
end; 
66 

2647  67 
procedure makeHogsWorry(x, y: hwFloat; r: LongInt); 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

68 
var 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

69 
gi: PGear; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

70 
d: LongInt; 
2647  71 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

72 
gi := GearsList; 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

73 
while gi <> nil do 
4578  74 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

75 
if (gi^.Kind = gtHedgehog) then 
4578  76 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

77 
d := r  hwRound(Distance(gi^.X  x, gi^.Y  y)); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

78 
if (d > 1) and not gi^.Invulnerable and (GetRandom(2) = 0) then 
4578  79 
begin 
3143  80 
if (CurrentHedgehog^.Gear = gi) then 
4372  81 
PlaySound(sndOops, gi^.Hedgehog^.Team^.voicepack) 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

82 
else 
4578  83 
begin 
3143  84 
if (gi^.State and gstMoving) = 0 then 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

85 
gi^.State := gi^.State or gstLoser; 
3143  86 
if d > r div 2 then 
4372  87 
PlaySound(sndNooo, gi^.Hedgehog^.Team^.voicepack) 
3143  88 
else 
4372  89 
PlaySound(sndUhOh, gi^.Hedgehog^.Team^.voicepack); 
4578  90 
end; 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

91 
end; 
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

92 
end; 
4578  93 
gi := gi^.NextGear 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

94 
end; 
2647  95 
end; 
96 
//////////////////////////////////////////////////////////////////////////////// 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

97 
procedure doStepDrowningGear(Gear: PGear); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

98 
forward; 
4  99 

100 
function CheckGearDrowning(Gear: PGear): boolean; 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

101 
var 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

102 
skipSpeed, skipAngle, skipDecay: hwFloat; 
2982  103 
i, maxDrops: LongInt; 
104 
particle: PVisualGear; 

3907
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset

105 
isSubmersible: boolean; 
4  106 
begin 
3907
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset

107 
isSubmersible:= (Gear = CurrentHedgehog^.Gear) and (CurAmmoGear <> nil) and (CurAmmoGear^.AmmoType = amJetpack); 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

108 
// 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

109 
if cWaterLine < hwRound(Gear^.Y) + Gear^.Radius then 
4578  110 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

111 
skipSpeed := _0_25; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

112 
skipAngle := _1_9; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

113 
skipDecay := _0_87; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

114 
// this could perhaps be a tiny bit higher. 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

115 
if (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) > skipSpeed) and 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

116 
(hwAbs(Gear^.dX) > skipAngle * hwAbs(Gear^.dY)) then 
4578  117 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

118 
Gear^.dY.isNegative := true; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

119 
Gear^.dY := Gear^.dY * skipDecay; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

120 
Gear^.dX := Gear^.dX * skipDecay; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

121 
CheckGearDrowning := false; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

122 
PlaySound(sndSkip) 
4578  123 
end 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

124 
else 
4578  125 
begin 
3907
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset

126 
if not isSubmersible then 
4578  127 
begin 
3907
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset

128 
CheckGearDrowning := true; 
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset

129 
Gear^.State := gstDrowning; 
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset

130 
Gear^.RenderTimer := false; 
4578  131 
if (Gear^.Kind <> gtSniperRifleShot) and (Gear^.Kind <> gtShotgunShot) and 
132 
(Gear^.Kind <> gtDEagleShot) and (Gear^.Kind <> gtSineGunShot) then 

3907
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset

133 
if Gear^.Kind = gtHedgehog then 
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset

134 
begin 
4365  135 
if Gear^.Hedgehog^.Effects[heResurrectable] then 
3907
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset

136 
ResurrectHedgehog(Gear) 
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset

137 
else 
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset

138 
begin 
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset

139 
Gear^.doStep := @doStepDrowningGear; 
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset

140 
Gear^.State := Gear^.State and (not gstHHDriven); 
4365  141 
AddCaption(Format(GetEventString(eidDrowned), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage); 
3907
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset

142 
end 
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset

143 
end 
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset

144 
else 
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset

145 
Gear^.doStep := @doStepDrowningGear 
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset

146 
end; 
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset

147 
if ((not isSubmersible) and (hwRound(Gear^.Y) < cWaterLine + 64 + Gear^.Radius)) or 
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset

148 
(isSubmersible and (hwRound(Gear^.Y) < cWaterLine + 2 + Gear^.Radius) and ((CurAmmoGear^.Pos = 0) and (CurAmmoGear^.dY < _0_01))) then 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

149 
// 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

150 
PlaySound(sndSplash) 
1918  151 
end; 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

152 

3907
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset

153 
if ((cReducedQuality and rqPlainSplash) = 0) and 
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset

154 
(((not isSubmersible) and (hwRound(Gear^.Y) < cWaterLine + 64 + Gear^.Radius)) or 
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset

155 
(isSubmersible and (hwRound(Gear^.Y) < cWaterLine + 2 + Gear^.Radius) and ((CurAmmoGear^.Pos = 0) and (CurAmmoGear^.dY < _0_01)))) then 
4578  156 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

157 
AddVisualGear(hwRound(Gear^.X), cWaterLine, vgtSplash); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

158 

a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

159 
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

160 
dY * Gear^.Radius * 2); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

161 
for i:= max(maxDrops div 3, min(32, Random(maxDrops))) downto 0 do 
4578  162 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

163 
particle := AddVisualGear(hwRound(Gear^.X)  3 + Random(6), cWaterLine, vgtDroplet); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

164 
if particle <> nil then 
4578  165 
begin 
3593
ae50f63e4fa9
Remove hwFloat from VisualGears  they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3591
diff
changeset

166 
particle^.dX := particle^.dX  (Gear^.dX.QWordValue / 42949672960); 
ae50f63e4fa9
Remove hwFloat from VisualGears  they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3591
diff
changeset

167 
particle^.dY := particle^.dY  (Gear^.dY.QWordValue / 21474836480) 
4578  168 
end 
2982  169 
end 
4578  170 
end; 
3907
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset

171 
if isSubmersible and (CurAmmoGear^.Pos = 0) then CurAmmoGear^.Pos := 1000 
1918  172 
end 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

173 
else 
3907
5b516f0d9957
Allow UFO to go underwater. Keep UFO active if it runs out of fuel in the air/water, just disable controls.
nemo
parents:
3894
diff
changeset

174 
CheckGearDrowning := false; 
4  175 
end; 
176 

4397
ab577db125c4
Disable rope attach to hogs/crates/barrels etc. Should fix a bug in collision according to unc0rr
nemo
parents:
4396
diff
changeset

177 
procedure CheckCollision(Gear: PGear); inline; 
4  178 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

179 
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

180 
) 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

181 
then Gear^.State := Gear^.State or gstCollision 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

182 
else Gear^.State := Gear^.State and not gstCollision 
4  183 
end; 
184 

185 
procedure CheckHHDamage(Gear: PGear); 

2848  186 
var 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

187 
dmg: Longword; 
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

188 
i: LongInt; 
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

189 
particle: PVisualGear; 
4  190 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

191 
if _0_4 < Gear^.dY then 
4578  192 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

193 
dmg := ModifyDamage(1 + hwRound((hwAbs(Gear^.dY)  _0_4) * 70), Gear); 
3851  194 
PlaySound(sndBump); 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

195 
if dmg < 1 then exit; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

196 

a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

197 
for i:= min(12, (3 + dmg div 10)) downto 0 do 
4578  198 
begin 
199 
particle := AddVisualGear(hwRound(Gear^.X)  5 + Random(10), hwRound(Gear^.Y) + 12, vgtDust); 

3593
ae50f63e4fa9
Remove hwFloat from VisualGears  they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3591
diff
changeset

200 
if particle <> nil then particle^.dX := particle^.dX + (Gear^.dX.QWordValue / 21474836480); 
4578  201 
end; 
2871
eec42a0b7014
rearrange fall damage a bit so invulnerability still causes dust
nemo
parents:
2859
diff
changeset

202 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

203 
if (Gear^.Invulnerable) then exit; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

204 

3682  205 
//if _0_6 < Gear^.dY then 
4365  206 
// PlaySound(sndOw4, Gear^.Hedgehog^.Team^.voicepack) 
3682  207 
//else 
4365  208 
// PlaySound(sndOw1, Gear^.Hedgehog^.Team^.voicepack); 
3682  209 

210 
ApplyDamage(Gear, dmg, dsFall); 

2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

211 
end 
4  212 
end; 
213 

214 
//////////////////////////////////////////////////////////////////////////////// 

215 
//////////////////////////////////////////////////////////////////////////////// 

216 
procedure CalcRotationDirAngle(Gear: PGear); 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

217 
var 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

218 
dAngle: real; 
4  219 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

220 
dAngle := (Gear^.dX.QWordValue + Gear^.dY.QWordValue) / $80000000; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

221 
if not Gear^.dX.isNegative then 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

222 
Gear^.DirAngle := Gear^.DirAngle + dAngle 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

223 
else 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

224 
Gear^.DirAngle := Gear^.DirAngle  dAngle; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

225 

a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

226 
if Gear^.DirAngle < 0 then Gear^.DirAngle := Gear^.DirAngle + 360 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

227 
else if 360 < Gear^.DirAngle then Gear^.DirAngle := Gear^.DirAngle  360 
4  228 
end; 
229 

230 
//////////////////////////////////////////////////////////////////////////////// 

231 
procedure doStepDrowningGear(Gear: PGear); 

232 
begin 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

233 
AllInactive := false; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

234 
Gear^.Y := Gear^.Y + cDrownSpeed; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

235 
Gear^.X := Gear^.X + Gear^.dX * cDrownSpeed; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

236 
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

237 
DeleteGear(Gear); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

238 
// 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

239 
if (cWaterOpacity < $FF) and ((GameTicks and $1F) = 0) then 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

240 
if (Gear^.Kind = gtHedgehog) and (Random(4) = 0) then 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

241 
AddVisualGear(hwRound(Gear^.X)  Gear^.Radius, hwRound(Gear^.Y)  Gear^.Radius, 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

242 
vgtBubble) 
2225  243 
else if Random(12) = 0 then 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

244 
AddVisualGear(hwRound(Gear^.X)  Gear^.Radius, hwRound(Gear^.Y)  Gear^.Radius, 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

245 
vgtBubble) 
4  246 
end; 
247 

248 
//////////////////////////////////////////////////////////////////////////////// 

249 
procedure doStepFallingGear(Gear: PGear); 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

250 
var 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

251 
isFalling: boolean; 
3020  252 
//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

253 
tdX, tdY: hwFloat; 
3001  254 
collV, collH: LongInt; 
4  255 
begin 
3915
c05855146440
Correct bug in flight ceiling for birdy as well, increase clip on velocity to 1.9 (shouldn't cause problems with most collision checks still), apply clip to both + and 
nemo
parents:
3909
diff
changeset

256 
// clip velocity at 1.9  over 1 per pixel, but really shouldn't cause many actual problems. 
c05855146440
Correct bug in flight ceiling for birdy as well, increase clip on velocity to 1.9 (shouldn't cause problems with most collision checks still), apply clip to both + and 
nemo
parents:
3909
diff
changeset

257 
if Gear^.dX.QWordValue > 8160437862 then Gear^.dX.QWordValue:= 8160437862; 
c05855146440
Correct bug in flight ceiling for birdy as well, increase clip on velocity to 1.9 (shouldn't cause problems with most collision checks still), apply clip to both + and 
nemo
parents:
3909
diff
changeset

258 
if Gear^.dY.QWordValue > 8160437862 then Gear^.dY.QWordValue:= 8160437862; 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

259 
Gear^.State := Gear^.State and not gstCollision; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

260 
collV := 0; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

261 
collH := 0; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

262 
tdX := Gear^.dX; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

263 
tdY := Gear^.dY; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

264 

503  265 

3359  266 
// might need some testing/adjustments  just to avoid projectiles to fly forever (accelerated by wind/skips) 
3609
bc63ed514b70
Minor fire tweak for readability and lethalness, remove exit condition that was hanging game (identified by jaylittle)
nemo
parents:
3603
diff
changeset

267 
if (hwRound(Gear^.X) < LAND_WIDTH div 2) or (hwRound(Gear^.X) > LAND_WIDTH * 3 div 2) then Gear^.State := Gear^.State or gstCollision; 
3359  268 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

269 
if Gear^.dY.isNegative then 
4578  270 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

271 
isFalling := true; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

272 
if TestCollisionYwithGear(Gear, 1) then 
4578  273 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

274 
collV := 1; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

275 
Gear^.dX := Gear^.dX * Gear^.Friction; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

276 
Gear^.dY :=  Gear^.dY * Gear^.Elasticity; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

277 
Gear^.State := Gear^.State or gstCollision 
4578  278 
end 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

279 
else if (Gear^.AdvBounce=1) and TestCollisionYwithGear(Gear, 1) then collV := 1; 
4578  280 
end 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

281 
else if TestCollisionYwithGear(Gear, 1) then 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

282 
begin 
4578  283 
collV := 1; 
284 
isFalling := false; 

285 
Gear^.dX := Gear^.dX * Gear^.Friction; 

286 
Gear^.dY :=  Gear^.dY * Gear^.Elasticity; 

287 
Gear^.State := Gear^.State or gstCollision 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

288 
end 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

289 
else 
4578  290 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

291 
isFalling := true; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

292 
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

293 
collV := 1; 
4578  294 
end; 
503  295 

2989
b49d87499398
Add back sheepluva's 45Â° patch for some weapons. Rescale Tiy's latest icons to his specifications.
nemo
parents:
2983
diff
changeset

296 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

297 
if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then 
4578  298 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

299 
collH := hwSign(Gear^.dX); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

300 
Gear^.dX :=  Gear^.dX * Gear^.Elasticity; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

301 
Gear^.dY := Gear^.dY * Gear^.Elasticity; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

302 
Gear^.State := Gear^.State or gstCollision 
4578  303 
end 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

304 
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

305 
collH := hwSign(Gear^.dX); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

306 
//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

307 
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

308 
tdY.QWordValue) > _0_2.QWordValue)) then 
4578  309 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

310 
Gear^.dX := tdY*Gear^.Elasticity*Gear^.Friction; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

311 
Gear^.dY := tdX*Gear^.Elasticity; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

312 
//*Gear^.Friction; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

313 
Gear^.dY.isNegative := not tdY.isNegative; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

314 
isFalling := false; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

315 
Gear^.AdvBounce := 10; 
4578  316 
end; 
503  317 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

318 
if Gear^.AdvBounce > 1 then dec(Gear^.AdvBounce); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

319 

4299  320 
if isFalling then 
321 
begin 

322 
Gear^.dY := Gear^.dY + cGravity; 

4602
ec84fb564bab
added density for gears used in gfMoreWind, needs alot of tweaking
Henek
parents:
4582
diff
changeset

323 
if (GameFlags and gfMoreWind) <> 0 then Gear^.dX := Gear^.dX + cWindSpeed / Gear^.Density 
4299  324 
end; 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

325 

a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

326 
Gear^.X := Gear^.X + Gear^.dX; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

327 
Gear^.Y := Gear^.Y + Gear^.dY; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

328 
CheckGearDrowning(Gear); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

329 
//if (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) < _0_0002) and 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

330 
if ((Gear^.dX.QWordValue + Gear^.dY.QWordValue) < _0_02.QWordValue) and 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

331 
(not isFalling) then 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

332 
Gear^.State := Gear^.State and not gstMoving 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

333 
else 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

334 
Gear^.State := Gear^.State or gstMoving; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

335 

a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

336 
if (Gear^.nImpactSounds > 0) then 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

337 
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

338 
gstMoving))) and 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

339 
((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

340 
PlaySound(TSound(ord(Gear^.ImpactSound) + LongInt(GetRandom(Gear^.nImpactSounds))), true 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

341 
); 
4  342 
end; 
343 

344 
//////////////////////////////////////////////////////////////////////////////// 

345 
procedure doStepBomb(Gear: PGear); 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

346 
var 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

347 
i, x, y: LongInt; 
919  348 
dX, dY: hwFloat; 
2538
661079b00177
Just checking this in so prg can try it. May back it out
nemo
parents:
2524
diff
changeset

349 
Fire: PGear; 
3475  350 
vg: PVisualGear; 
4  351 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

352 
AllInactive := false; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

353 

a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

354 
doStepFallingGear(Gear); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

355 

a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

356 
dec(Gear^.Timer); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

357 
if Gear^.Timer = 1000 then // might need adjustments 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

358 
case Gear^.Kind of 
4168  359 
gtBomb: makeHogsWorry(Gear^.X, Gear^.Y, 50); 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

360 
gtClusterBomb: makeHogsWorry(Gear^.X, Gear^.Y, 20); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

361 
gtWatermelon: makeHogsWorry(Gear^.X, Gear^.Y, 75); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

362 
gtHellishBomb: makeHogsWorry(Gear^.X, Gear^.Y, 90); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

363 
gtGasBomb: makeHogsWorry(Gear^.X, Gear^.Y, 50); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

364 
end; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

365 

a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

366 
if (Gear^.Kind = gtBall) and ((Gear^.State and gstTmpFlag) <> 0) then 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

367 
begin 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

368 
CheckCollision(Gear); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

369 
if (Gear^.State and gstCollision) <> 0 then 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

370 
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

371 
end; 
3004  372 

3475  373 
if (Gear^.Kind = gtGasBomb) and ((GameTicks mod 200) = 0) then 
374 
begin 

375 
vg:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeWhite); 

376 
if vg <> nil then 

377 
vg^.Tint:= $FFC0C000; 

378 
end; 

379 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

380 
if Gear^.Timer = 0 then 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

381 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

382 
case Gear^.Kind of 
4168  383 
gtBomb: doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound); 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

384 
gtBall: doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 40, EXPLAutoSound); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

385 
gtClusterBomb: 
3476
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset

386 
begin 
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset

387 
x := hwRound(Gear^.X); 
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset

388 
y := hwRound(Gear^.Y); 
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset

389 
doMakeExplosion(x, y, 20, EXPLAutoSound); 
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset

390 
for i:= 0 to 4 do 
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset

391 
begin 
3505  392 
dX := rndSign(GetRandom * _0_1) + Gear^.dX / 5; 
3476
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset

393 
dY := (GetRandom  _3) * _0_08; 
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset

394 
AddGear(x, y, gtCluster, 0, dX, dY, 25); 
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset

395 
end 
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset

396 
end; 
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset

397 
gtWatermelon: 
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset

398 
begin 
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset

399 
x := hwRound(Gear^.X); 
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset

400 
y := hwRound(Gear^.Y); 
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset

401 
doMakeExplosion(x, y, 75, EXPLAutoSound); 
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset

402 
for i:= 0 to 5 do 
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset

403 
begin 
3505  404 
dX := rndSign(GetRandom * _0_1) + Gear^.dX / 5; 
3476
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset

405 
dY := (GetRandom  _1_5) * _0_3; 
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset

406 
AddGear(x, y, gtMelonPiece, 0, dX, dY, 75)^.DirAngle := i * 60; 
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset

407 
end 
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset

408 
end; 
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset

409 
gtHellishBomb: 
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset

410 
begin 
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset

411 
x := hwRound(Gear^.X); 
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset

412 
y := hwRound(Gear^.Y); 
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset

413 
doMakeExplosion(x, y, 90, EXPLAutoSound); 
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset

414 

1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset

415 
for i:= 0 to 127 do 
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset

416 
begin 
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset

417 
dX := AngleCos(i * 16) * _0_5 * (GetRandom + _1); 
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset

418 
dY := AngleSin(i * 16) * _0_5 * (GetRandom + _1); 
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset

419 
Fire := AddGear(x, y, gtFlame, 0, dX, dY, 0); 
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset

420 
if i mod 2 = 0 then Fire^.State := Fire^.State or gsttmpFlag; 
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset

421 
Fire := AddGear(x, y, gtFlame, 0, dX, dY, 0); 
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset

422 
if i mod 2 <> 0 then Fire^.State := Fire^.State or gsttmpFlag; 
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset

423 
end 
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset

424 
end; 
3712  425 
gtGasBomb: 
426 
begin 

427 
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 20, EXPLAutoSound); 

428 
for i:= 0 to 2 do 

4160
043c17a8b3ca
Don't call getrandom() from parameters to a function. The order of calls is undefined, so desyncs are probable.
unc0rr
parents:
4155
diff
changeset

429 
begin 
043c17a8b3ca
Don't call getrandom() from parameters to a function. The order of calls is undefined, so desyncs are probable.
unc0rr
parents:
4155
diff
changeset

430 
x:= GetRandom(60); 
043c17a8b3ca
Don't call getrandom() from parameters to a function. The order of calls is undefined, so desyncs are probable.
unc0rr
parents:
4155
diff
changeset

431 
y:= GetRandom(40); 
043c17a8b3ca
Don't call getrandom() from parameters to a function. The order of calls is undefined, so desyncs are probable.
unc0rr
parents:
4155
diff
changeset

432 
AddGear(hwRound(Gear^.X)  30 + x, hwRound(Gear^.Y)  20 + y, gtPoisonCloud, 0, _0, _0, 0); 
043c17a8b3ca
Don't call getrandom() from parameters to a function. The order of calls is undefined, so desyncs are probable.
unc0rr
parents:
4155
diff
changeset

433 
end 
3712  434 
end; 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

435 
end; 
3476
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset

436 
DeleteGear(Gear); 
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset

437 
exit 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

438 
end; 
1263  439 

4  440 
CalcRotationDirAngle(Gear); 
1263  441 

442 
if Gear^.Kind = gtHellishBomb then 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

443 
begin 
3118  444 

445 
if Gear^.Timer = 3000 then 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

446 
begin 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

447 
Gear^.nImpactSounds := 0; 
3118  448 
PlaySound(sndHellish); 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

449 
end; 
1279  450 

2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

451 
if (GameTicks and $3F) = 0 then 
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

452 
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

453 
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtEvilTrace); 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

454 
end; 
4  455 
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

456 
//////////////////////////////////////////////////////////////////////////////// 
ecf0c7e7995b
Initial molotov cocktail. Still needs graphics, tweaking of fire behaviour. Also changed probabilities for default weapon sets
nemo
parents:
2455
diff
changeset

457 
procedure doStepMolotov(Gear: PGear); 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

458 
var 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

459 
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

460 
dX, dY: hwFloat; 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

461 
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

462 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

463 
AllInactive := false; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

464 

2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

465 
doStepFallingGear(Gear); 
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

466 
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

467 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

468 
if (Gear^.State and gstCollision) <> 0 then 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

469 
begin 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

470 
PlaySound(sndMolotov); 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

471 
gX := hwRound(Gear^.X); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

472 
gY := hwRound(Gear^.Y); 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

473 
//doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 5, EXPLAutoSound); 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

474 
for i:= 0 to 20 do 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

475 
begin 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

476 
dX := AngleCos(i * 2) * ((_0_1*(i div 5))) * (GetRandom + _1); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

477 
dY := AngleSin(i * 8) * _0_5 * (GetRandom + _1); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

478 
Fire := AddGear(gX, gY, gtFlame, 0, dX, dY, 0); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

479 
Fire^.State := Fire^.State or gsttmpFlag; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

480 
Fire := AddGear(gX, gY, gtFlame, 0, dX, dY, 0); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

481 
Fire^.State := Fire^.State or gsttmpFlag; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

482 
Fire := AddGear(gX, gY, gtFlame, 0, dX, dY, 0); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

483 
Fire^.State := Fire^.State or gsttmpFlag; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

484 
Fire := AddGear(gX, gY, gtFlame, 0, dX, dY, 0); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

485 
Fire^.State := Fire^.State or gsttmpFlag; 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

486 
end; 
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

487 
DeleteGear(Gear); 
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

488 
exit 
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

489 
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

490 
end; 
4  491 

1279  492 
procedure doStepWatermelon(Gear: PGear); 
493 
begin 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

494 
AllInactive := false; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

495 
Gear^.doStep := @doStepBomb 
1279  496 
end; 
497 

78  498 
procedure doStepCluster(Gear: PGear); 
499 
begin 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

500 
AllInactive := false; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

501 
doStepFallingGear(Gear); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

502 
if (Gear^.State and gstCollision) <> 0 then 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

503 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

504 
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Timer, EXPLAutoSound); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

505 
DeleteGear(Gear); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

506 
exit 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

507 
end; 
1262  508 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

509 
if (Gear^.Kind = gtMelonPiece) or (Gear^.Kind = gtBall) then 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

510 
CalcRotationDirAngle(Gear) 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

511 
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

512 
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace) 
78  513 
end; 
514 

4  515 
//////////////////////////////////////////////////////////////////////////////// 
4168  516 
procedure doStepShell(Gear: PGear); 
4  517 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

518 
AllInactive := false; 
4272
cf18de7ea3d4
engine side of a more wind patch. no frontend hook. just want to check it in to pull it from another machine
nemo
parents:
4265
diff
changeset

519 
if (GameFlags and gfMoreWind) = 0 then Gear^.dX := Gear^.dX + cWindSpeed; 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

520 
doStepFallingGear(Gear); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

521 
if (Gear^.State and gstCollision) <> 0 then 
4578  522 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

523 
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

524 
DeleteGear(Gear); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

525 
exit 
4578  526 
end; 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

527 
if (GameTicks and $3F) = 0 then 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

528 
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace); 
95  529 
end; 
530 

4  531 
//////////////////////////////////////////////////////////////////////////////// 
4578  532 
procedure doStepSnowball(Gear: PGear); 
533 
var kick, i: LongInt; 

534 
particle: PVisualGear; 

535 
begin 

536 
AllInactive := false; 

537 
if (GameFlags and gfMoreWind) = 0 then Gear^.dX := Gear^.dX + cWindSpeed; 

538 
doStepFallingGear(Gear); 

539 
CalcRotationDirAngle(Gear); 

540 
if (Gear^.State and gstCollision) <> 0 then 

541 
begin 

542 
kick:= hwRound((hwAbs(Gear^.dX)+hwAbs(Gear^.dY)) * _20); 

543 
Gear^.dY.isNegative:= not Gear^.dY.isNegative; 

544 
Gear^.dX.isNegative:= not Gear^.dX.isNegative; 

545 
AmmoShove(Gear, 1, kick); 

546 
for i:= 15 + kick div 10 downto 0 do 

547 
begin 

548 
particle := AddVisualGear(hwRound(Gear^.X) + Random(25), hwRound(Gear^.Y) + Random(25), vgtDust); 

549 
if particle <> nil then particle^.dX := particle^.dX + (Gear^.dX.QWordValue / 21474836480) 

550 
end; 

551 
DeleteGear(Gear); 

552 
exit 

553 
end; 

554 
if ((GameTicks and $1F) = 0) and (Random(3) = 0) then 

555 
begin 

4582  556 
particle:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtDust); 
4578  557 
if particle <> nil then particle^.dX := particle^.dX + (Gear^.dX.QWordValue / 21474836480) 
558 
end 

559 
end; 

560 

4611  561 
procedure doStepSnowflake(Gear: PGear); 
4613
f58ff1827763
minor position tweaks. hopefully checking array bounds correctly
nemo
parents:
4611
diff
changeset

562 
var xx, yy, px, py, i: LongInt; 
4642  563 
move, allpx: Boolean; 
4611  564 
s: PSDL_Surface; 
565 
p: PLongwordArray; 

4791  566 
oAlpha, nAlpha: byte; 
4611  567 
begin 
568 
if GameTicks and $7 = 0 then 

569 
begin 

570 
with Gear^ do 

571 
begin 

572 
X:= X + cWindSpeed * 1600 + dX; 

573 
Y:= Y + dY + cGravity * vobFallSpeed * 8; // using same value as flakes to try and get similar results 

574 
xx:= hwRound(X); 

575 
yy:= hwRound(Y); 

576 
if vobVelocity <> 0 then 

577 
begin 

4621  578 
DirAngle := DirAngle + (Angle / 1250000000); 
4611  579 
if DirAngle < 0 then DirAngle := DirAngle + 360 
580 
else if 360 < DirAngle then DirAngle := DirAngle  360; 

581 
end; 

582 

583 
inc(Health, 8); 

584 
if Health > vobFrameTicks then 

585 
begin 

586 
dec(Health, vobFrameTicks); 

587 
inc(Timer); 

588 
if Timer = vobFramesCount then Timer:= 0 

589 
end; 

590 

591 
move:= false; 

592 
// move back to cloud layer 

593 
if yy > cWaterLine then move:= true 

4791  594 
else if ((yy and LAND_HEIGHT_MASK) <> 0) or ((xx and LAND_WIDTH_MASK) <> 0) then move:=true 
595 
// Solid pixel encountered 

596 
else if (Land[yy, xx] > 255) then 

4611  597 
begin 
4791  598 
// If there's room below keep falling 
599 
if (((yy1) and LAND_HEIGHT_MASK) = 0) and (Land[yy1, xx] = 0) then 

600 
begin 

601 
X:= X  cWindSpeed * 1600  dX; 

602 
end 

603 
// If there's room below, on the sides, fill the gaps 

604 
else if (((yy1) and LAND_HEIGHT_MASK) = 0) and (((xx(1*hwSign(cWindSpeed))) and LAND_WIDTH_MASK) = 0) and (Land[yy1, (xx(1*hwSign(cWindSpeed)))] = 0) then 

605 
begin 

606 
X:= X  _0_8 * hwSign(cWindSpeed); 

607 
Y:= Y  dY  cGravity * vobFallSpeed * 8; 

608 
end 

609 
else if (((yy1) and LAND_HEIGHT_MASK) = 0) and (((xx(2*hwSign(cWindSpeed))) and LAND_WIDTH_MASK) = 0) and (Land[yy1, (xx(2*hwSign(cWindSpeed)))] = 0) then 

610 
begin 

611 
X:= X  _0_8 * 2 * hwSign(cWindSpeed); 

612 
Y:= Y  dY  cGravity * vobFallSpeed * 8; 

613 
end 

614 
else if (((yy1) and LAND_HEIGHT_MASK) = 0) and (((xx+(1*hwSign(cWindSpeed))) and LAND_WIDTH_MASK) = 0) and (Land[yy1, (xx+(1*hwSign(cWindSpeed)))] = 0) then 

615 
begin 

616 
X:= X + _0_8 * hwSign(cWindSpeed); 

617 
Y:= Y  dY  cGravity * vobFallSpeed * 8; 

618 
end 

619 
else if (((yy1) and LAND_HEIGHT_MASK) = 0) and (((xx+(2*hwSign(cWindSpeed))) and LAND_WIDTH_MASK) = 0) and (Land[yy1, (xx+(2*hwSign(cWindSpeed)))] = 0) then 

620 
begin 

621 
X:= X + _0_8 * 2 * hwSign(cWindSpeed); 

622 
Y:= Y  dY  cGravity * vobFallSpeed * 8; 

623 
end 

624 
else 

4611  625 
begin 
4791  626 
// we've collided with land. draw some stuff and get back into the clouds 
627 
move:= true; 

628 
if (CurAmmoGear = nil) or (CurAmmoGear^.Kind <> gtRope) then 

4655
b75bb4307b0f
Might want the snow actually showing up. Also disable it while rope is active due to bad side effects.
nemo
parents:
4642
diff
changeset

629 
begin 
4791  630 
////////////////////////////////// TODO  ASK UNC0RR FOR A GOOD HOME FOR THIS //////////////////////////////////// 
631 
dec(yy,3); 

632 
dec(xx,2); 

633 
s:= SpritesData[sprSnow].Surface; 

634 
p:= s^.pixels; 

635 
allpx:= true; 

636 
for py:= 0 to Pred(s^.h) do 

637 
begin 

638 
for px:= 0 to Pred(s^.w) do 

639 
if (((yy + py) and LAND_HEIGHT_MASK) = 0) and (((xx + px) and LAND_WIDTH_MASK) = 0) then 

640 
begin 

641 
if (cReducedQuality and rqBlurryLand) = 0 then 

642 
begin 

643 
LandPixels[yy + py, xx + px]:= addBgColor(LandPixels[yy + py, xx + px], p^[px]); 

644 
Land[yy + py, xx + px]:= Land[yy + py, xx + px] or lfObject; 

645 
end 

646 
else 

647 
begin 

648 
LandPixels[(yy + py) div 2, (xx + px) div 2]:= addBgColor(LandPixels[(yy + py) div 2, (xx + px) div 2], p^[px]); 

649 
Land[(yy + py) div 2, (xx + px) div 2]:= Land[(yy + py) div 2, (xx + px) div 2] or lfObject; 

650 
end; 

651 
end 

652 
else allpx:= false; 

653 
p:= @(p^[s^.pitch shr 2]) 

654 
end; 

655 

656 
for py:= (yy) to (yy+1) do 

657 
begin 

658 
for px:= (xx+2) to (xx+3) do 

4655
b75bb4307b0f
Might want the snow actually showing up. Also disable it while rope is active due to bad side effects.
nemo
parents:
4642
diff
changeset

659 
begin 
4791  660 
Land[py, px]:= lfBasic; 
661 
end; 

662 
end; 

663 

664 
if allpx then UpdateLandTexture(xx, Pred(s^.h), yy, Pred(s^.w)) 

665 
else 

666 
begin 

667 
UpdateLandTexture( 

668 
max(0, min(LAND_WIDTH, xx)), 

669 
min(LAND_WIDTH  xx, Pred(s^.w)), 

670 
max(0, min(LAND_WIDTH, yy)), 

671 
min(LAND_HEIGHT  yy, Pred(s^.h)) 

672 
); 

673 
end; 

674 
////////////////////////////////// TODO  ASK UNC0RR FOR A GOOD HOME FOR THIS //////////////////////////////////// 

675 
end 

676 
end; 

4611  677 
end; 
678 
if move then 

679 
begin 

680 
X:= int2hwFloat(GetRandom(LAND_WIDTH+1024)512); 

4637  681 
Y:= int2hwFloat(750+(GetRandom(50)25)) 
4611  682 
end 
683 
end 

684 
end 

685 
end; 

686 

4578  687 
//////////////////////////////////////////////////////////////////////////////// 
4  688 
procedure doStepGrave(Gear: PGear); 
689 
begin 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

690 
AllInactive := false; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

691 
if Gear^.dY.isNegative then 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

692 
if TestCollisionY(Gear, 1) then Gear^.dY := _0; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

693 

a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

694 
if not Gear^.dY.isNegative then 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

695 
if TestCollisionY(Gear, 1) then 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

696 
begin 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

697 
Gear^.dY :=  Gear^.dY * Gear^.Elasticity; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

698 
if Gear^.dY >  _1div1024 then 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

699 
begin 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

700 
Gear^.Active := false; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

701 
exit 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

702 
end 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

703 
else if Gear^.dY <  _0_03 then PlaySound(Gear^.ImpactSound) 
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 

a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

706 
Gear^.Y := Gear^.Y + Gear^.dY; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

707 
CheckGearDrowning(Gear); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

708 
Gear^.dY := Gear^.dY + cGravity 
4  709 
end; 
710 

711 
//////////////////////////////////////////////////////////////////////////////// 

3080  712 
procedure doStepBeeWork(Gear: PGear); 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

713 
var 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

714 
t: hwFloat; 
3143  715 
gX,gY: LongInt; 
3139  716 
nuw: boolean; 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

717 

a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

718 
const uw: boolean = false; 
4  719 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

720 
AllInactive := false; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

721 
gX := hwRound(Gear^.X); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

722 
gY := hwRound(Gear^.Y); 
3591  723 
nuw := (cWaterLine < gy + Gear^.Radius); 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

724 
if nuw and not uw then 
3139  725 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

726 
AddVisualGear(gX, cWaterLine, vgtSplash); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

727 
AddVisualGear(gX  3 + Random(6), cWaterLine, vgtDroplet); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

728 
AddVisualGear(gX  3 + Random(6), cWaterLine, vgtDroplet); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

729 
AddVisualGear(gX  3 + Random(6), cWaterLine, vgtDroplet); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

730 
AddVisualGear(gX  3 + Random(6), cWaterLine, vgtDroplet); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

731 
StopSound(Gear^.SoundChannel); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

732 
Gear^.SoundChannel := LoopSound(sndBeeWater); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

733 
uw := nuw 
3139  734 
end 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

735 
else if not nuw and uw then 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

736 
begin 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

737 
AddVisualGear(gX, cWaterLine, vgtSplash); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

738 
StopSound(Gear^.SoundChannel); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

739 
Gear^.SoundChannel := LoopSound(sndBee); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

740 
uw := nuw 
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 

a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

743 

3591  744 
if (GameTicks and $F) = 0 then 
745 
begin 

746 
if (GameTicks and $30) = 0 then 

747 
AddVisualGear(gX, gY, vgtBeeTrace); 

748 
Gear^.dX := Gear^.Elasticity * (Gear^.dX + _0_000064 * (TargetPoint.X  gX)); 

749 
Gear^.dY := Gear^.Elasticity * (Gear^.dY + _0_000064 * (TargetPoint.Y  gY)); 

750 
// make sure new speed isn't higher than original one (which we stored in Friction variable) 

751 
t := Gear^.Friction / Distance(Gear^.dX, Gear^.dY); 

752 
Gear^.dX := Gear^.dX * t; 

753 
Gear^.dY := Gear^.dY * t; 

754 
end; 

755 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

756 
Gear^.X := Gear^.X + Gear^.dX; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

757 
Gear^.Y := Gear^.Y + Gear^.dY; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

758 

a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

759 
CheckCollision(Gear); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

760 
dec(Gear^.Timer); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

761 
if ((Gear^.State and gstCollision) <> 0) or (Gear^.Timer = 0) then 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

762 
begin 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

763 
StopSound(Gear^.SoundChannel); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

764 
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

765 
DeleteGear(Gear); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

766 
end; 
4  767 
end; 
768 

3080  769 
procedure doStepBee(Gear: PGear); 
4  770 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

771 
AllInactive := false; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

772 
Gear^.X := Gear^.X + Gear^.dX; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

773 
Gear^.Y := Gear^.Y + Gear^.dY; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

774 
Gear^.dY := Gear^.dY + cGravity; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

775 
CheckCollision(Gear); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

776 
if (Gear^.State and gstCollision) <> 0 then 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

777 
begin 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

778 
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

779 
DeleteGear(Gear); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

780 
exit 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

781 
end; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

782 
dec(Gear^.Timer); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

783 
if Gear^.Timer = 0 then 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

784 
begin 
4365  785 
Gear^.Hedgehog^.Gear^.Message:= Gear^.Hedgehog^.Gear^.Message and not gmAttack; 
786 
Gear^.Hedgehog^.Gear^.State:= Gear^.Hedgehog^.Gear^.State and not gstAttacking; 

4135
5be798ecafdc
This should make bee and other targetted things behave more reliably in infinite attack mode. Blocks switching of weps if a target point is active.
nemo
parents:
4104
diff
changeset

787 
AttackBar:= 0; 
5be798ecafdc
This should make bee and other targetted things behave more reliably in infinite attack mode. Blocks switching of weps if a target point is active.
nemo
parents:
4104
diff
changeset

788 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

789 
Gear^.SoundChannel := LoopSound(sndBee); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

790 
Gear^.Timer := 5000; 
3591  791 
// save initial speed in otherwise unused Friction variable 
792 
Gear^.Friction := Distance(Gear^.dX, Gear^.dY); 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

793 
Gear^.doStep := @doStepBeeWork 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

794 
end; 
4  795 
end; 
796 

797 
//////////////////////////////////////////////////////////////////////////////// 

876  798 
procedure doStepShotIdle(Gear: PGear); 
799 
begin 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

800 
AllInactive := false; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

801 
inc(Gear^.Timer); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

802 
if Gear^.Timer > 75 then 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

803 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

804 
DeleteGear(Gear); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

805 
AfterAttack 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

806 
end 
876  807 
end; 
808 

4  809 
procedure doStepShotgunShot(Gear: PGear); 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

810 
var 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

811 
i: LongWord; 
2828  812 
shell: PVisualGear; 
4  813 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

814 
AllInactive := false; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

815 

a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

816 
if ((Gear^.State and gstAnimation) = 0) then 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

817 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

818 
dec(Gear^.Timer); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

819 
if Gear^.Timer = 0 then 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

820 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

821 
PlaySound(sndShotgunFire); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

822 
shell := AddVisualGear(hwRound(Gear^.x), hwRound(Gear^.y), vgtShell); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

823 
if shell <> nil then 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

824 
begin 
3593
ae50f63e4fa9
Remove hwFloat from VisualGears  they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3591
diff
changeset

825 
shell^.dX := gear^.dX.QWordValue / 17179869184; 
ae50f63e4fa9
Remove hwFloat from VisualGears  they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3591
diff
changeset

826 
shell^.dY := gear^.dY.QWordValue / 17179869184; 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

827 
shell^.Frame := 0 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

828 
end; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

829 
Gear^.State := Gear^.State or gstAnimation 
2858  830 
end; 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

831 
exit 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

832 
end 
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

833 
else inc(Gear^.Timer); 
876  834 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

835 
i := 200; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

836 
repeat 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

837 
Gear^.X := Gear^.X + Gear^.dX; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

838 
Gear^.Y := Gear^.Y + Gear^.dY; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

839 
CheckCollision(Gear); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

840 
if (Gear^.State and gstCollision) <> 0 then 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

841 
begin 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

842 
Gear^.X := Gear^.X + Gear^.dX * 8; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

843 
Gear^.Y := Gear^.Y + Gear^.dY * 8; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

844 
ShotgunShot(Gear); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

845 
Gear^.doStep := @doStepShotIdle; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

846 
exit 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

847 
end; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

848 

a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

849 
CheckGearDrowning(Gear); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

850 
if (Gear^.State and gstDrowning) <> 0 then 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

851 
begin 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

852 
Gear^.doStep := @doStepShotIdle; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

853 
exit 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

854 
end; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

855 
dec(i) 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

856 
until i = 0; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

857 
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

858 
then 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

859 
Gear^.doStep := @doStepShotIdle 
4  860 
end; 
861 

862 
//////////////////////////////////////////////////////////////////////////////// 

2023
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset

863 
procedure doStepBulletWork(Gear: PGear); 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

864 
var 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

865 
i, x, y: LongWord; 
351  866 
oX, oY: hwFloat; 
4327  867 
VGear: PVisualGear; 
38  868 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

869 
AllInactive := false; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

870 
inc(Gear^.Timer); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

871 
i := 80; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

872 
oX := Gear^.X; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

873 
oY := Gear^.Y; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

874 
repeat 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

875 
Gear^.X := Gear^.X + Gear^.dX; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

876 
Gear^.Y := Gear^.Y + Gear^.dY; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

877 
x := hwRound(Gear^.X); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

878 
y := hwRound(Gear^.Y); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

879 
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

880 
and (Land[y, x] <> 0) then inc(Gear^.Damage); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

881 
if Gear^.Damage > 5 then 
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3821
diff
changeset

882 
if Gear^.AmmoType = amDEagle then 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

883 
AmmoShove(Gear, 7, 20) 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

884 
else 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

885 
AmmoShove(Gear, Gear^.Timer, 20); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

886 
CheckGearDrowning(Gear); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

887 
dec(i) 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

888 
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

889 
if Gear^.Damage > 0 then 
2994
7ae3067546f2
Palewolf adds bubbles and splashes when firing bullets into the water
nemo
parents:
2989
diff
changeset

890 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

891 
DrawTunnel(oX, oY, Gear^.dX, Gear^.dY, 82  i, 1); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

892 
dec(Gear^.Health, Gear^.Damage); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

893 
Gear^.Damage := 0 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

894 
end; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

895 
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

896 
begin 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

897 
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

898 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

899 
if Random(6) = 0 then 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

900 
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtBubble); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

901 
Gear^.X := Gear^.X + Gear^.dX; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

902 
Gear^.Y := Gear^.Y + Gear^.dY; 
2994
7ae3067546f2
Palewolf adds bubbles and splashes when firing bullets into the water
nemo
parents:
2989
diff
changeset

903 
end; 
7ae3067546f2
Palewolf adds bubbles and splashes when firing bullets into the water
nemo
parents:
2989
diff
changeset

904 
end; 
1760  905 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

906 
if (Gear^.Health <= 0) 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

907 
or (hwRound(Gear^.X) and LAND_WIDTH_MASK <> 0) 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

908 
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

909 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

910 
if (Gear^.Kind = gtSniperRifleShot) and ((GameFlags and gfLaserSight) = 0) then 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

911 
cLaserSighting := false; 
3836
833c0f32e326
Change all use of curslot/idx to CurAmmoType to try and avoid some bugs with use of last weapon.
nemo
parents:
3821
diff
changeset

912 
if (Ammoz[Gear^.AmmoType].Ammo.NumPerTurn <= CurrentHedgehog^.MultiShootAttacks) and 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

913 
((GameFlags and gfArtillery) = 0) then cArtillery := false; 
4279  914 

4327  915 
// Bullet Hit 
916 
if (hwRound(Gear^.X) and LAND_WIDTH_MASK = 0) 

917 
and (hwRound(Gear^.Y) and LAND_HEIGHT_MASK = 0) then 

918 
begin 

919 
VGear := AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtBulletHit); 

920 
if VGear <> nil then 

921 
begin 

922 
VGear^.Angle := DxDy2Angle(Gear^.dX, Gear^.dY); 

923 
end; 

924 
end; 

925 

4279  926 
// Bullet trail 
4327  927 
VGear := AddVisualGear( 
4279  928 
hwround(CurrentHedgehog^.Gear^.X) + GetLaunchX(CurrentHedgehog^.CurAmmoType, hwSign(CurrentHedgehog^.Gear^.dX), CurrentHedgehog^.Gear^.Angle), 
929 
hwround(CurrentHedgehog^.Gear^.Y) + GetLaunchY(CurrentHedgehog^.CurAmmoType, CurrentHedgehog^.Gear^.Angle), 

930 
vgtLineTrail 

931 
); 

4327  932 
if VGear <> nil then 
4279  933 
begin 
4281  934 
// http://mantis.freepascal.org/view.php?id=17714 hits again 
4327  935 
VGear^.dX := Gear^.X.QWordValue / SignAs(_1,_1).QWordValue; 
936 
VGear^.dY := Gear^.Y.QWordValue / SignAs(_1,_1).QWordValue; 

4279  937 

938 
// reached edge of land. assume infinite beam. Extend it way out past camera 

939 
if (hwRound(Gear^.X) and LAND_WIDTH_MASK <> 0) 

940 
or (hwRound(Gear^.Y) and LAND_HEIGHT_MASK <> 0) then 

941 
begin 

4327  942 
VGear^.dX := VGear^.dX + (CurrentHedgehog^.Gear^.dX * LAND_WIDTH).QWordValue / SignAs(_1,_1).QWordValue; 
943 
VGear^.dY := VGear^.dY + (CurrentHedgehog^.Gear^.dY * LAND_WIDTH).QWordValue / SignAs(_1,_1).QWordValue; 

4279  944 
end; 
945 

4327  946 
VGear^.Timer := 200; 
4279  947 
end; 
948 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

949 
Gear^.doStep := @doStepShotIdle 
2031
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2029
diff
changeset

950 
end; 
37  951 
end; 
952 

559  953 
procedure doStepDEagleShot(Gear: PGear); 
954 
begin 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

955 
PlaySound(sndGun); 
4708
aa1da6339eb3
add dx/dy increment prior to dostepbulletwork to avoid hurting yourself due to adjusted radius interaction (which snowball needs)
nemo
parents:
4691
diff
changeset

956 
// add an initial step to avoid problem with ammoshove related to calculation of radius + 1 radius as gear widths 
aa1da6339eb3
add dx/dy increment prior to dostepbulletwork to avoid hurting yourself due to adjusted radius interaction (which snowball needs)
nemo
parents:
4691
diff
changeset

957 
Gear^.X := Gear^.X + Gear^.dX; 
aa1da6339eb3
add dx/dy increment prior to dostepbulletwork to avoid hurting yourself due to adjusted radius interaction (which snowball needs)
nemo
parents:
4691
diff
changeset

958 
Gear^.Y := Gear^.Y + Gear^.dY; 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

959 
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

960 
end; 
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset

961 

41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset

962 
procedure doStepSniperRifleShot(Gear: PGear); 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

963 
var 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

964 
HHGear: PGear; 
2828  965 
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

966 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

967 
cArtillery := true; 
4365  968 
HHGear := Gear^.Hedgehog^.Gear; 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

969 
HHGear^.State := HHGear^.State or gstNotKickable; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

970 
HedgehogChAngle(HHGear); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

971 
if not cLaserSighting then 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

972 
// 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

973 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

974 
cLaserSighting := true; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

975 
HHGear^.Message := 0; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

976 
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

977 
end; 
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2029
diff
changeset

978 

3894  979 
if (HHGear^.Message and gmAttack) <> 0 then 
2031
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2029
diff
changeset

980 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

981 
shell := AddVisualGear(hwRound(Gear^.x), hwRound(Gear^.y), vgtShell); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

982 
if shell <> nil then 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

983 
begin 
3593
ae50f63e4fa9
Remove hwFloat from VisualGears  they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3591
diff
changeset

984 
shell^.dX := gear^.dX.QWordValue / 8589934592; 
ae50f63e4fa9
Remove hwFloat from VisualGears  they don't need the precision for syncing purposes, and it saves a whole lot of operations.
nemo
parents:
3591
diff
changeset

985 
shell^.dY := gear^.dY.QWordValue / 8589934592; 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

986 
shell^.Frame := 1 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

987 
end; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

988 
Gear^.State := Gear^.State or gstAnimation; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

989 
Gear^.dX := SignAs(AngleSin(HHGear^.Angle), HHGear^.dX) * _0_5; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

990 
Gear^.dY := AngleCos(HHGear^.Angle) * _0_5; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

991 
PlaySound(sndGun); 
4708
aa1da6339eb3
add dx/dy increment prior to dostepbulletwork to avoid hurting yourself due to adjusted radius interaction (which snowball needs)
nemo
parents:
4691
diff
changeset

992 
// add an initial step to avoid problem with ammoshove related to calculation of radius + 1 radius as gear widths 
aa1da6339eb3
add dx/dy increment prior to dostepbulletwork to avoid hurting yourself due to adjusted radius interaction (which snowball needs)
nemo
parents:
4691
diff
changeset

993 
Gear^.X := Gear^.X + Gear^.dX; 
aa1da6339eb3
add dx/dy increment prior to dostepbulletwork to avoid hurting yourself due to adjusted radius interaction (which snowball needs)
nemo
parents:
4691
diff
changeset

994 
Gear^.Y := Gear^.Y + Gear^.dY; 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

995 
Gear^.doStep := @doStepBulletWork; 
2024
2985f3bd18b7
Disable long jump in artillery mode, make snipre rifle single shot
nemo
parents:
2023
diff
changeset

996 
end 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

997 
else 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

998 
if (GameTicks mod 32) = 0 then 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

999 
if (GameTicks mod 4096) < 2048 then 
2052  1000 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1001 
if (HHGear^.Angle + 1 <= cMaxAngle) then inc(HHGear^.Angle) 
2052  1002 
end 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1003 
else 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1004 
if (HHGear^.Angle  1 >= 0) then dec(HHGear^.Angle); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1005 

a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1006 
if (TurnTimeLeft > 0) then 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1007 
dec(TurnTimeLeft) 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1008 
else 
2058  1009 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1010 
DeleteGear(Gear); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1011 
AfterAttack 
2058  1012 
end; 
559  1013 
end; 
1014 

37  1015 
//////////////////////////////////////////////////////////////////////////////// 
4  1016 
procedure doStepActionTimer(Gear: PGear); 
1017 
begin 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1018 
dec(Gear^.Timer); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1019 
case Gear^.Kind of 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1020 
gtATStartGame: 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1021 
begin 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1022 
AllInactive := false; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1023 
if Gear^.Timer = 0 then 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1024 
begin 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1025 
AddCaption(trmsg[sidStartFight], cWhiteColor, capgrpGameState); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1026 
end 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1027 
end; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1028 
gtATSmoothWindCh: 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1029 
begin 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1030 
if Gear^.Timer = 0 then 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1031 
begin 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1032 
if WindBarWidth < Gear^.Tag then inc(WindBarWidth) 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1033 
else if WindBarWidth > Gear^.Tag then dec(WindBarWidth); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1034 
if WindBarWidth <> Gear^.Tag then Gear^.Timer := 10; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1035 
end 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1036 
end; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1037 
gtATFinishGame: 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1038 
begin 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1039 
AllInactive := false; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1040 
if Gear^.Timer = 1000 then 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1041 
begin 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1042 
ScreenFade := sfToBlack; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1043 
ScreenFadeValue := 0; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1044 
ScreenFadeSpeed := 1; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1045 
end; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1046 
if Gear^.Timer = 0 then 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1047 
begin 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1048 
SendIPC('N'); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1049 
SendIPC('q'); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1050 
GameState := gsExit 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1051 
end 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1052 
end; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1053 
end; 
351  1054 
if Gear^.Timer = 0 then DeleteGear(Gear) 
4  1055 
end; 
1056 

1057 
//////////////////////////////////////////////////////////////////////////////// 

1058 
procedure doStepPickHammerWork(Gear: PGear); 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1059 
var 
4578  1060 
i, ei, x, y: LongInt; 
4  1061 
HHGear: PGear; 
1062 
begin 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1063 
AllInactive := false; 
4365  1064 
HHGear := Gear^.Hedgehog^.Gear; 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1065 
dec(Gear^.Timer); 
3894  1066 
if (Gear^.Timer = 0)or((Gear^.Message and gmDestroy) <> 0)or((HHGear^.State and gstHHDriven) = 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1067 
0) then 
4578  1068 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1069 
StopSound(Gear^.SoundChannel); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1070 
DeleteGear(Gear); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1071 
AfterAttack; 
3954
ae3583ad6ea9
Hopefully fix the last of the more obvious weapon bugs w/ infinite attack mode, add a depixeling sweep every 5s too.
nemo
parents:
3953
diff
changeset

1072 
doStepHedgehogMoving(HHGear); // for gfInfAttack 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1073 
exit 
4578  1074 
end; 
1075 

1076 
x:= hwRound(Gear^.X); 

1077 
y:= hwRound(Gear^.Y); 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1078 
if (Gear^.Timer mod 33) = 0 then 
4578  1079 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1080 
HHGear^.State := HHGear^.State or gstNoDamage; 
4578  1081 
doMakeExplosion(x, y + 7, 6, EXPLDontDraw); 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1082 
HHGear^.State := HHGear^.State and not gstNoDamage 
4578  1083 
end; 
422  1084 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1085 
if (Gear^.Timer mod 47) = 0 then 
4578  1086 
begin 
1087 
// ok. this was an attempt to turn off dust if not actually drilling land. I have no idea why it isn't working as expected 

4691  1088 
if (( (y + 12) and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) and (Land[y + 12, x] > 255) then 
4578  1089 
for i:= 0 to 1 do 
1090 
AddVisualGear(x  5 + Random(10), y + 12, vgtDust); 

1091 

1092 
i := x  Gear^.Radius  LongInt(GetRandom(2)); 

1093 
ei := x + Gear^.Radius + LongInt(GetRandom(2)); 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1094 
while i <= ei do 
4578  1095 
begin 
1096 
DrawExplosion(i, y + 3, 3); 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1097 
inc(i, 1) 
4578  1098 
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

1099 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1100 
if CheckLandValue(hwRound(Gear^.X + Gear^.dX + SignAs(_6,Gear^.dX)), hwRound(Gear^.Y + _1_9) 
3519  1101 
, lfIndestructible) then 
4578  1102 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1103 
Gear^.X := Gear^.X + Gear^.dX; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1104 
Gear^.Y := Gear^.Y + _1_9; 
4578  1105 
end; 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1106 
SetAllHHToActive; 
4578  1107 
end; 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1108 
if TestCollisionYwithGear(Gear, 1) then 
4578  1109 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1110 
Gear^.dY := _0; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1111 
SetLittle(HHGear^.dX); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1112 
HHGear^.dY := _0; 
4578  1113 
end 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1114 
else 
4578  1115 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1116 
Gear^.dY := Gear^.dY + cGravity; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1117 
Gear^.Y := Gear^.Y + Gear^.dY; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1118 
if hwRound(Gear^.Y) > cWaterLine then Gear^.Timer := 1 
4578  1119 
end; 
4  1120 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1121 
Gear^.X := Gear^.X + HHGear^.dX; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1122 
HHGear^.X := Gear^.X; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1123 
HHGear^.Y := Gear^.Y  int2hwFloat(cHHRadius); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1124 

3894  1125 
if (Gear^.Message and gmAttack) <> 0 then 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1126 
if (Gear^.State and gsttmpFlag) <> 0 then Gear^.Timer := 1 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1127 
else 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1128 
else 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1129 
if (Gear^.State and gsttmpFlag) = 0 then Gear^.State := Gear^.State or gsttmpFlag; 
3894  1130 
if ((Gear^.Message and gmLeft) <> 0) then Gear^.dX :=  _0_3 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1131 
else 
3894  1132 
if ((Gear^.Message and gmRight) <> 0) then Gear^.dX := _0_3 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1133 
else Gear^.dX := _0; 
4  1134 
end; 
1135 

1136 
procedure doStepPickHammer(Gear: PGear); 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1137 
var 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1138 
i, y: LongInt; 
4  1139 
ar: TRangeArray; 
911
b709fe13ed69
Fix issue with hedgehog on top of the hedgehog with pickhammer
unc0rr
parents:
883
diff
changeset

1140 
HHGear: PGear; 
4  1141 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1142 
i := 0; 
4365  1143 
HHGear := Gear^.Hedgehog^.Gear; 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1144 

a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1145 
y := hwRound(Gear^.Y)  cHHRadius * 2; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1146 
while y < hwRound(Gear^.Y) do 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1147 
begin 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1148 
ar[i].Left := hwRound(Gear^.X)  Gear^.Radius  LongInt(GetRandom(2)); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1149 
ar[i].Right := hwRound(Gear^.X) + Gear^.Radius + LongInt(GetRandom(2)); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1150 
inc(y, 2); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1151 
inc(i) 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1152 
end; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1153 

a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1154 
DrawHLinesExplosions(@ar, 3, hwRound(Gear^.Y)  cHHRadius * 2, 2, Pred(i)); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1155 
Gear^.dY := HHGear^.dY; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1156 
DeleteCI(HHGear); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1157 

a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1158 
Gear^.SoundChannel := LoopSound(sndPickhammer); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1159 
doStepPickHammerWork(Gear); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1160 
Gear^.doStep := @doStepPickHammerWork 
4  1161 
end; 
1162 

1163 
//////////////////////////////////////////////////////////////////////////////// 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1164 
var 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1165 
BTPrevAngle, BTSteps: LongInt; 
302  1166 

303
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset

1167 
procedure doStepBlowTorchWork(Gear: PGear); 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1168 
var 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1169 
HHGear: PGear; 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

1170 
b: boolean; 
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

1171 
prevX: LongInt; 
302  1172 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1173 
AllInactive := false; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1174 
dec(Gear^.Timer); 
4365  1175 
HHGear := Gear^.Hedgehog^.Gear; 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1176 

a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1177 
HedgehogChAngle(HHGear); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1178 

a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1179 
b := false; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1180 

a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1181 
if abs(LongInt(HHGear^.Angle)  BTPrevAngle) > 7 then 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

1182 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1183 
Gear^.dX := SignAs(AngleSin(HHGear^.Angle) * _0_5, HHGear^.dX); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1184 
Gear^.dY := AngleCos(HHGear^.Angle) * (  _0_5); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1185 
BTPrevAngle := HHGear^.Angle; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1186 
b := true 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

1187 
end; 
1528  1188 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1189 
if ((HHGear^.State and gstMoving) <> 0) then 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

1190 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1191 
doStepHedgehogMoving(HHGear); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1192 
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

1193 
end; 
305  1194 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1195 
if Gear^.Timer mod cHHStepTicks = 0 then 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

1196 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1197 
b := true; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1198 
if Gear^.dX.isNegative then 
3894  1199 
HHGear^.Message := (HHGear^.Message and (gmAttack or gmUp or gmDown)) or gmLeft 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1200 
else 
3894  1201 
HHGear^.Message := (HHGear^.Message and (gmAttack or gmUp or gmDown)) or gmRight; 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1202 

a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1203 
if ((HHGear^.State and gstMoving) = 0) then 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

1204 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1205 
HHGear^.State := HHGear^.State and not gstAttacking; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1206 
prevX := hwRound(HHGear^.X); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1207 

a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1208 
// why the call to HedgehogStep then a further increment of X? 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1209 
if (prevX = hwRound(HHGear^.X)) and 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1210 
CheckLandValue(hwRound(HHGear^.X + SignAs(_6, HHGear^.dX)), hwRound(HHGear^.Y), 
3519  1211 
lfIndestructible) then HedgehogStep(HHGear); 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1212 

a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1213 
if (prevX = hwRound(HHGear^.X)) and 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1214 
CheckLandValue(hwRound(HHGear^.X + SignAs(_6, HHGear^.dX)), hwRound(HHGear^.Y), 
3519  1215 
lfIndestructible) then HHGear^.X := HHGear^.X + SignAs(_1, HHGear^.dX); 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1216 
HHGear^.State := HHGear^.State or gstAttacking 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

1217 
end; 
305  1218 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1219 
inc(BTSteps); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1220 
if BTSteps = 7 then 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

1221 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1222 
BTSteps := 0; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1223 
if CheckLandValue(hwRound(HHGear^.X + Gear^.dX * (cHHRadius + cBlowTorchC) + SignAs(_6, 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1224 
Gear^.dX)), hwRound(HHGear^.Y + Gear^.dY * (cHHRadius + cBlowTorchC)), 
3519  1225 
lfIndestructible) 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

1226 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1227 
Gear^.X := HHGear^.X + Gear^.dX * (cHHRadius + cBlowTorchC); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1228 
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

1229 
end; 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1230 
HHGear^.State := HHGear^.State or gstNoDamage; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1231 
AmmoShove(Gear, 2, 15); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1232 
HHGear^.State := HHGear^.State and not gstNoDamage 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

1233 
end; 
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

1234 
end; 
305  1235 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1236 
if b then 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1237 
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

1238 
Gear^.dY) * 7, 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1239 
Gear^.dX, Gear^.dY, 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1240 
cHHRadius * 5, cHHRadius * 2 + 7); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1241 

3894  1242 
if (Gear^.Timer = 0) or ((HHGear^.Message and gmAttack) <> 0) then 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

1243 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1244 
HHGear^.Message := 0; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1245 
HHGear^.State := HHGear^.State and (not gstNotKickable); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1246 
DeleteGear(Gear); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1247 
AfterAttack 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

1248 
end 
302  1249 
end; 
1250 

303
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset

1251 
procedure doStepBlowTorch(Gear: PGear); 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1252 
var 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1253 
HHGear: PGear; 
303
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset

1254 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1255 
BTPrevAngle := High(LongInt); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1256 
BTSteps := 0; 
4365  1257 
HHGear := Gear^.Hedgehog^.Gear; 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1258 
HHGear^.Message := 0; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1259 
HHGear^.State := HHGear^.State or gstNotKickable; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1260 
Gear^.doStep := @doStepBlowTorchWork 
303
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset

1261 
end; 
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset

1262 

302  1263 
//////////////////////////////////////////////////////////////////////////////// 
1264 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1265 
procedure doStepRope(Gear: PGear); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1266 
forward; 
1781  1267 

1268 
procedure doStepRopeAfterAttack(Gear: PGear); 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1269 
var 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1270 
HHGear: PGear; 
1781  1271 
begin 
4365  1272 
HHGear := Gear^.Hedgehog^.Gear; 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1273 
if ((HHGear^.State and gstHHDriven) = 0) 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1274 
or (CheckGearDrowning(HHGear)) 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1275 
or TestCollisionYwithGear(HHGear, 1) then 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

1276 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1277 
DeleteGear(Gear); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1278 
isCursorVisible := false; 
4372  1279 
ApplyAmmoChanges(HHGear^.Hedgehog^); 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1280 
exit 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

1281 
end; 
1781  1282 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1283 
HedgehogChAngle(HHGear); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1284 

a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1285 
if TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then SetLittle(HHGear^.dX); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1286 

a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1287 
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

1288 
HHGear^.X := HHGear^.X + HHGear^.dX; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1289 
HHGear^.Y := HHGear^.Y + HHGear^.dY; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1290 
HHGear^.dY := HHGear^.dY + cGravity; 
4641  1291 
if (GameFlags and gfMoreWind) <> 0 then HHGear^.dX := HHGear^.dX + cWindSpeed / HHGear^.Density; 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1292 

3894  1293 
if (Gear^.Message and gmAttack) <> 0 then 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

1294 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1295 
Gear^.X := HHGear^.X; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1296 
Gear^.Y := HHGear^.Y; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1297 

4365  1298 
ApplyAngleBounds(Gear^.Hedgehog^, amRope); 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1299 

a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1300 
Gear^.dX := SignAs(AngleSin(HHGear^.Angle), HHGear^.dX); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1301 
Gear^.dY := AngleCos(HHGear^.Angle); 
4396
3cfd2e15464a
After repeated requests, variable length rope. Intended for the infinite rope folks, but values less than 100 make rope more interesting IMO.
nemo
parents:
4387
diff
changeset

1302 
Gear^.Friction := _450 * _0_01 * cRopePercent; 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1303 
Gear^.Elasticity := _0; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1304 
Gear^.State := Gear^.State and not gsttmpflag; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1305 
Gear^.doStep := @doStepRope; 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

1306 
end 
1781  1307 
end; 
1308 

4  1309 
procedure doStepRopeWork(Gear: PGear); 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1310 
var 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1311 
HHGear: PGear; 
3986
99178ffb817d
Remove this  doesn't seem to do anything useful after all.
nemo
parents:
3985
diff
changeset

1312 
len, tx, ty, nx, ny, ropeDx, ropeDy, mdX, mdY: hwFloat; 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

1313 
lx, ly: LongInt; 
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

1314 
haveCollision, 
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

1315 
haveDivided: boolean; 
4  1316 

3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1317 
procedure DeleteMe; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1318 
begin 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

1319 
with HHGear^ do 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1320 
begin 
3894  1321 
Message := Message and not gmAttack; 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1322 
State := (State or gstMoving) and not gstWinner; 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

1323 
end; 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1324 
DeleteGear(Gear) 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1325 
end; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1326 

a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1327 
procedure WaitCollision; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1328 
begin 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

1329 
with HHGear^ do 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1330 
begin 
3894  1331 
Message := Message and not gmAttack; 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1332 
State := State or gstMoving; 