summaryrefslogtreecommitdiffstats
path: root/src/render
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/render/Hud.cpp36
-rw-r--r--src/render/Hud.h13
-rw-r--r--src/render/Particle.cpp4
-rw-r--r--src/render/WaterCannon.cpp4
4 files changed, 29 insertions, 28 deletions
diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp
index 63bf0b06..a6e6bccf 100644
--- a/src/render/Hud.cpp
+++ b/src/render/Hud.cpp
@@ -41,13 +41,13 @@ CRGBA ODDJOB_COLOR(89, 115, 150, 255);
CRGBA ODDJOB2_COLOR(156, 91, 40, 255);
CRGBA MISSIONTITLE_COLOR(220, 172, 2, 255);
-wchar CHud::m_HelpMessage[256];
-wchar CHud::m_LastHelpMessage[256];
+wchar CHud::m_HelpMessage[HELP_MSG_LENGTH];
+wchar CHud::m_LastHelpMessage[HELP_MSG_LENGTH];
uint32 CHud::m_HelpMessageState;
uint32 CHud::m_HelpMessageTimer;
int32 CHud::m_HelpMessageFadeTimer;
-wchar CHud::m_HelpMessageToPrint[256];
-float CHud::m_fHelpMessageTime;
+wchar CHud::m_HelpMessageToPrint[HELP_MSG_LENGTH];
+float CHud::m_HelpMessageDisplayTime;
bool CHud::m_HelpMessageQuick;
uint32 CHud::m_ZoneState;
int32 CHud::m_ZoneFadeTimer;
@@ -1047,14 +1047,14 @@ void CHud::DrawAfterFade()
return;
if (m_HelpMessage[0]) {
- if (!CMessages::WideStringCompare(m_HelpMessage, m_LastHelpMessage, 256)) {
+ if (!CMessages::WideStringCompare(m_HelpMessage, m_LastHelpMessage, HELP_MSG_LENGTH)) {
switch (m_HelpMessageState) {
case 0:
m_HelpMessageFadeTimer = 0;
m_HelpMessageState = 2;
m_HelpMessageTimer = 0;
- CMessages::WideStringCopy(m_HelpMessageToPrint, m_HelpMessage, 256);
- m_fHelpMessageTime = CMessages::GetWideStringLength(m_HelpMessage) * 0.05f + 3.0f;
+ CMessages::WideStringCopy(m_HelpMessageToPrint, m_HelpMessage, HELP_MSG_LENGTH);
+ m_HelpMessageDisplayTime = CMessages::GetWideStringLength(m_HelpMessage) * 0.05f + 3.0f;
if (TheCamera.m_ScreenReductionPercentage == 0.0f)
DMAudio.PlayFrontEndSound(SOUND_HUD, 0);
@@ -1069,7 +1069,7 @@ void CHud::DrawAfterFade()
default:
break;
}
- CMessages::WideStringCopy(m_LastHelpMessage, m_HelpMessage, 256);
+ CMessages::WideStringCopy(m_LastHelpMessage, m_HelpMessage, HELP_MSG_LENGTH);
}
float fAlpha = 225.0f;
@@ -1079,7 +1079,7 @@ void CHud::DrawAfterFade()
case 1:
fAlpha = 225.0f;
m_HelpMessageFadeTimer = 600;
- if (m_HelpMessageTimer > m_fHelpMessageTime * 1000.0f || m_HelpMessageQuick && m_HelpMessageTimer > 1500.0f) {
+ if (m_HelpMessageTimer > m_HelpMessageDisplayTime * 1000.0f || m_HelpMessageQuick && m_HelpMessageTimer > 1500.0f) {
m_HelpMessageFadeTimer = 600;
m_HelpMessageState = 3;
}
@@ -1105,7 +1105,7 @@ void CHud::DrawAfterFade()
if (m_HelpMessageFadeTimer < 0) {
m_HelpMessageState = 2;
m_HelpMessageFadeTimer = 0;
- CMessages::WideStringCopy(m_HelpMessageToPrint, m_LastHelpMessage, 256);
+ CMessages::WideStringCopy(m_HelpMessageToPrint, m_LastHelpMessage, HELP_MSG_LENGTH);
}
fAlpha = m_HelpMessageFadeTimer * 0.001f * 225.0f;
break;
@@ -1371,7 +1371,7 @@ void CHud::GetRidOfAllHudMessages()
m_ZoneNameTimer = 0;
m_pZoneName = nil;
- for (int i = 0; i < 256; i++) {
+ for (int i = 0; i < HELP_MSG_LENGTH; i++) {
m_HelpMessage[i] = 0;
m_LastHelpMessage[i] = 0;
m_HelpMessageToPrint[i] = 0;
@@ -1381,7 +1381,7 @@ void CHud::GetRidOfAllHudMessages()
m_HelpMessageFadeTimer = 0;
m_HelpMessageState = 0;
m_HelpMessageQuick = 0;
- m_fHelpMessageTime = 1.0f;
+ m_HelpMessageDisplayTime = 1.0f;
m_VehicleName = nil;
m_pLastVehicleName = nil;
m_pVehicleNameToPrint = nil;
@@ -1389,7 +1389,7 @@ void CHud::GetRidOfAllHudMessages()
m_VehicleFadeTimer = 0;
m_VehicleState = 0;
- for (int i = 0; i < 256; i++)
+ for (int i = 0; i < ARRAY_SIZE(m_Message); i++)
m_Message[i] = 0;
for (int i = 0; i < 6; i++) {
@@ -1464,7 +1464,7 @@ void CHud::ReInitialise() {
wchar LastBigMessage[6][128];
-void CHud::SetBigMessage(wchar *message, int16 style)
+void CHud::SetBigMessage(wchar *message, uint16 style)
{
int i = 0;
@@ -1495,10 +1495,10 @@ void CHud::SetBigMessage(wchar *message, int16 style)
void CHud::SetHelpMessage(wchar *message, bool quick)
{
if (!CReplay::IsPlayingBack()) {
- CMessages::WideStringCopy(m_HelpMessage, message, 256);
+ CMessages::WideStringCopy(m_HelpMessage, message, HELP_MSG_LENGTH);
CMessages::InsertPlayerControlKeysInString(m_HelpMessage);
- for (int i = 0; i < 256; i++) {
+ for (int i = 0; i < HELP_MSG_LENGTH; i++) {
m_LastHelpMessage[i] = 0;
}
@@ -1510,7 +1510,7 @@ void CHud::SetHelpMessage(wchar *message, bool quick)
void CHud::SetMessage(wchar *message)
{
int i = 0;
- for (i = 0; i < 256; i++) {
+ for (i = 0; i < ARRAY_SIZE(m_Message); i++) {
if (message[i] == 0)
break;
@@ -1522,7 +1522,7 @@ void CHud::SetMessage(wchar *message)
void CHud::SetPagerMessage(wchar *message)
{
int i = 0;
- for (i = 0; i < 256; i++) {
+ for (i = 0; i < ARRAY_SIZE(m_PagerMessage); i++) {
if (message[i] == 0)
break;
diff --git a/src/render/Hud.h b/src/render/Hud.h
index 701e47e2..bef73cc2 100644
--- a/src/render/Hud.h
+++ b/src/render/Hud.h
@@ -1,6 +1,8 @@
#pragma once
#include "Sprite2d.h"
+#define HELP_MSG_LENGTH 256
+
enum eItems
{
ITEM_NONE = -1,
@@ -36,14 +38,13 @@ class CHud
{
public:
static CSprite2d Sprites[NUM_HUD_SPRITES];
- static wchar m_HelpMessage[256];
- static wchar m_LastHelpMessage[256];
+ static wchar m_HelpMessage[HELP_MSG_LENGTH];
+ static wchar m_LastHelpMessage[HELP_MSG_LENGTH];
static uint32 m_HelpMessageState;
static uint32 m_HelpMessageTimer;
static int32 m_HelpMessageFadeTimer;
- static wchar m_HelpMessageToPrint[256];
- static float &m_HelpMessageDisplayTime;
- static float m_fHelpMessageTime;
+ static wchar m_HelpMessageToPrint[HELP_MSG_LENGTH];
+ static float m_HelpMessageDisplayTime;
static bool m_HelpMessageQuick;
static uint32 m_ZoneState;
static int32 m_ZoneFadeTimer;
@@ -88,7 +89,7 @@ public:
static void GetRidOfAllHudMessages();
static void Initialise();
static void ReInitialise();
- static void SetBigMessage(wchar *message, int16 style);
+ static void SetBigMessage(wchar *message, uint16 style);
static void SetHelpMessage(wchar *message, bool quick);
static void SetMessage(wchar *message);
static void SetPagerMessage(wchar *message);
diff --git a/src/render/Particle.cpp b/src/render/Particle.cpp
index a867ae13..acce946b 100644
--- a/src/render/Particle.cpp
+++ b/src/render/Particle.cpp
@@ -302,8 +302,8 @@ void CParticle::Initialise()
{
float angle = DEGTORAD(float(i) * float(360.0f / SIN_COS_TABLE_SIZE));
- m_SinTable[i] = Sin(angle);
- m_CosTable[i] = Cos(angle);
+ m_SinTable[i] = ::Sin(angle);
+ m_CosTable[i] = ::Cos(angle);
}
int32 slot = CTxdStore::FindTxdSlot("particle");
diff --git a/src/render/WaterCannon.cpp b/src/render/WaterCannon.cpp
index 2b34db37..f54b31b9 100644
--- a/src/render/WaterCannon.cpp
+++ b/src/render/WaterCannon.cpp
@@ -64,7 +64,7 @@ void CWaterCannon::Update_OncePerFrame(int16 index)
if (CTimer::GetTimeInMilliseconds() > m_nTimeCreated + WATERCANNON_LIFETIME )
{
- m_nCur = (m_nCur + 1) % -NUM_SEGMENTPOINTS;
+ m_nCur = (m_nCur + 1) % NUM_SEGMENTPOINTS;
m_abUsed[m_nCur] = false;
}
@@ -124,7 +124,7 @@ void CWaterCannon::Render(void)
RwIm3DVertexSetV(&WaterCannonVertices[2], v);
RwIm3DVertexSetV(&WaterCannonVertices[3], v);
- int16 pointA = m_nCur % -NUM_SEGMENTPOINTS;
+ int16 pointA = m_nCur % NUM_SEGMENTPOINTS;
int16 pointB = pointA - 1;
if ( (pointA - 1) < 0 )