Code clean up.

This commit is contained in:
_AG 2019-06-20 15:18:15 +02:00
parent 922c73eeee
commit f3c331ece6
5 changed files with 78 additions and 39 deletions

View File

@ -10,12 +10,6 @@
#include "Pools.h"
#include "Script.h"
//WRAPPER void CRadar::DrawMap () { EAXJMP(0x4A4200); }
//WRAPPER void CRadar::DrawRotatingRadarSprite(CSprite2d* sprite, float x, float y, float angle, int alpha) { EAXJMP(0x4A5D10); }
//WRAPPER void CRadar::TransformRealWorldPointToRadarSpace(CVector2D *out, CVector2D *in) { EAXJMP(0x4A50D0); }
//WRAPPER void CRadar::DrawRadarSprite(int sprite, float x, float y, int alpha) { EAXJMP(0x4A5EF0); }
//WRAPPER void CRadar::ShowRadarMarker(CVector pos, uint32 color, float radius) { EAXJMP(0x4A59C0); }
//WRAPPER void CRadar::DrawBlips() { EAXJMP(0x4A42F0); }
WRAPPER void CRadar::ClearBlipForEntity(eBlipType type, int32 id) { EAXJMP(0x4A56C0); }
WRAPPER void CRadar::Draw3dMarkers() { EAXJMP(0x4A4C70); }
WRAPPER void CRadar::DrawRadarMap() { EAXJMP(0x4A6C20); }
@ -73,6 +67,9 @@ CSprite2d *CRadar::RadarSprites[RADAR_SPRITE_COUNT] = {
WeaponSprite
};
#if 0
WRAPPER void CRadar::DrawMap () { EAXJMP(0x4A4200); }
#else
void CRadar::DrawMap()
{
if (!TheCamera.m_WideScreenOn && CHud::m_Wants_To_Draw_Hud) {
@ -94,7 +91,11 @@ void CRadar::DrawMap()
CRadar::DrawRadarMap();
}
}
#endif
#if 0
WRAPPER void CRadar::DrawBlips() { EAXJMP(0x4A42F0); }
#else
void CRadar::DrawBlips()
{
if (!TheCamera.m_WideScreenOn && CHud::m_Wants_To_Draw_Hud) {
@ -208,6 +209,7 @@ void CRadar::DrawBlips()
}
}
}
#endif
bool CRadar::DisplayThisBlip(int16 spriteid)
{
@ -316,6 +318,9 @@ void CRadar::TransformRadarPointToScreenSpace(CVector2D *out, CVector2D *in)
out->y = (SCREEN_SCALE_Y(76.0f)) * 0.5f + SCREEN_HEIGHT - (SCREEN_SCALE_Y(123.0f)) - in->y * (SCREEN_SCALE_Y(76.0f)) * 0.5f;
}
#if 0
WRAPPER void CRadar::TransformRealWorldPointToRadarSpace(CVector2D *out, CVector2D *in) { EAXJMP(0x4A50D0); }
#else
void CRadar::TransformRealWorldPointToRadarSpace(CVector2D *out, CVector2D *in)
{
if (TheCamera.Cams->Mode != CCam::CamMode::MODE_TOPDOWN1 && TheCamera.Cams->Mode != CCam::CamMode::MODE_TOPDOWNPED) {
@ -348,7 +353,11 @@ void CRadar::TransformRealWorldPointToRadarSpace(CVector2D *out, CVector2D *in)
out->x = cachedSin * y + cachedCos * x;
out->y = cachedCos * y - cachedSin * x;
}
#endif
#if 0
WRAPPER void CRadar::DrawRadarSprite(int sprite, float x, float y, int alpha) { EAXJMP(0x4A5EF0); }
#else
void CRadar::DrawRadarSprite(int sprite, float x, float y, int alpha)
{
float w = SCREEN_SCALE_X(8.0f);
@ -356,7 +365,11 @@ void CRadar::DrawRadarSprite(int sprite, float x, float y, int alpha)
RadarSprites[sprite]->Draw(CRect(x - w, y - h, x + w, y + h), CRGBA(255, 255, 255, alpha));
}
#endif
#if 0
WRAPPER void CRadar::ShowRadarMarker(CVector pos, CRGBA color, float radius) { EAXJMP(0x4A59C0); }
#else
void CRadar::ShowRadarMarker(CVector pos, CRGBA color, float radius) {
float z2 = pos.z + (0.5f * color.color32) * TheCamera.m_matrix.m_matrix.at.z;
float y2 = (0.5f * color.color32) * TheCamera.m_matrix.m_matrix.at.y + pos.y;
@ -390,7 +403,11 @@ void CRadar::ShowRadarMarker(CVector pos, CRGBA color, float radius) {
x1 = pos.x - (1.4f * color.color32) * TheCamera.m_matrix.m_matrix.right.x;
CTheScripts::ScriptDebugLine3D(x1, y1, z1, x2, y2, z2, color.color32, color.color32);
}
#endif
#if 0
WRAPPER void CRadar::DrawRotatingRadarSprite(CSprite2d* sprite, float x, float y, float angle, int alpha) { EAXJMP(0x4A5D10); }
#else
void CRadar::DrawRotatingRadarSprite(CSprite2d* sprite, float x, float y, float angle, int alpha)
{
CVector curPosn[4];
@ -417,6 +434,7 @@ void CRadar::DrawRotatingRadarSprite(CSprite2d* sprite, float x, float y, float
sprite->Draw(curPosn[2].x, curPosn[2].y, curPosn[3].x, curPosn[3].y, curPosn[0].x, curPosn[0].y, curPosn[1].x, curPosn[1].y, CRGBA(255, 255, 255, alpha));
}
#endif
STARTPATCHES
InjectHook(0x4A5040, CRadar::TransformRadarPointToScreenSpace, PATCH_JUMP);

View File

@ -16,8 +16,6 @@ int32 &gNumRetunePresses = *(int32*)0x650B80;
wchar *pCurrentStation = (wchar*)0x650B9C;
uint8 &cDisplay = *(uint8*)0x650BA1;
//WRAPPER void cMusicManager::DisplayRadioStationName(void) { EAXJMP(0x57E6D0); }
bool cMusicManager::PlayerInCar()
{
if (!FindPlayerVehicle())
@ -44,6 +42,9 @@ bool cMusicManager::PlayerInCar()
}
}
#if 0
WRAPPER void cMusicManager::DisplayRadioStationName(void) { EAXJMP(0x57E6D0); }
#else
void cMusicManager::DisplayRadioStationName()
{
int8 pRetune;
@ -170,3 +171,4 @@ void cMusicManager::DisplayRadioStationName()
CFont::DrawFonts();
}
}
#endif

View File

@ -8,5 +8,5 @@ bool CDarkel::Status = *(bool*)0x95CCB4;
bool CDarkel::FrenzyOnGoing()
{
return Status;
return Status == 1;
}

View File

@ -8,8 +8,6 @@
#include "Messages.h"
#include "Text.h"
//WRAPPER void CGarages::PrintMessages(void) { EAXJMP(0x426310); }
int32 &CGarages::BankVansCollected = *(int32 *)0x8F1B34;
bool &CGarages::BombsAreFree = *(bool *)0x95CD7A;
bool &CGarages::RespraysAreFree = *(bool *)0x95CD1D;
@ -65,6 +63,9 @@ CGarages::IsModelIndexADoor(uint32 id)
id == MI_CRUSHERLID;
}
#if 0
WRAPPER void CGarages::PrintMessages(void) { EAXJMP(0x426310); }
#else
void CGarages::PrintMessages()
{
if (CTimer::GetTimeInMilliseconds() > CGarages::MessageStartTime && CTimer::GetTimeInMilliseconds() < CGarages::MessageEndTime) {
@ -105,3 +106,4 @@ void CGarages::PrintMessages()
}
}
}
#endif

