From 71c2a8f33ac5af68319c76112e18ce502319a14b Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 2 Dec 2019 00:16:48 +0100 Subject: [PATCH] - made the main option menu work. --- source/common/menu/menu.cpp | 1 + source/common/menu/menu.h | 1 + source/common/menu/menudef.cpp | 5 ++-- source/common/menu/optionmenu.cpp | 36 ++++++--------------------- wadsrc/static/demolition/language.csv | 20 +++++++++++++-- wadsrc/static/demolition/menudef.txt | 36 +++++++++++++++++++++++++++ 6 files changed, 66 insertions(+), 33 deletions(-) diff --git a/source/common/menu/menu.cpp b/source/common/menu/menu.cpp index 6a4b2aff9..88413202a 100644 --- a/source/common/menu/menu.cpp +++ b/source/common/menu/menu.cpp @@ -541,6 +541,7 @@ bool M_SetMenu(FName menu, int param, FName caller) FOptionMenuDescriptor *ld = static_cast(*desc); //const PClass *cls = ld->mClass == NULL? RUNTIME_CLASS(DOptionMenu) : ld->mClass; + ld->CalcIndent(); DOptionMenu *newmenu = new DOptionMenu; newmenu->Init(DMenu::CurrentMenu, ld); M_ActivateMenu(newmenu); diff --git a/source/common/menu/menu.h b/source/common/menu/menu.h index 32dbf4d69..b4ec67847 100644 --- a/source/common/menu/menu.h +++ b/source/common/menu/menu.h @@ -644,6 +644,7 @@ public: bool MouseEvent(int type, int x, int y); void Ticker (); void Drawer (); + virtual int GetIndent(); const FOptionMenuDescriptor *GetDescriptor() const { return mDesc; } void SetFocus(FOptionMenuItem *fc) { diff --git a/source/common/menu/menudef.cpp b/source/common/menu/menudef.cpp index 86f2fbd75..4c88ae577 100644 --- a/source/common/menu/menudef.cpp +++ b/source/common/menu/menudef.cpp @@ -794,7 +794,7 @@ static void ParseOptionMenuBody(FScanner &sc, FOptionMenuDescriptor *desc) sc.MustGetString(); desc->mClass = sc.String; } - else if (sc.Compare("Title")) + else if (sc.Compare("Title") || sc.Compare("Caption")) { sc.MustGetString(); desc->mTitle = sc.String; @@ -1025,7 +1025,6 @@ static void ParseOptionMenu(FScanner &sc) ParseOptionMenuBody(sc, desc); bool scratch = ReplaceMenu(sc, desc); - if (desc->mIndent == 0) desc->CalcIndent(); if (scratch) delete desc; } @@ -1046,7 +1045,7 @@ void M_ParseMenuDefs() OptionSettings.mFontColorMore = CR_GOLD;// = V_FindFontColor(gameinfo.mFontColorMore); OptionSettings.mFontColorHeader = CR_YELLOW;// = V_FindFontColor(gameinfo.mFontColorHeader); OptionSettings.mFontColorHighlight = CR_BRICK;// = V_FindFontColor(gameinfo.mFontColorHighlight); - OptionSettings.mFontColorSelection = CR_DARKRED;// = V_FindFontColor(gameinfo.mFontColorSelection); + OptionSettings.mFontColorSelection = CR_RED;// = V_FindFontColor(gameinfo.mFontColorSelection); DefaultListMenuSettings.Reset(); DefaultOptionMenuSettings.Reset(); diff --git a/source/common/menu/optionmenu.cpp b/source/common/menu/optionmenu.cpp index 8076f8635..946a3ea8d 100644 --- a/source/common/menu/optionmenu.cpp +++ b/source/common/menu/optionmenu.cpp @@ -212,17 +212,6 @@ bool DOptionMenu::MenuEvent (int mkey, bool fromcontroller) // Figure out how many lines of text fit on the menu int y = mDesc->mPosition; - if (y <= 0) - { - if (BigFont && mDesc->mTitle.IsNotEmpty()) - { - y = -y + BigFont->GetHeight(); - } - else - { - y = -y; - } - } y *= CleanYfac_1; int rowheight = OptionSettings.mLinespacing * CleanYfac_1; int maxitems = (screen->GetHeight() - rowheight - y) / rowheight + 1; @@ -397,6 +386,11 @@ void DOptionMenu::Ticker () // // //============================================================================= +int DOptionMenu::GetIndent() +{ + int indent = std::max(0, (mDesc->mIndent + 40) - CleanWidth_1 / 2); + return screen->GetWidth() / 2 + indent * CleanXfac_1; +} void DOptionMenu::Drawer () { @@ -410,25 +404,10 @@ void DOptionMenu::Drawer () int fontheight = OptionSettings.mLinespacing * CleanYfac_1; y *= CleanYfac_1; - int indent = mDesc->mIndent; - if (indent > 280) - { // kludge for the compatibility options with their extremely long labels - if (indent + 40 <= CleanWidth_1) - { - indent = (screen->GetWidth() - ((indent + 40) * CleanXfac_1)) / 2 + indent * CleanXfac_1; - } - else - { - indent = screen->GetWidth() - 40 * CleanXfac_1; - } - } - else - { - indent = (indent - 160) * CleanXfac_1 + screen->GetWidth() / 2; - } + int indent = GetIndent(); int ytop = y + mDesc->mScrollTop * 8 * CleanYfac_1; - int lastrow = screen->GetHeight() - SmallFont->GetHeight() * CleanYfac_1; + int lastrow = screen->GetHeight() - OptionFont()->GetHeight() * CleanYfac_1; unsigned i; for (i = 0; i < mDesc->mItems.Size() && y <= lastrow; i++, y += fontheight) @@ -498,6 +477,7 @@ bool FOptionMenuItem::MouseEvent(int type, int x, int y) return false; } + int FOptionMenuItem::GetIndent() { if (mCentered) return 0; diff --git a/wadsrc/static/demolition/language.csv b/wadsrc/static/demolition/language.csv index 7ccb43e91..8711b1f38 100644 --- a/wadsrc/static/demolition/language.csv +++ b/wadsrc/static/demolition/language.csv @@ -18,7 +18,7 @@ Select an Episode,MNU_SELECTEPISODE,DN3D et.al.,,,,"Welche Episode? ",,,,,,,,,,,,,,,,, Episodes,MNU_EPISODES,Blood,,,,Episoden,,,,,,,,,,,,,,,,, Select Skill,MNU_SELECTSKILL,DN3D et.al.,,,,Schwierigkeitsgrad,,,,,,,,,,,,,,,,, -Difficulty,MBU_DIFFICULTY,Blood,,,,Schwierigkeitsgrad,,,,,,,,,,,,,,,,, +Difficulty,MNU_DIFFICULTY,Blood,,,,Schwierigkeitsgrad,,,,,,,,,,,,,,,,, About Demolition,MNU_ENGINECREDITS,,,,,Über Demolition,,,,,,,,,,,,,,,,, Press Y or N.,PRESSYN,,,,Stiskni Y nebo N.,Drücke Y oder N.,"Πάτα Y ή N ",Premu Y aŭ N.,Presiona Y ó N.,,Paina Y tai N.,Appuyez sur Y ou N.,Nyomj Y-t vagy N-t.,Premi Y oppure N.,YかNで答えろ,Y키 또는 N키를 누르시오.,Druk op Y of N.,Wciśnij Y lub N.,Aperte Y ou N.,Carrega Y ou N.,,Нажмите Y или N.,Притисните Y или N. @@ -214,4 +214,20 @@ No files,MNU_NOFILES,,,,Žádné soubory,Keine Dateien,,Neniuj dosieroj,Sin arch ",,Haluatko varmasti poistaa tallennetun pelin ,"Voulez vous vraiment effacer cette sauvegarde? ",Biztos ki akarod törölni a mentést?,Vuoi veramente rimuovere il salvataggio,本当にこのセーブを消すのか?,저장된 게임을 정말로 삭제하시겠습니까?,Wil je echt de opgeslagen spel verwijderen?,Czy naprawdę chcesz usunąć zapis gry,"Deseja mesmo deletar o jogo salvo ",Deseja mesmo apagar o jogo,,"Вы действительно хотите удалить сохранение -",Да ли стварно желите да избришете сачувану игру \ No newline at end of file +",Да ли стварно желите да избришете сачувану игру +,,,,,,,,,,,,,,,,,,,,,,, +Options,OPTMNU_TITLE,,,,Možnosti,Optionen,,Agordoj,Opciones,,Asetukset,Options,Beállítások,Opzioni,オプション,설정,Opties,Opcje,Opções,,,Настройки,Подешавања +Customize Controls,OPTMNU_CONTROLS,,,,Nastavení ovládání,Steuerung einstellen,,Agordi Regilojn,Personalizar Controles,,Ohjausasetukset,Modifier les Contrôles,Irányítás testreszabása,Personalizza i controlli,キー配置変更,조작 사용자 지정,Instellen van de controle,Ustaw Klawisze,Configurar Controles,Configurar Controlos,,Управление,Контроле +Mouse Options,OPTMNU_MOUSE,,,,Nastavení myši,Mauseinstellungen,,Musagordoj,Opciones de Ratón,,Hiiriasetukset,Options de la Souris,Egér beállítások,Opzioni Mouse,マウス オプション,마우스 설정,Muis opties,Opcje Myszki,Opções de mouse,Opções do rato,,Мышь,Миш +Controller Options,OPTMNU_JOYSTICK,,,,Nastavení ovladače,Joystickeinstellungen,,Ludregilagordoj,Opciones de Mando,,Peliohjainasetukset,Options de la Manette,Játékvezérlő beállítások,Opzioni Joystick,コントローラーオプション,조이스틱 설정,Controller opties,Opcje Kontrolera,Opções de joystick,,,Контроллер,Контролер +Player Setup,OPTMNU_PLAYER,,,,Nastavení hráče,Spieler einrichten,,Ludanta Agordaĵo,Config. del Jugador,,Pelaaja-asetukset,Options du Joueur,Játékos testreszabása,Settaggio giocatore,プレイヤーの特徴,플레이어 설정,Speler instellen,Ustawienia Gracza,Configurações de Jogador,Configurações do Jogador,,Игрок,Играч +Gameplay Options,OPTMNU_GAMEPLAY,,,,Nastavení herních mechanik,Spieleinstellungen,,Ludadagordoj,Opciones de Jugabilidad,,Pelattavuusasetukset,Options du Gameplay,Játék mechanika,Opzioni Gameplay,ゲームプレイ オプション,게임 설정,Gameplay-opties,Opcje Rozgrywki,Opções de jogabilidade,,,Геймплей,Гејмплеј +Automap Options,OPTMNU_AUTOMAP,,,,Nastavení automapy,Automapeinstellungen,,Aŭtomapagordoj,Opciones del Automapa,,Automaattikartan asetukset,Options de la Carte,Térkép beállítások,Opzioni Automappa,オートマップ オプション,오토맵 설정,Automap-opties,Opcje Mapy,Opções de automapa,,,Автокарта,Аутомапа +HUD Options,OPTMNU_HUD,,,,Nastavení HUD,HUD Einstellungen,,Agordoj de HUD,Opciones del HUD,,Tilanäytön asetukset,Options de l'ATH,HUD beállítások,Opzioni HUD,HUD オプション,HUD 설정,HUD opties,Opcje Paska HUD,Opções de HUD,,,HUD,HUD +Miscellaneous Options,OPTMNU_MISCELLANEOUS,,,,Ostatní nastavení,Verschiedene Einstellungen,,Ekstraĵagordoj,Opciones Misceláneas,,Sekalaiset asetukset,Options Annexes,Általános beállítások,Opzioni miste,その他のオプション,그 외 설정,Diverse opties,Różne Opcje,Outras opções,,,Дополнительно,Разно +Sound Options,OPTMNU_SOUND,,,,Nastavení zvuku,Soundeinstellungen,,Sonagordoj,Opciones de Sonido,,Ääniasetukset,Options du Son,Hang beállítások,Opzioni Suono,サウンド オプション,음향 설정,Geluidsopties,Opcje Dźwięku,Opções de som,,,Звук,Звук +Display Options,OPTMNU_DISPLAY,,,,Nastavení grafiky,Anzeigeeinstellungen,,Ekranagordoj,Opciones de Visualización,,Näyttöasetukset,Options de l'Affichage,Megjelenítés beállítások,Opzioni Display,ディスプレイ オプション,디스플레이 설정,Weergaveopties,Opcje Wyświetlania,Opções de vídeo,,,Экран,Приказ +Set video mode,OPTMNU_VIDEO,,,,Nastavit režim displeje,Videomodus,,Agordi videoreĝimon,Modos de Vídeo,,Aseta videotila,Choisir Mode D'Affichage,Felbontás,Settaggio modalità video,ビデオ 調整,화면 설정,Videomodus instellen,Ustaw tryb wideo,Definir modo de vídeo,,,Видеорежим,Видео мод +Reset to defaults,OPTMNU_DEFAULTS,,,,Obnovit původní,Auf Vorgaben zurücksetzen,,Reŝanĝi al defaŭltoj,Valores por Defecto,,Palauta oletusasetukset,Réinitialiser les paramètres,Alapértelmezett beállítások használata,Reimposta ai valori di default,初期設定に戻す,초기화,Terugzetten naar standaardinstellingen,Resetuj do domyślnych,Redefinir para configurações padrão,,,Сбросить все настройки,Врати подразумевано +Reset to last saved,OPTMNU_RESETTOSAVED,,,,Obnovit naposledy uložené,Auf gespeicherte Werte zurücksetzen,,Reŝanĝi al lasta konservo,Últimos Valores Guardados,,Palauta viimeksi tallennettu tila,Recharger dernière config.,Legutóbbi mentett beállítások használata,Reimposta ai valori salvati l'ultima volta,最後に保存した設定に戻す,이전 설정으로 초기화,Reset naar laatste opgeslagen,Resetuj do ostatnio zapisanych,Redefinir para última configuração salva,Redefinir para última configuração gravada,,Вернуть предыдущие настройки,Врати задње сачувано +Go to console,OPTMNU_CONSOLE,,,,Jít do konzole,Öffne Konsole,,Iri al konzolo,Ir a la consola,,Mene konsoliin,Ouvrir la console,Konzol megnyitása,Vai alla console,コンソールを開く,콘솔로 이동,Ga naar de console,Przejdź do konsoli,Abrir console,Abrir consola,,Открыть консоль,Отвори конзолу \ No newline at end of file diff --git a/wadsrc/static/demolition/menudef.txt b/wadsrc/static/demolition/menudef.txt index 825992f80..841f2fa7d 100644 --- a/wadsrc/static/demolition/menudef.txt +++ b/wadsrc/static/demolition/menudef.txt @@ -575,3 +575,39 @@ ListMenu "SaveGameMenu" Class "SaveMenu" // uses its own implementation } +//------------------------------------------------------------------------------------------- +// +// The generic options menus start here +// +//------------------------------------------------------------------------------------------- + +OptionMenuSettings +{ + Linespacing 17 + // todo: implement color themes that fit the games +} + +DefaultOptionMenu +{ + Position 85 +} + +OptionMenu "OptionsMenu" +{ + Caption "$MNU_OPTIONS" + Submenu "$OPTMNU_CONTROLS", "CustomizeControls" + Submenu "$OPTMNU_MOUSE", "MouseOptions" + Submenu "$OPTMNU_JOYSTICK", "JoystickOptions" + StaticText " " + Submenu "$OPTMNU_PLAYER", "NewPlayerMenu" + Submenu "$OPTMNU_SOUND", "SoundOptions" + Submenu "$OPTMNU_DISPLAY", "VideoOptions" + Submenu "$OPTMNU_VIDEO", "VideoModeMenu" + Submenu "$OPTMNU_GAMEPLAY", "GameplayOptions" + Submenu "$OPTMNU_MISCELLANEOUS", "MiscOptions" + StaticText " " + SafeCommand "$OPTMNU_DEFAULTS", "reset2defaults" + SafeCommand "$OPTMNU_RESETTOSAVED", "reset2saved" + Command "$OPTMNU_CONSOLE", "menuconsole" +} +