author  nemo 
Sat, 30 Oct 2010 21:06:55 0400  
changeset 4035  3ed9573bcf5e 
parent 4026  afae5a3b8424 
child 4036  69e535a0e43a 
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 

31 
begin 

32 
if onlyCheckIfChanged then 

33 
begin 

34 
Gear^.X := Gear^.X + dX; 

35 
Gear^.Y := Gear^.Y + dY; 

36 
EXIT; 

37 
end 

38 
else 

39 
steps := 1; 

40 
end; 

41 

42 
if steps > 1 then 

43 
begin 

44 
sX:= dX / steps; 

45 
sY:= dY / steps; 

46 
end 

47 
else 

48 
begin 

49 
sX:= dX; 

50 
sY:= dY; 

51 
end; 

52 

53 
caller:= Gear^.doStep; 

54 

55 
for i:= 1 to steps do 

56 
begin 

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; 

64 
end; 

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 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

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

75 
if (gi^.Kind = gtHedgehog) then 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

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 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

79 
begin 
3143  80 
if (CurrentHedgehog^.Gear = gi) then 
81 
PlaySound(sndOops, PHedgehog(gi^.Hedgehog)^.Team^.voicepack) 

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

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

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 
87 
PlaySound(sndNooo, PHedgehog(gi^.Hedgehog)^.Team^.voicepack) 

88 
else 

89 
PlaySound(sndUhOh, PHedgehog(gi^.Hedgehog)^.Team^.voicepack); 

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

90 
end; 
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; 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

93 
gi := gi^.NextGear 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
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 
1918  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 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

117 
begin 
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) 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

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

124 
else 
1918  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 
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

127 
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

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; 
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

131 
if (Gear^.Kind <> gtSniperRifleShot) and (Gear^.Kind <> gtShotgunShot) and (Gear^.Kind <> gtDEagleShot) and (Gear^.Kind <> gtSineGunShot) 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

132 
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

133 
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

134 
if PHedgehog(Gear^.Hedgehog)^.Effects[heResurrectable] 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

135 
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

136 
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

137 
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

138 
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

139 
Gear^.State := Gear^.State and (not gstHHDriven); 
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 
AddCaption(Format(GetEventString(eidDrowned), PHedgehog(Gear^.Hedgehog)^.Name), cWhiteColor, capgrpMessage); 
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

141 
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

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

144 
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

145 
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

146 
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

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

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

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

151 

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

152 
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

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

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

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

157 

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

158 
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

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

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

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

163 
if particle <> nil then 
2982  164 
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

165 
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

166 
particle^.dY := particle^.dY  (Gear^.dY.QWordValue / 21474836480) 
2982  167 
end 
168 
end 

169 
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

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

172 
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

173 
CheckGearDrowning := false; 
4  174 
end; 
175 

176 
procedure CheckCollision(Gear: PGear); 

177 
begin 

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

178 
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

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

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

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

184 
procedure CheckHHDamage(Gear: PGear); 

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

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

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

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

190 
if _0_4 < Gear^.dY then 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

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

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

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

195 

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

196 
for i:= min(12, (3 + dmg div 10)) downto 0 do 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

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

198 
particle := AddVisualGear(hwRound(Gear^.X)  5 + Random(10), hwRound(Gear^.Y) + 12, 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

199 
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); 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

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 
206 
// PlaySound(sndOw4, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack) 

207 
//else 

208 
// PlaySound(sndOw1, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack); 

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 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

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 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

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 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

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; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

280 
end 
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 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

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

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

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

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

287 
Gear^.State := Gear^.State or gstCollision 
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 
3071
f40a3fbe3b34
Add more dY checks to allow greater 45 deg bouncing, simplify check for stopped gear in interests of perf.
nemo
parents:
3065
diff
changeset

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; 
3071
f40a3fbe3b34
Add more dY checks to allow greater 45 deg bouncing, simplify check for stopped gear in interests of perf.
nemo
parents:
3065
diff
changeset

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 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

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 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

303 
end 
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 
3001  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; 
3001  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 

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

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

321 

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

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

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

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

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

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

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

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

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

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

331 

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

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

333 
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

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

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

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

337 
); 
4  338 
end; 
339 

340 
//////////////////////////////////////////////////////////////////////////////// 

341 
procedure doStepBomb(Gear: PGear); 

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

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

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

