1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-23 07:40:01 +00:00

more cleanup

This commit is contained in:
aap 2020-06-14 23:16:22 +02:00
parent b77d044729
commit e6d2b49121
3 changed files with 40 additions and 41 deletions

View file

@ -111,7 +111,11 @@ CCam::Process(void)
Fwd.x = CamTargetEntity->GetForward().x; Fwd.x = CamTargetEntity->GetForward().x;
Fwd.y = CamTargetEntity->GetForward().y; Fwd.y = CamTargetEntity->GetForward().y;
Fwd.Normalise(); Fwd.Normalise();
// Game normalizes again here manually. useless, so skipped float FwdLength = Fwd.Magnitude2D();
if(FwdLength != 0.0f){
Fwd.x /= FwdLength;
Fwd.y /= FwdLength;
}
float FwdSpeedX = ((CVehicle*)CamTargetEntity)->GetMoveSpeed().x * Fwd.x; float FwdSpeedX = ((CVehicle*)CamTargetEntity)->GetMoveSpeed().x * Fwd.x;
float FwdSpeedY = ((CVehicle*)CamTargetEntity)->GetMoveSpeed().y * Fwd.y; float FwdSpeedY = ((CVehicle*)CamTargetEntity)->GetMoveSpeed().y * Fwd.y;
@ -272,7 +276,7 @@ CCam::Process(void)
CVector TargetToCam = Source - m_cvecTargetCoorsForFudgeInter; CVector TargetToCam = Source - m_cvecTargetCoorsForFudgeInter;
float DistOnGround = TargetToCam.Magnitude2D(); float DistOnGround = TargetToCam.Magnitude2D();
m_fTrueBeta = CGeneral::GetATanOfXY(TargetToCam.x, TargetToCam.y); m_fTrueBeta = CGeneral::GetATanOfXY(TargetToCam.x, TargetToCam.y);
m_fTrueAlpha = CGeneral::GetATanOfXY(TargetToCam.z, DistOnGround); m_fTrueAlpha = CGeneral::GetATanOfXY(DistOnGround, TargetToCam.z);
if(TheCamera.m_uiTransitionState == 0) if(TheCamera.m_uiTransitionState == 0)
KeepTrackOfTheSpeed(Source, m_cvecTargetCoorsForFudgeInter, Up, m_fTrueAlpha, m_fTrueBeta, FOV); KeepTrackOfTheSpeed(Source, m_cvecTargetCoorsForFudgeInter, Up, m_fTrueAlpha, m_fTrueBeta, FOV);
@ -2585,7 +2589,7 @@ CCam::Process_M16_1stPerson(const CVector &CameraTarget, float, float, float)
while(Beta >= PI) Beta -= 2*PI; while(Beta >= PI) Beta -= 2*PI;
while(Beta < -PI) Beta += 2*PI; while(Beta < -PI) Beta += 2*PI;
if(Alpha > DEGTORAD(60.0f)) Alpha = DEGTORAD(60.0f); if(Alpha > DEGTORAD(60.0f)) Alpha = DEGTORAD(60.0f);
if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f); else if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
#ifdef GTA3_1_1_PATCH #ifdef GTA3_1_1_PATCH
HeadPos.x = 0.0f; HeadPos.x = 0.0f;
@ -2876,7 +2880,7 @@ CCam::Process_1rstPersonPedOnPC(const CVector&, float TargetOrientation, float,
while(Beta >= PI) Beta -= 2*PI; while(Beta >= PI) Beta -= 2*PI;
while(Beta < -PI) Beta += 2*PI; while(Beta < -PI) Beta += 2*PI;
if(Alpha > DEGTORAD(60.0f)) Alpha = DEGTORAD(60.0f); if(Alpha > DEGTORAD(60.0f)) Alpha = DEGTORAD(60.0f);
if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f); else if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
TargetCoors.x = 3.0f * Cos(Alpha) * Cos(Beta) + Source.x; TargetCoors.x = 3.0f * Cos(Alpha) * Cos(Beta) + Source.x;
TargetCoors.y = 3.0f * Cos(Alpha) * Sin(Beta) + Source.y; TargetCoors.y = 3.0f * Cos(Alpha) * Sin(Beta) + Source.y;
@ -2920,13 +2924,8 @@ CCam::Process_1rstPersonPedOnPC(const CVector&, float TargetOrientation, float,
void void
CCam::Process_Sniper(const CVector &CameraTarget, float TargetOrientation, float, float) CCam::Process_Sniper(const CVector &CameraTarget, float TargetOrientation, float, float)
{ {
if(CamTargetEntity->m_rwObject == nil)
return;
#ifdef FIX_BUGS
if(!CamTargetEntity->IsPed()) if(!CamTargetEntity->IsPed())
return; return;
#endif
static bool FailedTestTwelveFramesAgo = false; static bool FailedTestTwelveFramesAgo = false;
RwV3d HeadPos; RwV3d HeadPos;
@ -2936,9 +2935,9 @@ CCam::Process_Sniper(const CVector &CameraTarget, float TargetOrientation, float
static float TargetFOV = 0.0f; static float TargetFOV = 0.0f;
if(ResetStatics){ if(ResetStatics){
Beta = TargetOrientation; Beta = ((CPed*)CamTargetEntity)->m_fRotationCur + HALFPI;
Alpha = 0.0f; Alpha = 0.0f;
m_fInitialPlayerOrientation = TargetOrientation; m_fInitialPlayerOrientation = ((CPed*)CamTargetEntity)->m_fRotationCur + HALFPI;
FailedTestTwelveFramesAgo = false; FailedTestTwelveFramesAgo = false;
// static DPadVertical unused // static DPadVertical unused
// static DPadHorizontal unused // static DPadHorizontal unused
@ -2979,7 +2978,7 @@ CCam::Process_Sniper(const CVector &CameraTarget, float TargetOrientation, float
while(Beta >= PI) Beta -= 2*PI; while(Beta >= PI) Beta -= 2*PI;
while(Beta < -PI) Beta += 2*PI; while(Beta < -PI) Beta += 2*PI;
if(Alpha > DEGTORAD(60.0f)) Alpha = DEGTORAD(60.0f); if(Alpha > DEGTORAD(60.0f)) Alpha = DEGTORAD(60.0f);
if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f); else if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
TargetCoors.x = 3.0f * Cos(Alpha) * Cos(Beta) + Source.x; TargetCoors.x = 3.0f * Cos(Alpha) * Cos(Beta) + Source.x;
TargetCoors.y = 3.0f * Cos(Alpha) * Sin(Beta) + Source.y; TargetCoors.y = 3.0f * Cos(Alpha) * Sin(Beta) + Source.y;
@ -3627,12 +3626,12 @@ CCam::Process_WheelCam(const CVector&, float, float, float)
} }
CVector NewUp(0.0f, 0.0f, 1.0f); CVector NewUp(0.0f, 0.0f, 1.0f);
CVector Left = CrossProduct(Front, NewUp); CVector Right = CrossProduct(Front, NewUp);
Left.Normalise(); Right.Normalise();
NewUp = CrossProduct(Left, Front); NewUp = CrossProduct(Right, Front);
float Roll = Cos((CTimer::GetTimeInMilliseconds()&0x1FFFF)/(float)0x1FFFF * TWOPI); float Roll = Cos((CTimer::GetTimeInMilliseconds()&0x1FFFF)/(float)0x1FFFF * TWOPI);
Up = Cos(Roll*0.4f)*NewUp + Sin(Roll*0.4f)*Left; Up = Cos(Roll*0.4f)*NewUp + Sin(Roll*0.4f)*Right;
} }
void void
@ -3753,7 +3752,7 @@ CCam::Process_Debug(const CVector&, float, float, float)
TargetCoors.z = Source.z + Sin(Alpha) * 3.0f; TargetCoors.z = Source.z + Sin(Alpha) * 3.0f;
if(Alpha > DEGTORAD(89.5f)) Alpha = DEGTORAD(89.5f); if(Alpha > DEGTORAD(89.5f)) Alpha = DEGTORAD(89.5f);
if(Alpha < DEGTORAD(-89.5f)) Alpha = DEGTORAD(-89.5f); else if(Alpha < DEGTORAD(-89.5f)) Alpha = DEGTORAD(-89.5f);
if(CPad::GetPad(1)->GetSquare() || KEYDOWN('W')) if(CPad::GetPad(1)->GetSquare() || KEYDOWN('W'))
Speed += 0.1f; Speed += 0.1f;
@ -3846,7 +3845,7 @@ CCam::Process_Debug(const CVector&, float, float, float)
TargetCoors.z = Source.z + Sin(Alpha) * 3.0f; TargetCoors.z = Source.z + Sin(Alpha) * 3.0f;
if(Alpha > DEGTORAD(89.5f)) Alpha = DEGTORAD(89.5f); if(Alpha > DEGTORAD(89.5f)) Alpha = DEGTORAD(89.5f);
if(Alpha < DEGTORAD(-89.5f)) Alpha = DEGTORAD(-89.5f); else if(Alpha < DEGTORAD(-89.5f)) Alpha = DEGTORAD(-89.5f);
if(CPad::GetPad(1)->GetSquare() || CPad::GetPad(1)->GetLeftMouse()) if(CPad::GetPad(1)->GetSquare() || CPad::GetPad(1)->GetLeftMouse())
Speed += 0.1f; Speed += 0.1f;
@ -3925,7 +3924,7 @@ CCam::Process_Editor(const CVector&, float, float, float)
CSceneEdit::m_vecCamHeading = TargetCoors - Source; CSceneEdit::m_vecCamHeading = TargetCoors - Source;
if(Alpha > DEGTORAD(89.5f)) Alpha = DEGTORAD(89.5f); if(Alpha > DEGTORAD(89.5f)) Alpha = DEGTORAD(89.5f);
if(Alpha < DEGTORAD(-89.5f)) Alpha = DEGTORAD(-89.5f); else if(Alpha < DEGTORAD(-89.5f)) Alpha = DEGTORAD(-89.5f);
if(CPad::GetPad(1)->GetSquare() || CPad::GetPad(1)->GetLeftMouse()) if(CPad::GetPad(1)->GetSquare() || CPad::GetPad(1)->GetLeftMouse())
Speed += 0.1f; Speed += 0.1f;
@ -4056,11 +4055,11 @@ bool
CCam::ProcessArrestCamOne(void) CCam::ProcessArrestCamOne(void)
{ {
FOV = 45.0f; FOV = 45.0f;
if(ResetStatics) if(!ResetStatics)
return true; return true;
#ifdef FIX_BUGS #ifdef FIX_BUGS
if(!CamTargetEntity->IsPed()) if(!CamTargetEntity->IsPed() || ((CPlayerPed*)TheCamera.pTargetEntity)->m_pArrestingCop == nil)
return true; return true;
#endif #endif
@ -4597,7 +4596,7 @@ CCam::Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrient
while(Beta >= PI) Beta -= 2.0f*PI; while(Beta >= PI) Beta -= 2.0f*PI;
while(Beta < -PI) Beta += 2.0f*PI; while(Beta < -PI) Beta += 2.0f*PI;
if(Alpha > DEGTORAD(45.0f)) Alpha = DEGTORAD(45.0f); if(Alpha > DEGTORAD(45.0f)) Alpha = DEGTORAD(45.0f);
if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f); else if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
float BetaDiff = TargetOrientation+PI - Beta; float BetaDiff = TargetOrientation+PI - Beta;

View file

@ -659,8 +659,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;
@ -676,16 +676,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)
{ {
@ -711,39 +711,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

@ -102,8 +102,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);