Merge branch 'miami' of https://github.com/GTAmodding/re3 into miami

This commit is contained in:
eray orçunus 2020-06-15 00:26:27 +03:00
commit ef4c8f53c5
14 changed files with 1463 additions and 1415 deletions

View File

@ -36,6 +36,8 @@ int16 CPickups::NumMessages;
int32 CPickups::aPickUpsCollected[NUMCOLLECTEDPICKUPS]; int32 CPickups::aPickUpsCollected[NUMCOLLECTEDPICKUPS];
int16 CPickups::CollectedPickUpIndex; int16 CPickups::CollectedPickUpIndex;
int32 CPickups::PlayerOnWeaponPickup;
// unused // unused
bool CPickups::bPickUpcamActivated; bool CPickups::bPickUpcamActivated;
CVehicle *CPickups::pPlayerVehicle; CVehicle *CPickups::pPlayerVehicle;

View File

@ -70,6 +70,8 @@ class CPickups
static int16 NumMessages; static int16 NumMessages;
static tPickupMessage aMessages[NUMPICKUPMESSAGES]; static tPickupMessage aMessages[NUMPICKUPMESSAGES];
public: public:
static int32 PlayerOnWeaponPickup;
static void Init(); static void Init();
static void Update(); static void Update();
static void RenderPickUpText(); static void RenderPickUpText();

File diff suppressed because it is too large Load Diff

View File

