mirror of
https://github.com/GTAmodding/re3.git
synced 2024-12-25 05:55:40 +00:00
Fixes from miami
This commit is contained in:
parent
bd96f49aac
commit
93d77f340d
5 changed files with 66 additions and 68 deletions
|
@ -450,9 +450,9 @@ int8 cSampleManager::GetCurrent3DProviderIndex(void)
|
||||||
|
|
||||||
int8 cSampleManager::SetCurrent3DProvider(uint8 nProvider)
|
int8 cSampleManager::SetCurrent3DProvider(uint8 nProvider)
|
||||||
{
|
{
|
||||||
ASSERT( nProvider < m_nNumberOfProviders );
|
|
||||||
if (nProvider >= m_nNumberOfProviders)
|
if (nProvider >= m_nNumberOfProviders)
|
||||||
nProvider = 0;
|
nProvider = 0;
|
||||||
|
ASSERT( nProvider < m_nNumberOfProviders );
|
||||||
int savedprovider = curprovider;
|
int savedprovider = curprovider;
|
||||||
|
|
||||||
if ( nProvider < m_nNumberOfProviders )
|
if ( nProvider < m_nNumberOfProviders )
|
||||||
|
|
|
@ -1682,7 +1682,7 @@ CPathFind::Load(uint8 *buf, uint32 size)
|
||||||
void
|
void
|
||||||
CPathFind::DisplayPathData(void)
|
CPathFind::DisplayPathData(void)
|
||||||
{
|
{
|
||||||
// Not the function from mobm_carPathLinksile but my own!
|
// Not the function from mobile but my own!
|
||||||
|
|
||||||
int i, j, k;
|
int i, j, k;
|
||||||
// Draw 50 units around camera
|
// Draw 50 units around camera
|
||||||
|
|
|
@ -4994,7 +4994,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
|
||||||
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
||||||
// Useless call
|
// Useless call
|
||||||
CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
|
CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
|
||||||
int handle = CRadar::SetCoordBlip(BLIP_COORD, pos, 2, BLIP_DISPLAY_BOTH);
|
int handle = CRadar::SetCoordBlip(BLIP_CONTACT_POINT, pos, 2, BLIP_DISPLAY_BOTH);
|
||||||
CRadar::ChangeBlipScale(handle, 3);
|
CRadar::ChangeBlipScale(handle, 3);
|
||||||
ScriptParams[0] = handle;
|
ScriptParams[0] = handle;
|
||||||
StoreParameters(&m_nIp, 1);
|
StoreParameters(&m_nIp, 1);
|
||||||
|
@ -9319,7 +9319,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
|
||||||
CVector pos = *(CVector*)&ScriptParams[0];
|
CVector pos = *(CVector*)&ScriptParams[0];
|
||||||
if (pos.z <= MAP_Z_LOW_LIMIT)
|
if (pos.z <= MAP_Z_LOW_LIMIT)
|
||||||
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
||||||
C3dMarkers::PlaceMarkerSet((uintptr)this + m_nIp, 4, pos, *(float*)&ScriptParams[3],
|
C3dMarkers::PlaceMarkerSet((uintptr)this + m_nIp, MARKERTYPE_CYLINDER, pos, *(float*)&ScriptParams[3],
|
||||||
SPHERE_MARKER_R, SPHERE_MARKER_G, SPHERE_MARKER_B, SPHERE_MARKER_A,
|
SPHERE_MARKER_R, SPHERE_MARKER_G, SPHERE_MARKER_B, SPHERE_MARKER_A,
|
||||||
SPHERE_MARKER_PULSE_PERIOD, SPHERE_MARKER_PULSE_FRACTION, 0);
|
SPHERE_MARKER_PULSE_PERIOD, SPHERE_MARKER_PULSE_FRACTION, 0);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -11254,7 +11254,7 @@ void CTheScripts::DrawScriptSpheres()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < MAX_NUM_SCRIPT_SPHERES; i++) {
|
for (int i = 0; i < MAX_NUM_SCRIPT_SPHERES; i++) {
|
||||||
if (ScriptSphereArray[i].m_bInUse)
|
if (ScriptSphereArray[i].m_bInUse)
|
||||||
C3dMarkers::PlaceMarkerSet(ScriptSphereArray[i].m_Id, 4, ScriptSphereArray[i].m_vecCenter, ScriptSphereArray[i].m_fRadius,
|
C3dMarkers::PlaceMarkerSet(ScriptSphereArray[i].m_Id, MARKERTYPE_CYLINDER, ScriptSphereArray[i].m_vecCenter, ScriptSphereArray[i].m_fRadius,
|
||||||
SPHERE_MARKER_R, SPHERE_MARKER_G, SPHERE_MARKER_B, SPHERE_MARKER_A, SPHERE_MARKER_PULSE_PERIOD, SPHERE_MARKER_PULSE_FRACTION, 0);
|
SPHERE_MARKER_R, SPHERE_MARKER_G, SPHERE_MARKER_B, SPHERE_MARKER_A, SPHERE_MARKER_PULSE_PERIOD, SPHERE_MARKER_PULSE_FRACTION, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
123
src/peds/Ped.cpp
123
src/peds/Ped.cpp
|
@ -202,8 +202,8 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
|
||||||
m_pedFormation = FORMATION_UNDEFINED;
|
m_pedFormation = FORMATION_UNDEFINED;
|
||||||
m_collidingThingTimer = 0;
|
m_collidingThingTimer = 0;
|
||||||
m_nPedStateTimer = 0;
|
m_nPedStateTimer = 0;
|
||||||
m_actionX = 0;
|
m_actionX = 0.0f;
|
||||||
m_actionY = 0;
|
m_actionY = 0.0f;
|
||||||
m_phoneTalkTimer = 0;
|
m_phoneTalkTimer = 0;
|
||||||
m_stateUnused = 0;
|
m_stateUnused = 0;
|
||||||
m_leaveCarTimer = 0;
|
m_leaveCarTimer = 0;
|
||||||
|
@ -295,7 +295,6 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
|
||||||
bIsShooting = false;
|
bIsShooting = false;
|
||||||
bFindNewNodeAfterStateRestore = false;
|
bFindNewNodeAfterStateRestore = false;
|
||||||
|
|
||||||
bHasACamera = false;
|
|
||||||
bGonnaInvestigateEvent = false;
|
bGonnaInvestigateEvent = false;
|
||||||
bPedIsBleeding = false;
|
bPedIsBleeding = false;
|
||||||
bStopAndShoot = false;
|
bStopAndShoot = false;
|
||||||
|
@ -352,7 +351,9 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
|
||||||
bSomeVCflag1 = false;
|
bSomeVCflag1 = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((CGeneral::GetRandomNumber() & 3) == 0)
|
if (CGeneral::GetRandomNumber() & 3)
|
||||||
|
bHasACamera = false;
|
||||||
|
else
|
||||||
bHasACamera = true;
|
bHasACamera = true;
|
||||||
|
|
||||||
m_audioEntityId = DMAudio.CreateEntity(AUDIOTYPE_PHYSICAL, this);
|
m_audioEntityId = DMAudio.CreateEntity(AUDIOTYPE_PHYSICAL, this);
|
||||||
|
@ -766,10 +767,10 @@ CPed::OurPedCanSeeThisOne(CEntity *target)
|
||||||
CColPoint colpoint;
|
CColPoint colpoint;
|
||||||
CEntity *ent;
|
CEntity *ent;
|
||||||
|
|
||||||
CVector2D dist = CVector2D(target->GetPosition()) - CVector2D(this->GetPosition());
|
CVector2D dist = CVector2D(target->GetPosition()) - CVector2D(GetPosition());
|
||||||
|
|
||||||
// Check if target is behind ped
|
// Check if target is behind ped
|
||||||
if (DotProduct2D(dist, CVector2D(this->GetForward())) < 0.0f)
|
if (DotProduct2D(dist, CVector2D(GetForward())) < 0.0f)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Check if target is too far away
|
// Check if target is too far away
|
||||||
|
@ -798,7 +799,7 @@ CPed::Avoid(void)
|
||||||
if (nearestPed && nearestPed->m_nPedState != PED_DEAD && nearestPed != m_pSeekTarget && nearestPed != m_pedInObjective) {
|
if (nearestPed && nearestPed->m_nPedState != PED_DEAD && nearestPed != m_pSeekTarget && nearestPed != m_pedInObjective) {
|
||||||
|
|
||||||
// Check if this ped wants to avoid the nearest one
|
// Check if this ped wants to avoid the nearest one
|
||||||
if (CPedType::GetAvoid(this->m_nPedType) & CPedType::GetFlag(nearestPed->m_nPedType)) {
|
if (CPedType::GetAvoid(m_nPedType) & CPedType::GetFlag(nearestPed->m_nPedType)) {
|
||||||
|
|
||||||
// Further codes checks whether the distance between us and ped will be equal or below 1.0, if we walk up to him by 1.25 meters.
|
// Further codes checks whether the distance between us and ped will be equal or below 1.0, if we walk up to him by 1.25 meters.
|
||||||
// If so, we want to avoid it, so we turn our body 45 degree and look to somewhere else.
|
// If so, we want to avoid it, so we turn our body 45 degree and look to somewhere else.
|
||||||
|
@ -1761,7 +1762,6 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase)
|
||||||
|
|
||||||
if (seatPosMult > 0.2f || vehIsUpsideDown) {
|
if (seatPosMult > 0.2f || vehIsUpsideDown) {
|
||||||
SetPosition(neededPos);
|
SetPosition(neededPos);
|
||||||
|
|
||||||
SetHeading(m_fRotationCur);
|
SetHeading(m_fRotationCur);
|
||||||
} else {
|
} else {
|
||||||
CMatrix vehDoorMat(veh->GetMatrix());
|
CMatrix vehDoorMat(veh->GetMatrix());
|
||||||
|
@ -2925,7 +2925,7 @@ CPed::ReactToAttack(CEntity *attacker)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (bCrouchWhenShooting || bKindaStayInSamePlace) {
|
} else if (bCrouchWhenShooting || bKindaStayInSamePlace) {
|
||||||
SetDuck(CGeneral::GetRandomNumberInRange(1000,3000));
|
SetDuck(CGeneral::GetRandomNumberInRange(1000, 3000));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8130,7 +8130,7 @@ CPed::InvestigateEvent(void)
|
||||||
animAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_IDLE_STANCE);
|
animAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_IDLE_STANCE);
|
||||||
|
|
||||||
if (animAssoc && animAssoc->animId == ANIM_IDLE_CAM) {
|
if (animAssoc && animAssoc->animId == ANIM_IDLE_CAM) {
|
||||||
CAnimManager::BlendAnimation(GetClump(), m_animGroup, ANIM_IDLE_STANCE, 14.0f);
|
CAnimManager::BlendAnimation(GetClump(), m_animGroup, ANIM_IDLE_STANCE, 4.0f);
|
||||||
SetLookTimer(CGeneral::GetRandomNumberInRange(1000, 2500));
|
SetLookTimer(CGeneral::GetRandomNumberInRange(1000, 2500));
|
||||||
|
|
||||||
} else if (CGeneral::GetRandomNumber() & 3) {
|
} else if (CGeneral::GetRandomNumber() & 3) {
|
||||||
|
@ -8157,7 +8157,7 @@ CPed::InvestigateEvent(void)
|
||||||
animToPlay = ANIM_XPRESS_SCRATCH;
|
animToPlay = ANIM_XPRESS_SCRATCH;
|
||||||
|
|
||||||
CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, animToPlay, 4.0f);
|
CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, animToPlay, 4.0f);
|
||||||
SetLookTimer(CGeneral::GetRandomNumberInRange(1000, 2500));
|
SetLookTimer(CGeneral::GetRandomNumberInRange(1500, 4000));
|
||||||
|
|
||||||
} else if (animAssoc && animAssoc->animId == ANIM_IDLE_HBHB) {
|
} else if (animAssoc && animAssoc->animId == ANIM_IDLE_HBHB) {
|
||||||
animAssoc->blendDelta = -8.0f;
|
animAssoc->blendDelta = -8.0f;
|
||||||
|
@ -8247,7 +8247,7 @@ CPed::InvestigateEvent(void)
|
||||||
SetMoveState(PEDMOVE_WALK);
|
SetMoveState(PEDMOVE_WALK);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (distSqr > 1.44f) {
|
if (distSqr > sq(1.2f)) {
|
||||||
SetMoveState(PEDMOVE_WALK);
|
SetMoveState(PEDMOVE_WALK);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -8555,7 +8555,6 @@ CPed::LookForInterestingNodes(void)
|
||||||
{
|
{
|
||||||
CBaseModelInfo *model;
|
CBaseModelInfo *model;
|
||||||
CPtrNode *ptrNode;
|
CPtrNode *ptrNode;
|
||||||
CVector effectPos;
|
|
||||||
CVector effectDist;
|
CVector effectDist;
|
||||||
C2dEffect *effect;
|
C2dEffect *effect;
|
||||||
CMatrix *objMat;
|
CMatrix *objMat;
|
||||||
|
@ -8596,7 +8595,7 @@ CPed::LookForInterestingNodes(void)
|
||||||
effect = model->Get2dEffect(e);
|
effect = model->Get2dEffect(e);
|
||||||
if (effect->type == EFFECT_ATTRACTOR && effect->attractor.probability >= randVal) {
|
if (effect->type == EFFECT_ATTRACTOR && effect->attractor.probability >= randVal) {
|
||||||
objMat = &veh->GetMatrix();
|
objMat = &veh->GetMatrix();
|
||||||
effectPos = veh->GetMatrix() * effect->pos;
|
CVector effectPos = veh->GetMatrix() * effect->pos;
|
||||||
effectDist = effectPos - GetPosition();
|
effectDist = effectPos - GetPosition();
|
||||||
if (effectDist.MagnitudeSqr() < sq(8.0f)) {
|
if (effectDist.MagnitudeSqr() < sq(8.0f)) {
|
||||||
found = true;
|
found = true;
|
||||||
|
@ -8614,7 +8613,7 @@ CPed::LookForInterestingNodes(void)
|
||||||
effect = model->Get2dEffect(e);
|
effect = model->Get2dEffect(e);
|
||||||
if (effect->type == EFFECT_ATTRACTOR && effect->attractor.probability >= randVal) {
|
if (effect->type == EFFECT_ATTRACTOR && effect->attractor.probability >= randVal) {
|
||||||
objMat = &obj->GetMatrix();
|
objMat = &obj->GetMatrix();
|
||||||
effectPos = obj->GetMatrix() * effect->pos;
|
CVector effectPos = obj->GetMatrix() * effect->pos;
|
||||||
effectDist = effectPos - GetPosition();
|
effectDist = effectPos - GetPosition();
|
||||||
if (effectDist.MagnitudeSqr() < sq(8.0f)) {
|
if (effectDist.MagnitudeSqr() < sq(8.0f)) {
|
||||||
found = true;
|
found = true;
|
||||||
|
@ -8632,7 +8631,7 @@ CPed::LookForInterestingNodes(void)
|
||||||
effect = model->Get2dEffect(e);
|
effect = model->Get2dEffect(e);
|
||||||
if (effect->type == EFFECT_ATTRACTOR && effect->attractor.probability >= randVal) {
|
if (effect->type == EFFECT_ATTRACTOR && effect->attractor.probability >= randVal) {
|
||||||
objMat = &building->GetMatrix();
|
objMat = &building->GetMatrix();
|
||||||
effectPos = building->GetMatrix() * effect->pos;
|
CVector effectPos = building->GetMatrix() * effect->pos;
|
||||||
effectDist = effectPos - GetPosition();
|
effectDist = effectPos - GetPosition();
|
||||||
if (effectDist.MagnitudeSqr() < sq(8.0f)) {
|
if (effectDist.MagnitudeSqr() < sq(8.0f)) {
|
||||||
found = true;
|
found = true;
|
||||||
|
@ -8650,7 +8649,7 @@ CPed::LookForInterestingNodes(void)
|
||||||
effect = model->Get2dEffect(e);
|
effect = model->Get2dEffect(e);
|
||||||
if (effect->type == EFFECT_ATTRACTOR && effect->attractor.probability >= randVal) {
|
if (effect->type == EFFECT_ATTRACTOR && effect->attractor.probability >= randVal) {
|
||||||
objMat = &building->GetMatrix();
|
objMat = &building->GetMatrix();
|
||||||
effectPos = building->GetMatrix() * effect->pos;
|
CVector effectPos = building->GetMatrix() * effect->pos;
|
||||||
effectDist = effectPos - GetPosition();
|
effectDist = effectPos - GetPosition();
|
||||||
if (effectDist.MagnitudeSqr() < sq(8.0f)) {
|
if (effectDist.MagnitudeSqr() < sq(8.0f)) {
|
||||||
found = true;
|
found = true;
|
||||||
|
@ -8676,12 +8675,13 @@ CPed::LookForInterestingNodes(void)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CVector2D effectPos = *objMat * effect->pos;
|
||||||
switch (effect->attractor.type) {
|
switch (effect->attractor.type) {
|
||||||
case ATTRACTORTYPE_ICECREAM:
|
case ATTRACTORTYPE_ICECREAM:
|
||||||
SetInvestigateEvent(EVENT_ICECREAM, CVector2D(effectPos), 0.1f, 15000, angleToFace);
|
SetInvestigateEvent(EVENT_ICECREAM, effectPos, 0.1f, 15000, angleToFace);
|
||||||
break;
|
break;
|
||||||
case ATTRACTORTYPE_STARE:
|
case ATTRACTORTYPE_STARE:
|
||||||
SetInvestigateEvent(EVENT_SHOPSTALL, CVector2D(effectPos), 1.0f,
|
SetInvestigateEvent(EVENT_SHOPSTALL, effectPos, 1.0f,
|
||||||
CGeneral::GetRandomNumberInRange(8000, 10 * effect->attractor.probability + 8500),
|
CGeneral::GetRandomNumberInRange(8000, 10 * effect->attractor.probability + 8500),
|
||||||
angleToFace);
|
angleToFace);
|
||||||
break;
|
break;
|
||||||
|
@ -11732,7 +11732,7 @@ CPed::RegisterThreatWithGangPeds(CEntity *attacker)
|
||||||
if (!attackerPed->m_pMyVehicle || attackerPed->m_pMyVehicle->GetModelIndex() != MI_TOYZ) {
|
if (!attackerPed->m_pMyVehicle || attackerPed->m_pMyVehicle->GetModelIndex() != MI_TOYZ) {
|
||||||
int16 lastVehicle;
|
int16 lastVehicle;
|
||||||
CEntity *vehicles[8];
|
CEntity *vehicles[8];
|
||||||
CWorld::FindObjectsInRange(GetPosition(), 30.0f, true, &lastVehicle, 6, vehicles, false, true, false, false, false);
|
CWorld::FindObjectsInRange(GetPosition(), ENTER_CAR_MAX_DIST, true, &lastVehicle, 6, vehicles, false, true, false, false, false);
|
||||||
|
|
||||||
if (lastVehicle > 8)
|
if (lastVehicle > 8)
|
||||||
lastVehicle = 8;
|
lastVehicle = 8;
|
||||||
|
@ -12539,7 +12539,8 @@ CPed::ProcessObjective(void)
|
||||||
SetObjective(OBJECTIVE_LEAVE_CAR, m_pMyVehicle);
|
SetObjective(OBJECTIVE_LEAVE_CAR, m_pMyVehicle);
|
||||||
bFleeAfterExitingCar = true;
|
bFleeAfterExitingCar = true;
|
||||||
} else if (m_nPedState != PED_FLEE_POS) {
|
} else if (m_nPedState != PED_FLEE_POS) {
|
||||||
SetFlee(GetPosition(), 10000);
|
CVector2D fleePos = GetPosition();
|
||||||
|
SetFlee(fleePos, 10000);
|
||||||
bUsePedNodeSeek = true;
|
bUsePedNodeSeek = true;
|
||||||
m_pNextPathNode = nil;
|
m_pNextPathNode = nil;
|
||||||
}
|
}
|
||||||
|
@ -12585,7 +12586,7 @@ CPed::ProcessObjective(void)
|
||||||
{
|
{
|
||||||
if (m_pedInObjective) {
|
if (m_pedInObjective) {
|
||||||
if (m_pedInObjective->IsPlayer() && CharCreatedBy != MISSION_CHAR
|
if (m_pedInObjective->IsPlayer() && CharCreatedBy != MISSION_CHAR
|
||||||
&& m_nPedType != PEDTYPE_COP && FindPlayerPed()->m_pWanted->m_CurrentCops
|
&& m_nPedType != PEDTYPE_COP && FindPlayerPed()->m_pWanted->m_CurrentCops != 0
|
||||||
&& !bKindaStayInSamePlace) {
|
&& !bKindaStayInSamePlace) {
|
||||||
|
|
||||||
SetObjective(OBJECTIVE_FLEE_ON_FOOT_TILL_SAFE);
|
SetObjective(OBJECTIVE_FLEE_ON_FOOT_TILL_SAFE);
|
||||||
|
@ -12693,7 +12694,6 @@ CPed::ProcessObjective(void)
|
||||||
SetObjective(OBJECTIVE_LEAVE_CAR, m_pMyVehicle);
|
SetObjective(OBJECTIVE_LEAVE_CAR, m_pMyVehicle);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_pedInObjective || m_pedInObjective->DyingOrDead()) {
|
if (!m_pedInObjective || m_pedInObjective->DyingOrDead()) {
|
||||||
ClearLookFlag();
|
ClearLookFlag();
|
||||||
bObjectiveCompleted = true;
|
bObjectiveCompleted = true;
|
||||||
|
@ -13249,7 +13249,7 @@ CPed::ProcessObjective(void)
|
||||||
if (m_carInObjective && m_carInObjective->m_fHealth > 0.0f) {
|
if (m_carInObjective && m_carInObjective->m_fHealth > 0.0f) {
|
||||||
distWithTarget = m_carInObjective->GetPosition() - GetPosition();
|
distWithTarget = m_carInObjective->GetPosition() - GetPosition();
|
||||||
if (!bInVehicle) {
|
if (!bInVehicle) {
|
||||||
if (nEnterCarRangeMultiplier * 30.0f < distWithTarget.Magnitude()) {
|
if (nEnterCarRangeMultiplier * ENTER_CAR_MAX_DIST < distWithTarget.Magnitude()) {
|
||||||
if (!m_carInObjective->pDriver && !m_carInObjective->GetIsOnScreen() && !GetIsOnScreen())
|
if (!m_carInObjective->pDriver && !m_carInObjective->GetIsOnScreen() && !GetIsOnScreen())
|
||||||
WarpPedToNearEntityOffScreen(m_carInObjective);
|
WarpPedToNearEntityOffScreen(m_carInObjective);
|
||||||
|
|
||||||
|
@ -13534,11 +13534,12 @@ CPed::ProcessObjective(void)
|
||||||
RestorePreviousObjective();
|
RestorePreviousObjective();
|
||||||
} else if (m_hitRecoverTimer < CTimer::GetTimeInMilliseconds()) {
|
} else if (m_hitRecoverTimer < CTimer::GetTimeInMilliseconds()) {
|
||||||
CVehicle *carToSteal = nil;
|
CVehicle *carToSteal = nil;
|
||||||
float closestCarDist = 30.0f;
|
float closestCarDist = ENTER_CAR_MAX_DIST;
|
||||||
CVector pos = GetPosition();
|
CVector pos = GetPosition();
|
||||||
int16 lastVehicle;
|
int16 lastVehicle;
|
||||||
CEntity *vehicles[8];
|
CEntity *vehicles[8];
|
||||||
|
|
||||||
|
// NB: This should've been ENTER_CAR_MAX_DIST actually, and is fixed in VC.
|
||||||
CWorld::FindObjectsInRange(pos, CHECK_NEARBY_THINGS_MAX_DIST, true, &lastVehicle, 6, vehicles, false, true, false, false, false);
|
CWorld::FindObjectsInRange(pos, CHECK_NEARBY_THINGS_MAX_DIST, true, &lastVehicle, 6, vehicles, false, true, false, false, false);
|
||||||
for(int i = 0; i < lastVehicle; i++) {
|
for(int i = 0; i < lastVehicle; i++) {
|
||||||
CVehicle *nearVeh = (CVehicle*)vehicles[i];
|
CVehicle *nearVeh = (CVehicle*)vehicles[i];
|
||||||
|
@ -14545,48 +14546,44 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
|
||||||
upperSpeedLimit *= 2.0f;
|
upperSpeedLimit *= 2.0f;
|
||||||
lowerSpeedLimit *= 1.5f;
|
lowerSpeedLimit *= 1.5f;
|
||||||
}
|
}
|
||||||
if (!bWasStanding) {
|
CAnimBlendAssociation *fallAnim = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_FALL_FALL);
|
||||||
if ((speed <= upperSpeedLimit /* || (bfFlagsL >> 5) & 1 */) && m_vecMoveSpeed.z >= lowerSpeedLimit
|
if (!bWasStanding && speed > upperSpeedLimit && (/*!bPushedAlongByCar ||*/ m_vecMoveSpeed.z < lowerSpeedLimit)
|
||||||
|| m_pCollidingEntity == collidingEnt) {
|
&& m_pCollidingEntity != collidingEnt) {
|
||||||
|
|
||||||
if (RpAnimBlendClumpGetAssociation(GetClump(), ANIM_FALL_FALL) && -0.016f * CTimer::GetTimeStep() > m_vecMoveSpeed.z) {
|
float damage = 100.0f * Max(speed - 0.25f, 0.0f);
|
||||||
InflictDamage(collidingEnt, WEAPONTYPE_FALL, 15.0f, PEDPIECE_TORSO, 2);
|
float damage2 = damage;
|
||||||
}
|
if (m_vecMoveSpeed.z < -0.25f)
|
||||||
} else {
|
damage += (-0.25f - m_vecMoveSpeed.z) * 150.0f;
|
||||||
float damage = 100.0f * Max(speed - 0.25f, 0.0f);
|
|
||||||
float damage2 = damage;
|
|
||||||
if (m_vecMoveSpeed.z < -0.25f)
|
|
||||||
damage += (-0.25f - m_vecMoveSpeed.z) * 150.0f;
|
|
||||||
|
|
||||||
uint8 dir = 2; // from backward
|
uint8 dir = 2; // from backward
|
||||||
if (m_vecMoveSpeed.x > 0.01f || m_vecMoveSpeed.x < -0.01f || m_vecMoveSpeed.y > 0.01f || m_vecMoveSpeed.y < -0.01f) {
|
if (m_vecMoveSpeed.x > 0.01f || m_vecMoveSpeed.x < -0.01f || m_vecMoveSpeed.y > 0.01f || m_vecMoveSpeed.y < -0.01f) {
|
||||||
CVector2D offset = -m_vecMoveSpeed;
|
CVector2D offset = -m_vecMoveSpeed;
|
||||||
dir = GetLocalDirection(offset);
|
dir = GetLocalDirection(offset);
|
||||||
}
|
|
||||||
InflictDamage(collidingEnt, WEAPONTYPE_FALL, damage, PEDPIECE_TORSO, dir);
|
|
||||||
if (IsPlayer() && damage2 > 5.0f)
|
|
||||||
Say(SOUND_PED_LAND);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
InflictDamage(collidingEnt, WEAPONTYPE_FALL, damage, PEDPIECE_TORSO, dir);
|
||||||
|
if (IsPlayer() && damage2 > 5.0f)
|
||||||
|
Say(SOUND_PED_LAND);
|
||||||
|
|
||||||
|
} else if (!bWasStanding && fallAnim && -0.016f * CTimer::GetTimeStep() > m_vecMoveSpeed.z) {
|
||||||
|
InflictDamage(collidingEnt, WEAPONTYPE_FALL, 15.0f, PEDPIECE_TORSO, 2);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
float speedSqr = 0.0f;
|
float speedSqr = 0.0f;
|
||||||
if (!bWasStanding) {
|
CAnimBlendAssociation *fallAnim = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_FALL_FALL);
|
||||||
if (m_vecMoveSpeed.z >= -0.25f && (speedSqr = m_vecMoveSpeed.MagnitudeSqr()) <= sq(0.5f)) {
|
if (!bWasStanding && (m_vecMoveSpeed.z < -0.25f || (speedSqr = m_vecMoveSpeed.MagnitudeSqr()) > sq(0.5f))) {
|
||||||
|
if (speedSqr == 0.0f)
|
||||||
|
speedSqr = sq(m_vecMoveSpeed.z);
|
||||||
|
|
||||||
if (RpAnimBlendClumpGetAssociation(GetClump(), ANIM_FALL_FALL) && -0.016f * CTimer::GetTimeStep() > m_vecMoveSpeed.z) {
|
uint8 dir = 2; // from backward
|
||||||
InflictDamage(collidingEnt, WEAPONTYPE_FALL, 15.0f, PEDPIECE_TORSO, 2);
|
if (m_vecMoveSpeed.x > 0.01f || m_vecMoveSpeed.x < -0.01f || m_vecMoveSpeed.y > 0.01f || m_vecMoveSpeed.y < -0.01f) {
|
||||||
}
|
CVector2D offset = -m_vecMoveSpeed;
|
||||||
} else {
|
dir = GetLocalDirection(offset);
|
||||||
if (speedSqr == 0.0f)
|
|
||||||
speedSqr = sq(m_vecMoveSpeed.z);
|
|
||||||
|
|
||||||
uint8 dir = 2; // from backward
|
|
||||||
if (m_vecMoveSpeed.x > 0.01f || m_vecMoveSpeed.x < -0.01f || m_vecMoveSpeed.y > 0.01f || m_vecMoveSpeed.y < -0.01f) {
|
|
||||||
CVector2D offset = -m_vecMoveSpeed;
|
|
||||||
dir = GetLocalDirection(offset);
|
|
||||||
}
|
|
||||||
InflictDamage(collidingEnt, WEAPONTYPE_FALL, 350.0f * sq(speedSqr), PEDPIECE_TORSO, dir);
|
|
||||||
}
|
}
|
||||||
|
InflictDamage(collidingEnt, WEAPONTYPE_FALL, 350.0f * sq(speedSqr), PEDPIECE_TORSO, dir);
|
||||||
|
|
||||||
|
} else if (!bWasStanding && fallAnim && -0.016f * CTimer::GetTimeStep() > m_vecMoveSpeed.z) {
|
||||||
|
InflictDamage(collidingEnt, WEAPONTYPE_FALL, 15.0f, PEDPIECE_TORSO, 2);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
m_vecMoveSpeed.z = 0.0f;
|
m_vecMoveSpeed.z = 0.0f;
|
||||||
|
@ -14613,7 +14610,7 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
|
||||||
bHasHitWall = true;
|
bHasHitWall = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (collidingEnt->IsBuilding() || collidingEnt->IsStatic()) {
|
if (collidingEnt->IsBuilding() || collidingEnt->IsStatic()) {
|
||||||
|
|
||||||
if (bWasStanding) {
|
if (bWasStanding) {
|
||||||
CVector sphereNormal;
|
CVector sphereNormal;
|
||||||
|
@ -15008,7 +15005,7 @@ CPed::ProcessBuoyancy(void)
|
||||||
ApplyMoveForce(buoyancyImpulse);
|
ApplyMoveForce(buoyancyImpulse);
|
||||||
if (!DyingOrDead()) {
|
if (!DyingOrDead()) {
|
||||||
if (bTryingToReachDryLand) {
|
if (bTryingToReachDryLand) {
|
||||||
if (buoyancyImpulse.z / m_fMass > 0.0032f * CTimer::GetTimeStep()) {
|
if (buoyancyImpulse.z / m_fMass > GRAVITY * 0.4f * CTimer::GetTimeStep()) {
|
||||||
bTryingToReachDryLand = false;
|
bTryingToReachDryLand = false;
|
||||||
CVector pos = GetPosition();
|
CVector pos = GetPosition();
|
||||||
if (PlacePedOnDryLand()) {
|
if (PlacePedOnDryLand()) {
|
||||||
|
@ -15032,7 +15029,7 @@ CPed::ProcessBuoyancy(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
float speedMult = 0.0f;
|
float speedMult = 0.0f;
|
||||||
if (buoyancyImpulse.z / m_fMass > 0.006f * CTimer::GetTimeStep()
|
if (buoyancyImpulse.z / m_fMass > GRAVITY * 0.75f * CTimer::GetTimeStep()
|
||||||
|| mod_Buoyancy.m_waterlevel > GetPosition().z) {
|
|| mod_Buoyancy.m_waterlevel > GetPosition().z) {
|
||||||
speedMult = pow(0.9f, CTimer::GetTimeStep());
|
speedMult = pow(0.9f, CTimer::GetTimeStep());
|
||||||
m_vecMoveSpeed.x *= speedMult;
|
m_vecMoveSpeed.x *= speedMult;
|
||||||
|
@ -15041,7 +15038,7 @@ CPed::ProcessBuoyancy(void)
|
||||||
bIsStanding = false;
|
bIsStanding = false;
|
||||||
InflictDamage(nil, WEAPONTYPE_DROWNING, 3.0f * CTimer::GetTimeStep(), PEDPIECE_TORSO, 0);
|
InflictDamage(nil, WEAPONTYPE_DROWNING, 3.0f * CTimer::GetTimeStep(), PEDPIECE_TORSO, 0);
|
||||||
}
|
}
|
||||||
if (buoyancyImpulse.z / m_fMass > 0.002f * CTimer::GetTimeStep()) {
|
if (buoyancyImpulse.z / m_fMass > GRAVITY * 0.25f * CTimer::GetTimeStep()) {
|
||||||
if (speedMult == 0.0f) {
|
if (speedMult == 0.0f) {
|
||||||
speedMult = pow(0.9f, CTimer::GetTimeStep());
|
speedMult = pow(0.9f, CTimer::GetTimeStep());
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
#define FEET_OFFSET 1.04f
|
#define FEET_OFFSET 1.04f
|
||||||
#define CHECK_NEARBY_THINGS_MAX_DIST 15.0f
|
#define CHECK_NEARBY_THINGS_MAX_DIST 15.0f
|
||||||
|
#define ENTER_CAR_MAX_DIST 30.0f
|
||||||
|
|
||||||
struct CPathNode;
|
struct CPathNode;
|
||||||
class CAccident;
|
class CAccident;
|
||||||
|
|
Loading…
Reference in a new issue