View File

@ -20,9 +20,6 @@
#include "User.h"
#include "World.h"
//WRAPPER void CHud::Draw(void) { EAXJMP(0x5052A0); }
//WRAPPER void CHud::DrawAfterFade(void) { EAXJMP(0x509030); }
//WRAPPER void CHud::ReInitialise(void) { EAXJMP(0x504CC0); }
WRAPPER void CHud::GetRidOfAllHudMessages(void) { EAXJMP(0x504F90); }
WRAPPER void CHud::SetHelpMessage(wchar *message, bool quick) { EAXJMP(0x5051E0); }
WRAPPER void CHud::SetMessage(wchar *message) { EAXJMP(0x50A210); }
@ -178,6 +175,9 @@ void CHud::SetZoneName(wchar *name)
m_ZoneName = name;
}
#if 0
WRAPPER void CHud::Draw(void) { EAXJMP(0x5052A0); }
#else
void CHud::Draw()
{
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)TRUE);
@ -973,7 +973,7 @@ void CHud::Draw()
*/
// MissionCompleteFailedText
if (CHud::m_BigMessage[0][0]) {
if (BigMessageInUse[0] == 0.0f) {
if (BigMessageInUse[0] != 0.0f) {
CFont::SetJustifyOff();
CFont::SetBackgroundOff();
CFont::SetBackGroundOnlyTextOff();
@ -981,15 +981,19 @@ void CHud::Draw()
CFont::SetPropOn();
CFont::SetCentreOn();
CFont::SetCentreSize(SCREEN_SCALE_X(615.0f));
CFont::SetColor(CRGBA(255, 255, 0, 255));
CFont::SetFontStyle(FONT_HEADING);
if (BigMessageX[0] >= (SCREENW - 20)) {
BigMessageInUse[0] += (CTimer::GetTimeStep() * 0.02f * 120.0f);
if (BigMessageInUse[0] >= 120.0f) {
BigMessageInUse[0] = 120.0;
BigMessageAlpha[0] += (CTimer::GetTimeStep() * 0.02f * -255.0f);
}
if (BigMessageAlpha[0] <= 0.0f) {
BigMessageAlpha[0] = 0.0f;
BigMessageInUse[0] = 1.0f;
m_BigMessage[0][0] = 0;
BigMessageAlpha[0] = 0.0;
}
}
else {
@ -1017,9 +1021,9 @@ void CHud::Draw()
}
// WastedBustedText
if (CHud::m_BigMessage[2][0]) {
if (BigMessageInUse[2] == 0.0f) {
BigMessageAlpha[2] += (CTimer::GetTimeStep() * 0.02f * 1000.0f) * 0.4f;
if (m_BigMessage[2][0]) {
if (BigMessageInUse[2] != 0.0f) {
BigMessageAlpha[2] += (CTimer::GetTimeStep() * 0.02f * 255.0f);
if (BigMessageAlpha[2] > 255.0f)
BigMessageAlpha[2] = 255.0;
@ -1034,12 +1038,12 @@ void CHud::Draw()
CFont::SetPropOn();
CFont::SetRightJustifyOn();
CFont::SetFontStyle(FONT_HEADING);
CFont::SetColor(CRGBA(0, 0, 0, 0.75f * BigMessageAlpha[2]));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f + 4.0f), SCREEN_SCALE_FROM_BOTTOM(78.0f), CHud::m_BigMessage[2]);
CFont::SetColor(CRGBA(0, 0, 0, BigMessageAlpha[2]));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f + 4.0f), SCREEN_SCALE_FROM_BOTTOM(78.0f), m_BigMessage[2]);
CFont::SetColor(CRGBA(170, 123, 87, BigMessageAlpha[2]));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_FROM_BOTTOM(82.0f), CHud::m_BigMessage[2]);
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_FROM_BOTTOM(82.0f), m_BigMessage[2]);
}
else {
BigMessageAlpha[2] = 0.0;
@ -1052,7 +1056,11 @@ void CHud::Draw()
}
}
}
#endif
#if 0
WRAPPER void CHud::DrawAfterFade(void) { EAXJMP(0x509030); }
#else
void CHud::DrawAfterFade()
{
if (CTimer::GetIsUserPaused() || CReplay::Mode == 1)
@ -1136,14 +1144,12 @@ void CHud::DrawAfterFade()
else
CFont::SetScale(SCREEN_SCALE_X(0.52f), SCREEN_SCALE_Y(1.1f));
CFont::SetColor(CRGBA(175, 175, 175, 255));
CFont::SetJustifyOff();
CFont::SetWrapx(SCREEN_SCALE_X(200.0f + 26.0f - 4.0f));
CFont::SetFontStyle(FONT_BANK);
CFont::SetBackgroundOn();
CFont::SetBackGroundOnlyTextOff();
CRGBA BackColor = { 0, 0, 0, (uint8)(0.9f * fAlpha) };
CFont::SetBackgroundColor(BackColor);
CFont::SetBackgroundColor(CRGBA(0, 0, 0, fAlpha));
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::SetAlphaFade(255.0f);
@ -1224,8 +1230,9 @@ void CHud::DrawAfterFade()
CFont::SetCentreOn();
CFont::SetPropOn();
CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(20.0f));
CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::SetFontStyle(FONT_BANK);
CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::PrintString(SCREEN_SCALE_X(2.0f) + (SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(20.0f + 2.0f), m_BigMessage[5]);
CFont::SetColor(CRGBA(156, 91, 40, 255));
@ -1236,7 +1243,7 @@ void CHud::DrawAfterFade()
DrawMissionTitle
*/
if (m_BigMessage[1][0]) {
if (BigMessageInUse[1] == 0.0f) {
if (BigMessageInUse[1] != 0.0f) {
CFont::SetJustifyOff();
CFont::SetBackgroundOff();
@ -1250,11 +1257,15 @@ void CHud::DrawAfterFade()
CFont::SetRightJustifyOn();
CFont::SetFontStyle(FONT_HEADING);
if (BigMessageX[1] >= (SCREENW - 20)) {
BigMessageAlpha[1] += (CTimer::GetTimeStep() * 0.02f * -255.0f);
BigMessageInUse[1] += (CTimer::GetTimeStep() * 0.02f * 120.0f);
if (BigMessageAlpha[1] <= 0.0f) {
BigMessageAlpha[1] = 0.0f;
BigMessageInUse[1] = 1.0f;
if (BigMessageInUse[1] >= 120.0f) {
BigMessageInUse[1] = 120.0;
BigMessageAlpha[1] += (CTimer::GetTimeStep() * 0.02f * -255.0f);
}
if (BigMessageAlpha[1] <= 0) {
m_BigMessage[1][0] = 0;
BigMessageAlpha[1] = 0.0;
}
}
else {
@ -1264,6 +1275,7 @@ void CHud::DrawAfterFade()
if (BigMessageAlpha[1] >= 255.0f)
BigMessageAlpha[1] = 255.0f;
}
CFont::SetColor(CRGBA(40, 40, 40, BigMessageAlpha[1]));
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f - 2.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f), m_BigMessage[1]);
@ -1271,16 +1283,20 @@ void CHud::DrawAfterFade()
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(20.0f), SCREEN_SCALE_FROM_BOTTOM(120.0f), m_BigMessage[1]);
}
else {
BigMessageAlpha[1] = 0.0f;
BigMessageX[1] = -60.0f;
BigMessageInUse[1] = 1.0f;
BigMessageAlpha[1] = 0.0;
BigMessageX[1] = -60.0;
BigMessageInUse[1] = 1.0;
}
}
else {
BigMessageInUse[1] = 0.0f;
BigMessageInUse[1] = 0.0;
}
}
#endif
#if 1
WRAPPER void CHud::ReInitialise(void) { EAXJMP(0x504CC0); }
#else
void CHud::ReInitialise() {
m_Wants_To_Draw_Hud = true;
m_ZoneState = 0;
@ -1329,6 +1345,7 @@ void CHud::ReInitialise() {
PagerXOffset = 150.0f;
OddJob2XOffset = 0.0f;
}
#endif
STARTPATCHES
InjectHook(0x48BC9A, &CHud::Initialise, PATCH_CALL);