Refactor `CEntity` (#1123)
* Fix `CStreaming::RemoveBuildingsNotInArea`, dont corrent check area * Fix `CEntity::PreRender`, `7.744F` -> `0.744F`. * Fix `CEntity::SetRwObjectAlpha`, call all material. * Low etc fix
This commit is contained in:
parent
63f8e3d486
commit
81da58a18c
|
|
@ -168,7 +168,7 @@ CVehicle* CAEAudioUtility::FindVehicleOfPlayer() {
|
|||
return vehicle;
|
||||
|
||||
auto* attach = player->m_pAttachedTo->AsAutomobile();
|
||||
if (attach && attach->IsVehicle())
|
||||
if (attach && attach->GetIsTypeVehicle())
|
||||
return attach;
|
||||
|
||||
return vehicle;
|
||||
|
|
|
|||
|
|
@ -266,7 +266,7 @@ void CAECollisionAudioEntity::ReportCollision(CEntity* entity1, CEntity* entity2
|
|||
// 0x4DBDF0
|
||||
void CAECollisionAudioEntity::ReportBulletHit(CEntity* entity, eSurfaceType surface, const CVector& posn, float angleWithColPointNorm) {
|
||||
if (AEAudioHardware.IsSoundBankLoaded(SND_BANK_GENRL_BULLET_HITS, SND_BANK_SLOT_BULLET_HITS)) {
|
||||
if (entity && entity->IsVehicle()) {
|
||||
if (entity && entity->GetIsTypeVehicle()) {
|
||||
surface = entity->AsVehicle()->IsSubBMX()
|
||||
? (eSurfaceType)(188) // todo: C* Surface
|
||||
: SURFACE_CAR;
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ CAEPedSpeechAudioEntity::CAEPedSpeechAudioEntity(CPed* ped) noexcept :
|
|||
CAEPedSpeechAudioEntity{}
|
||||
{
|
||||
m_Entity = ped;
|
||||
if (ped->GetModelID() != MODEL_INVALID) {
|
||||
if (ped->GetModelId() != MODEL_INVALID) {
|
||||
auto* const mi = ped->GetPedModelInfo();
|
||||
m_PedAudioType = mi->m_nPedAudioType;
|
||||
switch (m_PedAudioType) {
|
||||
|
|
@ -108,7 +108,7 @@ CAEPedSpeechAudioEntity::CAEPedSpeechAudioEntity(CPed* ped) noexcept :
|
|||
break;
|
||||
}
|
||||
}
|
||||
VERIFY(GetSexFromModel(ped->GetModelID()));
|
||||
VERIFY(GetSexFromModel(ped->GetModelId()));
|
||||
m_IsInitialized = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -723,7 +723,7 @@ void CAEScriptAudioEntity::ProcessMissionAudioEvent(eAudioEvents eventId, CVecto
|
|||
AEAmbienceTrackManager.PlaySpecialMissionAmbienceTrack(AE_GARAGE_DOOR_CLOSING);
|
||||
break;
|
||||
case AE_CAS9_AD:
|
||||
if (CLocalisation::Blood() && physical && physical->IsPed()) {
|
||||
if (CLocalisation::Blood() && physical && physical->GetIsTypePed()) {
|
||||
physical->AsPed()->GetAE().AddAudioEvent(AE_PED_CRUNCH, 0.0f, 1.0f, physical, 0, 0, 0);
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ CAEVehicleAudioEntity::~CAEVehicleAudioEntity() {
|
|||
|
||||
// 0x4F7670
|
||||
void CAEVehicleAudioEntity::Initialise(CEntity* entity) {
|
||||
assert(entity && entity->IsVehicle());
|
||||
assert(entity && entity->GetIsTypeVehicle());
|
||||
|
||||
m_TimeLastServiced = 0;
|
||||
m_Entity = entity;
|
||||
|
|
@ -114,7 +114,7 @@ void CAEVehicleAudioEntity::Initialise(CEntity* entity) {
|
|||
m_MovingPartSmoothedSpeed = 0.0f;
|
||||
m_FadeIn = 1.0f;
|
||||
m_FadeOut = 0.0f;
|
||||
m_AuSettings = GetVehicleAudioSettings(entity->m_nModelIndex - MODEL_VEHICLE_FIRST);
|
||||
m_AuSettings = GetVehicleAudioSettings(entity->GetModelIndex() - MODEL_VEHICLE_FIRST);
|
||||
m_HasSiren = entity->AsVehicle()->UsesSiren();
|
||||
|
||||
for (uint32 i = 0; auto& es : m_EngineSounds) {
|
||||
|
|
@ -137,7 +137,7 @@ void CAEVehicleAudioEntity::Initialise(CEntity* entity) {
|
|||
MODEL_MOWER,
|
||||
MODEL_SWEEPER,
|
||||
MODEL_TUG,
|
||||
}, entity->GetModelID());
|
||||
}, entity->GetModelId());
|
||||
|
||||
switch (m_AuSettings.VehicleAudioType) {
|
||||
case AE_CAR: {
|
||||
|
|
@ -385,7 +385,7 @@ bool CAEVehicleAudioEntity::DoesBankSlotContainThisBank(eSoundBankSlot bankSlot,
|
|||
#pragma region Helpers
|
||||
// 0x4F5C40
|
||||
bool CAEVehicleAudioEntity::CopHeli() const noexcept {
|
||||
const auto modelIndex = m_Entity->m_nModelIndex;
|
||||
const auto modelIndex = m_Entity->GetModelIndex();
|
||||
return modelIndex == MODEL_MAVERICK || modelIndex == MODEL_VCNMAV;
|
||||
}
|
||||
|
||||
|
|
@ -1257,7 +1257,7 @@ constexpr float CAEVehicleAudioEntity::GetDummyIdleRatioProgress(float ratio) {
|
|||
|
||||
// 0x4F51F0
|
||||
float CAEVehicleAudioEntity::GetVolumeForDummyIdle(float ratio, float fadeRatio) const noexcept {
|
||||
if (GetVehicle()->GetModelID() == MODEL_CADDY) {
|
||||
if (GetVehicle()->GetModelId() == MODEL_CADDY) {
|
||||
return s_Config.DummyEngine.ID.VolumeBase - 30.0f;
|
||||
}
|
||||
|
||||
|
|
@ -1285,7 +1285,7 @@ float CAEVehicleAudioEntity::GetVolumeForDummyIdle(float ratio, float fadeRatio)
|
|||
|
||||
// 0x4F5310
|
||||
float CAEVehicleAudioEntity::GetFrequencyForDummyIdle(float ratio, float fadeRatio) const noexcept {
|
||||
if (GetVehicle()->m_nModelIndex == MODEL_CADDY) {
|
||||
if (GetVehicle()->GetModelIndex() == MODEL_CADDY) {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
|
|
@ -1941,7 +1941,7 @@ void CAEVehicleAudioEntity::GetSirenState(bool& isSirenOn, bool& isFastSirenOn,
|
|||
if (m_IsWreckedVehicle || !m_HasSiren || !vp.Vehicle->vehicleFlags.bSirenOrAlarm) {
|
||||
isSirenOn = false;
|
||||
} else if (isSirenOn = (vp.Vehicle->GetStatus() != STATUS_ABANDONED)) {
|
||||
isFastSirenOn = vp.Vehicle->m_HornCounter && vp.Vehicle->m_nModelIndex != MODEL_MRWHOOP;
|
||||
isFastSirenOn = vp.Vehicle->m_HornCounter && vp.Vehicle->GetModelIndex() != MODEL_MRWHOOP;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2055,7 +2055,7 @@ void CAEVehicleAudioEntity::PlayHornOrSiren(bool isHornOn, bool isSirenOn, bool
|
|||
if (isSirenOn && !isFastSirenOn) {
|
||||
if ((!m_IsSirenOn || m_IsFastSirenOn) && !m_SirenSound) {
|
||||
if (areHornSoundsLoaded) {
|
||||
const auto isMrWhoop = vp.Vehicle->GetModelID() == MODEL_MRWHOOP;
|
||||
const auto isMrWhoop = vp.Vehicle->GetModelId() == MODEL_MRWHOOP;
|
||||
if (isMrWhoop && !AEAudioHardware.IsSoundBankLoaded(SND_BANK_GENRL_ICEVAN_P, SND_BANK_SLOT_PLAYER_ENGINE_P)) { // 0x4F9CCD
|
||||
return;
|
||||
}
|
||||
|
|
@ -2273,7 +2273,7 @@ void CAEVehicleAudioEntity::ProcessVehicleFlatTyre(tVehicleParams& vp) {
|
|||
const auto spinning = [&]{
|
||||
switch (m_AuSettings.VehicleAudioType) {
|
||||
case AE_SPECIAL: {
|
||||
if (vp.Vehicle->m_nModelIndex != MODEL_CADDY) {
|
||||
if (vp.Vehicle->GetModelIndex() != MODEL_CADDY) {
|
||||
return false;
|
||||
}
|
||||
[[fallthrough]];
|
||||
|
|
@ -2327,7 +2327,7 @@ void CAEVehicleAudioEntity::ProcessVehicleRoadNoise(tVehicleParams& vp) {
|
|||
|
||||
// 0x4F8B47
|
||||
bool cancel = false;
|
||||
switch (vp.Vehicle->m_nModelIndex) {
|
||||
switch (vp.Vehicle->GetModelIndex()) {
|
||||
case MODEL_ARTICT1:
|
||||
case MODEL_ARTICT2:
|
||||
case MODEL_PETROTR:
|
||||
|
|
@ -2519,7 +2519,7 @@ void CAEVehicleAudioEntity::ProcessMovingParts(tVehicleParams& vp) {
|
|||
auto* const a = vp.Vehicle->AsAutomobile();
|
||||
const auto* const cfg = &s_Config.MovingParts;
|
||||
|
||||
switch (vp.Vehicle->m_nModelIndex) {
|
||||
switch (vp.Vehicle->GetModelIndex()) {
|
||||
case MODEL_PACKER:
|
||||
case MODEL_DOZER:
|
||||
case MODEL_DUMPER:
|
||||
|
|
@ -2539,7 +2539,7 @@ void CAEVehicleAudioEntity::ProcessMovingParts(tVehicleParams& vp) {
|
|||
true
|
||||
);
|
||||
|
||||
const auto* const props = &cfg->PropsByModel.at(vp.Vehicle->GetModelID());
|
||||
const auto* const props = &cfg->PropsByModel.at(vp.Vehicle->GetModelId());
|
||||
const auto slot = props->Slot.value_or(m_DummySlot);
|
||||
const auto* const params = &props->SoundParamsByPartDir[delta <= 0.f ? 0 : 1];
|
||||
|
||||
|
|
@ -2568,7 +2568,7 @@ float CAEVehicleAudioEntity::GetVolForPlayerEngineSound(tVehicleParams& vp, eVeh
|
|||
case AE_SOUND_CAR_REV:
|
||||
return lerp(cfg.Rev.VolMin, cfg.Rev.VolMax, vp.RealRevsRatio);
|
||||
case AE_SOUND_CAR_ID:
|
||||
return vp.Vehicle->m_nModelIndex == MODEL_CADDY
|
||||
return vp.Vehicle->GetModelIndex() == MODEL_CADDY
|
||||
? cfg.ID.VolMin - 30.f
|
||||
: lerp(cfg.ID.VolMin, cfg.ID.VolMax, vp.RealRevsRatio);
|
||||
case AE_SOUND_PLAYER_CRZ:
|
||||
|
|
@ -2613,7 +2613,7 @@ float CAEVehicleAudioEntity::GetFreqForPlayerEngineSound(tVehicleParams& vp, eVe
|
|||
auto* const cfg = &s_Config.PlayerEngine;
|
||||
|
||||
float f;
|
||||
if (st == AE_SOUND_CAR_ID && vp.Vehicle->GetModelID() == MODEL_CADDY) { // Moved out here to simplify logic...
|
||||
if (st == AE_SOUND_CAR_ID && vp.Vehicle->GetModelId() == MODEL_CADDY) { // Moved out here to simplify logic...
|
||||
f = 0.f;
|
||||
} else {
|
||||
// 0x4F80A6 - Calculate z move speed factor
|
||||
|
|
@ -3182,7 +3182,7 @@ void CAEVehicleAudioEntity::ProcessAircraft(tVehicleParams& params) {
|
|||
JustWreckedVehicle();
|
||||
} else if (m_IsPlayerDriver) {
|
||||
ProcessPlayerHeli(params);
|
||||
} else if (vehicle->m_nStatus == STATUS_PHYSICS) {
|
||||
} else if (vehicle->GetStatus() == STATUS_PHYSICS) {
|
||||
ProcessAIHeli(params);
|
||||
} else {
|
||||
ProcessDummyHeli(params);
|
||||
|
|
@ -3190,7 +3190,7 @@ void CAEVehicleAudioEntity::ProcessAircraft(tVehicleParams& params) {
|
|||
break;
|
||||
}
|
||||
case AE_AIRCRAFT_PLANE: {
|
||||
switch (vehicle->m_nModelIndex) {
|
||||
switch (vehicle->GetModelIndex()) {
|
||||
case MODEL_SHAMAL:
|
||||
case MODEL_HYDRA:
|
||||
case MODEL_AT400:
|
||||
|
|
@ -3205,7 +3205,7 @@ void CAEVehicleAudioEntity::ProcessAircraft(tVehicleParams& params) {
|
|||
default: {
|
||||
if (m_IsPlayerDriver) {
|
||||
ProcessPlayerProp(params);
|
||||
} else if (vehicle->m_nStatus == STATUS_PHYSICS || vehicle->m_autoPilot.m_vehicleRecordingId >= 0) {
|
||||
} else if (vehicle->GetStatus() == STATUS_PHYSICS || vehicle->m_autoPilot.m_vehicleRecordingId >= 0) {
|
||||
ProcessAIProp(params);
|
||||
} else {
|
||||
ProcessDummyProp(params);
|
||||
|
|
@ -4548,11 +4548,11 @@ void CAEVehicleAudioEntity::StopNonEngineSounds() noexcept {
|
|||
// 0x501E10
|
||||
void CAEVehicleAudioEntity::ProcessVehicle(CPhysical* physical) {
|
||||
auto* const vehicle = physical->AsVehicle();
|
||||
const auto isStatusSimple = vehicle->m_nStatus == STATUS_SIMPLE;
|
||||
const auto isStatusSimple = vehicle->GetStatus() == STATUS_SIMPLE;
|
||||
|
||||
tVehicleParams vp{};
|
||||
vp.Vehicle = vehicle;
|
||||
vp.ModelIndexMinusOffset = physical->m_nModelIndex - 400;
|
||||
vp.ModelIndexMinusOffset = physical->GetModelIndex() - MODEL_VEHICLE_FIRST;
|
||||
vp.BaseVehicleType = vehicle->m_nVehicleType;
|
||||
vp.SpecificVehicleType = vehicle->m_nVehicleSubType;
|
||||
vp.Transmission = vehicle->m_pHandlingData
|
||||
|
|
@ -4601,7 +4601,7 @@ void CAEVehicleAudioEntity::ProcessVehicle(CPhysical* physical) {
|
|||
|
||||
ProcessMovingParts(vp);
|
||||
|
||||
if (vp.Vehicle->m_nModelIndex == MODEL_COMBINE) {
|
||||
if (vp.Vehicle->GetModelIndex() == MODEL_COMBINE) {
|
||||
ProcessPlayerCombine(vp);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -647,7 +647,7 @@ void CAEWeaponAudioEntity::PlayMiniGunStopSound(CPhysical* entity) {
|
|||
s.m_Event = AE_FRONTEND_PICKUP_HEALTH; // ???
|
||||
AESoundManager.RequestNewSound(&s);
|
||||
};
|
||||
if (entity->IsVehicle() && entity->AsVehicle()->IsSubPlane()) {
|
||||
if (entity->GetIsTypeVehicle() && entity->AsVehicle()->IsSubPlane()) {
|
||||
PlayMiniGunFireStopSound(1.8f, 0.7937f);
|
||||
} else {
|
||||
PlayMiniGunFireStopSound(1.f, 1.f);
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ BreakObject_c::BreakObject_c() {
|
|||
|
||||
// 0x59E750
|
||||
bool BreakObject_c::Init(CObject* object, const CVector* velocity, float fVelocityRand, int32 bJustFaces) {
|
||||
if (!object->m_pRwObject || RwObjectGetType(object->m_pRwObject) != rpATOMIC)
|
||||
if (!object->GetRwObject() || RwObjectGetType(object->GetRwObject()) != rpATOMIC)
|
||||
return false;
|
||||
|
||||
auto* info = BREAKABLEPLG(RpAtomicGetGeometry(object->m_pRwAtomic), m_pBreakableInfo);
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ void CBulletInfo::Update() {
|
|||
if (CWorld::ProcessLineOfSight(info.m_vecPosition, newPosition, colPoint, hitEntity, true, true, true, true, true, false, false, true)) {
|
||||
CWeapon::CheckForShootingVehicleOccupant(&hitEntity, &colPoint, info.m_nWeaponType, info.m_vecPosition, newPosition);
|
||||
|
||||
switch (hitEntity->m_nType) {
|
||||
switch (hitEntity->GetType()) {
|
||||
case ENTITY_TYPE_PED: {
|
||||
auto hitPed = hitEntity->AsPed();
|
||||
|
||||
|
|
@ -130,7 +130,7 @@ void CBulletInfo::Update() {
|
|||
// std::cout << "Hit vehicle\n";
|
||||
auto hitVehicle = hitEntity->AsVehicle();
|
||||
|
||||
if (info.m_pCreator && info.m_pCreator->IsPed())
|
||||
if (info.m_pCreator && info.m_pCreator->GetIsTypePed())
|
||||
if (info.m_pCreator->AsPed()->m_pAttachedTo == hitVehicle)
|
||||
break;
|
||||
|
||||
|
|
@ -163,11 +163,11 @@ void CBulletInfo::Update() {
|
|||
if (TheCamera.IsSphereVisible(colPoint.m_vecNormal, 1.0f))
|
||||
g_fx.AddBulletImpact(colPoint.m_vecPoint, colPoint.m_vecNormal, colPoint.m_nSurfaceTypeB, 8, colPoint.m_nLightingB.GetCurrentLighting());
|
||||
|
||||
if (info.m_pCreator && info.m_pCreator->IsPed())
|
||||
if (info.m_pCreator && info.m_pCreator->GetIsTypePed())
|
||||
if (info.m_pCreator->AsPed()->m_pAttachedTo == hitEntity)
|
||||
break;
|
||||
|
||||
switch (hitEntity->m_nType) {
|
||||
switch (hitEntity->GetType()) {
|
||||
case ENTITY_TYPE_OBJECT: {
|
||||
// std::cout << "Hit object\n";
|
||||
auto hitObject = hitEntity->AsObject();
|
||||
|
|
@ -180,11 +180,11 @@ void CBulletInfo::Update() {
|
|||
if (hitObject->physicalFlags.bDisableCollisionForce || hitObject->m_pObjectInfo->m_fColDamageMultiplier >= 99.9f) {
|
||||
/* empty */
|
||||
} else {
|
||||
if (hitObject->IsStatic() && hitObject->m_pObjectInfo->m_fUprootLimit <= 0.0f) {
|
||||
if (hitObject->GetIsStatic() && hitObject->m_pObjectInfo->m_fUprootLimit <= 0.0f) {
|
||||
hitObject->SetIsStatic(false);
|
||||
hitObject->AddToMovingList();
|
||||
}
|
||||
if (!hitObject->IsStatic()) {
|
||||
if (!hitObject->GetIsStatic()) {
|
||||
hitObject->ApplyMoveForce(colPoint.m_vecNormal * -7.5f);
|
||||
}
|
||||
}
|
||||
|
|
@ -205,9 +205,9 @@ void CBulletInfo::Update() {
|
|||
}
|
||||
case ENTITY_TYPE_BUILDING: {
|
||||
// std::cout << "Hit building\n";
|
||||
if (info.m_pCreator && info.m_pCreator->IsPed()) {
|
||||
if (info.m_pCreator && info.m_pCreator->GetIsTypePed()) {
|
||||
if (auto playerData = info.m_pCreator->AsPed()->m_pPlayerData) {
|
||||
playerData->m_nModelIndexOfLastBuildingShot = hitEntity->m_nModelIndex;
|
||||
playerData->m_nModelIndexOfLastBuildingShot = hitEntity->GetModelIndex();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ bool cBuoyancy::ProcessBuoyancy(CPhysical* entity, float fBuoyancy, CVector* vec
|
|||
|
||||
m_EntityMatrix = *entity->m_matrix;
|
||||
PreCalcSetup(entity, fBuoyancy);
|
||||
if (entity->IsPed()) {
|
||||
if (entity->GetIsTypePed()) {
|
||||
entity->GetColModel(); // for some reason, this is here?
|
||||
|
||||
m_bInWater = true;
|
||||
|
|
@ -92,7 +92,7 @@ bool cBuoyancy::ProcessBuoyancyBoat(CVehicle* vehicle, float fBuoyancy, CVector*
|
|||
vecWaveNormal.z += 2.0F;
|
||||
vecWaveNormal *= fThird;
|
||||
|
||||
switch (vehicle->m_nModelIndex) {
|
||||
switch (vehicle->GetModelIndex()) {
|
||||
case MODEL_SQUALO:
|
||||
case MODEL_SPEEDER:
|
||||
case MODEL_JETMAX:
|
||||
|
|
@ -167,13 +167,13 @@ bool cBuoyancy::CalcBuoyancyForce(CPhysical* entity, CVector* vecBuoyancyTurnPoi
|
|||
void cBuoyancy::PreCalcSetup(CPhysical* entity, float fBuoyancy)
|
||||
{
|
||||
CVehicle* vehicle = entity->AsVehicle();
|
||||
m_bProcessingBoat = entity->IsVehicle() && vehicle->IsBoat();
|
||||
m_bProcessingBoat = entity->GetIsTypeVehicle() && vehicle->IsBoat();
|
||||
auto cm = entity->GetColModel();
|
||||
m_vecBoundingMin = cm->m_boundBox.m_vecMin;
|
||||
m_vecBoundingMax = cm->m_boundBox.m_vecMax;
|
||||
|
||||
if (!m_bProcessingBoat) {
|
||||
switch (entity->m_nModelIndex) {
|
||||
switch (entity->GetModelIndex()) {
|
||||
case MODEL_LEVIATHN: //417
|
||||
m_vecBoundingMin.y *= 0.4F;
|
||||
m_vecBoundingMax.y *= 1.15F;
|
||||
|
|
@ -186,7 +186,7 @@ void cBuoyancy::PreCalcSetup(CPhysical* entity, float fBuoyancy)
|
|||
m_vecBoundingMax.y *= 1.4F;
|
||||
break;
|
||||
default:
|
||||
if (entity->IsVehicle() && vehicle->IsSubHeli()) {
|
||||
if (entity->GetIsTypeVehicle() && vehicle->IsSubHeli()) {
|
||||
m_vecBoundingMin.y = -m_vecBoundingMax.y;
|
||||
m_vecBoundingMax.z = m_vecBoundingMin.z * -1.1F;
|
||||
m_vecBoundingMin.z *= 0.85F;
|
||||
|
|
@ -195,7 +195,7 @@ void cBuoyancy::PreCalcSetup(CPhysical* entity, float fBuoyancy)
|
|||
}
|
||||
}
|
||||
else {
|
||||
switch (entity->m_nModelIndex) {
|
||||
switch (entity->GetModelIndex()) {
|
||||
case MODEL_SQUALO: //446
|
||||
m_vecBoundingMax.y *= 0.9F;
|
||||
m_vecBoundingMin.y *= 0.9F;
|
||||
|
|
@ -291,7 +291,7 @@ void cBuoyancy::AddSplashParticles(CPhysical* entity, CVector vecFrom, CVector v
|
|||
auto vecCurPoint = Lerp(vecFrom, vecTo, fCurrentProgress);
|
||||
auto vecTransformedPoint = entity->m_matrix->TransformPoint(vecCurPoint);
|
||||
|
||||
if (!entity->IsPed()) {
|
||||
if (!entity->GetIsTypePed()) {
|
||||
const auto& vecEntPos = entity->GetPosition();
|
||||
vecSplashDir = vecTransformedPoint - vecEntPos;
|
||||
}
|
||||
|
|
@ -304,7 +304,7 @@ void cBuoyancy::AddSplashParticles(CPhysical* entity, CVector vecFrom, CVector v
|
|||
g_fx.m_WaterSplash->AddParticle(&vecTransformedPoint, &vecVelocity, 0.0F, &curParticle, -1.0F, 1.2F, 0.6F, 0);
|
||||
}
|
||||
|
||||
if (entity->IsPed()) {
|
||||
if (entity->GetIsTypePed()) {
|
||||
auto ped = entity->AsPed();
|
||||
auto swimTask = ped->GetIntelligence()->GetTaskSwim();
|
||||
if (!swimTask) {
|
||||
|
|
|
|||
|
|
@ -339,7 +339,7 @@ bool CCam::Using3rdPersonMouseCam() const {
|
|||
|
||||
// 0x509DC0
|
||||
bool CCam::GetWeaponFirstPersonOn() {
|
||||
return m_pCamTargetEntity && m_pCamTargetEntity->IsPed() && m_pCamTargetEntity->AsPed()->GetActiveWeapon().m_IsFirstPersonWeaponModeSelected;
|
||||
return m_pCamTargetEntity && m_pCamTargetEntity->GetIsTypePed() && m_pCamTargetEntity->AsPed()->GetActiveWeapon().m_IsFirstPersonWeaponModeSelected;
|
||||
}
|
||||
|
||||
// inlined -- alpha = vertical angle
|
||||
|
|
@ -386,11 +386,11 @@ void CCam::Process_1rstPersonPedOnPC(const CVector& target, float orientation, f
|
|||
m_fFOV = 70.0f;
|
||||
}
|
||||
|
||||
if (!m_pCamTargetEntity->m_pRwObject) {
|
||||
if (!m_pCamTargetEntity->GetRwObject()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_pCamTargetEntity->IsPed()) {
|
||||
if (!m_pCamTargetEntity->GetIsTypePed()) {
|
||||
m_bResetStatics = false;
|
||||
RwCameraSetNearClipPlane(Scene.m_pRwCamera, 0.05f);
|
||||
return;
|
||||
|
|
@ -495,14 +495,14 @@ void CCam::Process_1stPerson(const CVector& target, float orientation, float spe
|
|||
gbFirstPersonRunThisFrame = true;
|
||||
|
||||
m_fFOV = 70.0f;
|
||||
if (!m_pCamTargetEntity->m_pRwObject) {
|
||||
if (!m_pCamTargetEntity->GetRwObject()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_bResetStatics) {
|
||||
m_fVerticalAngle = 0.0f;
|
||||
m_fHorizontalAngle = [&] {
|
||||
if (m_pCamTargetEntity->IsPed()) {
|
||||
if (m_pCamTargetEntity->GetIsTypePed()) {
|
||||
return m_pCamTargetEntity->AsPed()->m_fCurrentRotation + DegreesToRadians(90.0f);
|
||||
} else {
|
||||
return orientation;
|
||||
|
|
@ -514,7 +514,7 @@ void CCam::Process_1stPerson(const CVector& target, float orientation, float spe
|
|||
TheCamera.m_fAvoidTheGeometryProbsTimer = 0.0f;
|
||||
}
|
||||
|
||||
if (m_pCamTargetEntity->IsPed()) {
|
||||
if (m_pCamTargetEntity->GetIsTypePed()) {
|
||||
m_bResetStatics = false;
|
||||
return;
|
||||
}
|
||||
|
|
@ -863,7 +863,7 @@ void CCam::Process_Rocket(const CVector& target, float orientation, float speedV
|
|||
static uint32 dword_B6FFFC = StaticRef<uint32>(0xB6FFFC);
|
||||
static bool byte_B70000 = StaticRef<bool>(0xB70000);
|
||||
|
||||
if (!m_pCamTargetEntity->IsPed()) {
|
||||
if (!m_pCamTargetEntity->GetIsTypePed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -881,7 +881,7 @@ void CCam::Process_Rocket(const CVector& target, float orientation, float speedV
|
|||
dword_B6FFFC = 0;
|
||||
dword_B6FFF8 = 0;
|
||||
}
|
||||
m_pCamTargetEntity->UpdateRW();
|
||||
m_pCamTargetEntity->UpdateRwMatrix();
|
||||
m_pCamTargetEntity->UpdateRwFrame();
|
||||
CVector headPosition{};
|
||||
targetPed->GetTransformedBonePosition(headPosition, eBoneTag::BONE_HEAD, true);
|
||||
|
|
@ -935,10 +935,10 @@ void CCam::Process_Rocket(const CVector& target, float orientation, float speedV
|
|||
if (hsTarget && CTimer::GetTimeInMS() - playerData->m_nLastHSMissileLOSTime > 1'000) {
|
||||
playerData->m_nLastHSMissileLOSTime = CTimer::GetTimeInMS();
|
||||
|
||||
const auto targetUsesCollision = hsTarget->m_bUsesCollision;
|
||||
const auto playerUsesCollision = player->m_bUsesCollision;
|
||||
hsTarget->m_bUsesCollision = false;
|
||||
player->m_bUsesCollision = false;
|
||||
const auto targetUsesCollision = hsTarget->GetUsesCollision();
|
||||
const auto playerUsesCollision = player->GetUsesCollision();
|
||||
hsTarget->SetUsesCollision(false);
|
||||
player->SetUsesCollision(false);
|
||||
|
||||
const auto isClear = CWorld::GetIsLineOfSightClear(
|
||||
player->GetPosition(),
|
||||
|
|
@ -950,8 +950,8 @@ void CCam::Process_Rocket(const CVector& target, float orientation, float speedV
|
|||
false,
|
||||
true
|
||||
);
|
||||
player->m_bUsesCollision = playerUsesCollision;
|
||||
hsTarget->m_bUsesCollision = targetUsesCollision;
|
||||
player->SetUsesCollision(playerUsesCollision);
|
||||
hsTarget->SetUsesCollision(targetUsesCollision);
|
||||
playerData->m_bLastHSMissileLOS = isClear;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -296,13 +296,13 @@ void CCamera::InitialiseCameraForDebugMode() {
|
|||
|
||||
// 0x50A480
|
||||
void CCamera::ApplyVehicleCameraTweaks(CVehicle* vehicle) {
|
||||
if (vehicle->m_nModelIndex == m_nCurrentTweakModelIndex) {
|
||||
if (vehicle->GetModelIndex() == m_nCurrentTweakModelIndex) {
|
||||
return;
|
||||
}
|
||||
|
||||
InitCameraVehicleTweaks();
|
||||
for (auto& camTweak : m_aCamTweak) {
|
||||
if (camTweak.ModelID == (int32)vehicle->m_nModelIndex) { // todo: vehicle->m_nModelIndex -> int16?
|
||||
if (camTweak.ModelID == vehicle->GetModelIndex()) {
|
||||
m_fCurrentTweakDistance = camTweak.Dist;
|
||||
m_fCurrentTweakAltitude = camTweak.Alt;
|
||||
m_fCurrentTweakAngle = camTweak.Angle;
|
||||
|
|
@ -885,7 +885,7 @@ void CCamera::SetZoomValueFollowPedScript(int16 zoomMode) {
|
|||
void CCamera::SetZoomValueCamStringScript(int16 zoomMode) {
|
||||
auto entity = m_aCams[0].m_pCamTargetEntity;
|
||||
|
||||
if (entity->m_nStatus == STATUS_SIMPLE) {
|
||||
if (entity->GetStatus() == STATUS_SIMPLE) {
|
||||
int32 arrPos{};
|
||||
VERIFY(GetArrPosForVehicleType(static_cast<eVehicleType>(entity->AsVehicle()->GetVehicleAppearance()), arrPos));
|
||||
m_fCarZoomValueScript = [zoomMode]{
|
||||
|
|
@ -940,7 +940,7 @@ void CCamera::StoreValuesDuringInterPol(CVector* sourceDuringInter, CVector* tar
|
|||
|
||||
// 0x50C360
|
||||
void CCamera::UpdateTargetEntity() {
|
||||
m_bPlayerWasOnBike = m_pTargetEntity && m_pTargetEntity->IsVehicle() && m_pTargetEntity->AsVehicle()->m_vecMoveSpeed.SquaredMagnitude() > 0.3f;
|
||||
m_bPlayerWasOnBike = m_pTargetEntity && m_pTargetEntity->GetIsTypeVehicle() && m_pTargetEntity->AsVehicle()->m_vecMoveSpeed.SquaredMagnitude() > 0.3f;
|
||||
|
||||
const auto player = FindPlayerPed();
|
||||
assert(player);
|
||||
|
|
@ -1040,7 +1040,7 @@ void CCamera::UpdateTargetEntity() {
|
|||
CEntity::ChangeEntityReference(m_pTargetEntity, player);
|
||||
}
|
||||
|
||||
if (m_pTargetEntity->IsVehicle()) {
|
||||
if (m_pTargetEntity->GetIsTypeVehicle()) {
|
||||
if (m_nCarZoom == 0) {
|
||||
if (player->m_nPedState == PEDSTATE_ARRESTED) {
|
||||
CEntity::ChangeEntityReference(m_pTargetEntity, player);
|
||||
|
|
@ -1063,7 +1063,7 @@ void CCamera::TakeControl(CEntity* target, eCamMode modeToGoTo, eSwitchType swit
|
|||
return {
|
||||
[&, this] {
|
||||
if (modeToGoTo == MODE_NONE) {
|
||||
switch (target->m_nType) {
|
||||
switch (target->GetType()) {
|
||||
case ENTITY_TYPE_PED:
|
||||
return MODE_FOLLOWPED;
|
||||
case ENTITY_TYPE_VEHICLE:
|
||||
|
|
@ -1783,7 +1783,7 @@ void CCamera::StartTransition(eCamMode newCamMode) {
|
|||
m_fFractionInterToStopCatchUp = 0.75f;
|
||||
|
||||
// Handle player rotation for weapon modes
|
||||
if (m_pTargetEntity && m_pTargetEntity->IsPed() && notsa::contains({ MODE_SNIPER, MODE_ROCKETLAUNCHER, MODE_ROCKETLAUNCHER_HS, MODE_M16_1STPERSON, MODE_SNIPER_RUNABOUT, MODE_ROCKETLAUNCHER_RUNABOUT, MODE_ROCKETLAUNCHER_RUNABOUT_HS, MODE_M16_1STPERSON_RUNABOUT, MODE_FIGHT_CAM_RUNABOUT, MODE_HELICANNON_1STPERSON, MODE_CAMERA, MODE_1STPERSON_RUNABOUT }, activeCamMode)) {
|
||||
if (m_pTargetEntity && m_pTargetEntity->GetIsTypePed() && notsa::contains({ MODE_SNIPER, MODE_ROCKETLAUNCHER, MODE_ROCKETLAUNCHER_HS, MODE_M16_1STPERSON, MODE_SNIPER_RUNABOUT, MODE_ROCKETLAUNCHER_RUNABOUT, MODE_ROCKETLAUNCHER_RUNABOUT_HS, MODE_M16_1STPERSON_RUNABOUT, MODE_FIGHT_CAM_RUNABOUT, MODE_HELICANNON_1STPERSON, MODE_CAMERA, MODE_1STPERSON_RUNABOUT }, activeCamMode)) {
|
||||
const float angle = CGeneral::GetATanOfXY(activeCam.m_vecFront.x, activeCam.m_vecFront.y) - HALF_PI;
|
||||
m_pTargetEntity->AsPed()->m_fCurrentRotation = angle;
|
||||
m_pTargetEntity->AsPed()->m_fAimingRotation = angle;
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ void CCarAI::AddPoliceCarOccupants(CVehicle* vehicle, bool bAlwaysCreatePassenge
|
|||
}
|
||||
vehicle->vehicleFlags.bOccupantsHaveBeenGenerated = true;
|
||||
|
||||
switch (vehicle->m_nModelIndex) {
|
||||
switch (vehicle->GetModelIndex()) {
|
||||
case MODEL_ENFORCER:
|
||||
case MODEL_FBIRANCH: {
|
||||
vehicle->SetUpDriver(PED_TYPE_NONE, false, false);
|
||||
|
|
@ -691,7 +691,7 @@ void CCarAI::UpdateCarAI(CVehicle* veh) {
|
|||
|| plyrVeh->GetMoveSpeed().SquaredMagnitude() < maxSpeedSq && veh->m_nCopsInCarTimer > 2500
|
||||
) {
|
||||
if (veh->vehicleFlags.bIsLawEnforcer) { // 0x41DED4 | 0x41E23F
|
||||
if ((veh->GetModelID() != MODEL_RHINO || veh->m_nRandomSeed > 10'000) && vehPlyrDist2DSq <= sq(10.f)) { // 0x41DEE1 | 0x41E254
|
||||
if ((veh->GetModelId() != MODEL_RHINO || veh->m_nRandomSeed > 10'000) && vehPlyrDist2DSq <= sq(10.f)) { // 0x41DEE1 | 0x41E254
|
||||
TellOccupantsToLeaveCar(veh);
|
||||
ap->SetCruiseSpeed(0);
|
||||
ap->SetCarMission(MISSION_NONE);
|
||||
|
|
@ -901,14 +901,14 @@ void CCarAI::UpdateCarAI(CVehicle* veh) {
|
|||
veh->m_nCopsInCarTimer = 0;
|
||||
}
|
||||
|
||||
if ((!plyrVeh || plyrVeh->IsUpsideDown() || veh->m_nCopsInCarTimer >= (veh->GetModelID() == MODEL_COPBIKE ? 2500 : 20'000)) && veh->vehicleFlags.bIsLawEnforcer && vehToPlyrDist2DSq <= sq(10.f)) {
|
||||
if ((!plyrVeh || plyrVeh->IsUpsideDown() || veh->m_nCopsInCarTimer >= (veh->GetModelId() == MODEL_COPBIKE ? 2500 : 20'000)) && veh->vehicleFlags.bIsLawEnforcer && vehToPlyrDist2DSq <= sq(10.f)) {
|
||||
TellOccupantsToLeaveCar(veh);
|
||||
ap->ClearCarMission();
|
||||
ap->SetCruiseSpeed(0);
|
||||
if (FindPlayerWanted()->GetWantedLevel() <= 1) {
|
||||
veh->vehicleFlags.bSirenOrAlarm = false;
|
||||
}
|
||||
} else if (veh->GetModelID() == MODEL_COPBIKE && veh->m_pDriver) {
|
||||
} else if (veh->GetModelId() == MODEL_COPBIKE && veh->m_pDriver) {
|
||||
const auto tUseSeq = notsa::dyn_cast_if_present<CTaskComplexSequence>(veh->m_pDriver->GetTaskManager().GetTaskPrimary(TASK_PRIMARY_PRIMARY));
|
||||
if (!tUseSeq || (!tUseSeq->Contains(TASK_COMPLEX_ENTER_CAR_AS_DRIVER)) && !tUseSeq->Contains(TASK_SIMPLE_GANG_DRIVEBY)) {
|
||||
veh->m_pDriver->GetEventGroup().Add(
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ CVehicle* CCarCtrl::CreateCarForScript(int32 modelid, CVector posn, bool doMissi
|
|||
CTheScripts::ClearSpaceForMissionEntity(posn, boat);
|
||||
boat->vehicleFlags.bEngineOn = false;
|
||||
boat->vehicleFlags.bIsLocked = true;
|
||||
boat->m_nStatus = eEntityStatus::STATUS_ABANDONED;
|
||||
boat->SetStatus(STATUS_ABANDONED);
|
||||
JoinCarWithRoadSystem(boat);
|
||||
|
||||
boat->m_autoPilot.SetCarMission(eCarMission::MISSION_NONE);
|
||||
|
|
@ -245,7 +245,7 @@ CVehicle* CCarCtrl::CreateCarForScript(int32 modelid, CVector posn, bool doMissi
|
|||
|
||||
CTheScripts::ClearSpaceForMissionEntity(posn, vehicle);
|
||||
vehicle->vehicleFlags.bIsLocked = true;
|
||||
vehicle->m_nStatus = eEntityStatus::STATUS_ABANDONED;
|
||||
vehicle->SetStatus(STATUS_ABANDONED);
|
||||
JoinCarWithRoadSystem(vehicle);
|
||||
vehicle->vehicleFlags.bEngineOn = false;
|
||||
vehicle->vehicleFlags.bHasBeenOwnedByPlayer = true;
|
||||
|
|
|
|||
|
|
@ -485,7 +485,7 @@ bool CCarEnterExit::IsClearToDriveAway(const CVehicle* vehicle) {
|
|||
|
||||
// 0x651210
|
||||
bool CCarEnterExit::IsPathToDoorBlockedByVehicleCollisionModel(const CPed* ped, const CVehicle* vehicle, const CVector& pos) {
|
||||
if (vehicle->m_nModelIndex == eModelID::MODEL_AT400) {
|
||||
if (vehicle->GetModelIndex() == eModelID::MODEL_AT400) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -521,7 +521,7 @@ bool CCarEnterExit::IsRoomForPedToLeaveCar(const CVehicle* vehicle, int32 doorId
|
|||
|
||||
// 0x64EEC0
|
||||
bool CCarEnterExit::IsVehicleHealthy(const CVehicle* vehicle) {
|
||||
return vehicle->m_nStatus != STATUS_WRECKED;
|
||||
return vehicle->GetStatus() != STATUS_WRECKED;
|
||||
}
|
||||
|
||||
// 0x6510D0
|
||||
|
|
@ -651,7 +651,7 @@ void CCarEnterExit::QuitEnteringCar(CPed* ped, CVehicle* vehicle, int32 doorId,
|
|||
break;
|
||||
}
|
||||
}
|
||||
ped->m_bUsesCollision = false;
|
||||
ped->SetUsesCollision(false);
|
||||
}
|
||||
|
||||
// 0x64F680
|
||||
|
|
|
|||
|
|
@ -263,13 +263,13 @@ void CCarGenerator::DoInternalProcessing()
|
|||
posn.z = vehicle->GetDistanceFromCentreOfMassToBaseOfModel() + baseZ;
|
||||
vehicle->SetPosn(posn);
|
||||
vehicle->SetOrientation(0.0f, 0.0f, m_nAngle * (TWO_PI / 256));
|
||||
vehicle->m_nStatus = eEntityStatus::STATUS_ABANDONED;
|
||||
vehicle->SetStatus(STATUS_ABANDONED);
|
||||
vehicle->m_nDoorLock = eCarLock::CARLOCK_UNLOCKED;
|
||||
vehicle->vehicleFlags.bHasBeenOwnedByPlayer = bPlayerHasAlreadyOwnedCar;
|
||||
tractorDriverPedType = -1;
|
||||
|
||||
if (!nightTime &&
|
||||
(vehicle->m_nModelIndex == MODEL_TRACTOR || vehicle->m_nModelIndex == MODEL_COMBINE))
|
||||
(vehicle->GetModelIndex() == MODEL_TRACTOR || vehicle->GetModelIndex() == MODEL_COMBINE))
|
||||
{
|
||||
// 0x6F3BF4
|
||||
|
||||
|
|
@ -290,7 +290,7 @@ void CCarGenerator::DoInternalProcessing()
|
|||
vehicle->m_autoPilot.SetCruiseSpeed(7);
|
||||
vehicle->m_autoPilot.SetCarMission(eCarMission::MISSION_CRUISE);
|
||||
vehicle->m_autoPilot.m_startingRouteNode = baseLink;
|
||||
vehicle->m_nStatus = eEntityStatus::STATUS_PHYSICS;
|
||||
vehicle->SetStatus(STATUS_PHYSICS);
|
||||
vehicle->vehicleFlags.bNeverUseSmallerRemovalRange = true;
|
||||
bWaitUntilFarFromPlayer = true;
|
||||
tractorDriverPedType = PED_TYPE_CIVMALE;
|
||||
|
|
@ -370,7 +370,7 @@ void CCarGenerator::Process()
|
|||
auto vehicle = GetVehiclePool()->GetAtRef(m_nVehicleHandle);
|
||||
if (!vehicle)
|
||||
m_nVehicleHandle = -1;
|
||||
else if (vehicle->m_nStatus == eEntityStatus::STATUS_PLAYER)
|
||||
else if (vehicle->GetStatus() == STATUS_PLAYER)
|
||||
{
|
||||
m_nNextGenTime += 60000;
|
||||
m_nVehicleHandle = -1;
|
||||
|
|
|
|||
|
|
@ -700,7 +700,7 @@ void CCheat::TankerCheat() {
|
|||
auto* trailer = new CTrailer(MODEL_PETROTR, RANDOM_VEHICLE);
|
||||
trailer->SetPosn(vehicle->GetPosition());
|
||||
trailer->SetOrientation(0.0f, 0.0f, DegreesToRadians(200));
|
||||
trailer->m_nStatus = STATUS_ABANDONED;
|
||||
trailer->SetStatus(STATUS_ABANDONED);
|
||||
CWorld::Add(trailer);
|
||||
trailer->SetTowLink(vehicle, true);
|
||||
}
|
||||
|
|
@ -708,7 +708,7 @@ void CCheat::TankerCheat() {
|
|||
// 0x43A0B0
|
||||
CVehicle* CCheat::VehicleCheat(eModelID modelId) {
|
||||
const auto player = FindPlayerPed();
|
||||
if (player->m_nAreaCode != AREA_CODE_NORMAL_WORLD) {
|
||||
if (player->GetAreaCode() != AREA_CODE_NORMAL_WORLD) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
@ -739,7 +739,7 @@ CVehicle* CCheat::VehicleCheat(eModelID modelId) {
|
|||
|
||||
vehicle->SetPosn(pos);
|
||||
vehicle->SetOrientation(0.0f, 0.0f, rotZ);
|
||||
vehicle->m_nStatus = STATUS_ABANDONED;
|
||||
vehicle->SetStatus(STATUS_ABANDONED);
|
||||
vehicle->m_nDoorLock = CARLOCK_UNLOCKED;
|
||||
CWorld::Add(vehicle);
|
||||
CTheScripts::ClearSpaceForMissionEntity(pos, vehicle);
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ void CClothes::RebuildPlayer(CPlayerPed* player, bool bIgnoreFatAndMuscle) {
|
|||
player->m_pPlayerData->m_pPedClothesDesc->m_fMuscleStat = CStats::GetStatValue(STAT_MUSCLE);
|
||||
}
|
||||
|
||||
ConstructPedModel(player->m_nModelIndex, *player->m_pPlayerData->m_pPedClothesDesc, &PlayerClothes, 0);
|
||||
ConstructPedModel(player->GetModelIndex(), *player->m_pPlayerData->m_pPedClothesDesc, &PlayerClothes, 0);
|
||||
player->Dress();
|
||||
RpAnimBlendClumpGiveAssociations(player->m_pRwClump, assoc);
|
||||
PlayerClothes = *player->m_pPlayerData->m_pPedClothesDesc;
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ int32 CClouds::MovingFog_GetFirstFreeSlot() {
|
|||
void CClouds::MovingFogRender() {
|
||||
ZoneScoped;
|
||||
|
||||
if (MovingFog_GetFXIntensity() == 0.f || !CGame::CanSeeOutSideFromCurrArea() && FindPlayerPed()->m_nAreaCode != AREA_CODE_NORMAL_WORLD)
|
||||
if (MovingFog_GetFXIntensity() == 0.f || !CGame::CanSeeOutSideFromCurrArea() && FindPlayerPed()->GetAreaCode() != AREA_CODE_NORMAL_WORLD)
|
||||
return;
|
||||
|
||||
// Adjust fog intensity
|
||||
|
|
|
|||
|
|
@ -20,4 +20,5 @@ public:
|
|||
|
||||
VALIDATE_SIZE(CBoundingBox, 0x18);
|
||||
|
||||
static inline int32& numBBFailed = *(int32*)0xB71808;
|
||||
// in entity.cpp
|
||||
static int32 numBBFailed; // 0xB71808
|
||||
|
|
|
|||
|
|
@ -190,20 +190,20 @@ void CColAccel::addIPLEntity(CEntity** ppEntities, int32 entitiesCount, int32 en
|
|||
return;
|
||||
|
||||
auto& entity = ppEntities[entityIndex];
|
||||
auto* entModelInfo = CModelInfo::GetModelInfo(entity->m_nModelIndex);
|
||||
auto* entModelInfo = CModelInfo::GetModelInfo(entity->GetModelIndex());
|
||||
|
||||
CColAccelIPLEntry iplEntry;
|
||||
iplEntry.m_nFlags = 0;
|
||||
iplEntry.m_nEntityIndex = entityIndex;
|
||||
iplEntry.m_nModelId = entity->m_nModelIndex;
|
||||
iplEntry.m_nLodModelId = entity->m_pLod->m_nModelIndex;
|
||||
iplEntry.m_nModelId = entity->GetModelIndex();
|
||||
iplEntry.m_nLodModelId = entity->GetLod()->GetModelIndex();
|
||||
iplEntry.m_nLodIndex = -1;
|
||||
|
||||
if (entity->m_nNumLodChildren || TheCamera.m_fLODDistMultiplier * entModelInfo->m_fDrawDistance > 300.0F)
|
||||
if (entity->GetNumLodChildren() || TheCamera.m_fLODDistMultiplier * entModelInfo->m_fDrawDistance > 300.0F)
|
||||
iplEntry.m_bIsFarDrawDist = true;
|
||||
|
||||
for (auto i = 0; i < entitiesCount; ++i) {
|
||||
if (ppEntities[i] != entity->m_pLod)
|
||||
if (ppEntities[i] != entity->GetLod())
|
||||
continue;
|
||||
|
||||
iplEntry.m_nLodIndex = i;
|
||||
|
|
@ -211,7 +211,7 @@ void CColAccel::addIPLEntity(CEntity** ppEntities, int32 entitiesCount, int32 en
|
|||
}
|
||||
|
||||
auto* lodModelInfo = CModelInfo::GetModelInfo(iplEntry.m_nLodModelId);
|
||||
if (entity->m_pLod->m_nNumLodChildren == 1) {
|
||||
if (entity->GetLod()->GetNumLodChildren() == 1) {
|
||||
if (entity->m_bUnderwater)
|
||||
iplEntry.m_bIsUnderwater = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ void CColStore::EnsureCollisionIsInMemory(const CVector& pos)
|
|||
return;
|
||||
|
||||
auto* player = FindPlayerPed();
|
||||
const auto area = player ? player->m_nAreaCode : CGame::currArea;
|
||||
const auto area = player ? player->GetAreaCode() : CGame::currArea;
|
||||
if (area != CGame::currArea)
|
||||
return;
|
||||
|
||||
|
|
@ -312,7 +312,7 @@ void CColStore::LoadCollision(CVector pos, bool bIgnorePlayerVeh)
|
|||
if (obj.type == MissionCleanUpEntityType::MISSION_CLEANUP_ENTITY_TYPE_VEHICLE)
|
||||
{
|
||||
entity = GetVehiclePool()->GetAtRef(obj.handle);
|
||||
if (!entity || entity->m_nStatus == eEntityStatus::STATUS_WRECKED)
|
||||
if (!entity || entity->GetStatus() == STATUS_WRECKED)
|
||||
continue;
|
||||
}
|
||||
else if (obj.type == MissionCleanUpEntityType::MISSION_CLEANUP_ENTITY_TYPE_PED)
|
||||
|
|
@ -325,7 +325,7 @@ void CColStore::LoadCollision(CVector pos, bool bIgnorePlayerVeh)
|
|||
if (!entity || entity->AsPhysical()->physicalFlags.b15 || entity->AsPhysical()->physicalFlags.bDontApplySpeed)
|
||||
continue;
|
||||
|
||||
ms_nRequiredCollisionArea = entity->m_nAreaCode;
|
||||
ms_nRequiredCollisionArea = entity->GetAreaCode();
|
||||
ms_pQuadTree->ForAllMatching(entity->GetPosition(), SetIfCollisionIsRequiredReducedBB);
|
||||
}
|
||||
|
||||
|
|
@ -422,7 +422,7 @@ void CColStore::SetCollisionRequired(const CVector& pos, int32 areaCode)
|
|||
auto usedArea = areaCode;
|
||||
if (areaCode == -1) {
|
||||
auto* player = FindPlayerPed();
|
||||
usedArea = player ? player->m_nAreaCode : CGame::currArea;
|
||||
usedArea = player ? player->GetAreaCode() : CGame::currArea;
|
||||
}
|
||||
|
||||
ms_nRequiredCollisionArea = usedArea;
|
||||
|
|
|
|||
|
|
@ -2410,7 +2410,7 @@ bool CCollision::CheckCameraCollisionPeds(
|
|||
|
||||
ped->SetCurrentScanCode();
|
||||
|
||||
if (!ped->m_bIsVisible || CWorld::pIgnoreEntity == ped || ped->IsPlayer()) {
|
||||
if (!ped->GetIsVisible() || CWorld::pIgnoreEntity == ped || ped->IsPlayer()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -2423,7 +2423,7 @@ bool CCollision::CheckCameraCollisionPeds(
|
|||
}
|
||||
|
||||
const auto AddInvisibleEntity = [](CEntity* entity) {
|
||||
entity->m_bIsVisible = false;
|
||||
entity->SetIsVisible(false);
|
||||
|
||||
auto& ref = gpMadeInvisibleEntities[gNumEntitiesSetInvisible++];
|
||||
ref = entity;
|
||||
|
|
@ -2435,7 +2435,7 @@ bool CCollision::CheckCameraCollisionPeds(
|
|||
// Add entity the peds holds too (if any)
|
||||
if (const auto task = ped->GetIntelligence()->GetTaskHold()) {
|
||||
if (const auto ent = task->m_pEntityToHold) {
|
||||
if (ent->m_bIsVisible) {
|
||||
if (ent->GetIsVisible()) {
|
||||
AddInvisibleEntity(ent);
|
||||
}
|
||||
}
|
||||
|
|
@ -2452,7 +2452,7 @@ void ResetMadeInvisibleObjects() {
|
|||
if (!ent) { // Must check, as the reference system might've cleared it
|
||||
continue;
|
||||
}
|
||||
ent->m_bIsVisible = true;
|
||||
ent->SetIsVisible(true);
|
||||
CEntity::CleanUpOldReference(ent);
|
||||
}
|
||||
gNumEntitiesSetInvisible = 0;
|
||||
|
|
@ -2774,7 +2774,7 @@ bool CCollision::SphereCastVsEntity(
|
|||
) {
|
||||
ZoneScoped;
|
||||
|
||||
if (!entity->m_bUsesCollision || TheCamera.IsExtraEntityToIgnore(entity)) {
|
||||
if (!entity->GetUsesCollision() || TheCamera.IsExtraEntityToIgnore(entity)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -313,7 +313,7 @@ bool CCover::FindCoordinatesCoverPoint(const CCoverPoint& cpt, CPed* ped, const
|
|||
|
||||
// 0x699120
|
||||
void CCover::FindCoverPointsForThisBuilding(CBuilding* building) {
|
||||
auto* mi = CModelInfo::GetModelInfo(building->m_nModelIndex);
|
||||
auto* mi = CModelInfo::GetModelInfo(building->GetModelIndex());
|
||||
for (int32 i = 0; i < mi->m_n2dfxCount; ++i) {
|
||||
if (auto* const fx = notsa::dyn_cast<C2dEffectCoverPoint>(mi->Get2dEffect(i))) {
|
||||
const auto dir = building->GetMatrix().TransformVector(CVector{fx->m_DirOfCover, 0.f});
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ CCoverPoint::CCoverPoint(eType type, eUsage usage, Dir dir, CEntity* coverEntity
|
|||
m_PointOnMap = *pos;
|
||||
}
|
||||
if (coverEntity) {
|
||||
if (!coverEntity->IsBuilding() || coverEntity->m_nIplIndex != 0) {
|
||||
if (!coverEntity->GetIsTypeBuilding() || coverEntity->GetIplIndex() != 0) {
|
||||
m_CoverEntity = coverEntity;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,10 +37,10 @@ void CCrime::ReportCrime(eCrimeType crimeType, CEntity* pVictim, CPed* pCommited
|
|||
}
|
||||
|
||||
// TODO: repair that.
|
||||
const bool isPedCriminal = pVictim && pVictim->IsPed() && CPedType::PoliceDontCareAboutCrimesAgainstPedType(pVictim->AsPed()->m_nPedType);
|
||||
const bool isPedCriminal = pVictim && pVictim->GetIsTypePed() && CPedType::PoliceDontCareAboutCrimesAgainstPedType(pVictim->AsPed()->m_nPedType);
|
||||
if (crimeType == CRIME_DAMAGED_PED
|
||||
&& pVictim
|
||||
&& pVictim->IsPed()
|
||||
&& pVictim->GetIsTypePed()
|
||||
&& IsPedPointerValid(pVictim->AsPed())
|
||||
&& !pCommitedby->AsPlayer()->GetWantedLevel()
|
||||
&& pVictim->AsPed()->bBeingChasedByPolice // Vanilla bug here
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ void CCutsceneMgr::DeleteCutsceneData_overlay() {
|
|||
for (auto& e : ms_pHiddenEntities | rngv::take(ms_iNumHiddenEntities)) {
|
||||
if (e) {
|
||||
CEntity::CleanUpOldReference(e);
|
||||
e->m_bIsVisible = true;
|
||||
e->SetIsVisible(true);
|
||||
}
|
||||
}
|
||||
ms_iNumHiddenEntities = 0;
|
||||
|
|
@ -209,7 +209,7 @@ void CCutsceneMgr::DeleteCutsceneData_overlay() {
|
|||
|
||||
const auto player = FindPlayerPed();
|
||||
const auto pad = CPad::GetPad(0);
|
||||
player->m_bIsVisible = true;
|
||||
player->SetIsVisible(true);
|
||||
pad->bPlayerSafeForCutscene = false;
|
||||
pad->Clear(false, false); // moved up here
|
||||
player->GetPlayerInfoForThisPlayerPed()->MakePlayerSafe(0, 10000.0);
|
||||
|
|
@ -255,7 +255,7 @@ void CCutsceneMgr::FinishCutscene() {
|
|||
ms_cutsceneTimerS = TheCamera.GetCutSceneFinishTime() / 1000.f;
|
||||
TheCamera.FinishCutscene();
|
||||
}
|
||||
FindPlayerPed()->m_bIsVisible = true;
|
||||
FindPlayerPed()->SetIsVisible(true);
|
||||
FindPlayerInfo().MakePlayerSafe(false, 10000.f);
|
||||
}
|
||||
|
||||
|
|
@ -286,10 +286,10 @@ void CCutsceneMgr::HideRequestedObjects() {
|
|||
CEntity* objInRng[32];
|
||||
CWorld::FindObjectsOfTypeInRange(modelId, cr.m_vecPosn, 1.5f, true, &nObjInRng, (int16)std::size(objInRng), objInRng, true, false, false, true, true);
|
||||
for (auto e : objInRng | rngv::take((size_t)nObjInRng)) {
|
||||
if (!e->m_bIsVisible) {
|
||||
if (!e->GetIsVisible()) {
|
||||
continue;
|
||||
}
|
||||
e->m_bIsVisible = false;
|
||||
e->SetIsVisible(false);
|
||||
CEntity::SetEntityReference(ms_pHiddenEntities[ms_iNumHiddenEntities++], e);
|
||||
}
|
||||
}
|
||||
|
|
@ -780,7 +780,7 @@ void CCutsceneMgr::LoadCutsceneData_preload() {
|
|||
|
||||
FindPlayerWanted()->ClearQdCrimes();
|
||||
auto player = FindPlayerPed();
|
||||
player->m_bIsVisible = false;
|
||||
player->SetIsVisible(false);
|
||||
player->ResetSprintEnergy();
|
||||
CPad::GetPad()->bPlayerSafeForCutscene = true;
|
||||
FindPlayerInfo().MakePlayerSafe(true, 10000.f);
|
||||
|
|
@ -943,7 +943,7 @@ void CCutsceneMgr::SetupCutsceneToStart() {
|
|||
|
||||
// Add it to the world and update skinning
|
||||
CWorld::Add(csobj);
|
||||
if (RwObjectGetType(csobj->m_pRwObject) == rpCLUMP) {
|
||||
if (RwObjectGetType(csobj->GetRwObject()) == rpCLUMP) {
|
||||
csobj->UpdateRpHAnim();
|
||||
}
|
||||
}
|
||||
|
|
@ -1061,8 +1061,8 @@ void CCutsceneMgr::Update_overlay() {
|
|||
|
||||
// Update cutscene specific model bounding boxes
|
||||
for (const auto csobj : ms_pCutsceneObjects | rngv::take(ms_numCutsceneObjs)) {
|
||||
if (IsModelIDForCutScene(csobj->GetModelID())) {
|
||||
UpdateCutsceneObjectBoundingBox(csobj->m_pRwClump, csobj->GetModelID());
|
||||
if (IsModelIDForCutScene(csobj->GetModelId())) {
|
||||
UpdateCutsceneObjectBoundingBox(csobj->m_pRwClump, csobj->GetModelId());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ bool CDarkel::ThisPedShouldBeKilledForFrenzy(const CPed& ped) {
|
|||
if (!FrenzyOnGoing())
|
||||
return false;
|
||||
|
||||
if (ModelToKill[3] == MODELTK_ANY_PED || rng::find(ModelToKill, ped.m_nModelIndex) != ModelToKill.end()) {
|
||||
if (ModelToKill[3] == MODELTK_ANY_PED || rng::find(ModelToKill, ped.GetModelIndex()) != ModelToKill.end()) {
|
||||
return !ped.IsPlayer();
|
||||
}
|
||||
|
||||
|
|
@ -143,7 +143,7 @@ bool CDarkel::ThisVehicleShouldBeKilledForFrenzy(const CVehicle& vehicle) {
|
|||
if (!FrenzyOnGoing())
|
||||
return false;
|
||||
|
||||
if (ModelToKill[3] == MODELTK_ANY_VEHICLE || rng::find(ModelToKill, vehicle.m_nModelIndex) != ModelToKill.end())
|
||||
if (ModelToKill[3] == MODELTK_ANY_VEHICLE || rng::find(ModelToKill, vehicle.GetModelIndex()) != ModelToKill.end())
|
||||
return true;
|
||||
|
||||
return ModelToKill[3] == MODELTK_ANY_BIKE && vehicle.IsSubBike();
|
||||
|
|
@ -505,7 +505,7 @@ void CDarkel::RegisterKillByPlayer(const CPed& killedPed, eWeaponType damageWeap
|
|||
}
|
||||
}
|
||||
|
||||
RegisteredKills[killedPed.m_nModelIndex][playerId]++;
|
||||
RegisteredKills[killedPed.GetModelIndex()][playerId]++;
|
||||
CStats::IncrementStat(STAT_PEOPLE_YOUVE_WASTED);
|
||||
CStats::PedsKilledOfThisType[killedPed.bChrisCriminal ? PED_TYPE_CRIMINAL : killedPed.m_nPedType]++;
|
||||
|
||||
|
|
@ -529,7 +529,7 @@ void CDarkel::RegisterCarBlownUpByPlayer(CVehicle& vehicle, int32 playerId) {
|
|||
KillsNeeded--;
|
||||
AudioEngine.ReportFrontendAudioEvent(AE_FRONTEND_PART_MISSION_COMPLETE);
|
||||
}
|
||||
RegisteredKills[vehicle.m_nModelIndex][playerId]++;
|
||||
RegisteredKills[vehicle.GetModelIndex()][playerId]++;
|
||||
|
||||
switch (vehicle.GetVehicleAppearance()) {
|
||||
case VEHICLE_APPEARANCE_AUTOMOBILE:
|
||||
|
|
@ -548,7 +548,7 @@ void CDarkel::RegisterCarBlownUpByPlayer(CVehicle& vehicle, int32 playerId) {
|
|||
}
|
||||
|
||||
if (FrenzyOnGoing()) {
|
||||
if (vehicle.m_nModelIndex == MODEL_RHINO) {
|
||||
if (vehicle.GetModelIndex() == MODEL_RHINO) {
|
||||
CStats::IncrementStat(STAT_HIGHEST_NUMBER_OF_TANKS_DESTROYED_ON_RAMPAGE);
|
||||
} else if (vehicle.IsLawEnforcementVehicle()) {
|
||||
CStats::IncrementStat(STAT_HIGHEST_POLICE_VEHICLES_DESTROYED_ON_RAMPAGE);
|
||||
|
|
|
|||
|
|
@ -19,16 +19,16 @@ void CAnimatedBuilding::ProcessControl()
|
|||
// 0x537A40
|
||||
void CAnimatedBuilding::ProcessCollision()
|
||||
{
|
||||
m_bIsInSafePosition = true;
|
||||
SetIsInSafePosition(true);
|
||||
}
|
||||
|
||||
// 0x403F00
|
||||
void CAnimatedBuilding::PreRender()
|
||||
{
|
||||
if (!m_pRwObject)
|
||||
if (!GetRwObject())
|
||||
return;
|
||||
|
||||
CEntity::PreRender();
|
||||
CEntity::UpdateRwFrame();
|
||||
CEntity::UpdateRpHAnim();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
#include "Building.h"
|
||||
|
||||
int32& gBuildings = *(int32*)0xB71804;
|
||||
|
||||
void CBuilding::InjectHooks()
|
||||
{
|
||||
RH_ScopedVirtualClass(CBuilding, 0x8585C8, 22);
|
||||
|
|
@ -15,8 +13,8 @@ void CBuilding::InjectHooks()
|
|||
|
||||
CBuilding::CBuilding() : CEntity()
|
||||
{
|
||||
m_nType = ENTITY_TYPE_BUILDING;
|
||||
m_bUsesCollision = true;
|
||||
SetTypeBuilding();
|
||||
SetUsesCollision(true);
|
||||
}
|
||||
|
||||
void* CBuilding::operator new(unsigned size)
|
||||
|
|
@ -32,8 +30,8 @@ void CBuilding::operator delete(void* data)
|
|||
void CBuilding::ReplaceWithNewModel(int32 newModelIndex)
|
||||
{
|
||||
DeleteRwObject();
|
||||
if (!CModelInfo::GetModelInfo(m_nModelIndex)->m_nRefCount)
|
||||
CStreaming::RemoveModel(m_nModelIndex);
|
||||
if (!CModelInfo::GetModelInfo(GetModelIndex())->m_nRefCount)
|
||||
CStreaming::RemoveModel(GetModelIndex());
|
||||
|
||||
m_nModelIndex = newModelIndex;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,4 +24,6 @@ VALIDATE_SIZE(CBuilding, 0x38);
|
|||
|
||||
bool IsBuildingPointerValid(CBuilding* building);
|
||||
|
||||
extern int32& gBuildings;
|
||||
// in entity.cpp
|
||||
static int32 gBuildings; // 0xB71804
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ void CDummy::operator delete(void* obj) {
|
|||
|
||||
// 0x532540
|
||||
CDummy::CDummy() : CEntity() {
|
||||
m_nType = ENTITY_TYPE_DUMMY;
|
||||
SetTypeDummy();
|
||||
}
|
||||
|
||||
bool IsDummyPointerValid(CDummy* dummy) {
|
||||
|
|
|
|||
|
|
@ -18,14 +18,14 @@ CDummyObject::CDummyObject() : CDummy() {
|
|||
|
||||
// 0x59EA20
|
||||
CDummyObject::CDummyObject(CObject* obj) : CDummy() {
|
||||
CEntity::SetModelIndexNoCreate(m_nModelIndex);
|
||||
if (obj->m_pRwObject)
|
||||
CEntity::AttachToRwObject(obj->m_pRwObject, true);
|
||||
CEntity::SetModelIndexNoCreate(GetModelIndex());
|
||||
if (obj->GetRwObject())
|
||||
CEntity::AttachToRwObject(obj->GetRwObject(), true);
|
||||
|
||||
obj->DetachFromRwObject();
|
||||
m_nIplIndex = obj->m_nIplIndex;
|
||||
m_nAreaCode = obj->m_nAreaCode;
|
||||
CIplStore::IncludeEntity(m_nIplIndex, this);
|
||||
SetIplIndex(obj->GetIplIndex());
|
||||
SetAreaCode(obj->GetAreaCode());
|
||||
CIplStore::IncludeEntity(GetIplIndex(), this);
|
||||
}
|
||||
|
||||
// 0x59EAC0
|
||||
|
|
@ -36,11 +36,11 @@ CObject* CDummyObject::CreateObject() {
|
|||
|
||||
if (obj) {
|
||||
CTheScripts::ScriptsForBrains.CheckIfNewEntityNeedsScript(obj, 1, nullptr);
|
||||
m_bIsVisible = false;
|
||||
m_bUsesCollision = false;
|
||||
SetIsVisible(false);
|
||||
SetUsesCollision(false);
|
||||
|
||||
obj->m_nLodIndex = m_nLodIndex;
|
||||
m_nLodIndex = 0;
|
||||
obj->SetLod(GetLod());
|
||||
SetLod(nullptr);
|
||||
}
|
||||
|
||||
return obj;
|
||||
|
|
@ -48,21 +48,21 @@ CObject* CDummyObject::CreateObject() {
|
|||
|
||||
// 0x59EB70
|
||||
void CDummyObject::UpdateFromObject(CObject* obj) {
|
||||
m_bIsVisible = true;
|
||||
m_bUsesCollision = true;
|
||||
SetIsVisible(true);
|
||||
SetUsesCollision(true);
|
||||
|
||||
obj->m_bImBeingRendered = true;
|
||||
CEntity::AttachToRwObject(obj->m_pRwObject, false);
|
||||
CEntity::AttachToRwObject(obj->GetRwObject(), false);
|
||||
obj->m_bImBeingRendered = false;
|
||||
CEntity::UpdateRW();
|
||||
CEntity::UpdateRwMatrix();
|
||||
obj->DetachFromRwObject();
|
||||
|
||||
if (obj->m_nIplIndex && CIplStore::HasDynamicStreamingDisabled(obj->m_nIplIndex)) {
|
||||
if (obj->GetIplIndex() && CIplStore::HasDynamicStreamingDisabled(obj->GetIplIndex())) {
|
||||
m_bRenderDamaged = obj->m_bRenderDamaged;
|
||||
m_bIsVisible = obj->m_bIsVisible;
|
||||
m_bUsesCollision = obj->m_bUsesCollision;
|
||||
SetIsVisible(obj->GetIsVisible());
|
||||
SetUsesCollision(obj->GetUsesCollision());
|
||||
}
|
||||
|
||||
m_nLodIndex = obj->m_nLodIndex;
|
||||
obj->m_nLodIndex = 0;
|
||||
SetLod(obj->GetLod());
|
||||
obj->SetLod(nullptr);
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -37,11 +37,17 @@ class CBaseModelInfo;
|
|||
|
||||
class NOTSA_EXPORT_VTABLE CEntity : public CPlaceable {
|
||||
public:
|
||||
struct CEntityInfo {
|
||||
eEntityType m_nType : 3; // Mask: & 0x7 = 7
|
||||
eEntityStatus m_nStatus : 5; // Mask: & 0xF8 = 248 (Remember: In the original code unless this was left shifted the value it's compared to has to be left shifted by 3!)
|
||||
};
|
||||
|
||||
union {
|
||||
struct RwObject* m_pRwObject;
|
||||
struct RpClump* m_pRwClump;
|
||||
struct RpAtomic* m_pRwAtomic;
|
||||
};
|
||||
|
||||
union {
|
||||
struct {
|
||||
/* https://github.com/multitheftauto/mtasa-blue/blob/master/Client/game_sa/CEntitySA.h */
|
||||
|
|
@ -81,126 +87,221 @@ public:
|
|||
bool m_bTunnel : 1; // Is this model part of a tunnel
|
||||
bool m_bTunnelTransition : 1; // This model should be rendered from within and outside the tunnel
|
||||
};
|
||||
|
||||
uint32 m_nFlags;
|
||||
};
|
||||
/* */
|
||||
|
||||
union {
|
||||
struct {
|
||||
uint16 m_nRandomSeedUpperByte : 8;
|
||||
uint16 m_nRandomSeedSecondByte : 8;
|
||||
};
|
||||
|
||||
uint16 m_nRandomSeed;
|
||||
};
|
||||
uint16 m_nModelIndex;
|
||||
CReference* m_pReferences;
|
||||
|
||||
uint16 m_nModelIndex;
|
||||
|
||||
CReference* m_pReferences;
|
||||
|
||||
protected:
|
||||
CLink<CEntity*>* m_pStreamingLink;
|
||||
uint16 m_nScanCode;
|
||||
uint8 m_nIplIndex;
|
||||
eAreaCodes m_nAreaCode;
|
||||
|
||||
uint16 m_ScanCode;
|
||||
uint8 m_IplIndex;
|
||||
eAreaCodes m_AreaCode;
|
||||
|
||||
union {
|
||||
int32 m_nLodIndex; // -1 - without LOD model
|
||||
CEntity* m_pLod;
|
||||
};
|
||||
int8 m_nNumLodChildren;
|
||||
uint8 m_nNumLodChildrenRendered;
|
||||
eEntityType m_nType : 3; // Mask: & 0x7 = 7
|
||||
eEntityStatus m_nStatus : 5; // Mask: & 0xF8 = 248 (Remember: In the original code unless this was left shifted the value it's compared to has to be left shifted by 3!)
|
||||
|
||||
uint8 m_NumLodChildren;
|
||||
|
||||
int8 m_NumLodChildrenRendered;
|
||||
|
||||
CEntityInfo m_info;
|
||||
|
||||
public:
|
||||
CEntity();
|
||||
~CEntity() override;
|
||||
|
||||
virtual void Add(); // VTab: 2, similar to previous, but with entity bound rect
|
||||
virtual void Add(const CRect& rect); // VTab: 1
|
||||
virtual void Remove(); // VTab: 3
|
||||
virtual void SetIsStatic(bool isStatic); // VTab: 4
|
||||
virtual void SetModelIndex(uint32 index); // VTab: 5
|
||||
virtual void SetModelIndexNoCreate(uint32 index); // VTab: 6
|
||||
virtual void CreateRwObject(); // VTab: 7
|
||||
virtual void DeleteRwObject(); // VTab: 8
|
||||
virtual CRect GetBoundRect(); // VTab: 9
|
||||
virtual void ProcessControl(); // VTab: 10
|
||||
virtual void ProcessCollision(); // VTab: 11
|
||||
virtual void ProcessShift(); // VTab: 12
|
||||
virtual bool TestCollision(bool bApplySpeed); // VTab: 13
|
||||
virtual void Teleport(CVector destination, bool resetRotation); // VTab: 14
|
||||
virtual void SpecialEntityPreCollisionStuff(CPhysical* colPhysical,
|
||||
bool bIgnoreStuckCheck,
|
||||
bool& bCollisionDisabled,
|
||||
bool& bCollidedEntityCollisionIgnored,
|
||||
bool& bCollidedEntityUnableToMove,
|
||||
bool& bThisOrCollidedEntityStuck); // VTab: 15
|
||||
virtual uint8 SpecialEntityCalcCollisionSteps(bool& bProcessCollisionBeforeSettingTimeStep, bool& unk2); // VTab: 16
|
||||
virtual void PreRender(); // VTab: 17
|
||||
virtual void Render(); // VTab: 18
|
||||
virtual bool SetupLighting(); // VTab: 19
|
||||
virtual void RemoveLighting(bool bRemove); // VTab: 20
|
||||
virtual void FlagToDestroyWhenNextProcessed(); // VTab: 21
|
||||
virtual void Add();
|
||||
virtual void Add(const CRect& rect);
|
||||
virtual void Remove();
|
||||
|
||||
void SetTypeBuilding() { SetType(ENTITY_TYPE_BUILDING); }
|
||||
void SetTypeVehicle() { SetType(ENTITY_TYPE_VEHICLE); }
|
||||
void SetTypePed() { SetType(ENTITY_TYPE_PED); }
|
||||
void SetTypeObject() { SetType(ENTITY_TYPE_OBJECT); }
|
||||
void SetTypeDummy() { SetType(ENTITY_TYPE_DUMMY); }
|
||||
|
||||
[[nodiscard]] bool GetIsTypeBuilding() const { return GetType() == ENTITY_TYPE_BUILDING; }
|
||||
[[nodiscard]] bool GetIsTypeVehicle() const { return GetType() == ENTITY_TYPE_VEHICLE; }
|
||||
[[nodiscard]] bool GetIsTypePed() const { return GetType() == ENTITY_TYPE_PED; }
|
||||
[[nodiscard]] bool GetIsTypeObject() const { return GetType() == ENTITY_TYPE_OBJECT; }
|
||||
[[nodiscard]] bool GetIsTypeDummy() const { return GetType() == ENTITY_TYPE_DUMMY; }
|
||||
[[nodiscard]] bool GetIsTypePhysical() const { return GetType() > ENTITY_TYPE_BUILDING && GetType() < ENTITY_TYPE_DUMMY; } // 0x4DA030, orig GetIsPhysical
|
||||
|
||||
void SetType(eEntityType type) { m_info.m_nType = type; }
|
||||
[[nodiscard]] auto GetType() const noexcept { return m_info.m_nType; }
|
||||
|
||||
void SetStatus(eEntityStatus status) { m_info.m_nStatus = status; }
|
||||
[[nodiscard]] auto GetStatus() const noexcept { return m_info.m_nStatus; }
|
||||
|
||||
// 0x541F70
|
||||
bool TreatAsPlayerForCollisions() {
|
||||
return GetStatus() == STATUS_PLAYER;
|
||||
}
|
||||
|
||||
void SetUsesCollision(bool usesCollision) { m_bUsesCollision = usesCollision; }
|
||||
bool GetUsesCollision() const { return m_bUsesCollision; }
|
||||
void SetCollisionProcessed(bool collisionProcessed) { m_bCollisionProcessed = collisionProcessed; }
|
||||
bool GetCollisionProcessed() const { return m_bCollisionProcessed; } // unused
|
||||
virtual void SetIsStatic(bool isStatic) { m_bIsStatic = isStatic; } // 0x403E20
|
||||
bool GetIsStatic() const { return m_bIsStatic || m_bIsStaticWaitingForCollision; } // 0x4633E0
|
||||
void SetHasContacted(bool hasContacted) { m_bHasContacted = hasContacted; }
|
||||
bool GetHasContacted() const { return m_bHasContacted; }
|
||||
void SetIsStuck(bool isStuck) { m_bIsStuck = isStuck; }
|
||||
bool GetIsStuck() const { return m_bIsStuck; }
|
||||
void SetIsInSafePosition(bool isInSafePosition) { m_bIsInSafePosition = isInSafePosition; }
|
||||
bool GetIsInSafePosition() const { return m_bIsInSafePosition; }
|
||||
void SetWasPostponed(bool wasPostponed) { m_bWasPostponed = wasPostponed; }
|
||||
bool GetWasPostponed() const { return m_bWasPostponed; }
|
||||
void SetIsVisible(bool isVisible) { m_bIsVisible = isVisible; }
|
||||
bool GetIsVisible() const { return m_bIsVisible; }
|
||||
void SetHasHitWall(bool hasHitWall) { m_bHasHitWall = hasHitWall; }
|
||||
bool GetHasHitWall() const { return m_bHasHitWall; }
|
||||
void SetIsBackfaceCulled(bool backfaceCulled) { m_bBackfaceCulled = backfaceCulled; }
|
||||
bool GetIsBackfaceCulled() const { return m_bBackfaceCulled; } // unused
|
||||
void SetIsUnimportantStream(bool unimportantStream) { m_bUnimportantStream |= unimportantStream; }
|
||||
|
||||
void SetScanCode(uint16 scanCode) { m_ScanCode = scanCode; }
|
||||
uint16 GetScanCode() const { return m_ScanCode; }
|
||||
void SetAreaCode(eAreaCodes areaCode) { m_AreaCode = areaCode; }
|
||||
eAreaCodes GetAreaCode() const { return m_AreaCode; }
|
||||
void SetIplIndex(uint8 iplIndex) { m_IplIndex = iplIndex; }
|
||||
uint8 GetIplIndex() { return m_IplIndex; }
|
||||
|
||||
virtual void SetModelIndex(uint32 index);
|
||||
virtual void SetModelIndexNoCreate(uint32 index);
|
||||
uint32 GetModelIndex() const { return m_nModelIndex; }
|
||||
auto GetModelId() const { return (eModelID)m_nModelIndex; } // NOTSA
|
||||
RwObject* GetRwObject() const { return m_pRwObject; }
|
||||
virtual void CreateRwObject();
|
||||
void AttachToRwObject(RwObject* object, bool updateMatrix);
|
||||
void DetachFromRwObject();
|
||||
virtual void DeleteRwObject();
|
||||
|
||||
RwMatrix* GetRwMatrix();
|
||||
void UpdateRwMatrix();
|
||||
|
||||
CVector GetBoundCentre() const;
|
||||
void GetBoundCentre(CVector& outCentre) const;
|
||||
|
||||
float GetBoundRadius() const;
|
||||
virtual CRect GetBoundRect() const;
|
||||
|
||||
CColModel* GetColModel() const;
|
||||
|
||||
// is entity touching entity
|
||||
bool GetIsTouching(CEntity* entity) const;
|
||||
// is entity touching sphere
|
||||
bool GetIsTouching(const CVector& centre, float radius) const;
|
||||
|
||||
bool GetIsOnScreen();
|
||||
bool GetIsBoundingBoxOnScreen();
|
||||
bool IsEntityOccluded();
|
||||
|
||||
bool IsInCurrentArea() const;
|
||||
bool IsInArea(int32 area);
|
||||
bool IsVisible();
|
||||
bool IsVisibleComplex() { return IsVisible(); } // unused
|
||||
|
||||
virtual void ProcessControl() { /* Do nothing */ } // 0x403E40
|
||||
virtual void ProcessCollision() { /* Do nothing */ } // 0x403E50
|
||||
virtual void ProcessShift() { /* Do nothing */ } // 0x403E60
|
||||
virtual bool TestCollision(bool applySpeed) { return false; } // 0x403E70
|
||||
virtual void Teleport(CVector newCoors, bool clearOrientation) { /* Do nothing */ } // 0x403E80
|
||||
virtual void SpecialEntityPreCollisionStuff(CPhysical* colPhysical, bool doingShift, bool& skipTestEntirely, bool& skipCol, bool& forceBuildingCol, bool& forceSoftCol) { /* Do nothing */ } // 0x403E90
|
||||
virtual uint8 SpecialEntityCalcCollisionSteps(bool& doPreCheckAtFullSpeed, bool& doPreCheckAtHalfSpeed) { return 1; } // 0x403EA0
|
||||
|
||||
void UpdateRwFrame();
|
||||
void UpdateRpHAnim();
|
||||
|
||||
bool HasPreRenderEffects();
|
||||
bool DoesNotCollideWithFlyers();
|
||||
void ModifyMatrixForPoleInWind();
|
||||
bool LivesInThisNonOverlapSector(int32 sectorX, int32 sectorY);
|
||||
void SetupBigBuilding();
|
||||
void ModifyMatrixForCrane();
|
||||
void PreRenderForGlassWindow();
|
||||
void SetRwObjectAlpha(int32 alpha);
|
||||
CVector* FindTriggerPointCoors(CVector* pOutVec, int32 triggerIndex);
|
||||
C2dEffect* GetRandom2dEffect(int32 effectType, bool bCheckForEmptySlot);
|
||||
CVector TransformFromObjectSpace(const CVector& offset);
|
||||
CVector* TransformFromObjectSpace(CVector& outPos, const CVector& offset);
|
||||
void CreateEffects();
|
||||
void DestroyEffects();
|
||||
void AttachToRwObject(RwObject* object, bool updateEntityMatrix);
|
||||
void DetachFromRwObject();
|
||||
CVector* GetBoundCentre(CVector* pOutCentre);
|
||||
void GetBoundCentre(CVector& outCentre);
|
||||
CVector GetBoundCentre();
|
||||
void RenderEffects();
|
||||
// is entity touching entity
|
||||
bool GetIsTouching(CEntity* entity);
|
||||
// is entity touching sphere
|
||||
bool GetIsTouching(const CVector& centre, float radius);
|
||||
bool GetIsOnScreen();
|
||||
bool GetIsBoundingBoxOnScreen();
|
||||
void ModifyMatrixForTreeInWind();
|
||||
void ModifyMatrixForBannerInWind();
|
||||
RwMatrix* GetModellingMatrix();
|
||||
CColModel* GetColModel() const;
|
||||
void CalculateBBProjection(CVector* corner1, CVector* corner2, CVector* corner3, CVector* corner4);
|
||||
virtual void PreRender();
|
||||
virtual void Render();
|
||||
void UpdateAnim();
|
||||
bool IsVisible();
|
||||
float GetDistanceFromCentreOfMassToBaseOfModel() const;
|
||||
void CleanUpOldReference(CEntity** entity); // See helper SafeCleanUpOldReference
|
||||
|
||||
/*!
|
||||
* @addr 0x571A40
|
||||
* @brief Clear (set to null) references to `this`
|
||||
*/
|
||||
void BuildWindSockMatrix();
|
||||
bool LivesInThisNonOverlapSector(int32 x, int32 y);
|
||||
float GetDistanceFromCentreOfMassToBaseOfModel() const;
|
||||
|
||||
void ProcessLightsForEntity();
|
||||
|
||||
void RemoveEscalatorsForEntity();
|
||||
|
||||
virtual bool SetupLighting();
|
||||
virtual void RemoveLighting(bool reset);
|
||||
|
||||
void SetupBigBuilding();
|
||||
|
||||
void RegisterReference(CEntity** entity);
|
||||
|
||||
void CleanUpOldReference(CEntity** entity);
|
||||
void ResolveReferences();
|
||||
void PruneReferences();
|
||||
void RegisterReference(CEntity** entity);
|
||||
void ProcessLightsForEntity();
|
||||
void RemoveEscalatorsForEntity();
|
||||
bool IsEntityOccluded();
|
||||
bool IsInCurrentAreaOrBarberShopInterior() const;
|
||||
bool IsInCurrentArea() const;
|
||||
void UpdateRW();
|
||||
// Always returns a non-null value. In case there's no LOD object `this` is returned. NOTSA
|
||||
void ModifyMatrixForTreeInWind();
|
||||
void ModifyMatrixForBannerInWind();
|
||||
void ModifyMatrixForCrane();
|
||||
void PreRenderForGlassWindow();
|
||||
|
||||
virtual void FlagToDestroyWhenNextProcessed() { /* Do nothing */ } // 0x403EB0
|
||||
|
||||
void SetRwObjectAlpha(int32 alpha);
|
||||
|
||||
void CreateEffects();
|
||||
void DestroyEffects();
|
||||
void RenderEffects();
|
||||
|
||||
void SetLodIndex(uint32 lodIndex) { m_nLodIndex = lodIndex; }
|
||||
uint32 GetLodIndex() { return m_nLodIndex; }
|
||||
void SetLod(CEntity* lod) { m_pLod = lod; }
|
||||
CEntity* GetLod() { return m_pLod; }
|
||||
|
||||
void AddLodChildren() { m_NumLodChildren++; } // orig AddLodChild
|
||||
void RemoveLodChildren() { m_NumLodChildren--; } // orig RemoveLodChild
|
||||
int32 GetNumLodChildren() { return m_NumLodChildren; }
|
||||
|
||||
void AddLodChildrenRendered() { m_NumLodChildrenRendered++; } // orig AddLodChildRendered
|
||||
void ResetLodChildrenRendered() { m_NumLodChildrenRendered = 0; } // orig ResetLodRenderedCounter
|
||||
bool HasLodChildrenRendered() { return m_NumLodChildrenRendered > 0; } // orig HasLodChildBeenRendered
|
||||
int32 GetNumLodChildrenRendered() { return m_NumLodChildrenRendered; }
|
||||
void SetCannotLodChildrenRender() { m_NumLodChildrenRendered = 128; } // orig SetLodChildCannotRender
|
||||
bool CanLodChildrenRender() { return m_NumLodChildrenRendered != 128; } // orig CanLodChildRender
|
||||
|
||||
// 128 = displaySuperLowLodFlag, yes, this is very hacky. Blame R*
|
||||
|
||||
CVector* FindTriggerPointCoors(CVector* pOutVec, int32 index);
|
||||
void CalculateBBProjection(CVector* point1, CVector* point2, CVector* point3, CVector* point4);
|
||||
|
||||
C2dEffect* GetRandom2dEffect(int32 effectType, bool mustBeFree);
|
||||
|
||||
CVector TransformFromObjectSpace(const CVector& offset) const;
|
||||
CVector* TransformFromObjectSpace(CVector& outPos, const CVector& offset) const;
|
||||
RwMatrix* GetModellingMatrix();
|
||||
|
||||
// NOTSA section
|
||||
|
||||
// Always returns a non-null value. In case there's no LOD object `this` is returned
|
||||
CEntity* FindLastLOD() noexcept;
|
||||
|
||||
// NOTSA
|
||||
auto GetModelId() const { return (eModelID)m_nModelIndex; }
|
||||
CBaseModelInfo* GetModelInfo() const;
|
||||
|
||||
CCollisionData* GetColData() { return GetColModel()->m_pColData; }
|
||||
|
||||
auto GetModelID() const { return (eModelID)(m_nModelIndex); }
|
||||
|
||||
//! @notsa
|
||||
bool ProcessScan();
|
||||
|
||||
// Wrapper around the mess called `CleanUpOldReference`
|
||||
// Takes in `ref` (which is usually a member variable),
|
||||
// calls `CleanUpOldReference` on it, then sets it to `nullptr`
|
||||
|
|
@ -218,7 +319,7 @@ public:
|
|||
// + clears the old entity (if any)
|
||||
// + set the new entity (if any)
|
||||
template<typename T, typename Y>
|
||||
requires std::is_base_of_v<CEntity, T> && std::is_base_of_v<CEntity, Y>
|
||||
requires std::is_base_of_v<CEntity, T> && std::is_base_of_v<CEntity, Y>
|
||||
static void ChangeEntityReference(T*& inOutRef, Y* entity) {
|
||||
ClearReference(inOutRef); // Clear old
|
||||
if (entity) { // Set new (if any)
|
||||
|
|
@ -229,7 +330,7 @@ public:
|
|||
|
||||
// Similar to `ChangeEntityReference`, but doesn't clear the old reference
|
||||
template<typename T, typename Y>
|
||||
requires std::is_base_of_v<CEntity, T> && std::is_base_of_v<CEntity, Y>
|
||||
requires std::is_base_of_v<CEntity, T> && std::is_base_of_v<CEntity, Y>
|
||||
static void SetEntityReference(T*& inOutRef, Y* entity) {
|
||||
inOutRef = entity;
|
||||
inOutRef->RegisterReference(reinterpret_cast<CEntity**>(&inOutRef));
|
||||
|
|
@ -261,24 +362,14 @@ public:
|
|||
}
|
||||
|
||||
public:
|
||||
// Rw callbacks
|
||||
static RpAtomic* SetAtomicAlphaCB(RpAtomic* atomic, void* data);
|
||||
static RpMaterial* SetMaterialAlphaCB(RpMaterial* material, void* data);
|
||||
// NOTSA section
|
||||
|
||||
[[nodiscard]] bool IsPhysical() const { return m_nType > ENTITY_TYPE_BUILDING && m_nType < ENTITY_TYPE_DUMMY; }
|
||||
[[nodiscard]] bool IsNothing() const { return m_nType == ENTITY_TYPE_NOTHING; }
|
||||
[[nodiscard]] bool IsVehicle() const { return m_nType == ENTITY_TYPE_VEHICLE; }
|
||||
[[nodiscard]] bool IsPed() const { return m_nType == ENTITY_TYPE_PED; }
|
||||
[[nodiscard]] bool IsObject() const { return m_nType == ENTITY_TYPE_OBJECT; }
|
||||
[[nodiscard]] bool IsBuilding() const { return m_nType == ENTITY_TYPE_BUILDING; }
|
||||
[[nodiscard]] bool IsDummy() const { return m_nType == ENTITY_TYPE_DUMMY; }
|
||||
|
||||
[[nodiscard]] bool IsModelTempCollision() const { return m_nModelIndex >= MODEL_TEMPCOL_DOOR1 && m_nModelIndex <= MODEL_TEMPCOL_BODYPART2; }
|
||||
[[nodiscard]] bool IsStatic() const { return m_bIsStatic || m_bIsStaticWaitingForCollision; } // 0x4633E0
|
||||
[[nodiscard]] bool IsRCCar() const { return m_nModelIndex == MODEL_RCBANDIT || m_nModelIndex == MODEL_RCTIGER || m_nModelIndex == MODEL_RCCAM; }
|
||||
[[nodiscard]] bool IsModelTempCollision() const { return GetModelIndex() >= MODEL_TEMPCOL_DOOR1 && GetModelIndex() <= MODEL_TEMPCOL_BODYPART2; }
|
||||
[[nodiscard]] bool IsRCCar() const { return GetModelIndex() == MODEL_RCBANDIT || GetModelIndex() == MODEL_RCTIGER || GetModelIndex() == MODEL_RCCAM; }
|
||||
|
||||
auto AsPhysical() { return reinterpret_cast<CPhysical*>(this); }
|
||||
auto AsVehicle() { return reinterpret_cast<CVehicle*>(this); }
|
||||
auto AsVehicle() const { return reinterpret_cast<const CVehicle*>(this); }
|
||||
auto AsAutomobile() { return reinterpret_cast<CAutomobile*>(this); }
|
||||
auto AsAutomobile() const { return reinterpret_cast<const CAutomobile*>(this); }
|
||||
auto AsBike() { return reinterpret_cast<CBike*>(this); }
|
||||
|
|
@ -295,24 +386,45 @@ public:
|
|||
auto AsBuilding() { return reinterpret_cast<CBuilding*>(this); }
|
||||
auto AsDummy() { return reinterpret_cast<CDummy*>(this); }
|
||||
|
||||
[[nodiscard]] auto GetType() const noexcept { return (eEntityType)m_nType; }
|
||||
void SetType(eEntityType type) { m_nType = type; }
|
||||
|
||||
[[nodiscard]] auto GetStatus() const noexcept { return m_nStatus; }
|
||||
void SetStatus(eEntityStatus status) { m_nStatus = status; }
|
||||
|
||||
bool ProcessScan();
|
||||
bool IsScanCodeCurrent() const;
|
||||
void SetCurrentScanCode();
|
||||
|
||||
private:
|
||||
friend void InjectHooksMain();
|
||||
static void InjectHooks();
|
||||
|
||||
CEntity* Constructor() {
|
||||
this->CEntity::CEntity();
|
||||
return this;
|
||||
}
|
||||
|
||||
CEntity* Destructor() {
|
||||
this->CEntity::~CEntity();
|
||||
return this;
|
||||
}
|
||||
};
|
||||
|
||||
VALIDATE_SIZE(CEntity, 0x38);
|
||||
|
||||
bool IsEntityPointerValid(CEntity* entity);
|
||||
RpMaterial* MaterialUpdateUVAnimCB(RpMaterial* material, void* data);
|
||||
inline bool CEntity::IsInCurrentArea() const {
|
||||
return GetAreaCode() == CGame::currArea || GetAreaCode() == AREA_CODE_13;
|
||||
}
|
||||
|
||||
bool IsGlassModel(CEntity* entity);
|
||||
inline bool CEntity::IsInArea(int32 area) {
|
||||
return GetAreaCode() == area || GetAreaCode() == AREA_CODE_13;
|
||||
}
|
||||
|
||||
inline RwMatrix* CEntity::GetRwMatrix() {
|
||||
return RwFrameGetMatrix(RwFrameGetParent(GetRwObject()));
|
||||
}
|
||||
|
||||
// Rw callbacks:
|
||||
|
||||
static RpAtomic* SetAtomicAlpha(RpAtomic* atomic, void* data);
|
||||
static RpMaterial* SetCompAlphaCB(RpMaterial* material, void* data);
|
||||
static RpMaterial* MaterialUpdateUVAnimCB(RpMaterial* material, void* data);
|
||||
|
||||
bool IsEntityPointerValid(CEntity* entity);
|
||||
|
||||
static inline float& GAME_GRAVITY = *(float*)0x863984; // default 0.008f
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ void CCutsceneObject::InjectHooks() {
|
|||
CCutsceneObject::CCutsceneObject() : CObject() {
|
||||
m_vWorldPosition.Set(0.0F, 0.0F, 0.0F);
|
||||
m_vForce.Set(0.0F, 0.0F, 0.0F);
|
||||
m_bUsesCollision = false;
|
||||
m_nStatus = eEntityStatus::STATUS_SIMPLE;
|
||||
SetUsesCollision(false);
|
||||
SetStatus(STATUS_SIMPLE);
|
||||
m_nObjectType = eObjectType::OBJECT_TYPE_CUTSCENE;
|
||||
m_nAttachBone = 0;
|
||||
m_pAttachmentObject = nullptr;
|
||||
|
|
@ -33,14 +33,14 @@ CCutsceneObject::CCutsceneObject() : CObject() {
|
|||
m_bStreamingDontDelete = true;
|
||||
|
||||
CObject::SetIsStatic(false);
|
||||
m_bBackfaceCulled = false;
|
||||
SetIsBackfaceCulled(false);
|
||||
m_fContactSurfaceBrightness = 0.5F;
|
||||
}
|
||||
|
||||
// 0x5B1B20
|
||||
void CCutsceneObject::SetModelIndex(unsigned index) {
|
||||
CEntity::SetModelIndex(index);
|
||||
if (RwObjectGetType(m_pRwObject) == rpCLUMP) {
|
||||
if (RwObjectGetType(GetRwObject()) == rpCLUMP) {
|
||||
RpAnimBlendClumpInit(m_pRwClump);
|
||||
auto* animData = RpAnimBlendClumpGetData(m_pRwClump);
|
||||
animData->m_PedPosition = &m_vecMoveSpeed;
|
||||
|
|
@ -52,8 +52,8 @@ void CCutsceneObject::SetModelIndex(unsigned index) {
|
|||
|
||||
// 0x5B1B90
|
||||
void CCutsceneObject::ProcessControl() {
|
||||
if (m_nAttachBone && m_pAttachmentObject && !m_bWasPostponed) {
|
||||
m_bWasPostponed = true;
|
||||
if (m_nAttachBone && m_pAttachmentObject && !GetWasPostponed()) {
|
||||
SetWasPostponed(true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -98,7 +98,7 @@ void CCutsceneObject::PreRender() {
|
|||
*static_cast<CMatrix*>(m_matrix) = attachMat;
|
||||
}
|
||||
|
||||
if (RwObjectGetType(m_pRwObject) == rpCLUMP) {
|
||||
if (RwObjectGetType(GetRwObject()) == rpCLUMP) {
|
||||
const auto* firstAtomic = GetFirstAtomic(m_pRwClump);
|
||||
if (firstAtomic) {
|
||||
if (RpSkinGeometryGetSkin(RpAtomicGetGeometry(firstAtomic))) {
|
||||
|
|
@ -111,7 +111,7 @@ void CCutsceneObject::PreRender() {
|
|||
}
|
||||
}
|
||||
|
||||
if (RwObjectGetType(m_pRwObject) == rpCLUMP)
|
||||
if (RwObjectGetType(GetRwObject()) == rpCLUMP)
|
||||
CEntity::UpdateRpHAnim();
|
||||
|
||||
g_realTimeShadowMan.DoShadowThisFrame(this);
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ CHandObject::CHandObject(int32 handModelIndex, CPed* ped, bool bLeftHand) : CObj
|
|||
if (!m_pTexture)
|
||||
m_pTexture = GetFirstTexture(txd->m_pRwDictionary);
|
||||
|
||||
m_nStatus = eEntityStatus::STATUS_SIMPLE;
|
||||
m_bUsesCollision = false;
|
||||
SetStatus(STATUS_SIMPLE);
|
||||
SetUsesCollision(false);
|
||||
m_bLightObject = true;
|
||||
m_bStreamingDontDelete = true;
|
||||
m_nObjectType = eObjectType::OBJECT_TYPE_DECORATION;
|
||||
|
|
@ -50,7 +50,7 @@ void CHandObject::ProcessControl()
|
|||
const auto boneMat = CMatrix(&matArr[m_nBoneIndex], false);
|
||||
*static_cast<CMatrix*>(m_matrix) = boneMat;
|
||||
|
||||
m_bIsInSafePosition = true;
|
||||
SetIsInSafePosition(true);
|
||||
CPhysical::RemoveAndAdd();
|
||||
}
|
||||
|
||||
|
|
@ -88,7 +88,7 @@ void CHandObject::PreRender()
|
|||
}
|
||||
|
||||
m_fContactSurfaceBrightness = m_pPed->m_fContactSurfaceBrightness;
|
||||
CEntity::UpdateRW();
|
||||
CEntity::UpdateRwMatrix();
|
||||
CEntity::UpdateRwFrame();
|
||||
CEntity::UpdateRpHAnim();
|
||||
}
|
||||
|
|
@ -99,4 +99,4 @@ void CHandObject::Render()
|
|||
auto* firstAtomic = GetFirstAtomic(m_pRwClump);
|
||||
RpMaterialSetTexture(RpGeometryGetMaterial(RpAtomicGetGeometry(firstAtomic), 0), m_pTexture);
|
||||
CObject::Render();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,21 +100,21 @@ CObject::CObject(int32 modelId, bool bCreate) : CPhysical() {
|
|||
// 0x5A1DF0
|
||||
CObject::CObject(CDummyObject* dummyObj) : CPhysical() {
|
||||
CEntity::SetModelIndexNoCreate(dummyObj->m_nModelIndex);
|
||||
if (dummyObj->m_pRwObject)
|
||||
CEntity::AttachToRwObject(dummyObj->m_pRwObject, true);
|
||||
if (dummyObj->GetRwObject())
|
||||
CEntity::AttachToRwObject(dummyObj->GetRwObject(), true);
|
||||
else
|
||||
CPlaceable::SetMatrix(dummyObj->GetMatrix());
|
||||
|
||||
dummyObj->DetachFromRwObject();
|
||||
Init();
|
||||
|
||||
m_nIplIndex = dummyObj->m_nIplIndex;
|
||||
m_nAreaCode = dummyObj->m_nAreaCode;
|
||||
SetIplIndex(dummyObj->GetIplIndex());
|
||||
SetAreaCode(dummyObj->GetAreaCode());
|
||||
m_bRenderDamaged = dummyObj->m_bRenderDamaged;
|
||||
|
||||
if (m_pRwObject) {
|
||||
if (GetRwObject()) {
|
||||
auto* atomic = m_pRwAtomic;
|
||||
if (RwObjectGetType(m_pRwObject) != rpATOMIC)
|
||||
if (RwObjectGetType(GetRwObject()) != rpATOMIC)
|
||||
atomic = GetFirstAtomic(m_pRwClump);
|
||||
|
||||
if (!CCustomBuildingRenderer::IsCBPCPipelineAttached(atomic))
|
||||
|
|
@ -180,7 +180,7 @@ void CObject::operator delete(void* obj, int32 poolRef) {
|
|||
|
||||
// 0x5A0760
|
||||
void CObject::SetIsStatic(bool isStatic) {
|
||||
m_bIsStatic = isStatic;
|
||||
CEntity::SetIsStatic(isStatic);
|
||||
physicalFlags.b31 = false;
|
||||
if (!isStatic && (physicalFlags.bDisableMoveForce && m_fDoorStartAngle < -1000.0F)) {
|
||||
m_fDoorStartAngle = GetHeading();
|
||||
|
|
@ -196,7 +196,7 @@ void CObject::CreateRwObject() {
|
|||
void CObject::ProcessControl() {
|
||||
auto* mi = GetModelInfo();
|
||||
auto bIsAnimated = false;
|
||||
if (mi->GetRwModelType() == rpCLUMP && mi->bHasAnimBlend && m_pRwObject)
|
||||
if (mi->GetRwModelType() == rpCLUMP && mi->bHasAnimBlend && GetRwObject())
|
||||
bIsAnimated = true;
|
||||
|
||||
if (m_fDamageIntensity > 0.0F
|
||||
|
|
@ -230,7 +230,7 @@ void CObject::ProcessControl() {
|
|||
}
|
||||
|
||||
objectFlags.bDamaged = false;
|
||||
if (!m_bIsStuck && !IsStatic()) {
|
||||
if (!GetIsStuck() && !GetIsStatic()) {
|
||||
if (!physicalFlags.bDisableZ && !physicalFlags.bInfiniteMass && !physicalFlags.bDisableMoveForce) {
|
||||
m_vecForce += m_vecMoveSpeed;
|
||||
m_vecForce /= 2.0F;
|
||||
|
|
@ -257,7 +257,7 @@ void CObject::ProcessControl() {
|
|||
}
|
||||
}
|
||||
|
||||
if (!IsStatic())
|
||||
if (!GetIsStatic())
|
||||
CPhysical::ProcessControl();
|
||||
|
||||
if (bIsAnimated)
|
||||
|
|
@ -282,11 +282,11 @@ void CObject::ProcessControl() {
|
|||
|
||||
if (m_pObjectInfo->m_bCausesExplosion
|
||||
&& objectFlags.bIsExploded
|
||||
&& m_bIsVisible
|
||||
&& GetIsVisible()
|
||||
&& (CGeneral::GetRandomNumber() % 32) == 10)
|
||||
{
|
||||
m_bUsesCollision = false;
|
||||
m_bIsVisible = false;
|
||||
SetUsesCollision(false);
|
||||
SetIsVisible(false);
|
||||
physicalFlags.bExplosionProof = true;
|
||||
physicalFlags.bApplyGravity = false;
|
||||
ResetMoveSpeed();
|
||||
|
|
@ -299,7 +299,7 @@ void CObject::ProcessControl() {
|
|||
}
|
||||
|
||||
if (m_bIsBIGBuilding)
|
||||
m_bIsInSafePosition = true;
|
||||
SetIsInSafePosition(true);
|
||||
|
||||
if (physicalFlags.bDisableMoveForce && m_fDoorStartAngle > -1000.0F) {
|
||||
auto fHeading = GetHeading();
|
||||
|
|
@ -327,7 +327,7 @@ void CObject::ProcessControl() {
|
|||
}
|
||||
|
||||
if (!m_bIsBIGBuilding
|
||||
&& !IsStatic()
|
||||
&& !GetIsStatic()
|
||||
&& std::fabs(fDiff) < 0.01F
|
||||
&& (objectFlags.bIsDoorMoving || std::fabs(m_vecTurnSpeed.z) < 0.01F)
|
||||
) {
|
||||
|
|
@ -347,7 +347,7 @@ void CObject::ProcessControl() {
|
|||
void CObject::Teleport(CVector destination, bool resetRotation) {
|
||||
CWorld::Remove(this);
|
||||
SetPosn(destination);
|
||||
CEntity::UpdateRW();
|
||||
CEntity::UpdateRwMatrix();
|
||||
CEntity::UpdateRwFrame();
|
||||
CWorld::Add(this);
|
||||
}
|
||||
|
|
@ -370,33 +370,33 @@ void CObject::SpecialEntityPreCollisionStuff(CPhysical* colPhysical, bool bIgnor
|
|||
if (!physicalFlags.bDisableZ) {
|
||||
if (physicalFlags.bDisableMoveForce || physicalFlags.bInfiniteMass)
|
||||
{
|
||||
if (bIgnoreStuckCheck || m_bIsStuck)
|
||||
if (bIgnoreStuckCheck || GetIsStuck())
|
||||
bCollisionDisabled = true;
|
||||
else if (!colPhysical->m_bIsStuck) { /* Do nothing pretty much, and skip further calc */ }
|
||||
else if (!colPhysical->m_bHasHitWall)
|
||||
else if (!colPhysical->GetIsStuck()) { /* Do nothing pretty much, and skip further calc */ }
|
||||
else if (!colPhysical->GetHasHitWall())
|
||||
bThisOrCollidedEntityStuck = true;
|
||||
else
|
||||
bCollidedEntityUnableToMove = true;
|
||||
}
|
||||
else if (objectFlags.bIsLampPost && (GetUp().z < 0.66F || m_bIsStuck))
|
||||
else if (objectFlags.bIsLampPost && (GetUp().z < 0.66F || GetIsStuck()))
|
||||
{
|
||||
if (colPhysical->IsVehicle() || colPhysical->IsPed()) {
|
||||
if (colPhysical->GetIsTypeVehicle() || colPhysical->GetIsTypePed()) {
|
||||
bCollidedEntityCollisionIgnored = true;
|
||||
if (colPhysical->IsVehicle())
|
||||
if (colPhysical->GetIsTypeVehicle())
|
||||
return;
|
||||
|
||||
m_pEntityIgnoredCollision = colPhysical;
|
||||
}
|
||||
}
|
||||
else if ( colPhysical->IsVehicle())
|
||||
else if ( colPhysical->GetIsTypeVehicle())
|
||||
{
|
||||
if (IsModelTempCollision())
|
||||
bCollisionDisabled = true;
|
||||
else if (IsTemporary() || IsExploded() || !CEntity::IsStatic())
|
||||
else if (IsTemporary() || IsExploded() || !CEntity::GetIsStatic())
|
||||
{
|
||||
if (colPhysical->AsVehicle()->IsConstructionVehicle())
|
||||
{
|
||||
if (m_bIsStuck || colPhysical->m_bIsStuck)
|
||||
if (GetIsStuck() || colPhysical->GetIsStuck())
|
||||
bThisOrCollidedEntityStuck = true;
|
||||
}
|
||||
else if (!CanBeSmashed())
|
||||
|
|
@ -425,10 +425,10 @@ void CObject::SpecialEntityPreCollisionStuff(CPhysical* colPhysical, bool bIgnor
|
|||
}
|
||||
}
|
||||
else if (m_nModelIndex != MODEL_GRENADE
|
||||
|| !colPhysical->IsPed()
|
||||
|| !colPhysical->GetIsTypePed()
|
||||
|| m_matrix->GetPosition().z >= colPhysical->m_matrix->GetPosition().z)
|
||||
{
|
||||
if (colPhysical->IsObject() && colPhysical->AsObject()->m_pObjectInfo->m_fUprootLimit > 0.0F && !colPhysical->m_pAttachedTo)
|
||||
if (colPhysical->GetIsTypeObject() && colPhysical->AsObject()->m_pObjectInfo->m_fUprootLimit > 0.0F && !colPhysical->m_pAttachedTo)
|
||||
{
|
||||
if ((!colPhysical->physicalFlags.bDisableCollisionForce || colPhysical->physicalFlags.bCollidable)
|
||||
&& colPhysical->m_fMass * 10.0F > m_fMass)
|
||||
|
|
@ -442,12 +442,12 @@ void CObject::SpecialEntityPreCollisionStuff(CPhysical* colPhysical, bool bIgnor
|
|||
{
|
||||
if (bIgnoreStuckCheck)
|
||||
bCollisionDisabled = true;
|
||||
else if (m_bIsStuck || colPhysical->m_bIsStuck)
|
||||
else if (GetIsStuck() || colPhysical->GetIsStuck())
|
||||
bThisOrCollidedEntityStuck = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!bCollidedEntityCollisionIgnored && (bIgnoreStuckCheck || m_bIsStuck))
|
||||
if (!bCollidedEntityCollisionIgnored && (bIgnoreStuckCheck || GetIsStuck()))
|
||||
bThisOrCollidedEntityStuck = true;
|
||||
|
||||
}
|
||||
|
|
@ -536,7 +536,7 @@ void CObject::PreRender() {
|
|||
if (!m_pAttachedTo)
|
||||
m_fContactSurfaceBrightness = m_nColLighting.GetCurrentLighting();
|
||||
|
||||
if (m_pRwObject && RwObjectGetType(m_pRwObject) == rpCLUMP && objectFlags.bFadingIn)
|
||||
if (GetRwObject() && RwObjectGetType(GetRwObject()) == rpCLUMP && objectFlags.bFadingIn)
|
||||
{
|
||||
auto iAlpha = CVisibilityPlugins::GetClumpAlpha(m_pRwClump) - 16;
|
||||
iAlpha = std::max(0, iAlpha);
|
||||
|
|
@ -548,7 +548,7 @@ void CObject::PreRender() {
|
|||
if (m_fScale != 1.0F || objectFlags.bIsScaled)
|
||||
{
|
||||
auto vecScale = CVector(m_fScale, m_fScale, m_fScale);
|
||||
CEntity::UpdateRW();
|
||||
CEntity::UpdateRwMatrix();
|
||||
RwMatrixScale(CEntity::GetModellingMatrix(), &vecScale, RwOpCombineType::rwCOMBINEPRECONCAT);
|
||||
CEntity::UpdateRwFrame();
|
||||
objectFlags.bIsScaled = true;
|
||||
|
|
@ -556,7 +556,7 @@ void CObject::PreRender() {
|
|||
objectFlags.bIsScaled = false; //BUG? It's unsetting the flag straight after setting it
|
||||
}
|
||||
|
||||
if (m_pRwObject && RwObjectGetType(m_pRwObject) == rpCLUMP)
|
||||
if (GetRwObject() && RwObjectGetType(GetRwObject()) == rpCLUMP)
|
||||
CEntity::UpdateRpHAnim();
|
||||
}
|
||||
|
||||
|
|
@ -648,8 +648,8 @@ void CObject::ProcessGarageDoorBehaviour() {
|
|||
m_matrix->GetPosition().z = vecDummyPos.z + fHeight * garage.m_fDoorPosition / 1.1F;
|
||||
}
|
||||
|
||||
m_bUsesCollision = garage.m_bDoorClosed;
|
||||
CEntity::UpdateRW();
|
||||
SetUsesCollision(garage.m_bDoorClosed);
|
||||
CEntity::UpdateRwMatrix();
|
||||
CEntity::UpdateRwFrame();
|
||||
}
|
||||
|
||||
|
|
@ -760,7 +760,7 @@ void CObject::ResetDoorAngle() {
|
|||
ResetTurnSpeed();
|
||||
ResetFrictionMoveSpeed();
|
||||
ResetFrictionTurnSpeed();
|
||||
CEntity::UpdateRW();
|
||||
CEntity::UpdateRwMatrix();
|
||||
CEntity::UpdateRwFrame();
|
||||
}
|
||||
|
||||
|
|
@ -774,7 +774,7 @@ void CObject::LockDoor() {
|
|||
|
||||
// 0x59F840
|
||||
void CObject::Init() {
|
||||
m_nType = ENTITY_TYPE_OBJECT;
|
||||
SetTypeObject();
|
||||
m_pObjectInfo = &CObjectData::GetDefault();
|
||||
m_nColDamageEffect = COL_DAMAGE_EFFECT_NONE;
|
||||
m_nSpecialColResponseCase = COL_SPECIAL_RESPONSE_NONE;
|
||||
|
|
@ -843,7 +843,7 @@ void CObject::Init() {
|
|||
objectFlags.bIsTargetable = false;
|
||||
physicalFlags.bAttachedToEntity = false;
|
||||
|
||||
m_nAreaCode = eAreaCodes::AREA_CODE_13;
|
||||
SetAreaCode(AREA_CODE_13);
|
||||
m_wRemapTxd = -1;
|
||||
m_pRemapTexture = nullptr;
|
||||
m_pControlCodeList = nullptr;
|
||||
|
|
@ -946,7 +946,7 @@ void CObject::ProcessSamSiteBehaviour() {
|
|||
fNewAngle = fHeading + fTimeStep;
|
||||
|
||||
CPlaceable::SetHeading(fNewAngle - HALF_PI);
|
||||
CEntity::UpdateRW();
|
||||
CEntity::UpdateRwMatrix();
|
||||
CEntity::UpdateRwFrame();
|
||||
|
||||
auto vecShootDir = vecPos - vecTargetPos;
|
||||
|
|
@ -965,7 +965,7 @@ void CObject::ProcessSamSiteBehaviour() {
|
|||
|
||||
fHeading += CTimer::GetTimeStep() / 200.0F;
|
||||
CPlaceable::SetHeading(fHeading - HALF_PI);
|
||||
CEntity::UpdateRW();
|
||||
CEntity::UpdateRwMatrix();
|
||||
CEntity::UpdateRwFrame();
|
||||
}
|
||||
|
||||
|
|
@ -998,16 +998,16 @@ void CObject::ProcessTrainCrossingBehaviour() {
|
|||
else
|
||||
SetMatrixForTrainCrossing(m_matrix, std::min(PI * 0.43F, fAngle + fTimeStep));
|
||||
|
||||
CEntity::UpdateRW();
|
||||
CEntity::UpdateRwMatrix();
|
||||
CEntity::UpdateRwFrame();
|
||||
}
|
||||
|
||||
// 0x5A0D90
|
||||
void CObject::ObjectDamage(float damage, const CVector* fxOrigin, const CVector* fxDirection, CEntity* damager, eWeaponType weaponType) {
|
||||
if (!m_bUsesCollision)
|
||||
if (!GetUsesCollision())
|
||||
return;
|
||||
|
||||
if (weaponType == eWeaponType::WEAPON_UNIDENTIFIED && damager && damager->IsVehicle())
|
||||
if (weaponType == eWeaponType::WEAPON_UNIDENTIFIED && damager && damager->GetIsTypeVehicle())
|
||||
weaponType = eWeaponType::WEAPON_RUNOVERBYCAR;
|
||||
|
||||
if (!CPhysical::CanPhysicalBeDamaged(weaponType, nullptr))
|
||||
|
|
@ -1024,11 +1024,11 @@ void CObject::ObjectDamage(float damage, const CVector* fxOrigin, const CVector*
|
|||
if (!damager)
|
||||
return;
|
||||
|
||||
if (damager->IsPed()) {
|
||||
if (damager->GetIsTypePed()) {
|
||||
auto* ped = damager->AsPed();
|
||||
if (!ped->bInVehicle || !ped->m_pVehicle || ped->m_pVehicle->m_nModelIndex != MODEL_SWATVAN)
|
||||
return;
|
||||
} else if (damager->IsVehicle()) {
|
||||
} else if (damager->GetIsTypeVehicle()) {
|
||||
if (damager->m_nModelIndex != MODEL_SWATVAN)
|
||||
return;
|
||||
} else
|
||||
|
|
@ -1052,12 +1052,12 @@ void CObject::ObjectDamage(float damage, const CVector* fxOrigin, const CVector*
|
|||
break;
|
||||
|
||||
case COL_DAMAGE_EFFECT_SMASH_COMPLETELY:
|
||||
m_bUsesCollision = false;
|
||||
m_bIsVisible = false;
|
||||
if (!CEntity::IsStatic())
|
||||
SetUsesCollision(false);
|
||||
SetIsVisible(false);
|
||||
if (!CEntity::GetIsStatic())
|
||||
CPhysical::RemoveFromMovingList();
|
||||
|
||||
m_bIsStatic = true;
|
||||
SetIsStatic(true);
|
||||
physicalFlags.bExplosionProof = true;
|
||||
ResetMoveSpeed();
|
||||
ResetTurnSpeed();
|
||||
|
|
@ -1067,13 +1067,13 @@ void CObject::ObjectDamage(float damage, const CVector* fxOrigin, const CVector*
|
|||
|
||||
case COL_DAMAGE_EFFECT_CHANGE_THEN_SMASH:
|
||||
if (m_bRenderDamaged) {
|
||||
m_bUsesCollision = false;
|
||||
m_bIsVisible = false;
|
||||
if (!CEntity::IsStatic()) {
|
||||
SetUsesCollision(false);
|
||||
SetIsVisible(false);
|
||||
if (!CEntity::GetIsStatic()) {
|
||||
CPhysical::RemoveFromMovingList();
|
||||
}
|
||||
|
||||
m_bIsStatic = true;
|
||||
SetIsStatic(true);
|
||||
physicalFlags.bExplosionProof = true;
|
||||
ResetMoveSpeed();
|
||||
ResetTurnSpeed();
|
||||
|
|
@ -1090,12 +1090,12 @@ void CObject::ObjectDamage(float damage, const CVector* fxOrigin, const CVector*
|
|||
const auto bJustFaces = damage * m_pObjectInfo->m_fColDamageMultiplier > m_pObjectInfo->m_fSmashMultiplier * 150.0F;
|
||||
g_breakMan.Add(this, &m_pObjectInfo->m_vecBreakVelocity, m_pObjectInfo->m_fBreakVelocityRand, bJustFaces);
|
||||
|
||||
m_bUsesCollision = false;
|
||||
m_bIsVisible = false;
|
||||
if (!CEntity::IsStatic())
|
||||
SetUsesCollision(false);
|
||||
SetIsVisible(false);
|
||||
if (!CEntity::GetIsStatic())
|
||||
CPhysical::RemoveFromMovingList();
|
||||
|
||||
m_bIsStatic = true;
|
||||
SetIsStatic(true);
|
||||
physicalFlags.bExplosionProof = true;
|
||||
ResetMoveSpeed();
|
||||
ResetTurnSpeed();
|
||||
|
|
@ -1106,7 +1106,7 @@ void CObject::ObjectDamage(float damage, const CVector* fxOrigin, const CVector*
|
|||
}
|
||||
}
|
||||
|
||||
if (!m_bUsesCollision && !m_bIsVisible) {
|
||||
if (!GetUsesCollision() && !GetIsVisible()) {
|
||||
m_fHealth = 0.0F;
|
||||
}
|
||||
}
|
||||
|
|
@ -1177,7 +1177,7 @@ void CObject::Explode() {
|
|||
m_vecMoveSpeed.y += CGeneral::GetRandomNumberInRange(-0.0256F, 0.0256F);
|
||||
m_vecMoveSpeed.z += 0.5F;
|
||||
|
||||
if (IsStatic()) {
|
||||
if (GetIsStatic()) {
|
||||
SetIsStatic(false);
|
||||
CPhysical::AddToMovingList();
|
||||
}
|
||||
|
|
@ -1222,12 +1222,12 @@ void CObject::ObjectFireDamage(float damage, CEntity* damager) {
|
|||
|
||||
g_breakMan.Add(this, &m_pObjectInfo->m_vecBreakVelocity, m_pObjectInfo->m_fBreakVelocityRand, true);
|
||||
|
||||
m_bUsesCollision = false;
|
||||
m_bIsVisible = false;
|
||||
if (!CEntity::IsStatic())
|
||||
SetUsesCollision(false);
|
||||
SetIsVisible(false);
|
||||
if (!CEntity::GetIsStatic())
|
||||
CPhysical::RemoveFromMovingList();
|
||||
|
||||
m_bIsStatic = true;
|
||||
SetIsStatic(true);
|
||||
physicalFlags.bExplosionProof = true;
|
||||
ResetMoveSpeed();
|
||||
ResetTurnSpeed();
|
||||
|
|
@ -1293,7 +1293,7 @@ bool CObject::IsCraneMovingPart() const {
|
|||
ModelIndices::MI_CRANE_HARNESS,
|
||||
ModelIndices::MI_MINI_MAGNET,
|
||||
ModelIndices::MI_WRECKING_BALL,
|
||||
}, GetModelID());
|
||||
}, GetModelId());
|
||||
}
|
||||
|
||||
// 0x5A1AB0
|
||||
|
|
@ -1310,7 +1310,7 @@ void CObject::GrabObjectToCarryWithRope(CPhysical* attachTo) {
|
|||
vecRopePoint *= attachTo->m_matrix->TransformPoint(vecRopePoint);
|
||||
|
||||
rope.m_pRopeAttachObject->SetPosn(vecRopePoint);
|
||||
rope.m_pRopeAttachObject->m_bUsesCollision = false;
|
||||
rope.m_pRopeAttachObject->SetUsesCollision(false);
|
||||
}
|
||||
|
||||
// 0x5A1B60
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ CCivilianPed::CCivilianPed(ePedType pedType, uint32 modelIndex) : CPed(pedType)
|
|||
void CCivilianPed::ProcessControl() {
|
||||
if (m_nCreatedBy != (PED_MISSION | PED_GAME)) {
|
||||
CPed::ProcessControl();
|
||||
if (!m_bWasPostponed && m_nPedState != PEDSTATE_DEAD)
|
||||
if (!GetWasPostponed() && m_nPedState != PEDSTATE_DEAD)
|
||||
GetActiveWeapon().Update(this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -246,7 +246,7 @@ void CCopPed::ProcessControl() {
|
|||
|
||||
CPed::ProcessControl();
|
||||
|
||||
if (m_bWasPostponed)
|
||||
if (GetWasPostponed())
|
||||
return;
|
||||
|
||||
if (m_nPedState == PEDSTATE_DEAD)
|
||||
|
|
@ -284,4 +284,4 @@ void CCopPed::ProcessControl() {
|
|||
} else {
|
||||
FlagToDestroyWhenNextProcessed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ void CEmergencyPed::FiremanAI() {
|
|||
// 0x5DE400
|
||||
void CEmergencyPed::ProcessControl() {
|
||||
CPed::ProcessControl();
|
||||
if (m_bWasPostponed || m_nPedState == PEDSTATE_DEAD)
|
||||
if (GetWasPostponed() || m_nPedState == PEDSTATE_DEAD)
|
||||
return;
|
||||
|
||||
auto& weapon = GetActiveWeapon();
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@ CPed::CPed(ePedType pedType) : CPhysical(), m_pedIK{CPedIK(this)} {
|
|||
m_fArmour = 0.0f;
|
||||
|
||||
m_nPedType = pedType;
|
||||
m_nType = ENTITY_TYPE_PED;
|
||||
SetTypePed();
|
||||
|
||||
// 0x5E8196
|
||||
physicalFlags.bCanBeCollidedWith = true;
|
||||
|
|
@ -1411,7 +1411,7 @@ void CPed::DropEntityThatThisPedIsHolding(bool bDeleteHeldEntity) {
|
|||
// Delete held entity (If any)
|
||||
if (bDeleteHeldEntity) {
|
||||
if (const auto heldEntity = task->m_pEntityToHold) {
|
||||
if (!heldEntity->IsObject() || !heldEntity->AsObject()->IsMissionObject()) {
|
||||
if (!heldEntity->GetIsTypeObject() || !heldEntity->AsObject()->IsMissionObject()) {
|
||||
heldEntity->DeleteRwObject(); // TODO; Are these 3 lines inlined?
|
||||
CWorld::Remove(heldEntity);
|
||||
delete heldEntity;
|
||||
|
|
@ -1589,7 +1589,7 @@ bool CPed::OurPedCanSeeThisEntity(CEntity* entity, bool isSpotted) {
|
|||
}
|
||||
|
||||
auto target{entity->GetPosition()};
|
||||
if (entity->IsPed()) {
|
||||
if (entity->GetIsTypePed()) {
|
||||
target.z += 1.f; // Adjust for head pos?
|
||||
}
|
||||
|
||||
|
|
@ -1664,7 +1664,7 @@ void CPed::ProcessBuoyancy()
|
|||
|
||||
if (bIsStanding) {
|
||||
auto& standingOnEntity = m_pContactEntity;
|
||||
if (standingOnEntity && standingOnEntity->IsVehicle()) {
|
||||
if (standingOnEntity && standingOnEntity->GetIsTypeVehicle()) {
|
||||
auto pStandingOnVehicle = standingOnEntity->AsVehicle();
|
||||
if (pStandingOnVehicle->IsBoat() && !pStandingOnVehicle->physicalFlags.bRenderScorched) {
|
||||
physicalFlags.bSubmergedInWater = false;
|
||||
|
|
@ -1684,7 +1684,7 @@ void CPed::ProcessBuoyancy()
|
|||
CColPoint lineColPoint;
|
||||
CEntity* colEntity;
|
||||
if (CWorld::ProcessVerticalLine(vecPedPos, fCheckZ, lineColPoint, colEntity, false, true, false, false, false, false, nullptr)) {
|
||||
if (colEntity->IsVehicle()) {
|
||||
if (colEntity->GetIsTypeVehicle()) {
|
||||
auto colVehicle = colEntity->AsVehicle();
|
||||
if (colVehicle->IsBoat()
|
||||
&& !colVehicle->physicalFlags.bRenderScorched
|
||||
|
|
@ -2801,7 +2801,7 @@ void CPed::PreRenderAfterTest()
|
|||
}
|
||||
}
|
||||
|
||||
if (m_bIsVisible && CTimeCycle::GetShadowStrength()) {
|
||||
if (GetIsVisible() && CTimeCycle::GetShadowStrength()) {
|
||||
const auto [shadowNeeded, activeTask] = [&]() -> std::pair<bool, CTask*> {
|
||||
if (!bInVehicle) {
|
||||
return std::make_pair(false, intel->m_TaskMgr.FindActiveTaskByType(TASK_COMPLEX_ENTER_ANY_CAR_AS_DRIVER));
|
||||
|
|
@ -2865,7 +2865,7 @@ void CPed::PreRenderAfterTest()
|
|||
}
|
||||
}
|
||||
|
||||
if (GetModelID() == MODEL_PLAYER) {
|
||||
if (GetModelId() == MODEL_PLAYER) {
|
||||
ShoulderBoneRotation(m_pRwClump);
|
||||
m_bDontUpdateHierarchy = true;
|
||||
}
|
||||
|
|
@ -3088,11 +3088,11 @@ CEntity* CPed::AttachPedToEntity(CEntity* entity, CVector offset, uint16 turretA
|
|||
|
||||
// Deal collision with `entity`
|
||||
if (!IsPlayer()) {
|
||||
if (entity->IsVehicle()) {
|
||||
if (entity->GetIsTypeVehicle()) {
|
||||
m_pEntityIgnoredCollision = entity->AsPhysical();
|
||||
}
|
||||
} else { // For player just disable collision
|
||||
m_bUsesCollision = false;
|
||||
SetUsesCollision(false);
|
||||
}
|
||||
|
||||
if (m_nSavedWeapon == WEAPON_UNIDENTIFIED) {
|
||||
|
|
@ -3585,7 +3585,7 @@ RwMatrix* CPed::GetBoneMatrix(eBoneTag bone) const {
|
|||
void CPed::SetModelIndex(uint32 modelIndex) {
|
||||
assert(modelIndex != MODEL_PLAYER || IsPlayer());
|
||||
|
||||
m_bIsVisible = true;
|
||||
SetIsVisible(true);
|
||||
|
||||
CEntity::SetModelIndex(modelIndex);
|
||||
|
||||
|
|
@ -3710,7 +3710,7 @@ void CPed::Render() {
|
|||
}
|
||||
|
||||
// 0x5E76BE
|
||||
if (bDontRender || !(m_bIsVisible || CMirrors::ShouldRenderPeds())) {
|
||||
if (bDontRender || !(GetIsVisible() || CMirrors::ShouldRenderPeds())) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -3900,8 +3900,8 @@ void CPed::FlagToDestroyWhenNextProcessed() {
|
|||
|
||||
if (m_pVehicle->IsDriver(this)) {
|
||||
ClearReference(m_pVehicle->m_pDriver);
|
||||
if (IsPlayer() && m_pVehicle->m_nStatus != STATUS_WRECKED) {
|
||||
m_pVehicle->m_nStatus = STATUS_ABANDONED;
|
||||
if (IsPlayer() && m_pVehicle->GetStatus() != STATUS_WRECKED) {
|
||||
m_pVehicle->SetStatus(STATUS_ABANDONED);
|
||||
}
|
||||
} else {
|
||||
m_pVehicle->RemovePassenger(this);
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ void CPlayerPed::RemovePlayerPed(int32 playerId) {
|
|||
CVehicle* playerVehicle = player->m_pVehicle;
|
||||
if (playerVehicle && playerVehicle->m_pDriver == player)
|
||||
{
|
||||
playerVehicle->m_nStatus = STATUS_PHYSICS;
|
||||
playerVehicle->SetStatus(STATUS_PHYSICS);
|
||||
playerVehicle->m_GasPedal = 0.0f;
|
||||
playerVehicle->m_BrakePedal = 0.1f;
|
||||
}
|
||||
|
|
@ -392,7 +392,7 @@ bool CPlayerPed::PedCanBeTargettedVehicleWise(CPed* ped) {
|
|||
|
||||
// 0x609DE0
|
||||
float CPlayerPed::FindTargetPriority(CEntity* entity) {
|
||||
switch (entity->m_nType) {
|
||||
switch (entity->GetType()) {
|
||||
case ENTITY_TYPE_VEHICLE:
|
||||
return 0.1f;
|
||||
|
||||
|
|
@ -604,8 +604,8 @@ void CPlayerPed::MakePlayerGroupDisappear() {
|
|||
for (int i = 0; i < TOTAL_PED_GROUP_FOLLOWERS; i++) {
|
||||
if (CPed* member = membership.GetMember(i)) {
|
||||
if (!member->IsCreatedByMission()) {
|
||||
member->m_bCollisionProcessed = false;
|
||||
member->m_bIsVisible = false;
|
||||
member->SetCollisionProcessed(false);
|
||||
member->SetIsVisible(false);
|
||||
abTempNeverLeavesGroup[i] = member->bNeverLeavesGroup;
|
||||
member->bNeverLeavesGroup = true;
|
||||
}
|
||||
|
|
@ -619,9 +619,9 @@ void CPlayerPed::MakePlayerGroupReappear() {
|
|||
for (int i = 0; i < TOTAL_PED_GROUP_FOLLOWERS; i++) {
|
||||
if (CPed* member = membership.GetMember(i)) {
|
||||
if (!member->IsCreatedByMission()) {
|
||||
member->m_bIsVisible = true;
|
||||
member->SetIsVisible(true);
|
||||
if (!member->bInVehicle)
|
||||
member->m_bUsesCollision = true;
|
||||
member->SetUsesCollision(true);
|
||||
member->bNeverLeavesGroup = abTempNeverLeavesGroup[i];
|
||||
}
|
||||
}
|
||||
|
|
@ -755,7 +755,7 @@ void CPlayerPed::MakeChangesForNewWeapon(eWeaponType weaponType) {
|
|||
// 0x60B550
|
||||
bool LOSBlockedBetweenPeds(CEntity* entity1, CEntity* entity2) {
|
||||
CVector origin{};
|
||||
if (entity1->IsPed()) {
|
||||
if (entity1->GetIsTypePed()) {
|
||||
origin = entity1->AsPed()->GetBonePosition(eBoneTag::BONE_NECK, false);
|
||||
if (entity1->AsPed()->bIsDucking)
|
||||
origin.z += 0.35f;
|
||||
|
|
@ -763,7 +763,7 @@ bool LOSBlockedBetweenPeds(CEntity* entity1, CEntity* entity2) {
|
|||
origin = entity1->GetPosition();
|
||||
}
|
||||
|
||||
const auto target = entity2->IsPed()
|
||||
const auto target = entity2->GetIsTypePed()
|
||||
? entity1->AsPed()->GetBonePosition(eBoneTag::BONE_NECK, false)
|
||||
: entity1->GetPosition();
|
||||
|
||||
|
|
@ -786,7 +786,7 @@ void CPlayerPed::DrawTriangleForMouseRecruitPed() {
|
|||
|
||||
// 0x60C0C0
|
||||
bool CPlayerPed::DoesTargetHaveToBeBroken(CEntity* target, CWeapon* weapon) {
|
||||
if (!target->m_bIsVisible) {
|
||||
if (!target->GetIsVisible()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -795,7 +795,7 @@ bool CPlayerPed::DoesTargetHaveToBeBroken(CEntity* target, CWeapon* weapon) {
|
|||
}
|
||||
|
||||
if (weapon->m_Type == eWeaponType::WEAPON_SPRAYCAN) {
|
||||
if (target->IsBuilding()) {
|
||||
if (target->GetIsTypeBuilding()) {
|
||||
if (CTagManager::IsTag(target)) {
|
||||
if (CTagManager::GetAlpha(target) == 255) { // they probably used -1
|
||||
return true;
|
||||
|
|
@ -1048,7 +1048,7 @@ void CPlayerPed::ProcessControl() {
|
|||
}
|
||||
if (m_pTargetedObject) {
|
||||
ClearReference(m_p3rdPersonMouseTarget);
|
||||
if (m_pTargetedObject->IsPed()) {
|
||||
if (m_pTargetedObject->GetIsTypePed()) {
|
||||
CPed* targetPed = m_pTargetedObject->AsPed();
|
||||
auto weaponInfo = CWeaponInfo::GetWeaponInfo(GetActiveWeapon().m_Type, GetWeaponSkill());
|
||||
float targetHeadRange = weaponInfo->GetTargetHeadRange();
|
||||
|
|
@ -1082,11 +1082,11 @@ void CPlayerPed::ProcessControl() {
|
|||
if (targetVeh)
|
||||
effectPos += (targetVeh->m_vecMoveSpeed + targetVeh->m_vecTurnSpeed) * CTimer::GetTimeStep();
|
||||
}
|
||||
} else if (m_pTargetedObject->IsVehicle()) {
|
||||
} else if (m_pTargetedObject->GetIsTypeVehicle()) {
|
||||
CVehicle* targetVeh = m_pTargetedObject->AsVehicle();
|
||||
effectPos = (targetVeh->m_vecMoveSpeed + targetVeh->m_vecTurnSpeed) * CTimer::GetTimeStep();
|
||||
effectPos += targetVeh->GetPosition();
|
||||
} else if (m_pTargetedObject->IsObject()) {
|
||||
} else if (m_pTargetedObject->GetIsTypeObject()) {
|
||||
CObject* targetObj = m_pTargetedObject->AsObject();
|
||||
effectPos = targetObj->m_vecMoveSpeed * CTimer::GetTimeStep();
|
||||
effectPos += targetObj->GetPosition();
|
||||
|
|
@ -1195,7 +1195,7 @@ void CPlayerPed::ProcessControl() {
|
|||
ProcessGroupBehaviour(pad);
|
||||
if (bInVehicle)
|
||||
CCarCtrl::RegisterVehicleOfInterest(m_pVehicle);
|
||||
if (!m_bIsVisible)
|
||||
if (!GetIsVisible())
|
||||
UpdateRpHAnim();
|
||||
if (bInVehicle) {
|
||||
CPad* pad = CPad::GetPad(0);
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -158,7 +158,7 @@ public:
|
|||
// originally virtual functions
|
||||
void Add() override;
|
||||
void Remove() override;
|
||||
CRect GetBoundRect() override;
|
||||
CRect GetBoundRect() const override;
|
||||
void ProcessControl() override;
|
||||
void ProcessCollision() override;
|
||||
void ProcessShift() override;
|
||||
|
|
|
|||
|
|
@ -376,7 +376,7 @@ CAutomobile::CAutomobile(int32 modelIndex, eVehicleCreatedBy createdBy, bool set
|
|||
CAutomobile::SetupSuspensionLines();
|
||||
}
|
||||
|
||||
m_nStatus = eEntityStatus::STATUS_SIMPLE;
|
||||
SetStatus(STATUS_SIMPLE);
|
||||
m_nNumPassengers = 0;
|
||||
|
||||
if (m_nDoorLock == CARLOCK_UNLOCKED) {
|
||||
|
|
@ -445,8 +445,8 @@ void CAutomobile::ProcessControl()
|
|||
eCarMission carMission = m_autoPilot.m_nCarMission;
|
||||
if ((carMission == MISSION_PLANE_CRASH_AND_BURN
|
||||
|| carMission == MISSION_HELI_CRASH_AND_BURN
|
||||
|| m_nStatus == STATUS_PLAYER && m_fHealth < 250.0 && m_fireParticleCounter == 2)
|
||||
&& m_nStatus != STATUS_WRECKED
|
||||
|| GetStatus() == STATUS_PLAYER && m_fHealth < 250.0 && m_fireParticleCounter == 2)
|
||||
&& GetStatus() != STATUS_WRECKED
|
||||
&& (m_fDamageIntensity > 0.0f && m_vecLastCollisionImpactVelocity.z > 0.0f || !IsInAir())
|
||||
&& (m_vecMoveSpeed.z >= 0.0f || physicalFlags.bSubmergedInWater))
|
||||
{
|
||||
|
|
@ -455,7 +455,7 @@ void CAutomobile::ProcessControl()
|
|||
}
|
||||
|
||||
if (CCheat::IsActive(CHEAT_ALL_TAXIS_NITRO)) {
|
||||
if (m_nStatus == STATUS_PLAYER && IsTransportVehicle())
|
||||
if (GetStatus() == STATUS_PLAYER && IsTransportVehicle())
|
||||
extraHandlingFlags |= EXTRA_HANDLING_TAXI_BOOST;
|
||||
}
|
||||
|
||||
|
|
@ -493,7 +493,7 @@ void CAutomobile::ProcessControl()
|
|||
bool extraHandlingTaxiBoost = !!(extraHandlingFlags & EXTRA_HANDLING_TAXI_BOOST);
|
||||
|
||||
bool skipPhysics = false;
|
||||
if (m_nStatus == STATUS_ABANDONED || m_nStatus == STATUS_WRECKED) {
|
||||
if (GetStatus() == STATUS_ABANDONED || GetStatus() == STATUS_WRECKED) {
|
||||
bool isVehicleIdle = false;
|
||||
if (!vehicleFlags.bVehicleColProcessed
|
||||
&& m_vecMoveSpeed == 0.0f
|
||||
|
|
@ -506,14 +506,14 @@ void CAutomobile::ProcessControl()
|
|||
float torqueLimitRadius = 0.0009f;
|
||||
float movingSpeedLimit = 0.005f;
|
||||
if (IsSubPlane()) {
|
||||
if (m_fDamageIntensity > 0.0f && m_pDamageEntity && m_pDamageEntity->IsVehicle())
|
||||
if (m_fDamageIntensity > 0.0f && m_pDamageEntity && m_pDamageEntity->GetIsTypeVehicle())
|
||||
forceLimitRadius = 0.003f;
|
||||
else
|
||||
forceLimitRadius = 0.009f;
|
||||
torqueLimitRadius = 0.003f;
|
||||
movingSpeedLimit = 0.1f;
|
||||
}
|
||||
else if (m_nStatus == STATUS_WRECKED) {
|
||||
else if (GetStatus() == STATUS_WRECKED) {
|
||||
forceLimitRadius = 0.006f;
|
||||
torqueLimitRadius = 0.0015f;
|
||||
movingSpeedLimit = 0.015f;
|
||||
|
|
@ -529,7 +529,7 @@ void CAutomobile::ProcessControl()
|
|||
if (forceLimitRadius * forceLimitRadius < m_vecForce.SquaredMagnitude()
|
||||
|| sq(torqueLimitRadius) < m_vecTorque.SquaredMagnitude()
|
||||
|| movingSpeedLimit <= m_fMovingSpeed
|
||||
|| m_fDamageIntensity > 0.0f && m_pDamageEntity && m_pDamageEntity->IsPed())
|
||||
|| m_fDamageIntensity > 0.0f && m_pDamageEntity && m_pDamageEntity->GetIsTypePed())
|
||||
{
|
||||
resetSpeed = false;
|
||||
}
|
||||
|
|
@ -568,8 +568,8 @@ void CAutomobile::ProcessControl()
|
|||
for (auto& collisionEntity : m_apWheelCollisionEntity) {
|
||||
if (collisionEntity) {
|
||||
vehicleFlags.bRestingOnPhysical = true;
|
||||
if (!CWorld::bForceProcessControl && collisionEntity->m_bIsInSafePosition) {
|
||||
m_bWasPostponed = true;
|
||||
if (!CWorld::bForceProcessControl && collisionEntity->GetIsInSafePosition()) {
|
||||
SetWasPostponed(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -581,7 +581,7 @@ void CAutomobile::ProcessControl()
|
|||
}
|
||||
|
||||
VehicleDamage(0.0f, eVehicleCollisionComponent::DEFAULT, nullptr, nullptr, nullptr, WEAPON_RAMMEDBYCAR);
|
||||
if (m_nStatus == STATUS_PLAYER && ModelIndices::HasWaterCannon(m_nModelIndex)) {
|
||||
if (GetStatus() == STATUS_PLAYER && ModelIndices::HasWaterCannon(m_nModelIndex)) {
|
||||
FireTruckControl(nullptr);
|
||||
}
|
||||
else {
|
||||
|
|
@ -608,7 +608,7 @@ void CAutomobile::ProcessControl()
|
|||
if (handlingFlags.bHydraulicInst)
|
||||
HydraulicControl();
|
||||
else if ((CCheat::IsActive(CHEAT_PERFECT_HANDLING) || (extraHandlingFlags & EXTRA_HANDLING_TAXI_BOOST))
|
||||
&& m_nStatus == STATUS_PLAYER
|
||||
&& GetStatus() == STATUS_PLAYER
|
||||
&& m_vecMoveSpeed.SquaredMagnitude() > 0.04f)
|
||||
{
|
||||
BoostJumpControl();
|
||||
|
|
@ -644,7 +644,7 @@ void CAutomobile::ProcessControl()
|
|||
if (m_nModelIndex == MODEL_SKIMMER) {
|
||||
auto skimmerModelInfo = CModelInfo::GetModelInfo(MODEL_SKIMMER)->AsVehicleModelInfoPtr();
|
||||
auto skimmerHandling = gHandlingDataMgr.GetBoatPointer(static_cast<uint8>(skimmerModelInfo->m_nHandlingId));
|
||||
ProcessBoatControl(skimmerHandling, &m_fDoomVerticalRotation, m_bHasHitWall, postCollision);
|
||||
ProcessBoatControl(skimmerHandling, &m_fDoomVerticalRotation, GetHasHitWall(), postCollision);
|
||||
physicalFlags.bTouchingWater = physicalFlags.bSubmergedInWater;
|
||||
}
|
||||
else {
|
||||
|
|
@ -718,7 +718,7 @@ void CAutomobile::ProcessControl()
|
|||
&& this == FindPlayerVehicle()
|
||||
&& CCamera::GetActiveCamera().m_nMode != MODE_1STPERSON)
|
||||
{
|
||||
if (m_nStatus == STATUS_PLAYER && !m_pHandlingData->m_bIsBus)
|
||||
if (GetStatus() == STATUS_PLAYER && !m_pHandlingData->m_bIsBus)
|
||||
{
|
||||
if (m_nBusDoorTimerEnd) {
|
||||
uint32 timeStep = (uint32)CTimer::GetTimeStepInMS();
|
||||
|
|
@ -798,7 +798,7 @@ void CAutomobile::ProcessControl()
|
|||
}
|
||||
|
||||
float traction = m_pHandlingData->m_fTractionMultiplier / 250.0f; // (0.004f * mult)
|
||||
if (m_nStatus == STATUS_PHYSICS)
|
||||
if (GetStatus() == STATUS_PHYSICS)
|
||||
traction = 250.0f / m_fCarTraction * m_pHandlingData->m_fTractionMultiplier;
|
||||
traction *= 0.25f / m_fVelocityFrequency;
|
||||
CPlane* vortex = AsPlane();
|
||||
|
|
@ -817,7 +817,7 @@ void CAutomobile::ProcessControl()
|
|||
float steerAngle = 1.0f; // todo: Repeated branch in conditional chain
|
||||
if (speedForward <= 0.01f || m_WheelCounts[CAR_WHEEL_FRONT_LEFT] <= 0.0f && m_WheelCounts[CAR_WHEEL_REAR_LEFT] <= 0.0f)
|
||||
steerAngle = 1.0f;
|
||||
else if (m_nStatus != STATUS_PLAYER)
|
||||
else if (GetStatus() != STATUS_PLAYER)
|
||||
steerAngle = 1.0f;
|
||||
else {
|
||||
CColPoint colPoint{};
|
||||
|
|
@ -904,7 +904,7 @@ void CAutomobile::ProcessControl()
|
|||
);
|
||||
}
|
||||
|
||||
if (m_nStatus != STATUS_PLAYER) {
|
||||
if (GetStatus() != STATUS_PLAYER) {
|
||||
if (CanUpdateHornCounter())
|
||||
ReduceHornCounter();
|
||||
}
|
||||
|
|
@ -937,7 +937,7 @@ void CAutomobile::ProcessControl()
|
|||
suspensionShake = suspensionChange;
|
||||
}
|
||||
|
||||
if (m_fWheelsSuspensionCompression[i] < 1.0f && m_nStatus == STATUS_PLAYER) {
|
||||
if (m_fWheelsSuspensionCompression[i] < 1.0f && GetStatus() == STATUS_PLAYER) {
|
||||
float roughness = (float)g_surfaceInfos.GetRoughness(m_wheelColPoint[i].m_nSurfaceTypeB) * 0.1f;
|
||||
roughnessShake = std::max(roughnessShake, roughness);
|
||||
}
|
||||
|
|
@ -979,7 +979,7 @@ void CAutomobile::ProcessControl()
|
|||
|
||||
if (!extraHandlingWheelsTouchingSand
|
||||
&& (suspensionShake > 0.0f || roughnessShake > 0.0f)
|
||||
&& m_nStatus == STATUS_PLAYER)
|
||||
&& GetStatus() == STATUS_PLAYER)
|
||||
{
|
||||
float speed = m_vecMoveSpeed.SquaredMagnitude();
|
||||
if (speed > 0.01f) {
|
||||
|
|
@ -1008,11 +1008,11 @@ void CAutomobile::ProcessControl()
|
|||
|
||||
if (handlingFlags.bHydraulicInst && m_vecMoveSpeed.Magnitude() < 0.2f) {
|
||||
auto& hydraulicData = CVehicle::m_aSpecialHydraulicData[m_vehicleSpecialColIndex];
|
||||
if (m_nStatus == STATUS_PHYSICS
|
||||
if (GetStatus() == STATUS_PHYSICS
|
||||
&& (hydraulicData.m_aWheelSuspension[CAR_WHEEL_FRONT_LEFT] > 0.5f && hydraulicData.m_aWheelSuspension[CAR_WHEEL_REAR_LEFT] > 0.5f
|
||||
|| hydraulicData.m_aWheelSuspension[CAR_WHEEL_FRONT_RIGHT] > 0.5f && hydraulicData.m_aWheelSuspension[CAR_WHEEL_REAR_RIGHT] > 0.5f
|
||||
)
|
||||
|| m_nStatus == STATUS_PLAYER
|
||||
|| GetStatus() == STATUS_PLAYER
|
||||
&& m_pDriver
|
||||
&& m_pDriver->IsPlayer()
|
||||
&& std::fabs((float)m_pDriver->AsPlayer()->GetPadFromPlayer()->GetCarGunLeftRight()) > 50.0f
|
||||
|
|
@ -1032,14 +1032,14 @@ void CAutomobile::ProcessControl()
|
|||
}
|
||||
|
||||
if (m_pTowingVehicle) {
|
||||
if (m_nStatus == STATUS_IS_TOWED) {
|
||||
if (GetStatus() == STATUS_IS_TOWED) {
|
||||
bool updateTractorLink = false; // TODO: rename this variable later
|
||||
if (m_pTowingVehicle->m_vecMoveSpeed != 0.0f || m_vecMoveSpeed.SquaredMagnitude() > 0.01f) {
|
||||
updateTractorLink = true;
|
||||
m_pTowingVehicle->UpdateTractorLink(false, false);
|
||||
}
|
||||
CVehicle::UpdateTrailerLink(false, false);
|
||||
if (m_pTowingVehicle && m_nStatus == STATUS_IS_TOWED) {
|
||||
if (m_pTowingVehicle && GetStatus() == STATUS_IS_TOWED) {
|
||||
if (updateTractorLink)
|
||||
m_pTowingVehicle->UpdateTractorLink(false, true);
|
||||
UpdateTrailerLink(false, true);
|
||||
|
|
@ -1050,7 +1050,7 @@ void CAutomobile::ProcessControl()
|
|||
}
|
||||
}
|
||||
else if (m_pVehicleBeingTowed) {
|
||||
if (m_pVehicleBeingTowed->m_nStatus == STATUS_IS_TOWED) {
|
||||
if (m_pVehicleBeingTowed->GetStatus() == STATUS_IS_TOWED) {
|
||||
if (m_pVehicleBeingTowed->m_pTowingVehicle == this) {
|
||||
RemoveFromMovingList();
|
||||
AddToMovingList();
|
||||
|
|
@ -1069,7 +1069,7 @@ void CAutomobile::ProcessControl()
|
|||
ResetFrictionTurnSpeed();
|
||||
}
|
||||
else if (!skipPhysics
|
||||
&& (m_GasPedal == 0.0f || m_nStatus == STATUS_WRECKED)
|
||||
&& (m_GasPedal == 0.0f || GetStatus() == STATUS_WRECKED)
|
||||
&& std::fabs(m_vecMoveSpeed.x) < 0.0045f
|
||||
&& std::fabs(m_vecMoveSpeed.y) < 0.0045f
|
||||
&& std::fabs(m_vecMoveSpeed.z) < 0.0045f)
|
||||
|
|
@ -1119,7 +1119,7 @@ void CAutomobile::ProcessControl()
|
|||
|
||||
// 0x6A1ED0
|
||||
CVector CAutomobile::AddMovingCollisionSpeed(CVector& point) {
|
||||
if (m_nStatus != STATUS_PLAYER && m_nStatus != STATUS_FORCED_STOP) {
|
||||
if (GetStatus() != STATUS_PLAYER && GetStatus() != STATUS_FORCED_STOP) {
|
||||
if (m_nCreatedBy != MISSION_VEHICLE || !m_wMiscComponentAngle && !m_wMiscComponentAnglePrev)
|
||||
return {};
|
||||
}
|
||||
|
|
@ -1196,7 +1196,7 @@ bool CAutomobile::ProcessAI(uint32& extraHandlingFlags) {
|
|||
if (DistanceBetweenPoints(FindPlayerCoors(), GetPosition()) > 50.0f)
|
||||
extraHandlingFlags |= EXTRA_HANDLING_NITROS;
|
||||
}
|
||||
} else if (m_nModelIndex == MODEL_RCBANDIT && m_nStatus != STATUS_REMOTE_CONTROLLED) {
|
||||
} else if (m_nModelIndex == MODEL_RCBANDIT && GetStatus() != STATUS_REMOTE_CONTROLLED) {
|
||||
extraHandlingFlags |= EXTRA_HANDLING_PERFECT;
|
||||
}
|
||||
|
||||
|
|
@ -1204,7 +1204,7 @@ bool CAutomobile::ProcessAI(uint32& extraHandlingFlags) {
|
|||
if (extraPerfectHandling || CCheat::IsActive(CHEAT_PERFECT_HANDLING)) {
|
||||
m_vecCentreOfMass.z = m_aSuspensionSpringLength[CAR_WHEEL_FRONT_LEFT] * 0.3f - m_fFrontHeightAboveRoad;
|
||||
}
|
||||
else if (m_nStatus == STATUS_PHYSICS) {
|
||||
else if (GetStatus() == STATUS_PHYSICS) {
|
||||
if (handlingFlags.bHydraulicGeom) {
|
||||
if (m_autoPilot.m_nCarMission != MISSION_NONE && colData && colData->m_nNumLines > 0) {
|
||||
m_vecCentreOfMass.y = (colData->m_pLines[0].m_vecStart.y + colData->m_pLines[1].m_vecStart.y) * 0.5f;
|
||||
|
|
@ -1224,9 +1224,9 @@ bool CAutomobile::ProcessAI(uint32& extraHandlingFlags) {
|
|||
m_vecCentreOfMass = m_pHandlingData->m_vecCentreOfMass;
|
||||
}
|
||||
|
||||
if (m_nStatus != STATUS_ABANDONED && m_nStatus != STATUS_WRECKED
|
||||
&& m_nStatus != STATUS_PLAYER && m_nStatus != STATUS_REMOTE_CONTROLLED
|
||||
&& m_nStatus != STATUS_FORCED_STOP && vehicleFlags.bIsLawEnforcer)
|
||||
if (GetStatus() != STATUS_ABANDONED && GetStatus() != STATUS_WRECKED
|
||||
&& GetStatus() != STATUS_PLAYER && GetStatus() != STATUS_REMOTE_CONTROLLED
|
||||
&& GetStatus() != STATUS_FORCED_STOP && vehicleFlags.bIsLawEnforcer)
|
||||
{
|
||||
ScanForCrimes();
|
||||
}
|
||||
|
|
@ -1249,7 +1249,7 @@ bool CAutomobile::ProcessAI(uint32& extraHandlingFlags) {
|
|||
}
|
||||
|
||||
bool isRemotelyControlledByPlayer = false;
|
||||
switch (m_nStatus) {
|
||||
switch (GetStatus()) {
|
||||
case STATUS_SIMPLE:
|
||||
{
|
||||
CCarAI::UpdateCarAI(this);
|
||||
|
|
@ -1382,7 +1382,7 @@ bool CAutomobile::ProcessAI(uint32& extraHandlingFlags) {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (m_nStatus != STATUS_PLAYER && m_nStatus != STATUS_REMOTE_CONTROLLED)
|
||||
if (GetStatus() != STATUS_PLAYER && GetStatus() != STATUS_REMOTE_CONTROLLED)
|
||||
return false;
|
||||
|
||||
bool processControlInput = isRemotelyControlledByPlayer;
|
||||
|
|
@ -1410,7 +1410,7 @@ bool CAutomobile::ProcessAI(uint32& extraHandlingFlags) {
|
|||
ProcessControlInputs(static_cast<uint8>(m_pDriver->m_nPedType));
|
||||
}
|
||||
|
||||
if (m_nStatus == STATUS_PLAYER && !IsSubHeli()) {
|
||||
if (GetStatus() == STATUS_PLAYER && !IsSubHeli()) {
|
||||
if (m_nModelIndex == MODEL_VORTEX || !IsSubPlane()) {
|
||||
if (m_nModelIndex != MODEL_SWATVAN && m_nModelIndex != MODEL_RHINO) {
|
||||
DoDriveByShootings();
|
||||
|
|
@ -1503,7 +1503,7 @@ void CAutomobile::ResetSuspension()
|
|||
// 0x6A8500
|
||||
void CAutomobile::ProcessFlyingCarStuff()
|
||||
{
|
||||
if (m_nStatus == STATUS_PLAYER || m_nStatus == STATUS_REMOTE_CONTROLLED || m_nStatus == STATUS_PHYSICS) {
|
||||
if (GetStatus() == STATUS_PLAYER || GetStatus() == STATUS_REMOTE_CONTROLLED || GetStatus() == STATUS_PHYSICS) {
|
||||
if (CCheat::IsActive(CHEAT_CARS_FLY)
|
||||
&& m_vecMoveSpeed.Magnitude() > 0.0f
|
||||
&& CTimer::GetTimeStep() > 0.0f
|
||||
|
|
@ -1585,7 +1585,7 @@ void CAutomobile::ProcessSuspension() {
|
|||
|
||||
float fSuspensionForceLevel = m_pHandlingData->m_fSuspensionForceLevel;
|
||||
if (handlingFlags.bHydraulicGeom && handlingFlags.bHydraulicInst) {
|
||||
if (handlingFlags.bNpcNeutralHandl && m_nStatus == STATUS_PHYSICS) {
|
||||
if (handlingFlags.bNpcNeutralHandl && GetStatus() == STATUS_PHYSICS) {
|
||||
suspensionBias = 0.5f;
|
||||
}
|
||||
if (std::fabs(forwardSpeed) < 0.15f) {
|
||||
|
|
@ -1689,7 +1689,7 @@ void CAutomobile::ProcessSuspension() {
|
|||
|
||||
float speedThreshold = 0.02f;
|
||||
float rollOnToWheelsForce = ROLL_ONTO_WHEELS_FORCE;
|
||||
if (m_nStatus != STATUS_PLAYER && m_nStatus != STATUS_REMOTE_CONTROLLED) {
|
||||
if (GetStatus() != STATUS_PLAYER && GetStatus() != STATUS_REMOTE_CONTROLLED) {
|
||||
speedThreshold *= 2.0f;
|
||||
rollOnToWheelsForce *= 2.0f;
|
||||
}
|
||||
|
|
@ -1727,7 +1727,7 @@ void CAutomobile::ProcessSuspension() {
|
|||
|
||||
// 0x6ACE70
|
||||
int32 CAutomobile::ProcessEntityCollision(CEntity* entity, CColPoint* outColPoints) {
|
||||
if (m_nStatus != STATUS_SIMPLE) {
|
||||
if (GetStatus() != STATUS_SIMPLE) {
|
||||
vehicleFlags.bVehicleColProcessed = true;
|
||||
}
|
||||
|
||||
|
|
@ -1775,8 +1775,8 @@ int32 CAutomobile::ProcessEntityCollision(CEntity* entity, CColPoint* outColPoin
|
|||
const auto tNumLines = tcd->m_nNumLines;
|
||||
if ( physicalFlags.bSkipLineCol
|
||||
|| physicalFlags.bProcessingShift
|
||||
|| entity->IsPed()
|
||||
|| m_nModelIndex == (uint16)eModelID::UNLOAD_MODEL && entity->IsVehicle()
|
||||
|| entity->GetIsTypePed()
|
||||
|| m_nModelIndex == (uint16)eModelID::UNLOAD_MODEL && entity->GetIsTypeVehicle()
|
||||
) {
|
||||
tcd->m_nNumLines = 0; // Later reset back to original value
|
||||
}
|
||||
|
|
@ -1790,7 +1790,7 @@ int32 CAutomobile::ProcessEntityCollision(CEntity* entity, CColPoint* outColPoin
|
|||
}
|
||||
|
||||
// For ghosts we dont do shit (In case this garbage is a forklift this value is modified below)
|
||||
auto numColPts = m_nStatus == STATUS_GHOST
|
||||
auto numColPts = GetStatus() == STATUS_GHOST
|
||||
? 0
|
||||
: CCollision::ProcessColModels(
|
||||
GetMatrix(), *GetColModel(),
|
||||
|
|
@ -1833,7 +1833,7 @@ int32 CAutomobile::ProcessEntityCollision(CEntity* entity, CColPoint* outColPoin
|
|||
CEntity::ChangeEntityReference(m_apWheelCollisionEntity[i], entity->AsPhysical());
|
||||
|
||||
m_vWheelCollisionPos[i] = cp.m_vecPoint - entity->GetPosition();
|
||||
if (entity->IsVehicle()) {
|
||||
if (entity->GetIsTypeVehicle()) {
|
||||
m_anCollisionLighting[i] = entity->AsVehicle()->m_anCollisionLighting[i];
|
||||
}
|
||||
break;
|
||||
|
|
@ -1859,7 +1859,7 @@ int32 CAutomobile::ProcessEntityCollision(CEntity* entity, CColPoint* outColPoin
|
|||
}
|
||||
|
||||
// 0x6AD38A - Remove a few specific cp's for forklifts
|
||||
if (m_nModelIndex == eModelID::MODEL_FORKLIFT && entity->IsObject() && !m_wMiscComponentAngle && !m_wMiscComponentAnglePrev) {
|
||||
if (m_nModelIndex == eModelID::MODEL_FORKLIFT && entity->GetIsTypeObject() && !m_wMiscComponentAngle && !m_wMiscComponentAnglePrev) {
|
||||
auto pts = aAutomobileColPoints | rng::views::take(numColPts);
|
||||
auto newEndIt = rng::remove_if(pts, [](CColPoint& cp) {
|
||||
return cp.m_nSurfaceTypeA == SURFACE_CAR_MOVINGCOMPONENT;
|
||||
|
|
@ -1872,20 +1872,20 @@ int32 CAutomobile::ProcessEntityCollision(CEntity* entity, CColPoint* outColPoin
|
|||
}
|
||||
|
||||
AddCollisionRecord(entity);
|
||||
if (!entity->IsBuilding()) {
|
||||
if (!entity->GetIsTypeBuilding()) {
|
||||
entity->AsPhysical()->AddCollisionRecord(this);
|
||||
}
|
||||
|
||||
if (numColPts > 0) {
|
||||
if ( entity->IsBuilding()
|
||||
|| (entity->IsObject() && entity->AsPhysical()->physicalFlags.bDisableCollisionForce)
|
||||
if ( entity->GetIsTypeBuilding()
|
||||
|| (entity->GetIsTypeObject() && entity->AsPhysical()->physicalFlags.bDisableCollisionForce)
|
||||
) {
|
||||
m_bHasHitWall = true;
|
||||
SetHasHitWall(true);
|
||||
}
|
||||
}
|
||||
|
||||
// 0x6AD482 - Add additional output colpoints for wheels
|
||||
if (numProcessedWheels > 0 && entity->IsBuilding() && m_pHandlingData->m_fSuspensionHighSpdComDamp > 0.f) {
|
||||
if (numProcessedWheels > 0 && entity->GetIsTypeBuilding() && m_pHandlingData->m_fSuspensionHighSpdComDamp > 0.f) {
|
||||
for (auto i = 0; i < MAX_CARWHEELS; i++) {
|
||||
if (m_damageManager.GetWheelStatus((eCarWheel)i) != eCarWheelStatus::WHEEL_STATUS_OK) { // Move to top
|
||||
continue;
|
||||
|
|
@ -1927,10 +1927,10 @@ rtn:
|
|||
|
||||
// 0x6A29C0
|
||||
void CAutomobile::ProcessControlCollisionCheck(bool applySpeed) {
|
||||
m_bIsStuck = false;
|
||||
|
||||
const CMatrix ogmat = GetMatrix(); // Save original matrix (We need it later)
|
||||
|
||||
SetIsStuck(false);
|
||||
|
||||
SkipPhysics();
|
||||
|
||||
physicalFlags.bSkipLineCol = physicalFlags.bProcessingShift = false;
|
||||
|
|
@ -1947,14 +1947,14 @@ void CAutomobile::ProcessControlCollisionCheck(bool applySpeed) {
|
|||
ApplyTurnSpeed();
|
||||
}
|
||||
} else {
|
||||
const auto ogUsesCollision = m_bUsesCollision;
|
||||
m_bUsesCollision = false;
|
||||
const auto ogUsesCollision = GetUsesCollision();
|
||||
SetUsesCollision(false);
|
||||
(void)CheckCollision();
|
||||
m_bUsesCollision = ogUsesCollision; // restore
|
||||
SetUsesCollision(ogUsesCollision); // restore
|
||||
}
|
||||
|
||||
m_bIsStuck = false;
|
||||
m_bIsInSafePosition = true;
|
||||
SetIsStuck(false);
|
||||
SetIsInSafePosition(true);
|
||||
}
|
||||
|
||||
// 0x6AD690
|
||||
|
|
@ -2552,7 +2552,7 @@ bool CAutomobile::BurstTyre(uint8 tyreComponentId, bool bPhysicalEffect) {
|
|||
m_damageManager.SetWheelStatus(wheel, WHEEL_STATUS_BURST);
|
||||
CStats::IncrementStat(STAT_TIRES_POPPED_WITH_GUNFIRE, 1.0f);
|
||||
m_vehicleAudio.AddAudioEvent(AE_TYRE_BURST, 0.0f);
|
||||
if (m_nStatus == STATUS_SIMPLE) {
|
||||
if (GetStatus() == STATUS_SIMPLE) {
|
||||
CCarCtrl::SwitchVehicleToRealPhysics(this);
|
||||
}
|
||||
|
||||
|
|
@ -2810,7 +2810,7 @@ void CAutomobile::DoBurstAndSoftGroundRatios()
|
|||
// 0x6A3770
|
||||
void CAutomobile::PlayCarHorn()
|
||||
{
|
||||
if (m_nAlarmState && m_nAlarmState != -1 && m_nStatus != STATUS_WRECKED || m_HornCounter) {
|
||||
if (m_nAlarmState && m_nAlarmState != -1 && GetStatus() != STATUS_WRECKED || m_HornCounter) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -2874,7 +2874,7 @@ void CAutomobile::VehicleDamage(float damageIntensity, eVehicleCollisionComponen
|
|||
if (autoFlags.bDoesNotGetDamagedUpsideDown) {
|
||||
return;
|
||||
}
|
||||
switch (m_nStatus) {
|
||||
switch (GetStatus()) {
|
||||
case eEntityStatus::STATUS_REMOTE_CONTROLLED: {
|
||||
if (physicalFlags.bSubmergedInWater)
|
||||
return;
|
||||
|
|
@ -2904,7 +2904,7 @@ void CAutomobile::VehicleDamage(float damageIntensity, eVehicleCollisionComponen
|
|||
const auto lastImpactVel_Dot_Fwd = DotProduct(m_matrix->GetForward(), m_vecLastCollisionImpactVelocity);
|
||||
|
||||
// 0x6A77D6
|
||||
if ( m_nStatus == STATUS_PHYSICS
|
||||
if (GetStatus() == STATUS_PHYSICS
|
||||
&& !IsMissionVehicle()
|
||||
&& lastImpactVel_Dot_Fwd < -0.4f // Impact was from behind - (-66, 66) deg
|
||||
&& m_fDamageIntensity / m_fMass > 0.1f
|
||||
|
|
@ -2947,14 +2947,14 @@ void CAutomobile::VehicleDamage(float damageIntensity, eVehicleCollisionComponen
|
|||
}
|
||||
|
||||
// 0x6A78F0
|
||||
if ( damager && damager->IsBuilding()
|
||||
if ( damager && damager->GetIsTypeBuilding()
|
||||
&& DotProduct(*vecCollisionDirection, m_matrix->GetUp()) > 0.6f // In front - (-66, 66) deg
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 0x6A792B
|
||||
if (m_nStatus == STATUS_PLAYER) {
|
||||
if (GetStatus() == STATUS_PLAYER) {
|
||||
if (CStats::GetPercentageProgress() >= 100.f) {
|
||||
calcDmgIntensity /= 2.f;
|
||||
}
|
||||
|
|
@ -2974,14 +2974,14 @@ void CAutomobile::VehicleDamage(float damageIntensity, eVehicleCollisionComponen
|
|||
}
|
||||
|
||||
// 0x6A79AB (Condition inverted)
|
||||
if (calcDmgIntensity > minDmgIntensity && m_nStatus != STATUS_WRECKED) {
|
||||
if (calcDmgIntensity > minDmgIntensity && GetStatus() != STATUS_WRECKED) {
|
||||
// NOTSA_LOG_DEBUG("calcDmgIntensity: {.2f}", calcDmgIntensity); // NOTSA
|
||||
// 0x6A79C7
|
||||
// If we're a law enforcer, and the dmgr is the
|
||||
// player's plyrveh increase their wanted level.
|
||||
if (vehicleFlags.bIsLawEnforcer) {
|
||||
const auto vehicle = FindPlayerVehicle();
|
||||
if (vehicle && damager == vehicle && m_nStatus != STATUS_ABANDONED) {
|
||||
if (vehicle && damager == vehicle && GetStatus() != STATUS_ABANDONED) {
|
||||
// R* used magnitude, but squared magnitude is more suitable.
|
||||
const auto speedMag = vehicle->m_vecMoveSpeed.SquaredMagnitude();
|
||||
if ( speedMag >= m_vecMoveSpeed.SquaredMagnitude()
|
||||
|
|
@ -2994,13 +2994,13 @@ void CAutomobile::VehicleDamage(float damageIntensity, eVehicleCollisionComponen
|
|||
|
||||
// 0x6A7A6E
|
||||
// Some shaky-shaky
|
||||
if (m_nStatus == STATUS_PLAYER && calcDmgIntensity > 50.f) {
|
||||
if (GetStatus() == STATUS_PLAYER && calcDmgIntensity > 50.f) {
|
||||
const auto intensity = std::min(250.f, calcDmgIntensity / m_fMass * 800.f + 100.f);
|
||||
CPad::GetPad()->StartShake(40000 / (uint8)intensity, (uint8)intensity, 2000u);
|
||||
}
|
||||
|
||||
// 0x6A7ACF
|
||||
if (damager && damager->IsVehicle()) {
|
||||
if (damager && damager->GetIsTypeVehicle()) {
|
||||
m_nLastWeaponDamageType = WEAPON_RAMMEDBYCAR;
|
||||
m_pLastDamageEntity = damager;
|
||||
damager->RegisterReference(&m_pLastDamageEntity);
|
||||
|
|
@ -3010,7 +3010,7 @@ void CAutomobile::VehicleDamage(float damageIntensity, eVehicleCollisionComponen
|
|||
// and play the fx sound
|
||||
const auto prevLightStates = m_damageManager.GetAllLightsState();
|
||||
|
||||
if (m_nStatus == STATUS_PLAYER) {
|
||||
if (GetStatus() == STATUS_PLAYER) {
|
||||
FindPlayerInfo().m_nVehicleTimeCounter = CTimer::GetTimeInMS();
|
||||
}
|
||||
|
||||
|
|
@ -3161,7 +3161,7 @@ void CAutomobile::VehicleDamage(float damageIntensity, eVehicleCollisionComponen
|
|||
if (calcCollHealthLoss > 0.f) {
|
||||
if (calcCollHealthLoss > 5.f) {
|
||||
if (m_pDamageEntity) {
|
||||
if (m_pDamageEntity->IsVehicle()) {
|
||||
if (m_pDamageEntity->GetIsTypeVehicle()) {
|
||||
const auto& damagedVeh = *m_pDamageEntity->AsVehicle();
|
||||
|
||||
if (damagedVeh.m_pDriver && m_pDriver) {
|
||||
|
|
@ -3193,7 +3193,7 @@ void CAutomobile::VehicleDamage(float damageIntensity, eVehicleCollisionComponen
|
|||
}
|
||||
if (this == FindPlayerVehicle()) {
|
||||
if (const auto p = PickRandomPassenger()) {
|
||||
p->Say(m_pDamageEntity->IsPed() ? CTX_GLOBAL_CAR_HIT_PED : CTX_GLOBAL_CAR_CRASH);
|
||||
p->Say(m_pDamageEntity->GetIsTypePed() ? CTX_GLOBAL_CAR_HIT_PED : CTX_GLOBAL_CAR_CRASH);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3347,7 +3347,7 @@ bool CAutomobile::SetTowLink(CVehicle* tractor, bool placeMeOnRoadProperly) {
|
|||
return false;
|
||||
}
|
||||
|
||||
switch (m_nStatus) {
|
||||
switch (GetStatus()) {
|
||||
case eEntityStatus::STATUS_PHYSICS:
|
||||
case eEntityStatus::STATUS_IS_TOWED:
|
||||
case eEntityStatus::STATUS_ABANDONED:
|
||||
|
|
@ -3360,7 +3360,7 @@ bool CAutomobile::SetTowLink(CVehicle* tractor, bool placeMeOnRoadProperly) {
|
|||
}
|
||||
}
|
||||
|
||||
m_nStatus = STATUS_IS_TOWED;
|
||||
SetStatus(STATUS_IS_TOWED);
|
||||
|
||||
m_pTowingVehicle = tractor;
|
||||
tractor->RegisterReference(m_pTowingVehicle);
|
||||
|
|
@ -3404,13 +3404,21 @@ bool CAutomobile::BreakTowLink() {
|
|||
CEntity::ClearReference(m_pTowingVehicle);
|
||||
}
|
||||
|
||||
switch (m_nStatus) {
|
||||
case eEntityStatus::STATUS_IS_TOWED:
|
||||
case eEntityStatus::STATUS_IS_SIMPLE_TOWED: {
|
||||
switch (GetStatus()) {
|
||||
case STATUS_IS_TOWED:
|
||||
case STATUS_IS_SIMPLE_TOWED: {
|
||||
if (m_pDriver) { // TODO: Use ternary
|
||||
m_nStatus = m_pDriver->IsPlayer() ? eEntityStatus::STATUS_PLAYER : eEntityStatus::STATUS_PHYSICS;
|
||||
if (m_pDriver->IsPlayer()) {
|
||||
SetStatus(STATUS_PLAYER);
|
||||
} else {
|
||||
SetStatus(STATUS_PHYSICS);
|
||||
}
|
||||
} else {
|
||||
m_nStatus = m_fHealth >= 1.f ? eEntityStatus::STATUS_ABANDONED : eEntityStatus::STATUS_WRECKED;
|
||||
if (m_fHealth >= 1.f) {
|
||||
SetStatus(STATUS_ABANDONED);
|
||||
} else {
|
||||
SetStatus(STATUS_WRECKED);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -3475,13 +3483,13 @@ void CAutomobile::SetupModelNodes() {
|
|||
|
||||
// 0x6A07A0
|
||||
void CAutomobile::HydraulicControl() {
|
||||
if (m_nStatus == STATUS_PHYSICS) { // TODO: switch()
|
||||
if (GetStatus() == STATUS_PHYSICS) { // TODO: switch()
|
||||
if (!IsCreatedBy(MISSION_VEHICLE))
|
||||
return;
|
||||
|
||||
if (m_vehicleSpecialColIndex < 0)
|
||||
return;
|
||||
} else if (m_nStatus != STATUS_PLAYER) {
|
||||
} else if (GetStatus() != STATUS_PLAYER) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -3490,7 +3498,7 @@ void CAutomobile::HydraulicControl() {
|
|||
}
|
||||
|
||||
CPlayerPed* driver = nullptr;
|
||||
if (m_nStatus == STATUS_PLAYER) {
|
||||
if (GetStatus() == STATUS_PLAYER) {
|
||||
if (m_pDriver && m_pDriver->IsPlayer())
|
||||
driver = m_pDriver->AsPlayer();
|
||||
if (CGameLogic::GameState != GAME_STATE_INITIAL)
|
||||
|
|
@ -3618,7 +3626,7 @@ void CAutomobile::HydraulicControl() {
|
|||
if (!suspensionTriggered) {
|
||||
std::ranges::fill(suspensionChange, 1.0f);
|
||||
|
||||
if (m_nStatus == STATUS_PHYSICS) {
|
||||
if (GetStatus() == STATUS_PHYSICS) {
|
||||
for (int32 i = 0; i < 4; i++) {
|
||||
suspensionChange[i] = hydraulicData.m_aWheelSuspension[i];
|
||||
}
|
||||
|
|
@ -3734,7 +3742,7 @@ bool CAutomobile::UpdateMovingCollision(float angle) {
|
|||
}
|
||||
|
||||
CPad* pad = nullptr;
|
||||
if (m_nStatus == STATUS_PLAYER) {
|
||||
if (GetStatus() == STATUS_PLAYER) {
|
||||
CPlayerPed* driver = m_pDriver->AsPlayer();
|
||||
if (!driver || !driver->IsPlayer() || CGameLogic::GameState)
|
||||
return false;
|
||||
|
|
@ -3920,7 +3928,7 @@ void CAutomobile::TellHeliToGoToCoors(float x, float y, float z, float altitudeM
|
|||
AsHeli()->m_fMinAltitude = altitudeMin;
|
||||
AsHeli()->m_fMaxAltitude = altitudeMax;
|
||||
|
||||
m_nStatus = STATUS_PHYSICS;
|
||||
SetStatus(STATUS_PHYSICS);
|
||||
|
||||
if (m_fAircraftGoToHeading == 0.f) {
|
||||
m_fAircraftGoToHeading = CGeneral::GetATanOfXY(m_matrix->GetForward().x, m_matrix->GetForward().y) + PI;
|
||||
|
|
@ -3954,7 +3962,7 @@ void CAutomobile::TellPlaneToGoToCoors(float x, float y, float z, float altitude
|
|||
AsPlane()->m_minAltitude = std::max(altitudeMin, z);
|
||||
AsPlane()->m_maxAltitude = altitudeMax;
|
||||
|
||||
m_nStatus = STATUS_PHYSICS;
|
||||
SetStatus(STATUS_PHYSICS);
|
||||
|
||||
if (m_fAircraftGoToHeading == 0.f) {
|
||||
m_fAircraftGoToHeading = CGeneral::GetATanOfXY(m_matrix->GetForward().x, m_matrix->GetForward().y);
|
||||
|
|
@ -4362,7 +4370,7 @@ void CAutomobile::StopNitroEffect() {
|
|||
// 0x6A3EA0
|
||||
void CAutomobile::NitrousControl(int8 boost) {
|
||||
CPad* pad = nullptr;
|
||||
if (m_nStatus == STATUS_PLAYER && m_pDriver->IsPlayer()) {
|
||||
if (GetStatus() == STATUS_PLAYER && m_pDriver->IsPlayer()) {
|
||||
pad = m_pDriver->AsPlayer()->GetPadFromPlayer();
|
||||
}
|
||||
|
||||
|
|
@ -4383,7 +4391,7 @@ void CAutomobile::NitrousControl(int8 boost) {
|
|||
}
|
||||
|
||||
if (m_fTireTemperature == 1.0f && m_nNitroBoosts > 0) {
|
||||
if (m_nStatus != STATUS_PHYSICS) {
|
||||
if (GetStatus() != STATUS_PHYSICS) {
|
||||
if ( !pad
|
||||
|| !pad->GetCarGunFired()
|
||||
|| pad->GetLookLeft()
|
||||
|
|
@ -4447,7 +4455,7 @@ void CAutomobile::TowTruckControl() {
|
|||
const auto UP_SPEED = 6.0f;
|
||||
const auto DOWN_SPEED = 2.0f;
|
||||
|
||||
if (m_nStatus != STATUS_PLAYER) {
|
||||
if (GetStatus() != STATUS_PLAYER) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -4629,7 +4637,7 @@ void CAutomobile::ProcessCarWheelPair(eCarWheel leftWheel, eCarWheel rightWheel,
|
|||
cosSteerAngle = std::cos(steerAngle);
|
||||
}
|
||||
|
||||
const auto neutralHandling = m_nStatus != STATUS_PLAYER && m_nStatus != STATUS_REMOTE_CONTROLLED && handlingFlags.bNpcNeutralHandl;
|
||||
const auto neutralHandling = GetStatus() != STATUS_PLAYER && GetStatus() != STATUS_REMOTE_CONTROLLED && handlingFlags.bNpcNeutralHandl;
|
||||
|
||||
// TOOD: Refactor
|
||||
float brakeBias = 0.0f;
|
||||
|
|
@ -4663,7 +4671,7 @@ void CAutomobile::ProcessCarWheelPair(eCarWheel leftWheel, eCarWheel rightWheel,
|
|||
}
|
||||
m_wheelColPoint[leftWheel].m_nSurfaceTypeA = SURFACE_WHEELBASE;
|
||||
float adhesion = g_surfaceInfos.GetAdhesiveLimit(&m_wheelColPoint[leftWheel]) * traction;
|
||||
if (m_nStatus == STATUS_PLAYER)
|
||||
if (TreatAsPlayerForCollisions())
|
||||
{
|
||||
adhesion *= g_surfaceInfos.GetWetMultiplier(m_wheelColPoint[leftWheel].m_nSurfaceTypeB);
|
||||
adhesion *= std::min(suspensionBias * m_pHandlingData->m_fSuspensionForceLevel * 4.0f * (1.0f - m_fWheelsSuspensionCompression[leftWheel]), 2.0f);
|
||||
|
|
@ -4713,7 +4721,7 @@ void CAutomobile::ProcessCarWheelPair(eCarWheel leftWheel, eCarWheel rightWheel,
|
|||
}
|
||||
m_wheelColPoint[rightWheel].m_nSurfaceTypeA = SURFACE_WHEELBASE;
|
||||
float adhesion = g_surfaceInfos.GetAdhesiveLimit(&m_wheelColPoint[rightWheel]) * traction;
|
||||
if (m_nStatus == STATUS_PLAYER)
|
||||
if (TreatAsPlayerForCollisions())
|
||||
{
|
||||
adhesion *= g_surfaceInfos.GetWetMultiplier(m_wheelColPoint[rightWheel].m_nSurfaceTypeB);
|
||||
adhesion *= std::min(suspensionBias * m_pHandlingData->m_fSuspensionForceLevel * 4.0f * (1.0f - m_fWheelsSuspensionCompression[rightWheel]), 2.0f);
|
||||
|
|
@ -5164,7 +5172,7 @@ CObject* CAutomobile::SpawnFlyingComponent(eCarNodes nodeIndex, uint32 collision
|
|||
obj->m_fAirResistance = 0.99f;
|
||||
}
|
||||
|
||||
if (m_nStatus == STATUS_WRECKED && IsVisible()) {
|
||||
if (GetStatus() == STATUS_WRECKED && IsVisible()) {
|
||||
const auto camDirUnnorm = TheCamera.GetPosition() - GetPosition();
|
||||
if (DotProduct(objDir, camDirUnnorm) > -0.5f) { // Object's direction is opposite to that of the camera's
|
||||
auto camDir = Normalized(camDirUnnorm);
|
||||
|
|
@ -5273,7 +5281,7 @@ void CAutomobile::ProcessBuoyancy()
|
|||
|
||||
// 0x6A8F67
|
||||
if ((CCheat::IsActive(CHEAT_CARS_ON_WATER) || m_nModelIndex == MODEL_VORTEX)
|
||||
&& m_nStatus == eEntityStatus::STATUS_PLAYER
|
||||
&& GetStatus() == STATUS_PLAYER
|
||||
&& GetUp().z > 0.3F
|
||||
) {
|
||||
if (!vehicleFlags.bIsDrowning) {
|
||||
|
|
@ -5350,7 +5358,7 @@ inline void CAutomobile::ProcessPedInVehicleBuoyancy(CPed* ped, bool bIsDriver)
|
|||
// 0x6A9680
|
||||
void CAutomobile::ProcessHarvester()
|
||||
{
|
||||
if (m_nStatus != STATUS_PLAYER)
|
||||
if (GetStatus() != STATUS_PLAYER)
|
||||
return;
|
||||
|
||||
CStreaming::m_bStreamHarvesterModelsThisFrame = true;
|
||||
|
|
@ -5440,7 +5448,7 @@ void CAutomobile::ProcessHarvester()
|
|||
CGeneral::GetRandomNumberInRange(0.12f, -0.04f)
|
||||
};
|
||||
limb->m_nObjectType = OBJECT_TEMPORARY;
|
||||
limb->UpdateRW();
|
||||
limb->UpdateRwMatrix();
|
||||
limb->UpdateRwFrame();
|
||||
limb->SetIsStatic(false);
|
||||
CObject::nNoTempObjects++;
|
||||
|
|
@ -5473,9 +5481,9 @@ void CAutomobile::ProcessSwingingDoor(eCarNodes nodeIdx, eDoors doorIdx)
|
|||
return;
|
||||
}
|
||||
|
||||
switch (m_nStatus) {
|
||||
case eEntityStatus::STATUS_PLAYER:
|
||||
case eEntityStatus::STATUS_PHYSICS:
|
||||
switch (GetStatus()) {
|
||||
case STATUS_PLAYER:
|
||||
case STATUS_PHYSICS:
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
|
|
@ -5630,7 +5638,7 @@ void CAutomobile::ScanForCrimes() {
|
|||
const auto plyrveh = FindPlayerVehicle();
|
||||
if ( plyrveh
|
||||
&& plyrveh->IsAutomobile()
|
||||
&& plyrveh->m_nStatus != eEntityStatus::STATUS_WRECKED
|
||||
&& plyrveh->GetStatus() != STATUS_WRECKED
|
||||
&& plyrveh->m_nAlarmState
|
||||
&& plyrveh->m_nAlarmState != -1
|
||||
&& DistanceBetweenPointsSquared(GetPosition(), plyrveh->GetPosition()) < sq(20.f)
|
||||
|
|
@ -5642,7 +5650,7 @@ void CAutomobile::ScanForCrimes() {
|
|||
// 0x6AE850
|
||||
void CAutomobile::TankControl()
|
||||
{
|
||||
if (m_nModelIndex == MODEL_RCTIGER && m_nStatus == STATUS_REMOTE_CONTROLLED) {
|
||||
if (m_nModelIndex == MODEL_RCTIGER && GetStatus() == STATUS_REMOTE_CONTROLLED) {
|
||||
if (CPad::GetPad()->CarGunJustDown()) {
|
||||
if (CTimer::GetTimeInMS() > m_nGunFiringTime + TIGER_GUNFIRE_RATE) {
|
||||
CWeapon minigun(WEAPON_MINIGUN, 5000);
|
||||
|
|
@ -5657,7 +5665,7 @@ void CAutomobile::TankControl()
|
|||
return;
|
||||
}
|
||||
|
||||
if (m_nStatus != STATUS_PLAYER || m_nModelIndex != MODEL_RHINO)
|
||||
if (GetStatus() != STATUS_PLAYER || m_nModelIndex != MODEL_RHINO)
|
||||
return;
|
||||
|
||||
if (CGameLogic::GameState != GAME_STATE_INITIAL || !m_pDriver || !m_pDriver->IsPlayer())
|
||||
|
|
@ -5807,7 +5815,7 @@ void CAutomobile::BlowUpCarsInPath() {
|
|||
for (auto&& entity : GetCollidingEntities()) {
|
||||
if (!entity)
|
||||
continue; // I don't think should ever happen? But original code checks...
|
||||
if (!entity->IsVehicle())
|
||||
if (!entity->GetIsTypeVehicle())
|
||||
continue;
|
||||
|
||||
auto& veh = *entity->AsVehicle();
|
||||
|
|
@ -6273,14 +6281,14 @@ bool CAutomobile::RcbanditCheck1CarWheels(CPtrListDoubleLink<CVehicle*>& ptrList
|
|||
if (vehicle == this || !vehicle->IsAutomobile())
|
||||
continue;
|
||||
|
||||
if (!ModelIndices::IsRCBandit(vehicle->m_nModelIndex) && vehicle->m_nScanCode != GetCurrentScanCode())
|
||||
if (!ModelIndices::IsRCBandit(vehicle->m_nModelIndex) && !vehicle->IsScanCodeCurrent())
|
||||
continue;
|
||||
|
||||
CVector distance = GetPosition() - vehicle->GetPosition();
|
||||
if (distance.x < 10.0f && distance.y < 10.0f) {
|
||||
auto modelInfo = vehicle->GetVehicleModelInfo();
|
||||
for (int32 i = 0; i < 4; i++) {
|
||||
if (m_fWheelsSuspensionCompressionPrev[i] >= 1.0f && m_nStatus != STATUS_SIMPLE)
|
||||
if (m_fWheelsSuspensionCompressionPrev[i] >= 1.0f && GetStatus() != STATUS_SIMPLE)
|
||||
continue;
|
||||
|
||||
static CMatrix wheelMatrix;
|
||||
|
|
@ -6325,7 +6333,7 @@ bool CAutomobile::RcbanditCheckHitWheels() {
|
|||
// 0x729B60
|
||||
void CAutomobile::FireTruckControl(CFire* fire) {
|
||||
if (this != FindPlayerVehicle()) {
|
||||
if (m_nStatus != STATUS_PHYSICS || !fire)
|
||||
if (GetStatus() != STATUS_PHYSICS || !fire)
|
||||
return;
|
||||
|
||||
CVector2D distance = fire->GetPosition() - GetPosition();
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ CBike::CBike(int32 modelIndex, eVehicleCreatedBy createdBy) : CVehicle(createdBy
|
|||
m_autoPilot.SetCarMission(MISSION_NONE, 0);
|
||||
m_autoPilot.carCtrlFlags.bAvoidLevelTransitions = false;
|
||||
|
||||
m_nStatus = STATUS_SIMPLE;
|
||||
SetStatus(STATUS_SIMPLE);
|
||||
m_nNumPassengers = 0;
|
||||
vehicleFlags.bLowVehicle = false;
|
||||
vehicleFlags.bIsBig = false;
|
||||
|
|
@ -283,7 +283,7 @@ bool CBike::ProcessAI(uint32& extraHandlingFlags) {
|
|||
|
||||
// 0x6BF400
|
||||
void CBike::ProcessDrivingAnims(CPed* driver, bool blend) {
|
||||
if (m_bOffscreen && m_nStatus == STATUS_PLAYER)
|
||||
if (m_bOffscreen && GetStatus() == STATUS_PLAYER)
|
||||
return;
|
||||
|
||||
ProcessRiderAnims(driver, this, &m_RideAnimData, m_BikeHandling, 0);
|
||||
|
|
@ -306,7 +306,7 @@ void CBike::ProcessControlInputs(uint8 playerNum) {
|
|||
|
||||
// 0x6BDEA0
|
||||
int32 CBike::ProcessEntityCollision(CEntity* entity, CColPoint* outColPoints) {
|
||||
if (m_nStatus != STATUS_SIMPLE) {
|
||||
if (GetStatus() != STATUS_SIMPLE) {
|
||||
vehicleFlags.bVehicleColProcessed = true;
|
||||
}
|
||||
|
||||
|
|
@ -319,7 +319,7 @@ int32 CBike::ProcessEntityCollision(CEntity* entity, CColPoint* outColPoints) {
|
|||
}
|
||||
#endif
|
||||
|
||||
if (physicalFlags.bSkipLineCol || physicalFlags.bProcessingShift || entity->IsPed()) {
|
||||
if (physicalFlags.bSkipLineCol || physicalFlags.bProcessingShift || entity->GetIsTypePed()) {
|
||||
tcd->m_nNumLines = 0; // Later reset back to original value
|
||||
}
|
||||
|
||||
|
|
@ -391,7 +391,7 @@ int32 CBike::ProcessEntityCollision(CEntity* entity, CColPoint* outColPoints) {
|
|||
CEntity::ChangeEntityReference(m_aGroundPhysicalPtrs[i], entity->AsPhysical());
|
||||
|
||||
m_aGroundOffsets[i] = cp.m_vecPoint - entity->GetPosition();
|
||||
if (entity->IsVehicle()) {
|
||||
if (entity->GetIsTypeVehicle()) {
|
||||
m_anCollisionLighting[i] = entity->AsVehicle()->m_anCollisionLighting[i];
|
||||
}
|
||||
break;
|
||||
|
|
@ -410,14 +410,14 @@ int32 CBike::ProcessEntityCollision(CEntity* entity, CColPoint* outColPoints) {
|
|||
|
||||
if (numColPts > 0 || numProcessedLines > 0) {
|
||||
AddCollisionRecord(entity);
|
||||
if (!entity->IsBuilding()) {
|
||||
if (!entity->GetIsTypeBuilding()) {
|
||||
entity->AsPhysical()->AddCollisionRecord(this);
|
||||
}
|
||||
if (numColPts > 0) {
|
||||
if ( entity->IsBuilding()
|
||||
|| (entity->IsObject() && entity->AsPhysical()->physicalFlags.bDisableCollisionForce)
|
||||
if ( entity->GetIsTypeBuilding()
|
||||
|| (entity->GetIsTypeObject() && entity->AsPhysical()->physicalFlags.bDisableCollisionForce)
|
||||
) {
|
||||
m_bHasHitWall = true;
|
||||
SetHasHitWall(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -589,7 +589,7 @@ void CBike::RemoveRefsToVehicle(CEntity* entityToRemove) {
|
|||
// 0x6B6620
|
||||
void CBike::ProcessControlCollisionCheck(bool applySpeed) {
|
||||
const CMatrix oldMat = GetMatrix();
|
||||
m_bIsStuck = false;
|
||||
SetIsStuck(false);
|
||||
SkipPhysics();
|
||||
physicalFlags.bSkipLineCol = false;
|
||||
physicalFlags.bProcessingShift = false;
|
||||
|
|
@ -606,14 +606,14 @@ void CBike::ProcessControlCollisionCheck(bool applySpeed) {
|
|||
ApplyTurnSpeed();
|
||||
}
|
||||
} else {
|
||||
const auto usesCollision = m_bUsesCollision;
|
||||
m_bUsesCollision = false;
|
||||
const auto usesCollision = GetUsesCollision();
|
||||
SetUsesCollision(false);
|
||||
CheckCollision();
|
||||
m_bUsesCollision = usesCollision;
|
||||
SetUsesCollision(usesCollision);
|
||||
}
|
||||
|
||||
m_bIsStuck = false;
|
||||
m_bIsInSafePosition = true;
|
||||
SetIsStuck(false);
|
||||
SetIsInSafePosition(true);
|
||||
}
|
||||
|
||||
// 0x6B5990
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ void CBmx::ProcessControl() {
|
|||
|
||||
CBike::ProcessControl();
|
||||
|
||||
if (m_bWasPostponed || m_nStatus != STATUS_PLAYER || !m_pDriver) {
|
||||
if (GetWasPostponed() || GetStatus() != STATUS_PLAYER || !m_pDriver) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -117,7 +117,7 @@ void CBmx::LaunchBunnyHopCB(CAnimBlendAssociation* assoc, void* data) {
|
|||
(bmx->m_WheelCounts[2] > 0.0f || bmx->m_WheelCounts[3] > 0.0f)
|
||||
) {
|
||||
auto power = std::min(bmx->m_fControlJump / 25.0f, 1.0f) + 1.0f;
|
||||
if (bmx->m_nStatus == STATUS_PLAYER) {
|
||||
if (bmx->GetStatus() == STATUS_PLAYER) {
|
||||
power *= CStats::GetFatAndMuscleModifier(STAT_MOD_6);
|
||||
}
|
||||
if (CCheat::IsActive(CHEAT_HUGE_BUNNY_HOP)) {
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ void CBoat::AddWakePoint(CVector posn) {
|
|||
return;
|
||||
|
||||
int16 uiMaxWakePoints = 31;
|
||||
if (m_nStatus != eEntityStatus::STATUS_PLAYER) {
|
||||
if (GetStatus() != STATUS_PLAYER) {
|
||||
if (m_nCreatedBy == eVehicleCreatedBy::MISSION_VEHICLE)
|
||||
uiMaxWakePoints = 20;
|
||||
else
|
||||
|
|
@ -449,7 +449,7 @@ void CBoat::FillBoatList() {
|
|||
}
|
||||
}
|
||||
|
||||
if (iNewInd != -1 && (fDistFromCam < fMinDist || boat->m_nStatus == eEntityStatus::STATUS_PLAYER)) {
|
||||
if (iNewInd != -1 && (fDistFromCam < fMinDist || boat->GetStatus() == STATUS_PLAYER)) {
|
||||
apFrameWakeGeneratingBoats[iNewInd] = boat;
|
||||
}
|
||||
}
|
||||
|
|
@ -489,7 +489,7 @@ void CBoat::ProcessControl() {
|
|||
CVehicle::UpdateClumpAlpha();
|
||||
CVehicle::ProcessCarAlarm();
|
||||
|
||||
switch (m_nStatus) {
|
||||
switch (GetStatus()) {
|
||||
case eEntityStatus::STATUS_PLAYER:
|
||||
m_nBoatFlags.bAnchored = false;
|
||||
m_fAnchoredAngle = -10000.0f;
|
||||
|
|
@ -536,7 +536,7 @@ void CBoat::ProcessControl() {
|
|||
break;
|
||||
}
|
||||
|
||||
if (m_nStatus == eEntityStatus::STATUS_PLAYER || m_nStatus == eEntityStatus::STATUS_REMOTE_CONTROLLED || m_nStatus == eEntityStatus::STATUS_PHYSICS) {
|
||||
if (GetStatus() == STATUS_PLAYER || GetStatus() == STATUS_REMOTE_CONTROLLED || GetStatus() == STATUS_PHYSICS) {
|
||||
auto fSTDPropSpeed = 0.0F;
|
||||
auto fROCPropSpeed = CPlane::PLANE_ROC_PROP_SPEED;
|
||||
if (m_nModelIndex == MODEL_SKIMMER)
|
||||
|
|
@ -558,9 +558,9 @@ void CBoat::ProcessControl() {
|
|||
}
|
||||
|
||||
auto fDamagePower = m_fDamageIntensity * m_pHandlingData->m_fCollisionDamageMultiplier;
|
||||
if (fDamagePower > 25.0F && m_nStatus != eEntityStatus::STATUS_WRECKED && m_fHealth >= 250.0F) {
|
||||
if (fDamagePower > 25.0F && GetStatus() != STATUS_WRECKED && m_fHealth >= 250.0F) {
|
||||
auto fSavedHealth = m_fHealth;
|
||||
if (m_nStatus == eEntityStatus::STATUS_PLAYER && CStats::GetPercentageProgress() >= 100.0F)
|
||||
if (GetStatus() == STATUS_PLAYER && CStats::GetPercentageProgress() >= 100.0F)
|
||||
fDamagePower *= 0.5F;
|
||||
|
||||
auto fGivenDamage = fDamagePower;
|
||||
|
|
@ -589,7 +589,7 @@ void CBoat::ProcessControl() {
|
|||
}
|
||||
}
|
||||
|
||||
if (m_fHealth > 460.0F || m_nStatus == eEntityStatus::STATUS_WRECKED) {
|
||||
if (m_fHealth > 460.0F || GetStatus() == STATUS_WRECKED) {
|
||||
m_fBurningTimer = 0.0F;
|
||||
FxSystem_c::SafeKillAndClear(m_pFireParticle);
|
||||
} else {
|
||||
|
|
@ -623,7 +623,7 @@ void CBoat::ProcessControl() {
|
|||
|
||||
auto bPostCollision = m_fDamageIntensity > 0.0F && m_vecLastCollisionImpactVelocity.z > 0.1F;
|
||||
CPhysical::ProcessControl();
|
||||
ProcessBoatControl(m_pBoatHandling, &m_fLastWaterImmersionDepth, m_bHasHitWall, bPostCollision);
|
||||
ProcessBoatControl(m_pBoatHandling, &m_fLastWaterImmersionDepth, GetHasHitWall(), bPostCollision);
|
||||
|
||||
if (m_nModelIndex == MODEL_SKIMMER
|
||||
&& (m_fPropSpeed > CPlane::PLANE_MIN_PROP_SPEED || m_vecMoveSpeed.SquaredMagnitude() > CPlane::PLANE_MIN_PROP_SPEED)) {
|
||||
|
|
@ -964,7 +964,7 @@ void CBoat::BlowUpCar(CEntity* damager, bool bHideExplosion) {
|
|||
return;
|
||||
|
||||
physicalFlags.bRenderScorched = true;
|
||||
m_nStatus = eEntityStatus::STATUS_WRECKED;
|
||||
SetStatus(STATUS_WRECKED);
|
||||
CVisibilityPlugins::SetClumpForAllAtomicsFlag(m_pRwClump, eAtomicComponentFlag::ATOMIC_IS_BLOWN_UP);
|
||||
m_vecMoveSpeed.z += 0.13F;
|
||||
m_fHealth = 0.0F;
|
||||
|
|
|
|||
|
|
@ -34,13 +34,13 @@ CMonsterTruck::CMonsterTruck(int32 modelIndex, eVehicleCreatedBy createdBy) : CA
|
|||
|
||||
// 0x6C8AE0
|
||||
int32 CMonsterTruck::ProcessEntityCollision(CEntity* entity, CColPoint* colPoint) {
|
||||
if (m_nStatus != STATUS_SIMPLE) {
|
||||
if (GetStatus() != STATUS_SIMPLE) {
|
||||
vehicleFlags.bVehicleColProcessed = true; // OK
|
||||
}
|
||||
|
||||
const auto tcm = GetColModel();
|
||||
|
||||
if (physicalFlags.bSkipLineCol || physicalFlags.bProcessingShift || entity->IsPed()) {
|
||||
if (physicalFlags.bSkipLineCol || physicalFlags.bProcessingShift || entity->GetIsTypePed()) {
|
||||
tcm->GetData()->m_nNumLines = 0; // hmm..... (Later reset back to 4)
|
||||
}
|
||||
|
||||
|
|
@ -64,7 +64,7 @@ int32 CMonsterTruck::ProcessEntityCollision(CEntity* entity, CColPoint* colPoint
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!(m_bUsesCollision || !numColPts)) { // TODO: Why is this in the loop body?
|
||||
if (!(GetUsesCollision() || !numColPts)) { // TODO: Why is this in the loop body?
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -83,7 +83,7 @@ int32 CMonsterTruck::ProcessEntityCollision(CEntity* entity, CColPoint* colPoint
|
|||
CEntity::ChangeEntityReference(m_apWheelCollisionEntity[i], entity->AsPhysical());
|
||||
|
||||
m_vWheelCollisionPos[i] = thisWheelColPtNow.m_vecPoint - entity->GetPosition();
|
||||
if (entity->IsVehicle()) {
|
||||
if (entity->GetIsTypeVehicle()) {
|
||||
m_anCollisionLighting[i] = entity->AsVehicle()->m_anCollisionLighting[i];
|
||||
}
|
||||
break;
|
||||
|
|
@ -102,14 +102,14 @@ int32 CMonsterTruck::ProcessEntityCollision(CEntity* entity, CColPoint* colPoint
|
|||
|
||||
if (numColPts > 0 || numProcessedLines > 0) {
|
||||
AddCollisionRecord(entity);
|
||||
if (!entity->IsBuilding()) {
|
||||
if (!entity->GetIsTypeBuilding()) {
|
||||
entity->AsPhysical()->AddCollisionRecord(this);
|
||||
}
|
||||
if (numColPts > 0) {
|
||||
if ( entity->IsBuilding()
|
||||
|| (entity->IsObject() && entity->AsPhysical()->physicalFlags.bDisableCollisionForce)
|
||||
if ( entity->GetIsTypeBuilding()
|
||||
|| (entity->GetIsTypeObject() && entity->AsPhysical()->physicalFlags.bDisableCollisionForce)
|
||||
) {
|
||||
m_bHasHitWall = true;
|
||||
SetHasHitWall(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -185,14 +185,14 @@ void CPlane::BlowUpCar(CEntity* damager, bool bHideExplosion) {
|
|||
if (!vehicleFlags.bCanBeDamaged)
|
||||
return;
|
||||
|
||||
if (m_nStatus == STATUS_PLAYER || m_autoPilot.m_nCarMission == MISSION_PLANE_CRASH_AND_BURN || m_nModelIndex == MODEL_RCBARON) {
|
||||
if (GetStatus() == STATUS_PLAYER || m_autoPilot.m_nCarMission == MISSION_PLANE_CRASH_AND_BURN || m_nModelIndex == MODEL_RCBARON) {
|
||||
if (damager == FindPlayerPed() || damager == FindPlayerVehicle()) {
|
||||
FindPlayerInfo().m_nHavocCaused += 20;
|
||||
FindPlayerInfo().m_fCurrentChaseValue += 10.0f;
|
||||
CStats::IncrementStat(STAT_COST_OF_PROPERTY_DAMAGED, (float)CGeneral::GetRandomNumberInRange(4000, 10'000));
|
||||
}
|
||||
|
||||
if (m_nStatus == STATUS_PLAYER) { // strange
|
||||
if (GetStatus() == STATUS_PLAYER) { // strange
|
||||
if (m_pDriver) {
|
||||
m_pDriver->bDontRender = true;
|
||||
}
|
||||
|
|
@ -403,7 +403,7 @@ void CPlane::ProcessControl() {
|
|||
return plugin::CallMethod<0x6C9260, CPlane*>(this);
|
||||
|
||||
// untested
|
||||
if (m_nStatus == STATUS_PLAYER) {
|
||||
if (GetStatus() == STATUS_PLAYER) {
|
||||
if (m_nModelIndex == MODEL_CROPDUST || m_nModelIndex == MODEL_STUNT) {
|
||||
auto pad = CPad::GetPad(m_pDriver->GetPadNumber());
|
||||
if (pad->IsRightShockPressed()) {
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ void CQuadBike::PreRender() {
|
|||
|
||||
// 0x6CE460
|
||||
bool CQuadBike::ProcessAI(uint32& extraHandlingFlags) {
|
||||
if (m_nStatus != STATUS_PLAYER) {
|
||||
if (GetStatus() != STATUS_PLAYER) {
|
||||
return CAutomobile::ProcessAI(extraHandlingFlags);
|
||||
}
|
||||
|
||||
|
|
@ -210,7 +210,7 @@ bool CQuadBike::ProcessAI(uint32& extraHandlingFlags) {
|
|||
void CQuadBike::ProcessControl() {
|
||||
return plugin::CallMethod<0x6CDCC0, CQuadBike*>(this);
|
||||
|
||||
if (m_nStatus != STATUS_PLAYER || !bDoQuadDamping) {
|
||||
if (GetStatus() != STATUS_PLAYER || !bDoQuadDamping) {
|
||||
CAutomobile::ProcessControl();
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -303,7 +303,7 @@ int32 CTrailer::ProcessEntityCollision(CEntity* entity, CColPoint* outColPoints)
|
|||
}
|
||||
#endif
|
||||
|
||||
if (physicalFlags.bSkipLineCol || physicalFlags.bProcessingShift || entity->IsPed() || entity->IsVehicle()) {
|
||||
if (physicalFlags.bSkipLineCol || physicalFlags.bProcessingShift || entity->GetIsTypePed() || entity->GetIsTypeVehicle()) {
|
||||
tcd->m_nNumLines = 0; // Later reset back to original value
|
||||
}
|
||||
|
||||
|
|
@ -356,7 +356,7 @@ int32 CTrailer::ProcessEntityCollision(CEntity* entity, CColPoint* outColPoints)
|
|||
CEntity::ChangeEntityReference(m_apWheelCollisionEntity[i], entity->AsPhysical());
|
||||
|
||||
m_vWheelCollisionPos[i] = cp.m_vecPoint - entity->GetPosition();
|
||||
if (entity->IsVehicle()) {
|
||||
if (entity->GetIsTypeVehicle()) {
|
||||
m_anCollisionLighting[i] = entity->AsVehicle()->m_anCollisionLighting[i];
|
||||
}
|
||||
break;
|
||||
|
|
@ -390,12 +390,12 @@ int32 CTrailer::ProcessEntityCollision(CEntity* entity, CColPoint* outColPoints)
|
|||
|
||||
if (numColPts > 0 || numProcessedLines > 0) {
|
||||
AddCollisionRecord(entity);
|
||||
if (!entity->IsBuilding()) {
|
||||
if (!entity->GetIsTypeBuilding()) {
|
||||
entity->AsPhysical()->AddCollisionRecord(this);
|
||||
}
|
||||
if (numColPts > 0 && entity->IsBuilding()
|
||||
|| (entity->IsObject() && entity->AsPhysical()->physicalFlags.bDisableCollisionForce)) {
|
||||
m_bHasHitWall = true;
|
||||
if (numColPts > 0 && entity->GetIsTypeBuilding()
|
||||
|| (entity->GetIsTypeObject() && entity->AsPhysical()->physicalFlags.bDisableCollisionForce)) {
|
||||
SetHasHitWall(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ CTrain::CTrain(int32 modelIndex, eVehicleCreatedBy createdBy) : CVehicle(created
|
|||
m_pTemporaryPassenger = nullptr;
|
||||
m_nMaxPassengers = 5;
|
||||
physicalFlags.bDisableSimpleCollision = true;
|
||||
m_bUsesCollision = true;
|
||||
SetUsesCollision(true);
|
||||
m_nTimeWhenCreated = CTimer::GetTimeInMS();
|
||||
field_5C8 = 0;
|
||||
m_nTrackId = 0;
|
||||
|
|
@ -142,7 +142,7 @@ CTrain::CTrain(int32 modelIndex, eVehicleCreatedBy createdBy) : CVehicle(created
|
|||
m_bTunnelTransition = true;
|
||||
m_pPrevCarriage = nullptr;
|
||||
m_pNextCarriage = nullptr;
|
||||
m_nStatus = STATUS_TRAIN_MOVING;
|
||||
SetStatus(STATUS_TRAIN_MOVING);
|
||||
m_autoPilot.m_speed = 0.0f;
|
||||
m_autoPilot.SetCruiseSpeed(0);
|
||||
m_vehicleAudio.Initialise(this);
|
||||
|
|
@ -497,7 +497,7 @@ void CTrain::ProcessControl() {
|
|||
m_fTrainSpeed = -m_fTrainSpeed;
|
||||
}
|
||||
|
||||
if (m_nStatus) {
|
||||
if (GetStatus()) {
|
||||
bool bIsStreakModel = trainFlags.bIsStreakModel;
|
||||
auto fStopAtStationSpeed = static_cast<float>(m_autoPilot.m_nCruiseSpeed);
|
||||
|
||||
|
|
@ -629,7 +629,7 @@ void CTrain::ProcessControl() {
|
|||
|
||||
m_fCurrentRailDistance += CTimer::GetTimeStep() * m_fTrainSpeed;
|
||||
|
||||
if (m_nStatus == STATUS_PLAYER) {
|
||||
if (GetStatus() == STATUS_PLAYER) {
|
||||
|
||||
float fTheTrainSpeed = m_fTrainSpeed;
|
||||
if (fTheTrainSpeed < 0.0f) {
|
||||
|
|
@ -846,13 +846,13 @@ void CTrain::ProcessControl() {
|
|||
m_vecTurnSpeed.z = std::clamp(m_vecTurnSpeed.z, -0.1f, 0.1f);
|
||||
}
|
||||
|
||||
UpdateRW();
|
||||
UpdateRwMatrix();
|
||||
UpdateRwFrame();
|
||||
RemoveAndAdd();
|
||||
|
||||
m_bIsStuck = false;
|
||||
m_bWasPostponed = false;
|
||||
m_bIsInSafePosition = true;
|
||||
SetIsStuck(false);
|
||||
SetWasPostponed(false);
|
||||
SetIsInSafePosition(true);
|
||||
|
||||
m_fMovingSpeed = DistanceBetweenPoints(GetPosition(), vecOldTrainPosition);
|
||||
|
||||
|
|
@ -869,12 +869,12 @@ void CTrain::ProcessControl() {
|
|||
}
|
||||
return;
|
||||
} else {
|
||||
if (!m_bIsStuck) {
|
||||
if (!GetIsStuck()) {
|
||||
float fMaxForce = 0.003f;
|
||||
float fMaxTorque = 0.0009f;
|
||||
float fMaxMovingSpeed = 0.005f;
|
||||
|
||||
if (m_nStatus != STATUS_PLAYER) {
|
||||
if (GetStatus() != STATUS_PLAYER) {
|
||||
fMaxForce = 0.006f;
|
||||
fMaxTorque = 0.0015f;
|
||||
fMaxMovingSpeed = 0.015f;
|
||||
|
|
@ -889,7 +889,7 @@ void CTrain::ProcessControl() {
|
|||
if (m_vecForce.SquaredMagnitude() > fMaxForceTimeStep ||
|
||||
m_vecTorque.SquaredMagnitude() > fMaxTorqueTimeStep ||
|
||||
m_fMovingSpeed >= fMaxMovingSpeed ||
|
||||
m_fDamageIntensity > 0.0f && m_pDamageEntity != nullptr && m_pDamageEntity->IsPed()
|
||||
m_fDamageIntensity > 0.0f && m_pDamageEntity != nullptr && m_pDamageEntity->GetIsTypePed()
|
||||
) {
|
||||
m_nFakePhysics = 0;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@ void CVehicle::InjectHooks() {
|
|||
// 0x6D5F10
|
||||
CVehicle::CVehicle(eVehicleCreatedBy createdBy) : CPhysical(), m_vehicleAudio(), m_autoPilot() {
|
||||
m_bHasPreRenderEffects = true;
|
||||
m_nType = ENTITY_TYPE_VEHICLE;
|
||||
SetTypeVehicle();
|
||||
|
||||
m_fRawSteerAngle = 0.0f;
|
||||
m_f2ndSteerAngle = 0.0f;
|
||||
|
|
@ -484,7 +484,7 @@ void CVehicle::DeleteRwObject() {
|
|||
// 0x6D6640
|
||||
void CVehicle::SpecialEntityPreCollisionStuff(CPhysical* colPhysical, bool bIgnoreStuckCheck, bool& bCollisionDisabled,
|
||||
bool& bCollidedEntityCollisionIgnored, bool& bCollidedEntityUnableToMove, bool& bThisOrCollidedEntityStuck) {
|
||||
if (colPhysical->IsPed()
|
||||
if (colPhysical->GetIsTypePed()
|
||||
&& colPhysical->AsPed()->bKnockedOffBike
|
||||
&& colPhysical->AsPed()->m_pVehicle == this)
|
||||
{
|
||||
|
|
@ -493,8 +493,8 @@ void CVehicle::SpecialEntityPreCollisionStuff(CPhysical* colPhysical, bool bIgno
|
|||
}
|
||||
|
||||
if (physicalFlags.bSubmergedInWater
|
||||
&& m_nStatus != eEntityStatus::STATUS_PLAYER
|
||||
&& (m_nStatus != eEntityStatus::STATUS_REMOTE_CONTROLLED && colPhysical->DoesNotCollideWithFlyers())) //Bug? Seems like it should check for it being heli
|
||||
&& GetStatus() != STATUS_PLAYER
|
||||
&& (GetStatus() != STATUS_REMOTE_CONTROLLED && colPhysical->DoesNotCollideWithFlyers())) // BUG:? Seems like it should check for it being heli
|
||||
{
|
||||
bCollisionDisabled = true;
|
||||
return;
|
||||
|
|
@ -522,8 +522,8 @@ void CVehicle::SpecialEntityPreCollisionStuff(CPhysical* colPhysical, bool bIgno
|
|||
return;
|
||||
}
|
||||
|
||||
if (m_bIsStuck
|
||||
&& colPhysical->IsVehicle()
|
||||
if (GetIsStuck()
|
||||
&& colPhysical->GetIsTypeVehicle()
|
||||
&& (colPhysical->AsVehicle()->physicalFlags.bDisableCollisionForce && !colPhysical->AsVehicle()->physicalFlags.bCollidable)
|
||||
) {
|
||||
bCollidedEntityCollisionIgnored = true;
|
||||
|
|
@ -534,13 +534,13 @@ void CVehicle::SpecialEntityPreCollisionStuff(CPhysical* colPhysical, bool bIgno
|
|||
if (colPhysical->IsImmovable()) {
|
||||
if (bIgnoreStuckCheck)
|
||||
bCollidedEntityCollisionIgnored = true;
|
||||
else if (m_bIsStuck || colPhysical->m_bIsStuck)
|
||||
else if (GetIsStuck() || colPhysical->GetIsStuck())
|
||||
bThisOrCollidedEntityStuck = true;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (colPhysical->IsObject())
|
||||
if (colPhysical->GetIsTypeObject())
|
||||
{
|
||||
if (colPhysical->AsObject()->IsFallenLampPost())
|
||||
{
|
||||
|
|
@ -557,11 +557,11 @@ void CVehicle::SpecialEntityPreCollisionStuff(CPhysical* colPhysical, bool bIgno
|
|||
|
||||
if (colPhysical->AsObject()->IsTemporary()
|
||||
|| colPhysical->AsObject()->IsExploded()
|
||||
|| !colPhysical->IsStatic())
|
||||
|| !colPhysical->GetIsStatic())
|
||||
{
|
||||
if (IsConstructionVehicle())
|
||||
{
|
||||
if (m_bIsStuck || colPhysical->m_bIsStuck)
|
||||
if (GetIsStuck() || colPhysical->GetIsStuck())
|
||||
bThisOrCollidedEntityStuck = true;
|
||||
}
|
||||
else if (!colPhysical->AsObject()->CanBeSmashed() && !IsBike())
|
||||
|
|
@ -589,7 +589,7 @@ void CVehicle::SpecialEntityPreCollisionStuff(CPhysical* colPhysical, bool bIgno
|
|||
if (!bCollidedEntityCollisionIgnored
|
||||
&& !bCollisionDisabled
|
||||
&& !bThisOrCollidedEntityStuck
|
||||
&& colPhysical->m_bIsStuck)
|
||||
&& colPhysical->GetIsStuck())
|
||||
{
|
||||
bCollidedEntityUnableToMove = true;
|
||||
}
|
||||
|
|
@ -603,7 +603,7 @@ void CVehicle::SpecialEntityPreCollisionStuff(CPhysical* colPhysical, bool bIgno
|
|||
return;
|
||||
}
|
||||
|
||||
if (IsRCCar() && (colPhysical->IsVehicle() || colPhysical->IsPed())) {
|
||||
if (IsRCCar() && (colPhysical->GetIsTypeVehicle() || colPhysical->GetIsTypePed())) {
|
||||
bCollidedEntityCollisionIgnored = true;
|
||||
physicalFlags.bSkipLineCol = true;
|
||||
return;
|
||||
|
|
@ -615,7 +615,7 @@ void CVehicle::SpecialEntityPreCollisionStuff(CPhysical* colPhysical, bool bIgno
|
|||
return;
|
||||
}
|
||||
|
||||
if (colPhysical->m_bIsStuck) {
|
||||
if (colPhysical->GetIsStuck()) {
|
||||
bCollidedEntityUnableToMove = true;
|
||||
return;
|
||||
}
|
||||
|
|
@ -631,7 +631,7 @@ uint8 CVehicle::SpecialEntityCalcCollisionSteps(bool& bProcessCollisionBeforeSet
|
|||
return 1;
|
||||
|
||||
auto fMove = sqrt(fMoveSquared);
|
||||
if (m_nStatus != eEntityStatus::STATUS_PLAYER)
|
||||
if (!TreatAsPlayerForCollisions())
|
||||
{
|
||||
if (fMoveSquared <= 0.32F)
|
||||
fMove *= (10.0F / 4.0F);
|
||||
|
|
@ -1322,7 +1322,7 @@ bool CVehicle::CanVehicleBeDamaged(CEntity* damager, eWeaponType weapon, bool& b
|
|||
|
||||
const auto player = FindPlayerPed();
|
||||
const auto vehicle = FindPlayerVehicle();
|
||||
if ( m_nStatus != STATUS_PLAYER
|
||||
if ( GetStatus() != STATUS_PLAYER
|
||||
&& physicalFlags.bInvulnerable
|
||||
&& damager != player
|
||||
&& damager != vehicle
|
||||
|
|
@ -1335,7 +1335,7 @@ bool CVehicle::CanVehicleBeDamaged(CEntity* damager, eWeaponType weapon, bool& b
|
|||
|
||||
bDamagedDueToFireOrExplosionOrBullet = false;
|
||||
if (CanPhysicalBeDamaged(weapon, &bDamagedDueToFireOrExplosionOrBullet)) {
|
||||
return !bDamagedDueToFireOrExplosionOrBullet || m_nStatus != STATUS_PLAYER || m_fHealth >= 250.0f;
|
||||
return !bDamagedDueToFireOrExplosionOrBullet || GetStatus() != STATUS_PLAYER || m_fHealth >= 250.0f;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1486,7 +1486,7 @@ void CVehicle::SetDriver(CPed* driver) {
|
|||
|
||||
// 0x6D1950
|
||||
void CVehicle::RemoveDriver(bool dontTurnEngineOff) {
|
||||
m_nStatus = STATUS_ABANDONED;
|
||||
SetStatus(STATUS_ABANDONED);
|
||||
|
||||
if (!dontTurnEngineOff) {
|
||||
if (!m_pDriver || !m_pDriver->IsPlayer()) {
|
||||
|
|
@ -1756,7 +1756,7 @@ void CVehicle::DestroyVehicleAndDriverAndPassengers(CVehicle* vehicle) {
|
|||
bool CVehicle::IsVehicleNormal() {
|
||||
if (m_pDriver
|
||||
&& !m_nNumPassengers
|
||||
&& m_nStatus != STATUS_WRECKED
|
||||
&& GetStatus() != STATUS_WRECKED
|
||||
&& GetVehicleModelInfo()->m_nVehicleClass != VEHICLE_CLASS_IGNORE
|
||||
) {
|
||||
return true;
|
||||
|
|
@ -1807,7 +1807,7 @@ bool CVehicle::ShufflePassengersToMakeSpace() {
|
|||
|
||||
// 0x6D2460
|
||||
void CVehicle::ExtinguishCarFire() {
|
||||
if (m_nStatus != STATUS_WRECKED) {
|
||||
if (GetStatus() != STATUS_WRECKED) {
|
||||
if (m_fHealth <= 300.0f)
|
||||
m_fHealth = 300.0f;
|
||||
}
|
||||
|
|
@ -2954,7 +2954,7 @@ void CVehicle::FirePlaneGuns() {
|
|||
|
||||
// Shake pad (if necessary)
|
||||
const auto GetPadIdToShake = [this]() -> std::optional<int32> {
|
||||
if (m_nStatus == STATUS_REMOTE_CONTROLLED) {
|
||||
if (GetStatus() == STATUS_REMOTE_CONTROLLED) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -3186,7 +3186,7 @@ void CVehicle::ProcessWheel(CVector& wheelFwd, CVector& wheelRight,
|
|||
bAlreadySkidding = true;
|
||||
adhesion *= m_pHandlingData->m_fTractionLoss;
|
||||
if (*wheelState == WHEEL_STATE_SPINNING) {
|
||||
if (m_nStatus == STATUS_PLAYER || m_nStatus == STATUS_REMOTE_CONTROLLED)
|
||||
if (GetStatus() == STATUS_PLAYER || GetStatus() == STATUS_REMOTE_CONTROLLED)
|
||||
adhesion *= (1.0f - fabs(m_GasPedal) * WS_ALREADY_SPINNING_LOSS);
|
||||
}
|
||||
}
|
||||
|
|
@ -3246,7 +3246,7 @@ void CVehicle::ProcessWheel(CVector& wheelFwd, CVector& wheelRight,
|
|||
if (bAlreadySkidding) {
|
||||
tractionLoss = 1.0f;
|
||||
} else if (*wheelState == WHEEL_STATE_SPINNING) {
|
||||
if (m_nStatus == STATUS_PLAYER || m_nStatus == STATUS_REMOTE_CONTROLLED) {
|
||||
if (GetStatus() == STATUS_PLAYER || GetStatus() == STATUS_REMOTE_CONTROLLED) {
|
||||
tractionLoss = tractionLoss * (1.0f - std::fabs(m_GasPedal) * WS_ALREADY_SPINNING_LOSS);
|
||||
}
|
||||
}
|
||||
|
|
@ -3394,7 +3394,7 @@ void CVehicle::FlyingControl(eFlightModel flightModel, float leftRightSkid, floa
|
|||
return;
|
||||
}
|
||||
|
||||
const auto padOfPlayerDriver = (m_nStatus == STATUS_PLAYER && m_pDriver && m_pDriver->IsPlayer()) ? m_pDriver->AsPlayer()->GetPadFromPlayer() : nullptr;
|
||||
const auto padOfPlayerDriver = (GetStatus() == STATUS_PLAYER && m_pDriver && m_pDriver->IsPlayer()) ? m_pDriver->AsPlayer()->GetPadFromPlayer() : nullptr;
|
||||
const auto windDragForce = IsMissionVehicle() ? CVector{} : -CWeather::WindDir * m_pFlyingHandlingData->m_fWindMult;
|
||||
const auto velocityWithDrag = m_vecMoveSpeed + windDragForce; // Plus because `windDragForce` is opposing to our velocity already
|
||||
|
||||
|
|
@ -3468,7 +3468,7 @@ bool CVehicle::BladeColSectorList(PtrListType& ptrList, CColModel& colModel, CMa
|
|||
}
|
||||
entity->SetCurrentScanCode();
|
||||
|
||||
auto entityCM = entity->IsPed()
|
||||
auto entityCM = entity->GetIsTypePed()
|
||||
? entity->GetModelInfo()->AsPedModelInfoPtr()->AnimatePedColModelSkinned(entity->m_pRwClump)
|
||||
: entity->GetColModel();
|
||||
|
||||
|
|
@ -3476,7 +3476,7 @@ bool CVehicle::BladeColSectorList(PtrListType& ptrList, CColModel& colModel, CMa
|
|||
continue;
|
||||
}
|
||||
|
||||
if (entity->IsObject() && entity->AsObject()->m_nObjectType == eObjectType::OBJECT_TEMPORARY) {
|
||||
if (entity->GetIsTypeObject() && entity->AsObject()->m_nObjectType == eObjectType::OBJECT_TEMPORARY) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -3492,7 +3492,7 @@ bool CVehicle::BladeColSectorList(PtrListType& ptrList, CColModel& colModel, CMa
|
|||
continue;
|
||||
}
|
||||
|
||||
if (entity->IsPed()) { // 0x6DB207
|
||||
if (entity->GetIsTypePed()) { // 0x6DB207
|
||||
auto& ped = *entity->AsPed();
|
||||
|
||||
const auto dirToPed = Normalized(GetPosition() - ped.GetPosition());
|
||||
|
|
@ -3582,7 +3582,7 @@ bool CVehicle::BladeColSectorList(PtrListType& ptrList, CColModel& colModel, CMa
|
|||
}
|
||||
|
||||
if (wasAnyCPValid) {
|
||||
if (entity->IsPed() && !CTimer::IsTimeInRange(planeRotorDmgTimeMS - 2000, planeRotorDmgTimeMS)) {
|
||||
if (entity->GetIsTypePed() && !CTimer::IsTimeInRange(planeRotorDmgTimeMS - 2000, planeRotorDmgTimeMS)) {
|
||||
const auto ReportCollision = [&](CVector pos) {
|
||||
AudioEngine.ReportCollision(
|
||||
this,
|
||||
|
|
@ -3761,7 +3761,7 @@ void CVehicle::ProcessBoatControl(tBoatHandlingData* boatHandling, float* fLastW
|
|||
}
|
||||
|
||||
CPad* pad = nullptr;
|
||||
if (m_nStatus == eEntityStatus::STATUS_PLAYER && m_pDriver && m_pDriver->IsPlayer()) {
|
||||
if (GetStatus() == STATUS_PLAYER && m_pDriver && m_pDriver->IsPlayer()) {
|
||||
pad = m_pDriver->AsPlayer()->GetPadFromPlayer();
|
||||
}
|
||||
|
||||
|
|
@ -3779,7 +3779,7 @@ void CVehicle::ProcessBoatControl(tBoatHandlingData* boatHandling, float* fLastW
|
|||
}
|
||||
|
||||
auto fTraction = 1.0F;
|
||||
if (m_nStatus == eEntityStatus::STATUS_PLAYER) {
|
||||
if (GetStatus() == STATUS_PLAYER) {
|
||||
auto fTractionLoss = DotProduct(m_vecMoveSpeed, GetForward()) * m_pHandlingData->m_fTractionBias;
|
||||
if (pad->GetHandBrake())
|
||||
fTractionLoss *= 0.5F;
|
||||
|
|
@ -3860,7 +3860,7 @@ void CVehicle::ProcessBoatControl(tBoatHandlingData* boatHandling, float* fLastW
|
|||
|
||||
if (fGasState > 0.01F) {
|
||||
fTractionLoss *= (0.55F - fGasState);
|
||||
if (m_nStatus == eEntityStatus::STATUS_PLAYER)
|
||||
if (GetStatus() == STATUS_PLAYER)
|
||||
fTractionLoss *= 2.6F;
|
||||
else
|
||||
fTractionLoss *= 5.0F;
|
||||
|
|
@ -3906,7 +3906,7 @@ void CVehicle::ProcessBoatControl(tBoatHandlingData* boatHandling, float* fLastW
|
|||
CPhysical::ApplyMoveForce(right * mult);
|
||||
}
|
||||
|
||||
if (m_nStatus == eEntityStatus::STATUS_PLAYER && pad->GetHandBrake()) {
|
||||
if (GetStatus() == STATUS_PLAYER && pad->GetHandBrake()) {
|
||||
auto fDirDotProd = DotProduct(m_vecMoveSpeed, GetForward());
|
||||
if (fDirDotProd > 0.0F) {
|
||||
auto fMoveForceMult = fDirDotProd * m_pHandlingData->m_fSuspensionLowerLimit * CTimer::GetTimeStep() * fImmersionDepth * m_fMass * -0.1F;
|
||||
|
|
@ -4362,7 +4362,7 @@ void CVehicle::DoHeadLightReflectionSingle(CMatrix& lightMat, bool bRight) {
|
|||
}
|
||||
const auto lightFwd2D = CVector2D(lightMat.GetForward()).Normalized();
|
||||
const auto lightRight2D = CVector2D(lightMat.GetRight()).Normalized();
|
||||
const auto lightSize = (IsBike() || GetModelID() == MODEL_QUAD)
|
||||
const auto lightSize = (IsBike() || GetModelId() == MODEL_QUAD)
|
||||
? 1.25f
|
||||
: std::fabs(vehOffset.x) * 4.0f;
|
||||
|
||||
|
|
|
|||
|
|
@ -712,7 +712,7 @@ public: // NOTSA functions
|
|||
[[nodiscard]] bool IsCreatedBy(eVehicleCreatedBy v) const { return v == m_nCreatedBy; }
|
||||
[[nodiscard]] bool IsMissionVehicle() const { return m_nCreatedBy == MISSION_VEHICLE; }
|
||||
|
||||
bool CanUpdateHornCounter() { return m_nAlarmState == 0 || m_nAlarmState == -1 || m_nStatus == STATUS_WRECKED; }
|
||||
bool CanUpdateHornCounter() { return m_nAlarmState == 0 || m_nAlarmState == -1 || m_info.m_nStatus == STATUS_WRECKED; }
|
||||
|
||||
CPlane* AsPlane() { return reinterpret_cast<CPlane*>(this); }
|
||||
CHeli* AsHeli() { return reinterpret_cast<CHeli*>(this); }
|
||||
|
|
|
|||
|
|
@ -327,7 +327,7 @@ bool CEntryExit::TransitionFinished(CPed* ped) {
|
|||
const auto spawnPos = ms_spawnPoint->m_vecExitPos;
|
||||
|
||||
if (const auto entity = ped->GetEntityThatThisPedIsHolding()) {
|
||||
entity->m_nAreaCode = (eAreaCodes)ms_spawnPoint->m_nArea;
|
||||
entity->m_AreaCode = (eAreaCodes)ms_spawnPoint->m_nArea;
|
||||
}
|
||||
|
||||
const auto DisplayEnExName = [this]{
|
||||
|
|
@ -409,9 +409,9 @@ bool CEntryExit::TransitionFinished(CPed* ped) {
|
|||
}
|
||||
|
||||
// ms_exitEnterState == 3
|
||||
ped->m_nAreaCode = (eAreaCodes)CGame::currArea;
|
||||
ped->m_AreaCode = (eAreaCodes)CGame::currArea;
|
||||
if (ped->m_pVehicle && ped->bInVehicle) {
|
||||
ped->m_pVehicle->m_nAreaCode = (eAreaCodes)CGame::currArea;
|
||||
ped->m_pVehicle->m_AreaCode = (eAreaCodes)CGame::currArea;
|
||||
}
|
||||
ped->m_pEnex = CGame::CanSeeOutSideFromCurrArea() ? nullptr : this; // Inverted
|
||||
|
||||
|
|
@ -610,7 +610,7 @@ void CEntryExit::WarpGangWithPlayer(CPlayerPed* player) {
|
|||
// Make the member be heading towards the player
|
||||
mem->m_fCurrentRotation = mem->m_fAimingRotation = memHeading;
|
||||
mem->SetHeading(memHeading);
|
||||
mem->m_nAreaCode = player->m_nAreaCode;
|
||||
mem->SetAreaCode(player->GetAreaCode());
|
||||
mem->m_pEnex = player->m_pEnex;
|
||||
}
|
||||
}
|
||||
|
|
@ -618,9 +618,18 @@ void CEntryExit::WarpGangWithPlayer(CPlayerPed* player) {
|
|||
// 0x43E990
|
||||
void CEntryExit::ProcessStealableObjects(CPed* ped) {
|
||||
const auto helde = ped->GetEntityThatThisPedIsHolding();
|
||||
if (!helde || !helde->IsObject() || !helde->AsObject()->objectFlags.bIsLiftable) {
|
||||
if (!helde) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!helde->GetIsTypeObject()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!helde->AsObject()->objectFlags.bIsLiftable) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto heldobj = helde->AsObject();
|
||||
switch (heldobj->m_nObjectType) {
|
||||
case OBJECT_MISSION:
|
||||
|
|
@ -637,5 +646,5 @@ void CEntryExit::ProcessStealableObjects(CPed* ped) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
heldobj->m_nAreaCode = ms_spawnPoint->GetArea();
|
||||
heldobj->SetAreaCode(ms_spawnPoint->GetArea());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -345,7 +345,7 @@ int32 CEntryExitManager::GetEntryExitIndex(const char* name, uint16 enabledFlags
|
|||
// 0x43ED80
|
||||
void CEntryExitManager::ResetAreaCodeForVisibleObjects() {
|
||||
while (ms_numVisibleEntities) {
|
||||
ms_visibleEntityList[--ms_numVisibleEntities]->m_nAreaCode = (eAreaCodes)ms_oldAreaCode;
|
||||
ms_visibleEntityList[--ms_numVisibleEntities]->SetAreaCode((eAreaCodes)ms_oldAreaCode);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -359,9 +359,9 @@ void CEntryExitManager::SetAreaCodeForVisibleObjects() {
|
|||
const auto playerPed{ FindPlayerPed() };
|
||||
|
||||
for (auto&& entity : std::span{ objsInFrustum, (size_t)numObjsInFrustum }) {
|
||||
if (entity->m_nAreaCode == CGame::currArea && entity != playerPed) {
|
||||
if (entity->GetAreaCode() == CGame::currArea && entity != playerPed) {
|
||||
ms_visibleEntityList[ms_numVisibleEntities++] = entity;
|
||||
entity->m_nAreaCode = AREA_CODE_13;
|
||||
entity->SetAreaCode(AREA_CODE_13);
|
||||
|
||||
if (ms_numVisibleEntities >= 32) {
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ void CEscalator::Update() {
|
|||
obj->GetMatrix() = m_Rotation;
|
||||
obj->SetPosn(beg + dir * t);
|
||||
obj->GetMoveSpeed() = (i < m_NumIntermediatePlanes ? -dir : dir) * 0.016f * (m_MoveDown ? -1.0f : 1.0f);
|
||||
obj->UpdateRW();
|
||||
obj->UpdateRwMatrix();
|
||||
obj->UpdateRwFrame();
|
||||
obj->RemoveAndAdd();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,13 +51,13 @@ bool CEventAreaCodes::AffectsPed(CPed* ped)
|
|||
if (m_ped->GetIntelligence()->FindTaskByType(TASK_COMPLEX_GOTO_DOOR_AND_OPEN))
|
||||
return true;
|
||||
if (ped->m_pContactEntity && m_ped->m_pContactEntity) {
|
||||
if (ped->m_pContactEntity->m_nAreaCode == m_ped->m_pContactEntity->m_nAreaCode)
|
||||
if (ped->m_pContactEntity->GetAreaCode() == m_ped->m_pContactEntity->GetAreaCode())
|
||||
return false;
|
||||
}
|
||||
if (m_ped->IsAlive()
|
||||
&& ped->IsAlive()
|
||||
&& (!ped->m_pContactEntity || ped->m_pContactEntity->m_nAreaCode != AREA_CODE_13)
|
||||
&& (!m_ped->m_pContactEntity || m_ped->m_pContactEntity->m_nAreaCode != AREA_CODE_13))
|
||||
&& (!ped->m_pContactEntity || ped->m_pContactEntity->GetAreaCode() != AREA_CODE_13)
|
||||
&& (!m_ped->m_pContactEntity || m_ped->m_pContactEntity->GetAreaCode() != AREA_CODE_13))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
@ -71,4 +71,4 @@ bool CEventAreaCodes::TakesPriorityOver(const CEvent& refEvent)
|
|||
if (CEventHandler::IsTemporaryEvent(refEvent))
|
||||
return true;
|
||||
return CEvent::TakesPriorityOver(refEvent);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ bool CEventAttractor::AffectsPed(CPed* ped) {
|
|||
|| GetEventType() != EVENT_ATTRACTOR
|
||||
|| !FindPlayerWanted()->m_nWantedLevel
|
||||
&& m_2dEffect->m_nAttractorType == PED_ATTRACTOR_TRIGGER_SCRIPT
|
||||
&& CPopulation::PedMICanBeCreatedAtThisAttractor(ped->GetModelID(), m_2dEffect->m_szScriptName))
|
||||
&& CPopulation::PedMICanBeCreatedAtThisAttractor(ped->GetModelId(), m_2dEffect->m_szScriptName))
|
||||
{
|
||||
CTask* activeTask = ped->GetTaskManager().GetActiveTask();
|
||||
if (!activeTask
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ bool CEventDamage::AffectsPed(CPed* ped) {
|
|||
|
||||
if (ped == FindPlayerPed()) {
|
||||
if (m_pSourceEntity) {
|
||||
if (m_pSourceEntity->IsPed() && pedSourceEntity->m_nPedType == PED_TYPE_GANG2 && m_weaponType >= WEAPON_GRENADE) {
|
||||
if (m_pSourceEntity->GetIsTypePed() && pedSourceEntity->m_nPedType == PED_TYPE_GANG2 && m_weaponType >= WEAPON_GRENADE) {
|
||||
const auto task = pedSourceEntity->GetTaskManager().Find<CTaskComplexKillPedOnFoot>();
|
||||
if (!task || task->m_target != ped){
|
||||
return false;
|
||||
|
|
@ -117,7 +117,7 @@ bool CEventDamage::AffectsPed(CPed* ped) {
|
|||
if (m_weaponType == WEAPON_PISTOL_SILENCED) {
|
||||
if (!m_pSourceEntity)
|
||||
return false;
|
||||
if (!m_pSourceEntity->IsPed())
|
||||
if (!m_pSourceEntity->GetIsTypePed())
|
||||
return false;
|
||||
if (!m_bWitnessedInVehicle)
|
||||
return false;
|
||||
|
|
@ -125,7 +125,7 @@ bool CEventDamage::AffectsPed(CPed* ped) {
|
|||
return false;
|
||||
}
|
||||
if (m_pSourceEntity) {
|
||||
if (m_pSourceEntity->IsPed()) {
|
||||
if (m_pSourceEntity->GetIsTypePed()) {
|
||||
CTask* activeTask = pedSourceEntity->GetTaskManager().GetActiveTask();
|
||||
if (activeTask && activeTask->GetTaskType() == TASK_SIMPLE_STEALTH_KILL) {
|
||||
CVector vecDirection = m_pSourceEntity->GetPosition() - ped->GetPosition();
|
||||
|
|
@ -140,7 +140,7 @@ bool CEventDamage::AffectsPed(CPed* ped) {
|
|||
}
|
||||
}
|
||||
if (m_pSourceEntity) {
|
||||
if ( m_pSourceEntity->IsPed()
|
||||
if ( m_pSourceEntity->GetIsTypePed()
|
||||
&& !pedSourceEntity->IsPlayer()
|
||||
&& CPedGroups::AreInSameGroup(ped, pedSourceEntity)
|
||||
&& m_weaponType != WEAPON_EXPLOSION
|
||||
|
|
@ -166,7 +166,7 @@ bool CEventDamage::AffectsPedGroup(CPedGroup* pedGroup) {
|
|||
if (!m_pSourceEntity)
|
||||
return true;
|
||||
|
||||
if (!m_pSourceEntity->IsPed())
|
||||
if (!m_pSourceEntity->GetIsTypePed())
|
||||
return true;
|
||||
|
||||
auto* ped = m_pSourceEntity->AsPed();
|
||||
|
|
@ -197,9 +197,9 @@ bool CEventDamage::IsCriminalEvent() {
|
|||
auto* vehicle = m_pSourceEntity->AsVehicle();
|
||||
auto* ped = m_pSourceEntity->AsPed();
|
||||
|
||||
return ( m_pSourceEntity->IsPed()
|
||||
return ( m_pSourceEntity->GetIsTypePed()
|
||||
&& ped->IsPlayer()
|
||||
|| m_pSourceEntity->IsVehicle()
|
||||
|| m_pSourceEntity->GetIsTypeVehicle()
|
||||
&& vehicle->m_pDriver == FindPlayerPed()
|
||||
);
|
||||
}
|
||||
|
|
@ -232,7 +232,7 @@ void CEventDamage::ReportCriminalEvent(CPed* ped) {
|
|||
|
||||
// 0x4ADA70
|
||||
CEntity* CEventDamage::GetSourceEntity() const {
|
||||
if (m_pSourceEntity && m_pSourceEntity->IsVehicle()) {
|
||||
if (m_pSourceEntity && m_pSourceEntity->GetIsTypeVehicle()) {
|
||||
auto* vehicle = m_pSourceEntity->AsVehicle();
|
||||
if (vehicle->m_pDriver)
|
||||
return vehicle->m_pDriver;
|
||||
|
|
@ -249,7 +249,7 @@ bool CEventDamage::TakesPriorityOver(const CEvent& refEvent) {
|
|||
}
|
||||
|
||||
auto* ped = m_pSourceEntity->AsPed();
|
||||
if (m_pSourceEntity && m_pSourceEntity->IsPed() && ped->IsPlayer() && refEvent.GetEventType() == EVENT_DAMAGE) {
|
||||
if (m_pSourceEntity && m_pSourceEntity->GetIsTypePed() && ped->IsPlayer() && refEvent.GetEventType() == EVENT_DAMAGE) {
|
||||
if (refEvent.GetSourceEntity() == m_pSourceEntity && (!m_damageResponse.m_bHealthZero || !m_bAddToEventGroup))
|
||||
return CEvent::TakesPriorityOver(refEvent);
|
||||
return true;
|
||||
|
|
@ -424,7 +424,7 @@ void CEventDamage::ComputeDeathAnim(CPed* ped, bool bMakeActiveTaskAbortable) {
|
|||
{
|
||||
auto* pedSourceEntity = m_pSourceEntity->AsPed();
|
||||
CTaskSimpleFight* taskFight = nullptr;
|
||||
if (m_pSourceEntity && m_pSourceEntity->IsPed())
|
||||
if (m_pSourceEntity && m_pSourceEntity->GetIsTypePed())
|
||||
taskFight = pedSourceEntity->m_pIntelligence->GetTaskFighting();
|
||||
|
||||
const auto bonePosition = ped->GetBonePosition(BONE_HEAD, false);
|
||||
|
|
@ -574,7 +574,7 @@ void CEventDamage::ComputeDeathAnim(CPed* ped, bool bMakeActiveTaskAbortable) {
|
|||
bKnockOutAnim = true;
|
||||
}
|
||||
if (m_pSourceEntity) {
|
||||
if (m_pSourceEntity->IsPed() && pedSourceEntity->m_pPlayerData) {
|
||||
if (m_pSourceEntity->GetIsTypePed() && pedSourceEntity->m_pPlayerData) {
|
||||
if (pedSourceEntity->m_pPlayerData->m_bAdrenaline)
|
||||
fForceFactor = fForceFactor * 5.0f;
|
||||
else
|
||||
|
|
@ -660,7 +660,7 @@ void CEventDamage::ComputeDamageAnim(CPed* ped, bool bMakeActiveTaskAbortable) {
|
|||
float fForceFactor = 0.0f;
|
||||
CTaskSimpleFight* sourceEntityTaskFight = nullptr;
|
||||
CTaskSimpleUseGun* sourceEntityTaskUseGun = nullptr;
|
||||
if (m_pSourceEntity && m_pSourceEntity->IsPed()) {
|
||||
if (m_pSourceEntity && m_pSourceEntity->GetIsTypePed()) {
|
||||
auto* pedSourceEntity = m_pSourceEntity->AsPed();
|
||||
sourceEntityTaskFight = pedSourceEntity->m_pIntelligence->GetTaskFighting();
|
||||
if (!sourceEntityTaskFight)
|
||||
|
|
@ -700,7 +700,7 @@ void CEventDamage::ComputeDamageAnim(CPed* ped, bool bMakeActiveTaskAbortable) {
|
|||
}
|
||||
if (ped->bUpperBodyDamageAnimsOnly || ped->bIsDucking || ped->m_pAttachedTo || !bMultiplyForceWithPedStrength || !m_pSourceEntity) {
|
||||
if (m_weaponType >= WEAPON_CHAINSAW || ped->m_fHealth >= fHealthThreshold) {
|
||||
if (m_weaponType != WEAPON_FALL || !m_pSourceEntity || !m_pSourceEntity->IsObject()) {
|
||||
if (m_weaponType != WEAPON_FALL || !m_pSourceEntity || !m_pSourceEntity->GetIsTypeObject()) {
|
||||
if (sourceEntityTaskFight && sourceEntityTaskFight->m_nCurrentMove == FIGHT_ATTACK_FIGHTIDLE && !ped->IsPlayer() && ped->m_nMoveState > PEDMOVE_WALK)
|
||||
m_bFallDown = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ bool CEventDanger::AffectsPed(CPed* ped) {
|
|||
|
||||
// 0x4B54E0
|
||||
bool CEventDanger::AffectsPedGroup(CPedGroup* pedGroup) {
|
||||
if (GetSourceEntity() && GetSourceEntity()->IsPed()) {
|
||||
if (GetSourceEntity() && GetSourceEntity()->GetIsTypePed()) {
|
||||
CPed* leader = pedGroup->GetMembership().GetLeader();
|
||||
if (leader) {
|
||||
CVector2D distance = leader->GetPosition() - m_dangerFrom->GetPosition();
|
||||
|
|
@ -49,7 +49,7 @@ bool CEventDanger::AffectsPedGroup(CPedGroup* pedGroup) {
|
|||
|
||||
// 0x4B2700
|
||||
CEntity* CEventDanger::GetSourceEntity() const {
|
||||
if (m_dangerFrom && !m_dangerFrom->IsPed() && m_dangerFrom->IsVehicle()) {
|
||||
if (m_dangerFrom && !m_dangerFrom->GetIsTypePed() && m_dangerFrom->GetIsTypeVehicle()) {
|
||||
CVehicle* vehicle = m_dangerFrom->AsVehicle();
|
||||
if (vehicle->m_pDriver)
|
||||
return vehicle->m_pDriver;
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ void CEventEditableResponse::InformGroup(CPed* ped) {
|
|||
void CEventEditableResponse::TriggerLookAt(CPed* ped) const {
|
||||
CEntity* sourceEntity = GetSourceEntity();
|
||||
if (sourceEntity) {
|
||||
if (sourceEntity->IsPed()) {
|
||||
if (sourceEntity->GetIsTypePed()) {
|
||||
g_ikChainMan.LookAt("CEventEditableResponse", ped, sourceEntity->AsPed(), 2'000, BONE_HEAD, nullptr, true, 0.25f, 500, 3, false);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ bool CEventGunShot::AffectsPed(CPed* ped) {
|
|||
if (!m_firedBy)
|
||||
return false;
|
||||
|
||||
if (m_firedBy->IsPed() && CPedGroups::AreInSameGroup(ped, m_firedBy->AsPed()))
|
||||
if (m_firedBy->GetIsTypePed() && CPedGroups::AreInSameGroup(ped, m_firedBy->AsPed()))
|
||||
return false;
|
||||
|
||||
if (!ped->IsInVehicleThatHasADriver()) {
|
||||
|
|
@ -74,7 +74,7 @@ bool CEventGunShot::AffectsPed(CPed* ped) {
|
|||
|
||||
// 0x4AC810
|
||||
bool CEventGunShot::IsCriminalEvent() {
|
||||
return m_firedBy && m_firedBy->IsPed() && m_firedBy->AsPed()->IsPlayer();
|
||||
return m_firedBy && m_firedBy->GetIsTypePed() && m_firedBy->AsPed()->IsPlayer();
|
||||
}
|
||||
|
||||
// 0x4AC780
|
||||
|
|
@ -83,12 +83,12 @@ bool CEventGunShot::TakesPriorityOver(const CEvent& refEvent) {
|
|||
bool bIsPlayer = false;
|
||||
bool otherPedIsPlayer = false;
|
||||
const auto refEventGunShot = static_cast<const CEventGunShot*>(&refEvent);
|
||||
if (m_firedBy && m_firedBy->AsPed()->IsPed()) {
|
||||
if (m_firedBy && m_firedBy->AsPed()->GetIsTypePed()) {
|
||||
bIsPlayer = m_firedBy->AsPed()->IsPlayer();
|
||||
}
|
||||
|
||||
CPed* otherPed = refEventGunShot->m_firedBy->AsPed();
|
||||
if (otherPed && otherPed->IsPed())
|
||||
if (otherPed && otherPed->GetIsTypePed())
|
||||
otherPedIsPlayer = otherPed->IsPlayer();
|
||||
|
||||
return bIsPlayer && !otherPedIsPlayer;
|
||||
|
|
|
|||
|
|
@ -423,13 +423,13 @@ void CEventHandler::RegisterKill(const CPed* ped, const CEntity* inflictedBy, eW
|
|||
if (!ped) {
|
||||
return;
|
||||
}
|
||||
if (inflictedBy && inflictedBy->IsPed() && inflictedBy->AsPed()->IsPlayer() && inflictedBy != ped) {
|
||||
if (inflictedBy && inflictedBy->GetIsTypePed() && inflictedBy->AsPed()->IsPlayer() && inflictedBy != ped) {
|
||||
const auto pi = &FindPlayerInfo();
|
||||
pi->m_nHavocCaused += 10;
|
||||
pi->m_fCurrentChaseValue += 5.f;
|
||||
CDarkel::RegisterKillByPlayer(*ped, weaponUsed, wasHeadShot, inflictedBy->AsPed()->m_nPedType);
|
||||
CPedGroups::RegisterKillByPlayer();
|
||||
} else if (inflictedBy && inflictedBy->IsVehicle() && inflictedBy == FindPlayerVehicle()) {
|
||||
} else if (inflictedBy && inflictedBy->GetIsTypeVehicle() && inflictedBy == FindPlayerVehicle()) {
|
||||
CStats::IncrementStat(STAT_PEOPLE_YOUVE_WASTED);
|
||||
} else {
|
||||
CDarkel::RegisterKillNotByPlayer(ped);
|
||||
|
|
@ -702,7 +702,7 @@ void CEventHandler::ComputeBuildingCollisionResponse(CEventBuildingCollision* e,
|
|||
}
|
||||
}
|
||||
|
||||
if (targetEntity->IsPed()) {
|
||||
if (targetEntity->GetIsTypePed()) {
|
||||
if (!g_ikChainMan.IsLooking(m_Ped)) { // 0x4BF77F
|
||||
g_ikChainMan.LookAt(
|
||||
"CompBldgCollResp",
|
||||
|
|
@ -852,7 +852,7 @@ void CEventHandler::ComputeDamageResponse(CEventDamage* e, CTask* tactive, CTask
|
|||
if (!ce || ce->GetEventType() != EVENT_DAMAGE || !e->IsSameEventForAI(static_cast<CEventDamage&>(*ce))) {
|
||||
if (!m_Ped->GetTaskManager().Has<TASK_COMPLEX_REACT_TO_ATTACK>() && !m_Ped->IsPlayer()) {
|
||||
if (const auto esrc = e->GetSourceEntity()) {
|
||||
if (esrc->IsPed()) {
|
||||
if (esrc->GetIsTypePed()) {
|
||||
ComputePersonalityResponseToDamage(e, esrc->AsPed());
|
||||
}
|
||||
}
|
||||
|
|
@ -879,7 +879,7 @@ void CEventHandler::ComputeDamageResponse(CEventDamage* e, CTask* tactive, CTask
|
|||
if (const auto v = m_Ped->GetVehicleIfInOne()) {
|
||||
if (v->IsBike() || v->IsSubQuad()) {
|
||||
if (!e->m_bFallDown && !e->HasKilledPed()) {
|
||||
assert(e->m_pSourceEntity->IsPed());
|
||||
assert(e->m_pSourceEntity->GetIsTypePed());
|
||||
ComputePersonalityResponseToDamage(e, e->m_pSourceEntity->AsPed());
|
||||
} else {
|
||||
ComputeKnockOffBikeResponse(e, tactive, tsimplest); // 0x4C02DE
|
||||
|
|
@ -946,7 +946,7 @@ void CEventHandler::ComputeDamageResponse(CEventDamage* e, CTask* tactive, CTask
|
|||
WEAPON_COUNTRYRIFLE,
|
||||
WEAPON_MINIGUN
|
||||
}, e->m_weaponType)) {
|
||||
if (e->m_pSourceEntity->IsPed() && e->m_pSourceEntity->AsPed()->IsCreatedByMission()) {
|
||||
if (e->m_pSourceEntity->GetIsTypePed() && e->m_pSourceEntity->AsPed()->IsCreatedByMission()) {
|
||||
int32 fallToDeathDir;
|
||||
bool bFallToDeathOverRailing;
|
||||
bool bFallToDeath = CTaskComplexFallToDeath::CalcFall(m_Ped, fallToDeathDir, bFallToDeathOverRailing);
|
||||
|
|
@ -1033,7 +1033,7 @@ void CEventHandler::ComputeDamageResponse(CEventDamage* e, CTask* tactive, CTask
|
|||
return DoComputeDamageAndResponseForPersonality();
|
||||
}
|
||||
|
||||
const auto eventSrcPed = e->m_pSourceEntity->IsPed()
|
||||
const auto eventSrcPed = e->m_pSourceEntity->GetIsTypePed()
|
||||
? e->m_pSourceEntity->AsPed()
|
||||
: nullptr;
|
||||
|
||||
|
|
@ -1116,9 +1116,9 @@ void CEventHandler::ComputeDamageResponse(CEventDamage* e, CTask* tactive, CTask
|
|||
e->GetAnimGroup(),
|
||||
m_Ped->IsPlayer() ? 500 : 1000
|
||||
};
|
||||
const auto knockedOverByVeh = e->m_pSourceEntity->IsVehicle()
|
||||
const auto knockedOverByVeh = e->m_pSourceEntity->GetIsTypeVehicle()
|
||||
? e->m_pSourceEntity->AsVehicle()
|
||||
: e->m_pSourceEntity->IsPed()
|
||||
: e->m_pSourceEntity->GetIsTypePed()
|
||||
? e->m_pSourceEntity->AsPed()->GetVehicleIfInOne()
|
||||
: nullptr;
|
||||
if (knockedOverByVeh) {
|
||||
|
|
@ -2123,7 +2123,7 @@ void CEventHandler::ComputeReallyLowHealthResponse(CEventHealthReallyLow* e, CTa
|
|||
void CEventHandler::ComputeReviveResponse(CEventRevived* e, CTask* tactive, CTask* tsimplest) {
|
||||
std::tie(m_EventResponseTask, m_SayTask) = [&]() -> std::pair<CTask*, CTask*> {
|
||||
m_Ped->m_fHealth = 100.f;
|
||||
m_Ped->m_bUsesCollision = true;
|
||||
m_Ped->SetUsesCollision(true);
|
||||
m_Ped->bKnockedUpIntoAir = false;
|
||||
m_Ped->bKnockedOffBike = false;
|
||||
m_Ped->bKilledByStealth = false;
|
||||
|
|
@ -2252,7 +2252,7 @@ void CEventHandler::ComputeShotFiredResponse(CEventGunShot* e, CTask* tactive, C
|
|||
if (!e->m_firedBy) {
|
||||
return nullptr;
|
||||
}
|
||||
const auto firedByPed = e->m_firedBy->IsPed()
|
||||
const auto firedByPed = e->m_firedBy->GetIsTypePed()
|
||||
? e->m_firedBy->AsPed()
|
||||
: nullptr;
|
||||
switch (e->m_TaskId) {
|
||||
|
|
|
|||
|
|
@ -33,11 +33,11 @@ bool CEventInAir::AffectsPed(CPed* ped)
|
|||
CTask* simplestActiveTask = ped->GetTaskManager().GetSimplestActiveTask();
|
||||
if (simplestActiveTask && simplestActiveTask->GetTaskType() == TASK_SIMPLE_FALL ||
|
||||
ped->m_pDamageEntity ||
|
||||
!ped->m_bUsesCollision ||
|
||||
!ped->GetUsesCollision() ||
|
||||
ped->m_pAttachedTo ||
|
||||
!CPedGeometryAnalyser::IsInAir(*ped)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
return ped->IsAlive();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ CEventKnockOffBike* CEventKnockOffBike::Constructor()
|
|||
bool CEventKnockOffBike::AffectsPed(CPed* ped)
|
||||
{
|
||||
if (ped->IsAlive()) {
|
||||
if (m_vehicle && m_vehicle->m_nStatus == STATUS_GHOST)
|
||||
if (m_vehicle && m_vehicle->GetStatus() == STATUS_GHOST)
|
||||
return false;
|
||||
if (ped->CantBeKnockedOffBike && !ped->bHasBeenRendered && !m_forceKnockOff)
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -38,9 +38,9 @@ bool CEventPlayerCommandToGroup::AffectsPedGroup(CPedGroup* pedGroup)
|
|||
if (leader && leader->IsPlayer()) {
|
||||
for (int32 i = 0; i < TOTAL_PED_GROUP_FOLLOWERS; i++) {
|
||||
CPed* member = pedGroup->GetMembership().GetMember(i);
|
||||
if (member && member->m_nAreaCode != leader->m_nAreaCode)
|
||||
if (member && member->GetAreaCode() != leader->GetAreaCode())
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ bool CEventVehicleDamage::AffectsPed(CPed* ped)
|
|||
bool CEventVehicleDamage::IsCriminalEvent()
|
||||
{
|
||||
if (m_attacker) {
|
||||
switch (m_attacker->m_nType) {
|
||||
switch (m_attacker->GetType()) {
|
||||
case ENTITY_TYPE_PED:
|
||||
return m_attacker->AsPed()->IsPlayer();
|
||||
case ENTITY_TYPE_VEHICLE:
|
||||
|
|
@ -75,10 +75,10 @@ void CEventVehicleDamage::ReportCriminalEvent(CPed* ped)
|
|||
// 0x4B1A70
|
||||
CEntity* CEventVehicleDamage::GetSourceEntity() const
|
||||
{
|
||||
if (m_attacker && m_attacker->IsVehicle()) {
|
||||
if (m_attacker && m_attacker->GetIsTypeVehicle()) {
|
||||
CVehicle* vehicle = m_attacker->AsVehicle();
|
||||
if (vehicle->m_pDriver)
|
||||
return vehicle->m_pDriver;
|
||||
}
|
||||
return m_attacker;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ CTaskAllocator* CGroupEventHandler::ComputeStareResponse(CPedGroup* pg, CPed* st
|
|||
|
||||
// 0x5FC070
|
||||
CTaskAllocator* CGroupEventHandler::ComputeResponseVehicleDamage(const CEventVehicleDamage& e, CPedGroup* pg, CPed* originator) {
|
||||
if (!e.m_attacker || !e.m_attacker->IsPed()) {
|
||||
if (!e.m_attacker || !e.m_attacker->GetIsTypePed()) {
|
||||
return nullptr;
|
||||
}
|
||||
const auto threat = e.m_attacker->AsPed();
|
||||
|
|
@ -167,7 +167,7 @@ CTaskAllocator* CGroupEventHandler::ComputeResponseVehicleDamage(const CEventVeh
|
|||
|
||||
// 0x5FBDF0
|
||||
CTaskAllocator* CGroupEventHandler::ComputeResponseShotFired(const CEventGunShot& e, CPedGroup* pg, CPed* originator) {
|
||||
if (!e.m_firedBy || !e.m_firedBy->IsPed()) {
|
||||
if (!e.m_firedBy || !e.m_firedBy->GetIsTypePed()) {
|
||||
return nullptr;
|
||||
}
|
||||
const auto threat = e.m_firedBy->AsPed();
|
||||
|
|
@ -372,7 +372,7 @@ CTaskAllocator* CGroupEventHandler::ComputeResponseLeaderEnterExit(const CEventL
|
|||
}
|
||||
CTaskSimpleWaitUntilLeaderAreaCodesMatch task{leader};
|
||||
if (task.ProcessPed(m)) {
|
||||
m->m_bUsesCollision = true;
|
||||
m->SetUsesCollision(true);
|
||||
} else {
|
||||
pg->GetIntelligence().SetEventResponseTask(m, task);
|
||||
}
|
||||
|
|
@ -383,7 +383,7 @@ CTaskAllocator* CGroupEventHandler::ComputeResponseLeaderEnterExit(const CEventL
|
|||
// 0x5FBD10
|
||||
CTaskAllocator* CGroupEventHandler::ComputeResponseGunAimedAt(const CEventGunAimedAt& e, CPedGroup* pg, CPed* originator) {
|
||||
const auto src = e.GetSourceEntity();
|
||||
if (!src || !src->IsPed()) {
|
||||
if (!src || !src->GetIsTypePed()) {
|
||||
return nullptr;
|
||||
}
|
||||
const auto srcPed = src->AsPed();
|
||||
|
|
@ -422,7 +422,7 @@ CTaskAllocator* CGroupEventHandler::ComputeResponseDraggedOutCar(const CEventDra
|
|||
if (!e.m_CarJacker) {
|
||||
return nullptr;
|
||||
}
|
||||
assert(e.m_CarJacker->IsPed()); // Original code just `returns nullptr` in this case, but but since `m_CarJacker` is typed as `CPed*` it *should* be at least a `CPed*`
|
||||
assert(e.m_CarJacker->GetIsTypePed()); // Original code just `returns nullptr` in this case, but but since `m_CarJacker` is typed as `CPed*` it *should* be at least a `CPed*`
|
||||
switch (e.m_TaskId) {
|
||||
case TASK_GROUP_KILL_THREATS_BASIC:
|
||||
return e.m_CarJacker->IsPlayer() && originator && originator->GetIntelligence()->Respects(e.m_CarJacker) && !pg->m_bIsMissionGroup
|
||||
|
|
@ -438,7 +438,7 @@ CTaskAllocator* CGroupEventHandler::ComputeResponseDraggedOutCar(const CEventDra
|
|||
// 0x5FB540
|
||||
CTaskAllocator* CGroupEventHandler::ComputeResponseDanger(const CEventDanger& e, CPedGroup* pg, CPed* originator) {
|
||||
const auto esrc = e.GetSourceEntity();
|
||||
if (!esrc || !esrc->IsPed()) {
|
||||
if (!esrc || !esrc->GetIsTypePed()) {
|
||||
return nullptr;
|
||||
}
|
||||
switch (e.m_TaskId) {
|
||||
|
|
@ -450,7 +450,7 @@ CTaskAllocator* CGroupEventHandler::ComputeResponseDanger(const CEventDanger& e,
|
|||
// 0x5FBF50
|
||||
CTaskAllocator* CGroupEventHandler::ComputeResponseDamage(const CEventDamage& e, CPedGroup* pg, CPed* originator) {
|
||||
const auto src = e.GetSourceEntity();
|
||||
if (!src || !src->IsPed()) {
|
||||
if (!src || !src->GetIsTypePed()) {
|
||||
return nullptr;
|
||||
}
|
||||
const auto srcPed = src->AsPed();
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ void CExplosion::AddExplosion(CEntity* victim, CEntity* creator, eExplosionType
|
|||
const auto CreateAndPlayFxWithSound = [&](const char* name, float volume = .0f) {
|
||||
FxSystem_c* fx{nullptr};
|
||||
if (exp->m_pVictim) {
|
||||
if (exp->m_pVictim->m_pRwObject) {
|
||||
if (exp->m_pVictim->GetRwObject()) {
|
||||
if (RwMatrix* matrix = exp->m_pVictim->GetModellingMatrix()) {
|
||||
CVector expToVictimDir = pos - exp->m_pVictim->GetPosition();
|
||||
fx = g_fxMan.CreateFxSystem(name, expToVictimDir, matrix, false);
|
||||
|
|
@ -384,7 +384,7 @@ void CExplosion::AddExplosion(CEntity* victim, CEntity* creator, eExplosionType
|
|||
gFireManager.StartFire(firePos, 0.8f, 0, exp->m_pCreator, (uint32)(CGeneral::GetRandomNumberInRange(5'600.0f, 12'600.0f) * 0.4f), 3, 1);
|
||||
}
|
||||
}
|
||||
if (creator && creator->IsPed() && creator->AsPed()->IsPlayer()) {
|
||||
if (creator && creator->GetIsTypePed() && creator->AsPed()->IsPlayer()) {
|
||||
CStats::IncrementStat(eStats::STAT_FIRES_STARTED, 1.0f);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
#include "PedStats.h"
|
||||
#include "LoadingScreen.h"
|
||||
#include "Garages.h"
|
||||
#include "Glass.h"
|
||||
|
||||
#define CHECK_ARG_COUNT(_l, _expected, _n) \
|
||||
do { \
|
||||
|
|
@ -1023,14 +1024,14 @@ CEntity* CFileLoader::LoadObjectInstance(CFileObjectInstance* objInstance, const
|
|||
newEntity->m_bDontCastShadowsOn = true;
|
||||
|
||||
if (mi->m_fDrawDistance < 2.0F)
|
||||
newEntity->m_bIsVisible = false;
|
||||
newEntity->SetIsVisible(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
newEntity = new CDummyObject();
|
||||
newEntity->SetModelIndexNoCreate(objInstance->m_nModelId);
|
||||
if (IsGlassModel(newEntity) && !CModelInfo::GetModelInfo(newEntity->m_nModelIndex)->IsGlassType2()) {
|
||||
newEntity->m_bIsVisible = false;
|
||||
if (CGlass::IsObjectGlass(newEntity) && !CModelInfo::GetModelInfo(newEntity->m_nModelIndex)->IsGlassType2()) {
|
||||
newEntity->SetIsVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1057,9 +1058,9 @@ CEntity* CFileLoader::LoadObjectInstance(CFileObjectInstance* objInstance, const
|
|||
newEntity->m_bUnderwater |= objInstance->m_bUnderwater;
|
||||
newEntity->m_bTunnel |= objInstance->m_bTunnel;
|
||||
newEntity->m_bTunnelTransition |= objInstance->m_bTunnelTransition;
|
||||
newEntity->m_bUnimportantStream |= objInstance->m_bRedundantStream;
|
||||
newEntity->m_nAreaCode = static_cast<eAreaCodes>(objInstance->m_nAreaCode);
|
||||
newEntity->m_nLodIndex = objInstance->m_nLodInstanceIndex;
|
||||
newEntity->SetIsUnimportantStream(objInstance->m_bRedundantStream);
|
||||
newEntity->SetAreaCode(static_cast<eAreaCodes>(objInstance->m_nAreaCode));
|
||||
newEntity->SetLodIndex(objInstance->m_nLodInstanceIndex);
|
||||
|
||||
if (objInstance->m_nModelId == ModelIndices::MI_TRAINCROSSING)
|
||||
{
|
||||
|
|
@ -1079,7 +1080,7 @@ CEntity* CFileLoader::LoadObjectInstance(CFileObjectInstance* objInstance, const
|
|||
}
|
||||
else
|
||||
{
|
||||
newEntity->m_bUsesCollision = false;
|
||||
newEntity->SetUsesCollision(false);
|
||||
}
|
||||
|
||||
if (cm->GetBoundingBox().m_vecMin.z + newEntity->GetPosition().z < 0.0f)
|
||||
|
|
@ -1954,17 +1955,18 @@ void CFileLoader::LoadZone(const char* line) {
|
|||
}
|
||||
|
||||
// 0x5B51E0
|
||||
// orig AddBuildingInstancesToWorld ?
|
||||
void LinkLods(int32 numRelatedIPLs) {
|
||||
// Link LODs
|
||||
for (auto& building : GetLoadedBuildings()) {
|
||||
const auto idx = building->m_nLodIndex;
|
||||
const auto idx = building->GetLodIndex();
|
||||
const auto lod = idx != -1
|
||||
? GetLoadedBuildings()[idx]
|
||||
: nullptr;
|
||||
if (idx != -1) {
|
||||
lod->m_nNumLodChildren++;
|
||||
lod->AddLodChildren();
|
||||
}
|
||||
building->m_pLod = lod;
|
||||
building->SetLod(lod);
|
||||
}
|
||||
|
||||
// Load related IPLs (?)
|
||||
|
|
@ -1990,15 +1992,15 @@ void LinkLods(int32 numRelatedIPLs) {
|
|||
}
|
||||
|
||||
// 0x5B5285
|
||||
if (building->m_nNumLodChildren || TheCamera.m_fLODDistMultiplier * building->GetModelInfo()->m_fDrawDistance > 300.f) {
|
||||
if (building->GetNumLodChildren() || TheCamera.m_fLODDistMultiplier * building->GetModelInfo()->m_fDrawDistance > 300.f) {
|
||||
building->SetupBigBuilding();
|
||||
}
|
||||
|
||||
// 0x5B5293 - Now handle the collision model for the building/lod
|
||||
if (const auto lod = building->m_pLod) {
|
||||
if (const auto lod = building->GetLod()) {
|
||||
const auto mi = building->GetModelInfo(),
|
||||
lodMI = lod->GetModelInfo();
|
||||
if (lod->m_nNumLodChildren == 1) {
|
||||
if (lod->GetNumLodChildren() == 1) {
|
||||
lod->m_bUnderwater |= building->m_bUnderwater;
|
||||
if (const auto cm = mi->GetColModel()) {
|
||||
if (cm != lodMI->GetColModel()) {
|
||||
|
|
@ -2009,8 +2011,8 @@ void LinkLods(int32 numRelatedIPLs) {
|
|||
} else if (mi->bDoWeOwnTheColModel) {
|
||||
mi->m_fDrawDistance = 400.f;
|
||||
} else {
|
||||
lod->m_nNumLodChildren--;
|
||||
building->m_pLod = nullptr;
|
||||
lod->RemoveLodChildren();
|
||||
building->SetLod(nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ void CFire::Start(CEntity* creator, CVector pos, uint32 nTimeToBurn, uint8 nGens
|
|||
|
||||
// see 0x53A050 CFireManager::StartFire
|
||||
void CFire::Start(CEntity* creator, CEntity* target, uint32 nTimeToBurn, uint8 nGens) {
|
||||
switch (target->m_nType) {
|
||||
switch (target->GetType()) {
|
||||
case ENTITY_TYPE_PED: {
|
||||
auto targetPed = target->AsPed();
|
||||
targetPed->m_pFire = this;
|
||||
|
|
@ -137,9 +137,9 @@ void CFire::Start(CEntity* creator, CEntity* target, uint32 nTimeToBurn, uint8 n
|
|||
m_Strength = 1.0f;
|
||||
m_Position = target->GetPosition();
|
||||
|
||||
if (target->IsPed() && target->AsPed()->IsPlayer())
|
||||
if (target->GetIsTypePed() && target->AsPed()->IsPlayer())
|
||||
m_TimeToBurn = CTimer::GetTimeInMS() + 2333;
|
||||
else if (target->IsVehicle())
|
||||
else if (target->GetIsTypeVehicle())
|
||||
m_TimeToBurn = CTimer::GetTimeInMS() + CGeneral::GetRandomNumberInRange(0, 1000) + 3000;
|
||||
else
|
||||
m_TimeToBurn = CTimer::GetTimeInMS() + CGeneral::GetRandomNumberInRange(0, 1000) + nTimeToBurn;
|
||||
|
|
@ -166,7 +166,7 @@ void CFire::Start(CVector pos, float fStrength, CEntity* target, uint8 nGens) {
|
|||
m_Position = pos;
|
||||
|
||||
if (target) {
|
||||
switch (target->m_nType) { /* Set target's `m_pFire` to `this` */
|
||||
switch (target->GetType()) { /* Set target's `m_pFire` to `this` */
|
||||
case ENTITY_TYPE_PED:
|
||||
target->AsPed()->m_pFire = this;
|
||||
break;
|
||||
|
|
@ -230,7 +230,7 @@ void CFire::Extinguish() {
|
|||
DestroyFx();
|
||||
|
||||
if (m_EntityOnFire) {
|
||||
switch (m_EntityOnFire->m_nType) {
|
||||
switch (m_EntityOnFire->GetType()) {
|
||||
case ENTITY_TYPE_PED: {
|
||||
m_EntityOnFire->AsPed()->m_pFire = nullptr;
|
||||
break;
|
||||
|
|
@ -256,7 +256,7 @@ void CFire::ProcessFire() {
|
|||
if (m_EntityOnFire) {
|
||||
m_Position = m_EntityOnFire->GetPosition();
|
||||
|
||||
switch (m_EntityOnFire->m_nType) {
|
||||
switch (m_EntityOnFire->GetType()) {
|
||||
case ENTITY_TYPE_PED: {
|
||||
auto targetPed = m_EntityOnFire->AsPed();
|
||||
|
||||
|
|
@ -309,7 +309,7 @@ void CFire::ProcessFire() {
|
|||
}
|
||||
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
if (!m_EntityOnFire || !m_EntityOnFire->IsVehicle()) {
|
||||
if (!m_EntityOnFire || !m_EntityOnFire->GetIsTypeVehicle()) {
|
||||
// Check if we can set player's ped on fire
|
||||
if (!FindPlayerVehicle()
|
||||
&& !player->m_pFire /* not already on fire */
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ CFire* CFireManager::FindNearestFire(const CVector& point, bool bCheckIsBeingExt
|
|||
if (bCheckIsBeingExtinguished && fire.IsBeingExtinguished())
|
||||
continue;
|
||||
|
||||
if (fire.GetEntityOnFire() && fire.GetEntityOnFire()->IsPed())
|
||||
if (fire.GetEntityOnFire() && fire.GetEntityOnFire()->GetIsTypePed())
|
||||
continue;
|
||||
|
||||
const float fDist2DSq = (fire.GetPosition() - point).SquaredMagnitude2D();
|
||||
|
|
@ -281,7 +281,7 @@ CFire* CFireManager::StartFire(CVector pos, float size, uint8 unused, CEntity* c
|
|||
// 0x53A050
|
||||
CFire* CFireManager::StartFire(CEntity* target, CEntity* creator, float size, uint8 unused, uint32 lifetime, int8 numGenerations) {
|
||||
/* Do few checks, and clear `m_pFire` if `target` */
|
||||
switch (target->m_nType) {
|
||||
switch (target->GetType()) {
|
||||
case ENTITY_TYPE_PED: {
|
||||
auto pedTarget = target->AsPed();
|
||||
if (!pedTarget->IsPedInControl())
|
||||
|
|
@ -327,7 +327,7 @@ int32 CFireManager::StartScriptFire(const CVector& pos, CEntity* target, float _
|
|||
fire->Extinguish();
|
||||
fire->SetIsScript(false);
|
||||
};
|
||||
switch (target->m_nType) {
|
||||
switch (target->GetType()) {
|
||||
case ENTITY_TYPE_PED: {
|
||||
auto pedTarget = target->AsPed();
|
||||
if (pedTarget->m_pFire)
|
||||
|
|
|
|||
|
|
@ -363,7 +363,7 @@ void CGameLogic::RestorePlayerStuffDuringResurrection(CPlayerPed* player, CVecto
|
|||
player->physicalFlags.bRenderScorched = false;
|
||||
player->m_fArmour = 0.0f;
|
||||
player->m_fHealth = static_cast<float>(playerInfo->m_nMaxHealth);
|
||||
player->m_bIsVisible = true;
|
||||
player->SetIsVisible(true);
|
||||
player->m_nDeathTimeMS = 0;
|
||||
player->bDoBloodyFootprints = false;
|
||||
playerData->m_nDrunkenness = 0;
|
||||
|
|
@ -398,7 +398,7 @@ void CGameLogic::RestorePlayerStuffDuringResurrection(CPlayerPed* player, CVecto
|
|||
CTheScripts::ClearSpaceForMissionEntity(posn, player);
|
||||
CWorld::ClearExcitingStuffFromArea(posn, 4000.0, 1);
|
||||
player->RestoreHeadingRate();
|
||||
player->m_nAreaCode = AREA_CODE_NORMAL_WORLD;
|
||||
player->SetAreaCode(AREA_CODE_NORMAL_WORLD);
|
||||
player->m_pEnex = 0;
|
||||
CEntryExitManager::ms_entryExitStackPosn = 0;
|
||||
CGame::currArea = AREA_CODE_NORMAL_WORLD;
|
||||
|
|
@ -591,8 +591,8 @@ void CGameLogic::Update() {
|
|||
CEntity::CleanUpOldReference(driver);
|
||||
driver = nullptr;
|
||||
|
||||
if (vehicle->m_nStatus != STATUS_WRECKED) {
|
||||
vehicle->m_nStatus = STATUS_ABANDONED;
|
||||
if (vehicle->GetStatus() != STATUS_WRECKED) {
|
||||
vehicle->SetStatus(STATUS_ABANDONED);
|
||||
}
|
||||
} else {
|
||||
vehicle->RemovePassenger(player1Ped);
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ void CGlass::InjectHooks() {
|
|||
RH_ScopedInstall(WindowRespondsToSoftCollision, 0x71AF70);
|
||||
RH_ScopedInstall(BreakGlassPhysically, 0x71CF50);
|
||||
RH_ScopedInstall(WindowRespondsToExplosion, 0x71C1A0);
|
||||
RH_ScopedInstall(IsObjectGlass, 0x46A760);
|
||||
}
|
||||
|
||||
// 0x71A8D0
|
||||
|
|
@ -74,7 +75,7 @@ bool CGlass::HasGlassBeenShatteredAtCoors(CVector point) {
|
|||
FindWindowSectorList(GetSector(sectorX, sectorY)->m_dummies, maxDist, entity, point);
|
||||
}
|
||||
}
|
||||
return entity && !entity->IsDummy() && entity->AsObject()->objectFlags.bHasBrokenGlass;
|
||||
return entity && !entity->GetIsTypeDummy() && entity->AsObject()->objectFlags.bHasBrokenGlass;
|
||||
}
|
||||
|
||||
// 0x71C2B0
|
||||
|
|
@ -175,7 +176,7 @@ void CGlass::CarWindscreenShatters(CVehicle* vehicle) {
|
|||
}
|
||||
|
||||
bool IsGlassObjectWithCol(CEntity* entity) {
|
||||
if (entity->IsObject() && entity->m_bUsesCollision) {
|
||||
if (entity->GetIsTypeObject() && entity->GetUsesCollision()) {
|
||||
if (const auto ami = entity->GetModelInfo()->AsAtomicModelInfoPtr()) {
|
||||
return ami->IsGlass();
|
||||
}
|
||||
|
|
@ -243,8 +244,8 @@ void CGlass::WindowRespondsToCollision(CEntity* entity, float fDamageIntensity,
|
|||
);
|
||||
}
|
||||
|
||||
object->m_bUsesCollision = false;
|
||||
object->m_bIsVisible = false;
|
||||
object->SetUsesCollision(false);
|
||||
object->SetIsVisible(false);
|
||||
object->objectFlags.bGlassBrokenAltogether = true;
|
||||
}
|
||||
|
||||
|
|
@ -411,7 +412,7 @@ void CGlass::FindWindowSectorList(PtrListType& objList, float& outDist, CEntity*
|
|||
if (entity->IsScanCodeCurrent())
|
||||
continue;
|
||||
|
||||
if (!entity->IsObject())
|
||||
if (!entity->GetIsTypeObject())
|
||||
continue;
|
||||
|
||||
const auto object = entity->AsObject();
|
||||
|
|
@ -419,7 +420,7 @@ void CGlass::FindWindowSectorList(PtrListType& objList, float& outDist, CEntity*
|
|||
switch (ami->nSpecialType) {
|
||||
case eModelInfoSpecialType::GLASS_TYPE_1:
|
||||
case eModelInfoSpecialType::GLASS_TYPE_2: {
|
||||
object->m_nScanCode = CWorld::ms_nCurrentScanCode;
|
||||
object->SetScanCode(CWorld::ms_nCurrentScanCode);
|
||||
const auto dist = DistanceBetweenPoints(point, object->GetPosition());
|
||||
if (dist < outDist) {
|
||||
outEntity = entity;
|
||||
|
|
@ -519,7 +520,7 @@ CFallingGlassPane* CGlass::FindFreePane() {
|
|||
|
||||
// 0x71AF70
|
||||
void CGlass::WindowRespondsToSoftCollision(CEntity* entity, float fDamageIntensity) {
|
||||
if (entity->m_bUsesCollision && fDamageIntensity > 50.f && !entity->AsObject()->objectFlags.bHasBrokenGlass) {
|
||||
if (entity->GetUsesCollision() && fDamageIntensity > 50.f && !entity->AsObject()->objectFlags.bHasBrokenGlass) {
|
||||
AudioEngine.ReportGlassCollisionEvent(AE_GLASS_HIT, entity->GetPosition());
|
||||
entity->AsObject()->objectFlags.bHasBrokenGlass = true;
|
||||
}
|
||||
|
|
@ -603,15 +604,15 @@ void CGlass::BreakGlassPhysically(CVector point, float radius) {
|
|||
1,
|
||||
false
|
||||
);
|
||||
object.m_bUsesCollision = false;
|
||||
object.m_bIsVisible = false;
|
||||
object.SetUsesCollision(false);
|
||||
object.SetIsVisible(false);
|
||||
object.objectFlags.bHasBrokenGlass = true;
|
||||
}
|
||||
}
|
||||
|
||||
// 0x71C1A0
|
||||
void CGlass::WindowRespondsToExplosion(CEntity* entity, CVector pos) {
|
||||
if (!entity->m_bUsesCollision) {
|
||||
if (!entity->GetUsesCollision()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -626,3 +627,17 @@ void CGlass::WindowRespondsToExplosion(CEntity* entity, CVector pos) {
|
|||
WindowRespondsToCollision(entity, 10000.f, entityToPosDir * (0.3f / dist), entityPos, true);
|
||||
}
|
||||
}
|
||||
|
||||
// 0x46A760
|
||||
bool CGlass::IsObjectGlass(CEntity* entity) {
|
||||
if (!entity->GetIsTypeObject()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto mi = CModelInfo::GetModelInfo(entity->GetModelIndex());
|
||||
if (!mi->AsAtomicModelInfoPtr()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return mi->IsGlass();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ public:
|
|||
static void RenderReflectionPolys();
|
||||
static void RenderShatteredPolys();
|
||||
static void RenderHiLightPolys();
|
||||
static bool IsObjectGlass(CEntity* entity);
|
||||
static uint8 CalcAlphaWithNormal(const CVector& normal);
|
||||
static void AskForObjectToBeRenderedInGlass(CEntity* entity);
|
||||
static CFallingGlassPane* FindFreePane();
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ void CIdleCam::IdleCamGeneralProcess() {
|
|||
// 0x50EAE0
|
||||
void CIdleCam::GetLookAtPositionOnTarget(const CEntity* target, CVector& outPos) {
|
||||
outPos = target->GetPosition();
|
||||
if (target->IsPed()) {
|
||||
if (target->GetIsTypePed()) {
|
||||
switch (target->AsPed()->m_nPedType) {
|
||||
case PED_TYPE_CIVFEMALE:
|
||||
case PED_TYPE_PROSTITUTE:
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ void CInterestingEvents::ScanForNearbyEntities() {
|
|||
assert(v3 == endSectorY);
|
||||
|
||||
CWorld::IncrementCurrentScanCode();
|
||||
player->m_nScanCode = GetCurrentScanCode();
|
||||
player->SetCurrentScanCode();
|
||||
|
||||
for (int32 sectorY = startSectorY; sectorY <= endSectorY; ++sectorY) {
|
||||
for (int32 sectorX = startSectorX; sectorX <= endSectorX; ++sectorX) {
|
||||
|
|
@ -230,10 +230,10 @@ void CInterestingEvents::ScanForNearbyEntities() {
|
|||
}
|
||||
|
||||
for (auto* const vehicle : rs->Vehicles) {
|
||||
if (vehicle->m_nScanCode == GetCurrentScanCode())
|
||||
if (vehicle->IsScanCodeCurrent())
|
||||
continue;
|
||||
|
||||
vehicle->m_nScanCode = GetCurrentScanCode();
|
||||
vehicle->SetCurrentScanCode();
|
||||
if (vehicle->physicalFlags.bRenderScorched != 0)
|
||||
continue;
|
||||
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ bool InteriorManager_c::Update() {
|
|||
const auto plyr = FindPlayerPed();
|
||||
|
||||
InteriorEffectInfo_t visibleIntFxBuf[32];
|
||||
const auto numVisibleIntFx = plyr->m_nAreaCode != eAreaCodes::AREA_CODE_NORMAL_WORLD && m_IsActive && !plyr->GetTaskManager().GetActiveTaskAs<CTaskSimpleCarDrive>()
|
||||
const auto numVisibleIntFx = plyr->GetAreaCode() != eAreaCodes::AREA_CODE_NORMAL_WORLD && m_IsActive && !plyr->GetTaskManager().GetActiveTaskAs<CTaskSimpleCarDrive>()
|
||||
? GetVisibleEffects(visibleIntFxBuf, std::size(visibleIntFxBuf))
|
||||
: 0;
|
||||
PruneVisibleEffects(visibleIntFxBuf, numVisibleIntFx, 8, 20.f);
|
||||
|
|
@ -117,7 +117,7 @@ bool InteriorManager_c::Update() {
|
|||
|
||||
i->m_box = ifx.Effects[k];
|
||||
i->m_interiorId = (uint32)(fxPos.x * fxPos.y * fxPos.z) + ifx.FxIds[k];
|
||||
i->m_areaCode = ifx.Entity->m_nAreaCode;
|
||||
i->m_areaCode = ifx.Entity->GetAreaCode();
|
||||
i->m_pGroup = grp;
|
||||
|
||||
i->Init(ifx.Effects[k]->m_Pos);
|
||||
|
|
@ -245,7 +245,7 @@ size_t InteriorManager_c::GetVisibleEffects(InteriorEffectInfo_t* intFxInfos, ui
|
|||
|
||||
size_t numIntFxInfo{};
|
||||
for (auto& e : entitiesInRange | rng::views::take(objCount)) {
|
||||
if (!e->m_pRwObject || !e->IsInCurrentAreaOrBarberShopInterior()) {
|
||||
if (!e->GetRwObject() || !e->IsInCurrentArea()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ void CIplStore::EnableDynamicStreaming(int32 iplSlotIndex, bool enable) {
|
|||
eAreaCodes ResolveAreaCode(int32 ec) {
|
||||
if (ec == -1) {
|
||||
if (const auto player = FindPlayerPed()) {
|
||||
return player->m_nAreaCode;
|
||||
return player->GetAreaCode();
|
||||
}
|
||||
return (eAreaCodes)CGame::currArea;
|
||||
}
|
||||
|
|
@ -351,15 +351,15 @@ bool CIplStore::LoadIpl(int32 iplSlotIndex, char* data, int32 dataSize) {
|
|||
// Anti copy-paste code helper.
|
||||
// Finish loading an ObjectInstance
|
||||
const auto FinishLoadObjInst = [&](CEntity* obj) {
|
||||
obj->m_nIplIndex = (uint8)iplSlotIndex;
|
||||
obj->SetIplIndex((uint8)iplSlotIndex);
|
||||
|
||||
// Assign LOD to `obj` (if set)
|
||||
if (obj->m_nLodIndex == -1) {
|
||||
obj->m_pLod = nullptr;
|
||||
if (obj->GetLodIndex() == -1) {
|
||||
obj->SetLod(nullptr);
|
||||
} else {
|
||||
assert(pIPLLODEntities);
|
||||
obj->m_pLod = pIPLLODEntities[obj->m_nLodIndex];
|
||||
obj->m_pLod->m_nNumLodChildren++;
|
||||
obj->SetLod(pIPLLODEntities[obj->GetLodIndex()]);
|
||||
obj->GetLod()->AddLodChildren();
|
||||
}
|
||||
|
||||
obj->Add(); // Add it to the world
|
||||
|
|
@ -423,14 +423,14 @@ bool CIplStore::LoadIplBoundingBox(int32 iplSlotIndex, char* data, int32 dataSiz
|
|||
// Anti copy-paste code helper.
|
||||
// Finish loading an ObjectInstance
|
||||
const auto FinishLoadObjInst = [&](CEntity* obj) {
|
||||
obj->m_nIplIndex = (uint8)iplSlotIndex;
|
||||
obj->SetIplIndex((uint8)iplSlotIndex);
|
||||
|
||||
if (obj->m_nLodIndex == -1) {
|
||||
obj->m_pLod = nullptr;
|
||||
if (obj->GetLodIndex() == -1) {
|
||||
obj->SetLod(nullptr);
|
||||
} else {
|
||||
assert(pIPLLODEntities);
|
||||
obj->m_pLod = pIPLLODEntities[obj->m_nLodIndex];
|
||||
obj->m_pLod->m_nNumLodChildren++;
|
||||
obj->SetLod(pIPLLODEntities[obj->GetLodIndex()]);
|
||||
obj->GetLod()->AddLodChildren();
|
||||
|
||||
if (ppCurrIplInstance) {
|
||||
*ppCurrIplInstance = obj;
|
||||
|
|
@ -508,7 +508,7 @@ void CIplStore::LoadIpls(CVector posn, bool bAvoidLoadInPlayerVehicleMovingDirec
|
|||
if (e->m_pAttachedTo || e->physicalFlags.bDontApplySpeed || e->physicalFlags.b15) {
|
||||
return;
|
||||
}
|
||||
ms_currentIPLAreaCode = e->m_nAreaCode;
|
||||
ms_currentIPLAreaCode = e->GetAreaCode();
|
||||
ms_pQuadTree->ForAllMatching(e->GetPosition2D(), SetIfIplIsRequiredReducedBB);
|
||||
};
|
||||
|
||||
|
|
@ -591,7 +591,7 @@ void CIplStore::RemoveIpl(int32 iplSlotIndex) {
|
|||
if (!entity)
|
||||
continue;
|
||||
|
||||
if (entity->m_nIplIndex == iplSlotIndex) {
|
||||
if (entity->GetIplIndex() == iplSlotIndex) {
|
||||
if constexpr (std::is_same_v<PoolT, CObjectPool>) {
|
||||
if (entity->m_pDummyObject) {
|
||||
CWorld::Add(entity->m_pDummyObject);
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ bool CPedGroupIntelligence::AddEvent(CEvent* event) {
|
|||
return false;
|
||||
}
|
||||
if (const auto src = eGrpEvent->GetEvent().GetSourceEntity()) {
|
||||
if (src->IsPed() && m_pPedGroup->GetMembership().IsMember(src->AsPed())) {
|
||||
if (src->GetIsTypePed() && m_pPedGroup->GetMembership().IsMember(src->AsPed())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -366,7 +366,7 @@ void CPedGroupIntelligence::ProcessIgnorePlayerGroup() {
|
|||
return;
|
||||
}
|
||||
const auto src = m_CurrentEvent->GetEvent().GetSourceEntity();
|
||||
if (!src || !src->IsPed()) {
|
||||
if (!src || !src->GetIsTypePed()) {
|
||||
return;
|
||||
}
|
||||
const auto grp = src->AsPed()->GetGroup();
|
||||
|
|
@ -400,7 +400,7 @@ bool CPedGroupIntelligence::IsCurrentEventValid() {
|
|||
const auto event = &m_CurrentEvent->GetEvent();
|
||||
if (event->GetEventType() == EVENT_PLAYER_COMMAND_TO_GROUP) {
|
||||
if (const auto src = event->GetSourceEntity()) {
|
||||
if (src->IsPed()) {
|
||||
if (src->GetIsTypePed()) {
|
||||
if (m_pPedGroup->GetMembership().IsMember(src->AsPed())) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -469,9 +469,9 @@ void CPedIntelligence::FlushImmediately(bool bSetPrimaryDefaultTask) {
|
|||
if (const auto tSimpleHoldEntity = notsa::dyn_cast_if_present<CTaskSimpleHoldEntity>(m_TaskMgr.GetTaskSecondary(TASK_SECONDARY_PARTIAL_ANIM))) {
|
||||
objectToHold = (CObject*)tSimpleHoldEntity->m_pEntityToHold;
|
||||
if (objectToHold) {
|
||||
if (objectToHold->IsObject()) {
|
||||
if (objectToHold->GetIsTypeObject()) {
|
||||
objectType = objectToHold->m_nObjectType;
|
||||
bIsEntityVisible = objectToHold->m_bIsVisible;
|
||||
bIsEntityVisible = objectToHold->GetIsVisible();
|
||||
}
|
||||
taskSimpleHoldEntityCloned = (CTaskSimpleHoldEntity*)tSimpleHoldEntity->Clone();
|
||||
}
|
||||
|
|
@ -501,7 +501,7 @@ void CPedIntelligence::FlushImmediately(bool bSetPrimaryDefaultTask) {
|
|||
if (taskSimpleHoldEntityCloned) {
|
||||
if (objectType != -1) {
|
||||
objectToHold->m_nObjectType = objectType;
|
||||
objectToHold->m_bIsVisible = bIsEntityVisible;
|
||||
objectToHold->SetIsVisible(bIsEntityVisible);
|
||||
}
|
||||
m_TaskMgr.SetTaskSecondary(taskSimpleHoldEntityCloned, TASK_SECONDARY_PARTIAL_ANIM);
|
||||
taskSimpleHoldEntityCloned->ProcessPed(m_pPed);
|
||||
|
|
@ -555,7 +555,7 @@ void CPedIntelligence::ProcessAfterProcCol() {
|
|||
}
|
||||
|
||||
if (bPositionSet) {
|
||||
m_pPed->UpdateRW();
|
||||
m_pPed->UpdateRwMatrix();
|
||||
m_pPed->UpdateRwFrame();
|
||||
}
|
||||
}
|
||||
|
|
@ -846,7 +846,7 @@ bool CPedIntelligence::IsPedGoingForCarDoor() {
|
|||
// should be (const CEntity* entity, bool unused)
|
||||
// 0x605550
|
||||
float CPedIntelligence::CanSeeEntityWithLights(CEntity* entity, int32 unUsed) {
|
||||
if (!entity->IsPed())
|
||||
if (!entity->GetIsTypePed())
|
||||
return LIGHT_AI_LEVEL_MAX;
|
||||
|
||||
CPed* ped = entity->AsPed();
|
||||
|
|
@ -931,7 +931,7 @@ void CPedIntelligence::ProcessFirst() {
|
|||
if (m_pPed->m_fDamageIntensity > 0.0f)
|
||||
{
|
||||
CEntity* damageEntity = m_pPed->m_pDamageEntity;
|
||||
if (damageEntity && !damageEntity->IsPed()) {
|
||||
if (damageEntity && !damageEntity->GetIsTypePed()) {
|
||||
if (DotProduct(m_pPed->m_vecLastCollisionImpactVelocity, m_pPed->GetForward()) < -0.5f)
|
||||
m_pPed->bPedHitWallLastFrame = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -137,9 +137,9 @@ void CPickup::GiveUsAPickUpObject(CObject** obj, int32 slotIndex) {
|
|||
object->UpdateRwFrame();
|
||||
object->physicalFlags.bApplyGravity = false;
|
||||
object->physicalFlags.bExplosionProof = true;
|
||||
object->m_bUsesCollision = false;
|
||||
object->SetUsesCollision(false);
|
||||
object->objectFlags.bIsPickup = true;
|
||||
object->objectFlags.b0x02 = object->m_bCollisionProcessed;
|
||||
object->objectFlags.b0x02 = object->GetCollisionProcessed();
|
||||
object->objectFlags.bDoNotRender = PickUpShouldBeInvisible();
|
||||
object->m_bHasPreRenderEffects = true;
|
||||
object->m_bTunnelTransition = true;
|
||||
|
|
@ -270,7 +270,7 @@ bool CPickup::Update(CPlayerPed* player, CVehicle* vehicle, int32 playerId) {
|
|||
if (CWaterLevel::GetWaterLevel(m_pObject->GetPosition(), level, true)) {
|
||||
m_pObject->GetPosition().z = level + extra;
|
||||
}
|
||||
m_pObject->UpdateRW();
|
||||
m_pObject->UpdateRwMatrix();
|
||||
m_pObject->UpdateRwFrame();
|
||||
};
|
||||
|
||||
|
|
@ -322,7 +322,7 @@ bool CPickup::Update(CPlayerPed* player, CVehicle* vehicle, int32 playerId) {
|
|||
case PICKUP_FLOATINGPACKAGE: {
|
||||
m_pObject->GetMoveSpeed().z -= CTimer::GetTimeStep() / 1'000.0f;
|
||||
m_pObject->GetPosition() += m_pObject->GetMoveSpeed() * CTimer::GetTimeStep();
|
||||
m_pObject->UpdateRW();
|
||||
m_pObject->UpdateRwMatrix();
|
||||
m_pObject->UpdateRwFrame();
|
||||
|
||||
float level;
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ void ProcObjectMan_c::ProcessTriangleRemoved(CPlantLocTri* triangle) {
|
|||
|
||||
auto& obj = *(ProcObjectListItem*)head;
|
||||
if (obj.m_LocTri == triangle) {
|
||||
if (obj.m_Obj->IsObject()) {
|
||||
if (obj.m_Obj->GetIsTypeObject()) {
|
||||
CObject::nNoTempObjects--;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -140,15 +140,15 @@ ProcObjectListItem* ProcSurfaceInfo_c::AddObject(CVector pos, CVector normal, tC
|
|||
head->m_bAllocatedMatrix = false;
|
||||
}
|
||||
|
||||
head->m_Obj->m_nAreaCode = static_cast<eAreaCodes>(CGame::currArea);
|
||||
head->m_Obj->SetAreaCode(static_cast<eAreaCodes>(CGame::currArea));
|
||||
head->m_Obj->SetIsStatic(true);
|
||||
head->m_Obj->CreateRwObject();
|
||||
head->m_Obj->UpdateRW();
|
||||
head->m_Obj->UpdateRwMatrix();
|
||||
head->m_Obj->UpdateRwFrame();
|
||||
CWorld::Add(head->m_Obj);
|
||||
m_Objects.AddItem(head);
|
||||
if (!isBuilding && (xyScale != 1.0f && zScale != 1.0f)) {
|
||||
auto* rwObject = head->m_Obj->m_pRwObject;
|
||||
auto* rwObject = head->m_Obj->GetRwObject();
|
||||
if (rwObject && rwObjectGetParent(rwObject) != (void*)-16) { // I don't understand this if, there must be some missing macro
|
||||
auto* modellingMatrix = head->m_Obj->GetModellingMatrix();
|
||||
|
||||
|
|
|
|||
|
|
@ -523,7 +523,7 @@ void CPlantMgr::_ColEntityCache_Update(const CVector& cameraPos, bool fast) {
|
|||
while (nextEntry) {
|
||||
auto* curEntry = nextEntry; // ReleaseEntry() Overwrites m_NextEntry pointer, we need to keep track of it before that can happen
|
||||
nextEntry = curEntry->m_NextEntry;
|
||||
if (!curEntry->m_Entity || _CalcDistanceSqrToEntity(curEntry->m_Entity, cameraPos) > PROC_OBJECTS_MAX_DISTANCE_SQUARED || !curEntry->m_Entity->IsInCurrentAreaOrBarberShopInterior()) {
|
||||
if (!curEntry->m_Entity || _CalcDistanceSqrToEntity(curEntry->m_Entity, cameraPos) > PROC_OBJECTS_MAX_DISTANCE_SQUARED || !curEntry->m_Entity->IsInCurrentArea()) {
|
||||
curEntry->ReleaseEntry();
|
||||
}
|
||||
}
|
||||
|
|
@ -534,7 +534,7 @@ void CPlantMgr::_ColEntityCache_Update(const CVector& cameraPos, bool fast) {
|
|||
CWorld::IncrementCurrentScanCode();
|
||||
CWorld::IterateSectorsOverlappedByRect({ cameraPos, PROC_OBJECTS_MAX_DISTANCE }, [cameraPos](int32 x, int32 y) {
|
||||
for (auto* const item : GetSector(x, y)->m_buildings) {
|
||||
if (item->m_bIsProcObject || item->IsScanCodeCurrent() || !item->IsInCurrentAreaOrBarberShopInterior())
|
||||
if (item->m_bIsProcObject || item->IsScanCodeCurrent() || !item->IsInCurrentArea())
|
||||
continue;
|
||||
|
||||
if (auto mi = item->GetModelInfo(); mi->GetModelType() == MODEL_INFO_ATOMIC && mi->bAtomicFlag0x200) {
|
||||
|
|
|
|||
|
|
@ -13,8 +13,11 @@ class CEntity;
|
|||
|
||||
enum ePointLightType : uint8 {
|
||||
PLTYPE_POINTLIGHT = 0,
|
||||
PLTYPE_SPOTLIGHT = 1,
|
||||
PLTYPE_DARKLIGHT = 2,
|
||||
PLTYPE_DIRECTIONAL,
|
||||
PLTYPE_ANTILIGHT,
|
||||
PLTYPE_ONLYFOGEFFECT_ALWAYS,
|
||||
PLTYPE_ONLYFOGEFFECT,
|
||||
PLTYPE_SMOG
|
||||
};
|
||||
|
||||
class CPointLight {
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#include "StdInc.h"
|
||||
|
||||
#include "Population.h"
|
||||
#include "Glass.h"
|
||||
#include <PedPlacement.h>
|
||||
#include <Attractors/PedAttractorPedPlacer.h>
|
||||
|
||||
|
|
@ -598,7 +599,7 @@ bool CPopulation::IsSunbather(eModelID modelIndex) {
|
|||
}
|
||||
|
||||
bool CPopulation::IsSunbather(CPed* ped) {
|
||||
return IsSunbather(ped->GetModelID());
|
||||
return IsSunbather(ped->GetModelId());
|
||||
}
|
||||
|
||||
// 0x611780
|
||||
|
|
@ -719,7 +720,7 @@ void CPopulation::ManagePed(CPed* ped, const CVector& playerPosn) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (ped->m_pAttachedTo && ped->m_pAttachedTo->m_nType == ENTITY_TYPE_VEHICLE) {
|
||||
if (ped->m_pAttachedTo && ped->m_pAttachedTo->GetIsTypeVehicle()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1198,7 +1199,7 @@ void CPopulation::CreateWaitingCoppers(CVector createAt, float createaWithHeadin
|
|||
veh->SetIsStatic(false);
|
||||
|
||||
// Now, update the RW matrix too
|
||||
if (veh->m_pRwObject) {
|
||||
if (veh->GetRwObject()) {
|
||||
vehMat.UpdateRwMatrix(RwFrameGetMatrix(RpClumpGetFrame(veh->m_pRwClump)));
|
||||
}
|
||||
|
||||
|
|
@ -1274,7 +1275,7 @@ CPed* CPopulation::AddPedInCar(
|
|||
// Pick a model and ped type to use (TODO: Could probably just get the model type, and then resolve the ped type from the model)
|
||||
const auto pedModel = [&]() -> eModelID {
|
||||
if (addAsDriver) {
|
||||
const auto driverModel = FindSpecificDriverModelForCar_ToUse(veh->GetModelID());
|
||||
const auto driverModel = FindSpecificDriverModelForCar_ToUse(veh->GetModelId());
|
||||
if (driverModel != MODEL_INVALID && CStreaming::IsModelLoaded(driverModel)) {
|
||||
return driverModel;
|
||||
}
|
||||
|
|
@ -1290,7 +1291,7 @@ CPed* CPopulation::AddPedInCar(
|
|||
return CCopPed::GetPedModelForCopType(ctype);
|
||||
};
|
||||
|
||||
switch (veh->GetModelID()) {
|
||||
switch (veh->GetModelId()) {
|
||||
case MODEL_FIRETRUK:
|
||||
return FixIfInvalid(CStreaming::GetDefaultFiremanModel());
|
||||
case MODEL_AMBULAN:
|
||||
|
|
@ -1563,13 +1564,13 @@ void CPopulation::ConvertToRealObject(CDummyObject* dummyObject) {
|
|||
}
|
||||
|
||||
CWorld::Remove(dummyObject);
|
||||
dummyObject->m_bIsVisible = false;
|
||||
dummyObject->SetIsVisible(false);
|
||||
dummyObject->ResolveReferences();
|
||||
|
||||
obj->SetRelatedDummy(dummyObject);
|
||||
CWorld::Add(obj);
|
||||
|
||||
if (!IsGlassModel(obj) || obj->GetModelInfo()->IsGlassType2()) {
|
||||
if (!CGlass::IsObjectGlass(obj) || obj->GetModelInfo()->IsGlassType2()) {
|
||||
if (obj->m_nModelIndex == ModelIndices::MI_BUOY || obj->physicalFlags.bAttachedToEntity) {
|
||||
obj->SetIsStatic(false);
|
||||
obj->m_vecMoveSpeed.Set(0.0F, 0.0F, -0.001F);
|
||||
|
|
@ -1577,7 +1578,7 @@ void CPopulation::ConvertToRealObject(CDummyObject* dummyObject) {
|
|||
obj->AddToMovingList();
|
||||
}
|
||||
} else {
|
||||
obj->m_bIsVisible = false;
|
||||
obj->SetIsVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1588,15 +1589,15 @@ void CPopulation::ConvertToDummyObject(CObject* object) {
|
|||
if (!CPopulation::TestRoomForDummyObject(object)) {
|
||||
return;
|
||||
}
|
||||
dummy->m_bIsVisible = true;
|
||||
dummy->SetIsVisible(true);
|
||||
dummy->UpdateFromObject(object);
|
||||
}
|
||||
|
||||
if (object->IsObject()) {
|
||||
if (object->GetIsTypeObject()) {
|
||||
auto* mi = object->GetModelInfo()->AsAtomicModelInfoPtr();
|
||||
if (mi && mi->IsGlassType1()) {
|
||||
if (dummy) {
|
||||
dummy->m_bIsVisible = false;
|
||||
dummy->SetIsVisible(false);
|
||||
} else {
|
||||
assert(false && "FIX_BUGS: dummy == nullptr");
|
||||
}
|
||||
|
|
@ -1657,7 +1658,7 @@ int32 CPopulation::GeneratePedsAtAttractors(
|
|||
for (int16 o{}; o < numEntitiesInRng; o++) {
|
||||
const auto ent = entitiesInRng[o];
|
||||
assert(ent);
|
||||
if (!ent->m_pRwObject) {
|
||||
if (!ent->GetRwObject()) {
|
||||
continue;
|
||||
}
|
||||
if (!ent->IsInCurrentArea()) {
|
||||
|
|
@ -1668,7 +1669,7 @@ int32 CPopulation::GeneratePedsAtAttractors(
|
|||
continue;
|
||||
}
|
||||
if (attractor->m_nFlags & 1) {
|
||||
if (!ent->IsObject()) {
|
||||
if (!ent->GetIsTypeObject()) {
|
||||
continue;
|
||||
}
|
||||
if (!ent->AsObject()->objectFlags.bEnableDisabledAttractors) {
|
||||
|
|
@ -1751,10 +1752,10 @@ void CPopulation::ManageObject(CObject* object, const CVector& posn) {
|
|||
|
||||
// 0x616000
|
||||
void CPopulation::ManageDummy(CDummy* dummy, const CVector& posn) {
|
||||
if (!dummy->IsInCurrentAreaOrBarberShopInterior() || !dummy->m_bIsVisible) {
|
||||
if (!dummy->IsInCurrentArea() || !dummy->GetIsVisible()) {
|
||||
return;
|
||||
}
|
||||
if ((posn - dummy->GetPosition()).SquaredMagnitude() >= sq(FindDummyDistForModel(dummy->GetModelID()))) {
|
||||
if ((posn - dummy->GetPosition()).SquaredMagnitude() >= sq(FindDummyDistForModel(dummy->GetModelId()))) {
|
||||
return;
|
||||
}
|
||||
ConvertToRealObject(static_cast<CDummyObject*>(dummy));
|
||||
|
|
|
|||
|
|
@ -603,7 +603,7 @@ bool CRadar::HasThisBlipBeenRevealed(int32 blipIndex) {
|
|||
* @returns True if it's allowed to be drawn.
|
||||
*/
|
||||
bool CRadar::DisplayThisBlip(eRadarSprite spriteId, int8 priority) {
|
||||
if (CGame::CanSeeOutSideFromCurrArea() && FindPlayerPed()->m_nAreaCode == AREA_CODE_NORMAL_WORLD) {
|
||||
if (CGame::CanSeeOutSideFromCurrArea() && FindPlayerPed()->GetAreaCode() == AREA_CODE_NORMAL_WORLD) {
|
||||
switch (spriteId) {
|
||||
case RADAR_SPRITE_NONE:
|
||||
case RADAR_SPRITE_WHITE:
|
||||
|
|
@ -1364,7 +1364,7 @@ void CRadar::Draw3dMarkers() {
|
|||
NOTSA_UNREACHABLE("Couldn't get the pickup!");
|
||||
}
|
||||
}
|
||||
ret.z += (CGame::currArea != 0 || FindPlayerPed()->m_nAreaCode != AREA_CODE_NORMAL_WORLD) ? 1.6f : 1.8f;
|
||||
ret.z += (CGame::currArea != 0 || FindPlayerPed()->GetAreaCode() != AREA_CODE_NORMAL_WORLD) ? 1.6f : 1.8f;
|
||||
|
||||
return ret;
|
||||
}();
|
||||
|
|
@ -1376,7 +1376,7 @@ void CRadar::Draw3dMarkers() {
|
|||
if (CTheScripts::IsPlayerOnAMission() || !FindPlayerPed())
|
||||
break;
|
||||
|
||||
if (!trace.m_bTrackingBlip && FindPlayerPed()->m_nAreaCode != AREA_CODE_NORMAL_WORLD)
|
||||
if (!trace.m_bTrackingBlip && FindPlayerPed()->GetAreaCode() != AREA_CODE_NORMAL_WORLD)
|
||||
break;
|
||||
|
||||
C3dMarkers::PlaceMarkerSet(coneHandle, MARKER3D_CYLINDER, trace.m_vPosition, 2.0f, 255, 0, 0, 228, 2048u, 0.2f, 0);
|
||||
|
|
@ -1607,7 +1607,7 @@ void CRadar::DrawRadarMap() {
|
|||
// 0x586B00
|
||||
void CRadar::DrawMap() {
|
||||
const auto player = FindPlayerPed();
|
||||
const auto mapShouldDrawn = !CGame::currArea && player->m_nAreaCode == 0 && FrontEndMenuManager.m_nRadarMode != 1;
|
||||
const auto mapShouldDrawn = !CGame::currArea && player->GetAreaCode() == AREA_CODE_NORMAL_WORLD && FrontEndMenuManager.m_nRadarMode != 1;
|
||||
|
||||
CalculateCachedSinCos();
|
||||
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ CRealTimeShadow& CRealTimeShadowManager::GetRealTimeShadow(CPhysical* physical)
|
|||
|
||||
bool isFirstPlayer{};
|
||||
|
||||
if (!physical->IsPed() || physical->AsPed()->IsPlayer()) {
|
||||
if (!physical->GetIsTypePed() || physical->AsPed()->IsPlayer()) {
|
||||
if (FindPlayerPed()->IsInVehicle()) { // Maybe wrong?
|
||||
if (FindPlayerPed()->m_pVehicle->GetMoveSpeed().SquaredMagnitude() < sq(0.3f)) {
|
||||
return;
|
||||
|
|
@ -146,7 +146,7 @@ void CRealTimeShadowManager::DoShadowThisFrame(CPhysical* physical) {
|
|||
case FX_QUALITY_VERY_HIGH: // Always render
|
||||
break;
|
||||
case FX_QUALITY_HIGH: { // Only draw for main player
|
||||
if (physical->IsPed()) {
|
||||
if (physical->GetIsTypePed()) {
|
||||
if (physical->AsPed()->m_nPedType == PED_TYPE_PLAYER1) {
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ auto CRegisteredCorona::GetPosition() const -> CVector {
|
|||
if (!m_pAttachedTo) {
|
||||
return m_vPosn;
|
||||
}
|
||||
if (m_pAttachedTo->IsVehicle() && m_pAttachedTo->AsVehicle()->IsSubBike()) {
|
||||
if (m_pAttachedTo->GetIsTypeVehicle() && m_pAttachedTo->AsVehicle()->IsSubBike()) {
|
||||
return m_pAttachedTo->AsBike()->m_mLeanMatrix.TransformPoint(m_vPosn);
|
||||
}
|
||||
return m_pAttachedTo->GetMatrix().TransformPoint(m_vPosn);
|
||||
|
|
|
|||
|
|
@ -127,17 +127,17 @@ void CRenderer::RenderOneRoad(CEntity* entity) {
|
|||
|
||||
// 0x553260
|
||||
void CRenderer::RenderOneNonRoad(CEntity* entity) {
|
||||
if (entity->IsPed() && entity->AsPed()->m_nPedState == PEDSTATE_DRIVING)
|
||||
if (entity->GetIsTypePed() && entity->AsPed()->m_nPedState == PEDSTATE_DRIVING)
|
||||
return;
|
||||
|
||||
bool bSetupLighting = entity->SetupLighting();
|
||||
auto* vehicle = entity->AsVehicle();
|
||||
if (entity->IsVehicle()) {
|
||||
if (entity->GetIsTypeVehicle()) {
|
||||
CVisibilityPlugins::SetupVehicleVariables(entity->m_pRwClump);
|
||||
CVisibilityPlugins::InitAlphaAtomicList();
|
||||
vehicle->RenderDriverAndPassengers();
|
||||
vehicle->SetupRender();
|
||||
} else if (!entity->m_bBackfaceCulled) {
|
||||
} else if (!entity->GetIsBackfaceCulled()) {
|
||||
RwRenderStateSet(rwRENDERSTATECULLMODE, RWRSTATE(rwCULLMODECULLNONE));
|
||||
}
|
||||
|
||||
|
|
@ -153,14 +153,14 @@ void CRenderer::RenderOneNonRoad(CEntity* entity) {
|
|||
entity->Render();
|
||||
}
|
||||
|
||||
if (entity->IsVehicle()) {
|
||||
if (entity->GetIsTypeVehicle()) {
|
||||
vehicle->m_bImBeingRendered = true;
|
||||
CVisibilityPlugins::RenderAlphaAtomics();
|
||||
vehicle->m_bImBeingRendered = false;
|
||||
vehicle->ResetAfterRender();
|
||||
vehicle->RemoveLighting(bSetupLighting);
|
||||
} else {
|
||||
if (!entity->m_bBackfaceCulled)
|
||||
if (!entity->GetIsBackfaceCulled())
|
||||
RwRenderStateSet(rwRENDERSTATECULLMODE, RWRSTATE(rwCULLMODECULLBACK));
|
||||
entity->RemoveLighting(bSetupLighting);
|
||||
}
|
||||
|
|
@ -186,7 +186,7 @@ void CRenderer::AddEntityToRenderList(CEntity* entity, float fDistance)
|
|||
else if (CVisibilityPlugins::InsertEntityIntoSortedList(entity, fDistance)) {
|
||||
return;
|
||||
}
|
||||
if (entity->m_nNumLodChildren && !entity->m_bUnderwater) {
|
||||
if (entity->GetNumLodChildren() && !entity->m_bUnderwater) {
|
||||
ms_aVisibleLodPtrs[ms_nNoOfVisibleLods] = entity;
|
||||
ms_nNoOfVisibleLods++;
|
||||
assert(ms_nNoOfVisibleLods <= MAX_VISIBLE_LOD_PTRS);
|
||||
|
|
@ -233,36 +233,35 @@ void CRenderer::AddToLodDontRenderList(CEntity* entity, float distance) {
|
|||
void CRenderer::ProcessLodRenderLists() {
|
||||
for (auto renderListEntry = GetLodRenderListBase(); renderListEntry != ms_pLodRenderList; renderListEntry++) {
|
||||
CEntity* entity = renderListEntry->entity;
|
||||
if (entity && !entity->m_bIsVisible) {
|
||||
entity->m_nNumLodChildrenRendered = 0;
|
||||
if (entity && !entity->GetIsVisible()) {
|
||||
entity->ResetLodChildrenRendered();
|
||||
renderListEntry->entity = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
const uint8 displaySuperLowLodFlag = 0x80u; // yes, this is very hacky. Blame R*
|
||||
bool bAllLodsRendered = false;
|
||||
while (bAllLodsRendered) {
|
||||
for (auto renderListEntry = GetLodRenderListBase(); renderListEntry != ms_pLodRenderList; renderListEntry++) {
|
||||
CEntity* entity = renderListEntry->entity;
|
||||
if (entity) {
|
||||
if (entity->m_nNumLodChildren > 0 && entity->m_nNumLodChildrenRendered == entity->m_nNumLodChildren) {
|
||||
entity->m_nNumLodChildrenRendered = 0;
|
||||
if (entity->HasLodChildrenRendered() && entity->GetNumLodChildrenRendered() == entity->GetNumLodChildren()) {
|
||||
entity->ResetLodChildrenRendered();
|
||||
renderListEntry->entity = nullptr;
|
||||
bAllLodsRendered = true;
|
||||
}
|
||||
else if (entity->m_pLod) {
|
||||
else if (entity->GetLod()) {
|
||||
auto modelInfo = CModelInfo::GetModelInfo(entity->m_nModelIndex);
|
||||
if (modelInfo->m_nAlpha < 255u
|
||||
&& entity->m_pLod->m_nNumLodChildrenRendered != displaySuperLowLodFlag
|
||||
&& entity->m_pLod->m_bDisplayedSuperLowLOD
|
||||
&& entity->GetLod()->CanLodChildrenRender()
|
||||
&& entity->GetLod()->m_bDisplayedSuperLowLOD
|
||||
) {
|
||||
entity->m_pLod->m_nNumLodChildrenRendered = 0;
|
||||
entity->GetLod()->ResetLodChildrenRendered();
|
||||
}
|
||||
if (!entity->m_pRwObject) {
|
||||
if (entity->m_pLod->m_bDisplayedSuperLowLOD)
|
||||
entity->m_pLod->m_nNumLodChildrenRendered = displaySuperLowLodFlag;
|
||||
if (!entity->GetRwObject()) {
|
||||
if (entity->GetLod()->m_bDisplayedSuperLowLOD)
|
||||
entity->GetLod()->SetCannotLodChildrenRender();
|
||||
renderListEntry->entity = nullptr;
|
||||
entity->m_nNumLodChildrenRendered = 0;
|
||||
entity->ResetLodChildrenRendered();
|
||||
CStreaming::RequestModel(entity->m_nModelIndex, 0);
|
||||
}
|
||||
}
|
||||
|
|
@ -271,16 +270,16 @@ void CRenderer::ProcessLodRenderLists() {
|
|||
}
|
||||
for (auto renderListEntry = GetLodRenderListBase(); renderListEntry != ms_pLodRenderList; renderListEntry++) {
|
||||
CEntity* entity = renderListEntry->entity;
|
||||
if (entity && entity->m_nNumLodChildrenRendered > 0) {
|
||||
if (entity && entity->HasLodChildrenRendered()) {
|
||||
entity->m_bDisplayedSuperLowLOD = false;
|
||||
entity->m_nNumLodChildrenRendered = 0;
|
||||
entity->ResetLodChildrenRendered();
|
||||
renderListEntry->entity = nullptr;
|
||||
}
|
||||
}
|
||||
for (auto renderListEntry = GetLodRenderListBase(); renderListEntry != ms_pLodRenderList; renderListEntry++) {
|
||||
CEntity* entity = renderListEntry->entity;
|
||||
if (entity) {
|
||||
if (entity->m_nNumLodChildrenRendered == displaySuperLowLodFlag || !entity->m_nNumLodChildrenRendered)
|
||||
if (!entity->CanLodChildrenRender() || !entity->GetNumLodChildrenRendered())
|
||||
{
|
||||
entity->m_bDisplayedSuperLowLOD = true;
|
||||
auto modelInfo = CModelInfo::GetModelInfo(entity->m_nModelIndex);
|
||||
|
|
@ -288,7 +287,7 @@ void CRenderer::ProcessLodRenderLists() {
|
|||
entity->m_bDistanceFade = true;
|
||||
AddEntityToRenderList(entity, renderListEntry->distance);
|
||||
}
|
||||
entity->m_nNumLodChildrenRendered = 0;
|
||||
entity->ResetLodChildrenRendered();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -348,7 +347,7 @@ void CRenderer::RenderRoads() {
|
|||
SetAmbientColours();
|
||||
|
||||
for (auto& entity : GetVisibleEntityPtrs()) {
|
||||
if (entity->IsBuilding() && CModelInfo::GetModelInfo(entity->m_nModelIndex)->IsRoad()) {
|
||||
if (entity->GetIsTypeBuilding() && CModelInfo::GetModelInfo(entity->m_nModelIndex)->IsRoad()) {
|
||||
if (CPostEffects::IsVisionFXActive()) {
|
||||
CPostEffects::FilterFX_StoreAndSetDayNightBalance();
|
||||
entity->Render();
|
||||
|
|
@ -372,13 +371,13 @@ void CRenderer::RenderEverythingBarRoads() {
|
|||
assert(ms_nNoOfVisibleEntities <= MAX_VISIBLE_ENTITY_PTRS);
|
||||
for (auto& entity : GetVisibleEntityPtrs()) {
|
||||
auto* vehicle = entity->AsVehicle();
|
||||
if (entity->IsBuilding() && CModelInfo::GetModelInfo(entity->m_nModelIndex)->IsRoad())
|
||||
if (entity->GetIsTypeBuilding() && CModelInfo::GetModelInfo(entity->m_nModelIndex)->IsRoad())
|
||||
continue;
|
||||
|
||||
bool bInserted = false;
|
||||
if (entity->IsVehicle() || (entity->IsPed() && CVisibilityPlugins::GetClumpAlpha(entity->m_pRwClump) != 255)) {
|
||||
if (entity->GetIsTypeVehicle() || (entity->GetIsTypePed() && CVisibilityPlugins::GetClumpAlpha(entity->m_pRwClump) != 255)) {
|
||||
// todo: R* nice check | or we missed smth here?
|
||||
if (entity->IsVehicle()) {
|
||||
if (entity->GetIsTypeVehicle()) {
|
||||
bool bInsertIntoSortedList = false;
|
||||
if (vehicle->IsBoat()) {
|
||||
const auto& camMode = CCamera::GetActiveCamera().m_nMode;
|
||||
|
|
@ -468,7 +467,7 @@ int32 CRenderer::SetupMapEntityVisibility(CEntity* entity, CBaseModelInfo* baseM
|
|||
const float fFarClipRadius = baseModelInfo->GetColModel()->GetBoundRadius() + ms_fFarClipPlane;
|
||||
float fDrawDistanceRadius = std::min(TheCamera.m_fLODDistMultiplier * baseModelInfo->m_fDrawDistance, fFarClipRadius);
|
||||
float fFadingDistance = MAX_FADING_DISTANCE;
|
||||
if (!entity->m_pLod) {
|
||||
if (!entity->GetLod()) {
|
||||
float fDrawDistance = std::min(baseModelInfo->m_fDrawDistance, fDrawDistanceRadius);
|
||||
if (fDrawDistance > MAX_LOWLOD_DISTANCE)
|
||||
fFadingDistance = fDrawDistance / 15.0f + 10.0f;
|
||||
|
|
@ -477,7 +476,7 @@ int32 CRenderer::SetupMapEntityVisibility(CEntity* entity, CBaseModelInfo* baseM
|
|||
}
|
||||
|
||||
if (!baseModelInfo->m_pRwObject) {
|
||||
if (entity->m_pLod && entity->m_pLod->m_nNumLodChildren > 1u &&
|
||||
if (entity->GetLod() && entity->GetLod()->GetNumLodChildren() > 1u &&
|
||||
fFadingDistance + fDistance - MAX_FADING_DISTANCE < fDrawDistanceRadius)
|
||||
{
|
||||
AddToLodRenderList(entity, fDistance);
|
||||
|
|
@ -489,12 +488,12 @@ int32 CRenderer::SetupMapEntityVisibility(CEntity* entity, CBaseModelInfo* baseM
|
|||
if (entity->m_bDontStream)
|
||||
return RENDERER_INVISIBLE;
|
||||
if (baseModelInfo->m_pRwObject && fDistance - MAX_FADING_DISTANCE < fDrawDistanceRadius) {
|
||||
if (!entity->m_pRwObject) {
|
||||
if (!entity->GetRwObject()) {
|
||||
entity->CreateRwObject();
|
||||
if (!entity->m_pRwObject)
|
||||
if (!entity->GetRwObject())
|
||||
return RENDERER_INVISIBLE;
|
||||
}
|
||||
if (!entity->m_bIsVisible)
|
||||
if (!entity->GetIsVisible())
|
||||
return RENDERER_INVISIBLE;
|
||||
if (!entity->GetIsOnScreen() || entity->IsEntityOccluded()) {
|
||||
if (!baseModelInfo->HasBeenPreRendered()) {
|
||||
|
|
@ -504,26 +503,26 @@ int32 CRenderer::SetupMapEntityVisibility(CEntity* entity, CBaseModelInfo* baseM
|
|||
return RENDERER_INVISIBLE;
|
||||
}
|
||||
entity->m_bDistanceFade = true;
|
||||
if (entity->m_pLod && entity->m_pLod->m_nNumLodChildren > 1u)
|
||||
if (entity->GetLod() && entity->GetLod()->GetNumLodChildren() > 1u)
|
||||
AddToLodRenderList(entity, fDistance);
|
||||
else
|
||||
AddEntityToRenderList(entity, fDistance);
|
||||
return RENDERER_INVISIBLE;
|
||||
}
|
||||
if (fDistance - MAX_STREAMING_DISTANCE >= fDrawDistanceRadius || !bIsTimeInRange || !entity->m_bIsVisible)
|
||||
if (fDistance - MAX_STREAMING_DISTANCE >= fDrawDistanceRadius || !bIsTimeInRange || !entity->GetIsVisible())
|
||||
return RENDERER_INVISIBLE;
|
||||
if (!entity->m_pRwObject)
|
||||
if (!entity->GetRwObject())
|
||||
entity->CreateRwObject();
|
||||
return RENDERER_STREAMME;
|
||||
}
|
||||
|
||||
if (!entity->m_pRwObject) {
|
||||
if (!entity->GetRwObject()) {
|
||||
entity->CreateRwObject();
|
||||
if (!entity->m_pRwObject)
|
||||
if (!entity->GetRwObject())
|
||||
return RENDERER_INVISIBLE;
|
||||
}
|
||||
|
||||
if (!entity->m_bIsVisible)
|
||||
if (!entity->GetIsVisible())
|
||||
return RENDERER_INVISIBLE;
|
||||
|
||||
if (entity->GetIsOnScreen() && !entity->IsEntityOccluded()) {
|
||||
|
|
@ -531,11 +530,11 @@ int32 CRenderer::SetupMapEntityVisibility(CEntity* entity, CBaseModelInfo* baseM
|
|||
entity->m_bDistanceFade = false;
|
||||
else
|
||||
entity->m_bDistanceFade = true;
|
||||
if (!entity->m_pLod)
|
||||
if (!entity->GetLod())
|
||||
return RENDERER_VISIBLE;
|
||||
if (baseModelInfo->m_nAlpha == 255)
|
||||
entity->m_pLod->m_nNumLodChildrenRendered++;
|
||||
if (entity->m_pLod->m_nNumLodChildren <= 1u)
|
||||
entity->GetLod()->AddLodChildrenRendered();
|
||||
if (entity->GetLod()->GetNumLodChildren() <= 1u)
|
||||
return RENDERER_VISIBLE;
|
||||
AddToLodRenderList(entity, fDistance);
|
||||
return RENDERER_INVISIBLE;
|
||||
|
|
@ -551,7 +550,7 @@ int32 CRenderer::SetupEntityVisibility(CEntity* entity, float& outDistance) {
|
|||
const int32& modelId = entity->m_nModelIndex;
|
||||
CBaseModelInfo* baseModelInfo = CModelInfo::GetModelInfo(modelId);
|
||||
CBaseModelInfo* baseAtomicModelInfo = baseModelInfo->AsAtomicModelInfoPtr();
|
||||
if (entity->IsVehicle() && !entity->m_bTunnelTransition) {
|
||||
if (entity->GetIsTypeVehicle() && !entity->m_bTunnelTransition) {
|
||||
if (!ms_bRenderTunnels && entity->m_bTunnel || !ms_bRenderOutsideTunnels && !entity->m_bTunnel)
|
||||
return RENDERER_INVISIBLE;
|
||||
}
|
||||
|
|
@ -590,9 +589,9 @@ int32 CRenderer::SetupEntityVisibility(CEntity* entity, float& outDistance) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!entity->m_pRwObject
|
||||
|| !entity->m_bIsVisible && (!CMirrors::TypeOfMirror || entity->m_nModelIndex)
|
||||
|| !entity->IsInCurrentAreaOrBarberShopInterior() && entity->IsVehicle()
|
||||
if (!entity->GetRwObject()
|
||||
|| !entity->GetIsVisible() && (!CMirrors::TypeOfMirror || entity->m_nModelIndex)
|
||||
|| !entity->IsInCurrentArea() && entity->GetIsTypeVehicle()
|
||||
) {
|
||||
return RENDERER_INVISIBLE;
|
||||
}
|
||||
|
|
@ -601,7 +600,7 @@ int32 CRenderer::SetupEntityVisibility(CEntity* entity, float& outDistance) {
|
|||
return RENDERER_CULLED;
|
||||
}
|
||||
|
||||
if (entity->m_bWasPostponed) {
|
||||
if (entity->GetWasPostponed()) {
|
||||
entity->m_bDistanceFade = false;
|
||||
AddEntityToRenderList(entity, DistanceBetweenPoints(ms_vecCameraPosition, entity->GetPosition()));
|
||||
return RENDERER_INVISIBLE;
|
||||
|
|
@ -635,7 +634,7 @@ int32 CRenderer::SetupEntityVisibility(CEntity* entity, float& outDistance) {
|
|||
{
|
||||
if (entity->m_bDontStream)
|
||||
{
|
||||
if (!entity->m_pRwObject || !entity->m_bIsVisible && (!CMirrors::TypeOfMirror || entity->m_nModelIndex))
|
||||
if (!entity->GetRwObject() || !entity->GetIsVisible() && (!CMirrors::TypeOfMirror || entity->m_nModelIndex))
|
||||
{
|
||||
return RENDERER_INVISIBLE;
|
||||
}
|
||||
|
|
@ -645,7 +644,7 @@ int32 CRenderer::SetupEntityVisibility(CEntity* entity, float& outDistance) {
|
|||
return RENDERER_CULLED;
|
||||
}
|
||||
|
||||
if (!entity->m_bWasPostponed)
|
||||
if (!entity->GetWasPostponed())
|
||||
{
|
||||
return RENDERER_VISIBLE;
|
||||
}
|
||||
|
|
@ -657,10 +656,10 @@ int32 CRenderer::SetupEntityVisibility(CEntity* entity, float& outDistance) {
|
|||
}
|
||||
}
|
||||
|
||||
if (entity->IsInCurrentAreaOrBarberShopInterior()) {
|
||||
if (entity->IsInCurrentArea()) {
|
||||
CVector position = entity->GetPosition();
|
||||
if (entity->m_pLod) {
|
||||
position = entity->m_pLod->GetPosition();
|
||||
if (entity->GetLod()) {
|
||||
position = entity->GetLod()->GetPosition();
|
||||
}
|
||||
|
||||
outDistance = DistanceBetweenPoints(ms_vecCameraPosition, position);
|
||||
|
|
@ -682,7 +681,7 @@ int32 CRenderer::SetupEntityVisibility(CEntity* entity, float& outDistance) {
|
|||
int32 CRenderer::SetupBigBuildingVisibility(CEntity* entity, float& outDistance) {
|
||||
CBaseModelInfo* baseModelInfo = CModelInfo::GetModelInfo(entity->m_nModelIndex);
|
||||
bool bIsTimeInRange = true;
|
||||
if (entity->m_nAreaCode != CGame::currArea && entity->m_nAreaCode != AREA_CODE_13)
|
||||
if (!entity->IsInCurrentArea())
|
||||
return RENDERER_INVISIBLE;
|
||||
|
||||
if (baseModelInfo->GetModelType() == MODEL_INFO_TIME)
|
||||
|
|
@ -708,35 +707,35 @@ int32 CRenderer::SetupBigBuildingVisibility(CEntity* entity, float& outDistance)
|
|||
}
|
||||
|
||||
CVector entityPos = entity->GetPosition();
|
||||
if (entity->m_pLod) {
|
||||
entityPos = entity->m_pLod->GetPosition();
|
||||
if (entity->GetLod()) {
|
||||
entityPos = entity->GetLod()->GetPosition();
|
||||
}
|
||||
|
||||
outDistance = DistanceBetweenPoints(ms_vecCameraPosition, entityPos);
|
||||
if (entity->m_nNumLodChildrenRendered <= 0) {
|
||||
if (!entity->HasLodChildrenRendered()) {
|
||||
int32 visibility = SetupMapEntityVisibility(entity, baseModelInfo, outDistance, bIsTimeInRange);
|
||||
if (visibility != RENDERER_VISIBLE || entity->m_nNumLodChildren <= 1u) {
|
||||
if (visibility != RENDERER_VISIBLE || entity->GetNumLodChildren() <= 1u) {
|
||||
return visibility;
|
||||
}
|
||||
if (entity->m_pLod && baseModelInfo->m_nAlpha == 255) {
|
||||
++entity->m_pLod->m_nNumLodChildrenRendered;
|
||||
if (entity->GetLod() && baseModelInfo->m_nAlpha == 255) {
|
||||
entity->GetLod()->AddLodChildrenRendered();
|
||||
}
|
||||
AddToLodRenderList(entity, outDistance);
|
||||
return RENDERER_INVISIBLE;
|
||||
}
|
||||
|
||||
if (entity->m_pLod)
|
||||
++entity->m_pLod->m_nNumLodChildrenRendered;
|
||||
if (entity->GetLod())
|
||||
entity->GetLod()->AddLodChildrenRendered();
|
||||
|
||||
if (entity->m_nNumLodChildren <= 1u) {
|
||||
entity->m_nNumLodChildrenRendered = 0;
|
||||
if (entity->GetNumLodChildren() <= 1u) {
|
||||
entity->ResetLodChildrenRendered();
|
||||
} else {
|
||||
ms_pLodRenderList->entity = entity;
|
||||
ms_pLodRenderList->distance = outDistance;
|
||||
ms_pLodRenderList++;
|
||||
}
|
||||
|
||||
if (!entity->m_pRwObject)
|
||||
if (!entity->GetRwObject())
|
||||
entity->CreateRwObject();
|
||||
|
||||
return RENDERER_STREAMME;
|
||||
|
|
@ -751,7 +750,7 @@ void I_ScanSectorList_ListModels(int32 sectorX, int32 sectorY) {
|
|||
continue;
|
||||
}
|
||||
entity->SetCurrentScanCode();
|
||||
if (!entity->IsInCurrentAreaOrBarberShopInterior()) {
|
||||
if (!entity->IsInCurrentArea()) {
|
||||
continue;
|
||||
}
|
||||
if constexpr (CheckIsVisible) {
|
||||
|
|
@ -799,7 +798,7 @@ void CRenderer::ScanSectorList(int32 sectorX, int32 sectorY) {
|
|||
float fDistance = 0.0f;
|
||||
switch (SetupEntityVisibility(entity, fDistance)) {
|
||||
case RENDERER_INVISIBLE: {
|
||||
if (entity->IsObject()) {
|
||||
if (entity->GetIsTypeObject()) {
|
||||
auto* atomicModelInfo = CModelInfo::GetModelInfo(entity->m_nModelIndex)->AsAtomicModelInfoPtr();
|
||||
if (atomicModelInfo && atomicModelInfo->IsGlass()) {
|
||||
bInvisibleEntity = true;
|
||||
|
|
@ -846,7 +845,7 @@ void CRenderer::ScanSectorList(int32 sectorX, int32 sectorY) {
|
|||
if (entity->m_bHasPreRenderEffects) {
|
||||
float fDrawDistance = MAX_INVISIBLE_ENTITY_DISTANCE;
|
||||
CVector2D distance = ms_vecCameraPosition - entity->GetPosition();
|
||||
if (entity->IsVehicle()) {
|
||||
if (entity->GetIsTypeVehicle()) {
|
||||
if (entity->AsVehicle()->vehicleFlags.bAlwaysSkidMarks) {
|
||||
fDrawDistance = MAX_INVISIBLE_VEHICLE_DISTANCE;
|
||||
}
|
||||
|
|
@ -883,7 +882,7 @@ void CRenderer::ScanBigBuildingList(int32 sectorX, int32 sectorY) {
|
|||
if (entity->IsScanCodeCurrent())
|
||||
continue;
|
||||
|
||||
entity->SetCurrentScanCode() ;
|
||||
entity->SetCurrentScanCode();
|
||||
|
||||
float fDistance = 0.0f;
|
||||
switch (SetupBigBuildingVisibility(entity, fDistance)) {
|
||||
|
|
@ -908,7 +907,7 @@ void CRenderer::ScanBigBuildingList(int32 sectorX, int32 sectorY) {
|
|||
|
||||
// 0x554EB0
|
||||
bool CRenderer::ShouldModelBeStreamed(CEntity* entity, const CVector& point, float farClip) {
|
||||
if (entity->m_nAreaCode != CGame::currArea && entity->m_nAreaCode != AREA_CODE_13)
|
||||
if (!entity->IsInCurrentArea())
|
||||
return false;
|
||||
|
||||
CBaseModelInfo* modelInfo = CModelInfo::GetModelInfo(entity->m_nModelIndex);
|
||||
|
|
@ -953,7 +952,7 @@ void CRenderer::ConstructRenderList() {
|
|||
ms_bInTheSky = false;
|
||||
|
||||
CPlayerPed* player = FindPlayerPed();
|
||||
if (player && player->m_nAreaCode == AREA_CODE_NORMAL_WORLD) {
|
||||
if (player && player->GetAreaCode() == AREA_CODE_NORMAL_WORLD) {
|
||||
float fGroundHeightZ = TheCamera.CalculateGroundHeight(eGroundHeightType::ENTITY_BB_BOTTOM);
|
||||
float fPlayerHeightZ = player->GetPosition().z;
|
||||
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@ void CReplay::StorePedUpdate(CPed* ped, uint8 index) {
|
|||
.flags = {
|
||||
.isTalking = (bool)(ped == FindPlayerPed() && gbFirstPersonRunThisFrame && ped->bIsTalking),
|
||||
.stillOnValidPoly = (bool)ped->bStillOnValidPoly,
|
||||
.usesCollision = (bool)ped->m_bUsesCollision
|
||||
.usesCollision = ped->GetUsesCollision()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -508,7 +508,7 @@ void CReplay::ProcessPedUpdate(CPed* ped, float interpValue, CAddressInReplayBuf
|
|||
|
||||
ped->bIsTalking = packet.flags.isTalking;
|
||||
ped->bStillOnValidPoly = packet.flags.stillOnValidPoly;
|
||||
ped->m_bUsesCollision = packet.flags.usesCollision;
|
||||
ped->SetUsesCollision(packet.flags.usesCollision);
|
||||
ped->m_fContactSurfaceBrightness = static_cast<float>(packet.contactSurfaceBrightness) / 100.0f;
|
||||
RetrievePedAnimation(ped, packet.animState);
|
||||
|
||||
|
|
@ -521,7 +521,7 @@ void CReplay::ProcessPedUpdate(CPed* ped, float interpValue, CAddressInReplayBuf
|
|||
}
|
||||
}
|
||||
|
||||
ped->m_nAreaCode = static_cast<eAreaCodes>(CGame::currArea);
|
||||
ped->SetAreaCode(static_cast<eAreaCodes>(CGame::currArea));
|
||||
CWorld::Remove(ped);
|
||||
CWorld::Add(ped);
|
||||
}
|
||||
|
|
@ -651,7 +651,7 @@ void CReplay::ProcessLookAroundCam() {
|
|||
if (FramesActiveLookAroundCam) {
|
||||
const auto MakeVisible = [](auto* entity) {
|
||||
if (entity) {
|
||||
entity->m_bIsVisible = true;
|
||||
entity->SetIsVisible(true);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -833,7 +833,7 @@ void CReplay::RecordThisFrame() {
|
|||
// Calculate the frame size beforehand.
|
||||
auto framePacketSize = 116u;
|
||||
for (const auto& veh : GetVehiclePool()->GetAllValid()) {
|
||||
if (veh.m_pRwObject) {
|
||||
if (veh.GetRwObject()) {
|
||||
switch (veh.m_nVehicleSubType) {
|
||||
case VEHICLE_TYPE_AUTOMOBILE:
|
||||
case VEHICLE_TYPE_MTRUCK:
|
||||
|
|
@ -860,7 +860,7 @@ void CReplay::RecordThisFrame() {
|
|||
}
|
||||
|
||||
for (const auto& ped : GetPedPool()->GetAllValid()) {
|
||||
if (ped.m_pRwObject) {
|
||||
if (ped.GetRwObject()) {
|
||||
if (!ped.bHasAlreadyBeenRecorded) {
|
||||
// New ped!
|
||||
framePacketSize += FindSizeOfPacket(REPLAY_PACKET_PED_HEADER);
|
||||
|
|
@ -904,7 +904,7 @@ void CReplay::RecordThisFrame() {
|
|||
Record.Write<tReplayTimerBlock>({.timeInMS = CTimer::GetTimeInMS()});
|
||||
|
||||
for (auto&& [i, veh] : GetVehiclePool()->GetAllValidWithIndex()) {
|
||||
if (veh.m_pRwObject) {
|
||||
if (veh.GetRwObject()) {
|
||||
switch (veh.m_nVehicleSubType) {
|
||||
case VEHICLE_TYPE_AUTOMOBILE:
|
||||
case VEHICLE_TYPE_MTRUCK:
|
||||
|
|
@ -950,7 +950,7 @@ void CReplay::RecordThisFrame() {
|
|||
}
|
||||
|
||||
for (auto&& [i, ped] : GetPedPool()->GetAllValidWithIndex()) {
|
||||
if (ped.m_pRwObject) {
|
||||
if (ped.GetRwObject()) {
|
||||
if (!ped.bHasAlreadyBeenRecorded) {
|
||||
// New ped!
|
||||
const auto modelId = ped.m_nModelIndex;
|
||||
|
|
@ -1044,7 +1044,7 @@ CPed* CReplay::DealWithNewPedPacket(const tReplayPedHeaderBlock& pedPacket, bool
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
ped->m_nStatus = STATUS_PLAYER_PLAYBACK_FROM_BUFFER;
|
||||
ped->SetStatus(STATUS_PLAYER_PLAYBACK_FROM_BUFFER);
|
||||
ped->bUsedForReplay = true;
|
||||
ped->GetMatrix().SetUnity();
|
||||
ped->SetCharCreatedBy(PED_GAME_MISSION);
|
||||
|
|
@ -1061,9 +1061,9 @@ CPed* CReplay::DealWithNewPedPacket(const tReplayPedHeaderBlock& pedPacket, bool
|
|||
// 0x45F380
|
||||
bool CReplay::PlayBackThisFrameInterpolation(CAddressInReplayBuffer& buffer, float interpolation, uint32* outTimer) {
|
||||
const auto SetupVehicle = [](const tReplayVehicleBlock& packet, CVehicle* vehicle) {
|
||||
vehicle->m_nStatus = STATUS_PLAYER_PLAYBACK_FROM_BUFFER;
|
||||
vehicle->SetStatus(STATUS_PLAYER_PLAYBACK_FROM_BUFFER);
|
||||
vehicle->vehicleFlags.bUsedForReplay = true;
|
||||
vehicle->m_bUsesCollision = false;
|
||||
vehicle->SetUsesCollision(false);
|
||||
packet.matrix.DecompressIntoFullMatrix(vehicle->GetMatrix());
|
||||
vehicle->m_nPrimaryColor = packet.primaryColor;
|
||||
vehicle->m_nSecondaryColor = packet.secondaryColor;
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ void tReplayVehicleBlock::ExtractVehicleUpdateData(CVehicle& veh, float interpol
|
|||
}
|
||||
|
||||
veh.vehicleFlags.bEngineOn = veh.vehicleFlags.bEngineBroken != true;
|
||||
veh.m_nAreaCode = static_cast<eAreaCodes>(CGame::currArea); // FIXME
|
||||
veh.SetAreaCode(static_cast<eAreaCodes>(CGame::currArea)); // FIXME
|
||||
|
||||
CWorld::Remove(&veh);
|
||||
CWorld::Add(&veh);
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ void CRope::ReleasePickedUpObject() {
|
|||
m_pRopeAttachObject->AsPhysical()->physicalFlags.b32 = false;
|
||||
m_pRopeAttachObject = nullptr;
|
||||
}
|
||||
m_pAttachedEntity->m_bUsesCollision = true;
|
||||
m_pAttachedEntity->SetUsesCollision(true);
|
||||
m_nFlags1 = 60; // 6th, 7th bits set
|
||||
}
|
||||
|
||||
|
|
@ -175,16 +175,16 @@ void CRope::PickUpObject(CEntity* obj) {
|
|||
// MultiplyMatrixWithVector should be used here
|
||||
CVector height = { {}, {}, CRopes::FindPickupHeight(obj) };
|
||||
m_pAttachedEntity->SetPosn(obj->GetPosition() + obj->GetMatrix().TransformVector(height));
|
||||
m_pAttachedEntity->m_bUsesCollision = false;
|
||||
m_pAttachedEntity->SetUsesCollision(false);
|
||||
|
||||
obj->AsPhysical()->physicalFlags.bAttachedToEntity = true;
|
||||
if (obj->IsVehicle()) {
|
||||
if (obj->m_nStatus == eEntityStatus::STATUS_SIMPLE)
|
||||
if (obj->GetIsTypeVehicle()) {
|
||||
if (obj->GetStatus() == STATUS_SIMPLE)
|
||||
{
|
||||
obj->m_nStatus = eEntityStatus::STATUS_PHYSICS;
|
||||
obj->SetStatus(STATUS_PHYSICS);
|
||||
}
|
||||
} else if (obj->IsObject()) {
|
||||
if (obj->m_bIsStatic || obj->m_bIsStaticWaitingForCollision) {
|
||||
} else if (obj->GetIsTypeObject()) {
|
||||
if (obj->GetIsStatic()) {
|
||||
obj->AsObject()->SetIsStatic(false);
|
||||
obj->AsObject()->AddToMovingList();
|
||||
obj->AsObject()->m_nFakePhysics = 0;
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ auto SetCharNeverTargetted(CPed& ped, bool bNeverEverTargetThisPed) {
|
|||
|
||||
// SET_CHAR_COLLISION
|
||||
auto SetCharCollision(CPed& ped, bool bUsesCollision) {
|
||||
ped.m_bUsesCollision = bUsesCollision;
|
||||
ped.SetUsesCollision(bUsesCollision);
|
||||
}
|
||||
|
||||
// IS_CHAR_SHOOTING
|
||||
|
|
@ -149,7 +149,7 @@ auto SetCharAllowedToDuck(CPed& ped, CVector rotdeg) {
|
|||
}
|
||||
|
||||
auto SetCharAreaVisible(CPed& ped, eAreaCodes area) {
|
||||
ped.m_nAreaCode = area;
|
||||
ped.SetAreaCode(area);
|
||||
if (area != AREA_CODE_NORMAL_WORLD) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -583,7 +583,7 @@ auto SetCharHeading(CPed& ped, float deg) {
|
|||
const auto rad = DegreesToRadians(FixAngleDegrees(deg));
|
||||
ped.m_fAimingRotation = ped.m_fCurrentRotation = rad;
|
||||
ped.SetHeading(rad);
|
||||
ped.UpdateRW();
|
||||
ped.UpdateRwMatrix();
|
||||
}
|
||||
|
||||
// IS_CHAR_TOUCHING_OBJECT
|
||||
|
|
@ -806,7 +806,7 @@ auto SetCharVisible(CPed& ped, bool isVisible) {
|
|||
if (&ped == FindPlayerPed()) {
|
||||
gPlayerPedVisible = isVisible;
|
||||
}
|
||||
ped.m_bIsVisible = isVisible;
|
||||
ped.SetIsVisible(isVisible);
|
||||
}
|
||||
|
||||
// REMOVE_CHAR_ELEGANTLY
|
||||
|
|
@ -1151,7 +1151,7 @@ auto SetLoadCollisionForCharFlag(CRunningScript& S, CPed& ped, bool loadCol) {
|
|||
DoSetPedIsWaitingForCollision(S, ped);
|
||||
} else if (ped.m_bIsStaticWaitingForCollision) {
|
||||
ped.m_bIsStaticWaitingForCollision = false;
|
||||
if (!ped.IsStatic()) { // TODO: I think this is inlined
|
||||
if (!ped.GetIsStatic()) {
|
||||
ped.AddToMovingList();
|
||||
}
|
||||
}
|
||||
|
|
@ -1431,7 +1431,7 @@ bool IsCharGettingInToACar(CPed& ped) {
|
|||
|
||||
// GET_CHAR_AREA_VISIBLE
|
||||
uint32 GetCharAreaVisible(CPed& ped) {
|
||||
return ped.m_nAreaCode != eAreaCodes::AREA_CODE_NORMAL_WORLD;
|
||||
return ped.GetAreaCode() != eAreaCodes::AREA_CODE_NORMAL_WORLD;
|
||||
}
|
||||
|
||||
// HAS_CHAR_SPOTTED_CHAR_IN_FRONT
|
||||
|
|
@ -1459,12 +1459,12 @@ bool IsCharTouchingChar(CPed& ped, CPed& other) {
|
|||
|
||||
// IS_CHAR_ATTACHED_TO_ANY_CAR
|
||||
bool IsCharAttachedToAnyCar(CPed* ped) {
|
||||
return ped && ped->m_nType == ENTITY_TYPE_VEHICLE;
|
||||
return ped && ped->GetIsTypeVehicle();
|
||||
}
|
||||
|
||||
// STORE_CAR_CHAR_IS_ATTACHED_TO_NO_SAVE
|
||||
CVehicle* StoreCarCharIsAttachedToNoSave(CPed* ped) {
|
||||
if (ped->m_nType != ENTITY_TYPE_VEHICLE) {
|
||||
if (!ped->GetIsTypeVehicle()) {
|
||||
return nullptr;
|
||||
}
|
||||
return ped->m_pAttachedTo->AsVehicle();
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ CObject& CreateObject(CRunningScript& S, script::Model model, CVector posn) {
|
|||
posn.z += object->GetDistanceFromCentreOfMassToBaseOfModel();
|
||||
object->SetPosn(posn);
|
||||
object->SetOrientation(CVector{0.0f});
|
||||
object->UpdateRW();
|
||||
object->UpdateRwMatrix();
|
||||
object->UpdateRwFrame();
|
||||
if (mi->AsLodAtomicModelInfoPtr()) {
|
||||
object->SetupBigBuilding();
|
||||
|
|
@ -99,7 +99,7 @@ void SetObjectScale(CObject& object, float scale) {
|
|||
}
|
||||
|
||||
void SetObjectCollision(CObject& object, bool enable) {
|
||||
object.m_bUsesCollision = enable;
|
||||
object.SetUsesCollision(enable);
|
||||
}
|
||||
|
||||
bool DoesObjectHaveThisModel(CObject& object, script::Model model) {
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ void MakePlayerSafeForCutscene(uint32 playerIdx) {
|
|||
/// IS_PLAYER_TARGETTING_CHAR(0457)
|
||||
bool IsPlayerTargettingChar(CPlayerPed& player, CPed* target) {
|
||||
CEntity* targetedObject = player.m_pTargetedObject;
|
||||
if (targetedObject && targetedObject->IsPed() && targetedObject == target) {
|
||||
if (targetedObject && targetedObject->GetIsTypePed() && targetedObject == target) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -253,7 +253,7 @@ bool IsPlayerTargettingChar(CPlayerPed& player, CPed* target) {
|
|||
/// IS_PLAYER_TARGETTING_OBJECT(0458)
|
||||
bool IsPlayerTargettingObject(CPlayerPed& player, CObject* target) {
|
||||
CEntity* targetedObject = player.m_pTargetedObject;
|
||||
return targetedObject && targetedObject->IsObject() && targetedObject == target;
|
||||
return targetedObject && targetedObject->GetIsTypeObject() && targetedObject == target;
|
||||
}
|
||||
|
||||
/// GIVE_REMOTE_CONTROLLED_MODEL_TO_PLAYER(046E)
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ void DisableHeliAudio(CVehicle& vehicle, bool enable) {
|
|||
|
||||
bool IsCarInAirProper(CRunningScript& S, CVehicle& vehicle) {
|
||||
for (auto* const e : vehicle.GetCollidingEntities()) {
|
||||
if (e && (e->IsBuilding() || e->IsVehicle())) {
|
||||
if (e && (e->GetIsTypeBuilding() || e->GetIsTypeVehicle())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue