Finished CCam; various smaller things

This commit is contained in:
aap 2020-03-26 14:16:06 +01:00
parent 8703758a7b
commit f0dfaac838
18 changed files with 4397 additions and 1266 deletions

View File

@ -43,7 +43,6 @@ CBoat
CBrightLights CBrightLights
CBulletInfo CBulletInfo
CBulletTraces CBulletTraces
CCam
CCamera CCamera
CCopPed CCopPed
CCrane CCrane

View File

@ -2,5 +2,10 @@
#include "patcher.h" #include "patcher.h"
#include "SceneEdit.h" #include "SceneEdit.h"
int &CSceneEdit::m_bCameraFollowActor = *(int*)0x940590;
bool &CSceneEdit::m_bRecording = *(bool*)0x95CD1F;
CVector &CSceneEdit::m_vecCurrentPosition = *(CVector*)0x943064;
CVector &CSceneEdit::m_vecCamHeading = *(CVector*)0x942F8C;
WRAPPER void CSceneEdit::Update(void) { EAXJMP(0x585570); } WRAPPER void CSceneEdit::Update(void) { EAXJMP(0x585570); }
WRAPPER void CSceneEdit::Init(void) { EAXJMP(0x585170); } WRAPPER void CSceneEdit::Init(void) { EAXJMP(0x585170); }

View File

@ -3,6 +3,11 @@
class CSceneEdit class CSceneEdit
{ {
public: public:
static int &m_bCameraFollowActor;
static bool &m_bRecording;
static CVector &m_vecCurrentPosition;
static CVector &m_vecCamHeading;
static void Update(void); static void Update(void);
static void Init(void); static void Init(void);
}; };

