hedgewars/uGears.pas
changeset 2716 b9ca1bfca24f
parent 2699 249adefa9c1c
child 2726 a84fc5113d01
equal deleted inserted replaced
2715:0e4e0db79e2a 2716:b9ca1bfca24f
    19 {$INCLUDE "options.inc"}
    19 {$INCLUDE "options.inc"}
    20 
    20 
    21 unit uGears;
    21 unit uGears;
    22 interface
    22 interface
    23 uses SDLh, uConsts, uFloat;
    23 uses SDLh, uConsts, uFloat;
    24 const AllInactive: boolean = false;
    24 
    25       PrvInactive: boolean = false;
    25     
    26 
    26 type
    27 type PGear = ^TGear;
    27 	PGear = ^TGear;
    28 	TGearStepProcedure = procedure (Gear: PGear);
    28 	TGearStepProcedure = procedure (Gear: PGear);
    29 	TGear = record
    29 	TGear = record
    30 			NextGear, PrevGear: PGear;
    30 			NextGear, PrevGear: PGear;
    31 			Active: Boolean;
    31 			Active: Boolean;
    32 			Invulnerable: Boolean;
    32 			Invulnerable: Boolean;
    55 			Z: Longword;
    55 			Z: Longword;
    56 			IntersectGear: PGear;
    56 			IntersectGear: PGear;
    57 			TriggerId: Longword;
    57 			TriggerId: Longword;
    58 			FlightTime: Longword;
    58 			FlightTime: Longword;
    59 			uid: Longword
    59 			uid: Longword
    60 			end;
    60 		end;
    61 
    61 
       
    62 var AllInactive: boolean;
       
    63     PrvInactive: boolean;
       
    64     CurAmmoGear: PGear;
       
    65     GearsList: PGear;
       
    66     KilledHHs: Longword;
       
    67     SuddenDeathDmg: Boolean;
       
    68     SpeechType: Longword;
       
    69     SpeechText: shortstring;
       
    70     TrainingTargetGear: PGear;
       
    71     skipFlag: boolean;
       
    72     
    62 procedure init_uGears;
    73 procedure init_uGears;
    63 procedure free_uGears;
    74 procedure free_uGears;
    64 function  AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear;
    75 function  AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear;
    65 procedure ProcessGears;
    76 procedure ProcessGears;
    66 procedure ResetUtilities;
    77 procedure ResetUtilities;
    71 procedure FreeGearsList;
    82 procedure FreeGearsList;
    72 procedure AddMiscGears;
    83 procedure AddMiscGears;
    73 procedure AssignHHCoords;
    84 procedure AssignHHCoords;
    74 procedure InsertGearToList(Gear: PGear);
    85 procedure InsertGearToList(Gear: PGear);
    75 procedure RemoveGearFromList(Gear: PGear);
    86 procedure RemoveGearFromList(Gear: PGear);
    76 
       
    77 var CurAmmoGear: PGear;
       
    78     GearsList: PGear;
       
    79     KilledHHs: Longword;
       
    80     SuddenDeathDmg: Boolean;
       
    81     SpeechType: Longword;
       
    82     SpeechText: shortstring;
       
    83     TrainingTargetGear: PGear;
       
    84     skipFlag: boolean;
       
    85 
    87 
    86 implementation
    88 implementation
    87 uses uWorld, uMisc, uStore, uConsole, uSound, uTeams, uRandom, uCollisions, uLand, uIO, uLandGraphics,
    89 uses uWorld, uMisc, uStore, uConsole, uSound, uTeams, uRandom, uCollisions, uLand, uIO, uLandGraphics,
    88 	uAIMisc, uLocale, uAI, uAmmos, uTriggers, uStats, uVisualGears,
    90 	uAIMisc, uLocale, uAI, uAmmos, uTriggers, uStats, uVisualGears,
    89 {$IFDEF GLES11}
    91 {$IFDEF GLES11}
  1532 end;
  1534 end;
  1533 
  1535 
  1534 procedure FreeGearsList;
  1536 procedure FreeGearsList;
  1535 var t, tt: PGear;
  1537 var t, tt: PGear;
  1536 begin
  1538 begin
  1537 tt:= GearsList;
  1539 	tt:= GearsList;
  1538 GearsList:= nil;
  1540 	GearsList:= nil;
  1539 while tt <> nil do
  1541 	while tt <> nil do
  1540 	begin
  1542 	begin
  1541 	t:= tt;
  1543 		t:= tt;
  1542 	tt:= tt^.NextGear;
  1544 		tt:= tt^.NextGear;
  1543 	Dispose(t)
  1545 		Dispose(t)
  1544 	end;
  1546 	end;
  1545 end;
  1547 end;
  1546 
  1548 
  1547 procedure AddMiscGears;
  1549 procedure AddMiscGears;
  1548 var i: LongInt;
  1550 var i: LongInt;
  2049 	KilledHHs:= 0;
  2051 	KilledHHs:= 0;
  2050 	SuddenDeathDmg:= false;
  2052 	SuddenDeathDmg:= false;
  2051 	SpeechType:= 1;
  2053 	SpeechType:= 1;
  2052 	TrainingTargetGear:= nil;
  2054 	TrainingTargetGear:= nil;
  2053 	skipFlag:= false;
  2055 	skipFlag:= false;
       
  2056 	
       
  2057 	AllInactive:= false;
       
  2058 	PrvInactive:= false;
  2054 end;
  2059 end;
  2055 
  2060 
  2056 procedure free_uGears;
  2061 procedure free_uGears;
  2057 begin
  2062 begin
  2058 	FreeGearsList();
  2063 	FreeGearsList();