diff options
author | aap <aap@papnet.eu> | 2019-06-25 08:19:47 +0200 |
---|---|---|
committer | aap <aap@papnet.eu> | 2019-06-25 08:54:41 +0200 |
commit | 628b9a8b54766dac8b6d75c71159d68820978b92 (patch) | |
tree | 63c406133ae83293eb3d0b7d3c68d15c19eeb577 | |
parent | Merge pull request #49 from gennariarmando/master (diff) | |
download | re3-628b9a8b54766dac8b6d75c71159d68820978b92.tar re3-628b9a8b54766dac8b6d75c71159d68820978b92.tar.gz re3-628b9a8b54766dac8b6d75c71159d68820978b92.tar.bz2 re3-628b9a8b54766dac8b6d75c71159d68820978b92.tar.lz re3-628b9a8b54766dac8b6d75c71159d68820978b92.tar.xz re3-628b9a8b54766dac8b6d75c71159d68820978b92.tar.zst re3-628b9a8b54766dac8b6d75c71159d68820978b92.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Frontend.cpp | 145 | ||||
-rw-r--r-- | src/Frontend.h | 116 |
2 files changed, 185 insertions, 76 deletions
diff --git a/src/Frontend.cpp b/src/Frontend.cpp index 9b0e185d..01acb740 100644 --- a/src/Frontend.cpp +++ b/src/Frontend.cpp @@ -48,6 +48,7 @@ int32 &CMenuManager::m_PrefsSfxVolume = *(int32*)0x5F2E48; CMenuManager &FrontEndMenuManager = *(CMenuManager*)0x8F59D8; +// TODO: replace magic numbers with enums const CMenuScreen aScreens[] = { // MENU_PAGE_NONE = 0 { "", -1, -1, 1, 0, 0, }, @@ -459,25 +460,26 @@ char *FrontendFilenames[] = { }; char *MenuFilenames[] = { - "connection24", - "findgame24", - "hostgame24", - "mainmenu24", - "playersetup24", - "singleplayer24", - "multiplayer24", - "dmalogo128", - "gtaLogo128", - "rockstarLogo128", - "gamespy256", - "mouse", - "mousetimer", - "mp3logo", - "downOFF", - "upOFF", - "downON", - "upON", - "gta3logo256", + "connection24", "", + "findgame24", "", + "hostgame24", "", + "mainmenu24", "", + "Playersetup24", "", + "singleplayer24", "", + "multiplayer24", "", + "dmalogo128", "dmalogo128m", + "gtaLogo128", "gtaLogo128", + "rockstarLogo128", "rockstarlogo128m", + "gamespy256", "gamespy256a", + "mouse", "mousetimera", + "mousetimer", "mousetimera", + "mp3logo", "mp3logoA", + "downOFF", "buttonA", + "downON", "buttonA", + "upOFF", "buttonA", + "upON", "buttonA", + "gta3logo256", "gta3logo256m", + nil, nil }; #if 1 @@ -522,11 +524,8 @@ WRAPPER bool CMenuManager::CheckHover(int, int, int, int) { EAXJMP(0x48ACA0); } #else bool CMenuManager::CheckHover(int x1, int x2, int y1, int y2) { - if (m_nMousePosX > x1 && m_nMousePosX < x2) { - if (m_nMousePosY > y1 && m_nMousePosY < y2) - return true; - } - return false; + return m_nMousePosX > x1 && m_nMousePosX < x2 && + m_nMousePosY > y1 && m_nMousePosY < y2; } #endif @@ -544,7 +543,7 @@ WRAPPER void CMenuManager::DisplayHelperText() { EAXJMP(0x48B490); } #else void CMenuManager::DisplayHelperText() { - wchar *str = nullptr; + wchar *str = nil; switch (m_nHelperTextMsgId) { case 0: str = TheText.Get("FET_MIG"); @@ -585,27 +584,23 @@ float CMenuManager::DisplaySlider(float x, float y, float leftSize, float rightS float sizeRange; float input = 0.0f; - int rects = 16; - for (int i = 0; i < rects; i++) { - input = i * rectSize * 0.0625f + x; + for (int i = 0; i < 16; i++) { + input = i * rectSize/16.0f + x; - if (i * 0.0625f + 0.03125f < progress) + if (i/16.0f + 1/32.0f < progress) color = CRGBA(255, 217, 106, FadeIn(255)); else color = CRGBA(185, 120, 0, FadeIn(255)); - if (leftSize <= rightSize) - sizeRange = rightSize; - else - sizeRange = leftSize; + sizeRange = max(leftSize, rightSize); - float _x = i * rectSize * 0.0625f + x; - float _y = y + sizeRange - ((rects - i) * leftSize + i * rightSize) * 0.0625f; - float _w = SCREEN_SCALE_X(10.0f) + i * rectSize * 0.0625f + x; + float _x = i * rectSize/16.0f + x; + float _y = y + sizeRange - ((16 - i) * leftSize + i * rightSize)/16.0f; + float _w = SCREEN_SCALE_X(10.0f) + i * rectSize/16.0f + x; float _h = y + sizeRange; float _s = SCREEN_SCALE_X(2.0f); CSprite2d::DrawRect(CRect(_x + _s, _y + _s, _w + _s, _h + _s), CRGBA(0, 0, 0, FadeIn(255))); // Shadow - CSprite2d::DrawRect(CRect(i * rectSize * 0.0625f + x, y + sizeRange - ((rects - i) * leftSize + i * rightSize) * 0.0625f, SCREEN_SCALE_X(10.0f) + i * rectSize * 0.0625f + x, y + sizeRange), color); + CSprite2d::DrawRect(CRect(i * rectSize/16.0f + x, y + sizeRange - ((16 - i) * leftSize + i * rightSize)/16.0f, SCREEN_SCALE_X(10.0f) + i * rectSize/16.0f + x, y + sizeRange), color); }; return input; } @@ -693,8 +688,8 @@ void CMenuManager::Draw() } for (int i = 0; i < 18; ++i) { - if (aScreens[m_nCurrScreen].m_aEntries[i].m_Action != 1 && aScreens[m_nCurrScreen].m_aEntries[i].m_EntryName[0]) { - wchar *columnToPrint[COLUMNS] = { nullptr, nullptr }; + if (aScreens[m_nCurrScreen].m_aEntries[i].m_Action != MENUACTION_LABEL && aScreens[m_nCurrScreen].m_aEntries[i].m_EntryName[0]) { + wchar *columnToPrint[COLUMNS] = { nil, nil }; if (aScreens[m_nCurrScreen].m_aEntries[i].m_ActionSlot >= MENU_ACTION_SAVE_1 && aScreens[m_nCurrScreen].m_aEntries[i].m_ActionSlot <= MENU_ACTION_SAVE_8) { columnToPrint[L] = GetNameOfSavedGame(i - 1); @@ -710,9 +705,9 @@ void CMenuManager::Draw() } switch (aScreens[m_nCurrScreen].m_aEntries[i].m_Action) { - case 3: + case MENUACTION_CTRLVIBRATION: break; - case 4: + case MENUACTION_CTRLCONFIG: switch (CPad::GetPad(0)->Mode) { case 0: columnToPrint[R] = TheText.Get("FEC_CF1"); @@ -728,37 +723,37 @@ void CMenuManager::Draw() break; }; break; - case 5: + case MENUACTION_CTRLDISPLAY: break; - case 6: + case MENUACTION_FRAMESYNC: columnToPrint[R] = TheText.Get(m_PrefsVsyncDisp ? "FEM_ON" : "FEM_OFF"); break; - case 7: + case MENUACTION_FRAMELIMIT: columnToPrint[R] = TheText.Get(m_PrefsFrameLimiter ? "FEM_ON" : "FEM_OFF"); break; - case 8: + case MENUACTION_TRAILS: columnToPrint[R] = TheText.Get(BlurOn ? "FEM_ON" : "FEM_OFF"); break; - case 9: + case MENUACTION_SUBTITLES: columnToPrint[R] = TheText.Get(m_PrefsShowSubtitles ? "FEM_ON" : "FEM_OFF"); break; - case 10: + case MENUACTION_WIDESCREEN: columnToPrint[R] = TheText.Get(m_PrefsUseWideScreen ? "FEM_ON" : "FEM_OFF"); break; - case 16: + case MENUACTION_RADIO: sprintf(gString, "FEA_FM%d", m_PrefsRadioStation); columnToPrint[R] = TheText.Get(gString); break; - case 28: + case MENUACTION_SETDBGFLAG: columnToPrint[R] = TheText.Get(CTheScripts::DbgFlag ? "FEM_ON" : "FEM_OFF"); break; - case 29: + case MENUACTION_SWITCHBIGWHITEDEBUGLIGHT: columnToPrint[R] = TheText.Get(CTheScripts::DbgFlag ? "FEM_ON" : "FEM_OFF"); break; - case 81: + case MENUACTION_INVVERT: columnToPrint[R] = TheText.Get(MousePointerStateHelper.bInvertVertically ? "FEM_ON" : "FEM_OFF"); break; - case 94: + case MENUACTION_SCREENRES: { char *res = _psGetVideoModeList()[m_nDisplayVideoMode]; @@ -769,7 +764,7 @@ void CMenuManager::Draw() columnToPrint[R] = gUString; } break; - case 95: + case MENUACTION_AUDIOHW: if (FrontEndMenuManager.m_nPrefsAudio3DProviderIndex == -1) columnToPrint[R] = TheText.Get("FEA_NAH"); else { @@ -778,7 +773,7 @@ void CMenuManager::Draw() columnToPrint[R] = gUString; } break; - case 96: + case MENUACTION_SPEAKERCONF: if (FrontEndMenuManager.m_nPrefsAudio3DProviderIndex == -1) columnToPrint[R] = TheText.Get("FEA_NAH"); else { @@ -795,7 +790,7 @@ void CMenuManager::Draw() }; } break; - case 99: + case MENUACTION_CTRLMETHOD: switch (m_ControlMethod) { case 0: columnToPrint[L] = TheText.Get("FET_SCN"); @@ -805,10 +800,10 @@ void CMenuManager::Draw() break; }; break; - case 100: + case MENUACTION_DYNAMICACOUSTIC: columnToPrint[R] = TheText.Get(m_PrefsDMA ? "FEM_ON" : "FEM_OFF"); break; - case 102: + case MENUACTION_MOUSESTEER: columnToPrint[R] = TheText.Get(m_bDisableMouseSteering ? "FEM_ON" : "FEM_OFF"); break; }; @@ -949,20 +944,20 @@ void CMenuManager::Draw() // Sliders // TODO: CheckHover switch (aScreens[m_nCurrScreen].m_aEntries[i].m_Action) { - case 11: - DisplaySlider(SCREEN_SCALE_FROM_RIGHT(SLIDER_X), vecPositions.y - SCREEN_SCALE_Y(3.0f), SCREEN_SCALE_Y(2.0f), SCREEN_SCALE_Y(18.0f), SCREEN_SCALE_X(256.0f), m_PrefsBrightness * 0.001953125); + case MENUACTION_BRIGHTNESS: + DisplaySlider(SCREEN_SCALE_FROM_RIGHT(SLIDER_X), vecPositions.y - SCREEN_SCALE_Y(3.0f), SCREEN_SCALE_Y(2.0f), SCREEN_SCALE_Y(18.0f), SCREEN_SCALE_X(256.0f), m_PrefsBrightness/512.0f); break; - case 12: - DisplaySlider(SCREEN_SCALE_FROM_RIGHT(SLIDER_X), vecPositions.y - SCREEN_SCALE_Y(3.0f), SCREEN_SCALE_Y(2.0f), SCREEN_SCALE_Y(18.0f), SCREEN_SCALE_X(256.0f), (m_PrefsLOD - 0.80000001) * 1.0000001); + case MENUACTION_DRAWDIST: + DisplaySlider(SCREEN_SCALE_FROM_RIGHT(SLIDER_X), vecPositions.y - SCREEN_SCALE_Y(3.0f), SCREEN_SCALE_Y(2.0f), SCREEN_SCALE_Y(18.0f), SCREEN_SCALE_X(256.0f), (m_PrefsLOD - 0.8f) * 1.0f); break; - case 13: - DisplaySlider(SCREEN_SCALE_FROM_RIGHT(SLIDER_X), vecPositions.y - SCREEN_SCALE_Y(3.0f), SCREEN_SCALE_Y(2.0f), SCREEN_SCALE_Y(18.0f), SCREEN_SCALE_X(256.0f), m_PrefsMusicVolume * 0.0078125); + case MENUACTION_MUSICVOLUME: + DisplaySlider(SCREEN_SCALE_FROM_RIGHT(SLIDER_X), vecPositions.y - SCREEN_SCALE_Y(3.0f), SCREEN_SCALE_Y(2.0f), SCREEN_SCALE_Y(18.0f), SCREEN_SCALE_X(256.0f), m_PrefsMusicVolume/128.0f); break; - case 14: - DisplaySlider(SCREEN_SCALE_FROM_RIGHT(SLIDER_X), vecPositions.y - SCREEN_SCALE_Y(3.0f), SCREEN_SCALE_Y(2.0f), SCREEN_SCALE_Y(18.0f), SCREEN_SCALE_X(256.0f), m_PrefsSfxVolume * 0.0078125); + case MENUACTION_SFXVOLUME: + DisplaySlider(SCREEN_SCALE_FROM_RIGHT(SLIDER_X), vecPositions.y - SCREEN_SCALE_Y(3.0f), SCREEN_SCALE_Y(2.0f), SCREEN_SCALE_Y(18.0f), SCREEN_SCALE_X(256.0f), m_PrefsSfxVolume/128.0f); break; - case 84: - DisplaySlider(SCREEN_SCALE_FROM_RIGHT(SLIDER_X), vecPositions.y - SCREEN_SCALE_Y(3.0f), SCREEN_SCALE_Y(2.0f), SCREEN_SCALE_Y(18.0f), SCREEN_SCALE_X(256.0f), TheCamera.m_fMouseAccelHorzntl * 200.0); + case MENUACTION_MOUSESENS: + DisplaySlider(SCREEN_SCALE_FROM_RIGHT(SLIDER_X), vecPositions.y - SCREEN_SCALE_Y(3.0f), SCREEN_SCALE_Y(2.0f), SCREEN_SCALE_Y(18.0f), SCREEN_SCALE_X(256.0f), TheCamera.m_fMouseAccelHorzntl * 200.0f); break; }; @@ -971,7 +966,7 @@ void CMenuManager::Draw() if (m_nCurrScreen == MENU_SOUND_SETTINGS) { for (int i = 0; i < POLICE_RADIO; i++) { - if (i > 5 && i < 7) + if (i == MSX_FM) fIconSpacing -= 1.5f; if (i < USERTRACK) @@ -1046,14 +1041,14 @@ void CMenuManager::DrawFrontEnd() { CFont::SetAlphaFade(255.0f); - if (!m_nCurrScreen) { + if (m_nCurrScreen == MENU_NONE) { if (m_bGameNotLoaded) m_nCurrScreen = MENU_START_MENU; else m_nCurrScreen = MENU_PAUSE_MENU; } - if (!m_nCurrOption && aScreens[m_nCurrScreen].m_aEntries[0].m_Action == 1) + if (!m_nCurrOption && aScreens[m_nCurrScreen].m_aEntries[0].m_Action == MENUACTION_LABEL) m_nCurrOption = 1; CMenuManager::DrawFrontEndNormal(); @@ -1077,7 +1072,7 @@ void CMenuManager::DrawFrontEndNormal() CSprite2d::InitPerFrame(); CFont::InitPerFrame(); - eMenuSprites currentSprite = MENU_CONNECTION; + eMenuSprites currentSprite = MENU_MAINMENU; switch (m_nPrevScreen) { case MENU_STATS: case MENU_START_MENU: @@ -1134,7 +1129,7 @@ void CMenuManager::DrawFrontEndNormal() } // GTA LOGO - if (m_nCurrScreen == 51 || m_nCurrScreen == 52) { + if (m_nCurrScreen == MENU_START_MENU || m_nCurrScreen == MENU_PAUSE_MENU) { if (CGame::frenchGame || CGame::germanGame || !CGame::nastyGame) m_aMenuSprites[MENU_GTA3LOGO].Draw(CRect((SCREEN_WIDTH / 2) - SCREEN_SCALE_X(115.0f), SCREEN_SCALE_Y(70.0f), (SCREEN_WIDTH / 2) + SCREEN_SCALE_X(115.0f), SCREEN_SCALE_Y(180.0f)), CRGBA(255, 255, 255, FadeIn(255))); else @@ -1262,8 +1257,8 @@ void CMenuManager::LoadAllTextures() CTxdStore::SetCurrentTxd(menu); debug("LOAD sprite\n"); - for (int i = 0; i < ARRAY_SIZE(MenuFilenames); i++) { - m_aMenuSprites[i].SetTexture(MenuFilenames[i]); + for (int i = 0; i < ARRAY_SIZE(MenuFilenames)/2; i++) { + m_aMenuSprites[i].SetTexture(MenuFilenames[i*2], MenuFilenames[i*2+1]); m_aMenuSprites[i].SetAddressing(rwTEXTUREADDRESSBORDER); }; @@ -1485,7 +1480,7 @@ void CMenuManager::UnloadTextures() CTxdStore::RemoveTxdSlot(frontend); debug("Remove menu textures\n"); - for (int i = 0; i < ARRAY_SIZE(MenuFilenames); ++i) + for (int i = 0; i < ARRAY_SIZE(MenuFilenames)/2; ++i) m_aMenuSprites[i].Delete(); int menu = CTxdStore::FindTxdSlot("menu"); diff --git a/src/Frontend.h b/src/Frontend.h index 2f68fdcd..7245477f 100644 --- a/src/Frontend.h +++ b/src/Frontend.h @@ -94,8 +94,8 @@ enum eMenuSprites { MENU_MOUSET, MENU_MP3LOGO, MENU_DOWNOFF, - MENU_UPOFF, MENU_DOWNON, + MENU_UPOFF, MENU_UPON, MENU_GTA3LOGO, }; @@ -173,6 +173,120 @@ enum eMenuScreen { MENU_58 = 58, }; +enum eMenuAction { + MENUACTION_NOTHING, + MENUACTION_LABEL, + MENUACTION_CHANGEMENU, + MENUACTION_CTRLVIBRATION, + MENUACTION_CTRLCONFIG, + MENUACTION_CTRLDISPLAY, + MENUACTION_FRAMESYNC, + MENUACTION_FRAMELIMIT, + MENUACTION_TRAILS, + MENUACTION_SUBTITLES, + MENUACTION_WIDESCREEN, + MENUACTION_BRIGHTNESS, + MENUACTION_DRAWDIST, + MENUACTION_MUSICVOLUME, + MENUACTION_SFXVOLUME, + MENUACTION_UNK15, + MENUACTION_RADIO, + MENUACTION_LANG_ENG, + MENUACTION_LANG_FRE, + MENUACTION_LANG_GER, + MENUACTION_LANG_IT, + MENUACTION_LANG_SPA, + MENUACTION_UPDATESAVE, + MENUACTION_CHECKSAVE, + MENUACTION_UNK24, + MENUACTION_NEWGAME, + MENUACTION_RELOADIDE, + MENUACTION_RELOADIPL, + MENUACTION_SETDBGFLAG, + MENUACTION_SWITCHBIGWHITEDEBUGLIGHT, + MENUACTION_PEDROADGROUPS, + MENUACTION_CARROADGROUPS, + MENUACTION_COLLISIONPOLYS, + MENUACTION_REGMEMCARD1, + MENUACTION_TESTFORMATMEMCARD1, + MENUACTION_TESTUNFORMATMEMCARD1, + MENUACTION_CREATEROOTDIR, + MENUACTION_CREATELOADICONS, + MENUACTION_FILLWITHGUFF, + MENUACTION_SAVEONLYTHEGAME, + MENUACTION_SAVEGAME, + MENUACTION_SAVEGAMEUNDERGTA, + MENUACTION_CREATECOPYPROTECTED, + MENUACTION_TESTSAVE, + MENUACTION_TESTLOAD, + MENUACTION_TESTDELETE, + MENUACTION_PARSEHEAP, + MENUACTION_SHOWCULL, + MENUACTION_MEMCARDSAVECONFIRM, + MENUACTION_UPDATEMEMCARDSAVE, + MENUACTION_UNK50, + MENUACTION_DEBUGSTREAM, + MENUACTION_MPMAP_LIBERTY, + MENUACTION_MPMAP_REDLIGHT, + MENUACTION_MPMAP_CHINATOWN, + MENUACTION_MPMAP_TOWER, + MENUACTION_MPMAP_SEWER, + MENUACTION_MPMAP_INDUSTPARK, + MENUACTION_MPMAP_DOCKS, + MENUACTION_MPMAP_STAUNTON, + MENUACTION_MPMAP_DEATHMATCH1, + MENUACTION_MPMAP_DEATHMATCH2, + MENUACTION_MPMAP_TEAMDEATH1, + MENUACTION_MPMAP_TEAMDEATH2, + MENUACTION_MPMAP_STASH, + MENUACTION_MPMAP_CAPTURE, + MENUACTION_MPMAP_RATRACE, + MENUACTION_MPMAP_DOMINATION, + MENUACTION_STARTMP, + MENUACTION_UNK69, + MENUACTION_UNK70, + MENUACTION_FINDMP, + MENUACTION_REDEFCTRL, + MENUACTION_UNK73, + MENUACTION_INITMP, + MENUACTION_MP_PLAYERCOLOR, + MENUACTION_MP_PLAYERNAME, + MENUACTION_MP_GAMENAME, + MENUACTION_GETKEY, + MENUACTION_SHOWHEADBOB, + MENUACTION_UNK80, + MENUACTION_INVVERT, + MENUACTION_CANCLEGAME, + MENUACTION_MP_PLAYERNUMBER, + MENUACTION_MOUSESENS, + MENUACTION_CHECKMPGAMES, + MENUACTION_CHECKMPPING, + MENUACTION_MP_SERVER, + MENUACTION_MP_MAP, + MENUACTION_MP_GAMETYPE, + MENUACTION_MP_LAN, + MENUACTION_MP_INTERNET, + MENUACTION_RESUME, + MENUACTION_DONTCANCLE, + MENUACTION_SCREENRES, + MENUACTION_AUDIOHW, + MENUACTION_SPEAKERCONF, + MENUACTION_PLAYERSETUP, + MENUACTION_RESTOREDEF, + MENUACTION_CTRLMETHOD, + MENUACTION_DYNAMICACOUSTIC, + MENUACTION_LOADRADIO, + MENUACTION_MOUSESTEER, + MENUACTION_UNK103, + MENUACTION_UNK104, + MENUACTION_UNK105, + MENUACTION_UNK106, + MENUACTION_UNK107, + MENUACTION_UNK108, + MENUACTION_UNK109, + MENUACTION_UNK110, +}; + enum eCheckHover { ACTIVATE_OPTION = 2, IGNORE_OPTION = 42, |