4147
src/core/Cam.cpp Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -5,6 +5,8 @@ class CEntity;
class CPed; class CPed;
class CAutomobile; class CAutomobile;
extern int16 &DebugCamMode;
#define NUMBER_OF_VECTORS_FOR_AVERAGE 2 #define NUMBER_OF_VECTORS_FOR_AVERAGE 2
struct CCam struct CCam
@ -66,17 +68,17 @@ struct CCam
bool m_bTheHeightFixerVehicleIsATrain; bool m_bTheHeightFixerVehicleIsATrain;
bool LookBehindCamWasInFront; bool LookBehindCamWasInFront;
bool LookingBehind; bool LookingBehind;
bool LookingLeft; // 32 bool LookingLeft;
bool LookingRight; bool LookingRight;
bool ResetStatics; //for interpolation type stuff to work bool ResetStatics; //for interpolation type stuff to work
bool Rotating; bool Rotating;
int16 Mode; // CameraMode int16 Mode; // CameraMode
uint32 m_uiFinishTime; // 52 uint32 m_uiFinishTime;
int m_iDoCollisionChecksOnFrameNum; int m_iDoCollisionChecksOnFrameNum;
int m_iDoCollisionCheckEveryNumOfFrames; int m_iDoCollisionCheckEveryNumOfFrames;
int m_iFrameNumWereAt; // 64 int m_iFrameNumWereAt;
int m_iRunningVectorArrayPos; int m_iRunningVectorArrayPos;
int m_iRunningVectorCounter; int m_iRunningVectorCounter;
int DirectionWasLooking; int DirectionWasLooking;
@ -85,9 +87,9 @@ struct CCam
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_fUnknownZOffSet; float m_fRoadOffSet;
float m_fAmountFractionObscured; float m_fAmountFractionObscured;
float m_fAlphaSpeedOverOneFrame; // 100 float m_fAlphaSpeedOverOneFrame;
float m_fBetaSpeedOverOneFrame; float m_fBetaSpeedOverOneFrame;
float m_fBufferedTargetBeta; float m_fBufferedTargetBeta;
float m_fBufferedTargetOrientation; float m_fBufferedTargetOrientation;
@ -95,7 +97,7 @@ struct CCam
float m_fCamBufferedHeight; float m_fCamBufferedHeight;
float m_fCamBufferedHeightSpeed; float m_fCamBufferedHeightSpeed;
float m_fCloseInPedHeightOffset; float m_fCloseInPedHeightOffset;
float m_fCloseInPedHeightOffsetSpeed; // 132 float m_fCloseInPedHeightOffsetSpeed;
float m_fCloseInCarHeightOffset; float m_fCloseInCarHeightOffset;
float m_fCloseInCarHeightOffsetSpeed; float m_fCloseInCarHeightOffsetSpeed;
float m_fDimensionOfHighestNearCar; float m_fDimensionOfHighestNearCar;
@ -103,7 +105,7 @@ struct CCam
float m_fFovSpeedOverOneFrame; float m_fFovSpeedOverOneFrame;
float m_fMinDistAwayFromCamWhenInterPolating; float m_fMinDistAwayFromCamWhenInterPolating;
float m_fPedBetweenCameraHeightOffset; float m_fPedBetweenCameraHeightOffset;
float m_fPlayerInFrontSyphonAngleOffSet; // 164 float m_fPlayerInFrontSyphonAngleOffSet;
float m_fRadiusForDead; float m_fRadiusForDead;
float m_fRealGroundDist; //used for follow ped mode float m_fRealGroundDist; //used for follow ped mode
float m_fTargetBeta; float m_fTargetBeta;
@ -111,7 +113,7 @@ struct CCam
float m_fTransitionBeta; float m_fTransitionBeta;
float m_fTrueBeta; float m_fTrueBeta;
float m_fTrueAlpha; // 200 float m_fTrueAlpha;
float m_fInitialPlayerOrientation; //used for first person float m_fInitialPlayerOrientation; //used for first person
float Alpha; float Alpha;
@ -120,34 +122,25 @@ struct CCam
float FOVSpeed; float FOVSpeed;
float Beta; float Beta;
float BetaSpeed; float BetaSpeed;
float Distance; // 232 float Distance;
float DistanceSpeed; float DistanceSpeed;
float CA_MIN_DISTANCE; float CA_MIN_DISTANCE;
float CA_MAX_DISTANCE; float CA_MAX_DISTANCE;
float SpeedVar; float SpeedVar;
// ped onfoot zoom distance CVector m_cvecSourceSpeedOverOneFrame;
float m_fTargetZoomGroundOne; CVector m_cvecTargetSpeedOverOneFrame;
float m_fTargetZoomGroundTwo; // 256 CVector m_cvecUpOverOneFrame;
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_cvecTargetCoorsForFudgeInter; // 360 CVector m_cvecTargetCoorsForFudgeInter;
CVector m_cvecCamFixedModeVector; // 372 CVector m_cvecCamFixedModeVector;
CVector m_cvecCamFixedModeSource; // 384 CVector m_cvecCamFixedModeSource;
CVector m_cvecCamFixedModeUpOffSet; // 396 CVector m_cvecCamFixedModeUpOffSet;
CVector m_vecLastAboveWaterCamPosition; //408 //helper for when the player has gone under the water CVector m_vecLastAboveWaterCamPosition; //helper for when the player has gone under the water
CVector m_vecBufferedPlayerBodyOffset; // 420 CVector m_vecBufferedPlayerBodyOffset;
// The three vectors that determine this camera for this frame // 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 Source; // Coors in world space
CVector SourceBeforeLookBehind; CVector SourceBeforeLookBehind;
CVector Up; // Just that CVector Up; // Just that
@ -162,6 +155,10 @@ struct CCam
bool m_bFirstPersonRunAboutActive; bool m_bFirstPersonRunAboutActive;
CCam(void) { Init(); }
void Init(void);
void Process(void);
void ProcessSpecialHeightRoutines(void);
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);
@ -171,13 +168,44 @@ struct CCam
bool FixCamIfObscured(CVector &TargetCoors, float TargetHeight, 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);
bool Using3rdPersonMouseCam(); void LookBehind(void);
bool GetWeaponFirstPersonOn(); 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_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_BehindCar(const CVector &CameraTarget, float TargetOrientation, float, float);
void Process_Cam_On_A_String(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);
}; };
static_assert(sizeof(CCam) == 0x1A4, "CCam: wrong size"); static_assert(sizeof(CCam) == 0x1A4, "CCam: wrong size");
static_assert(offsetof(CCam, Alpha) == 0xA8, "CCam: error"); static_assert(offsetof(CCam, Alpha) == 0xA8, "CCam: error");
@ -223,6 +251,7 @@ enum
FADE_OUT = 0, FADE_OUT = 0,
FADE_IN, FADE_IN,
FADE_NONE
}; };
enum enum
@ -445,8 +474,8 @@ uint32 unknown;
uint32 m_fScriptTimeForInterPolation; uint32 m_fScriptTimeForInterPolation;
int16 m_iFadingDirection; int16 m_iFadingDirection;
int m_iModeObbeCamIsInForCar; int m_iModeObbeCamIsInForCar;
int16 m_iModeToGoTo; int16 m_iModeToGoTo;
int16 m_iMusicFadingDirection; int16 m_iMusicFadingDirection;
int16 m_iTypeOfSwitch; int16 m_iTypeOfSwitch;
@ -493,6 +522,7 @@ int m_iModeObbeCamIsInForCar;
void TakeControlNoEntity(const CVector&, int16, int32); void TakeControlNoEntity(const CVector&, int16, int32);
void SetCamPositionForFixedMode(const CVector&, const CVector&); void SetCamPositionForFixedMode(const CVector&, const CVector&);
bool GetFading(); bool GetFading();
int GetFadingDirection();
void Init(); void Init();
void SetRwCamera(RwCamera*); void SetRwCamera(RwCamera*);
@ -525,8 +555,12 @@ static_assert(offsetof(CCamera, m_uiTransitionState) == 0x89, "CCamera: error");
static_assert(offsetof(CCamera, m_uiTimeTransitionStart) == 0x94, "CCamera: error"); static_assert(offsetof(CCamera, m_uiTimeTransitionStart) == 0x94, "CCamera: error");
static_assert(offsetof(CCamera, m_BlurBlue) == 0x9C, "CCamera: error"); static_assert(offsetof(CCamera, m_BlurBlue) == 0x9C, "CCamera: error");
static_assert(offsetof(CCamera, Cams) == 0x1A4, "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_vecCutSceneOffset) == 0x6F8, "CCamera: error");
static_assert(offsetof(CCamera, m_arrPathArray) == 0x7a8, "CCamera: error");
static_assert(sizeof(CCamera) == 0xE9D8, "CCamera: wrong size"); static_assert(sizeof(CCamera) == 0xE9D8, "CCamera: wrong size");
extern CCamera &TheCamera; extern CCamera &TheCamera;
void CamShakeNoPos(CCamera*, float); void CamShakeNoPos(CCamera*, float);

View File

@ -89,3 +89,49 @@ CDebug::DebugDisplayTextBuffer()
} }
#endif #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++;
}

