hedgewars/uGears.pas
branchwebgl
changeset 8026 4a4f21070479
parent 8011 ffd5eba8f7c2
child 8096 453917e94e55
equal deleted inserted replaced
8023:7de85783b823 8026:4a4f21070479
    51 procedure FreeGearsList;
    51 procedure FreeGearsList;
    52 procedure AddMiscGears;
    52 procedure AddMiscGears;
    53 procedure AssignHHCoords;
    53 procedure AssignHHCoords;
    54 function  GearByUID(uid : Longword) : PGear;
    54 function  GearByUID(uid : Longword) : PGear;
    55 procedure doStepDrowningGear(Gear: PGear);
    55 procedure doStepDrowningGear(Gear: PGear);
    56 
       
    57 
    56 
    58 implementation
    57 implementation
    59 uses uStore, uSound, uTeams, uRandom, uCollisions, uIO, uLandGraphics,
    58 uses uStore, uSound, uTeams, uRandom, uCollisions, uIO, uLandGraphics,
    60     uLocale, uAI, uAmmos, uStats, uVisualGears, uScript, GLunit, uMobile, uVariables,
    59     uLocale, uAI, uAmmos, uStats, uVisualGears, uScript, GLunit, uMobile, uVariables,
    61     uCommands, uUtils, uTextures, uRenderUtils, uGearsRender, uCaptions, uDebug, uLandTexture,
    60     uCommands, uUtils, uTextures, uRenderUtils, uGearsRender, uCaptions, uDebug, uLandTexture,
   598 
   597 
   599 procedure AddMiscGears;
   598 procedure AddMiscGears;
   600 var i,rx, ry: Longword;
   599 var i,rx, ry: Longword;
   601     rdx, rdy: hwFloat;
   600     rdx, rdy: hwFloat;
   602     Gear: PGear;
   601     Gear: PGear;
       
   602     temp: Longword;
   603 begin
   603 begin
   604 AddGear(0, 0, gtATStartGame, 0, _0, _0, 2000);
   604 AddGear(0, 0, gtATStartGame, 0, _0, _0, 2000);
   605 
   605 
   606 i:= 0;
   606 i:= 0;
   607 Gear:= PGear(1);
   607 Gear:= PGear(1);
   641 if (GameFlags and gfLaserSight) <> 0 then
   641 if (GameFlags and gfLaserSight) <> 0 then
   642     cLaserSighting:= true;
   642     cLaserSighting:= true;
   643 
   643 
   644 if (GameFlags and gfArtillery) <> 0 then
   644 if (GameFlags and gfArtillery) <> 0 then
   645     cArtillery:= true;
   645     cArtillery:= true;
       
   646 
   646 for i:= GetRandom(10)+30 downto 0 do
   647 for i:= GetRandom(10)+30 downto 0 do
   647     begin
   648     begin
   648     rx:= GetRandom(rightX-leftX)+leftX;
   649     rx:= GetRandom(rightX-leftX)+leftX;
   649     ry:= GetRandom(LAND_HEIGHT-topY)+topY;
   650     ry:= GetRandom(LAND_HEIGHT-topY)+topY;
   650     rdx:= _90-(GetRandomf*_360);
   651     rdx:= _90-(GetRandomf*_360);
   929 end;
   930 end;
   930 
   931 
   931 var GearsNearArray : TPGearArray;
   932 var GearsNearArray : TPGearArray;
   932 function GearsNear(X, Y: hwFloat; Kind: TGearType; r: LongInt): PGearArrayS;
   933 function GearsNear(X, Y: hwFloat; Kind: TGearType; r: LongInt): PGearArrayS;
   933 var
   934 var
   934     t: PGear;
   935     t  : PGear;
   935     s: Longword;
   936     s: Longword;
   936 begin
   937 begin
   937     r:= r*r;
   938     r:= r*r;
   938     s:= 0;
   939     s:= 0;
   939     SetLength(GearsNearArray, s);
   940     SetLength(GearsNearArray, s);
   946             inc(s);
   947             inc(s);
   947             SetLength(GearsNearArray, s);
   948             SetLength(GearsNearArray, s);
   948             GearsNearArray[s - 1] := t;
   949             GearsNearArray[s - 1] := t;
   949             end;
   950             end;
   950         t := t^.NextGear;
   951         t := t^.NextGear;
   951     end;
   952 	end;
   952 
   953 
   953     GearsNear.size:= s;
   954     GearsNear.size:= s;
   954     GearsNear.ar:= @GearsNearArray
   955     GearsNear.ar:= @GearsNearArray
   955 end;
   956 end;
   956 
   957