@ -20,6 +20,7 @@
#include "Replay.h" #include "Replay.h"
#include "CutsceneMgr.h" #include "CutsceneMgr.h"
#include "Renderer.h" #include "Renderer.h"
#include "Timecycle.h"
#include "MBlur.h" #include "MBlur.h"
#include "Text.h" #include "Text.h"
#include "Hud.h" #include "Hud.h"
@ -61,6 +62,8 @@ enum
CCamera TheCamera; CCamera TheCamera;
bool CCamera::m_bUseMouse3rdPerson = true; bool CCamera::m_bUseMouse3rdPerson = true;
bool bDidWeProcessAnyCinemaCam; bool bDidWeProcessAnyCinemaCam;
float CCamera::m_fMouseAccelHorzntl;
float CCamera::m_fMouseAccelVertical;
float CCamera::m_f3rdPersonCHairMultX; float CCamera::m_f3rdPersonCHairMultX;
float CCamera::m_f3rdPersonCHairMultY; float CCamera::m_f3rdPersonCHairMultY;
@ -75,26 +78,16 @@ float CCamera::m_f3rdPersonCHairMultY;
CCamera::CCamera(void) CCamera::CCamera(void)
{ {
#ifdef GTA3_1_1_PATCH
m_fMouseAccelHorzntl = 0.0025f;
m_fMouseAccelVertical = 0.003f;
#endif
Init(); Init();
} }
//--MIAMI: done
void void
CCamera::Init(void) CCamera::Init(void)
{ {
#ifdef GTA3_1_1_PATCH
float fMouseAccelHorzntl = m_fMouseAccelHorzntl;
float fMouseAccelVertical = m_fMouseAccelVertical;
#endif
memset(this, 0, sizeof(CCamera)); // this is fine, no vtable memset(this, 0, sizeof(CCamera)); // this is fine, no vtable
#ifdef GTA3_1_1_PATCH
m_fMouseAccelHorzntl = fMouseAccelHorzntl;
m_fMouseAccelVertical = fMouseAccelVertical;
#endif
m_pRwCamera = nil; m_pRwCamera = nil;
m_bPlayerWasOnBike = false;
m_1rstPersonRunCloseToAWall = false; m_1rstPersonRunCloseToAWall = false;
m_fPositionAlongSpline = 0.0f; m_fPositionAlongSpline = 0.0f;
m_bCameraJustRestored = false; m_bCameraJustRestored = false;
@ -103,8 +96,22 @@ CCamera::Init(void)
Cams[2].Init(); Cams[2].Init();
Cams[0].Mode = CCam::MODE_FOLLOWPED; Cams[0].Mode = CCam::MODE_FOLLOWPED;
Cams[1].Mode = CCam::MODE_FOLLOWPED; Cams[1].Mode = CCam::MODE_FOLLOWPED;
unknown = 0; m_bEnable1rstPersonCamCntrlsScript = false;
m_bJustJumpedOutOf1stPersonBecauseOfTarget = 0; m_bAllow1rstPersonWeaponsCamera = false;
m_bVehicleSuspenHigh = false;
Cams[0].m_fMinRealGroundDist = 1.85f;
// TODO: what weird value is this?
Cams[0].m_fTargetCloseInDist = 2.0837801f - Cams[0].m_fMinRealGroundDist;
Cams[0].m_fTargetZoomGroundOne = 0.25f;
Cams[0].m_fTargetZoomGroundTwo = 1.5f;
Cams[0].m_fTargetZoomGroundThree = 4.0f;
Cams[0].m_fTargetZoomOneZExtra = -0.14f;
Cams[0].m_fTargetZoomTwoZExtra = 0.16f;
Cams[0].m_fTargetZoomThreeZExtra = 0.25f;
// TODO: another weird value
Cams[0].m_fTargetZoomZCloseIn = 0.90040702f;
m_bMoveCamToAvoidGeom = false;
SetMotionBlur(CTimeCycle::GetBlurRed(), CTimeCycle::GetBlurGreen(), CTimeCycle::GetBlurBlue(), m_motionBlur, MBLUR_NORMAL);
ClearPlayerWeaponMode(); ClearPlayerWeaponMode();
m_bInATunnelAndABigVehicle = false; m_bInATunnelAndABigVehicle = false;
m_iModeObbeCamIsInForCar = OBBE_INVALID; m_iModeObbeCamIsInForCar = OBBE_INVALID;
@ -122,8 +129,8 @@ CCamera::Init(void)
Cams[1].m_fPlayerVelocity = 0.0f; Cams[1].m_fPlayerVelocity = 0.0f;
Cams[2].m_fPlayerVelocity = 0.0f; Cams[2].m_fPlayerVelocity = 0.0f;
m_bHeadBob = false; m_bHeadBob = false;
m_fFractionInterToStopMovingTarget = 0.25f; m_fFractionInterToStopMoving = 0.25f;
m_fFractionInterToStopCatchUpTarget = 0.75f; m_fFractionInterToStopCatchUp = 0.75f;
m_fGaitSwayBuffer = 0.85f; m_fGaitSwayBuffer = 0.85f;
m_bScriptParametersSetForInterPol = false; m_bScriptParametersSetForInterPol = false;
m_uiCamShakeStart = 0; m_uiCamShakeStart = 0;
@ -168,10 +175,11 @@ CCamera::Init(void)
m_bMusicFading = false; m_bMusicFading = false;
m_fTimeToFadeMusic = 0.0f; m_fTimeToFadeMusic = 0.0f;
m_fFLOATingFadeMusic = 0.0f; m_fFLOATingFadeMusic = 0.0f;
m_fMouseAccelHorzntl = 0.003f;
m_fMouseAccelVertical = 0.0025f;
} }
m_bMoveCamToAvoidGeom = false;
if(FrontEndMenuManager.m_bWantToRestart) if(FrontEndMenuManager.m_bWantToRestart)
m_bMoveCamToAvoidGeom = true; m_fTimeToFadeMusic = 0.0f;
m_bStartingSpline = false; m_bStartingSpline = false;
m_iTypeOfSwitch = INTERPOLATION; m_iTypeOfSwitch = INTERPOLATION;
m_bUseScriptZoomValuePed = false; m_bUseScriptZoomValuePed = false;
@ -190,6 +198,8 @@ CCamera::Init(void)
m_uiTimeLastChange = 0; m_uiTimeLastChange = 0;
m_uiTimeWeEnteredIdle = 0; m_uiTimeWeEnteredIdle = 0;
m_bIdleOn = false; m_bIdleOn = false;
m_uiTimeWeLeftIdle_StillNoInput = 0;
m_uiTimeWeEnteredIdle = 0;
LODDistMultiplier = 1.0f; LODDistMultiplier = 1.0f;
m_bCamDirectlyBehind = false; m_bCamDirectlyBehind = false;
m_bCamDirectlyInFront = false; m_bCamDirectlyInFront = false;
@ -209,12 +219,10 @@ CCamera::Init(void)
m_uiTransitionState = 0; m_uiTransitionState = 0;
m_uiTimeTransitionStart = 0; m_uiTimeTransitionStart = 0;
m_bLookingAtPlayer = true; m_bLookingAtPlayer = true;
#ifndef GTA3_1_1_PATCH
m_fMouseAccelHorzntl = 0.0025f;
m_fMouseAccelVertical = 0.003f;
#endif
m_f3rdPersonCHairMultX = 0.53f; m_f3rdPersonCHairMultX = 0.53f;
m_f3rdPersonCHairMultY = 0.4f; m_f3rdPersonCHairMultY = 0.4f;
m_fAvoidTheGeometryProbsTimer = 0.0f;
m_nAvoidTheGeometryProbsDirn = 0;
} }
void void
@ -322,12 +330,12 @@ CCamera::Process(void)
currentTime = m_uiTransitionDuration; currentTime = m_uiTransitionDuration;
float fractionInter = (float) currentTime / m_uiTransitionDuration; float fractionInter = (float) currentTime / m_uiTransitionDuration;
if(fractionInter <= m_fFractionInterToStopMovingTarget){ if(fractionInter <= m_fFractionInterToStopMoving){
float inter; float inter;
if(m_fFractionInterToStopMovingTarget == 0.0f) if(m_fFractionInterToStopMoving == 0.0f)
inter = 0.0f; inter = 0.0f;
else else
inter = (m_fFractionInterToStopMovingTarget - fractionInter)/m_fFractionInterToStopMovingTarget; inter = (m_fFractionInterToStopMoving - fractionInter)/m_fFractionInterToStopMoving;
inter = 0.5f - 0.5*Cos(inter*PI); // smooth it inter = 0.5f - 0.5*Cos(inter*PI); // smooth it
m_vecSourceWhenInterPol = m_cvecStartingSourceForInterPol + inter*m_cvecSourceSpeedAtStartInter; m_vecSourceWhenInterPol = m_cvecStartingSourceForInterPol + inter*m_cvecSourceSpeedAtStartInter;
@ -381,12 +389,12 @@ CCamera::Process(void)
} }
CamUp.Normalise(); CamUp.Normalise();
FOV = m_fFOVWhenInterPol; FOV = m_fFOVWhenInterPol;
}else if(fractionInter > m_fFractionInterToStopMovingTarget && fractionInter <= 1.0f){ }else if(fractionInter > m_fFractionInterToStopMoving && fractionInter <= 1.0f){
float inter; float inter;
if(m_fFractionInterToStopCatchUpTarget == 0.0f) if(m_fFractionInterToStopCatchUp == 0.0f)
inter = 0.0f; inter = 0.0f;
else else
inter = (fractionInter - m_fFractionInterToStopMovingTarget)/m_fFractionInterToStopCatchUpTarget; inter = (fractionInter - m_fFractionInterToStopMoving)/m_fFractionInterToStopCatchUp;
inter = 0.5f - 0.5*Cos(inter*PI); // smooth it inter = 0.5f - 0.5*Cos(inter*PI); // smooth it
CamSource = m_vecSourceWhenInterPol + inter*(Cams[ActiveCam].Source - m_vecSourceWhenInterPol); CamSource = m_vecSourceWhenInterPol + inter*(Cams[ActiveCam].Source - m_vecSourceWhenInterPol);
@ -1610,7 +1618,7 @@ CCamera::UpdateSoundDistances(void)
} }
f = (n + 1) / 6.0f; f = (n + 1) / 6.0f;
SoundDistUp = (1.0f-f)*SoundDistUpAsReadOld + f*SoundDistUpAsRead; SoundDistUp = (1.0f-f)*SoundDistUpAsReadOld + f*SoundDistUpAsRead;
/*
// check left // check left
n = (CTimer::GetFrameCounter()+2) % 12; n = (CTimer::GetFrameCounter()+2) % 12;
if(n == 0){ if(n == 0){
@ -1637,6 +1645,7 @@ CCamera::UpdateSoundDistances(void)
} }
f = (n + 1) / 6.0f; f = (n + 1) / 6.0f;
SoundDistRight = (1.0f-f)*SoundDistRightAsReadOld + f*SoundDistRightAsRead; SoundDistRight = (1.0f-f)*SoundDistRightAsReadOld + f*SoundDistRightAsRead;
*/
} }
void void
@ -1681,6 +1690,129 @@ CamShakeNoPos(CCamera *cam, float strength)
} }
} }
bool bAvoidTest1 = false;
bool bAvoidTest2 = false; // unused
bool bAvoidTest3 = false; // unused
float fRangePlayerRadius = 0.5f;
float fCloseNearClipLimit = 0.15f;
float fAvoidTweakFOV = 1.15f;
float fAvoidProbTimerDamp = 0.9f;
//--MIAMI: done
void
CCamera::AvoidTheGeometry(const CVector &Source, const CVector &TargetPos, CVector &NewSource, float FOV)
{
float Beta = 0.0f;
float Alpha = 0.0f;
CVector vDist = TargetPos - Source;
m_vecClearGeometryVec = CVector(0.0f, 0.0f, 0.0f);
float fDist = vDist.Magnitude();
float fDistOnGround = vDist.Magnitude2D();
if(vDist.x == 0.0f && vDist.y == 0.0f)
Beta = CGeneral::GetATanOfXY(GetForward().x, GetForward().y);
else
Beta = CGeneral::GetATanOfXY(vDist.x, vDist.y);
if(fDistOnGround != 0.0f || vDist.z != 0.0f)
Alpha = CGeneral::GetATanOfXY(fDistOnGround, vDist.z);
CVector Front(Cos(Alpha)*Cos(Beta), Cos(Alpha)*Sin(Beta), Sin(Alpha));
NewSource = TargetPos - Front*fDist;
Front.Normalise();
// Clip camera source
CColPoint point;
CEntity *entity = nil;
CWorld::pIgnoreEntity = pTargetEntity;
if(CWorld::ProcessLineOfSight(TargetPos, NewSource, point, entity, true, false, false, true, false, false, true)){
CVector ClipPoint1 = point.point;
NewSource = point.point;
if(!bAvoidTest1){
if(CWorld::ProcessLineOfSight(NewSource, TargetPos, point, entity, false, true, true, true, false, false, true)){
if((NewSource - point.point).Magnitude() < RwCameraGetNearClipPlane(Scene.camera))
NewSource = point.point;
else if((NewSource - ClipPoint1).Magnitude() < RwCameraGetNearClipPlane(Scene.camera))
NewSource = ClipPoint1;
}
}
}
CWorld::pIgnoreEntity = nil;
vDist = TargetPos - NewSource;
fDist = vDist.Magnitude();
if(FindPlayerPed())
if(fDist - fRangePlayerRadius < RwCameraGetNearClipPlane(Scene.camera))
RwCameraSetNearClipPlane(Scene.camera, Max(fDist - fRangePlayerRadius, fCloseNearClipLimit));
static float fClearGeomAmount;
static float fClearGeomAmountSpeed;
float Near = RwCameraGetNearClipPlane(Scene.camera);
float ViewPlaneHeight = Tan(DEGTORAD(FOV) / 2.0f);
float ViewPlaneWidth = ViewPlaneHeight * CDraw::CalculateAspectRatio() * fAvoidTweakFOV;
CVector Center = NewSource + Front*Near;
float fClearGeomTarget = 0.0f;
if(CWorld::TestSphereAgainstWorld(Center, ViewPlaneWidth, nil, true, false, false, true, false, true)){
CVector CamToCol = gaTempSphereColPoints[0].point - NewSource;
float FrontDist = DotProduct(CamToCol, Front);
CVector CenterToCol = gaTempSphereColPoints[0].point - Center;
if(FrontDist < DEFAULT_NEAR && FrontDist > fCloseNearClipLimit){
if(FrontDist < RwCameraGetNearClipPlane(Scene.camera))
RwCameraSetNearClipPlane(Scene.camera, FrontDist);
}else if(FrontDist < fCloseNearClipLimit)
RwCameraSetNearClipPlane(Scene.camera, fCloseNearClipLimit);
float ColDepth = ViewPlaneWidth - CenterToCol.Magnitude(); // amount of radius in collision
CenterToCol.Normalise();
CVector Normal = gaTempSphereColPoints[0].normal;
Normal.Normalise();
if(-DotProduct(CenterToCol, Normal) < 0.0f)
Normal = -Normal; // always push away from col surface
float DistToMove = DotProduct(-ColDepth*CenterToCol, Normal);
m_vecClearGeometryVec = DistToMove*Normal; // move source so this point is out of collision
if(pTargetEntity && pTargetEntity->IsPed() && RwCameraGetNearClipPlane(Scene.camera) < 2.0f*fCloseNearClipLimit){
float TargetNormalDir = DotProduct(Normal, pTargetEntity->GetForward());
if(TargetNormalDir < 0.0f){
// target looking towards collision
if(m_fAvoidTheGeometryProbsTimer < 0.0f)
m_fAvoidTheGeometryProbsTimer = 0.0f;
m_fAvoidTheGeometryProbsTimer += CTimer::GetTimeStep();
}else if(TargetNormalDir > 0.5f){
// target looking away from collision
if(m_fAvoidTheGeometryProbsTimer > 0.0f)
m_fAvoidTheGeometryProbsTimer = 0.0f;
m_fAvoidTheGeometryProbsTimer -= CTimer::GetTimeStep();
}
if(m_nAvoidTheGeometryProbsDirn == 0){
if(CrossProduct(pTargetEntity->GetPosition() - NewSource, Normal).z > 0.0f)
m_nAvoidTheGeometryProbsDirn = -1;
else
m_nAvoidTheGeometryProbsDirn = 1;
}
}
fClearGeomTarget = 1.0f;
}
m_fAvoidTheGeometryProbsTimer *= Pow(fAvoidProbTimerDamp, CTimer::GetTimeStep());
WellBufferMe(fClearGeomTarget, &fClearGeomAmount, &fClearGeomAmountSpeed, 0.2f, 0.05f, false);
m_vecClearGeometryVec *= fClearGeomAmount;
m_bMoveCamToAvoidGeom = true;
}
void
CCamera::GetArrPosForVehicleType(int apperance, int &index)
{
switch(apperance){
case VEHICLE_APPEARANCE_CAR: index = 0; break;
case VEHICLE_APPEARANCE_BIKE: index = 1; break;
case VEHICLE_APPEARANCE_HELI: index = 2; break;
case VEHICLE_APPEARANCE_PLANE: index = 3; break;
case VEHICLE_APPEARANCE_BOAT: index = 4; break;
}
}
void void
@ -1828,28 +1960,25 @@ CCamera::SetCamPositionForFixedMode(const CVector &Source, const CVector &UpOffS
} }
//--MIAMI: done
/*
* On PS2 the transition happens between Cams[1] and Cams[2].
* On PC the whole system has been changed.
*/
void void
CCamera::StartTransition(int16 newMode) CCamera::StartTransition(int16 newMode)
{ {
bool foo = false; bool switchFromFixedSyphon = false;
bool switchSyphonMode = false; bool switchSyphonMode = false;
bool switchPedToCar = false;
bool switchPedMode = false; bool switchPedMode = false;
bool switchPedToCar = false;
bool switchFromFight = false;
bool switchBikeToPed = false;
bool switchFromFixed = false; bool switchFromFixed = false;
bool switch1stPersonToVehicle = false; bool switch1stPersonToVehicle = false;
float betaOffset, targetBeta, camBeta, deltaBeta; float betaOffset, targetBeta, camBeta, deltaBeta;
int door; int door;
bool vehicleVertical; bool vehicleVertical;
// missing on PS2
m_bItsOkToLookJustAtThePlayer = false; m_bItsOkToLookJustAtThePlayer = false;
m_fFractionInterToStopMovingTarget = 0.25f; m_fFractionInterToStopMoving = 0.25f;
m_fFractionInterToStopCatchUpTarget = 0.75f; m_fFractionInterToStopCatchUp = 0.75f;
if(Cams[ActiveCam].Mode == CCam::MODE_SYPHON_CRIM_IN_FRONT || if(Cams[ActiveCam].Mode == CCam::MODE_SYPHON_CRIM_IN_FRONT ||
Cams[ActiveCam].Mode == CCam::MODE_FOLLOWPED || Cams[ActiveCam].Mode == CCam::MODE_FOLLOWPED ||
@ -1859,16 +1988,19 @@ CCamera::StartTransition(int16 newMode)
newMode == CCam::MODE_FOLLOWPED || newMode == CCam::MODE_FOLLOWPED ||
newMode == CCam::MODE_SYPHON || newMode == CCam::MODE_SYPHON ||
newMode == CCam::MODE_SPECIAL_FIXED_FOR_SYPHON) newMode == CCam::MODE_SPECIAL_FIXED_FOR_SYPHON)
m_bItsOkToLookJustAtThePlayer = true; switchPedMode = true;
if(newMode == CCam::MODE_CAM_ON_A_STRING) if(newMode == CCam::MODE_CAM_ON_A_STRING)
switchPedToCar = true; switchPedToCar = true;
} }
//
if(Cams[ActiveCam].Mode == CCam::MODE_SPECIAL_FIXED_FOR_SYPHON)
switchFromFixedSyphon = true;
if(Cams[ActiveCam].Mode == CCam::MODE_CAM_ON_A_STRING && newMode == CCam::MODE_FOLLOWPED && m_bPlayerWasOnBike)
switchBikeToPed = true;
if(Cams[ActiveCam].Mode == CCam::MODE_SYPHON_CRIM_IN_FRONT && newMode == CCam::MODE_SYPHON) if(Cams[ActiveCam].Mode == CCam::MODE_SYPHON_CRIM_IN_FRONT && newMode == CCam::MODE_SYPHON)
switchSyphonMode = true; switchSyphonMode = true;
if(Cams[ActiveCam].Mode == CCam::MODE_FIGHT_CAM && newMode == CCam::MODE_FOLLOWPED) if(Cams[ActiveCam].Mode == CCam::MODE_FIGHT_CAM && newMode == CCam::MODE_FOLLOWPED)
switchPedMode = true; switchFromFight = true;
if(Cams[ActiveCam].Mode == CCam::MODE_FIXED) if(Cams[ActiveCam].Mode == CCam::MODE_FIXED)
switchFromFixed = true; switchFromFixed = true;
@ -1889,12 +2021,6 @@ CCamera::StartTransition(int16 newMode)
((CPed*)pTargetEntity)->m_fRotationDest = angle; ((CPed*)pTargetEntity)->m_fRotationDest = angle;
} }
/* // PS2
ActiveCam = (ActiveCam+1)%2;
Cams[ActiveCam].Init();
Cams[ActiveCam].Mode = newMode;
*/
Cams[ActiveCam].m_cvecCamFixedModeVector = m_vecFixedModeVector; Cams[ActiveCam].m_cvecCamFixedModeVector = m_vecFixedModeVector;
Cams[ActiveCam].CamTargetEntity = pTargetEntity; Cams[ActiveCam].CamTargetEntity = pTargetEntity;
Cams[ActiveCam].m_cvecCamFixedModeSource = m_vecFixedModeSource; Cams[ActiveCam].m_cvecCamFixedModeSource = m_vecFixedModeSource;
@ -1909,16 +2035,17 @@ CCamera::StartTransition(int16 newMode)
newMode == CCam::MODE_1STPERSON_RUNABOUT || newMode == CCam::MODE_1STPERSON_RUNABOUT ||
newMode == CCam::MODE_M16_1STPERSON_RUNABOUT || newMode == CCam::MODE_M16_1STPERSON_RUNABOUT ||
newMode == CCam::MODE_FIGHT_CAM_RUNABOUT || newMode == CCam::MODE_FIGHT_CAM_RUNABOUT ||
newMode == CCam::MODE_HELICANNON_1STPERSON) newMode == CCam::MODE_HELICANNON_1STPERSON ||
newMode == CCam::MODE_CAMERA)
Cams[ActiveCam].Alpha = 0.0f; Cams[ActiveCam].Alpha = 0.0f;
// PS2 also copies values to ActiveCam here
switch(Cams[ActiveCam].Mode) switch(Cams[ActiveCam].Mode)
case CCam::MODE_SNIPER_RUNABOUT: case CCam::MODE_SNIPER_RUNABOUT:
case CCam::MODE_ROCKETLAUNCHER_RUNABOUT: case CCam::MODE_ROCKETLAUNCHER_RUNABOUT:
case CCam::MODE_1STPERSON_RUNABOUT: case CCam::MODE_1STPERSON_RUNABOUT:
case CCam::MODE_M16_1STPERSON_RUNABOUT: case CCam::MODE_M16_1STPERSON_RUNABOUT:
case CCam::MODE_FIGHT_CAM_RUNABOUT: case CCam::MODE_FIGHT_CAM_RUNABOUT:
case CCam::MODE_CAMERA:
if(newMode == CCam::MODE_CAM_ON_A_STRING || newMode == CCam::MODE_BEHINDBOAT) if(newMode == CCam::MODE_CAM_ON_A_STRING || newMode == CCam::MODE_BEHINDBOAT)
switch1stPersonToVehicle = true; switch1stPersonToVehicle = true;
@ -1932,16 +2059,6 @@ CCamera::StartTransition(int16 newMode)
betaOffset = DEGTORAD(55.0f); betaOffset = DEGTORAD(55.0f);
if(m_bJustCameOutOfGarage){ if(m_bJustCameOutOfGarage){
m_bUseTransitionBeta = true; m_bUseTransitionBeta = true;
/*
// weird logic...
if(CMenuManager::m_ControlMethod == CONTROL_CLASSIC)
Cams[ActiveCam].m_fTransitionBeta = CGeneral::GetATanOfXY(Cams[ActiveCam].Front.x, Cams[ActiveCam].Front.y) + PI;
else if(Cams[ActiveCam].Front.x != 0.0f && Cams[ActiveCam].Front.y != 0.0f) // && is wrong here
Cams[ActiveCam].m_fTransitionBeta = CGeneral::GetATanOfXY(Cams[ActiveCam].Front.x, Cams[ActiveCam].Front.y) + PI;
else
Cams[ActiveCam].m_fTransitionBeta = 0.0f;
*/
// this is better:
if(Cams[ActiveCam].Front.x != 0.0f || Cams[ActiveCam].Front.y != 0.0f) if(Cams[ActiveCam].Front.x != 0.0f || Cams[ActiveCam].Front.y != 0.0f)
Cams[ActiveCam].m_fTransitionBeta = CGeneral::GetATanOfXY(Cams[ActiveCam].Front.x, Cams[ActiveCam].Front.y) + PI; Cams[ActiveCam].m_fTransitionBeta = CGeneral::GetATanOfXY(Cams[ActiveCam].Front.x, Cams[ActiveCam].Front.y) + PI;
else else
@ -2010,6 +2127,7 @@ CCamera::StartTransition(int16 newMode)
case CCam::MODE_M16_1STPERSON_RUNABOUT: case CCam::MODE_M16_1STPERSON_RUNABOUT:
case CCam::MODE_FIGHT_CAM_RUNABOUT: case CCam::MODE_FIGHT_CAM_RUNABOUT:
case CCam::MODE_HELICANNON_1STPERSON: case CCam::MODE_HELICANNON_1STPERSON:
case CCam::MODE_CAMERA:
if(FindPlayerVehicle()) if(FindPlayerVehicle())
Cams[ActiveCam].Beta = Atan2(FindPlayerVehicle()->GetForward().x, FindPlayerVehicle()->GetForward().y); Cams[ActiveCam].Beta = Atan2(FindPlayerVehicle()->GetForward().x, FindPlayerVehicle()->GetForward().y);
else else
@ -2027,42 +2145,7 @@ CCamera::StartTransition(int16 newMode)
if(!m_bLookingAtPlayer || m_bJustCameOutOfGarage) if(!m_bLookingAtPlayer || m_bJustCameOutOfGarage)
break; break;
m_bUseTransitionBeta = true; m_bUseTransitionBeta = true;
targetBeta = CGeneral::GetATanOfXY(pTargetEntity->GetForward().x, pTargetEntity->GetForward().y); Cams[ActiveCam].m_fTransitionBeta = CGeneral::GetATanOfXY(Cams[ActiveCam].Front.x, Cams[ActiveCam].Front.y);
camBeta = CGeneral::GetATanOfXY(Cams[ActiveCam].Front.x, Cams[ActiveCam].Front.y);
deltaBeta = targetBeta - camBeta;
while(deltaBeta >= PI) deltaBeta -= 2*PI;
while(deltaBeta < -PI) deltaBeta += 2*PI;
deltaBeta = Abs(deltaBeta);
// switchFromFixed logic again here, skipped
if(switchFromFixed){
Cams[ActiveCam].m_fTransitionBeta = CGeneral::GetATanOfXY(Cams[ActiveCam].Front.x, Cams[ActiveCam].Front.y);
break;
}
door = FindPlayerPed()->m_vehEnterType;
if(deltaBeta > HALFPI){
if(((CVehicle*)pTargetEntity)->IsUpsideDown()){
if(door == CAR_DOOR_LF || door == CAR_DOOR_LR) // BUG: game checks LF twice
betaOffset = -DEGTORAD(57.0f);
}else{
if(door == CAR_DOOR_RF || door == CAR_DOOR_RR)
betaOffset = -DEGTORAD(57.0f);
}
Cams[ActiveCam].m_fTransitionBeta = targetBeta + betaOffset + PI;
}else{
if(((CVehicle*)pTargetEntity)->IsUpsideDown()){
if(door == CAR_DOOR_RF || door == CAR_DOOR_RR)
betaOffset = -DEGTORAD(57.0f);
else if(door == CAR_DOOR_LF || door == CAR_DOOR_LR)
betaOffset = DEGTORAD(57.0f);
}else{
if(door == CAR_DOOR_LF || door == CAR_DOOR_LR)
betaOffset = -DEGTORAD(57.0f);
else if(door == CAR_DOOR_RF || door == CAR_DOOR_RR)
betaOffset = DEGTORAD(57.0f);
}
Cams[ActiveCam].m_fTransitionBeta = targetBeta + betaOffset;
}
break; break;
case CCam::MODE_BEHINDBOAT: case CCam::MODE_BEHINDBOAT:
@ -2087,27 +2170,34 @@ CCamera::StartTransition(int16 newMode)
m_uiTransitionDuration = 1350; m_uiTransitionDuration = 1350;
if(switchSyphonMode) if(switchSyphonMode)
m_uiTransitionDuration = 1800; m_uiTransitionDuration = 1800;
else if(switchPedMode) else if(switchFromFight)
m_uiTransitionDuration = 750; m_uiTransitionDuration = 750;
// not on PS2
else if(switchPedToCar){ else if(switchPedToCar){
m_fFractionInterToStopMovingTarget = 0.2f; m_fFractionInterToStopMoving = 0.1f;
m_fFractionInterToStopCatchUpTarget = 0.8f; m_fFractionInterToStopCatchUp = 0.9f;
m_uiTransitionDuration = 950; m_uiTransitionDuration = 750;
}else if(switchFromFixedSyphon){
m_fFractionInterToStopMoving = 0.0f;
m_fFractionInterToStopCatchUp = 1.0f;
m_uiTransitionDuration = 600;
}else if(switchFromFixed){ }else if(switchFromFixed){
m_fFractionInterToStopMovingTarget = 0.05f; m_fFractionInterToStopMoving = 0.05f;
m_fFractionInterToStopCatchUpTarget = 0.95f; m_fFractionInterToStopCatchUp = 0.95f;
}else if(switchBikeToPed){
m_uiTransitionDuration = 800;
}else if(switch1stPersonToVehicle){ }else if(switch1stPersonToVehicle){
m_fFractionInterToStopMovingTarget = 0.0f; m_fFractionInterToStopMoving = 0.0f;
m_fFractionInterToStopCatchUpTarget = 1.0f; m_fFractionInterToStopCatchUp = 1.0f;
m_uiTransitionDuration = 1; m_uiTransitionDuration = 1;
}else if(switchPedMode){
m_fFractionInterToStopMoving = 0.5f;
m_fFractionInterToStopCatchUp = 0.5f;
m_uiTransitionDuration = 350;
}else }else
m_uiTransitionDuration = 1350; // already set above m_uiTransitionDuration = 1350; // already set above
//
m_uiTransitionState = 1; m_uiTransitionState = 1;
m_uiTimeTransitionStart = CTimer::GetTimeInMilliseconds(); m_uiTimeTransitionStart = CTimer::GetTimeInMilliseconds();
m_uiTransitionJUSTStarted = 1; m_uiTransitionJUSTStarted = 1;
// PS2 returns here
if(m_vecDoingSpecialInterPolation){ if(m_vecDoingSpecialInterPolation){
m_cvecStartingSourceForInterPol = SourceDuringInter; m_cvecStartingSourceForInterPol = SourceDuringInter;
m_cvecStartingTargetForInterPol = TargetDuringInter; m_cvecStartingTargetForInterPol = TargetDuringInter;
@ -2138,10 +2228,22 @@ CCamera::StartTransition(int16 newMode)
m_fBetaSpeedAtStartInter = Cams[ActiveCam].m_fBetaSpeedOverOneFrame; m_fBetaSpeedAtStartInter = Cams[ActiveCam].m_fBetaSpeedOverOneFrame;
m_fFOVSpeedAtStartInter = Cams[ActiveCam].m_fFovSpeedOverOneFrame; m_fFOVSpeedAtStartInter = Cams[ActiveCam].m_fFovSpeedOverOneFrame;
Cams[ActiveCam].ResetStatics = true; Cams[ActiveCam].ResetStatics = true;
if(!m_bLookingAtPlayer && m_bScriptParametersSetForInterPol){ if(m_bLookingAtPlayer){
m_fFractionInterToStopMovingTarget = m_fScriptPercentageInterToStopMoving; if(switchPedMode)
m_fFractionInterToStopCatchUpTarget = m_fScriptPercentageInterToCatchUp; m_uiTransitionDurationTargetCoors = 350;
m_uiTransitionDuration = m_fScriptTimeForInterPolation; else
m_uiTransitionDurationTargetCoors = 600;
m_fFractionInterToStopMovingTarget = 0.0f;
m_fFractionInterToStopCatchUpTarget = 1.0f;
}else{
if(m_bScriptParametersSetForInterPol){
m_fFractionInterToStopMoving = m_fScriptPercentageInterToStopMoving;
m_fFractionInterToStopCatchUp = m_fScriptPercentageInterToCatchUp;
m_uiTransitionDuration = m_fScriptTimeForInterPolation;
}
m_uiTransitionDurationTargetCoors = m_uiTransitionDuration;
m_fFractionInterToStopMovingTarget = m_fFractionInterToStopMoving;
m_fFractionInterToStopCatchUpTarget = m_fFractionInterToStopCatchUp;
} }
} }

View File

@ -123,7 +123,6 @@ public:
float f_Roll; //used for adding a slight roll to the camera in the float f_Roll; //used for adding a slight roll to the camera in the
float f_rollSpeed; float f_rollSpeed;
float m_fSyphonModeTargetZOffSet; float m_fSyphonModeTargetZOffSet;
float m_fRoadOffSet;
float m_fAmountFractionObscured; float m_fAmountFractionObscured;
float m_fAlphaSpeedOverOneFrame; float m_fAlphaSpeedOverOneFrame;
float m_fBetaSpeedOverOneFrame; float m_fBetaSpeedOverOneFrame;
@ -146,7 +145,8 @@ public:
float m_fRealGroundDist; //used for follow ped mode float m_fRealGroundDist; //used for follow ped mode
float m_fTargetBeta; float m_fTargetBeta;
float m_fTimeElapsedFloat; float m_fTimeElapsedFloat;
float m_fTilt;
float m_fTiltSpeed;
float m_fTransitionBeta; float m_fTransitionBeta;
float m_fTrueBeta; float m_fTrueBeta;
float m_fTrueAlpha; float m_fTrueAlpha;
@ -164,6 +164,16 @@ public:
float CA_MAX_DISTANCE; float CA_MAX_DISTANCE;
float SpeedVar; float SpeedVar;
float m_fTargetZoomGroundOne;
float m_fTargetZoomGroundTwo;
float m_fTargetZoomGroundThree;
float m_fTargetZoomOneZExtra;
float m_fTargetZoomTwoZExtra;
float m_fTargetZoomThreeZExtra;
float m_fTargetZoomZCloseIn;
float m_fMinRealGroundDist;
float m_fTargetCloseInDist;
CVector m_cvecSourceSpeedOverOneFrame; CVector m_cvecSourceSpeedOverOneFrame;
CVector m_cvecTargetSpeedOverOneFrame; CVector m_cvecTargetSpeedOverOneFrame;
CVector m_cvecUpOverOneFrame; CVector m_cvecUpOverOneFrame;
@ -198,10 +208,8 @@ public:
void GetVectorsReadyForRW(void); void GetVectorsReadyForRW(void);
CVector DoAverageOnVector(const CVector &vec); CVector DoAverageOnVector(const CVector &vec);
float GetPedBetaAngleForClearView(const CVector &Target, float Dist, float BetaOffset, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies); float GetPedBetaAngleForClearView(const CVector &Target, float Dist, float BetaOffset, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies);
void WorkOutCamHeightWeeCar(CVector &TargetCoors, float TargetOrientation);
void WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, float TargetHeight); void WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, float TargetHeight);
bool RotCamIfInFrontCar(CVector &TargetCoors, float TargetOrientation); bool RotCamIfInFrontCar(CVector &TargetCoors, float TargetOrientation);
bool FixCamIfObscured(CVector &TargetCoors, float TargetHeight, float TargetOrientation);
void Cam_On_A_String_Unobscured(const CVector &TargetCoors, float BaseDist); void Cam_On_A_String_Unobscured(const CVector &TargetCoors, float BaseDist);
void FixCamWhenObscuredByVehicle(const CVector &TargetCoors); void FixCamWhenObscuredByVehicle(const CVector &TargetCoors);
void LookBehind(void); void LookBehind(void);
@ -234,37 +242,23 @@ public:
void Process_BehindBoat(const CVector &CameraTarget, float TargetOrientation, float, float); void Process_BehindBoat(const CVector &CameraTarget, float TargetOrientation, float, float);
void Process_Fight_Cam(const CVector &CameraTarget, float TargetOrientation, float, float); void Process_Fight_Cam(const CVector &CameraTarget, float TargetOrientation, float, float);
void Process_FlyBy(const CVector&, float, float, float); void Process_FlyBy(const CVector&, float, float, float);
void Process_WheelCam(const CVector&, float, float, float); bool Process_WheelCam(const CVector&, float, float, float);
void Process_Fixed(const CVector &CameraTarget, float, float, float); void Process_Fixed(const CVector &CameraTarget, float, float, float);
void Process_Player_Fallen_Water(const CVector &CameraTarget, float TargetOrientation, float, float); void Process_Player_Fallen_Water(const CVector &CameraTarget, float TargetOrientation, float, float);
void Process_Circle(const CVector &CameraTarget, float, float, float);
void Process_SpecialFixedForSyphon(const CVector &CameraTarget, float, float, float); void Process_SpecialFixedForSyphon(const CVector &CameraTarget, float, float, float);
void Process_LightHouse(const CVector &CameraTarget, float, float, float);
void ProcessPedsDeadBaby(void); void ProcessPedsDeadBaby(void);
bool ProcessArrestCamOne(void); bool ProcessArrestCamOne(void);
bool ProcessArrestCamTwo(void); bool ProcessArrestCamTwo(void);
bool GetLookAlongGroundPos(CEntity *Target, CPed *Cop, CVector &TargetCoors, CVector &SourceOut);
/* Some of the unused PS2 cams */ bool GetLookFromLampPostPos(CEntity *Target, CPed *Cop, CVector &TargetCoors, CVector &SourceOut);
void Process_Chris_With_Binding_PlusRotation(const CVector &CameraTarget, float, float, float); bool GetLookOverShoulderPos(CEntity *Target, CPed *Cop, CVector &TargetCoors, CVector &SourceOut);
void Process_ReactionCam(const CVector &CameraTarget, float TargetOrientation, float, float);
void Process_FollowPed_WithBinding(const CVector &CameraTarget, float TargetOrientation, float, float);
// TODO:
// CCam::Process_CushyPillows_Arse
// CCam::Process_Look_At_Cars
// CCam::Process_CheesyZoom
// CCam::Process_Aiming
// CCam::Process_Bill // same as BehindCar due to unused variables
// CCam::Process_Im_The_Passenger_Woo_Woo
// CCam::Process_Blood_On_The_Tracks
// CCam::Process_Cam_Running_Side_Train
// CCam::Process_Cam_On_Train_Roof
// custom stuff // custom stuff
void Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrientation, float, float); void Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrientation, float, float);
void Process_FollowCar_SA(const CVector &CameraTarget, float TargetOrientation, float, float); void Process_FollowCar_SA(const CVector &CameraTarget, float TargetOrientation, float, float);
}; };
VALIDATE_SIZE(CCam, 0x1A4);
class CCamPathSplines class CCamPathSplines
{ {
public: public:
@ -358,6 +352,7 @@ public:
bool m_bInitialNoNodeStaticsSet; bool m_bInitialNoNodeStaticsSet;
bool m_bIgnoreFadingStuffForMusic; bool m_bIgnoreFadingStuffForMusic;
bool m_bPlayerIsInGarage; bool m_bPlayerIsInGarage;
bool m_bPlayerWasOnBike;
bool m_bJustCameOutOfGarage; bool m_bJustCameOutOfGarage;
bool m_bJustInitalised; bool m_bJustInitalised;
bool m_bJust_Switched; bool m_bJust_Switched;
@ -383,6 +378,8 @@ public:
bool m_1rstPersonRunCloseToAWall; bool m_1rstPersonRunCloseToAWall;
bool m_bHeadBob; bool m_bHeadBob;
bool m_bVehicleSuspenHigh; bool m_bVehicleSuspenHigh;
bool m_bEnable1rstPersonCamCntrlsScript;
bool m_bAllow1rstPersonWeaponsCamera;
bool m_bFailedCullZoneTestPreviously; bool m_bFailedCullZoneTestPreviously;
bool m_FadeTargetIsSplashScreen; bool m_FadeTargetIsSplashScreen;
@ -398,15 +395,16 @@ public:
uint8 m_uiTransitionState; // 0:one mode 1:transition uint8 m_uiTransitionState; // 0:one mode 1:transition
uint32 m_uiTimeLastChange; uint32 m_uiTimeLastChange;
uint32 m_uiTimeWeLeftIdle_StillNoInput;
uint32 m_uiTimeWeEnteredIdle; uint32 m_uiTimeWeEnteredIdle;
uint32 m_uiTimeTransitionStart; uint32 m_uiTimeTransitionStart;
uint32 m_uiTransitionDuration; uint32 m_uiTransitionDuration;
uint32 m_uiTransitionDurationTargetCoors;
int m_BlurBlue; int m_BlurBlue;
int m_BlurGreen; int m_BlurGreen;
int m_BlurRed; int m_BlurRed;
int m_BlurType; int m_BlurType;
uint32 unknown; // some counter having to do with music
int m_iWorkOutSpeedThisNumFrames; int m_iWorkOutSpeedThisNumFrames;
int m_iNumFramesSoFar; int m_iNumFramesSoFar;
@ -466,15 +464,16 @@ public:
float PedZoomIndicator; float PedZoomIndicator;
#endif #endif
float PlayerExhaustion; float PlayerExhaustion;
float SoundDistUp, SoundDistLeft, SoundDistRight; float SoundDistUp;
float SoundDistUpAsRead, SoundDistLeftAsRead, SoundDistRightAsRead; float SoundDistUpAsRead;
float SoundDistUpAsReadOld, SoundDistLeftAsReadOld, SoundDistRightAsReadOld; float SoundDistUpAsReadOld;
float m_fAvoidTheGeometryProbsTimer;
int16 m_nAvoidTheGeometryProbsDirn;
float m_fWideScreenReductionAmount; float m_fWideScreenReductionAmount;
float m_fStartingFOVForInterPol; float m_fStartingFOVForInterPol;
// not static yet static float m_fMouseAccelHorzntl;// acceleration multiplier for 1st person controls
float m_fMouseAccelHorzntl;// acceleration multiplier for 1st person controls static float m_fMouseAccelVertical;// acceleration multiplier for 1st person controls
float m_fMouseAccelVertical;// acceleration multiplier for 1st person controls
static float m_f3rdPersonCHairMultX; static float m_f3rdPersonCHairMultX;
static float m_f3rdPersonCHairMultY; static float m_f3rdPersonCHairMultY;
@ -501,7 +500,7 @@ public:
CVector m_vecSourceWhenInterPol; CVector m_vecSourceWhenInterPol;
CVector m_vecTargetWhenInterPol; CVector m_vecTargetWhenInterPol;
CVector m_vecUpWhenInterPol; CVector m_vecUpWhenInterPol;
CVector m_vecClearGeometryVec;
CVector m_vecGameCamPos; CVector m_vecGameCamPos;
CVector SourceDuringInter; CVector SourceDuringInter;
CVector TargetDuringInter; CVector TargetDuringInter;
@ -509,7 +508,9 @@ public:
RwCamera *m_pRwCamera; RwCamera *m_pRwCamera;
CEntity *pTargetEntity; CEntity *pTargetEntity;
CCamPathSplines m_arrPathArray[MAX_NUM_OF_SPLINETYPES]; CCamPathSplines m_arrPathArray[MAX_NUM_OF_SPLINETYPES];
#ifdef GTA_TRAIN
CTrainCamNode m_arrTrainCamNode[MAX_NUM_OF_NODES]; CTrainCamNode m_arrTrainCamNode[MAX_NUM_OF_NODES];
#endif
CMatrix m_cameraMatrix; CMatrix m_cameraMatrix;
bool m_bGarageFixedCamPositionSet; bool m_bGarageFixedCamPositionSet;
bool m_vecDoingSpecialInterPolation; bool m_vecDoingSpecialInterPolation;
@ -527,6 +528,8 @@ public:
float m_fFLOATingFadeMusic; float m_fFLOATingFadeMusic;
float m_fTimeToFadeOut; float m_fTimeToFadeOut;
float m_fTimeToFadeMusic; float m_fTimeToFadeMusic;
float m_fFractionInterToStopMoving;
float m_fFractionInterToStopCatchUp;
float m_fFractionInterToStopMovingTarget; float m_fFractionInterToStopMovingTarget;
float m_fFractionInterToStopCatchUpTarget; float m_fFractionInterToStopCatchUpTarget;
float m_fGaitSwayBuffer; float m_fGaitSwayBuffer;
@ -560,6 +563,8 @@ public:
void InitialiseCameraForDebugMode(void); void InitialiseCameraForDebugMode(void);
void CamShake(float strength, float x, float y, float z); void CamShake(float strength, float x, float y, float z);
bool Get_Just_Switched_Status() { return m_bJust_Switched; } bool Get_Just_Switched_Status() { return m_bJust_Switched; }
void AvoidTheGeometry(const CVector &Source, const CVector &TargetPos, CVector &NewSource, float FOV);
void GetArrPosForVehicleType(int apperance, int &index);
// Who's in control // Who's in control
void TakeControl(CEntity *target, int16 mode, int16 typeOfSwitch, int32 controller); void TakeControl(CEntity *target, int16 mode, int16 typeOfSwitch, int32 controller);

View File

@ -649,8 +649,8 @@ CWorld::GetIsLineOfSightSectorListClear(CPtrList &list, const CColLine &line, bo
} }
void void
CWorld::FindObjectsInRangeSectorList(CPtrList &list, Const CVector &centre, float radius, bool ignoreZ, short *nextObject, CWorld::FindObjectsInRangeSectorList(CPtrList &list, Const CVector &centre, float radius, bool ignoreZ, int16 *numObjects,
short lastObject, CEntity **objects) int16 lastObject, CEntity **objects)
{ {
float radiusSqr = radius * radius; float radiusSqr = radius * radius;
float objDistSqr; float objDistSqr;
@ -666,16 +666,16 @@ CWorld::FindObjectsInRangeSectorList(CPtrList &list, Const CVector &centre, floa
else else
objDistSqr = diff.MagnitudeSqr(); objDistSqr = diff.MagnitudeSqr();
if(objDistSqr < radiusSqr && *nextObject < lastObject) { if(objDistSqr < radiusSqr && *numObjects < lastObject) {
if(objects) { objects[*nextObject] = object; } if(objects) { objects[*numObjects] = object; }
(*nextObject)++; (*numObjects)++;
} }
} }
} }
} }
void void
CWorld::FindObjectsInRange(Const CVector &centre, float radius, bool ignoreZ, short *nextObject, short lastObject, CWorld::FindObjectsInRange(Const CVector &centre, float radius, bool ignoreZ, int16 *numObjects, int16 lastObject,
CEntity **objects, bool checkBuildings, bool checkVehicles, bool checkPeds, CEntity **objects, bool checkBuildings, bool checkVehicles, bool checkPeds,
bool checkObjects, bool checkDummies) bool checkObjects, bool checkDummies)
{ {
@ -701,39 +701,39 @@ CWorld::FindObjectsInRange(Const CVector &centre, float radius, bool ignoreZ, sh
AdvanceCurrentScanCode(); AdvanceCurrentScanCode();
*nextObject = 0; *numObjects = 0;
for(int curY = minY; curY <= maxY; curY++) { for(int curY = minY; curY <= maxY; curY++) {
for(int curX = minX; curX <= maxX; curX++) { for(int curX = minX; curX <= maxX; curX++) {
CSector *sector = GetSector(curX, curY); CSector *sector = GetSector(curX, curY);
if(checkBuildings) { if(checkBuildings) {
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_BUILDINGS], centre, radius, FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_BUILDINGS], centre, radius,
ignoreZ, nextObject, lastObject, objects); ignoreZ, numObjects, lastObject, objects);
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], centre, FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], centre,
radius, ignoreZ, nextObject, lastObject, objects); radius, ignoreZ, numObjects, lastObject, objects);
} }
if(checkVehicles) { if(checkVehicles) {
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_VEHICLES], centre, radius, FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_VEHICLES], centre, radius,
ignoreZ, nextObject, lastObject, objects); ignoreZ, numObjects, lastObject, objects);
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], centre, FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], centre,
radius, ignoreZ, nextObject, lastObject, objects); radius, ignoreZ, numObjects, lastObject, objects);
} }
if(checkPeds) { if(checkPeds) {
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_PEDS], centre, radius, ignoreZ, FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_PEDS], centre, radius, ignoreZ,
nextObject, lastObject, objects); numObjects, lastObject, objects);
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_PEDS_OVERLAP], centre, radius, FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_PEDS_OVERLAP], centre, radius,
ignoreZ, nextObject, lastObject, objects); ignoreZ, numObjects, lastObject, objects);
} }
if(checkObjects) { if(checkObjects) {
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_OBJECTS], centre, radius, FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_OBJECTS], centre, radius,
ignoreZ, nextObject, lastObject, objects); ignoreZ, numObjects, lastObject, objects);
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], centre, FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], centre,
radius, ignoreZ, nextObject, lastObject, objects); radius, ignoreZ, numObjects, lastObject, objects);
} }
if(checkDummies) { if(checkDummies) {
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_DUMMIES], centre, radius, FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_DUMMIES], centre, radius,
ignoreZ, nextObject, lastObject, objects); ignoreZ, numObjects, lastObject, objects);
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], centre, FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], centre,
radius, ignoreZ, nextObject, lastObject, objects); radius, ignoreZ, numObjects, lastObject, objects);
} }
} }
} }