View File

@ -6,15 +6,29 @@ class CDebug
{ {
MAX_LINES = 15, MAX_LINES = 15,
MAX_STR_LEN = 80, MAX_STR_LEN = 80,
MAX_SCREEN_STRS = 100,
}; };
static int16 ms_nCurrentTextLine; static int16 ms_nCurrentTextLine;
static char ms_aTextBuffer[MAX_LINES][MAX_STR_LEN]; 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: public:
static void DebugInitTextBuffer(); static void DebugInitTextBuffer();
static void DebugDisplayTextBuffer(); static void DebugDisplayTextBuffer();
static void DebugAddText(const char *str); static void DebugAddText(const char *str);
// custom
static void PrintAt(const char *str, int x, int y);
static void DisplayScreenStrings();
}; };
extern bool gbDebugStuffInRelease; extern bool gbDebugStuffInRelease;

View File

@ -399,6 +399,8 @@ public:
bool GetLeftShoulder2JustDown() { return !!(NewState.LeftShoulder2 && !OldState.LeftShoulder2); } bool GetLeftShoulder2JustDown() { return !!(NewState.LeftShoulder2 && !OldState.LeftShoulder2); }
bool GetRightShoulder1JustDown() { return !!(NewState.RightShoulder1 && !OldState.RightShoulder1); } bool GetRightShoulder1JustDown() { return !!(NewState.RightShoulder1 && !OldState.RightShoulder1); }
bool GetRightShoulder2JustDown() { return !!(NewState.RightShoulder2 && !OldState.RightShoulder2); } 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 GetStartJustDown() { return !!(NewState.Start && !OldState.Start); }
bool GetLeftStickXJustDown() { return !!(NewState.LeftStickX && !OldState.LeftStickX); } bool GetLeftStickXJustDown() { return !!(NewState.LeftStickX && !OldState.LeftStickX); }
bool GetLeftStickYJustDown() { return !!(NewState.LeftStickY && !OldState.LeftStickY); } bool GetLeftStickYJustDown() { return !!(NewState.LeftStickY && !OldState.LeftStickY); }
@ -422,6 +424,10 @@ public:
bool GetLeftShoulder2(void) { return !!NewState.LeftShoulder2; } bool GetLeftShoulder2(void) { return !!NewState.LeftShoulder2; }
bool GetRightShoulder1(void) { return !!NewState.RightShoulder1; } bool GetRightShoulder1(void) { return !!NewState.RightShoulder1; }
bool GetRightShoulder2(void) { return !!NewState.RightShoulder2; } 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; } bool ArePlayerControlsDisabled(void) { return DisablePlayerControls != PLAYERCONTROL_ENABLED; }
}; };

View File