345 
Fire: PGear; 
3475  346 
vg: PVisualGear; 
4  347 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

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

349 

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

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

351 

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

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

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

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

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

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

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

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

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

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

361 

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

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

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

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

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

366 
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

367 
end; 
3004  368 

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

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

372 
if vg <> nil then 

373 
vg^.Tint:= $FFC0C000; 

374 
end; 

375 

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

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

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

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

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

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

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

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

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

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

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

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

387 
begin 
3505  388 
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

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

390 
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

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

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

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

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

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

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

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

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

399 
begin 
3505  400 
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

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

402 
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

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

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

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

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

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

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

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

410 

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

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

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

413 
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

414 
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

415 
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

416 
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

417 
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

418 
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

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

420 
end; 
3712  421 
gtGasBomb: 
422 
begin 

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

424 
for i:= 0 to 2 do 

3976  425 
AddGear(int64(hwRound(Gear^.X))  30 + GetRandom(60), int64(hwRound(Gear^.Y))  20 + GetRandom(40), gtPoisonCloud, 0, _0, _0, 0); 
3712  426 
end; 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

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

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

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

430 
end; 
1263  431 

4  432 
CalcRotationDirAngle(Gear); 
1263  433 

434 
if Gear^.Kind = gtHellishBomb then 

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

435 
begin 
3118  436 

437 
if Gear^.Timer = 3000 then 

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

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

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

441 
end; 
1279  442 

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

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

444 
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

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

446 
end; 
4  447 
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

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

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

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

451 
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

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

453 
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

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

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

456 

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

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

458 
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

459 

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

481 
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

482 
end; 
4  483 

1279  484 
procedure doStepWatermelon(Gear: PGear); 
485 
begin 

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

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

487 
Gear^.doStep := @doStepBomb 
1279  488 
end; 
489 

78  490 
procedure doStepCluster(Gear: PGear); 
491 
begin 

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

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

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

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

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

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

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

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

499 
end; 
1262  500 

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

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

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

503 
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

504 
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace) 
78  505 
end; 
506 

4  507 
//////////////////////////////////////////////////////////////////////////////// 
508 
procedure doStepGrenade(Gear: PGear); 

509 
begin 

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

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

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

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

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

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

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

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

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

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

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

520 
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace); 
95  521 
end; 
522 

4  523 
//////////////////////////////////////////////////////////////////////////////// 
524 
procedure doStepGrave(Gear: PGear); 

525 
begin 

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

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

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

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

529 

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

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

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

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

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

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

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

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

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

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

539 
else if Gear^.dY <  _0_03 then PlaySound(Gear^.ImpactSound) 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

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

541 

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

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

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

544 
Gear^.dY := Gear^.dY + cGravity 
4  545 
end; 
546 

547 
//////////////////////////////////////////////////////////////////////////////// 

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

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

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

553 

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

576 
uw := nuw 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

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

578 

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

579 

3591  580 
if (GameTicks and $F) = 0 then 
581 
begin 

582 
if (GameTicks and $30) = 0 then 

583 
AddVisualGear(gX, gY, vgtBeeTrace); 

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

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

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

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

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

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

590 
end; 

591 

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

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

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

594 

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

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

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

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

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

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

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

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

602 
end; 
4  603 
end; 
604 

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

626 
end; 
4  627 
end; 
628 

629 
//////////////////////////////////////////////////////////////////////////////// 

876  630 
procedure doStepShotIdle(Gear: PGear); 
631 
begin 

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

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

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

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

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

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

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

638 
end 
876  639 
end; 
640 

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

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

643 
i: LongWord; 
2828  644 
shell: PVisualGear; 
4  645 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

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

647 

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

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

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

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

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

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

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

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

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

656 
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

657 
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

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

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

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

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

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

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

665 
else inc(Gear^.Timer); 
876  666 

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

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

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

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

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

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

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

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

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

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

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

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

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

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

680 

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

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

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

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

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

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

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

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

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

689 
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

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

691 
Gear^.doStep := @doStepShotIdle 
4  692 
end; 
693 

694 
//////////////////////////////////////////////////////////////////////////////// 

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

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

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

697 
i, x, y: LongWord; 
351  698 
oX, oY: hwFloat; 
38  699 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

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

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

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

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

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

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

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

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

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

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

710 
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

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

712 
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

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

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

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

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

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

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

719 
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

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

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

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

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

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

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

