summaryrefslogtreecommitdiffstats
path: root/src/render/Fluff.cpp
diff options
context:
space:
mode:
authorerorcun <erayorcunus@gmail.com>2020-06-16 22:02:21 +0200
committerGitHub <noreply@github.com>2020-06-16 22:02:21 +0200
commitd322a8033e07cf286891fdc165c7b77dfe6b762e (patch)
tree30a5d3a4181030ca731ae38f20df077a22b91e67 /src/render/Fluff.cpp
parentUpdate ModelIndices.h (diff)
parentfix crash-VC pickup scaling (diff)
downloadre3-d322a8033e07cf286891fdc165c7b77dfe6b762e.tar
re3-d322a8033e07cf286891fdc165c7b77dfe6b762e.tar.gz
re3-d322a8033e07cf286891fdc165c7b77dfe6b762e.tar.bz2
re3-d322a8033e07cf286891fdc165c7b77dfe6b762e.tar.lz
re3-d322a8033e07cf286891fdc165c7b77dfe6b762e.tar.xz
re3-d322a8033e07cf286891fdc165c7b77dfe6b762e.tar.zst
re3-d322a8033e07cf286891fdc165c7b77dfe6b762e.zip
Diffstat (limited to 'src/render/Fluff.cpp')
-rw-r--r--src/render/Fluff.cpp35
1 files changed, 18 insertions, 17 deletions
diff --git a/src/render/Fluff.cpp b/src/render/Fluff.cpp
index f0f4b25d..d851cae0 100644
--- a/src/render/Fluff.cpp
+++ b/src/render/Fluff.cpp
@@ -160,11 +160,11 @@ void CMovingThings::Init()
void CMovingThings::Shutdown()
{
int i;
- for (i = 0; i < 11; ++i)
+ for (i = 0; i < ARRAY_SIZE(aScrollBars); ++i)
aScrollBars[i].SetVisibility(false);
- for (i = 0; i < 2; ++i)
+ for (i = 0; i < ARRAY_SIZE(aTowerClocks); ++i)
aTowerClocks[i].SetVisibility(false);
- for (i = 0; i < 3; ++i)
+ for (i = 0; i < ARRAY_SIZE(aDigitalClocks); ++i)
aDigitalClocks[i].SetVisibility(false);
}
@@ -186,17 +186,17 @@ void CMovingThings::Update()
aMovingThings[i].Update();
}
/* I don't think these are done yet?
- for (i = 0; i < 11; ++i)
+ for (i = 0; i < ARRAY_SIZE(aScrollBars); ++i)
{
if (aScrollBars[i].IsVisible() || (CTimer::GetFrameCounter() + i) % 8 == 0)
aScrollBars[i].Update();
}
- for (i = 0; i < 2; ++i)
+ for (i = 0; i < ARRAY_SIZE(aTowerClocks); ++i)
{
if (aTowerClocks[i].IsVisible() || (CTimer::GetFrameCounter() + i) % 8 == 0)
aTowerClocks[i].Update();
}
- for (i = 0; i < 3; ++i)
+ for (i = 0; i < ARRAY_SIZE(aDigitalClocks); ++i)
{
if (aDigitalClocks[i].IsVisible() || (CTimer::GetFrameCounter() + i) % 8 == 0)
aDigitalClocks[i].Update();
@@ -209,17 +209,17 @@ void CMovingThings::Render()
CSmokeTrails::Update();
int i;
- for (i = 0; i < 11; ++i)
+ for (i = 0; i < ARRAY_SIZE(aScrollBars); ++i)
{
if (aScrollBars[i].IsVisible())
aScrollBars[i].Render();
}
- for (i = 0; i < 2; ++i)
+ for (i = 0; i < ARRAY_SIZE(aTowerClocks); ++i)
{
if (aTowerClocks[i].IsVisible())
aTowerClocks[i].Render();
}
- for (i = 0; i < 3; ++i)
+ for (i = 0; i < ARRAY_SIZE(aDigitalClocks); ++i)
{
if (aDigitalClocks[i].IsVisible())
aDigitalClocks[i].Render();
@@ -320,7 +320,8 @@ const char* FindDigitalClockMessage()
}
else
{
- int temperature = 13.0f - 6.0f * Cos((CClock::GetMinutes() + 60.0f * CClock::GetHours()) * 0.0043611112f - 1.0f);
+ // they didn't use rad2deg here because of 3.14
+ int temperature = 13.0f - 6.0f * Cos((CClock::GetMinutes() + 60.0f * CClock::GetHours()) / (4.0f * 180.0f / 3.14f) - 1.0f);
String_DigitalClock[0] = '0' + temperature / 10;
if (String_DigitalClock[0] == '0')
String_DigitalClock[0] = ' ';
@@ -335,7 +336,7 @@ const char* FindDigitalClockMessage()
// ---------- CScrollBar ----------
void CScrollBar::Init(CVector position, uint8 type, float sizeX, float sizeY, float sizeZ, uint8 red, uint8 green, uint8 blue, float scale)
{
- for (int i = 0; i < 40; ++i)
+ for (int i = 0; i < ARRAY_SIZE(m_MessageBar); ++i)
m_MessageBar[i] = 0;
m_pMessage = ". ";
@@ -641,16 +642,16 @@ void CScrollBar::Update()
}
// Scroll
- for (int i = 0; i < 39; i++)
+ for (int i = 0; i < ARRAY_SIZE(m_MessageBar)-1; i++)
m_MessageBar[i] = m_MessageBar[i + 1];
- m_MessageBar[39] = m_Counter < 5 ? ScrollCharSet[m_pMessage[m_MessageCurrentChar] - ' '][m_Counter] : 0;
+ m_MessageBar[ARRAY_SIZE(m_MessageBar)-1] = m_Counter < 5 ? ScrollCharSet[m_pMessage[m_MessageCurrentChar] - ' '][m_Counter] : 0;
// Introduce some random displaying glitches; signs aren't supposed to be perfect :P
switch (CGeneral::GetRandomNumber() & 0xFF)
{
- case 0x0D: m_MessageBar[39] = 0; break;
- case 0xE3: m_MessageBar[39] = 0xE3; break;
- case 0x64: m_MessageBar[39] = ~m_MessageBar[39]; break;
+ case 0x0D: m_MessageBar[ARRAY_SIZE(m_MessageBar)-1] = 0; break;
+ case 0xE3: m_MessageBar[ARRAY_SIZE(m_MessageBar)-1] = 0xE3; break;
+ case 0x64: m_MessageBar[ARRAY_SIZE(m_MessageBar)-1] = ~m_MessageBar[ARRAY_SIZE(m_MessageBar)-1]; break;
}
}
@@ -677,7 +678,7 @@ void CScrollBar::Render()
CVector coronaCoord, screenCoord;
float screenW, screenH;
- for (int i = 1; i < 40; ++i)
+ for (int i = 1; i < ARRAY_SIZE(m_MessageBar); ++i)
{
for (int j = 0; j < 5; ++j)
{