@ -20,11 +20,12 @@
#include "Replay.h" #include "Replay.h"
#include "Population.h" #include "Population.h"
CColPoint *gaTempSphereColPoints = (CColPoint*)0x6E64C0; // [32]
CPtrList *CWorld::ms_bigBuildingsList = (CPtrList*)0x6FAB60; CPtrList *CWorld::ms_bigBuildingsList = (CPtrList*)0x6FAB60;
CPtrList &CWorld::ms_listMovingEntityPtrs = *(CPtrList*)0x8F433C; CPtrList &CWorld::ms_listMovingEntityPtrs = *(CPtrList*)0x8F433C;
CSector (*CWorld::ms_aSectors)[NUMSECTORS_X] = (CSector (*)[NUMSECTORS_Y])0x665608; CSector (*CWorld::ms_aSectors)[NUMSECTORS_X] = (CSector (*)[NUMSECTORS_Y])0x665608;
uint16 &CWorld::ms_nCurrentScanCode = *(uint16*)0x95CC64; uint16 &CWorld::ms_nCurrentScanCode = *(uint16*)0x95CC64;
CColPoint &CWorld::ms_testSpherePoint = *(CColPoint*)0x6E64C0;
uint8 &CWorld::PlayerInFocus = *(uint8 *)0x95CD61; uint8 &CWorld::PlayerInFocus = *(uint8 *)0x95CD61;
CPlayerInfo (&CWorld::Players)[NUMPLAYERS] = *(CPlayerInfo (*)[NUMPLAYERS])*(uintptr*)0x9412F0; CPlayerInfo (&CWorld::Players)[NUMPLAYERS] = *(CPlayerInfo (*)[NUMPLAYERS])*(uintptr*)0x9412F0;
@ -609,9 +610,9 @@ CWorld::GetIsLineOfSightSectorListClear(CPtrList &list, const CColLine &line, bo
} }
void void
CWorld::FindObjectsInRangeSectorList(CPtrList &list, CVector &centre, float distance, bool ignoreZ, short *nextObject, short lastObject, CEntity **objects) CWorld::FindObjectsInRangeSectorList(CPtrList &list, CVector &centre, float radius, bool ignoreZ, short *nextObject, short lastObject, CEntity **objects)
{ {
float distSqr = distance * distance; float radiusSqr = radius * radius;
float objDistSqr; float objDistSqr;
for (CPtrNode *node = list.first; node; node = node->next) { for (CPtrNode *node = list.first; node; node = node->next) {
@ -625,7 +626,7 @@ CWorld::FindObjectsInRangeSectorList(CPtrList &list, CVector &centre, float dist
else else
objDistSqr = diff.MagnitudeSqr(); objDistSqr = diff.MagnitudeSqr();
if (objDistSqr < distSqr && *nextObject < lastObject) { if (objDistSqr < radiusSqr && *nextObject < lastObject) {
if (objects) { if (objects) {
objects[*nextObject] = object; objects[*nextObject] = object;
} }
@ -636,22 +637,22 @@ CWorld::FindObjectsInRangeSectorList(CPtrList &list, CVector &centre, float dist
} }
void void
CWorld::FindObjectsInRange(CVector &centre, float distance, bool ignoreZ, short *nextObject, short lastObject, CEntity **objects, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies) CWorld::FindObjectsInRange(CVector &centre, 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; if (minX <= 0) minX = 0;
int minY = GetSectorIndexY(centre.y - distance); int minY = GetSectorIndexY(centre.y - radius);
if (minY <= 0) minY = 0; if (minY <= 0) minY = 0;
int maxX = GetSectorIndexX(centre.x + distance); int maxX = GetSectorIndexX(centre.x + radius);
#ifdef FIX_BUGS #ifdef FIX_BUGS
if (maxX >= NUMSECTORS_X) maxX = NUMSECTORS_X - 1; if (maxX >= NUMSECTORS_X) maxX = NUMSECTORS_X - 1;
#else #else
if (maxX >= NUMSECTORS_X) maxX = NUMSECTORS_X; if (maxX >= NUMSECTORS_X) maxX = NUMSECTORS_X;
#endif #endif
int maxY = GetSectorIndexY(centre.y + distance); int maxY = GetSectorIndexY(centre.y + radius);
#ifdef FIX_BUGS #ifdef FIX_BUGS
if (maxY >= NUMSECTORS_Y) maxY = NUMSECTORS_Y - 1; if (maxY >= NUMSECTORS_Y) maxY = NUMSECTORS_Y - 1;
#else #else
@ -665,48 +666,48 @@ CWorld::FindObjectsInRange(CVector &centre, float distance, bool ignoreZ, short
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, 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, distance, ignoreZ, nextObject, lastObject, objects); FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], centre, radius, ignoreZ, nextObject, lastObject, objects);
} }
if (checkVehicles) { if (checkVehicles) {
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_VEHICLES], 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, distance, ignoreZ, nextObject, lastObject, objects); FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], centre, radius, ignoreZ, nextObject, lastObject, objects);
} }
if (checkPeds) { if (checkPeds) {
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_PEDS], 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, distance, ignoreZ, nextObject, lastObject, objects); FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_PEDS_OVERLAP], centre, radius, ignoreZ, nextObject, lastObject, objects);
} }
if (checkObjects) { if (checkObjects) {
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_OBJECTS], 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, distance, ignoreZ, nextObject, lastObject, objects); FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], centre, radius, ignoreZ, nextObject, lastObject, objects);
} }
if (checkDummies) { if (checkDummies) {
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_DUMMIES], 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, distance, ignoreZ, nextObject, lastObject, objects); FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], centre, radius, ignoreZ, nextObject, lastObject, objects);
} }
} }
} }
} }
CEntity* 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; CEntity* foundE = nil;
int minX = GetSectorIndexX(centre.x - distance); int minX = GetSectorIndexX(centre.x - radius);
if (minX <= 0) minX = 0; if (minX <= 0) minX = 0;
int minY = GetSectorIndexY(centre.y - distance); int minY = GetSectorIndexY(centre.y - radius);
if (minY <= 0) minY = 0; if (minY <= 0) minY = 0;
int maxX = GetSectorIndexX(centre.x + distance); int maxX = GetSectorIndexX(centre.x + radius);
#ifdef FIX_BUGS #ifdef FIX_BUGS
if (maxX >= NUMSECTORS_X) maxX = NUMSECTORS_X - 1; if (maxX >= NUMSECTORS_X) maxX = NUMSECTORS_X - 1;
#else #else
if (maxX >= NUMSECTORS_X) maxX = NUMSECTORS_X; if (maxX >= NUMSECTORS_X) maxX = NUMSECTORS_X;
#endif #endif
int maxY = GetSectorIndexY(centre.y + distance); int maxY = GetSectorIndexY(centre.y + radius);
#ifdef FIX_BUGS #ifdef FIX_BUGS
if (maxY >= NUMSECTORS_Y) maxY = NUMSECTORS_Y - 1; if (maxY >= NUMSECTORS_Y) maxY = NUMSECTORS_Y - 1;
#else #else
@ -719,47 +720,47 @@ CWorld::TestSphereAgainstWorld(CVector centre, float distance, CEntity *entityTo
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) {
foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_BUILDINGS], centre, distance, entityToIgnore, false); foundE = TestSphereAgainstSectorList(sector->m_lists[ENTITYLIST_BUILDINGS], centre, radius, entityToIgnore, false);
if (foundE) if (foundE)
return 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) if (foundE)
return foundE; return foundE;
} }
if (checkVehicles) { 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) if (foundE)
return 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) if (foundE)
return foundE; return foundE;
} }
if (checkPeds) { 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) if (foundE)
return 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) if (foundE)
return foundE; return foundE;
} }
if (checkObjects) { 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) if (foundE)
return 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) if (foundE)
return foundE; return foundE;
} }
if (checkDummies) { 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) if (foundE)
return 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) if (foundE)
return foundE; return foundE;
} }
@ -806,7 +807,7 @@ CWorld::TestSphereAgainstSectorList(CPtrList &list, CVector spherePos, float rad
if (e->GetBoundRadius() + radius > distance) { if (e->GetBoundRadius() + radius > distance) {
CColModel *eCol = CModelInfo::GetModelInfo(e->m_modelIndex)->GetColModel(); CColModel *eCol = CModelInfo::GetModelInfo(e->m_modelIndex)->GetColModel();
int collidedSpheres = CCollision::ProcessColModels(sphereMat, sphereCol, e->GetMatrix(), int collidedSpheres = CCollision::ProcessColModels(sphereMat, sphereCol, e->GetMatrix(),
*eCol, &ms_testSpherePoint, nil, nil); *eCol, gaTempSphereColPoints, nil, nil);
if (collidedSpheres != 0 || if (collidedSpheres != 0 ||
(e->IsVehicle() && ((CVehicle*)e)->m_vehType == VEHICLE_TYPE_CAR && (e->IsVehicle() && ((CVehicle*)e)->m_vehType == VEHICLE_TYPE_CAR &&

View File

@ -60,8 +60,6 @@ class CWorld
static uint16 &ms_nCurrentScanCode; static uint16 &ms_nCurrentScanCode;
public: public:
static CColPoint& ms_testSpherePoint;
static uint8 &PlayerInFocus; static uint8 &PlayerInFocus;
static CPlayerInfo (&Players)[NUMPLAYERS]; static CPlayerInfo (&Players)[NUMPLAYERS];
static CEntity *&pIgnoreEntity; static CEntity *&pIgnoreEntity;
@ -101,7 +99,7 @@ public:
static bool GetIsLineOfSightSectorClear(CSector &sector, const CColLine &line, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSeeThrough, bool ignoreSomeObjects = false); static bool GetIsLineOfSightSectorClear(CSector &sector, 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 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 CEntity *TestSphereAgainstSectorList(CPtrList&, CVector, float, CEntity*, bool);
static void FindObjectsInRangeSectorList(CPtrList&, CVector&, float, bool, short*, short, CEntity**); static void FindObjectsInRangeSectorList(CPtrList&, CVector&, float, bool, short*, short, CEntity**);
static void FindObjectsInRange(CVector&, float, bool, short*, short, CEntity**, bool, bool, bool, bool, bool); static void FindObjectsInRange(CVector&, float, bool, short*, short, CEntity**, bool, bool, bool, bool, bool);
@ -141,6 +139,8 @@ public:
static void Process(); static void Process();
}; };
extern CColPoint *gaTempSphereColPoints;
class CPlayerPed; class CPlayerPed;
class CVehicle; class CVehicle;
CPlayerPed *FindPlayerPed(void); CPlayerPed *FindPlayerPed(void);

View File

@ -201,3 +201,5 @@ enum Config {
#define VC_PED_PORTS // various ports from VC's CPed, mostly subtle #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 NEW_WALK_AROUND_ALGORITHM // to make walking around vehicles/objects less awkward
#define CANCELLABLE_CAR_ENTER #define CANCELLABLE_CAR_ENTER
#define IMPROVED_CAMERA // Better Debug cam, and maybe more in the future

View File

@ -325,6 +325,7 @@ DoRWStuffStartOfFrame_Horizon(int16 TopRed, int16 TopGreen, int16 TopBlue, int16
void void
DoRWStuffEndOfFrame(void) DoRWStuffEndOfFrame(void)
{ {
CDebug::DisplayScreenStrings(); // custom
CDebug::DebugDisplayTextBuffer(); CDebug::DebugDisplayTextBuffer();
// FlushObrsPrintfs(); // FlushObrsPrintfs();
RwCameraEndUpdate(Scene.camera); RwCameraEndUpdate(Scene.camera);

View File

@ -20,6 +20,7 @@
#include "debugmenu_public.h" #include "debugmenu_public.h"
#include "Particle.h" #include "Particle.h"
#include "Console.h" #include "Console.h"
#include "Debug.h"
#include <vector> #include <vector>
#include <list> #include <list>
@ -114,13 +115,16 @@ SpawnCar(int id)
CStreaming::LoadAllRequestedModels(false); CStreaming::LoadAllRequestedModels(false);
if(CStreaming::HasModelLoaded(id)){ if(CStreaming::HasModelLoaded(id)){
playerpos = FindPlayerCoors(); playerpos = FindPlayerCoors();
int node = ThePaths.FindNodeClosestToCoors(playerpos, 0, 100.0f, false, false); int node;
if(node < 0) if(!CModelInfo::IsBoatModel(id)){
return; node = ThePaths.FindNodeClosestToCoors(playerpos, 0, 100.0f, false, false);
if(node < 0)
return;
}
CVehicle *v; CVehicle *v;
if(CModelInfo::IsBoatModel(id)) if(CModelInfo::IsBoatModel(id))
return; v = new CBoat(id, RANDOM_VEHICLE);
else else
v = new CAutomobile(id, RANDOM_VEHICLE); v = new CAutomobile(id, RANDOM_VEHICLE);
@ -130,7 +134,11 @@ SpawnCar(int id)
if(carCol2) if(carCol2)
DebugMenuEntrySetAddress(carCol2, &v->m_currentColour2); 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->GetPosition().z += 4.0f;
v->SetOrientation(0.0f, 0.0f, 3.49f); v->SetOrientation(0.0f, 0.0f, 3.49f);
v->m_status = STATUS_ABANDONED; v->m_status = STATUS_ABANDONED;
@ -197,6 +205,12 @@ PlaceOnRoad(void)
((CAutomobile*)veh)->PlaceOnRoadProperly(); ((CAutomobile*)veh)->PlaceOnRoadProperly();
} }
static void
ResetCamStatics(void)
{
TheCamera.Cams[TheCamera.ActiveCam].ResetStatics = true;
}
static const char *carnames[] = { static const char *carnames[] = {
"landstal", "idaho", "stinger", "linerun", "peren", "sentinel", "patriot", "firetruk", "trash", "stretch", "manana", "infernus", "blista", "pony", "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", "mule", "cheetah", "ambulan", "fbicar", "moonbeam", "esperant", "taxi", "kuruma", "bobcat", "mrwhoop", "bfinject", "corpse", "police", "enforcer",
@ -358,7 +372,13 @@ DebugMenuPopulate(void)
DebugMenuAddCmd("Debug", "Start Credits", CCredits::Start); DebugMenuAddCmd("Debug", "Start Credits", CCredits::Start);
DebugMenuAddCmd("Debug", "Stop Credits", CCredits::Stop); 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", "Reset Statics", ResetCamStatics);
CTweakVars::AddDBG("Debug"); CTweakVars::AddDBG("Debug");
} }
} }
@ -433,7 +453,8 @@ void re3_debug(const char *format, ...)
vsprintf_s(re3_buff, re3_buffsize, format, va); vsprintf_s(re3_buff, re3_buffsize, format, va);
va_end(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, ...) void re3_trace(const char *filename, unsigned int lineno, const char *func, const char *format, ...)

View File

@ -12169,11 +12169,11 @@ CPed::PlacePedOnDryLand(void)
if (!CWorld::TestSphereAgainstWorld(potentialGround, 5.0f, nil, true, false, false, false, false, false)) if (!CWorld::TestSphereAgainstWorld(potentialGround, 5.0f, nil, true, false, false, false, false, false))
return false; return false;
CVector potentialGroundDist = CWorld::ms_testSpherePoint.point - GetPosition(); CVector potentialGroundDist = gaTempSphereColPoints[0].point - GetPosition();
potentialGroundDist.z = 0.0f; potentialGroundDist.z = 0.0f;
potentialGroundDist.Normalise(); potentialGroundDist.Normalise();
CVector posToCheck = 0.5f * potentialGroundDist + CWorld::ms_testSpherePoint.point; CVector posToCheck = 0.5f * potentialGroundDist + gaTempSphereColPoints[0].point;
posToCheck.z = 3.0f + waterLevel; posToCheck.z = 3.0f + waterLevel;
if (CWorld::ProcessVerticalLine(posToCheck, waterLevel - 1.0f, foundCol, foundEnt, true, true, false, true, false, false, false)) { if (CWorld::ProcessVerticalLine(posToCheck, waterLevel - 1.0f, foundCol, foundEnt, true, true, false, true, false, false, false)) {

View File

@ -94,7 +94,7 @@ CFont::Initialise(void)
SetBackgroundColor(CRGBA(0x80, 0x80, 0x80, 0x80)); SetBackgroundColor(CRGBA(0x80, 0x80, 0x80, 0x80));
SetBackGroundOnlyTextOff(); SetBackGroundOnlyTextOff();
SetPropOn(); SetPropOn();
SetFontStyle(0); SetFontStyle(FONT_BANK);
SetRightJustifyWrap(0.0f); SetRightJustifyWrap(0.0f);
SetAlphaFade(255.0f); SetAlphaFade(255.0f);
SetDropShadowPosition(0); SetDropShadowPosition(0);

View File

@ -115,47 +115,43 @@ void CHud::Draw()
return; return;
if (m_Wants_To_Draw_Hud && !TheCamera.m_WideScreenOn) { if (m_Wants_To_Draw_Hud && !TheCamera.m_WideScreenOn) {
bool Mode_RunAround = 0; bool DrawCrossHair = 0;
bool Mode_FirstPerson = 0; bool DrawCrossHairPC = 0;
int32 WeaponType = FindPlayerPed()->m_weapons[FindPlayerPed()->m_currentWeapon].m_eWeaponType; int32 WeaponType = FindPlayerPed()->m_weapons[FindPlayerPed()->m_currentWeapon].m_eWeaponType;
int32 Mode = TheCamera.Cams[TheCamera.ActiveCam].Mode; int32 Mode = TheCamera.Cams[TheCamera.ActiveCam].Mode;
if (Mode == CCam::MODE_SNIPER || Mode == CCam::MODE_ROCKETLAUNCHER || Mode == CCam::MODE_M16_1STPERSON || Mode == CCam::MODE_EDITOR) if (Mode == CCam::MODE_SNIPER || Mode == CCam::MODE_ROCKETLAUNCHER || Mode == CCam::MODE_M16_1STPERSON || Mode == CCam::MODE_HELICANNON_1STPERSON)
Mode_FirstPerson = 1; DrawCrossHair = 1;
if (Mode == CCam::MODE_M16_1STPERSON_RUNABOUT || Mode == CCam::MODE_SNIPER_RUNABOUT) if (Mode == CCam::MODE_M16_1STPERSON_RUNABOUT || Mode == CCam::MODE_ROCKETLAUNCHER_RUNABOUT || Mode == CCam::MODE_SNIPER_RUNABOUT)
Mode_RunAround = 1; DrawCrossHairPC = 1;
/* /*
Draw Crosshairs Draw Crosshairs
*/ */
if (TheCamera.Cams->Using3rdPersonMouseCam() && (!CPad::GetPad(0)->GetLookBehindForPed() || TheCamera.m_bPlayerIsInGarage) || Mode == CCam::MODE_1STPERSON_RUNABOUT) { if (TheCamera.Cams[TheCamera.ActiveCam].Using3rdPersonMouseCam() &&
(!CPad::GetPad(0)->GetLookBehindForPed() || TheCamera.m_bPlayerIsInGarage) || Mode == CCam::MODE_1STPERSON_RUNABOUT) {
if (FindPlayerPed() && !FindPlayerPed()->EnteringCar()) { if (FindPlayerPed() && !FindPlayerPed()->EnteringCar()) {
if ((WeaponType >= WEAPONTYPE_COLT45 && WeaponType <= WEAPONTYPE_M16) || WeaponType == WEAPONTYPE_FLAMETHROWER) if ((WeaponType >= WEAPONTYPE_COLT45 && WeaponType <= WEAPONTYPE_M16) || WeaponType == WEAPONTYPE_FLAMETHROWER)
Mode_RunAround = 1; DrawCrossHairPC = 1;
} }
} }
if (Mode_FirstPerson || Mode_RunAround) { if (DrawCrossHair || DrawCrossHairPC) {
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void *)rwFILTERLINEAR); RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void *)rwFILTERLINEAR);
int32 SpriteBrightLikeADiamond = SpriteBrightness + 1; SpriteBrightness = min(SpriteBrightness+1, 30);
if (SpriteBrightLikeADiamond > 30)
SpriteBrightLikeADiamond = 30;
SpriteBrightness = SpriteBrightLikeADiamond;
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
float fStep = Sin((CTimer::GetTimeInMilliseconds() & 1023) * 0.0061328127); float fStep = Sin((CTimer::GetTimeInMilliseconds() & 1023)/1024.0f * 6.28f);
float fMultBright = SpriteBrightness * 0.03f * (0.25f * fStep + 0.75f); float fMultBright = SpriteBrightness * 0.03f * (0.25f * fStep + 0.75f);
CRect rect; CRect rect;
if (DrawCrossHairPC && TheCamera.Cams[TheCamera.ActiveCam].Using3rdPersonMouseCam()) {
#ifndef ASPECT_RATIO_SCALE #ifndef ASPECT_RATIO_SCALE
if (Mode_RunAround && TheCamera.Cams->Using3rdPersonMouseCam()) {
float f3rdX = SCREEN_WIDTH * TheCamera.m_f3rdPersonCHairMultX; float f3rdX = SCREEN_WIDTH * TheCamera.m_f3rdPersonCHairMultX;
float f3rdY = SCREEN_HEIGHT * TheCamera.m_f3rdPersonCHairMultY; float f3rdY = SCREEN_HEIGHT * TheCamera.m_f3rdPersonCHairMultY;
#else #else
if (Mode_RunAround && TheCamera.Cams->Using3rdPersonMouseCam()) {
float f3rdX = (((TheCamera.m_f3rdPersonCHairMultX - 0.5f) / ((CDraw::GetAspectRatio()) / (DEFAULT_ASPECT_RATIO))) + 0.5f) * SCREEN_WIDTH; float f3rdX = (((TheCamera.m_f3rdPersonCHairMultX - 0.5f) / ((CDraw::GetAspectRatio()) / (DEFAULT_ASPECT_RATIO))) + 0.5f) * SCREEN_WIDTH;
float f3rdY = SCREEN_HEIGHT * TheCamera.m_f3rdPersonCHairMultY + SCREEN_SCALE_Y(-2.0f); float f3rdY = SCREEN_HEIGHT * TheCamera.m_f3rdPersonCHairMultY + SCREEN_SCALE_Y(-2.0f);
#endif #endif
@ -179,14 +175,14 @@ void CHud::Draw()
else { else {
if (Mode == CCam::MODE_M16_1STPERSON || if (Mode == CCam::MODE_M16_1STPERSON ||
Mode == CCam::MODE_M16_1STPERSON_RUNABOUT || Mode == CCam::MODE_M16_1STPERSON_RUNABOUT ||
Mode == CCam::MODE_EDITOR) { Mode == CCam::MODE_HELICANNON_1STPERSON) {
rect.left = (SCREEN_WIDTH / 2) - SCREEN_SCALE_X(32.0f); rect.left = (SCREEN_WIDTH / 2) - SCREEN_SCALE_X(32.0f);
rect.top = (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(32.0f); rect.top = (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(32.0f);
rect.right = (SCREEN_WIDTH / 2) + SCREEN_SCALE_X(32.0f); rect.right = (SCREEN_WIDTH / 2) + SCREEN_SCALE_X(32.0f);
rect.bottom = (SCREEN_HEIGHT / 2) + SCREEN_SCALE_Y(32.0f); rect.bottom = (SCREEN_HEIGHT / 2) + SCREEN_SCALE_Y(32.0f);
Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255)); Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255));
} }
else if (Mode == CCam::MODE_ROCKETLAUNCHER_RUNABOUT) { else if (Mode == CCam::MODE_1STPERSON_RUNABOUT) {
rect.left = (SCREEN_WIDTH / 2) - SCREEN_SCALE_X(32.0f * 0.7f); rect.left = (SCREEN_WIDTH / 2) - SCREEN_SCALE_X(32.0f * 0.7f);
rect.top = (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(32.0f * 0.7f); rect.top = (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(32.0f * 0.7f);
rect.right = (SCREEN_WIDTH / 2) + SCREEN_SCALE_X(32.0f * 0.7f); rect.right = (SCREEN_WIDTH / 2) + SCREEN_SCALE_X(32.0f * 0.7f);
@ -194,17 +190,18 @@ void CHud::Draw()
Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255)); Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255));
} }
else if (Mode == CCam::MODE_ROCKETLAUNCHER || Mode == CCam::MODE_SNIPER_RUNABOUT) { else if (Mode == CCam::MODE_ROCKETLAUNCHER || Mode == CCam::MODE_ROCKETLAUNCHER_RUNABOUT) {
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void *)TRUE); RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void *)TRUE);
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void *)rwBLENDONE); RwRenderStateSet(rwRENDERSTATESRCBLEND, (void *)rwBLENDONE);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void *)rwBLENDONE); RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void *)rwBLENDONE);
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, gpRocketSightTex->raster); RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpRocketSightTex));
CSprite::RenderOneXLUSprite(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, 1.0f, SCREEN_SCALE_X(40.0f), SCREEN_SCALE_Y(40.0f), (100.0f * fMultBright), (200.0f * fMultBright), (100.0f * fMultBright), 255, 1.0f, 255); CSprite::RenderOneXLUSprite(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, 1.0f, SCREEN_SCALE_X(40.0f), SCREEN_SCALE_Y(40.0f), (100.0f * fMultBright), (200.0f * fMultBright), (100.0f * fMultBright), 255, 1.0f, 255);
} }
else { else {
// Sniper
rect.left = (SCREEN_WIDTH / 2) - SCREEN_SCALE_X(210.0f); rect.left = (SCREEN_WIDTH / 2) - SCREEN_SCALE_X(210.0f);
rect.top = (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(210.0f); rect.top = (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(210.0f);
rect.right = SCREEN_WIDTH / 2; rect.right = SCREEN_WIDTH / 2;

View File

@ -645,6 +645,9 @@ CRenderer::ScanWorld(void)
m_loadingPriority = false; m_loadingPriority = false;
if(TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN || if(TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN ||
#ifdef FIX_BUGS
TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_GTACLASSIC ||
#endif
TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOP_DOWN_PED){ TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOP_DOWN_PED){
CRect rect; CRect rect;
int x1, x2, y1, y2; int x1, x2, y1, y2;
@ -756,6 +759,9 @@ CRenderer::RequestObjectsInFrustum(void)
RwV3dTransformPoints((RwV3d*)vectors, (RwV3d*)vectors, 9, cammatrix); RwV3dTransformPoints((RwV3d*)vectors, (RwV3d*)vectors, 9, cammatrix);
if(TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN || if(TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN ||
#ifdef FIX_BUGS
TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_GTACLASSIC ||
#endif
TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOP_DOWN_PED){ TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOP_DOWN_PED){
CRect rect; CRect rect;
int x1, x2, y1, y2; int x1, x2, y1, y2;