Merge pull request #205 from erorcun/erorcun

Little cleanup
This commit is contained in:
aap 2019-09-12 14:39:47 +02:00 committed by GitHub
commit dec134c881
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 24 deletions

View File

@ -331,7 +331,7 @@ CWorld::ProcessVerticalLine(const CVector &point1, float z2, CColPoint &point, C
{ {
AdvanceCurrentScanCode(); AdvanceCurrentScanCode();
CVector point2(point1.x, point1.y, z2); CVector point2(point1.x, point1.y, z2);
return CWorld::ProcessVerticalLineSector(*GetSector(GetSectorIndexX(point1.x), GetSectorIndexX(point1.y)), return ProcessVerticalLineSector(*GetSector(GetSectorIndexX(point1.x), GetSectorIndexX(point1.y)),
CColLine(point1, point2), point, entity, CColLine(point1, point2), point, entity,
checkBuildings, checkVehicles, checkPeds, checkObjects, checkDummies, ignoreSeeThrough, poly); checkBuildings, checkVehicles, checkPeds, checkObjects, checkDummies, ignoreSeeThrough, poly);
} }
@ -605,8 +605,8 @@ CWorld::FindObjectsInRangeSectorList(CPtrList &list, CVector &centre, float dist
for (CPtrNode *node = list.first; node; node = node->next) { for (CPtrNode *node = list.first; node; node = node->next) {
CEntity *object = (CEntity*)node->item; CEntity *object = (CEntity*)node->item;
if (object->m_scanCode != CWorld::GetCurrentScanCode()) { if (object->m_scanCode != GetCurrentScanCode()) {
object->m_scanCode = CWorld::GetCurrentScanCode(); object->m_scanCode = GetCurrentScanCode();
CVector diff = centre - object->GetPosition(); CVector diff = centre - object->GetPosition();
if (ignoreZ) if (ignoreZ)
@ -941,11 +941,11 @@ CWorld::RemoveEntityInsteadOfProcessingIt(CEntity* ent)
{ {
if (ent->IsPed()) { if (ent->IsPed()) {
if (FindPlayerPed() == ent) if (FindPlayerPed() == ent)
CWorld::Remove(ent); Remove(ent);
else else
CPopulation::RemovePed(ent); CPopulation::RemovePed(ent);
} else { } else {
CWorld::Remove(ent); Remove(ent);
delete ent; delete ent;
} }
} }
@ -987,7 +987,7 @@ CWorld::RemoveFallenCars(void)
veh->Teleport(newPos); veh->Teleport(newPos);
veh->m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f); veh->m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
} else if (veh->VehicleCreatedBy == RANDOM_VEHICLE || veh->VehicleCreatedBy == PARKED_VEHICLE) { } else if (veh->VehicleCreatedBy == RANDOM_VEHICLE || veh->VehicleCreatedBy == PARKED_VEHICLE) {
CWorld::Remove(veh); Remove(veh);
delete veh; delete veh;
} }
} }
@ -1001,7 +1001,7 @@ CWorld::Process(void)
if (!(CTimer::GetFrameCounter() & 63)) if (!(CTimer::GetFrameCounter() & 63))
CReferences::PruneAllReferencesInWorld(); CReferences::PruneAllReferencesInWorld();
if (CWorld::bProcessCutsceneOnly) { if (bProcessCutsceneOnly) {
for (int i = 0; i < NUMCUTSCENEOBJECTS; i++) { for (int i = 0; i < NUMCUTSCENEOBJECTS; i++) {
CCutsceneObject *csObj = CCutsceneMgr::GetCutsceneObject(i); CCutsceneObject *csObj = CCutsceneMgr::GetCutsceneObject(i);
if (csObj && csObj->m_entryInfoList.first) { if (csObj && csObj->m_entryInfoList.first) {
@ -1036,7 +1036,7 @@ CWorld::Process(void)
} }
} }
} }
CWorld::bForceProcessControl = 1; bForceProcessControl = true;
for (CPtrNode* node = ms_listMovingEntityPtrs.first; node; node = node->next) { for (CPtrNode* node = ms_listMovingEntityPtrs.first; node; node = node->next) {
CPhysical* movingEnt = (CPhysical*)node->item; CPhysical* movingEnt = (CPhysical*)node->item;
if (movingEnt->bWasPostponed) { if (movingEnt->bWasPostponed) {
@ -1050,7 +1050,7 @@ CWorld::Process(void)
} }
} }
} }
CWorld::bForceProcessControl = 0; bForceProcessControl = false;
if (CReplay::IsPlayingBack()) { if (CReplay::IsPlayingBack()) {
for (CPtrNode* node = ms_listMovingEntityPtrs.first; node; node = node->next) { for (CPtrNode* node = ms_listMovingEntityPtrs.first; node; node = node->next) {
CEntity* movingEnt = (CEntity*)node->item; CEntity* movingEnt = (CEntity*)node->item;
@ -1059,7 +1059,7 @@ CWorld::Process(void)
movingEnt->UpdateRwFrame(); movingEnt->UpdateRwFrame();
} }
} else { } else {
CWorld::bNoMoreCollisionTorque = 0; bNoMoreCollisionTorque = false;
for (CPtrNode* node = ms_listMovingEntityPtrs.first; node; node = node->next) { for (CPtrNode* node = ms_listMovingEntityPtrs.first; node; node = node->next) {
CEntity* movingEnt = (CEntity*)node->item; CEntity* movingEnt = (CEntity*)node->item;
if (!movingEnt->bIsInSafePosition) { if (!movingEnt->bIsInSafePosition) {
@ -1068,7 +1068,7 @@ CWorld::Process(void)
movingEnt->UpdateRwFrame(); movingEnt->UpdateRwFrame();
} }
} }
CWorld::bNoMoreCollisionTorque = 1; bNoMoreCollisionTorque = true;
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
for (CPtrNode* node = ms_listMovingEntityPtrs.first; node; node = node->next) { for (CPtrNode* node = ms_listMovingEntityPtrs.first; node; node = node->next) {
CEntity* movingEnt = (CEntity*)node->item; CEntity* movingEnt = (CEntity*)node->item;
@ -1091,7 +1091,7 @@ CWorld::Process(void)
} }
} }
} }
CWorld::bSecondShift = 0; bSecondShift = false;
for (CPtrNode* node = ms_listMovingEntityPtrs.first; node; node = node->next) { for (CPtrNode* node = ms_listMovingEntityPtrs.first; node; node = node->next) {
CEntity* movingEnt = (CEntity*)node->item; CEntity* movingEnt = (CEntity*)node->item;
if (!movingEnt->bIsInSafePosition) { if (!movingEnt->bIsInSafePosition) {
@ -1103,7 +1103,7 @@ CWorld::Process(void)
} }
} }
} }
CWorld::bSecondShift = 1; bSecondShift = true;
for (CPtrNode* node = ms_listMovingEntityPtrs.first; node; node = node->next) { for (CPtrNode* node = ms_listMovingEntityPtrs.first; node; node = node->next) {
CPhysical* movingEnt = (CPhysical*)node->item; CPhysical* movingEnt = (CPhysical*)node->item;
if (!movingEnt->bIsInSafePosition) { if (!movingEnt->bIsInSafePosition) {
@ -1167,9 +1167,9 @@ CWorld::Process(void)
Players[PlayerInFocus].Process(); Players[PlayerInFocus].Process();
CRecordDataForChase::SaveOrRetrieveCarPositions(); CRecordDataForChase::SaveOrRetrieveCarPositions();
if ((CTimer::GetFrameCounter() & 7) == 1) { if ((CTimer::GetFrameCounter() & 7) == 1) {
CWorld::RemoveFallenPeds(); RemoveFallenPeds();
} else if ((CTimer::GetFrameCounter() & 7) == 5) { } else if ((CTimer::GetFrameCounter() & 7) == 5) {
CWorld::RemoveFallenCars(); RemoveFallenCars();
} }
} }
} }