726 
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

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

728 
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

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

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

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

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

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

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

735 
end; 
1760  736 

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

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

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

739 
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

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

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

742 
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

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

744 
((GameFlags and gfArtillery) = 0) then cArtillery := false; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

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

746 
end; 
37  747 
end; 
748 

559  749 
procedure doStepDEagleShot(Gear: PGear); 
750 
begin 

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

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

752 
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

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

754 

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

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

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

757 
HHGear: PGear; 
2828  758 
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

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

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

761 
HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

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

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

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

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

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

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

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

769 
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

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

771 

3894  772 
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

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

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

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

776 
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

777 
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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

795 

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

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

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

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

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

801 
AfterAttack 
2058  802 
end; 
559  803 
end; 
804 

37  805 
//////////////////////////////////////////////////////////////////////////////// 
4  806 
procedure doStepActionTimer(Gear: PGear); 
807 
begin 

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

843 
end; 
351  844 
if Gear^.Timer = 0 then DeleteGear(Gear) 
4  845 
end; 
846 

847 
//////////////////////////////////////////////////////////////////////////////// 

848 
procedure doStepPickHammerWork(Gear: PGear); 

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

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

850 
i, ei: LongInt; 
4  851 
HHGear: PGear; 
852 
begin 

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

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

854 
HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

855 
dec(Gear^.Timer); 
3894  856 
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

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

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

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

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

861 
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

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

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

864 
end; 
845  865 

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

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

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

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

869 
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y) + 7, 6, EXPLDontDraw); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

870 
HHGear^.State := HHGear^.State and not gstNoDamage 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

871 
end; 
422  872 

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

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

874 
begin 
3720  875 
for i:= 0 to 1 do 
876 
AddVisualGear(hwRound(Gear^.X)  5 + Random(10), hwRound(Gear^.Y) + 12, vgtDust); 

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

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

878 
ei := hwRound(Gear^.X) + Gear^.Radius + LongInt(GetRandom(2)); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

879 
while i <= ei do 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

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

881 
DrawExplosion(i, hwRound(Gear^.Y) + 3, 3); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

882 
inc(i, 1) 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

883 
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

884 

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

885 
if CheckLandValue(hwRound(Gear^.X + Gear^.dX + SignAs(_6,Gear^.dX)), hwRound(Gear^.Y + _1_9) 
3519  886 
, 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

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

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

889 
Gear^.Y := Gear^.Y + _1_9; 
2090
4edb0d49a42d
prevent unc0rr from getting clever with jackhammer too. bring blowtorch into line with the other  should be more fun anyway
nemo
parents:
2089
diff
changeset

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

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

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

893 
if TestCollisionYwithGear(Gear, 1) then 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

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

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

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

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

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

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

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

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

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

903 
if hwRound(Gear^.Y) > cWaterLine then Gear^.Timer := 1 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

904 
end; 
4  905 

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

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

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

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

909 

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

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

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

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

914 
if (Gear^.State and gsttmpFlag) = 0 then Gear^.State := Gear^.State or gsttmpFlag; 
3894  915 
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

916 
else 
3894  917 
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

918 
else Gear^.dX := _0; 
4  919 
end; 
920 

921 
procedure doStepPickHammer(Gear: PGear); 

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

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

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

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

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

928 
HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

929 

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

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

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

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

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

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

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

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

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

938 

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

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

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

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

942 

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

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

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

945 
Gear^.doStep := @doStepPickHammerWork 
4  946 
end; 
947 

948 
//////////////////////////////////////////////////////////////////////////////// 

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

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

950 
BTPrevAngle, BTSteps: LongInt; 
302  951 

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

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

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

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

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

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

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

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

960 
HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

961 

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

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

963 

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

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

965 

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

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

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

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

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

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

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

972 
end; 
1528  973 

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

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

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

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

977 
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

978 
end; 
305  979 

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

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

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

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

983 
if Gear^.dX.isNegative then 
3894  984 
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

985 
else 
3894  986 
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

987 

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

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

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

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

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

992 

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

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

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

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

997 

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

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

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

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

1002 
end; 
305  1003 

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

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

1005 
if BTSteps = 7 then 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

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

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

1008 
if CheckLandValue(hwRound(HHGear^.X + Gear^.dX * (cHHRadius + cBlowTorchC) + SignAs(_6, 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1009 
Gear^.dX)), hwRound(HHGear^.Y + Gear^.dY * (cHHRadius + cBlowTorchC)), 
3519  1010 
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

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

1012 
Gear^.X := HHGear^.X + Gear^.dX * (cHHRadius + cBlowTorchC); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1013 
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

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

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

1016 
AmmoShove(Gear, 2, 15); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1017 
HHGear^.State := HHGear^.State and not gstNoDamage 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

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

1019 
end; 
305  1020 

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

1021 
if b then 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1022 
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

1023 
Gear^.dY) * 7, 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1024 
Gear^.dX, Gear^.dY, 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1025 
cHHRadius * 5, cHHRadius * 2 + 7); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1026 

