DEADSOFTWARE

add 'respawn items' flag
authorfgsfds <pvt.fgsfds@gmail.com>
Sun, 9 Feb 2020 02:17:27 +0000 (05:17 +0300)
committerfgsfds <pvt.fgsfds@gmail.com>
Sun, 9 Feb 2020 02:17:27 +0000 (05:17 +0300)
src/game/g_game.pas
src/game/g_items.pas
src/game/g_language.pas
src/game/g_menu.pas
src/game/g_options.pas

index cf87c940dd9abc81ef4e179bcba5259f7a86c42c..0d31e221c6c5c0950e515552fe1b7ed26396620d 100644 (file)
@@ -180,6 +180,7 @@ const
   GAME_OPTION_BOTVSPLAYER  = 32;
   GAME_OPTION_BOTVSMONSTER = 64;
   GAME_OPTION_DMKEYS       = 128;
   GAME_OPTION_BOTVSPLAYER  = 32;
   GAME_OPTION_BOTVSMONSTER = 64;
   GAME_OPTION_DMKEYS       = 128;
+  GAME_OPTION_RESPAWNITEMS = 256;
 
   STATE_NONE        = 0;
   STATE_MENU        = 1;
 
   STATE_NONE        = 0;
   STATE_MENU        = 1;
@@ -5572,7 +5573,27 @@ begin
         g_Console_Add(_lc[I_MSG_DMKEYS_ON])
       else
         g_Console_Add(_lc[I_MSG_DMKEYS_OFF]);
         g_Console_Add(_lc[I_MSG_DMKEYS_ON])
       else
         g_Console_Add(_lc[I_MSG_DMKEYS_OFF]);
-      g_Console_Add(_lc[I_MSG_ONMAPCHANGE]);
+
+      if g_Game_IsNet then MH_SEND_GameSettings;
+    end;
+  end
+  else if (cmd = 'g_respawn_items') and not g_Game_IsClient then
+  begin
+    with gGameSettings do
+    begin
+      if (Length(P) > 1) and
+         ((P[1] = '1') or (P[1] = '0')) then
+      begin
+        if (P[1][1] = '1') then
+          Options := Options or GAME_OPTION_RESPAWNITEMS
+        else
+          Options := Options and (not GAME_OPTION_RESPAWNITEMS);
+      end;
+
+      if (LongBool(Options and GAME_OPTION_RESPAWNITEMS)) then
+        g_Console_Add(_lc[I_MSG_RESPAWNITEMS_ON])
+      else
+        g_Console_Add(_lc[I_MSG_RESPAWNITEMS_OFF]);
 
       if g_Game_IsNet then MH_SEND_GameSettings;
     end;
 
       if g_Game_IsNet then MH_SEND_GameSettings;
     end;
index 8efa5ca9fb4626cd1907e805d640db44e5153033..07c4df2b1d8e929832c6ac67b97f548de27b3d4d 100644 (file)
@@ -453,8 +453,10 @@ begin
   it.slotIsUsed := true;
 
   it.ItemType := ItemType;
   it.slotIsUsed := true;
 
   it.ItemType := ItemType;
-  it.Respawnable := Respawnable;
-  if g_Game_IsServer and (ITEM_RESPAWNTIME = 0) then it.Respawnable := False;
+  if g_Game_IsServer and ((ITEM_RESPAWNTIME = 0) or not LongBool(gGameSettings.Options and GAME_OPTION_RESPAWNITEMS)) then
+    it.Respawnable := False
+  else
+    it.Respawnable := Respawnable;
   it.InitX := X;
   it.InitY := Y;
   it.RespawnTime := 0;
   it.InitX := X;
   it.InitY := Y;
   it.RespawnTime := 0;
index 8ccc8ea8a70e2eb9229530e659de6f7e7cb8af29..1aad7c6823c3cc7fcb061768556076f6b1de918d 100644 (file)
@@ -162,6 +162,7 @@ type
     I_MENU_GOAL_LIMIT,
     I_MENU_MAX_LIVES,
     I_MENU_TEAM_DAMAGE,
     I_MENU_GOAL_LIMIT,
     I_MENU_MAX_LIVES,
     I_MENU_TEAM_DAMAGE,
