author  alfadur 
Thu, 01 Nov 2018 04:04:33 +0300  
changeset 14055  82956b3ba2ab 
parent 14040  128fbd36eee4 
child 14065  aa586aadd91f 
permissions  rwrr 
4  1 
(* 
1066  2 
* Hedgewars, a free turn based strategy game 
11046  3 
* Copyright (c) 20042015 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 

10108
c68cf030eded
update FSF address. note: two sdl include files (by Sam Lantinga) still have the old FSF address in their copyright  but I ain't gonna touch their copyright headers
sheepluva
parents:
10040
diff
changeset

16 
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 021101301 USA 
4  17 
*) 
18 

5121
2d34ec60992c
added some comments in order to confuse the GSoC students as much as possible ;D
sheepluva
parents:
5076
diff
changeset

19 
(* 
2d34ec60992c
added some comments in order to confuse the GSoC students as much as possible ;D
sheepluva
parents:
5076
diff
changeset

20 
* This file contains the step handlers for gears. 
2d34ec60992c
added some comments in order to confuse the GSoC students as much as possible ;D
sheepluva
parents:
5076
diff
changeset

21 
* 
2d34ec60992c
added some comments in order to confuse the GSoC students as much as possible ;D
sheepluva
parents:
5076
diff
changeset

22 
* Important: Since gears change the course of the game, calculations that 
2d34ec60992c
added some comments in order to confuse the GSoC students as much as possible ;D
sheepluva
parents:
5076
diff
changeset

23 
* lead to different results for different clients/players/machines 
2d34ec60992c
added some comments in order to confuse the GSoC students as much as possible ;D
sheepluva
parents:
5076
diff
changeset

24 
* should NOT occur! 
2d34ec60992c
added some comments in order to confuse the GSoC students as much as possible ;D
sheepluva
parents:
5076
diff
changeset

25 
* Use safe functions and data types! (e.g. GetRandom() and hwFloat) 
2d34ec60992c
added some comments in order to confuse the GSoC students as much as possible ;D
sheepluva
parents:
5076
diff
changeset

26 
*) 
10015  27 

9285  28 
{$INCLUDE "options.inc"} 
29 

30 
unit uGearsHandlersMess; 

31 
interface 

32 
uses uTypes, uFloat; 

33 

34 
procedure doStepPerPixel(Gear: PGear; step: TGearStepProcedure; onlyCheckIfChanged: boolean); 

14011
3c40754f6cfe
Add Grenade taunt when grenade close to hog is about to blow up
Wuzzy <Wuzzy2@mail.ru>
parents:
14009
diff
changeset

35 
procedure makeHogsWorry(x, y: hwFloat; r: LongInt; gearType: TGearType); 
9285  36 
procedure HideHog(HH: PHedgehog); 
37 
procedure doStepDrowningGear(Gear: PGear); 

38 
procedure doStepFallingGear(Gear: PGear); 

39 
procedure doStepBomb(Gear: PGear); 

40 
procedure doStepMolotov(Gear: PGear); 

41 
procedure doStepCluster(Gear: PGear); 

42 
procedure doStepShell(Gear: PGear); 

43 
procedure doStepSnowball(Gear: PGear); 

44 
procedure doStepSnowflake(Gear: PGear); 

45 
procedure doStepGrave(Gear: PGear); 

46 
procedure doStepBeeWork(Gear: PGear); 

47 
procedure doStepBee(Gear: PGear); 

48 
procedure doStepShotIdle(Gear: PGear); 

49 
procedure doStepShotgunShot(Gear: PGear); 

13151
deab88f1f6f7
Improve appearance of bullet trails, slight fade out at beginning
alfadur
parents:
13147
diff
changeset

50 
procedure spawnBulletTrail(Bullet: PGear; bulletX, bulletY: hwFloat; fadeIn: Boolean); 
9285  51 
procedure doStepBulletWork(Gear: PGear); 
52 
procedure doStepDEagleShot(Gear: PGear); 

53 
procedure doStepSniperRifleShot(Gear: PGear); 

54 
procedure doStepActionTimer(Gear: PGear); 

55 
procedure doStepPickHammerWork(Gear: PGear); 

56 
procedure doStepPickHammer(Gear: PGear); 

57 
procedure doStepBlowTorchWork(Gear: PGear); 

58 
procedure doStepBlowTorch(Gear: PGear); 

59 
procedure doStepMine(Gear: PGear); 

10789
acbf69e2e5cf
experiment with air mines. thought they could make shoppa... interesting. ToDo: Allow mines to give up, tweak distances, real graphics, toggle for whether they can acquire a new target while they haven't given up.
nemo
parents:
10736
diff
changeset

60 
procedure doStepAirMine(Gear: PGear); 
9285  61 
procedure doStepSMine(Gear: PGear); 
62 
procedure doStepDynamite(Gear: PGear); 

63 
procedure doStepRollingBarrel(Gear: PGear); 

64 
procedure doStepCase(Gear: PGear); 

65 
procedure doStepTarget(Gear: PGear); 

66 
procedure doStepIdle(Gear: PGear); 

67 
procedure doStepShover(Gear: PGear); 

68 
procedure doStepWhip(Gear: PGear); 

69 
procedure doStepFlame(Gear: PGear); 

70 
procedure doStepFirePunchWork(Gear: PGear); 

71 
procedure doStepFirePunch(Gear: PGear); 

72 
procedure doStepParachuteWork(Gear: PGear); 

73 
procedure doStepParachute(Gear: PGear); 

74 
procedure doStepAirAttackWork(Gear: PGear); 

75 
procedure doStepAirAttack(Gear: PGear); 

76 
procedure doStepAirBomb(Gear: PGear); 

77 
procedure doStepGirder(Gear: PGear); 

78 
procedure doStepTeleportAfter(Gear: PGear); 

79 
procedure doStepTeleportAnim(Gear: PGear); 

80 
procedure doStepTeleport(Gear: PGear); 

81 
procedure doStepSwitcherWork(Gear: PGear); 

82 
procedure doStepSwitcher(Gear: PGear); 

83 
procedure doStepMortar(Gear: PGear); 

84 
procedure doStepKamikazeWork(Gear: PGear); 

85 
procedure doStepKamikazeIdle(Gear: PGear); 

86 
procedure doStepKamikaze(Gear: PGear); 

87 
procedure doStepCakeExpl(Gear: PGear); 

88 
procedure doStepCakeDown(Gear: PGear); 

11531  89 
procedure doStepCakeWalk(Gear: PGear); 
9285  90 
procedure doStepCakeUp(Gear: PGear); 
91 
procedure doStepCakeFall(Gear: PGear); 

92 
procedure doStepCake(Gear: PGear); 

93 
procedure doStepSeductionWork(Gear: PGear); 

94 
procedure doStepSeductionWear(Gear: PGear); 

95 
procedure doStepSeduction(Gear: PGear); 

96 
procedure doStepWaterUp(Gear: PGear); 

97 
procedure doStepDrillDrilling(Gear: PGear); 

98 
procedure doStepDrill(Gear: PGear); 

99 
procedure doStepBallgunWork(Gear: PGear); 

100 
procedure doStepBallgun(Gear: PGear); 

101 
procedure doStepRCPlaneWork(Gear: PGear); 

102 
procedure doStepRCPlane(Gear: PGear); 

103 
procedure doStepJetpackWork(Gear: PGear); 

104 
procedure doStepJetpack(Gear: PGear); 

105 
procedure doStepBirdyDisappear(Gear: PGear); 

106 
procedure doStepBirdyFly(Gear: PGear); 

107 
procedure doStepBirdyDescend(Gear: PGear); 

108 
procedure doStepBirdyAppear(Gear: PGear); 

109 
procedure doStepBirdy(Gear: PGear); 

110 
procedure doStepEggWork(Gear: PGear); 

111 
procedure doPortalColorSwitch(); 

112 
procedure doStepPortal(Gear: PGear); 

113 
procedure loadNewPortalBall(oldPortal: PGear; destroyGear: Boolean); 

114 
procedure doStepMovingPortal_real(Gear: PGear); 

115 
procedure doStepMovingPortal(Gear: PGear); 

116 
procedure doStepPortalShot(newPortal: PGear); 

117 
procedure doStepPiano(Gear: PGear); 

118 
procedure doStepSineGunShotWork(Gear: PGear); 

119 
procedure doStepSineGunShot(Gear: PGear); 

120 
procedure doStepFlamethrowerWork(Gear: PGear); 

121 
procedure doStepFlamethrower(Gear: PGear); 

122 
procedure doStepLandGunWork(Gear: PGear); 

123 
procedure doStepLandGun(Gear: PGear); 

124 
procedure doStepPoisonCloud(Gear: PGear); 

125 
procedure doStepHammer(Gear: PGear); 

126 
procedure doStepHammerHitWork(Gear: PGear); 

127 
procedure doStepHammerHit(Gear: PGear); 

128 
procedure doStepResurrectorWork(Gear: PGear); 

129 
procedure doStepResurrector(Gear: PGear); 

130 
procedure doStepNapalmBomb(Gear: PGear); 

11468
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11391
diff
changeset

131 
//procedure doStepStructure(Gear: PGear); 
9285  132 
procedure doStepTardisWarp(Gear: PGear); 
133 
procedure doStepTardis(Gear: PGear); 

134 
procedure updateFuel(Gear: PGear); 

135 
procedure updateTarget(Gear:PGear; newX, newY:HWFloat); 

136 
procedure doStepIceGun(Gear: PGear); 

137 
procedure doStepAddAmmo(Gear: PGear); 

138 
procedure doStepGenericFaller(Gear: PGear); 

13605
422d6062620a
hijack the duck for an attempted resurrection of the creeper. initial pass.
nemo
parents:
13604
diff
changeset

139 
procedure doStepCreeper(Gear: PGear); 
9285  140 
procedure doStepKnife(Gear: PGear); 
12898  141 
procedure doStepMinigunWork(Gear: PGear); 
142 
procedure doStepMinigun(Gear: PGear); 

143 
procedure doStepMinigunBullet(Gear: PGear); 

9285  144 

145 
var 

146 
upd: Longword; 

147 
snowLeft,snowRight: LongInt; 

148 

149 
implementation 

150 
uses uConsts, uVariables, uVisualGearsList, uRandom, uCollisions, uGearsList, uUtils, uSound 

151 
, SDLh, uScript, uGearsHedgehog, uGearsUtils, uIO, uCaptions, uLandGraphics 

12823
e2e372449c19
Remove unused uCommands from uGearsHandlersMess
Wuzzy <Wuzzy2@mail.ru>
parents:
12820
diff
changeset

152 
, uGearsHandlers, uTextures, uRenderUtils, uAmmos, uTeams, uLandTexture 
12169
869cf5f34700
More ticker messages: Sick, king died, resurrect, time box return, timeout, kamikaze
Wuzzy <almikes@aol.com>
parents:
12120
diff
changeset

153 
, uStore, uAI, uStats, uLocale; 
5121
2d34ec60992c
added some comments in order to confuse the GSoC students as much as possible ;D
sheepluva
parents:
5076
diff
changeset

154 

3569  155 
procedure doStepPerPixel(Gear: PGear; step: TGearStepProcedure; onlyCheckIfChanged: boolean); 
156 
var 

157 
dX, dY, sX, sY: hwFloat; 

158 
i, steps: LongWord; 

159 
caller: TGearStepProcedure; 

160 
begin 

161 
dX:= Gear^.dX; 

162 
dY:= Gear^.dY; 

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

164 

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

166 
if steps < 1 then 

4578  167 
begin 
3569  168 
if onlyCheckIfChanged then 
4578  169 
begin 
3569  170 
Gear^.X := Gear^.X + dX; 
171 
Gear^.Y := Gear^.Y + dY; 

172 
EXIT; 

4578  173 
end 
3569  174 
else 
175 
steps := 1; 

4578  176 
end; 
3569  177 

178 
if steps > 1 then 

4578  179 
begin 
3569  180 
sX:= dX / steps; 
181 
sY:= dY / steps; 

4578  182 
end 
8795  183 

3569  184 
else 
4578  185 
begin 
3569  186 
sX:= dX; 
187 
sY:= dY; 

4578  188 
end; 
3569  189 

190 
caller:= Gear^.doStep; 

191 

192 
for i:= 1 to steps do 

4578  193 
begin 
3569  194 
Gear^.X := Gear^.X + sX; 
195 
Gear^.Y := Gear^.Y + sY; 

196 
step(Gear); 

197 
if (Gear^.doStep <> caller) 

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

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

200 
break; 

4578  201 
end; 
3569  202 
end; 
203 

14011
3c40754f6cfe
Add Grenade taunt when grenade close to hog is about to blow up
Wuzzy <Wuzzy2@mail.ru>
parents:
14009
diff
changeset

204 
procedure makeHogsWorry(x, y: hwFloat; r: LongInt; gearType: TGearType); 
8795  205 
var 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

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

207 
d: LongInt; 
14011
3c40754f6cfe
Add Grenade taunt when grenade close to hog is about to blow up
Wuzzy <Wuzzy2@mail.ru>
parents:
14009
diff
changeset

208 
grenadeTaunt: boolean; 
2647  209 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

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

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

213 
if (gi^.Kind = gtHedgehog) then 
4578  214 
begin 
12805  215 
d := r  hwRound(Distance(gi^.X  x, gi^.Y  y)); 
10011
ead5e4b21671
Add check for gear kind of hedgehog on invulnerability effect. This probably fixes bug #766, is similar to change in previous r2a1483d91977 and was introduced by r7d925e82e572
nemo
parents:
9998
diff
changeset

216 
if (d > 1) and (gi^.Hedgehog^.Effects[heInvulnerable] = 0) and (GetRandom(2) = 0) then 
4578  217 
begin 
3143  218 
if (CurrentHedgehog^.Gear = gi) then 
14019
1effb8b72b11
New taunt: Runaway, when something is about to blow up near current hog
Wuzzy <Wuzzy2@mail.ru>
parents:
14014
diff
changeset

