diff options
author | Sergeanur <s.anureev@yandex.ua> | 2020-06-15 16:44:47 +0200 |
---|---|---|
committer | Sergeanur <s.anureev@yandex.ua> | 2020-06-15 16:44:47 +0200 |
commit | 655eaa36ce4dfbe3c8f7d46097d87d513a384b5f (patch) | |
tree | aa16b934b8623fa16e0dcc149069a5e55115a345 /src/render/Fluff.cpp | |
parent | Fix vehicle cam. zoom values (diff) | |
parent | more cleanup (diff) | |
download | re3-655eaa36ce4dfbe3c8f7d46097d87d513a384b5f.tar re3-655eaa36ce4dfbe3c8f7d46097d87d513a384b5f.tar.gz re3-655eaa36ce4dfbe3c8f7d46097d87d513a384b5f.tar.bz2 re3-655eaa36ce4dfbe3c8f7d46097d87d513a384b5f.tar.lz re3-655eaa36ce4dfbe3c8f7d46097d87d513a384b5f.tar.xz re3-655eaa36ce4dfbe3c8f7d46097d87d513a384b5f.tar.zst re3-655eaa36ce4dfbe3c8f7d46097d87d513a384b5f.zip |
Diffstat (limited to 'src/render/Fluff.cpp')
-rw-r--r-- | src/render/Fluff.cpp | 35 |
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) { |