summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoreray orçunus <erayorcunus@gmail.com>2020-06-15 22:49:59 +0200
committereray orçunus <erayorcunus@gmail.com>2020-06-15 22:49:59 +0200
commit595576b151945b99b9c3311280420fe5ff02d6cf (patch)
tree0f8f8d41444ac1c1da2228dba5b644ff0dcc14d8 /src
parentPeds & fixes continues (diff)
parentMerge remote-tracking branch 'origin/master' into miami (diff)
downloadre3-595576b151945b99b9c3311280420fe5ff02d6cf.tar
re3-595576b151945b99b9c3311280420fe5ff02d6cf.tar.gz
re3-595576b151945b99b9c3311280420fe5ff02d6cf.tar.bz2
re3-595576b151945b99b9c3311280420fe5ff02d6cf.tar.lz
re3-595576b151945b99b9c3311280420fe5ff02d6cf.tar.xz
re3-595576b151945b99b9c3311280420fe5ff02d6cf.tar.zst
re3-595576b151945b99b9c3311280420fe5ff02d6cf.zip
Diffstat (limited to 'src')
-rw-r--r--src/core/Cam.cpp100
-rw-r--r--src/core/Camera.cpp7
-rw-r--r--src/core/Camera.h5
-rw-r--r--src/core/World.cpp2
-rw-r--r--src/render/Fluff.cpp35
-rw-r--r--src/render/Hud.cpp4
-rw-r--r--src/vehicles/Boat.cpp2
-rw-r--r--src/vehicles/Train.cpp4
-rw-r--r--src/weapons/BulletInfo.cpp3
9 files changed, 134 insertions, 28 deletions
diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp
index 5b784947..4bbfbcca 100644
--- a/src/core/Cam.cpp
+++ b/src/core/Cam.cpp
@@ -244,10 +244,18 @@ CCam::Process(void)
case MODE_PLAYER_FALLEN_WATER:
Process_Player_Fallen_Water(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
break;
-// case MODE_CAM_ON_TRAIN_ROOF:
-// case MODE_CAM_RUNNING_SIDE_TRAIN:
-// case MODE_BLOOD_ON_THE_TRACKS:
-// case MODE_IM_THE_PASSENGER_WOOWOO:
+/* case MODE_CAM_ON_TRAIN_ROOF:
+ Process_Cam_On_Train_Roof(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
+ break;
+ case MODE_CAM_RUNNING_SIDE_TRAIN:
+ Process_Cam_Running_Side_Train(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
+ break;
+ case MODE_BLOOD_ON_THE_TRACKS:
+ Process_Blood_On_The_Tracks(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
+ break;
+ case MODE_IM_THE_PASSENGER_WOOWOO:
+ Process_Im_The_Passenger_Woo_Woo(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
+ break;*/
case MODE_SYPHON_CRIM_IN_FRONT:
Process_Syphon_Crim_In_Front(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
break;
@@ -2742,7 +2750,7 @@ CCam::Process_1rstPersonPedOnPC(const CVector&, float TargetOrientation, float,
while(Beta >= PI) Beta -= 2*PI;
while(Beta < -PI) Beta += 2*PI;
if(Alpha > DEGTORAD(60.0f)) Alpha = DEGTORAD(60.0f);
- if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
+ else if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
TargetCoors.x = 3.0f * Cos(Alpha) * Cos(Beta) + Source.x;
TargetCoors.y = 3.0f * Cos(Alpha) * Sin(Beta) + Source.y;
@@ -4316,6 +4324,88 @@ CCam::ProcessArrestCamTwo(void)
}
+void
+CCam::Process_Im_The_Passenger_Woo_Woo(const CVector &CameraTarget, float TargetOrientation, float, float)
+{
+ FOV = 50.0f;
+
+ Source = CamTargetEntity->GetPosition();
+ Source.z += 2.5f;
+ Front = CamTargetEntity->GetForward();
+ Front.Normalise();
+ Source += 1.35f*Front;
+ float heading = CGeneral::GetATanOfXY(Front.x, Front.y) + DEGTORAD(45.0f);
+ Front.x = Cos(heading);
+ Front.y = Sin(heading);
+ Up = CamTargetEntity->GetUp();
+
+ GetVectorsReadyForRW();
+}
+
+void
+CCam::Process_Blood_On_The_Tracks(const CVector &CameraTarget, float TargetOrientation, float, float)
+{
+ FOV = 50.0f;
+
+ Source = CamTargetEntity->GetPosition();
+ Source.z += 5.45f;
+
+ static CVector Test = -CamTargetEntity->GetForward();
+#ifdef FIX_BUGS
+ if(ResetStatics){
+ Test = -CamTargetEntity->GetForward();
+ ResetStatics = false;
+ }
+#endif
+
+ Source.x += 19.45*Test.x;
+ Source.y += 19.45*Test.y;
+ Front = Test;
+ Front.Normalise();
+ Up = CamTargetEntity->GetUp();
+
+ GetVectorsReadyForRW();
+}
+
+void
+CCam::Process_Cam_Running_Side_Train(const CVector &CameraTarget, float TargetOrientation, float, float)
+{
+ FOV = 60.0f;
+
+ Source = CamTargetEntity->GetPosition();
+ Source.z += 4.0f;
+ CVector fwd = CamTargetEntity->GetForward();
+ float heading = CGeneral::GetATanOfXY(fwd.x, fwd.y) - DEGTORAD(15.0f);
+ Source.x -= Cos(heading)*10.0f;
+ Source.y -= Sin(heading)*10.0f;
+ heading -= DEGTORAD(5.0f);
+ Front = fwd;
+ Front.x += Cos(heading);
+ Front.y += Sin(heading);
+ Front.z -= 0.056f;
+ Front.Normalise();
+ Up = CamTargetEntity->GetUp();
+
+ GetVectorsReadyForRW();
+}
+
+void
+CCam::Process_Cam_On_Train_Roof(const CVector &CameraTarget, float TargetOrientation, float, float)
+{
+ static float RoofMultiplier = 1.5f;
+
+ Source = CamTargetEntity->GetPosition();
+ Source.z += 4.8f;
+ Front = CamTargetEntity->GetForward();
+ Front.Normalise();
+ Source += Front*RoofMultiplier;
+ Up = CamTargetEntity->GetUp();
+ Up.Normalise();
+
+ GetVectorsReadyForRW();
+}
+
+
#ifdef FREE_CAM
void
CCam::Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrientation, float, float)
diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp
index 6d25c6d1..7ff61026 100644
--- a/src/core/Camera.cpp
+++ b/src/core/Camera.cpp
@@ -2974,6 +2974,13 @@ CCamera::Process_Train_Camera_Control(void)
if(node >= m_uiNumberOfTrainCamNodes)
node = 0;
}
+#ifdef FIX_BUGS
+ // Not really a bug but be nice and respect the debug mode
+ if(DebugCamMode){
+ TakeControl(target, DebugCamMode, JUMP_CUT, CAMCONTROL_SCRIPT);
+ return;
+ }
+#endif
if(found){
SetWideScreenOn();
diff --git a/src/core/Camera.h b/src/core/Camera.h
index 7a95f75a..e56fcd9d 100644
--- a/src/core/Camera.h
+++ b/src/core/Camera.h
@@ -240,6 +240,11 @@ public:
bool GetLookFromLampPostPos(CEntity *Target, CPed *Cop, CVector &TargetCoors, CVector &SourceOut);
bool GetLookOverShoulderPos(CEntity *Target, CPed *Cop, CVector &TargetCoors, CVector &SourceOut);
+ void Process_Im_The_Passenger_Woo_Woo(const CVector& CameraTarget, float TargetOrientation, float, float);
+ void Process_Blood_On_The_Tracks(const CVector& CameraTarget, float TargetOrientation, float, float);
+ void Process_Cam_Running_Side_Train(const CVector& CameraTarget, float TargetOrientation, float, float);
+ void Process_Cam_On_Train_Roof(const CVector& CameraTarget, float TargetOrientation, float, float);
+
// custom stuff
void Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrientation, float, float);
void Process_FollowCar_SA(const CVector &CameraTarget, float TargetOrientation, float, float);
diff --git a/src/core/World.cpp b/src/core/World.cpp
index a44d3efc..8399161f 100644
--- a/src/core/World.cpp
+++ b/src/core/World.cpp
@@ -941,7 +941,7 @@ CWorld::TestSphereAgainstSectorList(CPtrList &list, CVector spherePos, float rad
if(e != entityToIgnore && e->bUsesCollision &&
!(ignoreSomeObjects && CameraToIgnoreThisObject(e))) {
- CVector diff = spherePos - e->GetPosition();
+ CVector diff = spherePos - e->GetBoundCentre();
float distance = diff.Magnitude();
if(e->GetBoundRadius() + radius > distance) {
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)
{
diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp
index 6df670a9..fe459b4a 100644
--- a/src/render/Hud.cpp
+++ b/src/render/Hud.cpp
@@ -154,8 +154,8 @@ 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;
CPlayerPed *playerPed = FindPlayerPed();
eWeaponType WeaponType = playerPed->GetWeapon()->m_eWeaponType;
diff --git a/src/vehicles/Boat.cpp b/src/vehicles/Boat.cpp
index 2da58ed7..63abba20 100644
--- a/src/vehicles/Boat.cpp
+++ b/src/vehicles/Boat.cpp
@@ -920,6 +920,8 @@ CBoat::AddWakePoint(CVector point)
}
m_avec2dWakePoints[0] = point;
m_afWakePointLifeTime[0] = 400.0f;
+ if(m_nNumWakePoints < ARRAY_SIZE(m_afWakePointLifeTime))
+ m_nNumWakePoints++;
}
}else{
m_avec2dWakePoints[0] = point;
diff --git a/src/vehicles/Train.cpp b/src/vehicles/Train.cpp
index 50f7cb1d..546f72c2 100644
--- a/src/vehicles/Train.cpp
+++ b/src/vehicles/Train.cpp
@@ -663,8 +663,8 @@ PlayAnnouncement(uint8 sound, uint8 station)
void
ProcessTrainAnnouncements(void)
{
- for (int i = 0; i < 3; i++) {
- for (int j = 0; j < 3; j++) {
+ for (int i = 0; i < ARRAY_SIZE(StationDist); i++) {
+ for (int j = 0; j < ARRAY_SIZE(EngineTrackPosition); j++) {
if (!bTrainArrivalAnnounced[i]) {
float preDist = StationDist[i] - 100.0f;
if (preDist < 0.0f)
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;