219 
if (CurrentHedgehog^.Gear^.FlightTime = 0) then 
1effb8b72b11
New taunt: Runaway, when something is about to blow up near current hog
Wuzzy <Wuzzy2@mail.ru>
parents:
14014
diff
changeset

220 
case random(4) of 
1effb8b72b11
New taunt: Runaway, when something is about to blow up near current hog
Wuzzy <Wuzzy2@mail.ru>
parents:
14014
diff
changeset

221 
0: PlaySoundV(sndWhatThe, gi^.Hedgehog^.Team^.voicepack); 
1effb8b72b11
New taunt: Runaway, when something is about to blow up near current hog
Wuzzy <Wuzzy2@mail.ru>
parents:
14014
diff
changeset

222 
1: PlaySoundV(sndOops, gi^.Hedgehog^.Team^.voicepack); 
1effb8b72b11
New taunt: Runaway, when something is about to blow up near current hog
Wuzzy <Wuzzy2@mail.ru>
parents:
14014
diff
changeset

223 
2: PlaySoundV(sndRunAway, gi^.Hedgehog^.Team^.voicepack); 
1effb8b72b11
New taunt: Runaway, when something is about to blow up near current hog
Wuzzy <Wuzzy2@mail.ru>
parents:
14014
diff
changeset

224 
3: PlaySoundV(sndRunAway, gi^.Hedgehog^.Team^.voicepack); 
1effb8b72b11
New taunt: Runaway, when something is about to blow up near current hog
Wuzzy <Wuzzy2@mail.ru>
parents:
14014
diff
changeset

225 
end 
14014  226 
else 
14019
1effb8b72b11
New taunt: Runaway, when something is about to blow up near current hog
Wuzzy <Wuzzy2@mail.ru>
parents:
14014
diff
changeset

227 
if random(4) = 0 then 
1effb8b72b11
New taunt: Runaway, when something is about to blow up near current hog
Wuzzy <Wuzzy2@mail.ru>
parents:
14014
diff
changeset

228 
PlaySoundV(sndWhatThe, gi^.Hedgehog^.Team^.voicepack) 
1effb8b72b11
New taunt: Runaway, when something is about to blow up near current hog
Wuzzy <Wuzzy2@mail.ru>
parents:
14014
diff
changeset

229 
else 
1effb8b72b11
New taunt: Runaway, when something is about to blow up near current hog
Wuzzy <Wuzzy2@mail.ru>
parents:
14014
diff
changeset

230 
PlaySoundV(sndOops, gi^.Hedgehog^.Team^.voicepack) 
8795  231 

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

232 
else 
4578  233 
begin 
8632
b5ed76d2a1f9
Make hogs thaw only on enemy turns, make timebox counter decrement only on your turn, adjust knock for frozen hogs, increase damage on frozen hogs, make freezer fuel only reduce when not adjusting angle.
nemo
parents:
8628
diff
changeset

234 
if ((gi^.State and gstMoving) = 0) and (gi^.Hedgehog^.Effects[heFrozen] = 0) then 
7829
c1dc7839d7b9
Set minimums on a few values to avoid camera zooming out past them. partly Issue #430. Might be worth defining a new constant for this.
nemo
parents:
7784
diff
changeset

235 
begin 
c1dc7839d7b9
Set minimums on a few values to avoid camera zooming out past them. partly Issue #430. Might be worth defining a new constant for this.
nemo
parents:
7784
diff
changeset

236 
gi^.dX.isNegative:= X<gi^.X; 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

237 
gi^.State := gi^.State or gstLoser; 
7829
c1dc7839d7b9
Set minimums on a few values to avoid camera zooming out past them. partly Issue #430. Might be worth defining a new constant for this.
nemo
parents:
7784
diff
changeset

238 
end; 
8795  239 

14011
3c40754f6cfe
Add Grenade taunt when grenade close to hog is about to blow up
Wuzzy <Wuzzy2@mail.ru>
parents:
14009
diff
changeset

240 
grenadeTaunt:= false; 
3c40754f6cfe
Add Grenade taunt when grenade close to hog is about to blow up
Wuzzy <Wuzzy2@mail.ru>
parents:
14009
diff
changeset

241 
if (gearType = gtGrenade) then 
3c40754f6cfe
Add Grenade taunt when grenade close to hog is about to blow up
Wuzzy <Wuzzy2@mail.ru>
parents:
14009
diff
changeset

242 
grenadeTaunt:= random(2) = 0; 
3c40754f6cfe
Add Grenade taunt when grenade close to hog is about to blow up
Wuzzy <Wuzzy2@mail.ru>
parents:
14009
diff
changeset

243 

3c40754f6cfe
Add Grenade taunt when grenade close to hog is about to blow up
Wuzzy <Wuzzy2@mail.ru>
parents:
14009
diff
changeset

244 
if grenadeTaunt then 
3c40754f6cfe
Add Grenade taunt when grenade close to hog is about to blow up
Wuzzy <Wuzzy2@mail.ru>
parents:
14009
diff
changeset

245 
PlaySoundV(sndGrenade, gi^.Hedgehog^.Team^.voicepack) 
3143  246 
else 
14011
3c40754f6cfe
Add Grenade taunt when grenade close to hog is about to blow up
Wuzzy <Wuzzy2@mail.ru>
parents:
14009
diff
changeset

247 
if d > r div 2 then 
14014  248 
if random(3) = 0 then 
249 
PlaySoundV(sndWhatThe, gi^.Hedgehog^.Team^.voicepack) 

250 
else 

251 
PlaySoundV(sndNooo, gi^.Hedgehog^.Team^.voicepack) 

14011
3c40754f6cfe
Add Grenade taunt when grenade close to hog is about to blow up
Wuzzy <Wuzzy2@mail.ru>
parents:
14009
diff
changeset

252 
else 
3c40754f6cfe
Add Grenade taunt when grenade close to hog is about to blow up
Wuzzy <Wuzzy2@mail.ru>
parents:
14009
diff
changeset

253 
PlaySoundV(sndUhOh, gi^.Hedgehog^.Team^.voicepack); 
3c40754f6cfe
Add Grenade taunt when grenade close to hog is about to blow up
Wuzzy <Wuzzy2@mail.ru>
parents:
14009
diff
changeset

254 

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

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

257 
end; 
8795  258 

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

260 
end; 
2647  261 
end; 
5313
5e18eaef65d0
now scripts can create unique crates: dummy (empty) crates and booby traps. scripts can also set health crate values
Henek
parents:
5298
diff
changeset

262 

5807
5c8fe58dead5
Define 2 script callbacks to notify of hog vanishment
nemo
parents:
5806
diff
changeset

263 
procedure HideHog(HH: PHedgehog); 
5c8fe58dead5
Define 2 script callbacks to notify of hog vanishment
nemo
parents:
5806
diff
changeset

264 
begin 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

265 
ScriptCall('onHogHide', HH^.Gear^.Uid); 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

266 
DeleteCI(HH^.Gear); 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

267 
if FollowGear = HH^.Gear then 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

268 
FollowGear:= nil; 
8795  269 

6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

270 
if lastGearByUID = HH^.Gear then 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

271 
lastGearByUID := nil; 
8795  272 

7400
09427dbec1d8
Fix TARDIS, make switcher work w/ the new more stringent check.
nemo
parents:
7399
diff
changeset

273 
HH^.Gear^.Message:= HH^.Gear^.Message or gmRemoveFromList; 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

274 
with HH^.Gear^ do 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

275 
begin 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

276 
Z := cHHZ; 
7400
09427dbec1d8
Fix TARDIS, make switcher work w/ the new more stringent check.
nemo
parents:
7399
diff
changeset

277 
HH^.Gear^.Active:= false; 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

278 
State:= State and (not (gstHHDriven or gstAttacking or gstAttacked)); 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

279 
Message := Message and (not gmAttack); 
5807
5c8fe58dead5
Define 2 script callbacks to notify of hog vanishment
nemo
parents:
5806
diff
changeset

280 
end; 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

281 
HH^.GearHidden:= HH^.Gear; 
13140
e330feceb662
Hide team bar if all hedgehogs in it are hidden or dead
Wuzzy <Wuzzy2@mail.ru>
parents:
13096
diff
changeset

282 
HH^.Gear:= nil; 
e330feceb662
Hide team bar if all hedgehogs in it are hidden or dead
Wuzzy <Wuzzy2@mail.ru>
parents:
13096
diff
changeset

283 
AddVisualGear(0, 0, vgtTeamHealthSorter); 
5807
5c8fe58dead5
Define 2 script callbacks to notify of hog vanishment
nemo
parents:
5806
diff
changeset

284 
end; 
5c8fe58dead5
Define 2 script callbacks to notify of hog vanishment
nemo
parents:
5806
diff
changeset

285 

4  286 

287 
//////////////////////////////////////////////////////////////////////////////// 

288 
procedure doStepDrowningGear(Gear: PGear); 

12714
5a57acce9cae
Fix bubbles drawn on the wrong side when hog drowns and faces right
Wuzzy <almikes@aol.com>
parents:
12712
diff
changeset

289 
var i, d, bubbleX, bubbleY: LongInt; 
10364
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset

290 
bubble: PVisualGear; 
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset

291 
begin 
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset

292 
if Gear^.Timer = 0 then 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

293 
begin 
10364
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset

294 
d:= 2 * Gear^.Radius; 
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset

295 
for i:= (Gear^.Radius * Gear^.Radius) div 4 downto 0 do 
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset

296 
begin 
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset

297 
bubble := AddVisualGear(hwRound(Gear^.X)  Gear^.Radius + random(d), hwRound(Gear^.Y)  Gear^.Radius + random(d), vgtBubble); 
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset

298 
if bubble <> nil then 
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset

299 
bubble^.dY:= 0.1 + random(20)/10; 
10354  300 
end; 
10364
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset

301 
DeleteGear(Gear); 
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset

302 
exit; 
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset

303 
end; 
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset

304 

9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset

305 
AllInactive := false; 
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset

306 
dec(Gear^.Timer); 
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset

307 

9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset

308 
Gear^.Y := Gear^.Y + cDrownSpeed; 
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset

309 

9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset

310 
if cWaterLine > hwRound(Gear^.Y) + Gear^.Radius then 
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset

311 
begin 
10494  312 
if LongInt(leftX) + Gear^.Radius > hwRound(Gear^.X) then 
10364
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset

313 
Gear^.X := Gear^.X  cDrownSpeed 
10354  314 
else 
10364
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset

315 
Gear^.X := Gear^.X + cDrownSpeed; 
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset

316 
end 
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset

317 
else 
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset

318 
Gear^.X := Gear^.X + Gear^.dX * cDrownSpeed; 
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset

319 

9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset

320 
// Create some bubbles (0.5% might be better but causes too few bubbles sometimes) 
12714
5a57acce9cae
Fix bubbles drawn on the wrong side when hog drowns and faces right
Wuzzy <almikes@aol.com>
parents:
12712
diff
changeset

321 
if (Gear^.Kind = gtHedgehog) and (Gear^.dX.isNegative) then 
5a57acce9cae
Fix bubbles drawn on the wrong side when hog drowns and faces right
Wuzzy <almikes@aol.com>
parents:
12712
diff
changeset

322 
bubbleX:= hwRound(Gear^.X)  Gear^.Radius 
5a57acce9cae
Fix bubbles drawn on the wrong side when hog drowns and faces right
Wuzzy <almikes@aol.com>
parents:
12712
diff
changeset

323 
else 
5a57acce9cae
Fix bubbles drawn on the wrong side when hog drowns and faces right
Wuzzy <almikes@aol.com>
parents:
12712
diff
changeset

324 
bubbleX:= hwRound(Gear^.X) + Gear^.Radius; 
5a57acce9cae
Fix bubbles drawn on the wrong side when hog drowns and faces right
Wuzzy <almikes@aol.com>
parents:
12712
diff
changeset

325 
bubbleY:= hwRound(Gear^.Y)  Gear^.Radius; 
10364
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset

326 
if ((not SuddenDeathDmg and (WaterOpacity < $FF)) 
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset

327 
or (SuddenDeathDmg and (SDWaterOpacity < $FF))) and ((GameTicks and $1F) = 0) then 
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset

328 
if (Gear^.Kind = gtHedgehog) and (Random(4) = 0) then 
12714
5a57acce9cae
Fix bubbles drawn on the wrong side when hog drowns and faces right
Wuzzy <almikes@aol.com>
parents:
12712
diff
changeset

329 
AddVisualGear(bubbleX, bubbleY, vgtBubble) 
10364
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset

330 
else if Random(12) = 0 then 
12714
5a57acce9cae
Fix bubbles drawn on the wrong side when hog drowns and faces right
Wuzzy <almikes@aol.com>
parents:
12712
diff
changeset

331 
AddVisualGear(bubbleX, bubbleY, vgtBubble); 
13737
bbea77a8dff9
Fix damage not being displayed if hog drowns in water with 100% opacity (like in Compost theme)
Wuzzy <Wuzzy2@mail.ru>
parents:
13651
diff
changeset

332 
// Instadelete gear and skip drowning animation if water is 100% opaque 
10364
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset

333 
if (not SuddenDeathDmg and (WaterOpacity > $FE)) 
13737
bbea77a8dff9
Fix damage not being displayed if hog drowns in water with 100% opacity (like in Compost theme)
Wuzzy <Wuzzy2@mail.ru>
parents:
13651
diff
changeset

334 
or (SuddenDeathDmg and (SDWaterOpacity > $FE)) then 
bbea77a8dff9
Fix damage not being displayed if hog drowns in water with 100% opacity (like in Compost theme)
Wuzzy <Wuzzy2@mail.ru>
parents:
13651
diff
changeset

335 
begin 
bbea77a8dff9
Fix damage not being displayed if hog drowns in water with 100% opacity (like in Compost theme)
Wuzzy <Wuzzy2@mail.ru>
parents:
13651
diff
changeset

336 
// Teleport gear to a suitable position for the damage tag in the water 
bbea77a8dff9
Fix damage not being displayed if hog drowns in water with 100% opacity (like in Compost theme)
Wuzzy <Wuzzy2@mail.ru>
parents:
13651
diff
changeset

