X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_menu.pas;h=678c0a00dc05bbb094fbb02b01c04ca6bd8cb1f6;hb=df0d78f371a10177854058e5431f8d938a88f297;hp=23e9629666c3a91727a73c2829b8ce74dd283072;hpb=f20e858e5220f471cbb5cca0043f51a209c0ddd4;p=d2df-sdl.git diff --git a/src/game/g_menu.pas b/src/game/g_menu.pas index 23e9629..678c0a0 100644 --- a/src/game/g_menu.pas +++ b/src/game/g_menu.pas @@ -1,3 +1,19 @@ +(* 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 . + *) +{$MODE DELPHI} unit g_menu; interface @@ -29,7 +45,7 @@ uses 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; @@ -73,8 +89,8 @@ begin Name := '__temp_yes_no_menu:'+WinName; YesNo := true; AddText(Text, MaxLen); - with AddButton(nil, 'Yes') do begin ProcEx := @YesButtonCB; UserData := @ActionProc; end; - with AddButton(nil, 'No') do begin ProcEx := @NoButtonCB; UserData := @ActionProc; end; + 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); @@ -148,7 +164,6 @@ begin end; menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP1Menu').GetControl('mOptionsControlsP1Menu')); - with menu, gGameControls.P1Control do begin KeyRight := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key; @@ -162,8 +177,29 @@ begin KeyOpen := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_USE])).Key; end; - menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu')); + menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuAlt').GetControl('mOptionsControlsP1MenuAlt')); + with menu, gGameControls.P1Control do + begin + KeyRight2 := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key; + KeyLeft2 := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key; + KeyUp2 := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_UP])).Key; + KeyDown2 := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_DOWN])).Key; + KeyFire2 := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_FIRE])).Key; + KeyJump2 := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_JUMP])).Key; + KeyNextWeapon2 := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key; + KeyPrevWeapon2 := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key; + KeyOpen2 := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_USE])).Key; + KeyStrafe2 := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_STRAFE])).Key; + end; + + menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuWeapons').GetControl('mOptionsControlsP1MenuWeapons')); + with menu, gGameControls.P1Control do + begin + for i := 0 to 9 do + KeyWeapon[i] := TGUIKeyRead(GetControl(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)])).Key; + end; + menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu')); with menu, gGameControls.P2Control do begin KeyRight := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key; @@ -177,6 +213,28 @@ begin KeyOpen := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_USE])).Key; end; + menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuAlt').GetControl('mOptionsControlsP2MenuAlt')); + with menu, gGameControls.P2Control do + begin + KeyRight2 := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key; + KeyLeft2 := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key; + KeyUp2 := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_UP])).Key; + KeyDown2 := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_DOWN])).Key; + KeyFire2 := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_FIRE])).Key; + KeyJump2 := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_JUMP])).Key; + KeyNextWeapon2 := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key; + KeyPrevWeapon2 := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key; + KeyOpen2 := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_USE])).Key; + KeyStrafe2 := TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_STRAFE])).Key; + end; + + menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuWeapons').GetControl('mOptionsControlsP2MenuWeapons')); + with menu, gGameControls.P2Control do + begin + for i := 0 to 9 do + KeyWeapon[i] := TGUIKeyRead(GetControl(_lc[TStrings_Locale(Cardinal(I_GAME_WEAPON0) + i)])).Key; + end; + if e_JoysticksAvailable > 0 then begin menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu')); @@ -288,7 +346,6 @@ begin 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; @@ -302,8 +359,22 @@ begin TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_USE])).Key := KeyOpen; end; - menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu')); + menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP1MenuAlt').GetControl('mOptionsControlsP1MenuAlt')); + with menu, gGameControls.P1Control do + begin + TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key := KeyRight2; + TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key := KeyLeft2; + TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_UP])).Key := KeyUp2; + TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_DOWN])).Key := KeyDown2; + TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_FIRE])).Key := KeyFire2; + TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_JUMP])).Key := KeyJump2; + TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key := KeyNextWeapon2; + TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key := KeyPrevWeapon2; + TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_USE])).Key := KeyOpen2; + TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_STRAFE])).Key := KeyStrafe2; + end; + menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP2Menu').GetControl('mOptionsControlsP2Menu')); with menu, gGameControls.P2Control do begin TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key := KeyRight; @@ -317,6 +388,21 @@ begin TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_USE])).Key := KeyOpen; end; + menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsP2MenuAlt').GetControl('mOptionsControlsP2MenuAlt')); + with menu, gGameControls.P2Control do + begin + TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_RIGHT])).Key := KeyRight2; + TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_LEFT])).Key := KeyLeft2; + TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_UP])).Key := KeyUp2; + TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_DOWN])).Key := KeyDown2; + TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_FIRE])).Key := KeyFire2; + TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_JUMP])).Key := KeyJump2; + TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_NEXT_WEAPON])).Key := KeyNextWeapon2; + TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_PREV_WEAPON])).Key := KeyPrevWeapon2; + TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_USE])).Key := KeyOpen2; + TGUIKeyRead(GetControl(_lc[I_MENU_CONTROL_STRAFE])).Key := KeyStrafe2; + end; + if e_JoysticksAvailable > 0 then begin menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsJoystickMenu').GetControl('mOptionsControlsJoystickMenu')); @@ -725,7 +811,7 @@ begin 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 @@ -774,16 +860,16 @@ var 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 @@ -809,7 +895,7 @@ var cwdt, chgt: Byte; spc: ShortInt; CharID: DWORD; - wad: TWADEditor_1; + wad: TWADFile; cfgdata, fntdata: Pointer; cfglen, fntlen: Integer; config: TConfig; @@ -819,11 +905,11 @@ begin 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(); @@ -841,7 +927,7 @@ begin 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; @@ -2528,8 +2614,12 @@ begin 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'); @@ -2538,7 +2628,7 @@ begin 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]; @@ -2554,8 +2644,37 @@ begin Menu.DefControl := 'mOptionsControlsP1Menu'; g_GUI_AddWindow(Menu); + Menu := TGUIWindow.Create('OptionsControlsP1MenuAlt'); + with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_PLAYER_1_ALT]))) do + begin + Name := 'mOptionsControlsP1MenuAlt'; + 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]; + AddKeyRead(_lc[I_MENU_CONTROL_STRAFE]).Name := _lc[I_MENU_CONTROL_STRAFE]; + end; + Menu.DefControl := 'mOptionsControlsP1MenuAlt'; + 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 + AddKeyRead(_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]; @@ -2571,6 +2690,36 @@ begin Menu.DefControl := 'mOptionsControlsP2Menu'; g_GUI_AddWindow(Menu); + Menu := TGUIWindow.Create('OptionsControlsP2MenuAlt'); + with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_PLAYER_2_ALT]))) do + begin + Name := 'mOptionsControlsP2MenuAlt'; + 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]; + AddKeyRead(_lc[I_MENU_CONTROL_STRAFE]).Name := _lc[I_MENU_CONTROL_STRAFE]; + end; + Menu.DefControl := 'mOptionsControlsP2MenuAlt'; + 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 + AddKeyRead(_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