1
0
Fork 0
mirror of https://github.com/halpz/re3.git synced 2024-12-27 18:25:28 +00:00

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];
int16 CPickups::CollectedPickUpIndex;
int32 CPickups::PlayerOnWeaponPickup;
// unused
bool CPickups::bPickUpcamActivated;
CVehicle *CPickups::pPlayerVehicle;

View file

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

File diff suppressed because it is too large Load diff

View file

@ -20,6 +20,7 @@
#include "Replay.h"
#include "CutsceneMgr.h"
#include "Renderer.h"
#include "Timecycle.h"
#include "MBlur.h"
#include "Text.h"
#include "Hud.h"
@ -61,6 +62,8 @@ enum
CCamera TheCamera;
bool CCamera::m_bUseMouse3rdPerson = true;
bool bDidWeProcessAnyCinemaCam;
float CCamera::m_fMouseAccelHorzntl;
float CCamera::m_fMouseAccelVertical;
float CCamera::m_f3rdPersonCHairMultX;
float CCamera::m_f3rdPersonCHairMultY;
@ -75,26 +78,16 @@ float CCamera::m_f3rdPersonCHairMultY;
CCamera::CCamera(void)
{
#ifdef GTA3_1_1_PATCH
m_fMouseAccelHorzntl = 0.0025f;
m_fMouseAccelVertical = 0.003f;
#endif
Init();
}
//--MIAMI: done
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
#ifdef GTA3_1_1_PATCH
m_fMouseAccelHorzntl = fMouseAccelHorzntl;
m_fMouseAccelVertical = fMouseAccelVertical;
#endif
m_pRwCamera = nil;
m_bPlayerWasOnBike = false;
m_1rstPersonRunCloseToAWall = false;
m_fPositionAlongSpline = 0.0f;
m_bCameraJustRestored = false;
@ -103,8 +96,22 @@ CCamera::Init(void)
Cams[2].Init();
Cams[0].Mode = CCam::MODE_FOLLOWPED;
Cams[1].Mode = CCam::MODE_FOLLOWPED;
unknown = 0;
m_bJustJumpedOutOf1stPersonBecauseOfTarget = 0;
m_bEnable1rstPersonCamCntrlsScript = false;
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();
m_bInATunnelAndABigVehicle = false;
m_iModeObbeCamIsInForCar = OBBE_INVALID;
@ -122,8 +129,8 @@ CCamera::Init(void)
Cams[1].m_fPlayerVelocity = 0.0f;
Cams[2].m_fPlayerVelocity = 0.0f;
m_bHeadBob = false;
m_fFractionInterToStopMovingTarget = 0.25f;
m_fFractionInterToStopCatchUpTarget = 0.75f;
m_fFractionInterToStopMoving = 0.25f;
m_fFractionInterToStopCatchUp = 0.75f;
m_fGaitSwayBuffer = 0.85f;
m_bScriptParametersSetForInterPol = false;
m_uiCamShakeStart = 0;
@ -168,10 +175,11 @@ CCamera::Init(void)
m_bMusicFading = false;
m_fTimeToFadeMusic = 0.0f;
m_fFLOATingFadeMusic = 0.0f;
m_fMouseAccelHorzntl = 0.003f;
m_fMouseAccelVertical = 0.0025f;
}
m_bMoveCamToAvoidGeom = false;
if(FrontEndMenuManager.m_bWantToRestart)
m_bMoveCamToAvoidGeom = true;
m_fTimeToFadeMusic = 0.0f;
m_bStartingSpline = false;
m_iTypeOfSwitch = INTERPOLATION;
m_bUseScriptZoomValuePed = false;
@ -190,6 +198,8 @@ CCamera::Init(void)
m_uiTimeLastChange = 0;
m_uiTimeWeEnteredIdle = 0;
m_bIdleOn = false;
m_uiTimeWeLeftIdle_StillNoInput = 0;
m_uiTimeWeEnteredIdle = 0;
LODDistMultiplier = 1.0f;
m_bCamDirectlyBehind = false;
m_bCamDirectlyInFront = false;
@ -209,12 +219,10 @@ CCamera::Init(void)
m_uiTransitionState = 0;
m_uiTimeTransitionStart = 0;
m_bLookingAtPlayer = true;
#ifndef GTA3_1_1_PATCH
m_fMouseAccelHorzntl = 0.0025f;
m_fMouseAccelVertical = 0.003f;
#endif
m_f3rdPersonCHairMultX = 0.53f;
m_f3rdPersonCHairMultY = 0.4f;
m_fAvoidTheGeometryProbsTimer = 0.0f;
m_nAvoidTheGeometryProbsDirn = 0;
}
void
@ -322,12 +330,12 @@ CCamera::Process(void)
currentTime = m_uiTransitionDuration;
float fractionInter = (float) currentTime / m_uiTransitionDuration;
if(fractionInter <= m_fFractionInterToStopMovingTarget){
if(fractionInter <= m_fFractionInterToStopMoving){
float inter;
if(m_fFractionInterToStopMovingTarget == 0.0f)
if(m_fFractionInterToStopMoving == 0.0f)
inter = 0.0f;
else
inter = (m_fFractionInterToStopMovingTarget - fractionInter)/m_fFractionInterToStopMovingTarget;
inter = (m_fFractionInterToStopMoving - fractionInter)/m_fFractionInterToStopMoving;
inter = 0.5f - 0.5*Cos(inter*PI); // smooth it
m_vecSourceWhenInterPol = m_cvecStartingSourceForInterPol + inter*m_cvecSourceSpeedAtStartInter;
@ -381,12 +389,12 @@ CCamera::Process(void)
}
CamUp.Normalise();
FOV = m_fFOVWhenInterPol;
}else if(fractionInter > m_fFractionInterToStopMovingTarget && fractionInter <= 1.0f){
}else if(fractionInter > m_fFractionInterToStopMoving && fractionInter <= 1.0f){
float inter;
if(m_fFractionInterToStopCatchUpTarget == 0.0f)
if(m_fFractionInterToStopCatchUp == 0.0f)
inter = 0.0f;
else
inter = (fractionInter - m_fFractionInterToStopMovingTarget)/m_fFractionInterToStopCatchUpTarget;
inter = (fractionInter - m_fFractionInterToStopMoving)/m_fFractionInterToStopCatchUp;
inter = 0.5f - 0.5*Cos(inter*PI); // smooth it
CamSource = m_vecSourceWhenInterPol + inter*(Cams[ActiveCam].Source - m_vecSourceWhenInterPol);
@ -1610,7 +1618,7 @@ CCamera::UpdateSoundDistances(void)
}
f = (n + 1) / 6.0f;
SoundDistUp = (1.0f-f)*SoundDistUpAsReadOld + f*SoundDistUpAsRead;
/*
// check left
n = (CTimer::GetFrameCounter()+2) % 12;
if(n == 0){
@ -1637,6 +1645,7 @@ CCamera::UpdateSoundDistances(void)
}
f = (n + 1) / 6.0f;
SoundDistRight = (1.0f-f)*SoundDistRightAsReadOld + f*SoundDistRightAsRead;
*/
}
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
@ -1828,28 +1960,25 @@ CCamera::SetCamPositionForFixedMode(const CVector &Source, const CVector &UpOffS
}
/*
* On PS2 the transition happens between Cams[1] and Cams[2].
* On PC the whole system has been changed.
*/
//--MIAMI: done
void
CCamera::StartTransition(int16 newMode)
{
bool foo = false;
bool switchFromFixedSyphon = false;
bool switchSyphonMode = false;
bool switchPedToCar = false;
bool switchPedMode = false;
bool switchPedToCar = false;
bool switchFromFight = false;
bool switchBikeToPed = false;
bool switchFromFixed = false;
bool switch1stPersonToVehicle = false;
float betaOffset, targetBeta, camBeta, deltaBeta;
int door;
bool vehicleVertical;
// missing on PS2
m_bItsOkToLookJustAtThePlayer = false;
m_fFractionInterToStopMovingTarget = 0.25f;
m_fFractionInterToStopCatchUpTarget = 0.75f;
m_fFractionInterToStopMoving = 0.25f;
m_fFractionInterToStopCatchUp = 0.75f;
if(Cams[ActiveCam].Mode == CCam::MODE_SYPHON_CRIM_IN_FRONT ||
Cams[ActiveCam].Mode == CCam::MODE_FOLLOWPED ||
@ -1859,16 +1988,19 @@ CCamera::StartTransition(int16 newMode)
newMode == CCam::MODE_FOLLOWPED ||
newMode == CCam::MODE_SYPHON ||
newMode == CCam::MODE_SPECIAL_FIXED_FOR_SYPHON)
m_bItsOkToLookJustAtThePlayer = true;
switchPedMode = true;
if(newMode == CCam::MODE_CAM_ON_A_STRING)
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)
switchSyphonMode = true;
if(Cams[ActiveCam].Mode == CCam::MODE_FIGHT_CAM && newMode == CCam::MODE_FOLLOWPED)
switchPedMode = true;
switchFromFight = true;
if(Cams[ActiveCam].Mode == CCam::MODE_FIXED)
switchFromFixed = true;
@ -1889,12 +2021,6 @@ CCamera::StartTransition(int16 newMode)
((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].CamTargetEntity = pTargetEntity;
Cams[ActiveCam].m_cvecCamFixedModeSource = m_vecFixedModeSource;
@ -1909,16 +2035,17 @@ CCamera::StartTransition(int16 newMode)
newMode == CCam::MODE_1STPERSON_RUNABOUT ||
newMode == CCam::MODE_M16_1STPERSON_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;
// PS2 also copies values to ActiveCam here
switch(Cams[ActiveCam].Mode)
case CCam::MODE_SNIPER_RUNABOUT:
case CCam::MODE_ROCKETLAUNCHER_RUNABOUT:
case CCam::MODE_1STPERSON_RUNABOUT:
case CCam::MODE_M16_1STPERSON_RUNABOUT:
case CCam::MODE_FIGHT_CAM_RUNABOUT:
case CCam::MODE_CAMERA:
if(newMode == CCam::MODE_CAM_ON_A_STRING || newMode == CCam::MODE_BEHINDBOAT)
switch1stPersonToVehicle = true;
@ -1932,16 +2059,6 @@ CCamera::StartTransition(int16 newMode)
betaOffset = DEGTORAD(55.0f);
if(m_bJustCameOutOfGarage){
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)
Cams[ActiveCam].m_fTransitionBeta = CGeneral::GetATanOfXY(Cams[ActiveCam].Front.x, Cams[ActiveCam].Front.y) + PI;
else
@ -2010,6 +2127,7 @@ CCamera::StartTransition(int16 newMode)
case CCam::MODE_M16_1STPERSON_RUNABOUT:
case CCam::MODE_FIGHT_CAM_RUNABOUT:
case CCam::MODE_HELICANNON_1STPERSON:
case CCam::MODE_CAMERA:
if(FindPlayerVehicle())
Cams[ActiveCam].Beta = Atan2(FindPlayerVehicle()->GetForward().x, FindPlayerVehicle()->GetForward().y);
else
@ -2027,43 +2145,8 @@ CCamera::StartTransition(int16 newMode)
if(!m_bLookingAtPlayer || m_bJustCameOutOfGarage)
break;
m_bUseTransitionBeta = true;
targetBeta = CGeneral::GetATanOfXY(pTargetEntity->GetForward().x, pTargetEntity->GetForward().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;
case CCam::MODE_BEHINDBOAT:
Cams[ActiveCam].BetaSpeed = 0.0f;
@ -2087,27 +2170,34 @@ CCamera::StartTransition(int16 newMode)
m_uiTransitionDuration = 1350;
if(switchSyphonMode)
m_uiTransitionDuration = 1800;
else if(switchPedMode)
else if(switchFromFight)
m_uiTransitionDuration = 750;
// not on PS2
else if(switchPedToCar){
m_fFractionInterToStopMovingTarget = 0.2f;
m_fFractionInterToStopCatchUpTarget = 0.8f;
m_uiTransitionDuration = 950;
m_fFractionInterToStopMoving = 0.1f;
m_fFractionInterToStopCatchUp = 0.9f;
m_uiTransitionDuration = 750;
}else if(switchFromFixedSyphon){
m_fFractionInterToStopMoving = 0.0f;
m_fFractionInterToStopCatchUp = 1.0f;
m_uiTransitionDuration = 600;
}else if(switchFromFixed){
m_fFractionInterToStopMovingTarget = 0.05f;
m_fFractionInterToStopCatchUpTarget = 0.95f;
m_fFractionInterToStopMoving = 0.05f;
m_fFractionInterToStopCatchUp = 0.95f;
}else if(switchBikeToPed){
m_uiTransitionDuration = 800;
}else if(switch1stPersonToVehicle){
m_fFractionInterToStopMovingTarget = 0.0f;
m_fFractionInterToStopCatchUpTarget = 1.0f;
m_fFractionInterToStopMoving = 0.0f;
m_fFractionInterToStopCatchUp = 1.0f;
m_uiTransitionDuration = 1;
}else if(switchPedMode){
m_fFractionInterToStopMoving = 0.5f;
m_fFractionInterToStopCatchUp = 0.5f;
m_uiTransitionDuration = 350;
}else
m_uiTransitionDuration = 1350; // already set above
//
m_uiTransitionState = 1;
m_uiTimeTransitionStart = CTimer::GetTimeInMilliseconds();
m_uiTransitionJUSTStarted = 1;
// PS2 returns here
if(m_vecDoingSpecialInterPolation){
m_cvecStartingSourceForInterPol = SourceDuringInter;
m_cvecStartingTargetForInterPol = TargetDuringInter;
@ -2138,11 +2228,23 @@ CCamera::StartTransition(int16 newMode)
m_fBetaSpeedAtStartInter = Cams[ActiveCam].m_fBetaSpeedOverOneFrame;
m_fFOVSpeedAtStartInter = Cams[ActiveCam].m_fFovSpeedOverOneFrame;
Cams[ActiveCam].ResetStatics = true;
if(!m_bLookingAtPlayer && m_bScriptParametersSetForInterPol){
m_fFractionInterToStopMovingTarget = m_fScriptPercentageInterToStopMoving;
m_fFractionInterToStopCatchUpTarget = m_fScriptPercentageInterToCatchUp;
if(m_bLookingAtPlayer){
if(switchPedMode)
m_uiTransitionDurationTargetCoors = 350;
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;
}
}
void

View file

@ -123,7 +123,6 @@ public:
float f_Roll; //used for adding a slight roll to the camera in the
float f_rollSpeed;
float m_fSyphonModeTargetZOffSet;
float m_fRoadOffSet;
float m_fAmountFractionObscured;
float m_fAlphaSpeedOverOneFrame;
float m_fBetaSpeedOverOneFrame;
@ -146,7 +145,8 @@ public:
float m_fRealGroundDist; //used for follow ped mode
float m_fTargetBeta;
float m_fTimeElapsedFloat;
float m_fTilt;
float m_fTiltSpeed;
float m_fTransitionBeta;
float m_fTrueBeta;
float m_fTrueAlpha;
@ -164,6 +164,16 @@ public:
float CA_MAX_DISTANCE;
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_cvecTargetSpeedOverOneFrame;
CVector m_cvecUpOverOneFrame;
@ -198,10 +208,8 @@ public:
void GetVectorsReadyForRW(void);
CVector DoAverageOnVector(const CVector &vec);
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);
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 FixCamWhenObscuredByVehicle(const CVector &TargetCoors);
void LookBehind(void);
@ -234,37 +242,23 @@ public:
void Process_BehindBoat(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_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_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_LightHouse(const CVector &CameraTarget, float, float, float);
void ProcessPedsDeadBaby(void);
bool ProcessArrestCamOne(void);
bool ProcessArrestCamTwo(void);
/* Some of the unused PS2 cams */
void Process_Chris_With_Binding_PlusRotation(const CVector &CameraTarget, float, float, float);
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
bool GetLookAlongGroundPos(CEntity *Target, CPed *Cop, CVector &TargetCoors, CVector &SourceOut);
bool GetLookFromLampPostPos(CEntity *Target, CPed *Cop, CVector &TargetCoors, CVector &SourceOut);
bool GetLookOverShoulderPos(CEntity *Target, CPed *Cop, CVector &TargetCoors, CVector &SourceOut);
// custom stuff
void Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrientation, float, float);
void Process_FollowCar_SA(const CVector &CameraTarget, float TargetOrientation, float, float);
};
VALIDATE_SIZE(CCam, 0x1A4);
class CCamPathSplines
{
public:
@ -358,6 +352,7 @@ public:
bool m_bInitialNoNodeStaticsSet;
bool m_bIgnoreFadingStuffForMusic;
bool m_bPlayerIsInGarage;
bool m_bPlayerWasOnBike;
bool m_bJustCameOutOfGarage;
bool m_bJustInitalised;
bool m_bJust_Switched;
@ -383,6 +378,8 @@ public:
bool m_1rstPersonRunCloseToAWall;
bool m_bHeadBob;
bool m_bVehicleSuspenHigh;
bool m_bEnable1rstPersonCamCntrlsScript;
bool m_bAllow1rstPersonWeaponsCamera;
bool m_bFailedCullZoneTestPreviously;
bool m_FadeTargetIsSplashScreen;
@ -398,15 +395,16 @@ public:
uint8 m_uiTransitionState; // 0:one mode 1:transition
uint32 m_uiTimeLastChange;
uint32 m_uiTimeWeLeftIdle_StillNoInput;
uint32 m_uiTimeWeEnteredIdle;
uint32 m_uiTimeTransitionStart;
uint32 m_uiTransitionDuration;
uint32 m_uiTransitionDurationTargetCoors;
int m_BlurBlue;
int m_BlurGreen;
int m_BlurRed;
int m_BlurType;
uint32 unknown; // some counter having to do with music
int m_iWorkOutSpeedThisNumFrames;
int m_iNumFramesSoFar;
@ -466,15 +464,16 @@ public:
float PedZoomIndicator;
#endif
float PlayerExhaustion;
float SoundDistUp, SoundDistLeft, SoundDistRight;
float SoundDistUpAsRead, SoundDistLeftAsRead, SoundDistRightAsRead;
float SoundDistUpAsReadOld, SoundDistLeftAsReadOld, SoundDistRightAsReadOld;
float SoundDistUp;
float SoundDistUpAsRead;
float SoundDistUpAsReadOld;
float m_fAvoidTheGeometryProbsTimer;
int16 m_nAvoidTheGeometryProbsDirn;
float m_fWideScreenReductionAmount;
float m_fStartingFOVForInterPol;
// not static yet
float m_fMouseAccelHorzntl;// acceleration multiplier for 1st person controls
float m_fMouseAccelVertical;// acceleration multiplier for 1st person controls
static float m_fMouseAccelHorzntl;// acceleration multiplier for 1st person controls
static float m_fMouseAccelVertical;// acceleration multiplier for 1st person controls
static float m_f3rdPersonCHairMultX;
static float m_f3rdPersonCHairMultY;
@ -501,7 +500,7 @@ public:
CVector m_vecSourceWhenInterPol;
CVector m_vecTargetWhenInterPol;
CVector m_vecUpWhenInterPol;
CVector m_vecClearGeometryVec;
CVector m_vecGameCamPos;
CVector SourceDuringInter;
CVector TargetDuringInter;
@ -509,7 +508,9 @@ public:
RwCamera *m_pRwCamera;
CEntity *pTargetEntity;
CCamPathSplines m_arrPathArray[MAX_NUM_OF_SPLINETYPES];
#ifdef GTA_TRAIN
CTrainCamNode m_arrTrainCamNode[MAX_NUM_OF_NODES];
#endif
CMatrix m_cameraMatrix;
bool m_bGarageFixedCamPositionSet;
bool m_vecDoingSpecialInterPolation;
@ -527,6 +528,8 @@ public:
float m_fFLOATingFadeMusic;
float m_fTimeToFadeOut;
float m_fTimeToFadeMusic;
float m_fFractionInterToStopMoving;
float m_fFractionInterToStopCatchUp;
float m_fFractionInterToStopMovingTarget;
float m_fFractionInterToStopCatchUpTarget;
float m_fGaitSwayBuffer;
@ -560,6 +563,8 @@ public:
void InitialiseCameraForDebugMode(void);
void CamShake(float strength, float x, float y, float z);
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
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
CWorld::FindObjectsInRangeSectorList(CPtrList &list, Const CVector &centre, float radius, bool ignoreZ, short *nextObject,
short lastObject, CEntity **objects)
CWorld::FindObjectsInRangeSectorList(CPtrList &list, Const CVector &centre, float radius, bool ignoreZ, int16 *numObjects,
int16 lastObject, CEntity **objects)
{
float radiusSqr = radius * radius;
float objDistSqr;
@ -666,16 +666,16 @@ CWorld::FindObjectsInRangeSectorList(CPtrList &list, Const CVector &centre, floa
else
objDistSqr = diff.MagnitudeSqr();
if(objDistSqr < radiusSqr && *nextObject < lastObject) {
if(objects) { objects[*nextObject] = object; }
(*nextObject)++;
if(objDistSqr < radiusSqr && *numObjects < lastObject) {
if(objects) { objects[*numObjects] = object; }
(*numObjects)++;
}
}
}
}
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,
bool checkObjects, bool checkDummies)
{
@ -701,39 +701,39 @@ CWorld::FindObjectsInRange(Const CVector &centre, float radius, bool ignoreZ, sh
AdvanceCurrentScanCode();
*nextObject = 0;
*numObjects = 0;
for(int curY = minY; curY <= maxY; curY++) {
for(int curX = minX; curX <= maxX; curX++) {
CSector *sector = GetSector(curX, curY);
if(checkBuildings) {
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_BUILDINGS], centre, radius,
ignoreZ, nextObject, lastObject, objects);
ignoreZ, numObjects, lastObject, objects);
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], centre,
radius, ignoreZ, nextObject, lastObject, objects);
radius, ignoreZ, numObjects, lastObject, objects);
}
if(checkVehicles) {
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_VEHICLES], centre, radius,
ignoreZ, nextObject, lastObject, objects);
ignoreZ, numObjects, lastObject, objects);
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], centre,
radius, ignoreZ, nextObject, lastObject, objects);
radius, ignoreZ, numObjects, lastObject, objects);
}
if(checkPeds) {
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_PEDS], centre, radius, ignoreZ,
nextObject, lastObject, objects);
numObjects, lastObject, objects);
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_PEDS_OVERLAP], centre, radius,
ignoreZ, nextObject, lastObject, objects);
ignoreZ, numObjects, lastObject, objects);
}
if(checkObjects) {
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_OBJECTS], centre, radius,
ignoreZ, nextObject, lastObject, objects);
ignoreZ, numObjects, lastObject, objects);
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], centre,
radius, ignoreZ, nextObject, lastObject, objects);
radius, ignoreZ, numObjects, lastObject, objects);
}
if(checkDummies) {
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_DUMMIES], centre, radius,
ignoreZ, nextObject, lastObject, objects);
ignoreZ, numObjects, lastObject, objects);
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 *TestSphereAgainstSectorList(CPtrList&, CVector, float, CEntity*, bool);
static void FindObjectsInRangeSectorList(CPtrList&, Const CVector&, float, bool, short*, short, CEntity**);
static void FindObjectsInRange(Const CVector&, float, bool, short*, short, CEntity**, bool, bool, bool, bool, bool);
static void FindObjectsInRangeSectorList(CPtrList &list, Const CVector &centre, float radius, bool ignoreZ, int16 *numObjects, int16 lastObject, CEntity **objects);
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 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);

