hedgewars/uGears.pas
changeset 6515 74a04089bb56
parent 6472 bced12412f94
child 6530 dc6ce7eb556b
equal deleted inserted replaced
6514:8ba891d34eba 6515:74a04089bb56
    37 
    37 
    38 procedure initModule;
    38 procedure initModule;
    39 procedure freeModule;
    39 procedure freeModule;
    40 function  SpawnCustomCrateAt(x, y: LongInt; crate: TCrateType; content: Longword ): PGear;
    40 function  SpawnCustomCrateAt(x, y: LongInt; crate: TCrateType; content: Longword ): PGear;
    41 function  SpawnFakeCrateAt(x, y: LongInt; crate: TCrateType; explode: boolean; poison: boolean ): PGear;
    41 function  SpawnFakeCrateAt(x, y: LongInt; crate: TCrateType; explode: boolean; poison: boolean ): PGear;
       
    42 <<<<<<< local
    42 function  GetAmmo: TAmmoType;
    43 function  GetAmmo: TAmmoType;
    43 function  GetUtility: TAmmoType;
    44 function  GetUtility: TAmmoType;
       
    45 =======
       
    46 function  GetAmmo(Hedgehog: PHedgehog): TAmmoType;
       
    47 function  GetUtility(Hedgehog: PHedgehog): TAmmoType;
       
    48 procedure ResurrectHedgehog(gear: PGear);
       
    49 >>>>>>> other
    44 procedure HideHog(HH: PHedgehog);
    50 procedure HideHog(HH: PHedgehog);
    45 procedure RestoreHog(HH: PHedgehog);
    51 procedure RestoreHog(HH: PHedgehog);
    46 procedure ProcessGears;
    52 procedure ProcessGears;
    47 procedure EndTurnCleanup;
    53 procedure EndTurnCleanup;
    48 procedure SetAllToActive;
    54 procedure SetAllToActive;
   348                         ScreenFadeSpeed:= 1;
   354                         ScreenFadeSpeed:= 1;
   349                         
   355                         
   350                         ChangeToSDClouds;
   356                         ChangeToSDClouds;
   351                         ChangeToSDFlakes;
   357                         ChangeToSDFlakes;
   352                         glClearColor(SDSkyColor.r * (SDTint/255) / 255, SDSkyColor.g * (SDTint/255) / 255, SDSkyColor.b * (SDTint/255) / 255, 0.99);
   358                         glClearColor(SDSkyColor.r * (SDTint/255) / 255, SDSkyColor.g * (SDTint/255) / 255, SDSkyColor.b * (SDTint/255) / 255, 0.99);
       
   359                         Ammoz[amTardis].SkipTurns:= 9999;
       
   360                         Ammoz[amTardis].Probability:= 0;
   353                         end;
   361                         end;
   354                     AddCaption(trmsg[sidSuddenDeath], cWhiteColor, capgrpGameState);
   362                     AddCaption(trmsg[sidSuddenDeath], cWhiteColor, capgrpGameState);
   355                     playSound(sndSuddenDeath);
   363                     playSound(sndSuddenDeath);
   356                     StopMusic //No SDMusic for now
   364                     StopMusic //No SDMusic for now
   357                     //MusicFN:= SDMusic;
   365                     //MusicFN:= SDMusic;
  1102     if ( (x = 0) and (y = 0) ) then FindPlace(FollowGear, true, 0, LAND_WIDTH);
  1110     if ( (x = 0) and (y = 0) ) then FindPlace(FollowGear, true, 0, LAND_WIDTH);
  1103 
  1111 
  1104     SpawnFakeCrateAt := FollowGear;
  1112     SpawnFakeCrateAt := FollowGear;
  1105 end;
  1113 end;
  1106 
  1114 
  1107 function GetAmmo: TAmmoType;
  1115 function GetAmmo(Hedgehog: PHedgehog): TAmmoType;
  1108 var t, aTot: LongInt;
  1116 var t, aTot: LongInt;
  1109     i: TAmmoType;
  1117     i: TAmmoType;
  1110 begin
  1118 begin
  1111 
  1119 
  1112 aTot:= 0;
  1120 aTot:= 0;
  1127       end
  1135       end
  1128     end;
  1136     end;
  1129 GetAmmo:= i
  1137 GetAmmo:= i
  1130 end;
  1138 end;
  1131 
  1139 
  1132 function GetUtility: TAmmoType;
  1140 function GetUtility(Hedgehog: PHedgehog): TAmmoType;
  1133 var t, uTot: LongInt;
  1141 var t, uTot: LongInt;
  1134     i: TAmmoType;
  1142     i: TAmmoType;
  1135 begin
  1143 begin
  1136 
  1144 
  1137 uTot:= 0;
  1145 uTot:= 0;
  1138 for i:= Low(TAmmoType) to High(TAmmoType) do
  1146 for i:= Low(TAmmoType) to High(TAmmoType) do
  1139     if (Ammoz[i].Ammo.Propz and ammoprop_Utility) <> 0 then
  1147     if ((Ammoz[i].Ammo.Propz and ammoprop_Utility) <> 0) and ((Hedgehog^.Team^.HedgehogsNumber > 1) or (Ammoz[i].Ammo.AmmoType <> amSwitch)) then
  1140         inc(uTot, Ammoz[i].Probability);
  1148         inc(uTot, Ammoz[i].Probability);
  1141 
  1149 
  1142 t:= uTot;
  1150 t:= uTot;
  1143 i:= Low(TAmmoType);
  1151 i:= Low(TAmmoType);
  1144 if (t > 0) then
  1152 if (t > 0) then
  1145     begin
  1153     begin
  1146     t:= GetRandom(t);
  1154     t:= GetRandom(t);
  1147     while t >= 0 do
  1155     while t >= 0 do
  1148       begin
  1156       begin
  1149       inc(i);
  1157       inc(i);
  1150       if (Ammoz[i].Ammo.Propz and ammoprop_Utility) <> 0 then
  1158       if ((Ammoz[i].Ammo.Propz and ammoprop_Utility) <> 0) and ((Hedgehog^.Team^.HedgehogsNumber > 1) or (Ammoz[i].Ammo.AmmoType <> amSwitch)) then
  1151           dec(t, Ammoz[i].Probability)
  1159           dec(t, Ammoz[i].Probability)
  1152       end
  1160       end
  1153     end;
  1161     end;
  1154 GetUtility:= i
  1162 GetUtility:= i
  1155 end;
  1163 end;