mirror of
https://github.com/halpz/re3.git
synced 2025-07-04 08:30:47 +00:00
Merge pull request #357 from aap/master
Finished CCam; various smaller things
This commit is contained in:
4424
src/core/Cam.cpp
Normal file
4424
src/core/Cam.cpp
Normal file
File diff suppressed because it is too large
Load Diff
1171
src/core/Camera.cpp
1171
src/core/Camera.cpp
File diff suppressed because it is too large
Load Diff
@ -5,6 +5,8 @@ class CEntity;
|
||||
class CPed;
|
||||
class CAutomobile;
|
||||
|
||||
extern int16 &DebugCamMode;
|
||||
|
||||
#define NUMBER_OF_VECTORS_FOR_AVERAGE 2
|
||||
|
||||
struct CCam
|
||||
@ -66,17 +68,17 @@ struct CCam
|
||||
bool m_bTheHeightFixerVehicleIsATrain;
|
||||
bool LookBehindCamWasInFront;
|
||||
bool LookingBehind;
|
||||
bool LookingLeft; // 32
|
||||
bool LookingLeft;
|
||||
bool LookingRight;
|
||||
bool ResetStatics; //for interpolation type stuff to work
|
||||
bool Rotating;
|
||||
|
||||
int16 Mode; // CameraMode
|
||||
uint32 m_uiFinishTime; // 52
|
||||
uint32 m_uiFinishTime;
|
||||
|
||||
int m_iDoCollisionChecksOnFrameNum;
|
||||
int m_iDoCollisionCheckEveryNumOfFrames;
|
||||
int m_iFrameNumWereAt; // 64
|
||||
int m_iFrameNumWereAt;
|
||||
int m_iRunningVectorArrayPos;
|
||||
int m_iRunningVectorCounter;
|
||||
int DirectionWasLooking;
|
||||
@ -85,9 +87,9 @@ struct CCam
|
||||
float f_Roll; //used for adding a slight roll to the camera in the
|
||||
float f_rollSpeed;
|
||||
float m_fSyphonModeTargetZOffSet;
|
||||
float m_fUnknownZOffSet;
|
||||
float m_fRoadOffSet;
|
||||
float m_fAmountFractionObscured;
|
||||
float m_fAlphaSpeedOverOneFrame; // 100
|
||||
float m_fAlphaSpeedOverOneFrame;
|
||||
float m_fBetaSpeedOverOneFrame;
|
||||
float m_fBufferedTargetBeta;
|
||||
float m_fBufferedTargetOrientation;
|
||||
@ -95,7 +97,7 @@ struct CCam
|
||||
float m_fCamBufferedHeight;
|
||||
float m_fCamBufferedHeightSpeed;
|
||||
float m_fCloseInPedHeightOffset;
|
||||
float m_fCloseInPedHeightOffsetSpeed; // 132
|
||||
float m_fCloseInPedHeightOffsetSpeed;
|
||||
float m_fCloseInCarHeightOffset;
|
||||
float m_fCloseInCarHeightOffsetSpeed;
|
||||
float m_fDimensionOfHighestNearCar;
|
||||
@ -103,7 +105,7 @@ struct CCam
|
||||
float m_fFovSpeedOverOneFrame;
|
||||
float m_fMinDistAwayFromCamWhenInterPolating;
|
||||
float m_fPedBetweenCameraHeightOffset;
|
||||
float m_fPlayerInFrontSyphonAngleOffSet; // 164
|
||||
float m_fPlayerInFrontSyphonAngleOffSet;
|
||||
float m_fRadiusForDead;
|
||||
float m_fRealGroundDist; //used for follow ped mode
|
||||
float m_fTargetBeta;
|
||||
@ -111,7 +113,7 @@ struct CCam
|
||||
|
||||
float m_fTransitionBeta;
|
||||
float m_fTrueBeta;
|
||||
float m_fTrueAlpha; // 200
|
||||
float m_fTrueAlpha;
|
||||
float m_fInitialPlayerOrientation; //used for first person
|
||||
|
||||
float Alpha;
|
||||
@ -120,34 +122,25 @@ struct CCam
|
||||
float FOVSpeed;
|
||||
float Beta;
|
||||
float BetaSpeed;
|
||||
float Distance; // 232
|
||||
float Distance;
|
||||
float DistanceSpeed;
|
||||
float CA_MIN_DISTANCE;
|
||||
float CA_MAX_DISTANCE;
|
||||
float SpeedVar;
|
||||
|
||||
// ped onfoot zoom distance
|
||||
float m_fTargetZoomGroundOne;
|
||||
float m_fTargetZoomGroundTwo; // 256
|
||||
float m_fTargetZoomGroundThree;
|
||||
// ped onfoot alpha angle offset
|
||||
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;
|
||||
|
||||
CVector m_cvecTargetCoorsForFudgeInter; // 360
|
||||
CVector m_cvecCamFixedModeVector; // 372
|
||||
CVector m_cvecCamFixedModeSource; // 384
|
||||
CVector m_cvecCamFixedModeUpOffSet; // 396
|
||||
CVector m_vecLastAboveWaterCamPosition; //408 //helper for when the player has gone under the water
|
||||
CVector m_vecBufferedPlayerBodyOffset; // 420
|
||||
CVector m_cvecTargetCoorsForFudgeInter;
|
||||
CVector m_cvecCamFixedModeVector;
|
||||
CVector m_cvecCamFixedModeSource;
|
||||
CVector m_cvecCamFixedModeUpOffSet;
|
||||
CVector m_vecLastAboveWaterCamPosition; //helper for when the player has gone under the water
|
||||
CVector m_vecBufferedPlayerBodyOffset;
|
||||
|
||||
// The three vectors that determine this camera for this frame
|
||||
CVector Front; // 432 // Direction of looking in
|
||||
CVector Front; // Direction of looking in
|
||||
CVector Source; // Coors in world space
|
||||
CVector SourceBeforeLookBehind;
|
||||
CVector Up; // Just that
|
||||
@ -162,6 +155,10 @@ struct CCam
|
||||
bool m_bFirstPersonRunAboutActive;
|
||||
|
||||
|
||||
CCam(void) { Init(); }
|
||||
void Init(void);
|
||||
void Process(void);
|
||||
void ProcessSpecialHeightRoutines(void);
|
||||
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);
|
||||
@ -171,13 +168,59 @@ struct CCam
|
||||
bool FixCamIfObscured(CVector &TargetCoors, float TargetHeight, float TargetOrientation);
|
||||
void Cam_On_A_String_Unobscured(const CVector &TargetCoors, float BaseDist);
|
||||
void FixCamWhenObscuredByVehicle(const CVector &TargetCoors);
|
||||
bool Using3rdPersonMouseCam();
|
||||
bool GetWeaponFirstPersonOn();
|
||||
void LookBehind(void);
|
||||
void LookLeft(void);
|
||||
void LookRight(void);
|
||||
void ClipIfPedInFrontOfPlayer(void);
|
||||
void KeepTrackOfTheSpeed(const CVector &source, const CVector &target, const CVector &up, const float &alpha, const float &beta, const float &fov);
|
||||
bool Using3rdPersonMouseCam(void);
|
||||
bool GetWeaponFirstPersonOn(void);
|
||||
bool IsTargetInWater(const CVector &CamCoors);
|
||||
void AvoidWallsTopDownPed(const CVector &TargetCoors, const CVector &Offset, float *Adjuster, float *AdjusterSpeed, float yDistLimit);
|
||||
void PrintMode(void);
|
||||
|
||||
void Process_Debug(float *vec, float a, float b, float c);
|
||||
void Process_Debug(const CVector&, float, float, float);
|
||||
void Process_Editor(const CVector&, float, float, float);
|
||||
void Process_ModelView(const CVector &CameraTarget, float, float, float);
|
||||
void Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, float, float);
|
||||
void Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrientation, float, float);
|
||||
void Process_BehindCar(const CVector &CameraTarget, float TargetOrientation, float, float);
|
||||
void Process_Cam_On_A_String(const CVector &CameraTarget, float TargetOrientation, float, float);
|
||||
void Process_TopDown(const CVector &CameraTarget, float TargetOrientation, float SpeedVar, float TargetSpeedVar);
|
||||
void Process_TopDownPed(const CVector &CameraTarget, float TargetOrientation, float, float);
|
||||
void Process_Rocket(const CVector &CameraTarget, float, float, float);
|
||||
void Process_M16_1stPerson(const CVector &CameraTarget, float, float, float);
|
||||
void Process_1stPerson(const CVector &CameraTarget, float, float, float);
|
||||
void Process_1rstPersonPedOnPC(const CVector &CameraTarget, float TargetOrientation, float, float);
|
||||
void Process_Sniper(const CVector &CameraTarget, float, float, float);
|
||||
void Process_Syphon(const CVector &CameraTarget, float, float, float);
|
||||
void Process_Syphon_Crim_In_Front(const CVector &CameraTarget, float, 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_FlyBy(const CVector&, float, float, float);
|
||||
void 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 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
|
||||
};
|
||||
static_assert(sizeof(CCam) == 0x1A4, "CCam: wrong size");
|
||||
static_assert(offsetof(CCam, Alpha) == 0xA8, "CCam: error");
|
||||
@ -223,6 +266,7 @@ enum
|
||||
|
||||
FADE_OUT = 0,
|
||||
FADE_IN,
|
||||
FADE_NONE
|
||||
};
|
||||
|
||||
enum
|
||||
@ -445,8 +489,8 @@ uint32 unknown;
|
||||
uint32 m_fScriptTimeForInterPolation;
|
||||
|
||||
|
||||
int16 m_iFadingDirection;
|
||||
int m_iModeObbeCamIsInForCar;
|
||||
int16 m_iFadingDirection;
|
||||
int m_iModeObbeCamIsInForCar;
|
||||
int16 m_iModeToGoTo;
|
||||
int16 m_iMusicFadingDirection;
|
||||
int16 m_iTypeOfSwitch;
|
||||
@ -493,6 +537,7 @@ int m_iModeObbeCamIsInForCar;
|
||||
void TakeControlNoEntity(const CVector&, int16, int32);
|
||||
void SetCamPositionForFixedMode(const CVector&, const CVector&);
|
||||
bool GetFading();
|
||||
int GetFadingDirection();
|
||||
|
||||
void Init();
|
||||
void SetRwCamera(RwCamera*);
|
||||
@ -525,8 +570,12 @@ static_assert(offsetof(CCamera, m_uiTransitionState) == 0x89, "CCamera: error");
|
||||
static_assert(offsetof(CCamera, m_uiTimeTransitionStart) == 0x94, "CCamera: error");
|
||||
static_assert(offsetof(CCamera, m_BlurBlue) == 0x9C, "CCamera: error");
|
||||
static_assert(offsetof(CCamera, Cams) == 0x1A4, "CCamera: error");
|
||||
static_assert(offsetof(CCamera, pToGarageWeAreIn) == 0x690, "CCamera: error");
|
||||
static_assert(offsetof(CCamera, m_PreviousCameraPosition) == 0x6B0, "CCamera: error");
|
||||
static_assert(offsetof(CCamera, m_vecCutSceneOffset) == 0x6F8, "CCamera: error");
|
||||
static_assert(offsetof(CCamera, m_arrPathArray) == 0x7a8, "CCamera: error");
|
||||
static_assert(sizeof(CCamera) == 0xE9D8, "CCamera: wrong size");
|
||||
|
||||
extern CCamera &TheCamera;
|
||||
|
||||
void CamShakeNoPos(CCamera*, float);
|
||||
void CamShakeNoPos(CCamera*, float);
|
||||
|
@ -89,3 +89,49 @@ CDebug::DebugDisplayTextBuffer()
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
// custom
|
||||
|
||||
CDebug::ScreenStr CDebug::ms_aScreenStrs[MAX_SCREEN_STRS];
|
||||
int CDebug::ms_nScreenStrs;
|
||||
|
||||
void
|
||||
CDebug::DisplayScreenStrings()
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
CFont::SetPropOn();
|
||||
CFont::SetBackgroundOff();
|
||||
CFont::SetScale(1.0f, 1.0f);
|
||||
CFont::SetCentreOff();
|
||||
CFont::SetRightJustifyOff();
|
||||
CFont::SetJustifyOff();
|
||||
CFont::SetRightJustifyWrap(0.0f);
|
||||
CFont::SetWrapx(9999.0f);
|
||||
CFont::SetBackGroundOnlyTextOff();
|
||||
CFont::SetFontStyle(FONT_BANK);
|
||||
|
||||
for(i = 0; i < ms_nScreenStrs; i++){
|
||||
AsciiToUnicode(ms_aScreenStrs[i].str, gUString);
|
||||
CFont::SetColor(CRGBA(0, 0, 0, 255));
|
||||
CFont::PrintString(ms_aScreenStrs[i].x, ms_aScreenStrs[i].y, gUString);
|
||||
CFont::SetColor(CRGBA(255, 255, 255, 255));
|
||||
CFont::PrintString(ms_aScreenStrs[i].x+1, ms_aScreenStrs[i].y+1, gUString);
|
||||
}
|
||||
CFont::DrawFonts();
|
||||
|
||||
ms_nScreenStrs = 0;
|
||||
}
|
||||
|
||||
void
|
||||
CDebug::PrintAt(const char *str, int x, int y)
|
||||
{
|
||||
if(ms_nScreenStrs >= MAX_SCREEN_STRS)
|
||||
return;
|
||||
strncpy(ms_aScreenStrs[ms_nScreenStrs].str, str, 256);
|
||||
ms_aScreenStrs[ms_nScreenStrs].x = x*12;
|
||||
ms_aScreenStrs[ms_nScreenStrs].y = y*22;
|
||||
ms_nScreenStrs++;
|
||||
}
|
||||
|
@ -6,15 +6,29 @@ class CDebug
|
||||
{
|
||||
MAX_LINES = 15,
|
||||
MAX_STR_LEN = 80,
|
||||
|
||||
MAX_SCREEN_STRS = 100,
|
||||
};
|
||||
|
||||
static int16 ms_nCurrentTextLine;
|
||||
static char ms_aTextBuffer[MAX_LINES][MAX_STR_LEN];
|
||||
|
||||
// custom
|
||||
struct ScreenStr {
|
||||
int x, y;
|
||||
char str[256];
|
||||
};
|
||||
static ScreenStr ms_aScreenStrs[MAX_SCREEN_STRS];
|
||||
static int ms_nScreenStrs;
|
||||
|
||||
public:
|
||||
static void DebugInitTextBuffer();
|
||||
static void DebugDisplayTextBuffer();
|
||||
static void DebugAddText(const char *str);
|
||||
|
||||
// custom
|
||||
static void PrintAt(const char *str, int x, int y);
|
||||
static void DisplayScreenStrings();
|
||||
};
|
||||
|
||||
extern bool gbDebugStuffInRelease;
|
||||
|
@ -399,6 +399,8 @@ public:
|
||||
bool GetLeftShoulder2JustDown() { return !!(NewState.LeftShoulder2 && !OldState.LeftShoulder2); }
|
||||
bool GetRightShoulder1JustDown() { return !!(NewState.RightShoulder1 && !OldState.RightShoulder1); }
|
||||
bool GetRightShoulder2JustDown() { return !!(NewState.RightShoulder2 && !OldState.RightShoulder2); }
|
||||
bool GetLeftShockJustDown() { return !!(NewState.LeftShock && !OldState.LeftShock); }
|
||||
bool GetRightShockJustDown() { return !!(NewState.RightShock && !OldState.RightShock); }
|
||||
bool GetStartJustDown() { return !!(NewState.Start && !OldState.Start); }
|
||||
bool GetLeftStickXJustDown() { return !!(NewState.LeftStickX && !OldState.LeftStickX); }
|
||||
bool GetLeftStickYJustDown() { return !!(NewState.LeftStickY && !OldState.LeftStickY); }
|
||||
@ -422,6 +424,10 @@ public:
|
||||
bool GetLeftShoulder2(void) { return !!NewState.LeftShoulder2; }
|
||||
bool GetRightShoulder1(void) { return !!NewState.RightShoulder1; }
|
||||
bool GetRightShoulder2(void) { return !!NewState.RightShoulder2; }
|
||||
int16 GetLeftStickX(void) { return NewState.LeftStickX; }
|
||||
int16 GetLeftStickY(void) { return NewState.LeftStickY; }
|
||||
int16 GetRightStickX(void) { return NewState.RightStickX; }
|
||||
int16 GetRightStickY(void) { return NewState.RightStickY; }
|
||||
|
||||
bool ArePlayerControlsDisabled(void) { return DisablePlayerControls != PLAYERCONTROL_ENABLED; }
|
||||
};
|
||||
|
@ -20,11 +20,12 @@
|
||||
#include "Replay.h"
|
||||
#include "Population.h"
|
||||
|
||||
CColPoint *gaTempSphereColPoints = (CColPoint*)0x6E64C0; // [32]
|
||||
|
||||
CPtrList *CWorld::ms_bigBuildingsList = (CPtrList*)0x6FAB60;
|
||||
CPtrList &CWorld::ms_listMovingEntityPtrs = *(CPtrList*)0x8F433C;
|
||||
CSector (*CWorld::ms_aSectors)[NUMSECTORS_X] = (CSector (*)[NUMSECTORS_Y])0x665608;
|
||||
uint16 &CWorld::ms_nCurrentScanCode = *(uint16*)0x95CC64;
|
||||
CColPoint &CWorld::ms_testSpherePoint = *(CColPoint*)0x6E64C0;
|
||||
|
||||
uint8 &CWorld::PlayerInFocus = *(uint8 *)0x95CD61;
|
||||
CPlayerInfo (&CWorld::Players)[NUMPLAYERS] = *(CPlayerInfo (*)[NUMPLAYERS])*(uintptr*)0x9412F0;
|
||||
@ -609,9 +610,9 @@ CWorld::GetIsLineOfSightSectorListClear(CPtrList &list, const CColLine &line, bo
|
||||
}
|
||||
|
||||
void
|
||||
CWorld::FindObjectsInRangeSectorList(CPtrList &list, CVector ¢re, float distance, bool ignoreZ, short *nextObject, short lastObject, CEntity **objects)
|
||||
CWorld::FindObjectsInRangeSectorList(CPtrList &list, CVector ¢re, float radius, bool ignoreZ, short *nextObject, short lastObject, CEntity **objects)
|
||||
{
|
||||
float distSqr = distance * distance;
|
||||
float radiusSqr = radius * radius;
|
||||
float objDistSqr;
|
||||
|
||||
for (CPtrNode *node = list.first; node; node = node->next) {
|
||||
@ -625,7 +626,7 @@ CWorld::FindObjectsInRangeSectorList(CPtrList &list, CVector ¢re, float dist
|
||||
else
|
||||
objDistSqr = diff.MagnitudeSqr();
|
||||
|
||||
if (objDistSqr < distSqr && *nextObject < lastObject) {
|
||||
if (objDistSqr < radiusSqr && *nextObject < lastObject) {
|
||||
if (objects) {
|
||||
objects[*nextObject] = object;
|
||||
}
|
||||
@ -636,22 +637,22 @@ CWorld::FindObjectsInRangeSectorList(CPtrList &list, CVector ¢re, float dist
|
||||
}
|
||||
|
||||
void
|
||||
CWorld::FindObjectsInRange(CVector ¢re, float distance, bool ignoreZ, short *nextObject, short lastObject, CEntity **objects, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies)
|
||||
CWorld::FindObjectsInRange(CVector ¢re, float radius, bool ignoreZ, short *nextObject, short lastObject, CEntity **objects, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies)
|
||||
{
|
||||
int minX = GetSectorIndexX(centre.x - distance);
|
||||
int minX = GetSectorIndexX(centre.x - radius);
|
||||
if (minX <= 0) minX = 0;
|
||||
|
||||
int minY = GetSectorIndexY(centre.y - distance);
|
||||
int minY = GetSectorIndexY(centre.y - radius);
|
||||
if (minY <= 0) minY = 0;
|
||||
|
||||
int maxX = GetSectorIndexX(centre.x + distance);
|
||||
int maxX = GetSectorIndexX(centre.x + radius);
|
||||
#ifdef FIX_BUGS
|
||||
if (maxX >= NUMSECTORS_X) maxX = NUMSECTORS_X - 1;
|
||||
#else
|
||||
if (maxX >= NUMSECTORS_X) maxX = NUMSECTORS_X;
|
||||
#endif
|
||||
|
||||
int maxY = GetSectorIndexY(centre.y + distance);
|
||||
int maxY = GetSectorIndexY(centre.y + radius);
|
||||
#ifdef FIX_BUGS
|
||||
if (maxY >= NUMSECTORS_Y) maxY = NUMSECTORS_Y - 1;
|
||||
#else
|
||||
@ -665,48 +666,48 @@ CWorld::FindObjectsInRange(CVector ¢re, float distance, bool ignoreZ, short
|
||||
for(int curX = minX; curX <= maxX; curX++) {
|
||||
CSector *sector = GetSector(curX, curY);
|
||||
if (checkBuildings) {
|
||||
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_BUILDINGS], centre, distance, ignoreZ, nextObject, lastObject, objects);
|
||||
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], centre, distance, ignoreZ, nextObject, lastObject, objects);
|
||||
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_BUILDINGS], centre, radius, ignoreZ, nextObject, lastObject, objects);
|
||||
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], centre, radius, ignoreZ, nextObject, lastObject, objects);
|
||||
}
|
||||
if (checkVehicles) {
|
||||
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_VEHICLES], centre, distance, ignoreZ, nextObject, lastObject, objects);
|
||||
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], centre, distance, ignoreZ, nextObject, lastObject, objects);
|
||||
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_VEHICLES], centre, radius, ignoreZ, nextObject, lastObject, objects);
|
||||
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], centre, radius, ignoreZ, nextObject, lastObject, objects);
|
||||
}
|
||||
if (checkPeds) {
|
||||
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_PEDS], centre, distance, ignoreZ, nextObject, lastObject, objects);
|
||||
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_PEDS_OVERLAP], centre, distance, ignoreZ, nextObject, lastObject, objects);
|
||||
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_PEDS], centre, radius, ignoreZ, nextObject, lastObject, objects);
|
||||
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_PEDS_OVERLAP], centre, radius, ignoreZ, nextObject, lastObject, objects);
|
||||
}
|
||||
if (checkObjects) {
|
||||
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_OBJECTS], centre, distance, ignoreZ, nextObject, lastObject, objects);
|
||||
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], centre, distance, ignoreZ, nextObject, lastObject, objects);
|
||||
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_OBJECTS], centre, radius, ignoreZ, nextObject, lastObject, objects);
|
||||
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], centre, radius, ignoreZ, nextObject, lastObject, objects);
|
||||
}
|
||||
if (checkDummies) {
|
||||
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_DUMMIES], centre, distance, ignoreZ, nextObject, lastObject, objects);
|
||||
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], centre, distance, ignoreZ, nextObject, lastObject, objects);
|
||||
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_DUMMIES], centre, radius, ignoreZ, nextObject, lastObject, objects);
|
||||
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], centre, radius, ignoreZ, nextObject, lastObject, objects);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CEntity*
|
||||
CWorld::TestSphereAgainstWorld(CVector centre, float distance, CEntity *entityToIgnore, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSomeObjects)
|
||||
CWorld::TestSphereAgainstWorld(CVector centre, float radius, CEntity *entityToIgnore, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSomeObjects)
|
||||
{
|
||||
CEntity* foundE = nil;
|
||||
|
||||
int minX = GetSectorIndexX(centre.x - distance);
|
||||
int minX = GetSectorIndexX(centre.x - radius);
|
||||
if (minX <= 0) minX = 0;
|
||||
|
||||
int minY = GetSectorIndexY(centre.y - distance);
|
||||
int minY = GetSectorIndexY(centre.y - radius);
|
||||
if (minY <= 0) minY = 0;
|
||||
|
||||
int maxX = GetSectorIndexX(centre.x + distance);
|
||||
int maxX = GetSectorIndexX(centre.x + radius);
|
||||
#ifdef FIX_BUGS
|
||||
if (maxX >= NUMSECTORS_X) maxX = NUMSECTORS_X - 1;
|
||||
#else
|
||||
if (maxX >= NUMSECTORS_X) maxX = NUMSECTORS_X;
|
||||
#endif
|
||||
|
||||
int maxY = GetSectorIndexY(centre.y + distance);
|
||||
int maxY = GetSectorIndexY(centre.y + radius);
|
||||
#ifdef FIX_BUGS
|
||||
if (maxY >= NUMSECTORS_Y) maxY = NUMSECTORS_Y - 1;
|
||||
#else
|
||||
@ -719,47 +720,47 @@ CWorld::TestSphereAgainstWorld(CVector centre, float distance, CEntity *entityTo
|
||||
for (int curX = minX; curX <= maxX; curX++) {
|
||||
CSector* sector = GetSector(curX, curY);
|
||||
if (checkBuildings) {
|
||||
foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_BUILDINGS], centre, distance, entityToIgnore, false);
|
||||
foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_BUILDINGS], centre, radius, entityToIgnore, false);
|
||||
if (foundE)
|
||||
return foundE;
|
||||
|
||||
foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], centre, distance, entityToIgnore, false);
|
||||
foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], centre, radius, entityToIgnore, false);
|
||||
if (foundE)
|
||||
return foundE;
|
||||
}
|
||||
if (checkVehicles) {
|
||||
foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_VEHICLES], centre, distance, entityToIgnore, false);
|
||||
foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_VEHICLES], centre, radius, entityToIgnore, false);
|
||||
if (foundE)
|
||||
return foundE;
|
||||
|
||||
foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], centre, distance, entityToIgnore, false);
|
||||
foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], centre, radius, entityToIgnore, false);
|
||||
if (foundE)
|
||||
return foundE;
|
||||
}
|
||||
if (checkPeds) {
|
||||
foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_PEDS], centre, distance, entityToIgnore, false);
|
||||
foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_PEDS], centre, radius, entityToIgnore, false);
|
||||
if (foundE)
|
||||
return foundE;
|
||||
|
||||
foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_PEDS_OVERLAP], centre, distance, entityToIgnore, false);
|
||||
foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_PEDS_OVERLAP], centre, radius, entityToIgnore, false);
|
||||
if (foundE)
|
||||
return foundE;
|
||||
}
|
||||
if (checkObjects) {
|
||||
foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_OBJECTS], centre, distance, entityToIgnore, ignoreSomeObjects);
|
||||
foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_OBJECTS], centre, radius, entityToIgnore, ignoreSomeObjects);
|
||||
if (foundE)
|
||||
return foundE;
|
||||
|
||||
foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], centre, distance, entityToIgnore, ignoreSomeObjects);
|
||||
foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], centre, radius, entityToIgnore, ignoreSomeObjects);
|
||||
if (foundE)
|
||||
return foundE;
|
||||
}
|
||||
if (checkDummies) {
|
||||
foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_DUMMIES], centre, distance, entityToIgnore, false);
|
||||
foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_DUMMIES], centre, radius, entityToIgnore, false);
|
||||
if (foundE)
|
||||
return foundE;
|
||||
|
||||
foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], centre, distance, entityToIgnore, false);
|
||||
foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], centre, radius, entityToIgnore, false);
|
||||
if (foundE)
|
||||
return foundE;
|
||||
}
|
||||
@ -806,7 +807,7 @@ CWorld::TestSphereAgainstSectorList(CPtrList &list, CVector spherePos, float rad
|
||||
if (e->GetBoundRadius() + radius > distance) {
|
||||
CColModel *eCol = CModelInfo::GetModelInfo(e->m_modelIndex)->GetColModel();
|
||||
int collidedSpheres = CCollision::ProcessColModels(sphereMat, sphereCol, e->GetMatrix(),
|
||||
*eCol, &ms_testSpherePoint, nil, nil);
|
||||
*eCol, gaTempSphereColPoints, nil, nil);
|
||||
|
||||
if (collidedSpheres != 0 ||
|
||||
(e->IsVehicle() && ((CVehicle*)e)->m_vehType == VEHICLE_TYPE_CAR &&
|
||||
|
@ -60,8 +60,6 @@ class CWorld
|
||||
static uint16 &ms_nCurrentScanCode;
|
||||
|
||||
public:
|
||||
static CColPoint& ms_testSpherePoint;
|
||||
|
||||
static uint8 &PlayerInFocus;
|
||||
static CPlayerInfo (&Players)[NUMPLAYERS];
|
||||
static CEntity *&pIgnoreEntity;
|
||||
@ -101,7 +99,7 @@ public:
|
||||
static bool GetIsLineOfSightSectorClear(CSector §or, const CColLine &line, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSeeThrough, bool ignoreSomeObjects = false);
|
||||
static bool GetIsLineOfSightSectorListClear(CPtrList &list, const CColLine &line, bool ignoreSeeThrough, bool ignoreSomeObjects = false);
|
||||
|
||||
static CEntity *TestSphereAgainstWorld(CVector centre, float distance, 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 void FindObjectsInRangeSectorList(CPtrList&, CVector&, float, bool, short*, short, CEntity**);
|
||||
static void FindObjectsInRange(CVector&, float, bool, short*, short, CEntity**, bool, bool, bool, bool, bool);
|
||||
@ -141,6 +139,8 @@ public:
|
||||
static void Process();
|
||||
};
|
||||
|
||||
extern CColPoint *gaTempSphereColPoints;
|
||||
|
||||
class CPlayerPed;
|
||||
class CVehicle;
|
||||
CPlayerPed *FindPlayerPed(void);
|
||||
|
@ -204,3 +204,5 @@ enum Config {
|
||||
#define VC_PED_PORTS // various ports from VC's CPed, mostly subtle
|
||||
// #define NEW_WALK_AROUND_ALGORITHM // to make walking around vehicles/objects less awkward
|
||||
#define CANCELLABLE_CAR_ENTER
|
||||
|
||||
#define IMPROVED_CAMERA // Better Debug cam, and maybe more in the future
|
||||
|
@ -325,6 +325,7 @@ DoRWStuffStartOfFrame_Horizon(int16 TopRed, int16 TopGreen, int16 TopBlue, int16
|
||||
void
|
||||
DoRWStuffEndOfFrame(void)
|
||||
{
|
||||
CDebug::DisplayScreenStrings(); // custom
|
||||
CDebug::DebugDisplayTextBuffer();
|
||||
// FlushObrsPrintfs();
|
||||
RwCameraEndUpdate(Scene.camera);
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "debugmenu_public.h"
|
||||
#include "Particle.h"
|
||||
#include "Console.h"
|
||||
#include "Debug.h"
|
||||
|
||||
#include <vector>
|
||||
#include <list>
|
||||
@ -114,13 +115,16 @@ SpawnCar(int id)
|
||||
CStreaming::LoadAllRequestedModels(false);
|
||||
if(CStreaming::HasModelLoaded(id)){
|
||||
playerpos = FindPlayerCoors();
|
||||
int node = ThePaths.FindNodeClosestToCoors(playerpos, 0, 100.0f, false, false);
|
||||
if(node < 0)
|
||||
return;
|
||||
int node;
|
||||
if(!CModelInfo::IsBoatModel(id)){
|
||||
node = ThePaths.FindNodeClosestToCoors(playerpos, 0, 100.0f, false, false);
|
||||
if(node < 0)
|
||||
return;
|
||||
}
|
||||
|
||||
CVehicle *v;
|
||||
if(CModelInfo::IsBoatModel(id))
|
||||
return;
|
||||
v = new CBoat(id, RANDOM_VEHICLE);
|
||||
else
|
||||
v = new CAutomobile(id, RANDOM_VEHICLE);
|
||||
|
||||
@ -130,7 +134,11 @@ SpawnCar(int id)
|
||||
if(carCol2)
|
||||
DebugMenuEntrySetAddress(carCol2, &v->m_currentColour2);
|
||||
|
||||
v->GetPosition() = ThePaths.m_pathNodes[node].pos;
|
||||
if(CModelInfo::IsBoatModel(id))
|
||||
v->GetPosition() = TheCamera.GetPosition() + TheCamera.GetForward()*15.0f;
|
||||
else
|
||||
v->GetPosition() = ThePaths.m_pathNodes[node].pos;
|
||||
|
||||
v->GetPosition().z += 4.0f;
|
||||
v->SetOrientation(0.0f, 0.0f, 3.49f);
|
||||
v->m_status = STATUS_ABANDONED;
|
||||
@ -197,6 +205,12 @@ PlaceOnRoad(void)
|
||||
((CAutomobile*)veh)->PlaceOnRoadProperly();
|
||||
}
|
||||
|
||||
static void
|
||||
ResetCamStatics(void)
|
||||
{
|
||||
TheCamera.Cams[TheCamera.ActiveCam].ResetStatics = true;
|
||||
}
|
||||
|
||||
static const char *carnames[] = {
|
||||
"landstal", "idaho", "stinger", "linerun", "peren", "sentinel", "patriot", "firetruk", "trash", "stretch", "manana", "infernus", "blista", "pony",
|
||||
"mule", "cheetah", "ambulan", "fbicar", "moonbeam", "esperant", "taxi", "kuruma", "bobcat", "mrwhoop", "bfinject", "corpse", "police", "enforcer",
|
||||
@ -358,7 +372,17 @@ DebugMenuPopulate(void)
|
||||
|
||||
DebugMenuAddCmd("Debug", "Start Credits", CCredits::Start);
|
||||
DebugMenuAddCmd("Debug", "Stop Credits", CCredits::Stop);
|
||||
|
||||
|
||||
extern bool PrintDebugCode;
|
||||
extern int16 &DebugCamMode;
|
||||
DebugMenuAddVarBool8("Cam", "Print Debug Code", (int8*)&PrintDebugCode, nil);
|
||||
DebugMenuAddVar("Cam", "Cam Mode", &DebugCamMode, nil, 1, 0, CCam::MODE_EDITOR, nil);
|
||||
DebugMenuAddCmd("Cam", "Normal", []() { DebugCamMode = 0; });
|
||||
DebugMenuAddCmd("Cam", "Follow Ped With Bind", []() { DebugCamMode = CCam::MODE_FOLLOW_PED_WITH_BIND; });
|
||||
DebugMenuAddCmd("Cam", "Reaction", []() { DebugCamMode = CCam::MODE_REACTION; });
|
||||
DebugMenuAddCmd("Cam", "Chris", []() { DebugCamMode = CCam::MODE_CHRIS; });
|
||||
DebugMenuAddCmd("Cam", "Reset Statics", ResetCamStatics);
|
||||
|
||||
CTweakVars::AddDBG("Debug");
|
||||
}
|
||||
}
|
||||
@ -433,7 +457,8 @@ void re3_debug(const char *format, ...)
|
||||
vsprintf_s(re3_buff, re3_buffsize, format, va);
|
||||
va_end(va);
|
||||
|
||||
printf("%s", re3_buff);
|
||||
// printf("%s", re3_buff);
|
||||
CDebug::DebugAddText(re3_buff);
|
||||
}
|
||||
|
||||
void re3_trace(const char *filename, unsigned int lineno, const char *func, const char *format, ...)
|
||||
|
Reference in New Issue
Block a user