From f754da272f3d5c97bef38ed777c5e5280a95d556 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Sat, 9 May 2020 13:43:08 +0300 Subject: Menu map fixes and resizable window on GLFW --- src/core/Frontend.cpp | 37 ++++++++++++++++++++++++++++++++----- src/core/MenuScreens.h | 2 ++ src/core/Radar.cpp | 4 ++-- 3 files changed, 36 insertions(+), 7 deletions(-) (limited to 'src/core') diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index fc845a4c..827e2ca7 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -901,6 +901,25 @@ CMenuManager::Draw() bool foundTheHoveringItem = false; wchar unicodeTemp[64]; +#ifdef MENU_MAP + if (m_nCurrScreen == MENUPAGE_MAP) { + // Back button + wchar *backTx = TheText.Get("FEDS_TB"); + CFont::SetDropShadowPosition(1); + CFont::SetDropColor(CRGBA(0, 0, 0, 255)); + CFont::PrintString(MENU_X(60.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f), backTx); + CFont::SetDropShadowPosition(0); + if (!CheckHover(MENU_X(30.0f), MENU_X(30.0f) + CFont::GetStringWidth(backTx), SCREEN_SCALE_FROM_BOTTOM(125.0f), SCREEN_SCALE_FROM_BOTTOM(105.0f))) { + m_nHoverOption = HOVEROPTION_NOT_HOVERING; + m_nCurrOption = m_nPrevOption = 0; + } else { + m_nHoverOption = HOVEROPTION_RANDOM_ITEM; + m_nCurrOption = m_nPrevOption = 1; + } + return; + } +#endif + for (int i = 0; i < NUM_MENUROWS; ++i) { if (aScreens[m_nCurrScreen].m_aEntries[i].m_Action != MENUACTION_LABEL && aScreens[m_nCurrScreen].m_aEntries[i].m_EntryName[0] != '\0') { wchar *rightText = nil; @@ -5381,13 +5400,13 @@ CMenuManager::PrintController(void) #define ZOOM(x, y, in) \ do { \ - if(fMapSize > SCREEN_WIDTH * 2 && in) \ + if(fMapSize > SCREEN_HEIGHT * 3.0f && in) \ break; \ float z2 = in? 1.1f : 1.f/1.1f; \ fMapCenterX += (x - fMapCenterX) * (1.0f - z2); \ fMapCenterY += (y - fMapCenterY) * (1.0f - z2); \ \ - if (fMapSize < SCREEN_WIDTH / 3 && !in) \ + if (fMapSize < SCREEN_HEIGHT / 2 && !in) \ break; \ \ fMapSize *= z2; \ @@ -5400,10 +5419,18 @@ CMenuManager::PrintMap(void) bMenuMapActive = true; CRadar::InitFrontEndMap(); + // Just entered to map if (!bMapLoaded) { - fMapCenterX = SCREEN_WIDTH / 2; - fMapCenterY = SCREEN_HEIGHT / 3; - fMapSize = SCREEN_HEIGHT / CDraw::GetAspectRatio(); + fMapSize = SCREEN_HEIGHT * 2.0f; + fMapCenterX = 0.0f; + fMapCenterY = 0.0f; + CVector2D radarSpacePlayer; + CVector2D screenSpacePlayer; + CRadar::TransformRealWorldPointToRadarSpace(radarSpacePlayer, CVector2D(FindPlayerCoors())); + CRadar::TransformRadarPointToScreenSpace(screenSpacePlayer, radarSpacePlayer); + + fMapCenterX = (-screenSpacePlayer.x) + SCREEN_WIDTH / 2; + fMapCenterY = (-screenSpacePlayer.y) + SCREEN_HEIGHT / 2; bMapMouseShownOnce = false; bMapLoaded = true; diff --git a/src/core/MenuScreens.h b/src/core/MenuScreens.h index 339479b8..6c2ebdb8 100644 --- a/src/core/MenuScreens.h +++ b/src/core/MenuScreens.h @@ -459,6 +459,8 @@ const CMenuScreen aScreens[] = { #ifdef MENU_MAP // MENUPAGE_MAP = 59 { "FEG_MAP", 1, MENUPAGE_NONE, MENUPAGE_NONE, 5, 2, + MENUACTION_UNK110, "", SAVESLOT_NONE, MENUPAGE_NONE, // to prevent cross/enter to go back + MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, }, #endif }; diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp index 7e3d0083..9406f1bd 100644 --- a/src/core/Radar.cpp +++ b/src/core/Radar.cpp @@ -1435,9 +1435,9 @@ CRadar::DrawYouAreHereSprite(float x, float y) if (show) { float left = x - SCREEN_SCALE_X(12.0f); - float top = y - SCREEN_SCALE_Y(2.0f); + float top = y; float right = SCREEN_SCALE_X(12.0) + x; - float bottom = y - SCREEN_SCALE_Y(26.0f); + float bottom = y - SCREEN_SCALE_Y(24.0f); CentreSprite.Draw(CRect(left, top, right, bottom), CRGBA(255, 255, 255, 255)); } MapLegendList[MapLegendCounter++] = RADAR_SPRITE_CENTRE; -- cgit v1.2.3 From 28103775ba799133b252e423e3da62ed7b09f7b9 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 9 May 2020 16:06:13 +0300 Subject: Place debug menu under ifdef --- src/core/AnimViewer.cpp | 3 ++- src/core/Cam.cpp | 2 +- src/core/Game.cpp | 3 ++- src/core/config.h | 1 + src/core/main.cpp | 12 ++++++++---- src/core/re3.cpp | 2 ++ 6 files changed, 16 insertions(+), 7 deletions(-) (limited to 'src/core') diff --git a/src/core/AnimViewer.cpp b/src/core/AnimViewer.cpp index 00d39066..40a8b09e 100644 --- a/src/core/AnimViewer.cpp +++ b/src/core/AnimViewer.cpp @@ -248,8 +248,9 @@ CAnimViewer::Update(void) } CPad::UpdatePads(); CPad* pad = CPad::GetPad(0); - +#ifdef DEBUGMENU DebugMenuProcess(); +#endif CStreaming::UpdateForAnimViewer(); CStreaming::RequestModel(modelId, 0); diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index 3b11ec5f..20b262c8 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -29,7 +29,7 @@ bool PrintDebugCode = false; int16 DebugCamMode; #ifdef FREE_CAM -bool CCamera::bFreeCam = false; +bool CCamera::bFreeCam = true; int nPreviousMode = -1; #endif diff --git a/src/core/Game.cpp b/src/core/Game.cpp index d0f412d8..969e0cdf 100644 --- a/src/core/Game.cpp +++ b/src/core/Game.cpp @@ -611,8 +611,9 @@ void CGame::Process(void) TheCamera.SetMotionBlurAlpha(0); if (TheCamera.m_BlurType == MBLUR_NONE || TheCamera.m_BlurType == MBLUR_SNIPER || TheCamera.m_BlurType == MBLUR_NORMAL) TheCamera.SetMotionBlur(0, 0, 0, 0, MBLUR_NONE); - +#ifdef DEBUGMENU DebugMenuProcess(); +#endif CCutsceneMgr::Update(); if (!CCutsceneMgr::IsCutsceneProcessing() && !CTimer::GetIsCodePaused()) FrontEndMenuManager.Process(); diff --git a/src/core/config.h b/src/core/config.h index 79d9ab86..20e5d679 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -187,6 +187,7 @@ enum Config { # define NO_MOVIES // disable intro videos # define NO_CDCHECK # define CHATTYSPLASH // print what the game is loading +# define DEBUGMENU //# define TIMEBARS // print debug timers #endif diff --git a/src/core/main.cpp b/src/core/main.cpp index ec37fa28..37a5673f 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -91,7 +91,9 @@ void GameInit(void); void SystemInit(void); void TheGame(void); +#ifdef DEBUGMENU void DebugMenuPopulate(void); +#endif void @@ -328,11 +330,10 @@ Initialise3D(void *param) { if (RsRwInitialise(param)) { - // +#ifdef DEBUGMENU DebugMenuInit(); DebugMenuPopulate(); - // - +#endif // !DEBUGMENU return CGame::InitialiseRenderWare(); } @@ -343,8 +344,9 @@ static void Terminate3D(void) { CGame::ShutdownRenderWare(); - +#ifdef DEBUGMENU DebugMenuShutdown(); +#endif // !DEBUGMENU RsRwTerminate(); @@ -878,7 +880,9 @@ Render2dStuff(void) CPad::PrintErrorMessage(); CFont::DrawFonts(); +#ifdef DEBUGMENU DebugMenuRender(); +#endif } void diff --git a/src/core/re3.cpp b/src/core/re3.cpp index a74b81a3..2c07836a 100644 --- a/src/core/re3.cpp +++ b/src/core/re3.cpp @@ -61,6 +61,7 @@ mysrand(unsigned int seed) myrand_seed = seed; } +#ifdef DEBUGMENU void WeaponCheat(); void HealthCheat(); void TankCheat(); @@ -384,6 +385,7 @@ DebugMenuPopulate(void) CTweakVars::AddDBG("Debug"); } } +#endif const int re3_buffsize = 1024; static char re3_buff[re3_buffsize]; -- cgit v1.2.3 From d9a3533438ea0bf3ace712facfd01c9462390130 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sun, 10 May 2020 01:14:00 +0300 Subject: Small unification --- src/core/templates.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core') diff --git a/src/core/templates.h b/src/core/templates.h index 69844fa4..4f7b8490 100644 --- a/src/core/templates.h +++ b/src/core/templates.h @@ -131,7 +131,7 @@ public: // TODO: the cast is unsafe return (int)((U*)entry - m_entries); } - int GetNoOfUsedSpaces(void){ + int GetNoOfUsedSpaces(void) const{ int i; int n = 0; for(i = 0; i < m_size; i++) -- cgit v1.2.3