1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-11-01 04:25:54 +00:00

Merge branch 'master' into script_dev

This commit is contained in:
Nikolay Korolev 2020-03-02 22:54:47 +03:00
commit 0a3211d0cf
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.lightType = lightType;
effect->light.roadReflection = roadReflection; effect->light.roadReflection = roadReflection;
effect->light.flareType = flare; effect->light.flareType = flare;
// TODO: check out the flags
if(flags & 4) if(flags & LIGHTFLAG_FOG_ALWAYS)
flags &= ~2; flags &= ~LIGHTFLAG_FOG_NORMAL;
effect->light.flags = flags; effect->light.flags = flags;
break; break;

View file

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

View file

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

View file

@ -151,7 +151,7 @@ CCivilianPed::CivilianAI(void)
SetLookFlag(angleToFace, true); SetLookFlag(angleToFace, true);
SetLookTimer(500); SetLookTimer(500);
} else if (eventDistSqr < sq(40.0f)) { } else if (eventDistSqr < sq(40.0f)) {
if (m_ped_flagD2) { if (bGonnaInvestigateEvent) {
if (CharCreatedBy != MISSION_CHAR && !IsGangMember()) if (CharCreatedBy != MISSION_CHAR && !IsGangMember())
SetInvestigateEvent(EVENT_EXPLOSION, m_eventOrThreat, 6.0f, 30000, 0.0f); 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->SetMoveState(PEDMOVE_WALK);
m_pRevivedPed->RestartNonPartialAnims(); m_pRevivedPed->RestartNonPartialAnims();
m_pRevivedPed->bIsPedDieAnimPlaying = false; m_pRevivedPed->bIsPedDieAnimPlaying = false;
m_pRevivedPed->m_ped_flagH1 = false; m_pRevivedPed->bKnockedUpIntoAir = false;
m_pRevivedPed->m_pCollidingEntity = nil; m_pRevivedPed->m_pCollidingEntity = nil;
} }
break; break;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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