DEADSOFTWARE

nuke g_respawn_items
[d2df-sdl.git] / src / game / g_menu.pas
index 3513439d44e4b2574f2e33b1b64c9351324a74e6..9f7aaaa4c53ea09180d2972a0f3c4428dba66fa5 100644 (file)
@@ -38,6 +38,7 @@ var
   PromptIP: string;
   PromptPort: Word;
   TempScale: Integer = -1;
+  TempResScale: Integer = -1;
 
 implementation
 
@@ -667,7 +668,6 @@ begin
     gcMaxLives := StrToIntDef(TGUIEdit(GetControl('edMaxLives')).Text, 0);
 
     gcTeamDamage := TGUISwitch(GetControl('swTeamDamage')).ItemIndex = 0;
-    gcRespawnItems := TGUISwitch(GetControl('swRespawnItems')).ItemIndex = 0;
     gcDeathmatchKeys := TGUISwitch(GetControl('swDeathmatchKeys')).ItemIndex = 0;
     gcAllowExit := TGUISwitch(GetControl('swEnableExits')).ItemIndex = 0;
     gcWeaponStay := TGUISwitch(GetControl('swWeaponStay')).ItemIndex = 0;
@@ -675,8 +675,6 @@ begin
     Options := 0;
     if gcTeamDamage then
       Options := Options or GAME_OPTION_TEAMDAMAGE;
-    if gcRespawnItems then
-      Options := Options or GAME_OPTION_RESPAWNITEMS;
     if gcDeathmatchKeys then
       Options := Options or GAME_OPTION_DMKEYS;
     if gcAllowExit then
@@ -737,7 +735,6 @@ begin
     NetPort := StrToIntDef(TGUIEdit(GetControl('edPort')).Text, 0);
 
     gnTeamDamage := TGUISwitch(GetControl('swTeamDamage')).ItemIndex = 0;
-    gnRespawnItems := TGUISwitch(GetControl('swRespawnItems')).ItemIndex = 0;
     gnDeathmatchKeys := TGUISwitch(GetControl('swDeathmatchKeys')).ItemIndex = 0;
     gnAllowExit := TGUISwitch(GetControl('swEnableExits')).ItemIndex = 0;
     gnWeaponStay := TGUISwitch(GetControl('swWeaponStay')).ItemIndex = 0;
@@ -745,8 +742,6 @@ begin
     Options := 0;
     if gnTeamDamage then
       Options := Options or GAME_OPTION_TEAMDAMAGE;
-    if gnRespawnItems then
-      Options := Options or GAME_OPTION_RESPAWNITEMS;
     if gnDeathmatchKeys then
       Options := Options or GAME_OPTION_DMKEYS;
     if gnAllowExit then
@@ -1726,7 +1721,16 @@ begin
     if GameType in [GT_CUSTOM, GT_SERVER] then
       begin
         TGUISwitch(menu.GetControl('swTeamDamage')).Enabled := True;
-        TGUISwitch(menu.GetControl('swDeathmatchKeys')).Enabled := (GameMode in [GM_DM, GM_TDM, GM_CTF]);
+        if (GameMode in [GM_DM, GM_TDM, GM_CTF]) then
+        begin
+          TGUISwitch(menu.GetControl('swDeathmatchKeys')).Enabled := True;
+          TGUILabel(menu.GetControlsText('swDeathmatchKeys')).Color := MENU_ITEMSTEXT_COLOR;
+        end
+        else
+        begin
+          TGUISwitch(menu.GetControl('swDeathmatchKeys')).Enabled := False;
+          TGUILabel(menu.GetControlsText('swDeathmatchKeys')).Color := MENU_UNACTIVEITEMS_COLOR;
+        end;
         TGUIEdit(menu.GetControl('edTimeLimit')).Enabled := True;
         TGUILabel(menu.GetControlsText('edTimeLimit')).Color := MENU_ITEMSTEXT_COLOR;
         TGUIEdit(menu.GetControl('edGoalLimit')).Enabled := True;
@@ -1739,6 +1743,7 @@ begin
       begin
         TGUISwitch(menu.GetControl('swTeamDamage')).Enabled := True;
         TGUISwitch(menu.GetControl('swDeathmatchKeys')).Enabled := False;
+        TGUILabel(menu.GetControlsText('swDeathmatchKeys')).Color := MENU_UNACTIVEITEMS_COLOR;
         with TGUIEdit(menu.GetControl('edTimeLimit')) do
         begin
           Enabled := False;
@@ -1881,8 +1886,8 @@ begin
   menu := TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
 
   TGUILabel(menu.GetControl('lbCurrentRes')).Text :=
-    IntToStr(gScreenWidth) +
-    ' x ' + IntToStr(gScreenHeight) +
+    IntToStr(gWinSizeX) +
+    ' x ' + IntToStr(gWinSizeY) +
     ', ' + IntToStr(gBPP) + ' bpp';
 
   with TGUIListBox(menu.GetControl('lsResolution')) do
@@ -1904,6 +1909,9 @@ begin
       ItemIndex := 0
     else
       ItemIndex := 1;
+
+  TempResScale := Round(r_pixel_scale - 1);
+  TGUIScroll(menu.GetControl('scResFactor')).Value := TempResScale;
 end;
 
 procedure ProcApplyVideoOptions();
@@ -1911,18 +1919,34 @@ var
   menu: TGUIMenu;
   Fullscreen: Boolean;
   SWidth, SHeight: Integer;
+  ScaleChanged: Boolean;
   str: String;
 begin
   menu := TGUIMenu(g_GUI_GetWindow('OptionsVideoResMenu').GetControl('mOptionsVideoResMenu'));
 
   str := TGUIListBox(menu.GetControl('lsResolution')).SelectedItem;
-  SScanf(str, '%dx%d', [@SWidth, @SHeight]);
+  if str <> '' then
+    SScanf(str, '%dx%d', [@SWidth, @SHeight])
+  else
+  begin
+    SWidth := gWinSizeX;
+    SHeight := gWinSizeY;
+  end;
 
   Fullscreen := TGUISwitch(menu.GetControl('swFullScreen')).ItemIndex = 0;
 
-  if (SWidth <> gScreenWidth) or
-     (SHeight <> gScreenHeight) or
-     (Fullscreen <> gFullscreen) then
+  ScaleChanged := False;
+  if TGUIScroll(menu.GetControl('scResFactor')).Value <> TempResScale then
+  begin
+    TempResScale := TGUIScroll(menu.GetControl('scResFactor')).Value;
+    r_pixel_scale := TempResScale + 1;
+    ScaleChanged := True;
+  end;
+
+  if (SWidth <> gWinSizeX) or
+     (SHeight <> gWinSizeY) or
+     (Fullscreen <> gFullscreen) or
+     ScaleChanged then
   begin
     gResolutionChange := True;
     gRC_Width := SWidth;
@@ -2215,16 +2239,6 @@ begin
       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_DEATHMATCH_KEYS]) do
     begin
       Name := 'swDeathmatchKeys';
@@ -2435,16 +2449,6 @@ begin
       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_DEATHMATCH_KEYS]) do
     begin
       Name := 'swDeathmatchKeys';
@@ -2715,6 +2719,11 @@ begin
       AddItem(_lc[I_MENU_YES]);
       AddItem(_lc[I_MENU_NO]);
     end;
+    with AddScroll(_lc[I_MENU_GAME_SCALE_FACTOR]) do
+    begin
+      Name := 'scResFactor';
+      Max := 10;
+    end;
     AddSpace();
     AddButton(@ProcApplyVideoOptions, _lc[I_MENU_RESOLUTION_APPLY]);
     UpdateIndex();