General fixes

Signed-off-by: eray orçunus <erayorcunus@gmail.com>
This commit is contained in:
eray orçunus 2019-07-07 00:00:32 +03:00
parent 2d08696190
commit 0eb8a5d53e
4 changed files with 19 additions and 27 deletions

View File

@ -77,7 +77,7 @@ public:
void UpdateTime(float timeDelta, float relSpeed);
bool UpdateBlend(float timeDelta);
float GetTimeLeft() { return hierarchy->totalLength - currentTime; }
inline float GetTimeLeft() { return hierarchy->totalLength - currentTime; }
static CAnimBlendAssociation *FromLink(CAnimBlendLink *l) {
return (CAnimBlendAssociation*)((uint8*)l - offsetof(CAnimBlendAssociation, link));

View File

@ -752,7 +752,7 @@ CAnimManager::LoadAnimFiles(void)
AnimAssocDefinition *def = &CAnimManager::ms_aAnimAssocDefinitions[i];
group->CreateAssociations(def->blockName, clump, def->animNames, def->numAnims);
for(j = 0; j < group->numAssociations; j++)
group->GetAnimation(def->animDescs[j].animId)->flags |= def->animDescs[j].flags;
group->GetAnimation(j)->flags |= def->animDescs[j].flags;
RpClumpDestroy(clump);
}
}

View File

@ -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;

View File

@ -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,