3894  1027 
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

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

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

1030 
HHGear^.State := HHGear^.State and (not gstNotKickable); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

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

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

1033 
end 
302  1034 
end; 
1035 

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

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

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

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

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

1040 
BTPrevAngle := High(LongInt); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

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

1042 
HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

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

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

1045 
Gear^.doStep := @doStepBlowTorchWork 
303
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset

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

1047 

302  1048 
//////////////////////////////////////////////////////////////////////////////// 
1049 

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

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

1051 
forward; 
1781  1052 

1053 
procedure doStepRopeAfterAttack(Gear: PGear); 

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

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

1055 
HHGear: PGear; 
1781  1056 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1057 
HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1058 
if ((HHGear^.State and gstHHDriven) = 0) 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1059 
or (CheckGearDrowning(HHGear)) 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1060 
or TestCollisionYwithGear(HHGear, 1) then 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

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

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

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

1064 
ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

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

1066 
end; 
1781  1067 

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

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

1069 

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

1070 
if TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then SetLittle(HHGear^.dX); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1071 

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

1072 
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

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

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

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

1076 

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

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

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

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

1081 

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

1082 
ApplyAngleBounds(PHedgehog(Gear^.Hedgehog)^, amRope); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1083 

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

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

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

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

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

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

1089 
Gear^.doStep := @doStepRope; 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

1090 
end 
1781  1091 
end; 
1092 

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

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

1095 
HHGear: PGear; 
3986
99178ffb817d
Remove this  doesn't seem to do anything useful after all.
nemo
parents:
3985
diff
changeset

1096 
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

1097 
lx, ly: LongInt; 
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

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

1099 
haveDivided: boolean; 
4  1100 

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

1101 
procedure DeleteMe; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

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

1103 
with HHGear^ do 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1104 
begin 
3894  1105 
Message := Message and not gmAttack; 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1106 
State := (State or gstMoving) and not gstWinner; 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

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

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

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

1110 

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

1111 
procedure WaitCollision; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

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

1113 
with HHGear^ do 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1114 
begin 
3894  1115 
Message := Message and not gmAttack; 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1116 
State := State or gstMoving; 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

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

1118 
RopePoints.Count := 0; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

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

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

1121 
end; 
1781  1122 

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

1124 
HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1125 

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

1126 
if ((HHGear^.State and gstHHDriven) = 0) 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1127 
or (CheckGearDrowning(HHGear)) then 
3974
91ac041ecb20
Rope optimisation. Remove a space in sdl keys that seems like a bug  issue #70
nemo
parents:
3971
diff
changeset

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

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

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

1131 
exit 
3974
91ac041ecb20
Rope optimisation. Remove a space in sdl keys that seems like a bug  issue #70
nemo
parents:
3971
diff
changeset

1132 
end; 
928
b9064b48b001
Some preparation work for attacking from rope, parachute and etc.
unc0rr
parents:
925
diff
changeset

1133 

3894  1134 
if (Gear^.Message and gmLeft <> 0) then HHGear^.dX := HHGear^.dX  _0_0002 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1135 
else 
3894  1136 
if (Gear^.Message and gmRight <> 0) then HHGear^.dX := HHGear^.dX + _0_0002; 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1137 

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

1138 
if not TestCollisionYwithGear(HHGear, 1) then HHGear^.dY := HHGear^.dY + cGravity; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1139 

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

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

1141 
// vector between hedgehog and rope attaching point 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

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

1143 

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

1144 
mdX := ropeDx + HHGear^.dX; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1145 
mdY := ropeDy + HHGear^.dY; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1146 
len := _1 / Distance(mdX, mdY); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1147 
mdX := mdX * len; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1148 
// rope vector plus hedgehog direction vector normalized 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1149 
mdY := mdY * len; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1150 

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

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