View file

@ -436,6 +436,21 @@ IsLightObject(int16 id)
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
IsBodyPart(int16 id)
{

View file

@ -19847,7 +19847,7 @@ CPed::DriveVehicle(void)
} else if (targetUDLean > -1.0f) {
targetUDLean = bike->m_fLeanInput;
bike->m_bike_flag80 = false;
bike->bWheelieCam = false;
neededAngForWheelie = 1.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])) {
@ -19857,13 +19857,13 @@ CPed::DriveVehicle(void)
stoppieAng = bike->pBikeHandling->fStoppieAng;
if (stoppieAng - bike->GetForward().z > 0.6f * stoppieAng)
bike->m_bike_flag80 = true;
bike->bWheelieCam = true;
}
} else {
float wheelieAng = bike->pBikeHandling->fWheelieAng;
neededAngForWheelie = wheelieAng - bike->GetForward().z;
if (neededAngForWheelie < wheelieAng / 2.f)
bike->m_bike_flag80 = true;
bike->bWheelieCam = true;
}
if (neededAngForWheelie >= 0.15f) {
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(FindPlayerVehicle() == ent &&
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
CVehicle *veh = (CVehicle*)ent;
int model = veh->GetModelIndex();

View file

@ -173,6 +173,9 @@ public:
static int GetFogBlue(void) { return m_nCurrentFogColourBlue; }
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 GetWaterGreen(void) { return m_fCurrentWaterGreen; }
static int GetWaterBlue(void) { return m_fCurrentWaterBlue; }

View file

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

View file

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

View file

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