37 |
37 |
38 procedure initModule; |
38 procedure initModule; |
39 procedure freeModule; |
39 procedure freeModule; |
40 function AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear; |
40 function AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear; |
41 function SpawnCustomCrateAt(x, y: LongInt; crate: TCrateType; content: Longword ): PGear; |
41 function SpawnCustomCrateAt(x, y: LongInt; crate: TCrateType; content: Longword ): PGear; |
42 function SpawnFakeCrateAt(x, y: LongInt; crate: TCrateType; trap: boolean ): PGear; |
42 function SpawnFakeCrateAt(x, y: LongInt; crate: TCrateType; explode: boolean; poison: boolean ): PGear; |
43 procedure ResurrectHedgehog(gear: PGear); |
43 procedure ResurrectHedgehog(gear: PGear); |
44 procedure ProcessGears; |
44 procedure ProcessGears; |
45 procedure EndTurnCleanup; |
45 procedure EndTurnCleanup; |
46 procedure ApplyDamage(Gear: PGear; AttackerHog: PHedgehog; Damage: Longword; Source: TDamageSource); |
46 procedure ApplyDamage(Gear: PGear; AttackerHog: PHedgehog; Damage: Longword; Source: TDamageSource); |
47 procedure SetAllToActive; |
47 procedure SetAllToActive; |
220 gear^.FlightTime:= 0; |
219 gear^.FlightTime:= 0; |
221 gear^.uid:= Counter; |
220 gear^.uid:= Counter; |
222 gear^.SoundChannel:= -1; |
221 gear^.SoundChannel:= -1; |
223 gear^.ImpactSound:= sndNone; |
222 gear^.ImpactSound:= sndNone; |
224 gear^.nImpactSounds:= 0; |
223 gear^.nImpactSounds:= 0; |
225 gear^.AmmoType:= amNothing; |
224 // Define ammo association, if any. |
|
225 gear^.AmmoType:= GearKindAmmoTypeMap[Kind]; |
226 |
226 |
227 if CurrentHedgehog <> nil then |
227 if CurrentHedgehog <> nil then |
228 begin |
228 begin |
229 gear^.Hedgehog:= CurrentHedgehog; |
229 gear^.Hedgehog:= CurrentHedgehog; |
230 gear^.IntersectGear:= CurrentHedgehog^.Gear |
230 gear^.IntersectGear:= CurrentHedgehog^.Gear |
231 end; |
231 end; |
232 // Define ammo association, if any. |
232 |
233 case Kind of |
|
234 gtGrenade: gear^.AmmoType:= amGrenade; |
|
235 gtShell: gear^.AmmoType:= amBazooka; |
|
236 gtBee: gear^.AmmoType:= amBee; |
|
237 gtShotgunShot: gear^.AmmoType:= amShotgun; |
|
238 gtPickHammer: gear^.AmmoType:= amPickHammer; |
|
239 gtRope: gear^.AmmoType:= amRope; |
|
240 gtDEagleShot: gear^.AmmoType:= amDEagle; |
|
241 gtDynamite: gear^.AmmoType:= amDynamite; |
|
242 gtClusterBomb, |
|
243 gtCluster: gear^.AmmoType:= amClusterBomb; |
|
244 gtShover: gear^.AmmoType:= amBaseballBat; // Shover is only used for baseball bat right now |
|
245 gtFirePunch: gear^.AmmoType:= amFirePunch; |
|
246 gtParachute: gear^.AmmoType:= amParachute; |
|
247 gtAirBomb: gear^.AmmoType:= amAirAttack; |
|
248 gtBlowTorch: gear^.AmmoType:= amBlowTorch; |
|
249 gtGirder: gear^.AmmoType:= amGirder; |
|
250 gtTeleport: gear^.AmmoType:= amTeleport; |
|
251 gtSwitcher: gear^.AmmoType:= amSwitch; |
|
252 gtMortar: gear^.AmmoType:= amMortar; |
|
253 gtWhip: gear^.AmmoType:= amWhip; |
|
254 gtKamikaze: gear^.AmmoType:= amKamikaze; |
|
255 gtCake: gear^.AmmoType:= amCake; |
|
256 gtSeduction: gear^.AmmoType:= amSeduction; |
|
257 gtWatermelon, |
|
258 gtMelonPiece: gear^.AmmoType:= amWatermelon; |
|
259 gtHellishBomb: gear^.AmmoType:= amHellishBomb; |
|
260 gtDrill: gear^.AmmoType:= amDrill; |
|
261 gtBallGun, |
|
262 gtBall: gear^.AmmoType:= amBallgun; |
|
263 gtRCPlane: gear^.AmmoType:= amRCPlane; |
|
264 gtSniperRifleShot: gear^.AmmoType:= amSniperRifle; |
|
265 gtJetpack: gear^.AmmoType:= amJetpack; |
|
266 gtMolotov: gear^.AmmoType:= amMolotov; |
|
267 gtBirdy, |
|
268 gtEgg: gear^.AmmoType:= amBirdy; |
|
269 gtPortal: gear^.AmmoType:= amPortalGun; |
|
270 gtPiano: gear^.AmmoType:= amPiano; |
|
271 gtGasBomb: gear^.AmmoType:= amGasBomb; |
|
272 gtSineGunShot: gear^.AmmoType:= amSineGun; |
|
273 gtFlamethrower: gear^.AmmoType:= amFlamethrower; |
|
274 gtSMine: gear^.AmmoType:= amSMine; |
|
275 gtHammer, |
|
276 gtHammerHit: gear^.AmmoType:= amHammer; |
|
277 gtResurrector: gear^.AmmoType:= amResurrector; |
|
278 gtSnowball: gear^.AmmoType:= amSnowball; |
|
279 gtStructure: gear^.AmmoType:= amStructure; // TODO - This will undoubtedly change once there is more than one structure |
|
280 gtLandGun: gear^.AmmoType:= amLandGun; |
|
281 gtTardis: gear^.AmmoType:= amTardis; |
|
282 end; |
|
283 |
|
284 case Kind of |
233 case Kind of |
285 gtGrenade, |
234 gtGrenade, |
286 gtClusterBomb, |
235 gtClusterBomb, |
287 gtGasBomb: begin |
236 gtGasBomb: begin |
288 gear^.ImpactSound:= sndGrenadeImpact; |
237 gear^.ImpactSound:= sndGrenadeImpact; |
339 DirAngle:= random * 360; |
288 DirAngle:= random * 360; |
340 dx.isNegative:= GetRandom(2) = 0; |
289 dx.isNegative:= GetRandom(2) = 0; |
341 dx.QWordValue:= GetRandom(100000000); |
290 dx.QWordValue:= GetRandom(100000000); |
342 dy.isNegative:= false; |
291 dy.isNegative:= false; |
343 dy.QWordValue:= GetRandom(70000000); |
292 dy.QWordValue:= GetRandom(70000000); |
|
293 State:= State or gstInvisible; |
344 if GetRandom(2) = 0 then dx := -dx; |
294 if GetRandom(2) = 0 then dx := -dx; |
345 Health:= random(vobFrameTicks); |
295 Health:= random(vobFrameTicks); |
346 Timer:= random(vobFramesCount); |
296 Timer:= random(vobFramesCount); |
347 Angle:= (random(2) * 2 - 1) * (1 + random(10000)) * vobVelocity |
297 Angle:= (random(2) * 2 - 1) * (1 + random(10000)) * vobVelocity |
348 end |
298 end |
1683 if ( (x = 0) and (y = 0) ) then FindPlace(FollowGear, true, 0, LAND_WIDTH); |
1636 if ( (x = 0) and (y = 0) ) then FindPlace(FollowGear, true, 0, LAND_WIDTH); |
1684 |
1637 |
1685 SpawnCustomCrateAt := FollowGear; |
1638 SpawnCustomCrateAt := FollowGear; |
1686 end; |
1639 end; |
1687 |
1640 |
1688 function SpawnFakeCrateAt(x, y: LongInt; crate: TCrateType; trap: boolean): PGear; |
1641 function SpawnFakeCrateAt(x, y: LongInt; crate: TCrateType; explode: boolean; poison: boolean): PGear; |
1689 begin |
1642 begin |
1690 FollowGear := AddGear(x, y, gtCase, 0, _0, _0, 0); |
1643 FollowGear := AddGear(x, y, gtCase, 0, _0, _0, 0); |
1691 cCaseFactor := 0; |
1644 cCaseFactor := 0; |
|
1645 FollowGear^.Pos := posCaseDummy; |
1692 |
1646 |
1693 if trap then FollowGear^.Pos := posCaseTrap |
1647 if explode then FollowGear^.Pos := FollowGear^.Pos + posCaseExplode; |
1694 else FollowGear^.Pos := posCaseDummy; |
1648 if poison then FollowGear^.Pos := FollowGear^.Pos + posCasePoison; |
1695 |
1649 |
1696 case crate of |
1650 case crate of |
1697 HealthCrate: begin |
1651 HealthCrate: begin |
1698 FollowGear^.Pos := FollowGear^.Pos + posCaseHealth; |
1652 FollowGear^.Pos := FollowGear^.Pos + posCaseHealth; |
1699 AddCaption(GetEventString(eidNewHealthPack), cWhiteColor, capgrpAmmoInfo); |
1653 AddCaption(GetEventString(eidNewHealthPack), cWhiteColor, capgrpAmmoInfo); |