hedgewars/uGears.pas
changeset 1259 0c660c3d98a4
parent 1257 40d37fefdbb4
child 1261 903058d382c7
equal deleted inserted replaced
1258:2a9843339910 1259:0c660c3d98a4
    22 {$INCLUDE options.inc}
    22 {$INCLUDE options.inc}
    23 const AllInactive: boolean = false;
    23 const AllInactive: boolean = false;
    24       PrvInactive: boolean = false;
    24       PrvInactive: boolean = false;
    25 
    25 
    26 type PGear = ^TGear;
    26 type PGear = ^TGear;
    27      TGearStepProcedure = procedure (Gear: PGear);
    27 	TGearStepProcedure = procedure (Gear: PGear);
    28      TGear = record
    28 	TGear = record
    29              NextGear, PrevGear: PGear;
    29 			NextGear, PrevGear: PGear;
    30              Active: Boolean;
    30 			Active: Boolean;
    31              Ammo : PAmmo;
    31 			Ammo : PAmmo;
    32              State : Longword;
    32 			State : Longword;
    33              X : hwFloat;
    33 			X : hwFloat;
    34              Y : hwFloat;
    34 			Y : hwFloat;
    35              dX: hwFloat;
    35 			dX: hwFloat;
    36              dY: hwFloat;
    36 			dY: hwFloat;
    37              Kind: TGearType;
    37 			Kind: TGearType;
    38              Pos: Longword;
    38 			Pos: Longword;
    39              doStep: TGearStepProcedure;
    39 			doStep: TGearStepProcedure;
    40              Radius: LongInt;
    40 			Radius: LongInt;
    41              Angle, Power : Longword;
    41 			Angle, Power : Longword;
    42              DirAngle: real;
    42 			DirAngle: real;
    43              Timer : LongWord;
    43 			Timer : LongWord;
    44              Elasticity: hwFloat;
    44 			Elasticity: hwFloat;
    45              Friction  : hwFloat;
    45 			Friction  : hwFloat;
    46              Message, MsgParam : Longword;
    46 			Message, MsgParam : Longword;
    47              Hedgehog: pointer;
    47 			Hedgehog: pointer;
    48              Health, Damage: LongInt;
    48 			Health, Damage: LongInt;
    49              CollisionIndex: LongInt;
    49 			CollisionIndex: LongInt;
    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              end;
    55 			end;
    56 
    56 
    57 function  AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear;
    57 function  AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear;
    58 procedure ProcessGears;
    58 procedure ProcessGears;
    59 procedure SetAllToActive;
    59 procedure SetAllToActive;
    60 procedure SetAllHHToActive;
    60 procedure SetAllHHToActive;
    69     GearsList: PGear = nil;
    69     GearsList: PGear = nil;
    70     KilledHHs: Longword = 0;
    70     KilledHHs: Longword = 0;
    71 
    71 
    72 implementation
    72 implementation
    73 uses uWorld, uMisc, uStore, uConsole, uSound, uTeams, uRandom, uCollisions,
    73 uses uWorld, uMisc, uStore, uConsole, uSound, uTeams, uRandom, uCollisions,
    74      uLand, uIO, uLandGraphics, uAIMisc, uLocale, uAI, uAmmos, uTriggers, GL,
    74 	uLand, uIO, uLandGraphics, uAIMisc, uLocale, uAI, uAmmos, uTriggers, GL,
    75      uStats, uVisualGears;
    75 	uStats, uVisualGears;
    76 
    76 
    77 const MAXROPEPOINTS = 384;
    77 const MAXROPEPOINTS = 384;
    78 var RopePoints: record
    78 var RopePoints: record
    79                 Count: Longword;
    79                 Count: Longword;
    80                 HookAngle: GLfloat;
    80                 HookAngle: GLfloat;
   100 
   100 
   101 {$INCLUDE GSHandlers.inc}
   101 {$INCLUDE GSHandlers.inc}
   102 {$INCLUDE HHHandlers.inc}
   102 {$INCLUDE HHHandlers.inc}
   103 
   103 
   104 const doStepHandlers: array[TGearType] of TGearStepProcedure = (
   104 const doStepHandlers: array[TGearType] of TGearStepProcedure = (
   105                                                                @doStepBomb,
   105 			@doStepBomb,
   106                                                                @doStepHedgehog,
   106 			@doStepHedgehog,
   107                                                                @doStepGrenade,
   107 			@doStepGrenade,
   108                                                                @doStepHealthTag,
   108 			@doStepHealthTag,
   109                                                                @doStepGrave,
   109 			@doStepGrave,
   110                                                                @doStepUFO,
   110 			@doStepUFO,
   111                                                                @doStepShotgunShot,
   111 			@doStepShotgunShot,
   112                                                                @doStepPickHammer,
   112 			@doStepPickHammer,
   113                                                                @doStepRope,
   113 			@doStepRope,
   114                                                                @doStepSmokeTrace,
   114 			@doStepSmokeTrace,
   115                                                                @doStepExplosion,
   115 			@doStepExplosion,
   116                                                                @doStepMine,
   116 			@doStepMine,
   117                                                                @doStepCase,
   117 			@doStepCase,
   118                                                                @doStepDEagleShot,
   118 			@doStepDEagleShot,
   119                                                                @doStepDynamite,
   119 			@doStepDynamite,
   120                                                                @doStepTeamHealthSorter,
   120 			@doStepTeamHealthSorter,
   121                                                                @doStepBomb,
   121 			@doStepBomb,
   122                                                                @doStepCluster,
   122 			@doStepCluster,
   123                                                                @doStepShover,
   123 			@doStepShover,
   124                                                                @doStepFlame,
   124 			@doStepFlame,
   125                                                                @doStepFirePunch,
   125 			@doStepFirePunch,
   126                                                                @doStepActionTimer,
   126 			@doStepActionTimer,
   127                                                                @doStepActionTimer,
   127 			@doStepActionTimer,
   128                                                                @doStepActionTimer,
   128 			@doStepActionTimer,
   129                                                                @doStepParachute,
   129 			@doStepParachute,
   130                                                                @doStepAirAttack,
   130 			@doStepAirAttack,
   131                                                                @doStepAirBomb,
   131 			@doStepAirBomb,
   132                                                                @doStepBlowTorch,
   132 			@doStepBlowTorch,
   133                                                                @doStepGirder,
   133 			@doStepGirder,
   134                                                                @doStepTeleport,
   134 			@doStepTeleport,
   135                                                                @doStepHealthTag,
   135 			@doStepHealthTag,
   136                                                                @doStepSwitcher,
   136 			@doStepSwitcher,
   137                                                                @doStepCase,
   137 			@doStepCase,
   138                                                                @doStepMortar,
   138 			@doStepMortar,
   139                                                                @doStepWhip,
   139 			@doStepWhip,
   140                                                                @doStepKamikaze,
   140 			@doStepKamikaze,
   141                                                                @doStepCake
   141 			@doStepCake,
   142                                                                );
   142 			@doStepSeduction
       
   143 			);
   143 
   144 
   144 procedure InsertGearToList(Gear: PGear);
   145 procedure InsertGearToList(Gear: PGear);
   145 var tmp, ptmp: PGear;
   146 var tmp, ptmp: PGear;
   146 begin
   147 begin
   147 if GearsList = nil then
   148 if GearsList = nil then