Fixes and cleanup

This commit is contained in:
eray orçunus 2020-03-02 03:03:39 +03:00
parent f72453d03e
commit a718e699ad
11 changed files with 122 additions and 92 deletions

View File

@ -952,9 +952,9 @@ CFileLoader::Load2dEffect(const char *line)
effect->light.lightType = lightType;
effect->light.roadReflection = roadReflection;
effect->light.flareType = flare;
// TODO: check out the flags
if(flags & 4)
flags &= ~2;
if(flags & LIGHTFLAG_FOG_ALWAYS)
flags &= ~LIGHTFLAG_FOG_NORMAL;
effect->light.flags = flags;
break;

View File

@ -387,7 +387,7 @@ CPlayerInfo::Process(void)
// Because vehicle enter/exit use same key binding.
bool enterOrExitVeh;
if (m_pPed->m_ped_flagI4 && m_pPed->bInVehicle)
if (m_pPed->bVehExitWillBeInstant && m_pPed->bInVehicle)
enterOrExitVeh = CPad::GetPad(0)->ExitVehicleJustDown();
else
enterOrExitVeh = CPad::GetPad(0)->GetExitVehicle();

View File

@ -1459,7 +1459,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
A->m_phy_flagA80 = true;
}else if(A->IsPed() && Aped->m_pCollidingEntity == B){
skipCollision = true;
if(!Aped->m_ped_flagH1)
if(!Aped->bKnockedUpIntoAir)
A->m_phy_flagA80 = true;
}else if(B->IsPed() && Bped->m_pCollidingEntity == A){
skipCollision = true;

View File

@ -151,7 +151,7 @@ CCivilianPed::CivilianAI(void)
SetLookFlag(angleToFace, true);
SetLookTimer(500);
} else if (eventDistSqr < sq(40.0f)) {
if (m_ped_flagD2) {
if (bGonnaInvestigateEvent) {
if (CharCreatedBy != MISSION_CHAR && !IsGangMember())
SetInvestigateEvent(EVENT_EXPLOSION, m_eventOrThreat, 6.0f, 30000, 0.0f);

View File

@ -376,7 +376,7 @@ CEmergencyPed::MedicAI(void)
m_pRevivedPed->SetMoveState(PEDMOVE_WALK);
m_pRevivedPed->RestartNonPartialAnims();
m_pRevivedPed->bIsPedDieAnimPlaying = false;
m_pRevivedPed->m_ped_flagH1 = false;
m_pRevivedPed->bKnockedUpIntoAir = false;
m_pRevivedPed->m_pCollidingEntity = nil;
}
break;

View File

@ -503,7 +503,7 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
bFindNewNodeAfterStateRestore = false;
bHasACamera = false;
m_ped_flagD2 = false;
bGonnaInvestigateEvent = false;
bPedIsBleeding = false;
bStopAndShoot = false;
bIsPedDieAnimPlaying = false;
@ -538,7 +538,7 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
bGonnaKillTheCarJacker = false;
bFadeOut = false;
m_ped_flagH1 = false;
bKnockedUpIntoAir = false;
bHitSteepSlope = false;
bCullExtraFarAway = false;
bClearObjective = false;
@ -549,14 +549,14 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
bShakeFist = false;
bNoCriticalHits = false;
m_ped_flagI4 = false;
bVehExitWillBeInstant = false;
bHasAlreadyBeenRecorded = false;
bFallenDown = false;
#ifdef KANGAROO_CHEAT
m_ped_flagI80 = false;
#endif
#ifdef VC_PED_PORTS
bKnockedUpIntoAir = false;
bSomeVCflag1 = false;
#endif
if ((CGeneral::GetRandomNumber() & 3) == 0)
@ -919,7 +919,7 @@ CPed::SetLookFlag(CEntity *target, bool keepTryingToLook)
m_lookTimer = 0;
bKeepTryingToLook = keepTryingToLook;
if (m_nPedState != PED_DRIVING) {
m_pedIK.m_flags &= ~CPedIK::LOOKING;
m_pedIK.m_flags &= ~CPedIK::LOOKAROUND_HEAD_ONLY;
}
}
}
@ -935,7 +935,7 @@ CPed::SetLookFlag(float direction, bool keepTryingToLook)
m_lookTimer = 0;
bKeepTryingToLook = keepTryingToLook;
if (m_nPedState != PED_DRIVING) {
m_pedIK.m_flags &= ~CPedIK::LOOKING;
m_pedIK.m_flags &= ~CPedIK::LOOKAROUND_HEAD_ONLY;
}
}
}
@ -1038,7 +1038,7 @@ CPed::ClearLookFlag(void) {
bIsRestoringLook = true;
bShakeFist = false;
m_pedIK.m_flags &= ~CPedIK::LOOKING;
m_pedIK.m_flags &= ~CPedIK::LOOKAROUND_HEAD_ONLY;
if (IsPlayer())
m_lookTimer = CTimer::GetTimeInMilliseconds() + 2000;
else
@ -1586,7 +1586,7 @@ CPed::PedSetDraggedOutCarCB(CAnimBlendAssociation *dragAssoc, void *arg)
ped->ReplaceWeaponWhenExitingVehicle();
ped->m_nStoredMoveState = PEDMOVE_NONE;
ped->m_ped_flagI4 = false;
ped->bVehExitWillBeInstant = false;
}
CVector
@ -3255,11 +3255,11 @@ CPed::CheckForDeadPeds(void)
if (CEventList::FindClosestEvent(EVENT_DEAD_PED, GetPosition(), &event)) {
int pedHandle = gaEvent[event].entityRef;
if (pedHandle && gaEvent[event].entityType == EVENT_ENTITY_PED) {
m_ped_flagD2 = true;
bGonnaInvestigateEvent = true;
return CPools::GetPed(pedHandle);
}
}
m_ped_flagD2 = false;
bGonnaInvestigateEvent = false;
return nil;
}
@ -3289,9 +3289,9 @@ CPed::CheckForExplosions(CVector2D &area)
if (actualEntity) {
m_pEventEntity = actualEntity;
m_pEventEntity->RegisterReference((CEntity **) &m_pEventEntity);
m_ped_flagD2 = true;
bGonnaInvestigateEvent = true;
} else
m_ped_flagD2 = false;
bGonnaInvestigateEvent = false;
CEventList::ClearEvent(event);
return true;
@ -3299,11 +3299,11 @@ CPed::CheckForExplosions(CVector2D &area)
area.x = gaEvent[event].posn.x;
area.y = gaEvent[event].posn.y;
CEventList::ClearEvent(event);
m_ped_flagD2 = false;
bGonnaInvestigateEvent = false;
return true;
}
m_ped_flagD2 = false;
bGonnaInvestigateEvent = false;
return false;
}
@ -3314,15 +3314,15 @@ CPed::CheckForGunShots(void)
if (CEventList::FindClosestEvent(EVENT_GUNSHOT, GetPosition(), &event)) {
if (gaEvent[event].entityType == EVENT_ENTITY_PED) {
// Probably due to we don't want peds to go gunshot area? (same on VC)
m_ped_flagD2 = false;
bGonnaInvestigateEvent = false;
return CPools::GetPed(gaEvent[event].entityRef);
}
}
m_ped_flagD2 = false;
bGonnaInvestigateEvent = false;
return nil;
}
uint8
PointBlankNecessity
CPed::CheckForPointBlankPeds(CPed *pedToVerify)
{
float pbDistance = 1.1f;
@ -3351,18 +3351,18 @@ CPed::CheckForPointBlankPeds(CPed *pedToVerify)
PedState nearPedState = nearPed->m_nPedState;
if (nearPedState == PED_FALL || nearPedState == PED_GETUP || nearPedState == PED_DIE || nearPedState == PED_DEAD || nearPedState == PED_DIVE_AWAY)
return 0;
return NO_POINT_BLANK_PED;
if (neededTurn < DEGTORAD(60.0f)) {
if (pedToVerify == nearPed)
return 1;
return POINT_BLANK_FOR_WANTED_PED;
else
return 2;
return POINT_BLANK_FOR_SOMEONE_ELSE;
}
}
}
}
return 0;
return NO_POINT_BLANK_PED;
}
bool
@ -3405,7 +3405,7 @@ CPed::ClearAll(void)
ClearLookFlag();
bIsPointingGunAt = false;
bRenderPedInCar = true;
m_ped_flagH1 = false;
bKnockedUpIntoAir = false;
m_pCollidingEntity = nil;
}
@ -4090,7 +4090,7 @@ CPed::SetGetUp(void)
}
bGetUpAnimStarted = true;
m_pCollidingEntity = nil;
m_ped_flagH1 = false;
bKnockedUpIntoAir = false;
CAnimBlendAssociation *animAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_SPRINT);
if (animAssoc) {
if (RpAnimBlendClumpGetAssociation(GetClump(), ANIM_RUN)) {
@ -4130,7 +4130,7 @@ CPed::ClearInvestigateEvent(void)
if (m_eventType > EVENT_EXPLOSION)
m_standardTimer = CTimer::GetTimeInMilliseconds() + 15000;
m_ped_flagD2 = false;
bGonnaInvestigateEvent = false;
m_pEventEntity = nil;
ClearLookFlag();
RestorePreviousState();
@ -4278,7 +4278,7 @@ void
CPed::RestoreGunPosition(void)
{
if (bIsLooking) {
m_pedIK.m_flags &= ~CPedIK::LOOKING;
m_pedIK.m_flags &= ~CPedIK::LOOKAROUND_HEAD_ONLY;
bIsRestoringGun = false;
} else if (m_pedIK.RestoreGunPosn()) {
bIsRestoringGun = false;
@ -4717,16 +4717,17 @@ CPed::SetAttack(CEntity *victim)
if (IsPlayer())
CPad::GetPad(0)->ResetAverageWeapon();
PointBlankNecessity pointBlankStatus;
if ((curWeapon->m_eWeaponFire == WEAPON_FIRE_INSTANT_HIT || GetWeapon()->m_eWeaponType == WEAPONTYPE_FLAMETHROWER)
&& TheCamera.PlayerWeaponMode.Mode != CCam::MODE_M16_1STPERSON
&& TheCamera.PlayerWeaponMode.Mode != CCam::MODE_M16_1STPERSON_RUNABOUT
&& TheCamera.PlayerWeaponMode.Mode != CCam::MODE_SNIPER
&& TheCamera.PlayerWeaponMode.Mode != CCam::MODE_SNIPER_RUNABOUT
&& CheckForPointBlankPeds(victimPed) != 0) {
&& (pointBlankStatus = CheckForPointBlankPeds(victimPed)) != NO_POINT_BLANK_PED) {
ClearAimFlag();
// This condition is pointless, we already check it in above
// if (CheckForPointBlankPeds(victimPed) == 1 || !victimPed)
// This condition is pointless
if (pointBlankStatus == POINT_BLANK_FOR_WANTED_PED || !victimPed)
StartFightAttack(200);
} else {
if (!curWeapon->m_bCanAim)
@ -5064,7 +5065,7 @@ CPed::FightStrike(CVector &touchedNodePos)
|| GetWeapon()->m_eWeaponType != WEAPONTYPE_UNARMED && IsPlayer()
|| nearPed->m_pedStats->m_flags & STAT_ONE_HIT_KNOCKDOWN)) {
nearPed->SetFall(0, (AnimationId)(direction + 25), 0);
nearPed->SetFall(0, (AnimationId)(direction + ANIM_KO_SKID_FRONT), 0);
if (nearPed->m_nPedState == PED_FALL)
nearPed->bIsStanding = false;
}
@ -5927,7 +5928,7 @@ CPed::SetDead(void)
m_bloodyFootprintCount = CTimer::GetTimeInMilliseconds();
m_deadBleeding = false;
bDoBloodyFootprints = false;
m_ped_flagI4 = false;
bVehExitWillBeInstant = false;
CEventList::RegisterEvent(EVENT_DEAD_PED, EVENT_ENTITY_PED, this, nil, 1000);
}
@ -6428,7 +6429,7 @@ CPed::Fight(void)
else
EndFight(ENDFIGHT_FAST);
} else if (currentAssoc && m_fightState != FIGHTSTATE_MOVE_FINISHED) {
} else if (currentAssoc && m_fightState > FIGHTSTATE_MOVE_FINISHED) {
float animTime = currentAssoc->currentTime;
FightMove &curMove = tFightMoves[m_lastFightMove];
if (curMove.hitLevel != HITLEVEL_NULL && animTime > curMove.startFireTime && animTime <= curMove.endFireTime && m_fightState >= FIGHTSTATE_NO_MOVE) {
@ -6486,7 +6487,9 @@ CPed::Fight(void)
if (IsPlayer() && !nPlayerInComboMove) {
if (curMove.comboFollowOnTime > 0.0f && m_fightButtonPressure != 0 && animTime > curMove.comboFollowOnTime) {
animAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, curMove.animId, 8.0f);
// Notice that it increases fight move index, because we're in combo!
animAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, tFightMoves[++m_lastFightMove].animId, 8.0f);
animAssoc->SetFinishCallback(FinishFightMoveCB, this);
animAssoc->SetCurrentTime(0.1f * animAssoc->hierarchy->totalLength);
m_fightButtonPressure = 0;
@ -6696,7 +6699,7 @@ CPed::Fight(void)
}
if (nextFightMove != FIGHTMOVE_IDLE) {
m_lastFightMove = (PedFightMoves) nextFightMove;
m_lastFightMove = nextFightMove;
animAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, tFightMoves[m_lastFightMove].animId, 4.0f);
animAssoc->SetFinishCallback(FinishFightMoveCB, this);
@ -8588,9 +8591,9 @@ CPed::KillPedWithCar(CVehicle *car, float impulse)
m_pCollidingEntity = car;
}
if (nodeToDamage == PED_MID)
m_ped_flagH1 = true;
bKnockedUpIntoAir = true;
else
m_ped_flagH1 = false;
bKnockedUpIntoAir = false;
distVec.Normalise();
@ -8612,7 +8615,7 @@ CPed::KillPedWithCar(CVehicle *car, float impulse)
damage = 30.0f;
CPed::InflictDamage(car, WEAPONTYPE_RAMMEDBYCAR, damage, PEDPIECE_TORSO, fallDirection);
CPed::SetFall(1000, (AnimationId)(fallDirection + 25), true);
CPed::SetFall(1000, (AnimationId)(fallDirection + ANIM_KO_SKID_FRONT), true);
if ((m_nPedState == PED_FALL || m_nPedState == PED_DIE || m_nPedState == PED_DEAD)
&& !m_pCollidingEntity
@ -8621,7 +8624,7 @@ CPed::KillPedWithCar(CVehicle *car, float impulse)
m_pCollidingEntity = car;
}
m_ped_flagH1 = false;
bKnockedUpIntoAir = false;
if (car->m_modelIndex != MI_TRAIN && !bHasHitWall) {
m_vecMoveSpeed = car->m_vecMoveSpeed * 0.75f;
}
@ -8771,10 +8774,10 @@ CPed::LookForInterestingNodes(void)
}
switch (effect->attractor.flags) {
case 0:
case ATTRACTORFLAG_ICECREAM:
SetInvestigateEvent(EVENT_ICECREAM, CVector2D(effectPos), 0.1f, 15000, angleToFace);
break;
case 1:
case ATTRACTORFLAG_STARE:
SetInvestigateEvent(EVENT_SHOPSTALL, CVector2D(effectPos), 1.0f,
CGeneral::GetRandomNumberInRange(8000, 10 * effect->attractor.probability + 8500),
angleToFace);
@ -8957,7 +8960,7 @@ CPed::MoveHeadToLook(void)
if (m_lookTimer && CTimer::GetTimeInMilliseconds() > m_lookTimer) {
ClearLookFlag();
} else if (m_nPedState == PED_DRIVING) {
m_pedIK.m_flags |= CPedIK::LOOKING;
m_pedIK.m_flags |= CPedIK::LOOKAROUND_HEAD_ONLY;
}
if (m_pLookTarget) {
@ -9709,7 +9712,7 @@ CPed::ProcessControl(void)
bIsStanding = false;
CVector2D collidingEntMoveDir = -collidingVeh->m_vecMoveSpeed;
int dir = GetLocalDirection(collidingEntMoveDir);
SetFall(1000, (AnimationId)(dir + 25), false);
SetFall(1000, (AnimationId)(dir + ANIM_KO_SKID_FRONT), false);
float damage;
if (collidingVeh->m_modelIndex == MI_TRAIN) {
@ -9841,7 +9844,7 @@ CPed::ProcessControl(void)
bIsStanding = false;
CVector2D collidingEntMoveDir = -collidingVeh->m_vecMoveSpeed;
int dir = GetLocalDirection(collidingEntMoveDir);
SetFall(1000, (AnimationId)(dir + 25), false);
SetFall(1000, (AnimationId)(dir + ANIM_KO_SKID_FRONT), false);
CPed *driver = collidingVeh->pDriver;
float damage;
@ -9975,7 +9978,7 @@ CPed::ProcessControl(void)
flyDir = 1;
}
if (flyDir != 0 && !bKnockedUpIntoAir) {
if (flyDir != 0 && !bSomeVCflag1) {
GetPosition() = (flyDir == 2 ? obstacleForFlyingOtherDir.point : obstacleForFlying.point);
GetPosition().z += FEET_OFFSET;
GetMatrix().UpdateRW();
@ -10082,11 +10085,11 @@ CPed::ProcessControl(void)
if (CWorld::ProcessVerticalLine(offsetToCheck, GetPosition().z - FEET_OFFSET, foundCol, foundEnt, true, true, false, true, false, false, false)) {
#ifdef VC_PED_PORTS
if (!bKnockedUpIntoAir || FEET_OFFSET + foundCol.point.z < GetPosition().z) {
if (!bSomeVCflag1 || FEET_OFFSET + foundCol.point.z < GetPosition().z) {
GetPosition().z = FEET_OFFSET + foundCol.point.z;
GetMatrix().UpdateRW();
if (bKnockedUpIntoAir)
bKnockedUpIntoAir = false;
if (bSomeVCflag1)
bSomeVCflag1 = false;
}
#else
GetPosition().z = FEET_OFFSET + foundCol.point.z;
@ -10155,15 +10158,15 @@ CPed::ProcessControl(void)
if (IsPedInControl() && !bIsStanding && !m_pDamageEntity && CheckIfInTheAir()) {
SetInTheAir();
#ifdef VC_PED_PORTS
bKnockedUpIntoAir = false;
bSomeVCflag1 = false;
#endif
}
#ifdef VC_PED_PORTS
if (bKnockedUpIntoAir) {
if (bSomeVCflag1) {
CVector posToCheck = GetPosition();
posToCheck.z += 0.9f;
if (!CWorld::TestSphereAgainstWorld(posToCheck, 0.2f, this, true, true, false, true, false, false))
bKnockedUpIntoAir = false;
bSomeVCflag1 = false;
}
#endif
ProcessObjective();
@ -11881,7 +11884,7 @@ CPed::PedSetOutCarCB(CAnimBlendAssociation *animAssoc, void *arg)
ped->bUsesCollision = true;
ped->m_actionX = 0.0f;
ped->m_actionY = 0.0f;
ped->m_ped_flagI4 = false;
ped->bVehExitWillBeInstant = false;
if (veh && veh->IsBoat())
ped->ApplyMoveSpeed();
@ -13566,13 +13569,16 @@ CPed::ProcessObjective(void)
m_pedInObjective->Say(SOUND_PED_ROBBED);
Say(SOUND_PED_MUGGING);
bRichFromMugging = true;
// VC FIX: ClearObjective() clears m_pedInObjective in VC (also same with VC_PED_PORTS), so get it before call
CPed *victim = m_pedInObjective;
ClearObjective();
if (m_pedInObjective->m_objective != OBJECTIVE_KILL_CHAR_ON_FOOT
|| m_pedInObjective->m_pedInObjective != this) {
SetFindPathAndFlee(m_pedInObjective, 15000, true);
if (victim->m_objective != OBJECTIVE_KILL_CHAR_ON_FOOT
|| victim->m_pedInObjective != this) {
SetFindPathAndFlee(victim, 15000, true);
m_nLastPedState = PED_WANDER_PATH;
} else {
SetObjective(OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE, m_pedInObjective);
SetObjective(OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE, victim);
SetMoveState(PEDMOVE_SPRINT);
m_nLastPedState = PED_WANDER_PATH;
}
@ -13598,6 +13604,9 @@ CPed::ProcessObjective(void)
SetWanderPath(CGeneral::GetRandomNumber() & 7);
}
} else {
#ifdef VC_PED_PORTS
m_objective = OBJECTIVE_NONE;
#endif
ClearObjective();
}
break;
@ -14387,10 +14396,10 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
if (CCollision::IsStoredPolyStillValidVerticalLine(pos, potentialGroundZ, intersectionPoint, &m_collPoly)) {
bStillOnValidPoly = true;
#ifdef VC_PED_PORTS
if(!bKnockedUpIntoAir || FEET_OFFSET + intersectionPoint.point.z < GetPosition().z) {
if(!bSomeVCflag1 || FEET_OFFSET + intersectionPoint.point.z < GetPosition().z) {
GetPosition().z = FEET_OFFSET + intersectionPoint.point.z;
if (bKnockedUpIntoAir)
bKnockedUpIntoAir = false;
if (bSomeVCflag1)
bSomeVCflag1 = false;
}
#else
GetPosition().z = FEET_OFFSET + intersectionPoint.point.z;
@ -14465,10 +14474,10 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
}
}
#ifdef VC_PED_PORTS
if (!bKnockedUpIntoAir || FEET_OFFSET + intersectionPoint.point.z < GetPosition().z) {
if (!bSomeVCflag1 || FEET_OFFSET + intersectionPoint.point.z < GetPosition().z) {
GetPosition().z = FEET_OFFSET + intersectionPoint.point.z;
if (bKnockedUpIntoAir)
bKnockedUpIntoAir = false;
if (bSomeVCflag1)
bSomeVCflag1 = false;
}
#else
GetPosition().z = FEET_OFFSET + intersectionPoint.point.z;
@ -14577,7 +14586,7 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
sphereNormal.x = -m_vecMoveSpeed.x / max(0.001f, speed);
sphereNormal.y = -m_vecMoveSpeed.y / max(0.001f, speed);
GetPosition().z -= 0.05f;
bKnockedUpIntoAir = true;
bSomeVCflag1 = true;
}
#endif
sphereNormal.Normalise();
@ -16625,7 +16634,7 @@ CPed::WarpPedIntoCar(CVehicle *car)
m_nPedState = PED_DRIVING;
bUsesCollision = false;
bIsInTheAir = false;
m_ped_flagI4 = true;
bVehExitWillBeInstant = true;
if (m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER) {
car->SetDriver(this);
car->pDriver->RegisterReference((CEntity **) &car->pDriver);
@ -16674,7 +16683,11 @@ CPed::WarpPedIntoCar(CVehicle *car)
RemoveWeaponWhenEnteringVehicle();
#else
if (car->IsBoat()) {
#ifndef FIX_BUGS
m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_DRIVE_BOAT, 100.0f);
#else
m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, car->GetDriverAnim(), 100.0f);
#endif
CWeaponInfo *ourWeapon = CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType);
RemoveWeaponModel(ourWeapon->m_nModelId);
} else {
@ -16925,9 +16938,15 @@ CPed::SetEnterCar_AllClear(CVehicle *car, uint32 doorNode, uint32 doorFlag)
m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_DRIVE_BOAT, 100.0f);
PedSetInCarCB(nil, this);
m_ped_flagI4 = true;
bVehExitWillBeInstant = true;
#else
#ifndef FIX_BUGS
m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_DRIVE_BOAT, 100.0f);
#else
m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, car->GetDriverAnim(), 100.0f);
#endif
m_pVehicleAnim->SetFinishCallback(PedSetInCarCB, this);
#endif
if (IsPlayer())

View File

@ -207,6 +207,12 @@ enum PedOnGroundState {
PED_DEAD_ON_THE_FLOOR
};
enum PointBlankNecessity : uint8 {
NO_POINT_BLANK_PED,
POINT_BLANK_FOR_WANTED_PED,
POINT_BLANK_FOR_SOMEONE_ELSE
};
enum PedState
{
PED_NONE,
@ -321,7 +327,7 @@ public:
uint8 bFindNewNodeAfterStateRestore : 1;
uint8 bHasACamera : 1; // does ped possess a camera to document accidents involves fire/explosion
uint8 m_ped_flagD2 : 1; // set when ped witnessed an event
uint8 bGonnaInvestigateEvent : 1;
uint8 bPedIsBleeding : 1;
uint8 bStopAndShoot : 1; // Ped cannot reach target to attack with fist, need to use gun
uint8 bIsPedDieAnimPlaying : 1;
@ -356,7 +362,7 @@ public:
uint8 bGonnaKillTheCarJacker : 1; // only set when car is jacked from right door
uint8 bFadeOut : 1;
uint8 m_ped_flagH1 : 1;
uint8 bKnockedUpIntoAir : 1; // has ped been knocked up into the air by a car collision
uint8 bHitSteepSlope : 1; // has ped collided/is standing on a steep slope (surface type)
uint8 bCullExtraFarAway : 1; // special ped only gets culled if it's extra far away (for roadblocks)
uint8 bClearObjective : 1;
@ -367,11 +373,11 @@ public:
uint8 bShakeFist : 1; // test shake hand at look entity
uint8 bNoCriticalHits : 1; // if set, limbs won't came off
uint8 m_ped_flagI4 : 1; // we've been put to car by script or without align phase? - related with cars
uint8 bVehExitWillBeInstant : 1;
uint8 bHasAlreadyBeenRecorded : 1;
uint8 bFallenDown : 1;
#ifdef VC_PED_PORTS
uint8 bKnockedUpIntoAir : 1; // has ped been knocked up into the air by a car collision
uint8 bSomeVCflag1 : 1;
#else
uint8 m_ped_flagI20 : 1;
#endif
@ -471,7 +477,7 @@ public:
uint8 m_wepAccuracy;
CEntity *m_pPointGunAt;
CVector m_vecHitLastPos;
PedFightMoves m_lastFightMove;
uint32 m_lastFightMove;
uint8 m_fightButtonPressure;
FightState m_fightState;
bool m_takeAStepAfterAttack;
@ -584,7 +590,7 @@ public:
CPed *CheckForDeadPeds(void);
bool CheckForExplosions(CVector2D &area);
CPed *CheckForGunShots(void);
uint8 CheckForPointBlankPeds(CPed*);
PointBlankNecessity CheckForPointBlankPeds(CPed*);
bool CheckIfInTheAir(void);
void ClearAll(void);
void SetPointGunAt(CEntity*);

View File

@ -185,7 +185,7 @@ CPedIK::LookInDirection(float phi, float theta)
if (headStatus == ANGLES_SET_TO_MAX)
success = false;
if (headStatus != ANGLES_SET_EXACTLY && !(m_flags & LOOKING)) {
if (headStatus != ANGLES_SET_EXACTLY && !(m_flags & LOOKAROUND_HEAD_ONLY)) {
float remainingTurn = CGeneral::LimitRadianAngle(phi - m_ped->m_fRotationCur);
if (CPedIK::MoveLimb(m_torsoOrient, remainingTurn, theta, ms_torsoInfo))
success = true;
@ -198,7 +198,7 @@ CPedIK::LookInDirection(float phi, float theta)
nextFrame.GetPosition() += framePos;
nextFrame.UpdateRW();
if (!(m_flags & LOOKING))
if (!(m_flags & LOOKAROUND_HEAD_ONLY))
RotateTorso(m_ped->m_pFrames[PED_MID], &m_torsoOrient, false);
return success;
@ -224,8 +224,8 @@ CPedIK::PointGunInDirection(float phi, float theta)
bool result = true;
bool armPointedToGun = false;
float angle = CGeneral::LimitRadianAngle(phi - m_ped->m_fRotationCur);
m_flags &= (~FLAG_1);
m_flags |= LOOKING;
m_flags &= (~GUN_POINTED_SUCCESSFULLY);
m_flags |= LOOKAROUND_HEAD_ONLY;
if (m_flags & AIMS_WITH_ARM) {
armPointedToGun = PointGunInDirectionUsingArm(angle, theta);
angle = CGeneral::LimitRadianAngle(angle - m_upperArmOrient.phi);
@ -242,7 +242,7 @@ CPedIK::PointGunInDirection(float phi, float theta)
if (status == ANGLES_SET_TO_MAX)
result = false;
else if (status == ANGLES_SET_EXACTLY)
m_flags |= FLAG_1;
m_flags |= GUN_POINTED_SUCCESSFULLY;
}
if (TheCamera.Cams[TheCamera.ActiveCam].Using3rdPersonMouseCam() && m_flags & AIMS_WITH_ARM)
RotateTorso(m_ped->m_pFrames[PED_MID], &m_torsoOrient, true);
@ -270,7 +270,7 @@ CPedIK::PointGunInDirectionUsingArm(float phi, float theta)
float uaPhi = phi - m_torsoOrient.phi - DEGTORAD(15.0f);
LimbMoveStatus uaStatus = MoveLimb(m_upperArmOrient, uaPhi, CGeneral::LimitRadianAngle(theta - pitch), ms_upperArmInfo);
if (uaStatus == ANGLES_SET_EXACTLY) {
m_flags |= FLAG_1;
m_flags |= GUN_POINTED_SUCCESSFULLY;
result = true;
}
if (uaStatus == ANGLES_SET_TO_MAX) {
@ -283,7 +283,7 @@ CPedIK::PointGunInDirectionUsingArm(float phi, float theta)
laStatus = MoveLimb(m_lowerArmOrient, laPhi, 0.0f, ms_lowerArmInfo);
if (laStatus == ANGLES_SET_EXACTLY) {
m_flags |= FLAG_1;
m_flags |= GUN_POINTED_SUCCESSFULLY;
result = true;
}
RwFrame *child = GetFirstChild(frame);
@ -331,9 +331,9 @@ CPedIK::RestoreLookAt(void)
matrix.Translate(pos);
matrix.UpdateRW();
if (!(m_flags & LOOKING))
if (!(m_flags & LOOKAROUND_HEAD_ONLY))
MoveLimb(m_torsoOrient, 0.0f, 0.0f, ms_torsoInfo);
if (!(m_flags & LOOKING))
if (!(m_flags & LOOKAROUND_HEAD_ONLY))
RotateTorso(m_ped->m_pFrames[PED_MID], &m_torsoOrient, false);
return result;

View File

@ -30,8 +30,8 @@ class CPedIK
{
public:
enum {
FLAG_1 = 1,
LOOKING = 2, // looking while in car?
GUN_POINTED_SUCCESSFULLY = 1, // set but unused
LOOKAROUND_HEAD_ONLY = 2,
AIMS_WITH_ARM = 4,
};

View File

@ -1016,7 +1016,7 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
}
}
} else {
m_pedIK.m_flags &= ~CPedIK::LOOKING;
m_pedIK.m_flags &= ~CPedIK::LOOKAROUND_HEAD_ONLY;
if (m_nPedState == PED_ATTACK) {
m_bHaveTargetSelected = true;
bIsAttacking = false;

View File

@ -22,6 +22,11 @@ enum {
LIGHT_BRIDGE_FLASH2,
};
enum {
ATTRACTORFLAG_ICECREAM,
ATTRACTORFLAG_STARE
};
enum {
LIGHTFLAG_LOSCHECK = 1,
// same order as CPointLights flags, must start at 2
@ -68,7 +73,7 @@ public:
C2dEffect(void) {}
void Shutdown(void){
if(type == 0){ // TODO: enum
if(type == EFFECT_LIGHT){
if(light.corona)
RwTextureDestroy(light.corona);
if(light.shadow)