summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2020-06-13 12:57:25 +0200
committerSergeanur <s.anureev@yandex.ua>2020-06-13 12:57:25 +0200
commitbeb6f3bf8057232a1b1b5a1673d22cff618e3a83 (patch)
treeaf3911f35d37096c87af30807b48679351f1b809 /src
parentminor fix (diff)
downloadre3-beb6f3bf8057232a1b1b5a1673d22cff618e3a83.tar
re3-beb6f3bf8057232a1b1b5a1673d22cff618e3a83.tar.gz
re3-beb6f3bf8057232a1b1b5a1673d22cff618e3a83.tar.bz2
re3-beb6f3bf8057232a1b1b5a1673d22cff618e3a83.tar.lz
re3-beb6f3bf8057232a1b1b5a1673d22cff618e3a83.tar.xz
re3-beb6f3bf8057232a1b1b5a1673d22cff618e3a83.tar.zst
re3-beb6f3bf8057232a1b1b5a1673d22cff618e3a83.zip
Diffstat (limited to '')
-rw-r--r--src/render/Fluff.cpp35
-rw-r--r--src/render/Hud.cpp10
-rw-r--r--src/weapons/BulletInfo.cpp3
3 files changed, 25 insertions, 23 deletions
diff --git a/src/render/Fluff.cpp b/src/render/Fluff.cpp
index 9f3f6929..d50bddd6 100644
--- a/src/render/Fluff.cpp
+++ b/src/render/Fluff.cpp
@@ -142,11 +142,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);
}
@@ -168,17 +168,17 @@ void CMovingThings::Update()
aMovingThings[i].Update();
}
- 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();
@@ -188,17 +188,17 @@ void CMovingThings::Update()
void CMovingThings::Render()
{
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();
@@ -297,7 +297,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] = ' ';
@@ -312,7 +313,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 = ". ";
@@ -618,16 +619,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;
}
}
@@ -654,7 +655,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)
{
diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp
index c7f61d5d..270cc07c 100644
--- a/src/render/Hud.cpp
+++ b/src/render/Hud.cpp
@@ -131,16 +131,16 @@ void CHud::Draw()
return;
if (m_Wants_To_Draw_Hud && !TheCamera.m_WideScreenOn) {
- bool DrawCrossHair = 0;
- bool DrawCrossHairPC = 0;
+ bool DrawCrossHair = false;
+ bool DrawCrossHairPC = false;
int32 WeaponType = FindPlayerPed()->m_weapons[FindPlayerPed()->m_currentWeapon].m_eWeaponType;
int32 Mode = TheCamera.Cams[TheCamera.ActiveCam].Mode;
if (Mode == CCam::MODE_SNIPER || Mode == CCam::MODE_ROCKETLAUNCHER || Mode == CCam::MODE_M16_1STPERSON || Mode == CCam::MODE_HELICANNON_1STPERSON)
- DrawCrossHair = 1;
+ DrawCrossHair = true;
if (Mode == CCam::MODE_M16_1STPERSON_RUNABOUT || Mode == CCam::MODE_ROCKETLAUNCHER_RUNABOUT || Mode == CCam::MODE_SNIPER_RUNABOUT)
- DrawCrossHairPC = 1;
+ DrawCrossHairPC = true;
/*
Draw Crosshairs
@@ -149,7 +149,7 @@ void CHud::Draw()
(!CPad::GetPad(0)->GetLookBehindForPed() || TheCamera.m_bPlayerIsInGarage) || Mode == CCam::MODE_1STPERSON_RUNABOUT) {
if (FindPlayerPed() && !FindPlayerPed()->EnteringCar()) {
if ((WeaponType >= WEAPONTYPE_COLT45 && WeaponType <= WEAPONTYPE_M16) || WeaponType == WEAPONTYPE_FLAMETHROWER)
- DrawCrossHairPC = 1;
+ DrawCrossHairPC = true;
}
}
diff --git a/src/weapons/BulletInfo.cpp b/src/weapons/BulletInfo.cpp
index 389e7486..26fc459d 100644
--- a/src/weapons/BulletInfo.cpp
+++ b/src/weapons/BulletInfo.cpp
@@ -22,6 +22,7 @@
#include "Weapon.h"
#include "WeaponInfo.h"
#include "World.h"
+#include "SurfaceTable.h"
#define BULLET_LIFETIME (1000)
#define NUM_PED_BLOOD_PARTICLES (8)
@@ -228,7 +229,7 @@ bool CBulletInfo::TestForSniperBullet(float x1, float x2, float y1, float y2, fl
#ifdef FIX_BUGS // original code is not going work anyway...
CColLine line(PlayerSniperBulletStart, PlayerSniperBulletEnd);
CColBox box;
- box.Set(CVector(x1, y1, z1), CVector(x2, y2, z2), 0, 0);
+ box.Set(CVector(x1, y1, z1), CVector(x2, y2, z2), SURFACE_DEFAULT, 0);
return CCollision::TestLineBox(line, box);
#else
float minP = 0.0f;