Merge pull request #384 from erorcun/erorcun

Menu map
This commit is contained in:
erorcun 2020-04-07 20:37:27 +03:00 committed by GitHub
commit 6a2d675467
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 463 additions and 69 deletions

BIN
gamefiles/menu.txd Normal file

Binary file not shown.

View File

@ -727,12 +727,24 @@ CCamera::CamControl(void)
if(CarZoomIndicator == CAM_ZOOM_1STPRS && !m_bPlayerIsInGarage){ if(CarZoomIndicator == CAM_ZOOM_1STPRS && !m_bPlayerIsInGarage){
CarZoomValue = 0.0f; CarZoomValue = 0.0f;
ReqMode = CCam::MODE_1STPERSON; 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) else if (CarZoomIndicator == CAM_ZOOM_2)
CarZoomValue = 1.9f; CarZoomValue = ((CVehicle*)pTargetEntity)->IsBoat() ? FREE_BOAT_ZOOM_VALUE_2 : FREE_CAR_ZOOM_VALUE_2;
else if (CarZoomIndicator == CAM_ZOOM_3) else if (CarZoomIndicator == CAM_ZOOM_3)
CarZoomValue = 3.9f; 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 = DEFAULT_CAR_ZOOM_VALUE_2;
else if(CarZoomIndicator == CAM_ZOOM_3)
CarZoomValue = DEFAULT_CAR_ZOOM_VALUE_3;
if(CarZoomIndicator == CAM_ZOOM_TOPDOWN && !m_bPlayerIsInGarage){ if(CarZoomIndicator == CAM_ZOOM_TOPDOWN && !m_bPlayerIsInGarage){
CarZoomValue = 1.0f; CarZoomValue = 1.0f;
ReqMode = CCam::MODE_TOPDOWN; ReqMode = CCam::MODE_TOPDOWN;
@ -2956,12 +2968,24 @@ CCamera::SetZoomValueFollowPedScript(int16 dist)
void void
CCamera::SetZoomValueCamStringScript(int16 dist) CCamera::SetZoomValueCamStringScript(int16 dist)
{ {
#ifdef FREE_CAM
if (bFreeCam) {
switch (dist) { switch (dist) {
case 0: m_fCarZoomValueScript = 0.05f; break; case 0: m_fCarZoomValueScript = ((CVehicle*)Cams[ActiveCam].CamTargetEntity)->IsBoat() ? FREE_BOAT_ZOOM_VALUE_1 : FREE_CAR_ZOOM_VALUE_1; break;
case 1: m_fCarZoomValueScript = 1.9f; 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 = 3.9f; 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; 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; m_bUseScriptZoomValueCar = true;
} }

View File

@ -23,6 +23,20 @@ enum
#define CAM_ZOOM_TOPDOWN (4.0f) #define CAM_ZOOM_TOPDOWN (4.0f)
#define CAM_ZOOM_CINEMATIC (5.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 class CCam
{ {
public: public:

View File

@ -27,12 +27,20 @@
#include "World.h" #include "World.h"
#include "Renderer.h" #include "Renderer.h"
#include "CdStream.h" #include "CdStream.h"
#include "Radar.h"
#define DONT_USE_SUSPICIOUS_FUNCS 1 #define DONT_USE_SUSPICIOUS_FUNCS 1
#define TIDY_UP_PBP // ProcessButtonPresses #define TIDY_UP_PBP // ProcessButtonPresses
#define MAX_VISIBLE_LIST_ROW 30 #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 #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 #ifdef PS2_LIKE_MENU
BottomBarOption bbNames[8]; BottomBarOption bbNames[8];
int bbTabCount = 0; int bbTabCount = 0;
@ -131,6 +139,21 @@ const char* FrontendFilenames[][2] = {
{"fe_radio9", "" }, // CHATTERBOX {"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 // 0x5F3344
const char* MenuFilenames[][2] = { const char* MenuFilenames[][2] = {
{"connection24", ""}, {"connection24", ""},
@ -362,7 +385,7 @@ void CMenuManager::CentreMousePointer()
{ {
tagPOINT Point; 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.x = SCREEN_WIDTH / 2;
Point.y = SCREEN_HEIGHT / 2; Point.y = SCREEN_HEIGHT / 2;
ClientToScreen(PSGLOBAL(window), &Point); ClientToScreen(PSGLOBAL(window), &Point);
@ -562,6 +585,11 @@ void CMenuManager::Draw()
case MENUPAGE_BRIEFS: case MENUPAGE_BRIEFS:
PrintBriefs(); PrintBriefs();
break; break;
#ifdef MENU_MAP
case MENUPAGE_MAP:
PrintMap();
break;
#endif
} }
// Header height isn't accounted, we will add that later. // Header height isn't accounted, we will add that later.
@ -2570,7 +2598,12 @@ void CMenuManager::LoadAllTextures()
m_aMenuSprites[i].SetTexture(MenuFilenames[i][0], MenuFilenames[i][1]); m_aMenuSprites[i].SetTexture(MenuFilenames[i][0], MenuFilenames[i][1]);
m_aMenuSprites[i].SetAddressing(rwTEXTUREADDRESSBORDER); 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; m_bSpritesLoaded = true;
CTxdStore::PopCurrentTxd(); CTxdStore::PopCurrentTxd();
} }
@ -3756,6 +3789,14 @@ CMenuManager::ProcessButtonPresses(void)
break; break;
#endif #endif
} else { } 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); 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"); printf("REMOVE menu textures\n");
for (int i = 0; i < ARRAY_SIZE(MenuFilenames); ++i) for (int i = 0; i < ARRAY_SIZE(MenuFilenames); ++i)
m_aMenuSprites[i].Delete(); 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"); int menu = CTxdStore::FindTxdSlot("menu");
CTxdStore::RemoveTxd(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 #if 0
uint8 CMenuManager::GetNumberOfMenuOptions() uint8 CMenuManager::GetNumberOfMenuOptions()
{ {

View File

@ -109,6 +109,8 @@ enum eFrontendSprites
FE_RADIO7, FE_RADIO7,
FE_RADIO8, FE_RADIO8,
FE_RADIO9, FE_RADIO9,
NUM_FE_SPRITES
}; };
enum eMenuSprites enum eMenuSprites
@ -132,6 +134,8 @@ enum eMenuSprites
MENUSPRITE_UPOFF, MENUSPRITE_UPOFF,
MENUSPRITE_UPON, MENUSPRITE_UPON,
MENUSPRITE_GTA3LOGO, MENUSPRITE_GTA3LOGO,
MENUSPRITE_UNUSED,
NUM_MENU_SPRITES
}; };
enum eSaveSlot enum eSaveSlot
@ -149,6 +153,22 @@ enum eSaveSlot
SAVESLOT_LABEL = 36 SAVESLOT_LABEL = 36
}; };
#ifdef MENU_MAP
enum MapSprites
{
MAPMID1,
MAPMID2,
MAPMID3,
MAPBOT1,
MAPBOT2,
MAPBOT3,
MAPTOP1,
MAPTOP2,
MAPTOP3,
NUM_MAP_SPRITES
};
#endif
enum eMenuScreen enum eMenuScreen
{ {
MENUPAGE_DISABLED = -1, MENUPAGE_DISABLED = -1,
@ -211,6 +231,9 @@ enum eMenuScreen
MENUPAGE_MOUSE_CONTROLS = 56, MENUPAGE_MOUSE_CONTROLS = 56,
MENUPAGE_57 = 57, MENUPAGE_57 = 57,
MENUPAGE_58 = 58, MENUPAGE_58 = 58,
#ifdef MENU_MAP
MENUPAGE_MAP = 59,
#endif
MENUPAGES MENUPAGES
}; };
@ -465,8 +488,8 @@ public:
char field_455; char field_455;
bool m_bStartWaitingForKeyBind; bool m_bStartWaitingForKeyBind;
bool m_bSpritesLoaded; bool m_bSpritesLoaded;
CSprite2d m_aFrontEndSprites[28]; CSprite2d m_aFrontEndSprites[NUM_FE_SPRITES];
CSprite2d m_aMenuSprites[20]; CSprite2d m_aMenuSprites[NUM_MENU_SPRITES];
int32 field_518; int32 field_518;
int32 m_nMenuFadeAlpha; int32 m_nMenuFadeAlpha;
bool m_bPressedPgUpOnList; bool m_bPressedPgUpOnList;
@ -532,6 +555,14 @@ public:
static bool m_PrefsDisableTutorials; static bool m_PrefsDisableTutorials;
#endif // !MASTER #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: public:
static void BuildStatLine(char *text, void *stat, uint8 aFloat, void *stat2); static void BuildStatLine(char *text, void *stat, uint8 aFloat, void *stat2);

View File

@ -7,7 +7,11 @@ const CMenuScreen aScreens[] = {
{ "", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, }, { "", 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. // 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, { ""/*"FET_STA"*/, MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 5, 2,
#endif
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
}, },
@ -20,7 +24,11 @@ const CMenuScreen aScreens[] = {
}, },
// MENUPAGE_BRIEFS = 3 // 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, { "FET_BRE", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 6, 3,
#endif
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
}, },
@ -298,7 +306,11 @@ const CMenuScreen aScreens[] = {
}, },
// MENUPAGE_OPTIONS = 41 // 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, { "FET_OPT", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 1, 4,
#endif
MENUACTION_CHANGEMENU, "FET_CTL", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC, MENUACTION_CHANGEMENU, "FET_CTL", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC,
MENUACTION_LOADRADIO, "FET_AUD", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS, MENUACTION_LOADRADIO, "FET_AUD", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
MENUACTION_CHANGEMENU, "FET_DIS", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, MENUACTION_CHANGEMENU, "FET_DIS", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
@ -308,7 +320,11 @@ const CMenuScreen aScreens[] = {
}, },
// MENUPAGE_EXIT = 42 // 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, { "FET_QG", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, 2, 5,
#endif
MENUACTION_LABEL, "FEQ_SRE", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_LABEL, "FEQ_SRE", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CANCELGAME, "FEM_YES", 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, { "FET_PAU", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_RESUME, "FEM_RES", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_RESUME, "FEM_RES", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEN_STA", SAVESLOT_NONE, MENUPAGE_NEW_GAME, 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_STA", SAVESLOT_NONE, MENUPAGE_STATS,
MENUACTION_CHANGEMENU, "FEP_BRI", SAVESLOT_NONE, MENUPAGE_BRIEFS, MENUACTION_CHANGEMENU, "FEP_BRI", SAVESLOT_NONE, MENUPAGE_BRIEFS,
MENUACTION_CHANGEMENU, "FET_OPT", SAVESLOT_NONE, MENUPAGE_OPTIONS, MENUACTION_CHANGEMENU, "FET_OPT", SAVESLOT_NONE, MENUPAGE_OPTIONS,
@ -407,4 +426,10 @@ const CMenuScreen aScreens[] = {
{ "", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, { "", 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
}; };

View File

@ -80,7 +80,7 @@ CRGBA CRadar::ArrowBlipColour1;
CRGBA CRadar::ArrowBlipColour2; CRGBA CRadar::ArrowBlipColour2;
uint16 CRadar::MapLegendCounter; uint16 CRadar::MapLegendCounter;
uint16 CRadar::MapLegendList[NUM_MAP_LEGENDS]; uint16 CRadar::MapLegendList[NUM_MAP_LEGENDS];
bool CRadar::bMenuMapActive; int CRadar::TargetMarkerId = -1;
#endif #endif
// taken from VC // taken from VC
@ -89,6 +89,10 @@ float CRadar::cachedSin;
uint8 CRadar::CalculateBlipAlpha(float dist) uint8 CRadar::CalculateBlipAlpha(float dist)
{ {
#ifdef MENU_MAP
if (CMenuManager::bMenuMapActive)
return 255;
#endif
if (dist <= 1.0f) if (dist <= 1.0f)
return 255; return 255;
@ -132,9 +136,12 @@ void CRadar::ClearBlip(int32 i)
if (index != -1) { if (index != -1) {
SetRadarMarkerState(index, false); SetRadarMarkerState(index, false);
ms_RadarTrace[index].m_bInUse = false; ms_RadarTrace[index].m_bInUse = false;
#ifndef MENU_MAP
// Ssshhh
ms_RadarTrace[index].m_eBlipType = BLIP_NONE; ms_RadarTrace[index].m_eBlipType = BLIP_NONE;
ms_RadarTrace[index].m_eBlipDisplay = BLIP_DISPLAY_NEITHER; 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_bInUse = false;
ms_RadarTrace[i].m_eBlipType = BLIP_NONE; ms_RadarTrace[i].m_eBlipType = BLIP_NONE;
ms_RadarTrace[i].m_eBlipDisplay = BLIP_DISPLAY_NEITHER; 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) bool CRadar::DisplayThisBlip(int32 counter)
{ {
switch (ms_RadarTrace[counter].m_IconID) { switch (ms_RadarTrace[counter].m_eRadarSprite) {
case RADAR_SPRITE_BOMB: case RADAR_SPRITE_BOMB:
case RADAR_SPRITE_SPRAY: case RADAR_SPRITE_SPRAY:
case RADAR_SPRITE_WEAPON: case RADAR_SPRITE_WEAPON:
@ -309,6 +316,9 @@ void CRadar::DrawBlips()
CVector2D in = CVector2D(0.0f, 0.0f); CVector2D in = CVector2D(0.0f, 0.0f);
TransformRadarPointToScreenSpace(out, in); TransformRadarPointToScreenSpace(out, in);
#ifdef MENU_MAP
if (!CMenuManager::bMenuMapActive) {
#endif
float angle; float angle;
if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN) if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN)
angle = PI + FindPlayerHeading(); angle = PI + FindPlayerHeading();
@ -328,9 +338,17 @@ void CRadar::DrawBlips()
LimitRadarPoint(in); LimitRadarPoint(in);
TransformRadarPointToScreenSpace(out, in); TransformRadarPointToScreenSpace(out, in);
DrawRadarSprite(RADAR_SPRITE_NORTH, out.x, out.y, 255); DrawRadarSprite(RADAR_SPRITE_NORTH, out.x, out.y, 255);
#ifdef MENU_MAP
}
#endif
CEntity *blipEntity = nil; CEntity *blipEntity = nil;
for(int blipId = 0; blipId < NUMRADARBLIPS; blipId++) { 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) if (!ms_RadarTrace[blipId].m_bInUse)
continue; continue;
@ -338,8 +356,8 @@ void CRadar::DrawBlips()
case BLIP_CAR: case BLIP_CAR:
case BLIP_CHAR: case BLIP_CHAR:
case BLIP_OBJECT: case BLIP_OBJECT:
if (ms_RadarTrace[blipId].m_IconID == RADAR_SPRITE_BOMB || ms_RadarTrace[blipId].m_IconID == RADAR_SPRITE_SAVE if (ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_BOMB || ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_SAVE
|| ms_RadarTrace[blipId].m_IconID == RADAR_SPRITE_SPRAY || ms_RadarTrace[blipId].m_IconID == RADAR_SPRITE_WEAPON) { || ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_SPRAY || ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_WEAPON) {
switch (ms_RadarTrace[blipId].m_eBlipType) { switch (ms_RadarTrace[blipId].m_eBlipType) {
case BLIP_CAR: case BLIP_CAR:
@ -372,8 +390,8 @@ void CRadar::DrawBlips()
TransformRealWorldPointToRadarSpace(in, blipEntity->GetPosition()); TransformRealWorldPointToRadarSpace(in, blipEntity->GetPosition());
float dist = LimitRadarPoint(in); float dist = LimitRadarPoint(in);
TransformRadarPointToScreenSpace(out, in); TransformRadarPointToScreenSpace(out, in);
if (ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_NONE) { if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_NONE) {
DrawRadarSprite(ms_RadarTrace[blipId].m_IconID, out.x, out.y, CalculateBlipAlpha(dist)); DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist));
} else { } else {
#ifdef TRIANGULAR_BLIPS #ifdef TRIANGULAR_BLIPS
CVector &pos = FindPlayerCentreOfWorld_NoSniperShift(); CVector &pos = FindPlayerCentreOfWorld_NoSniperShift();
@ -394,8 +412,8 @@ void CRadar::DrawBlips()
break; break;
case BLIP_COORD: case BLIP_COORD:
case BLIP_CONTACT_POINT: case BLIP_CONTACT_POINT:
if ((ms_RadarTrace[blipId].m_IconID == RADAR_SPRITE_BOMB || ms_RadarTrace[blipId].m_IconID == RADAR_SPRITE_SAVE if ((ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_BOMB || ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_SAVE
|| ms_RadarTrace[blipId].m_IconID == RADAR_SPRITE_SPRAY || ms_RadarTrace[blipId].m_IconID == RADAR_SPRITE_WEAPON) || 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())) { && (ms_RadarTrace[blipId].m_eBlipType != BLIP_CONTACT_POINT || !CTheScripts::IsPlayerOnAMission())) {
uint32 color = GetRadarTraceColour(ms_RadarTrace[blipId].m_nColor, ms_RadarTrace[blipId].m_bDim); 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); TransformRealWorldPointToRadarSpace(in, ms_RadarTrace[blipId].m_vec2DPos);
float dist = LimitRadarPoint(in); float dist = LimitRadarPoint(in);
TransformRadarPointToScreenSpace(out, in); TransformRadarPointToScreenSpace(out, in);
if (ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_NONE) { if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_NONE) {
DrawRadarSprite(ms_RadarTrace[blipId].m_IconID, out.x, out.y, CalculateBlipAlpha(dist)); DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist));
} else { } else {
#ifdef TRIANGULAR_BLIPS #ifdef TRIANGULAR_BLIPS
CVector &pos = FindPlayerCentreOfWorld_NoSniperShift(); CVector &pos = FindPlayerCentreOfWorld_NoSniperShift();
@ -442,8 +460,8 @@ void CRadar::DrawBlips()
case BLIP_CAR: case BLIP_CAR:
case BLIP_CHAR: case BLIP_CHAR:
case BLIP_OBJECT: case BLIP_OBJECT:
if (ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_BOMB && ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_SAVE if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_BOMB && ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_SAVE
&& ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_SPRAY && ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_WEAPON) { && ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_SPRAY && ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_WEAPON) {
switch (ms_RadarTrace[blipId].m_eBlipType) { switch (ms_RadarTrace[blipId].m_eBlipType) {
case BLIP_CAR: case BLIP_CAR:
@ -477,8 +495,8 @@ void CRadar::DrawBlips()
TransformRealWorldPointToRadarSpace(in, blipEntity->GetPosition()); TransformRealWorldPointToRadarSpace(in, blipEntity->GetPosition());
float dist = LimitRadarPoint(in); float dist = LimitRadarPoint(in);
TransformRadarPointToScreenSpace(out, in); TransformRadarPointToScreenSpace(out, in);
if (ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_NONE) if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_NONE)
DrawRadarSprite(ms_RadarTrace[blipId].m_IconID, out.x, out.y, CalculateBlipAlpha(dist)); DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist));
else else
#ifdef TRIANGULAR_BLIPS #ifdef TRIANGULAR_BLIPS
{ {
@ -509,8 +527,8 @@ void CRadar::DrawBlips()
switch (ms_RadarTrace[blipId].m_eBlipType) { switch (ms_RadarTrace[blipId].m_eBlipType) {
case BLIP_COORD: case BLIP_COORD:
case BLIP_CONTACT_POINT: case BLIP_CONTACT_POINT:
if (ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_BOMB && ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_SAVE if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_BOMB && ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_SAVE
&& ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_SPRAY && ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_WEAPON && 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())) { && (ms_RadarTrace[blipId].m_eBlipType != BLIP_CONTACT_POINT || !CTheScripts::IsPlayerOnAMission())) {
uint32 color = GetRadarTraceColour(ms_RadarTrace[blipId].m_nColor, ms_RadarTrace[blipId].m_bDim); 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); TransformRealWorldPointToRadarSpace(in, ms_RadarTrace[blipId].m_vec2DPos);
float dist = LimitRadarPoint(in); float dist = LimitRadarPoint(in);
TransformRadarPointToScreenSpace(out, in); TransformRadarPointToScreenSpace(out, in);
if (ms_RadarTrace[blipId].m_IconID != RADAR_SPRITE_NONE) if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_NONE)
DrawRadarSprite(ms_RadarTrace[blipId].m_IconID, out.x, out.y, CalculateBlipAlpha(dist)); DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist));
else else
#ifdef TRIANGULAR_BLIPS #ifdef TRIANGULAR_BLIPS
{ {
@ -550,6 +568,14 @@ void CRadar::DrawBlips()
break; 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)); 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 #ifdef MENU_MAP
if (bMenuMapActive) { if (CMenuManager::bMenuMapActive) {
bool alreadyThere; bool alreadyThere = false;
for (int i = 0; i < NUM_MAP_LEGENDS; i++) { for (int i = 0; i < NUM_MAP_LEGENDS; i++) {
if (MapLegendList[i] == sprite) if (MapLegendList[i] == sprite)
alreadyThere = true; alreadyThere = true;
@ -834,7 +860,7 @@ CRadar::Initialise()
ms_RadarTrace[i].m_bInUse = false; ms_RadarTrace[i].m_bInUse = false;
ms_RadarTrace[i].m_eBlipType = BLIP_NONE; ms_RadarTrace[i].m_eBlipType = BLIP_NONE;
ms_RadarTrace[i].m_eBlipDisplay = BLIP_DISPLAY_NEITHER; 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; m_radarRange = 350.0f;
@ -847,6 +873,10 @@ float CRadar::LimitRadarPoint(CVector2D &point)
float dist, invdist; float dist, invdist;
dist = point.Magnitude(); dist = point.Magnitude();
#ifdef MENU_MAP
if (CMenuManager::bMenuMapActive)
return dist;
#endif
if (dist > 1.0f) { if (dist > 1.0f) {
invdist = 1.0f / dist; invdist = 1.0f / dist;
point.x *= invdist; point.x *= invdist;
@ -930,7 +960,7 @@ void CRadar::SetBlipSprite(int32 i, int32 icon)
{ {
int index = CRadar::GetActualBlipArrayIndex(i); int index = CRadar::GetActualBlipArrayIndex(i);
if (index != -1) { 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_nEntityHandle = 0;
ms_RadarTrace[nextBlip].m_wScale = 1; ms_RadarTrace[nextBlip].m_wScale = 1;
ms_RadarTrace[nextBlip].m_eBlipDisplay = display; 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); 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_nEntityHandle = handle;
ms_RadarTrace[nextBlip].m_wScale = 1; ms_RadarTrace[nextBlip].m_wScale = 1;
ms_RadarTrace[nextBlip].m_eBlipDisplay = display; 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); return GetNewUniqueBlipIndex(nextBlip);
} }
@ -1050,8 +1080,8 @@ void CRadar::ShowRadarTraceWithHeight(float x, float y, uint32 size, uint8 red,
} }
#ifdef MENU_MAP #ifdef MENU_MAP
// VC uses -1 for coords and -2 for entities but meh, I don't want to edit DrawBlips // VC uses -1 for coords and -2 for entities but meh, I don't want to edit DrawBlips
if (bMenuMapActive) { if (CMenuManager::bMenuMapActive) {
bool alreadyThere; bool alreadyThere = false;
for (int i = 0; i < NUM_MAP_LEGENDS; i++) { for (int i = 0; i < NUM_MAP_LEGENDS; i++) {
if (MapLegendList[i] == -1) if (MapLegendList[i] == -1)
alreadyThere = true; alreadyThere = true;
@ -1156,9 +1186,10 @@ void CRadar::TransformRadarPointToRealWorldSpace(CVector2D &out, const CVector2D
void CRadar::TransformRadarPointToScreenSpace(CVector2D &out, const CVector2D &in) void CRadar::TransformRadarPointToScreenSpace(CVector2D &out, const CVector2D &in)
{ {
#ifdef MENU_MAP #ifdef MENU_MAP
if (bMenuMapActive) { if (CMenuManager::bMenuMapActive) {
out.x = MENU_X_LEFT_ALIGNED((0.66193402f * m_nMapNegativePadding * in.x) + (0.2348f * m_nMapNegativePadding) + m_nMapLeftPadding); // fMapSize is actually half map size. Radar range is 1000, so if x is -2000, in.x + 2.0f is 0.
out.y = MENU_Y(m_nMapTopPadding - (0.065807f * m_nMapNegativePadding) - (0.66563499f * m_nMapNegativePadding * in.y)); 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 } else
#endif #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 if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN || TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOP_DOWN_PED
#ifdef MENU_MAP #ifdef MENU_MAP
|| bMenuMapActive || CMenuManager::bMenuMapActive
#endif #endif
) { ) {
cachedSin = 0.0f; cachedSin = 0.0f;
@ -1361,7 +1392,7 @@ CRadar::InitFrontEndMap()
CalculateCachedSinCos(); CalculateCachedSinCos();
vec2DRadarOrigin.x = 0.0f; vec2DRadarOrigin.x = 0.0f;
vec2DRadarOrigin.y = 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++) { for (int i = 0; i < NUM_MAP_LEGENDS; i++) {
MapLegendList[i] = RADAR_SPRITE_NONE; MapLegendList[i] = RADAR_SPRITE_NONE;
} }
@ -1369,6 +1400,62 @@ CRadar::InitFrontEndMap()
ArrowBlipColour1 = CRGBA(0, 0, 0, 0); ArrowBlipColour1 = CRGBA(0, 0, 0, 0);
ArrowBlipColour2 = 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 #endif
STARTPATCHES STARTPATCHES

View File

@ -69,7 +69,7 @@ struct CBlip
float m_Radius; float m_Radius;
int16 m_wScale; int16 m_wScale;
uint16 m_eBlipDisplay; // eBlipDisplay uint16 m_eBlipDisplay; // eBlipDisplay
uint16 m_IconID; // eRadarSprite uint16 m_eRadarSprite; // eRadarSprite
}; };
static_assert(sizeof(CBlip) == 0x30, "CBlip: error"); static_assert(sizeof(CBlip) == 0x30, "CBlip: error");
@ -108,12 +108,16 @@ public:
static float cachedCos; static float cachedCos;
static float cachedSin; static float cachedSin;
#ifdef MENU_MAP #ifdef MENU_MAP
#define NUM_MAP_LEGENDS 75
static CRGBA ArrowBlipColour1; static CRGBA ArrowBlipColour1;
static CRGBA ArrowBlipColour2; static CRGBA ArrowBlipColour2;
static uint16 MapLegendList[75]; static uint16 MapLegendList[NUM_MAP_LEGENDS];
static bool bMenuMapActive; static uint16 MapLegendCounter;
static int TargetMarkerId;
static void InitFrontEndMap(); static void InitFrontEndMap();
static void DrawYouAreHereSprite(float, float);
static void ToggleTargetMarker(float, float);
#endif #endif
static uint8 CalculateBlipAlpha(float dist); static uint8 CalculateBlipAlpha(float dist);
static void ChangeBlipBrightness(int32 i, int32 bright); static void ChangeBlipBrightness(int32 i, int32 bright);

View File

@ -192,7 +192,7 @@ enum Config {
#define TRIANGULAR_BLIPS // height indicating triangular radar blips, as in VC #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_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 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 // Script
#define USE_DEBUG_SCRIPT_LOADER // makes game load main_freeroam.scm by default #define USE_DEBUG_SCRIPT_LOADER // makes game load main_freeroam.scm by default