hedgewars/uGearsList.pas
changeset 7028 0f60591f3a16
parent 7010 10a0a31804f3
child 7069 bcf9d8e64e92
equal deleted inserted replaced
7027:f264ad9d8965 7028:0f60591f3a16
    31 
    31 
    32 uses uRandom, uUtils, uConsts, uVariables, uAmmos, uTeams, uStats,
    32 uses uRandom, uUtils, uConsts, uVariables, uAmmos, uTeams, uStats,
    33     uTextures, uScript, uRenderUtils, uAI, uCollisions,
    33     uTextures, uScript, uRenderUtils, uAI, uCollisions,
    34     uGearsRender, uGearsUtils;
    34     uGearsRender, uGearsUtils;
    35 
    35 
       
    36 var GCounter: LongWord = 0; // this doesn't get re-initialized, but should be harmless
       
    37 
    36 procedure InsertGearToList(Gear: PGear);
    38 procedure InsertGearToList(Gear: PGear);
    37 var tmp, ptmp: PGear;
    39 var tmp, ptmp: PGear;
    38 begin
    40 begin
    39     tmp:= GearsList;
    41     tmp:= GearsList;
    40     ptmp:= GearsList;
    42     ptmp:= GearsList;
    72 end;
    74 end;
    73     
    75     
    74 function AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear;
    76 function AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear;
    75 var gear: PGear;
    77 var gear: PGear;
    76 begin
    78 begin
    77 inc(Counter);
    79 inc(GCounter);
    78 AddFileLog('AddGear: #' + inttostr(Counter) + ' (' + inttostr(x) + ',' + inttostr(y) + '), d(' + floattostr(dX) + ',' + floattostr(dY) + ') type = ' + EnumToStr(Kind));
    80 AddFileLog('AddGear: #' + inttostr(GCounter) + ' (' + inttostr(x) + ',' + inttostr(y) + '), d(' + floattostr(dX) + ',' + floattostr(dY) + ') type = ' + EnumToStr(Kind));
    79 
    81 
    80 New(gear);
    82 New(gear);
    81 FillChar(gear^, sizeof(TGear), 0);
    83 FillChar(gear^, sizeof(TGear), 0);
    82 gear^.X:= int2hwFloat(X);
    84 gear^.X:= int2hwFloat(X);
    83 gear^.Y:= int2hwFloat(Y);
    85 gear^.Y:= int2hwFloat(Y);
    89 gear^.dY:= dY;
    91 gear^.dY:= dY;
    90 gear^.doStep:= doStepHandlers[Kind];
    92 gear^.doStep:= doStepHandlers[Kind];
    91 gear^.CollisionIndex:= -1;
    93 gear^.CollisionIndex:= -1;
    92 gear^.Timer:= Timer;
    94 gear^.Timer:= Timer;
    93 gear^.FlightTime:= 0;
    95 gear^.FlightTime:= 0;
    94 gear^.uid:= Counter;
    96 gear^.uid:= GCounter;
    95 gear^.SoundChannel:= -1;
    97 gear^.SoundChannel:= -1;
    96 gear^.ImpactSound:= sndNone;
    98 gear^.ImpactSound:= sndNone;
    97 gear^.nImpactSounds:= 0;
    99 gear^.nImpactSounds:= 0;
    98 gear^.Density:= _1;
   100 gear^.Density:= _1;
    99 // Define ammo association, if any.
   101 // Define ammo association, if any.