337 
if (WorldEdge = weSea) and (hwRound(Gear^.X)  Gear^.Radius < leftX) then 
bbea77a8dff9
Fix damage not being displayed if hog drowns in water with 100% opacity (like in Compost theme)
Wuzzy <Wuzzy2@mail.ru>
parents:
13651
diff
changeset

338 
begin 
bbea77a8dff9
Fix damage not being displayed if hog drowns in water with 100% opacity (like in Compost theme)
Wuzzy <Wuzzy2@mail.ru>
parents:
13651
diff
changeset

339 
if (hwRound(Gear^.X)  Gear^.Radius > leftX  90) then 
bbea77a8dff9
Fix damage not being displayed if hog drowns in water with 100% opacity (like in Compost theme)
Wuzzy <Wuzzy2@mail.ru>
parents:
13651
diff
changeset

340 
Gear^.X := Gear^.X  _90 
bbea77a8dff9
Fix damage not being displayed if hog drowns in water with 100% opacity (like in Compost theme)
Wuzzy <Wuzzy2@mail.ru>
parents:
13651
diff
changeset

341 
end 
bbea77a8dff9
Fix damage not being displayed if hog drowns in water with 100% opacity (like in Compost theme)
Wuzzy <Wuzzy2@mail.ru>
parents:
13651
diff
changeset

342 
else if (WorldEdge = weSea) and (hwRound(Gear^.X) + Gear^.Radius > rightX) then 
bbea77a8dff9
Fix damage not being displayed if hog drowns in water with 100% opacity (like in Compost theme)
Wuzzy <Wuzzy2@mail.ru>
parents:
13651
diff
changeset

343 
begin 
bbea77a8dff9
Fix damage not being displayed if hog drowns in water with 100% opacity (like in Compost theme)
Wuzzy <Wuzzy2@mail.ru>
parents:
13651
diff
changeset

344 
if (hwRound(Gear^.X)  Gear^.Radius < rightX + 90) then 
bbea77a8dff9
Fix damage not being displayed if hog drowns in water with 100% opacity (like in Compost theme)
Wuzzy <Wuzzy2@mail.ru>
parents:
13651
diff
changeset

345 
Gear^.X := Gear^.X + _90 
bbea77a8dff9
Fix damage not being displayed if hog drowns in water with 100% opacity (like in Compost theme)
Wuzzy <Wuzzy2@mail.ru>
parents:
13651
diff
changeset

346 
end 
bbea77a8dff9
Fix damage not being displayed if hog drowns in water with 100% opacity (like in Compost theme)
Wuzzy <Wuzzy2@mail.ru>
parents:
13651
diff
changeset

347 
else 
bbea77a8dff9
Fix damage not being displayed if hog drowns in water with 100% opacity (like in Compost theme)
Wuzzy <Wuzzy2@mail.ru>
parents:
13651
diff
changeset

348 
Gear^.Y := int2hwFloat(Gear^.Radius + cWaterLine + cVisibleWater); 
bbea77a8dff9
Fix damage not being displayed if hog drowns in water with 100% opacity (like in Compost theme)
Wuzzy <Wuzzy2@mail.ru>
parents:
13651
diff
changeset

349 
DeleteGear(Gear); 
bbea77a8dff9
Fix damage not being displayed if hog drowns in water with 100% opacity (like in Compost theme)
Wuzzy <Wuzzy2@mail.ru>
parents:
13651
diff
changeset

350 
exit; 
bbea77a8dff9
Fix damage not being displayed if hog drowns in water with 100% opacity (like in Compost theme)
Wuzzy <Wuzzy2@mail.ru>
parents:
13651
diff
changeset

351 
end; 
bbea77a8dff9
Fix damage not being displayed if hog drowns in water with 100% opacity (like in Compost theme)
Wuzzy <Wuzzy2@mail.ru>
parents:
13651
diff
changeset

352 
// Delete normally if gear is outside of visible range 
bbea77a8dff9
Fix damage not being displayed if hog drowns in water with 100% opacity (like in Compost theme)
Wuzzy <Wuzzy2@mail.ru>
parents:
13651
diff
changeset

353 
if (hwRound(Gear^.Y) > Gear^.Radius + cWaterLine + cVisibleWater) then 
10364
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset

354 
DeleteGear(Gear); 
9f7be3da1245
burst drowning gears into bubbles after timeout
sheepluva
parents:
10363
diff
changeset

355 
end; 
4  356 

357 
//////////////////////////////////////////////////////////////////////////////// 

358 
procedure doStepFallingGear(Gear: PGear); 

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

360 
isFalling: boolean; 
3020  361 
//tmp: QWord; 
9526  362 
tX, tdX, tdY: hwFloat; 
9769
5814e0c47c99
Experiment in adding a "boing" graphic for bouncing. It has no text right now (was thinking l10n) and colour is fixed.
nemo
parents:
9768
diff
changeset

363 
collV, collH, gX, gY: LongInt; 
9721
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

364 
land, xland: word; 
4  365 
begin 
9526  366 
tX:= Gear^.X; 
9769
5814e0c47c99
Experiment in adding a "boing" graphic for bouncing. It has no text right now (was thinking l10n) and colour is fixed.
nemo
parents:
9768
diff
changeset

367 
gX:= hwRound(Gear^.X); 
5814e0c47c99
Experiment in adding a "boing" graphic for bouncing. It has no text right now (was thinking l10n) and colour is fixed.
nemo
parents:
9768
diff
changeset

368 
gY:= hwRound(Gear^.Y); 
13610
f1b6070a6e14
Fix projectiles reacing incorrectly with land just behind the wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13609
diff
changeset

369 
Gear^.State := Gear^.State and (not gstCollision); 
f1b6070a6e14
Fix projectiles reacing incorrectly with land just behind the wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13609
diff
changeset

370 

f1b6070a6e14
Fix projectiles reacing incorrectly with land just behind the wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13609
diff
changeset

371 
// World wrap 
f1b6070a6e14
Fix projectiles reacing incorrectly with land just behind the wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13609
diff
changeset

372 
if (Gear^.Kind <> gtGenericFaller) and WorldWrap(Gear) and (WorldEdge = weWrap) and 
9706
5178d2263521
return land word from uCollisions to make decisions based on it. Should be handy for trampoline.
nemo
parents:
9698
diff
changeset

373 
((TestCollisionXwithGear(Gear, 1) <> 0) or (TestCollisionXwithGear(Gear, 1) <> 0)) then 
9526  374 
begin 
13610
f1b6070a6e14
Fix projectiles reacing incorrectly with land just behind the wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13609
diff
changeset

375 
// Collision with land that *just* behind the other side of the world wrap edge 
f1b6070a6e14
Fix projectiles reacing incorrectly with land just behind the wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13609
diff
changeset

376 
if (not Gear^.Sticky) then 
f1b6070a6e14
Fix projectiles reacing incorrectly with land just behind the wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13609
diff
changeset

377 
begin 
f1b6070a6e14
Fix projectiles reacing incorrectly with land just behind the wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13609
diff
changeset

378 
Gear^.X:= tX; 
f1b6070a6e14
Fix projectiles reacing incorrectly with land just behind the wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13609
diff
changeset

379 
Gear^.dX.isNegative:= (gX > LongInt(leftX) + Gear^.Radius*2); 
f1b6070a6e14
Fix projectiles reacing incorrectly with land just behind the wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13609
diff
changeset

380 
Gear^.dX := Gear^.dX * Gear^.Friction; 
f1b6070a6e14
Fix projectiles reacing incorrectly with land just behind the wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13609
diff
changeset

381 
end; 
f1b6070a6e14
Fix projectiles reacing incorrectly with land just behind the wrap world edge
Wuzzy <Wuzzy2@mail.ru>
parents:
13609
diff
changeset

382 
Gear^.State := Gear^.State or gstCollision; 
9526  383 
end; 
9473
a51a69094c24
partial implementation of noninfinite world (edge wrap/warp/bounce)
nemo
parents:
9470
diff
changeset

384 

7627  385 
// clip velocity at 2  over 1 per pixel, but really shouldn't cause many actual problems. 
9967
40750e72514b
keep velocity from fluttering between 2 and 3px / ms when falling...
nemo
parents:
9885
diff
changeset

386 
if Gear^.dX.Round > 1 then 
7627  387 
Gear^.dX.QWordValue:= 8589934592; 
9967
40750e72514b
keep velocity from fluttering between 2 and 3px / ms when falling...
nemo
parents:
9885
diff
changeset

388 
if Gear^.dY.Round > 1 then 
7627  389 
Gear^.dY.QWordValue:= 8589934592; 
8838
aa2ffd427f6a
strip PAS2C, old WEB symbols and outdated pas2c sources from default branch, all crelated development is done on the webgl branch
koda
parents:
8822
diff
changeset

390 

10354  391 
if (Gear^.State and gstSubmersible <> 0) and CheckCoordInWater(gX, gY) then 
8992
5b0be812dcdb
Rename submersible state, increase getaway time for attack underwater, slow down gear dx/dy underwater to simulate water resistance
nemo
parents:
8990
diff
changeset

392 
begin 
5b0be812dcdb
Rename submersible state, increase getaway time for attack underwater, slow down gear dx/dy underwater to simulate water resistance
nemo
parents:
8990
diff
changeset

393 
Gear^.dX:= Gear^.dX * _0_999; 
5b0be812dcdb
Rename submersible state, increase getaway time for attack underwater, slow down gear dx/dy underwater to simulate water resistance
nemo
parents:
8990
diff
changeset

394 
Gear^.dY:= Gear^.dY * _0_999 
5b0be812dcdb
Rename submersible state, increase getaway time for attack underwater, slow down gear dx/dy underwater to simulate water resistance
nemo
parents:
8990
diff
changeset

395 
end; 
5b0be812dcdb
Rename submersible state, increase getaway time for attack underwater, slow down gear dx/dy underwater to simulate water resistance
nemo
parents:
8990
diff
changeset

396 

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

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

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

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

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

401 

3359  402 
// might need some testing/adjustments  just to avoid projectiles to fly forever (accelerated by wind/skips) 
9769
5814e0c47c99
Experiment in adding a "boing" graphic for bouncing. It has no text right now (was thinking l10n) and colour is fixed.
nemo
parents:
9768
diff
changeset

403 
if (gX < min(LAND_WIDTH div 2, 2048)) 
5814e0c47c99
Experiment in adding a "boing" graphic for bouncing. It has no text right now (was thinking l10n) and colour is fixed.
nemo
parents:
9768
diff
changeset

404 
or (gX > max(LAND_WIDTH * 3 div 2, 6144)) then 
11389
c93f204a5a00
Set gears that go off map to gmDestroy instead of collision, disable morewind for nogravity gears, restrict application of wind to gears that are already moving and not colliding.
nemo
parents:
11342
diff
changeset

405 
Gear^.Message := Gear^.Message or gmDestroy; 
3359  406 

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

407 
if Gear^.dY.isNegative then 
4578  408 
begin 
6081
537bbd5c1a62
Basic test implementation of an ice flag. Allows for slick parts of terrain. Intended for ice gun, or "ice" mask on portions of land objects.
nemo
parents:
6011
diff
changeset

409 
land:= TestCollisionYwithGear(Gear, 1); 
9820  410 
isFalling := land = 0; 
6081
537bbd5c1a62
Basic test implementation of an ice flag. Allows for slick parts of terrain. Intended for ice gun, or "ice" mask on portions of land objects.
nemo
parents:
6011
diff
changeset

411 
if land <> 0 then 
4578  412 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

413 
collV := 1; 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

414 
if land and lfIce <> 0 then 
9721
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

415 
Gear^.dX := Gear^.dX * (_0_9 + Gear^.Friction * _0_1) 
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

416 
else Gear^.dX := Gear^.dX * Gear^.Friction; 
9731
953197ac43d8
Make sticky mine respect lfBouncy, make hogs do same, kinda... make uCollisions return land w/ mask, restrict bouncy to advbounce gears only, which means piano doesn't bounce anymore
nemo
parents:
9724
diff
changeset

417 
if (Gear^.AdvBounce = 0) or (land and lfBouncy = 0) then 
9721
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

418 
begin 
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

419 
Gear^.dY :=  Gear^.dY * Gear^.Elasticity; 
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

420 
Gear^.State := Gear^.State or gstCollision 
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

421 
end 
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

422 
else Gear^.dY :=  Gear^.dY * cElastic 
4578  423 
end 
9721
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

424 
else if Gear^.AdvBounce = 1 then 
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

425 
begin 
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

426 
land:= TestCollisionYwithGear(Gear, 1); 
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

427 
if land <> 0 then collV := 1 
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

428 
end 
4578  429 
end 
8795  430 
else 
6498  431 
begin // Gear^.dY.isNegative is false 
6081
537bbd5c1a62
Basic test implementation of an ice flag. Allows for slick parts of terrain. Intended for ice gun, or "ice" mask on portions of land objects.
nemo
parents:
6011
diff
changeset

432 
land:= TestCollisionYwithGear(Gear, 1); 
537bbd5c1a62
Basic test implementation of an ice flag. Allows for slick parts of terrain. Intended for ice gun, or "ice" mask on portions of land objects.
nemo
parents:
6011
diff
changeset

433 
if land <> 0 then 
537bbd5c1a62
Basic test implementation of an ice flag. Allows for slick parts of terrain. Intended for ice gun, or "ice" mask on portions of land objects.
nemo
parents:
6011
diff
changeset

434 
begin 
537bbd5c1a62
Basic test implementation of an ice flag. Allows for slick parts of terrain. Intended for ice gun, or "ice" mask on portions of land objects.
nemo
parents:
6011
diff
changeset

435 
collV := 1; 
537bbd5c1a62
Basic test implementation of an ice flag. Allows for slick parts of terrain. Intended for ice gun, or "ice" mask on portions of land objects.
nemo
parents:
6011
diff
changeset

436 
isFalling := false; 
8795  437 
if land and lfIce <> 0 then 
6498  438 
Gear^.dX := Gear^.dX * (_0_9 + Gear^.Friction * _0_1) 
8795  439 
else 
6498  440 
Gear^.dX := Gear^.dX * Gear^.Friction; 
6081
537bbd5c1a62
Basic test implementation of an ice flag. Allows for slick parts of terrain. Intended for ice gun, or "ice" mask on portions of land objects.
nemo
parents:
6011
diff
changeset