1152 
// for visual purposes only 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

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

1154 

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

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

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

1157 
ty := HHGear^.Y; 
4  1158 

3894  1159 
if ((Gear^.Message and gmDown) <> 0) and (Gear^.Elasticity < Gear^.Friction) then 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

1160 
if not (TestCollisionXwithGear(HHGear, hwSign(ropeDx)) 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1161 
or TestCollisionYwithGear(HHGear, hwSign(ropeDy))) then 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1162 
Gear^.Elasticity := Gear^.Elasticity + _0_3; 
1652  1163 

3894  1164 
if ((Gear^.Message and gmUp) <> 0) and (Gear^.Elasticity > _30) then 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

1165 
if not (TestCollisionXwithGear(HHGear, hwSign(ropeDx)) 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1166 
or TestCollisionYwithGear(HHGear, hwSign(ropeDy))) then 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

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

1168 

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

1169 
HHGear^.X := Gear^.X + mdX * Gear^.Elasticity; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1170 
HHGear^.Y := Gear^.Y + mdY * Gear^.Elasticity; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1171 

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

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

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

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

1175 

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 
haveDivided := false; 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

1178 
// check whether rope needs dividing 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1179 

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

1180 
len := Gear^.Elasticity  _5; 
3585
39570d86de57
rope: optimization, should save up to ~3 million hwFloat multiplications per second
sheepluva
parents:
3584
diff
changeset

1181 
nx := Gear^.X + mdX * len; 
39570d86de57
rope: optimization, should save up to ~3 million hwFloat multiplications per second
sheepluva
parents:
3584
diff
changeset

1182 
ny := Gear^.Y + mdY * len; 
39570d86de57
rope: optimization, should save up to ~3 million hwFloat multiplications per second
sheepluva
parents:
3584
diff
changeset

1183 
tx := mdX * _0_3; // should be the same as increase step 
39570d86de57
rope: optimization, should save up to ~3 million hwFloat multiplications per second
sheepluva
parents:
3584
diff
changeset

1184 
ty := mdY * _0_3; 
39570d86de57
rope: optimization, should save up to ~3 million hwFloat multiplications per second
sheepluva
parents:
3584
diff
changeset

1185 

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

1186 
while len > _3 do 
3974
91ac041ecb20
Rope optimisation. Remove a space in sdl keys that seems like a bug  issue #70
nemo
parents:
3971
diff
changeset

1187 
begin 
3585
39570d86de57
rope: optimization, should save up to ~3 million hwFloat multiplications per second
sheepluva
parents:
3584
diff
changeset

1188 
lx := hwRound(nx); 
39570d86de57
rope: optimization, should save up to ~3 million hwFloat multiplications per second
sheepluva
parents:
3584
diff
changeset

1189 
ly := hwRound(ny); 
3974
91ac041ecb20
Rope optimisation. Remove a space in sdl keys that seems like a bug  issue #70
nemo
parents:
3971
diff
changeset

1190 
if ((ly and LAND_HEIGHT_MASK) = 0) and ((lx and LAND_WIDTH_MASK) = 0) and (Land[ly, lx] <> 0) then 
91ac041ecb20
Rope optimisation. Remove a space in sdl keys that seems like a bug  issue #70
nemo
parents:
3971
diff
changeset

1191 
begin 
3986
99178ffb817d
Remove this  doesn't seem to do anything useful after all.
nemo
parents:
3985
diff
changeset

1192 
ny := _1 / Distance(ropeDx, ropeDy); 
3584  1193 
// old rope pos 
3986
99178ffb817d
Remove this  doesn't seem to do anything useful after all.
nemo
parents:
3985
diff
changeset

1194 
nx := ropeDx * ny; 
99178ffb817d
Remove this  doesn't seem to do anything useful after all.
nemo
parents:
3985
diff
changeset

1195 
ny := ropeDy * ny; 
3584  1196 

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

1197 
with RopePoints.ar[RopePoints.Count] do 
3974
91ac041ecb20
Rope optimisation. Remove a space in sdl keys that seems like a bug  issue #70
nemo
parents:
3971
diff
changeset

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

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

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