View File

@ -103,8 +103,8 @@ public:
static CEntity *TestSphereAgainstWorld(CVector centre, float radius, CEntity *entityToIgnore, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSomeObjects); static CEntity *TestSphereAgainstWorld(CVector centre, float radius, CEntity *entityToIgnore, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSomeObjects);
static CEntity *TestSphereAgainstSectorList(CPtrList&, CVector, float, CEntity*, bool); static CEntity *TestSphereAgainstSectorList(CPtrList&, CVector, float, CEntity*, bool);
static void FindObjectsInRangeSectorList(CPtrList&, Const CVector&, float, bool, short*, short, CEntity**); static void FindObjectsInRangeSectorList(CPtrList &list, Const CVector &centre, float radius, bool ignoreZ, int16 *numObjects, int16 lastObject, CEntity **objects);
static void FindObjectsInRange(Const CVector&, float, bool, short*, short, CEntity**, bool, bool, bool, bool, bool); static void FindObjectsInRange(Const CVector &centre, float radius, bool ignoreZ, int16 *numObjects, int16 lastObject, CEntity **objects, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies);
static void FindObjectsOfTypeInRangeSectorList(uint32 modelId, CPtrList& list, const CVector& position, float radius, bool bCheck2DOnly, int16* nEntitiesFound, int16 maxEntitiesToFind, CEntity** aEntities); static void FindObjectsOfTypeInRangeSectorList(uint32 modelId, CPtrList& list, const CVector& position, float radius, bool bCheck2DOnly, int16* nEntitiesFound, int16 maxEntitiesToFind, CEntity** aEntities);
static void FindObjectsOfTypeInRange(uint32 modelId, const CVector& position, float radius, bool bCheck2DOnly, int16* nEntitiesFound, int16 maxEntitiesToFind, CEntity** aEntities, bool bBuildings, bool bVehicles, bool bPeds, bool bObjects, bool bDummies); static void FindObjectsOfTypeInRange(uint32 modelId, const CVector& position, float radius, bool bCheck2DOnly, int16* nEntitiesFound, int16 maxEntitiesToFind, CEntity** aEntities, bool bBuildings, bool bVehicles, bool bPeds, bool bObjects, bool bDummies);
static float FindGroundZForCoord(float x, float y); static float FindGroundZForCoord(float x, float y);

