some more camera stuff

This commit is contained in:
aap 2020-06-14 23:15:56 +02:00
parent f64d3ad7de
commit 0741fd5b1d
5 changed files with 453 additions and 521 deletions

File diff suppressed because it is too large Load Diff

View File

@ -121,9 +121,8 @@ public:
float f_max_role_angle; //=DEGTORAD(5.0f); float f_max_role_angle; //=DEGTORAD(5.0f);
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; //TODO(MIAMI): remove 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;
@ -246,26 +245,14 @@ public:
bool 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);

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)
{ {