diff --git a/src/game/g_menu.pas b/src/game/g_menu.pas
index 5c0452e464d9a2cbacec39794ed00767a04a1f28..89b1a55acfd384e0fcf6e533c072090633e4ea01 100644 (file)
--- a/src/game/g_menu.pas
+++ b/src/game/g_menu.pas
+(* Copyright (C) DooM 2D:Forever Developers
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *)
+{$MODE DELPHI}
unit g_menu;
interface
g_gui, g_textures, e_graphics, g_main, g_window, g_game, g_map,
g_basic, g_console, g_sound, g_gfx, g_player, g_options,
e_log, SysUtils, CONFIG, g_playermodel, DateUtils,
- MAPSTRUCT, WADEDITOR, Math, WADSTRUCT, g_saveload,
+ MAPSTRUCT, wadreader, Math, g_saveload,
e_textures, GL, GLExt, g_language,
g_net, g_netmsg, g_netmaster, g_items, e_input;
+
+type TYNCallback = procedure (yes:Boolean);
+
+procedure YNKeyDownProc (win: TGUIWindow; Key: Byte);
+begin
+ if win.UserData = nil then exit;
+ case Key of
+ IK_Y, IK_SPACE: TYNCallback(win.UserData)(true);
+ IK_N: TYNCallback(win.UserData)(false);
+ end;
+end;
+
+procedure YesButtonCB (ctl: TGUITextButton);
+begin
+ if ctl.UserData = nil then exit;
+ TYNCallback(ctl.UserData)(true);
+end;
+
+procedure NoButtonCB (ctl: TGUITextButton);
+begin
+ if ctl.UserData = nil then exit;
+ TYNCallback(ctl.UserData)(false);
+end;
+
+function CreateYNMenu (WinName, Text: String; MaxLen: Word; FontID: DWORD; ActionProc: TYNCallback): TGUIWindow;
+var
+ menu: TGUIMenu;
+begin
+ //if length(Text) = 0 then exit;
+ Result := TGUIWindow.Create(WinName);
+ with Result do
+ begin
+ //OnKeyDownEx := @YNKeyDownProc;
+ //UserData := @ActionProc;
+ menu := TGUIMenu(Result.AddChild(TGUIMenu.Create(gMenuSmallFont, gMenuSmallFont, '')));
+ with menu do
+ begin
+ Name := '__temp_yes_no_menu:'+WinName;
+ YesNo := true;
+ AddText(Text, MaxLen);
+ with AddButton(nil, _lc[I_MENU_YES]) do begin ProcEx := @YesButtonCB; UserData := @ActionProc; end;
+ with AddButton(nil, _lc[I_MENU_NO]) do begin ProcEx := @NoButtonCB; UserData := @ActionProc; end;
+ end;
+ DefControl := '__temp_yes_no_menu:'+WinName;
+ SetActive(nil);
+ end;
+end;
+
+
procedure ProcChangeColor(Sender: TGUIControl); forward;
procedure ProcSelectModel(Sender: TGUIControl); forward;
gBPP := 32;
gVSync := TGUISwitch(menu.GetControl('swVSync')).ItemIndex = 0;
gTextureFilter := TGUISwitch(menu.GetControl('swTextureFilter')).ItemIndex = 0;
+ glLegacyNPOT := not (TGUISwitch(menu.GetControl('swLegacyNPOT')).ItemIndex = 0);
menu := TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
end;
menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
-
with menu, gGameControls.P1Control do
begin
- KeyRight := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key;
- KeyLeft := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key;
- KeyUp := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_UP])).Key;
- KeyDown := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_DOWN])).Key;
- KeyFire := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_FIRE])).Key;
- KeyJump := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_JUMP])).Key;
- KeyNextWeapon := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key;
- KeyPrevWeapon := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key;
- KeyOpen := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_USE])).Key;
+ KeyRight := TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key0;
+ KeyLeft := TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key0;
+ KeyUp := TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_UP])).Key0;
+ KeyDown := TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_DOWN])).Key0;
+ KeyFire := TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_FIRE])).Key0;
+ KeyJump := TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_JUMP])).Key0;
+ KeyNextWeapon := TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key0;
+ KeyPrevWeapon := TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key0;
+ KeyOpen := TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_USE])).Key0;
+ KeyStrafe := TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_STRAFE])).Key0;
+ // second set
+ KeyRight2 := TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key1;
+ KeyLeft2 := TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key1;
+ KeyUp2 := TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_UP])).Key1;
+ KeyDown2 := TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_DOWN])).Key1;
+ KeyFire2 := TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_FIRE])).Key1;
+ KeyJump2 := TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_JUMP])).Key1;
+ KeyNextWeapon2 := TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key1;
+ KeyPrevWeapon2 := TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key1;
+ KeyOpen2 := TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_USE])).Key1;
+ KeyStrafe2 := TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_STRAFE])).Key1;
+ end;
+
+ menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
+ with menu, gGameControls.P1Control do
+ begin
+ for i := 0 to 9 do
+ begin
+ KeyWeapon[i] := TGUIKeyRead2(GetControl(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)])).Key0;
+ KeyWeapon2[i] := TGUIKeyRead2(GetControl(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)])).Key1;
+ end;
end;
menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
-
with menu, gGameControls.P2Control do
begin
- KeyRight := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key;
- KeyLeft := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key;
- KeyUp := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_UP])).Key;
- KeyDown := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_DOWN])).Key;
- KeyFire := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_FIRE])).Key;
- KeyJump := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_JUMP])).Key;
- KeyNextWeapon := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key;
- KeyPrevWeapon := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key;
- KeyOpen := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_USE])).Key;
+ KeyRight := TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key0;
+ KeyLeft := TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key0;
+ KeyUp := TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_UP])).Key0;
+ KeyDown := TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_DOWN])).Key0;
+ KeyFire := TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_FIRE])).Key0;
+ KeyJump := TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_JUMP])).Key0;
+ KeyNextWeapon := TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key0;
+ KeyPrevWeapon := TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key0;
+ KeyOpen := TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_USE])).Key0;
+ KeyStrafe := TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_STRAFE])).Key0;
+ // second set
+ KeyRight2 := TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key1;
+ KeyLeft2 := TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key1;
+ KeyUp2 := TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_UP])).Key1;
+ KeyDown2 := TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_DOWN])).Key1;
+ KeyFire2 := TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_FIRE])).Key1;
+ KeyJump2 := TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_JUMP])).Key1;
+ KeyNextWeapon2 := TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key1;
+ KeyPrevWeapon2 := TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key1;
+ KeyOpen2 := TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_USE])).Key1;
+ KeyStrafe2 := TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_STRAFE])).Key1;
+ end;
+
+ menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
+ with menu, gGameControls.P2Control do
+ begin
+ for i := 0 to 9 do
+ begin
+ KeyWeapon[i] := TGUIKeyRead2(GetControl(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)])).Key0;
+ KeyWeapon2[i] := TGUIKeyRead2(GetControl(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)])).Key1;
+ end;
end;
if e_JoysticksAvailable > 0 then
with TGUISwitch(menu.GetControl('swVSync')) do
if gVSync then ItemIndex := 0 else ItemIndex := 1;
+ with TGUISwitch(menu.GetControl('swLegacyNPOT')) do
+ if not glLegacyNPOT then ItemIndex := 0 else ItemIndex := 1;
+
menu := TGUIMenu(g_GUI_GetWindow('OptionsSoundMenu').GetControl('mOptionsSoundMenu'));
TGUIScroll(menu.GetControl('scSoundLevel')).Value := Round(gSoundLevel/16);
ItemIndex := 0;
menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu'));
-
with menu, gGameControls.P1Control do
begin
- TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key := KeyRight;
- TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key := KeyLeft;
- TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_UP])).Key := KeyUp;
- TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_DOWN])).Key := KeyDown;
- TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_FIRE])).Key := KeyFire;
- TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_JUMP])).Key := KeyJump;
- TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key := KeyNextWeapon;
- TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key := KeyPrevWeapon;
- TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_USE])).Key := KeyOpen;
+ TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key0 := KeyRight;
+ TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key0 := KeyLeft;
+ TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_UP])).Key0 := KeyUp;
+ TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_DOWN])).Key0 := KeyDown;
+ TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_FIRE])).Key0 := KeyFire;
+ TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_JUMP])).Key0 := KeyJump;
+ TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key0 := KeyNextWeapon;
+ TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key0 := KeyPrevWeapon;
+ TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_USE])).Key0 := KeyOpen;
+ TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_STRAFE])).Key1 := KeyStrafe;
+ // second set
+ TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key1 := KeyRight2;
+ TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key1 := KeyLeft2;
+ TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_UP])).Key1 := KeyUp2;
+ TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_DOWN])).Key1 := KeyDown2;
+ TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_FIRE])).Key1 := KeyFire2;
+ TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_JUMP])).Key1 := KeyJump2;
+ TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key1 := KeyNextWeapon2;
+ TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key1 := KeyPrevWeapon2;
+ TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_USE])).Key1 := KeyOpen2;
+ TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_STRAFE])).Key1 := KeyStrafe2;
+ end;
+
+ menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons'));
+ with menu, gGameControls.P1Control do
+ begin
+ for i := 0 to 9 do
+ begin
+ TGUIKeyRead2(GetControl(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)])).Key0 := KeyWeapon[i];
+ TGUIKeyRead2(GetControl(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)])).Key1 := KeyWeapon2[i];
+ end;
end;
menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu'));
-
with menu, gGameControls.P2Control do
begin
- TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key := KeyRight;
- TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key := KeyLeft;
- TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_UP])).Key := KeyUp;
- TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_DOWN])).Key := KeyDown;
- TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_FIRE])).Key := KeyFire;
- TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_JUMP])).Key := KeyJump;
- TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key := KeyNextWeapon;
- TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key := KeyPrevWeapon;
- TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_USE])).Key := KeyOpen;
+ TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key0 := KeyRight;
+ TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key0 := KeyLeft;
+ TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_UP])).Key0 := KeyUp;
+ TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_DOWN])).Key0 := KeyDown;
+ TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_FIRE])).Key0 := KeyFire;
+ TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_JUMP])).Key0 := KeyJump;
+ TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key0 := KeyNextWeapon;
+ TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key0 := KeyPrevWeapon;
+ TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_USE])).Key0 := KeyOpen;
+ TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_STRAFE])).Key0 := KeyStrafe;
+ // second set
+ TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key1 := KeyRight2;
+ TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key1 := KeyLeft2;
+ TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_UP])).Key1 := KeyUp2;
+ TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_DOWN])).Key1 := KeyDown2;
+ TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_FIRE])).Key1 := KeyFire2;
+ TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_JUMP])).Key1 := KeyJump2;
+ TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key1 := KeyNextWeapon2;
+ TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key1 := KeyPrevWeapon2;
+ TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_USE])).Key1 := KeyOpen2;
+ TGUIKeyRead2(GetControl(_lc[I_MENU_CONTROL_STRAFE])).Key1 := KeyStrafe2;
+ end;
+
+ menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons'));
+ with menu, gGameControls.P2Control do
+ begin
+ for i := 0 to 9 do
+ begin
+ TGUIKeyRead2(GetControl(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)])).Key0 := KeyWeapon[i];
+ TGUIKeyRead2(GetControl(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)])).Key1 := KeyWeapon2[i];
+ end;
end;
if e_JoysticksAvailable > 0 then
if a.pic <> '' then
begin
- g_ProcessResourceStr(a.pic, @fn, nil, nil);
+ fn := g_ExtractWadName(a.pic);
if fn = '' then
TGUIImage(win.GetControl('mpWADImage')).SetImage(wad+a.pic)
else
cwdt, chgt: Byte;
spc: ShortInt;
ID: DWORD;
- wad: TWADEditor_1;
+ wad: TWADFile;
cfgdata: Pointer;
cfglen: Integer;
config: TConfig;
begin
cfglen := 0;
- wad := TWADEditor_1.Create;
+ wad := TWADFile.Create;
if wad.ReadFile(GameWAD) then
- wad.GetResource('FONTS', cfgres, cfgdata, cfglen);
+ wad.GetResource('FONTS/'+cfgres, cfgdata, cfglen);
wad.Free();
if cfglen <> 0 then
cwdt, chgt: Byte;
spc: ShortInt;
CharID: DWORD;
- wad: TWADEditor_1;
+ wad: TWADFile;
cfgdata, fntdata: Pointer;
cfglen, fntlen: Integer;
config: TConfig;
cfglen := 0;
fntlen := 0;
- wad := TWADEditor_1.Create;
+ wad := TWADFile.Create;
if wad.ReadFile(GameWAD) then
begin
- wad.GetResource('FONTS', txtres, cfgdata, cfglen);
- wad.GetResource('FONTS', fntres, fntdata, fntlen);
+ wad.GetResource('FONTS/'+txtres, cfgdata, cfglen);
+ wad.GetResource('FONTS/'+fntres, fntdata, fntlen);
end;
wad.Free();
chrwidth := config.ReadInt(IntToStr(a), 'Width', 0);
if chrwidth = 0 then Continue;
- if e_CreateTextureMemEx(fntdata, CharID, cwdt*(a mod 16), chgt*(a div 16),
+ if e_CreateTextureMemEx(fntdata, fntlen, CharID, cwdt*(a mod 16), chgt*(a div 16),
cwdt, chgt) then
e_CharFont_AddChar(FontID, CharID, Chr(a), chrwidth);
end;
gMusic.Play();
end;
-procedure ProcExitMenuKeyDown(Key: Byte);
+procedure ProcExitMenuKeyDown (yes: Boolean);
var
s: ShortString;
snd: TPlayableSound;
res: Boolean;
begin
- if Key = IK_Y then
+ if yes then
begin
g_Game_StopAllSounds(True);
case (Random(18)) of
15: s := 'SOUND_MONSTER_SPIDER_ALERT';
else s := 'SOUND_PLAYER_FALL';
end;
-
snd := TPlayableSound.Create();
res := snd.SetByName(s);
- if not res then
- res := snd.SetByName('SOUND_PLAYER_FALL');
-
+ if not res then res := snd.SetByName('SOUND_PLAYER_FALL');
if res then
begin
snd.Play(True);
- while snd.IsPlaying() do
- ;
+ while snd.IsPlaying() do begin end;
end;
-
g_Game_Quit();
- end
- else
- if Key = IK_N then
- g_GUI_HideWindow();
+ exit;
+ end;
+ g_GUI_HideWindow();
end;
procedure ProcLoadMenu();
if Direction = D_LEFT then Direction := D_RIGHT else Direction := D_LEFT;
end;
-procedure ProcDefaultMenuKeyDown(Key: Byte);
+procedure ProcDefaultMenuKeyDown (yes: Boolean);
begin
- if Key = Ord('y') then
+ if yes then
begin
g_Options_SetDefault();
ReadOptions();
- g_GUI_HideWindow();
- end else
- if Key = Ord('n') then g_GUI_HideWindow;
+ end;
+ g_GUI_HideWindow();
end;
-procedure ProcSavedMenuKeyDown(Key: Byte);
+procedure ProcSavedMenuKeyDown (yes: Boolean);
begin
- if Key = Ord('y') then
- begin
- ReadOptions();
- g_GUI_HideWindow();
- end else
- if Key = Ord('n') then g_GUI_HideWindow;
+ if yes then ReadOptions();
+ g_GUI_HideWindow();
end;
procedure ProcAuthorsClose();
g_Game_Pause(False);
end;
-procedure ProcRestartMenuKeyDown(Key: Byte);
+procedure ProcRestartMenuKeyDown (yes: Boolean);
begin
- if Key = Ord('y') then g_Game_Restart()
- else if Key = Ord('n') then g_GUI_HideWindow;
+ if yes then g_Game_Restart() else g_GUI_HideWindow;
end;
-procedure ProcEndMenuKeyDown(Key: Byte);
+procedure ProcEndMenuKeyDown (yes: Boolean);
begin
- if Key = Ord('y') then gExit := EXIT_SIMPLE
- else if Key = Ord('n') then g_GUI_HideWindow;
+ if yes then gExit := EXIT_SIMPLE else g_GUI_HideWindow;
end;
procedure ProcSetRussianLanguage();
ProcApplyOptions();
end;
-function CreateYNMenu(Name, Text: String; MaxLen: Word; FontID: DWORD;
- KeyDownProc: Pointer): TGUIWindow;
-var
- a: Integer;
- h, _x: Word;
- lines: SArray;
-begin
- Result := TGUIWindow.Create(Name);
-
- with Result do
- begin
- OnKeyDown := KeyDownProc;
-
- lines := GetLines(Text, FontID, MaxLen);
-
- h := e_CharFont_GetMaxHeight(FontID);
- _x := (gScreenHeight div 2)-(h*Length(lines) div 2);
-
- if lines <> nil then
- begin
- for a := 0 to High(lines) do
- with TGUILabel(Result.AddChild(TGUILabel.Create(lines[a], FontID))) do
- begin
- X := (gScreenWidth div 2)-(GetWidth div 2);
- Y := _x;
- Color := _RGB(255, 0, 0);
- _x := _x+h;
- end;
-
- with TGUILabel(Result.AddChild(TGUILabel.Create('(Y/N)', FontID))) do
- begin
- X := (gScreenWidth div 2)-(GetWidth div 2);
- Y := _x;
- Color := _RGB(255, 0, 0);
- end;
- end;
-
- DefControl := '';
- SetActive(nil);
- end;
-end;
-
procedure ProcSetFirstRussianLanguage();
begin
gLanguage := LANGUAGE_RUSSIAN;
Sort := True;
Dirs := True;
- FileMask := '*.wad';
+ FileMask := '*.wad|*.pk3|*.zip';
SetBase(MapsDir+'megawads/');
end;
Sort := True;
Dirs := True;
- FileMask := '*.wad';
+ FileMask := '*.wad|*.pk3|*.zip';
SetBase(MapsDir);
end;
with AddList(_lc[I_MENU_MAP_RESOURCE], 12, 4) do
AddItem(_lc[I_MENU_YES]);
AddItem(_lc[I_MENU_NO]);
end;
+ with AddSwitch(_lc[I_MENU_VIDEO_LEGACY_COMPATIBLE]) do
+ begin
+ Name := 'swLegacyNPOT';
+ AddItem(_lc[I_MENU_NO]);
+ AddItem(_lc[I_MENU_YES]);
+ end;
AddSpace();
AddText(_lc[I_MENU_VIDEO_NEED_RESTART], Round(gScreenWidth*0.6));
ReAlign();
AddKeyRead(_lc[I_MENU_CONTROL_CHAT]).Name := _lc[I_MENU_CONTROL_CHAT];
AddKeyRead(_lc[I_MENU_CONTROL_TEAMCHAT]).Name := _lc[I_MENU_CONTROL_TEAMCHAT];
AddSpace();
- AddButton(nil, _lc[I_MENU_PLAYER_1], 'OptionsControlsP1Menu');
- AddButton(nil, _lc[I_MENU_PLAYER_2], 'OptionsControlsP2Menu');
+ AddButton(nil, _lc[I_MENU_PLAYER_1_KBD], 'OptionsControlsP1Menu');
+ {AddButton(nil, _lc[I_MENU_PLAYER_1_ALT], 'OptionsControlsP1MenuAlt');}
+ AddButton(nil, _lc[I_MENU_PLAYER_1_WEAPONS], 'OptionsControlsP1MenuWeapons');
+ AddButton(nil, _lc[I_MENU_PLAYER_2_KBD], 'OptionsControlsP2Menu');
+ {AddButton(nil, _lc[I_MENU_PLAYER_2_ALT], 'OptionsControlsP2MenuAlt');}
+ AddButton(nil, _lc[I_MENU_PLAYER_2_WEAPONS], 'OptionsControlsP2MenuWeapons');
AddSpace();
if e_JoysticksAvailable <> 0 then
AddButton(nil, _lc[I_MENU_CONTROL_JOYSTICKS], 'OptionsControlsJoystickMenu');
g_GUI_AddWindow(Menu);
Menu := TGUIWindow.Create('OptionsControlsP1Menu');
- with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_PLAYER_1]))) do
+ with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_PLAYER_1_KBD]))) do
begin
Name := 'mOptionsControlsP1Menu';
- AddKeyRead(_lc[I_MENU_CONTROL_LEFT]).Name := _lc[I_MENU_CONTROL_LEFT];
- AddKeyRead(_lc[I_MENU_CONTROL_RIGHT]).Name := _lc[I_MENU_CONTROL_RIGHT];
- AddKeyRead(_lc[I_MENU_CONTROL_UP]).Name := _lc[I_MENU_CONTROL_UP];
- AddKeyRead(_lc[I_MENU_CONTROL_DOWN]).Name := _lc[I_MENU_CONTROL_DOWN];
- AddKeyRead(_lc[I_MENU_CONTROL_JUMP]).Name := _lc[I_MENU_CONTROL_JUMP];
- AddKeyRead(_lc[I_MENU_CONTROL_FIRE]).Name := _lc[I_MENU_CONTROL_FIRE];
- AddKeyRead(_lc[I_MENU_CONTROL_USE]).Name := _lc[I_MENU_CONTROL_USE];
- AddKeyRead(_lc[I_MENU_CONTROL_NEXT_WEAPON]).Name := _lc[I_MENU_CONTROL_NEXT_WEAPON];
- AddKeyRead(_lc[I_MENU_CONTROL_PREV_WEAPON]).Name := _lc[I_MENU_CONTROL_PREV_WEAPON];
+ AddKeyRead2(_lc[I_MENU_CONTROL_LEFT]).Name := _lc[I_MENU_CONTROL_LEFT];
+ AddKeyRead2(_lc[I_MENU_CONTROL_RIGHT]).Name := _lc[I_MENU_CONTROL_RIGHT];
+ AddKeyRead2(_lc[I_MENU_CONTROL_UP]).Name := _lc[I_MENU_CONTROL_UP];
+ AddKeyRead2(_lc[I_MENU_CONTROL_DOWN]).Name := _lc[I_MENU_CONTROL_DOWN];
+ AddKeyRead2(_lc[I_MENU_CONTROL_JUMP]).Name := _lc[I_MENU_CONTROL_JUMP];
+ AddKeyRead2(_lc[I_MENU_CONTROL_FIRE]).Name := _lc[I_MENU_CONTROL_FIRE];
+ AddKeyRead2(_lc[I_MENU_CONTROL_USE]).Name := _lc[I_MENU_CONTROL_USE];
+ AddKeyRead2(_lc[I_MENU_CONTROL_NEXT_WEAPON]).Name := _lc[I_MENU_CONTROL_NEXT_WEAPON];
+ AddKeyRead2(_lc[I_MENU_CONTROL_PREV_WEAPON]).Name := _lc[I_MENU_CONTROL_PREV_WEAPON];
+ AddKeyRead2(_lc[I_MENU_CONTROL_STRAFE]).Name := _lc[I_MENU_CONTROL_STRAFE];
end;
Menu.DefControl := 'mOptionsControlsP1Menu';
g_GUI_AddWindow(Menu);
+ Menu := TGUIWindow.Create('OptionsControlsP1MenuWeapons');
+ with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_PLAYER_1_WEAPONS]))) do
+ begin
+ Name := 'mOptionsControlsP1MenuWeapons';
+ for i := 0 to 9 do
+ AddKeyRead2(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)]).Name :=
+ _lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)];
+ end;
+ Menu.DefControl := 'mOptionsControlsP1MenuWeapons';
+ g_GUI_AddWindow(Menu);
+
Menu := TGUIWindow.Create('OptionsControlsP2Menu');
- with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_PLAYER_2]))) do
+ with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_PLAYER_2_KBD]))) do
begin
Name := 'mOptionsControlsP2Menu';
- AddKeyRead(_lc[I_MENU_CONTROL_LEFT]).Name := _lc[I_MENU_CONTROL_LEFT];
- AddKeyRead(_lc[I_MENU_CONTROL_RIGHT]).Name := _lc[I_MENU_CONTROL_RIGHT];
- AddKeyRead(_lc[I_MENU_CONTROL_UP]).Name := _lc[I_MENU_CONTROL_UP];
- AddKeyRead(_lc[I_MENU_CONTROL_DOWN]).Name := _lc[I_MENU_CONTROL_DOWN];
- AddKeyRead(_lc[I_MENU_CONTROL_JUMP]).Name := _lc[I_MENU_CONTROL_JUMP];
- AddKeyRead(_lc[I_MENU_CONTROL_FIRE]).Name := _lc[I_MENU_CONTROL_FIRE];
- AddKeyRead(_lc[I_MENU_CONTROL_USE]).Name := _lc[I_MENU_CONTROL_USE];
- AddKeyRead(_lc[I_MENU_CONTROL_NEXT_WEAPON]).Name := _lc[I_MENU_CONTROL_NEXT_WEAPON];
- AddKeyRead(_lc[I_MENU_CONTROL_PREV_WEAPON]).Name := _lc[I_MENU_CONTROL_PREV_WEAPON];
+ AddKeyRead2(_lc[I_MENU_CONTROL_LEFT]).Name := _lc[I_MENU_CONTROL_LEFT];
+ AddKeyRead2(_lc[I_MENU_CONTROL_RIGHT]).Name := _lc[I_MENU_CONTROL_RIGHT];
+ AddKeyRead2(_lc[I_MENU_CONTROL_UP]).Name := _lc[I_MENU_CONTROL_UP];
+ AddKeyRead2(_lc[I_MENU_CONTROL_DOWN]).Name := _lc[I_MENU_CONTROL_DOWN];
+ AddKeyRead2(_lc[I_MENU_CONTROL_JUMP]).Name := _lc[I_MENU_CONTROL_JUMP];
+ AddKeyRead2(_lc[I_MENU_CONTROL_FIRE]).Name := _lc[I_MENU_CONTROL_FIRE];
+ AddKeyRead2(_lc[I_MENU_CONTROL_USE]).Name := _lc[I_MENU_CONTROL_USE];
+ AddKeyRead2(_lc[I_MENU_CONTROL_NEXT_WEAPON]).Name := _lc[I_MENU_CONTROL_NEXT_WEAPON];
+ AddKeyRead2(_lc[I_MENU_CONTROL_PREV_WEAPON]).Name := _lc[I_MENU_CONTROL_PREV_WEAPON];
+ AddKeyRead2(_lc[I_MENU_CONTROL_STRAFE]).Name := _lc[I_MENU_CONTROL_STRAFE];
end;
Menu.DefControl := 'mOptionsControlsP2Menu';
g_GUI_AddWindow(Menu);
+ Menu := TGUIWindow.Create('OptionsControlsP2MenuWeapons');
+ with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_PLAYER_2_WEAPONS]))) do
+ begin
+ Name := 'mOptionsControlsP2MenuWeapons';
+ for i := 0 to 9 do
+ AddKeyRead2(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)]).Name :=
+ _lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)];
+ end;
+ Menu.DefControl := 'mOptionsControlsP2MenuWeapons';
+ g_GUI_AddWindow(Menu);
+
Menu := TGUIWindow.Create('OptionsControlsJoystickMenu');
with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_CONTROL_JOYSTICKS]))) do
begin
_y := _y+22;
end;
with TGUILabel(Menu.AddChild(TGUILabel.Create(_lc[I_CREDITS_A_2_1], gMenuSmallFont))) do
+ begin
+ Color := _RGB(255, 255, 255);
+ X := cx+32;
+ Y := _y;
+ _y := _y+22;
+ end;
+ with TGUILabel(Menu.AddChild(TGUILabel.Create(_lc[I_CREDITS_A_2_2], gMenuSmallFont))) do
begin
Color := _RGB(255, 255, 255);
X := cx+32;