Update Radar.cpp

This commit is contained in:
_AG 2019-06-20 21:34:39 +02:00
parent f3c331ece6
commit 11ba688c98
4 changed files with 183 additions and 92 deletions

View File

@ -9,12 +9,15 @@
#include "Vehicle.h" #include "Vehicle.h"
#include "Pools.h" #include "Pools.h"
#include "Script.h" #include "Script.h"
#include "TxdStore.h"
WRAPPER void CRadar::ClearBlipForEntity(eBlipType type, int32 id) { EAXJMP(0x4A56C0); } WRAPPER void CRadar::ClearBlipForEntity(eBlipType type, int32 id) { EAXJMP(0x4A56C0); }
WRAPPER void CRadar::Draw3dMarkers() { EAXJMP(0x4A4C70); } WRAPPER void CRadar::Draw3dMarkers() { EAXJMP(0x4A4C70); }
WRAPPER void CRadar::DrawRadarMap() { EAXJMP(0x4A6C20); }
WRAPPER float CRadar::LimitRadarPoint(CVector2D *point) { EAXJMP(0x4A4F30); } WRAPPER float CRadar::LimitRadarPoint(CVector2D *point) { EAXJMP(0x4A4F30); }
WRAPPER void CRadar::ShowRadarTrace(float x, float y, uint32 size, uint32 red, uint32 green, uint32 blue, uint32 alpha) { EAXJMP(0x4A5870); } WRAPPER void CRadar::ShowRadarTrace(float x, float y, uint32 size, uint32 red, uint32 green, uint32 blue, uint32 alpha) { EAXJMP(0x4A5870); }
WRAPPER void CRadar::StreamRadarSections(int x, int y) { EAXJMP(0x4A6100); }
WRAPPER int CRadar::ClipRadarPoly(CVector2D *out, CVector2D *in) { EAXJMP(0x4A64A0); }
WRAPPER void CRadar::TransformRealWorldToTexCoordSpace(CVector2D *out, CVector2D *in, int x, int y) { EAXJMP(0x4A5530); }
float &CRadar::m_RadarRange = *(float*)0x8E281C; float &CRadar::m_RadarRange = *(float*)0x8E281C;
CVector2D &CRadar::vec2DRadarOrigin = *(CVector2D*)0x6299B8; CVector2D &CRadar::vec2DRadarOrigin = *(CVector2D*)0x6299B8;
@ -22,6 +25,8 @@ CBlip *CRadar::ms_RadarTrace = (CBlip*)0x6ED5E0;
float CRadar::cachedSin; float CRadar::cachedSin;
float CRadar::cachedCos; float CRadar::cachedCos;
int *gRadarTxdIds = (int*)0x6299C0;
CSprite2d *CRadar::AsukaSprite = (CSprite2d*)0x8F1A40; CSprite2d *CRadar::AsukaSprite = (CSprite2d*)0x8F1A40;
CSprite2d *CRadar::BombSprite = (CSprite2d*)0x8F5FB4; CSprite2d *CRadar::BombSprite = (CSprite2d*)0x8F5FB4;
CSprite2d *CRadar::CatSprite = (CSprite2d*)0x885B24; CSprite2d *CRadar::CatSprite = (CSprite2d*)0x885B24;
@ -93,6 +98,98 @@ void CRadar::DrawMap()
} }
#endif #endif
#if 0
WRAPPER void CRadar::DrawRadarMask() { EAXJMP(0x4A69C0); }
#else
void CRadar::DrawRadarMask()
{
CVector2D vec2d[4]{
CVector2D(1.0f, -1.0f),
CVector2D(1.0f, 1.0f),
CVector2D(-1.0f, 1.0f),
CVector2D(-1.0, -1.0f)
};
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
RwRenderStateSet(rwRENDERSTATESHADEMODE, (void*)rwSHADEMODEFLAT);
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
RwD3D8SetRenderState(rwRENDERSTATESTENCILFUNCTION, rwSTENCILFUNCTIONALWAYS);
CVector2D out[8];
CVector2D in;
for (int i = 0; i < 4; i++) {
in.x = vec2d[i].x;
in.y = vec2d[i].y;
CRadar::TransformRadarPointToScreenSpace(out, &in);
for (int j = 0; j < 7; j++) {
CRadar::cachedCos = cos(j * M_PI_2 * (1.0f / 6.0f));
CRadar::cachedSin = sin(j * M_PI_2 * (1.0f / 6.0f));
in.x = vec2d[i].x * cachedCos;
in.y = vec2d[i].y * cachedSin;
CRadar::TransformRadarPointToScreenSpace(&out[j + 1], &in);
};
CSprite2d::SetMaskVertices(8, (float *)out);
RwIm2DRenderPrimitive(rwPRIMTYPETRIFAN, CSprite2d::GetVertices(), 8);
};
RwD3D8SetRenderState(rwRENDERSTATESTENCILFUNCTION, rwSTENCILFUNCTIONGREATER);
}
#endif
#if 1
WRAPPER void CRadar::DrawRadarSection(int x, int y) { EAXJMP(0x4A67E0); }
#else
void CRadar::DrawRadarSection(int x, int y)
{
}
#endif
#if 0
WRAPPER void CRadar::DrawRadarMap() { EAXJMP(0x4A6C20); }
#else
void CRadar::DrawRadarMap()
{
CRadar::DrawRadarMask();
int x = floorf((2000.0f + vec2DRadarOrigin.x) * 0.002f);
int y = round(7.0f - (2000.0f + vec2DRadarOrigin.y) * 0.002f);
CRadar::StreamRadarSections(x, y);
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
RwRenderStateSet(rwRENDERSTATESHADEMODE, (void*)rwSHADEMODEFLAT);
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATETEXTUREADDRESS, (void*)rwTEXTUREADDRESSCLAMP);
RwRenderStateSet(rwRENDERSTATETEXTUREPERSPECTIVE, (void*)FALSE);
CRadar::DrawRadarSection(x - 1, y - 1);
CRadar::DrawRadarSection(x, y - 1);
CRadar::DrawRadarSection(x + 1, y - 1);
CRadar::DrawRadarSection(x - 1, y);
CRadar::DrawRadarSection(x, y);
CRadar::DrawRadarSection(x + 1, y);
CRadar::DrawRadarSection(x - 1, y + 1);
CRadar::DrawRadarSection(x, y + 1);
CRadar::DrawRadarSection(x + 1, y + 1);
}
#endif
#if 0 #if 0
WRAPPER void CRadar::DrawBlips() { EAXJMP(0x4A42F0); } WRAPPER void CRadar::DrawBlips() { EAXJMP(0x4A42F0); }
#else #else
@ -120,7 +217,7 @@ void CRadar::DrawBlips()
CVector2D vec2d; CVector2D vec2d;
vec2d.x = vec2DRadarOrigin.x; vec2d.x = vec2DRadarOrigin.x;
vec2d.y = M_SQRT2 * CRadar::m_RadarRange + vec2DRadarOrigin.y; vec2d.y = M_SQRT2 * m_RadarRange + vec2DRadarOrigin.y;
CRadar::TransformRealWorldPointToRadarSpace(&in, &vec2d); CRadar::TransformRealWorldPointToRadarSpace(&in, &vec2d);
CRadar::LimitRadarPoint(&in); CRadar::LimitRadarPoint(&in);
CRadar::TransformRadarPointToScreenSpace(&out, &in); CRadar::TransformRadarPointToScreenSpace(&out, &in);
@ -146,62 +243,58 @@ void CRadar::DrawBlips()
}; };
if (e) { if (e) {
if (CRadar::ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BOTH || CRadar::ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) { if (ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) {
if (CTheScripts::DbgFlag) { if (CTheScripts::DbgFlag) {
CRadar::ShowRadarMarker(e->GetPosition(), CRadar::GetRadarTraceColour(CRadar::ms_RadarTrace[i].m_nColor, CRadar::ms_RadarTrace[i].m_bDim), CRadar::ms_RadarTrace->m_Radius); CRadar::ShowRadarMarker(e->GetPosition(), GetRadarTraceColour(ms_RadarTrace[i].m_nColor, ms_RadarTrace[i].m_bDim), ms_RadarTrace->m_Radius);
CRadar::ms_RadarTrace[i].m_Radius = CRadar::ms_RadarTrace[i].m_Radius - 0.1f; ms_RadarTrace[i].m_Radius = ms_RadarTrace[i].m_Radius - 0.1f;
if (CRadar::ms_RadarTrace[i].m_Radius >= 1.0f) if (ms_RadarTrace[i].m_Radius >= 1.0f)
CRadar::ms_RadarTrace[i].m_Radius = 5.0; ms_RadarTrace[i].m_Radius = 5.0;
} }
} }
if (CRadar::ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BOTH || CRadar::ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BLIP_ONLY) { if (ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BLIP_ONLY) {
vec2d = e->GetPosition(); vec2d = e->GetPosition();
CRadar::TransformRealWorldPointToRadarSpace(&in, &vec2d); CRadar::TransformRealWorldPointToRadarSpace(&in, &vec2d);
float dist = CRadar::LimitRadarPoint(&in); float dist = CRadar::LimitRadarPoint(&in);
int a = CRadar::CalculateBlipAlpha(dist); int a = CRadar::CalculateBlipAlpha(dist);
CRadar::TransformRadarPointToScreenSpace(&out, &in); CRadar::TransformRadarPointToScreenSpace(&out, &in);
CRGBA col = CRadar::GetRadarTraceColour(CRadar::ms_RadarTrace[i].m_nColor, CRadar::ms_RadarTrace[i].m_bDim); CRGBA col = CRadar::GetRadarTraceColour(ms_RadarTrace[i].m_nColor, ms_RadarTrace[i].m_bDim);
if (CRadar::ms_RadarTrace[i].m_IconID) if (CRadar::ms_RadarTrace[i].m_IconID)
CRadar::DrawRadarSprite(CRadar::ms_RadarTrace[i].m_IconID, out.x, out.y, a); CRadar::DrawRadarSprite(ms_RadarTrace[i].m_IconID, out.x, out.y, a);
else else
CRadar::ShowRadarTrace(out.x, out.y, CRadar::ms_RadarTrace[i].m_wScale, col.r, col.g, col.b, 255); CRadar::ShowRadarTrace(out.x, out.y, ms_RadarTrace[i].m_wScale, col.r, col.g, col.b, 255);
} }
} }
} }
}
}
/* /*
DrawCoordBlip DrawCoordBlip
*/ */
for (int i = 0; i < 32; i++) {
if (CRadar::ms_RadarTrace[i].m_bInUse) {
if (ms_RadarTrace[i].m_eBlipType >= BLIP_COORD) { if (ms_RadarTrace[i].m_eBlipType >= BLIP_COORD) {
if (CRadar::DisplayThisBlip(ms_RadarTrace[i].m_IconID) && CRadar::ms_RadarTrace[i].m_eBlipType != BLIP_CONTACT_POINT || !CTheScripts::IsPlayerOnAMission()) { if (ms_RadarTrace[i].m_eBlipType != BLIP_CONTACT_POINT || ms_RadarTrace[i].m_eBlipType == BLIP_CONTACT_POINT && DisplayThisBlip(i) || !CTheScripts::IsPlayerOnAMission()) {
if (CRadar::ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BOTH || CRadar::ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) { if (ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) {
if (CTheScripts::DbgFlag) { if (CTheScripts::DbgFlag) {
CRadar::ShowRadarMarker(CRadar::ms_RadarTrace[i].m_vecPos, CRadar::GetRadarTraceColour(CRadar::ms_RadarTrace[i].m_nColor, CRadar::ms_RadarTrace[i].m_bDim), CRadar::ms_RadarTrace->m_Radius); CRadar::ShowRadarMarker(ms_RadarTrace[i].m_vecPos, GetRadarTraceColour(ms_RadarTrace[i].m_nColor, ms_RadarTrace[i].m_bDim), ms_RadarTrace->m_Radius);
CRadar::ms_RadarTrace[i].m_Radius = CRadar::ms_RadarTrace[i].m_Radius - 0.1f; CRadar::ms_RadarTrace[i].m_Radius = ms_RadarTrace[i].m_Radius - 0.1f;
if (CRadar::ms_RadarTrace[i].m_Radius >= 1.0f) if (ms_RadarTrace[i].m_Radius >= 1.0f)
CRadar::ms_RadarTrace[i].m_Radius = 5.0f; ms_RadarTrace[i].m_Radius = 5.0f;
} }
} }
if (CRadar::ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BOTH || CRadar::ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BLIP_ONLY) { if (ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BLIP_ONLY) {
CRadar::TransformRealWorldPointToRadarSpace(&in, &ms_RadarTrace[i].m_vec2DPos); CRadar::TransformRealWorldPointToRadarSpace(&in, &ms_RadarTrace[i].m_vec2DPos);
float dist = CRadar::LimitRadarPoint(&in); float dist = CRadar::LimitRadarPoint(&in);
int a = CRadar::CalculateBlipAlpha(dist); int a = CRadar::CalculateBlipAlpha(dist);
CRadar::TransformRadarPointToScreenSpace(&out, &in); CRadar::TransformRadarPointToScreenSpace(&out, &in);
CRGBA col = CRadar::GetRadarTraceColour(CRadar::ms_RadarTrace[i].m_nColor, CRadar::ms_RadarTrace[i].m_bDim); CRGBA col = CRadar::GetRadarTraceColour(ms_RadarTrace[i].m_nColor, ms_RadarTrace[i].m_bDim);
if (CRadar::ms_RadarTrace[i].m_IconID) if (CRadar::ms_RadarTrace[i].m_IconID)
CRadar::DrawRadarSprite(CRadar::ms_RadarTrace[i].m_IconID, out.x, out.y, a); CRadar::DrawRadarSprite(ms_RadarTrace[i].m_IconID, out.x, out.y, a);
else else
CRadar::ShowRadarTrace(out.x, out.y, CRadar::ms_RadarTrace[i].m_wScale, col.r, col.g, col.b, 255); CRadar::ShowRadarTrace(out.x, out.y, ms_RadarTrace[i].m_wScale, col.r, col.g, col.b, 255);
} }
} }
} }
@ -211,45 +304,6 @@ void CRadar::DrawBlips()
} }
#endif #endif
bool CRadar::DisplayThisBlip(int16 spriteid)
{
switch (spriteid) {
case RADAR_SPRITE_NONE:
return true;
break;
case RADAR_SPRITE_ASUKA:
case RADAR_SPRITE_BOMB:
case RADAR_SPRITE_CAT:
return false;
break;
case RADAR_SPRITE_CENTRE:
return true;
break;
case RADAR_SPRITE_COPCAR:
case RADAR_SPRITE_DON:
case RADAR_SPRITE_EIGHT:
case RADAR_SPRITE_EL:
case RADAR_SPRITE_ICE:
case RADAR_SPRITE_JOEY:
case RADAR_SPRITE_KENJI:
case RADAR_SPRITE_LIZ:
case RADAR_SPRITE_LUIGI:
return false;
break;
case RADAR_SPRITE_NORTH:
return true;
break;
case RADAR_SPRITE_RAY:
case RADAR_SPRITE_SAL:
case RADAR_SPRITE_SAVE:
case RADAR_SPRITE_SPRAY:
case RADAR_SPRITE_TONY:
case RADAR_SPRITE_WEAPON:
return false;
break;
};
}
int CRadar::CalculateBlipAlpha(float dist) int CRadar::CalculateBlipAlpha(float dist)
{ {
if (dist <= 1.0f) if (dist <= 1.0f)
@ -269,46 +323,38 @@ CRGBA CRadar::GetRadarTraceColour(uint32 color, bool bright)
return CRGBA(113, 43, 73, 255); return CRGBA(113, 43, 73, 255);
else else
return CRGBA(127, 0, 0, 255); return CRGBA(127, 0, 0, 255);
break;
case 1: case 1:
if (bright) if (bright)
return CRGBA(95, 160, 106, 255); return CRGBA(95, 160, 106, 255);
else else
return CRGBA(127, 0, 255, 255); return CRGBA(127, 0, 255, 255);
break;
case 2: case 2:
if (bright) if (bright)
return CRGBA(128, 167, 243, 255); return CRGBA(128, 167, 243, 255);
else else
return CRGBA(0, 127, 255, 255); return CRGBA(0, 127, 255, 255);
break;
case 3: case 3:
if (bright) if (bright)
return CRGBA(225, 225, 225, 255); return CRGBA(225, 225, 225, 255);
else else
return CRGBA(127, 127, 127, 255); return CRGBA(127, 127, 127, 255);
break;
case 4: case 4:
if (bright) if (bright)
return CRGBA(255, 225, 0, 255); return CRGBA(255, 225, 0, 255);
else else
return CRGBA(127, 127, 0, 255); return CRGBA(127, 127, 0, 255);
break;
case 5: case 5:
if (bright) if (bright)
return CRGBA(255, 0, 255, 255); return CRGBA(255, 0, 255, 255);
else else
return CRGBA(127, 0, 127, 255); return CRGBA(127, 0, 127, 255);
break;
case 6: case 6:
if (bright) if (bright)
return CRGBA(255, 255, 255, 255); return CRGBA(255, 255, 255, 255);
else else
return CRGBA(127, 127, 255, 255); return CRGBA(127, 127, 255, 255);
break;
default: default:
return CRGBA(0, 0, 0, 255); return CRGBA(0, 0, 0, 255);
break;
} }
} }
@ -323,20 +369,20 @@ WRAPPER void CRadar::TransformRealWorldPointToRadarSpace(CVector2D *out, CVector
#else #else
void CRadar::TransformRealWorldPointToRadarSpace(CVector2D *out, CVector2D *in) void CRadar::TransformRealWorldPointToRadarSpace(CVector2D *out, CVector2D *in)
{ {
if (TheCamera.Cams->Mode != CCam::CamMode::MODE_TOPDOWN1 && TheCamera.Cams->Mode != CCam::CamMode::MODE_TOPDOWNPED) { if (TheCamera.Cams[TheCamera.ActiveCam].Mode != CCam::CamMode::MODE_TOPDOWN1 && TheCamera.Cams[TheCamera.ActiveCam].Mode != CCam::CamMode::MODE_TOPDOWNPED) {
if (TheCamera.GetLookDirection() != LOOKING_FORWARD) { if (TheCamera.GetLookDirection() != LOOKING_FORWARD) {
cachedSin = sin(atan2(-TheCamera.Cams[TheCamera.ActiveCam].CamTargetEntity->m_matrix.m_matrix.up.x, TheCamera.Cams[TheCamera.ActiveCam].CamTargetEntity->m_matrix.m_matrix.up.y)); cachedSin = sin(atan2(-TheCamera.m_matrix.m_matrix.up.x, TheCamera.m_matrix.m_matrix.up.y));
cachedCos = cos(atan2(-TheCamera.Cams[TheCamera.ActiveCam].CamTargetEntity->m_matrix.m_matrix.up.x, TheCamera.Cams[TheCamera.ActiveCam].CamTargetEntity->m_matrix.m_matrix.up.y)); cachedCos = cos(atan2(-TheCamera.m_matrix.m_matrix.up.x, TheCamera.m_matrix.m_matrix.up.y));
} }
else { else {
CVector vecCamera; CVector vecCamera;
if (TheCamera.Cams->Mode == CCam::CamMode::MODE_FIRSTPERSON) { if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::CamMode::MODE_FIRSTPERSON) {
vecCamera = TheCamera.Cams[TheCamera.ActiveCam].CamTargetEntity->m_matrix.m_matrix.up; vecCamera = TheCamera.Cams[TheCamera.ActiveCam].CamTargetEntity->m_matrix.m_matrix.up;
vecCamera.Normalise(); vecCamera.Normalise();
} }
else else
vecCamera = TheCamera.Cams[TheCamera.ActiveCam].CamTargetEntity->m_matrix.m_matrix.pos - TheCamera.Cams[TheCamera.ActiveCam].SourceBeforeLookBehind; vecCamera = TheCamera.m_matrix.m_matrix.up;
cachedSin = sin(atan2(-vecCamera.x, vecCamera.y)); cachedSin = sin(atan2(-vecCamera.x, vecCamera.y));
cachedCos = cos(atan2(-vecCamera.x, vecCamera.y)); cachedCos = cos(atan2(-vecCamera.x, vecCamera.y));
@ -436,6 +482,42 @@ void CRadar::DrawRotatingRadarSprite(CSprite2d* sprite, float x, float y, float
} }
#endif #endif
bool CRadar::DisplayThisBlip(int counter)
{
switch (ms_RadarTrace[counter].m_IconID) {
case RADAR_SPRITE_BOMB:
case RADAR_SPRITE_SPRAY:
case RADAR_SPRITE_WEAPON:
return true;
default:
return false;
}
}
void CRadar::GetTextureCorners(int x, int y, CVector2D *out)
{
out[0].x = 500.0f * (x - 4);
out[0].y = 500.0f * (3 - y);
out[1].x = 500.0f * (y - 4 + 1);
out[1].y = 500.0f * (3 - y);
out[2].x = 500.0f * (y - 4 + 1);
out[2].y = 500.0f * (3 - y + 1);
out[3].x = 500.0f * (x - 4);
out[3].y = 500.0f * (3 - y + 1);
}
void CRadar::ClipRadarTileCoords(int x, int y)
{
if (x < 0)
x = 0;
if (x > 7)
x = 7;
if (y < 0)
y = 0;
if (y > 7)
y = 7;
}
STARTPATCHES STARTPATCHES
InjectHook(0x4A5040, CRadar::TransformRadarPointToScreenSpace, PATCH_JUMP); InjectHook(0x4A5040, CRadar::TransformRadarPointToScreenSpace, PATCH_JUMP);
ENDPATCHES ENDPATCHES

View File

@ -99,9 +99,12 @@ public:
static void ClearBlipForEntity(eBlipType type, int32 id); static void ClearBlipForEntity(eBlipType type, int32 id);
static void Draw3dMarkers(); static void Draw3dMarkers();
static void DrawMap(); static void DrawMap();
static void StreamRadarSections(int x, int y);
static int ClipRadarPoly(CVector2D *out, CVector2D *in);
static void TransformRealWorldToTexCoordSpace(CVector2D *out, CVector2D *in, int x, int y);
static void DrawRadarSection(int x, int y);
static void TransformRadarPointToScreenSpace(CVector2D * out, CVector2D * in); static void TransformRadarPointToScreenSpace(CVector2D * out, CVector2D * in);
static void DrawBlips(); static void DrawBlips();
static bool DisplayThisBlip(int16 spriteid);
static int CalculateBlipAlpha(float dist); static int CalculateBlipAlpha(float dist);
static CRGBA GetRadarTraceColour(uint32 color, bool bright); static CRGBA GetRadarTraceColour(uint32 color, bool bright);
static void DrawRadarMap(); static void DrawRadarMap();
@ -111,4 +114,8 @@ public:
static void DrawRadarSprite(int sprite, float x, float y, int alpha); static void DrawRadarSprite(int sprite, float x, float y, int alpha);
static void ShowRadarMarker(CVector pos, CRGBA color, float radius); static void ShowRadarMarker(CVector pos, CRGBA color, float radius);
static void ShowRadarTrace(float x, float y, uint32 size, uint32 red, uint32 green, uint32 blue, uint32 alpha); static void ShowRadarTrace(float x, float y, uint32 size, uint32 red, uint32 green, uint32 blue, uint32 alpha);
static void DrawRadarMask();
static bool DisplayThisBlip(int counter);
static void GetTextureCorners(int x, int y, CVector2D * out);
static void ClipRadarTileCoords(int x, int y);
}; };

View File

@ -1011,13 +1011,13 @@ void CHud::Draw()
CFont::PrintString(SCREEN_WIDTH / 2, (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(20.0f), m_BigMessage[0]); CFont::PrintString(SCREEN_WIDTH / 2, (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(20.0f), m_BigMessage[0]);
} }
else { else {
BigMessageAlpha[0] = 0.0; BigMessageAlpha[0] = 0.0f;
BigMessageX[0] = -60.0; BigMessageX[0] = -60.0f;
BigMessageInUse[0] = 1.0; BigMessageInUse[0] = 1.0f;
} }
} }
else { else {
BigMessageInUse[0] = 0.0; BigMessageInUse[0] = 0.0f;
} }
// WastedBustedText // WastedBustedText
@ -1149,7 +1149,7 @@ void CHud::DrawAfterFade()
CFont::SetFontStyle(FONT_BANK); CFont::SetFontStyle(FONT_BANK);
CFont::SetBackgroundOn(); CFont::SetBackgroundOn();
CFont::SetBackGroundOnlyTextOff(); CFont::SetBackGroundOnlyTextOff();
CFont::SetBackgroundColor(CRGBA(0, 0, 0, fAlpha)); CFont::SetBackgroundColor(CRGBA(0, 0, 0, fAlpha * 0.8f));
CFont::SetColor(CRGBA(175, 175, 175, 255)); CFont::SetColor(CRGBA(175, 175, 175, 255));
CFont::PrintString(SCREEN_SCALE_X(26.0f), SCREEN_SCALE_Y(28.0f + (150.0f - PagerXOffset) * 0.6f), CHud::m_HelpMessageToPrint); CFont::PrintString(SCREEN_SCALE_X(26.0f), SCREEN_SCALE_Y(28.0f + (150.0f - PagerXOffset) * 0.6f), CHud::m_HelpMessageToPrint);
CFont::SetAlphaFade(255.0f); CFont::SetAlphaFade(255.0f);
@ -1283,18 +1283,18 @@ void CHud::DrawAfterFade()
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f), m_BigMessage[1]); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f), m_BigMessage[1]);
} }
else { else {
BigMessageAlpha[1] = 0.0; BigMessageAlpha[1] = 0.0f;
BigMessageX[1] = -60.0; BigMessageX[1] = -60.0f;
BigMessageInUse[1] = 1.0; BigMessageInUse[1] = 1.0f;
} }
} }
else { else {
BigMessageInUse[1] = 0.0; BigMessageInUse[1] = 0.0f;
} }
} }
#endif #endif
#if 1 #if 0
WRAPPER void CHud::ReInitialise(void) { EAXJMP(0x504CC0); } WRAPPER void CHud::ReInitialise(void) { EAXJMP(0x504CC0); }
#else #else
void CHud::ReInitialise() { void CHud::ReInitialise() {
@ -1315,7 +1315,7 @@ void CHud::ReInitialise() {
BigMessageInUse[i] = 0.0f; BigMessageInUse[i] = 0.0f;
if (i <= 128) if (i <= 128)
*(wchar*)(m_BigMessage[i]) = 0; m_BigMessage[i][0] = 0;
} }
m_HelpMessageTimer = 0; m_HelpMessageTimer = 0;

View File

@ -46,4 +46,6 @@ public:
static void DrawRect(const CRect &r, const CRGBA &c0, const CRGBA &c1, const CRGBA &c2, const CRGBA &c3); static void DrawRect(const CRect &r, const CRGBA &c0, const CRGBA &c1, const CRGBA &c2, const CRGBA &c3);
static void DrawRect(const CRect &r, const CRGBA &col); static void DrawRect(const CRect &r, const CRGBA &col);
static void DrawRectXLU(const CRect &r, const CRGBA &c0, const CRGBA &c1, const CRGBA &c2, const CRGBA &c3); static void DrawRectXLU(const CRect &r, const CRGBA &c0, const CRGBA &c1, const CRGBA &c2, const CRGBA &c3);
static RwIm2DVertex* GetVertices() { return maVertices; };
}; };