View File

@ -500,7 +500,7 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
m_ped_flagG4 = false; m_ped_flagG4 = false;
bStartWanderPathOnFoot = false; bStartWanderPathOnFoot = false;
m_ped_flagG10 = false; m_ped_flagG10 = false;
m_ped_flagG20 = false; bBusJacked = false;
m_ped_flagG40 = false; m_ped_flagG40 = false;
bFadeOut = false; bFadeOut = false;
@ -509,7 +509,7 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
m_ped_flagH4 = false; m_ped_flagH4 = false;
bClearObjective = false; bClearObjective = false;
m_ped_flagH10 = false; m_ped_flagH10 = false;
m_ped_flagH20 = false; bCollidedWithMyVehicle = false;
m_ped_flagH40 = false; m_ped_flagH40 = false;
m_ped_flagH80 = false; m_ped_flagH80 = false;
@ -8872,7 +8872,7 @@ CPed::ProcessControl(void)
if (m_fHealth <= 1.0f && m_nPedState <= PED_STATES_NO_AI && !bIsInTheAir && !bIsLanding) if (m_fHealth <= 1.0f && m_nPedState <= PED_STATES_NO_AI && !bIsInTheAir && !bIsLanding)
SetDie(ANIM_KO_SHOT_FRONT1, 4.0f, 0.0f); SetDie(ANIM_KO_SHOT_FRONT1, 4.0f, 0.0f);
m_ped_flagH20 = false; bCollidedWithMyVehicle = false;
CEntity *collidingEnt = m_pDamageEntity; CEntity *collidingEnt = m_pDamageEntity;
if (!bUsesCollision || m_fDamageImpulse <= 0.0f || m_nPedState == PED_DIE || !collidingEnt) { if (!bUsesCollision || m_fDamageImpulse <= 0.0f || m_nPedState == PED_DIE || !collidingEnt) {
@ -9100,7 +9100,7 @@ CPed::ProcessControl(void)
float collidingVehSpeedSqr = collidingVeh->m_vecMoveSpeed.MagnitudeSqr(); float collidingVehSpeedSqr = collidingVeh->m_vecMoveSpeed.MagnitudeSqr();
if (collidingVeh == m_pMyVehicle) if (collidingVeh == m_pMyVehicle)
m_ped_flagH20 = true; bCollidedWithMyVehicle = true;
if (collidingVehSpeedSqr <= 1.0f / 400.0f) { if (collidingVehSpeedSqr <= 1.0f / 400.0f) {
if (!IsPedInControl() if (!IsPedInControl()
@ -10219,7 +10219,7 @@ CPed::PedAnimGetInCB(CAnimBlendAssociation *animAssoc, void *arg)
veh->bIsHandbrakeOn = true; veh->bIsHandbrakeOn = true;
veh->m_status = STATUS_PLAYER_DISABLED; veh->m_status = STATUS_PLAYER_DISABLED;
} }
driver->m_ped_flagG20 = true; driver->bBusJacked = true;
veh->m_veh_flagC10 = false; veh->m_veh_flagC10 = false;
PedSetInCarCB(nil, ped); PedSetInCarCB(nil, ped);
if (ped->m_nPedType == PEDTYPE_COP if (ped->m_nPedType == PEDTYPE_COP
@ -10456,6 +10456,7 @@ CPed::PedAnimStepOutCarCB(CAnimBlendAssociation* animAssoc, void* arg)
} }
if (ped->m_ped_flagE80 || ped->m_ped_flagG40) { if (ped->m_ped_flagE80 || ped->m_ped_flagG40) {
// POTENTIAL BUG? Why DOOR_FRONT_LEFT instead of door variable? or vice versa?
if (!veh->IsDoorMissing(door)) if (!veh->IsDoorMissing(door))
((CAutomobile*)veh)->Damage.SetDoorStatus(DOOR_FRONT_LEFT, DOOR_STATUS_SWINGING); ((CAutomobile*)veh)->Damage.SetDoorStatus(DOOR_FRONT_LEFT, DOOR_STATUS_SWINGING);
} else { } else {

View File

@ -304,7 +304,7 @@ public:
uint8 bIsDucking : 1; uint8 bIsDucking : 1;
uint8 bGetUpAnimStarted : 1; uint8 bGetUpAnimStarted : 1;
uint8 bDoBloodyFootprints : 1; uint8 bDoBloodyFootprints : 1;
uint8 m_ped_flagE80 : 1; uint8 m_ped_flagE80 : 1; // bDontDragMeOutCar? bStayInCarOnJack?
uint8 bWanderPathAfterExitingCar : 1; uint8 bWanderPathAfterExitingCar : 1;
uint8 m_ped_flagF2 : 1; uint8 m_ped_flagF2 : 1;
@ -320,8 +320,8 @@ public:
uint8 m_ped_flagG4 : 1; uint8 m_ped_flagG4 : 1;
uint8 bStartWanderPathOnFoot : 1; // exits the car if he's in it, reset after path found uint8 bStartWanderPathOnFoot : 1; // exits the car if he's in it, reset after path found
uint8 m_ped_flagG10 : 1; uint8 m_ped_flagG10 : 1;
uint8 m_ped_flagG20 : 1; uint8 bBusJacked : 1;
uint8 m_ped_flagG40 : 1; uint8 m_ped_flagG40 : 1; // had to exit car due to someone jacked it from RF door
uint8 bFadeOut : 1; uint8 bFadeOut : 1;
uint8 m_ped_flagH1 : 1; uint8 m_ped_flagH1 : 1;
@ -329,7 +329,7 @@ public:
uint8 m_ped_flagH4 : 1; uint8 m_ped_flagH4 : 1;
uint8 bClearObjective : 1; uint8 bClearObjective : 1;
uint8 m_ped_flagH10 : 1; uint8 m_ped_flagH10 : 1;
uint8 m_ped_flagH20 : 1; // set if our own vehicle damaged us. I don't know how is that possible uint8 bCollidedWithMyVehicle : 1;
uint8 m_ped_flagH40 : 1; uint8 m_ped_flagH40 : 1;
uint8 m_ped_flagH80 : 1; uint8 m_ped_flagH80 : 1;