hedgewars/uGears.pas
changeset 3331 8e05feb871c3
parent 3322 80afcb97eb46
child 3334 f94a52a763d4
equal deleted inserted replaced
3330:987ec27b6042 3331:8e05feb871c3
   623 const delay: LongWord = 0;
   623 const delay: LongWord = 0;
   624     step: (stDelay, stChDmg, stSweep, stTurnReact,
   624     step: (stDelay, stChDmg, stSweep, stTurnReact,
   625             stAfterDelay, stChWin, stWater, stChWin2, stHealth,
   625             stAfterDelay, stChWin, stWater, stChWin2, stHealth,
   626             stSpawn, stNTurn) = stDelay;
   626             stSpawn, stNTurn) = stDelay;
   627 var Gear, t: PGear;
   627 var Gear, t: PGear;
       
   628     i: LongInt;
       
   629     s: shortstring;
   628 begin
   630 begin
   629 PrvInactive:= AllInactive;
   631 PrvInactive:= AllInactive;
   630 AllInactive:= true;
   632 AllInactive:= true;
   631 
   633 
   632 if (StepSoundTimer > 0) and (StepSoundChannel < 0) then
   634 if (StepSoundTimer > 0) and (StepSoundChannel < 0) then
   695             CheckForWin;
   697             CheckForWin;
   696             inc(step)
   698             inc(step)
   697             end;
   699             end;
   698     stWater: if (not bBetweenTurns) and (not isInMultiShoot) then
   700     stWater: if (not bBetweenTurns) and (not isInMultiShoot) then
   699                 begin
   701                 begin
   700                 if TotalRounds = cSuddenDTurns + 2 then bWaterRising:= true;
   702                 if TotalRounds = cSuddenDTurns + 1 then bWaterRising:= true;
   701 
   703 
   702                 if bWaterRising then
   704                 if bWaterRising then
   703                 AddGear(0, 0, gtWaterUp, 0, _0, _0, 0);
   705                 AddGear(0, 0, gtWaterUp, 0, _0, _0, 0);
   704 
   706 
   705                 inc(step)
   707                 inc(step)
   707     stChWin2: begin
   709     stChWin2: begin
   708             CheckForWin;
   710             CheckForWin;
   709             inc(step)
   711             inc(step)
   710             end;
   712             end;
   711     stHealth: begin
   713     stHealth: begin
   712             if (TotalRounds = cSuddenDTurns) and (cHealthDecrease = 0) then
   714             if (TotalRounds = cSuddenDTurns - 1) and (cHealthDecrease = 0) then
   713                 begin
   715                 begin
   714                 cHealthDecrease:= 5;
   716                 cHealthDecrease:= 5;
   715                 AddCaption(trmsg[sidSuddenDeath], cWhiteColor, capgrpGameState);
   717                 AddCaption(trmsg[sidSuddenDeath], cWhiteColor, capgrpGameState);
   716                 playSound(sndSuddenDeath)
   718                 playSound(sndSuddenDeath)
   717                 end;
   719                 end
   718 
   720             else if (TotalRounds < cSuddenDTurns - 1) then
       
   721                 begin
       
   722                 i:= cSuddenDTurns - TotalRounds - 1;
       
   723                 s:= inttostr(i);
       
   724                 if i = 1 then
       
   725                     AddCaption(trmsg[sidRoundSD], cWhiteColor, capgrpGameState)
       
   726                 else if i in [2, 5, 10, 15, 20, 25, 50, 100] then
       
   727                     AddCaption(Format(trmsg[sidRoundsSD], s), cWhiteColor, capgrpGameState);
       
   728                 end;
   719             if bBetweenTurns
   729             if bBetweenTurns
   720                 or isInMultiShoot
   730                 or isInMultiShoot
   721                 or (TotalRounds = -1) then inc(step)
   731                 or (TotalRounds = -1) then inc(step)
   722             else begin
   732             else begin
   723                 bBetweenTurns:= true;
   733                 bBetweenTurns:= true;
  2201 if t<h then
  2211 if t<h then
  2202     begin
  2212     begin
  2203     FollowGear:= AddGear(0, 0, gtCase, 0, _0, _0, 0);
  2213     FollowGear:= AddGear(0, 0, gtCase, 0, _0, _0, 0);
  2204     FollowGear^.Health:= 25;
  2214     FollowGear^.Health:= 25;
  2205     FollowGear^.Pos:= posCaseHealth;
  2215     FollowGear^.Pos:= posCaseHealth;
  2206     AddCaption(GetEventString(eidNewHealthPack), cWhiteColor, capgrpGameState);
  2216     AddCaption(GetEventString(eidNewHealthPack), cWhiteColor, capgrpAmmoInfo);
  2207     end
  2217     end
  2208 else if (t<a+h) then
  2218 else if (t<a+h) then
  2209     begin
  2219     begin
  2210     t:= aTot;
  2220     t:= aTot;
  2211     if (t > 0) then
  2221     if (t > 0) then
  2221           if (Ammoz[i].Ammo.Propz and ammoprop_Utility) = 0 then
  2231           if (Ammoz[i].Ammo.Propz and ammoprop_Utility) = 0 then
  2222               dec(t, Ammoz[i].Probability)
  2232               dec(t, Ammoz[i].Probability)
  2223           end;
  2233           end;
  2224         FollowGear^.Pos:= posCaseAmmo;
  2234         FollowGear^.Pos:= posCaseAmmo;
  2225         FollowGear^.State:= Longword(i);
  2235         FollowGear^.State:= Longword(i);
  2226         AddCaption(GetEventString(eidNewAmmoPack), cWhiteColor, capgrpGameState);
  2236         AddCaption(GetEventString(eidNewAmmoPack), cWhiteColor, capgrpAmmoInfo);
  2227         end
  2237         end
  2228     end
  2238     end
  2229 else
  2239 else
  2230     begin
  2240     begin
  2231     t:= uTot;
  2241     t:= uTot;
  2242           if (Ammoz[i].Ammo.Propz and ammoprop_Utility) <> 0 then
  2252           if (Ammoz[i].Ammo.Propz and ammoprop_Utility) <> 0 then
  2243               dec(t, Ammoz[i].Probability)
  2253               dec(t, Ammoz[i].Probability)
  2244           end;
  2254           end;
  2245         FollowGear^.Pos:= posCaseUtility;
  2255         FollowGear^.Pos:= posCaseUtility;
  2246         FollowGear^.State:= Longword(i);
  2256         FollowGear^.State:= Longword(i);
  2247         AddCaption(GetEventString(eidNewUtilityPack), cWhiteColor, capgrpGameState);
  2257         AddCaption(GetEventString(eidNewUtilityPack), cWhiteColor, capgrpAmmoInfo);
  2248         end
  2258         end
  2249     end;
  2259     end;
  2250 
  2260 
  2251 // handles case of no ammo or utility crates - considered also placing booleans in uAmmos and altering probabilities
  2261 // handles case of no ammo or utility crates - considered also placing booleans in uAmmos and altering probabilities
  2252 if (FollowGear <> nil) then
  2262 if (FollowGear <> nil) then