+    I_MENU_RESPAWN_ITEMS,
     I_MENU_ENABLE_EXITS,
     I_MENU_WEAPONS_STAY,
     I_MENU_ENABLE_MONSTERS,
     I_MENU_ENABLE_EXITS,
     I_MENU_WEAPONS_STAY,
     I_MENU_ENABLE_MONSTERS,
@@ -573,6 +574,8 @@ type
     I_MSG_ALLOWMON_OFF,
     I_MSG_DMKEYS_ON,
     I_MSG_DMKEYS_OFF,
     I_MSG_ALLOWMON_OFF,
     I_MSG_DMKEYS_ON,
     I_MSG_DMKEYS_OFF,
+    I_MSG_RESPAWNITEMS_ON,
+    I_MSG_RESPAWNITEMS_OFF,
     I_MSG_BOTSVSPLAYERS_ON,
     I_MSG_BOTSVSPLAYERS_OFF,
     I_MSG_BOTSVSMONSTERS_ON,
     I_MSG_BOTSVSPLAYERS_ON,
     I_MSG_BOTSVSPLAYERS_OFF,
     I_MSG_BOTSVSMONSTERS_ON,
@@ -920,6 +923,8 @@ const
                                        'Æèçíè:'),
     ('MENU TEAM DAMAGE',               'Friendly Fire:',
                                        'Óðîí ñâîèõ:'),
                                        'Æèçíè:'),
     ('MENU TEAM DAMAGE',               'Friendly Fire:',
                                        'Óðîí ñâîèõ:'),
+    ('MENU RESPAWN ITEMS',             'Respawn Items:',
+                                       'Ðåñïàâíèòü ïðåäìåòû:'),
     ('MENU ENABLE EXITS',              'Enable Exit:',
                                        'Âêëþ÷èòü âûõîä:'),
     ('MENU WEAPONS STAY',              'Weapons stay:',
     ('MENU ENABLE EXITS',              'Enable Exit:',
                                        'Âêëþ÷èòü âûõîä:'),
     ('MENU WEAPONS STAY',              'Weapons stay:',
@@ -1699,10 +1704,14 @@ const
                                        'Ìîíñòðû â DM âêëþ÷åíû*'),
     ('MSG ALLOWMON OFF',               'Monsters in DM disabled*',
                                        'Ìîíñòðû â DM âûêëþ÷åíû*'),
                                        'Ìîíñòðû â DM âêëþ÷åíû*'),
     ('MSG ALLOWMON OFF',               'Monsters in DM disabled*',
                                        'Ìîíñòðû â DM âûêëþ÷åíû*'),
