Merge pull request #115 from erorcun/erorcun

General fixes
This commit is contained in:
aap 2019-07-07 09:44:04 +02:00 committed by GitHub
commit 0384d7ceb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 26 deletions

View File

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

View File

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

View File

@ -558,11 +558,11 @@ CheckForPedsOnGroundToAttack(CPlayerPed *player, CPed **pedOnGround)
if (currentPedState == PED_DEAD) { if (currentPedState == PED_DEAD) {
foundDead = 1; foundDead = 1;
if (!deadPed) if (!deadPed)
deadPed = (CPed*)currentPed; deadPed = currentPed;
} else if (!currentPed->IsPedHeadAbovePos(-0.6f)) { } else if (!currentPed->IsPedHeadAbovePos(-0.6f)) {
foundOnTheFloor = 1; foundOnTheFloor = 1;
if (!pedOnTheFloor) if (!pedOnTheFloor)
pedOnTheFloor = (CPed*)currentPed; pedOnTheFloor = currentPed;
} }
} }
} else if ((distance >= 0.8f || angleDiff >= DEGTORAD(75.0f)) } else if ((distance >= 0.8f || angleDiff >= DEGTORAD(75.0f))
@ -573,11 +573,11 @@ CheckForPedsOnGroundToAttack(CPlayerPed *player, CPed **pedOnGround)
if (angleDiff < DEGTORAD(75.0f)) { if (angleDiff < DEGTORAD(75.0f)) {
foundBelow = 1; foundBelow = 1;
if (!pedBelow) if (!pedBelow)
pedBelow = (CPed*)currentPed; pedBelow = currentPed;
} }
} else { } else {
foundBelow = 1; foundBelow = 1;
pedBelow = (CPed*)currentPed; pedBelow = currentPed;
break; break;
} }
} }
@ -598,7 +598,7 @@ CheckForPedsOnGroundToAttack(CPlayerPed *player, CPed **pedOnGround)
} }
if (pedOnGround) if (pedOnGround)
* pedOnGround = (CPed*)currentPed; * pedOnGround = currentPed;
return stateToReturn; return stateToReturn;
} }
@ -1370,7 +1370,7 @@ CPed::RestartNonPartialAnims(void)
{ {
CAnimBlendAssociation *assoc; 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()) if (!assoc->IsPartial())
assoc->flags |= ASSOC_RUNNING; assoc->flags |= ASSOC_RUNNING;
} }
@ -1680,7 +1680,7 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase)
float pedZSpeedOnExit = m_vecMoveSpeed.z - 0.008f * CTimer::GetTimeStep(); float pedZSpeedOnExit = m_vecMoveSpeed.z - 0.008f * CTimer::GetTimeStep();
// If we're not in ground at next step, apply animation // 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; m_vecMoveSpeed.z = pedZSpeedOnExit;
ApplyMoveSpeed(); ApplyMoveSpeed();
// Removing below line breaks the animation // Removing below line breaks the animation
@ -1742,9 +1742,9 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase)
neededPos -= timeUntilStateChange * m_vecOffsetSeek; neededPos -= timeUntilStateChange * m_vecOffsetSeek;
} }
if (limitedAngle >= PI + m_fRotationCur) { if (limitedAngle > PI + m_fRotationCur) {
limitedAngle -= 2 * PI; limitedAngle -= 2 * PI;
} else if (limitedAngle <= m_fRotationCur - PI) { } else if (limitedAngle < m_fRotationCur - PI) {
limitedAngle += 2 * PI; limitedAngle += 2 * PI;
} }
m_fRotationCur -= (m_fRotationCur - limitedAngle) * (1.0f - timeUntilStateChange); m_fRotationCur -= (m_fRotationCur - limitedAngle) * (1.0f - timeUntilStateChange);
@ -2376,7 +2376,7 @@ CPed::SetLeader(CEntity *leader)
m_leader = (CPed*)leader; m_leader = (CPed*)leader;
if(m_leader) if(m_leader)
m_leader->RegisterReference((CEntity **)m_leader); m_leader->RegisterReference((CEntity **)&m_leader);
} }
void void
@ -2458,9 +2458,9 @@ CPed::SetObjective(eObjective newObj, void *entity)
m_ped_flagD20 = false; m_ped_flagD20 = false;
m_vecSeekVehicle = CVector(0.0f, 0.0f, 0.0f); m_vecSeekVehicle = CVector(0.0f, 0.0f, 0.0f);
m_pedInObjective = (CPed*)entity; m_pedInObjective = (CPed*)entity;
m_pedInObjective->RegisterReference((CEntity**)m_pedInObjective); m_pedInObjective->RegisterReference((CEntity**)&m_pedInObjective);
m_pLookTarget = (CEntity*)entity; m_pLookTarget = (CEntity*)entity;
m_pLookTarget->RegisterReference((CEntity**)m_pLookTarget); m_pLookTarget->RegisterReference((CEntity**)&m_pLookTarget);
return; return;
case OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE: case OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE:
case OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS: case OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS:
@ -2468,17 +2468,17 @@ CPed::SetObjective(eObjective newObj, void *entity)
case OBJECTIVE_FIGHT_CHAR: case OBJECTIVE_FIGHT_CHAR:
m_vecSeekVehicle = CVector(0.0f, 0.0f, 0.0f); m_vecSeekVehicle = CVector(0.0f, 0.0f, 0.0f);
m_pedInObjective = (CPed*)entity; m_pedInObjective = (CPed*)entity;
m_pedInObjective->RegisterReference((CEntity**)m_pedInObjective); m_pedInObjective->RegisterReference((CEntity**)&m_pedInObjective);
return; return;
case OBJECTIVE_FOLLOW_PED_IN_FORMATION: case OBJECTIVE_FOLLOW_PED_IN_FORMATION:
m_pedInObjective = (CPed*)entity; m_pedInObjective = (CPed*)entity;
m_pedInObjective->RegisterReference((CEntity**)m_pedInObjective); m_pedInObjective->RegisterReference((CEntity**)&m_pedInObjective);
m_pedFormation = 1; m_pedFormation = 1;
return; return;
case OBJECTIVE_LEAVE_VEHICLE: case OBJECTIVE_LEAVE_VEHICLE:
case OBJECTIVE_FLEE_CAR: case OBJECTIVE_FLEE_CAR:
m_carInObjective = (CVehicle*)entity; m_carInObjective = (CVehicle*)entity;
m_carInObjective->RegisterReference((CEntity **)m_carInObjective); m_carInObjective->RegisterReference((CEntity **)&m_carInObjective);
if (!m_carInObjective->bIsBus || m_leaveCarTimer) if (!m_carInObjective->bIsBus || m_leaveCarTimer)
return; return;
break; break;
@ -2496,9 +2496,9 @@ CPed::SetObjective(eObjective newObj, void *entity)
case OBJECTIVE_SOLICIT: case OBJECTIVE_SOLICIT:
case OBJECTIVE_BUY_ICE_CREAM: case OBJECTIVE_BUY_ICE_CREAM:
m_carInObjective = (CVehicle*)entity; m_carInObjective = (CVehicle*)entity;
m_carInObjective->RegisterReference((CEntity**)m_carInObjective); m_carInObjective->RegisterReference((CEntity**)&m_carInObjective);
m_pSeekTarget = 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); m_vecSeekVehicle = CVector(0.0f, 0.0f, 0.0f);
if (newObj == OBJECTIVE_SOLICIT) { if (newObj == OBJECTIVE_SOLICIT) {
m_objectiveTimer = CTimer::GetTimeInMilliseconds() + 10000; m_objectiveTimer = CTimer::GetTimeInMilliseconds() + 10000;

View File

@ -69,13 +69,6 @@ enum eDoors
DOOR_REAR_RIGHT DOOR_REAR_RIGHT
}; };
enum {
GETTING_IN_OUT_FL = 1,
GETTING_IN_OUT_RL = 2,
GETTING_IN_OUT_FR = 4,
GETTING_IN_OUT_RR = 8
};
class CVehicle : public CPhysical class CVehicle : public CPhysical
{ {
public: public: