summaryrefslogtreecommitdiffstats
path: root/src/render
diff options
context:
space:
mode:
authorFire_Head <Fire-Head@users.noreply.github.com>2019-06-17 12:37:59 +0200
committerGitHub <noreply@github.com>2019-06-17 12:37:59 +0200
commit0bb8bf9d1505792a0fd4f9872fd57fca8f197d13 (patch)
treecc2c85e0ccf486546de22074639d0e8fbe032f65 /src/render
parentMerge pull request #7 from GTAmodding/master (diff)
parentMerge pull request #20 from gennariarmando/master (diff)
downloadre3-0bb8bf9d1505792a0fd4f9872fd57fca8f197d13.tar
re3-0bb8bf9d1505792a0fd4f9872fd57fca8f197d13.tar.gz
re3-0bb8bf9d1505792a0fd4f9872fd57fca8f197d13.tar.bz2
re3-0bb8bf9d1505792a0fd4f9872fd57fca8f197d13.tar.lz
re3-0bb8bf9d1505792a0fd4f9872fd57fca8f197d13.tar.xz
re3-0bb8bf9d1505792a0fd4f9872fd57fca8f197d13.tar.zst
re3-0bb8bf9d1505792a0fd4f9872fd57fca8f197d13.zip
Diffstat (limited to 'src/render')
-rw-r--r--src/render/Draw.cpp18
-rw-r--r--src/render/Draw.h7
-rw-r--r--src/render/Hud.cpp1280
-rw-r--r--src/render/Hud.h89
-rw-r--r--src/render/Particle.cpp206
-rw-r--r--src/render/Particle.h54
-rw-r--r--src/render/ParticleMgr.cpp20
-rw-r--r--src/render/ParticleMgr.h64
-rw-r--r--src/render/VisibilityPlugins.cpp8
-rw-r--r--src/render/VisibilityPlugins.h1
10 files changed, 1571 insertions, 176 deletions
diff --git a/src/render/Draw.cpp b/src/render/Draw.cpp
index 7c5a48ad..b411176f 100644
--- a/src/render/Draw.cpp
+++ b/src/render/Draw.cpp
@@ -1,6 +1,10 @@
#include "common.h"
#include "patcher.h"
#include "Draw.h"
+#include "Frontend.h"
+#include "Camera.h"
+
+float CDraw::ms_fAspectRatio;
float &CDraw::ms_fNearClipZ = *(float*)0x8E2DC4;
float &CDraw::ms_fFarClipZ = *(float*)0x9434F0;
@@ -11,6 +15,17 @@ uint8 &CDraw::FadeRed = *(uint8*)0x95CD90;
uint8 &CDraw::FadeGreen = *(uint8*)0x95CD71;
uint8 &CDraw::FadeBlue = *(uint8*)0x95CD53;
+void
+CDraw::CalculateAspectRatio()
+{
+ if(FrontEndMenuManager.m_PrefsUseWideScreen)
+ ms_fAspectRatio = 16.0f/9.0f;
+ else if(TheCamera.m_WideScreenOn)
+ ms_fAspectRatio = 1.25f;
+ else
+ ms_fAspectRatio = 4.0f/3.0f;
+}
+
static float hFov2vFov(float hfov)
{
float w = SCREENW;
@@ -36,4 +51,7 @@ CDraw::SetFOV(float fov)
STARTPATCHES
InjectHook(0x4FE7B0, CDraw::SetFOV, PATCH_JUMP);
+
+ Nop(0x46B618, 2);
+ Patch<float>(0x5F0A64, 1.3333334f);
ENDPATCHES
diff --git a/src/render/Draw.h b/src/render/Draw.h
index 408c41b0..6dd42121 100644
--- a/src/render/Draw.h
+++ b/src/render/Draw.h
@@ -6,6 +6,8 @@ private:
static float &ms_fNearClipZ;
static float &ms_fFarClipZ;
static float &ms_fFOV;
+ static float ms_fAspectRatio;
+
public:
static uint8 &FadeValue;
static uint8 &FadeRed;
@@ -16,6 +18,11 @@ public:
static float GetNearClipZ(void) { return ms_fNearClipZ; }
static void SetFarClipZ(float farclip) { ms_fFarClipZ = farclip; }
static float GetFarClipZ(void) { return ms_fFarClipZ; }
+
static void SetFOV(float fov);
static float GetFOV(void) { return ms_fFOV; }
+
+ static void CalculateAspectRatio();
+ static float GetAspectRatio(void) { return ms_fAspectRatio; }
+
};
diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp
index 0de5f5b0..bd8cee51 100644
--- a/src/render/Hud.cpp
+++ b/src/render/Hud.cpp
@@ -1,8 +1,1284 @@
#include "common.h"
#include "patcher.h"
+#include "Camera.h"
+#include "DMAudio.h"
+#include "Clock.h"
+#include "Darkel.h"
#include "Hud.h"
+#include "Messages.h"
+#include "Frontend.h"
+#include "Font.h"
+#include "Pad.h"
+#include "Radar.h"
+#include "Replay.h"
+#include "Sprite.h"
+#include "Sprite2d.h"
+#include "Text.h"
+#include "Timer.h"
+#include "Script.h"
+#include "TxdStore.h"
+#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); }
+WRAPPER void CHud::SetBigMessage(wchar *message, int16 style) { EAXJMP(0x50A250); }
+WRAPPER void CHud::SetPagerMessage(wchar *message) { EAXJMP(0x50A320); }
+
+wchar *CHud::m_HelpMessage = (wchar*)0x86B888;
+wchar *CHud::m_LastHelpMessage = (wchar*)0x6E8F28;
+int32 &CHud::m_HelpMessageState = *(int32*)0x880E1C;
+int32 &CHud::m_HelpMessageTimer = *(int32*)0x880FA4;
+int32 &CHud::m_HelpMessageFadeTimer = *(int32*)0x8F6258;
+wchar *CHud::m_HelpMessageToPrint = (wchar*)0x664480;
+float &CHud::m_HelpMessageDisplayTime = *(float*)0x8E2C28;
+float &CHud::m_fTextBoxNumLines = *(float*)0x8E2C28;
+float &CHud::m_fHelpMessageTime = *(float *)0x8E2C28;
+bool &CHud::m_bHelpMessageQuick = *(bool *)0x95CCF7;
+int32 CHud::m_ZoneState = *(int32*)0x8F29AC;
+int32 CHud::m_ZoneFadeTimer;
+int32 CHud::m_ZoneNameTimer = *(int32*)0x8F1A50;
+wchar *&CHud::m_pZoneName = *(wchar **)0x8E2C2C;
+wchar *CHud::m_pLastZoneName = (wchar*)0x8F432C;
+wchar *CHud::m_ZoneToPrint;
+int32 CHud::m_VehicleState = *(int32*)0x940560;
+int32 CHud::m_VehicleFadeTimer;
+int32 CHud::m_VehicleNameTimer = *(int32*)0x8F2A14;
+wchar *&CHud::m_pVehicleName = *(wchar **)0x942FB4;
+wchar *CHud::m_pLastVehicleName = *(wchar **)0x8E2DD8;
+wchar *CHud::m_pVehicleNameToPrint;
+wchar *CHud::m_Message = (wchar*)0x72E318;
+wchar *CHud::m_PagerMessage = (wchar*)0x878840;
bool &CHud::m_Wants_To_Draw_Hud = *(bool*)0x95CD89;
+bool &CHud::m_Wants_To_Draw_3dMarkers = *(bool*)0x95CD62;
+wchar(*CHud::m_BigMessage)[128] = (wchar(*)[128])0x664CE0;
+float *CHud::BigMessageInUse = (float*)0x862140;
+float *CHud::BigMessageAlpha = (float*)0x862108;
+float *CHud::BigMessageX = (float*)0x773248;
+
+float &CHud::OddJob2OffTimer = *(float*)0x942FA0;
+int8 &CHud::CounterOnLastFrame = *(int8*)0x95CD67;
+float &CHud::OddJob2XOffset = *(float*)0x8F1B5C;
+int16 &CHud::CounterFlashTimer = *(int16*)0x95CC20;
+int16 &CHud::OddJob2Timer = *(int16*)0x95CC52;
+int8 &CHud::TimerOnLastFrame = *(int8*)0x95CDA7;
+int16 &CHud::OddJob2On = *(int16*)0x95CC78;
+int16 &CHud::TimerFlashTimer = *(int16*)0x95CC6C;
+int16 &CHud::PagerSoundPlayed = *(int16*)0x95CC4A;
+int32 &CHud::SpriteBrightness = *(int32*)0x95CC54;
+float &CHud::PagerXOffset = *(float*)0x941590;
+int32 CHud::m_ItemToFlash = *(int32*)0x95CC82;
+int16 &CHud::PagerTimer = *(int16*)0x95CC3A;
+int16 &CHud::PagerOn = *(int16*)0x95CCA0;
+
+CSprite2d *CHud::Sprites = (CSprite2d*)0x95CB9C;
+char *WeaponFilenames[] = {
+ "fist",
+ "fistm",
+ "bat",
+ "batm",
+ "pistol",
+ "pistolm",
+ "uzi",
+ "uzim",
+ "shotgun",
+ "shotgunm",
+ "ak47",
+ "ak47m",
+ "m16",
+ "m16m",
+ "sniper",
+ "sniperm",
+ "rocket",
+ "rocketm",
+ "flame",
+ "flamem",
+ "molotov",
+ "molotovm",
+ "grenade",
+ "grenadem",
+ "detonator",
+ "detonator_mask",
+ "",
+ "",
+ "",
+ "",
+ "radardisc",
+ "radardiscm",
+ "pager",
+ "pagerm",
+ "",
+ "",
+ "",
+ "",
+ "bleeder",
+ "",
+ "sitesniper",
+ "sitesniperm",
+ "siteM16",
+ "siteM16m",
+ "siterocket",
+ "siterocketm"
+};
+
+RwTexture *&gpSniperSightTex = *(RwTexture**)0x8F5834;
+RwTexture *&gpRocketSightTex = *(RwTexture**)0x8E2C20;
+
+void CHud::Initialise()
+{
+ ReInitialise();
+
+ int HudTXD = CTxdStore::AddTxdSlot("hud");
+ CTxdStore::LoadTxd(HudTXD, "MODELS/HUD.TXD");
+ CTxdStore::AddRef(HudTXD);
+ CTxdStore::PopCurrentTxd();
+ CTxdStore::SetCurrentTxd(HudTXD);
+
+ for (int i = 0; i < ARRAY_SIZE(WeaponFilenames) / 2; i++) {
+ Sprites[i].SetTexture(WeaponFilenames[i * 2]);
+ }
+
+ gpSniperSightTex = RwTextureRead("sitesniper", 0);
+ gpRocketSightTex = RwTextureRead("siterocket", 0);
+
+ CTxdStore::PopCurrentTxd();
+}
+
+void CHud::Shutdown()
+{
+ for (int i = 0; i < ARRAY_SIZE(WeaponFilenames) / 2; ++i) {
+ Sprites[i].Delete();
+ }
+
+ RwTextureDestroy(gpSniperSightTex);
+ gpSniperSightTex = 0;
+
+ RwTextureDestroy(gpRocketSightTex);
+ gpRocketSightTex = 0;
+
+ int HudTXD = CTxdStore::FindTxdSlot("hud");
+ CTxdStore::RemoveTxdSlot(HudTXD);
+}
+
+void CHud::SetVehicleName(wchar *name)
+{
+ m_pVehicleName = name;
+}
+
+void CHud::SetZoneName(wchar *name)
+{
+ m_pZoneName = name;
+}
+
+void CHud::Draw()
+{
+ RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)TRUE);
+ RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
+ RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
+ RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
+ RwRenderStateSet(rwRENDERSTATETEXTUREADDRESS, (void*)rwTEXTUREADDRESSMIRROR);
+ RwRenderStateSet(rwRENDERSTATETEXTURERASTER, (void*)FALSE);
+ RwRenderStateSet(rwRENDERSTATESHADEMODE, (void*)rwSHADEMODEFLAT);
+ RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
+
+ if (CReplay::Mode != 1) {
+ if (m_Wants_To_Draw_Hud && !TheCamera.m_WideScreenOn) {
+ bool Mode_RunAround = 0;
+ bool Mode_FirstPerson = 0;
+
+ int32 WeaponType = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_eWeaponType;
+ int32 Mode = TheCamera.Cams[TheCamera.ActiveCam].Mode;
+
+ if (Mode == CCam::CamMode::MODE_SNIPER || Mode == CCam::CamMode::MODE_ROCKET || Mode == CCam::CamMode::MODE_M16FIRSTPERSON_34 || Mode == CCam::CamMode::MODE_EDITOR)
+ Mode_FirstPerson = 1;
+ if (Mode == CCam::CamMode::MODE_FIRSTPERSONPEDONPC_41 || Mode == CCam::CamMode::MODE_SNIPER_RUN_AROUND)
+ Mode_RunAround = 1;
+
+ /*
+ Draw Crosshairs
+ */
+ if (TheCamera.Cams->Using3rdPersonMouseCam() && (!CPad::GetPad(0)->GetLookBehindForPed() || TheCamera.m_bPlayerIsInGarage) || Mode == 40) {
+ if (CWorld::Players[CWorld::PlayerInFocus].m_pPed) {
+ int32 State = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_nPedState;
+ if (State != PED_ENTER_CAR && State != PED_CARJACK) {
+ if ((WeaponType >= WEAPONTYPE_COLT45 && WeaponType <= WEAPONTYPE_M16) || WeaponType == WEAPONTYPE_FLAMETHROWER)
+ Mode_RunAround = 1;
+ }
+ }
+ }
+
+ if (Mode_FirstPerson || Mode_RunAround) {
+ RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void *)rwFILTERLINEAR);
+
+ int32 SpriteBrightLikeADiamond = CHud::SpriteBrightness + 1;
+ if (SpriteBrightLikeADiamond > 30)
+ SpriteBrightLikeADiamond = 30;
+
+ CHud::SpriteBrightness = SpriteBrightLikeADiamond;
+
+ RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
+
+ float fStep = sin((CTimer::GetTimeInMilliseconds() & 1023) * 0.0061328127);
+ float fMultBright = CHud::SpriteBrightness * 0.03f * (0.25f * fStep + 0.75f);
+ CRect rect;
+
+ float fWidescreenOffset[2] = { 0.0f, 0.0f };
+
+ if (CMenuManager::m_PrefsUseWideScreen) {
+ fWidescreenOffset[0] = 0.0f;
+ fWidescreenOffset[1] = HUD_STRETCH_Y(18.0f);
+ }
+
+ if (Mode_RunAround && TheCamera.Cams->Using3rdPersonMouseCam()) {
+ float f3rdX = SCREENW * TheCamera.m_f3rdPersonCHairMultX + fWidescreenOffset[0];
+ float f3rdY = SCREENH * TheCamera.m_f3rdPersonCHairMultY - fWidescreenOffset[1];
+
+ if (CWorld::Players[CWorld::PlayerInFocus].m_pPed && WeaponType == WEAPONTYPE_M16) {
+ rect.left = f3rdX - HUD_STRETCH_X(32.0f * 0.6f);
+ rect.top = f3rdY - HUD_STRETCH_Y(32.0f * 0.6f);
+ rect.right = f3rdX + HUD_STRETCH_X(32.0f * 0.6f);
+ rect.bottom = f3rdY + HUD_STRETCH_Y(32.0f * 0.6f);
+
+ CHud::Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255));
+ }
+ else {
+ rect.left = f3rdX - HUD_STRETCH_X(32.0f * 0.4f);
+ rect.top = f3rdY - HUD_STRETCH_Y(32.0f * 0.4f);
+ rect.right = f3rdX + HUD_STRETCH_X(32.0f * 0.4f);
+ rect.bottom = f3rdY + HUD_STRETCH_Y(32.0f * 0.4f);
+
+ CHud::Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255));
+ }
+ }
+ else {
+ if (Mode != CCam::CamMode::MODE_M16FIRSTPERSON_34 && Mode != CCam::CamMode::MODE_FIRSTPERSONPEDONPC_41 && Mode != CCam::CamMode::MODE_EDITOR) {
+ if (Mode == CCam::CamMode::MODE_ROCKET_RUN_AROUND) {
+ rect.left = (SCREEN_WIDTH / 2) - HUD_STRETCH_X(32.0f * 0.7f);
+ rect.top = (SCREEN_HEIGHT / 2) - HUD_STRETCH_Y(32.0f * 0.7f);
+ rect.right = (SCREEN_WIDTH / 2) + HUD_STRETCH_X(32.0f * 0.7f);
+ rect.bottom = (SCREEN_HEIGHT / 2) + HUD_STRETCH_Y(32.0f * 0.7f);
+
+ CHud::Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255));
+ }
+ else if (Mode != CCam::CamMode::MODE_ROCKET && Mode != CCam::CamMode::MODE_SNIPER_RUN_AROUND) {
+ rect.left = (SCREEN_WIDTH / 2) - HUD_STRETCH_X(210.0f);
+ rect.top = (SCREEN_HEIGHT / 2) - HUD_STRETCH_Y(210.0f);
+ rect.right = SCREEN_WIDTH / 2;
+ rect.bottom = SCREEN_HEIGHT / 2;
+ CHud::Sprites[HUD_SITESNIPER].Draw(CRect(rect), CRGBA(255, 255, 255, 255));
+
+ rect.right = (SCREEN_WIDTH / 2);
+ rect.top = (SCREEN_HEIGHT / 2) - HUD_STRETCH_Y(210.0f);
+ rect.left = HUD_STRETCH_X(210.0f) + (SCREEN_WIDTH / 2);
+ rect.bottom = SCREEN_HEIGHT / 2;
+ CHud::Sprites[HUD_SITESNIPER].Draw(CRect(rect), CRGBA(255, 255, 255, 255));
+
+ rect.left = (SCREEN_WIDTH / 2) - HUD_STRETCH_X(210.0f);
+ rect.bottom = (SCREEN_HEIGHT / 2);
+ rect.right = (SCREEN_WIDTH / 2);
+ rect.top = HUD_STRETCH_Y(210.0f) + (SCREEN_HEIGHT / 2);
+ CHud::Sprites[HUD_SITESNIPER].Draw(CRect(rect), CRGBA(255, 255, 255, 255));
+
+ rect.right = (SCREEN_WIDTH / 2);
+ rect.bottom = (SCREEN_HEIGHT / 2);
+ rect.left = HUD_STRETCH_X(210.0f) + (SCREEN_WIDTH / 2);
+ rect.top = HUD_STRETCH_Y(210.0f) + (SCREEN_HEIGHT / 2);
+ CHud::Sprites[HUD_SITESNIPER].Draw(CRect(rect), CRGBA(255, 255, 255, 255));
+ }
+ else {
+ RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void *)TRUE);
+ RwRenderStateSet(rwRENDERSTATESRCBLEND, (void *)rwBLENDONE);
+ RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void *)rwBLENDONE);
+ RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
+ RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE);
+ RwRenderStateSet(rwRENDERSTATETEXTURERASTER, gpRocketSightTex->raster);
+
+ CSprite::RenderOneXLUSprite(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, 1.0f, HUD_STRETCH_X(40.0f), HUD_STRETCH_Y(40.0f), (100.0f * fMultBright), (200.0f * fMultBright), (100.0f * fMultBright), 255, 1.0f, 255);
+ }
+ }
+ else {
+ rect.left = (SCREEN_WIDTH / 2) - HUD_STRETCH_X(32.0f);
+ rect.top = (SCREEN_HEIGHT / 2) - HUD_STRETCH_Y(32.0f);
+ rect.right = (SCREEN_WIDTH / 2) + HUD_STRETCH_X(32.0f);
+ rect.bottom = (SCREEN_HEIGHT / 2) + HUD_STRETCH_Y(32.0f);
+ CHud::Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255));
+ }
+ }
+ RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void *)rwFILTERLINEAR);
+ RwRenderStateSet(rwRENDERSTATESRCBLEND, (void *)rwBLENDSRCALPHA);
+ RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void *)rwBLENDINVSRCALPHA);
+ }
+ else {
+ CHud::SpriteBrightness = 0;
+ }
+
+ /*
+ DrawMoneyCounter
+ */
+ wchar sPrint[16];
+ wchar sPrintIcon[16];
+ char sTemp[16];
+
+ sprintf(sTemp, "$%08d", CWorld::Players[CWorld::PlayerInFocus].m_nVisibleMoney);
+ AsciiToUnicode(sTemp, sPrint);
+
+ CFont::SetPropOff();
+ CFont::SetBackgroundOff();
+ CFont::SetScale(HUD_STRETCH_X(0.8f), HUD_STRETCH_Y(1.35f));
+ CFont::SetCentreOff();
+ CFont::SetRightJustifyOn();
+ CFont::SetRightJustifyWrap(0.0f);
+ CFont::SetBackGroundOnlyTextOff();
+ CFont::SetFontStyle(FONT_HEADING);
+ CFont::SetPropOff();
+ CFont::SetColor(CRGBA(0, 0, 0, 255));
+
+ CFont::PrintString(HUD_FROM_RIGHT(110.0f - 2.0f), HUD_STRETCH_Y(43.0f + 2.0f), sPrint);
+
+ CFont::SetColor(CRGBA(89, 115, 150, 255));
+ CFont::PrintString(HUD_FROM_RIGHT(110.0f), HUD_STRETCH_Y(43.0f), sPrint);
+
+ /*
+ DrawClock
+ */
+ sprintf(sTemp, "%02d:%02d", CClock::GetHours(), CClock::GetMinutes());
+ AsciiToUnicode(sTemp, sPrint);
+
+ CFont::SetColor(CRGBA(0, 0, 0, 255));
+
+ CFont::PrintString(HUD_FROM_RIGHT(111.0f - 2.0f), HUD_STRETCH_Y(22.0f + 2.0f), sPrint);
+
+ CFont::SetColor(CRGBA(194, 165, 120, 255));
+ CFont::PrintString(HUD_FROM_RIGHT(111.0f), HUD_STRETCH_Y(22.0f), sPrint);
+
+ /*
+ DrawAmmo
+ */
+ int32 AmmoInClip = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_nAmmoInClip;
+ int32 TotalAmmo = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_nAmmoTotal;
+
+ if (AmmoInClip <= 1 || AmmoInClip >= 1000) {
+ sprintf(sTemp, "%d", TotalAmmo);
+ }
+ else {
+ if (WeaponType == WEAPONTYPE_FLAMETHROWER) {
+ int tot_min_clip_div_10 = (TotalAmmo - AmmoInClip) / 10;
+ if (tot_min_clip_div_10 > 9999)
+ tot_min_clip_div_10 = 9999;
+
+ sprintf(sTemp, "%d-%d", tot_min_clip_div_10, AmmoInClip / 10);
+ }
+ else {
+ if (AmmoInClip > 9999)
+ AmmoInClip = 9999;
+ sprintf(sTemp, "%d-%d", (TotalAmmo - AmmoInClip), AmmoInClip);
+ }
+ }
+
+ AsciiToUnicode(sTemp, sPrint);
+
+ CFont::SetBackgroundOff();
+ CFont::SetScale(HUD_STRETCH_X(0.4f), HUD_STRETCH_Y(0.6f));
+ CFont::SetJustifyOff();
+ CFont::SetCentreOn();
+ CFont::SetCentreSize(HUD_STRETCH_X(640.0f));
+ CFont::SetPropOn();
+ CFont::SetFontStyle(FONT_BANK);
+
+ if (!CDarkel::FrenzyOnGoing()) {
+ if (WeaponType) {
+ if (WeaponType != 1) {
+ CFont::SetColor(CRGBA(0, 0, 0, 255));
+ CFont::PrintString(HUD_FROM_RIGHT(66.0f), HUD_STRETCH_Y(73.0f), sPrint);
+ }
+ }
+ }
+
+ /*
+ DrawWeaponIcon
+ */
+ CHud::Sprites[WeaponType].Draw(
+ CRect(HUD_FROM_RIGHT(99.0f), HUD_STRETCH_Y(27.0f), HUD_FROM_RIGHT(35.0f), HUD_STRETCH_Y(91.0f)),
+ CRGBA(255, 255, 255, 255),
+ 0.015f,
+ 0.015f,
+ 1.0f,
+ 0.0f,
+ 0.015f,
+ 1.0f,
+ 1.0f,
+ 1.0f);
+
+ /*
+ DrawHealth
+ */
+ CFont::SetBackgroundOff();
+ CFont::SetScale(HUD_STRETCH_X(0.8f), HUD_STRETCH_Y(1.35f));
+ CFont::SetJustifyOff();
+ CFont::SetCentreOff();
+ CFont::SetRightJustifyWrap(0.0f);
+ CFont::SetRightJustifyOn();
+ CFont::SetPropOff();
+ CFont::SetFontStyle(FONT_HEADING);
+
+ if (CHud::m_ItemToFlash == ITEM_HEALTH && CTimer::GetFrameCounter() & 8
+ || CHud::m_ItemToFlash != ITEM_HEALTH
+ || CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_fHealth < 10
+ && CTimer::GetFrameCounter() & 8) {
+ if (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_fHealth >= 10
+ || CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_fHealth < 10 && CTimer::GetFrameCounter() & 8) {
+
+ AsciiToUnicode("[", sPrintIcon);
+ sprintf(sTemp, "%03d", (int32)CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_fHealth);
+ AsciiToUnicode(sTemp, sPrint);
+
+ CFont::SetColor(CRGBA(0, 0, 0, 255));
+ CFont::PrintString(HUD_FROM_RIGHT(110.0f - 2.0f), HUD_STRETCH_Y(65.0f + 2.0f), sPrint);
+
+ if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss + 2000 || CTimer::GetFrameCounter() & 4) {
+ CFont::PrintString(HUD_FROM_RIGHT(164.0f - 2.0f), HUD_STRETCH_Y(65.0f + 2.0f), sPrintIcon);
+ }
+ CFont::SetColor(CRGBA(186, 101, 50, 255));
+
+ CFont::PrintString(HUD_FROM_RIGHT(110.0f), HUD_STRETCH_Y(65.0f), sPrint);
+
+ if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastHealthLoss + 2000 || CTimer::GetFrameCounter() & 4) {
+ CFont::PrintString(HUD_FROM_RIGHT(164.0f), HUD_STRETCH_Y(65.0f), sPrintIcon);
+ }
+ }
+ }
+
+ /*
+ DrawArmour
+ */
+ if (CHud::m_ItemToFlash == ITEM_ARMOUR && CTimer::GetFrameCounter() & 8 || CHud::m_ItemToFlash != ITEM_ARMOUR) {
+ CFont::SetScale(HUD_STRETCH_X(0.8f), HUD_STRETCH_Y(1.35f));
+ if (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_fArmour > 1.0f) {
+ AsciiToUnicode("[", sPrintIcon);
+ sprintf(sTemp, "%03d", (int32)CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_fArmour);
+ AsciiToUnicode(sTemp, sPrint);
+
+ CFont::SetColor(CRGBA(0, 0, 0, 255));
+ CFont::PrintString(HUD_FROM_RIGHT(182.0f - 2.0f), HUD_STRETCH_Y(65.0f + 2.0f), sPrint);
+
+ if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss + 2000 || CTimer::GetFrameCounter() & 4) {
+ CFont::PrintString(HUD_FROM_RIGHT(234.0f - 2.0f), HUD_STRETCH_Y(65.0f + 2.0f), sPrintIcon);
+ }
+
+ CFont::SetColor(CRGBA(124, 140, 95, 255));
+
+ CFont::PrintString(HUD_FROM_RIGHT(182.0f), HUD_STRETCH_Y(65.0f), sPrint);
+
+ if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss + 2000 || CTimer::GetFrameCounter() & 1) {
+ CFont::PrintString(HUD_FROM_RIGHT(234.0f), HUD_STRETCH_Y(65.0f), sPrintIcon);
+ }
+ }
+ }
+
+ /*
+ DrawWantedLevel
+ */
+ CFont::SetBackgroundOff();
+ CFont::SetScale(HUD_STRETCH_X(0.8f), HUD_STRETCH_Y(1.35f));
+ CFont::SetJustifyOff();
+ CFont::SetCentreOff();
+ CFont::SetRightJustifyOff();
+ CFont::SetPropOn();
+ CFont::SetFontStyle(FONT_HEADING);
+
+ AsciiToUnicode("]", sPrintIcon);
+
+ for (int i = 0; i < 6; i++) {
+ CFont::SetColor(CRGBA(0, 0, 0, 255));
+ CFont::PrintString(2.0f + HUD_FROM_RIGHT(60.0f - 2.0f + 23.0f * i), HUD_STRETCH_Y(87.0f + 2.0f), sPrintIcon);
+ if (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->m_nWantedLevel > i
+ && (CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->m_nLastWantedLevelChange
+ + 2000 || CTimer::GetFrameCounter() & 4)) {
+
+ CFont::SetColor(CRGBA(193, 164, 120, 255));
+ CFont::PrintString(HUD_FROM_RIGHT(60.0f + 23.0f * i), HUD_STRETCH_Y(87.0f), sPrintIcon);
+ }
+ }
+
+ /*
+ DrawZoneName
+ */
+ if (CHud::m_pZoneName) {
+ float fZoneAlpha = 0.0f;
+
+ if (CHud::m_pZoneName != CHud::m_pLastZoneName) {
+ switch (CHud::m_ZoneState) {
+ case 0:
+ CHud::m_ZoneState = 2;
+ CHud::m_ZoneToPrint = CHud::m_pZoneName;
+ CHud::m_ZoneNameTimer = 0;
+ CHud::m_ZoneFadeTimer = 0;
+ break;
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ CHud::m_ZoneNameTimer = 0;
+ CHud::m_ZoneState = 4;
+ break;
+ default:
+ break;
+ }
+ CHud::m_pLastZoneName = CHud::m_pZoneName;
+ }
+
+ if (CHud::m_ZoneState) {
+ switch (CHud::m_ZoneState) {
+ case 1:
+ if (CHud::m_ZoneNameTimer > 10000) {
+ CHud::m_ZoneFadeTimer = 1000;
+ CHud::m_ZoneState = 3;
+ }
+ fZoneAlpha = 255.0f;
+ break;
+ case 2:
+ CHud::m_ZoneFadeTimer += (CTimer::GetTimeStep() * 0.02f * 1000.0f);
+ if (CHud::m_ZoneFadeTimer > 1000) {
+ CHud::m_ZoneState = 1;
+ CHud::m_ZoneFadeTimer = 1000;
+ }
+ fZoneAlpha = CHud::m_ZoneFadeTimer * 0.001f * 255.0f;
+ break;
+ case 3:
+ CHud::m_ZoneFadeTimer += (CTimer::GetTimeStep() * 0.02f * -1000.0f);
+ if (CHud::m_ZoneFadeTimer < 0) {
+ CHud::m_ZoneState = 0;
+ CHud::m_ZoneFadeTimer = 0;
+ }
+ fZoneAlpha = CHud::m_ZoneFadeTimer * 0.001f * 255.0f;
+ break;
+ case 4:
+ CHud::m_ZoneFadeTimer += (CTimer::GetTimeStep() * 0.02f * -1000.0f);
+ if (CHud::m_ZoneFadeTimer < 0) {
+ CHud::m_ZoneFadeTimer = 0;
+ CHud::m_ZoneToPrint = CHud::m_pLastZoneName;
+ CHud::m_ZoneNameTimer = 0;
+ CHud::m_ZoneState = 2;
+ }
+ fZoneAlpha = CHud::m_ZoneFadeTimer * 0.001f * 255.0f;
+ break;
+ default:
+ break;
+
+ }
+ if (!CHud::m_Message[0]) {
+ CHud::m_ZoneNameTimer += (CTimer::GetTimeStep() * 0.02f * 1000.0f);
+ CFont::SetJustifyOff();
+ CFont::SetPropOn();
+ CFont::SetBackgroundOff();
+
+ if (CMenuManager::m_PrefsLanguage == 4)
+ CFont::SetScale(HUD_STRETCH_X(1.2f * 0.8f), HUD_STRETCH_Y(1.2f));
+ else
+ CFont::SetScale(HUD_STRETCH_X(1.2f), HUD_STRETCH_Y(1.2f));
+
+ CFont::SetRightJustifyOn();
+ CFont::SetRightJustifyWrap(0.0f);
+ CFont::SetBackGroundOnlyTextOff();
+ CFont::SetFontStyle(FONT_BANK);
+ CFont::SetColor(CRGBA(0, 0, 0, fZoneAlpha));
+ CFont::PrintString(HUD_FROM_RIGHT(32.0f - 1.0f), HUD_FROM_BOTTOM(30.0f - 1.0f), CHud::m_ZoneToPrint);
+
+ CFont::SetColor(CRGBA(152, 154, 82, fZoneAlpha));
+ CFont::PrintString(HUD_FROM_RIGHT(32.0f), HUD_FROM_BOTTOM(30.0f), CHud::m_ZoneToPrint);
+ }
+ }
+ }
+ else {
+ CHud::m_pLastZoneName = 0;
+ CHud::m_ZoneState = 0;
+ CHud::m_ZoneFadeTimer = 0;
+ CHud::m_ZoneNameTimer = 0;
+ }
+
+ /*
+ DrawVehicleName
+ */
+ if (CHud::m_pVehicleName) {
+ float fVehicleAlpha = 0.0f;
+
+ if (CHud::m_pVehicleName != CHud::m_pLastVehicleName) {
+ switch (CHud::m_VehicleState) {
+ case 0:
+ CHud::m_VehicleState = 2;
+ CHud::m_pVehicleNameToPrint = CHud::m_pVehicleName;
+ CHud::m_VehicleNameTimer = 0;
+ CHud::m_VehicleFadeTimer = 0;
+ break;
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ CHud::m_VehicleNameTimer = 0;
+ CHud::m_VehicleState = 4;
+ break;
+ default:
+ break;
+ }
+ CHud::m_pLastVehicleName = CHud::m_pVehicleName;
+ }
+
+ if (CHud::m_VehicleState) {
+ switch (CHud::m_VehicleState) {
+ case 1:
+ if (CHud::m_VehicleNameTimer > 10000) {
+ CHud::m_VehicleFadeTimer = 1000;
+ CHud::m_VehicleState = 3;
+ }
+ fVehicleAlpha = 255.0f;
+ break;
+ case 2:
+ CHud::m_VehicleFadeTimer += (CTimer::GetTimeStep() * 0.02f * 1000.0f);
+ if (CHud::m_VehicleFadeTimer > 1000) {
+ CHud::m_VehicleState = 1;
+ CHud::m_VehicleFadeTimer = 1000;
+ }
+ fVehicleAlpha = CHud::m_VehicleFadeTimer * 0.001f * 255.0f;
+ break;
+ case 3:
+ CHud::m_VehicleFadeTimer += (CTimer::GetTimeStep() * 0.02f * -1000.0f);
+ if (CHud::m_VehicleFadeTimer < 0) {
+ CHud::m_VehicleState = 0;
+ CHud::m_VehicleFadeTimer = 0;
+ }
+ fVehicleAlpha = CHud::m_VehicleFadeTimer * 0.001f * 255.0f;
+ break;
+ case 4:
+ CHud::m_VehicleFadeTimer += (CTimer::GetTimeStep() * 0.02f * -1000.0f);
+ if (CHud::m_VehicleFadeTimer < 0) {
+ CHud::m_VehicleFadeTimer = 0;
+ CHud::m_pVehicleNameToPrint = CHud::m_pLastVehicleName;
+ CHud::m_VehicleNameTimer = 0;
+ CHud::m_VehicleState = 2;
+ }
+ fVehicleAlpha = CHud::m_VehicleFadeTimer * 0.001f * 255.0f;
+ break;
+ default:
+ break;
+ }
+
+ if (!CHud::m_Message[0]) {
+ CHud::m_VehicleNameTimer += (CTimer::GetTimeStep() * 0.02f * 1000.0f);
+ CFont::SetJustifyOff();
+ CFont::SetPropOn();
+ CFont::SetBackgroundOff();
+
+ if (CMenuManager::m_PrefsLanguage != 3 && CMenuManager::m_PrefsLanguage != 4)
+ CFont::SetScale(HUD_STRETCH_X(1.2f), HUD_STRETCH_Y(1.2f));
+ else
+ CFont::SetScale(HUD_STRETCH_X(1.2f * 0.85f), HUD_STRETCH_Y(1.2f));
+
+ CFont::SetRightJustifyOn();
+ CFont::SetRightJustifyWrap(0.0f);
+ CFont::SetBackGroundOnlyTextOff();
+ CFont::SetFontStyle(FONT_BANK);
+ CFont::SetColor(CRGBA(0, 0, 0, fVehicleAlpha));
+ CFont::PrintString(HUD_FROM_RIGHT(32.0f - 1.0f), HUD_FROM_BOTTOM(55.0f - 1.0f), CHud::m_pVehicleNameToPrint);
+
+ CFont::SetColor(CRGBA(194, 165, 120, fVehicleAlpha));
+ CFont::PrintString(HUD_FROM_RIGHT(32.0f), HUD_FROM_BOTTOM(55.0f), CHud::m_pVehicleNameToPrint);
+ }
+ }
+ }
+ else {
+ CHud::m_pLastVehicleName = 0;
+ CHud::m_VehicleState = 0;
+ CHud::m_VehicleFadeTimer = 0;
+ CHud::m_VehicleNameTimer = 0;
+ }
+
+ /*
+ DrawOnScreenTimer
+ */
+ wchar sTimer[16];
+ if (!CUserDisplay::OnscnTimer.m_sEntries[0].m_bTimerProcessed)
+ TimerOnLastFrame = 0;
+ if (!CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterProcessed)
+ CounterOnLastFrame = 0;
+
+ if (CUserDisplay::OnscnTimer.m_bProcessed == 1) {
+ if (CUserDisplay::OnscnTimer.m_sEntries[0].m_bTimerProcessed == 1) {
+ if (!TimerOnLastFrame)
+ TimerFlashTimer = 1;
+
+ TimerOnLastFrame = 1;
+
+ if (TimerFlashTimer) {
+ if (++TimerFlashTimer > 50)
+ TimerFlashTimer = 0;
+ }
+
+ if (CTimer::GetFrameCounter() & 4 || !TimerFlashTimer) {
+ AsciiToUnicode(CUserDisplay::OnscnTimer.m_sEntries[0].m_bTimerBuffer, sTimer);
+ CFont::SetPropOn();
+ CFont::SetBackgroundOff();
+ CFont::SetScale(HUD_STRETCH_X(0.8f), HUD_STRETCH_Y(1.35f));
+ CFont::SetRightJustifyOn();
+ CFont::SetRightJustifyWrap(0.0f);
+ CFont::SetFontStyle(FONT_HEADING);
+ CFont::SetPropOff();
+ CFont::SetBackGroundOnlyTextOn();
+ CFont::SetColor(CRGBA(0, 0, 0, 255));
+ CFont::PrintString(HUD_FROM_RIGHT(27.0f - 2.0f), HUD_STRETCH_Y(110.0f + 2.0f), sTimer);
+
+ CFont::SetScale(HUD_STRETCH_X(0.8f), HUD_STRETCH_Y(1.35f));
+ CFont::SetColor(CRGBA(186, 101, 50, 255));
+ CFont::PrintString(HUD_FROM_RIGHT(27.0f), HUD_STRETCH_Y(110.0f), sTimer);
+
+ if (CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText[0]) {
+ CFont::SetPropOn();
+ CFont::SetColor(CRGBA(0, 0, 0, 255));
+ CFont::SetScale(HUD_STRETCH_X(0.8f), HUD_STRETCH_Y(1.35f));
+ CFont::PrintString(HUD_FROM_RIGHT(27.0f + 78.0f), HUD_STRETCH_Y(110.0f + 2.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText));
+
+ CFont::SetColor(CRGBA(186, 101, 50, 255));
+ CFont::PrintString(HUD_FROM_RIGHT(27.0f + 80.0f), HUD_STRETCH_Y(110.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aTimerText));
+ }
+ }
+ }
+ if (CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterProcessed == 1) {
+ if (!CounterOnLastFrame)
+ CounterFlashTimer = 1;
+
+ CounterOnLastFrame = 1;
+
+ if (CounterFlashTimer) {
+ if (++CounterFlashTimer > 50)
+ CounterFlashTimer = 0;
+ }
+
+ if (CTimer::GetFrameCounter() & 4 || !CounterFlashTimer) {
+ if (CUserDisplay::OnscnTimer.m_sEntries[0].m_nType) {
+ CSprite2d::DrawRect(CRect(HUD_FROM_RIGHT(127.0f - 4.0f), HUD_STRETCH_Y(132.0 + 8.0f), HUD_FROM_RIGHT(23.0f), HUD_STRETCH_Y(11.0f + 132.0f + 8.0f)), CRGBA(0, 106, 164, 80));
+ CSprite2d::DrawRect(CRect(HUD_FROM_RIGHT(127.0f + 4.0f), HUD_STRETCH_Y(132.0 + 8.0f), HUD_FROM_RIGHT(atoi(CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterBuffer) + 27.0f + 100.0f + 4.0f), HUD_STRETCH_Y(11.0f + 132.0f + 8.0f)), CRGBA(0, 106, 164, 255));
+ }
+ else {
+ AsciiToUnicode(CUserDisplay::OnscnTimer.m_sEntries[0].m_bCounterBuffer, sTimer);
+
+ CFont::SetPropOn();
+ CFont::SetBackgroundOff();
+ CFont::SetScale(HUD_STRETCH_X(0.8f), HUD_STRETCH_Y(1.35f));
+ CFont::SetCentreOff();
+ CFont::SetRightJustifyOn();
+ CFont::SetRightJustifyWrap(0.0f);
+ CFont::SetFontStyle(FONT_HEADING);
+ CFont::SetColor(CRGBA(244, 20, 20, 255));
+ CFont::SetWrapx(HUD_STRETCH_X(640.0f));
+ CFont::SetPropOff();
+ CFont::SetBackGroundOnlyTextOn();
+ CFont::SetColor(CRGBA(0, 0, 0, 255));
+ CFont::PrintString(HUD_FROM_RIGHT(27.0f - 2.0f), HUD_STRETCH_Y(132.0f + 2.0f), sTimer);
+
+ CFont::SetColor(CRGBA(0, 106, 164, 255));
+ CFont::PrintString(HUD_FROM_RIGHT(27.0f), HUD_STRETCH_Y(132.0f), sTimer);
+ }
+
+ if (CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText[0]) {
+ CFont::SetPropOn();
+ CFont::SetScale(HUD_STRETCH_X(0.8f), HUD_STRETCH_Y(1.35f));
+
+ CFont::SetColor(CRGBA(0, 0, 0, 255));
+ CFont::PrintString(HUD_FROM_RIGHT(27.0f + 59.0f), HUD_STRETCH_Y(132.0f + 2.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText));
+
+ CFont::SetColor(CRGBA(0, 106, 164, 255));
+ CFont::PrintString(HUD_FROM_RIGHT(27.0f + 61.0f), HUD_STRETCH_Y(132.0f), TheText.Get(CUserDisplay::OnscnTimer.m_sEntries[0].m_aCounterText));
+ }
+ }
+ }
+ }
+
+ /*
+ DrawPager
+ */
+ if (!m_PagerMessage[0]) {
+ if (PagerOn == 1) {
+ PagerSoundPlayed = false;
+ PagerOn = 2;
+ }
+ }
+ if (m_PagerMessage[0] || PagerOn == 2) {
+ if (!PagerOn) {
+ PagerOn = 1;
+ PagerXOffset = 150.0f;
+ }
+ if (PagerOn == 1) {
+ if (PagerXOffset > 0.0f) {
+ float fStep = PagerXOffset * 0.05f;
+ if (fStep > 10.0f)
+ fStep = 10.0f;
+ PagerXOffset -= fStep * CTimer::GetTimeStep();
+ }
+ if (!PagerSoundPlayed) {
+ DMAudio.PlayFrontEndSound(96, 0);
+ PagerSoundPlayed = 1;
+ }
+ }
+ else if (PagerOn == 2) {
+ float fStep = PagerXOffset * 0.05f;
+ if (fStep < 2.0f)
+ fStep = 2.0f;
+ PagerXOffset += fStep * CTimer::GetTimeStep();
+ if (PagerXOffset > 150.0f) {
+ PagerXOffset = 150.0;
+ PagerOn = 0;
+ }
+ }
+
+ CHud::Sprites[HUD_PAGER].Draw(CRect(HUD_STRETCH_X(26.0f - PagerXOffset), HUD_STRETCH_Y(27.0f), HUD_STRETCH_X(160.0 + 26.0f - PagerXOffset), HUD_STRETCH_Y(80.0f + 27.0f)), CRGBA(255, 255, 255, 255));
+
+ CFont::SetBackgroundOff();
+ CFont::SetScale(HUD_STRETCH_X(0.84f), HUD_STRETCH_Y(1.0f));
+ CFont::SetColor(CRGBA(32, 162, 66, 205));
+ CFont::SetRightJustifyOff();
+ CFont::SetBackgroundOff();
+ CFont::SetCentreOff();
+ CFont::SetJustifyOff();
+ CFont::SetPropOff();
+ CFont::SetFontStyle(FONT_PAGER);
+ CFont::PrintString(HUD_STRETCH_X(52.0f - PagerXOffset), HUD_STRETCH_Y(54.0f), CHud::m_PagerMessage);
+ }
+
+ /*
+ DrawRadar
+ */
+ if (CHud::m_ItemToFlash == ITEM_RADAR && CTimer::GetFrameCounter() & 8 || CHud::m_ItemToFlash != ITEM_RADAR) {
+ CRadar::DrawMap();
+ CHud::Sprites[HUD_RADARDISC].Draw(CRect(HUD_STRETCH_X(16.0f), HUD_FROM_BOTTOM(123.0f + 4.0f), HUD_STRETCH_X(94.0f + 20.0f + 5.0f), HUD_FROM_BOTTOM(-76.0f + 123.0f - 6.0f)), CRGBA(0, 0, 0, 255));
+ CRadar::DrawBlips();
+ }
+ }
+
+ /*
+ Draw3dMarkers
+ */
+ if (CHud::m_Wants_To_Draw_3dMarkers && !TheCamera.m_WideScreenOn && !CHud::m_BigMessage[0][0] && !CHud::m_BigMessage[2][0]) {
+ CRadar::Draw3dMarkers();
+ }
+
+ /*
+ DrawScriptText
+ */
+ if (!CTimer::GetIsUserPaused()) {
+ CTextLine* IntroText = CTheScripts::IntroTextLines;
+
+ for (int i = 0; i < 2; i++) {
+ if (CTheScripts::IntroTextLines[i].m_awText[0] && CTheScripts::IntroTextLines[i].field_29) {
+ CFont::SetScale(HUD_STRETCH_X(CTheScripts::IntroTextLines[i].m_fScaleX), HUD_STRETCH_Y(CTheScripts::IntroTextLines[i].m_fScaleY * 0.5f));
+ CFont::SetColor(CTheScripts::IntroTextLines[i].m_sColor);
+
+ if (CTheScripts::IntroTextLines[i].m_bJustify)
+ CFont::SetJustifyOn();
+ else
+ CFont::SetJustifyOff();
+
+ if (CTheScripts::IntroTextLines[i].m_bRightJustify)
+ CFont::SetRightJustifyOn();
+ else
+ CFont::SetRightJustifyOff();
+
+ if (CTheScripts::IntroTextLines[i].m_bCentered)
+ CFont::SetCentreOn();
+ else
+ CFont::SetCentreOff();
+
+ CFont::SetWrapx(HUD_STRETCH_X(CTheScripts::IntroTextLines[i].m_fWrapX));
+ CFont::SetCentreSize(HUD_STRETCH_X(CTheScripts::IntroTextLines[i].m_fCenterSize));
+
+ if (CTheScripts::IntroTextLines[i].m_bBackground)
+ CFont::SetBackgroundOn();
+ else
+ CFont::SetBackgroundOff();
+
+ CFont::SetBackgroundColor(CTheScripts::IntroTextLines[i].m_sBackgroundColor);
+
+ if (CTheScripts::IntroTextLines[i].m_bBackgroundOnly)
+ CFont::SetBackGroundOnlyTextOn();
+ else
+ CFont::SetBackGroundOnlyTextOff();
+
+ if (CTheScripts::IntroTextLines[i].m_bTextProportional)
+ CFont::SetPropOn();
+ else
+ CFont::SetPropOff();
+
+ CFont::SetFontStyle(CTheScripts::IntroTextLines[i].m_nFont);
+ CFont::PrintString(HUD_STRETCH_X(640.0f - CTheScripts::IntroTextLines[i].field_36), HUD_STRETCH_Y(448.0f - CTheScripts::IntroTextLines[i].field_40), IntroText->m_awText);
+ }
+ }
+
+ CScriptRectangle* IntroRect = CTheScripts::IntroRectangles;
+
+ for (int i = 0; i < 16; i++) {
+ if (CTheScripts::IntroRectangles[i].m_bIsUsed && CTheScripts::IntroRectangles[i].m_bIsAntialiased) {
+ if (CTheScripts::IntroRectangles[i].m_wTextureId >= 0) {
+ CRect rect = {
+ CTheScripts::IntroRectangles[i].m_sRect.left,
+ CTheScripts::IntroRectangles[i].m_sRect.bottom,
+ CTheScripts::IntroRectangles[i].m_sRect.right,
+ CTheScripts::IntroRectangles[i].m_sRect.bottom };
+
+ CTheScripts::ScriptSprites[CTheScripts::IntroRectangles[i].m_wTextureId].Draw(rect, IntroRect->m_sColor);
+ }
+ else {
+ CRect rect = {
+ CTheScripts::IntroRectangles[i].m_sRect.left,
+ CTheScripts::IntroRectangles[i].m_sRect.bottom,
+ CTheScripts::IntroRectangles[i].m_sRect.right,
+ CTheScripts::IntroRectangles[i].m_sRect.bottom };
+
+ CSprite2d::DrawRect(rect, IntroRect->m_sColor);
+ }
+ }
+ }
+
+ /*
+ DrawSubtitles
+ */
+ if (CHud::m_Message[0] && !CHud::m_BigMessage[2][0] && (FrontEndMenuManager.m_PrefsShowSubtitles == 1 || !TheCamera.m_WideScreenOn)) {
+ CFont::SetJustifyOff();
+ CFont::SetBackgroundOff();
+ CFont::SetBackgroundColor(CRGBA(0, 0, 0, 128));
+ CFont::SetScale(HUD_STRETCH_X(0.48f), HUD_STRETCH_Y(1.120f));
+ CFont::SetCentreOn();
+ CFont::SetPropOn();
+ CFont::SetFontStyle(FONT_BANK);
+
+ if (TheCamera.m_WideScreenOn)
+ CFont::SetCentreSize(HUD_FROM_RIGHT(120.0f));
+ else
+ CFont::SetCentreSize(HUD_FROM_RIGHT(280.0f));
+
+ CFont::SetDropShadowPosition(1);
+ CFont::SetDropColor(CRGBA(0, 0, 0, 255));
+ CFont::SetColor(CRGBA(235, 235, 235, 255));
+ CFont::PrintString(SCREEN_WIDTH / 2, HUD_FROM_BOTTOM(64.0f), CHud::m_Message);
+ CFont::SetDropShadowPosition(0);
+ }
+
+ /*
+ DrawBigMessage
+ */
+ // MissionCompleteFailedText
+ if (CHud::m_BigMessage[0][0]) {
+ if (BigMessageInUse[0] == 0.0f) {
+ CFont::SetJustifyOff();
+ CFont::SetBackgroundOff();
+ CFont::SetBackGroundOnlyTextOff();
+ CFont::SetScale(HUD_STRETCH_X(1.8f), HUD_STRETCH_Y(1.8f));
+ CFont::SetPropOn();
+ CFont::SetCentreOn();
+ CFont::SetCentreSize(HUD_STRETCH_X(615.0f));
+ CFont::SetColor(CRGBA(255, 255, 0, 255));
+ CFont::SetFontStyle(FONT_HEADING);
+
+ if (BigMessageX[0] >= (SCREENW - 20)) {
+ BigMessageAlpha[0] += (CTimer::GetTimeStep() * 0.02f * -255.0f);
+
+ if (BigMessageAlpha[0] <= 0.0f) {
+ BigMessageAlpha[0] = 0.0f;
+ BigMessageInUse[0] = 1.0f;
+ }
+ }
+ else {
+ BigMessageX[0] += (CTimer::GetTimeStep() * 0.02f * 255.0f);
+ BigMessageAlpha[0] += (CTimer::GetTimeStep() * 0.02f * 255.0f);
+
+ if (BigMessageAlpha[0] >= 255.0f)
+ BigMessageAlpha[0] = 255.0f;
+ }
+
+ CFont::SetColor(CRGBA(0, 0, 0, BigMessageAlpha[0]));
+ CFont::PrintString(SCREEN_WIDTH / 2, (SCREEN_HEIGHT / 2) - HUD_STRETCH_Y(20.0f - 2.0f), m_BigMessage[0]);
+
+ CFont::SetColor(CRGBA(85, 119, 133, BigMessageAlpha[0]));
+ CFont::PrintString(SCREEN_WIDTH / 2, (SCREEN_HEIGHT / 2) - HUD_STRETCH_Y(20.0f), m_BigMessage[0]);
+ }
+ else {
+ BigMessageAlpha[0] = 0.0;
+ BigMessageX[0] = -60.0;
+ BigMessageInUse[0] = 1.0;
+ }
+ }
+ else {
+ BigMessageInUse[0] = 0.0;
+ }
+
+ // WastedBustedText
+ if (CHud::m_BigMessage[2][0]) {
+ if (BigMessageInUse[2] == 0.0f) {
+ BigMessageAlpha[2] += (CTimer::GetTimeStep() * 0.02f * 1000.0f) * 0.4f;
+
+ if (BigMessageAlpha[2] > 255.0f)
+ BigMessageAlpha[2] = 255.0;
+
+ CFont::SetBackgroundOff();
+
+ if (CGame::frenchGame || CGame::germanGame)
+ CFont::SetScale(HUD_STRETCH_X(1.4f), HUD_STRETCH_Y(1.4f));
+ else
+ CFont::SetScale(HUD_STRETCH_X(2.0f), HUD_STRETCH_Y(2.0f));
+
+ CFont::SetPropOn();
+ CFont::SetRightJustifyOn();
+ CFont::SetFontStyle(FONT_HEADING);
+ CFont::SetColor(CRGBA(0, 0, 0, 0.75f * BigMessageAlpha[2]));
+
+ CFont::PrintString(HUD_FROM_RIGHT(20.0f + 4.0f), HUD_FROM_BOTTOM(78.0f), CHud::m_BigMessage[2]);
+
+ CFont::SetColor(CRGBA(170, 123, 87, BigMessageAlpha[2]));
+ CFont::PrintString(HUD_FROM_RIGHT(20.0f), HUD_FROM_BOTTOM(82.0f), CHud::m_BigMessage[2]);
+ }
+ else {
+ BigMessageAlpha[2] = 0.0;
+ BigMessageInUse[2] = 1.0;
+ }
+ }
+ else {
+ BigMessageInUse[2] = 0.0;
+ }
+ }
+ }
+}
+
+void CHud::DrawAfterFade()
+{
+ if (CTimer::GetIsUserPaused() || CReplay::Mode == 1)
+ return;
+
+ if (m_HelpMessage[0]) {
+ if (!CMessages::WideStringCompare(m_HelpMessage, m_LastHelpMessage, 256)) {
+ switch (m_HelpMessageState) {
+ case 0:
+ m_HelpMessageFadeTimer = 0;
+ m_HelpMessageState = 2;
+ m_HelpMessageTimer = 0;
+ CMessages::WideStringCopy(m_HelpMessageToPrint, m_HelpMessage, 256);
+ m_HelpMessageDisplayTime = CMessages::GetWideStringLength(m_HelpMessage) * 0.05f + 3.0f;
+
+ if (TheCamera.m_ScreenReductionPercentage == 0.0f)
+ DMAudio.PlayFrontEndSound(SOUND_A0, 0);
+ break;
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ m_HelpMessageTimer = 5;
+ m_HelpMessageState = 4;
+ break;
+ default:
+ break;
+ }
+ CMessages::WideStringCopy(m_LastHelpMessage, m_HelpMessage, 256);
+ }
+
+ float fAlpha = 255.0f;
+
+ if (m_HelpMessageState) {
+ switch (m_HelpMessageState) {
+ case 1:
+ fAlpha = 255.0f;
+ m_HelpMessageFadeTimer = 600;
+ if (m_HelpMessageTimer > m_fHelpMessageTime * 1000 || m_bHelpMessageQuick && m_HelpMessageTimer > 1500) {
+ m_HelpMessageFadeTimer = 600;
+ m_HelpMessageState = 3;
+ }
+ break;
+ case 2:
+ m_HelpMessageFadeTimer += 2 * (CTimer::GetTimeStep() * 0.02f * 1000.0f);
+ if (m_HelpMessageFadeTimer > 0) {
+ m_HelpMessageState = 1;
+ m_HelpMessageFadeTimer = 0;
+ }
+ fAlpha = m_HelpMessageFadeTimer * 0.001f * 255.0f;
+ break;
+ case 3:
+ m_HelpMessageFadeTimer -= 2 * (CTimer::GetTimeStep() * 0.02f * 1000.0f);
+ if (m_HelpMessageFadeTimer >= 0) {
+ m_HelpMessageState = 0;
+ m_HelpMessageFadeTimer = 0;
+ }
+ fAlpha = m_HelpMessageFadeTimer * 0.001f * 255.0f;
+ break;
+ case 4:
+ m_HelpMessageFadeTimer -= 2 * (CTimer::GetTimeStep() * 0.02f * 1000.0f);
+ if (m_HelpMessageFadeTimer >= 0) {
+ m_HelpMessageState = 2;
+ m_HelpMessageFadeTimer = 0;
+ CMessages::WideStringCopy(m_HelpMessageToPrint, m_LastHelpMessage, 400);
+ }
+ fAlpha = m_HelpMessageFadeTimer * 0.001f * 255.0f;
+ break;
+ default:
+ break;
+ }
+
+ m_HelpMessageTimer += (CTimer::GetTimeStep() * 0.02f * 1000.0f);
+
+ CFont::SetAlphaFade(fAlpha);
+ CFont::SetCentreOff();
+ CFont::SetPropOn();
+
+ if (CGame::germanGame)
+ CFont::SetScale(HUD_STRETCH_X(0.52f * 0.85f), HUD_STRETCH_Y(1.1f * 0.85f));
+ else
+ CFont::SetScale(HUD_STRETCH_X(0.52f), HUD_STRETCH_Y(1.1f));
+
+ CFont::SetColor(CRGBA(175, 175, 175, 255));
+ CFont::SetJustifyOff();
+ CFont::SetWrapx(HUD_STRETCH_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::SetColor(CRGBA(175, 175, 175, 255));
+ CFont::PrintString(HUD_STRETCH_X(26.0f), HUD_STRETCH_Y(28.0f + (150.0f - PagerXOffset) * 0.6f), CHud::m_HelpMessageToPrint);
+ CFont::SetAlphaFade(255.0f);
+ CFont::DrawFonts();
+ }
+ }
+ else
+ m_HelpMessageState = 0;
+
+ /*
+ DrawBigMessage2
+ */
+ // Oddjob
+ if (m_BigMessage[4][0]) {
+ CFont::SetJustifyOff();
+ CFont::SetBackgroundOff();
+ CFont::SetScale(HUD_STRETCH_X(1.2f), HUD_STRETCH_Y(1.5f));
+ CFont::SetCentreOn();
+ CFont::SetPropOn();
+ CFont::SetCentreSize(HUD_STRETCH_X(600.0f));
+ CFont::SetFontStyle(FONT_BANK);
+
+ CFont::SetColor(CRGBA(0, 0, 0, 255));
+ CFont::PrintString(HUD_STRETCH_X(2.0f) + (SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) - HUD_STRETCH_Y(84.0f), m_BigMessage[4]);
+
+ CFont::SetColor(CRGBA(89, 115, 150, 255));
+ CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) - HUD_STRETCH_Y(84.0f), m_BigMessage[4]);
+ }
+
+ // Oddjob result
+ if (OddJob2OffTimer > 0)
+ OddJob2OffTimer = OddJob2OffTimer - (CTimer::GetTimeStep() * 0.02f * 1000.0f);
+
+ static float fStep;
+ if (!m_BigMessage[1][0] && m_BigMessage[4][0] && m_BigMessage[5][0] && OddJob2OffTimer <= 0.0f) {
+ switch (OddJob2On) {
+ case 0:
+ OddJob2On = 1;
+ OddJob2XOffset = 380.0;
+ break;
+ case 1:
+ if (OddJob2XOffset <= 2.0f) {
+ OddJob2Timer = 0;
+ OddJob2On = 2;
+ }
+ else {
+ fStep = 40.0;
+ if ((OddJob2XOffset * 0.16667) <= 40.0)
+ fStep = OddJob2XOffset * 0.16667;
+ OddJob2XOffset = OddJob2XOffset - fStep;
+ }
+ break;
+ case 2:
+ OddJob2Timer += (20.0 * CTimer::GetTimeStep());
+ if (OddJob2Timer > 1500) {
+ OddJob2On = 3;
+ }
+ break;
+ case 3:
+ fStep = 30.0;
+ if ((OddJob2XOffset * 0.2) >= 30.0)
+ fStep = OddJob2XOffset * 0.2;
+
+ OddJob2XOffset = OddJob2XOffset - fStep;
+
+ if (OddJob2XOffset < -380.0) {
+ OddJob2OffTimer = 5000.0;
+ OddJob2On = 0;
+ }
+ break;
+ default:
+ break;
+ }
+
+ CFont::SetJustifyOff();
+ CFont::SetBackgroundOff();
+ CFont::SetScale(HUD_STRETCH_X(1.0f), HUD_STRETCH_Y(1.2f));
+ CFont::SetCentreOn();
+ CFont::SetPropOn();
+ CFont::SetCentreSize(HUD_FROM_RIGHT(20.0f));
+ CFont::SetColor(CRGBA(0, 0, 0, 255));
+ CFont::SetFontStyle(FONT_BANK);
+ CFont::PrintString(HUD_STRETCH_X(2.0f) + (SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) - HUD_STRETCH_Y(20.0f + 2.0f), m_BigMessage[5]);
+
+ CFont::SetColor(CRGBA(156, 91, 40, 255));
+ CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) - HUD_STRETCH_Y(20.0f + 2.0f), m_BigMessage[5]);
+ }
+
+ /*
+ DrawMissionTitle
+ */
+ if (m_BigMessage[1][0]) {
+ if (BigMessageInUse[1] == 0.0f) {
+ CFont::SetJustifyOff();
+ CFont::SetBackgroundOff();
+
+ if (CGame::frenchGame || CMenuManager::m_PrefsLanguage == 4)
+ CFont::SetScale(HUD_STRETCH_X(0.884f), HUD_STRETCH_Y(1.36f));
+ else
+ CFont::SetScale(HUD_STRETCH_X(1.04f), HUD_STRETCH_Y(1.6f));
+
+ CFont::SetPropOn();
+ CFont::SetRightJustifyWrap(-500);
+ CFont::SetRightJustifyOn();
+ CFont::SetFontStyle(FONT_HEADING);
+ if (BigMessageX[1] >= (SCREENW - 20)) {
+ BigMessageAlpha[1] += (CTimer::GetTimeStep() * 0.02f * -255.0f);
+
+ if (BigMessageAlpha[1] <= 0.0f) {
+ BigMessageAlpha[1] = 0.0f;
+ BigMessageInUse[1] = 1.0f;
+ }
+ }
+ else {
+ BigMessageX[1] += (CTimer::GetTimeStep() * 0.02f * 255.0f);
+ BigMessageAlpha[1] += (CTimer::GetTimeStep() * 0.02f * 255.0f);
+
+ if (BigMessageAlpha[1] >= 255.0f)
+ BigMessageAlpha[1] = 255.0f;
+ }
+ CFont::SetColor(CRGBA(40, 40, 40, BigMessageAlpha[1]));
+ CFont::PrintString(HUD_FROM_RIGHT(20.0f - 2.0f), HUD_FROM_BOTTOM(120.0f), m_BigMessage[1]);
+
+ CFont::SetColor(CRGBA(220, 172, 2, BigMessageAlpha[1]));
+ CFont::PrintString(HUD_FROM_RIGHT(20.0f), HUD_FROM_BOTTOM(120.0f), m_BigMessage[1]);
+ }
+ else {
+ BigMessageAlpha[1] = 0.0f;
+ BigMessageX[1] = -60.0f;
+ BigMessageInUse[1] = 1.0f;
+ }
+ }
+ else {
+ BigMessageInUse[1] = 0.0f;
+ }
+}
-WRAPPER void CHud::Draw(void) { EAXJMP(0x5052A0); }
-WRAPPER void CHud::DrawAfterFade(void) { EAXJMP(0x509030); }
+STARTPATCHES
+ InjectHook(0x48BC9A, &CHud::Initialise, PATCH_CALL);
+ InjectHook(0x48C4F1, &CHud::ReInitialise, PATCH_CALL);
+ InjectHook(0x48BCBC, &CHud::Shutdown, PATCH_CALL);
+ENDPATCHES
diff --git a/src/render/Hud.h b/src/render/Hud.h
index 242acea8..c4c43e30 100644
--- a/src/render/Hud.h
+++ b/src/render/Hud.h
@@ -1,10 +1,95 @@
#pragma once
+#include "Sprite2d.h"
+
+enum eItems
+{
+ ITEM_ARMOUR = 3,
+ ITEM_HEALTH = 4,
+ ITEM_RADAR = 8
+};
+
+enum eSprites
+{
+ HUD_FIST,
+ HUD_BAT,
+ HUD_PISTOL,
+ HUD_UZI,
+ HUD_SHOTGUN,
+ HUD_AK47,
+ HUD_M16,
+ HUD_SNIPER,
+ HUD_ROCKET,
+ HUD_FLAME,
+ HUD_MOLOTOV,
+ HUD_GRENADE,
+ HUD_DETONATOR,
+ HUD_RADARDISC = 15,
+ HUD_PAGER = 16,
+ HUD_SITESNIPER = 20,
+ HUD_SITEM16 = 21
+};
class CHud
{
public:
- static void Draw(void);
- static void DrawAfterFade(void);
+ static CSprite2d *Sprites;
+ static wchar *m_HelpMessage;
+ static wchar *m_LastHelpMessage;
+ static int32 &m_HelpMessageState;
+ static int32 &m_HelpMessageTimer;
+ static int32 &m_HelpMessageFadeTimer;
+ static wchar *m_HelpMessageToPrint;
+ static float &m_HelpMessageDisplayTime;
+ static float &m_fTextBoxNumLines;
+ static float &m_fHelpMessageTime;
+ static bool &m_bHelpMessageQuick;
+ static int32 m_ZoneState;
+ static int32 m_ZoneFadeTimer;
+ static int32 m_ZoneNameTimer;
+ static wchar *&m_pZoneName;
+ static wchar *m_pLastZoneName;
+ static wchar *m_ZoneToPrint;
+ static wchar *&m_pVehicleName;
+ static wchar *m_pLastVehicleName;
+ static wchar *m_pVehicleNameToPrint;
+ static int32 m_VehicleState;
+ static int32 m_VehicleFadeTimer;
+ static int32 m_VehicleNameTimer;
+ static wchar *m_Message;
+ static wchar *m_PagerMessage;
static bool &m_Wants_To_Draw_Hud;
+ static bool &m_Wants_To_Draw_3dMarkers;
+ static wchar(*m_BigMessage)[128];
+ static float *BigMessageInUse;
+ static float *BigMessageAlpha;
+ static float *BigMessageX;
+ static float &OddJob2OffTimer;
+ static int8 &CounterOnLastFrame;
+ static float &OddJob2XOffset;
+ static int16 &CounterFlashTimer;
+ static int16 &OddJob2Timer;
+ static int8 &TimerOnLastFrame;
+ static int16 &OddJob2On;
+ static int16 &TimerFlashTimer;
+ static int16 &PagerSoundPlayed;
+ static int32 &SpriteBrightness;
+ static float &PagerXOffset;
+ static int32 m_ItemToFlash;
+ static int16 &PagerTimer;
+ static int16 &PagerOn;
+
+public:
+ static void Initialise();
+ static void Shutdown();
+ static void ReInitialise();
+ static void GetRidOfAllHudMessages();
+ static void SetZoneName(wchar *name);
+ static void SetHelpMessage(wchar *message, bool quick);
+ static void SetVehicleName(wchar *name);
+ static void Draw();
+ static void DrawAfterFade();
+ static void SetMessage(wchar *message);
+ static void SetBigMessage(wchar *message, int16 style);
+ static void SetPagerMessage(wchar *message);
};
diff --git a/src/render/Particle.cpp b/src/render/Particle.cpp
index b7c14f1b..1ff3bced 100644
--- a/src/render/Particle.cpp
+++ b/src/render/Particle.cpp
@@ -44,7 +44,7 @@
-const Char SmokeFiles[][6+1] =
+const char SmokeFiles[][6+1] =
{
"smoke1",
"smoke2",
@@ -54,7 +54,7 @@ const Char SmokeFiles[][6+1] =
};
-const Char Smoke2Files[][9+1] =
+const char Smoke2Files[][9+1] =
{
"smokeII_1",
"smokeII_2",
@@ -63,7 +63,7 @@ const Char Smoke2Files[][9+1] =
"smokeII_5"
};
-const Char RubberFiles[][7+1] =
+const char RubberFiles[][7+1] =
{
"rubber1",
"rubber2",
@@ -72,7 +72,7 @@ const Char RubberFiles[][7+1] =
"rubber5"
};
-const Char RainSplashFiles[][7+1] =
+const char RainSplashFiles[][7+1] =
{
"splash1",
"splash2",
@@ -81,14 +81,14 @@ const Char RainSplashFiles[][7+1] =
"splash5"
};
-const Char WatersprayFiles[][11+1] =
+const char WatersprayFiles[][11+1] =
{
"waterspray1",
"waterspray2",
"waterspray3"
};
-const Char ExplosionMediumFiles[][7+1] =
+const char ExplosionMediumFiles[][7+1] =
{
"explo01",
"explo02",
@@ -98,7 +98,7 @@ const Char ExplosionMediumFiles[][7+1] =
"explo06"
};
-const Char GunFlashFiles[][9+1] =
+const char GunFlashFiles[][9+1] =
{
"gunflash1",
"gunflash2",
@@ -106,7 +106,7 @@ const Char GunFlashFiles[][9+1] =
"gunflash4"
};
-const Char RaindropFiles[][9+1] =
+const char RaindropFiles[][9+1] =
{
"raindrop1",
"raindrop2",
@@ -114,13 +114,13 @@ const Char RaindropFiles[][9+1] =
"raindrop4"
};
-const Char RainSplashupFiles[][10+1] =
+const char RainSplashupFiles[][10+1] =
{
"splash_up1",
"splash_up2"
};
-const Char BirdfrontFiles[][8+1] =
+const char BirdfrontFiles[][8+1] =
{
"birdf_01",
"birdf_02",
@@ -128,7 +128,7 @@ const Char BirdfrontFiles[][8+1] =
"birdf_04"
};
-const Char CardebrisFiles[][12+1] =
+const char CardebrisFiles[][12+1] =
{
"cardebris_01",
"cardebris_02",
@@ -136,7 +136,7 @@ const Char CardebrisFiles[][12+1] =
"cardebris_04"
};
-const Char CarsplashFiles[][12+1] =
+const char CarsplashFiles[][12+1] =
{
"carsplash_01",
"carsplash_02",
@@ -210,7 +210,7 @@ RwTexture * (&gpRainDropTex)[MAX_RAINDROP_FILES] = *(RwTexture * (*)[MAX_RA
RwRaster *gpRainDropRaster[MAX_RAINDROP_FILES];
//Float CParticle::ms_afRandTable[CParticle::RAND_TABLE_SIZE]; //
-Float (&CParticle::ms_afRandTable)[CParticle::RAND_TABLE_SIZE] = *(Float (*)[CParticle::RAND_TABLE_SIZE])*(int *)0x6E98C8;
+float (&CParticle::ms_afRandTable)[CParticle::RAND_TABLE_SIZE] = *(float (*)[CParticle::RAND_TABLE_SIZE])*(int *)0x6E98C8;
CParticle *CParticle::m_pUnusedListHead;
@@ -218,13 +218,13 @@ CParticle *CParticle::m_pUnusedListHead;
//Float CParticle::m_SinTable[CParticle::SIN_COS_TABLE_SIZE]; //
//Float CParticle::m_CosTable[CParticle::SIN_COS_TABLE_SIZE]; /
-Float (&CParticle::m_SinTable)[CParticle::SIN_COS_TABLE_SIZE] = *(Float (*)[CParticle::SIN_COS_TABLE_SIZE])*(int *)0x877358;
-Float (&CParticle::m_CosTable)[CParticle::SIN_COS_TABLE_SIZE] = *(Float (*)[CParticle::SIN_COS_TABLE_SIZE])*(int *)0x70DA18;
+float (&CParticle::m_SinTable)[CParticle::SIN_COS_TABLE_SIZE] = *(float (*)[CParticle::SIN_COS_TABLE_SIZE])*(int *)0x877358;
+float (&CParticle::m_CosTable)[CParticle::SIN_COS_TABLE_SIZE] = *(float (*)[CParticle::SIN_COS_TABLE_SIZE])*(int *)0x70DA18;
-Int32 Randomizer;
+int32 Randomizer;
-Int32 nParticleCreationInterval = 1;
-Float fParticleScaleLimit = 0.5f;
+int32 nParticleCreationInterval = 1;
+float fParticleScaleLimit = 0.5f;
@@ -241,7 +241,7 @@ void CParticle::ReloadConfig()
m_pUnusedListHead = gParticleArray;
- for ( Int32 i = 0; i < MAX_PARTICLES_ON_SCREEN; i++ )
+ for ( int32 i = 0; i < MAX_PARTICLES_ON_SCREEN; i++ )
{
if ( i == MAX_PARTICLES_ON_SCREEN - 1 )
gParticleArray[i].m_pNext = NULL;
@@ -292,93 +292,93 @@ void CParticle::Initialise()
CParticleObject::Initialise();
- Float randVal = -1.0f;
- for ( Int32 i = 0; i < RAND_TABLE_SIZE; i++ )
+ float randVal = -1.0f;
+ for ( int32 i = 0; i < RAND_TABLE_SIZE; i++ )
{
ms_afRandTable[i] = randVal;
randVal += 0.1f;
}
- for ( Int32 i = 0; i < SIN_COS_TABLE_SIZE; i++ )
+ for ( int32 i = 0; i < SIN_COS_TABLE_SIZE; i++ )
{
- Float angle = DEGTORAD(Float(i) * Float(360.0f / SIN_COS_TABLE_SIZE));
+ float angle = DEGTORAD(float(i) * float(360.0f / SIN_COS_TABLE_SIZE));
m_SinTable[i] = sin(angle);
m_CosTable[i] = cos(angle);
}
- Int32 slot = CTxdStore::FindTxdSlot("particle");
+ int32 slot = CTxdStore::FindTxdSlot("particle");
CTxdStore::PushCurrentTxd();
CTxdStore::SetCurrentTxd(slot);
- for ( Int32 i = 0; i < MAX_SMOKE_FILES; i++ )
+ for ( int32 i = 0; i < MAX_SMOKE_FILES; i++ )
{
gpSmokeTex[i] = RwTextureRead(SmokeFiles[i], NULL);
gpSmokeRaster[i] = RwTextureGetRaster(gpSmokeTex[i]);
}
- for ( Int32 i = 0; i < MAX_SMOKE2_FILES; i++ )
+ for ( int32 i = 0; i < MAX_SMOKE2_FILES; i++ )
{
gpSmoke2Tex[i] = RwTextureRead(Smoke2Files[i], NULL);
gpSmoke2Raster[i] = RwTextureGetRaster(gpSmoke2Tex[i]);
}
- for ( Int32 i = 0; i < MAX_RUBBER_FILES; i++ )
+ for ( int32 i = 0; i < MAX_RUBBER_FILES; i++ )
{
gpRubberTex[i] = RwTextureRead(RubberFiles[i], NULL);
gpRubberRaster[i] = RwTextureGetRaster(gpRubberTex[i]);
}
- for ( Int32 i = 0; i < MAX_RAINSPLASH_FILES; i++ )
+ for ( int32 i = 0; i < MAX_RAINSPLASH_FILES; i++ )
{
gpRainSplashTex[i] = RwTextureRead(RainSplashFiles[i], NULL);
gpRainSplashRaster[i] = RwTextureGetRaster(gpRainSplashTex[i]);
}
- for ( Int32 i = 0; i < MAX_WATERSPRAY_FILES; i++ )
+ for ( int32 i = 0; i < MAX_WATERSPRAY_FILES; i++ )
{
gpWatersprayTex[i] = RwTextureRead(WatersprayFiles[i], NULL);
gpWatersprayRaster[i] = RwTextureGetRaster(gpWatersprayTex[i]);
}
- for ( Int32 i = 0; i < MAX_EXPLOSIONMEDIUM_FILES; i++ )
+ for ( int32 i = 0; i < MAX_EXPLOSIONMEDIUM_FILES; i++ )
{
gpExplosionMediumTex[i] = RwTextureRead(ExplosionMediumFiles[i], NULL);
gpExplosionMediumRaster[i] = RwTextureGetRaster(gpExplosionMediumTex[i]);
}
- for ( Int32 i = 0; i < MAX_GUNFLASH_FILES; i++ )
+ for ( int32 i = 0; i < MAX_GUNFLASH_FILES; i++ )
{
gpGunFlashTex[i] = RwTextureRead(GunFlashFiles[i], NULL);
gpGunFlashRaster[i] = RwTextureGetRaster(gpGunFlashTex[i]);
}
- for ( Int32 i = 0; i < MAX_RAINDROP_FILES; i++ )
+ for ( int32 i = 0; i < MAX_RAINDROP_FILES; i++ )
{
gpRainDropTex[i] = RwTextureRead(RaindropFiles[i], NULL);
gpRainDropRaster[i] = RwTextureGetRaster(gpRainDropTex[i]);
}
- for ( Int32 i = 0; i < MAX_RAINSPLASHUP_FILES; i++ )
+ for ( int32 i = 0; i < MAX_RAINSPLASHUP_FILES; i++ )
{
gpRainSplashupTex[i] = RwTextureRead(RainSplashupFiles[i], NULL);
gpRainSplashupRaster[i] = RwTextureGetRaster(gpRainSplashupTex[i]);
}
- for ( Int32 i = 0; i < MAX_BIRDFRONT_FILES; i++ )
+ for ( int32 i = 0; i < MAX_BIRDFRONT_FILES; i++ )
{
gpBirdfrontTex[i] = RwTextureRead(BirdfrontFiles[i], NULL);
gpBirdfrontRaster[i] = RwTextureGetRaster(gpBirdfrontTex[i]);
}
- for ( Int32 i = 0; i < MAX_CARDEBRIS_FILES; i++ )
+ for ( int32 i = 0; i < MAX_CARDEBRIS_FILES; i++ )
{
gpCarDebrisTex[i] = RwTextureRead(CardebrisFiles[i], NULL);
gpCarDebrisRaster[i] = RwTextureGetRaster(gpCarDebrisTex[i]);
}
- for ( Int32 i = 0; i < MAX_CARSPLASH_FILES; i++ )
+ for ( int32 i = 0; i < MAX_CARSPLASH_FILES; i++ )
{
gpCarSplashTex[i] = RwTextureRead(CarsplashFiles[i], NULL);
gpCarSplashRaster[i] = RwTextureGetRaster(gpCarSplashTex[i]);
@@ -429,7 +429,7 @@ void CParticle::Initialise()
CTxdStore::PopCurrentTxd();
- for ( Int32 i = 0; i < MAX_PARTICLES; i++ )
+ for ( int32 i = 0; i < MAX_PARTICLES; i++ )
{
tParticleSystemData *entry = &mod_ParticleSystemManager.m_aParticles[i];
@@ -584,7 +584,7 @@ void CParticle::Shutdown()
{
debug("Shutting down CParticle...");
- for ( Int32 i = 0; i < MAX_SMOKE_FILES; i++ )
+ for ( int32 i = 0; i < MAX_SMOKE_FILES; i++ )
{
RwTextureDestroy(gpSmokeTex[i]);
#ifdef GTA3_1_1_PATCH
@@ -592,7 +592,7 @@ void CParticle::Shutdown()
#endif
}
- for ( Int32 i = 0; i < MAX_SMOKE2_FILES; i++ )
+ for ( int32 i = 0; i < MAX_SMOKE2_FILES; i++ )
{
RwTextureDestroy(gpSmoke2Tex[i]);
#ifdef GTA3_1_1_PATCH
@@ -600,7 +600,7 @@ void CParticle::Shutdown()
#endif
}
- for ( Int32 i = 0; i < MAX_RUBBER_FILES; i++ )
+ for ( int32 i = 0; i < MAX_RUBBER_FILES; i++ )
{
RwTextureDestroy(gpRubberTex[i]);
#ifdef GTA3_1_1_PATCH
@@ -608,7 +608,7 @@ void CParticle::Shutdown()
#endif
}
- for ( Int32 i = 0; i < MAX_RAINSPLASH_FILES; i++ )
+ for ( int32 i = 0; i < MAX_RAINSPLASH_FILES; i++ )
{
RwTextureDestroy(gpRainSplashTex[i]);
#ifdef GTA3_1_1_PATCH
@@ -616,7 +616,7 @@ void CParticle::Shutdown()
#endif
}
- for ( Int32 i = 0; i < MAX_WATERSPRAY_FILES; i++ )
+ for ( int32 i = 0; i < MAX_WATERSPRAY_FILES; i++ )
{
RwTextureDestroy(gpWatersprayTex[i]);
#ifdef GTA3_1_1_PATCH
@@ -624,7 +624,7 @@ void CParticle::Shutdown()
#endif
}
- for ( Int32 i = 0; i < MAX_EXPLOSIONMEDIUM_FILES; i++ )
+ for ( int32 i = 0; i < MAX_EXPLOSIONMEDIUM_FILES; i++ )
{
RwTextureDestroy(gpExplosionMediumTex[i]);
#ifdef GTA3_1_1_PATCH
@@ -632,7 +632,7 @@ void CParticle::Shutdown()
#endif
}
- for ( Int32 i = 0; i < MAX_GUNFLASH_FILES; i++ )
+ for ( int32 i = 0; i < MAX_GUNFLASH_FILES; i++ )
{
RwTextureDestroy(gpGunFlashTex[i]);
#ifdef GTA3_1_1_PATCH
@@ -640,7 +640,7 @@ void CParticle::Shutdown()
#endif
}
- for ( Int32 i = 0; i < MAX_RAINDROP_FILES; i++ )
+ for ( int32 i = 0; i < MAX_RAINDROP_FILES; i++ )
{
RwTextureDestroy(gpRainDropTex[i]);
#ifdef GTA3_1_1_PATCH
@@ -648,7 +648,7 @@ void CParticle::Shutdown()
#endif
}
- for ( Int32 i = 0; i < MAX_RAINSPLASHUP_FILES; i++ )
+ for ( int32 i = 0; i < MAX_RAINSPLASHUP_FILES; i++ )
{
RwTextureDestroy(gpRainSplashupTex[i]);
#ifdef GTA3_1_1_PATCH
@@ -656,7 +656,7 @@ void CParticle::Shutdown()
#endif
}
- for ( Int32 i = 0; i < MAX_BIRDFRONT_FILES; i++ )
+ for ( int32 i = 0; i < MAX_BIRDFRONT_FILES; i++ )
{
RwTextureDestroy(gpBirdfrontTex[i]);
#ifdef GTA3_1_1_PATCH
@@ -664,7 +664,7 @@ void CParticle::Shutdown()
#endif
}
- for ( Int32 i = 0; i < MAX_CARDEBRIS_FILES; i++ )
+ for ( int32 i = 0; i < MAX_CARDEBRIS_FILES; i++ )
{
RwTextureDestroy(gpCarDebrisTex[i]);
#ifdef GTA3_1_1_PATCH
@@ -672,7 +672,7 @@ void CParticle::Shutdown()
#endif
}
- for ( Int32 i = 0; i < MAX_CARSPLASH_FILES; i++ )
+ for ( int32 i = 0; i < MAX_CARSPLASH_FILES; i++ )
{
RwTextureDestroy(gpCarSplashTex[i]);
#ifdef GTA3_1_1_PATCH
@@ -750,7 +750,7 @@ void CParticle::Shutdown()
gpPointlightTex = NULL;
#endif
- Int32 slot;
+ int32 slot;
slot = CTxdStore::FindTxdSlot("particle");
CTxdStore::RemoveTxdSlot(slot);
@@ -758,13 +758,13 @@ void CParticle::Shutdown()
debug("CParticle shut down");
}
-CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVector const &vecDir, CEntity *pEntity, Float fSize, Int32 nRotationSpeed, Int32 nRotation, Int32 nCurFrame, Int32 nLifeSpan)
+CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVector const &vecDir, CEntity *pEntity, float fSize, int32 nRotationSpeed, int32 nRotation, int32 nCurFrame, int32 nLifeSpan)
{
CRGBA color(0, 0, 0, 0);
return AddParticle(type, vecPos, vecDir, pEntity, fSize, color, nRotationSpeed, nRotation, nCurFrame, nLifeSpan);
}
-CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVector const &vecDir, CEntity *pEntity, Float fSize, RwRGBA const &color, Int32 nRotationSpeed, Int32 nRotation, Int32 nCurFrame, Int32 nLifeSpan)
+CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVector const &vecDir, CEntity *pEntity, float fSize, RwRGBA const &color, int32 nRotationSpeed, int32 nRotation, int32 nCurFrame, int32 nLifeSpan)
{
if ( CTimer::GetIsPaused() )
return NULL;
@@ -833,8 +833,8 @@ CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVe
if ( psystem->m_InitialColorVariation != 0 )
{
- Int32 ColorVariation = CGeneral::GetRandomNumberInRange(-psystem->m_InitialColorVariation, psystem->m_InitialColorVariation);
- //Float ColorVariation = CGeneral::GetRandomNumberInRange((Float)-psystem->m_InitialColorVariation, (Float)psystem->m_InitialColorVariation);
+ int32 ColorVariation = CGeneral::GetRandomNumberInRange(-psystem->m_InitialColorVariation, psystem->m_InitialColorVariation);
+ //Float ColorVariation = CGeneral::GetRandomNumberInRange((float)-psystem->m_InitialColorVariation, (float)psystem->m_InitialColorVariation);
pParticle->m_Color.red = clamp(pParticle->m_Color.red +
PERCENT(pParticle->m_Color.red, ColorVariation),
@@ -893,18 +893,18 @@ CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVe
if ( psystem->m_nLifeSpanErrorShape != 0 )
{
- Float randVal = ms_afRandTable[CGeneral::GetRandomNumber() % RAND_TABLE_SIZE];
+ float randVal = ms_afRandTable[CGeneral::GetRandomNumber() % RAND_TABLE_SIZE];
if ( randVal > 0.0f )
- pParticle->m_nTimeWhenWillBeDestroyed += Int32(Float(psystem->m_nLifeSpan) * randVal * Float(psystem->m_nLifeSpanErrorShape));
+ pParticle->m_nTimeWhenWillBeDestroyed += int32(float(psystem->m_nLifeSpan) * randVal * float(psystem->m_nLifeSpanErrorShape));
else
- pParticle->m_nTimeWhenWillBeDestroyed += Int32(Float(psystem->m_nLifeSpan) * randVal / Float(psystem->m_nLifeSpanErrorShape));
+ pParticle->m_nTimeWhenWillBeDestroyed += int32(float(psystem->m_nLifeSpan) * randVal / float(psystem->m_nLifeSpanErrorShape));
}
if ( psystem->Flags & ZCHECK_FIRST )
{
- static Bool bValidGroundFound = false;
+ static bool bValidGroundFound = false;
static CVector LastTestCoors;
- static Float LastTestGroundZ;
+ static float LastTestGroundZ;
if ( bValidGroundFound
&& vecPos.x == LastTestCoors.x
@@ -939,11 +939,11 @@ CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVe
if ( psystem->Flags & ZCHECK_BUMP )
{
- static Float Z_Ground = 0.0f;
+ static float Z_Ground = 0.0f;
if ( psystem->Flags & ZCHECK_BUMP_FIRST )
{
- Bool bZFound = false;
+ bool bZFound = false;
Z_Ground = CWorld::FindGroundZFor3DCoord(vecPos.x, vecPos.y, vecPos.z, (bool *)&bZFound);
@@ -1000,21 +1000,21 @@ void CParticle::Update()
CRGBA color(0, 0, 0, 0);
- Float fFricDeccel50 = pow(0.50f, CTimer::GetTimeStep());
- Float fFricDeccel80 = pow(0.80f, CTimer::GetTimeStep());
- Float fFricDeccel90 = pow(0.90f, CTimer::GetTimeStep());
- Float fFricDeccel95 = pow(0.95f, CTimer::GetTimeStep());
- Float fFricDeccel96 = pow(0.96f, CTimer::GetTimeStep());
- Float fFricDeccel99 = pow(0.99f, CTimer::GetTimeStep());
+ float fFricDeccel50 = pow(0.50f, CTimer::GetTimeStep());
+ float fFricDeccel80 = pow(0.80f, CTimer::GetTimeStep());
+ float fFricDeccel90 = pow(0.90f, CTimer::GetTimeStep());
+ float fFricDeccel95 = pow(0.95f, CTimer::GetTimeStep());
+ float fFricDeccel96 = pow(0.96f, CTimer::GetTimeStep());
+ float fFricDeccel99 = pow(0.99f, CTimer::GetTimeStep());
CParticleObject::UpdateAll();
- for ( Int32 i = 0; i < MAX_PARTICLES; i++ )
+ for ( int32 i = 0; i < MAX_PARTICLES; i++ )
{
tParticleSystemData *psystem = &mod_ParticleSystemManager.m_aParticles[i];
CParticle *particle = psystem->m_pParticles;
CParticle *prevParticle = NULL;
- Bool bRemoveParticle;
+ bool bRemoveParticle;
if ( particle == NULL )
continue;
@@ -1035,18 +1035,18 @@ void CParticle::Update()
{
if ( particle->m_nTimeWhenColorWillBeChanged > CTimer::GetTimeInMilliseconds() )
{
- Float colorMul = 1.0f - Float(particle->m_nTimeWhenColorWillBeChanged - CTimer::GetTimeInMilliseconds()) / Float(psystem->m_ColorFadeTime);
+ float colorMul = 1.0f - float(particle->m_nTimeWhenColorWillBeChanged - CTimer::GetTimeInMilliseconds()) / float(psystem->m_ColorFadeTime);
particle->m_Color.red = clamp(
- psystem->m_RenderColouring.red + Int32(Float(psystem->m_FadeDestinationColor.red - psystem->m_RenderColouring.red) * colorMul),
+ psystem->m_RenderColouring.red + int32(float(psystem->m_FadeDestinationColor.red - psystem->m_RenderColouring.red) * colorMul),
0, 255);
particle->m_Color.green = clamp(
- psystem->m_RenderColouring.green + Int32(Float(psystem->m_FadeDestinationColor.green - psystem->m_RenderColouring.green) * colorMul),
+ psystem->m_RenderColouring.green + int32(float(psystem->m_FadeDestinationColor.green - psystem->m_RenderColouring.green) * colorMul),
0, 255);
particle->m_Color.blue = clamp(
- psystem->m_RenderColouring.blue + Int32(Float(psystem->m_FadeDestinationColor.blue - psystem->m_RenderColouring.blue) * colorMul),
+ psystem->m_RenderColouring.blue + int32(float(psystem->m_FadeDestinationColor.blue - psystem->m_RenderColouring.blue) * colorMul),
0, 255);
}
else
@@ -1063,7 +1063,7 @@ void CParticle::Update()
}
}
- Float size = particle->m_fSize + particle->m_fExpansionRate;
+ float size = particle->m_fSize + particle->m_fExpansionRate;
if ( size < 0.0f )
{
@@ -1147,7 +1147,7 @@ void CParticle::Update()
{
bRemoveParticle = true;
- Int32 randVal = Int32(CGeneral::GetRandomNumber());
+ int32 randVal = int32(CGeneral::GetRandomNumber());
if ( randVal & 1 )
{
@@ -1188,11 +1188,11 @@ void CParticle::Update()
vecPosn.z += 1.0f;
Randomizer++;
- Int32 randVal = Int32(Randomizer & 7);
+ int32 randVal = int32(Randomizer & 7);
if ( randVal == 5 )
{
- Int32 randTime = Int32(CGeneral::GetRandomNumber());
+ int32 randTime = int32(CGeneral::GetRandomNumber());
CShadows::AddPermanentShadow(1, gpBloodPoolTex, &vecPosn,
0.1f, 0.0f, 0.0f, -0.1f,
@@ -1202,7 +1202,7 @@ void CParticle::Update()
}
else if ( randVal == 2 )
{
- Int32 randTime = Int32(CGeneral::GetRandomNumber());
+ int32 randTime = int32(CGeneral::GetRandomNumber());
CShadows::AddPermanentShadow(1, gpBloodPoolTex, &vecPosn,
0.2f, 0.0f, 0.0f, -0.2f,
@@ -1414,12 +1414,12 @@ void CParticle::Update()
if ( particle->m_fCurrentZRadius != 0.0f )
{
- Int32 nSinCosIndex = particle->m_nCurrentZRotation % (SIN_COS_TABLE_SIZE - 1);
+ int32 nSinCosIndex = particle->m_nCurrentZRotation % (SIN_COS_TABLE_SIZE - 1);
- Float fX = (m_CosTable[nSinCosIndex] - m_SinTable[nSinCosIndex])
+ float fX = (m_CosTable[nSinCosIndex] - m_SinTable[nSinCosIndex])
* particle->m_fCurrentZRadius;
- Float fY = (m_SinTable[nSinCosIndex] + m_CosTable[nSinCosIndex])
+ float fY = (m_SinTable[nSinCosIndex] + m_CosTable[nSinCosIndex])
* particle->m_fCurrentZRadius;
moveStep -= particle->m_vecParticleMovementOffset;
@@ -1446,15 +1446,15 @@ void CParticle::Render()
CSprite::InitSpriteBuffer2D();
- UInt32 flags = DRAW_OPAQUE;
+ uint32 flags = DRAW_OPAQUE;
RwRaster *prevFrame = NULL;
- for ( Int32 i = 0; i < MAX_PARTICLES; i++ )
+ for ( int32 i = 0; i < MAX_PARTICLES; i++ )
{
tParticleSystemData *psystem = &mod_ParticleSystemManager.m_aParticles[i];
- Bool particleBanned = false;
+ bool particleBanned = false;
CParticle *particle = psystem->m_pParticles;
@@ -1513,7 +1513,7 @@ void CParticle::Render()
while ( particle != NULL )
{
- Bool canDraw = true;
+ bool canDraw = true;
if ( particle->m_nAlpha == 0 )
canDraw = false;
@@ -1540,7 +1540,7 @@ void CParticle::Render()
particle->m_fSize * 63.0f,
particle->m_Color,
particle->m_nColorIntensity,
- (Float)particle->m_nRotation,
+ (float)particle->m_nRotation,
particle->m_nAlpha);
}
else
@@ -1561,8 +1561,8 @@ void CParticle::Render()
if ( canDraw )
{
CVector coors;
- Float w;
- Float h;
+ float w;
+ float h;
if ( CSprite::CalcScreenCoors(particle->m_vecPosition, coors, &w, &h, true) )
{
@@ -1578,13 +1578,13 @@ void CParticle::Render()
particle->m_Color.blue,
particle->m_nColorIntensity,
1.0f / coors.z,
- Float(particle->m_nRotation),
+ float(particle->m_nRotation),
particle->m_nAlpha);
}
else if ( psystem->Flags & SCREEN_TRAIL )
{
- Float fRotation;
- Float fTrailLength;
+ float fRotation;
+ float fTrailLength;
if ( particle->m_vecScreenPosition.x == 0.0f )
{
@@ -1599,12 +1599,12 @@ void CParticle::Render()
coors.y - particle->m_vecScreenPosition.y
);
- Float fDist = vecDist.Magnitude();
+ float fDist = vecDist.Magnitude();
fTrailLength = fDist;
//Float fRot = atan2( vecDist.x / fDist, sqrtf(1.0f - vecDist.x / fDist * (vecDist.x / fDist)) );
- Float fRot = asinf(vecDist.x / fDist);
+ float fRot = asinf(vecDist.x / fDist);
fRotation = fRot;
@@ -1616,9 +1616,9 @@ void CParticle::Render()
if ( fRotation < 0.0f )
fRotation += 360.0f;
- Float fSpeed = particle->m_vecVelocity.Magnitude();
+ float fSpeed = particle->m_vecVelocity.Magnitude();
- Float fNewTrailLength = fSpeed * CTimer::GetTimeStep() * w * 2.0f;
+ float fNewTrailLength = fSpeed * CTimer::GetTimeStep() * w * 2.0f;
if ( fDist > fNewTrailLength )
fTrailLength = fNewTrailLength;
@@ -1640,8 +1640,8 @@ void CParticle::Render()
else if ( psystem->Flags & SPEED_TRAIL )
{
CVector vecPrevPos = particle->m_vecPosition - particle->m_vecVelocity;
- Float fRotation;
- Float fTrailLength;
+ float fRotation;
+ float fTrailLength;
if ( CSprite::CalcScreenCoors(vecPrevPos, particle->m_vecScreenPosition, &fTrailLength, &fRotation, true) )
{
@@ -1651,12 +1651,12 @@ void CParticle::Render()
coors.y - particle->m_vecScreenPosition.y
);
- Float fDist = vecDist.Magnitude();
+ float fDist = vecDist.Magnitude();
fTrailLength = fDist;
//Float fRot = atan2(vecDist.x / fDist, sqrt(1.0f - vecDist.x / fDist * (vecDist.x / fDist)));
- Float fRot = asinf(vecDist.x / fDist);
+ float fRot = asinf(vecDist.x / fDist);
fRotation = fRot;
@@ -1687,7 +1687,7 @@ void CParticle::Render()
}
else if ( psystem->Flags & VERT_TRAIL )
{
- Float fTrailLength = fabsf(particle->m_vecVelocity.z * 10.0f);
+ float fTrailLength = fabsf(particle->m_vecVelocity.z * 10.0f);
CSprite::RenderBufferedOneXLUSprite(coors.x, coors.y, coors.z,
particle->m_fSize * w,
@@ -1772,7 +1772,7 @@ void CParticle::RemoveParticle(CParticle *pParticle, CParticle *pPrevParticle, t
m_pUnusedListHead = pParticle;
}
-void CParticle::AddJetExplosion(CVector const &vecPos, Float fPower, Float fSize)
+void CParticle::AddJetExplosion(CVector const &vecPos, float fPower, float fSize)
{
CRGBA color(240, 240, 240, 255);
@@ -1790,7 +1790,7 @@ void CParticle::AddJetExplosion(CVector const &vecPos, Float fPower, Float fSize
CVector vecStepPos = vecPos;
- for ( Int32 i = 0; i < Int32(fPower * 4.0f); i++ )
+ for ( int32 i = 0; i < int32(fPower * 4.0f); i++ )
{
AddParticle(PARTICLE_EXPLOSION_MFAST,
vecStepPos,
@@ -1837,7 +1837,7 @@ void CParticle::AddYardieDoorSmoke(CVector const &vecPos, CMatrix const &matMatr
CVector vecBasePos = matMatrix * (invMat * vecPos + CVector(0.0f, -1.0f, 0.5f));
- for ( Int32 i = 0; i < 5; i++ )
+ for ( int32 i = 0; i < 5; i++ )
{
CVector pos = vecBasePos;
diff --git a/src/render/Particle.h b/src/render/Particle.h
index 68e01879..5db91727 100644
--- a/src/render/Particle.h
+++ b/src/render/Particle.h
@@ -16,25 +16,25 @@ public:
CVector m_vecPosition;
CVector m_vecVelocity;
CVector m_vecScreenPosition;
- UInt32 m_nTimeWhenWillBeDestroyed;
- UInt32 m_nTimeWhenColorWillBeChanged;
- Float m_fZGround;
+ uint32 m_nTimeWhenWillBeDestroyed;
+ uint32 m_nTimeWhenColorWillBeChanged;
+ float m_fZGround;
CVector m_vecParticleMovementOffset;
- Int16 m_nCurrentZRotation;
- UInt16 m_nZRotationTimer;
- Float m_fCurrentZRadius;
- UInt16 m_nZRadiusTimer;
+ int16 m_nCurrentZRotation;
+ uint16 m_nZRotationTimer;
+ float m_fCurrentZRadius;
+ uint16 m_nZRadiusTimer;
char _pad0[2];
- Float m_fSize;
- Float m_fExpansionRate;
- UInt16 m_nFadeToBlackTimer;
- UInt16 m_nFadeAlphaTimer;
- UInt8 m_nColorIntensity;
- UInt8 m_nAlpha;
- UInt16 m_nCurrentFrame;
- Int16 m_nAnimationSpeedTimer;
- Int16 m_nRotationStep;
- Int16 m_nRotation;
+ float m_fSize;
+ float m_fExpansionRate;
+ uint16 m_nFadeToBlackTimer;
+ uint16 m_nFadeAlphaTimer;
+ uint8 m_nColorIntensity;
+ uint8 m_nAlpha;
+ uint16 m_nCurrentFrame;
+ int16 m_nAnimationSpeedTimer;
+ int16 m_nRotationStep;
+ int16 m_nRotation;
RwRGBA m_Color;
char _pad1[2];
CParticle *m_pNext;
@@ -49,24 +49,24 @@ public:
;
}
- //static Float ms_afRandTable[RAND_TABLE_SIZE];
- static Float (&ms_afRandTable)[RAND_TABLE_SIZE];
+ //static float ms_afRandTable[RAND_TABLE_SIZE];
+ static float (&ms_afRandTable)[RAND_TABLE_SIZE];
static CParticle *m_pUnusedListHead;
/*
- static Float m_SinTable[SIN_COS_TABLE_SIZE];
- static Float m_CosTable[SIN_COS_TABLE_SIZE];
+ static float m_SinTable[SIN_COS_TABLE_SIZE];
+ static float m_CosTable[SIN_COS_TABLE_SIZE];
*/
- static Float (&m_SinTable)[SIN_COS_TABLE_SIZE];
- static Float (&m_CosTable)[SIN_COS_TABLE_SIZE];
+ static float (&m_SinTable)[SIN_COS_TABLE_SIZE];
+ static float (&m_CosTable)[SIN_COS_TABLE_SIZE];
static void ReloadConfig();
static void Initialise();
static void Shutdown();
- static CParticle *AddParticle(tParticleType type, CVector const &vecPos, CVector const &vecDir, CEntity *pEntity = NULL, Float fSize = 0.0f, Int32 nRotationSpeed = 0, Int32 nRotation = 0, Int32 nCurFrame = 0, Int32 nLifeSpan = 0);
- static CParticle *AddParticle(tParticleType type, CVector const &vecPos, CVector const &vecDir, CEntity *pEntity, Float fSize, RwRGBA const &color, Int32 nRotationSpeed = 0, Int32 nRotation = 0, Int32 nCurFrame = 0, Int32 nLifeSpan = 0);
+ static CParticle *AddParticle(tParticleType type, CVector const &vecPos, CVector const &vecDir, CEntity *pEntity = NULL, float fSize = 0.0f, int32 nRotationSpeed = 0, int32 nRotation = 0, int32 nCurFrame = 0, int32 nLifeSpan = 0);
+ static CParticle *AddParticle(tParticleType type, CVector const &vecPos, CVector const &vecDir, CEntity *pEntity, float fSize, RwRGBA const &color, int32 nRotationSpeed = 0, int32 nRotation = 0, int32 nCurFrame = 0, int32 nLifeSpan = 0);
static void Update();
static void Render();
@@ -74,7 +74,7 @@ public:
static void RemovePSystem(tParticleType type);
static void RemoveParticle(CParticle *pParticle, CParticle *pPrevParticle, tParticleSystemData *pPSystemData);
- static inline void _Next(CParticle *&pParticle, CParticle *&pPrevParticle, tParticleSystemData *pPSystemData, Bool bRemoveParticle)
+ static inline void _Next(CParticle *&pParticle, CParticle *&pPrevParticle, tParticleSystemData *pPSystemData, bool bRemoveParticle)
{
if ( bRemoveParticle )
{
@@ -92,7 +92,7 @@ public:
}
}
- static void AddJetExplosion(CVector const &vecPos, Float fPower, Float fSize);
+ static void AddJetExplosion(CVector const &vecPos, float fPower, float fSize);
static void AddYardieDoorSmoke(CVector const &vecPos, CMatrix const &matMatrix);
};
diff --git a/src/render/ParticleMgr.cpp b/src/render/ParticleMgr.cpp
index 9757a6ca..15370b47 100644
--- a/src/render/ParticleMgr.cpp
+++ b/src/render/ParticleMgr.cpp
@@ -5,7 +5,7 @@
cParticleSystemMgr mod_ParticleSystemManager;
-const Char *ParticleFilename = "PARTICLE.CFG";
+const char *ParticleFilename = "PARTICLE.CFG";
//cParticleSystemMgr::cParticleSystemMgr()
void cParticleSystemMgr::ctor()
@@ -17,7 +17,7 @@ void cParticleSystemMgr::Initialise()
{
LoadParticleData();
- for ( Int32 i = 0; i < MAX_PARTICLES; i++ )
+ for ( int32 i = 0; i < MAX_PARTICLES; i++ )
m_aParticles[i].m_pParticles = NULL;
}
@@ -28,13 +28,13 @@ void cParticleSystemMgr::LoadParticleData()
CFileMgr::SetDir("");
tParticleSystemData *entry = NULL;
- Int32 type = PARTICLE_FIRST;
+ int32 type = PARTICLE_FIRST;
- Char *lineStart = (Char *)work_buff;
- Char *lineEnd = lineStart + 1;
+ char *lineStart = (char *)work_buff;
+ char *lineEnd = lineStart + 1;
- Char line[500];
- Char delims[4];
+ char line[500];
+ char delims[4];
while ( true )
{
@@ -44,7 +44,7 @@ void cParticleSystemMgr::LoadParticleData()
while ( *lineEnd != '\n' )
++lineEnd;
- Int32 lineLength = lineEnd - lineStart;
+ int32 lineLength = lineEnd - lineStart;
ASSERT(lineLength < 500);
@@ -57,11 +57,11 @@ void cParticleSystemMgr::LoadParticleData()
if ( *line != ';' )
{
- Int32 param = CFG_PARAM_FIRST;
+ int32 param = CFG_PARAM_FIRST;
strcpy(delims, " \t");
- Char *value = strtok(line, delims);
+ char *value = strtok(line, delims);
ASSERT(value != NULL);
diff --git a/src/render/ParticleMgr.h b/src/render/ParticleMgr.h
index a2dcbdb5..5e8da1e4 100644
--- a/src/render/ParticleMgr.h
+++ b/src/render/ParticleMgr.h
@@ -100,42 +100,42 @@ enum
struct tParticleSystemData
{
tParticleType m_Type;
- Char m_aName[20];
- Float m_fCreateRange;
- Float m_fDefaultInitialRadius;
- Float m_fExpansionRate;
- UInt16 m_nZRotationInitialAngle;
- Int16 m_nZRotationAngleChangeAmount;
- UInt16 m_nZRotationChangeTime;
- UInt16 m_nZRadiusChangeTime;
- Float m_fInitialZRadius;
- Float m_fZRadiusChangeAmount;
- UInt16 m_nFadeToBlackTime;
- Int16 m_nFadeToBlackAmount;
- UInt8 m_nFadeToBlackInitialIntensity;
- UInt8 m_nFadeAlphaInitialIntensity;
- UInt16 m_nFadeAlphaTime;
- Int16 m_nFadeAlphaAmount;
- UInt16 m_nStartAnimationFrame;
- UInt16 m_nFinalAnimationFrame;
- UInt16 m_nAnimationSpeed;
- UInt16 m_nRotationSpeed;
+ char m_aName[20];
+ float m_fCreateRange;
+ float m_fDefaultInitialRadius;
+ float m_fExpansionRate;
+ uint16 m_nZRotationInitialAngle;
+ int16 m_nZRotationAngleChangeAmount;
+ uint16 m_nZRotationChangeTime;
+ uint16 m_nZRadiusChangeTime;
+ float m_fInitialZRadius;
+ float m_fZRadiusChangeAmount;
+ uint16 m_nFadeToBlackTime;
+ int16 m_nFadeToBlackAmount;
+ uint8 m_nFadeToBlackInitialIntensity;
+ uint8 m_nFadeAlphaInitialIntensity;
+ uint16 m_nFadeAlphaTime;
+ int16 m_nFadeAlphaAmount;
+ uint16 m_nStartAnimationFrame;
+ uint16 m_nFinalAnimationFrame;
+ uint16 m_nAnimationSpeed;
+ uint16 m_nRotationSpeed;
char _pad1[2];
- Float m_fGravitationalAcceleration;
- Int32 m_nFrictionDecceleration;
- Int32 m_nLifeSpan;
- Float m_fPositionRandomError;
- Float m_fVelocityRandomError;
- Float m_fExpansionRateError;
- Int32 m_nRotationRateError;
- UInt32 m_nLifeSpanErrorShape;
- Float m_fTrailLengthMultiplier;
- UInt32 Flags;
+ float m_fGravitationalAcceleration;
+ int32 m_nFrictionDecceleration;
+ int32 m_nLifeSpan;
+ float m_fPositionRandomError;
+ float m_fVelocityRandomError;
+ float m_fExpansionRateError;
+ int32 m_nRotationRateError;
+ uint32 m_nLifeSpanErrorShape;
+ float m_fTrailLengthMultiplier;
+ uint32 Flags;
RwRGBA m_RenderColouring;
- UInt8 m_InitialColorVariation;
+ uint8 m_InitialColorVariation;
RwRGBA m_FadeDestinationColor;
char _pad2[3];
- UInt32 m_ColorFadeTime;
+ uint32 m_ColorFadeTime;
RwRaster **m_ppRaster;
CParticle *m_pParticles;
diff --git a/src/render/VisibilityPlugins.cpp b/src/render/VisibilityPlugins.cpp
index 5608c933..316a397c 100644
--- a/src/render/VisibilityPlugins.cpp
+++ b/src/render/VisibilityPlugins.cpp
@@ -49,6 +49,13 @@ CVisibilityPlugins::Initialise(void)
}
void
+CVisibilityPlugins::Shutdown(void)
+{
+ m_alphaList.Shutdown();
+ m_alphaEntityList.Shutdown();
+}
+
+void
CVisibilityPlugins::InitAlphaEntityList(void)
{
m_alphaEntityList.Clear();
@@ -822,6 +829,7 @@ CVisibilityPlugins::GetClumpAlpha(RpClump *clump)
STARTPATCHES
InjectHook(0x527E50, CVisibilityPlugins::Initialise, PATCH_JUMP);
+ InjectHook(0x527EA0, CVisibilityPlugins::Shutdown, PATCH_JUMP);
InjectHook(0x528F90, CVisibilityPlugins::InitAlphaEntityList, PATCH_JUMP);
InjectHook(0x528FF0, CVisibilityPlugins::InsertEntityIntoSortedList, PATCH_JUMP);
InjectHook(0x528F80, CVisibilityPlugins::InitAlphaAtomicList, PATCH_JUMP);
diff --git a/src/render/VisibilityPlugins.h b/src/render/VisibilityPlugins.h
index 89222dce..65d2675a 100644
--- a/src/render/VisibilityPlugins.h
+++ b/src/render/VisibilityPlugins.h
@@ -35,6 +35,7 @@ public:
static float &ms_pedFadeDist;
static void Initialise(void);
+ static void Shutdown(void);
static void InitAlphaEntityList(void);
static bool InsertEntityIntoSortedList(CEntity *e, float dist);
static void InitAlphaAtomicList(void);