View File

@ -436,6 +436,21 @@ IsLightObject(int16 id)
id == MI_TRAFFICLIGHTS_TWOVERTICAL; id == MI_TRAFFICLIGHTS_TWOVERTICAL;
} }
inline bool
IsLampPost(int16 id)
{
return id == MI_SINGLESTREETLIGHTS1 ||
id == MI_SINGLESTREETLIGHTS2 ||
id == MI_SINGLESTREETLIGHTS3 ||
id == MI_BOLLARDLIGHT ||
id == MI_MLAMPPOST ||
id == MI_STREETLAMP1 ||
id == MI_STREETLAMP2 ||
id == MI_TELPOLE02 ||
id == MI_TRAFFICLIGHTS_MIAMI ||
id == MI_TRAFFICLIGHTS_TWOVERTICAL;
}
inline bool inline bool
IsBodyPart(int16 id) IsBodyPart(int16 id)
{ {

View File

@ -19847,7 +19847,7 @@ CPed::DriveVehicle(void)
} else if (targetUDLean > -1.0f) { } else if (targetUDLean > -1.0f) {
targetUDLean = bike->m_fLeanInput; targetUDLean = bike->m_fLeanInput;
bike->m_bike_flag80 = false; bike->bWheelieCam = false;
neededAngForWheelie = 1.0f; neededAngForWheelie = 1.0f;
if (bike->m_aWheelTimer[0] != 0.0f || bike->m_aWheelTimer[1] != 0.0f || bike->GetForward().z <= 0.0f || if (bike->m_aWheelTimer[0] != 0.0f || bike->m_aWheelTimer[1] != 0.0f || bike->GetForward().z <= 0.0f ||
(0.0f == bike->m_aWheelTimer[2] && 0.0f == bike->m_aWheelTimer[3])) { (0.0f == bike->m_aWheelTimer[2] && 0.0f == bike->m_aWheelTimer[3])) {
@ -19857,13 +19857,13 @@ CPed::DriveVehicle(void)
stoppieAng = bike->pBikeHandling->fStoppieAng; stoppieAng = bike->pBikeHandling->fStoppieAng;
if (stoppieAng - bike->GetForward().z > 0.6f * stoppieAng) if (stoppieAng - bike->GetForward().z > 0.6f * stoppieAng)
bike->m_bike_flag80 = true; bike->bWheelieCam = true;
} }
} else { } else {
float wheelieAng = bike->pBikeHandling->fWheelieAng; float wheelieAng = bike->pBikeHandling->fWheelieAng;
neededAngForWheelie = wheelieAng - bike->GetForward().z; neededAngForWheelie = wheelieAng - bike->GetForward().z;
if (neededAngForWheelie < wheelieAng / 2.f) if (neededAngForWheelie < wheelieAng / 2.f)
bike->m_bike_flag80 = true; bike->bWheelieCam = true;
} }
if (neededAngForWheelie >= 0.15f) { if (neededAngForWheelie >= 0.15f) {
if (bike->m_fBrakePedal <= 0.5f || velocityFwdDotProd <= 0.01f) { if (bike->m_fBrakePedal <= 0.5f || velocityFwdDotProd <= 0.01f) {

View File

@ -357,7 +357,7 @@ CRenderer::SetupEntityVisibility(CEntity *ent)
if(mi->GetModelType() != MITYPE_SIMPLE && mi->GetModelType() != MITYPE_WEAPON){ if(mi->GetModelType() != MITYPE_SIMPLE && mi->GetModelType() != MITYPE_WEAPON){
if(FindPlayerVehicle() == ent && if(FindPlayerVehicle() == ent &&
TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_1STPERSON && TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_1STPERSON &&
!(FindPlayerVehicle()->IsBike() && ((CBike*)FindPlayerVehicle())->m_bike_flag80)){ !(FindPlayerVehicle()->IsBike() && ((CBike*)FindPlayerVehicle())->bWheelieCam)){
// Player's vehicle in first person mode // Player's vehicle in first person mode
CVehicle *veh = (CVehicle*)ent; CVehicle *veh = (CVehicle*)ent;
int model = veh->GetModelIndex(); int model = veh->GetModelIndex();

View File

@ -173,6 +173,9 @@ public:
static int GetFogBlue(void) { return m_nCurrentFogColourBlue; } static int GetFogBlue(void) { return m_nCurrentFogColourBlue; }
static int GetFogReduction(void) { return m_FogReduction; } static int GetFogReduction(void) { return m_FogReduction; }
static int GetBlurRed(void) { return m_fCurrentBlurRed; }
static int GetBlurGreen(void) { return m_fCurrentBlurGreen; }
static int GetBlurBlue(void) { return m_fCurrentBlurBlue; }
static int GetWaterRed(void) { return m_fCurrentWaterRed; } static int GetWaterRed(void) { return m_fCurrentWaterRed; }
static int GetWaterGreen(void) { return m_fCurrentWaterGreen; } static int GetWaterGreen(void) { return m_fCurrentWaterGreen; }
static int GetWaterBlue(void) { return m_fCurrentWaterBlue; } static int GetWaterBlue(void) { return m_fCurrentWaterBlue; }

View File

@ -273,14 +273,14 @@ CAutomobile::ProcessControl(void)
if(CReplay::IsPlayingBack()) if(CReplay::IsPlayingBack())
return; return;
UpdatePassengerList();
// Heli wind // Heli wind
if(IsRealHeli()) if(IsRealHeli())
if((GetStatus() == STATUS_PLAYER || GetStatus() == STATUS_PHYSICS) && m_aWheelSpeed[1] > 0.075f || if((GetStatus() == STATUS_PLAYER || GetStatus() == STATUS_PHYSICS) && m_aWheelSpeed[1] > 0.075f ||
GetStatus() == STATUS_SIMPLE) GetStatus() == STATUS_SIMPLE)
CWindModifiers::RegisterOne(GetPosition(), 1); CWindModifiers::RegisterOne(GetPosition(), 1);
UpdatePassengerList();
// Improve grip of vehicles in certain cases // Improve grip of vehicles in certain cases
bool strongGrip1 = false; bool strongGrip1 = false;
bool strongGrip2 = false; bool strongGrip2 = false;

View File

@ -125,7 +125,7 @@ CBike::CBike(int32 id, uint8 CreatedBy)
bIsStanding = false; bIsStanding = false;
bExtraSpeed = false; bExtraSpeed = false;
bIsOnFire = false; bIsOnFire = false;
m_bike_flag80 = false; bWheelieCam = false;
m_fTireTemperature = 1.0f; m_fTireTemperature = 1.0f;
m_fBrakeDestabilization = 0.0f; m_fBrakeDestabilization = 0.0f;
@ -314,7 +314,7 @@ CBike::ProcessControl(void)
ReduceHornCounter(); ReduceHornCounter();
bVehicleColProcessed = false; bVehicleColProcessed = false;
bAudioChangingGear = false; bAudioChangingGear = false;
m_bike_flag80 = false; bWheelieCam = false;
// that's all we do for simple vehicles // that's all we do for simple vehicles
return; return;
@ -324,7 +324,7 @@ CBike::ProcessControl(void)
PlayHornIfNecessary(); PlayHornIfNecessary();
bBalancedByRider = true; bBalancedByRider = true;
m_bike_flag80 = false; bWheelieCam = false;
if(bIsBeingCarJacked){ if(bIsBeingCarJacked){
m_fGasPedal = 0.0f; m_fGasPedal = 0.0f;
@ -350,7 +350,7 @@ CBike::ProcessControl(void)
bBalancedByRider = (pDriver || pPassengers[0] || bIsBeingCarJacked) && !bIsStanding; bBalancedByRider = (pDriver || pPassengers[0] || bIsBeingCarJacked) && !bIsStanding;
m_fPedLeanAmountLR = 0.0f; m_fPedLeanAmountLR = 0.0f;
m_fPedLeanAmountUD = 0.0f; m_fPedLeanAmountUD = 0.0f;
m_bike_flag80 = false; bWheelieCam = false;
if(bIsBeingCarJacked){ if(bIsBeingCarJacked){
m_fGasPedal = 0.0f; m_fGasPedal = 0.0f;
@ -371,7 +371,7 @@ CBike::ProcessControl(void)
m_nCarHornTimer = 0; m_nCarHornTimer = 0;
bBalancedByRider = false; bBalancedByRider = false;
m_bike_flag80 = false; bWheelieCam = false;
m_fPedLeanAmountLR = 0.0f; m_fPedLeanAmountLR = 0.0f;
m_fPedLeanAmountUD = 0.0f; m_fPedLeanAmountUD = 0.0f;
break; break;
@ -393,7 +393,7 @@ CBike::ProcessControl(void)
m_nCarHornTimer = 0; m_nCarHornTimer = 0;
bBalancedByRider = true; bBalancedByRider = true;
m_bike_flag80 = false; bWheelieCam = false;
break; break;
} }
@ -1344,7 +1344,7 @@ CBike::PreRender(void)
// 1.0 if directly behind car, -1.0 if in front // 1.0 if directly behind car, -1.0 if in front
float behindness = DotProduct(lookVector, GetForward()); float behindness = DotProduct(lookVector, GetForward());
// 0.0 if behind car, PI if in front // 0.0 if behind car, PI if in front
float angle = Abs(PI/2.0f - Acos(Abs(behindness))); float angle = Abs(Acos(Abs(behindness)));
// Headlight // Headlight

View File

@ -73,7 +73,7 @@ public:
uint8 bIsStanding : 1; uint8 bIsStanding : 1;
uint8 bExtraSpeed : 1; // leaning forward uint8 bExtraSpeed : 1; // leaning forward
uint8 bIsOnFire : 1; uint8 bIsOnFire : 1;
uint8 m_bike_flag80 : 1; uint8 bWheelieCam : 1;
int16 m_doingBurnout; int16 m_doingBurnout;
float m_fTireTemperature; float m_fTireTemperature;
float m_fBrakeDestabilization; float m_fBrakeDestabilization;