summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authoreray orçunus <erayorcunus@gmail.com>2020-04-07 01:15:55 +0200
committereray orçunus <erayorcunus@gmail.com>2020-04-07 19:18:24 +0200
commit1f8e073c0a446a6c6fe959cc39e27df6e456becc (patch)
tree4f6829e3ada8874d0ad7fa8bf1f4778b682e0756 /src/core
parentfinished CCollision (diff)
downloadre3-1f8e073c0a446a6c6fe959cc39e27df6e456becc.tar
re3-1f8e073c0a446a6c6fe959cc39e27df6e456becc.tar.gz
re3-1f8e073c0a446a6c6fe959cc39e27df6e456becc.tar.bz2
re3-1f8e073c0a446a6c6fe959cc39e27df6e456becc.tar.lz
re3-1f8e073c0a446a6c6fe959cc39e27df6e456becc.tar.xz
re3-1f8e073c0a446a6c6fe959cc39e27df6e456becc.tar.zst
re3-1f8e073c0a446a6c6fe959cc39e27df6e456becc.zip
Diffstat (limited to '')
-rw-r--r--src/core/Camera.cpp42
-rw-r--r--src/core/Camera.h14
-rw-r--r--src/core/Frontend.cpp219
-rw-r--r--src/core/Frontend.h35
-rw-r--r--src/core/MenuScreens.h25
-rw-r--r--src/core/Radar.cpp183
-rw-r--r--src/core/Radar.h10
-rw-r--r--src/core/config.h2
8 files changed, 462 insertions, 68 deletions
diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp
index e5bc09c8..9d927354 100644
--- a/src/core/Camera.cpp
+++ b/src/core/Camera.cpp
@@ -727,12 +727,24 @@ CCamera::CamControl(void)
if(CarZoomIndicator == CAM_ZOOM_1STPRS && !m_bPlayerIsInGarage){
CarZoomValue = 0.0f;
ReqMode = CCam::MODE_1STPERSON;
- }else if(CarZoomIndicator == CAM_ZOOM_1)
- CarZoomValue = 0.05f;
+ }
+#ifdef FREE_CAM
+ else if (bFreeCam) {
+ if (CarZoomIndicator == CAM_ZOOM_1)
+ CarZoomValue = ((CVehicle*)pTargetEntity)->IsBoat() ? FREE_BOAT_ZOOM_VALUE_1 : FREE_CAR_ZOOM_VALUE_1;
+ else if (CarZoomIndicator == CAM_ZOOM_2)
+ CarZoomValue = ((CVehicle*)pTargetEntity)->IsBoat() ? FREE_BOAT_ZOOM_VALUE_2 : FREE_CAR_ZOOM_VALUE_2;
+ else if (CarZoomIndicator == CAM_ZOOM_3)
+ CarZoomValue = ((CVehicle*)pTargetEntity)->IsBoat() ? FREE_BOAT_ZOOM_VALUE_3 : FREE_CAR_ZOOM_VALUE_3;
+ }
+#endif
+ else if(CarZoomIndicator == CAM_ZOOM_1)
+ CarZoomValue = DEFAULT_CAR_ZOOM_VALUE_1;
else if(CarZoomIndicator == CAM_ZOOM_2)
- CarZoomValue = 1.9f;
+ CarZoomValue = DEFAULT_CAR_ZOOM_VALUE_2;
else if(CarZoomIndicator == CAM_ZOOM_3)
- CarZoomValue = 3.9f;
+ CarZoomValue = DEFAULT_CAR_ZOOM_VALUE_3;
+
if(CarZoomIndicator == CAM_ZOOM_TOPDOWN && !m_bPlayerIsInGarage){
CarZoomValue = 1.0f;
ReqMode = CCam::MODE_TOPDOWN;
@@ -2956,11 +2968,23 @@ CCamera::SetZoomValueFollowPedScript(int16 dist)
void
CCamera::SetZoomValueCamStringScript(int16 dist)
{
- switch (dist) {
- case 0: m_fCarZoomValueScript = 0.05f; break;
- case 1: m_fCarZoomValueScript = 1.9f; break;
- case 2: m_fCarZoomValueScript = 3.9f; break;
- default: m_fCarZoomValueScript = m_fCarZoomValueScript; break;
+#ifdef FREE_CAM
+ if (bFreeCam) {
+ switch (dist) {
+ case 0: m_fCarZoomValueScript = ((CVehicle*)Cams[ActiveCam].CamTargetEntity)->IsBoat() ? FREE_BOAT_ZOOM_VALUE_1 : FREE_CAR_ZOOM_VALUE_1; break;
+ case 1: m_fCarZoomValueScript = ((CVehicle*)Cams[ActiveCam].CamTargetEntity)->IsBoat() ? FREE_BOAT_ZOOM_VALUE_2 : FREE_CAR_ZOOM_VALUE_2; break;
+ case 2: m_fCarZoomValueScript = ((CVehicle*)Cams[ActiveCam].CamTargetEntity)->IsBoat() ? FREE_BOAT_ZOOM_VALUE_3 : FREE_CAR_ZOOM_VALUE_3; break;
+ default: m_fCarZoomValueScript = m_fCarZoomValueScript; break;
+ }
+ } else
+#endif
+ {
+ switch (dist) {
+ case 0: m_fCarZoomValueScript = DEFAULT_CAR_ZOOM_VALUE_1; break;
+ case 1: m_fCarZoomValueScript = DEFAULT_CAR_ZOOM_VALUE_2; break;
+ case 2: m_fCarZoomValueScript = DEFAULT_CAR_ZOOM_VALUE_3; break;
+ default: m_fCarZoomValueScript = m_fCarZoomValueScript; break;
+ }
}
m_bUseScriptZoomValueCar = true;
diff --git a/src/core/Camera.h b/src/core/Camera.h
index f21fe913..c22ba9c8 100644
--- a/src/core/Camera.h
+++ b/src/core/Camera.h
@@ -23,6 +23,20 @@ enum
#define CAM_ZOOM_TOPDOWN (4.0f)
#define CAM_ZOOM_CINEMATIC (5.0f)
+#ifdef FREE_CAM // LCS values
+#define FREE_CAR_ZOOM_VALUE_1 (-1.0f)
+#define FREE_CAR_ZOOM_VALUE_2 (2.0f)
+#define FREE_CAR_ZOOM_VALUE_3 (6.0f)
+
+#define FREE_BOAT_ZOOM_VALUE_1 (-2.41f)
+#define FREE_BOAT_ZOOM_VALUE_2 (6.49f)
+#define FREE_BOAT_ZOOM_VALUE_3 (15.0f)
+#endif
+
+#define DEFAULT_CAR_ZOOM_VALUE_1 (0.05f)
+#define DEFAULT_CAR_ZOOM_VALUE_2 (1.9f)
+#define DEFAULT_CAR_ZOOM_VALUE_3 (3.9f)
+
class CCam
{
public:
diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp
index a7851650..49b95f7d 100644
--- a/src/core/Frontend.cpp
+++ b/src/core/Frontend.cpp
@@ -27,12 +27,20 @@
#include "World.h"
#include "Renderer.h"
#include "CdStream.h"
+#include "Radar.h"
#define DONT_USE_SUSPICIOUS_FUNCS 1
#define TIDY_UP_PBP // ProcessButtonPresses
#define MAX_VISIBLE_LIST_ROW 30
#define SCROLLBAR_MAX_HEIGHT 263.0f // actually it's 273. but calculating it from scrollbar drawing code gives 287. i don't know
+#ifdef MENU_MAP
+bool CMenuManager::bMenuMapActive = false;
+float CMenuManager::fMapSize;
+float CMenuManager::fMapCenterY;
+float CMenuManager::fMapCenterX;
+#endif
+
#ifdef PS2_LIKE_MENU
BottomBarOption bbNames[8];
int bbTabCount = 0;
@@ -129,7 +137,22 @@ const char* FrontendFilenames[][2] = {
{"fe_radio7", "" }, // MSX_FM
{"fe_radio8", "" }, // FLASHBACK
{"fe_radio9", "" }, // CHATTERBOX
-};
+};
+
+#ifdef MENU_MAP
+const char* MapFilenames[][2] = {
+ {"mapMid01", "mapMid01A"},
+ {"mapMid02", "mapMid02A"},
+ {"mapMid03", "mapMid03A"},
+ {"mapBot01", "mapBot01A"},
+ {"mapBot02", "mapBot02A"},
+ {"mapBot03", "mapBot03A"},
+ {"mapTop01", "mapTop01A"},
+ {"mapTop02", "mapTop02A"},
+ {"mapTop03", "mapTop03A"},
+};
+CSprite2d CMenuManager::m_aMapSprites[NUM_MAP_SPRITES];
+#endif
// 0x5F3344
const char* MenuFilenames[][2] = {
@@ -362,7 +385,7 @@ void CMenuManager::CentreMousePointer()
{
tagPOINT Point;
- if (SCREEN_WIDTH * 0.5f == 0.0f && 0.0f == SCREEN_HEIGHT * 0.5f) {
+ if (SCREEN_WIDTH * 0.5f != 0.0f && 0.0f != SCREEN_HEIGHT * 0.5f) {
Point.x = SCREEN_WIDTH / 2;
Point.y = SCREEN_HEIGHT / 2;
ClientToScreen(PSGLOBAL(window), &Point);
@@ -562,6 +585,11 @@ void CMenuManager::Draw()
case MENUPAGE_BRIEFS:
PrintBriefs();
break;
+#ifdef MENU_MAP
+ case MENUPAGE_MAP:
+ PrintMap();
+ break;
+#endif
}
// Header height isn't accounted, we will add that later.
@@ -1156,7 +1184,7 @@ void CMenuManager::Draw()
if (m_nCurrScreen == MENUPAGE_CONTROLLER_SETTINGS)
PrintController();
-
+
/* else if (m_nCurrScreen == MENUPAGE_SKIN_SELECT_OLD) {
CSprite2d::DrawRect(CRect(StretchX(180), MENU_Y(98), StretchX(230), MENU_Y(123)), CRGBA(255, 255, 255, FadeIn(255)));
CSprite2d::DrawRect(CRect(StretchX(181), MENU_Y(99), StretchX(229), MENU_Y(233)), CRGBA(Player color from PickNewPlayerColour, FadeIn(255)));
@@ -2570,7 +2598,12 @@ void CMenuManager::LoadAllTextures()
m_aMenuSprites[i].SetTexture(MenuFilenames[i][0], MenuFilenames[i][1]);
m_aMenuSprites[i].SetAddressing(rwTEXTUREADDRESSBORDER);
}
-
+#ifdef MENU_MAP
+ for (int i = 0; i < ARRAY_SIZE(MapFilenames); i++) {
+ m_aMapSprites[i].SetTexture(MapFilenames[i][0], MapFilenames[i][1]);
+ m_aMapSprites[i].SetAddressing(rwTEXTUREADDRESSBORDER);
+ }
+#endif
m_bSpritesLoaded = true;
CTxdStore::PopCurrentTxd();
}
@@ -3756,6 +3789,14 @@ CMenuManager::ProcessButtonPresses(void)
break;
#endif
} else {
+#ifdef MENU_MAP
+ if (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu == MENUPAGE_MAP) {
+ fMapCenterX = SCREEN_WIDTH / 2;
+ fMapCenterY = SCREEN_HEIGHT / 3;
+ fMapSize = SCREEN_HEIGHT / CDraw::GetAspectRatio();
+ }
+
+#endif
ChangeScreen(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu, 0, true, true);
}
}
@@ -4428,7 +4469,10 @@ void CMenuManager::UnloadTextures()
printf("REMOVE menu textures\n");
for (int i = 0; i < ARRAY_SIZE(MenuFilenames); ++i)
m_aMenuSprites[i].Delete();
-
+#ifdef MENU_MAP
+ for (int i = 0; i < ARRAY_SIZE(MapFilenames); ++i)
+ m_aMapSprites[i].Delete();
+#endif
int menu = CTxdStore::FindTxdSlot("menu");
CTxdStore::RemoveTxd(menu);
@@ -4674,6 +4718,171 @@ CMenuManager::PrintController(void)
}
}
+#ifdef MENU_MAP
+
+#define ZOOM(x, y, in) \
+ do { \
+ if ((fMapSize < SCREEN_WIDTH / 3 && !in) || (fMapSize > SCREEN_WIDTH * 2 && in)) \
+ break; \
+ float z2 = in? 1.1f : 1.f/1.1f; \
+ fMapCenterX += (x - fMapCenterX) * (1.0f - z2); \
+ fMapCenterY += (y - fMapCenterY) * (1.0f - z2); \
+ fMapSize *= z2; \
+ } while(0) \
+
+void
+CMenuManager::PrintMap(void)
+{
+ bMenuMapActive = true;
+ CRadar::InitFrontEndMap();
+
+ // Because fMapSize is half of the map length, and map consists of 3x3 tiles.
+ float halfTile = fMapSize / 3.0f;
+
+ RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
+
+ if (SCREEN_WIDTH >= fMapCenterX - fMapSize || SCREEN_HEIGHT >= fMapCenterY - fMapSize) {
+ m_aMapSprites[MAPTOP1].Draw(CRect(fMapCenterX - fMapSize, fMapCenterY - fMapSize,
+ fMapCenterX - halfTile, fMapCenterY - halfTile), CRGBA(255, 255, 255, FadeIn(255)));
+ }
+
+ if (SCREEN_WIDTH >= fMapCenterX - halfTile || SCREEN_HEIGHT >= fMapCenterY - fMapSize) {
+ m_aMapSprites[MAPTOP2].Draw(CRect(fMapCenterX - halfTile, fMapCenterY - fMapSize,
+ fMapCenterX + halfTile, fMapCenterY - halfTile), CRGBA(255, 255, 255, FadeIn(255)));
+ }
+
+ if (SCREEN_WIDTH >= fMapCenterX - halfTile || SCREEN_HEIGHT >= fMapCenterY - fMapSize) {
+ m_aMapSprites[MAPTOP3].Draw(CRect(fMapCenterX + halfTile, fMapCenterY - fMapSize,
+ fMapCenterX + fMapSize, fMapCenterY - halfTile), CRGBA(255, 255, 255, FadeIn(255)));
+ }
+
+ if (SCREEN_WIDTH >= fMapCenterX - fMapSize || SCREEN_HEIGHT >= fMapCenterY - halfTile) {
+ m_aMapSprites[MAPMID1].Draw(CRect(fMapCenterX - fMapSize, fMapCenterY - halfTile,
+ fMapCenterX - halfTile, fMapCenterY + halfTile), CRGBA(255, 255, 255, FadeIn(255)));
+ }
+
+ if (SCREEN_WIDTH >= fMapCenterX - halfTile || SCREEN_HEIGHT >= fMapCenterY - halfTile) {
+ m_aMapSprites[MAPMID2].Draw(CRect(fMapCenterX - halfTile, fMapCenterY - halfTile,
+ fMapCenterX + halfTile, fMapCenterY + halfTile), CRGBA(255, 255, 255, FadeIn(255)));
+ }
+
+ if (SCREEN_WIDTH >= fMapCenterX - halfTile || SCREEN_HEIGHT >= fMapCenterY - halfTile) {
+ m_aMapSprites[MAPMID3].Draw(CRect(fMapCenterX + halfTile, fMapCenterY - halfTile,
+ fMapCenterX + fMapSize, fMapCenterY + halfTile), CRGBA(255, 255, 255, FadeIn(255)));
+ }
+
+ if (SCREEN_WIDTH >= fMapCenterX - fMapSize || SCREEN_HEIGHT >= fMapCenterY - halfTile) {
+ m_aMapSprites[MAPBOT1].Draw(CRect(fMapCenterX - fMapSize, fMapCenterY + halfTile,
+ fMapCenterX - halfTile, fMapCenterY + fMapSize), CRGBA(255, 255, 255, FadeIn(255)));
+ }
+
+ if (SCREEN_WIDTH >= fMapCenterX - halfTile || SCREEN_HEIGHT >= fMapCenterY - halfTile) {
+ m_aMapSprites[MAPBOT2].Draw(CRect(fMapCenterX - halfTile, fMapCenterY + halfTile,
+ fMapCenterX + halfTile, fMapCenterY + fMapSize), CRGBA(255, 255, 255, FadeIn(255)));
+ }
+
+ if (SCREEN_WIDTH >= fMapCenterX - halfTile || SCREEN_HEIGHT >= fMapCenterY - halfTile) {
+ m_aMapSprites[MAPBOT3].Draw(CRect(fMapCenterX + halfTile, fMapCenterY + halfTile,
+ fMapCenterX + fMapSize, fMapCenterY + fMapSize), CRGBA(255, 255, 255, FadeIn(255)));
+ }
+
+ CRadar::DrawBlips();
+
+ if (CPad::GetPad(0)->GetRightMouseJustDown()) {
+ if (m_nMousePosY > fMapCenterY - fMapSize && m_nMousePosY < fMapCenterY + fMapSize &&
+ m_nMousePosX > fMapCenterX - fMapSize && m_nMousePosX < fMapCenterX + fMapSize) {
+
+ float diffX = fMapCenterX - fMapSize, diffY = fMapCenterY - fMapSize;
+ float x = ((m_nMousePosX - diffX) / (fMapSize * 2)) * 4000.0f - 2000.0f;
+ float y = 2000.0f - ((m_nMousePosY - diffY) / (fMapSize * 2)) * 4000.0f;
+ CRadar::ToggleTargetMarker(x, y);
+ }
+ }
+
+ if (CPad::GetPad(0)->GetLeftMouse()) {
+ fMapCenterX += m_nMousePosX - m_nMouseOldPosX;
+ fMapCenterY += m_nMousePosY - m_nMouseOldPosY;
+ } else if (CPad::GetPad(0)->GetLeft() || CPad::GetPad(0)->GetDPadLeft()) {
+ fMapCenterX += 15.0f;
+ } else if (CPad::GetPad(0)->GetRight() || CPad::GetPad(0)->GetDPadRight()) {
+ fMapCenterX -= 15.0f;
+ } else if (CPad::GetPad(0)->GetLeftStickX()) {
+ fMapCenterX -= CPad::GetPad(0)->GetLeftStickX() / 128.0f * 20.0f;
+ }
+
+ if (CPad::GetPad(0)->GetUp() || CPad::GetPad(0)->GetDPadUp()) {
+ fMapCenterY += 15.0f;
+ } else if (CPad::GetPad(0)->GetDown() || CPad::GetPad(0)->GetDPadDown()) {
+ fMapCenterY -= 15.0f;
+ } else if (CPad::GetPad(0)->GetLeftStickY()) {
+ fMapCenterY += CPad::GetPad(0)->GetLeftStickY() / 128.0f * 20.0f;
+ }
+
+ if (CPad::GetPad(0)->GetMouseWheelUp() || CPad::GetPad(0)->GetPageUp() || CPad::GetPad(0)->GetRightShoulder2()) {
+ if (CPad::GetPad(0)->GetMouseWheelUp())
+ ZOOM(m_nMousePosX, m_nMousePosY, false);
+ else
+ ZOOM(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, false);
+ } else if (CPad::GetPad(0)->GetMouseWheelDown() || CPad::GetPad(0)->GetPageDown() || CPad::GetPad(0)->GetRightShoulder1()) {
+ if (CPad::GetPad(0)->GetMouseWheelDown())
+ ZOOM(m_nMousePosX, m_nMousePosY, true);
+ else
+ ZOOM(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, true);
+ }
+
+ if (fMapCenterX - fMapSize > SCREEN_WIDTH / 2)
+ fMapCenterX = fMapSize + SCREEN_WIDTH / 2;
+
+ if (fMapCenterX + fMapSize < SCREEN_WIDTH / 2)
+ fMapCenterX = SCREEN_WIDTH / 2 - fMapSize;
+
+ if (fMapCenterY + fMapSize < SCREEN_HEIGHT - MENU_Y(60.0f))
+ fMapCenterY = SCREEN_HEIGHT - MENU_Y(60.0f) - fMapSize;
+
+ fMapCenterY = min(fMapCenterY, fMapSize); // To not show beyond north border
+
+ bMenuMapActive = false;
+
+ // CFont::SetWrapx(MENU_X_RIGHT_ALIGNED(5.0f)); // From VC
+ // CFont::SetRightJustifyWrap(10.0f);
+
+ CSprite2d::DrawRect(CRect(MENU_X(14.0f), SCREEN_STRETCH_FROM_BOTTOM(95.0f),
+ SCREEN_STRETCH_FROM_RIGHT(11.0f), SCREEN_STRETCH_FROM_BOTTOM(58.0f)),
+ CRGBA(235, 170, 50, 255));
+
+ CFont::SetScale(MENU_X(0.4f), MENU_Y(0.7f));
+ CFont::SetFontStyle(FONT_BANK);
+ CFont::SetColor(CRGBA(0, 0, 0, FadeIn(255)));
+
+ float nextX = MENU_X(30.0f), nextY = 95.0f;
+ wchar *text;
+#define TEXT_PIECE(key,extraSpace) \
+ text = TheText.Get(key); CFont::PrintString(nextX, SCREEN_SCALE_FROM_BOTTOM(nextY), text); nextX += CFont::GetStringWidth(text, true) + MENU_X(extraSpace);
+
+ TEXT_PIECE("FEC_MWB", 3.0f);
+ TEXT_PIECE("FEC_PGD", 1.0f);
+ TEXT_PIECE("FEC_IBT", 1.0f);
+ TEXT_PIECE("FEC_ZIN", 20.0f);
+ TEXT_PIECE("FEC_MWF", 3.0f);
+ TEXT_PIECE("FEC_PGU", 1.0f);
+ TEXT_PIECE("FEC_IBT", 1.0f);
+ CFont::PrintString(nextX, SCREEN_SCALE_FROM_BOTTOM(nextY), TheText.Get("FEC_ZOT")); nextX = MENU_X(30.0f); nextY -= 11.0f;
+ TEXT_PIECE("FEC_UPA", 2.0f);
+ TEXT_PIECE("FEC_DWA", 2.0f);
+ TEXT_PIECE("FEC_LFA", 2.0f);
+ TEXT_PIECE("FEC_RFA", 2.0f);
+ TEXT_PIECE("FEC_MSL", 1.0f);
+ TEXT_PIECE("FEC_IBT", 1.0f);
+ CFont::PrintString(nextX, SCREEN_SCALE_FROM_BOTTOM(nextY), TheText.Get("FEC_MOV")); nextX = MENU_X(30.0f); nextY -= 11.0f;
+ TEXT_PIECE("FEC_MSR", 2.0f);
+ TEXT_PIECE("FEC_IBT", 1.0f);
+ CFont::PrintString(nextX, SCREEN_SCALE_FROM_BOTTOM(nextY), TheText.Get("FEC_TAR"));
+#undef TEXT_PIECE
+}
+
+#undef ZOOM
+#endif
+
#if 0
uint8 CMenuManager::GetNumberOfMenuOptions()
{
diff --git a/src/core/Frontend.h b/src/core/Frontend.h
index 4eee198f..a97afb24 100644
--- a/src/core/Frontend.h
+++ b/src/core/Frontend.h
@@ -109,6 +109,8 @@ enum eFrontendSprites
FE_RADIO7,
FE_RADIO8,
FE_RADIO9,
+
+ NUM_FE_SPRITES
};
enum eMenuSprites
@@ -132,6 +134,8 @@ enum eMenuSprites
MENUSPRITE_UPOFF,
MENUSPRITE_UPON,
MENUSPRITE_GTA3LOGO,
+ MENUSPRITE_UNUSED,
+ NUM_MENU_SPRITES
};
enum eSaveSlot
@@ -149,6 +153,22 @@ enum eSaveSlot
SAVESLOT_LABEL = 36
};
+#ifdef MENU_MAP
+enum MapSprites
+{
+ MAPMID1,
+ MAPMID2,
+ MAPMID3,
+ MAPBOT1,
+ MAPBOT2,
+ MAPBOT3,
+ MAPTOP1,
+ MAPTOP2,
+ MAPTOP3,
+ NUM_MAP_SPRITES
+};
+#endif
+
enum eMenuScreen
{
MENUPAGE_DISABLED = -1,
@@ -211,6 +231,9 @@ enum eMenuScreen
MENUPAGE_MOUSE_CONTROLS = 56,
MENUPAGE_57 = 57,
MENUPAGE_58 = 58,
+#ifdef MENU_MAP
+ MENUPAGE_MAP = 59,
+#endif
MENUPAGES
};
@@ -465,8 +488,8 @@ public:
char field_455;
bool m_bStartWaitingForKeyBind;
bool m_bSpritesLoaded;
- CSprite2d m_aFrontEndSprites[28];
- CSprite2d m_aMenuSprites[20];
+ CSprite2d m_aFrontEndSprites[NUM_FE_SPRITES];
+ CSprite2d m_aMenuSprites[NUM_MENU_SPRITES];
int32 field_518;
int32 m_nMenuFadeAlpha;
bool m_bPressedPgUpOnList;
@@ -532,6 +555,14 @@ public:
static bool m_PrefsDisableTutorials;
#endif // !MASTER
+#ifdef MENU_MAP
+ static bool bMenuMapActive;
+ static float fMapSize;
+ static float fMapCenterY;
+ static float fMapCenterX;
+ static CSprite2d m_aMapSprites[NUM_MAP_SPRITES];
+ void PrintMap();
+#endif
public:
static void BuildStatLine(char *text, void *stat, uint8 aFloat, void *stat2);
diff --git a/src/core/MenuScreens.h b/src/core/MenuScreens.h
index ace6a719..bac8f0a8 100644
--- a/src/core/MenuScreens.h
+++ b/src/core/MenuScreens.h
@@ -7,7 +7,11 @@ const CMenuScreen aScreens[] = {
{ "", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, },
// MENUPAGE_STATS = 1 - Both PrintStats and Draw were printing the page name, so deleted the string Draw looked for.
+#ifdef MENU_MAP
+ { ""/*"FET_STA"*/, MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 5, 3,
+#else
{ ""/*"FET_STA"*/, MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 5, 2,
+#endif
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
@@ -20,7 +24,11 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_BRIEFS = 3
+#ifdef MENU_MAP
+ { "FET_BRE", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 6, 4,
+#else
{ "FET_BRE", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 6, 3,
+#endif
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
@@ -298,7 +306,11 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_OPTIONS = 41
+#ifdef MENU_MAP
+ { "FET_OPT", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 1, 5,
+#else
{ "FET_OPT", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 1, 4,
+#endif
MENUACTION_CHANGEMENU, "FET_CTL", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC,
MENUACTION_LOADRADIO, "FET_AUD", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
MENUACTION_CHANGEMENU, "FET_DIS", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
@@ -308,7 +320,11 @@ const CMenuScreen aScreens[] = {
},
// MENUPAGE_EXIT = 42
+#ifdef MENU_MAP
+ { "FET_QG", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 2, 6,
+#else
{ "FET_QG", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 2, 5,
+#endif
MENUACTION_LABEL, "FEQ_SRE", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CANCELGAME, "FEM_YES", SAVESLOT_NONE, MENUPAGE_NONE,
@@ -369,6 +385,9 @@ const CMenuScreen aScreens[] = {
{ "FET_PAU", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_RESUME, "FEM_RES", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEN_STA", SAVESLOT_NONE, MENUPAGE_NEW_GAME,
+#ifdef MENU_MAP
+ MENUACTION_CHANGEMENU, "FEG_MAP", SAVESLOT_NONE, MENUPAGE_MAP,
+#endif
MENUACTION_CHANGEMENU, "FEP_STA", SAVESLOT_NONE, MENUPAGE_STATS,
MENUACTION_CHANGEMENU, "FEP_BRI", SAVESLOT_NONE, MENUPAGE_BRIEFS,
MENUACTION_CHANGEMENU, "FET_OPT", SAVESLOT_NONE, MENUPAGE_OPTIONS,
@@ -407,4 +426,10 @@ const CMenuScreen aScreens[] = {
{ "", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
},
+
+#ifdef MENU_MAP
+ // MENUPAGE_MAP = 59
+ { "FEG_MAP", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 5, 2,
+ },
+#endif
};
diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp
index 3824af7d..07ddb5d8 100644
--- a/src/core/Radar.cpp
+++ b/src/core/Radar.cpp
@@ -80,7 +80,7 @@ CRGBA CRadar::ArrowBlipColour1;
CRGBA CRadar::ArrowBlipColour2;
uint16 CRadar::MapLegendCounter;
uint16 CRadar::MapLegendList[NUM_MAP_LEGENDS];
-bool CRadar::bMenuMapActive;
+int CRadar::TargetMarkerId = -1;
#endif
// taken from VC
@@ -89,6 +89,10 @@ float CRadar::cachedSin;
uint8 CRadar::CalculateBlipAlpha(float dist)
{
+#ifdef MENU_MAP
+ if (CMenuManager::bMenuMapActive)
+ return 255;
+#endif
if (dist <= 1.0f)
return 255;
@@ -132,9 +136,12 @@ void CRadar::ClearBlip(int32 i)
if (index != -1) {
SetRadarMarkerState(index, false);
ms_RadarTrace[index].m_bInUse = false;
+#ifndef MENU_MAP
+ // Ssshhh
ms_RadarTrace[index].m_eBlipType = BLIP_NONE;
ms_RadarTrace[index].m_eBlipDisplay = BLIP_DISPLAY_NEITHER;
- ms_RadarTrace[index].m_IconID = RADAR_SPRITE_NONE;
+ ms_RadarTrace[index].m_eRadarSprite = RADAR_SPRITE_NONE;
+#endif
}
}
@@ -146,7 +153,7 @@ void CRadar::ClearBlipForEntity(eBlipType type, int32 id)
ms_RadarTrace[i].m_bInUse = false;
ms_RadarTrace[i].m_eBlipType = BLIP_NONE;
ms_RadarTrace[i].m_eBlipDisplay = BLIP_DISPLAY_NEITHER;
- ms_RadarTrace[i].m_IconID = RADAR_SPRITE_NONE;
+ ms_RadarTrace[i].m_eRadarSprite = RADAR_SPRITE_NONE;
}
};
}
@@ -233,7 +240,7 @@ int CRadar::ClipRadarPoly(CVector2D *poly, const CVector2D *rect)
bool CRadar::DisplayThisBlip(int32 counter)
{
- switch (ms_RadarTrace[counter].m_IconID) {
+ switch (ms_RadarTrace[counter].m_eRadarSprite) {
case RADAR_SPRITE_BOMB:
case RADAR_SPRITE_SPRAY:
case RADAR_SPRITE_WEAPON:
@@ -309,28 +316,39 @@ void CRadar::DrawBlips()
CVector2D in = CVector2D(0.0f, 0.0f);
TransformRadarPointToScreenSpace(out, in);
- float angle;
- if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN)
- angle = PI + FindPlayerHeading();
+#ifdef MENU_MAP
+ if (!CMenuManager::bMenuMapActive) {
+#endif
+ float angle;
+ if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN)
+ angle = PI + FindPlayerHeading();
#ifdef FIX_BUGS
- else if (TheCamera.GetLookDirection() != LOOKING_FORWARD)
- angle = FindPlayerHeading() - (PI + (TheCamera.Cams[TheCamera.ActiveCam].CamTargetEntity->GetPosition() - TheCamera.Cams[TheCamera.ActiveCam].SourceBeforeLookBehind).Heading());
+ else if (TheCamera.GetLookDirection() != LOOKING_FORWARD)
+ angle = FindPlayerHeading() - (PI + (TheCamera.Cams[TheCamera.ActiveCam].CamTargetEntity->GetPosition() - TheCamera.Cams[TheCamera.ActiveCam].SourceBeforeLookBehind).Heading());
#endif
- else
- angle = FindPlayerHeading() - (PI + TheCamera.GetForward().Heading());
+ else
+ angle = FindPlayerHeading() - (PI + TheCamera.GetForward().Heading());
- DrawRotatingRadarSprite(&CentreSprite, out.x, out.y, angle, 255);
+ DrawRotatingRadarSprite(&CentreSprite, out.x, out.y, angle, 255);
- CVector2D vec2d;
- vec2d.x = vec2DRadarOrigin.x;
- vec2d.y = M_SQRT2 * m_radarRange + vec2DRadarOrigin.y;
- TransformRealWorldPointToRadarSpace(in, vec2d);
- LimitRadarPoint(in);
- TransformRadarPointToScreenSpace(out, in);
- DrawRadarSprite(RADAR_SPRITE_NORTH, out.x, out.y, 255);
+ CVector2D vec2d;
+ vec2d.x = vec2DRadarOrigin.x;
+ vec2d.y = M_SQRT2 * m_radarRange + vec2DRadarOrigin.y;
+ TransformRealWorldPointToRadarSpace(in, vec2d);
+ LimitRadarPoint(in);
+ TransformRadarPointToScreenSpace(out, in);
+ DrawRadarSprite(RADAR_SPRITE_NORTH, out.x, out.y, 255);
+#ifdef MENU_MAP
+ }
+#endif
CEntity *blipEntity = nil;
for(int blipId = 0; blipId < NUMRADARBLIPS; blipId++) {
+#ifdef MENU_MAP
+ // A little hack to reuse cleared blips in menu map. hehe
+ if (!CMenuManager::bMenuMapActive || ms_RadarTrace[blipId].m_eBlipType == BLIP_CAR ||
+ ms_RadarTrace[blipId].m_eBlipType == BLIP_CHAR || ms_RadarTrace[blipId].m_eBlipType == BLIP_OBJECT)
+#endif
if (!ms_RadarTrace[blipId].m_bInUse)
continue;
@@ -338,8 +356,8 @@ void CRadar::DrawBlips()
case BLIP_CAR:
case BLIP_CHAR:
case BLIP_OBJECT:
- if (ms_RadarTrace[blipId].m_IconID == RADAR_SPRITE_BOMB || ms_RadarTrace[blipId].m_IconID == RADAR_SPRITE_SAVE
- || ms_RadarTrace[blipId].m_IconID == RADAR_SPRITE_SPRAY || ms_RadarTrace[blipId].m_IconID == RADAR_SPRITE_WEAPON) {
+ if (ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_BOMB || ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_SAVE
+ || ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_SPRAY || ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_WEAPON) {
switch (ms_RadarTrace[blipId].m_eBlipType) {
case BLIP_CAR:
@@ -372,8 +390,8 @@ void CRadar::DrawBlips()
TransformRealWorldPointToRadarSpace(in, blipEntity->GetPosition());
float dist = LimitRadarPoint(in);
TransformRadarPointToScreenSpace(out, in);
- if (ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_NONE) {
- DrawRadarSprite(ms_RadarTrace[blipId].m_IconID, out.x, out.y, CalculateBlipAlpha(dist));
+ if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_NONE) {
+ DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist));
} else {
#ifdef TRIANGULAR_BLIPS
CVector &pos = FindPlayerCentreOfWorld_NoSniperShift();
@@ -394,8 +412,8 @@ void CRadar::DrawBlips()
break;
case BLIP_COORD:
case BLIP_CONTACT_POINT:
- if ((ms_RadarTrace[blipId].m_IconID == RADAR_SPRITE_BOMB || ms_RadarTrace[blipId].m_IconID == RADAR_SPRITE_SAVE
- || ms_RadarTrace[blipId].m_IconID == RADAR_SPRITE_SPRAY || ms_RadarTrace[blipId].m_IconID == RADAR_SPRITE_WEAPON)
+ if ((ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_BOMB || ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_SAVE
+ || ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_SPRAY || ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_WEAPON)
&& (ms_RadarTrace[blipId].m_eBlipType != BLIP_CONTACT_POINT || !CTheScripts::IsPlayerOnAMission())) {
uint32 color = GetRadarTraceColour(ms_RadarTrace[blipId].m_nColor, ms_RadarTrace[blipId].m_bDim);
@@ -411,8 +429,8 @@ void CRadar::DrawBlips()
TransformRealWorldPointToRadarSpace(in, ms_RadarTrace[blipId].m_vec2DPos);
float dist = LimitRadarPoint(in);
TransformRadarPointToScreenSpace(out, in);
- if (ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_NONE) {
- DrawRadarSprite(ms_RadarTrace[blipId].m_IconID, out.x, out.y, CalculateBlipAlpha(dist));
+ if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_NONE) {
+ DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist));
} else {
#ifdef TRIANGULAR_BLIPS
CVector &pos = FindPlayerCentreOfWorld_NoSniperShift();
@@ -442,8 +460,8 @@ void CRadar::DrawBlips()
case BLIP_CAR:
case BLIP_CHAR:
case BLIP_OBJECT:
- if (ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_BOMB && ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_SAVE
- && ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_SPRAY && ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_WEAPON) {
+ if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_BOMB && ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_SAVE
+ && ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_SPRAY && ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_WEAPON) {
switch (ms_RadarTrace[blipId].m_eBlipType) {
case BLIP_CAR:
@@ -477,8 +495,8 @@ void CRadar::DrawBlips()
TransformRealWorldPointToRadarSpace(in, blipEntity->GetPosition());
float dist = LimitRadarPoint(in);
TransformRadarPointToScreenSpace(out, in);
- if (ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_NONE)
- DrawRadarSprite(ms_RadarTrace[blipId].m_IconID, out.x, out.y, CalculateBlipAlpha(dist));
+ if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_NONE)
+ DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist));
else
#ifdef TRIANGULAR_BLIPS
{
@@ -509,8 +527,8 @@ void CRadar::DrawBlips()
switch (ms_RadarTrace[blipId].m_eBlipType) {
case BLIP_COORD:
case BLIP_CONTACT_POINT:
- if (ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_BOMB && ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_SAVE
- && ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_SPRAY && ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_WEAPON
+ if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_BOMB && ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_SAVE
+ && ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_SPRAY && ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_WEAPON
&& (ms_RadarTrace[blipId].m_eBlipType != BLIP_CONTACT_POINT || !CTheScripts::IsPlayerOnAMission())) {
uint32 color = GetRadarTraceColour(ms_RadarTrace[blipId].m_nColor, ms_RadarTrace[blipId].m_bDim);
@@ -526,8 +544,8 @@ void CRadar::DrawBlips()
TransformRealWorldPointToRadarSpace(in, ms_RadarTrace[blipId].m_vec2DPos);
float dist = LimitRadarPoint(in);
TransformRadarPointToScreenSpace(out, in);
- if (ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_NONE)
- DrawRadarSprite(ms_RadarTrace[blipId].m_IconID, out.x, out.y, CalculateBlipAlpha(dist));
+ if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_NONE)
+ DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist));
else
#ifdef TRIANGULAR_BLIPS
{
@@ -550,6 +568,14 @@ void CRadar::DrawBlips()
break;
}
}
+#ifdef MENU_MAP
+ if (CMenuManager::bMenuMapActive) {
+ CVector2D in, out;
+ TransformRealWorldPointToRadarSpace(in, FindPlayerCentreOfWorld_NoSniperShift());
+ TransformRadarPointToScreenSpace(out, in);
+ DrawYouAreHereSprite(out.x, out.y);
+ }
+#endif
}
}
@@ -701,8 +727,8 @@ void CRadar::DrawRadarSprite(uint16 sprite, float x, float y, uint8 alpha)
{
RadarSprites[sprite]->Draw(CRect(x - SCREEN_SCALE_X(8.0f), y - SCREEN_SCALE_Y(8.0f), x + SCREEN_SCALE_X(8.0f), y + SCREEN_SCALE_Y(8.0f)), CRGBA(255, 255, 255, alpha));
#ifdef MENU_MAP
- if (bMenuMapActive) {
- bool alreadyThere;
+ if (CMenuManager::bMenuMapActive) {
+ bool alreadyThere = false;
for (int i = 0; i < NUM_MAP_LEGENDS; i++) {
if (MapLegendList[i] == sprite)
alreadyThere = true;
@@ -834,7 +860,7 @@ CRadar::Initialise()
ms_RadarTrace[i].m_bInUse = false;
ms_RadarTrace[i].m_eBlipType = BLIP_NONE;
ms_RadarTrace[i].m_eBlipDisplay = BLIP_DISPLAY_NEITHER;
- ms_RadarTrace[i].m_IconID = RADAR_SPRITE_NONE;
+ ms_RadarTrace[i].m_eRadarSprite = RADAR_SPRITE_NONE;
}
m_radarRange = 350.0f;
@@ -847,6 +873,10 @@ float CRadar::LimitRadarPoint(CVector2D &point)
float dist, invdist;
dist = point.Magnitude();
+#ifdef MENU_MAP
+ if (CMenuManager::bMenuMapActive)
+ return dist;
+#endif
if (dist > 1.0f) {
invdist = 1.0f / dist;
point.x *= invdist;
@@ -930,7 +960,7 @@ void CRadar::SetBlipSprite(int32 i, int32 icon)
{
int index = CRadar::GetActualBlipArrayIndex(i);
if (index != -1) {
- ms_RadarTrace[index].m_IconID = icon;
+ ms_RadarTrace[index].m_eRadarSprite = icon;
}
}
@@ -951,7 +981,7 @@ int CRadar::SetCoordBlip(eBlipType type, CVector pos, int32 color, eBlipDisplay
ms_RadarTrace[nextBlip].m_nEntityHandle = 0;
ms_RadarTrace[nextBlip].m_wScale = 1;
ms_RadarTrace[nextBlip].m_eBlipDisplay = display;
- ms_RadarTrace[nextBlip].m_IconID = RADAR_SPRITE_NONE;
+ ms_RadarTrace[nextBlip].m_eRadarSprite = RADAR_SPRITE_NONE;
return CRadar::GetNewUniqueBlipIndex(nextBlip);
}
@@ -970,7 +1000,7 @@ int CRadar::SetEntityBlip(eBlipType type, int32 handle, int32 color, eBlipDispla
ms_RadarTrace[nextBlip].m_nEntityHandle = handle;
ms_RadarTrace[nextBlip].m_wScale = 1;
ms_RadarTrace[nextBlip].m_eBlipDisplay = display;
- ms_RadarTrace[nextBlip].m_IconID = RADAR_SPRITE_NONE;
+ ms_RadarTrace[nextBlip].m_eRadarSprite = RADAR_SPRITE_NONE;
return GetNewUniqueBlipIndex(nextBlip);
}
@@ -1050,8 +1080,8 @@ void CRadar::ShowRadarTraceWithHeight(float x, float y, uint32 size, uint8 red,
}
#ifdef MENU_MAP
// VC uses -1 for coords and -2 for entities but meh, I don't want to edit DrawBlips
- if (bMenuMapActive) {
- bool alreadyThere;
+ if (CMenuManager::bMenuMapActive) {
+ bool alreadyThere = false;
for (int i = 0; i < NUM_MAP_LEGENDS; i++) {
if (MapLegendList[i] == -1)
alreadyThere = true;
@@ -1156,9 +1186,10 @@ void CRadar::TransformRadarPointToRealWorldSpace(CVector2D &out, const CVector2D
void CRadar::TransformRadarPointToScreenSpace(CVector2D &out, const CVector2D &in)
{
#ifdef MENU_MAP
- if (bMenuMapActive) {
- out.x = MENU_X_LEFT_ALIGNED((0.66193402f * m_nMapNegativePadding * in.x) + (0.2348f * m_nMapNegativePadding) + m_nMapLeftPadding);
- out.y = MENU_Y(m_nMapTopPadding - (0.065807f * m_nMapNegativePadding) - (0.66563499f * m_nMapNegativePadding * in.y));
+ if (CMenuManager::bMenuMapActive) {
+ // fMapSize is actually half map size. Radar range is 1000, so if x is -2000, in.x + 2.0f is 0.
+ out.x = (CMenuManager::fMapCenterX - CMenuManager::fMapSize) + (in.x + 2.0f) * CMenuManager::fMapSize * 2.0f / 4.0f;
+ out.y = (CMenuManager::fMapCenterY - CMenuManager::fMapSize) + (2.0f - in.y) * CMenuManager::fMapSize * 2.0f / 4.0f;
} else
#endif
{
@@ -1331,7 +1362,7 @@ CRadar::CalculateCachedSinCos()
{
if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN || TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOP_DOWN_PED
#ifdef MENU_MAP
- || bMenuMapActive
+ || CMenuManager::bMenuMapActive
#endif
) {
cachedSin = 0.0f;
@@ -1361,7 +1392,7 @@ CRadar::InitFrontEndMap()
CalculateCachedSinCos();
vec2DRadarOrigin.x = 0.0f;
vec2DRadarOrigin.y = 0.0f;
- m_radarRange = 1190.0f;
+ m_radarRange = 1000.0f; // doesn't mean anything, just affects the calculation in TransformRadarPointToScreenSpace
for (int i = 0; i < NUM_MAP_LEGENDS; i++) {
MapLegendList[i] = RADAR_SPRITE_NONE;
}
@@ -1369,6 +1400,62 @@ CRadar::InitFrontEndMap()
ArrowBlipColour1 = CRGBA(0, 0, 0, 0);
ArrowBlipColour2 = CRGBA(0, 0, 0, 0);
}
+
+void
+CRadar::DrawYouAreHereSprite(float x, float y)
+{
+ static uint32 lastChange = 0;
+ static bool show = true;
+
+ if (show) {
+ if (CTimer::GetTimeInMillisecondsPauseMode() - lastChange > 500) {
+ lastChange = CTimer::GetTimeInMillisecondsPauseMode();
+ show = !show;
+ }
+ } else {
+ if (CTimer::GetTimeInMillisecondsPauseMode() - lastChange > 200) {
+ lastChange = CTimer::GetTimeInMillisecondsPauseMode();
+ show = !show;
+ }
+ }
+
+ if (show) {
+ float left = x - SCREEN_SCALE_X(12.0f);
+ float top = y - SCREEN_SCALE_Y(2.0f);
+ float right = SCREEN_SCALE_X(12.0) + x;
+ float bottom = y - SCREEN_SCALE_Y(26.0f);
+ CentreSprite.Draw(CRect(left, top, right, bottom), CRGBA(255, 217, 106, 255));
+ }
+ MapLegendList[MapLegendCounter++] = RADAR_SPRITE_CENTRE;
+}
+
+void
+CRadar::ToggleTargetMarker(float x, float y)
+{
+ if (TargetMarkerId == -1) {
+ int nextBlip;
+ for (nextBlip = 0; nextBlip < NUMRADARBLIPS; nextBlip++) {
+ if (!ms_RadarTrace[nextBlip].m_bInUse)
+ break;
+ }
+ ms_RadarTrace[nextBlip].m_eBlipType = BLIP_COORD;
+ ms_RadarTrace[nextBlip].m_nColor = 0x333333FF;
+ ms_RadarTrace[nextBlip].m_bDim = 1;
+ ms_RadarTrace[nextBlip].m_bInUse = 1;
+ ms_RadarTrace[nextBlip].m_Radius = 1.0f;
+ CVector pos(x, y, CWorld::FindGroundZForCoord(x,y));
+ ms_RadarTrace[nextBlip].m_vec2DPos = pos;
+ ms_RadarTrace[nextBlip].m_vecPos = pos;
+ ms_RadarTrace[nextBlip].m_nEntityHandle = 0;
+ ms_RadarTrace[nextBlip].m_wScale = 5;
+ ms_RadarTrace[nextBlip].m_eBlipDisplay = BLIP_DISPLAY_BLIP_ONLY;
+ ms_RadarTrace[nextBlip].m_eRadarSprite = RADAR_SPRITE_NONE;
+ TargetMarkerId = CRadar::GetNewUniqueBlipIndex(nextBlip);
+ } else {
+ ClearBlip(TargetMarkerId);
+ TargetMarkerId = -1;
+ }
+}
#endif
STARTPATCHES
diff --git a/src/core/Radar.h b/src/core/Radar.h
index fb10967b..6d5bb196 100644
--- a/src/core/Radar.h
+++ b/src/core/Radar.h
@@ -69,7 +69,7 @@ struct CBlip
float m_Radius;
int16 m_wScale;
uint16 m_eBlipDisplay; // eBlipDisplay
- uint16 m_IconID; // eRadarSprite
+ uint16 m_eRadarSprite; // eRadarSprite
};
static_assert(sizeof(CBlip) == 0x30, "CBlip: error");
@@ -108,12 +108,16 @@ public:
static float cachedCos;
static float cachedSin;
#ifdef MENU_MAP
+#define NUM_MAP_LEGENDS 75
static CRGBA ArrowBlipColour1;
static CRGBA ArrowBlipColour2;
- static uint16 MapLegendList[75];
- static bool bMenuMapActive;
+ static uint16 MapLegendList[NUM_MAP_LEGENDS];
+ static uint16 MapLegendCounter;
+ static int TargetMarkerId;
static void InitFrontEndMap();
+ static void DrawYouAreHereSprite(float, float);
+ static void ToggleTargetMarker(float, float);
#endif
static uint8 CalculateBlipAlpha(float dist);
static void ChangeBlipBrightness(int32 i, int32 bright);
diff --git a/src/core/config.h b/src/core/config.h
index d813a1f2..75ecbfad 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -192,7 +192,7 @@ enum Config {
#define TRIANGULAR_BLIPS // height indicating triangular radar blips, as in VC
#define PS2_SAVE_DIALOG // PS2 style save dialog with transparent black box
// #define PS2_LIKE_MENU // An effort to recreate PS2 menu, cycling through tabs, different bg etc.
-// #define MENU_MAP // Very WIP
+#define MENU_MAP // VC-like menu map. Make sure you have new menu.txd
// Script
#define USE_DEBUG_SCRIPT_LOADER // makes game load main_freeroam.scm by default