441 

9731
953197ac43d8
Make sticky mine respect lfBouncy, make hogs do same, kinda... make uCollisions return land w/ mask, restrict bouncy to advbounce gears only, which means piano doesn't bounce anymore
nemo
parents:
9724
diff
changeset

442 
if (Gear^.AdvBounce = 0) or (land and lfBouncy = 0) then 
9721
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

443 
begin 
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

444 
Gear^.dY :=  Gear^.dY * Gear^.Elasticity; 
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

445 
Gear^.State := Gear^.State or gstCollision 
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

446 
end 
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

447 
else Gear^.dY :=  Gear^.dY * cElastic 
6081
537bbd5c1a62
Basic test implementation of an ice flag. Allows for slick parts of terrain. Intended for ice gun, or "ice" mask on portions of land objects.
nemo
parents:
6011
diff
changeset

448 
end 
537bbd5c1a62
Basic test implementation of an ice flag. Allows for slick parts of terrain. Intended for ice gun, or "ice" mask on portions of land objects.
nemo
parents:
6011
diff
changeset

449 
else 
537bbd5c1a62
Basic test implementation of an ice flag. Allows for slick parts of terrain. Intended for ice gun, or "ice" mask on portions of land objects.
nemo
parents:
6011
diff
changeset

450 
begin 
537bbd5c1a62
Basic test implementation of an ice flag. Allows for slick parts of terrain. Intended for ice gun, or "ice" mask on portions of land objects.
nemo
parents:
6011
diff
changeset

451 
isFalling := true; 
9721
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

452 
if Gear^.AdvBounce = 1 then 
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

453 
begin 
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

454 
land:= TestCollisionYwithGear(Gear, 1); 
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

455 
if land <> 0 then collV := 1 
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

456 
end 
6081
537bbd5c1a62
Basic test implementation of an ice flag. Allows for slick parts of terrain. Intended for ice gun, or "ice" mask on portions of land objects.
nemo
parents:
6011
diff
changeset

457 
end 
4578  458 
end; 
503  459 

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

460 

9721
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

461 
xland:= TestCollisionXwithGear(Gear, hwSign(Gear^.dX)); 
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

462 
if xland <> 0 then 
4578  463 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

464 
collH := hwSign(Gear^.dX); 
9731
953197ac43d8
Make sticky mine respect lfBouncy, make hogs do same, kinda... make uCollisions return land w/ mask, restrict bouncy to advbounce gears only, which means piano doesn't bounce anymore
nemo
parents:
9724
diff
changeset

465 
if (Gear^.AdvBounce = 0) or (xland and lfBouncy = 0) then 
9721
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

466 
begin 
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

467 
Gear^.dX :=  Gear^.dX * Gear^.Elasticity; 
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

468 
Gear^.dY := Gear^.dY * Gear^.Elasticity; 
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

469 
Gear^.State := Gear^.State or gstCollision 
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

470 
end 
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

471 
else 
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

472 
begin 
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

473 
Gear^.dX :=  Gear^.dX * cElastic; 
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

474 
Gear^.dY := Gear^.dY * cElastic 
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

475 
end 
4578  476 
end 
9721
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

477 
else if Gear^.AdvBounce = 1 then 
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

478 
begin 
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

479 
xland:= TestCollisionXwithGear(Gear, hwSign(Gear^.dX)); 
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

480 
if xland <> 0 then collH := hwSign(Gear^.dX) 
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

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

482 
//if Gear^.AdvBounce and (collV <>0) and (collH <> 0) and (hwSqr(tdX) + hwSqr(tdY) > _0_08) then 
10015  483 
if (collV <> 0) and (collH <> 0) and 
9731
953197ac43d8
Make sticky mine respect lfBouncy, make hogs do same, kinda... make uCollisions return land w/ mask, restrict bouncy to advbounce gears only, which means piano doesn't bounce anymore
nemo
parents:
9724
diff
changeset

484 
(((Gear^.AdvBounce=1) and ((collV=1) or ((tdX.QWordValue + tdY.QWordValue) > _0_2.QWordValue)))) then 
953197ac43d8
Make sticky mine respect lfBouncy, make hogs do same, kinda... make uCollisions return land w/ mask, restrict bouncy to advbounce gears only, which means piano doesn't bounce anymore
nemo
parents:
9724
diff
changeset

485 
//or ((xland or land) and lfBouncy <> 0)) then 
9721
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

486 
begin 
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

487 
if (xland or land) and lfBouncy = 0 then 
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

488 
begin 
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

489 
Gear^.dX := tdY*Gear^.Elasticity*Gear^.Friction; 
9767  490 
Gear^.dY := tdX*Gear^.Elasticity; 
491 
Gear^.State := Gear^.State or gstCollision 

9721
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

492 
end 
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

493 
else 
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

494 
begin 
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

495 
Gear^.dX := tdY*cElastic*Gear^.Friction; 
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

496 
Gear^.dY := tdX*cElastic 
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

497 
end; 
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

498 

