From 0eb8a5d53ecb596fe1e0640ab6d42fa5fe0200b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Sun, 7 Jul 2019 00:00:32 +0300 Subject: General fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: eray orçunus --- src/entities/Ped.cpp | 34 +++++++++++++++++----------------- src/entities/Vehicle.h | 8 -------- 2 files changed, 17 insertions(+), 25 deletions(-) (limited to 'src/entities') diff --git a/src/entities/Ped.cpp b/src/entities/Ped.cpp index ba0e3088..055ea3fb 100644 --- a/src/entities/Ped.cpp +++ b/src/entities/Ped.cpp @@ -558,11 +558,11 @@ CheckForPedsOnGroundToAttack(CPlayerPed *player, CPed **pedOnGround) if (currentPedState == PED_DEAD) { foundDead = 1; if (!deadPed) - deadPed = (CPed*)currentPed; + deadPed = currentPed; } else if (!currentPed->IsPedHeadAbovePos(-0.6f)) { foundOnTheFloor = 1; if (!pedOnTheFloor) - pedOnTheFloor = (CPed*)currentPed; + pedOnTheFloor = currentPed; } } } else if ((distance >= 0.8f || angleDiff >= DEGTORAD(75.0f)) @@ -573,11 +573,11 @@ CheckForPedsOnGroundToAttack(CPlayerPed *player, CPed **pedOnGround) if (angleDiff < DEGTORAD(75.0f)) { foundBelow = 1; if (!pedBelow) - pedBelow = (CPed*)currentPed; + pedBelow = currentPed; } } else { foundBelow = 1; - pedBelow = (CPed*)currentPed; + pedBelow = currentPed; break; } } @@ -598,7 +598,7 @@ CheckForPedsOnGroundToAttack(CPlayerPed *player, CPed **pedOnGround) } if (pedOnGround) - * pedOnGround = (CPed*)currentPed; + * pedOnGround = currentPed; return stateToReturn; } @@ -1370,7 +1370,7 @@ CPed::RestartNonPartialAnims(void) { CAnimBlendAssociation *assoc; - for (assoc = RpAnimBlendClumpGetFirstAssociation((RpClump*)m_rwObject); !assoc; assoc = RpAnimBlendGetNextAssociation(assoc)) { + for (assoc = RpAnimBlendClumpGetFirstAssociation((RpClump*)m_rwObject); assoc; assoc = RpAnimBlendGetNextAssociation(assoc)) { if (!assoc->IsPartial()) assoc->flags |= ASSOC_RUNNING; } @@ -1680,7 +1680,7 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase) float pedZSpeedOnExit = m_vecMoveSpeed.z - 0.008f * CTimer::GetTimeStep(); // If we're not in ground at next step, apply animation - if (neededPos.z + pedZSpeedOnExit > autoZPos.z) { + if (neededPos.z + pedZSpeedOnExit >= autoZPos.z) { m_vecMoveSpeed.z = pedZSpeedOnExit; ApplyMoveSpeed(); // Removing below line breaks the animation @@ -1742,9 +1742,9 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase) neededPos -= timeUntilStateChange * m_vecOffsetSeek; } - if (limitedAngle >= PI + m_fRotationCur) { + if (limitedAngle > PI + m_fRotationCur) { limitedAngle -= 2 * PI; - } else if (limitedAngle <= m_fRotationCur - PI) { + } else if (limitedAngle < m_fRotationCur - PI) { limitedAngle += 2 * PI; } m_fRotationCur -= (m_fRotationCur - limitedAngle) * (1.0f - timeUntilStateChange); @@ -2376,7 +2376,7 @@ CPed::SetLeader(CEntity *leader) m_leader = (CPed*)leader; if(m_leader) - m_leader->RegisterReference((CEntity **)m_leader); + m_leader->RegisterReference((CEntity **)&m_leader); } void @@ -2458,9 +2458,9 @@ CPed::SetObjective(eObjective newObj, void *entity) m_ped_flagD20 = false; m_vecSeekVehicle = CVector(0.0f, 0.0f, 0.0f); m_pedInObjective = (CPed*)entity; - m_pedInObjective->RegisterReference((CEntity**)m_pedInObjective); + m_pedInObjective->RegisterReference((CEntity**)&m_pedInObjective); m_pLookTarget = (CEntity*)entity; - m_pLookTarget->RegisterReference((CEntity**)m_pLookTarget); + m_pLookTarget->RegisterReference((CEntity**)&m_pLookTarget); return; case OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE: case OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS: @@ -2468,17 +2468,17 @@ CPed::SetObjective(eObjective newObj, void *entity) case OBJECTIVE_FIGHT_CHAR: m_vecSeekVehicle = CVector(0.0f, 0.0f, 0.0f); m_pedInObjective = (CPed*)entity; - m_pedInObjective->RegisterReference((CEntity**)m_pedInObjective); + m_pedInObjective->RegisterReference((CEntity**)&m_pedInObjective); return; case OBJECTIVE_FOLLOW_PED_IN_FORMATION: m_pedInObjective = (CPed*)entity; - m_pedInObjective->RegisterReference((CEntity**)m_pedInObjective); + m_pedInObjective->RegisterReference((CEntity**)&m_pedInObjective); m_pedFormation = 1; return; case OBJECTIVE_LEAVE_VEHICLE: case OBJECTIVE_FLEE_CAR: m_carInObjective = (CVehicle*)entity; - m_carInObjective->RegisterReference((CEntity **)m_carInObjective); + m_carInObjective->RegisterReference((CEntity **)&m_carInObjective); if (!m_carInObjective->bIsBus || m_leaveCarTimer) return; break; @@ -2496,9 +2496,9 @@ CPed::SetObjective(eObjective newObj, void *entity) case OBJECTIVE_SOLICIT: case OBJECTIVE_BUY_ICE_CREAM: m_carInObjective = (CVehicle*)entity; - m_carInObjective->RegisterReference((CEntity**)m_carInObjective); + m_carInObjective->RegisterReference((CEntity**)&m_carInObjective); m_pSeekTarget = m_carInObjective; - m_pSeekTarget->RegisterReference((CEntity**)m_pSeekTarget); + m_pSeekTarget->RegisterReference((CEntity**)&m_pSeekTarget); m_vecSeekVehicle = CVector(0.0f, 0.0f, 0.0f); if (newObj == OBJECTIVE_SOLICIT) { m_objectiveTimer = CTimer::GetTimeInMilliseconds() + 10000; diff --git a/src/entities/Vehicle.h b/src/entities/Vehicle.h index eb5275ad..ba953e22 100644 --- a/src/entities/Vehicle.h +++ b/src/entities/Vehicle.h @@ -14,14 +14,6 @@ enum { PERMANENT_VEHICLE = 4, }; - -enum { - GETTING_IN_OUT_FL = 1, - GETTING_IN_OUT_RL = 2, - GETTING_IN_OUT_FR = 4, - GETTING_IN_OUT_RR = 8 -}; - enum eCarLock { CARLOCK_NOT_USED, CARLOCK_UNLOCKED, -- cgit v1.2.3