hedgewars/uGears.pas
changeset 1503 a40b871d506b
parent 1495 2b2b89bdb5f3
child 1505 3a96e93572cb
equal deleted inserted replaced
1502:db1f1dd12321 1503:a40b871d506b
    50 			Tag: LongInt;
    50 			Tag: LongInt;
    51 			Tex: PTexture;
    51 			Tex: PTexture;
    52 			Z: Longword;
    52 			Z: Longword;
    53 			IntersectGear: PGear;
    53 			IntersectGear: PGear;
    54 			TriggerId: Longword;
    54 			TriggerId: Longword;
       
    55 			uid: Longword;
    55 			end;
    56 			end;
    56 
    57 
    57 function  AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear;
    58 function  AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear;
    58 procedure ProcessGears;
    59 procedure ProcessGears;
    59 procedure SetAllToActive;
    60 procedure SetAllToActive;
   183 const Counter: Longword = 0;
   184 const Counter: Longword = 0;
   184 var Result: PGear;
   185 var Result: PGear;
   185 begin
   186 begin
   186 inc(Counter);
   187 inc(Counter);
   187 {$IFDEF DEBUGFILE}
   188 {$IFDEF DEBUGFILE}
   188 AddFileLog('AddGear: (' + inttostr(x) + ',' + inttostr(y) + '), d(' + floattostr(dX) + ',' + floattostr(dY) + ') type = ' + inttostr(ord(Kind)));
   189 AddFileLog('AddGear: #' + inttostr(Counter) + ' (' + inttostr(x) + ',' + inttostr(y) + '), d(' + floattostr(dX) + ',' + floattostr(dY) + ') type = ' + inttostr(ord(Kind)));
   189 {$ENDIF}
   190 {$ENDIF}
   190 
   191 
   191 New(Result);
   192 New(Result);
   192 FillChar(Result^, sizeof(TGear), 0);
   193 FillChar(Result^, sizeof(TGear), 0);
   193 Result^.X:= int2hwFloat(X);
   194 Result^.X:= int2hwFloat(X);
   199 Result^.dY:= dY;
   200 Result^.dY:= dY;
   200 Result^.doStep:= doStepHandlers[Kind];
   201 Result^.doStep:= doStepHandlers[Kind];
   201 Result^.CollisionIndex:= -1;
   202 Result^.CollisionIndex:= -1;
   202 Result^.Timer:= Timer;
   203 Result^.Timer:= Timer;
   203 Result^.Z:= cUsualZ;
   204 Result^.Z:= cUsualZ;
       
   205 Result^.uid:= Counter;
   204 
   206 
   205 if CurrentTeam <> nil then
   207 if CurrentTeam <> nil then
   206    begin
   208    begin
   207    Result^.Hedgehog:= CurrentHedgehog;
   209    Result^.Hedgehog:= CurrentHedgehog;
   208    Result^.IntersectGear:= CurrentHedgehog^.Gear
   210    Result^.IntersectGear:= CurrentHedgehog^.Gear
   380 		inc(KilledHHs);
   382 		inc(KilledHHs);
   381 		RecountTeamHealth(team);
   383 		RecountTeamHealth(team);
   382 		end;
   384 		end;
   383 
   385 
   384 {$IFDEF DEBUGFILE}
   386 {$IFDEF DEBUGFILE}
   385 with Gear^ do AddFileLog('Delete: (' + inttostr(hwRound(x)) + ',' + inttostr(hwRound(y)) + '), d(' + floattostr(dX) + ',' + floattostr(dY) + ') type = ' + inttostr(ord(Kind)));
   387 with Gear^ do AddFileLog('Delete: #' + inttostr(uid) + ' (' + inttostr(hwRound(x)) + ',' + inttostr(hwRound(y)) + '), d(' + floattostr(dX) + ',' + floattostr(dY) + ') type = ' + inttostr(ord(Kind)));
   386 {$ENDIF}
   388 {$ENDIF}
   387 
   389 
   388 if Gear^.TriggerId <> 0 then TickTrigger(Gear^.TriggerId);
   390 if Gear^.TriggerId <> 0 then TickTrigger(Gear^.TriggerId);
   389 if CurAmmoGear = Gear then CurAmmoGear:= nil;
   391 if CurAmmoGear = Gear then CurAmmoGear:= nil;
   390 if FollowGear = Gear then FollowGear:= nil;
   392 if FollowGear = Gear then FollowGear:= nil;