-    ('MSG DMKEYS ON',                  'Spawning with all keys in DM enabled*',
-                                       'Ðåñïàâí ñî âñåìè êëþ÷àìè â DM âêëþ÷åí*'),
-    ('MSG DMKEYS OFF',                 'Spawning with all keys in DM disabled*',
-                                       'Ðåñïàâí ñî âñåìè êëþ÷àìè â DM âûêëþ÷åí*'),
+    ('MSG DMKEYS ON',                  'Spawning with all keys in DM enabled',
+                                       'Ðåñïàâí ñî âñåìè êëþ÷àìè â DM âêëþ÷åí'),
+    ('MSG DMKEYS OFF',                 'Spawning with all keys in DM disabled',
+                                       'Ðåñïàâí ñî âñåìè êëþ÷àìè â DM âûêëþ÷åí'),
+    ('MSG RESPAWNITEMS ON',            'Respawning items enabled',
+                                       'Ðåñïàâí ïðåäìåòîâ âêëþ÷åí'),
+    ('MSG RESPAWNITEMS OFF',           'Respawning items disabled',
+                                       'Ðåñïàâí ïðåäìåòîâ âûêëþ÷åí'),
     ('MSG BOTSVSPLAYERS ON',           'Bots attack players',
                                        'Áîòû ïðîòèâ èãðîêîâ'),
     ('MSG BOTSVSPLAYERS OFF',          'Bots ignore players',
     ('MSG BOTSVSPLAYERS ON',           'Bots attack players',
                                        'Áîòû ïðîòèâ èãðîêîâ'),
     ('MSG BOTSVSPLAYERS OFF',          'Bots ignore players',
index 3cfec36d6f79ba50f00c1d6c9748991bf9fe71b7..8331660c6107c21c00137101818cc3ce0aa28a37 100644 (file)
@@ -667,12 +667,15 @@ begin
     gcMaxLives := StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
 
     gcTeamDamage := TGUISwitch(GetControl('swTeamDamage')).ItemIndex = 0;
     gcMaxLives := StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
 
     gcTeamDamage := TGUISwitch(GetControl('swTeamDamage')).ItemIndex = 0;
+    gcRespawnItems := TGUISwitch(GetControl('swRespawnItems')).ItemIndex = 0;
     gcAllowExit := TGUISwitch(GetControl('swEnableExits')).ItemIndex = 0;
     gcWeaponStay := TGUISwitch(GetControl('swWeaponStay')).ItemIndex = 0;
     gcMonsters := TGUISwitch(GetControl('swMonsters')).ItemIndex = 0;
     Options := 0;
     if gcTeamDamage then
       Options := Options or GAME_OPTION_TEAMDAMAGE;
     gcAllowExit := TGUISwitch(GetControl('swEnableExits')).ItemIndex = 0;
     gcWeaponStay := TGUISwitch(GetControl('swWeaponStay')).ItemIndex = 0;
     gcMonsters := TGUISwitch(GetControl('swMonsters')).ItemIndex = 0;
     Options := 0;
     if gcTeamDamage then
       Options := Options or GAME_OPTION_TEAMDAMAGE;
+    if gcRespawnItems then
+      Options := Options or GAME_OPTION_RESPAWNITEMS;
     if gcAllowExit then
       Options := Options or GAME_OPTION_ALLOWEXIT;
     if gcWeaponStay then
     if gcAllowExit then
       Options := Options or GAME_OPTION_ALLOWEXIT;
     if gcWeaponStay then
@@ -731,12 +734,15 @@ begin
     NetPort := StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
 
     gnTeamDamage := TGUISwitch(GetControl('swTeamDamage')).ItemIndex = 0;
     NetPort := StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
 
     gnTeamDamage := TGUISwitch(GetControl('swTeamDamage')).ItemIndex = 0;
+    gnRespawnItems := TGUISwitch(GetControl('swRespawnItems')).ItemIndex = 0;
     gnAllowExit := TGUISwitch(GetControl('swEnableExits')).ItemIndex = 0;
     gnWeaponStay := TGUISwitch(GetControl('swWeaponStay')).ItemIndex = 0;
     gnMonsters := TGUISwitch(GetControl('swMonsters')).ItemIndex = 0;
     Options := 0;
     if gnTeamDamage then
       Options := Options or GAME_OPTION_TEAMDAMAGE;
     gnAllowExit := TGUISwitch(GetControl('swEnableExits')).ItemIndex = 0;
     gnWeaponStay := TGUISwitch(GetControl('swWeaponStay')).ItemIndex = 0;
     gnMonsters := TGUISwitch(GetControl('swMonsters')).ItemIndex = 0;
     Options := 0;
     if gnTeamDamage then
       Options := Options or GAME_OPTION_TEAMDAMAGE;
+    if gnRespawnItems then
+      Options := Options or GAME_OPTION_RESPAWNITEMS;
     if gnAllowExit then
       Options := Options or GAME_OPTION_ALLOWEXIT;
     if gnWeaponStay then
     if gnAllowExit then
       Options := Options or GAME_OPTION_ALLOWEXIT;
     if gnWeaponStay then
@@ -2188,6 +2194,16 @@ begin
       else
         ItemIndex := 1;
     end;
       else
         ItemIndex := 1;
     end;
+    with AddSwitch(_lc[I_MENU_RESPAWN_ITEMS]) do
+    begin
+      Name := 'swRespawnItems';
+      AddItem(_lc[I_MENU_YES]);
+      AddItem(_lc[I_MENU_NO]);
+      if gnRespawnItems then
+        ItemIndex := 0
+      else
+        ItemIndex := 1;
+    end;
     with AddSwitch(_lc[I_MENU_ENABLE_EXITS]) do
     begin
       Name := 'swEnableExits';
     with AddSwitch(_lc[I_MENU_ENABLE_EXITS]) do
     begin
       Name := 'swEnableExits';
@@ -2388,6 +2404,16 @@ begin
       else
         ItemIndex := 1;
     end;
       else
         ItemIndex := 1;
     end;
+    with AddSwitch(_lc[I_MENU_RESPAWN_ITEMS]) do
+    begin
+      Name := 'swRespawnItems';
+      AddItem(_lc[I_MENU_YES]);
+      AddItem(_lc[I_MENU_NO]);
+      if gcRespawnItems then
+        ItemIndex := 0
+      else
+        ItemIndex := 1;
+    end;
     with AddSwitch(_lc[I_MENU_ENABLE_EXITS]) do
     begin
       Name := 'swEnableExits';
     with AddSwitch(_lc[I_MENU_ENABLE_EXITS]) do
     begin
       Name := 'swEnableExits';
index c923a6771fdb120124f71ef6a778720633af8ffc..02889313813d3d9cbbba34e7db62f47efa24e6ac 100644 (file)
@@ -74,6 +74,7 @@ var
   gcMonsters: Boolean;
   gcBotsVS: String;
   gcDeathmatchKeys: Boolean = True;
   gcMonsters: Boolean;
   gcBotsVS: String;
   gcDeathmatchKeys: Boolean = True;
+  gcRespawnItems: Boolean = True;
   gcSpawnInvul: Integer = 0;
   gnMap: String;
   gnGameMode: String;
   gcSpawnInvul: Integer = 0;
   gnMap: String;
   gnGameMode: String;
@@ -87,6 +88,7 @@ var
   gnMonsters: Boolean;
   gnBotsVS: String;
   gnDeathmatchKeys: Boolean = True;
   gnMonsters: Boolean;
   gnBotsVS: String;
   gnDeathmatchKeys: Boolean = True;
+  gnRespawnItems: Boolean = True;
   gnSpawnInvul: Integer = 0;
   gsSDLSampleRate: Integer;
   gsSDLBufferSize: Integer;
   gnSpawnInvul: Integer = 0;
   gsSDLSampleRate: Integer;
   gsSDLBufferSize: Integer;
@@ -288,6 +290,7 @@ begin
   gcMonsters := False;
   gcBotsVS := 'Everybody';
   gcDeathmatchKeys := True;
   gcMonsters := False;
   gcBotsVS := 'Everybody';
   gcDeathmatchKeys := True;
+  gcRespawnItems := True;
   gcSpawnInvul := 0;
 
   (* section GameplayNetwork *)
   gcSpawnInvul := 0;
 
   (* section GameplayNetwork *)
@@ -303,6 +306,7 @@ begin
   gnMonsters := False;
   gnBotsVS := 'Everybody';
   gnDeathmatchKeys := True;
   gnMonsters := False;
   gnBotsVS := 'Everybody';
   gnDeathmatchKeys := True;
+  gnRespawnItems := True;
   gnSpawnInvul := 0;
 
   (* section MasterServer *)
   gnSpawnInvul := 0;
 
   (* section MasterServer *)
@@ -419,6 +423,7 @@ begin
   ReadBoolean(gcMonsters, 'Monsters');
   ReadString(gcBotsVS, 'BotsVS');
   ReadBoolean(gcDeathmatchKeys, 'DeathmatchKeys');
   ReadBoolean(gcMonsters, 'Monsters');
   ReadString(gcBotsVS, 'BotsVS');
   ReadBoolean(gcDeathmatchKeys, 'DeathmatchKeys');
+  ReadBoolean(gcRespawnItems, 'RespawnItems');
   ReadInteger(gcSpawnInvul, 'SpawnInvul');
 
   with gGameSettings do
   ReadInteger(gcSpawnInvul, 'SpawnInvul');
 
   with gGameSettings do
@@ -449,6 +454,8 @@ begin
       Options := Options or GAME_OPTION_BOTVSMONSTER;
     if gcDeathmatchKeys then
       Options := Options or GAME_OPTION_DMKEYS;
       Options := Options or GAME_OPTION_BOTVSMONSTER;
     if gcDeathmatchKeys then
       Options := Options or GAME_OPTION_DMKEYS;
+    if gcRespawnItems then
+      Options := Options or GAME_OPTION_RESPAWNITEMS;
   end;
 
   section := 'GameplayNetwork';
   end;
 
   section := 'GameplayNetwork';
@@ -464,6 +471,7 @@ begin
   ReadBoolean(gnMonsters, 'Monsters');
   ReadString(gnBotsVS, 'BotsVS');
   ReadBoolean(gnDeathmatchKeys, 'DeathmatchKeys');
   ReadBoolean(gnMonsters, 'Monsters');
   ReadString(gnBotsVS, 'BotsVS');
   ReadBoolean(gnDeathmatchKeys, 'DeathmatchKeys');
+  ReadBoolean(gnRespawnItems, 'RespawnItems');
   ReadInteger(gnSpawnInvul, 'SpawnInvul');
 
   section := 'MasterServer';
   ReadInteger(gnSpawnInvul, 'SpawnInvul');
 
   section := 'MasterServer';
@@ -536,6 +544,7 @@ begin
   config.WriteBool('GameplayCustom', 'Monsters', gcMonsters);
   config.WriteStr ('GameplayCustom', 'BotsVS', gcBotsVS);
   config.WriteBool('GameplayCustom', 'DeathmatchKeys', gcDeathmatchKeys);
   config.WriteBool('GameplayCustom', 'Monsters', gcMonsters);
   config.WriteStr ('GameplayCustom', 'BotsVS', gcBotsVS);
   config.WriteBool('GameplayCustom', 'DeathmatchKeys', gcDeathmatchKeys);
+  config.WriteBool('GameplayCustom', 'RespawnItems', gcRespawnItems);
   config.WriteInt ('GameplayCustom', 'SpawnInvul', gcSpawnInvul);
 
   config.WriteStr ('GameplayNetwork', 'Map', gnMap);
   config.WriteInt ('GameplayCustom', 'SpawnInvul', gcSpawnInvul);
 
   config.WriteStr ('GameplayNetwork', 'Map', gnMap);
@@ -550,6 +559,7 @@ begin
   config.WriteBool('GameplayNetwork', 'Monsters', gnMonsters);
   config.WriteStr ('GameplayNetwork', 'BotsVS', gnBotsVS);
   config.WriteBool('GameplayNetwork', 'DeathmatchKeys', gnDeathmatchKeys);
   config.WriteBool('GameplayNetwork', 'Monsters', gnMonsters);
   config.WriteStr ('GameplayNetwork', 'BotsVS', gnBotsVS);
   config.WriteBool('GameplayNetwork', 'DeathmatchKeys', gnDeathmatchKeys);
+  config.WriteBool('GameplayNetwork', 'RespawnItems', gnRespawnItems);
   config.WriteInt ('GameplayNetwork', 'SpawnInvul', gnSpawnInvul);
 
   config.WriteStr('MasterServer', 'IP', NetSlistIP);
   config.WriteInt ('GameplayNetwork', 'SpawnInvul', gnSpawnInvul);
 
   config.WriteStr('MasterServer', 'IP', NetSlistIP);
@@ -598,6 +608,7 @@ begin
   config.WriteBool('GameplayCustom', 'Monsters', gcMonsters);
   config.WriteStr ('GameplayCustom', 'BotsVS', gcBotsVS);
   config.WriteBool('GameplayCustom', 'DeathmatchKeys', gcDeathmatchKeys);
   config.WriteBool('GameplayCustom', 'Monsters', gcMonsters);
   config.WriteStr ('GameplayCustom', 'BotsVS', gcBotsVS);
   config.WriteBool('GameplayCustom', 'DeathmatchKeys', gcDeathmatchKeys);
+  config.WriteBool('GameplayCustom', 'RespawnItems', gcRespawnItems);
   config.WriteInt ('GameplayCustom', 'SpawnInvul', gcSpawnInvul);
 
   config.SaveFile(FileName);
   config.WriteInt ('GameplayCustom', 'SpawnInvul', gcSpawnInvul);
 
   config.SaveFile(FileName);
@@ -624,6 +635,7 @@ begin
   config.WriteBool('GameplayNetwork', 'Monsters', gnMonsters);
   config.WriteStr ('GameplayNetwork', 'BotsVS', gnBotsVS);
   config.WriteBool('GameplayNetwork', 'DeathmatchKeys', gnDeathmatchKeys);
   config.WriteBool('GameplayNetwork', 'Monsters', gnMonsters);
   config.WriteStr ('GameplayNetwork', 'BotsVS', gnBotsVS);
   config.WriteBool('GameplayNetwork', 'DeathmatchKeys', gnDeathmatchKeys);
+  config.WriteBool('GameplayNetwork', 'RespawnItems', gnRespawnItems);
   config.WriteInt ('GameplayNetwork', 'SpawnInvul', gnSpawnInvul);
 
   config.SaveFile(FileName);
   config.WriteInt ('GameplayNetwork', 'SpawnInvul', gnSpawnInvul);
 
   config.SaveFile(FileName);