57 |
57 |
58 implementation |
58 implementation |
59 uses uStore, uSound, uTeams, uRandom, uCollisions, uIO, uLandGraphics, |
59 uses uStore, uSound, uTeams, uRandom, uCollisions, uIO, uLandGraphics, |
60 uLocale, uAI, uAmmos, uStats, uVisualGears, uScript, GLunit, uMobile, uVariables, |
60 uLocale, uAI, uAmmos, uStats, uVisualGears, uScript, GLunit, uMobile, uVariables, |
61 uCommands, uUtils, uTextures, uRenderUtils, uGearsRender, uCaptions, uDebug, uLandTexture, |
61 uCommands, uUtils, uTextures, uRenderUtils, uGearsRender, uCaptions, uDebug, uLandTexture, |
62 uGearsHedgehog, uGearsUtils, uGearsList, uGearsHandlers; |
62 uGearsHedgehog, uGearsUtils, uGearsList, uGearsHandlers, uGearsHandlersRope; |
63 |
63 |
64 var skipFlag: boolean; |
64 var skipFlag: boolean; |
65 |
65 |
66 procedure AmmoShove(Ammo: PGear; Damage, Power: LongInt); forward; |
66 procedure AmmoShove(Ammo: PGear; Damage, Power: LongInt); forward; |
67 //procedure AmmoFlameWork(Ammo: PGear); forward; |
67 //procedure AmmoFlameWork(Ammo: PGear); forward; |
75 delay2: LongWord; |
75 delay2: LongWord; |
76 step: (stDelay, stChDmg, stSweep, stTurnReact, |
76 step: (stDelay, stChDmg, stSweep, stTurnReact, |
77 stAfterDelay, stChWin, stWater, stChWin2, stHealth, |
77 stAfterDelay, stChWin, stWater, stChWin2, stHealth, |
78 stSpawn, stNTurn); |
78 stSpawn, stNTurn); |
79 upd: Longword; |
79 upd: Longword; |
|
80 snowLeft,snowRight: LongInt; |
80 //SDMusic: shortstring; |
81 //SDMusic: shortstring; |
81 |
82 |
82 // For better maintainability the step handlers of gears are stored in |
83 // For better maintainability the step handlers of gears are stored in |
83 // separate files. |
84 // separate files. |
84 // Note: step handlers of gears that are hedgehogs are in a different file |
85 // Note: step handlers of gears that are hedgehogs are in a different file |
204 while t <> nil do |
205 while t <> nil do |
205 begin |
206 begin |
206 curHandledGear:= t; |
207 curHandledGear:= t; |
207 t:= curHandledGear^.NextGear; |
208 t:= curHandledGear^.NextGear; |
208 |
209 |
209 if curHandledGear^.Message and gmRemoveFromList <> 0 then |
210 if curHandledGear^.Message and gmDelete <> 0 then |
210 begin |
211 DeleteGear(curHandledGear) |
211 RemoveGearFromList(curHandledGear); |
212 else |
212 // since I can't think of any good reason this would ever be separate from a remove from list, going to keep it inside this block |
213 begin |
213 if curHandledGear^.Message and gmAddToList <> 0 then InsertGearToList(curHandledGear); |
214 if curHandledGear^.Message and gmRemoveFromList <> 0 then |
214 curHandledGear^.Message:= curHandledGear^.Message and not (gmRemoveFromList or gmAddToList) |
215 begin |
215 end; |
216 RemoveGearFromList(curHandledGear); |
216 if curHandledGear^.Active then |
217 // since I can't think of any good reason this would ever be separate from a remove from list, going to keep it inside this block |
217 begin |
218 if curHandledGear^.Message and gmAddToList <> 0 then InsertGearToList(curHandledGear); |
218 if curHandledGear^.RenderTimer and (curHandledGear^.Timer > 500) and ((curHandledGear^.Timer mod 1000) = 0) then |
219 curHandledGear^.Message:= curHandledGear^.Message and (not (gmRemoveFromList or gmAddToList)) |
219 begin |
220 end; |
220 FreeTexture(curHandledGear^.Tex); |
221 if curHandledGear^.Active then |
221 curHandledGear^.Tex:= RenderStringTex(inttostr(curHandledGear^.Timer div 1000), cWhiteColor, fntSmall); |
222 begin |
222 end; |
223 if curHandledGear^.RenderTimer and (curHandledGear^.Timer > 500) and ((curHandledGear^.Timer mod 1000) = 0) then |
223 curHandledGear^.doStep(curHandledGear); |
224 begin |
224 // might be useful later |
225 FreeTexture(curHandledGear^.Tex); |
225 //ScriptCall('onGearStep', Gear^.uid); |
226 curHandledGear^.Tex:= RenderStringTex(inttostr(curHandledGear^.Timer div 1000), cWhiteColor, fntSmall); |
|
227 end; |
|
228 curHandledGear^.doStep(curHandledGear); |
|
229 // might be useful later |
|
230 //ScriptCall('onGearStep', Gear^.uid); |
|
231 end |
226 end |
232 end |
227 end; |
233 end; |
228 curHandledGear:= nil; |
234 curHandledGear:= nil; |
229 |
235 |
230 if AllInactive then |
236 if AllInactive then |
632 if (GameFlags and gfLaserSight) <> 0 then |
638 if (GameFlags and gfLaserSight) <> 0 then |
633 cLaserSighting:= true; |
639 cLaserSighting:= true; |
634 |
640 |
635 if (GameFlags and gfArtillery) <> 0 then |
641 if (GameFlags and gfArtillery) <> 0 then |
636 cArtillery:= true; |
642 cArtillery:= true; |
637 |
643 for i:= GetRandom(10)+30 downto 0 do |
638 for i:= 0 to GetRandom(10)+30 do |
644 begin |
639 begin rx:= GetRandom(rightX-leftX)+leftX; |
645 rx:= GetRandom(rightX-leftX)+leftX; |
640 ry:= GetRandom(LAND_HEIGHT-topY)+topY; |
646 ry:= GetRandom(LAND_HEIGHT-topY)+topY; |
641 rdx:= _90-(GetRandomf*_360); |
647 rdx:= _90-(GetRandomf*_360); |
642 rdy:= _90-(GetRandomf*_360); |
648 rdy:= _90-(GetRandomf*_360); |
643 AddGear(rx, ry, gtGenericFaller, gstInvisible, rdx, rdy, $FFFFFFFF); |
649 AddGear(rx, ry, gtGenericFaller, gstInvisible, rdx, rdy, $FFFFFFFF); |
644 end; |
650 end; |
645 |
651 |
|
652 snowRight:= max(LAND_WIDTH,4096)+512; |
|
653 snowLeft:= -(snowRight-LAND_WIDTH); |
|
654 |
646 if not hasBorder and ((Theme = 'Snow') or (Theme = 'Christmas')) then |
655 if not hasBorder and ((Theme = 'Snow') or (Theme = 'Christmas')) then |
647 for i:= 0 to Pred(vobCount*2) do |
656 for i:= vobCount * max(LAND_WIDTH,4096) div 2048 downto 1 do |
648 AddGear(GetRandom(LAND_WIDTH+1024)-512, LAND_HEIGHT - GetRandom(LAND_HEIGHT div 2), gtFlake, 0, _0, _0, 0); |
657 AddGear(GetRandom(snowRight-snowLeft)+snowLeft, LAND_HEIGHT-1300+GetRandom(750), gtFlake, 0, _0, _0, 0); |
649 end; |
658 end; |
650 |
659 |
651 |
660 |
652 procedure ShotgunShot(Gear: PGear); |
661 procedure ShotgunShot(Gear: PGear); |
653 var t: PGear; |
662 var t: PGear; |