10895
bce67defd804
Make bouncing a bit less wtf for various gears tested (hog, 'zooka, saucer hog, drill strike). Less hacky is another matter.
nemo
parents:
10887
diff
changeset

499 
Gear^.dX.isNegative:= tdX.isNegative; 
bce67defd804
Make bouncing a bit less wtf for various gears tested (hog, 'zooka, saucer hog, drill strike). Less hacky is another matter.
nemo
parents:
10887
diff
changeset

500 
Gear^.dY.isNegative:= tdY.isNegative; 
bce67defd804
Make bouncing a bit less wtf for various gears tested (hog, 'zooka, saucer hog, drill strike). Less hacky is another matter.
nemo
parents:
10887
diff
changeset

501 
if (collV > 0) and (collH > 0) and (not tdX.isNegative) and (not tdY.isNegative) then 
bce67defd804
Make bouncing a bit less wtf for various gears tested (hog, 'zooka, saucer hog, drill strike). Less hacky is another matter.
nemo
parents:
10887
diff
changeset

502 
begin 
bce67defd804
Make bouncing a bit less wtf for various gears tested (hog, 'zooka, saucer hog, drill strike). Less hacky is another matter.
nemo
parents:
10887
diff
changeset

503 
Gear^.dX.isNegative := true; 
bce67defd804
Make bouncing a bit less wtf for various gears tested (hog, 'zooka, saucer hog, drill strike). Less hacky is another matter.
nemo
parents:
10887
diff
changeset

504 
Gear^.dY.isNegative := true 
bce67defd804
Make bouncing a bit less wtf for various gears tested (hog, 'zooka, saucer hog, drill strike). Less hacky is another matter.
nemo
parents:
10887
diff
changeset

505 
end 
bce67defd804
Make bouncing a bit less wtf for various gears tested (hog, 'zooka, saucer hog, drill strike). Less hacky is another matter.
nemo
parents:
10887
diff
changeset

506 
else if (collV > 0) and (collH < 0) and (tdX.isNegative or tdY.isNegative) then 
bce67defd804
Make bouncing a bit less wtf for various gears tested (hog, 'zooka, saucer hog, drill strike). Less hacky is another matter.
nemo
parents:
10887
diff
changeset

507 
begin 
bce67defd804
Make bouncing a bit less wtf for various gears tested (hog, 'zooka, saucer hog, drill strike). Less hacky is another matter.
nemo
parents:
10887
diff
changeset

508 
Gear^.dY.isNegative := not tdY.isNegative; 
bce67defd804
Make bouncing a bit less wtf for various gears tested (hog, 'zooka, saucer hog, drill strike). Less hacky is another matter.
nemo
parents:
10887
diff
changeset

509 
if not tdY.isNegative then Gear^.dX.isNegative := false 
bce67defd804
Make bouncing a bit less wtf for various gears tested (hog, 'zooka, saucer hog, drill strike). Less hacky is another matter.
nemo
parents:
10887
diff
changeset

510 
end 
bce67defd804
Make bouncing a bit less wtf for various gears tested (hog, 'zooka, saucer hog, drill strike). Less hacky is another matter.
nemo
parents:
10887
diff
changeset

511 
else if (collV < 0) and (collH > 0) and (not tdX.isNegative) then 
bce67defd804
Make bouncing a bit less wtf for various gears tested (hog, 'zooka, saucer hog, drill strike). Less hacky is another matter.
nemo
parents:
10887
diff
changeset

512 
begin 
bce67defd804
Make bouncing a bit less wtf for various gears tested (hog, 'zooka, saucer hog, drill strike). Less hacky is another matter.
nemo
parents:
10887
diff
changeset

513 
Gear^.dX.isNegative := true; 
bce67defd804
Make bouncing a bit less wtf for various gears tested (hog, 'zooka, saucer hog, drill strike). Less hacky is another matter.
nemo
parents:
10887
diff
changeset

514 
Gear^.dY.isNegative := false 
bce67defd804
Make bouncing a bit less wtf for various gears tested (hog, 'zooka, saucer hog, drill strike). Less hacky is another matter.
nemo
parents:
10887
diff
changeset

515 
end 
bce67defd804
Make bouncing a bit less wtf for various gears tested (hog, 'zooka, saucer hog, drill strike). Less hacky is another matter.
nemo
parents:
10887
diff
changeset

516 
else if (collV < 0) and (collH < 0) and tdX.isNegative and tdY.isNegative then 
bce67defd804
Make bouncing a bit less wtf for various gears tested (hog, 'zooka, saucer hog, drill strike). Less hacky is another matter.
nemo
parents:
10887
diff
changeset

517 
Gear^.dX.isNegative := false; 
bce67defd804
Make bouncing a bit less wtf for various gears tested (hog, 'zooka, saucer hog, drill strike). Less hacky is another matter.
nemo
parents:
10887
diff
changeset

518 

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

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

520 
Gear^.AdvBounce := 10; 
4578  521 
end; 
503  522 

6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

523 
if Gear^.AdvBounce > 1 then 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

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

525 

11389
c93f204a5a00
Set gears that go off map to gmDestroy instead of collision, disable morewind for nogravity gears, restrict application of wind to gears that are already moving and not colliding.
nemo
parents:
11342
diff
changeset

526 
if isFalling and (Gear^.State and gstNoGravity = 0) then 
c93f204a5a00
Set gears that go off map to gmDestroy instead of collision, disable morewind for nogravity gears, restrict application of wind to gears that are already moving and not colliding.
nemo
parents:
11342
diff
changeset

527 
begin 
c93f204a5a00
Set gears that go off map to gmDestroy instead of collision, disable morewind for nogravity gears, restrict application of wind to gears that are already moving and not colliding.
nemo
parents:
11342
diff
changeset

528 
Gear^.dY := Gear^.dY + cGravity; 
12693
2592c6ea6008
wind blowing around mines offturn was too annoying.
nemo
parents:
12692
diff
changeset

529 
if (GameFlags and gfMoreWind <> 0) and (TurnTimeLeft > 0) and 
11389
c93f204a5a00
Set gears that go off map to gmDestroy instead of collision, disable morewind for nogravity gears, restrict application of wind to gears that are already moving and not colliding.
nemo
parents:
11342
diff
changeset

530 
((xland or land) = 0) and 
c93f204a5a00
Set gears that go off map to gmDestroy instead of collision, disable morewind for nogravity gears, restrict application of wind to gears that are already moving and not colliding.
nemo
parents:
11342
diff
changeset

531 
((Gear^.dX.QWordValue + Gear^.dY.QWordValue) > _0_02.QWordValue) then 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

532 
Gear^.dX := Gear^.dX + cWindSpeed / Gear^.Density 
9820  533 
end; 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

534 

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

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

536 
Gear^.Y := Gear^.Y + Gear^.dY; 
9479
167dea42d7d7
move border back a bit from left/right bounds, bee tweak
nemo
parents:
9477
diff
changeset

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

538 
//if (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) < _0_0002) and 
6498  539 
if (not isFalling) and ((Gear^.dX.QWordValue + Gear^.dY.QWordValue) < _0_02.QWordValue) then 
6450  540 
Gear^.State := Gear^.State and (not gstMoving) 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

541 
else 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

542 
Gear^.State := Gear^.State or gstMoving; 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

543 

9731
953197ac43d8
Make sticky mine respect lfBouncy, make hogs do same, kinda... make uCollisions return land w/ mask, restrict bouncy to advbounce gears only, which means piano doesn't bounce anymore
nemo
parents:
9724
diff
changeset

544 
if ((xland or land) and lfBouncy <> 0) and (Gear^.dX.QWordValue < _0_15.QWordValue) and (Gear^.dY.QWordValue < _0_15.QWordValue) then 
9721
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

545 
Gear^.State := Gear^.State or gstCollision; 
10015  546 

9769
5814e0c47c99
Experiment in adding a "boing" graphic for bouncing. It has no text right now (was thinking l10n) and colour is fixed.
nemo
parents:
9768
diff
changeset

547 
if ((xland or land) and lfBouncy <> 0) and (Gear^.Radius >= 3) and 
5814e0c47c99
Experiment in adding a "boing" graphic for bouncing. It has no text right now (was thinking l10n) and colour is fixed.
nemo
parents:
9768
diff
changeset

548 
((Gear^.dX.QWordValue > _0_15.QWordValue) or (Gear^.dY.QWordValue > _0_15.QWordValue)) then 
5814e0c47c99
Experiment in adding a "boing" graphic for bouncing. It has no text right now (was thinking l10n) and colour is fixed.
nemo
parents:
9768
diff
changeset

549 
begin 
10508  550 
AddBounceEffectForGear(Gear); 
9769
5814e0c47c99
Experiment in adding a "boing" graphic for bouncing. It has no text right now (was thinking l10n) and colour is fixed.
nemo
parents:
9768
diff
changeset

551 
end 
9721
1833dadcebf0
Initial pass at bounciness. To try it out, or lfBouncy on girder in uLandGraphics (search for the word graphically)
nemo
parents:
9706
diff
changeset

552 
else if (Gear^.nImpactSounds > 0) and 
7777  553 
(Gear^.State and gstCollision <> 0) and 
554 
(((Gear^.Kind <> gtMine) and (Gear^.Damage <> 0)) or (Gear^.State and gstMoving <> 0)) and 

555 
(((Gear^.Radius < 3) and (Gear^.dY < _0_1)) or 

8795  556 
((Gear^.Radius >= 3) and 
7777  557 
((Gear^.dX.QWordValue > _0_1.QWordValue) or (Gear^.dY.QWordValue > _0_1.QWordValue)))) then 
5461  558 
PlaySound(TSound(ord(Gear^.ImpactSound) + LongInt(GetRandom(Gear^.nImpactSounds))), true); 
4  559 
end; 
560 

561 
//////////////////////////////////////////////////////////////////////////////// 

562 
procedure doStepBomb(Gear: PGear); 

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

564 
i, x, y: LongInt; 
8413
454191defee6
restore former cluster behaviour (makes the most diff for the bomb)
nemo
parents:
8370
diff
changeset

565 
dX, dY, gdX: hwFloat; 
3475  566 
vg: PVisualGear; 
4  567 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

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

569 

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

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

571 

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

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

573 
if Gear^.Timer = 1000 then // might need adjustments 
8795  574 
case Gear^.Kind of 
11468
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11391
diff
changeset

575 
gtGrenade, 
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11391
diff
changeset

576 
gtClusterBomb, 
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11391
diff
changeset

577 
gtWatermelon, 
14011
3c40754f6cfe
Add Grenade taunt when grenade close to hog is about to blow up
Wuzzy <Wuzzy2@mail.ru>
parents:
14009
diff
changeset

578 
gtHellishBomb: makeHogsWorry(Gear^.X, Gear^.Y, Gear^.Boom, Gear^.Kind); 
3c40754f6cfe
Add Grenade taunt when grenade close to hog is about to blow up
Wuzzy <Wuzzy2@mail.ru>
parents:
14009
diff
changeset

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

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

581 

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

582 
if (Gear^.Kind = gtBall) and ((Gear^.State and gstTmpFlag) <> 0) then 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

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

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

585 
if (Gear^.State and gstCollision) <> 0 then 
11468
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11391
diff
changeset

586 
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLDontDraw or EXPLNoGfx); 
7726
1137406bce12
Set default collision mask for gears at currenthedgehog X/Y to FF7F, expose mask to scripting as well. This should resolve the collision part of bug #420
nemo
parents:
7721
diff
changeset

587 
end; 
3004  588 

3475  589 
if (Gear^.Kind = gtGasBomb) and ((GameTicks mod 200) = 0) then 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

590 
begin 
3475  591 
vg:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeWhite); 
592 
if vg <> nil then 

593 
vg^.Tint:= $FFC0C000; 

7726
1137406bce12
Set default collision mask for gears at currenthedgehog X/Y to FF7F, expose mask to scripting as well. This should resolve the collision part of bug #420
nemo
parents:
7721
diff
changeset

594 
end; 
3475  595 

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

596 
if Gear^.Timer = 0 then 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

597 
begin 
8795  598 
case Gear^.Kind of 
11468
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11391
diff
changeset

599 
gtGrenade: doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); 
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11391
diff
changeset

600 
gtBall: doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); 
8795  601 
gtClusterBomb: 
3476
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset

602 
begin 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

603 
x := hwRound(Gear^.X); 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

604 
y := hwRound(Gear^.Y); 
8413
454191defee6
restore former cluster behaviour (makes the most diff for the bomb)
nemo
parents:
8370
diff
changeset

605 
gdX:= Gear^.dX; 
11468
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11391
diff
changeset

606 
doMakeExplosion(x, y, Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

607 
for i:= 0 to 4 do 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

608 
begin 
8413
454191defee6
restore former cluster behaviour (makes the most diff for the bomb)
nemo
parents:
8370
diff
changeset

609 
dX := rndSign(GetRandomf * _0_1) + gdX / 5; 
7001  610 
dY := (GetRandomf  _3) * _0_08; 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

611 
FollowGear := AddGear(x, y, gtCluster, 0, dX, dY, 25) 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

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

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

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

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

617 
y := hwRound(Gear^.Y); 
8413
454191defee6
restore former cluster behaviour (makes the most diff for the bomb)
nemo
parents:
8370
diff
changeset

618 
gdX:= Gear^.dX; 
11468
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11391
diff
changeset

619 
doMakeExplosion(x, y, Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); 
3476
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset

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

621 
begin 
8413
454191defee6
restore former cluster behaviour (makes the most diff for the bomb)
nemo
parents:
8370
diff
changeset

622 
dX := rndSign(GetRandomf * _0_1) + gdX / 5; 
7001  623 
dY := (GetRandomf  _1_5) * _0_3; 
6120  624 
FollowGear:= AddGear(x, y, gtMelonPiece, 0, dX, dY, 75); 
625 
FollowGear^.DirAngle := i * 60 

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

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

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

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

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

631 
y := hwRound(Gear^.Y); 
11468
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11391
diff
changeset

632 
doMakeExplosion(x, y, Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); 
3476
1ec68b8d3bd1
Henek adds a flamethrower, updates some translations, and tweaks how fire works.
nemo
parents:
3475
diff
changeset

633 

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

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

635 
begin 
7001  636 
dX := AngleCos(i * 16) * _0_5 * (GetRandomf + _1); 
637 
dY := AngleSin(i * 16) * _0_5 * (GetRandomf + _1); 

6131  638 
if i mod 2 = 0 then 
6126
61c1161ee32f
Remove unnecessary assignments postcreation. Simplifies Lua manipulation of these adds as well as just being tidier.
nemo
parents:
6122
diff
changeset

639 
begin 
61c1161ee32f
Remove unnecessary assignments postcreation. Simplifies Lua manipulation of these adds as well as just being tidier.
nemo
parents:
6122
diff
changeset

640 
AddGear(x, y, gtFlame, gstTmpFlag, dX, dY, 0); 
61c1161ee32f
Remove unnecessary assignments postcreation. Simplifies Lua manipulation of these adds as well as just being tidier.
nemo
parents:
6122
diff
changeset

641 
AddGear(x, y, gtFlame, 0, dX, dY, 0) 
61c1161ee32f
Remove unnecessary assignments postcreation. Simplifies Lua manipulation of these adds as well as just being tidier.
nemo
parents:
6122
diff
changeset

642 
end 
61c1161ee32f
Remove unnecessary assignments postcreation. Simplifies Lua manipulation of these adds as well as just being tidier.
nemo
parents:
6122
diff
changeset

643 
else 
8795  644 
begin 
6126
61c1161ee32f
Remove unnecessary assignments postcreation. Simplifies Lua manipulation of these adds as well as just being tidier.
nemo
parents:
6122
diff
changeset

645 
AddGear(x, y, gtFlame, 0, dX, dY, 0); 
61c1161ee32f
Remove unnecessary assignments postcreation. Simplifies Lua manipulation of these adds as well as just being tidier.
nemo
parents:
6122
diff
changeset

646 
AddGear(x, y, gtFlame, gstTmpFlag, dX, dY, 0) 
61c1161ee32f
Remove unnecessary assignments postcreation. Simplifies Lua manipulation of these adds as well as just being tidier.
nemo
parents:
6122
diff
changeset

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

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

649 
end; 
3712  650 
gtGasBomb: 
651 
begin 

11468
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11391
diff
changeset

652 
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); 
3712  653 
for i:= 0 to 2 do 
4160
043c17a8b3ca
Don't call getrandom() from parameters to a function. The order of calls is undefined, so desyncs are probable.
unc0rr
parents:
4155
diff
changeset

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

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

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

658 
end 
3712  659 
end; 
7726
1137406bce12
Set default collision mask for gears at currenthedgehog X/Y to FF7F, expose mask to scripting as well. This should resolve the collision part of bug #420
nemo
parents:
7721
diff
changeset

660 
end; 
1137406bce12
Set default collision mask for gears at currenthedgehog X/Y to FF7F, expose mask to scripting as well. This should resolve the collision part of bug #420
nemo
parents:
7721
diff
changeset

661 
DeleteGear(Gear); 
1137406bce12
Set default collision mask for gears at currenthedgehog X/Y to FF7F, expose mask to scripting as well. This should resolve the collision part of bug #420
nemo
parents:
7721
diff
changeset

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

663 
end; 
6498  664 

665 
CalcRotationDirAngle(Gear); 

666 

667 
if Gear^.Kind = gtHellishBomb then 

6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

668 
begin 
6498  669 

670 
if Gear^.Timer = 3000 then 

6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

671 
begin 
6498  672 
Gear^.nImpactSounds := 0; 
673 
PlaySound(sndHellish); 

6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

674 
end; 
6498  675 

676 
if (GameTicks and $3F) = 0 then 

677 
if (Gear^.State and gstCollision) = 0 then 

678 
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtEvilTrace); 

6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

679 
end; 
4  680 
end; 
5313
5e18eaef65d0
now scripts can create unique crates: dummy (empty) crates and booby traps. scripts can also set health crate values
Henek
parents:
5298
diff
changeset

681 

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

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

683 
procedure doStepMolotov(Gear: PGear); 
8795  684 
var 
6472  685 
s: Longword; 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

686 
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

687 
dX, dY: hwFloat; 
5874
5cd329cf2460
nemo's molotov burst effect; with a slight color modification added
sheepluva
parents:
5873
diff
changeset

688 
smoke, glass: PVisualGear; 
2457
ecf0c7e7995b
Initial molotov cocktail. Still needs graphics, tweaking of fire behaviour. Also changed probabilities for default weapon sets
nemo
parents:
2455
diff
changeset

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

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

691 

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

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

693 
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

694 

5870  695 
// let's add some smoke depending on speed 
8906
82756a90a343
I see no reason why a visual effect needs Distance. IMO square should look just fine. Untested. Oh. Also reduced flake count at Randi's request.
nemo
parents:
8838
diff
changeset

696 
s:= max(32,152  round((abs(hwFloat2FLoat(Gear^.dX))+abs(hwFloat2Float(Gear^.dY)))*120))+random(10); 
6011
519f8a58c021
Fix a bunch of warnings (also improves speed a bit in 32 bit code)
unC0Rr
parents:
6002
diff
changeset

697 
if (GameTicks mod s) = 0 then 
5871
09daa06191d7
Since we are tweaking molotov. make the flame flickery and add a drowning frame
nemo
parents:
5870
diff
changeset

698 
begin 
5873  699 
// adjust angle to match the texture 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

700 
if Gear^.dX.isNegative then 
8906
82756a90a343
I see no reason why a visual effect needs Distance. IMO square should look just fine. Untested. Oh. Also reduced flake count at Randi's request.
nemo
parents:
8838
diff
changeset

701 
i:= 130 
82756a90a343
I see no reason why a visual effect needs Distance. IMO square should look just fine. Untested. Oh. Also reduced flake count at Randi's request.
nemo
parents:
8838
diff
changeset

702 
else i:= 50; 
8795  703 

5873  704 
smoke:= AddVisualGear(hwRound(Gear^.X)round(cos((Gear^.DirAngle+i) * pi / 180)*20), hwRound(Gear^.Y)round(sin((Gear^.DirAngle+i) * pi / 180)*20), vgtSmoke); 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

705 
if smoke <> nil then 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

706 
smoke^.Scale:= 0.75; 
5871
09daa06191d7
Since we are tweaking molotov. make the flame flickery and add a drowning frame
nemo
parents:
5870
diff
changeset

707 
end; 
5870  708 

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

709 
if (Gear^.State and gstCollision) <> 0 then 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

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

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

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

713 
gY := hwRound(Gear^.Y); 
5924
82fc26c53d2a
Tweak sparkles, glass. Left glass commented out in case he prefers old behaviour.
nemo
parents:
5922
diff
changeset

714 
for i:= 0 to 4 do 
5874
5cd329cf2460
nemo's molotov burst effect; with a slight color modification added
sheepluva
parents:
5873
diff
changeset

715 
begin 
5924
82fc26c53d2a
Tweak sparkles, glass. Left glass commented out in case he prefers old behaviour.
nemo
parents:
5922
diff
changeset

716 
(*glass:= AddVisualGear(gx+random(7)3, gy+random(5)2, vgtEgg); 
5874
5cd329cf2460
nemo's molotov burst effect; with a slight color modification added
sheepluva
parents:
5873
diff
changeset

717 
if glass <> nil then 
5cd329cf2460
nemo's molotov burst effect; with a slight color modification added
sheepluva
parents:
5873
diff
changeset

718 
begin 
5cd329cf2460
nemo's molotov burst effect; with a slight color modification added
sheepluva
parents:
5873
diff
changeset

719 
glass^.Frame:= 2; 
5cd329cf2460
nemo's molotov burst effect; with a slight color modification added
sheepluva
parents:
5873
diff
changeset

720 
glass^.Tint:= $41B83ED0  i * $10081000; 
5cd329cf2460
nemo's molotov burst effect; with a slight color modification added
sheepluva
parents:
5873
diff
changeset

721 
glass^.dX:= 1/(10*(random(11)5)); 
5cd329cf2460
nemo's molotov burst effect; with a slight color modification added
sheepluva
parents:
5873
diff
changeset

722 
glass^.dY:= 1/(random(4)+5); 
5924
82fc26c53d2a
Tweak sparkles, glass. Left glass commented out in case he prefers old behaviour.
nemo
parents:
5922
diff
changeset

723 
end;*) 
82fc26c53d2a
Tweak sparkles, glass. Left glass commented out in case he prefers old behaviour.
nemo
parents:
5922
diff
changeset

724 
glass:= AddVisualGear(gx+random(7)3, gy+random(7)3, vgtStraightShot); 
6131  725 
if glass <> nil then 
5924
82fc26c53d2a
Tweak sparkles, glass. Left glass commented out in case he prefers old behaviour.
nemo
parents:
5922
diff
changeset

726 
with glass^ do 
82fc26c53d2a
Tweak sparkles, glass. Left glass commented out in case he prefers old behaviour.
nemo
parents:
5922
diff
changeset

727 
begin 
82fc26c53d2a
Tweak sparkles, glass. Left glass commented out in case he prefers old behaviour.
nemo
parents:
5922
diff
changeset

728 
Frame:= 2; 
82fc26c53d2a
Tweak sparkles, glass. Left glass commented out in case he prefers old behaviour.
nemo
parents:
5922
diff
changeset

729 
Tint:= $41B83ED0  i * $10081000; 
7066
12cc2bd84b0b
Make pas2c even more happier with uGears.c, allow assigning arrays in some cases
unc0rr
parents:
7062
diff
changeset

730 
Angle:= random(360); 
5924
82fc26c53d2a
Tweak sparkles, glass. Left glass commented out in case he prefers old behaviour.
nemo
parents:
5922
diff
changeset

731 
dx:= 0.0000001; 
82fc26c53d2a
Tweak sparkles, glass. Left glass commented out in case he prefers old behaviour.
nemo
parents:
5922
diff
changeset

732 
dy:= 0; 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

733 
if random(2) = 0 then 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

734 
dx := dx; 
5924
82fc26c53d2a
Tweak sparkles, glass. Left glass commented out in case he prefers old behaviour.
nemo
parents:
5922
diff
changeset

735 
FrameTicks:= 750; 
82fc26c53d2a
Tweak sparkles, glass. Left glass commented out in case he prefers old behaviour.
nemo
parents:
5922
diff
changeset

736 
State:= ord(sprEgg) 
82fc26c53d2a
Tweak sparkles, glass. Left glass commented out in case he prefers old behaviour.
nemo
parents:
5922
diff
changeset

737 
end; 
5874
5cd329cf2460
nemo's molotov burst effect; with a slight color modification added
sheepluva
parents:
5873
diff
changeset

738 
end; 
5415
94e26612e2ec
Adjust "sticky" fire (molotov) so it makes better fire pits, by making the kicks more regular, yet of random left/right. Tweak napalm slightly along same lines. Probably needs more balancing.
nemo
parents:
5413
diff
changeset

739 
for i:= 0 to 24 do 
6126
61c1161ee32f
Remove unnecessary assignments postcreation. Simplifies Lua manipulation of these adds as well as just being tidier.
nemo
parents:
6122
diff
changeset

740 
begin 
7001  741 
dX := AngleCos(i * 2) * ((_0_15*(i div 5))) * (GetRandomf + _1); 
742 
dY := AngleSin(i * 8) * _0_5 * (GetRandomf + _1); 

6126
61c1161ee32f
Remove unnecessary assignments postcreation. Simplifies Lua manipulation of these adds as well as just being tidier.
nemo
parents:
6122
diff
changeset

743 
AddGear(gX, gY, gtFlame, gstTmpFlag, dX, dY, 0); 
61c1161ee32f
Remove unnecessary assignments postcreation. Simplifies Lua manipulation of these adds as well as just being tidier.
nemo
parents:
6122
diff
changeset

744 
AddGear(gX, gY, gtFlame, gstTmpFlag, dX,dY, 0); 
61c1161ee32f
Remove unnecessary assignments postcreation. Simplifies Lua manipulation of these adds as well as just being tidier.
nemo
parents:
6122
diff
changeset

745 
AddGear(gX, gY, gtFlame, gstTmpFlag,dX, dY, 0); 
61c1161ee32f
Remove unnecessary assignments postcreation. Simplifies Lua manipulation of these adds as well as just being tidier.
nemo
parents:
6122
diff
changeset

746 
AddGear(gX, gY, gtFlame, gstTmpFlag,dX,dY, 0); 
61c1161ee32f
Remove unnecessary assignments postcreation. Simplifies Lua manipulation of these adds as well as just being tidier.
nemo
parents:
6122
diff
changeset

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

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

749 
exit 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

750 
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

751 
end; 
4  752 

5313
5e18eaef65d0
now scripts can create unique crates: dummy (empty) crates and booby traps. scripts can also set health crate values
Henek
parents:
5298
diff
changeset

753 
//////////////////////////////////////////////////////////////////////////////// 
1279  754 

78  755 
procedure doStepCluster(Gear: PGear); 
756 
begin 

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

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

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

759 
if (Gear^.State and gstCollision) <> 0 then 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

760 
begin 
11468
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11391
diff
changeset

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

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

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

764 
end; 
1262  765 

11468
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11391
diff
changeset

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

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

768 
else if (GameTicks and $1F) = 0 then 
10352  769 
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace); 
78  770 
end; 
771 

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

775 
AllInactive := false; 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

776 
if (GameFlags and gfMoreWind) = 0 then 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

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

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

779 
if (Gear^.State and gstCollision) <> 0 then 
4578  780 
begin 
11468
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11391
diff
changeset

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

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

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

785 
if (GameTicks and $3F) = 0 then 
10352  786 
AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace); 
95  787 
end; 
788 

4  789 
//////////////////////////////////////////////////////////////////////////////// 
4578  790 
procedure doStepSnowball(Gear: PGear); 
791 
var kick, i: LongInt; 

792 
particle: PVisualGear; 

8945
145bf64a9579
this should improve consistency of mortar cluster spread and snowball knocks
nemo
parents:
8934
diff
changeset

793 
gdX, gdY: hwFloat; 
4578  794 
begin 
795 
AllInactive := false; 

6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

796 
if (GameFlags and gfMoreWind) = 0 then 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

797 
Gear^.dX := Gear^.dX + cWindSpeed; 
8945
145bf64a9579
this should improve consistency of mortar cluster spread and snowball knocks
nemo
parents:
8934
diff
changeset

798 
gdX := Gear^.dX; 
145bf64a9579
this should improve consistency of mortar cluster spread and snowball knocks
nemo
parents:
8934
diff
changeset

799 
gdY := Gear^.dY; 
4578  800 
doStepFallingGear(Gear); 
801 
CalcRotationDirAngle(Gear); 

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

803 
begin 

11468
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11391
diff
changeset

804 
kick:= hwRound((hwAbs(gdX)+hwAbs(gdY)) * Gear^.Boom / 10000); 
8945
145bf64a9579
this should improve consistency of mortar cluster spread and snowball knocks
nemo
parents:
8934
diff
changeset

805 
Gear^.dX:= gdX; 
145bf64a9579
this should improve consistency of mortar cluster spread and snowball knocks
nemo
parents:
8934
diff
changeset

806 
Gear^.dY:= gdY; 
7621  807 
AmmoShove(Gear, 0, kick); 
4578  808 
for i:= 15 + kick div 10 downto 0 do 
809 
begin 

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

6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

811 
if particle <> nil then 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

812 
particle^.dX := particle^.dX + (Gear^.dX.QWordValue / 21474836480) 
4578  813 
end; 
814 
DeleteGear(Gear); 

815 
exit 

816 
end; 

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

818 
begin 

4582  819 
particle:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtDust); 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

820 
if particle <> nil then 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

821 
particle^.dX := particle^.dX + (Gear^.dX.QWordValue / 21474836480) 
4578  822 
end 
823 
end; 

824 

5313
5e18eaef65d0
now scripts can create unique crates: dummy (empty) crates and booby traps. scripts can also set health crate values
Henek
parents:
5298
diff
changeset

825 
//////////////////////////////////////////////////////////////////////////////// 
4611  826 
procedure doStepSnowflake(Gear: PGear); 
6419
6a464d0a5c13
Tidy up flake land generation, to avoid ragged holes in landbacktex. Remove of one odd Land[] change forces a PROTO bump. Well, had to happen eventually.
nemo
parents:
6389
diff
changeset

827 
var xx, yy, px, py, rx, ry, lx, ly: LongInt; 
5025
ac1691d35cf2
Land sprayer tweaks, make land spray and mudball not end turn
nemo
parents:
5024
diff
changeset

828 
move, draw, allpx, gun: Boolean; 
4611  829 
s: PSDL_Surface; 
830 
p: PLongwordArray; 

5693  831 
lf: LongWord; 
4611  832 
begin 
5695  833 
inc(Gear^.Pos); 
5025
ac1691d35cf2
Land sprayer tweaks, make land spray and mudball not end turn
nemo
parents:
5024
diff
changeset

834 
gun:= (Gear^.State and gstTmpFlag) <> 0; 
5024  835 
move:= false; 
836 
draw:= false; 

5025
ac1691d35cf2
Land sprayer tweaks, make land spray and mudball not end turn
nemo
parents:
5024
diff
changeset

837 
if gun then 
5024  838 
begin 
6450  839 
Gear^.State:= Gear^.State and (not gstInvisible); 
5024  840 
doStepFallingGear(Gear); 
841 
CheckCollision(Gear); 

6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

842 
if ((Gear^.State and gstCollision) <> 0) or ((Gear^.State and gstMoving) = 0) then 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

843 
draw:= true; 
5024  844 
xx:= hwRound(Gear^.X); 
845 
yy:= hwRound(Gear^.Y); 

9809  846 
if draw and (WorldEdge = weWrap) and ((xx < LongInt(leftX) + 3) or (xx > LongInt(rightX)  3)) then 
847 
begin 

10015  848 
if xx < LongInt(leftX) + 3 then 
9563  849 
xx:= rightX3 
850 
else xx:= leftX+3; 

851 
Gear^.X:= int2hwFloat(xx) 

852 
end 

5024  853 
end 
854 
else if GameTicks and $7 = 0 then 

4611  855 
begin 
856 
with Gear^ do 

857 
begin 

6450  858 
State:= State and (not gstInvisible); 
5355  859 
X:= X + cWindSpeed * 3200 + dX; 
4611  860 
Y:= Y + dY + cGravity * vobFallSpeed * 8; // using same value as flakes to try and get similar results 
861 
xx:= hwRound(X); 

862 
yy:= hwRound(Y); 

863 
if vobVelocity <> 0 then 

864 
begin 

7649  865 
DirAngle := DirAngle + (Damage / 1000); 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

866 
if DirAngle < 0 then 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

867 
DirAngle := DirAngle + 360 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

868 
else if 360 < DirAngle then 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

869 
DirAngle := DirAngle  360; 
4611  870 
end; 
7649  871 
(* 
872 
We aren't using frametick right now, so just a waste of cycles. 

4611  873 
inc(Health, 8); 
5186  874 
if longword(Health) > vobFrameTicks then 
4611  875 
begin 
876 
dec(Health, vobFrameTicks); 

877 
inc(Timer); 

6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

878 
if Timer = vobFramesCount then 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

879 
Timer:= 0 
4611  880 
end; 
7649  881 
*) 
4611  882 
// move back to cloud layer 
10354  883 
if CheckCoordInWater(xx, yy) then 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

884 
move:= true 
7477
26706bf32ecf
First pass at variable land size. For playing a small map (forced on rqLowRes), this should save 42MiB of RAM.
nemo
parents:
7468
diff
changeset

885 
else if (xx > snowRight) or (xx < snowLeft) then 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

886 
move:=true 
10736
5b7cf9fcb47e
Try to handle negative gravity w/ snow. Still needs to look nicer. Currently causes banding.
nemo
parents:
10679
diff
changeset

887 
else if (cGravity < _0) and (yy < LAND_HEIGHT1200) then 
5b7cf9fcb47e
Try to handle negative gravity w/ snow. Still needs to look nicer. Currently causes banding.
nemo
parents:
10679
diff
changeset

888 
move:=true 
4791  889 
// Solid pixel encountered 
7477
26706bf32ecf
First pass at variable land size. For playing a small map (forced on rqLowRes), this should save 42MiB of RAM.
nemo
parents:
7468
diff
changeset

890 
else if ((yy and LAND_HEIGHT_MASK) = 0) and ((xx and LAND_WIDTH_MASK) = 0) and (Land[yy, xx] <> 0) then 
4611  891 
begin 
7128
574b385ce7df
Minor freezer changes, allow snow to accumulate on indestructible terrain too.
nemo
parents:
7101
diff
changeset

892 
lf:= Land[yy, xx] and (lfObject or lfBasic or lfIndestructible); 
8602  893 
if lf = 0 then lf:= lfObject; 
4791  894 
// If there's room below keep falling 
895 
if (((yy1) and LAND_HEIGHT_MASK) = 0) and (Land[yy1, xx] = 0) then 

896 
begin 

897 
X:= X  cWindSpeed * 1600  dX; 

898 
end 

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

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

901 
begin 

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

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

904 
end 

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

906 
begin 

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

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

909 
end 

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

911 
begin 

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

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

914 
end 

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

916 
begin 

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

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

919 
end 

4805
01332828b568
Fancier detection of hogs/objects. Hogs wont get buried even by the worst of storms.
Palewolf
parents:
4803
diff
changeset

920 
// if there's an hog/object below do nothing 
01332828b568
Fancier detection of hogs/objects. Hogs wont get buried even by the worst of storms.
Palewolf
parents:
4803
diff
changeset

921 
else if ((((yy+1) and LAND_HEIGHT_MASK) = 0) and ((Land[yy+1, xx] and $FF) <> 0)) 
01332828b568
Fancier detection of hogs/objects. Hogs wont get buried even by the worst of storms.
Palewolf
parents:
4803
diff
changeset

922 
then move:=true 
5024  923 
else draw:= true 
924 
end 

925 
end 

926 
end; 

6131  927 
if draw then 
5024  928 
with Gear^ do 
929 
begin 

930 
// we've collided with land. draw some stuff and get back into the clouds 

931 
move:= true; 

6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

932 
if (Pos > 20) and ((CurAmmoGear = nil) 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

933 
or (CurAmmoGear^.Kind <> gtRope)) then 
5024  934 
begin 
935 
////////////////////////////////// TODO  ASK UNC0RR FOR A GOOD HOME FOR THIS //////////////////////////////////// 

5025
ac1691d35cf2
Land sprayer tweaks, make land spray and mudball not end turn
nemo
parents:
5024
diff
changeset

936 
if not gun then 
5024  937 
begin 
938 
dec(yy,3); 

939 
dec(xx,1) 

940 
end; 

941 
s:= SpritesData[sprSnow].Surface; 

942 
p:= s^.pixels; 

943 
allpx:= true; 

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

945 
begin 

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

6419
6a464d0a5c13
Tidy up flake land generation, to avoid ragged holes in landbacktex. Remove of one odd Land[] change forces a PROTO bump. Well, had to happen eventually.
nemo
parents:
6389
diff
changeset

947 
begin 
6a464d0a5c13
Tidy up flake land generation, to avoid ragged holes in landbacktex. Remove of one odd Land[] change forces a PROTO bump. Well, had to happen eventually.
nemo
parents:
6389
diff
changeset

948 
lx:=xx + px; ly:=yy + py; 
6a464d0a5c13
Tidy up flake land generation, to avoid ragged holes in landbacktex. Remove of one odd Land[] change forces a PROTO bump. Well, had to happen eventually.
nemo
parents:
6389
diff
changeset

949 
if (ly and LAND_HEIGHT_MASK = 0) and (lx and LAND_WIDTH_MASK = 0) and (Land[ly, lx] and $FF = 0) then 
5024  950 
begin 
6419
6a464d0a5c13
Tidy up flake land generation, to avoid ragged holes in landbacktex. Remove of one odd Land[] change forces a PROTO bump. Well, had to happen eventually.
nemo
parents:
6389
diff
changeset

951 
rx:= lx; 
6a464d0a5c13
Tidy up flake land generation, to avoid ragged holes in landbacktex. Remove of one odd Land[] change forces a PROTO bump. Well, had to happen eventually.
nemo
parents:
6389
diff
changeset

952 
ry:= ly; 
6a464d0a5c13
Tidy up flake land generation, to avoid ragged holes in landbacktex. Remove of one odd Land[] change forces a PROTO bump. Well, had to happen eventually.
nemo
parents:
6389
diff
changeset

953 
if cReducedQuality and rqBlurryLand <> 0 then 
5025
ac1691d35cf2
Land sprayer tweaks, make land spray and mudball not end turn
nemo
parents:
5024
diff
changeset

954 
begin 
6419
6a464d0a5c13
Tidy up flake land generation, to avoid ragged holes in landbacktex. Remove of one odd Land[] change forces a PROTO bump. Well, had to happen eventually.
nemo
parents:
6389
diff
changeset

955 
rx:= rx div 2;ry:= ry div 2; 
6a464d0a5c13
Tidy up flake land generation, to avoid ragged holes in landbacktex. Remove of one odd Land[] change forces a PROTO bump. Well, had to happen eventually.
nemo
parents:
6389
diff
changeset

956 
end; 
8751
4609823efc94
More flagging of Land values. Also use less than for tests of nonterrain, instead of "and $FF00 = 0". Saves a couple of ops, which actually matters a small amount in a few places.
nemo
parents:
8744
diff
changeset

957 
if Land[yy + py, xx + px] <= lfAllObjMask then 
5025
ac1691d35cf2
Land sprayer tweaks, make land spray and mudball not end turn
nemo
parents:
5024
diff
changeset

958 
if gun then 
6419
6a464d0a5c13
Tidy up flake land generation, to avoid ragged holes in landbacktex. Remove of one odd Land[] change forces a PROTO bump. Well, had to happen eventually.
nemo
parents:
6389
diff
changeset

959 
begin 
6a464d0a5c13
Tidy up flake land generation, to avoid ragged holes in landbacktex. Remove of one odd Land[] change forces a PROTO bump. Well, had to happen eventually.
nemo
parents:
6389
diff
changeset

960 
LandDirty[yy div 32, xx div 32]:= 1; 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

961 
if LandPixels[ry, rx] = 0 then 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

962 
Land[ly, lx]:= lfDamaged or lfObject 
6419
6a464d0a5c13
Tidy up flake land generation, to avoid ragged holes in landbacktex. Remove of one odd Land[] change forces a PROTO bump. Well, had to happen eventually.
nemo
parents:
6389
diff
changeset

963 
else Land[ly, lx]:= lfDamaged or lfBasic 
6a464d0a5c13
Tidy up flake land generation, to avoid ragged holes in landbacktex. Remove of one odd Land[] change forces a PROTO bump. Well, had to happen eventually.
nemo
parents:
6389
diff
changeset

964 
end 
6a464d0a5c13
Tidy up flake land generation, to avoid ragged holes in landbacktex. Remove of one odd Land[] change forces a PROTO bump. Well, had to happen eventually.
nemo
parents:
6389
diff
changeset

965 
else Land[ly, lx]:= lf; 
6a464d0a5c13
Tidy up flake land generation, to avoid ragged holes in landbacktex. Remove of one odd Land[] change forces a PROTO bump. Well, had to happen eventually.
nemo
parents:
6389
diff
changeset

966 
if gun then 
10645
b8c73bacb31e
Fix inflight colouring of land spray, make it use tint when added to land too (lua might find that handy), tweak climbhome cake delay slightly
nemo
parents:
10642
diff
changeset

967 
LandPixels[ry, rx]:= (Gear^.Tint shr 24 shl RShift) or 
b8c73bacb31e
Fix inflight colouring of land spray, make it use tint when added to land too (lua might find that handy), tweak climbhome cake delay slightly
nemo
parents:
10642
diff
changeset

968 
(Gear^.Tint shr 16 and $FF shl GShift) or 
b8c73bacb31e
Fix inflight colouring of land spray, make it use tint when added to land too (lua might find that handy), tweak climbhome cake delay slightly
nemo
parents:
10642
diff
changeset

969 
(Gear^.Tint shr 8 and $FF shl BShift) or 
b8c73bacb31e
Fix inflight colouring of land spray, make it use tint when added to land too (lua might find that handy), tweak climbhome cake delay slightly
nemo
parents:
10642
diff
changeset

970 
(p^[px] and AMask) 
6419
6a464d0a5c13
Tidy up flake land generation, to avoid ragged holes in landbacktex. Remove of one odd Land[] change forces a PROTO bump. Well, had to happen eventually.
nemo
parents:
6389
diff
changeset

971 
else LandPixels[ry, rx]:= addBgColor(LandPixels[ry, rx], p^[px]); 
5024  972 
end 
6419
6a464d0a5c13
Tidy up flake land generation, to avoid ragged holes in landbacktex. Remove of one odd Land[] change forces a PROTO bump. Well, had to happen eventually.
nemo
parents:
6389
diff
changeset

973 
else allpx:= false 
6a464d0a5c13
Tidy up flake land generation, to avoid ragged holes in landbacktex. Remove of one odd Land[] change forces a PROTO bump. Well, had to happen eventually.
nemo
parents:
6389
diff
changeset

974 
end; 
10131
4b4a043111f4
 pas2c recognizes typecasts in initialization expressions
unc0rr
parents:
10125
diff
changeset

975 
p:= PLongWordArray(@(p^[s^.pitch shr 2])) 
5024  976 
end; 
8795  977 

978 
// Why is this here. For one thing, there's no test on +1 being safe. 

6419
6a464d0a5c13
Tidy up flake land generation, to avoid ragged holes in landbacktex. Remove of one odd Land[] change forces a PROTO bump. Well, had to happen eventually.
nemo
parents:
6389
diff
changeset

979 
//Land[py, px+1]:= lfBasic; 
8795  980 

6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

981 
if allpx then 
7170
84ac6c6d2d8e
Only create textures for nonempty LandPixel chunks. This should save a fair amount of memory, especially on smaller maps, and eliminate a number of draws
nemo
parents:
7168
diff
changeset

982 
UpdateLandTexture(xx, Pred(s^.h), yy, Pred(s^.w), true) 
4791  983 
else 
4611  984 
begin 
5024  985 
UpdateLandTexture( 
986 
max(0, min(LAND_WIDTH, xx)), 

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

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

7170
84ac6c6d2d8e
Only create textures for nonempty LandPixel chunks. This should save a fair amount of memory, especially on smaller maps, and eliminate a number of draws
nemo
parents:
7168
diff
changeset

989 
min(LAND_HEIGHT  yy, Pred(s^.h)), false // could this be true without unnecessarily creating blanks? 
5024  990 
); 
4791  991 
end; 
5024  992 
////////////////////////////////// TODO  ASK UNC0RR FOR A GOOD HOME FOR THIS //////////////////////////////////// 
4611  993 
end 
5024  994 
end; 
995 

996 
if move then 

997 
begin 

5025
ac1691d35cf2
Land sprayer tweaks, make land spray and mudball not end turn
nemo
parents:
5024
diff
changeset

998 
if gun then 
5024  999 
begin 
1000 
DeleteGear(Gear); 

1001 
exit 

1002 
end; 

5695  1003 
Gear^.Pos:= 0; 
7721  1004 
Gear^.X:= int2hwFloat(LongInt(GetRandom(snowRight  snowLeft)) + snowLeft); 
10736
5b7cf9fcb47e
Try to handle negative gravity w/ snow. Still needs to look nicer. Currently causes banding.
nemo
parents:
10679
diff
changeset

1005 
if (cGravity < _0) and (yy < LAND_HEIGHT1200) then 
5b7cf9fcb47e
Try to handle negative gravity w/ snow. Still needs to look nicer. Currently causes banding.
nemo
parents:
10679
diff
changeset

1006 
Gear^.Y:= int2hwFloat(LAND_HEIGHT  50  LongInt(GetRandom(50))) 
5b7cf9fcb47e
Try to handle negative gravity w/ snow. Still needs to look nicer. Currently causes banding.
nemo
parents:
10679
diff
changeset

1007 
else Gear^.Y:= int2hwFloat(LAND_HEIGHT + LongInt(GetRandom(50))  1250); 
5413  1008 
Gear^.State:= Gear^.State or gstInvisible; 
4611  1009 
end 
1010 
end; 

1011 

4578  1012 
//////////////////////////////////////////////////////////////////////////////// 
4  1013 
procedure doStepGrave(Gear: PGear); 
1014 
begin 

7394  1015 
if (Gear^.Message and gmDestroy) <> 0 then 
7393
3f203c62353b
Fix bug in resurrector deleting graves (exists in stable too), remove some unnecessary assignments due to the fillchar 0
nemo
parents:
7391
diff
changeset

1016 
begin 
3f203c62353b
Fix bug in resurrector deleting graves (exists in stable too), remove some unnecessary assignments due to the fillchar 0
nemo
parents:
7391
diff
changeset

1017 
DeleteGear(Gear); 
3f203c62353b
Fix bug in resurrector deleting graves (exists in stable too), remove some unnecessary assignments due to the fillchar 0
nemo
parents:
7391
diff
changeset

1018 
exit 
3f203c62353b
Fix bug in resurrector deleting graves (exists in stable too), remove some unnecessary assignments due to the fillchar 0
nemo
parents:
7391
diff
changeset

1019 
end; 
7394  1020 

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

1021 
AllInactive := false; 
7394  1022 

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

1023 
if Gear^.dY.isNegative then 
9706
5178d2263521
return land word from uCollisions to make decisions based on it. Should be handy for trampoline.
nemo
parents:
9698
diff
changeset

1024 
if TestCollisionY(Gear, 1) <> 0 then 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

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

1026 

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

1027 
if not Gear^.dY.isNegative then 
9706
5178d2263521
return land word from uCollisions to make decisions based on it. Should be handy for trampoline.
nemo
parents:
9698
diff
changeset

1028 
if TestCollisionY(Gear, 1) <> 0 then 
9820  1029 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

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

1031 
if Gear^.dY >  _1div1024 then 
9820  1032 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

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

1034 
exit 
9820  1035 
end 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

1036 
else if Gear^.dY <  _0_03 then 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

1037 
PlaySound(Gear^.ImpactSound) 
9820  1038 
end; 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1039 

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

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

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

1042 
Gear^.dY := Gear^.dY + cGravity 
4  1043 
end; 
1044 

1045 
//////////////////////////////////////////////////////////////////////////////// 

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

1048 
t: hwFloat; 
5748
70d7f8e40f53
Just for fun. Flowers! Also, use a less blatant image in ammo menu.
nemo
parents:
5738
diff
changeset

1049 
gX,gY,i: LongInt; 
12804  1050 
uw, nuw: boolean; 
5748
70d7f8e40f53
Just for fun. Flowers! Also, use a less blatant image in ammo menu.
nemo
parents:
5738
diff
changeset

1051 
flower: PVisualGear; 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1052 

4  1053 
begin 
12804  1054 
WorldWrap(Gear); 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

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

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

1057 
gY := hwRound(Gear^.Y); 
6251  1058 
uw := (Gear^.Tag <> 0); // was bee underwater last tick? 
10354  1059 
nuw := CheckCoordInWater(gx, gy + Gear^.Radius); // is bee underwater now? 
6251  1060 

1061 
// if water entered or left 

1062 
if nuw <> uw then 

6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

1063 
begin 
10363  1064 
if Gear^.Timer <> 5000 then 
1065 
AddSplashForGear(Gear, false); 

7053  1066 
StopSoundChan(Gear^.SoundChannel); 
6251  1067 
if nuw then 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

1068 
begin 
6251  1069 
Gear^.SoundChannel := LoopSound(sndBeeWater); 
1070 
Gear^.Tag := 1; 

1071 
end 

1072 
else 

6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

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

1074 
Gear^.SoundChannel := LoopSound(sndBee); 
6251  1075 
Gear^.Tag := 0; 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

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

1077 
end; 
6251  1078 

1079 

1080 
if Gear^.Timer = 0 then 

9766
62c49992b049
fix Issue #724: Bee sound never stops (underwater when timer is 0)
sheepluva
parents:
9742
diff
changeset

1081 
begin 
13593
083733ec7941
Add support for infinite fly time of jetpack and Birdy
Wuzzy <Wuzzy2@mail.ru>
parents:
13572
diff
changeset

1082 
// no energy? just fall 
9766
62c49992b049
fix Issue #724: Bee sound never stops (underwater when timer is 0)
sheepluva
parents:
9742
diff
changeset

1083 
doStepFallingGear(Gear); 
62c49992b049
fix Issue #724: Bee sound never stops (underwater when timer is 0)
sheepluva
parents:
9742
diff
changeset

1084 
// if drowning, stop bee sound 
62c49992b049
fix Issue #724: Bee sound never stops (underwater when timer is 0)
sheepluva
parents:
9742
diff
changeset

1085 
if (Gear^.State and gstDrowning) <> 0 then 
62c49992b049
fix Issue #724: Bee sound never stops (underwater when timer is 0)
sheepluva
parents:
9742
diff
changeset

1086 
StopSoundChan(Gear^.SoundChannel); 
62c49992b049
fix Issue #724: Bee sound never stops (underwater when timer is 0)
sheepluva
parents:
9742
diff
changeset

1087 
end 
6251  1088 
else 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

1089 
begin 
11475  1090 
if (Gear^.Timer and $F) = 0 then 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

1091 
begin 
11475  1092 
if (Gear^.Timer and $3F) = 0 then 
10352  1093 
AddVisualGear(gX, gY, vgtBeeTrace); 
1094 

11475  1095 
Gear^.dX := Gear^.dX + _0_000064 * (Gear^.Target.X  gX); 
1096 
Gear^.dY := Gear^.dY + _0_000064 * (Gear^.Target.Y  gY); 

6251  1097 
// make sure new speed isn't higher than original one (which we stored in Friction variable) 
1098 
t := Gear^.Friction / Distance(Gear^.dX, Gear^.dY); 

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

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

6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

1101 
end; 
6251  1102 

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

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

1105 

6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

1106 
end; 
3591  1107 

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

1108 

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

1109 
CheckCollision(Gear); 
6251  1110 
if ((Gear^.State and gstCollision) <> 0) then 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

1111 
begin 
7053  1112 
StopSoundChan(Gear^.SoundChannel); 
11468
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11391
diff
changeset

1113 
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound); 
5748
70d7f8e40f53
Just for fun. Flowers! Also, use a less blatant image in ammo menu.
nemo
parents:
5738
diff
changeset

1114 
for i:= 0 to 31 do 
70d7f8e40f53
Just for fun. Flowers! Also, use a less blatant image in ammo menu.
nemo
parents:
5738
diff
changeset

1115 
begin 
70d7f8e40f53
Just for fun. Flowers! Also, use a less blatant image in ammo menu.
nemo
parents:
5738
diff
changeset

1116 
flower:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtStraightShot); 
6131  1117 
if flower <> nil then 
5748
70d7f8e40f53
Just for fun. Flowers! Also, use a less blatant image in ammo menu.
nemo
parents:
5738
diff
changeset

1118 
with flower^ do 
70d7f8e40f53
Just for fun. Flowers! Also, use a less blatant image in ammo menu.
nemo
parents:
5738
diff
changeset

1119 
begin 
70d7f8e40f53
Just for fun. Flowers! Also, use a less blatant image in ammo menu.
nemo
parents:
5738
diff
changeset

1120 
Scale:= 0.75; 
70d7f8e40f53
Just for fun. Flowers! Also, use a less blatant image in ammo menu.
nemo
parents:
5738
diff
changeset

1121 
dx:= 0.001 * (random(200)); 
70d7f8e40f53
Just for fun. Flowers! Also, use a less blatant image in ammo menu.
nemo
parents:
5738
diff
changeset

1122 
dy:= 0.001 * (random(200)); 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

1123 
if random(2) = 0 then 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

1124 
dx := dx; 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

1125 
if random(2) = 0 then 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

1126 
dy := dy; 
5748
70d7f8e40f53
Just for fun. Flowers! Also, use a less blatant image in ammo menu.
nemo
parents:
5738
diff
changeset

1127 
FrameTicks:= random(250) + 250; 
70d7f8e40f53
Just for fun. Flowers! Also, use a less blatant image in ammo menu.
nemo
parents:
5738
diff
changeset

1128 
State:= ord(sprTargetBee); 
70d7f8e40f53
Just for fun. Flowers! Also, use a less blatant image in ammo menu.
nemo
parents:
5738
diff
changeset

1129 
end; 
70d7f8e40f53
Just for fun. Flowers! Also, use a less blatant image in ammo menu.
nemo
parents:
5738
diff
changeset

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

1131 
DeleteGear(Gear); 
10135  1132 
exit; 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1133 
end; 
6251  1134 

1135 
if (Gear^.Timer > 0) then 

9766
62c49992b049
fix Issue #724: Bee sound never stops (underwater when timer is 0)
sheepluva
parents:
9742
diff
changeset

1136 
begin 
62c49992b049
fix Issue #724: Bee sound never stops (underwater when timer is 0)
sheepluva
parents:
9742
diff
changeset

1137 
dec(Gear^.Timer); 
62c49992b049
fix Issue #724: Bee sound never stops (underwater when timer is 0)
sheepluva
parents:
9742
diff
changeset

1138 
if Gear^.Timer = 0 then 
62c49992b049
fix Issue #724: Bee sound never stops (underwater when timer is 0)
sheepluva
parents:
9742
diff
changeset

1139 
begin 
62c49992b049
fix Issue #724: Bee sound never stops (underwater when timer is 0)
sheepluva
parents:
9742
diff
changeset

1140 
// no need to display remaining time anymore 
62c49992b049
fix Issue #724: Bee sound never stops (underwater when timer is 0)
sheepluva
parents:
9742
diff
changeset

1141 
Gear^.RenderTimer:= false; 
62c49992b049
fix Issue #724: Bee sound never stops (underwater when timer is 0)
sheepluva
parents:
9742
diff
changeset

1142 
// bee can drown when timer reached 0 
9954  1143 
Gear^.State:= Gear^.State and (not gstSubmersible); 
9766
62c49992b049
fix Issue #724: Bee sound never stops (underwater when timer is 0)
sheepluva
parents:
9742
diff
changeset

1144 
end; 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

1145 
end; 
4  1146 
end; 
1147 

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

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

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

1152 
Gear^.Y := Gear^.Y + Gear^.dY; 
11286  1153 
WorldWrap(Gear); 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1154 
Gear^.dY := Gear^.dY + cGravity; 
10363  1155 
CheckGearDrowning(Gear); 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

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

1157 
if (Gear^.State and gstCollision) <> 0 then 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

1158 
begin 
11468
2f6f8baa2a97
Make weapon damage in most cases be a structure value and also expose it to lua. Needs testing/review due to conditions at time of doing this (w/ one arm, dizzy/tingling due to sodium citrate), and just number of places changed..
nemo
parents:
11391
diff
changeset

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

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

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

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

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

1164 
if Gear^.Timer = 0 then 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

1165 
begin 
6450  1166 
Gear^.Hedgehog^.Gear^.Message:= Gear^.Hedgehog^.Gear^.Message and (not gmAttack); 
1167 
Gear^.Hedgehog^.Gear^.State:= Gear^.Hedgehog^.Gear^.State and (not gstAttacking); 

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

1168 
AttackBar:= 0; 
8795  1169 

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

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

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

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

1174 
Gear^.doStep := @doStepBeeWork 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

1175 
end; 
4  1176 
end; 
1177 

1178 
//////////////////////////////////////////////////////////////////////////////// 

876  1179 
procedure doStepShotIdle(Gear: PGear); 
1180 
begin 

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

1181 
AllInactive := false; 
13152  1182 
if (Gear^.Kind <> gtMinigunBullet) then 
1183 
begin 

1184 
inc(Gear^.Timer); 

1185 
if Gear^.Timer > 75 then 

1186 
begin 

1187 
DeleteGear(Gear); 

1188 
AfterAttack 

1189 
end 

1190 
end 

1191 
else 

6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

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

1193 
DeleteGear(Gear); 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

1194 
end 
876  1195 
end; 
1196 

13147
7040506c831f
Fix direction of dispensed bullet shells from shotgun/sniper/minigun
alfadur
parents:
13140
diff
changeset

1197 
procedure CreateShellForGear(Gear: PGear; startFrame: Longword); 
7040506c831f
Fix direction of dispensed bullet shells from shotgun/sniper/minigun
alfadur
parents:
13140
diff
changeset

1198 
var 
7040506c831f
Fix direction of dispensed bullet shells from shotgun/sniper/minigun
alfadur
parents:
13140
diff
changeset

1199 
shell: PVisualGear; 
7040506c831f
Fix direction of dispensed bullet shells from shotgun/sniper/minigun
alfadur
parents:
13140
diff
changeset

1200 
begin 
7040506c831f
Fix direction of dispensed bullet shells from shotgun/sniper/minigun
alfadur
parents:
13140
diff
changeset

1201 
shell := AddVisualGear(hwRound(Gear^.x), hwRound(Gear^.y), vgtShell); 
7040506c831f
Fix direction of dispensed bullet shells from shotgun/sniper/minigun
alfadur
parents:
13140
diff
changeset

1202 
if shell <> nil then 
7040506c831f
Fix direction of dispensed bullet shells from shotgun/sniper/minigun
alfadur
parents:
13140
diff
changeset

1203 
begin 
7040506c831f
Fix direction of dispensed bullet shells from shotgun/sniper/minigun
alfadur
parents:
13140
diff
changeset

1204 
shell^.dX := gear^.dX.QWordValue / 17179869184; 
7040506c831f
Fix direction of dispensed bullet shells from shotgun/sniper/minigun
alfadur
parents:
13140
diff
changeset

1205 
if (gear^.dX.isNegative) then 
7040506c831f
Fix direction of dispensed bullet shells from shotgun/sniper/minigun
alfadur
parents:
13140
diff
changeset

1206 
shell^.dX := shell^.dX; 
7040506c831f
Fix direction of dispensed bullet shells from shotgun/sniper/minigun
alfadur
parents:
13140
diff
changeset

1207 
shell^.dY := gear^.dY.QWordValue / 17179869184; 
7040506c831f
Fix direction of dispensed bullet shells from shotgun/sniper/minigun
alfadur
parents:
13140
diff
changeset

1208 
shell^.Frame := startFrame; 
7040506c831f
Fix direction of dispensed bullet shells from shotgun/sniper/minigun
alfadur
parents:
13140
diff
changeset

1209 
end; 
7040506c831f
Fix direction of dispensed bullet shells from shotgun/sniper/minigun
alfadur
parents:
13140
diff
changeset

1210 
end; 
7040506c831f
Fix direction of dispensed bullet shells from shotgun/sniper/minigun
alfadur
parents:
13140
diff
changeset

1211 

13407
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13406
diff
changeset

1212 
function ShotgunLineHitHelp(Gear: PGear; oX, oY, tX, tY: hwFloat): Boolean; 
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13406
diff
changeset

1213 
var i: LongInt; 
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13406
diff
changeset

1214 
Collisions: PGearArray; 
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13406
diff
changeset

1215 
begin 
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13406
diff
changeset

1216 
ShotgunLineHitHelp := false; 
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13406
diff
changeset

1217 
Collisions := CheckAllGearsLineCollision(Gear, oX, oY, tX, tY); 
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13406
diff
changeset

1218 
i := Collisions^.Count; 
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13406
diff
changeset

1219 
while i > 0 do 
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13406
diff
changeset

1220 
begin 
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13406
diff
changeset

1221 
dec(i); 
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13406
diff
changeset

1222 
if Collisions^.ar[i]^.Kind in 
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13406
diff
changeset

1223 
[gtMine, gtSMine, gtAirMine, gtKnife, gtCase, gtTarget, gtExplosives] then 
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13406
diff
changeset

1224 
begin 
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13406
diff
changeset

1225 
Gear^.X := Collisions^.ar[i]^.X; 
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13406
diff
changeset

1226 
Gear^.Y := Collisions^.ar[i]^.Y; 
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13406
diff
changeset

1227 
ShotgunShot(Gear); 
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13406
diff
changeset

1228 
Gear^.doStep := @doStepShotIdle; 
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13406
diff
changeset

1229 
ShotgunLineHitHelp := true; 
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13406
diff
changeset

1230 
exit; 
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13406
diff
changeset

1231 
end; 
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13406
diff
changeset

1232 
end; 
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13406
diff
changeset

1233 
end; 
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13406
diff
changeset

1234 

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

1237 
i: LongWord; 
13407
06792533ef91
ensure shotgun works with portals and make it hit airmines
alfadur
parents:
13406
diff
changeset

1238 
oX, oY, tmpX, tmpY: hwFloat; 
4  1239 
begin 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

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

1241 

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

1242 
if ((Gear^.State and gstAnimation) = 0) then 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

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

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

1245 
if Gear^.Timer = 0 then 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

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

1247 
PlaySound(sndShotgunFire); 
13147
7040506c831f
Fix direction of dispensed bullet shells from shotgun/sniper/minigun
alfadur
parents:
13140
diff
changeset

1248 
CreateShellForGear(Gear, 0); 
3454
a9bef74bd6e0
Code restlyling: experimental restyling of one module
mbait
parents:
3440
diff
changeset

1249 
Gear^.State := Gear^.State or gstAnimation 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

1250 
end; 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

1251 
exit 
7564
651d56a6e568
Cancel shotgun shot if hedgehog is moved moved (by explosion)
unc0rr
parents:
7539
diff
changeset

1252 
end else 
651d56a6e568
Cancel shotgun shot if hedgehog is moved moved (by explosion)
unc0rr
parents:
7539
diff
changeset

1253 
if(Gear^.Hedgehog^.Gear = nil) or ((Gear^.Hedgehog^.Gear^.State and gstMoving) <> 0) then 
651d56a6e568
Cancel shotgun shot if hedgehog is moved moved (by explosion)
unc0rr
parents:
7539
diff
changeset

1254 
begin 
651d56a6e568
Cancel shotgun shot if hedgehog is moved moved (by explosion)
unc0rr
parents:
7539
diff
changeset

1255 
DeleteGear(Gear); 
651d56a6e568
Cancel shotgun shot if hedgehog is moved moved (by explosion)
unc0rr
parents:
7539
diff
changeset

1256 
AfterAttack; 
651d56a6e568
Cancel shotgun shot if hedgehog is moved moved (by explosion)
unc0rr
parents:
7539
diff
changeset

1257 
exit 
651d56a6e568
Cancel shotgun shot if hedgehog is moved moved (by explosion)
unc0rr
parents:
7539
diff
changeset

1258 
end 
6580
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

1259 
else 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
diff
changeset

1260 
inc(Gear^.Timer); 
6155187bf599
A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents:
6556