1201 
if RopePoints.Count = 0 then RopePoints.HookAngle := DxDy2Angle(Gear^.dY, Gear^.dX); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1202 
b := (nx * HHGear^.dY) > (ny * HHGear^.dX); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1203 
dLen := len 
3974
91ac041ecb20
Rope optimisation. Remove a space in sdl keys that seems like a bug  issue #70
nemo
parents:
3971
diff
changeset

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

1205 
with RopePoints.rounded[RopePoints.Count] do 
3974
91ac041ecb20
Rope optimisation. Remove a space in sdl keys that seems like a bug  issue #70
nemo
parents:
3971
diff
changeset

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

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

1208 
Y := hwRound(Gear^.Y); 
3974
91ac041ecb20
Rope optimisation. Remove a space in sdl keys that seems like a bug  issue #70
nemo
parents:
3971
diff
changeset

1209 
end; 
1553
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset

1210 

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

1211 
Gear^.X := Gear^.X + nx * len; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1212 
Gear^.Y := Gear^.Y + ny * len; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1213 
inc(RopePoints.Count); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1214 
TryDo(RopePoints.Count <= MAXROPEPOINTS, 'Rope points overflow', true); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

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

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

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

1218 
break 
3974
91ac041ecb20
Rope optimisation. Remove a space in sdl keys that seems like a bug  issue #70
nemo
parents:
3971
diff
changeset

1219 
end; 
3585
39570d86de57
rope: optimization, should save up to ~3 million hwFloat multiplications per second
sheepluva
parents:
3584
diff
changeset

1220 
nx := nx  tx; 
39570d86de57
rope: optimization, should save up to ~3 million hwFloat multiplications per second
sheepluva
parents:
3584
diff
changeset

1221 
ny := ny  ty; 
3974
91ac041ecb20
Rope optimisation. Remove a space in sdl keys that seems like a bug  issue #70
nemo
parents:
3971
diff
changeset

1222 
lx := hwRound(nx); 
91ac041ecb20
Rope optimisation. Remove a space in sdl keys that seems like a bug  issue #70
nemo
parents:
3971
diff
changeset

1223 
ly := hwRound(ny); 
3588  1224 
// len := len  _0_3 // should be the same as increase step 
1225 
len.QWordValue := len.QWordValue  _0_3.QWordValue; 

3974
91ac041ecb20
Rope optimisation. Remove a space in sdl keys that seems like a bug  issue #70
nemo
parents:
3971
diff
changeset

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

1227 

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

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

1229 
if RopePoints.Count > 0 then // check whether the last dividing point could be removed 
3974
91ac041ecb20
Rope optimisation. Remove a space in sdl keys that seems like a bug  issue #70
nemo
parents:
3971
diff
changeset

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

1231 
tx := RopePoints.ar[Pred(RopePoints.Count)].X; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1232 
ty := RopePoints.ar[Pred(RopePoints.Count)].Y; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

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

1234 
mdY := ty  Gear^.Y; 
3974
91ac041ecb20
Rope optimisation. Remove a space in sdl keys that seems like a bug  issue #70
nemo
parents:
3971
diff
changeset

1235 
if RopePoints.ar[Pred(RopePoints.Count)].b xor (mdX * (ty  HHGear^.Y) > (tx  HHGear^.X) * mdY) then 
91ac041ecb20
Rope optimisation. Remove a space in sdl keys that seems like a bug  issue #70
nemo
parents:
3971
diff
changeset

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

1237 
dec(RopePoints.Count); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1238 
Gear^.X := RopePoints.ar[RopePoints.Count].X; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1239 
Gear^.Y := RopePoints.ar[RopePoints.Count].Y; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1240 
Gear^.Elasticity := Gear^.Elasticity + RopePoints.ar[RopePoints.Count].dLen; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1241 
Gear^.Friction := Gear^.Friction + RopePoints.ar[RopePoints.Count].dLen; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1242 

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

1243 
// restore hog position 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1244 
len := _1 / Distance(mdX, mdY); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1245 
mdX := mdX * len; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1246 
mdY := mdY * len; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1247 

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

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

1249 
HHGear^.Y := Gear^.Y  mdY * Gear^.Elasticity; 
3974
91ac041ecb20
Rope optimisation. Remove a space in sdl keys that seems like a bug  issue #70
nemo
parents:
3971
diff
changeset

1250 
end 
91ac041ecb20
Rope optimisation. Remove a space in sdl keys that seems like a bug  issue #70
nemo
parents:
3971
diff
changeset

