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

Merge remote-tracking branch 'upstream/miami' into miami

This commit is contained in:
Nikolay Korolev 2020-10-18 17:30:51 +03:00
commit d7789661cd
23 changed files with 198 additions and 158 deletions

View file

@ -1,4 +1,4 @@
#include "common.h"
#include "common.h"
#include "AudioManager.h"
#include "audio_enums.h"
@ -993,7 +993,7 @@ cAudioManager::ProcessVehicleRoadNoise(cVehicleParams *params)
int32 emittingVol;
uint32 freq;
float modificator;
float multiplier;
int sampleFreq;
float velocity;
@ -1016,9 +1016,9 @@ cAudioManager::ProcessVehicleRoadNoise(cVehicleParams *params)
freq = 6050 * emittingVol / 30 + 16000;
} else {
m_sQueueSample.m_nSampleIndex = SFX_ROAD_NOISE;
modificator = m_sQueueSample.m_fDistance / 190.f;
multiplier = (m_sQueueSample.m_fDistance / SOUND_INTENSITY) * 0.5f;
sampleFreq = SampleManager.GetSampleBaseFrequency(SFX_ROAD_NOISE);
freq = (sampleFreq * modificator) + ((3 * sampleFreq) / 4);
freq = (sampleFreq * multiplier) + ((3 * sampleFreq) / 4);
}
m_sQueueSample.m_nFrequency = freq;
m_sQueueSample.m_nLoopCount = 0;
@ -1046,7 +1046,7 @@ cAudioManager::ProcessWetRoadNoise(cVehicleParams *params)
float relativeVelocity;
int32 emittingVol;
float modificator;
float multiplier;
int freq;
float velChange;
@ -1066,9 +1066,13 @@ cAudioManager::ProcessWetRoadNoise(cVehicleParams *params)
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nReleasingVolumeModificator = 3;
modificator = m_sQueueSample.m_fDistance / 6.f;
#ifdef FIX_BUGS
multiplier = (m_sQueueSample.m_fDistance / SOUND_INTENSITY) * 0.5f;
#else
multiplier = (m_sQueueSample.m_fDistance / 3.0f) * 0.5f;
#endif
freq = SampleManager.GetSampleBaseFrequency(SFX_ROAD_NOISE);
m_sQueueSample.m_nFrequency = freq + freq * modificator;
m_sQueueSample.m_nFrequency = freq + freq * multiplier;
m_sQueueSample.m_nLoopCount = 0;
m_sQueueSample.m_nEmittingVolume = emittingVol;
m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
@ -4923,17 +4927,25 @@ cAudioManager::ProcessFires(int32)
void
cAudioManager::ProcessWaterCannon(int32)
{
const float SOUND_INTENSITY = 900.0f;
const float SOUND_INTENSITY = 30.0f;
for (int32 i = 0; i < NUM_WATERCANNONS; i++) {
if (CWaterCannons::aCannons[i].m_nId) {
m_sQueueSample.m_vecPos = CWaterCannons::aCannons[0].m_avecPos[CWaterCannons::aCannons[i].m_nCur];
float distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
if (distSquared < SOUND_INTENSITY) {
if (distSquared < SQR(SOUND_INTENSITY)) {
m_sQueueSample.m_fDistance = Sqrt(distSquared);
#ifdef FIX_BUGS
m_sQueueSample.m_nVolume = ComputeVolume(50, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
#else
m_sQueueSample.m_nVolume = ComputeVolume(50, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance);
#endif
if (m_sQueueSample.m_nVolume != 0) {
#ifdef FIX_BUGS
m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
#else
m_sQueueSample.m_fSoundIntensity = SQR(SOUND_INTENSITY);
#endif
m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_nFrequency = 15591;

View file

@ -122,11 +122,11 @@ CPickup::GiveUsAPickUpObject(int32 handle)
{
CObject *object;
if (handle <= 0) object = new CObject(m_eModelIndex, false);
else {
if (handle >= 0) {
CPools::MakeSureSlotInObjectPoolIsEmpty(handle);
object = new(handle) CObject(m_eModelIndex, false);
}
object = new (handle) CObject(m_eModelIndex, false);
} else
object = new CObject(m_eModelIndex, false);
if (object == nil) return nil;
object->ObjectCreatedBy = MISSION_OBJECT;
@ -729,7 +729,7 @@ CPickups::Update()
#ifdef CAMERA_PICKUP
if ( bPickUpcamActivated ) // taken from PS2
{
float dist = (FindPlayerCoors() - StaticCamCoors).Magnitude2D();
float dist = Distance2D(StaticCamCoors, FindPlayerCoors());
float mult;
if ( dist < 10.0f )
mult = 1.0f - (dist / 10.0f );
@ -745,8 +745,7 @@ CPickups::Update()
TheCamera.TakeControl(FindPlayerVehicle(), CCam::MODE_FIXED, JUMP_CUT, CAMCONTROL_SCRIPT);
}
if ( FindPlayerVehicle() != pPlayerVehicle
|| (FindPlayerCoors() - StaticCamCoors).Magnitude() > 40.0f
if ( FindPlayerVehicle() != pPlayerVehicle || Distance(StaticCamCoors, FindPlayerCoors()) > 40.0f
|| ((CTimer::GetTimeInMilliseconds() - StaticCamStartTime) > 60000) )
{
TheCamera.RestoreWithJumpCut();
@ -836,7 +835,7 @@ CPickups::DoPickUpEffects(CEntity *entity)
CObject *object = (CObject*)entity;
if (object->bPickupObjWithMessage || object->bOutOfStock || object->m_nBonusValue) {
float dist = (TheCamera.GetPosition() - pos).Magnitude();
float dist = Distance2D(pos, TheCamera.GetPosition());
const float MAXDIST = 12.0f;
if (dist < MAXDIST && NumMessages < NUMPICKUPMESSAGES) {
@ -879,7 +878,7 @@ void
CPickups::DoMineEffects(CEntity *entity)
{
const CVector &pos = entity->GetPosition();
float dist = (TheCamera.GetPosition() - pos).Magnitude();
float dist = Distance(pos, TheCamera.GetPosition());
const float MAXDIST = 20.0f;
if (dist < MAXDIST) {
@ -898,7 +897,7 @@ void
CPickups::DoMoneyEffects(CEntity *entity)
{
const CVector &pos = entity->GetPosition();
float dist = (TheCamera.GetPosition() - pos).Magnitude();
float dist = Distance(pos, TheCamera.GetPosition());
const float MAXDIST = 20.0f;
if (dist < MAXDIST) {
@ -917,7 +916,7 @@ void
CPickups::DoCollectableEffects(CEntity *entity)
{
const CVector &pos = entity->GetPosition();
float dist = (TheCamera.GetPosition() - pos).Magnitude();
float dist = Distance(pos, TheCamera.GetPosition());
const float MAXDIST = 14.0f;
if (dist < MAXDIST) {

View file

@ -236,7 +236,7 @@ CRoadBlocks::CreateRoadBlockBetween2Points(CVector point1, CVector point2)
tmp.GetPosition().z += fModelRadius - 0.6f;
pVehicle->m_matrix = tmp;
pVehicle->PlaceOnRoadProperly();
pVehicle->bIsStatic = false;
pVehicle->SetIsStatic(false);
pVehicle->m_matrix.UpdateRW();
pVehicle->m_nDoorLock = CARLOCK_UNLOCKED;
CCarCtrl::JoinCarWithRoadSystem(pVehicle);

View file

@ -1704,7 +1704,7 @@ static void PossiblyWakeThisEntity(CPhysical* pEntity, bool ifColLoaded = false)
return;
if (!ifColLoaded || CColStore::HasCollisionLoaded(pEntity->GetPosition())) {
pEntity->bIsStaticWaitingForCollision = false;
if (!pEntity->IsStatic())
if (!pEntity->GetIsStatic())
pEntity->AddToMovingList();
}
}
@ -2381,9 +2381,11 @@ void CTheScripts::Process()
case 4:
AllowMissionReplay = 5;
RetryMission(0, 0);
break;
case 6:
AllowMissionReplay = 7;
TimeToWaitTill = CTimer::GetTimeInMilliseconds() + 500;
break;
case 7:
if (TimeToWaitTill < CTimer::GetTimeInMilliseconds()) {
AllowMissionReplay = 0;
@ -3971,7 +3973,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
pos.z += car->GetDistanceFromCentreOfMassToBaseOfModel();
car->bIsStatic = false;
car->SetIsStatic(false);
/* Again weird usage of virtual functions. */
if (car->IsBoat()) {
car->Teleport(pos);
@ -9647,13 +9649,13 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
script_assert(pObject);
if (ScriptParams[1]) {
if (pObject->bIsStatic) {
pObject->bIsStatic = false;
pObject->SetIsStatic(false);
pObject->AddToMovingList();
}
}
else {
if (!pObject->bIsStatic) {
pObject->bIsStatic = true;
pObject->SetIsStatic(true);
pObject->RemoveFromMovingList();
}
}
@ -13725,7 +13727,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
pVehicle->bDontLoadCollision = true;
if (pVehicle->bIsStaticWaitingForCollision) {
pVehicle->bIsStaticWaitingForCollision = false;
if (!pVehicle->IsStatic())
if (!pVehicle->GetIsStatic())
pVehicle->AddToMovingList();
}
}
@ -13748,7 +13750,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
pPed->bDontLoadCollision = true;
if (pPed->bIsStaticWaitingForCollision) {
pPed->bIsStaticWaitingForCollision = false;
if (!pPed->IsStatic())
if (!pPed->GetIsStatic())
pPed->AddToMovingList();
}
}

View file

@ -4247,7 +4247,7 @@ CCam::GetLookFromLampPostPos(CEntity *Target, CPed *Cop, CVector &TargetCoors, C
CWorld::FindObjectsInRange(TargetCoors, 30.0f, true, &NumObjects, 15, Objects, false, false, false, true, true);
float NearestDist = 10000.0f;
for(i = 0; i < NumObjects; i++){
if(Objects[i]->IsStatic() && Objects[i]->GetUp().z > 0.9f && IsLampPost(Objects[i]->GetModelIndex())){
if(Objects[i]->GetIsStatic() && Objects[i]->GetUp().z > 0.9f && IsLampPost(Objects[i]->GetModelIndex())){
float Dist = (Objects[i]->GetPosition() - TargetCoors).Magnitude2D();
if(Abs(ARRESTCAM_LAMP_BEST_DIST - Dist) < NearestDist){
CVector TestStart = Objects[i]->GetColModel()->boundingBox.max;

View file

@ -272,7 +272,7 @@ uint8 CRadar::CalculateBlipAlpha(float dist)
return 255;
if (dist <= 10.0f)
return (128.0f * ((dist - 1.0f) / 4.0f)) + ((1.0f - (dist - 1.0f) / 4.0f) * 255.0f);
return (128.0f * ((dist - 1.0f) / 9.0f)) + ((1.0f - (dist - 1.0f) / 9.0f) * 255.0f);
return 128;
}

View file

@ -79,7 +79,7 @@ CWorld::Add(CEntity *ent)
if(ent->IsBuilding() || ent->IsDummy()) return;
if(!ent->IsStatic()) ((CPhysical *)ent)->AddToMovingList();
if(!ent->GetIsStatic()) ((CPhysical *)ent)->AddToMovingList();
}
void
@ -94,7 +94,7 @@ CWorld::Remove(CEntity *ent)
if(ent->IsBuilding() || ent->IsDummy()) return;
if(!ent->IsStatic()) ((CPhysical *)ent)->RemoveFromMovingList();
if(!ent->GetIsStatic()) ((CPhysical *)ent)->RemoveFromMovingList();
}
void
@ -1962,7 +1962,7 @@ CWorld::Process(void)
RemoveEntityInsteadOfProcessingIt(movingEnt);
} else {
movingEnt->ProcessControl();
if(movingEnt->IsStatic()) { movingEnt->RemoveFromMovingList(); }
if(movingEnt->GetIsStatic()) { movingEnt->RemoveFromMovingList(); }
}
}
bForceProcessControl = true;
@ -1973,7 +1973,7 @@ CWorld::Process(void)
RemoveEntityInsteadOfProcessingIt(movingEnt);
} else {
movingEnt->ProcessControl();
if(movingEnt->IsStatic()) { movingEnt->RemoveFromMovingList(); }
if(movingEnt->GetIsStatic()) { movingEnt->RemoveFromMovingList(); }
}
}
}
@ -2133,13 +2133,13 @@ CWorld::TriggerExplosionSectorList(CPtrList &list, const CVector &position, floa
CObject *pObject = (CObject *)pEntity;
CVehicle *pVehicle = (CVehicle *)pEntity;
if(!pEntity->bExplosionProof && (!pEntity->IsPed() || !pPed->bInVehicle)) {
if(pEntity->IsStatic()) {
if(pEntity->GetIsStatic()) {
if(pEntity->IsObject()) {
if (fPower > pObject->m_fUprootLimit || IsFence(pObject->GetModelIndex())) {
if (IsGlass(pObject->GetModelIndex())) {
CGlass::WindowRespondsToExplosion(pObject, position);
} else {
pObject->bIsStatic = false;
pObject->SetIsStatic(false);
pObject->AddToMovingList();
int16 modelId = pEntity->GetModelIndex();
if(modelId != MI_FIRE_HYDRANT ||
@ -2157,18 +2157,18 @@ CWorld::TriggerExplosionSectorList(CPtrList &list, const CVector &position, floa
}
}
}
if(pEntity->IsStatic()) {
if(pEntity->GetIsStatic()) {
float fDamageMultiplier =
(fRadius - fMagnitude) * 2.0f / fRadius;
float fDamage = 300.0f * Min(fDamageMultiplier, 1.0f);
pObject->ObjectDamage(fDamage);
}
} else {
pEntity->bIsStatic = false;
pEntity->SetIsStatic(false);
pEntity->AddToMovingList();
}
}
if(!pEntity->IsStatic()) {
if(!pEntity->GetIsStatic()) {
float fDamageMultiplier = Min((fRadius - fMagnitude) * 2.0f / fRadius, 1.0f);
CVector vecForceDir =
vecDistance * (fPower * pEntity->m_fMass * 0.00071429f * fDamageMultiplier /

View file

@ -104,7 +104,8 @@ public:
eEntityStatus GetStatus() const { return (eEntityStatus)m_status; }
void SetStatus(eEntityStatus status) { m_status = status; }
CColModel *GetColModel(void) { return CModelInfo::GetModelInfo(m_modelIndex)->GetColModel(); }
bool IsStatic(void) { return bIsStatic || bIsStaticWaitingForCollision; }
bool GetIsStatic(void) const { return bIsStatic || bIsStaticWaitingForCollision; }
void SetIsStatic(bool state) { bIsStatic = state; }
#ifdef COMPATIBLE_SAVES
void SaveEntityFlags(uint8*& buf);
void LoadEntityFlags(uint8*& buf);

View file

@ -344,7 +344,7 @@ CPhysical::ProcessEntityCollision(CEntity *ent, CColPoint *colpoints)
AddCollisionRecord(ent);
if(!ent->IsBuilding()) // Can't this catch dummies too?
((CPhysical*)ent)->AddCollisionRecord(this);
if(ent->IsBuilding() || ent->IsStatic())
if(ent->IsBuilding() || ent->GetIsStatic())
this->bHasHitWall = true;
}
return numSpheres;
@ -380,7 +380,7 @@ CPhysical::ProcessControl(void)
m_nStaticFrames++;
if(m_nStaticFrames > 10){
m_nStaticFrames = 10;
bIsStatic = true;
SetIsStatic(true);
m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
m_vecTurnSpeed = CVector(0.0f, 0.0f, 0.0f);
m_vecMoveFriction = m_vecMoveSpeed;
@ -614,7 +614,7 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
}
float speedA, speedB;
if(B->IsStatic() && !foo){
if(B->GetIsStatic() && !foo){
if(A->bPedPhysics){
speedA = DotProduct(A->m_vecMoveSpeed, colpoint.normal);
if(speedA < 0.0f){
@ -625,7 +625,7 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
if(IsGlass(B->GetModelIndex()))
CGlass::WindowRespondsToCollision(B, impulseA, A->m_vecMoveSpeed, colpoint.point, false);
else if(!B->bInfiniteMass){
B->bIsStatic = false;
B->SetIsStatic(false);
CWorld::Players[CWorld::PlayerInFocus].m_nHavocLevel += 2;
CStats::PropertyDestroyed += CGeneral::GetRandomNumberInRange(30, 60);
}
@ -637,7 +637,7 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
return true;
}
}else if(!B->bInfiniteMass)
B->bIsStatic = false;
B->SetIsStatic(false);
if(B->bInfiniteMass){
impulseA = -speedA * A->m_fMass;
@ -675,7 +675,7 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
if(IsGlass(B->GetModelIndex()))
CGlass::WindowRespondsToCollision(B, impulseA, A->m_vecMoveSpeed, colpoint.point, false);
else
B->bIsStatic = false;
B->SetIsStatic(false);
int16 model = B->GetModelIndex();
if(model == MI_FIRE_HYDRANT && !Bobj->bHasBeenDamaged){
CParticleObject::AddObject(POBJECT_FIRE_HYDRANT, B->GetPosition() - CVector(0.0f, 0.0f, 0.5f), true);
@ -699,11 +699,11 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
return true;
}
}else if(!B->bInfiniteMass)
B->bIsStatic = false;
B->SetIsStatic(false);
}
}
if(B->IsStatic())
if(B->GetIsStatic())
return false;
if(!B->bInfiniteMass && !B->m_phy_flagA08)
B->AddToMovingList();
@ -1231,7 +1231,7 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
canshift = true;
else
canshift = A->IsPed() &&
B->IsObject() && B->IsStatic() && !Bobj->bHasBeenDamaged;
B->IsObject() && B->GetIsStatic() && !Bobj->bHasBeenDamaged;
if(B == A ||
B->m_scanCode == CWorld::GetCurrentScanCode() ||
!B->bUsesCollision ||
@ -1255,7 +1255,7 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
CObject *Aobj = (CObject*)A;
if(Aobj->ObjectCreatedBy != TEMP_OBJECT &&
!Aobj->bHasBeenDamaged &&
Aobj->IsStatic()){
Aobj->GetIsStatic()){
if(Aobj->m_pCollidingEntity == B)
Aobj->m_pCollidingEntity = nil;
}else if(Aobj->m_pCollidingEntity != B){
@ -1272,7 +1272,7 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
CObject *Bobj = (CObject*)B;
if(Bobj->ObjectCreatedBy != TEMP_OBJECT &&
!Bobj->bHasBeenDamaged &&
Bobj->IsStatic()){
Bobj->GetIsStatic()){
if(Bobj->m_pCollidingEntity == A)
Bobj->m_pCollidingEntity = nil;
}else if(Bobj->m_pCollidingEntity != A){
@ -1595,7 +1595,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
skipCollision = true;
else if(Aobj->ObjectCreatedBy == TEMP_OBJECT ||
Aobj->bHasBeenDamaged ||
!Aobj->IsStatic()){
!Aobj->GetIsStatic()){
if(Aobj->m_pCollidingEntity == B)
skipCollision = true;
else if(Aobj->m_nCollisionDamageEffect < DAMAGE_EFFECT_SMASH_COMPLETELY){
@ -1614,7 +1614,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
skipCollision = true;
else if(Bobj->ObjectCreatedBy == TEMP_OBJECT ||
Bobj->bHasBeenDamaged ||
!Bobj->IsStatic()){
!Bobj->GetIsStatic()){
if(Bobj->m_pCollidingEntity == A)
skipCollision = true;
else if(Bobj->m_nCollisionDamageEffect < DAMAGE_EFFECT_SMASH_COMPLETELY){

View file

@ -115,6 +115,14 @@ Distance(const CVector &v1, const CVector &v2)
return (v2 - v1).Magnitude();
}
inline float
Distance2D(const CVector &v1, const CVector &v2)
{
float x = v2.x - v1.x;
float y = v2.y - v1.y;
return Sqrt(x*x + y*y);
}
class CMatrix;
CVector Multiply3x3(const CMatrix &mat, const CVector &vec);

View file

@ -98,7 +98,7 @@ CObject::ProcessControl(void)
CPhysical::ProcessControl();
if (mod_Buoyancy.ProcessBuoyancy(this, m_fBuoyancy, &point, &impulse)) {
bIsInWater = true;
bIsStatic = false;
SetIsStatic(false);
ApplyMoveForce(impulse);
ApplyTurnForce(impulse, point);
float fTimeStep = Pow(0.97f, CTimer::GetTimeStep());
@ -197,7 +197,7 @@ CObject::ObjectDamage(float amount)
case DAMAGE_EFFECT_SMASH_COMPLETELY:
bIsVisible = false;
bUsesCollision = false;
bIsStatic = true;
SetIsStatic(true);
bExplosionProof = true;
SetMoveSpeed(0.0f, 0.0f, 0.0f);
SetTurnSpeed(0.0f, 0.0f, 0.0f);
@ -209,7 +209,7 @@ CObject::ObjectDamage(float amount)
else {
bIsVisible = false;
bUsesCollision = false;
bIsStatic = true;
SetIsStatic(true);
bExplosionProof = true;
SetMoveSpeed(0.0f, 0.0f, 0.0f);
SetTurnSpeed(0.0f, 0.0f, 0.0f);
@ -218,7 +218,7 @@ CObject::ObjectDamage(float amount)
case DAMAGE_EFFECT_SMASH_CARDBOARD_COMPLETELY: {
bIsVisible = false;
bUsesCollision = false;
bIsStatic = true;
SetIsStatic(true);
bExplosionProof = true;
SetMoveSpeed(0.0f, 0.0f, 0.0f);
SetTurnSpeed(0.0f, 0.0f, 0.0f);
@ -241,7 +241,7 @@ CObject::ObjectDamage(float amount)
case DAMAGE_EFFECT_SMASH_WOODENBOX_COMPLETELY: {
bIsVisible = false;
bUsesCollision = false;
bIsStatic = true;
SetIsStatic(true);
bExplosionProof = true;
SetMoveSpeed(0.0f, 0.0f, 0.0f);
SetTurnSpeed(0.0f, 0.0f, 0.0f);
@ -264,7 +264,7 @@ CObject::ObjectDamage(float amount)
case DAMAGE_EFFECT_SMASH_TRAFFICCONE_COMPLETELY: {
bIsVisible = false;
bUsesCollision = false;
bIsStatic = true;
SetIsStatic(true);
bExplosionProof = true;
SetMoveSpeed(0.0f, 0.0f, 0.0f);
SetTurnSpeed(0.0f, 0.0f, 0.0f);
@ -289,7 +289,7 @@ CObject::ObjectDamage(float amount)
case DAMAGE_EFFECT_SMASH_BARPOST_COMPLETELY: {
bIsVisible = false;
bUsesCollision = false;
bIsStatic = true;
SetIsStatic(true);
bExplosionProof = true;
SetMoveSpeed(0.0f, 0.0f, 0.0f);
SetTurnSpeed(0.0f, 0.0f, 0.0f);
@ -329,7 +329,7 @@ CObject::Init(void)
CObjectData::SetObjectData(GetModelIndex(), *this);
m_nEndOfLifeTime = 0;
ObjectCreatedBy = GAME_OBJECT;
bIsStatic = true;
SetIsStatic(true);
bIsPickup = false;
bPickupObjWithMessage = false;
bOutOfStock = false;

View file

@ -425,7 +425,7 @@ void CCivilianPed::FindNearbyAttractorsSectorList(CPtrList& list, float& minDist
{
for (CPtrNode* pNode = list.first; pNode != nil; pNode = pNode->next) {
CEntity* pEntity = (CEntity*)pNode->item;
if (pEntity->IsObject() && (!pEntity->IsStatic() || ((CObject*)pEntity)->bHasBeenDamaged))
if (pEntity->IsObject() && (!pEntity->GetIsStatic() || ((CObject*)pEntity)->bHasBeenDamaged))
continue;
CBaseModelInfo* pModelInfo = CModelInfo::GetModelInfo(pEntity->GetModelIndex());
for (int i = 0; i < pModelInfo->GetNum2dEffects(); i++) {

View file

@ -15403,17 +15403,17 @@ CPed::ProcessObjective(void)
CVector distance = m_nextRoutePointPos - GetPosition();
distance.z = 0.0f;
if (m_objective == OBJECTIVE_GOTO_SHELTER_ON_FOOT) {
if (m_nMoveState == PEDMOVE_SPRINT && distance.Magnitude() < SQR(2.0f)) {
if (m_nMoveState == PEDMOVE_RUN && distance.Magnitude() < SQR(2.0f)) {
SetMoveState(PEDMOVE_WALK);
bIsRunning = false;
}
else if (CWeather::Rain < 0.2f && m_attractor) {
if (CWeather::Rain < 0.2f && m_attractor) {
GetPedAttractorManager()->DeRegisterPed(this, m_attractor);
return;
}
}
else if (m_objective == OBJECTIVE_GOTO_ICE_CREAM_VAN_ON_FOOT) {
if (m_nMoveState == PEDMOVE_SPRINT && distance.Magnitude() < SQR(4.0f)) {
if (m_nMoveState == PEDMOVE_RUN && distance.Magnitude() < SQR(4.0f)) {
SetMoveState(PEDMOVE_WALK);
bIsRunning = false;
}
@ -15439,8 +15439,10 @@ CPed::ProcessObjective(void)
}
}
if (sq(m_distanceToCountSeekDone) < distance.MagnitudeSqr()) {
if (CTimer::GetTimeInMilliseconds() > m_nPedStateTimer || GetPedState() != PED_SEEK_POS)
if (CTimer::GetTimeInMilliseconds() > m_nPedStateTimer || GetPedState() != PED_SEEK_POS) {
m_vecSeekPos = m_nextRoutePointPos;
SetSeek(m_vecSeekPos, m_distanceToCountSeekDone);
}
}
else {
if (!bReachedAttractorHeadingTarget) {
@ -15510,6 +15512,10 @@ CPed::ProcessObjective(void)
SetObjective(OBJECTIVE_WAIT_ON_FOOT_AT_ICE_CREAM_VAN);
break;
}
} else {
m_prevObjective = OBJECTIVE_NONE;
SetObjective(OBJECTIVE_WAIT_ON_FOOT);
m_objectiveTimer = 0;
}
}
}
@ -15693,11 +15699,11 @@ CPed::ProcessObjective(void)
}
if (!pVan->m_bSirenOrAlarm) {
GetPedAttractorManager()->DeRegisterPed(this, m_attractor);
return; // ???
return; // Why?
}
if (pVan->GetStatus() == STATUS_WRECKED) {
GetPedAttractorManager()->DeRegisterPed(this, m_attractor);
return; // ???
return; // Why?
}
break;
}
@ -16422,11 +16428,11 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
if (!collidingEnt->IsBuilding())
((CPhysical*)collidingEnt)->AddCollisionRecord(this);
if (ourCollidedSpheres > 0 && (collidingEnt->IsBuilding() || collidingEnt->IsStatic())) {
if (ourCollidedSpheres > 0 && (collidingEnt->IsBuilding() || collidingEnt->GetIsStatic())) {
bHasHitWall = true;
}
}
if (collidingEnt->IsBuilding() || collidingEnt->IsStatic()) {
if (collidingEnt->IsBuilding() || collidingEnt->GetIsStatic()) {
if (bWasStanding) {
CVector sphereNormal;
float normalLength;
@ -17003,72 +17009,69 @@ CPed::ProcessBuoyancy(void)
}
}
}
float speedMult = 0.0f;
if (buoyancyImpulse.z / m_fMass > GRAVITY * CTimer::GetTimeStep()
|| mod_Buoyancy.m_waterlevel > GetPosition().z) {
}
float speedMult = 0.0f;
if (buoyancyImpulse.z / m_fMass > GRAVITY * CTimer::GetTimeStep()
|| mod_Buoyancy.m_waterlevel > GetPosition().z + 0.6f) {
speedMult = pow(0.9f, CTimer::GetTimeStep());
m_vecMoveSpeed.x *= speedMult;
m_vecMoveSpeed.y *= speedMult;
m_vecMoveSpeed.z *= speedMult;
bIsStanding = false;
bIsDrowning = true;
InflictDamage(nil, WEAPONTYPE_DROWNING, 3.0f * CTimer::GetTimeStep(), PEDPIECE_TORSO, 0);
}
if (buoyancyImpulse.z / m_fMass > GRAVITY * 0.25f * CTimer::GetTimeStep()) {
if (speedMult == 0.0f) {
speedMult = pow(0.9f, CTimer::GetTimeStep());
m_vecMoveSpeed.x *= speedMult;
m_vecMoveSpeed.y *= speedMult;
m_vecMoveSpeed.z *= speedMult;
bIsStanding = false;
bIsDrowning = true;
InflictDamage(nil, WEAPONTYPE_DROWNING, 3.0f * CTimer::GetTimeStep(), PEDPIECE_TORSO, 0);
}
if (buoyancyImpulse.z / m_fMass > GRAVITY * 0.25f * CTimer::GetTimeStep()) {
if (speedMult == 0.0f) {
speedMult = pow(0.9f, CTimer::GetTimeStep());
}
m_vecMoveSpeed.x *= speedMult;
m_vecMoveSpeed.y *= speedMult;
if (m_vecMoveSpeed.z >= -0.1f) {
if (m_vecMoveSpeed.z < -0.04f)
m_vecMoveSpeed.z = -0.02f;
} else {
m_vecMoveSpeed.z = -0.01f;
DMAudio.PlayOneShot(m_audioEntityId, SOUND_SPLASH, 0.0f);
CVector aBitForward = 2.2f * m_vecMoveSpeed + GetPosition();
float level = 0.0f;
if (CWaterLevel::GetWaterLevel(aBitForward, &level, false))
aBitForward.z = level;
m_vecMoveSpeed.x *= speedMult;
m_vecMoveSpeed.y *= speedMult;
if (m_vecMoveSpeed.z >= -0.1f) {
if (m_vecMoveSpeed.z < -0.04f)
m_vecMoveSpeed.z = -0.02f;
} else {
m_vecMoveSpeed.z = -0.01f;
DMAudio.PlayOneShot(m_audioEntityId, SOUND_SPLASH, 0.0f);
CVector aBitForward = 2.2f * m_vecMoveSpeed + GetPosition();
float level = 0.0f;
if (CWaterLevel::GetWaterLevel(aBitForward, &level, false))
aBitForward.z = level;
CParticleObject::AddObject(POBJECT_PED_WATER_SPLASH, aBitForward, CVector(0.0f, 0.0f, 0.1f), 0.0f, 200, color, true);
nGenerateRaindrops = CTimer::GetTimeInMilliseconds() + 80;
nGenerateWaterCircles = CTimer::GetTimeInMilliseconds() + 100;
CParticleObject::AddObject(POBJECT_PED_WATER_SPLASH, aBitForward, CVector(0.0f, 0.0f, 0.1f), 0.0f, 200, color, true);
nGenerateRaindrops = CTimer::GetTimeInMilliseconds() + 80;
nGenerateWaterCircles = CTimer::GetTimeInMilliseconds() + 100;
}
}
if (nGenerateWaterCircles && CTimer::GetTimeInMilliseconds() >= nGenerateWaterCircles) {
CVector pos = GetPosition();
float level = 0.0f;
if (CWaterLevel::GetWaterLevel(pos, &level, false))
pos.z = level;
if (pos.z != 0.0f) {
nGenerateWaterCircles = 0;
for(int i = 0; i < 4; i++) {
pos.x += CGeneral::GetRandomNumberInRange(-0.75f, 0.75f);
pos.y += CGeneral::GetRandomNumberInRange(-0.75f, 0.75f);
CParticle::AddParticle(PARTICLE_RAIN_SPLASH_BIGGROW, pos, CVector(0.0f, 0.0f, 0.0f), nil, 0.0f, color, 0, 0, 0, 0);
}
}
} else
return;
}
if (nGenerateRaindrops && CTimer::GetTimeInMilliseconds() >= nGenerateRaindrops) {
CVector pos = GetPosition();
float level = 0.0f;
if (CWaterLevel::GetWaterLevel(pos, &level, false))
pos.z = level;
if (pos.z >= 0.0f) {
pos.z += 0.25f;
nGenerateRaindrops = 0;
CParticleObject::AddObject(POBJECT_SPLASHES_AROUND, pos, CVector(0.0f, 0.0f, 0.0f), 4.5f, 1500, CRGBA(0,0,0,0), true);
}
}
} else
bTouchingWater = false;
if (nGenerateWaterCircles && CTimer::GetTimeInMilliseconds() >= nGenerateWaterCircles) {
CVector pos = GetPosition();
float level = 0.0f;
if (CWaterLevel::GetWaterLevel(pos, &level, false))
pos.z = level;
if (pos.z != 0.0f) {
nGenerateWaterCircles = 0;
for(int i = 0; i < 4; i++) {
pos.x += CGeneral::GetRandomNumberInRange(-0.75f, 0.75f);
pos.y += CGeneral::GetRandomNumberInRange(-0.75f, 0.75f);
CParticle::AddParticle(PARTICLE_RAIN_SPLASH_BIGGROW, pos, CVector(0.0f, 0.0f, 0.0f), nil, 0.0f, color, 0, 0, 0, 0);
}
}
}
if (nGenerateRaindrops && CTimer::GetTimeInMilliseconds() >= nGenerateRaindrops) {
CVector pos = GetPosition();
float level = 0.0f;
if (CWaterLevel::GetWaterLevel(pos, &level, false))
pos.z = level;
if (pos.z >= 0.0f) {
pos.z += 0.25f;
nGenerateRaindrops = 0;
CParticleObject::AddObject(POBJECT_SPLASHES_AROUND, pos, CVector(0.0f, 0.0f, 0.0f), 4.5f, 1500, CRGBA(0,0,0,0), true);
}
}
}
// --MIAMI: Done
@ -18411,7 +18414,7 @@ CPed::SeekCar(void)
{
m_fRotationCur = m_fRotationDest;
if (!bVehEnterDoorIsBlocked) {
vehToSeek->bIsStatic = false;
vehToSeek->SetIsStatic(false);
if (m_objective == OBJECTIVE_SOLICIT_VEHICLE) {
SetSolicit(1000);
} else if (m_objective == OBJECTIVE_BUY_ICE_CREAM) {

View file

@ -945,7 +945,7 @@ CPopulation::ConvertToRealObject(CDummyObject *dummy)
if (IsGlass(obj->GetModelIndex()) && !mi->m_isArtistGlass) {
obj->bIsVisible = false;
} else if (obj->GetModelIndex() == MI_BUOY) {
obj->bIsStatic = false;
obj->SetIsStatic(false);
obj->m_vecMoveSpeed = CVector(0.0f, 0.0f, -0.001f);
obj->bTouchingWater = true;
obj->AddToMovingList();

View file

@ -393,9 +393,9 @@ void
CGlass::AskForObjectToBeRenderedInGlass(CEntity *entity)
{
#ifdef FIX_BUGS
if ( NumGlassEntities < NUM_GLASSPANES )
if ( NumGlassEntities < NUM_GLASSENTITIES )
#else
if ( NumGlassEntities < NUM_GLASSPANES-1 )
if ( NumGlassEntities < NUM_GLASSENTITIES-1 )
#endif
{
apEntitiesToBeRendered[NumGlassEntities++] = entity;

View file

@ -209,7 +209,7 @@ CMotionBlurStreaks::Update(void)
{
int i;
for(i = 0; i < NUMMBLURSTREAKS; i++)
if(aStreaks[i].m_id)
if(aStreaks[i].m_id != 0)
aStreaks[i].Update();
}
@ -230,7 +230,7 @@ CMotionBlurStreaks::RegisterStreak(uintptr id, uint8 r, uint8 g, uint8 b, CVecto
}
}
// Find free slot
for(i = 0; aStreaks[i].m_id; i++)
for(i = 0; aStreaks[i].m_id != 0; i++)
if(i == NUMMBLURSTREAKS-1)
return;
// Create a new streak
@ -251,7 +251,7 @@ CMotionBlurStreaks::Render(void)
bool setRenderStates = false;
int i;
for(i = 0; i < NUMMBLURSTREAKS; i++)
if(aStreaks[i].m_id){
if(aStreaks[i].m_id != 0){
if(!setRenderStates){
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
@ -328,7 +328,7 @@ void CBulletTraces::Render(void)
RwIm3DVertexSetPos(&TraceVertices[4], sup.x + width.x, sup.y + width.y, sup.z + width.z);
RwIm3DVertexSetPos(&TraceVertices[5], sup.x - width.x, sup.y - width.y, sup.z - width.z);
LittleTest();
if (RwIm3DTransform(TraceVertices, ARRAY_SIZE(TraceVertices), nil, 1)) {
if (RwIm3DTransform(TraceVertices, ARRAY_SIZE(TraceVertices), nil, rwIM3D_VERTEXUV)) {
RwIm3DRenderIndexedPrimitive(rwPRIMTYPETRILIST, TraceIndexList, ARRAY_SIZE(TraceIndexList));
RwIm3DEnd();
}
@ -851,6 +851,22 @@ CBrightLights::Render(void)
TempBufferIndicesStored += 12*3;
break;
case BRIGHTLIGHT_FRONT_BIG:
case BRIGHTLIGHT_REAR_BIG:
for (j = 0; j < 8; j++) {
pos = BigCarHeadLightsSide[j] * aBrightLights[i].m_side +
BigCarHeadLightsUp[j] * aBrightLights[i].m_up +
BigCarHeadLightsFront[j] * aBrightLights[i].m_front +
aBrightLights[i].m_pos;
RwIm3DVertexSetRGBA(&TempBufferRenderVertices[TempBufferVerticesStored + j], r, g, b, a);
RwIm3DVertexSetPos(&TempBufferRenderVertices[TempBufferVerticesStored + j], pos.x, pos.y, pos.z);
}
for (j = 0; j < 12 * 3; j++)
TempBufferRenderIndexList[TempBufferIndicesStored + j] = CubeIndices[j] + TempBufferVerticesStored;
TempBufferVerticesStored += 8;
TempBufferIndicesStored += 12 * 3;
break;
case BRIGHTLIGHT_FRONT_TALL:
case BRIGHTLIGHT_REAR_TALL:
for(j = 0; j < 8; j++){
@ -869,8 +885,8 @@ CBrightLights::Render(void)
case BRIGHTLIGHT_SIREN:
for(j = 0; j < 6; j++){
pos = SirenLightsSide[j]*aBrightLights[i].m_side +
SirenLightsUp[j]*aBrightLights[i].m_up +
pos = SirenLightsSide[j] * TheCamera.GetRight() +
SirenLightsUp[j] * TheCamera.GetUp() +
aBrightLights[i].m_pos;
RwIm3DVertexSetRGBA(&TempBufferRenderVertices[TempBufferVerticesStored+j], r, g, b, a);
RwIm3DVertexSetPos(&TempBufferRenderVertices[TempBufferVerticesStored+j], pos.x, pos.y, pos.z);
@ -1067,11 +1083,8 @@ CMoneyMessage::Render()
CFont::SetPropOn();
CFont::SetBackgroundOff();
float fScaleY = fDistY / 100.0f;
if (fScaleY > MAX_SCALE) fScaleY = MAX_SCALE;
float fScaleX = fDistX / 100.0f;
if (fScaleX > MAX_SCALE) fScaleX = MAX_SCALE;
float fScaleY = Min(fDistY / 100.0f, MAX_SCALE);
float fScaleX = Min(fDistX / 100.0f, MAX_SCALE);
CFont::SetScale(fScaleX, fScaleY); // maybe use SCREEN_SCALE_X and SCREEN_SCALE_Y here?
CFont::SetCentreOn();

View file

@ -43,6 +43,7 @@
#define MAX_SUBSYSTEMS (16)
// --MIAMI: file done
rw::EngineOpenParams openParams;

View file

@ -53,6 +53,7 @@
#define MAX_SUBSYSTEMS (16)
// --MIAMI: file done
static RwBool ForegroundApp = TRUE;

View file

@ -1,4 +1,4 @@
#include "common.h"
#include "common.h"
#include "main.h"
#include "General.h"
@ -4635,7 +4635,6 @@ CAutomobile::ProcessOpenDoor(uint32 component, uint32 anim, float time)
case ANIM_CAR_ROLLDOOR_LOW:
ProcessDoorOpenCloseAnimation(this, component, door, time, 0.1f, 0.6f, 0.95f);
break;
break;
case ANIM_CAR_GETOUT_LHS:
case ANIM_CAR_GETOUT_LOW_LHS:
case ANIM_CAR_GETOUT_RHS:
@ -4649,6 +4648,7 @@ CAutomobile::ProcessOpenDoor(uint32 component, uint32 anim, float time)
case ANIM_CAR_PULLOUT_RHS:
case ANIM_CAR_PULLOUT_LOW_RHS:
OpenDoor(component, door, 1.0f);
break;
case ANIM_COACH_OPEN_L:
case ANIM_COACH_OPEN_R:
ProcessDoorOpenAnimation(this, component, door, time, 0.66f, 0.8f);
@ -5349,7 +5349,7 @@ CAutomobile::SpawnFlyingComponent(int32 component, uint32 type)
obj->m_fElasticity = 0.1f;
obj->m_fBuoyancy = obj->m_fMass*GRAVITY/0.75f;
obj->ObjectCreatedBy = TEMP_OBJECT;
obj->bIsStatic = false;
obj->SetIsStatic(false);
obj->bIsPickup = false;
obj->bUseVehicleColours = true;
obj->m_colour1 = m_currentColour1;

View file

@ -893,7 +893,7 @@ CBoat::BlowUpCar(CEntity *culprit)
obj->m_fElasticity = 0.1f;
obj->m_fBuoyancy = obj->m_fMass*GRAVITY/0.75f;
obj->ObjectCreatedBy = TEMP_OBJECT;
obj->bIsStatic = false;
obj->SetIsStatic(false);
obj->bIsPickup = false;
// life time

View file

@ -671,7 +671,7 @@ CHeli::SpawnFlyingComponent(int32 component)
obj->m_fElasticity = 0.1f;
obj->m_fBuoyancy = obj->m_fMass*GRAVITY/0.75f;
obj->ObjectCreatedBy = TEMP_OBJECT;
obj->bIsStatic = false;
obj->SetIsStatic(false);
obj->bIsPickup = false;
// life time

View file

@ -205,13 +205,13 @@ void CBulletInfo::Update(void)
if (pHitEntity->IsObject()) {
CObject *pHitObject = (CObject*)pHitEntity;
if ( !pHitObject->bInfiniteMass && pHitObject->m_fCollisionDamageMultiplier < 99.9f) {
bool notStatic = !pHitObject->IsStatic();
bool notStatic = !pHitObject->GetIsStatic();
if (notStatic && pHitObject->m_fUprootLimit <= 0.0f) {
pHitObject->bIsStatic = false;
pHitObject->AddToMovingList();
}
notStatic = !pHitObject->IsStatic();
notStatic = !pHitObject->GetIsStatic();
if (!notStatic) {
CVector moveForce = point.normal * -BULLET_HIT_FORCE;
pHitObject->ApplyMoveForce(moveForce.x, moveForce.y, moveForce.z);

View file

@ -1526,14 +1526,14 @@ CWeapon::DoBulletImpact(CEntity *shooter, CEntity *victim,
if ( !victimObject->bInfiniteMass && victimObject->m_fCollisionDamageMultiplier < 99.9f)
{
bool notStatic = !victimObject->IsStatic();
bool notStatic = !victimObject->GetIsStatic();
if (notStatic && victimObject->m_fUprootLimit <= 0.0f)
{
victimObject->bIsStatic = false;
victimObject->SetIsStatic(false);
victimObject->AddToMovingList();
}
notStatic = !victimObject->IsStatic();
notStatic = !victimObject->GetIsStatic();
if (!notStatic)
{
CVector moveForce = point->normal * -4.0f;
@ -1922,14 +1922,14 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
if ( !victimObject->bInfiniteMass )
{
bool notStatic = !victimObject->IsStatic();
bool notStatic = !victimObject->GetIsStatic();
if ( notStatic && victimObject->m_fUprootLimit <= 0.0f )
{
victimObject->bIsStatic = false;
victimObject->SetIsStatic(false);
victimObject->AddToMovingList();
}
notStatic = !victimObject->IsStatic();
notStatic = !victimObject->GetIsStatic();
if ( !notStatic )
{
CVector moveForce = point.normal*-5.0f;
@ -3149,9 +3149,9 @@ CWeapon::BlowUpExplosiveThings(CEntity *thing)
object->m_vecMoveSpeed.x += float((CGeneral::GetRandomNumber()&255) - 128) * 0.0002f;
object->m_vecMoveSpeed.y += float((CGeneral::GetRandomNumber()&255) - 128) * 0.0002f;
if ( object->IsStatic())
if ( object->GetIsStatic())
{
object->bIsStatic = false;
object->SetIsStatic(false);
object->AddToMovingList();
}
}