From: binarymaster Date: Wed, 9 Aug 2017 16:18:14 +0000 (+0300) Subject: Refactor: Add global ammo limits X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=61d62a1b2d465abbb7145ed44e826740e2eaf184;p=d2df-sdl.git Refactor: Add global ammo limits --- diff --git a/src/game/g_player.pas b/src/game/g_player.pas index 1ec0ccd..5f4692f 100644 --- a/src/game/g_player.pas +++ b/src/game/g_player.pas @@ -52,6 +52,10 @@ const A_CELLS = 3; A_HIGH = 3; + AmmoLimits: Array [0..1] of Array [A_BULLETS..A_HIGH] of Word = + ((200, 50, 50, 300), + (400, 100, 100, 600)); + K_SIMPLEKILL = 0; K_HARDKILL = 1; K_EXTRAHARDKILL = 2; @@ -3686,10 +3690,10 @@ begin (FAmmo[A_ROCKETS] < FMaxAmmo[A_ROCKETS]) or (FAmmo[A_CELLS] < FMaxAmmo[A_CELLS]) then begin - FMaxAmmo[A_BULLETS] := 400; - FMaxAmmo[A_SHELLS] := 100; - FMaxAmmo[A_ROCKETS] := 100; - FMaxAmmo[A_CELLS] := 600; + FMaxAmmo[A_BULLETS] := AmmoLimits[1, A_BULLETS]; + FMaxAmmo[A_SHELLS] := AmmoLimits[1, A_SHELLS]; + FMaxAmmo[A_ROCKETS] := AmmoLimits[1, A_ROCKETS]; + FMaxAmmo[A_CELLS] := AmmoLimits[1, A_CELLS]; if FAmmo[A_BULLETS] < FMaxAmmo[A_BULLETS] then IncMax(FAmmo[A_BULLETS], 10, FMaxAmmo[A_BULLETS]); @@ -4126,10 +4130,10 @@ begin FAmmo[A_BULLETS] := 50; - FMaxAmmo[A_BULLETS] := 200; - FMaxAmmo[A_SHELLS] := 50; - FMaxAmmo[A_ROCKETS] := 50; - FMaxAmmo[A_CELLS] := 300; + FMaxAmmo[A_BULLETS] := AmmoLimits[0, A_BULLETS]; + FMaxAmmo[A_SHELLS] := AmmoLimits[0, A_SHELLS]; + FMaxAmmo[A_ROCKETS] := AmmoLimits[0, A_SHELLS]; + FMaxAmmo[A_CELLS] := AmmoLimits[0, A_CELLS]; if gGameSettings.GameMode in [GM_DM, GM_TDM, GM_CTF] then FRulez := [R_KEY_RED, R_KEY_GREEN, R_KEY_BLUE] @@ -5738,10 +5742,10 @@ begin (FAmmo[A_ROCKETS] < FMaxAmmo[A_ROCKETS]) or (FAmmo[A_CELLS] < FMaxAmmo[A_CELLS]) then begin - FMaxAmmo[A_BULLETS] := 400; - FMaxAmmo[A_SHELLS] := 100; - FMaxAmmo[A_ROCKETS] := 100; - FMaxAmmo[A_CELLS] := 600; + FMaxAmmo[A_BULLETS] := AmmoLimits[1, A_BULLETS]; + FMaxAmmo[A_SHELLS] := AmmoLimits[1, A_SHELLS]; + FMaxAmmo[A_ROCKETS] := AmmoLimits[1, A_ROCKETS]; + FMaxAmmo[A_CELLS] := AmmoLimits[1, A_CELLS]; if FAmmo[A_BULLETS] < FMaxAmmo[A_BULLETS] then IncMax(FAmmo[A_BULLETS], 10, FMaxAmmo[A_BULLETS]); if FAmmo[A_SHELLS] < FMaxAmmo[A_SHELLS] then IncMax(FAmmo[A_SHELLS], 4, FMaxAmmo[A_SHELLS]);