1251 
end; 
4  1252 

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

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

1254 
if TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then 
3974
91ac041ecb20
Rope optimisation. Remove a space in sdl keys that seems like a bug  issue #70
nemo
parents:
3971
diff
changeset

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

1256 
HHGear^.dX := _0_6 * HHGear^.dX; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1257 
haveCollision := true 
3974
91ac041ecb20
Rope optimisation. Remove a space in sdl keys that seems like a bug  issue #70
nemo
parents:
3971
diff
changeset

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

1259 
if TestCollisionYwithGear(HHGear, hwSign(HHGear^.dY)) then 
3974
91ac041ecb20
Rope optimisation. Remove a space in sdl keys that seems like a bug  issue #70
nemo
parents:
3971
diff
changeset

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

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

1262 
haveCollision := true 
3974
91ac041ecb20
Rope optimisation. Remove a space in sdl keys that seems like a bug  issue #70
nemo
parents:
3971
diff
changeset

1263 
end; 
1551
c747e69f98f3
Add some speed to hedgehog on rope when colliding with land and pressing left or right arrow key
unc0rr
parents:
1548
diff
changeset

1264 

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

1265 
if haveCollision 
3894  1266 
and (Gear^.Message and (gmLeft or gmRight) <> 0) 
1267 
and (Gear^.Message and (gmUp or gmDown) <> 0) then 

3974
91ac041ecb20
Rope optimisation. Remove a space in sdl keys that seems like a bug  issue #70
nemo
parents:
3971
diff
changeset

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

1269 
HHGear^.dX := SignAs(hwAbs(HHGear^.dX) + _0_2, HHGear^.dX); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1270 
HHGear^.dY := SignAs(hwAbs(HHGear^.dY) + _0_2, HHGear^.dY) 
3974
91ac041ecb20
Rope optimisation. Remove a space in sdl keys that seems like a bug  issue #70
nemo
parents:
3971
diff
changeset

1271 
end; 
4  1272 

3583  1273 
len := hwSqr(HHGear^.dX) + hwSqr(HHGear^.dY); 
1274 
if len > _0_64 then 

3974
91ac041ecb20
Rope optimisation. Remove a space in sdl keys that seems like a bug  issue #70
nemo
parents:
3971
diff
changeset

1275 
begin 
3583  1276 
len := _0_8 / hwSqrt(len); 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1277 
HHGear^.dX := HHGear^.dX * len; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1278 
HHGear^.dY := HHGear^.dY * len; 
3974
91ac041ecb20
Rope optimisation. Remove a space in sdl keys that seems like a bug  issue #70
nemo
parents:
3971
diff
changeset

1279 
end; 
789  1280 

3583  1281 

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

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

1284 
with PHedgehog(Gear^.Hedgehog)^ do 
3974
91ac041ecb20
Rope optimisation. Remove a space in sdl keys that seems like a bug  issue #70
nemo
parents:
3971
diff
changeset

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

1286 
PlaySound(sndRopeRelease); 
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

1287 
if CurAmmoType <> amParachute then 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

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

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

1290 
DeleteMe 
3974
91ac041ecb20
Rope optimisation. Remove a space in sdl keys that seems like a bug  issue #70
nemo
parents:
3971
diff
changeset

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

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

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

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

1295 
Gear^.State := Gear^.State or gsttmpFlag; 
4  1296 
end; 
1297 

1298 
procedure doStepRopeAttach(Gear: PGear); 

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

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

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

1301 
tx, ty, tt: hwFloat; 
1781  1302 

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

1303 
procedure RemoveFromAmmo; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

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

1305 
if (Gear^.State and gstAttacked) = 0 then 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

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

1307 
OnUsedAmmo(PHedgehog(HHGear^.Hedgehog)^); 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

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

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

1310 
ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^) 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1311 
end; 
2376  1312 

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

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

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

1316 
Gear^.Elasticity := Gear^.Elasticity + _1; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1317 

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

1318 
HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

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

1320 

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

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

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

1323 
if TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then SetLittle(HHGear^.dX); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1324 
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

1325 

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

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

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

1328 

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

1329 
if TestCollisionYwithGear(HHGear, 1) then 
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand t 4' command
unc0rr
parents:
2944
diff
changeset

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

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

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

1333 
//HHGear^.State:= HHGear^.State and not (gstHHJumping or gstHHHJump); 
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset
