From 3648ef4687967c7363c9c61f4610679484dc478e Mon Sep 17 00:00:00 2001 From: Fire-Head Date: Wed, 13 Jan 2021 00:07:24 +0300 Subject: [PATCH 1/7] lcs particle --- src/control/GameLogic.cpp | 2 +- src/core/main.cpp | 3 +- src/core/main.h | 4 +- src/modelinfo/VehicleModelInfo.cpp | 4 +- src/render/MBlur.cpp | 3 + src/render/Particle.cpp | 994 +++++++++++------------------ src/render/Particle.h | 20 +- src/render/ParticleMgr.cpp | 34 +- src/render/ParticleMgr.h | 7 +- src/render/ParticleType.h | 9 +- src/render/Sprite.cpp | 13 + src/render/Sprite.h | 2 + src/render/Weather.cpp | 2 + src/vehicles/Automobile.cpp | 2 + src/vehicles/Bike.cpp | 2 +- src/vehicles/Boat.cpp | 3 +- src/weapons/Weapon.cpp | 8 +- 17 files changed, 464 insertions(+), 648 deletions(-) diff --git a/src/control/GameLogic.cpp b/src/control/GameLogic.cpp index 2eea9645..93e6c67d 100644 --- a/src/control/GameLogic.cpp +++ b/src/control/GameLogic.cpp @@ -393,7 +393,7 @@ CGameLogic::RestorePlayerStuffDuringResurrection(CPlayerPed *pPlayerPed, CVector CWorld::Add(pPlayerPed); CHud::ResetWastedText(); CStreaming::StreamZoneModels(pos); - clearWaterDrop = true; + //clearWaterDrop = true; } void diff --git a/src/core/main.cpp b/src/core/main.cpp index d9579fee..3cce9c19 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -76,7 +76,7 @@ GlobalScene Scene; -uint8 work_buff[55000]; +uint8 work_buff[102400]; char gString[256]; char gString2[512]; wchar gUString[256]; @@ -102,6 +102,7 @@ float NumberOfChunksLoaded; bool g_SlowMode = false; char version_name[64]; +bool gMakeResources = true; void GameInit(void); void SystemInit(void); diff --git a/src/core/main.h b/src/core/main.h index 37a82fb2..4dfaef5e 100644 --- a/src/core/main.h +++ b/src/core/main.h @@ -7,7 +7,7 @@ struct GlobalScene }; extern GlobalScene Scene; -extern uint8 work_buff[55000]; +extern uint8 work_buff[102400]; extern char gString[256]; extern char gString2[512]; extern wchar gUString[256]; @@ -24,6 +24,8 @@ extern bool gbShowTimebars; extern bool gbPrintMemoryUsage; #endif +extern bool gMakeResources; + class CSprite2d; bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha); diff --git a/src/modelinfo/VehicleModelInfo.cpp b/src/modelinfo/VehicleModelInfo.cpp index 6dc9e5b0..c8a19df1 100644 --- a/src/modelinfo/VehicleModelInfo.cpp +++ b/src/modelinfo/VehicleModelInfo.cpp @@ -1139,11 +1139,11 @@ CVehicleModelInfo::LoadEnvironmentMaps(void) txdslot = CTxdStore::FindTxdSlot("particle"); CTxdStore::PushCurrentTxd(); CTxdStore::SetCurrentTxd(txdslot); - if(gpWhiteTexture == nil){ + /*if(gpWhiteTexture == nil){ gpWhiteTexture = RwTextureRead("white", nil); RwTextureGetName(gpWhiteTexture)[0] = '@'; RwTextureSetFilterMode(gpWhiteTexture, rwFILTERLINEAR); - } + }*/ CTxdStore::PopCurrentTxd(); } diff --git a/src/render/MBlur.cpp b/src/render/MBlur.cpp index 44d4f1d4..f96fedc5 100644 --- a/src/render/MBlur.cpp +++ b/src/render/MBlur.cpp @@ -591,6 +591,8 @@ CMBlur::AddRenderFx(RwCamera *cam, RwRect *rect, float z, FxType type) void CMBlur::OverlayRenderFx(RwCamera *cam, RwRaster *frontBuf) { + //TODO(LCS) +#if 0 bool drawWaterDrops = false; RwIm2DVertex verts[4]; int red = (0.75f*CTimeCycle::GetDirectionalRed() + CTimeCycle::GetAmbientRed())*0.55f * 255; @@ -796,4 +798,5 @@ CMBlur::OverlayRenderFx(RwCamera *cam, RwRaster *frontBuf) RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE); pBufVertCount = 0; +#endif } diff --git a/src/render/Particle.cpp b/src/render/Particle.cpp index 0ad4681d..35812024 100644 --- a/src/render/Particle.cpp +++ b/src/render/Particle.cpp @@ -12,6 +12,7 @@ #include "Replay.h" #include "Stats.h" #include "Weather.h" +#include "WaterLevel.h" #include "MBlur.h" #include "main.h" #include "AudioScriptObject.h" @@ -212,7 +213,6 @@ RwRaster *gpLetterRaster; RwTexture *gpSparkTex; RwTexture *gpNewspaperTex; RwTexture *gpGunSmokeTex; -RwTexture *gpDotTex; RwTexture *gpHeatHazeTex; RwTexture *gpBeastieTex; RwTexture *gpRainDripTex[MAX_RAINDRIP_FILES]; @@ -221,34 +221,30 @@ RwTexture *gpRainDripDarkTex[MAX_RAINDRIP_FILES]; RwRaster *gpSparkRaster; RwRaster *gpNewspaperRaster; RwRaster *gpGunSmokeRaster; -RwRaster *gpDotRaster; RwRaster *gpHeatHazeRaster; RwRaster *gpBeastieRaster; RwRaster *gpRainDripRaster[MAX_RAINDRIP_FILES]; RwRaster *gpRainDripDarkRaster[MAX_RAINDRIP_FILES]; +RwTexture *gpFireHoseTex; +RwRaster *gpFireHoseRaster; + +RwTexture *gpMultiPlayerHitTex; +RwRaster *gpMultiPlayerHitRaster; + float CParticle::ms_afRandTable[CParticle::RAND_TABLE_SIZE]; CParticle *CParticle::m_pUnusedListHead; float CParticle::m_SinTable[CParticle::SIN_COS_TABLE_SIZE]; float CParticle::m_CosTable[CParticle::SIN_COS_TABLE_SIZE]; int32 Randomizer; -int32 nParticleCreationInterval = 1; float PARTICLE_WIND_TEST_SCALE = 0.002f; -float fParticleScaleLimit = 0.5f; - -bool clearWaterDrop; -int32 numWaterDropOnScreen; #ifdef DEBUGMENU SETTWEAKPATH("Particle"); -TWEAKINT32(nParticleCreationInterval, 0, 5, 1); -TWEAKFLOAT(fParticleScaleLimit, 0.0f, 1.0f, 0.1f); TWEAKFUNC(CParticle::ReloadConfig); #endif - - void CParticle::ReloadConfig() { debug("Initialising CParticleMgr..."); @@ -286,14 +282,6 @@ void CParticle::ReloadConfig() gParticleArray[i].m_nFadeAlphaTimer = 0; - gParticleArray[i].m_nCurrentZRotation = 0; - - gParticleArray[i].m_nZRotationTimer = 0; - - gParticleArray[i].m_fCurrentZRadius = 0.0f; - - gParticleArray[i].m_nZRadiusTimer = 0; - gParticleArray[i].m_nCurrentFrame = 0; gParticleArray[i].m_nAnimationSpeedTimer = 0; @@ -318,7 +306,7 @@ void CParticle::Initialise() } for ( int32 i = 0; i < SIN_COS_TABLE_SIZE; i++ ) - { + { float angle = DEGTORAD(float(i) * float(360.0f / SIN_COS_TABLE_SIZE)); m_SinTable[i] = ::Sin(angle); @@ -371,7 +359,6 @@ void CParticle::Initialise() gpRainDropTex = RwTextureRead("raindrop4", nil); gpRainDropRaster = RwTextureGetRaster(gpRainDropTex); - for ( int32 i = 0; i < MAX_RAINSPLASHUP_FILES; i++ ) { @@ -411,8 +398,7 @@ void CParticle::Initialise() gpFlame5Tex = RwTextureRead("flame5", nil); -//#ifdef FIX_BUGS -#if 0 +#ifdef FIX_BUGS gpFlame5Raster = RwTextureGetRaster(gpFlame5Tex); #else // this seems to have become more of a design choice @@ -452,21 +438,18 @@ void CParticle::Initialise() gpGunShellTex = RwTextureRead("gunshell", nil); gpGunShellRaster = RwTextureGetRaster(gpGunShellTex); - gpPointlightTex = RwTextureRead("pointlight", nil); + gpPointlightTex = RwTextureRead("smoke5", nil); gpPointlightRaster = RwTextureGetRaster(gpPointlightTex); gpSparkTex = RwTextureRead("spark", nil); gpSparkRaster = RwTextureGetRaster(gpSparkTex); - gpNewspaperTex = RwTextureRead("newspaper02_64", nil); + gpNewspaperTex = RwTextureRead("ballot_paper", nil); gpNewspaperRaster = RwTextureGetRaster(gpNewspaperTex); gpGunSmokeTex = RwTextureRead("gunsmoke3", nil); gpGunSmokeRaster = RwTextureGetRaster(gpGunSmokeTex); - gpDotTex = RwTextureRead("dot", nil); - gpDotRaster = RwTextureGetRaster(gpDotTex); - gpHeatHazeTex = RwTextureRead("heathaze", nil); gpHeatHazeRaster = RwTextureGetRaster(gpHeatHazeTex); @@ -482,8 +465,10 @@ void CParticle::Initialise() gpRainDripDarkTex[0] = RwTextureRead("raindrip64_d", nil); gpRainDripDarkRaster[0] = RwTextureGetRaster(gpRainDripDarkTex[0]); - gpRainDripDarkTex[1] = RwTextureRead("raindripb64_d", nil); - gpRainDripDarkRaster[1] = RwTextureGetRaster(gpRainDripDarkTex[1]); + gpMultiPlayerHitTex = RwTextureRead("mphit", nil); + gpMultiPlayerHitRaster = RwTextureGetRaster(gpMultiPlayerHitTex); + gpFireHoseTex = RwTextureRead("firehose", nil); + gpFireHoseRaster = RwTextureGetRaster(gpFireHoseTex); CTxdStore::PopCurrentTxd(); @@ -491,119 +476,141 @@ void CParticle::Initialise() { tParticleSystemData *entry = &mod_ParticleSystemManager.m_aParticles[i]; - switch ( i ) + switch( i ) { case PARTICLE_SPARK: - case PARTICLE_SPARK_SMALL: - case PARTICLE_RAINDROP_SMALL: - case PARTICLE_HELI_ATTACK: entry->m_ppRaster = &gpRainDropSmallRaster; break; - + + case PARTICLE_SPARK_SMALL: + entry->m_ppRaster = &gpRainDropSmallRaster; + break; + case PARTICLE_WATER_SPARK: entry->m_ppRaster = &gpSparkRaster; break; - + case PARTICLE_WHEEL_DIRT: + entry->m_ppRaster = &gpRubberRaster[4]; + break; + case PARTICLE_SAND: - case PARTICLE_STEAM2: - case PARTICLE_STEAM_NY: - case PARTICLE_STEAM_NY_SLOWMOTION: - case PARTICLE_GROUND_STEAM: - case PARTICLE_ENGINE_STEAM: - case PARTICLE_PEDFOOT_DUST: - case PARTICLE_CAR_DUST: - case PARTICLE_EXHAUST_FUMES: entry->m_ppRaster = &gpSmoke2Raster; break; - + case PARTICLE_WHEEL_WATER: - case PARTICLE_WATER: - case PARTICLE_SMOKE: - case PARTICLE_SMOKE_SLOWMOTION: - case PARTICLE_DRY_ICE: - case PARTICLE_GARAGEPAINT_SPRAY: - case PARTICLE_STEAM: - case PARTICLE_WATER_CANNON: - case PARTICLE_EXTINGUISH_STEAM: - case PARTICLE_HELI_DUST: - case PARTICLE_PAINT_SMOKE: - case PARTICLE_BULLETHIT_SMOKE: entry->m_ppRaster = gpSmokeRaster; break; - + case PARTICLE_BLOOD: entry->m_ppRaster = &gpBloodRaster; break; - + case PARTICLE_BLOOD_SMALL: + entry->m_ppRaster = &gpBloodSmallRaster; + break; + case PARTICLE_BLOOD_SPURT: entry->m_ppRaster = &gpBloodSmallRaster; break; - + case PARTICLE_DEBRIS: - case PARTICLE_TREE_LEAVES: entry->m_ppRaster = &gpLeafRaster; break; - + case PARTICLE_DEBRIS2: entry->m_ppRaster = &gpGungeRaster; break; - + case PARTICLE_FLYERS: entry->m_ppRaster = &gpNewspaperRaster; break; - + + case PARTICLE_WATER: + entry->m_ppRaster = gpSmokeRaster; + break; + case PARTICLE_FLAME: - case PARTICLE_CARFLAME: entry->m_ppRaster = &gpFlame1Raster; break; - + case PARTICLE_FIREBALL: entry->m_ppRaster = &gpFlame5Raster; break; - + case PARTICLE_GUNFLASH: + entry->m_ppRaster = gpGunFlashRaster; + break; + case PARTICLE_GUNFLASH_NOANIM: entry->m_ppRaster = gpGunFlashRaster; break; - - + case PARTICLE_GUNSMOKE: - case PARTICLE_WATERDROP: - case PARTICLE_BLOODDROP: - case PARTICLE_HEATHAZE: - case PARTICLE_HEATHAZE_IN_DIST: entry->m_ppRaster = nil; break; - + case PARTICLE_GUNSMOKE2: - case PARTICLE_BOAT_THRUSTJET: - case PARTICLE_RUBBER_SMOKE: entry->m_ppRaster = gpRubberRaster; break; - + case PARTICLE_CIGARETTE_SMOKE: entry->m_ppRaster = &gpGunSmokeRaster; break; - + + case PARTICLE_SMOKE: + case PARTICLE_SMOKE_SLOWMOTION: + case PARTICLE_DRY_ICE: + entry->m_ppRaster = gpSmokeRaster; + break; + case PARTICLE_TEARGAS: entry->m_ppRaster = &gpHeatHazeRaster; break; + case PARTICLE_GARAGEPAINT_SPRAY: + entry->m_ppRaster = gpSmokeRaster; + break; + case PARTICLE_SHARD: + entry->m_ppRaster = &gpRainDropRaster; + break; + + case PARTICLE_SPLASH: + entry->m_ppRaster = gpCarSplashRaster; + break; + + case PARTICLE_CARFLAME: + entry->m_ppRaster = &gpFlame1Raster; + break; + + case PARTICLE_STEAM: + entry->m_ppRaster = gpSmokeRaster; + break; + + case PARTICLE_STEAM2: + entry->m_ppRaster = &gpSmoke2Raster; + break; + + case PARTICLE_STEAM_NY: + case PARTICLE_STEAM_NY_SLOWMOTION: + case PARTICLE_GROUND_STEAM: + case PARTICLE_HYDRANT_STEAM: + entry->m_ppRaster = &gpSmoke2Raster; + break; + + case PARTICLE_ENGINE_STEAM: + entry->m_ppRaster = &gpSmoke2Raster; + break; + case PARTICLE_RAINDROP: - case PARTICLE_RAINDROP_2D: entry->m_ppRaster = &gpRainDropRaster; break; - case PARTICLE_SPLASH: - case PARTICLE_PED_SPLASH: - case PARTICLE_CAR_SPLASH: - case PARTICLE_WATER_HYDRANT: - entry->m_ppRaster = gpCarSplashRaster; + case PARTICLE_RAINDROP_SMALL: + entry->m_ppRaster = &gpRainDropSmallRaster; break; - + case PARTICLE_RAIN_SPLASH: case PARTICLE_RAIN_SPLASH_BIGGROW: entry->m_ppRaster = gpRainSplashRaster; @@ -616,57 +623,161 @@ void CParticle::Initialise() case PARTICLE_WATERSPRAY: entry->m_ppRaster = gpWatersprayRaster; break; - + case PARTICLE_EXPLOSION_MEDIUM: + entry->m_ppRaster = gpExplosionMediumRaster; + break; + case PARTICLE_EXPLOSION_LARGE: + entry->m_ppRaster = gpExplosionMediumRaster; + break; + case PARTICLE_EXPLOSION_MFAST: + entry->m_ppRaster = gpExplosionMediumRaster; + break; + case PARTICLE_EXPLOSION_LFAST: entry->m_ppRaster = gpExplosionMediumRaster; break; + case PARTICLE_CAR_SPLASH: + entry->m_ppRaster = gpCarSplashRaster; + break; + case PARTICLE_BOAT_SPLASH: entry->m_ppRaster = &gpBoatWakeRaster; break; + case PARTICLE_BOAT_THRUSTJET: + entry->m_ppRaster = gpRubberRaster; + break; + + case PARTICLE_WATER_HYDRANT: + entry->m_ppRaster = gpCarSplashRaster; + break; + + case PARTICLE_WATER_CANNON: + entry->m_ppRaster = gpSmokeRaster; + break; + + case PARTICLE_EXTINGUISH_STEAM: + entry->m_ppRaster = gpSmokeRaster; + break; + + case PARTICLE_PED_SPLASH: + entry->m_ppRaster = gpCarSplashRaster; + break; + + case PARTICLE_PEDFOOT_DUST: + entry->m_ppRaster = &gpSmoke2Raster; + break; + + case PARTICLE_CAR_DUST: + entry->m_ppRaster = &gpSmoke2Raster; + break; + + case PARTICLE_HELI_DUST: + entry->m_ppRaster = gpSmokeRaster; + break; + + case PARTICLE_HELI_ATTACK: + entry->m_ppRaster = &gpRainDropSmallRaster; + break; + case PARTICLE_ENGINE_SMOKE: + entry->m_ppRaster = &gpSmokeRaster[4]; + break; + case PARTICLE_ENGINE_SMOKE2: - case PARTICLE_CARFLAME_SMOKE: - case PARTICLE_FIREBALL_SMOKE: case PARTICLE_ROCKET_SMOKE: - case PARTICLE_TEST: entry->m_ppRaster = &gpCloudRaster4; break; + case PARTICLE_CARFLAME_SMOKE: + entry->m_ppRaster= &gpCloudRaster4; + break; + + case PARTICLE_FIREBALL_SMOKE: + entry->m_ppRaster = &gpCloudRaster4; + break; + + case PARTICLE_PAINT_SMOKE: + entry->m_ppRaster = gpSmokeRaster; + break; + + case PARTICLE_TREE_LEAVES: + entry->m_ppRaster = &gpLeafRaster; + break; + case PARTICLE_CARCOLLISION_DUST: - case PARTICLE_BURNINGRUBBER_SMOKE: entry->m_ppRaster = &gpCollisionSmokeRaster; break; case PARTICLE_CAR_DEBRIS: - case PARTICLE_HELI_DEBRIS: case PARTICLE_BIRD_DEBRIS: + case PARTICLE_HELI_DEBRIS: entry->m_ppRaster = gpCarDebrisRaster; break; + case PARTICLE_EXHAUST_FUMES: + entry->m_ppRaster = &gpSmoke2Raster; + break; + + case PARTICLE_RUBBER_SMOKE: + entry->m_ppRaster = gpRubberRaster; + break; + + case PARTICLE_BURNINGRUBBER_SMOKE: + entry->m_ppRaster = &gpCollisionSmokeRaster; + break; + + case PARTICLE_BULLETHIT_SMOKE: + entry->m_ppRaster = gpSmokeRaster; + break; + case PARTICLE_GUNSHELL_FIRST: + entry->m_ppRaster = &gpGunShellRaster; + break; + case PARTICLE_GUNSHELL: + entry->m_ppRaster= &gpGunShellRaster; + break; + case PARTICLE_GUNSHELL_BUMP1: + entry->m_ppRaster = &gpGunShellRaster; + break; + case PARTICLE_GUNSHELL_BUMP2: entry->m_ppRaster = &gpGunShellRaster; break; + case PARTICLE_TEST: + entry->m_ppRaster = &gpSmokeRaster[4]; + break; case PARTICLE_BIRD_FRONT: entry->m_ppRaster = gpBirdfrontRaster; break; case PARTICLE_SHIP_SIDE: - entry->m_ppRaster = gpBoatRaster; + entry->m_ppRaster= gpBoatRaster; break; case PARTICLE_BEASTIE: entry->m_ppRaster = &gpBeastieRaster; break; + + case PARTICLE_RAINDROP_2D: + entry->m_ppRaster= &gpRainDropRaster; + break; + + case PARTICLE_FERRY_CHIM_SMOKE: + entry->m_ppRaster= gpSmokeRaster; + break; + + case PARTICLE_MULTIPLAYER_HIT: + entry->m_ppRaster= &gpMultiPlayerHitRaster; + break; } } @@ -753,8 +864,8 @@ void CParticle::Shutdown() { RwTextureDestroy(gpRainDripTex[i]); gpRainDripTex[i] = nil; - - RwTextureDestroy(gpRainDripDarkTex[i]); + + RwTextureDestroy(gpRainDripDarkTex[i]); // hmm, i think gpRainDripDarkTex[1(one)] can crash, let's wait for report hehe gpRainDripDarkTex[i] = nil; } @@ -811,14 +922,18 @@ void CParticle::Shutdown() RwTextureDestroy(gpGunSmokeTex); gpGunSmokeTex = nil; - - RwTextureDestroy(gpDotTex); - gpDotTex = nil; + RwTextureDestroy(gpHeatHazeTex); gpHeatHazeTex = nil; RwTextureDestroy(gpBeastieTex); gpBeastieTex = nil; + + RwTextureDestroy(gpMultiPlayerHitTex); + gpBeastieTex = nil; + + RwTextureDestroy(gpFireHoseTex); + gpFireHoseTex = nil; int32 slot; @@ -870,24 +985,12 @@ CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVe CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVector const &vecDir, CEntity *pEntity, float fSize, RwRGBA const &color, int32 nRotationSpeed, int32 nRotation, int32 nCurFrame, int32 nLifeSpan) { - if ( CTimer::GetIsPaused() ) + if ( CTimer::GetIsPaused() /*TODO: || byte_355C47*/ ) return nil; - - if ( ( type == PARTICLE_ENGINE_SMOKE - || type == PARTICLE_ENGINE_SMOKE2 - || type == PARTICLE_ENGINE_STEAM - || type == PARTICLE_CARFLAME_SMOKE - || type == PARTICLE_RUBBER_SMOKE - || type == PARTICLE_BURNINGRUBBER_SMOKE - || type == PARTICLE_EXHAUST_FUMES - || type == PARTICLE_CARCOLLISION_DUST ) - && nParticleCreationInterval & CTimer::GetFrameCounter() ) - { - return nil; - } - +/* if ( !CReplay::IsPlayingBack() ) CReplay::RecordParticle(type, vecPos, vecDir, fSize, color); +*/ CParticle *pParticle = m_pUnusedListHead; @@ -922,38 +1025,15 @@ CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVe if ( psystem->m_nFadeAlphaTime ) pParticle->m_nFadeAlphaTimer /= psystem->m_nFadeAlphaTime; - pParticle->m_nCurrentZRotation = psystem->m_nZRotationInitialAngle; - pParticle->m_fCurrentZRadius = psystem->m_fInitialZRadius; - if ( nCurFrame != 0 ) pParticle->m_nCurrentFrame = nCurFrame; else pParticle->m_nCurrentFrame = psystem->m_nStartAnimationFrame; - - pParticle->m_nZRotationTimer = 0; - pParticle->m_nZRadiusTimer = 0; pParticle->m_nAnimationSpeedTimer = 0; pParticle->m_fZGround = 0.0f; - - if ( type != PARTICLE_HEATHAZE ) - pParticle->m_vecPosition = vecPos; - else - { - CVector screen; - float w, h; - - if ( !CSprite::CalcScreenCoors(vecPos, &screen, &w, &h, true) ) - return nil; - - pParticle->m_vecPosition = screen; - psystem->m_vecTextureStretch.x = w; - psystem->m_vecTextureStretch.y = h; - } - + pParticle->m_vecPosition = vecPos; pParticle->m_vecVelocity = vecDir; - - pParticle->m_vecParticleMovementOffset = CVector(0.0f, 0.0f, 0.0f); pParticle->m_nTimeWhenColorWillBeChanged = 0; if ( color.alpha != 0 ) @@ -1090,14 +1170,14 @@ CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVe break; case PARTICLE_EXPLOSION_MEDIUM: - pParticle->m_nColorIntensity -= 30 * (CGeneral::GetRandomNumber() & 1); // mb "+= -30 * rand" here ? + pParticle->m_nColorIntensity -= 2 * 15 * (CGeneral::GetRandomNumber() & 1); // mb "+= -30 * rand" here ? pParticle->m_nAnimationSpeedTimer = CGeneral::GetRandomNumber() & 7; pParticle->m_fSize = CGeneral::GetRandomNumberInRange(0.3f, 0.8f); pParticle->m_vecPosition.z -= CGeneral::GetRandomNumberInRange(-0.1f, 0.1f); break; case PARTICLE_EXPLOSION_LARGE: - pParticle->m_nColorIntensity -= 30 * (CGeneral::GetRandomNumber() & 1); // mb "+= -30 * rand" here ? + pParticle->m_nColorIntensity -= 2 * 15 * (CGeneral::GetRandomNumber() & 1); // mb "+= -30 * rand" here ? pParticle->m_nAnimationSpeedTimer = CGeneral::GetRandomNumber() & 7; pParticle->m_fSize = CGeneral::GetRandomNumberInRange(0.8f, 1.4f); pParticle->m_vecPosition.z -= CGeneral::GetRandomNumberInRange(-0.3f, 0.3f); @@ -1123,7 +1203,7 @@ CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVe void CParticle::Update() { - if ( CTimer::GetIsPaused() ) + if ( CTimer::GetIsPaused() /*TODO: || byte_355C47*/ ) return; CRGBA color(0, 0, 0, 0); @@ -1136,7 +1216,9 @@ void CParticle::Update() float fFricDeccel99 = pow(0.99f, CTimer::GetTimeStep()); CParticleObject::UpdateAll(); - + + // no more erectedcocks +#ifndef FIX_BUGS // ejaculation at 23:00, 23:15, 23:30, 23:45 if ( CClock::ms_nGameClockHours == 23 && ( CClock::ms_nGameClockMinutes == 0 @@ -1155,6 +1237,7 @@ void CParticle::Update() 1, 1000); } +#endif for ( int32 i = 0; i < MAX_PARTICLES; i++ ) { @@ -1174,68 +1257,7 @@ void CParticle::Update() CVector vecMoveStep = particle->m_vecVelocity * CTimer::GetTimeStep(); CVector vecPos = particle->m_vecPosition; - - if ( numWaterDropOnScreen == 0 ) - clearWaterDrop = false; - - if ( psystem->m_Type == PARTICLE_WATERDROP ) - { - if ( CGame::IsInInterior() || clearWaterDrop == true ) - { - bRemoveParticle = true; - continue; - } - - static uint8 nWaterDropCount; - - if ( nWaterDropCount == 5 ) - { - vecMoveStep = CVector(0.0f, 0.0f, 0.0f); - particle->m_nTimeWhenWillBeDestroyed += 1250; - nWaterDropCount = 0; - } - else - { - if ( TheCamera.m_CameraAverageSpeed > 0.35f ) - { - if ( vecMoveStep.Magnitude() > 0.5f ) - { - if ( vecMoveStep.Magnitude() > 0.4f && vecMoveStep.Magnitude() < 0.8f ) - { - vecMoveStep.x += TheCamera.m_CameraAverageSpeed * 1.5f; - vecMoveStep.y += TheCamera.m_CameraAverageSpeed * 1.5f; - } - else if ( vecMoveStep.Magnitude() != 0.0f ) - { - vecMoveStep.x += CGeneral::GetRandomNumberInRange(0.01f, 0.05f); - vecMoveStep.y += CGeneral::GetRandomNumberInRange(0.01f, 0.05f); - } - } - } - - nWaterDropCount++; - } - - if ( vecPos.z <= 1.5f ) - vecMoveStep.z = 0.0f; - } - - if ( psystem->m_Type == PARTICLE_HEATHAZE || psystem->m_Type == PARTICLE_HEATHAZE_IN_DIST ) - { -#ifdef FIX_BUGS - int32 nSinCosIndex = (int32(DEGTORAD((float)particle->m_nRotation) * float(SIN_COS_TABLE_SIZE) / TWOPI) + SIN_COS_TABLE_SIZE) % SIN_COS_TABLE_SIZE; -#else - int32 nSinCosIndex = int32(DEGTORAD((float)particle->m_nRotation) * float(SIN_COS_TABLE_SIZE) / TWOPI) % SIN_COS_TABLE_SIZE; -#endif - vecMoveStep.x = Sin(nSinCosIndex); - vecMoveStep.y = Sin(nSinCosIndex); - - if ( psystem->m_Type == PARTICLE_HEATHAZE_IN_DIST ) - particle->m_nRotation = int16((float)particle->m_nRotation + 0.75f); - else - particle->m_nRotation = int16((float)particle->m_nRotation + 1.0f); - } - + if ( psystem->m_Type == PARTICLE_BEASTIE ) { #ifdef FIX_BUGS @@ -1258,28 +1280,7 @@ void CParticle::Update() } vecPos += vecMoveStep; - - if ( psystem->m_Type == PARTICLE_FIREBALL ) - { - AddParticle(PARTICLE_HEATHAZE, particle->m_vecPosition, CVector(0.0f, 0.0f, 0.0f), - nil, particle->m_fSize * 5.0f); - } - - if ( psystem->m_Type == PARTICLE_GUNSMOKE2 ) - { - if ( CTimer::GetFrameCounter() & 10 ) - { -#ifdef FIX_BUGS - if ( FindPlayerPed() && FindPlayerPed()->GetWeapon()->m_eWeaponType == WEAPONTYPE_MINIGUN ) -#else - if ( FindPlayerPed()->GetWeapon()->m_eWeaponType == WEAPONTYPE_MINIGUN ) -#endif - { - AddParticle(PARTICLE_HEATHAZE, particle->m_vecPosition, CVector(0.0f, 0.0f, 0.0f)); - } - } - } - + if ( CWeather::Wind > 0.0f ) { if ( vecMoveStep.Magnitude() != 0.0f ) @@ -1299,12 +1300,15 @@ void CParticle::Update() || psystem->m_Type == PARTICLE_BOAT_SPLASH || psystem->m_Type == PARTICLE_RAINDROP_2D ) { - int32 nMaxDrops = int32(6.0f * TheCamera.m_CameraAverageSpeed + 1.0f); + //int32 nMaxDrops = int32(6.0f * TheCamera.m_CameraAverageSpeed + 1.0f); float fDistToCam = 0.0f; if ( psystem->m_Type == PARTICLE_BOAT_SPLASH || psystem->m_Type == PARTICLE_CAR_SPLASH ) { - if ( vecPos.z + particle->m_fSize < 5.0f ) + float fWaterLevel = 0.0f; + CWaterLevel::GetWaterLevelNoWaves(vecPos.x, vecPos.y, vecPos.z, &fWaterLevel); + + if ( vecPos.z + particle->m_fSize < fWaterLevel ) { bRemoveParticle = true; continue; @@ -1315,61 +1319,16 @@ void CParticle::Update() case LOOKING_LEFT: case LOOKING_RIGHT: case LOOKING_FORWARD: - nMaxDrops /= 2; + //nMaxDrops /= 2; break; default: - nMaxDrops = 0; + //nMaxDrops = 0; break; } fDistToCam = (TheCamera.GetPosition() - vecPos).Magnitude(); } - - if ( numWaterDropOnScreen < nMaxDrops && numWaterDropOnScreen < 63 - && fDistToCam < 10.0f - && clearWaterDrop == false - && !CGame::IsInInterior() ) - { - CVector vecWaterdropTarget - ( - CGeneral::GetRandomNumberInRange(-0.25f, 0.25f), - CGeneral::GetRandomNumberInRange(0.1f, 0.75f), - -0.01f - ); - - CVector vecWaterdropPos; - - if ( TheCamera.m_CameraAverageSpeed < 0.35f ) - vecWaterdropPos.x = (float)CGeneral::GetRandomNumberInRange(50, int32(SCREEN_WIDTH) - 50); - else - vecWaterdropPos.x = (float)CGeneral::GetRandomNumberInRange(200, int32(SCREEN_WIDTH) - 200); - - if ( psystem->m_Type == PARTICLE_BOAT_SPLASH || psystem->m_Type == PARTICLE_CAR_SPLASH ) - vecWaterdropPos.y = (float)CGeneral::GetRandomNumberInRange(SCREEN_HEIGHT / 2, SCREEN_HEIGHT); - else - { - if ( TheCamera.m_CameraAverageSpeed < 0.35f ) - vecWaterdropPos.y = (float)CGeneral::GetRandomNumberInRange(0, int32(SCREEN_HEIGHT)); - else - vecWaterdropPos.y = (float)CGeneral::GetRandomNumberInRange(150, int32(SCREEN_HEIGHT) - 200); - } - - vecWaterdropPos.z = 2.0f; - - if ( AddParticle(PARTICLE_WATERDROP, - vecWaterdropPos, - vecWaterdropTarget, - nil, - CGeneral::GetRandomNumberInRange(0.1f, 0.15f), - 0, - 0, - CGeneral::GetRandomNumber() & 1, - 0) != nil ) - { - numWaterDropOnScreen++; - } - } } if ( CTimer::GetTimeInMilliseconds() > particle->m_nTimeWhenWillBeDestroyed || particle->m_nAlpha == 0 ) @@ -1432,10 +1391,7 @@ void CParticle::Update() } else size = particle->m_fSize + particle->m_fExpansionRate; - - if ( psystem->m_Type == PARTICLE_WATERDROP ) - size = (size - Abs(vecMoveStep.x) * 0.000150000007f) + (Abs(vecMoveStep.z) * 0.0500000007f); //TODO: - + if ( size < 0.0f ) { bRemoveParticle = true; @@ -1716,28 +1672,6 @@ void CParticle::Update() continue; } } - - if ( psystem->m_nZRotationAngleChangeAmount != 0 ) - { - if ( particle->m_nZRotationTimer >= psystem->m_nZRotationChangeTime ) - { - particle->m_nZRotationTimer = 0; - particle->m_nCurrentZRotation += psystem->m_nZRotationAngleChangeAmount; - } - else - ++particle->m_nZRotationTimer; - } - - if ( psystem->m_fZRadiusChangeAmount != 0.0f ) - { - if ( particle->m_nZRadiusTimer >= psystem->m_nZRadiusChangeTime ) - { - particle->m_nZRadiusTimer = 0; - particle->m_fCurrentZRadius += psystem->m_fZRadiusChangeAmount; - } - else - ++particle->m_nZRadiusTimer; - } if ( psystem->m_nAnimationSpeed != 0 ) { @@ -1764,21 +1698,6 @@ void CParticle::Update() particle->m_nRotation += particle->m_nRotationStep; #endif - if ( particle->m_fCurrentZRadius != 0.0f ) - { - int32 nSinCosIndex = particle->m_nCurrentZRotation % SIN_COS_TABLE_SIZE; - - float fX = (Cos(nSinCosIndex) - Sin(nSinCosIndex)) * particle->m_fCurrentZRadius; - - float fY = (Sin(nSinCosIndex) + Cos(nSinCosIndex)) * particle->m_fCurrentZRadius; - - vecPos -= particle->m_vecParticleMovementOffset; - - vecPos += CVector(fX, fY, 0.0f); - - particle->m_vecParticleMovementOffset = CVector(fX, fY, 0.0f); - } - particle->m_vecPosition = vecPos; } } @@ -1809,6 +1728,8 @@ void CParticle::Render() RwRaster **frames = psystem->m_ppRaster; tParticleType type = psystem->m_Type; + /* + something on ps2 if ( type == PARTICLE_ENGINE_SMOKE || type == PARTICLE_ENGINE_SMOKE2 || type == PARTICLE_ENGINE_STEAM @@ -1820,7 +1741,7 @@ void CParticle::Render() { particleBanned = true; } - + */ if ( particle ) { if ( (flags & DRAW_OPAQUE) != (psystem->Flags & DRAW_OPAQUE) @@ -1865,6 +1786,8 @@ void CParticle::Render() if ( particle->m_nAlpha == 0 ) canDraw = false; + // TODO: psp vert buffer check + if ( canDraw && psystem->m_nFinalAnimationFrame != 0 && frames != nil ) { RwRaster *curFrame = frames[particle->m_nCurrentFrame]; @@ -1878,11 +1801,7 @@ void CParticle::Render() if ( canDraw && psystem->Flags & DRAWTOP2D ) { - float screenZ = (particle->m_vecPosition.z - CDraw::GetNearClipZ()) - * (CSprite::GetFarScreenZ() - CSprite::GetNearScreenZ()) - * CDraw::GetFarClipZ() - / ( (CDraw::GetFarClipZ() - CDraw::GetNearClipZ()) * particle->m_vecPosition.z ) - + CSprite::GetNearScreenZ(); + float screenZ = CalcScreenZ(particle->m_vecPosition.z); float stretchTexW; float stretchTexH; @@ -1897,108 +1816,6 @@ void CParticle::Render() stretchTexW = CGeneral::GetRandomNumberInRange(0.1f, 1.0f) * psystem->m_vecTextureStretch.x + 63.0f; stretchTexH = CGeneral::GetRandomNumberInRange(0.1f, 1.0f) * psystem->m_vecTextureStretch.y + 63.0f; } - - - if ( i == PARTICLE_WATERDROP ) - { - int32 timeLeft = (particle->m_nTimeWhenWillBeDestroyed - CTimer::GetTimeInMilliseconds()) / particle->m_nTimeWhenWillBeDestroyed; - - stretchTexH += (1.0f - (float)timeLeft ) * psystem->m_vecTextureStretch.y; - - RwRect rect; - - rect.x = int32(particle->m_vecPosition.x - SCREEN_STRETCH_X(particle->m_fSize * stretchTexW)); - rect.y = int32(particle->m_vecPosition.y - SCREEN_STRETCH_Y(particle->m_fSize * stretchTexH)); - rect.w = int32(particle->m_vecPosition.x + SCREEN_STRETCH_X(particle->m_fSize * stretchTexW)); - rect.h = int32(particle->m_vecPosition.y + SCREEN_STRETCH_Y(particle->m_fSize * stretchTexH)); - - FxType fxtype; - - if ( particle->m_nCurrentFrame != 0 ) - fxtype = FXTYPE_WATER2; - else - fxtype = FXTYPE_WATER1; - - CMBlur::AddRenderFx(Scene.camera, &rect, screenZ, fxtype); - - canDraw = false; - } - - if ( i == PARTICLE_BLOODDROP ) - { - int32 timeLeft = (particle->m_nTimeWhenWillBeDestroyed - CTimer::GetTimeInMilliseconds()) / particle->m_nTimeWhenWillBeDestroyed; - - stretchTexH += (1.0f + (float)timeLeft) * psystem->m_vecTextureStretch.y; - stretchTexW += (1.0f - (float)timeLeft) * psystem->m_vecTextureStretch.x; - - RwRect rect; - - rect.x = int32(particle->m_vecPosition.x - SCREEN_STRETCH_X(particle->m_fSize * stretchTexW)); - rect.y = int32(particle->m_vecPosition.y - SCREEN_STRETCH_Y(particle->m_fSize * stretchTexH)); - rect.w = int32(particle->m_vecPosition.x + SCREEN_STRETCH_X(particle->m_fSize * stretchTexW)); - rect.h = int32(particle->m_vecPosition.y + SCREEN_STRETCH_Y(particle->m_fSize * stretchTexH)); - - FxType fxtype; - - if ( particle->m_nCurrentFrame ) - fxtype = FXTYPE_BLOOD2; - else - fxtype = FXTYPE_BLOOD1; - - CMBlur::AddRenderFx(Scene.camera, &rect, screenZ, fxtype); - - canDraw = false; - } - - if ( i == PARTICLE_HEATHAZE_IN_DIST ) - { - RwRect rect; - - rect.x = int32(particle->m_vecPosition.x - SCREEN_STRETCH_X(particle->m_fSize * stretchTexW)); - rect.y = int32(particle->m_vecPosition.y - SCREEN_STRETCH_Y(particle->m_fSize * stretchTexH * 0.15f)); - rect.w = int32(particle->m_vecPosition.x + SCREEN_STRETCH_X(particle->m_fSize * stretchTexW)); - rect.h = int32(particle->m_vecPosition.y + SCREEN_STRETCH_Y(particle->m_fSize * stretchTexH * 0.15f)); - - CMBlur::AddRenderFx(Scene.camera, &rect, screenZ, FXTYPE_HEATHAZE); - - canDraw = false; - } - - if ( i == PARTICLE_HEATHAZE ) - { - RwRect rect; - - switch ( TheCamera.GetLookDirection() ) - { - case LOOKING_LEFT: - rect.x = int32(particle->m_vecPosition.x - SCREEN_STRETCH_X(particle->m_fSize * psystem->m_vecTextureStretch.x * 2.0f)); - rect.y = int32(particle->m_vecPosition.y - SCREEN_STRETCH_Y(particle->m_fSize * psystem->m_vecTextureStretch.y)); - rect.w = int32(particle->m_vecPosition.x - SCREEN_STRETCH_X(particle->m_fSize * psystem->m_vecTextureStretch.x)); - rect.h = int32(particle->m_vecPosition.y + SCREEN_STRETCH_Y(particle->m_fSize * psystem->m_vecTextureStretch.y)); - - break; - - case LOOKING_RIGHT: - rect.x = int32(particle->m_vecPosition.x + SCREEN_STRETCH_X(particle->m_fSize * psystem->m_vecTextureStretch.x)); - rect.y = int32(particle->m_vecPosition.y - SCREEN_STRETCH_Y(particle->m_fSize * psystem->m_vecTextureStretch.y)); - rect.w = int32(particle->m_vecPosition.x + SCREEN_STRETCH_X(particle->m_fSize * psystem->m_vecTextureStretch.x * 4.0f)); - rect.h = int32(particle->m_vecPosition.y + SCREEN_STRETCH_Y(particle->m_fSize * psystem->m_vecTextureStretch.y)); - - break; - - default: - rect.x = int32(particle->m_vecPosition.x - SCREEN_STRETCH_X(particle->m_fSize * psystem->m_vecTextureStretch.x)); - rect.y = int32(particle->m_vecPosition.y - SCREEN_STRETCH_Y(particle->m_fSize * psystem->m_vecTextureStretch.y)); - rect.w = int32(particle->m_vecPosition.x + SCREEN_STRETCH_X(particle->m_fSize * psystem->m_vecTextureStretch.x)); - rect.h = int32(particle->m_vecPosition.y + SCREEN_STRETCH_Y(particle->m_fSize * psystem->m_vecTextureStretch.y)); - - break; - } - - CMBlur::AddRenderFx(Scene.camera, &rect, screenZ, FXTYPE_HEATHAZE); - - canDraw = false; - } if ( canDraw ) { @@ -2064,6 +1881,8 @@ void CParticle::Render() } else if ( i == PARTICLE_WATER_HYDRANT ) { + float screenZ = CalcScreenZ(particle->m_vecPosition.z); + int32 timeLeft = (particle->m_nTimeWhenWillBeDestroyed - CTimer::GetTimeInMilliseconds()) / particle->m_nTimeWhenWillBeDestroyed; w += (1.0f - (float)timeLeft) * psystem->m_vecTextureStretch.x; @@ -2083,190 +1902,149 @@ void CParticle::Render() h += CGeneral::GetRandomNumberInRange(0.1f, 1.0f) * psystem->m_vecTextureStretch.y; } - if ( i == PARTICLE_WATER_HYDRANT - || (!particleBanned || SCREEN_WIDTH * fParticleScaleLimit >= w) - && SCREEN_HEIGHT * fParticleScaleLimit >= h ) + if ( particle->m_nRotation != 0 && i != PARTICLE_BEASTIE ) + { + CSprite::RenderBufferedOneXLUSprite_Rotate_Dimension(coors.x, coors.y, coors.z, + particle->m_fSize * w, particle->m_fSize * h, + particle->m_Color.red, + particle->m_Color.green, + particle->m_Color.blue, + particle->m_nColorIntensity, + 1.0f / coors.z, + DEGTORAD((float)particle->m_nRotation), + particle->m_nAlpha); + } + else if ( psystem->Flags & SCREEN_TRAIL ) { - if ( i == PARTICLE_WATER_HYDRANT ) + float fRotation; + float fTrailLength; + + if ( particle->m_fZGround == 0.0f ) { - RwRect rect; - - if ( w > 0.0f ) - { - rect.x = int32(coors.x - SCREEN_STRETCH_X(particle->m_fSize * w)); - rect.w = int32(coors.x + SCREEN_STRETCH_X(particle->m_fSize * w)); - } - else - { - rect.w = int32(coors.x - SCREEN_STRETCH_X(particle->m_fSize * w)); - rect.x = int32(coors.x + SCREEN_STRETCH_X(particle->m_fSize * w)); - } - - if ( h > 0.0f ) - { - rect.y = int32(coors.y - SCREEN_STRETCH_Y(particle->m_fSize * h)); - rect.h = int32(coors.y + SCREEN_STRETCH_Y(particle->m_fSize * h)); - } - else - { - rect.h = int32(coors.y - SCREEN_STRETCH_Y(particle->m_fSize * h)); - rect.y = int32(coors.y + SCREEN_STRETCH_Y(particle->m_fSize * h)); - } - - float screenZ = (coors.z - CDraw::GetNearClipZ()) - * (CSprite::GetFarScreenZ() - CSprite::GetNearScreenZ()) * CDraw::GetFarClipZ() - / ( (CDraw::GetFarClipZ() - CDraw::GetNearClipZ()) * coors.z ) + CSprite::GetNearScreenZ(); - - CMBlur::AddRenderFx(Scene.camera, &rect, screenZ, FXTYPE_SPLASH1); + fTrailLength = 0.0f; + fRotation = 0.0f; } else { - if ( particle->m_nRotation != 0 && i != PARTICLE_BEASTIE ) - { - CSprite::RenderBufferedOneXLUSprite_Rotate_Dimension(coors.x, coors.y, coors.z, - particle->m_fSize * w, particle->m_fSize * h, - particle->m_Color.red, - particle->m_Color.green, - particle->m_Color.blue, - particle->m_nColorIntensity, - 1.0f / coors.z, - DEGTORAD((float)particle->m_nRotation), - particle->m_nAlpha); - } - else if ( psystem->Flags & SCREEN_TRAIL ) - { - float fRotation; - float fTrailLength; - - if ( particle->m_fZGround == 0.0f ) - { - fTrailLength = 0.0f; - fRotation = 0.0f; - } - else - { - CVector2D vecDist - ( - coors.x - particle->m_fZGround, - coors.y - particle->m_fExpansionRate - ); + CVector2D vecDist + ( + coors.x - particle->m_fZGround, + coors.y - particle->m_fExpansionRate + ); - float fDist = vecDist.Magnitude(); + float fDist = vecDist.Magnitude(); - fTrailLength = fDist; - - float fRot = Asin(vecDist.x / fDist); + fTrailLength = fDist; + + float fRot = Asin(vecDist.x / fDist); - fRotation = fRot; + fRotation = fRot; - if ( vecDist.y < 0.0f ) - fRotation = -1.0f * fRot + DEGTORAD(180.0f); - - float fSpeed = particle->m_vecVelocity.Magnitude(); - - float fNewTrailLength = fSpeed * CTimer::GetTimeStep() * w * 2.0f; - - if ( fDist > fNewTrailLength ) - fTrailLength = fNewTrailLength; - } - - CSprite::RenderBufferedOneXLUSprite_Rotate_Dimension(coors.x, coors.y, coors.z, - particle->m_fSize * w, - particle->m_fSize * h + fTrailLength * psystem->m_fTrailLengthMultiplier, - particle->m_Color.red, - particle->m_Color.green, - particle->m_Color.blue, - particle->m_nColorIntensity, - 1.0f / coors.z, - fRotation, - particle->m_nAlpha); - - particle->m_fZGround = coors.x; // WTF ? - particle->m_fExpansionRate = coors.y; // WTF ? - } - else if ( psystem->Flags & SPEED_TRAIL ) - { - CVector vecPrevPos = particle->m_vecPosition - particle->m_vecVelocity; - float fRotation; - float fTrailLength; - CVector vecScreenPosition; - - if ( CSprite::CalcScreenCoors(vecPrevPos, &vecScreenPosition, &fTrailLength, &fRotation, true) ) - { - CVector2D vecDist - ( - coors.x - vecScreenPosition.x, - coors.y - vecScreenPosition.y - ); - - float fDist = vecDist.Magnitude(); - - fTrailLength = fDist; - - float fRot = Asin(vecDist.x / fDist); - - fRotation = fRot; - - if ( vecDist.y < 0.0f ) - fRotation = -1.0f * fRot + DEGTORAD(180.0f); - } - else - { - fRotation = 0.0f; - fTrailLength = 0.0f; - } - - CSprite::RenderBufferedOneXLUSprite_Rotate_Dimension(coors.x, coors.y, coors.z, - particle->m_fSize * w, - particle->m_fSize * h + fTrailLength * psystem->m_fTrailLengthMultiplier, - particle->m_Color.red, - particle->m_Color.green, - particle->m_Color.blue, - particle->m_nColorIntensity, - 1.0f / coors.z, - fRotation, - particle->m_nAlpha); - } - else if ( psystem->Flags & VERT_TRAIL ) - { - float fTrailLength = fabsf(particle->m_vecVelocity.z * 10.0f); - - CSprite::RenderBufferedOneXLUSprite(coors.x, coors.y, coors.z, - particle->m_fSize * w, - (particle->m_fSize + fTrailLength * psystem->m_fTrailLengthMultiplier) * h, - particle->m_Color.red, - particle->m_Color.green, - particle->m_Color.blue, - particle->m_nColorIntensity, - 1.0f / coors.z, - particle->m_nAlpha); - } - else if ( i == PARTICLE_RAINDROP_SMALL ) - { - CSprite::RenderBufferedOneXLUSprite(coors.x, coors.y, coors.z, - particle->m_fSize * w * 0.05f, - particle->m_fSize * h, - particle->m_Color.red, - particle->m_Color.green, - particle->m_Color.blue, - particle->m_nColorIntensity, - 1.0f / coors.z, - particle->m_nAlpha); - } - /*else if ( i == PARTICLE_BOAT_WAKE )*/ - else - { - CSprite::RenderBufferedOneXLUSprite(coors.x, coors.y, coors.z, - particle->m_fSize * w, - particle->m_fSize * h, - particle->m_Color.red, - particle->m_Color.green, - particle->m_Color.blue, - particle->m_nColorIntensity, - 1.0f / coors.z, - particle->m_nAlpha); - } + if ( vecDist.y < 0.0f ) + fRotation = -1.0f * fRot + DEGTORAD(180.0f); + + float fSpeed = particle->m_vecVelocity.Magnitude(); + + float fNewTrailLength = fSpeed * CTimer::GetTimeStep() * w * 2.0f; + + if ( fDist > fNewTrailLength ) + fTrailLength = fNewTrailLength; } + + CSprite::RenderBufferedOneXLUSprite_Rotate_Dimension(coors.x, coors.y, coors.z, + particle->m_fSize * w, + particle->m_fSize * h + fTrailLength * psystem->m_fTrailLengthMultiplier, + particle->m_Color.red, + particle->m_Color.green, + particle->m_Color.blue, + particle->m_nColorIntensity, + 1.0f / coors.z, + fRotation, + particle->m_nAlpha); + + particle->m_fZGround = coors.x; // WTF ? + particle->m_fExpansionRate = coors.y; // WTF ? + } + else if ( psystem->Flags & SPEED_TRAIL ) + { + CVector vecPrevPos = particle->m_vecPosition - particle->m_vecVelocity; + float fRotation; + float fTrailLength; + CVector vecScreenPosition; + + if ( CSprite::CalcScreenCoors(vecPrevPos, &vecScreenPosition, &fTrailLength, &fRotation, true) ) + { + CVector2D vecDist + ( + coors.x - vecScreenPosition.x, + coors.y - vecScreenPosition.y + ); + + float fDist = vecDist.Magnitude(); + + fTrailLength = fDist; + + float fRot = Asin(vecDist.x / fDist); + + fRotation = fRot; + + if ( vecDist.y < 0.0f ) + fRotation = -1.0f * fRot + DEGTORAD(180.0f); + } + else + { + fRotation = 0.0f; + fTrailLength = 0.0f; + } + + CSprite::RenderBufferedOneXLUSprite_Rotate_Dimension(coors.x, coors.y, coors.z, + particle->m_fSize * w, + particle->m_fSize * h + fTrailLength * psystem->m_fTrailLengthMultiplier, + particle->m_Color.red, + particle->m_Color.green, + particle->m_Color.blue, + particle->m_nColorIntensity, + 1.0f / coors.z, + fRotation, + particle->m_nAlpha); + } + else if ( psystem->Flags & VERT_TRAIL ) + { + float fTrailLength = Abs(particle->m_vecVelocity.z * 10.0f); + + CSprite::RenderBufferedOneXLUSprite(coors.x, coors.y, coors.z, + particle->m_fSize * w, + (particle->m_fSize + fTrailLength * psystem->m_fTrailLengthMultiplier) * h, + particle->m_Color.red, + particle->m_Color.green, + particle->m_Color.blue, + particle->m_nColorIntensity, + 1.0f / coors.z, + particle->m_nAlpha); + } + else if ( i == PARTICLE_RAINDROP_SMALL ) + { + CSprite::RenderBufferedOneXLUSprite(coors.x, coors.y, coors.z, + particle->m_fSize * w * 0.05f, + particle->m_fSize * h, + particle->m_Color.red, + particle->m_Color.green, + particle->m_Color.blue, + particle->m_nColorIntensity, + 1.0f / coors.z, + particle->m_nAlpha); + } + else + { + CSprite::RenderBufferedOneXLUSprite(coors.x, coors.y, coors.z, + particle->m_fSize * w, + particle->m_fSize * h, + particle->m_Color.red, + particle->m_Color.green, + particle->m_Color.blue, + particle->m_nColorIntensity, + 1.0f / coors.z, + particle->m_nAlpha); } } } @@ -2295,9 +2073,6 @@ void CParticle::RemovePSystem(tParticleType type) void CParticle::RemoveParticle(CParticle *pParticle, CParticle *pPrevParticle, tParticleSystemData *pPSystemData) { - if ( pPSystemData->m_Type == PARTICLE_WATERDROP ) - --numWaterDropOnScreen; - if ( pPrevParticle ) pPrevParticle->m_pNext = pParticle->m_pNext; else @@ -2331,9 +2106,9 @@ void CParticle::AddJetExplosion(CVector const &vecPos, float fPower, float fSize vecStepPos, CVector ( - CGeneral::GetRandomNumberInRange(-0.2f, 0.2f), - CGeneral::GetRandomNumberInRange(-0.2f, 0.2f), - CGeneral::GetRandomNumberInRange(-0.2f, 0.0f) + CGeneral::GetRandomNumberInRange(-0.02f, 0.02f), + CGeneral::GetRandomNumberInRange(-0.02f, 0.02f), + CGeneral::GetRandomNumberInRange(-0.02f, 0.0f) ), nil, fSize, color, 0, 0, 0, 0); @@ -2397,18 +2172,7 @@ void CParticle::CalWindDir(CVector *vecDirIn, CVector *vecDirOut) void CParticle::HandleShipsAtHorizonStuff() { - tParticleSystemData *psystemdata = &mod_ParticleSystemManager.m_aParticles[PARTICLE_SHIP_SIDE]; - - for ( CParticle *particle = psystemdata->m_pParticles; particle; particle = particle->m_pNext ) - { - if ( CTimer::GetTimeInMilliseconds() > particle->m_nTimeWhenWillBeDestroyed - 32000 - && CTimer::GetTimeInMilliseconds() < particle->m_nTimeWhenWillBeDestroyed - 22000 ) - { - particle->m_nAlpha = Min(particle->m_nAlpha + 1, 96); - } - if ( CTimer::GetTimeInMilliseconds() > particle->m_nTimeWhenWillBeDestroyed - 10000 ) - particle->m_nFadeAlphaTimer = 1; - } + ; } void CParticle::HandleShootableBirdsStuff(CEntity *entity, CVector const&camPos) @@ -2448,7 +2212,7 @@ void CParticle::HandleShootableBirdsStuff(CEntity *entity, CVector const&camPos) bRemoveParticle = true; for ( int32 i = 0; i < 8; i++ ) - { + { CParticle *pBirdDerbis = AddParticle(PARTICLE_BIRD_DEBRIS, particle->m_vecPosition, CVector @@ -2474,7 +2238,7 @@ void CParticle::HandleShootableBirdsStuff(CEntity *entity, CVector const&camPos) } void -CEntity::AddSteamsFromGround(CVector *unused) +CEntity::AddSteamsFromGround(CVector *unused) //todo { int i, n; C2dEffect *effect; diff --git a/src/render/Particle.h b/src/render/Particle.h index 5542dc02..edfd9b77 100644 --- a/src/render/Particle.h +++ b/src/render/Particle.h @@ -18,11 +18,6 @@ public: uint32 m_nTimeWhenWillBeDestroyed; uint32 m_nTimeWhenColorWillBeChanged; float m_fZGround; - CVector m_vecParticleMovementOffset; - int16 m_nCurrentZRotation; - uint16 m_nZRotationTimer; - float m_fCurrentZRadius; - uint16 m_nZRadiusTimer; uint8 m_nColorIntensity; uint8 m_nAlpha; float m_fSize; @@ -35,12 +30,20 @@ public: uint8 m_nCurrentFrame; RwRGBA m_Color; CParticle *m_pNext; + + //CVector m_vecParticleMovementOffset; + //int16 m_nCurrentZRotation; + //uint16 m_nZRotationTimer; + //float m_fCurrentZRadius; + //uint16 m_nZRadiusTimer; + int32 field_4C; + CParticle() { ; } - + ~CParticle() { ; @@ -97,12 +100,9 @@ public: static void HandleShootableBirdsStuff(CEntity *entity, CVector const&camPos); }; -extern bool clearWaterDrop; -extern int32 numWaterDropOnScreen; extern RwRaster *gpCarSplashRaster[]; extern RwRaster *gpHeatHazeRaster; -extern RwRaster *gpDotRaster; extern RwRaster *gpRainDripRaster[]; extern RwRaster *gpRainDripDarkRaster[]; -VALIDATE_SIZE(CParticle, 0x58); +VALIDATE_SIZE(CParticle, 0x50); diff --git a/src/render/ParticleMgr.cpp b/src/render/ParticleMgr.cpp index f6919435..c802067d 100644 --- a/src/render/ParticleMgr.cpp +++ b/src/render/ParticleMgr.cpp @@ -4,18 +4,31 @@ #include "FileMgr.h" #include "ParticleMgr.h" +// --LCS: File done + cParticleSystemMgr mod_ParticleSystemManager; const char *ParticleFilename = "PARTICLE.CFG"; cParticleSystemMgr::cParticleSystemMgr() { - memset(this, 0, sizeof(*this)); +#ifdef FIX_BUGS + m_aParticles = nil; +#endif +} + +cParticleSystemMgr::~cParticleSystemMgr() +{ +#ifdef FIX_BUGS + if ( m_aParticles ) + delete [] m_aParticles; +#endif } void cParticleSystemMgr::Initialise() { - LoadParticleData(); + if ( gMakeResources ) + LoadParticleData(); for ( int32 i = 0; i < MAX_PARTICLES; i++ ) m_aParticles[i].m_pParticles = nil; @@ -23,20 +36,31 @@ void cParticleSystemMgr::Initialise() void cParticleSystemMgr::LoadParticleData() { - CFileMgr::SetDir("DATA"); - CFileMgr::LoadFile(ParticleFilename, work_buff, ARRAY_SIZE(work_buff), "r"); +#ifdef FIX_BUGS + if ( m_aParticles ) + delete [] m_aParticles; +#endif + m_aParticles = new tParticleSystemData[MAX_PARTICLES]; + + memset(m_aParticles, 0, sizeof(tParticleSystemData)*MAX_PARTICLES); + + CFileMgr::SetDir("Data"); + ssize_t len = CFileMgr::LoadFile(ParticleFilename, work_buff, ARRAY_SIZE(work_buff), "r"); CFileMgr::SetDir(""); + ASSERT(!(len <= 0)); + tParticleSystemData *entry = nil; int32 type = PARTICLE_FIRST; + char *buffEnd = (char *)&work_buff[len]; char *lineStart = (char *)work_buff; char *lineEnd = lineStart + 1; char line[500]; char delims[4]; - while ( true ) + while ( lineStart < buffEnd ) { ASSERT(lineStart != nil); ASSERT(lineEnd != nil); diff --git a/src/render/ParticleMgr.h b/src/render/ParticleMgr.h index f4afc018..16da2c5f 100644 --- a/src/render/ParticleMgr.h +++ b/src/render/ParticleMgr.h @@ -124,15 +124,18 @@ class cParticleSystemMgr }; public: - tParticleSystemData m_aParticles[MAX_PARTICLES]; + tParticleSystemData *m_aParticles;//[MAX_PARTICLES]; cParticleSystemMgr(); +#ifdef FIX_BUGS + ~cParticleSystemMgr(); +#endif void Initialise(); void LoadParticleData(); void RangeCheck(tParticleSystemData *pData) { } }; -VALIDATE_SIZE(cParticleSystemMgr, 0x2FFC); +VALIDATE_SIZE(cParticleSystemMgr, 0x4); extern cParticleSystemMgr mod_ParticleSystemManager; diff --git a/src/render/ParticleType.h b/src/render/ParticleType.h index 0af9a1e1..cb3d53f0 100644 --- a/src/render/ParticleType.h +++ b/src/render/ParticleType.h @@ -42,8 +42,6 @@ enum tParticleType PARTICLE_RAIN_SPLASH_BIGGROW, PARTICLE_RAIN_SPLASHUP, PARTICLE_WATERSPRAY, - PARTICLE_WATERDROP, - PARTICLE_BLOODDROP, PARTICLE_EXPLOSION_MEDIUM, PARTICLE_EXPLOSION_LARGE, PARTICLE_EXPLOSION_MFAST, @@ -83,10 +81,11 @@ enum tParticleType PARTICLE_SHIP_SIDE, PARTICLE_BEASTIE, PARTICLE_RAINDROP_2D, - PARTICLE_HEATHAZE, - PARTICLE_HEATHAZE_IN_DIST, + PARTICLE_FERRY_CHIM_SMOKE, + PARTICLE_MULTIPLAYER_HIT, + PARTICLE_HYDRANT_STEAM, MAX_PARTICLES, PARTICLE_FIRST = PARTICLE_SPARK, - PARTICLE_LAST = PARTICLE_RAINDROP_2D + PARTICLE_LAST = PARTICLE_HYDRANT_STEAM }; \ No newline at end of file diff --git a/src/render/Sprite.cpp b/src/render/Sprite.cpp index 401eebd0..38ddc114 100644 --- a/src/render/Sprite.cpp +++ b/src/render/Sprite.cpp @@ -10,6 +10,19 @@ float CSprite::m_f2DFarScreenZ; float CSprite::m_fRecipNearClipPlane; int32 CSprite::m_bFlushSpriteBufferSwitchZTest; +float CalcScreenZ(float z) +{ + // LCS TODO: check + + if ( z == 0.0f ) + return CSprite::GetNearScreenZ(); + + return (z - CDraw::GetNearClipZ()) + * (CSprite::GetFarScreenZ() - CSprite::GetNearScreenZ()) * CDraw::GetFarClipZ() + / ( (CDraw::GetFarClipZ() - CDraw::GetNearClipZ()) * z ) + + CSprite::GetNearScreenZ(); +} + float CSprite::CalcHorizonCoors(void) { diff --git a/src/render/Sprite.h b/src/render/Sprite.h index fae6684e..952837a0 100644 --- a/src/render/Sprite.h +++ b/src/render/Sprite.h @@ -29,3 +29,5 @@ public: static void RenderBufferedOneXLUSprite2D_Rotate_Dimension(float x, float y, float w, float h, const RwRGBA &colour, int16 intens, float rotation, uint8 alpha); }; + +extern float CalcScreenZ(float z); \ No newline at end of file diff --git a/src/render/Weather.cpp b/src/render/Weather.cpp index 17c45fcd..333801d8 100644 --- a/src/render/Weather.cpp +++ b/src/render/Weather.cpp @@ -325,6 +325,7 @@ void CWeather::Update(void) void CWeather::AddHeatHaze() { + /* if(TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN || TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOP_DOWN_PED) return; @@ -336,6 +337,7 @@ void CWeather::AddHeatHaze() pos.y = CGeneral::GetRandomNumberInRange(SCREEN_HEIGHT*0.4f, SCREEN_HEIGHT*0.9f); pos.z = 100.0f; CParticle::AddParticle(PARTICLE_HEATHAZE_IN_DIST, pos, CVector(0.0f, 0.0f, 0.0f)); + */ } void CWeather::AddBeastie() diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index 6db4313d..64309c39 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -2037,6 +2037,7 @@ CAutomobile::PreRender(void) if(DotProduct(GetForward(), camDist) > 0.0f || TheCamera.GetLookDirection() == LOOKING_LEFT || TheCamera.GetLookDirection() == LOOKING_RIGHT){ + /* CParticle::AddParticle(PARTICLE_HEATHAZE, pos1, CVector(0.0f, 0.0f, 0.0f)); if(pHandling->Flags & HANDLING_DBL_EXHAUST) CParticle::AddParticle(PARTICLE_HEATHAZE, pos2, CVector(0.0f, 0.0f, 0.0f)); @@ -2044,6 +2045,7 @@ CAutomobile::PreRender(void) CParticle::AddParticle(PARTICLE_HEATHAZE, pos1, CVector(0.0f, 0.0f, 0.0f)); if(pHandling->Flags & HANDLING_DBL_EXHAUST) CParticle::AddParticle(PARTICLE_HEATHAZE, pos2, CVector(0.0f, 0.0f, 0.0f)); + */ } } diff --git a/src/vehicles/Bike.cpp b/src/vehicles/Bike.cpp index 19e95a6e..ab5ab622 100644 --- a/src/vehicles/Bike.cpp +++ b/src/vehicles/Bike.cpp @@ -1724,7 +1724,7 @@ CBike::PreRender(void) TheCamera.GetLookDirection() == LOOKING_RIGHT) pos1 -= 0.2f*GetForward(); - CParticle::AddParticle(PARTICLE_HEATHAZE, pos1, CVector(0.0f, 0.0f, 0.0f)); + //CParticle::AddParticle(PARTICLE_HEATHAZE, pos1, CVector(0.0f, 0.0f, 0.0f)); } } } diff --git a/src/vehicles/Boat.cpp b/src/vehicles/Boat.cpp index 695d380f..6ad23f8e 100644 --- a/src/vehicles/Boat.cpp +++ b/src/vehicles/Boat.cpp @@ -682,6 +682,7 @@ CBoat::ProcessControl(void) } // Spray waterdrops on screen + /* if(TheCamera.GetLookingForwardFirstPerson() && FindPlayerVehicle() && FindPlayerVehicle()->IsBoat() && m_nDeltaVolumeUnderWater > 0 && numWaterDropOnScreen < 20){ CVector dropPos; @@ -712,7 +713,7 @@ CBoat::ProcessControl(void) if(CParticle::AddParticle(PARTICLE_WATERDROP, dropPos, dropDir, nil, CGeneral::GetRandomNumberInRange(0.1f, 0.15f), dropColor, 0, 0, frm)) numWaterDropOnScreen++; - } + }*/ if(m_fPrevVolumeUnderWater == 0.0f && m_fVolumeUnderWater > 0.0f && GetModelIndex() == MI_SKIMMER){ CVector splashDir(0.0f, 0.0f, 0.25f*speed); diff --git a/src/weapons/Weapon.cpp b/src/weapons/Weapon.cpp index e2213399..eae69213 100644 --- a/src/weapons/Weapon.cpp +++ b/src/weapons/Weapon.cpp @@ -645,9 +645,9 @@ CWeapon::FireMelee(CEntity *shooter, CVector &fireSource) CVector dropDir(CGeneral::GetRandomNumberInRange(-0.15f, 0.15f), CGeneral::GetRandomNumberInRange(0.1f, 0.35f), 0.f); CVector dropPos(CGeneral::GetRandomNumberInRange(SCREEN_STRETCH_X(50.0f), SCREEN_STRETCH_FROM_RIGHT(50.0f)), CGeneral::GetRandomNumberInRange(SCREEN_STRETCH_Y(50.0f), SCREEN_STRETCH_FROM_BOTTOM(50.0f)), 1.f); - CParticle::AddParticle(PARTICLE_BLOODDROP, dropPos, dropDir, nil, CGeneral::GetRandomNumberInRange(0.1f, 0.15f), + /*CParticle::AddParticle(PARTICLE_BLOODDROP, dropPos, dropDir, nil, CGeneral::GetRandomNumberInRange(0.1f, 0.15f), CRGBA(0, 0, 0, 0), 0, 0, CGeneral::GetRandomNumber() & 1, 0); - + */ } if (info->m_AnimToPlay == ASSOCGRP_KNIFE) { @@ -737,7 +737,7 @@ CWeapon::FireMelee(CEntity *shooter, CVector &fireSource) { nearCar->VehicleDamage(info->m_nDamage * (0.00075f * nearCar->pHandling->fMass), gaTempSphereColPoints[0].pieceB); - CParticle::AddParticle(PARTICLE_HEATHAZE, gaTempSphereColPoints[0].point, CVector(0.0f, 0.0f, 0.0f), 0, 0.0f, 0, 0, 0, 0); + //CParticle::AddParticle(PARTICLE_HEATHAZE, gaTempSphereColPoints[0].point, CVector(0.0f, 0.0f, 0.0f), 0, 0.0f, 0, 0, 0, 0); } else { @@ -814,7 +814,7 @@ CWeapon::FireMelee(CEntity *shooter, CVector &fireSource) CParticle::AddParticle(PARTICLE_SPARK, gaTempSphereColPoints[0].point, 0.1f * gaTempSphereColPoints[0].normal, 0, 0.0f, 0, 0, 0, 0); } - CParticle::AddParticle(PARTICLE_HEATHAZE, gaTempSphereColPoints[0].point, CVector(0.0f, 0.0f, 0.0f), 0, 0.0f, 0, 0, 0, 0); + //CParticle::AddParticle(PARTICLE_HEATHAZE, gaTempSphereColPoints[0].point, CVector(0.0f, 0.0f, 0.0f), 0, 0.0f, 0, 0, 0, 0); if (!damageEntityRegistered) { From 096db533a667c0e366ccdf5b6625d8eff8ec7d91 Mon Sep 17 00:00:00 2001 From: Fire-Head Date: Wed, 13 Jan 2021 00:09:40 +0300 Subject: [PATCH 2/7] rem gMakeResources --- src/core/main.cpp | 1 - src/core/main.h | 2 -- 2 files changed, 3 deletions(-) diff --git a/src/core/main.cpp b/src/core/main.cpp index 3cce9c19..41a99991 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -102,7 +102,6 @@ float NumberOfChunksLoaded; bool g_SlowMode = false; char version_name[64]; -bool gMakeResources = true; void GameInit(void); void SystemInit(void); diff --git a/src/core/main.h b/src/core/main.h index 4dfaef5e..9b76a947 100644 --- a/src/core/main.h +++ b/src/core/main.h @@ -24,8 +24,6 @@ extern bool gbShowTimebars; extern bool gbPrintMemoryUsage; #endif -extern bool gMakeResources; - class CSprite2d; bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha); From 660d040531a6962600862bc5cbf88c601c57e5a0 Mon Sep 17 00:00:00 2001 From: Fire-Head Date: Wed, 13 Jan 2021 01:06:22 +0300 Subject: [PATCH 3/7] assert, temp fixes --- src/render/Particle.cpp | 42 ++++++++++++++++++++++++++++++++++++++++- src/render/Shadows.cpp | 18 +++++++++--------- vendor/librw | 2 +- 3 files changed, 51 insertions(+), 11 deletions(-) diff --git a/src/render/Particle.cpp b/src/render/Particle.cpp index 35812024..ff74bc67 100644 --- a/src/render/Particle.cpp +++ b/src/render/Particle.cpp @@ -321,84 +321,101 @@ void CParticle::Initialise() for ( int32 i = 0; i < MAX_SMOKE_FILES; i++ ) { gpSmokeTex[i] = RwTextureRead(SmokeFiles[i], nil); + ASSERT(gpSmokeTex[i] != nil); gpSmokeRaster[i] = RwTextureGetRaster(gpSmokeTex[i]); } gpSmoke2Tex = RwTextureRead("smokeII_3", nil); + ASSERT(gpSmoke2Tex != nil); gpSmoke2Raster = RwTextureGetRaster(gpSmoke2Tex); for ( int32 i = 0; i < MAX_RUBBER_FILES; i++ ) { gpRubberTex[i] = RwTextureRead(RubberFiles[i], nil); + ASSERT(gpRubberTex[i] != nil); gpRubberRaster[i] = RwTextureGetRaster(gpRubberTex[i]); } for ( int32 i = 0; i < MAX_RAINSPLASH_FILES; i++ ) { gpRainSplashTex[i] = RwTextureRead(RainSplashFiles[i], nil); + ASSERT(gpRainSplashTex[i] != nil); gpRainSplashRaster[i] = RwTextureGetRaster(gpRainSplashTex[i]); } for ( int32 i = 0; i < MAX_WATERSPRAY_FILES; i++ ) { gpWatersprayTex[i] = RwTextureRead(WatersprayFiles[i], nil); + ASSERT(gpWatersprayTex[i] != nil); gpWatersprayRaster[i] = RwTextureGetRaster(gpWatersprayTex[i]); } for ( int32 i = 0; i < MAX_EXPLOSIONMEDIUM_FILES; i++ ) { gpExplosionMediumTex[i] = RwTextureRead(ExplosionMediumFiles[i], nil); + ASSERT(gpExplosionMediumTex[i] != nil); gpExplosionMediumRaster[i] = RwTextureGetRaster(gpExplosionMediumTex[i]); } for ( int32 i = 0; i < MAX_GUNFLASH_FILES; i++ ) { gpGunFlashTex[i] = RwTextureRead(GunFlashFiles[i], nil); + ASSERT(gpGunFlashTex[i] != nil); gpGunFlashRaster[i] = RwTextureGetRaster(gpGunFlashTex[i]); } gpRainDropTex = RwTextureRead("raindrop4", nil); + ASSERT(gpRainDropTex != nil); gpRainDropRaster = RwTextureGetRaster(gpRainDropTex); for ( int32 i = 0; i < MAX_RAINSPLASHUP_FILES; i++ ) { gpRainSplashupTex[i] = RwTextureRead(RainSplashupFiles[i], nil); + ASSERT(gpRainSplashupTex[i] != nil); gpRainSplashupRaster[i] = RwTextureGetRaster(gpRainSplashupTex[i]); } for ( int32 i = 0; i < MAX_BIRDFRONT_FILES; i++ ) { gpBirdfrontTex[i] = RwTextureRead(BirdfrontFiles[i], nil); + ASSERT(gpBirdfrontTex[i] != nil); gpBirdfrontRaster[i] = RwTextureGetRaster(gpBirdfrontTex[i]); } for ( int32 i = 0; i < MAX_BOAT_FILES; i++ ) { gpBoatTex[i] = RwTextureRead(BoatFiles[i], nil); + ASSERT(gpBoatTex[i] != nil); gpBoatRaster[i] = RwTextureGetRaster(gpBoatTex[i]); } for ( int32 i = 0; i < MAX_CARDEBRIS_FILES; i++ ) { gpCarDebrisTex[i] = RwTextureRead(CardebrisFiles[i], nil); + ASSERT(gpCarDebrisTex[i] != nil); gpCarDebrisRaster[i] = RwTextureGetRaster(gpCarDebrisTex[i]); } for ( int32 i = 0; i < MAX_CARSPLASH_FILES; i++ ) { gpCarSplashTex[i] = RwTextureRead(CarsplashFiles[i], nil); + ASSERT(gpCarSplashTex[i] != nil); gpCarSplashRaster[i] = RwTextureGetRaster(gpCarSplashTex[i]); } gpBoatWakeTex = RwTextureRead("boatwake2", nil); + ASSERT(gpBoatWakeTex != nil); gpBoatWakeRaster = RwTextureGetRaster(gpBoatWakeTex); gpFlame1Tex = RwTextureRead("flame1", nil); + ASSERT(gpFlame1Tex != nil); gpFlame1Raster = RwTextureGetRaster(gpFlame1Tex); gpFlame5Tex = RwTextureRead("flame5", nil); + ASSERT(gpFlame5Tex != nil); -#ifdef FIX_BUGS +//#ifdef FIX_BUGS +#if 0 gpFlame5Raster = RwTextureGetRaster(gpFlame5Tex); #else // this seems to have become more of a design choice @@ -406,68 +423,91 @@ void CParticle::Initialise() #endif gpRainDropSmallTex = RwTextureRead("rainsmall", nil); + ASSERT(gpRainDropSmallTex != nil); gpRainDropSmallRaster = RwTextureGetRaster(gpRainDropSmallTex); gpBloodTex = RwTextureRead("blood", nil); + ASSERT(gpBloodTex != nil); gpBloodRaster = RwTextureGetRaster(gpBloodTex); gpLeafTex = RwTextureRead("gameleaf01_64", nil); + ASSERT(gpLeafTex != nil); gpLeafRaster = RwTextureGetRaster(gpLeafTex); gpLetterTex = RwTextureRead("letter", nil); + ASSERT(gpLetterTex != nil); gpLetterRaster = RwTextureGetRaster(gpLetterTex); gpCloudTex1 = RwTextureRead("cloud3", nil); + ASSERT(gpCloudTex1 != nil); gpCloudRaster1 = RwTextureGetRaster(gpCloudTex1); gpCloudTex4 = RwTextureRead("cloudmasked", nil); + ASSERT(gpCloudTex4 != nil); gpCloudRaster4 = RwTextureGetRaster(gpCloudTex4); gpBloodSmallTex = RwTextureRead("bloodsplat2", nil); + ASSERT(gpBloodSmallTex != nil); gpBloodSmallRaster = RwTextureGetRaster(gpBloodSmallTex); gpGungeTex = RwTextureRead("gunge", nil); + ASSERT(gpGungeTex != nil); gpGungeRaster = RwTextureGetRaster(gpGungeTex); gpCollisionSmokeTex = RwTextureRead("collisionsmoke", nil); + ASSERT(gpCollisionSmokeTex != nil); gpCollisionSmokeRaster = RwTextureGetRaster(gpCollisionSmokeTex); gpBulletHitTex = RwTextureRead("bullethitsmoke", nil); + ASSERT(gpBulletHitTex != nil); gpBulletHitRaster = RwTextureGetRaster(gpBulletHitTex); gpGunShellTex = RwTextureRead("gunshell", nil); + ASSERT(gpGunShellTex != nil); gpGunShellRaster = RwTextureGetRaster(gpGunShellTex); gpPointlightTex = RwTextureRead("smoke5", nil); + ASSERT(gpPointlightTex != nil); gpPointlightRaster = RwTextureGetRaster(gpPointlightTex); gpSparkTex = RwTextureRead("spark", nil); + ASSERT(gpSparkTex != nil); gpSparkRaster = RwTextureGetRaster(gpSparkTex); gpNewspaperTex = RwTextureRead("ballot_paper", nil); + ASSERT(gpNewspaperTex != nil); gpNewspaperRaster = RwTextureGetRaster(gpNewspaperTex); gpGunSmokeTex = RwTextureRead("gunsmoke3", nil); + ASSERT(gpGunSmokeTex != nil); gpGunSmokeRaster = RwTextureGetRaster(gpGunSmokeTex); gpHeatHazeTex = RwTextureRead("heathaze", nil); + ASSERT(gpHeatHazeTex != nil); gpHeatHazeRaster = RwTextureGetRaster(gpHeatHazeTex); gpBeastieTex = RwTextureRead("beastie", nil); + ASSERT(gpBeastieTex != nil); gpBeastieRaster = RwTextureGetRaster(gpBeastieTex); gpRainDripTex[0] = RwTextureRead("raindrip64", nil); + ASSERT(gpRainDripTex[0] != nil); gpRainDripRaster[0] = RwTextureGetRaster(gpRainDripTex[0]); gpRainDripTex[1] = RwTextureRead("raindripb64", nil); + ASSERT(gpRainDripTex[1] != nil); gpRainDripRaster[1] = RwTextureGetRaster(gpRainDripTex[1]); gpRainDripDarkTex[0] = RwTextureRead("raindrip64_d", nil); + ASSERT(gpRainDripDarkTex[0] != nil); gpRainDripDarkRaster[0] = RwTextureGetRaster(gpRainDripDarkTex[0]); gpMultiPlayerHitTex = RwTextureRead("mphit", nil); + ASSERT(gpMultiPlayerHitTex != nil); gpMultiPlayerHitRaster = RwTextureGetRaster(gpMultiPlayerHitTex); + gpFireHoseTex = RwTextureRead("firehose", nil); + ASSERT(gpFireHoseTex != nil); gpFireHoseRaster = RwTextureGetRaster(gpFireHoseTex); CTxdStore::PopCurrentTxd(); diff --git a/src/render/Shadows.cpp b/src/render/Shadows.cpp index 2b1df555..ba902bae 100644 --- a/src/render/Shadows.cpp +++ b/src/render/Shadows.cpp @@ -76,14 +76,14 @@ CShadows::Init(void) gpShadowBikeTex = RwTextureRead("shad_bike", nil); gpShadowBaronTex = RwTextureRead("shad_rcbaron", nil); gpShadowExplosionTex = RwTextureRead("shad_exp", nil); - gpShadowHeadLightsTex = RwTextureRead("headlight", nil); + gpShadowHeadLightsTex = RwTextureRead("headlight_single", nil); gpOutline1Tex = RwTextureRead("outline_64", nil); gpOutline2Tex = RwTextureRead("outline2_64", nil); gpOutline3Tex = RwTextureRead("outline3_64", nil); gpBloodPoolTex = RwTextureRead("bloodpool_64", nil); - gpReflectionTex = RwTextureRead("reflection01", nil); + //gpReflectionTex = RwTextureRead("reflection01", nil); gpWalkDontTex = RwTextureRead("walk_dont", nil); - gpCrackedGlassTex = RwTextureRead("wincrack_32", nil); + //gpCrackedGlassTex = RwTextureRead("wincrack_32", nil); gpPostShadowTex = RwTextureRead("lamp_shad_64", nil); CTxdStore::PopCurrentTxd(); @@ -99,9 +99,9 @@ CShadows::Init(void) ASSERT(gpOutline2Tex != nil); ASSERT(gpOutline3Tex != nil); ASSERT(gpBloodPoolTex != nil); - ASSERT(gpReflectionTex != nil); + //ASSERT(gpReflectionTex != nil); ASSERT(gpWalkDontTex != nil); - ASSERT(gpCrackedGlassTex != nil); + //ASSERT(gpCrackedGlassTex != nil); ASSERT(gpPostShadowTex != nil); @@ -178,9 +178,9 @@ CShadows::Shutdown(void) ASSERT(gpOutline2Tex != nil); ASSERT(gpOutline3Tex != nil); ASSERT(gpBloodPoolTex != nil); - ASSERT(gpReflectionTex != nil); + //ASSERT(gpReflectionTex != nil); ASSERT(gpWalkDontTex != nil); - ASSERT(gpCrackedGlassTex != nil); + //ASSERT(gpCrackedGlassTex != nil); ASSERT(gpPostShadowTex != nil); RwTextureDestroy(gpShadowCarTex); @@ -194,9 +194,9 @@ CShadows::Shutdown(void) RwTextureDestroy(gpOutline2Tex); RwTextureDestroy(gpOutline3Tex); RwTextureDestroy(gpBloodPoolTex); - RwTextureDestroy(gpReflectionTex); + //RwTextureDestroy(gpReflectionTex); RwTextureDestroy(gpWalkDontTex); - RwTextureDestroy(gpCrackedGlassTex); + //RwTextureDestroy(gpCrackedGlassTex); RwTextureDestroy(gpPostShadowTex); } diff --git a/vendor/librw b/vendor/librw index 78d540fc..ed9cb45e 160000 --- a/vendor/librw +++ b/vendor/librw @@ -1 +1 @@ -Subproject commit 78d540fce0ca090b07377cee40d73eadfb7a699d +Subproject commit ed9cb45ee9a2749a0a89231bf16f09a5c53bfc92 From 97c9a4a02c9f801d35fbcf47658756a89a33f6d9 Mon Sep 17 00:00:00 2001 From: Fire-Head Date: Wed, 13 Jan 2021 23:15:33 +0300 Subject: [PATCH 4/7] Revert "Merge branch 'lcs' of https://github.com/GTAmodding/re3 into lcs" This reverts commit d63e3f155995f2b82cee1f19bcf5c0f00bda491a, reversing changes made to ec173550561d7cb36505853fed13967d5299cce1. --- CMakeLists.txt | 94 +++------- README.md | 11 +- cmake/FindMPG123.cmake | 28 +++ cmake/FindSndFile.cmake | 84 ++++----- cmake/Findmpg123.cmake | 38 ---- premake5.lua | 6 +- src/CMakeLists.txt | 170 +++++++++--------- src/animation/AnimBlendClumpData.cpp | 2 +- src/animation/AnimBlendClumpData.h | 6 +- src/animation/FrameUpdate.cpp | 42 ++--- src/animation/RpAnimBlend.cpp | 2 +- src/control/Replay.cpp | 20 +-- src/control/Replay.h | 6 +- src/control/Script4.cpp | 16 +- src/core/Camera.cpp | 2 +- src/core/Game.cpp | 2 +- src/core/PlayerInfo.cpp | 4 +- src/core/config.h | 6 +- src/core/main.cpp | 4 - src/entities/Physical.cpp | 37 +--- src/objects/CutsceneObject.cpp | 2 +- src/peds/Ped.cpp | 150 ++++++++-------- src/peds/Ped.h | 6 +- src/peds/PedAI.cpp | 252 +++++++++++++-------------- src/peds/PedFight.cpp | 12 +- src/render/Font.cpp | 122 ++++--------- src/render/MBlur.cpp | 2 +- src/render/WaterLevel.cpp | 68 ++++---- src/render/WaterLevel.h | 3 +- src/rw/MemoryMgr.cpp | 2 +- src/rw/RwHelper.cpp | 9 +- src/text/Text.cpp | 10 +- src/text/Text.h | 4 +- src/vehicles/Automobile.cpp | 2 +- src/vehicles/Bike.cpp | 2 +- src/vehicles/Cranes.h | 2 +- src/vehicles/Heli.cpp | 4 +- src/vehicles/Heli.h | 3 +- src/vehicles/Train.cpp | 2 +- src/vehicles/Vehicle.cpp | 12 +- 40 files changed, 542 insertions(+), 707 deletions(-) create mode 100644 cmake/FindMPG123.cmake delete mode 100644 cmake/Findmpg123.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 116d8455..387400b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,82 +1,44 @@ cmake_minimum_required(VERSION 3.8) -set(EXECUTABLE reLCS) -set(PROJECT RELCS) - -project(${EXECUTABLE} C CXX) +project(reVC C CXX) list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") if(WIN32) - set(${PROJECT}_AUDIOS "OAL" "MSS") + set(REVC_AUDIOS "NULL" "OAL" "MSS") else() - set(${PROJECT}_AUDIOS "OAL") + set(REVC_AUDIOS "NULL" "OAL") endif() -set(${PROJECT}_AUDIO "OAL" CACHE STRING "Audio") +set(REVC_AUDIO "OAL" CACHE STRING "Audio") -option(${PROJECT}_WITH_OPUS "Build ${EXECUTABLE} with opus support" OFF) -option(${PROJECT}_WITH_LIBSNDFILE "Build ${EXECUTABLE} with libsndfile (instead of internal decoder)" OFF) - -set_property(CACHE ${PROJECT}_AUDIO PROPERTY STRINGS ${${PROJECT}_AUDIOS}) -message(STATUS "${PROJECT}_AUDIO = ${${PROJECT}_AUDIO} (choices=${${PROJECT}_AUDIOS})") -set("${PROJECT}_AUDIO_${${PROJECT}_AUDIO}" ON) -if(NOT ${PROJECT}_AUDIO IN_LIST ${PROJECT}_AUDIOS) - message(FATAL_ERROR "Illegal ${PROJECT}_AUDIO=${${PROJECT}_AUDIO}") +set_property(CACHE REVC_AUDIO PROPERTY STRINGS ${REVC_AUDIOS}) +message(STATUS "REVC_AUDIO = ${REVC_AUDIO} (choices=${REVC_AUDIOS})") +set("REVC_AUDIO_${REVC_AUDIO}" ON) +if(NOT REVC_AUDIO IN_LIST REVC_AUDIOS) + message(FATAL_ERROR "Illegal REVC_AUDIO=${REVC_AUDIO}") endif() -option(${PROJECT}_VENDORED_LIBRW "Use vendored librw" ON) -if(${PROJECT}_VENDORED_LIBRW) - add_subdirectory(vendor/librw) -else() - find_package(librw REQUIRED) +if(REVC_INSTALL) + include(GNUInstallDirs) + set(REVC_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}/reVC") endif() + +add_subdirectory("vendor/librw") add_subdirectory(src) -if(${PROJECT}_INSTALL) - install(DIRECTORY gamefiles/ DESTINATION ".") - if(LIBRW_PLATFORM_NULL) - set(platform "-null") - elseif(LIBRW_PLATFORM_PS2) - set(platform "-ps2") - elseif(LIBRW_PLATFORM_GL3) - if(LIBRW_GL3_GFXLIB STREQUAL "GLFW") - set(platform "-gl3-glfw") - else() - set(platform "-gl3-sdl2") - endif() - elseif(LIBRW_PLATFORM_D3D9) - set(platform "-d3d9") - endif() - if(${PROJECT}_AUDIO_OAL) - set(audio "-oal") - elseif(${PROJECT}_AUDIO_MSS) - set(audio "-mss") - endif() - if(${PROJECT}_WITH_OPUS) - set(audio "${audio}-opus") - endif() - if(NOT LIBRW_PLATFORM_PS2) - if(WIN32) - set(os "-win") - elseif(APPLE) - set(os "-apple") - elseif(UNIX) - set(os "-linux") - else() - set(compiler "-UNK") - message(WARNING "Unknown os. Created cpack package will be wrong. (override using cpack -P)") - endif() - endif() +if(REVC_INSTALL) + include(CMakePackageConfigHelpers) + configure_package_config_file(reVC-config.cmake.in reVC-config.cmake + INSTALL_DESTINATION "${CMAKE_INSTALL_PREFIX}" + ) + install( + FILES "${CMAKE_CURRENT_BINARY_DIR}/reVC-config.cmake" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" + ) + install( + EXPORT reVC-targets + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" + ) - set(CPACK_PACKAGE_NAME "${PROJECT_NAME}${platform}${audio}${os}${compiler}") - set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "GTA III reversed") - set(CPACK_PACKAGE_VENDOR "GTAModding") - # FIXME: missing license (https://github.com/GTAmodding/re3/issues/794) - # set(CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_SOURCE_DIR}/LICENSE") - # set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE") - set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}") - set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}") - set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}") - set(CPACK_GENERATOR "TXZ") - include(CPack) + include(CMakeCPack.cmake) endif() diff --git a/README.md b/README.md index 162f965d..af559e1e 100644 --- a/README.md +++ b/README.md @@ -35,13 +35,6 @@ There are various settings at the very bottom of [config.h](https://github.com/G ## Contributing Please read the [Coding Style](https://github.com/GTAmodding/re3/blob/master/CODING_STYLE.md) Document -### Unreversed / incomplete classes - -PS2/Mobile stuff: - - src/core/Pad.cpp - src/core/main.cpp - src/core/Frontend_PS2.cpp - src/core/FrontEndControls.cpp - src/save/MemoryCard.cpp +### Unreversed / incomplete classes (at least the ones we know) +See [VC todo list](https://github.com/GTAmodding/re3/wiki/VC-todo) diff --git a/cmake/FindMPG123.cmake b/cmake/FindMPG123.cmake new file mode 100644 index 00000000..a9b6dd8b --- /dev/null +++ b/cmake/FindMPG123.cmake @@ -0,0 +1,28 @@ +# - Find mpg123 +# Find the native mpg123 includes and library +# +# MPG123_INCLUDE_DIR - where to find mpg123.h +# MPG123_LIBRARIES - List of libraries when using mpg123. +# MPG123_FOUND - True if mpg123 found. + +IF(MPG123_INCLUDE_DIR AND MPG123_LIBRARIES) + # Already in cache, be silent + SET(MPG123_FIND_QUIETLY TRUE) +ENDIF(MPG123_INCLUDE_DIR AND MPG123_LIBRARIES) + +FIND_PATH(MPG123_INCLUDE_DIR mpg123.h + PATHS "${MPG123_DIR}" + PATH_SUFFIXES include + ) + +FIND_LIBRARY(MPG123_LIBRARIES NAMES mpg123 mpg123-0 + PATHS "${MPG123_DIR}" + PATH_SUFFIXES lib + ) + +# MARK_AS_ADVANCED(MPG123_LIBRARIES MPG123_INCLUDE_DIR) + +# handle the QUIETLY and REQUIRED arguments and set MPG123_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(MPG123 DEFAULT_MSG MPG123_LIBRARIES MPG123_INCLUDE_DIR) diff --git a/cmake/FindSndFile.cmake b/cmake/FindSndFile.cmake index 5381af48..8ae47b70 100644 --- a/cmake/FindSndFile.cmake +++ b/cmake/FindSndFile.cmake @@ -4,11 +4,9 @@ # # Once done this will define # -# SNDFILE_FOUND - system has libsndfile +# SNDFILE_FOUND - system has libsndfile # SNDFILE_INCLUDE_DIRS - the libsndfile include directory -# SNDFILE_LIBRARIES - Link these to use libsndfile -# SNDFILE_CFLAGS - Compile options to use libsndfile -# SndFile::SndFile - Imported library of libsndfile +# SNDFILE_LIBRARIES - Link these to use libsndfile # # Copyright (C) 2006 Wengo # @@ -17,51 +15,53 @@ # For details see the accompanying COPYING-CMAKE-SCRIPTS file. # -find_package(PkgConfig QUIET) -if(PKG_CONFIG_FOUND) - pkg_search_module(PKG_SNDFILE "sndfile") -endif() +if (SNDFILE_LIBRARIES AND SNDFILE_INCLUDE_DIRS) + # in cache already + set(SNDFILE_FOUND TRUE) +else (SNDFILE_LIBRARIES AND SNDFILE_INCLUDE_DIRS) -find_path(SNDFILE_INCLUDE_DIR + find_path(SNDFILE_INCLUDE_DIR NAMES - sndfile.h - HINTS - ${PKG_SNDFILE_INCLUDE_DIRS} + sndfile.h PATHS - /usr/include - /usr/local/include - /opt/local/include - /sw/include - ) - -find_library(SNDFILE_LIBRARY + /usr/include + /usr/local/include + /opt/local/include + /sw/include + ) + + find_library(SNDFILE_LIBRARY NAMES - sndfile - HINTS - ${PKG_SNDFILE_LIBRARIES} + sndfile PATHS - /usr/lib - /usr/local/lib - /opt/local/lib - /sw/lib -) + /usr/lib + /usr/local/lib + /opt/local/lib + /sw/lib + ) -set(SNDFILE_CFLAGS "${PKG_SNDFILE_CFLAGS_OTHER}" CACHE STRING "CFLAGS of libsndfile") + set(SNDFILE_INCLUDE_DIRS + ${SNDFILE_INCLUDE_DIR} + ) + set(SNDFILE_LIBRARIES + ${SNDFILE_LIBRARY} + ) -set(SNDFILE_INCLUDE_DIRS "${SNDFILE_INCLUDE_DIR}") -set(SNDFILE_LIBRARIES "${SNDFILE_LIBRARY}") - -if(SNDFILE_INCLUDE_DIRS AND SNDFILE_LIBRARIES) + if (SNDFILE_INCLUDE_DIRS AND SNDFILE_LIBRARIES) set(SNDFILE_FOUND TRUE) -endif() + endif (SNDFILE_INCLUDE_DIRS AND SNDFILE_LIBRARIES) -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(SndFile DEFAULT_MSG SNDFILE_INCLUDE_DIRS SNDFILE_LIBRARIES) + if (SNDFILE_FOUND) + if (NOT SndFile_FIND_QUIETLY) + message(STATUS "Found libsndfile: ${SNDFILE_LIBRARIES}") + endif (NOT SndFile_FIND_QUIETLY) + else (SNDFILE_FOUND) + if (SndFile_FIND_REQUIRED) + message(FATAL_ERROR "Could not find libsndfile") + endif (SndFile_FIND_REQUIRED) + endif (SNDFILE_FOUND) -if(NOT TARGET SndFile::SndFile) - add_library(__SndFile INTERFACE) - target_compile_options(__SndFile INTERFACE ${SNDFILE_CFLAGS}) - target_include_directories(__SndFile INTERFACE ${SNDFILE_INCLUDE_DIRS}) - target_link_libraries(__SndFile INTERFACE ${SNDFILE_LIBRARIES}) - add_library(SndFile::SndFile ALIAS __SndFile) -endif() + # show the SNDFILE_INCLUDE_DIRS and SNDFILE_LIBRARIES variables only in the advanced view + mark_as_advanced(SNDFILE_INCLUDE_DIRS SNDFILE_LIBRARIES) + +endif (SNDFILE_LIBRARIES AND SNDFILE_INCLUDE_DIRS) diff --git a/cmake/Findmpg123.cmake b/cmake/Findmpg123.cmake deleted file mode 100644 index c6fe56bb..00000000 --- a/cmake/Findmpg123.cmake +++ /dev/null @@ -1,38 +0,0 @@ -# - Find mpg123 -# Find the native mpg123 includes and library -# -# mpg123_INCLUDE_DIR - Where to find mpg123.h -# mpg123_LIBRARIES - List of libraries when using mpg123. -# mpg123_CFLAGS - Compile options to use mpg123 -# mpg123_FOUND - True if mpg123 found. -# MPG123::libmpg123 - Imported library of libmpg123 - -find_package(PkgConfig QUIET) -if(PKG_CONFIG_FOUND) - pkg_search_module(PKG_MPG123 mpg123) -endif() - -find_path(mpg123_INCLUDE_DIR mpg123.h - HINTS ${PKG_MPG123_INCLUDE_DIRS} - PATHS "${mpg123_DIR}" - PATH_SUFFIXES include -) - -find_library(mpg123_LIBRARIES NAMES mpg123 mpg123-0 - HINTS ${PKG_MPG123_LIBRARIES} - PATHS "${mpg123_DIR}" - PATH_SUFFIXES lib -) - -set(mpg123_CFLAGS "${PKG_MPG123_CFLAGS_OTHER}" CACHE STRING "CFLAGS of mpg123") - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(mpg123 DEFAULT_MSG mpg123_LIBRARIES mpg123_INCLUDE_DIR) - -if(NOT TARGET MPG123::libmpg123) - add_library(__libmpg123 INTERFACE) - target_compile_options(__libmpg123 INTERFACE ${mpg123_CFLAGS}) - target_include_directories(__libmpg123 INTERFACE ${mpg123_INCLUDE_DIR}) - target_link_libraries(__libmpg123 INTERFACE ${mpg123_LIBRARIES}) - add_library(MPG123::libmpg123 ALIAS __libmpg123) -endif() diff --git a/premake5.lua b/premake5.lua index 11a0bbbd..6c26732c 100644 --- a/premake5.lua +++ b/premake5.lua @@ -172,10 +172,11 @@ workspace "reLCS" filter {} - function setpaths (gamepath, exepath) + function setpaths (gamepath, exepath, scriptspath) + scriptspath = scriptspath or "" if (gamepath) then postbuildcommands { - '{COPYFILE} "%{cfg.buildtarget.abspath}" "' .. gamepath .. '%{cfg.buildtarget.name}"' + '{COPYFILE} "%{cfg.buildtarget.abspath}" "' .. gamepath .. scriptspath .. '%{cfg.buildtarget.name}"' } debugdir (gamepath) if (exepath) then @@ -185,6 +186,7 @@ workspace "reLCS" debugdir (gamepath .. (dir or "")) end end + --targetdir ("bin/%{prj.name}/" .. scriptspath) end if(_OPTIONS["with-librw"]) then diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index dc204d17..e87878a8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,105 +1,92 @@ set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) -file(GLOB_RECURSE ${PROJECT}_SOURCES "*.cpp" "*.h" "*.rc") +if(${REVC_AUDIO} STREQUAL "OAL") + find_package(OpenAL REQUIRED) + find_package(MPG123 REQUIRED) + find_package(SndFile REQUIRED) +endif() -function(header_directories RETURN_LIST) - file(GLOB_RECURSE ALL_SRCS *.h *.cpp *.c) - set(RELDIRS) - foreach(SRC ${ALL_SRCS}) - file(RELATIVE_PATH RELSRC "${CMAKE_CURRENT_SOURCE_DIR}" "${SRC}") - get_filename_component(RELDIR "${RELSRC}" DIRECTORY) - list(APPEND RELDIRS ${RELDIR}) - endforeach() - list(REMOVE_DUPLICATES RELDIRS) - set(${RETURN_LIST} ${RELDIRS} PARENT_SCOPE) -endfunction() +file(GLOB_RECURSE Sources "*.cpp" "*.h") -header_directories(${PROJECT}_INCLUDES) +MACRO(HEADER_DIRECTORIES return_list) + FILE(GLOB_RECURSE new_list *.cpp) + SET(dir_list "animation" + "audio" + "collision" + "control" + "core" + "entities" + "extras" + "fakerw" + "math" + "modelinfo" + "objects" + "peds" + "render" + "rw" + "save" + "skel" + "text" + "vehicles" + "weapons") + FOREACH(file_path ${new_list}) + GET_FILENAME_COMPONENT(dir_path ${file_path} PATH) + SET(dir_list ${dir_list} ${dir_path}) + ENDFOREACH() + LIST(REMOVE_DUPLICATES dir_list) + SET(${return_list} ${dir_list}) +ENDMACRO() -add_executable(${EXECUTABLE} WIN32 - ${${PROJECT}_SOURCES} -) +HEADER_DIRECTORIES(header_list) +include_directories(${header_list}) -target_link_libraries(${EXECUTABLE} PRIVATE - librw::librw - Threads::Threads -) -target_include_directories(${EXECUTABLE} - PRIVATE +add_executable(reVC ${Sources}) +target_link_libraries(reVC librw) +target_link_libraries(reVC Threads::Threads) + +if(${REVC_AUDIO} STREQUAL "OAL") + target_link_libraries(reVC ${OPENAL_LIBRARY}) + target_link_libraries(reVC ${MPG123_LIBRARIES}) + target_link_libraries(reVC ${SNDFILE_LIBRARIES}) +endif() + +target_include_directories(reVC + INTERFACE $ - $ -) + ) -target_compile_definitions(${EXECUTABLE} +target_compile_definitions(reVC PRIVATE - $,DEBUG,NDEBUG> - LIBRW - ${PROJECT}_NO_AUTOLINK -) - -if(LIBRW_PLATFORM_D3D9) - target_compile_definitions(${EXECUTABLE} - PUBLIC - USE_D3D9 + "$,DEBUG,NDEBUG>" + PUBLIC + "RW_${REVC_PLATFORM}" ) -endif() -if(${PROJECT}_AUDIO STREQUAL "OAL") - find_package(OpenAL REQUIRED) - target_include_directories(${EXECUTABLE} PRIVATE ${OPENAL_INCLUDE_DIR}) - target_link_libraries(${EXECUTABLE} PRIVATE ${OPENAL_LIBRARY}) - target_compile_definitions(${EXECUTABLE} PRIVATE ${OPENAL_DEFINITIONS}) - target_compile_definitions(${EXECUTABLE} PRIVATE AUDIO_OAL) -elseif(${PROJECT}_AUDIO STREQUAL "MSS") - find_package(MilesSDK REQUIRED) - target_compile_definitions(${EXECUTABLE} PRIVATE AUDIO_MSS) - target_link_libraries(${EXECUTABLE} PRIVATE MilesSDK::MilesSDK) -endif() - -find_package(mpg123 REQUIRED) -target_link_libraries(${EXECUTABLE} PRIVATE - MPG123::libmpg123 -) -if(${PROJECT}_WITH_OPUS) - find_package(opusfile REQUIRED) - target_link_libraries(${EXECUTABLE} PRIVATE - opusfile::opusfile - ) - target_compile_definitions(${EXECUTABLE} PRIVATE AUDIO_OPUS) -endif() -if(${PROJECT}_WITH_LIBSNDFILE) - find_package(SndFile REQUIRED) - target_link_libraries(${EXECUTABLE} PRIVATE - SndFile::SndFile - ) - target_compile_definitions(${EXECUTABLE} PRIVATE AUDIO_OAL_USE_SNDFILE) -endif() - -target_compile_definitions(${EXECUTABLE} PRIVATE ) +target_compile_definitions(reVC PRIVATE LIBRW=1 AUDIO_OAL=1) if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") - target_compile_options(${EXECUTABLE} + target_compile_options(reVC PRIVATE "-Wall" - ) - if (NOT LIBRW_PLATFORM_PS2) - target_compile_options(${EXECUTABLE} - PRIVATE - -Wextra - -Wdouble-promotion - -Wpedantic ) + if (NOT REVC_PLATFORM_PS2) + target_compile_options(reVC + PRIVATE + "-Wextra" + "-Wdouble-promotion" + "-Wpedantic" + ) endif() elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") - target_compile_options(${EXECUTABLE} + target_compile_options(reVC PUBLIC - /Zc:sizedDealloc- - ) + /wd4996 /wd4244 + ) endif() -set_target_properties(${EXECUTABLE} +set_target_properties(reVC PROPERTIES C_STANDARD 11 C_EXTENSIONS OFF @@ -107,15 +94,20 @@ set_target_properties(${EXECUTABLE} CXX_STANDARD 11 CXX_EXTENSIONS OFF CXX_STANDARD_REQUIRED ON -) - -if(${PROJECT}_INSTALL) - install( - TARGETS ${EXECUTABLE} - EXPORT ${EXECUTABLE}-targets - RUNTIME DESTINATION "." + PREFIX "" ) - if(MSVC) - install(FILES $ DESTINATION "." OPTIONAL) - endif() + +if(REVC_INSTALL) + target_include_directories(reVC + INTERFACE + $ + ) + + install( + TARGETS reVC + EXPORT reVC-targets + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + ) endif() diff --git a/src/animation/AnimBlendClumpData.cpp b/src/animation/AnimBlendClumpData.cpp index 620c2229..4e8f3153 100644 --- a/src/animation/AnimBlendClumpData.cpp +++ b/src/animation/AnimBlendClumpData.cpp @@ -8,7 +8,7 @@ CAnimBlendClumpData::CAnimBlendClumpData(void) { numFrames = 0; - velocity2d = nil; + velocity = nil; frames = nil; link.Init(); } diff --git a/src/animation/AnimBlendClumpData.h b/src/animation/AnimBlendClumpData.h index bb711b28..633fc7b9 100644 --- a/src/animation/AnimBlendClumpData.h +++ b/src/animation/AnimBlendClumpData.h @@ -3,6 +3,7 @@ #include "AnimBlendList.h" +// TODO: put somewhere else struct AnimBlendFrameData { enum { @@ -30,10 +31,7 @@ class CAnimBlendClumpData public: CAnimBlendLink link; int32 numFrames; - union { - CVector2D *velocity2d; - CVector *velocity3d; - }; + CVector *velocity; // order of frames is determined by RW hierarchy AnimBlendFrameData *frames; diff --git a/src/animation/FrameUpdate.cpp b/src/animation/FrameUpdate.cpp index e35bd4c8..a085fd4b 100644 --- a/src/animation/FrameUpdate.cpp +++ b/src/animation/FrameUpdate.cpp @@ -33,7 +33,7 @@ FrameUpdateCallBackNonSkinned(AnimBlendFrameData *frame, void *arg) AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg; if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION && - gpAnimBlendClump->velocity2d){ + gpAnimBlendClump->velocity){ if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION_3D) FrameUpdateCallBackWith3dVelocityExtractionNonSkinned(frame, arg); else @@ -142,11 +142,11 @@ FrameUpdateCallBackWithVelocityExtractionNonSkinned(AnimBlendFrameData *frame, v } if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){ - gpAnimBlendClump->velocity2d->x = transx - curx; - gpAnimBlendClump->velocity2d->y = transy - cury; + gpAnimBlendClump->velocity->x = transx - curx; + gpAnimBlendClump->velocity->y = transy - cury; if(looped){ - gpAnimBlendClump->velocity2d->x += endx; - gpAnimBlendClump->velocity2d->y += endy; + gpAnimBlendClump->velocity->x += endx; + gpAnimBlendClump->velocity->y += endy; } mat->pos.x = pos.x - transx; mat->pos.y = pos.y - transy; @@ -222,9 +222,9 @@ FrameUpdateCallBackWith3dVelocityExtractionNonSkinned(AnimBlendFrameData *frame, } if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){ - *gpAnimBlendClump->velocity3d = trans - cur; + *gpAnimBlendClump->velocity = trans - cur; if(looped) - *gpAnimBlendClump->velocity3d += end; + *gpAnimBlendClump->velocity += end; mat->pos.x = (pos - trans).x + frame->resetPos.x; mat->pos.y = (pos - trans).y + frame->resetPos.y; mat->pos.z = (pos - trans).z + frame->resetPos.z; @@ -244,7 +244,7 @@ FrameUpdateCallBackSkinned(AnimBlendFrameData *frame, void *arg) AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg; if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION && - gpAnimBlendClump->velocity2d){ + gpAnimBlendClump->velocity){ if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION_3D) FrameUpdateCallBackWith3dVelocityExtractionSkinned(frame, arg); else @@ -354,11 +354,11 @@ FrameUpdateCallBackWithVelocityExtractionSkinned(AnimBlendFrameData *frame, void } if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){ - gpAnimBlendClump->velocity2d->x = transx - curx; - gpAnimBlendClump->velocity2d->y = transy - cury; + gpAnimBlendClump->velocity->x = transx - curx; + gpAnimBlendClump->velocity->y = transy - cury; if(looped){ - gpAnimBlendClump->velocity2d->x += endx; - gpAnimBlendClump->velocity2d->y += endy; + gpAnimBlendClump->velocity->x += endx; + gpAnimBlendClump->velocity->y += endy; } xform->t.x = pos.x - transx; xform->t.y = pos.y - transy; @@ -434,9 +434,9 @@ FrameUpdateCallBackWith3dVelocityExtractionSkinned(AnimBlendFrameData *frame, vo } if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){ - *gpAnimBlendClump->velocity3d = trans - cur; + *gpAnimBlendClump->velocity = trans - cur; if(looped) - *gpAnimBlendClump->velocity3d += end; + *gpAnimBlendClump->velocity += end; xform->t.x = (pos - trans).x + frame->resetPos.x; xform->t.y = (pos - trans).y + frame->resetPos.y; xform->t.z = (pos - trans).z + frame->resetPos.z; @@ -446,7 +446,7 @@ FrameUpdateCallBackWith3dVelocityExtractionSkinned(AnimBlendFrameData *frame, vo void FrameUpdateCallBackOffscreen(AnimBlendFrameData *frame, void *arg) { - if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION && gpAnimBlendClump->velocity2d) + if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION && gpAnimBlendClump->velocity) FrameUpdateCallBackWithVelocityExtractionSkinned(frame, arg); } @@ -466,7 +466,7 @@ FrameUpdateCallBackNonSkinnedCompressed(AnimBlendFrameData *frame, void *arg) AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg; if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION && - gpAnimBlendClump->velocity2d){ + gpAnimBlendClump->velocity){ if(updateData->foobar) for(node = updateData->nodes; *node; node++) if((*node)->sequence && (*node)->association->IsPartial()) @@ -511,9 +511,9 @@ FrameUpdateCallBackNonSkinnedCompressed(AnimBlendFrameData *frame, void *arg) } if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){ - *gpAnimBlendClump->velocity3d = trans - cur; + *gpAnimBlendClump->velocity = trans - cur; if(looped) - *gpAnimBlendClump->velocity3d += end; + *gpAnimBlendClump->velocity += end; mat->pos.x = (pos - trans).x + frame->resetPos.x; mat->pos.y = (pos - trans).y + frame->resetPos.y; mat->pos.z = (pos - trans).z + frame->resetPos.z; @@ -573,7 +573,7 @@ FrameUpdateCallBackSkinnedCompressed(AnimBlendFrameData *frame, void *arg) AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg; if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION && - gpAnimBlendClump->velocity2d){ + gpAnimBlendClump->velocity){ if(updateData->foobar) for(node = updateData->nodes; *node; node++) if((*node)->sequence && (*node)->association->IsPartial()) @@ -620,9 +620,9 @@ FrameUpdateCallBackSkinnedCompressed(AnimBlendFrameData *frame, void *arg) } if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){ - *gpAnimBlendClump->velocity3d = trans - cur; + *gpAnimBlendClump->velocity = trans - cur; if(looped) - *gpAnimBlendClump->velocity3d += end; + *gpAnimBlendClump->velocity += end; xform->t.x = (pos - trans).x + frame->resetPos.x; xform->t.y = (pos - trans).y + frame->resetPos.y; xform->t.z = (pos - trans).z + frame->resetPos.z; diff --git a/src/animation/RpAnimBlend.cpp b/src/animation/RpAnimBlend.cpp index 9223d198..c4103dbf 100644 --- a/src/animation/RpAnimBlend.cpp +++ b/src/animation/RpAnimBlend.cpp @@ -437,7 +437,7 @@ RpAnimBlendNodeUpdateKeyframes(AnimBlendFrameData *frames, AnimBlendFrameUpdateD CAnimBlendAssociation *a = (*node)->association; for(i = 0; i < numNodes; i++) if((frames[i].flag & AnimBlendFrameData::VELOCITY_EXTRACTION) == 0 || - gpAnimBlendClump->velocity2d == nil){ + gpAnimBlendClump->velocity == nil){ if((*node)[i].sequence) (*node)[i].FindKeyFrame(a->currentTime - a->timeStep); } diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp index aef48217..7adb4999 100644 --- a/src/control/Replay.cpp +++ b/src/control/Replay.cpp @@ -1729,7 +1729,7 @@ void CReplay::SaveReplayToHD(void) CFileMgr::SetDir(""); } -void CReplay::PlayReplayFromHD(void) +void PlayReplayFromHD(void) { CFileMgr::SetDirMyDocuments(); int fr = CFileMgr::OpenFile("replay.rep", "rb"); @@ -1748,17 +1748,17 @@ void CReplay::PlayReplayFromHD(void) return; } int slot; - for (slot = 0; CFileMgr::Read(fr, (char*)Buffers[slot], sizeof(Buffers[slot])); slot++) - BufferStatus[slot] = REPLAYBUFFER_PLAYBACK; - BufferStatus[slot - 1] = REPLAYBUFFER_RECORD; - while (slot < NUM_REPLAYBUFFERS) - BufferStatus[slot++] = REPLAYBUFFER_UNUSED; + for (slot = 0; CFileMgr::Read(fr, (char*)CReplay::Buffers[slot], sizeof(CReplay::Buffers[slot])); slot++) + CReplay::BufferStatus[slot] = CReplay::REPLAYBUFFER_PLAYBACK; + CReplay::BufferStatus[slot - 1] = CReplay::REPLAYBUFFER_RECORD; + while (slot < CReplay::NUM_REPLAYBUFFERS) + CReplay::BufferStatus[slot++] = CReplay::REPLAYBUFFER_UNUSED; CFileMgr::CloseFile(fr); CFileMgr::SetDir(""); - TriggerPlayback(REPLAYCAMMODE_ASSTORED, 0.0f, 0.0f, 0.0f, false); - bPlayingBackFromFile = true; - bAllowLookAroundCam = true; - StreamAllNecessaryCarsAndPeds(); + CReplay::TriggerPlayback(CReplay::REPLAYCAMMODE_ASSTORED, 0.0f, 0.0f, 0.0f, false); + CReplay::bPlayingBackFromFile = true; + CReplay::bAllowLookAroundCam = true; + CReplay::StreamAllNecessaryCarsAndPeds(); } void CReplay::StreamAllNecessaryCarsAndPeds(void) diff --git a/src/control/Replay.h b/src/control/Replay.h index 5dd8b651..84a6bef0 100644 --- a/src/control/Replay.h +++ b/src/control/Replay.h @@ -64,6 +64,8 @@ struct CStoredDetailedAnimationState uint8 aGroupId2[NUM_PARTIAL_ANIMS_IN_REPLAY]; }; +void PlayReplayFromHD(void); + #ifdef GTA_REPLAY #define REPLAY_STUB #else @@ -408,10 +410,12 @@ private: static void EmptyAllPools(void); static void MarkEverythingAsNew(void); static void SaveReplayToHD(void); - static void PlayReplayFromHD(void); // out of class in III PC and later because of SecuROM static void FindFirstFocusCoordinate(CVector *coord); static void ProcessLookAroundCam(void); static size_t FindSizeOfPacket(uint8); static void GoToNextBlock(void); + + /* Absolute nonsense, but how could this function end up being outside of class? */ + friend void PlayReplayFromHD(void); #endif }; diff --git a/src/control/Script4.cpp b/src/control/Script4.cpp index 12eb179c..d7e1d083 100644 --- a/src/control/Script4.cpp +++ b/src/control/Script4.cpp @@ -785,20 +785,20 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) }else{ pPed->m_pMyVehicle->RemovePassenger(pPed); } - if (pPed->m_vehDoor) { + if (pPed->m_vehEnterType) { if (pPed->GetPedState() == PED_EXIT_CAR || pPed->GetPedState() == PED_DRAG_FROM_CAR) { uint8 flags = 0; if (pPed->m_pMyVehicle->IsBike()) { - if (pPed->m_vehDoor == CAR_DOOR_LF || - pPed->m_vehDoor == CAR_DOOR_RF || - pPed->m_vehDoor == CAR_WINDSCREEN) + if (pPed->m_vehEnterType == CAR_DOOR_LF || + pPed->m_vehEnterType == CAR_DOOR_RF || + pPed->m_vehEnterType == CAR_WINDSCREEN) flags = CAR_DOOR_FLAG_LF | CAR_DOOR_FLAG_RF; - else if (pPed->m_vehDoor == CAR_DOOR_LR || - pPed->m_vehDoor == CAR_DOOR_RR) + else if (pPed->m_vehEnterType == CAR_DOOR_LR || + pPed->m_vehEnterType == CAR_DOOR_RR) flags = CAR_DOOR_FLAG_LR | CAR_DOOR_FLAG_RR; } else { - switch (pPed->m_vehDoor) { + switch (pPed->m_vehEnterType) { case CAR_DOOR_LF: flags = pPed->m_pMyVehicle->m_nNumMaxPassengers != 0 ? CAR_DOOR_FLAG_LF : CAR_DOOR_FLAG_LF | CAR_DOOR_FLAG_LR; break; @@ -814,7 +814,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) } } pPed->m_pMyVehicle->m_nGettingOutFlags &= ~flags; - pPed->m_pMyVehicle->ProcessOpenDoor(pPed->m_vehDoor, NUM_STD_ANIMS, 0.0f); + pPed->m_pMyVehicle->ProcessOpenDoor(pPed->m_vehEnterType, NUM_STD_ANIMS, 0.0f); } } } diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp index 992c7d74..d245bb5a 100644 --- a/src/core/Camera.cpp +++ b/src/core/Camera.cpp @@ -2353,7 +2353,7 @@ CCamera::StartTransition(int16 newMode) while(deltaBeta < -PI) deltaBeta += 2*PI; deltaBeta = Abs(deltaBeta); - door = FindPlayerPed()->m_vehDoor; + door = FindPlayerPed()->m_vehEnterType; if(deltaBeta > HALFPI){ if(((CPed*)pTargetEntity)->m_carInObjective){ if(((CPed*)pTargetEntity)->m_carInObjective->IsUpsideDown()){ diff --git a/src/core/Game.cpp b/src/core/Game.cpp index 43e5856c..c5154bd4 100644 --- a/src/core/Game.cpp +++ b/src/core/Game.cpp @@ -462,7 +462,7 @@ bool CGame::Initialise(const char* datFile) TestModelIndices(); LoadingScreen("Loading the Game", "Setup water", nil); - CWaterLevel::Initialise("DATA\\WATER.DAT"); + WaterLevelInitialise("DATA\\WATER.DAT"); TheConsole.Init(); CDraw::SetFOV(120.0f); CDraw::ms_fLODDistance = 500.0f; diff --git a/src/core/PlayerInfo.cpp b/src/core/PlayerInfo.cpp index f0f3e2c6..7289175d 100644 --- a/src/core/PlayerInfo.cpp +++ b/src/core/PlayerInfo.cpp @@ -390,8 +390,8 @@ CPlayerInfo::Process(void) m_pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_PASSENGER, carBelow); } else if (carBelow->IsBoat()) { if (!carBelow->pDriver) { - m_pPed->m_vehDoor = 0; - m_pPed->SetEnterCar(carBelow, m_pPed->m_vehDoor); + m_pPed->m_vehEnterType = 0; + m_pPed->SetEnterCar(carBelow, m_pPed->m_vehEnterType); } } else { m_pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, carBelow); diff --git a/src/core/config.h b/src/core/config.h index 58bc9ffd..225863f3 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -240,16 +240,12 @@ enum Config { # define TIMEBARS // print debug timers #endif -#define FIX_BUGS // fixes bugs that we've came across during reversing. You can undefine this only on release builds. +#define FIX_BUGS // fixes bugs that we've came across during reversing, TODO: use this more //#define MORE_LANGUAGES // Add more translations to the game #define COMPATIBLE_SAVES // this allows changing structs while keeping saves compatible #define LOAD_INI_SETTINGS // as the name suggests. fundamental for CUSTOM_FRONTEND_OPTIONS #define FIX_HIGH_FPS_BUGS_ON_FRONTEND -#if defined(__LP64__) || defined(_WIN64) -#define FIX_BUGS_64 // Must have fixes to be able to run 64 bit build -#endif - // Just debug menu entries #ifdef DEBUGMENU #define RELOADABLES // some debug menu options to reload TXD files diff --git a/src/core/main.cpp b/src/core/main.cpp index 7f73c311..e6d83608 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -1426,13 +1426,11 @@ Idle(void *arg) CSprite2d::InitPerFrame(); CFont::InitPerFrame(); - PUSH_MEMID(MEMID_GAME_PROCESS); CPointLights::InitPerFrame(); tbStartTimer(0, "CGame::Process"); CGame::Process(); tbEndTimer("CGame::Process"); - POP_MEMID(); tbStartTimer(0, "DMAudio.Service"); DMAudio.Service(); @@ -1454,8 +1452,6 @@ Idle(void *arg) if(arg == nil) return; - PUSH_MEMID(MEMID_RENDER); - if(!FrontEndMenuManager.m_bMenuActive && TheCamera.GetScreenFadeStatus() != FADE_2) { // This is from SA, but it's nice for windowed mode diff --git a/src/entities/Physical.cpp b/src/entities/Physical.cpp index 07d1d0b4..706b469c 100644 --- a/src/entities/Physical.cpp +++ b/src/entities/Physical.cpp @@ -883,13 +883,9 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl if(B->GetStatus() == STATUS_PLAYER) pointposB *= 0.8f; if(CWorld::bNoMoreCollisionTorque){ -#ifdef FIX_BUGS + // BUG: the game actually uses A here, but this can't be right B->ApplyFrictionMoveForce(fB*-0.3f); B->ApplyFrictionTurnForce(fB*-0.3f, pointposB); -#else - A->ApplyFrictionMoveForce(fB*-0.3f); - A->ApplyFrictionTurnForce(fB*-0.3f, pointposB); -#endif } } if(!A->bInfiniteMass){ @@ -1058,13 +1054,7 @@ CPhysical::ApplyFriction(CPhysical *B, float adhesiveLimit, CColPoint &colpoint) fOtherSpeedA = vOtherSpeedA.Magnitude(); fOtherSpeedB = vOtherSpeedB.Magnitude(); -#ifdef FIX_BUGS // division by 0 - frictionDir = vOtherSpeedA; - frictionDir.Normalise(); -#else frictionDir = vOtherSpeedA * (1.0f/fOtherSpeedA); -#endif - speedSum = (B->m_fMass*fOtherSpeedB + A->m_fMass*fOtherSpeedA)/(B->m_fMass + A->m_fMass); if(fOtherSpeedA > speedSum){ impulseA = (speedSum - fOtherSpeedA) * A->m_fMass; @@ -1094,12 +1084,7 @@ CPhysical::ApplyFriction(CPhysical *B, float adhesiveLimit, CColPoint &colpoint) fOtherSpeedA = vOtherSpeedA.Magnitude(); fOtherSpeedB = vOtherSpeedB.Magnitude(); -#ifdef FIX_BUGS // division by 0 - frictionDir = vOtherSpeedA; - frictionDir.Normalise(); -#else frictionDir = vOtherSpeedA * (1.0f/fOtherSpeedA); -#endif float massB = B->GetMass(pointposB, frictionDir); speedSum = (massB*fOtherSpeedB + A->m_fMass*fOtherSpeedA)/(massB + A->m_fMass); if(fOtherSpeedA > speedSum){ @@ -1127,12 +1112,7 @@ CPhysical::ApplyFriction(CPhysical *B, float adhesiveLimit, CColPoint &colpoint) fOtherSpeedA = vOtherSpeedA.Magnitude(); fOtherSpeedB = vOtherSpeedB.Magnitude(); -#ifdef FIX_BUGS // division by 0 - frictionDir = vOtherSpeedA; - frictionDir.Normalise(); -#else frictionDir = vOtherSpeedA * (1.0f/fOtherSpeedA); -#endif float massA = A->GetMass(pointposA, frictionDir); speedSum = (B->m_fMass*fOtherSpeedB + massA*fOtherSpeedA)/(B->m_fMass + massA); if(fOtherSpeedA > speedSum){ @@ -1160,12 +1140,7 @@ CPhysical::ApplyFriction(CPhysical *B, float adhesiveLimit, CColPoint &colpoint) fOtherSpeedA = vOtherSpeedA.Magnitude(); fOtherSpeedB = vOtherSpeedB.Magnitude(); -#ifdef FIX_BUGS // division by 0 - frictionDir = vOtherSpeedA; - frictionDir.Normalise(); -#else frictionDir = vOtherSpeedA * (1.0f/fOtherSpeedA); -#endif float massA = A->GetMass(pointposA, frictionDir); float massB = B->GetMass(pointposB, frictionDir); speedSum = (massB*fOtherSpeedB + massA*fOtherSpeedA)/(massB + massA); @@ -1203,12 +1178,7 @@ CPhysical::ApplyFriction(float adhesiveLimit, CColPoint &colpoint) fOtherSpeed = vOtherSpeed.Magnitude(); if(fOtherSpeed > 0.0f){ -#ifdef FIX_BUGS // division by 0 - frictionDir = vOtherSpeed; - frictionDir.Normalise(); -#else frictionDir = vOtherSpeed * (1.0f/fOtherSpeed); -#endif // not really impulse but speed // maybe use ApplyFrictionMoveForce instead? fImpulse = -fOtherSpeed; @@ -1226,12 +1196,7 @@ CPhysical::ApplyFriction(float adhesiveLimit, CColPoint &colpoint) fOtherSpeed = vOtherSpeed.Magnitude(); if(fOtherSpeed > 0.0f){ -#ifdef FIX_BUGS // division by 0 - frictionDir = vOtherSpeed; - frictionDir.Normalise(); -#else frictionDir = vOtherSpeed * (1.0f/fOtherSpeed); -#endif fImpulse = -fOtherSpeed * m_fMass; impulseLimit = adhesiveLimit*CTimer::GetTimeStep() * 1.5; if(fImpulse < -impulseLimit) fImpulse = -impulseLimit; diff --git a/src/objects/CutsceneObject.cpp b/src/objects/CutsceneObject.cpp index 803fcf0f..01fb038f 100644 --- a/src/objects/CutsceneObject.cpp +++ b/src/objects/CutsceneObject.cpp @@ -46,7 +46,7 @@ CCutsceneObject::SetModelIndex(uint32 id) CEntity::SetModelIndex(id); assert(RwObjectGetType(m_rwObject) == rpCLUMP); RpAnimBlendClumpInit((RpClump*)m_rwObject); - (*RPANIMBLENDCLUMPDATA(m_rwObject))->velocity3d = &m_vecMoveSpeed; + (*RPANIMBLENDCLUMPDATA(m_rwObject))->velocity = &m_vecMoveSpeed; (*RPANIMBLENDCLUMPDATA(m_rwObject))->frames[0].flag |= AnimBlendFrameData::VELOCITY_EXTRACTION_3D; } diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index f5123b39..f597edea 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -113,15 +113,15 @@ CPed::CPed(uint32 pedType) : m_pedIK(this) m_attackTimer = 0; m_timerUnused = 0; m_lookTimer = 0; - m_chatTimer = 0; + m_standardTimer = 0; m_shootTimer = 0; - m_carJackTimer = 0; + m_hitRecoverTimer = 0; m_duckAndCoverTimer = 0; m_moved = CVector2D(0.0f, 0.0f); m_fRotationCur = 0.0f; m_headingRate = 15.0f; m_fRotationDest = 0.0f; - m_vehDoor = CAR_DOOR_LF; + m_vehEnterType = CAR_DOOR_LF; m_walkAroundType = 0; m_pCurrentPhysSurface = nil; m_vecOffsetFromPhysSurface = CVector(0.0f, 0.0f, 0.0f); @@ -381,7 +381,7 @@ CPed::~CPed(void) GetPedAttractorManager()->DeRegisterPed(this, m_attractor); CRadar::ClearBlipForEntity(BLIP_CHAR, CPools::GetPedPool()->GetIndex(this)); if (InVehicle()){ - uint8 door_flag = GetCarDoorFlag(m_vehDoor); + uint8 door_flag = GetCarDoorFlag(m_vehEnterType); if (m_pMyVehicle->pDriver == this) m_pMyVehicle->pDriver = nil; else { @@ -434,7 +434,8 @@ CPed::SetModelIndex(uint32 mi) if (!CanUseTorsoWhenLooking()) m_pedIK.m_flags |= CPedIK::LOOKAROUND_HEAD_ONLY; - (*RPANIMBLENDCLUMPDATA(m_rwObject))->velocity2d = &m_vecAnimMoveDelta; + // This is a mistake by R*, velocity is CVector, whereas m_vecAnimMoveDelta is CVector2D. + (*RPANIMBLENDCLUMPDATA(m_rwObject))->velocity = (CVector*) &m_vecAnimMoveDelta; if(modelInfo->GetHitColModel() == nil) modelInfo->CreateHitColModelSkinned(GetClump()); @@ -1298,8 +1299,7 @@ CPed::ScanForInterestingStuff(void) if (LookForInterestingNodes()) return; - if (m_nPedType == PEDTYPE_CRIMINAL && m_carJackTimer < CTimer::GetTimeInMilliseconds()) { - // Find a car to steal or a ped to mug if we haven't already decided to steal a car + if (m_nPedType == PEDTYPE_CRIMINAL && m_hitRecoverTimer < CTimer::GetTimeInMilliseconds()) { if (CGeneral::GetRandomNumber() % 100 < 10) { int mostExpensiveVehAround = -1; int bestMonetaryValue = 0; @@ -1322,10 +1322,10 @@ CPed::ScanForInterestingStuff(void) } if (bestMonetaryValue > 2000 && mostExpensiveVehAround != -1 && vehicles[mostExpensiveVehAround]) { SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, vehicles[mostExpensiveVehAround]); - m_carJackTimer = CTimer::GetTimeInMilliseconds() + 5000; + m_hitRecoverTimer = CTimer::GetTimeInMilliseconds() + 5000; return; } - m_carJackTimer = CTimer::GetTimeInMilliseconds() + 5000; + m_hitRecoverTimer = CTimer::GetTimeInMilliseconds() + 5000; } else if (m_objective != OBJECTIVE_MUG_CHAR && !(CGeneral::GetRandomNumber() & 7)) { CPed *charToMug = nil; for (int i = 0; i < m_numNearPeds; ++i) { @@ -1347,13 +1347,13 @@ CPed::ScanForInterestingStuff(void) if (charToMug) SetObjective(OBJECTIVE_MUG_CHAR, charToMug); - m_carJackTimer = CTimer::GetTimeInMilliseconds() + 5000; + m_hitRecoverTimer = CTimer::GetTimeInMilliseconds() + 5000; } } if (m_nPedState == PED_WANDER_PATH) { if (CGeneral::GetRandomNumberInRange(0.0f, 1.0f) < 0.5f) { - if (CTimer::GetTimeInMilliseconds() > m_chatTimer) { + if (CTimer::GetTimeInMilliseconds() > m_standardTimer) { for (int i = 0; i < m_numNearPeds; i ++) { if (m_nearPeds[i] && m_nearPeds[i]->m_nPedState == PED_WANDER_PATH) { if ((GetPosition() - m_nearPeds[i]->GetPosition()).Magnitude() < 1.8f @@ -1369,7 +1369,7 @@ CPed::ScanForInterestingStuff(void) } } } else { - m_chatTimer = CTimer::GetTimeInMilliseconds() + 200; + m_standardTimer = CTimer::GetTimeInMilliseconds() + 200; } } } @@ -3656,7 +3656,7 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj) if (Abs(angleDiffBtwObjCenterAndForward) >= objTopRightHeading) { if (PI - objTopRightHeading >= Abs(angleDiffBtwObjCenterAndForward)) { if ((angleDiffBtwObjCenterAndForward <= 0.0f || objUpsideDown) && (angleDiffBtwObjCenterAndForward < 0.0f || !objUpsideDown)) { - if (goingToEnterCar && (m_vehDoor == CAR_DOOR_RF || m_vehDoor == CAR_DOOR_RR)) { + if (goingToEnterCar && (m_vehEnterType == CAR_DOOR_RF || m_vehEnterType == CAR_DOOR_RR)) { m_walkAroundType = 0; } else { if (CGeneral::LimitRadianAngle(m_fRotationDest - angleToFaceObjCenter) >= 0.0f) { @@ -3674,7 +3674,7 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj) } } } else { - if (goingToEnterCar && (m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_LR)) { + if (goingToEnterCar && (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR)) { m_walkAroundType = 0; } else { if (CGeneral::LimitRadianAngle(m_fRotationDest - angleToFaceObjCenter) <= 0.0f) { @@ -3692,7 +3692,7 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj) } } } - } else if (goingToEnterCar && (m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_LR) + } else if (goingToEnterCar && (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR) || CGeneral::LimitRadianAngle(m_fRotationDest - angleToFaceObjCenter) < 0.0f) { if (entityOnTopLeftOfObj == 1 || entityOnTopLeftOfObj && !entityOnTopRightOfObj && !entityOnBottomRightOfObj) { m_walkAroundType = 3; @@ -3700,7 +3700,7 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj) } else if (entityOnTopRightOfObj == 1 || entityOnTopRightOfObj && !entityOnTopLeftOfObj && !entityOnBottomLeftOfObj) { m_walkAroundType = 4; } - } else if (goingToEnterCar && (m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_LR) + } else if (goingToEnterCar && (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR) || CGeneral::LimitRadianAngle(m_fRotationDest - angleToFaceObjCenter) > 0.0f) { if (entityOnBottomLeftOfObj == 1 || entityOnBottomLeftOfObj && !entityOnTopRightOfObj && !entityOnBottomRightOfObj) { m_walkAroundType = 2; @@ -3723,10 +3723,10 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj) if (Abs(angleDiffBtwObjCenterAndForward) < objTopRightHeading) { if (goingToEnterCar) { if (goingToEnterCarAndItsVan) { - if (m_vehDoor == CAR_DOOR_LR || m_vehDoor == CAR_DOOR_RR) + if (m_vehEnterType == CAR_DOOR_LR || m_vehEnterType == CAR_DOOR_RR) return; } - if (m_vehDoor != CAR_DOOR_LF && m_vehDoor != CAR_DOOR_LR && (!entityOnBottomRightOfObj || entityOnBottomLeftOfObj)) { + if (m_vehEnterType != CAR_DOOR_LF && m_vehEnterType != CAR_DOOR_LR && (!entityOnBottomRightOfObj || entityOnBottomLeftOfObj)) { m_fRotationDest = CGeneral::LimitRadianAngle(dirToSet - HALFPI); localPosToHead.x = adjustedColMax.x; localPosToHead.z = 0.0f; @@ -3755,9 +3755,9 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj) } else { if (PI - objTopRightHeading >= Abs(angleDiffBtwObjCenterAndForward)) { if (angleDiffBtwObjCenterAndForward <= 0.0f) { - if (!goingToEnterCar || !goingToEnterCarAndItsVan || m_vehDoor != CAR_DOOR_LR && m_vehDoor != CAR_DOOR_RR) { + if (!goingToEnterCar || !goingToEnterCarAndItsVan || m_vehEnterType != CAR_DOOR_LR && m_vehEnterType != CAR_DOOR_RR) { if (goingToEnterCar) { - if (m_vehDoor == CAR_DOOR_RF || (m_vehDoor == CAR_DOOR_RR && !goingToEnterCarAndItsVan)) + if (m_vehEnterType == CAR_DOOR_RF || (m_vehEnterType == CAR_DOOR_RR && !goingToEnterCarAndItsVan)) return; } if (m_walkAroundType == 4 || m_walkAroundType == 3 @@ -3779,14 +3779,14 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj) localPosToHead.z = 0.0f; localPosToHead.y = adjustedColMin.y; } - } else if (goingToEnterCar && goingToEnterCarAndItsVan && (m_vehDoor == CAR_DOOR_LR || m_vehDoor == CAR_DOOR_RR)) { + } else if (goingToEnterCar && goingToEnterCarAndItsVan && (m_vehEnterType == CAR_DOOR_LR || m_vehEnterType == CAR_DOOR_RR)) { m_fRotationDest = CGeneral::LimitRadianAngle(PI + dirToSet); localPosToHead.x = adjustedColMin.x; localPosToHead.z = 0.0f; localPosToHead.y = adjustedColMin.y; } else { if (goingToEnterCar) { - if (m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_LR && !goingToEnterCarAndItsVan) + if (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR && !goingToEnterCarAndItsVan) return; } if (m_walkAroundType == 1 || m_walkAroundType == 2 @@ -3804,8 +3804,8 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj) } } } else { - if (goingToEnterCar && (!goingToEnterCarAndItsVan || m_vehDoor != CAR_DOOR_LR && m_vehDoor != CAR_DOOR_RR)) { - if (m_vehDoor != CAR_DOOR_LF && m_vehDoor != CAR_DOOR_LR && (!entityOnTopRightOfObj || entityOnTopLeftOfObj)) { + if (goingToEnterCar && (!goingToEnterCarAndItsVan || m_vehEnterType != CAR_DOOR_LR && m_vehEnterType != CAR_DOOR_RR)) { + if (m_vehEnterType != CAR_DOOR_LF && m_vehEnterType != CAR_DOOR_LR && (!entityOnTopRightOfObj || entityOnTopLeftOfObj)) { m_fRotationDest = CGeneral::LimitRadianAngle(dirToSet - HALFPI); localPosToHead.x = adjustedColMax.x; @@ -4099,9 +4099,9 @@ CPed::PedSetOutCarCB(CAnimBlendAssociation *animAssoc, void *arg) } if (veh && veh->IsBike()) // BUG? - veh->m_nGettingOutFlags &= ~GetBikeDoorFlag(ped->m_vehDoor); + veh->m_nGettingOutFlags &= ~GetBikeDoorFlag(ped->m_vehEnterType); else - veh->m_nGettingOutFlags &= ~GetCarDoorFlag(ped->m_vehDoor); + veh->m_nGettingOutFlags &= ~GetCarDoorFlag(ped->m_vehEnterType); if (veh->pDriver == ped) { veh->RemoveDriver(); @@ -4123,7 +4123,7 @@ CPed::PedSetOutCarCB(CAnimBlendAssociation *animAssoc, void *arg) if (veh->bIsBus && !veh->IsUpsideDown() && !veh->IsOnItsSide()) { float angleAfterExit; - if (ped->m_vehDoor == CAR_DOOR_LF) { + if (ped->m_vehEnterType == CAR_DOOR_LF) { angleAfterExit = HALFPI + veh->GetForward().Heading(); } else { angleAfterExit = veh->GetForward().Heading() - HALFPI; @@ -4174,7 +4174,7 @@ CPed::PedSetDraggedOutCarCB(CAnimBlendAssociation *dragAssoc, void *arg) uint8 exitFlags = 0; quickJackedAssoc = RpAnimBlendClumpGetAssociation(ped->GetClump(), ANIM_CAR_QJACKED); if (dragAssoc && dragAssoc->animId == ANIM_BIKE_HIT && ped->m_pMyVehicle) { - if (ped->m_vehDoor == CAR_DOOR_LF || ped->m_vehDoor == CAR_DOOR_RF) { + if (ped->m_vehEnterType == CAR_DOOR_LF || ped->m_vehEnterType == CAR_DOOR_RF) { CAnimManager::BlendAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_BIKE_FALL_OFF, 100.0f); ped->m_pMyVehicle->m_nGettingOutFlags &= ~(CAR_DOOR_FLAG_RF | CAR_DOOR_FLAG_LF); } else { @@ -4196,9 +4196,9 @@ CPed::PedSetDraggedOutCarCB(CAnimBlendAssociation *dragAssoc, void *arg) vehicle = ped->m_pMyVehicle; if (vehicle && vehicle->IsBike()) - exitFlags = GetBikeDoorFlagInclJumpInFromFront(ped->m_vehDoor); + exitFlags = GetBikeDoorFlagInclJumpInFromFront(ped->m_vehEnterType); else - exitFlags = GetCarDoorFlag(ped->m_vehDoor); + exitFlags = GetCarDoorFlag(ped->m_vehEnterType); if (vehicle) vehicle->m_nGettingOutFlags &= ~exitFlags; @@ -4419,7 +4419,7 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg) } else if (veh->bIsBus) { veh->AddPassenger(ped); } else { - switch (ped->m_vehDoor) { + switch (ped->m_vehEnterType) { case CAR_DOOR_RF: veh->AddPassenger(ped, 0); break; @@ -4449,9 +4449,9 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg) int8 doorFlag; if (veh->IsBike()) { - doorFlag = GetBikeDoorFlagInclJumpInFromFront(ped->m_vehDoor); + doorFlag = GetBikeDoorFlagInclJumpInFromFront(ped->m_vehEnterType); } else { - doorFlag = GetEnterCarDoorFlag(ped->m_vehDoor, veh->m_nNumMaxPassengers); + doorFlag = GetEnterCarDoorFlag(ped->m_vehEnterType, veh->m_nNumMaxPassengers); } veh->m_nGettingInFlags &= ~doorFlag; @@ -5133,13 +5133,13 @@ void CPed::Idle(void) { CVehicle *veh = m_pMyVehicle; - if (veh && veh->m_nGettingOutFlags && m_vehDoor) { + if (veh && veh->m_nGettingOutFlags && m_vehEnterType) { - if (veh->m_nGettingOutFlags & GetCarDoorFlag(m_vehDoor)) { + if (veh->m_nGettingOutFlags & GetCarDoorFlag(m_vehEnterType)) { if (m_objective != OBJECTIVE_KILL_CHAR_ON_FOOT) { - CVector doorPos = GetPositionToOpenCarDoor(veh, m_vehDoor); + CVector doorPos = GetPositionToOpenCarDoor(veh, m_vehEnterType); CVector doorDist = GetPosition() - doorPos; if (doorDist.MagnitudeSqr() < sq(0.5f)) { @@ -5886,7 +5886,7 @@ CPed::ClearFlee(void) { RestorePreviousState(); bUsePedNodeSeek = false; - m_chatTimer = 0; + m_standardTimer = 0; m_fleeTimer = 0; } @@ -5932,7 +5932,7 @@ CPed::Flee(void) if (m_nPedStateTimer < CTimer::GetTimeInMilliseconds() && m_collidingThingTimer < CTimer::GetTimeInMilliseconds()) { - if (m_pNextPathNode && CTimer::GetTimeInMilliseconds() > m_chatTimer) { + if (m_pNextPathNode && CTimer::GetTimeInMilliseconds() > m_standardTimer) { curDirectionShouldBe = CGeneral::GetNodeHeadingFromVector(GetPosition().x - ms_vec2DFleePosition.x, GetPosition().y - ms_vec2DFleePosition.y); if (m_nPathDir < curDirectionShouldBe) @@ -5975,7 +5975,7 @@ CPed::Flee(void) if (m_pNextPathNode && m_pNextPathNode != realLastNode && m_pNextPathNode != m_pLastPathNode && curDirectionShouldBe - nextDirection != 4) { m_nPathDir = nextDirection; - m_chatTimer = CTimer::GetTimeInMilliseconds() + 2000; + m_standardTimer = CTimer::GetTimeInMilliseconds() + 2000; } else { bUsePedNodeSeek = false; SetMoveState(PEDMOVE_RUN); @@ -7215,7 +7215,7 @@ CPed::SetChat(CEntity *chatWith, uint32 time) SetMoveState(PEDMOVE_STILL); m_lookTimer = 0; SetLookFlag(chatWith, true); - m_chatTimer = CTimer::GetTimeInMilliseconds() + time; + m_standardTimer = CTimer::GetTimeInMilliseconds() + time; m_lookTimer = CTimer::GetTimeInMilliseconds() + 3000; } @@ -7236,7 +7236,7 @@ CPed::Chat(void) if (partner->m_nPedState != PED_CHAT) { ClearChat(); - m_chatTimer = CTimer::GetTimeInMilliseconds() + 30000; + m_standardTimer = CTimer::GetTimeInMilliseconds() + 30000; if (partner->m_pedInObjective) { if (partner->m_objective == OBJECTIVE_KILL_CHAR_ON_FOOT || partner->m_objective == OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE) @@ -7269,9 +7269,9 @@ CPed::Chat(void) Say(SOUND_PED_CHAT); } } - if (m_chatTimer && CTimer::GetTimeInMilliseconds() > m_chatTimer) { + if (m_standardTimer && CTimer::GetTimeInMilliseconds() > m_standardTimer) { ClearChat(); - m_chatTimer = CTimer::GetTimeInMilliseconds() + 30000; + m_standardTimer = CTimer::GetTimeInMilliseconds() + 30000; } } @@ -7480,7 +7480,7 @@ CPed::SetSeekCar(CVehicle *car, uint32 doorNode) m_pMyVehicle = car; m_pMyVehicle->RegisterReference((CEntity**) &m_pMyVehicle); // m_pSeekTarget->RegisterReference((CEntity**) &m_pSeekTarget); - m_vehDoor = doorNode; + m_vehEnterType = doorNode; m_distanceToCountSeekDone = 0.5f; SetPedState(PED_SEEK_CAR); @@ -7498,9 +7498,9 @@ CPed::SeekCar(void) } if (m_objective != OBJECTIVE_ENTER_CAR_AS_PASSENGER) { - if (!vehToSeek->IsBike() && m_vehDoor && m_objective != OBJECTIVE_ENTER_CAR_AS_DRIVER) { + if (!vehToSeek->IsBike() && m_vehEnterType && m_objective != OBJECTIVE_ENTER_CAR_AS_DRIVER) { if (IsRoomToBeCarJacked()) { - dest = GetPositionToOpenCarDoor(vehToSeek, m_vehDoor); + dest = GetPositionToOpenCarDoor(vehToSeek, m_vehEnterType); } else if (m_nPedType == PEDTYPE_COP) { dest = GetPositionToOpenCarDoor(vehToSeek, CAR_DOOR_RF); } else { @@ -7509,7 +7509,7 @@ CPed::SeekCar(void) } else GetNearestDoor(vehToSeek, dest); } else { - if (m_carJackTimer > CTimer::GetTimeInMilliseconds()) { + if (m_hitRecoverTimer > CTimer::GetTimeInMilliseconds()) { SetMoveState(PEDMOVE_STILL); return; } @@ -7553,7 +7553,7 @@ CPed::SeekCar(void) if (IsPlayer()) { ClearObjective(); } else if (CharCreatedBy == RANDOM_CHAR) { - m_carJackTimer = CTimer::GetTimeInMilliseconds() + 30000; + m_hitRecoverTimer = CTimer::GetTimeInMilliseconds() + 30000; } SetMoveState(PEDMOVE_STILL); TheCamera.ClearPlayerWeaponMode(); @@ -7581,7 +7581,7 @@ CPed::SeekCar(void) else if (2.0f * vehToSeek->GetColModel()->boundingBox.max.x > distToDestSqr) bCanPedEnterSeekedCar = true; - if (vehToSeek->m_nGettingInFlags & GetCarDoorFlag(m_vehDoor)) + if (vehToSeek->m_nGettingInFlags & GetCarDoorFlag(m_vehEnterType)) bVehEnterDoorIsBlocked = true; else bVehEnterDoorIsBlocked = false; @@ -7592,7 +7592,7 @@ CPed::SeekCar(void) if (1.6f + GetPosition().z > dest.z && GetPosition().z - 0.5f < dest.z) { #ifdef GTA_TRAIN if (vehToSeek->IsTrain()) { - SetEnterTrain(vehToSeek, m_vehDoor); + SetEnterTrain(vehToSeek, m_vehEnterType); } else #endif { @@ -7613,42 +7613,42 @@ CPed::SeekCar(void) case STATUS_PLAYER_DISABLED: if (vehToSeek->IsBike()) { if ((!m_leader || m_leader != vehToSeek->pDriver) && - ((m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_RF || m_vehDoor == CAR_WINDSCREEN) && vehToSeek->pDriver || - (m_vehDoor == CAR_DOOR_LR || m_vehDoor == CAR_DOOR_RR) && vehToSeek->pPassengers[0])) { + ((m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_RF || m_vehEnterType == CAR_WINDSCREEN) && vehToSeek->pDriver || + (m_vehEnterType == CAR_DOOR_LR || m_vehEnterType == CAR_DOOR_RR) && vehToSeek->pPassengers[0])) { SetCarJack(vehToSeek); } else { - SetEnterCar(vehToSeek, m_vehDoor); + SetEnterCar(vehToSeek, m_vehEnterType); } } else if (!vehToSeek->bIsBus && (!m_leader || m_leader != vehToSeek->pDriver) && - (m_vehDoor == CAR_DOOR_LF && vehToSeek->pDriver || m_vehDoor == CAR_DOOR_RF && vehToSeek->pPassengers[0] || m_vehDoor == CAR_DOOR_LR && vehToSeek->pPassengers[1] || m_vehDoor == CAR_DOOR_RR && vehToSeek->pPassengers[2])) { + (m_vehEnterType == CAR_DOOR_LF && vehToSeek->pDriver || m_vehEnterType == CAR_DOOR_RF && vehToSeek->pPassengers[0] || m_vehEnterType == CAR_DOOR_LR && vehToSeek->pPassengers[1] || m_vehEnterType == CAR_DOOR_RR && vehToSeek->pPassengers[2])) { SetCarJack(vehToSeek); - if (m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER && m_vehDoor != CAR_DOOR_LF) + if (m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER && m_vehEnterType != CAR_DOOR_LF) vehToSeek->pDriver->bFleeAfterExitingCar = true; } else { - SetEnterCar(vehToSeek, m_vehDoor); + SetEnterCar(vehToSeek, m_vehEnterType); } break; case STATUS_ABANDONED: if (vehToSeek->IsBike()) { - if ((m_vehDoor == CAR_DOOR_LR || m_vehDoor == CAR_DOOR_RR) && vehToSeek->pPassengers[0]) { + if ((m_vehEnterType == CAR_DOOR_LR || m_vehEnterType == CAR_DOOR_RR) && vehToSeek->pPassengers[0]) { if (vehToSeek->pPassengers[0]->bDontDragMeOutCar) { if (IsPlayer()) - SetEnterCar(vehToSeek, m_vehDoor); + SetEnterCar(vehToSeek, m_vehEnterType); } else { SetCarJack(vehToSeek); } } else { - SetEnterCar(vehToSeek, m_vehDoor); + SetEnterCar(vehToSeek, m_vehEnterType); } - } else if (m_vehDoor == CAR_DOOR_RF && vehToSeek->pPassengers[0]) { + } else if (m_vehEnterType == CAR_DOOR_RF && vehToSeek->pPassengers[0]) { if (vehToSeek->pPassengers[0]->bDontDragMeOutCar) { if (IsPlayer()) - SetEnterCar(vehToSeek, m_vehDoor); + SetEnterCar(vehToSeek, m_vehEnterType); } else { SetCarJack(vehToSeek); } } else { - SetEnterCar(vehToSeek, m_vehDoor); + SetEnterCar(vehToSeek, m_vehEnterType); } break; case STATUS_WRECKED: @@ -7966,7 +7966,7 @@ CPed::LookForInterestingNodes(void) C2dEffect *effect; CMatrix *objMat; - if ((CTimer::GetFrameCounter() + (m_randomSeed % 256)) & 7 || CTimer::GetTimeInMilliseconds() <= m_chatTimer) { + if ((CTimer::GetFrameCounter() + (m_randomSeed % 256)) & 7 || CTimer::GetTimeInMilliseconds() <= m_standardTimer) { return false; } bool found = false; @@ -8076,7 +8076,7 @@ CPed::LookForInterestingNodes(void) float angleToFace = CGeneral::GetRadianAngleBetweenPoints(effectFrontLocal.x, effectFrontLocal.y, 0.0f, 0.0f); randVal = CGeneral::GetRandomNumber() % 256; if (randVal <= m_randomSeed % 256) { - m_chatTimer = CTimer::GetTimeInMilliseconds() + 2000; + m_standardTimer = CTimer::GetTimeInMilliseconds() + 2000; SetLookFlag(angleToFace, true); SetLookTimer(1000); return false; @@ -8299,7 +8299,7 @@ CPed::SetWaitState(eWaitState state, void *time) if (m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER && CharCreatedBy == RANDOM_CHAR && m_nPedState == PED_SEEK_CAR) { ClearObjective(); RestorePreviousState(); - m_carJackTimer = CTimer::GetTimeInMilliseconds() + 30000; + m_hitRecoverTimer = CTimer::GetTimeInMilliseconds() + 30000; } break; case WAITSTATE_TURN180: @@ -8328,7 +8328,7 @@ CPed::SetWaitState(eWaitState state, void *time) if (m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER && CharCreatedBy == RANDOM_CHAR && m_nPedState == PED_SEEK_CAR) { ClearObjective(); RestorePreviousState(); - m_carJackTimer = CTimer::GetTimeInMilliseconds() + 30000; + m_hitRecoverTimer = CTimer::GetTimeInMilliseconds() + 30000; } break; case WAITSTATE_LOOK_ABOUT: @@ -8980,14 +8980,14 @@ CPed::SetSolicit(uint32 time) if (CharCreatedBy != MISSION_CHAR && m_carInObjective->m_nNumGettingIn == 0 && CTimer::GetTimeInMilliseconds() < m_objectiveTimer) { - if (m_vehDoor == CAR_DOOR_LF) { + if (m_vehEnterType == CAR_DOOR_LF) { m_fRotationDest = m_carInObjective->GetForward().Heading() - HALFPI; } else { m_fRotationDest = m_carInObjective->GetForward().Heading() + HALFPI; } if (Abs(m_fRotationDest - m_fRotationCur) < HALFPI) { - m_chatTimer = CTimer::GetTimeInMilliseconds() + time; + m_standardTimer = CTimer::GetTimeInMilliseconds() + time; if(!m_carInObjective->bIsVan && !m_carInObjective->bIsBus) m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_HOOKERTALK, 4.0f); @@ -9001,8 +9001,8 @@ CPed::SetSolicit(uint32 time) void CPed::Solicit(void) { - if (m_chatTimer >= CTimer::GetTimeInMilliseconds() && m_carInObjective) { - CVector doorPos = GetPositionToOpenCarDoor(m_carInObjective, m_vehDoor, 0.0f); + if (m_standardTimer >= CTimer::GetTimeInMilliseconds() && m_carInObjective) { + CVector doorPos = GetPositionToOpenCarDoor(m_carInObjective, m_vehEnterType, 0.0f); Say(SOUND_PED_SOLICIT); if (FindPlayerVehicle() == m_carInObjective) { FindPlayerPed()->Say(SOUND_PED_SOLICIT); @@ -9062,7 +9062,7 @@ CPed::BuyIceCream(void) { if (m_carInObjective) { CPed *driver = m_carInObjective->pDriver; - if (driver && CTimer::GetTimeInMilliseconds() > m_chatTimer) { + if (driver && CTimer::GetTimeInMilliseconds() > m_standardTimer) { SetChat(driver, 8000); driver->SetChat(this, 8000); return; @@ -9138,7 +9138,7 @@ CPed::PossiblyFindBetterPosToSeekCar(CVector *pos, CVehicle *veh) bool canHeadToRf = NTVF_RF <= 0.0f || NTVF_RF >= HALFPI; // Only order of conditions are different among enterTypes. - if (m_vehDoor == CAR_DOOR_RR) { + if (m_vehEnterType == CAR_DOOR_RR) { if (canHeadToRr) { foundPos = rightRearPos; foundIt = true; @@ -9152,7 +9152,7 @@ CPed::PossiblyFindBetterPosToSeekCar(CVector *pos, CVehicle *veh) foundPos = leftFrontPos; foundIt = true; } - } else if(m_vehDoor == CAR_DOOR_RF) { + } else if(m_vehEnterType == CAR_DOOR_RF) { if (canHeadToRf) { foundPos = rightFrontPos; foundIt = true; @@ -9166,7 +9166,7 @@ CPed::PossiblyFindBetterPosToSeekCar(CVector *pos, CVehicle *veh) foundPos = leftRearPos; foundIt = true; } - } else if (m_vehDoor == CAR_DOOR_LF) { + } else if (m_vehEnterType == CAR_DOOR_LF) { if (canHeadToLf) { foundPos = leftFrontPos; foundIt = true; @@ -9180,7 +9180,7 @@ CPed::PossiblyFindBetterPosToSeekCar(CVector *pos, CVehicle *veh) foundPos = rightRearPos; foundIt = true; } - } else if (m_vehDoor == CAR_DOOR_LR) { + } else if (m_vehEnterType == CAR_DOOR_LR) { if (canHeadToLr) { foundPos = leftRearPos; foundIt = true; diff --git a/src/peds/Ped.h b/src/peds/Ped.h index 242a86f2..4056898e 100644 --- a/src/peds/Ped.h +++ b/src/peds/Ped.h @@ -596,7 +596,7 @@ public: float m_fRotationCur; float m_fRotationDest; float m_headingRate; - uint16 m_vehDoor; + uint16 m_vehEnterType; int16 m_walkAroundType; CPhysical *m_pCurrentPhysSurface; CVector m_vecOffsetFromPhysSurface; @@ -650,10 +650,10 @@ public: uint32 m_leaveCarTimer; uint32 m_getUpTimer; uint32 m_lookTimer; - uint32 m_chatTimer; + uint32 m_standardTimer; uint32 m_attackTimer; uint32 m_shootTimer; // shooting is a part of attack - uint32 m_carJackTimer; + uint32 m_hitRecoverTimer; uint32 m_objectiveTimer; uint32 m_duckTimer; uint32 m_duckAndCoverTimer; diff --git a/src/peds/PedAI.cpp b/src/peds/PedAI.cpp index a28ded8c..244c7b84 100644 --- a/src/peds/PedAI.cpp +++ b/src/peds/PedAI.cpp @@ -1223,7 +1223,7 @@ CPed::ProcessObjective(void) bool foundSeat = false; if (m_carInObjective->IsBike()) { if (!m_carInObjective->pPassengers[0] && !(m_carInObjective->m_nGettingInFlags & (CAR_DOOR_FLAG_RR | CAR_DOOR_FLAG_LR))) { - m_vehDoor = CAR_DOOR_RR; + m_vehEnterType = CAR_DOOR_RR; foundSeat = true; } } else { @@ -1232,27 +1232,27 @@ CPed::ProcessObjective(void) if (m_carInObjective->pPassengers[2] || m_carInObjective->m_nGettingInFlags & CAR_DOOR_FLAG_RR) { foundSeat = false; } else { - m_vehDoor = CAR_DOOR_RR; + m_vehEnterType = CAR_DOOR_RR; foundSeat = true; } } else { - m_vehDoor = CAR_DOOR_LR; + m_vehEnterType = CAR_DOOR_LR; foundSeat = true; } } else { - m_vehDoor = CAR_DOOR_RF; + m_vehEnterType = CAR_DOOR_RF; foundSeat = true; } } for (int i = 2; i < m_carInObjective->m_nNumMaxPassengers; ++i) { if (!m_carInObjective->pPassengers[i] && !(m_carInObjective->m_nGettingInFlags & CAR_DOOR_FLAG_RF)) { - m_vehDoor = CAR_DOOR_RF; + m_vehEnterType = CAR_DOOR_RF; foundSeat = true; } } if (foundSeat) { - SetPosition(GetPositionToOpenCarDoor(m_carInObjective, m_vehDoor)); - SetEnterCar(m_carInObjective, m_vehDoor); + SetPosition(GetPositionToOpenCarDoor(m_carInObjective, m_vehEnterType)); + SetEnterCar(m_carInObjective, m_vehEnterType); } } m_objectiveTimer = 0; @@ -1565,7 +1565,7 @@ CPed::ProcessObjective(void) if (bInVehicle) { bScriptObjectiveCompleted = true; RestorePreviousObjective(); - } else if (m_carJackTimer < CTimer::GetTimeInMilliseconds()) { + } else if (m_hitRecoverTimer < CTimer::GetTimeInMilliseconds()) { CVehicle *carToSteal = nil; float closestCarDist = nEnterCarRangeMultiplier * ENTER_CAR_MAX_DIST; CVector pos = GetPosition(); @@ -1590,7 +1590,7 @@ CPed::ProcessObjective(void) } if (carToSteal) { SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, carToSteal); - m_carJackTimer = CTimer::GetTimeInMilliseconds() + 5000; + m_hitRecoverTimer = CTimer::GetTimeInMilliseconds() + 5000; } else { RestorePreviousObjective(); RestorePreviousState(); @@ -2382,7 +2382,7 @@ CPed::PedAnimAlignCB(CAnimBlendAssociation *animAssoc, void *arg) return; } - if (!ped->m_vehDoor) { + if (!ped->m_vehEnterType) { ped->QuitEnteringCar(); return; } @@ -2396,7 +2396,7 @@ CPed::PedAnimAlignCB(CAnimBlendAssociation *animAssoc, void *arg) bool itsLow = !!veh->bLowVehicle; eDoors enterDoor; - switch (ped->m_vehDoor) { + switch (ped->m_vehEnterType) { case CAR_DOOR_RF: itsVan = false; enterDoor = DOOR_FRONT_RIGHT; @@ -2418,7 +2418,7 @@ CPed::PedAnimAlignCB(CAnimBlendAssociation *animAssoc, void *arg) if (veh->IsBike()) { CPed *pedToDragOut = nil; if (veh->GetStatus() == STATUS_ABANDONED) { - if (ped->m_vehDoor == CAR_WINDSCREEN) { + if (ped->m_vehEnterType == CAR_WINDSCREEN) { ped->m_pVehicleAnim = CAnimManager::BlendAnimation(ped->GetClump(), ((CBike*)veh)->m_bikeAnimType, ANIM_BIKE_KICK, 6.0f); ped->m_pVehicleAnim->SetFinishCallback(PedAnimGetInCB, ped); ((CBike*)veh)->bIsBeingPickedUp = true; @@ -2444,7 +2444,7 @@ CPed::PedAnimAlignCB(CAnimBlendAssociation *animAssoc, void *arg) ped->m_pVehicleAnim->SetFinishCallback(PedAnimGetInCB, ped); ((CBike*)veh)->bIsBeingPickedUp = true; } - } else if (ped->m_vehDoor == CAR_WINDSCREEN) { + } else if (ped->m_vehEnterType == CAR_WINDSCREEN) { if (veh->pDriver->m_nPedState != PED_DRIVING || veh->pDriver->bDontDragMeOutCar) { ped->QuitEnteringCar(); } else { @@ -2458,7 +2458,7 @@ CPed::PedAnimAlignCB(CAnimBlendAssociation *animAssoc, void *arg) if (veh->pDriver) { if (veh->m_vecMoveSpeed.Magnitude() > 0.2f) { ped->QuitEnteringCar(); - ped->SetFall(1000, ped->m_vehDoor == CAR_DOOR_LF || ped->m_vehDoor == CAR_DOOR_LR ? ANIM_KO_SPIN_L : ANIM_KO_SPIN_R, false); + ped->SetFall(1000, ped->m_vehEnterType == CAR_DOOR_LF || ped->m_vehEnterType == CAR_DOOR_LR ? ANIM_KO_SPIN_L : ANIM_KO_SPIN_R, false); return; } if (veh->pDriver->m_nPedState != PED_DRIVING || veh->pDriver->bDontDragMeOutCar) { @@ -2479,7 +2479,7 @@ CPed::PedAnimAlignCB(CAnimBlendAssociation *animAssoc, void *arg) if (veh->pPassengers[0]) { if (veh->m_vecMoveSpeed.Magnitude() > 0.2f) { ped->QuitEnteringCar(); - ped->SetFall(1000, ped->m_vehDoor == CAR_DOOR_LF || ped->m_vehDoor == CAR_DOOR_LR ? ANIM_KO_SPIN_L : ANIM_KO_SPIN_R, false); + ped->SetFall(1000, ped->m_vehEnterType == CAR_DOOR_LF || ped->m_vehEnterType == CAR_DOOR_LR ? ANIM_KO_SPIN_L : ANIM_KO_SPIN_R, false); return; } if (veh->pPassengers[0]->m_nPedState != PED_DRIVING || veh->pPassengers[0]->bDontDragMeOutCar) { @@ -2502,7 +2502,7 @@ CPed::PedAnimAlignCB(CAnimBlendAssociation *animAssoc, void *arg) } if (pedToDragOut) { - pedToDragOut->SetBeingDraggedFromCar(veh, ped->m_vehDoor, false); + pedToDragOut->SetBeingDraggedFromCar(veh, ped->m_vehEnterType, false); if (pedToDragOut->IsGangMember()) pedToDragOut->RegisterThreatWithGangPeds(ped); @@ -2580,7 +2580,7 @@ CPed::PedAnimAlignCB(CAnimBlendAssociation *animAssoc, void *arg) } if (player != veh->pDriver) { - veh->pDriver->SetBeingDraggedFromCar(veh, ped->m_vehDoor, true); + veh->pDriver->SetBeingDraggedFromCar(veh, ped->m_vehEnterType, true); if (veh->pDriver->IsGangMember()) veh->pDriver->RegisterThreatWithGangPeds(ped); } @@ -2630,7 +2630,7 @@ CPed::PedAnimDoorOpenCB(CAnimBlendAssociation* animAssoc, void* arg) eDoors door; CPed *pedInSeat = nil; - switch (ped->m_vehDoor) { + switch (ped->m_vehEnterType) { case CAR_DOOR_RF: door = DOOR_FRONT_RIGHT; pedInSeat = veh->pPassengers[0]; @@ -2688,21 +2688,21 @@ CPed::PedAnimDoorOpenCB(CAnimBlendAssociation* animAssoc, void* arg) if (veh->m_vecMoveSpeed.Magnitude() > 0.2f || veh->IsCar() && veh->GetVehicleAppearance() == VEHICLE_APPEARANCE_HELI && ((CAutomobile*)veh)->m_nWheelsOnGround == 0) { ped->QuitEnteringCar(); - if (ped->m_vehDoor != CAR_DOOR_LF && ped->m_vehDoor != CAR_DOOR_LR) + if (ped->m_vehEnterType != CAR_DOOR_LF && ped->m_vehEnterType != CAR_DOOR_LR) ped->SetFall(1000, ANIM_KO_SPIN_R, false); else ped->SetFall(1000, ANIM_KO_SPIN_L, false); return; } - veh->ProcessOpenDoor(ped->m_vehDoor, ANIM_CAR_OPEN_LHS, 1.0f); + veh->ProcessOpenDoor(ped->m_vehEnterType, ANIM_CAR_OPEN_LHS, 1.0f); - if (ped->m_vehDoor == CAR_DOOR_LF || ped->m_vehDoor == CAR_DOOR_RF) + if (ped->m_vehEnterType == CAR_DOOR_LF || ped->m_vehEnterType == CAR_DOOR_RF) isVan = false; if (ped->m_nPedState != PED_CARJACK || isBus) { - if (ped->m_vehDoor == CAR_DOOR_LF || ped->m_vehDoor == CAR_DOOR_LR) { + if (ped->m_vehEnterType == CAR_DOOR_LF || ped->m_vehEnterType == CAR_DOOR_LR) { if (veh->IsBike()) { ped->m_pVehicleAnim = CAnimManager::AddAnimation(ped->GetClump(), ((CBike*)veh)->m_bikeAnimType, ANIM_BIKE_JUMPON_R); } else if (isVan) { @@ -2727,14 +2727,14 @@ CPed::PedAnimDoorOpenCB(CAnimBlendAssociation* animAssoc, void* arg) ped->m_pVehicleAnim = CAnimManager::AddAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_CAR_GETIN_RHS); } - if (ped->m_vehDoor == CAR_DOOR_RF && pedInSeat && veh->IsCar()) + if (ped->m_vehEnterType == CAR_DOOR_RF && pedInSeat && veh->IsCar()) pedInSeat->SetObjective(OBJECTIVE_LEAVE_CAR, veh); } ped->m_pVehicleAnim->SetFinishCallback(PedAnimGetInCB, ped); } else { CPed *pedToDragOut = nil; - switch (ped->m_vehDoor) { + switch (ped->m_vehEnterType) { case CAR_DOOR_RF: pedToDragOut = veh->pPassengers[0]; break; case CAR_DOOR_RR: pedToDragOut = veh->pPassengers[2]; break; case CAR_DOOR_LF: pedToDragOut = veh->pDriver; break; @@ -2748,7 +2748,7 @@ CPed::PedAnimDoorOpenCB(CAnimBlendAssociation* animAssoc, void* arg) ((CCopPed*)ped)->SetArrestPlayer(ped->m_pedInObjective); } - if (ped->m_vehDoor != CAR_DOOR_LF && ped->m_vehDoor != CAR_DOOR_LR) { + if (ped->m_vehEnterType != CAR_DOOR_LF && ped->m_vehEnterType != CAR_DOOR_LR) { if (pedToDragOut && !pedToDragOut->bDontDragMeOutCar) { if (pedToDragOut->m_nPedState != PED_DRIVING) { @@ -2818,7 +2818,7 @@ CPed::PedAnimDoorOpenCB(CAnimBlendAssociation* animAssoc, void* arg) } if (player != pedToDragOut) { - pedToDragOut->SetBeingDraggedFromCar(veh, ped->m_vehDoor, false); + pedToDragOut->SetBeingDraggedFromCar(veh, ped->m_vehEnterType, false); if (pedToDragOut->IsGangMember()) pedToDragOut->RegisterThreatWithGangPeds(ped); } @@ -2889,7 +2889,7 @@ CPed::PedAnimPullPedOutCB(CAnimBlendAssociation* animAssoc, void* arg) } if (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER) { - if (ped->m_vehDoor == CAR_DOOR_LF || ped->m_vehDoor == CAR_DOOR_LR) { + if (ped->m_vehEnterType == CAR_DOOR_LF || ped->m_vehEnterType == CAR_DOOR_LR) { if (veh->IsBike()) ped->m_pVehicleAnim = CAnimManager::AddAnimation(ped->GetClump(), ((CBike*)veh)->m_bikeAnimType, ANIM_BIKE_JUMPON_R); else if (isLow) @@ -2946,7 +2946,7 @@ CPed::PedAnimGetInCB(CAnimBlendAssociation *animAssoc, void *arg) } return; } - if (ped->IsPlayer() && ped->m_vehDoor == CAR_DOOR_LF + if (ped->IsPlayer() && ped->m_vehEnterType == CAR_DOOR_LF && (Pads[0].GetAccelerate() >= 255.0f || Pads[0].GetBrake() >= 255.0f) && veh->IsCar() && !veh->pDriver) { @@ -2965,7 +2965,7 @@ CPed::PedAnimGetInCB(CAnimBlendAssociation *animAssoc, void *arg) bool isBus = !!veh->bIsBus; bool isLow = !!veh->bLowVehicle; eDoors enterDoor; - switch (ped->m_vehDoor) { + switch (ped->m_vehEnterType) { case CAR_DOOR_RF: isVan = false; enterDoor = DOOR_FRONT_RIGHT; @@ -3011,7 +3011,7 @@ CPed::PedAnimGetInCB(CAnimBlendAssociation *animAssoc, void *arg) ped->m_leaveCarTimer = CTimer::GetTimeInMilliseconds() + 400; return; } - if (driver != ped && ped->m_vehDoor != CAR_DOOR_LF) { + if (driver != ped && ped->m_vehEnterType != CAR_DOOR_LF) { if (!driver->IsPlayer()) { driver->bUsePedNodeSeek = true; driver->m_pLastPathNode = nil; @@ -3094,10 +3094,10 @@ CPed::PedAnimDoorCloseCB(CAnimBlendAssociation *animAssoc, void *arg) bool isLow = !!veh->bLowVehicle; if (!veh->bIsBus) - veh->ProcessOpenDoor(ped->m_vehDoor, ANIM_CAR_CLOSEDOOR_LHS, 1.0f); + veh->ProcessOpenDoor(ped->m_vehEnterType, ANIM_CAR_CLOSEDOOR_LHS, 1.0f); eDoors door; - switch (ped->m_vehDoor) { + switch (ped->m_vehEnterType) { case CAR_DOOR_RF: door = DOOR_FRONT_RIGHT; break; case CAR_DOOR_RR: door = DOOR_REAR_RIGHT; break; case CAR_DOOR_LF: door = DOOR_FRONT_LEFT; break; @@ -3110,7 +3110,7 @@ CPed::PedAnimDoorCloseCB(CAnimBlendAssociation *animAssoc, void *arg) if (door == DOOR_FRONT_LEFT || ped->m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER || veh->bIsBus || veh->m_nNumMaxPassengers == 0) { PedSetInCarCB(nil, ped); - } else if (ped->m_vehDoor == CAR_DOOR_RF + } else if (ped->m_vehEnterType == CAR_DOOR_RF && (veh->m_nGettingInFlags & CAR_DOOR_FLAG_LF || (veh->pDriver != nil && (veh->pDriver->m_objective != OBJECTIVE_LEAVE_CAR @@ -3263,7 +3263,7 @@ CPed::PedAnimStepOutCarCB(CAnimBlendAssociation* animAssoc, void* arg) veh->m_vecMoveSpeed += CVector(0.001f, 0.001f, 0.001f); veh->m_vecTurnSpeed += CVector(0.001f, 0.001f, 0.001f); if (!veh->bIsBus) - veh->ProcessOpenDoor(ped->m_vehDoor, ANIM_CAR_GETOUT_LHS, 1.0f); + veh->ProcessOpenDoor(ped->m_vehEnterType, ANIM_CAR_GETOUT_LHS, 1.0f); /* // Duplicate and only in PC for some reason @@ -3273,7 +3273,7 @@ CPed::PedAnimStepOutCarCB(CAnimBlendAssociation* animAssoc, void* arg) } */ eDoors door; - switch (ped->m_vehDoor) { + switch (ped->m_vehEnterType) { case CAR_DOOR_RF: door = DOOR_FRONT_RIGHT; break; @@ -3442,7 +3442,7 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase) if (veh->GetUp().z <= -0.8f) vehIsUpsideDown = true; - if (m_vehDoor == CAR_DOOR_RF || m_vehDoor == CAR_DOOR_RR) { + if (m_vehEnterType == CAR_DOOR_RF || m_vehEnterType == CAR_DOOR_RR) { if (vehIsUpsideDown) { m_fRotationDest = -PI + veh->GetForward().Heading(); } else if (veh->bIsBus) { @@ -3450,7 +3450,7 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase) } else { m_fRotationDest = veh->GetForward().Heading(); } - } else if (m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_LR) { + } else if (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR) { if (vehIsUpsideDown) { m_fRotationDest = veh->GetForward().Heading(); } else if (veh->bIsBus) { @@ -3465,7 +3465,7 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase) m_fRotationDest = veh->GetForward().Heading(); } else if (veh->bIsBus) { m_fRotationDest = 0.5f * PI + veh->GetForward().Heading(); - } else if (m_vehDoor == CAR_WINDSCREEN) { + } else if (m_vehEnterType == CAR_WINDSCREEN) { m_fRotationDest = veh->GetForward().Heading() + PI; } else { m_fRotationDest = veh->GetForward().Heading(); @@ -3573,7 +3573,7 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase) if (phase == LINE_UP_TO_CAR_2) { neededPos = GetPosition(); } else { - neededPos = GetPositionToOpenCarDoor(veh, m_vehDoor, seatPosMult); + neededPos = GetPositionToOpenCarDoor(veh, m_vehEnterType, seatPosMult); } autoZPos = neededPos; @@ -3690,13 +3690,13 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase) SetHeading(m_fRotationCur); } else { CMatrix vehDoorMat(veh->GetMatrix()); - vehDoorMat.GetPosition() += Multiply3x3(vehDoorMat, GetLocalPositionToOpenCarDoor(veh, m_vehDoor, 0.0f)); + vehDoorMat.GetPosition() += Multiply3x3(vehDoorMat, GetLocalPositionToOpenCarDoor(veh, m_vehEnterType, 0.0f)); - if (m_vehDoor == CAR_WINDSCREEN || veh->bIsBus) { + if (m_vehEnterType == CAR_WINDSCREEN || veh->bIsBus) { CMatrix correctionMat; - if (veh->bIsBus && (m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_LR)) + if (veh->bIsBus && (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR)) correctionMat.SetRotateZ(-HALFPI); - else if (veh->bIsBus && (m_vehDoor == CAR_DOOR_RF || m_vehDoor == CAR_DOOR_RR)) + else if (veh->bIsBus && (m_vehEnterType == CAR_DOOR_RF || m_vehEnterType == CAR_DOOR_RR)) correctionMat.SetRotateZ(HALFPI); else correctionMat.SetRotateZ(PI); @@ -3720,7 +3720,7 @@ CPed::SetCarJack(CVehicle* car) return; if (car->IsBike()) { - switch (m_vehDoor) { + switch (m_vehEnterType) { case CAR_DOOR_RF: doorFlag = CAR_DOOR_FLAG_LF | CAR_DOOR_FLAG_RF; door = DOOR_FRONT_RIGHT; @@ -3747,7 +3747,7 @@ CPed::SetCarJack(CVehicle* car) break; } } else { - switch (m_vehDoor) { + switch (m_vehEnterType) { case CAR_DOOR_RF: doorFlag = CAR_DOOR_FLAG_RF; door = DOOR_FRONT_RIGHT; @@ -3788,7 +3788,7 @@ CPed::SetCarJack(CVehicle* car) if (m_nPedState != PED_CARJACK && !m_pVehicleAnim) if ((car->IsDoorReady(door) || car->IsDoorFullyOpen(door))) if (!car->bIsBeingCarJacked && !(doorFlag & car->m_nGettingInFlags) && !(doorFlag & car->m_nGettingOutFlags)) - SetCarJack_AllClear(car, m_vehDoor, doorFlag); + SetCarJack_AllClear(car, m_vehEnterType, doorFlag); } // --MIAMI: Done @@ -3812,7 +3812,7 @@ CPed::SetCarJack_AllClear(CVehicle* car, uint32 doorNode, uint32 doorFlag) Say(SOUND_PED_CAR_JACKING, 1000); CVector carEnterPos; - carEnterPos = GetPositionToOpenCarDoor(car, m_vehDoor); + carEnterPos = GetPositionToOpenCarDoor(car, m_vehEnterType); car->m_nGettingInFlags |= doorFlag; m_vecOffsetSeek = carEnterPos - GetPosition(); @@ -3825,7 +3825,7 @@ CPed::SetCarJack_AllClear(CVehicle* car, uint32 doorNode, uint32 doorFlag) float zDiff = Max(0.0f, carEnterPos.z - GetPosition().z); bUsesCollision = false; - if (m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_LR) + if (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR) m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, zDiff > 4.4f ? ANIM_CAR_ALIGNHI_LHS : ANIM_CAR_ALIGN_LHS, 4.0f); else m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, zDiff > 4.4f ? ANIM_CAR_ALIGNHI_RHS : ANIM_CAR_ALIGN_RHS, 4.0f); @@ -3851,14 +3851,14 @@ CPed::SetBeingDraggedFromCar(CVehicle *veh, uint32 vehEnterType, bool quickJack) if (veh->IsBike()) { ((CBike*)veh)->bIsBeingPickedUp = true; if (veh->pPassengers[0] != this && (vehEnterType != CAR_WINDSCREEN || veh->pPassengers[0])) - m_vehDoor = CAR_DOOR_LF; + m_vehEnterType = CAR_DOOR_LF; else - m_vehDoor = CAR_DOOR_LR; + m_vehEnterType = CAR_DOOR_LR; } else { - m_vehDoor = vehEnterType; + m_vehEnterType = vehEnterType; } - if (m_vehDoor == CAR_DOOR_LF) { + if (m_vehEnterType == CAR_DOOR_LF) { if (veh->pDriver && veh->pDriver->IsPlayer()) veh->SetStatus(STATUS_PLAYER_DISABLED); else @@ -3878,9 +3878,9 @@ CPed::SetBeingDraggedFromCar(CVehicle *veh, uint32 vehEnterType, bool quickJack) SetRadioStation(); if(veh->IsBike()) - veh->m_nGettingOutFlags |= GetBikeDoorFlagInclJumpInFromFront(m_vehDoor); + veh->m_nGettingOutFlags |= GetBikeDoorFlagInclJumpInFromFront(m_vehEnterType); else - veh->m_nGettingOutFlags |= GetCarDoorFlag(m_vehDoor); + veh->m_nGettingOutFlags |= GetCarDoorFlag(m_vehEnterType); } // --MIAMI: Done @@ -3899,15 +3899,15 @@ CPed::BeingDraggedFromCar(void) assocGroup = ((CBike*)m_pMyVehicle)->m_bikeAnimType; } else { - if (m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_LR) { - if (bWillBeQuickJacked && m_vehDoor == CAR_DOOR_LF) { + if (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR) { + if (bWillBeQuickJacked && m_vehEnterType == CAR_DOOR_LF) { enterAnim = ANIM_CAR_QJACKED; } else if (m_pMyVehicle->bLowVehicle) { enterAnim = ANIM_CAR_LJACKED_LHS; } else { enterAnim = ANIM_CAR_JACKED_LHS; } - } else if (m_vehDoor == CAR_DOOR_RF || m_vehDoor == CAR_DOOR_RR) { + } else if (m_vehEnterType == CAR_DOOR_RF || m_vehEnterType == CAR_DOOR_RR) { if (m_pMyVehicle->bLowVehicle) enterAnim = ANIM_CAR_LJACKED_RHS; else @@ -3944,7 +3944,7 @@ CPed::BeingDraggedFromCar(void) static float mult = 5.f; if (m_objective == OBJECTIVE_LEAVE_CAR_AND_DIE) { if (m_pMyVehicle) { - m_pMyVehicle->ProcessOpenDoor(m_vehDoor, NUM_STD_ANIMS, m_pVehicleAnim->currentTime * mult); + m_pMyVehicle->ProcessOpenDoor(m_vehEnterType, NUM_STD_ANIMS, m_pVehicleAnim->currentTime * mult); } } } @@ -3960,7 +3960,7 @@ CPed::SetEnterCar(CVehicle *car, uint32 unused) uint8 doorFlag; eDoors door; if (car->IsBike()) { - switch (m_vehDoor) { + switch (m_vehEnterType) { case CAR_DOOR_RF: doorFlag = CAR_DOOR_FLAG_RF | CAR_DOOR_FLAG_LF; door = DOOR_FRONT_RIGHT; @@ -3986,7 +3986,7 @@ CPed::SetEnterCar(CVehicle *car, uint32 unused) break; } } else { - switch (m_vehDoor) { + switch (m_vehEnterType) { case CAR_DOOR_RF: doorFlag = CAR_DOOR_FLAG_RF; door = DOOR_FRONT_RIGHT; @@ -4022,7 +4022,7 @@ CPed::SetEnterCar(CVehicle *car, uint32 unused) || doorFlag && !car->IsDoorReady(door) && !car->IsDoorFullyOpen(door)) SetMoveState(PEDMOVE_STILL); else - SetEnterCar_AllClear(car, m_vehDoor, doorFlag); + SetEnterCar_AllClear(car, m_vehEnterType, doorFlag); } } @@ -4038,9 +4038,9 @@ CPed::SetEnterCar_AllClear(CVehicle *car, uint32 doorNode, uint32 doorFlag) m_pSeekTarget = car; m_pSeekTarget->RegisterReference((CEntity **) &m_pSeekTarget); - m_vehDoor = doorNode; + m_vehEnterType = doorNode; SetPedState(PED_ENTER_CAR); - if (m_vehDoor == CAR_DOOR_RF && m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER && !car->IsBike()) { + if (m_vehEnterType == CAR_DOOR_RF && m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER && !car->IsBike()) { car->bIsBeingCarJacked = true; } @@ -4048,7 +4048,7 @@ CPed::SetEnterCar_AllClear(CVehicle *car, uint32 doorNode, uint32 doorFlag) m_pMyVehicle->RegisterReference((CEntity**) &m_pMyVehicle); ((CVehicle*)m_pSeekTarget)->m_nNumGettingIn++; bUsesCollision = false; - CVector doorOpenPos = GetPositionToOpenCarDoor(car, m_vehDoor); + CVector doorOpenPos = GetPositionToOpenCarDoor(car, m_vehEnterType); // Because buses have stairs if (!m_pMyVehicle->bIsBus) @@ -4071,7 +4071,7 @@ CPed::SetEnterCar_AllClear(CVehicle *car, uint32 doorNode, uint32 doorFlag) car->AutoPilot.m_nCruiseSpeed = 0; } else { - if (m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_LR) + if (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR) m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, zDiff > 4.4f ? ANIM_CAR_ALIGNHI_RHS : ANIM_CAR_ALIGN_RHS, 4.0f); else m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, zDiff > 4.4f ? ANIM_CAR_ALIGNHI_LHS : ANIM_CAR_ALIGN_LHS, 4.0f); @@ -4087,11 +4087,11 @@ CPed::EnterCar(void) CVehicle *veh = m_pMyVehicle; // Not used. - // CVector posForDoor = GetPositionToOpenCarDoor(veh, m_vehDoor); + // CVector posForDoor = GetPositionToOpenCarDoor(veh, m_vehEnterType); if (veh->CanPedOpenLocks(this)) { - if (m_vehDoor && m_pVehicleAnim) { - veh->ProcessOpenDoor(m_vehDoor, m_pVehicleAnim->animId, m_pVehicleAnim->currentTime); + if (m_vehEnterType && m_pVehicleAnim) { + veh->ProcessOpenDoor(m_vehEnterType, m_pVehicleAnim->animId, m_pVehicleAnim->currentTime); } } bIsInTheAir = false; @@ -4147,10 +4147,10 @@ CPed::QuitEnteringCar(void) RestorePreviousObjective(); if (veh->IsBike()) { - veh->m_nGettingInFlags &= ~GetBikeDoorFlag(m_vehDoor); + veh->m_nGettingInFlags &= ~GetBikeDoorFlag(m_vehEnterType); ((CBike*)veh)->bIsBeingPickedUp = false; } else - veh->m_nGettingInFlags &= ~GetEnterCarDoorFlag(m_vehDoor, veh->m_nNumMaxPassengers); + veh->m_nGettingInFlags &= ~GetEnterCarDoorFlag(m_vehEnterType, veh->m_nNumMaxPassengers); } bUsesCollision = true; @@ -4184,7 +4184,7 @@ CPed::SetExitBoat(CVehicle *boat) newPos = { 0.0f, 0.0f, boatCol->boundingBox.min.z }; newPos = boat->GetMatrix() * newPos; newPos.z += 1.0f; - m_vehDoor = CAR_DOOR_RF; + m_vehEnterType = CAR_DOOR_RF; PedSetOutCarCB(nil, this); bIsStanding = true; m_pCurSurface = boat; @@ -4193,7 +4193,7 @@ CPed::SetExitBoat(CVehicle *boat) } else { if (boat->m_modelIndex == MI_SKIMMER) { if (!boat->bIsInWater) { - m_vehDoor = CAR_DOOR_RF; + m_vehEnterType = CAR_DOOR_RF; PedSetOutCarCB(nil, this); bIsStanding = true; SetMoveState(PEDMOVE_STILL); @@ -4214,7 +4214,7 @@ CPed::SetExitBoat(CVehicle *boat) newPos.z += 2.0f; } - m_vehDoor = CAR_DOOR_RF; + m_vehEnterType = CAR_DOOR_RF; PedSetOutCarCB(nil, this); bIsStanding = true; m_pCurSurface = boat; @@ -4455,14 +4455,14 @@ CPed::SetExitCar(CVehicle *veh, uint32 wantedDoorNode) // needed for PositionPedOutOfCollision() optedDoorNode = firstOptedDoor; - m_vehDoor = firstOptedDoor; + m_vehEnterType = firstOptedDoor; PositionPedOutOfCollision(); teleportNeeded = true; } } if (!teleportNeeded && veh->IsOnItsSide()) { - m_vehDoor = optedDoorNode; + m_vehEnterType = optedDoorNode; PositionPedOutOfCollision(); teleportNeeded = true; } @@ -4480,7 +4480,7 @@ CPed::SetExitCar(CVehicle *veh, uint32 wantedDoorNode) bUsesCollision = false; m_pSeekTarget = veh; m_pSeekTarget->RegisterReference((CEntity**) &m_pSeekTarget); - m_vehDoor = optedDoorNode; + m_vehEnterType = optedDoorNode; SetPedState(PED_EXIT_CAR); if (m_pVehicleAnim && m_pVehicleAnim->flags & ASSOC_PARTIAL) m_pVehicleAnim->blendDelta = -1000.0f; @@ -4493,16 +4493,16 @@ CPed::SetExitCar(CVehicle *veh, uint32 wantedDoorNode) PedSetOutCarCB(nil, this); } else { if (veh->GetUp().z <= -0.8f && !veh->IsBike()) { - if (m_vehDoor == CAR_DOOR_RF || m_vehDoor == CAR_DOOR_RR) { + if (m_vehEnterType == CAR_DOOR_RF || m_vehEnterType == CAR_DOOR_RR) { m_pVehicleAnim = CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_CRAWLOUT_RHS2); - } else if (m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_LR) { + } else if (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR) { m_pVehicleAnim = CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_CRAWLOUT_RHS); } m_pVehicleAnim->SetFinishCallback(PedSetOutCarCB, this); } else if (veh->IsBike()) { CBike* bike = (CBike*)veh; - switch (m_vehDoor) { + switch (m_vehEnterType) { case CAR_BUMP_REAR: case CAR_BOOT: m_pVehicleAnim = CAnimManager::AddAnimation(GetClump(), bike->m_bikeAnimType, ANIM_BIKE_GETOFF_BACK); @@ -4521,7 +4521,7 @@ CPed::SetExitCar(CVehicle *veh, uint32 wantedDoorNode) int8 exitFlags = 0; // Bike door flags incl. passenger jump off - switch (m_vehDoor) { + switch (m_vehEnterType) { case CAR_BUMP_REAR: case CAR_DOOR_RR: case CAR_DOOR_LR: @@ -4535,7 +4535,7 @@ CPed::SetExitCar(CVehicle *veh, uint32 wantedDoorNode) } // Passenger get off - if (m_vehDoor == CAR_BUMP_REAR || m_vehDoor == CAR_BOOT) { + if (m_vehEnterType == CAR_BUMP_REAR || m_vehEnterType == CAR_BOOT) { m_pVehicleAnim->SetFinishCallback(RestoreHeadingRateCB, this); m_headingRate = 0.0f; @@ -4545,7 +4545,7 @@ CPed::SetExitCar(CVehicle *veh, uint32 wantedDoorNode) } } else { - switch (m_vehDoor) { + switch (m_vehEnterType) { case CAR_DOOR_RF: if (canJumpOut) { m_pVehicleAnim = CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_ROLLOUT_RHS); @@ -4596,7 +4596,7 @@ CPed::SetExitCar(CVehicle *veh, uint32 wantedDoorNode) break; } if (!bBusJacked && !canJumpOut) { - veh->m_nGettingOutFlags |= GetCarDoorFlag(m_vehDoor); + veh->m_nGettingOutFlags |= GetCarDoorFlag(m_vehEnterType); } m_pVehicleAnim->SetFinishCallback(canJumpOut ? RestoreHeadingRateCB : PedAnimStepOutCarCB, this); } @@ -4622,7 +4622,7 @@ CPed::ExitCar(void) if (!m_pVehicleAnim) { if (InVehicle()) { if (m_pMyVehicle->IsBike()) { - if (m_vehDoor == CAR_BOOT || m_vehDoor == CAR_BUMP_REAR) { + if (m_vehEnterType == CAR_BOOT || m_vehEnterType == CAR_BUMP_REAR) { ((CBike*)m_pMyVehicle)->KnockOffRider(WEAPONTYPE_UNARMED, 0, this, false); } } else if (m_pMyVehicle->IsCar()) { @@ -4656,7 +4656,7 @@ CPed::ExitCar(void) LineUpPedWithCar(LINE_UP_TO_CAR_FALL); } } else { - m_pMyVehicle->ProcessOpenDoor(m_vehDoor, exitAnim, animTime); + m_pMyVehicle->ProcessOpenDoor(m_vehEnterType, exitAnim, animTime); if (m_pSeekTarget) { // Car is upside down @@ -4718,17 +4718,17 @@ CPed::GetNearestDoor(CVehicle *veh, CVector &posToOpen) angleDiff += TWOPI; if (Abs(angleDiff) < DEGTORAD(30.f) - && (IsPlayer() && ((CPlayerPed*)this)->m_fMoveSpeed > 1.5f && !m_vehDoor || + && (IsPlayer() && ((CPlayerPed*)this)->m_fMoveSpeed > 1.5f && !m_vehEnterType || !IsPlayer() && m_nPedType != PEDTYPE_COP && m_nMoveState == PEDMOVE_RUN && m_pedStats->m_temper > 65 - && !m_vehDoor || m_vehDoor == CAR_WINDSCREEN)) { - m_vehDoor = CAR_WINDSCREEN; + && !m_vehEnterType || m_vehEnterType == CAR_WINDSCREEN)) { + m_vehEnterType = CAR_WINDSCREEN; posToOpen = GetPositionToOpenCarDoor(veh, CAR_WINDSCREEN); return; } } } - } else if (m_vehDoor == CAR_DOOR_LF && veh->pDriver && !veh->bLowVehicle && !veh->bIsBus) { + } else if (m_vehEnterType == CAR_DOOR_LF && veh->pDriver && !veh->bLowVehicle && !veh->bIsBus) { enterOffset = &vecPedQuickDraggedOutCarAnimOffset; } @@ -4739,10 +4739,10 @@ CPed::GetNearestDoor(CVehicle *veh, CVector &posToOpen) if ((lfPos - GetPosition()).MagnitudeSqr2D() < (rfPos - GetPosition()).MagnitudeSqr2D()) { if (veh->IsRoomForPedToLeaveCar(CAR_DOOR_LF, enterOffset)) { - m_vehDoor = CAR_DOOR_LF; + m_vehEnterType = CAR_DOOR_LF; posToOpen = lfPos; } else if (veh->IsRoomForPedToLeaveCar(CAR_DOOR_RF, enterOffset)) { - m_vehDoor = CAR_DOOR_RF; + m_vehEnterType = CAR_DOOR_RF; posToOpen = rfPos; } } else { @@ -4756,14 +4756,14 @@ CPed::GetNearestDoor(CVehicle *veh, CVector &posToOpen) && veh->IsRoomForPedToLeaveCar(CAR_DOOR_LF, enterOffset) || (veh->m_nGettingInFlags & CAR_DOOR_FLAG_RF) && veh->IsRoomForPedToLeaveCar(CAR_DOOR_LF, enterOffset)) { - m_vehDoor = CAR_DOOR_LF; + m_vehEnterType = CAR_DOOR_LF; posToOpen = lfPos; } else { - m_vehDoor = CAR_DOOR_RF; + m_vehEnterType = CAR_DOOR_RF; posToOpen = rfPos; } } else if (veh->IsRoomForPedToLeaveCar(CAR_DOOR_LF, enterOffset)) { - m_vehDoor = CAR_DOOR_LF; + m_vehEnterType = CAR_DOOR_LF; posToOpen = lfPos; } } @@ -4780,7 +4780,7 @@ CPed::GetNearestPassengerDoor(CVehicle *veh, CVector &posToOpen) switch (veh->GetModelIndex()) { case MI_BUS: - m_vehDoor = CAR_DOOR_RF; + m_vehEnterType = CAR_DOOR_RF; posToOpen = GetPositionToOpenCarDoor(veh, CAR_DOOR_RF); return true; case MI_RHINO: @@ -4839,15 +4839,15 @@ CPed::GetNearestPassengerDoor(CVehicle *veh, CVector &posToOpen) CVector2D nextToCompare = rfPosDist; posToOpen = rfPos; - m_vehDoor = CAR_DOOR_RF; + m_vehEnterType = CAR_DOOR_RF; if (lrPosDist.MagnitudeSqr() < nextToCompare.MagnitudeSqr()) { - m_vehDoor = CAR_DOOR_LR; + m_vehEnterType = CAR_DOOR_LR; posToOpen = lrPos; nextToCompare = lrPosDist; } if (rrPosDist.MagnitudeSqr() < nextToCompare.MagnitudeSqr()) { - m_vehDoor = CAR_DOOR_RR; + m_vehEnterType = CAR_DOOR_RR; posToOpen = rrPos; } return canEnter; @@ -4870,7 +4870,7 @@ void CPed::PedSetGetInCarPositionCB(CAnimBlendAssociation* assoc, void* arg) CPed* pPed = (CPed*)arg; CMatrix mat(pPed->GetMatrix()); CVehicle* pVehicle = pPed->m_pMyVehicle; - const CVector& offset = (pVehicle->bIsVan && (pPed->m_vehDoor == CAR_DOOR_RR || pPed->m_vehDoor == CAR_DOOR_LR)) ? vecPedVanRearDoorAnimOffset : vecPedCarDoorAnimOffset; + const CVector& offset = (pVehicle->bIsVan && (pPed->m_vehEnterType == CAR_DOOR_RR || pPed->m_vehEnterType == CAR_DOOR_LR)) ? vecPedVanRearDoorAnimOffset : vecPedCarDoorAnimOffset; CVector position = Multiply3x3(mat, offset) + pPed->GetPosition(); CPedPlacement::FindZCoorForPed(&position); pPed->SetMoveSpeed(0.0f, 0.0f, 0.0f); @@ -5054,7 +5054,7 @@ CPed::PedSetQuickDraggedOutCarPositionCB(CAnimBlendAssociation *animAssoc, void ped->bUsesCollision = true; ped->RestartNonPartialAnims(); draggedOutOffset = vecPedQuickDraggedOutCarAnimOffset; - if (ped->m_vehDoor == CAR_DOOR_RF || ped->m_vehDoor == CAR_DOOR_RR) + if (ped->m_vehEnterType == CAR_DOOR_RF || ped->m_vehEnterType == CAR_DOOR_RR) draggedOutOffset.x = -draggedOutOffset.x; finalPos = Multiply3x3(pedMat, draggedOutOffset) + ped->GetPosition(); @@ -5067,7 +5067,7 @@ CPed::PedSetQuickDraggedOutCarPositionCB(CAnimBlendAssociation *animAssoc, void ped->m_fRotationCur = ped->m_fRotationDest; ped->CalculateNewOrientation(); - if (!veh->IsRoomForPedToLeaveCar(ped->m_vehDoor, &vecPedQuickDraggedOutCarAnimOffset)) + if (!veh->IsRoomForPedToLeaveCar(ped->m_vehEnterType, &vecPedQuickDraggedOutCarAnimOffset)) ped->PositionPedOutOfCollision(); } @@ -5158,7 +5158,7 @@ CPed::PedSetDraggedOutCarPositionCB(CAnimBlendAssociation* animAssoc, void* arg) } else { draggedOutOffset = vecPedDraggedOutCarAnimOffset; } - if (ped->m_vehDoor == CAR_DOOR_RF || ped->m_vehDoor == CAR_DOOR_RR) + if (ped->m_vehEnterType == CAR_DOOR_RF || ped->m_vehEnterType == CAR_DOOR_RR) draggedOutOffset.x = -draggedOutOffset.x; CVector posAfterBeingDragged = Multiply3x3(pedMat, draggedOutOffset); @@ -5167,7 +5167,7 @@ CPed::PedSetDraggedOutCarPositionCB(CAnimBlendAssociation* animAssoc, void* arg) ped->m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f); ped->SetPosition(posAfterBeingDragged); - if (ped->m_pMyVehicle && !ped->m_pMyVehicle->IsBike() && !ped->m_pMyVehicle->IsRoomForPedToLeaveCar(ped->m_vehDoor, &vecPedDraggedOutCarAnimOffset)) { + if (ped->m_pMyVehicle && !ped->m_pMyVehicle->IsBike() && !ped->m_pMyVehicle->IsRoomForPedToLeaveCar(ped->m_vehEnterType, &vecPedDraggedOutCarAnimOffset)) { ped->PositionPedOutOfCollision(); } @@ -5235,7 +5235,7 @@ CPed::GetNearestTrainDoor(CVehicle *train, CVector &doorPos) CVehicleModelInfo* trainModel = (CVehicleModelInfo*)CModelInfo::GetModelInfo(train->m_modelIndex); CMatrix trainMat = CMatrix(train->GetMatrix()); - doorPos = trainModel->m_positions[m_vehDoor]; + doorPos = trainModel->m_positions[m_vehEnterType]; doorPos.x -= 1.5f; doorPos = Multiply3x3(trainMat, doorPos); doorPos += train->GetPosition(); @@ -5286,17 +5286,17 @@ CPed::GetNearestTrainPedPosition(CVehicle *train, CVector &enterPos) if (distMidEntry < distLeftEntry) { if (distMidEntry < distRightEntry) { enterPos = midEntryPos; - m_vehDoor = TRAIN_POS_MID_ENTRY; + m_vehEnterType = TRAIN_POS_MID_ENTRY; } else { enterPos = rightEntryPos; - m_vehDoor = TRAIN_POS_RIGHT_ENTRY; + m_vehEnterType = TRAIN_POS_RIGHT_ENTRY; } } else if (distRightEntry < distLeftEntry) { enterPos = rightEntryPos; - m_vehDoor = TRAIN_POS_RIGHT_ENTRY; + m_vehEnterType = TRAIN_POS_RIGHT_ENTRY; } else { enterPos = leftEntryPos; - m_vehDoor = TRAIN_POS_LEFT_ENTRY; + m_vehEnterType = TRAIN_POS_LEFT_ENTRY; } return 1; @@ -6075,7 +6075,7 @@ CPed::SeekBoatPosition(void) m_vecSeekPos = boatMat * enterOffset; if (Seek()) { // We arrived to the boat - m_vehDoor = 0; + m_vehEnterType = 0; SetEnterCar(m_carInObjective, 0); } } else @@ -6212,9 +6212,9 @@ CPed::PositionPedOutOfCollision(void) foundAPos = true; } - } else if (m_vehDoor != 0) { + } else if (m_vehEnterType != 0) { // Try the normal way - CVector pos = GetPositionToOpenCarDoor(m_pMyVehicle, m_vehDoor); + CVector pos = GetPositionToOpenCarDoor(m_pMyVehicle, m_vehEnterType); newPos = pos; GetMatrix().SetTranslate(newPos); if (!CheckCollision()) { @@ -6224,7 +6224,7 @@ CPed::PositionPedOutOfCollision(void) } float vehRelativeExitX = vehCol->boundingBox.min.x - 0.355f; - if (m_vehDoor == CAR_DOOR_RF || m_vehDoor == CAR_DOOR_RR) + if (m_vehEnterType == CAR_DOOR_RF || m_vehEnterType == CAR_DOOR_RR) vehRelativeExitX = 0.355f + vehCol->boundingBox.max.x; if (!foundAPos) { @@ -6545,19 +6545,19 @@ CPed::KillCharOnFootArmed(CVector &ourPos, CVector &targetPos, CVector &distWith if (m_nPedType == PEDTYPE_COP || vehOfTarget->bIsBus) { GoToNearestDoor(vehOfTarget); } else { - m_vehDoor = 0; + m_vehEnterType = 0; if (m_pedInObjective == vehOfTarget->pDriver || vehOfTarget->bIsBus) { - m_vehDoor = CAR_DOOR_LF; + m_vehEnterType = CAR_DOOR_LF; } else if (m_pedInObjective == vehOfTarget->pPassengers[0]) { - m_vehDoor = CAR_DOOR_RF; + m_vehEnterType = CAR_DOOR_RF; } else if (m_pedInObjective == vehOfTarget->pPassengers[1]) { - m_vehDoor = CAR_DOOR_LR; + m_vehEnterType = CAR_DOOR_LR; } else if (m_pedInObjective == vehOfTarget->pPassengers[2]) { - m_vehDoor = CAR_DOOR_RR; + m_vehEnterType = CAR_DOOR_RR; } // Unused - // GetPositionToOpenCarDoor(vehOfTarget, m_vehDoor); - SetSeekCar(vehOfTarget, m_vehDoor); + // GetPositionToOpenCarDoor(vehOfTarget, m_vehEnterType); + SetSeekCar(vehOfTarget, m_vehEnterType); SetMoveState(PEDMOVE_RUN); } } @@ -6835,19 +6835,19 @@ CPed::KillCharOnFootMelee(CVector &ourPos, CVector &targetPos, CVector &distWith if (m_nPedType == PEDTYPE_COP || vehOfTarget->bIsBus) { GoToNearestDoor(vehOfTarget); } else { - m_vehDoor = 0; + m_vehEnterType = 0; if (m_pedInObjective == vehOfTarget->pDriver || vehOfTarget->bIsBus) { - m_vehDoor = CAR_DOOR_LF; + m_vehEnterType = CAR_DOOR_LF; } else if (m_pedInObjective == vehOfTarget->pPassengers[0]) { - m_vehDoor = CAR_DOOR_RF; + m_vehEnterType = CAR_DOOR_RF; } else if (m_pedInObjective == vehOfTarget->pPassengers[1]) { - m_vehDoor = CAR_DOOR_LR; + m_vehEnterType = CAR_DOOR_LR; } else if (m_pedInObjective == vehOfTarget->pPassengers[2]) { - m_vehDoor = CAR_DOOR_RR; + m_vehEnterType = CAR_DOOR_RR; } // Unused - // GetPositionToOpenCarDoor(vehOfTarget, m_vehDoor); - SetSeekCar(vehOfTarget, m_vehDoor); + // GetPositionToOpenCarDoor(vehOfTarget, m_vehEnterType); + SetSeekCar(vehOfTarget, m_vehEnterType); SetMoveState(PEDMOVE_RUN); } } diff --git a/src/peds/PedFight.cpp b/src/peds/PedFight.cpp index d1f39491..0f83cdd1 100644 --- a/src/peds/PedFight.cpp +++ b/src/peds/PedFight.cpp @@ -2418,7 +2418,7 @@ CPed::SetInvestigateEvent(eEventType event, CVector2D pos, float distanceToCount SetStoredState(); bFindNewNodeAfterStateRestore = false; SetPedState(PED_INVESTIGATE); - m_chatTimer = CTimer::GetTimeInMilliseconds() + time; + m_standardTimer = CTimer::GetTimeInMilliseconds() + time; m_eventType = event; m_eventOrThreat = pos; m_distanceToCountSeekDone = distanceToCountDone; @@ -2442,13 +2442,13 @@ CPed::InvestigateEvent(void) if (m_nWaitState == WAITSTATE_TURN180) return; - if (CTimer::GetTimeInMilliseconds() > m_chatTimer) { + if (CTimer::GetTimeInMilliseconds() > m_standardTimer) { - if (m_chatTimer) { + if (m_standardTimer) { if (m_eventType < EVENT_UNK) SetWaitState(WAITSTATE_TURN180, nil); - m_chatTimer = 0; + m_standardTimer = 0; } else { ClearInvestigateEvent(); } @@ -2509,7 +2509,7 @@ CPed::InvestigateEvent(void) Say(SOUND_PED_CHAT_EVENT); } else { - m_chatTimer = 0; + m_standardTimer = 0; } } else if (CTimer::GetTimeInMilliseconds() > m_lookTimer) { @@ -2653,7 +2653,7 @@ CPed::ClearInvestigateEvent(void) animAssoc->flags |= ASSOC_DELETEFADEDOUT; } if (m_eventType > EVENT_EXPLOSION) - m_chatTimer = CTimer::GetTimeInMilliseconds() + 15000; + m_standardTimer = CTimer::GetTimeInMilliseconds() + 15000; bGonnaInvestigateEvent = false; m_pEventEntity = nil; diff --git a/src/render/Font.cpp b/src/render/Font.cpp index d15dc7d3..6d569591 100644 --- a/src/render/Font.cpp +++ b/src/render/Font.cpp @@ -274,13 +274,13 @@ CFont::Initialise(void) SetScale(1.0f, 1.0f); SetSlantRefPoint(SCREEN_WIDTH, 0.0f); SetSlant(0.0f); - SetColor(CRGBA(255, 255, 255, 0)); + SetColor(CRGBA(0xFF, 0xFF, 0xFF, 0)); SetJustifyOff(); SetCentreOff(); SetWrapx(SCREEN_WIDTH); SetCentreSize(SCREEN_WIDTH); SetBackgroundOff(); - SetBackgroundColor(CRGBA(128, 128, 128, 128)); + SetBackgroundColor(CRGBA(0x80, 0x80, 0x80, 0x80)); SetBackGroundOnlyTextOff(); SetPropOn(); SetFontStyle(FONT_BANK); @@ -614,10 +614,10 @@ CFont::PrintString(float xstart, float ystart, wchar *s) x = xstart; #ifdef MORE_LANGUAGES if (IsJapaneseFont()) - y += 32.0f * Details.scaleY / 2.75f + 2.0f * Details.scaleY; + y += 32.0f * CFont::Details.scaleY / 2.75f + 2.0f * CFont::Details.scaleY; else #endif - y += 32.0f * Details.scaleY * 0.5f + 2.0f * Details.scaleY; + y += 32.0f * CFont::Details.scaleY * 0.5f + 2.0f * CFont::Details.scaleY; start = s; }else break; @@ -653,7 +653,7 @@ CFont::PrintString(float xstart, float ystart, wchar *s) else x = 0.0f; - y += 32.0f * Details.scaleY / 2.75f + 2.0f * Details.scaleY; + y += 32.0f * CFont::Details.scaleY / 2.75f + 2.0f * CFont::Details.scaleY; numSpaces = 0; first = true; lineLength = 0.0f; @@ -676,7 +676,7 @@ CFont::PrintString(float xstart, float ystart, wchar *s) x = xstart; else x = 0.0f; - y += 32.0f * Details.scaleY / 2.75f + 2.0f * Details.scaleY; + y += 32.0f * CFont::Details.scaleY / 2.75f + 2.0f * CFont::Details.scaleY; numSpaces = 0; first = true; lineLength = 0.0f; @@ -753,10 +753,10 @@ CFont::GetNumberLines(float xstart, float ystart, wchar *s) // Why even? #ifdef MORE_LANGUAGES if (IsJapanese()) - y += 32.0f * Details.scaleY / 2.75f + 2.0f * Details.scaleY; + y += 32.0f * CFont::Details.scaleY / 2.75f + 2.0f * CFont::Details.scaleY; else #endif - y += 32.0f * Details.scaleY * 0.5f + 2.0f * Details.scaleY; + y += 32.0f * CFont::Details.scaleY * 0.5f + 2.0f * CFont::Details.scaleY; }else{ // still space in current line t = GetNextSpace(s); @@ -827,7 +827,7 @@ CFont::GetTextRect(CRect *rect, float xstart, float ystart, wchar *s) else x = xstart; numLines++; - y += 32.0f * Details.scaleY * 0.5f + 2.0f * Details.scaleY; + y += 32.0f * CFont::Details.scaleY * 0.5f + 2.0f * CFont::Details.scaleY; }else{ // still space in current line t = GetNextSpace(s); @@ -855,11 +855,11 @@ CFont::GetTextRect(CRect *rect, float xstart, float ystart, wchar *s) rect->right = xstart + maxlength/2 + 4.0f; #ifdef MORE_LANGUAGES if (IsJapaneseFont()) { - rect->bottom = (32.0f * Details.scaleY / 2.75f + 2.0f * Details.scaleY) * numLines + ystart + (4.0f / 2.75f); + rect->bottom = (32.0f * CFont::Details.scaleY / 2.75f + 2.0f * CFont::Details.scaleY) * numLines + ystart + (4.0f / 2.75f); rect->top = ystart - (4.0f / 2.75f); } else { #endif - rect->bottom = (32.0f * Details.scaleY * 0.5f + 2.0f * Details.scaleY) * numLines + ystart + 2.0f; + rect->bottom = (32.0f * CFont::Details.scaleY * 0.5f + 2.0f * CFont::Details.scaleY) * numLines + ystart + 2.0f; rect->top = ystart - 2.0f; #ifdef MORE_LANGUAGES } @@ -869,11 +869,11 @@ CFont::GetTextRect(CRect *rect, float xstart, float ystart, wchar *s) rect->right = xstart + Details.centreSize*0.5f + 4.0f; #ifdef MORE_LANGUAGES if (IsJapaneseFont()) { - rect->bottom = (32.0f * Details.scaleY / 2.75f + 2.0f * Details.scaleY) * numLines + ystart + (4.0f / 2.75f); + rect->bottom = (32.0f * CFont::Details.scaleY / 2.75f + 2.0f * CFont::Details.scaleY) * numLines + ystart + (4.0f / 2.75f); rect->top = ystart - (4.0f / 2.75f); } else { #endif - rect->bottom = (32.0f * Details.scaleY * 0.5f + 2.0f * Details.scaleY) * numLines + ystart + 2.0f; + rect->bottom = (32.0f * CFont::Details.scaleY * 0.5f + 2.0f * CFont::Details.scaleY) * numLines + ystart + 2.0f; rect->top = ystart - 2.0f; #ifdef MORE_LANGUAGES } @@ -886,10 +886,10 @@ CFont::GetTextRect(CRect *rect, float xstart, float ystart, wchar *s) rect->bottom = ystart - 4.0f + 4.0f; #ifdef MORE_LANGUAGES if (IsJapaneseFont()) - rect->top = (32.0f * Details.scaleY / 2.75f + 2.0f * Details.scaleY) * numLines + ystart + 2.0f + (4.0f / 2.75f); + rect->top = (32.0f * CFont::Details.scaleY / 2.75f + 2.0f * CFont::Details.scaleY) * numLines + ystart + 2.0f + (4.0f / 2.75f); else #endif - rect->top = (32.0f * Details.scaleY * 0.5f + 2.0f * Details.scaleY) * numLines + ystart + 2.0f + 2.0f; + rect->top = (32.0f * CFont::Details.scaleY * 0.5f + 2.0f * CFont::Details.scaleY) * numLines + ystart + 2.0f + 2.0f; } } @@ -1315,89 +1315,27 @@ CFont::ParseToken(wchar *s) case 'n': NewLine = 1; break; - case 'b': - Details.color.r = 27; - Details.color.g = 89; - Details.color.b = 130; - Details.anonymous_23 = true; - break; + case 'b': SetColor(CRGBA(27, 89, 130, 255)); Details.anonymous_23 = true; break; case 'f': Details.bFlash = !Details.bFlash; if (!Details.bFlash) Details.color.a = 255; break; - case 'g': - Details.color.r = 255; - Details.color.g = 150; - Details.color.b = 225; - Details.anonymous_23 = true; - break; - case 'h': - Details.color.r = 225; - Details.color.g = 225; - Details.color.b = 225; - Details.anonymous_23 = true; - break; - case 'l': - Details.color.r = 0; - Details.color.g = 0; - Details.color.b = 0; - Details.anonymous_23 = true; - break; - case 'o': - Details.color.r = 229; - Details.color.g = 125; - Details.color.b = 126; - Details.anonymous_23 = true; - break; - case 'p': - Details.color.r = 168; - Details.color.g = 110; - Details.color.b = 252; - Details.anonymous_23 = true; - break; - case 'q': - Details.color.r = 199; - Details.color.g = 144; - Details.color.b = 203; - Details.anonymous_23 = true; - break; - case 'r': - Details.color.r = 255; - Details.color.g = 150; - Details.color.b = 225; - Details.anonymous_23 = true; - break; - case 't': - Details.color.r = 86; - Details.color.g = 212; - Details.color.b = 146; - Details.anonymous_23 = true; - break; - case 'w': - Details.color.r = 175; - Details.color.g = 175; - Details.color.b = 175; - Details.anonymous_23 = true; - break; - case 'x': + case 'g': SetColor(CRGBA(255, 150, 225, 255)); Details.anonymous_23 = true; break; + case 'h': SetColor(CRGBA(225, 225, 225, 255)); Details.anonymous_23 = true; break; + case 'l': SetColor(CRGBA(0, 0, 0, 255)); Details.anonymous_23 = true; break; + case 'o': SetColor(CRGBA(229, 125, 126, 255)); Details.anonymous_23 = true; break; + case 'p': SetColor(CRGBA(168, 110, 252, 255)); Details.anonymous_23 = true; break; + case 'q': SetColor(CRGBA(199, 144, 203, 255)); Details.anonymous_23 = true; break; + case 'r': SetColor(CRGBA(255, 150, 225, 255)); Details.anonymous_23 = true; break; + case 't': SetColor(CRGBA(86, 212, 146, 255)); Details.anonymous_23 = true; break; + case 'w': SetColor(CRGBA(175, 175, 175, 255)); Details.anonymous_23 = true; break; #ifdef FIX_BUGS - Details.color.r = 0; - Details.color.g = 255; - Details.color.b = 255; + case 'x': SetColor(CRGBA(0, 255, 255, 255)); Details.anonymous_23 = true; break; #else - Details.color.r = 132; - Details.color.g = 146; - Details.color.b = 197; + case 'x': SetColor(CRGBA(132, 146, 197, 255)); Details.anonymous_23 = true; break; #endif - Details.anonymous_23 = true; - break; - case 'y': - Details.color.r = 255; - Details.color.g = 227; - Details.color.b = 79; - Details.anonymous_23 = true; - break; + case 'y': SetColor(CRGBA(255, 227, 79, 255)); Details.anonymous_23 = true; break; #ifdef BUTTON_ICONS case 'U': PS2Symbol = BUTTON_UP; break; case 'D': PS2Symbol = BUTTON_DOWN; break; @@ -1604,7 +1542,7 @@ CFont::RenderFontBuffer() if (RenderState.bFontHalfTexture) c = FindNewCharacter(c); else if (c > 155) - c = '\0'; + c = 0; if (RenderState.slant != 0.0f) textPosY = (RenderState.slantRefX - textPosX) * RenderState.slant + RenderState.slantRefY; @@ -1618,7 +1556,7 @@ CFont::RenderFontBuffer() // PS2 uses different chars for some symbols if (!RenderState.bFontHalfTexture && c == 30) c = 61; // wanted star #endif - textPosX += RenderState.scaleX * GetCharacterWidth(c); + textPosX += RenderState.scaleX * (RenderState.proportional ? Size[RenderState.style][c] : Size[RenderState.style][209]); if (c == '\0') textPosX += RenderState.fExtraSpace; } diff --git a/src/render/MBlur.cpp b/src/render/MBlur.cpp index 5abc94b9..f96fedc5 100644 --- a/src/render/MBlur.cpp +++ b/src/render/MBlur.cpp @@ -442,7 +442,7 @@ CMBlur::OverlayRender(RwCamera *cam, RwRaster *raster, RwRGBA color, int32 type, RwIm2DVertexSetIntRGBA(&Vertex2[3], r, g, b, 80); RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA); RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA); - pBufVertCount = 0; + // TODO(MIAMI): pBufVertCount = 0; }else{ RwIm2DVertexSetIntRGBA(&Vertex2[0], r*2, g*2, b*2, 30); RwIm2DVertexSetIntRGBA(&Vertex2[1], r*2, g*2, b*2, 30); diff --git a/src/render/WaterLevel.cpp b/src/render/WaterLevel.cpp index 6247c611..6caac31e 100644 --- a/src/render/WaterLevel.cpp +++ b/src/render/WaterLevel.cpp @@ -113,9 +113,9 @@ float fMinWaterAlphaMult = -30.0f; void -CWaterLevel::Initialise(Const char *pWaterDat) +WaterLevelInitialise(Const char *pWaterDat) { - ms_nNoOfWaterLevels = 0; + CWaterLevel::ms_nNoOfWaterLevels = 0; #ifdef MASTER int32 hFile = -1; @@ -131,11 +131,11 @@ CWaterLevel::Initialise(Const char *pWaterDat) if (hFile > 0) { - CFileMgr::Read(hFile, (char *)&ms_nNoOfWaterLevels, sizeof(ms_nNoOfWaterLevels)); - CFileMgr::Read(hFile, (char *)ms_aWaterZs, sizeof(ms_aWaterZs)); - CFileMgr::Read(hFile, (char *)ms_aWaterRects, sizeof(ms_aWaterRects)); - CFileMgr::Read(hFile, (char *)aWaterBlockList, sizeof(aWaterBlockList)); - CFileMgr::Read(hFile, (char *)aWaterFineBlockList, sizeof(aWaterFineBlockList)); + CFileMgr::Read(hFile, (char *)&CWaterLevel::ms_nNoOfWaterLevels, sizeof(CWaterLevel::ms_nNoOfWaterLevels)); + CFileMgr::Read(hFile, (char *)CWaterLevel::ms_aWaterZs, sizeof(CWaterLevel::ms_aWaterZs)); + CFileMgr::Read(hFile, (char *)CWaterLevel::ms_aWaterRects, sizeof(CWaterLevel::ms_aWaterRects)); + CFileMgr::Read(hFile, (char *)CWaterLevel::aWaterBlockList, sizeof(CWaterLevel::aWaterBlockList)); + CFileMgr::Read(hFile, (char *)CWaterLevel::aWaterFineBlockList, sizeof(CWaterLevel::aWaterFineBlockList)); CFileMgr::CloseFile(hFile); } #ifndef MASTER @@ -157,7 +157,7 @@ CWaterLevel::Initialise(Const char *pWaterDat) { float z, l, b, r, t; sscanf(line, "%f %f %f %f %f", &z, &l, &b, &r, &t); - AddWaterLevel(l, b, r, t, z); + CWaterLevel::AddWaterLevel(l, b, r, t, z); } } @@ -167,17 +167,17 @@ CWaterLevel::Initialise(Const char *pWaterDat) { for (int32 y = 0; y < MAX_SMALL_SECTORS; y++) { - aWaterFineBlockList[x][y] = NO_WATER; + CWaterLevel::aWaterFineBlockList[x][y] = NO_WATER; } } // rasterize water rects read from file - for (int32 i = 0; i < ms_nNoOfWaterLevels; i++) + for (int32 i = 0; i < CWaterLevel::ms_nNoOfWaterLevels; i++) { - int32 l = WATER_HUGE_X(ms_aWaterRects[i].left + WATER_X_OFFSET); - int32 r = WATER_HUGE_X(ms_aWaterRects[i].right + WATER_X_OFFSET) + 1.0f; - int32 t = WATER_HUGE_Y(ms_aWaterRects[i].top); - int32 b = WATER_HUGE_Y(ms_aWaterRects[i].bottom) + 1.0f; + int32 l = WATER_HUGE_X(CWaterLevel::ms_aWaterRects[i].left + WATER_X_OFFSET); + int32 r = WATER_HUGE_X(CWaterLevel::ms_aWaterRects[i].right + WATER_X_OFFSET) + 1.0f; + int32 t = WATER_HUGE_Y(CWaterLevel::ms_aWaterRects[i].top); + int32 b = WATER_HUGE_Y(CWaterLevel::ms_aWaterRects[i].bottom) + 1.0f; l = clamp(l, 0, MAX_SMALL_SECTORS - 1); r = clamp(r, 0, MAX_SMALL_SECTORS - 1); @@ -188,7 +188,7 @@ CWaterLevel::Initialise(Const char *pWaterDat) { for (int32 y = t; y <= b; y++) { - aWaterFineBlockList[x][y] = i; + CWaterLevel::aWaterFineBlockList[x][y] = i; } } } @@ -209,10 +209,10 @@ CWaterLevel::Initialise(Const char *pWaterDat) { for (int32 j = 0; j <= 8; j++) { - CVector worldPos = CVector(worldX + i * (SMALL_SECTOR_SIZE / 8), worldY + j * (SMALL_SECTOR_SIZE / 8), ms_aWaterZs[aWaterFineBlockList[x][y]]); + CVector worldPos = CVector(worldX + i * (SMALL_SECTOR_SIZE / 8), worldY + j * (SMALL_SECTOR_SIZE / 8), CWaterLevel::ms_aWaterZs[CWaterLevel::aWaterFineBlockList[x][y]]); if ((worldPos.x > WORLD_MIN_X && worldPos.x < WORLD_MAX_X) && (worldPos.y > WORLD_MIN_Y && worldPos.y < WORLD_MAX_Y) && - (!WaterLevelAccordingToRectangles(worldPos.x, worldPos.y) || TestVisibilityForFineWaterBlocks(worldPos))) + (!CWaterLevel::WaterLevelAccordingToRectangles(worldPos.x, worldPos.y) || CWaterLevel::TestVisibilityForFineWaterBlocks(worldPos))) continue; // at least one point in the tile wasn't blocked, so don't remove water @@ -222,37 +222,37 @@ CWaterLevel::Initialise(Const char *pWaterDat) } if (i < 1000) - aWaterFineBlockList[x][y] = NO_WATER; + CWaterLevel::aWaterFineBlockList[x][y] = NO_WATER; } } } - RemoveIsolatedWater(); + CWaterLevel::RemoveIsolatedWater(); // calculate coarse tiles from fine tiles for (int32 x = 0; x < MAX_LARGE_SECTORS; x++) { for (int32 y = 0; y < MAX_LARGE_SECTORS; y++) { - if (aWaterFineBlockList[x * 2][y * 2] >= 0) + if (CWaterLevel::aWaterFineBlockList[x * 2][y * 2] >= 0) { - aWaterBlockList[x][y] = aWaterFineBlockList[x * 2][y * 2]; + CWaterLevel::aWaterBlockList[x][y] = CWaterLevel::aWaterFineBlockList[x * 2][y * 2]; } - else if (aWaterFineBlockList[x * 2 + 1][y * 2] >= 0) + else if (CWaterLevel::aWaterFineBlockList[x * 2 + 1][y * 2] >= 0) { - aWaterBlockList[x][y] = aWaterFineBlockList[x * 2 + 1][y * 2]; + CWaterLevel::aWaterBlockList[x][y] = CWaterLevel::aWaterFineBlockList[x * 2 + 1][y * 2]; } - else if (aWaterFineBlockList[x * 2][y * 2 + 1] >= 0) + else if (CWaterLevel::aWaterFineBlockList[x * 2][y * 2 + 1] >= 0) { - aWaterBlockList[x][y] = aWaterFineBlockList[x * 2][y * 2 + 1]; + CWaterLevel::aWaterBlockList[x][y] = CWaterLevel::aWaterFineBlockList[x * 2][y * 2 + 1]; } - else if (aWaterFineBlockList[x * 2 + 1][y * 2 + 1] >= 0) + else if (CWaterLevel::aWaterFineBlockList[x * 2 + 1][y * 2 + 1] >= 0) { - aWaterBlockList[x][y] = aWaterFineBlockList[x * 2 + 1][y * 2 + 1]; + CWaterLevel::aWaterBlockList[x][y] = CWaterLevel::aWaterFineBlockList[x * 2 + 1][y * 2 + 1]; } else { - aWaterBlockList[x][y] = NO_WATER; + CWaterLevel::aWaterBlockList[x][y] = NO_WATER; } } } @@ -261,11 +261,11 @@ CWaterLevel::Initialise(Const char *pWaterDat) if (hFile > 0) { - CFileMgr::Write(hFile, (char *)&ms_nNoOfWaterLevels, sizeof(ms_nNoOfWaterLevels)); - CFileMgr::Write(hFile, (char *)ms_aWaterZs, sizeof(ms_aWaterZs)); - CFileMgr::Write(hFile, (char *)ms_aWaterRects, sizeof(ms_aWaterRects)); - CFileMgr::Write(hFile, (char *)aWaterBlockList, sizeof(aWaterBlockList)); - CFileMgr::Write(hFile, (char *)aWaterFineBlockList, sizeof(aWaterFineBlockList)); + CFileMgr::Write(hFile, (char *)&CWaterLevel::ms_nNoOfWaterLevels, sizeof(CWaterLevel::ms_nNoOfWaterLevels)); + CFileMgr::Write(hFile, (char *)CWaterLevel::ms_aWaterZs, sizeof(CWaterLevel::ms_aWaterZs)); + CFileMgr::Write(hFile, (char *)CWaterLevel::ms_aWaterRects, sizeof(CWaterLevel::ms_aWaterRects)); + CFileMgr::Write(hFile, (char *)CWaterLevel::aWaterBlockList, sizeof(CWaterLevel::aWaterBlockList)); + CFileMgr::Write(hFile, (char *)CWaterLevel::aWaterFineBlockList, sizeof(CWaterLevel::aWaterFineBlockList)); CFileMgr::CloseFile(hFile); } @@ -300,7 +300,7 @@ CWaterLevel::Initialise(Const char *pWaterDat) CTxdStore::PopCurrentTxd(); - CreateWavyAtomic(); + CWaterLevel::CreateWavyAtomic(); printf("Done Initing waterlevels\n"); } diff --git a/src/render/WaterLevel.h b/src/render/WaterLevel.h index d12fb9f6..d0c64eb4 100644 --- a/src/render/WaterLevel.h +++ b/src/render/WaterLevel.h @@ -116,7 +116,6 @@ public: static RpAtomic *ms_pWavyAtomic; static RpAtomic *ms_pMaskAtomic; - static void Initialise(Const char *pWaterDat); // out of class in III PC and later because of SecuROM static void Shutdown(); static void CreateWavyAtomic(); @@ -182,3 +181,5 @@ public: static void HandleBeachToysStuff(void); static CEntity *CreateBeachToy(CVector const &vec, eBeachToy beachtoy); }; + +extern void WaterLevelInitialise(Const char *datFile); \ No newline at end of file diff --git a/src/rw/MemoryMgr.cpp b/src/rw/MemoryMgr.cpp index 2379692c..e2f6f144 100644 --- a/src/rw/MemoryMgr.cpp +++ b/src/rw/MemoryMgr.cpp @@ -93,7 +93,7 @@ MemoryMgrFree(void *ptr) void * RwMallocAlign(RwUInt32 size, RwUInt32 align) { -#if defined (FIX_BUGS) || defined(FIX_BUGS_64) +#ifdef FIX_BUGS uintptr ptralign = align-1; void *mem = (void *)MemoryMgrMalloc(size + sizeof(uintptr) + ptralign); diff --git a/src/rw/RwHelper.cpp b/src/rw/RwHelper.cpp index d80a3904..38a0f613 100644 --- a/src/rw/RwHelper.cpp +++ b/src/rw/RwHelper.cpp @@ -255,8 +255,7 @@ SkinGetBonePositionsToTable(RpClump *clump, RwV3d *boneTable) parent = stack[sp--]; else parent = i; - - //assert(parent >= 0 && parent < numBones); + assert(parent >= 0 && parent < numBones); } } @@ -264,7 +263,7 @@ RpHAnimAnimation* HAnimAnimationCreateForHierarchy(RpHAnimHierarchy *hier) { int i; -#if defined FIX_BUGS || defined LIBRW +#ifdef FIX_BUGS int numNodes = hier->numNodes*2; // you're supposed to have at least two KFs per node #else int numNodes = hier->numNodes; @@ -278,7 +277,7 @@ HAnimAnimationCreateForHierarchy(RpHAnimHierarchy *hier) frame->q.real = 1.0f; frame->q.imag.x = frame->q.imag.y = frame->q.imag.z = 0.0f; frame->t.x = frame->t.y = frame->t.z = 0.0f; -#if defined FIX_BUGS || defined LIBRW +#ifdef FIX_BUGS // times are subtracted and divided giving NaNs // so they can't both be 0 frame->time = i/hier->numNodes; @@ -484,7 +483,7 @@ CameraSize(RwCamera * camera, RwRect * rect, RwRaster *zRaster; // BUG: game just changes camera raster's sizes, but this is a hack -#if defined FIX_BUGS || defined LIBRW +#ifdef FIX_BUGS /* * Destroy rasters... */ diff --git a/src/text/Text.cpp b/src/text/Text.cpp index efb8b2a9..fd1659dc 100644 --- a/src/text/Text.cpp +++ b/src/text/Text.cpp @@ -113,14 +113,14 @@ wchar* CText::Get(const char *key) { uint8 result = false; -#if defined (FIX_BUGS) || defined(FIX_BUGS_64) +#ifdef FIX_BUGS wchar *outstr = keyArray.Search(key, data.chars, &result); #else wchar *outstr = keyArray.Search(key, &result); #endif if (!result && bHasMissionTextOffsets && bIsMissionTextLoaded) -#if defined (FIX_BUGS) || defined(FIX_BUGS_64) +#ifdef FIX_BUGS outstr = mission_keyArray.Search(key, mission_data.chars, &result); #else outstr = mission_keyArray.Search(key, &result); @@ -347,7 +347,7 @@ CKeyArray::Unload(void) void CKeyArray::Update(wchar *chars) { -#if !defined(FIX_BUGS) && !defined(FIX_BUGS_64) +#ifndef FIX_BUGS int i; for(i = 0; i < numEntries; i++) entries[i].value = (wchar*)((uint8*)chars + (uintptr)entries[i].value); @@ -375,7 +375,7 @@ CKeyArray::BinarySearch(const char *key, CKeyEntry *entries, int16 low, int16 hi } wchar* -#if defined (FIX_BUGS) || defined(FIX_BUGS_64) +#ifdef FIX_BUGS CKeyArray::Search(const char *key, wchar *data, uint8 *result) #else CKeyArray::Search(const char *key, uint8 *result) @@ -385,7 +385,7 @@ CKeyArray::Search(const char *key, uint8 *result) char errstr[25]; int i; -#if defined (FIX_BUGS) || defined(FIX_BUGS_64) +#ifdef FIX_BUGS found = BinarySearch(key, entries, 0, numEntries-1); if (found) { *result = true; diff --git a/src/text/Text.h b/src/text/Text.h index 05387346..3e11ea46 100644 --- a/src/text/Text.h +++ b/src/text/Text.h @@ -7,7 +7,7 @@ void TextCopy(wchar *dst, const wchar *src); struct CKeyEntry { -#if defined(FIX_BUGS) || defined(FIX_BUGS_64) +#ifdef FIX_BUGS uint32 valueOffset; #else wchar *value; @@ -30,7 +30,7 @@ public: void Unload(void); void Update(wchar *chars); CKeyEntry *BinarySearch(const char *key, CKeyEntry *entries, int16 low, int16 high); -#if defined (FIX_BUGS) || defined(FIX_BUGS_64) +#ifdef FIX_BUGS wchar *Search(const char *key, wchar *data, uint8 *result); #else wchar *Search(const char *key, uint8* result); diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index d54c2291..6f00a2ea 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -5824,7 +5824,7 @@ CAutomobile::KnockPedOutCar(eWeaponType weapon, uint16 door, CPed *ped) if(ped == nil) return; - ped->m_vehDoor = door; + ped->m_vehEnterType = door; ped->SetPedState(PED_IDLE); CAnimManager::BlendAnimation(ped->GetClump(), ped->m_animGroup, ANIM_IDLE_STANCE, 100.0f); CPed::PedSetOutCarCB(nil, ped); diff --git a/src/vehicles/Bike.cpp b/src/vehicles/Bike.cpp index 293cf58e..bb613617 100644 --- a/src/vehicles/Bike.cpp +++ b/src/vehicles/Bike.cpp @@ -2609,7 +2609,7 @@ CBike::KnockOffRider(eWeaponType weapon, uint8 direction, CPed *ped, bool bGetBa ped->SetPedState(PED_IDLE); CAnimManager::BlendAnimation(ped->GetClump(), ped->m_animGroup, ANIM_IDLE_STANCE, 100.0f); - ped->m_vehDoor = CAR_DOOR_LF; + ped->m_vehEnterType = CAR_DOOR_LF; CPed::PedSetOutCarCB(nil, ped); ped->SetMoveState(PEDMOVE_STILL); if(GetUp().z < 0.0f) diff --git a/src/vehicles/Cranes.h b/src/vehicles/Cranes.h index e842ed3f..162f9af9 100644 --- a/src/vehicles/Cranes.h +++ b/src/vehicles/Cranes.h @@ -88,7 +88,7 @@ public: static bool IsThisCarBeingCarriedByAnyCrane(CVehicle* pVehicle); static bool IsThisCarBeingTargettedByAnyCrane(CVehicle* pVehicle); static void Save(uint8* buf, uint32* size); - static void Load(uint8* buf, uint32 size); // out of class in III PC and later because of SecuROM + static void Load(uint8* buf, uint32 size); // on mobile it's CranesLoad outside of the class static uint32 CarsCollectedMilitaryCrane; static int32 NumCranes; diff --git a/src/vehicles/Heli.cpp b/src/vehicles/Heli.cpp index 1c1b2617..644fdde8 100644 --- a/src/vehicles/Heli.cpp +++ b/src/vehicles/Heli.cpp @@ -762,7 +762,7 @@ CHeli::InitHelis(void) } CHeli* -CHeli::GenerateHeli(bool catalina) +GenerateHeli(bool catalina) { CHeli *heli; CVector heliPos; @@ -800,7 +800,7 @@ CHeli::GenerateHeli(bool catalina) id++; found = true; for(i = 0; i < 4; i++) - if(pHelis[i] && pHelis[i]->m_nHeliId == id) + if(CHeli::pHelis[i] && CHeli::pHelis[i]->m_nHeliId == id) found = false; } heli->m_nHeliId = id; diff --git a/src/vehicles/Heli.h b/src/vehicles/Heli.h index c5ae08e2..1f372e42 100644 --- a/src/vehicles/Heli.h +++ b/src/vehicles/Heli.h @@ -83,14 +83,13 @@ public: bool SendDownSwat(void); static void InitHelis(void); - static CHeli *GenerateHeli(bool catalina); // out of class in III PC and later because of SecuROM static void UpdateHelis(void); static void SpecialHeliPreRender(void); static bool TestRocketCollision(CVector *coors); static bool TestBulletCollision(CVector *line0, CVector *line1, CVector *bulletPos, int32 damage); static bool TestSniperCollision(CVector *line0, CVector *line1); - static void StartCatalinaFlyBy(void); // out of class in III PC and later because of SecuROM + static void StartCatalinaFlyBy(void); static void RemoveCatalinaHeli(void); static CHeli *FindPointerToCatalinasHeli(void); static void CatalinaTakeOff(void); diff --git a/src/vehicles/Train.cpp b/src/vehicles/Train.cpp index 55be4a20..fefe1781 100644 --- a/src/vehicles/Train.cpp +++ b/src/vehicles/Train.cpp @@ -388,7 +388,7 @@ void CTrain::AddPassenger(CPed *ped) { #ifdef GTA_TRAIN - int i = ped->m_vehDoor; + int i = ped->m_vehEnterType; if((i == TRAIN_POS_LEFT_ENTRY || i == TRAIN_POS_MID_ENTRY || i == TRAIN_POS_RIGHT_ENTRY) && pPassengers[i] == nil){ pPassengers[i] = ped; m_nNumPassengers++; diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp index 145611b1..e1e00667 100644 --- a/src/vehicles/Vehicle.cpp +++ b/src/vehicles/Vehicle.cpp @@ -1430,13 +1430,13 @@ CVehicle::ShufflePassengersToMakeSpace(void) if (!pPassengers[2] && !(m_nGettingInFlags & CAR_DOOR_FLAG_RR)) { pPassengers[2] = pPassengers[1]; pPassengers[1] = nil; - pPassengers[2]->m_vehDoor = CAR_DOOR_RR; + pPassengers[2]->m_vehEnterType = CAR_DOOR_RR; return true; } if (!pPassengers[0] && !(m_nGettingInFlags & CAR_DOOR_FLAG_RF)) { pPassengers[0] = pPassengers[1]; pPassengers[1] = nil; - pPassengers[0]->m_vehDoor = CAR_DOOR_RF; + pPassengers[0]->m_vehEnterType = CAR_DOOR_RF; return true; } return false; @@ -1447,13 +1447,13 @@ CVehicle::ShufflePassengersToMakeSpace(void) if (!pPassengers[1] && !(m_nGettingInFlags & CAR_DOOR_FLAG_LR)) { pPassengers[1] = pPassengers[2]; pPassengers[2] = nil; - pPassengers[1]->m_vehDoor = CAR_DOOR_LR; + pPassengers[1]->m_vehEnterType = CAR_DOOR_LR; return true; } if (!pPassengers[0] && !(m_nGettingInFlags & CAR_DOOR_FLAG_RF)) { pPassengers[0] = pPassengers[2]; pPassengers[2] = nil; - pPassengers[0]->m_vehDoor = CAR_DOOR_RF; + pPassengers[0]->m_vehEnterType = CAR_DOOR_RF; return true; } return false; @@ -1464,13 +1464,13 @@ CVehicle::ShufflePassengersToMakeSpace(void) if (!pPassengers[1] && !(m_nGettingInFlags & CAR_DOOR_FLAG_LR)) { pPassengers[1] = pPassengers[0]; pPassengers[0] = nil; - pPassengers[1]->m_vehDoor = CAR_DOOR_LR; + pPassengers[1]->m_vehEnterType = CAR_DOOR_LR; return true; } if (!pPassengers[2] && !(m_nGettingInFlags & CAR_DOOR_FLAG_RR)) { pPassengers[2] = pPassengers[0]; pPassengers[0] = nil; - pPassengers[2]->m_vehDoor = CAR_DOOR_RR; + pPassengers[2]->m_vehEnterType = CAR_DOOR_RR; return true; } return false; From 8baa104453db38734a3eb9e9ff511389d0e72506 Mon Sep 17 00:00:00 2001 From: Fire-Head Date: Wed, 13 Jan 2021 23:17:53 +0300 Subject: [PATCH 5/7] Revert "Revert "Merge branch 'lcs' of https://github.com/GTAmodding/re3 into lcs"" This reverts commit 97c9a4a02c9f801d35fbcf47658756a89a33f6d9. --- CMakeLists.txt | 94 +++++++--- README.md | 11 +- cmake/FindMPG123.cmake | 28 --- cmake/FindSndFile.cmake | 84 ++++----- cmake/Findmpg123.cmake | 38 ++++ premake5.lua | 6 +- src/CMakeLists.txt | 174 +++++++++--------- src/animation/AnimBlendClumpData.cpp | 2 +- src/animation/AnimBlendClumpData.h | 6 +- src/animation/FrameUpdate.cpp | 42 ++--- src/animation/RpAnimBlend.cpp | 2 +- src/control/Replay.cpp | 20 +-- src/control/Replay.h | 6 +- src/control/Script4.cpp | 16 +- src/core/Camera.cpp | 2 +- src/core/Game.cpp | 2 +- src/core/PlayerInfo.cpp | 4 +- src/core/config.h | 6 +- src/core/main.cpp | 4 + src/entities/Physical.cpp | 37 +++- src/objects/CutsceneObject.cpp | 2 +- src/peds/Ped.cpp | 150 ++++++++-------- src/peds/Ped.h | 6 +- src/peds/PedAI.cpp | 252 +++++++++++++-------------- src/peds/PedFight.cpp | 12 +- src/render/Font.cpp | 122 +++++++++---- src/render/MBlur.cpp | 2 +- src/render/WaterLevel.cpp | 68 ++++---- src/render/WaterLevel.h | 3 +- src/rw/MemoryMgr.cpp | 2 +- src/rw/RwHelper.cpp | 9 +- src/text/Text.cpp | 10 +- src/text/Text.h | 4 +- src/vehicles/Automobile.cpp | 2 +- src/vehicles/Bike.cpp | 2 +- src/vehicles/Cranes.h | 2 +- src/vehicles/Heli.cpp | 4 +- src/vehicles/Heli.h | 3 +- src/vehicles/Train.cpp | 2 +- src/vehicles/Vehicle.cpp | 12 +- 40 files changed, 709 insertions(+), 544 deletions(-) delete mode 100644 cmake/FindMPG123.cmake create mode 100644 cmake/Findmpg123.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 387400b3..116d8455 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,44 +1,82 @@ cmake_minimum_required(VERSION 3.8) -project(reVC C CXX) +set(EXECUTABLE reLCS) +set(PROJECT RELCS) + +project(${EXECUTABLE} C CXX) list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") if(WIN32) - set(REVC_AUDIOS "NULL" "OAL" "MSS") + set(${PROJECT}_AUDIOS "OAL" "MSS") else() - set(REVC_AUDIOS "NULL" "OAL") + set(${PROJECT}_AUDIOS "OAL") endif() -set(REVC_AUDIO "OAL" CACHE STRING "Audio") +set(${PROJECT}_AUDIO "OAL" CACHE STRING "Audio") -set_property(CACHE REVC_AUDIO PROPERTY STRINGS ${REVC_AUDIOS}) -message(STATUS "REVC_AUDIO = ${REVC_AUDIO} (choices=${REVC_AUDIOS})") -set("REVC_AUDIO_${REVC_AUDIO}" ON) -if(NOT REVC_AUDIO IN_LIST REVC_AUDIOS) - message(FATAL_ERROR "Illegal REVC_AUDIO=${REVC_AUDIO}") +option(${PROJECT}_WITH_OPUS "Build ${EXECUTABLE} with opus support" OFF) +option(${PROJECT}_WITH_LIBSNDFILE "Build ${EXECUTABLE} with libsndfile (instead of internal decoder)" OFF) + +set_property(CACHE ${PROJECT}_AUDIO PROPERTY STRINGS ${${PROJECT}_AUDIOS}) +message(STATUS "${PROJECT}_AUDIO = ${${PROJECT}_AUDIO} (choices=${${PROJECT}_AUDIOS})") +set("${PROJECT}_AUDIO_${${PROJECT}_AUDIO}" ON) +if(NOT ${PROJECT}_AUDIO IN_LIST ${PROJECT}_AUDIOS) + message(FATAL_ERROR "Illegal ${PROJECT}_AUDIO=${${PROJECT}_AUDIO}") endif() -if(REVC_INSTALL) - include(GNUInstallDirs) - set(REVC_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}/reVC") +option(${PROJECT}_VENDORED_LIBRW "Use vendored librw" ON) +if(${PROJECT}_VENDORED_LIBRW) + add_subdirectory(vendor/librw) +else() + find_package(librw REQUIRED) endif() - -add_subdirectory("vendor/librw") add_subdirectory(src) -if(REVC_INSTALL) - include(CMakePackageConfigHelpers) - configure_package_config_file(reVC-config.cmake.in reVC-config.cmake - INSTALL_DESTINATION "${CMAKE_INSTALL_PREFIX}" - ) - install( - FILES "${CMAKE_CURRENT_BINARY_DIR}/reVC-config.cmake" - DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" - ) - install( - EXPORT reVC-targets - DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" - ) +if(${PROJECT}_INSTALL) + install(DIRECTORY gamefiles/ DESTINATION ".") + if(LIBRW_PLATFORM_NULL) + set(platform "-null") + elseif(LIBRW_PLATFORM_PS2) + set(platform "-ps2") + elseif(LIBRW_PLATFORM_GL3) + if(LIBRW_GL3_GFXLIB STREQUAL "GLFW") + set(platform "-gl3-glfw") + else() + set(platform "-gl3-sdl2") + endif() + elseif(LIBRW_PLATFORM_D3D9) + set(platform "-d3d9") + endif() + if(${PROJECT}_AUDIO_OAL) + set(audio "-oal") + elseif(${PROJECT}_AUDIO_MSS) + set(audio "-mss") + endif() + if(${PROJECT}_WITH_OPUS) + set(audio "${audio}-opus") + endif() + if(NOT LIBRW_PLATFORM_PS2) + if(WIN32) + set(os "-win") + elseif(APPLE) + set(os "-apple") + elseif(UNIX) + set(os "-linux") + else() + set(compiler "-UNK") + message(WARNING "Unknown os. Created cpack package will be wrong. (override using cpack -P)") + endif() + endif() - include(CMakeCPack.cmake) + set(CPACK_PACKAGE_NAME "${PROJECT_NAME}${platform}${audio}${os}${compiler}") + set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "GTA III reversed") + set(CPACK_PACKAGE_VENDOR "GTAModding") + # FIXME: missing license (https://github.com/GTAmodding/re3/issues/794) + # set(CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_SOURCE_DIR}/LICENSE") + # set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE") + set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}") + set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}") + set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}") + set(CPACK_GENERATOR "TXZ") + include(CPack) endif() diff --git a/README.md b/README.md index af559e1e..162f965d 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,13 @@ There are various settings at the very bottom of [config.h](https://github.com/G ## Contributing Please read the [Coding Style](https://github.com/GTAmodding/re3/blob/master/CODING_STYLE.md) Document -### Unreversed / incomplete classes (at least the ones we know) -See [VC todo list](https://github.com/GTAmodding/re3/wiki/VC-todo) +### Unreversed / incomplete classes + +PS2/Mobile stuff: + + src/core/Pad.cpp + src/core/main.cpp + src/core/Frontend_PS2.cpp + src/core/FrontEndControls.cpp + src/save/MemoryCard.cpp diff --git a/cmake/FindMPG123.cmake b/cmake/FindMPG123.cmake deleted file mode 100644 index a9b6dd8b..00000000 --- a/cmake/FindMPG123.cmake +++ /dev/null @@ -1,28 +0,0 @@ -# - Find mpg123 -# Find the native mpg123 includes and library -# -# MPG123_INCLUDE_DIR - where to find mpg123.h -# MPG123_LIBRARIES - List of libraries when using mpg123. -# MPG123_FOUND - True if mpg123 found. - -IF(MPG123_INCLUDE_DIR AND MPG123_LIBRARIES) - # Already in cache, be silent - SET(MPG123_FIND_QUIETLY TRUE) -ENDIF(MPG123_INCLUDE_DIR AND MPG123_LIBRARIES) - -FIND_PATH(MPG123_INCLUDE_DIR mpg123.h - PATHS "${MPG123_DIR}" - PATH_SUFFIXES include - ) - -FIND_LIBRARY(MPG123_LIBRARIES NAMES mpg123 mpg123-0 - PATHS "${MPG123_DIR}" - PATH_SUFFIXES lib - ) - -# MARK_AS_ADVANCED(MPG123_LIBRARIES MPG123_INCLUDE_DIR) - -# handle the QUIETLY and REQUIRED arguments and set MPG123_FOUND to TRUE if -# all listed variables are TRUE -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(MPG123 DEFAULT_MSG MPG123_LIBRARIES MPG123_INCLUDE_DIR) diff --git a/cmake/FindSndFile.cmake b/cmake/FindSndFile.cmake index 8ae47b70..5381af48 100644 --- a/cmake/FindSndFile.cmake +++ b/cmake/FindSndFile.cmake @@ -4,9 +4,11 @@ # # Once done this will define # -# SNDFILE_FOUND - system has libsndfile +# SNDFILE_FOUND - system has libsndfile # SNDFILE_INCLUDE_DIRS - the libsndfile include directory -# SNDFILE_LIBRARIES - Link these to use libsndfile +# SNDFILE_LIBRARIES - Link these to use libsndfile +# SNDFILE_CFLAGS - Compile options to use libsndfile +# SndFile::SndFile - Imported library of libsndfile # # Copyright (C) 2006 Wengo # @@ -15,53 +17,51 @@ # For details see the accompanying COPYING-CMAKE-SCRIPTS file. # -if (SNDFILE_LIBRARIES AND SNDFILE_INCLUDE_DIRS) - # in cache already - set(SNDFILE_FOUND TRUE) -else (SNDFILE_LIBRARIES AND SNDFILE_INCLUDE_DIRS) +find_package(PkgConfig QUIET) +if(PKG_CONFIG_FOUND) + pkg_search_module(PKG_SNDFILE "sndfile") +endif() - find_path(SNDFILE_INCLUDE_DIR +find_path(SNDFILE_INCLUDE_DIR NAMES - sndfile.h + sndfile.h + HINTS + ${PKG_SNDFILE_INCLUDE_DIRS} PATHS - /usr/include - /usr/local/include - /opt/local/include - /sw/include - ) - - find_library(SNDFILE_LIBRARY + /usr/include + /usr/local/include + /opt/local/include + /sw/include + ) + +find_library(SNDFILE_LIBRARY NAMES - sndfile + sndfile + HINTS + ${PKG_SNDFILE_LIBRARIES} PATHS - /usr/lib - /usr/local/lib - /opt/local/lib - /sw/lib - ) + /usr/lib + /usr/local/lib + /opt/local/lib + /sw/lib +) - set(SNDFILE_INCLUDE_DIRS - ${SNDFILE_INCLUDE_DIR} - ) - set(SNDFILE_LIBRARIES - ${SNDFILE_LIBRARY} - ) +set(SNDFILE_CFLAGS "${PKG_SNDFILE_CFLAGS_OTHER}" CACHE STRING "CFLAGS of libsndfile") - if (SNDFILE_INCLUDE_DIRS AND SNDFILE_LIBRARIES) +set(SNDFILE_INCLUDE_DIRS "${SNDFILE_INCLUDE_DIR}") +set(SNDFILE_LIBRARIES "${SNDFILE_LIBRARY}") + +if(SNDFILE_INCLUDE_DIRS AND SNDFILE_LIBRARIES) set(SNDFILE_FOUND TRUE) - endif (SNDFILE_INCLUDE_DIRS AND SNDFILE_LIBRARIES) +endif() - if (SNDFILE_FOUND) - if (NOT SndFile_FIND_QUIETLY) - message(STATUS "Found libsndfile: ${SNDFILE_LIBRARIES}") - endif (NOT SndFile_FIND_QUIETLY) - else (SNDFILE_FOUND) - if (SndFile_FIND_REQUIRED) - message(FATAL_ERROR "Could not find libsndfile") - endif (SndFile_FIND_REQUIRED) - endif (SNDFILE_FOUND) +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(SndFile DEFAULT_MSG SNDFILE_INCLUDE_DIRS SNDFILE_LIBRARIES) - # show the SNDFILE_INCLUDE_DIRS and SNDFILE_LIBRARIES variables only in the advanced view - mark_as_advanced(SNDFILE_INCLUDE_DIRS SNDFILE_LIBRARIES) - -endif (SNDFILE_LIBRARIES AND SNDFILE_INCLUDE_DIRS) +if(NOT TARGET SndFile::SndFile) + add_library(__SndFile INTERFACE) + target_compile_options(__SndFile INTERFACE ${SNDFILE_CFLAGS}) + target_include_directories(__SndFile INTERFACE ${SNDFILE_INCLUDE_DIRS}) + target_link_libraries(__SndFile INTERFACE ${SNDFILE_LIBRARIES}) + add_library(SndFile::SndFile ALIAS __SndFile) +endif() diff --git a/cmake/Findmpg123.cmake b/cmake/Findmpg123.cmake new file mode 100644 index 00000000..c6fe56bb --- /dev/null +++ b/cmake/Findmpg123.cmake @@ -0,0 +1,38 @@ +# - Find mpg123 +# Find the native mpg123 includes and library +# +# mpg123_INCLUDE_DIR - Where to find mpg123.h +# mpg123_LIBRARIES - List of libraries when using mpg123. +# mpg123_CFLAGS - Compile options to use mpg123 +# mpg123_FOUND - True if mpg123 found. +# MPG123::libmpg123 - Imported library of libmpg123 + +find_package(PkgConfig QUIET) +if(PKG_CONFIG_FOUND) + pkg_search_module(PKG_MPG123 mpg123) +endif() + +find_path(mpg123_INCLUDE_DIR mpg123.h + HINTS ${PKG_MPG123_INCLUDE_DIRS} + PATHS "${mpg123_DIR}" + PATH_SUFFIXES include +) + +find_library(mpg123_LIBRARIES NAMES mpg123 mpg123-0 + HINTS ${PKG_MPG123_LIBRARIES} + PATHS "${mpg123_DIR}" + PATH_SUFFIXES lib +) + +set(mpg123_CFLAGS "${PKG_MPG123_CFLAGS_OTHER}" CACHE STRING "CFLAGS of mpg123") + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(mpg123 DEFAULT_MSG mpg123_LIBRARIES mpg123_INCLUDE_DIR) + +if(NOT TARGET MPG123::libmpg123) + add_library(__libmpg123 INTERFACE) + target_compile_options(__libmpg123 INTERFACE ${mpg123_CFLAGS}) + target_include_directories(__libmpg123 INTERFACE ${mpg123_INCLUDE_DIR}) + target_link_libraries(__libmpg123 INTERFACE ${mpg123_LIBRARIES}) + add_library(MPG123::libmpg123 ALIAS __libmpg123) +endif() diff --git a/premake5.lua b/premake5.lua index 6c26732c..11a0bbbd 100644 --- a/premake5.lua +++ b/premake5.lua @@ -172,11 +172,10 @@ workspace "reLCS" filter {} - function setpaths (gamepath, exepath, scriptspath) - scriptspath = scriptspath or "" + function setpaths (gamepath, exepath) if (gamepath) then postbuildcommands { - '{COPYFILE} "%{cfg.buildtarget.abspath}" "' .. gamepath .. scriptspath .. '%{cfg.buildtarget.name}"' + '{COPYFILE} "%{cfg.buildtarget.abspath}" "' .. gamepath .. '%{cfg.buildtarget.name}"' } debugdir (gamepath) if (exepath) then @@ -186,7 +185,6 @@ workspace "reLCS" debugdir (gamepath .. (dir or "")) end end - --targetdir ("bin/%{prj.name}/" .. scriptspath) end if(_OPTIONS["with-librw"]) then diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e87878a8..dc204d17 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,92 +1,105 @@ set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) -if(${REVC_AUDIO} STREQUAL "OAL") - find_package(OpenAL REQUIRED) - find_package(MPG123 REQUIRED) - find_package(SndFile REQUIRED) -endif() +file(GLOB_RECURSE ${PROJECT}_SOURCES "*.cpp" "*.h" "*.rc") -file(GLOB_RECURSE Sources "*.cpp" "*.h") +function(header_directories RETURN_LIST) + file(GLOB_RECURSE ALL_SRCS *.h *.cpp *.c) + set(RELDIRS) + foreach(SRC ${ALL_SRCS}) + file(RELATIVE_PATH RELSRC "${CMAKE_CURRENT_SOURCE_DIR}" "${SRC}") + get_filename_component(RELDIR "${RELSRC}" DIRECTORY) + list(APPEND RELDIRS ${RELDIR}) + endforeach() + list(REMOVE_DUPLICATES RELDIRS) + set(${RETURN_LIST} ${RELDIRS} PARENT_SCOPE) +endfunction() -MACRO(HEADER_DIRECTORIES return_list) - FILE(GLOB_RECURSE new_list *.cpp) - SET(dir_list "animation" - "audio" - "collision" - "control" - "core" - "entities" - "extras" - "fakerw" - "math" - "modelinfo" - "objects" - "peds" - "render" - "rw" - "save" - "skel" - "text" - "vehicles" - "weapons") - FOREACH(file_path ${new_list}) - GET_FILENAME_COMPONENT(dir_path ${file_path} PATH) - SET(dir_list ${dir_list} ${dir_path}) - ENDFOREACH() - LIST(REMOVE_DUPLICATES dir_list) - SET(${return_list} ${dir_list}) -ENDMACRO() +header_directories(${PROJECT}_INCLUDES) -HEADER_DIRECTORIES(header_list) -include_directories(${header_list}) +add_executable(${EXECUTABLE} WIN32 + ${${PROJECT}_SOURCES} +) +target_link_libraries(${EXECUTABLE} PRIVATE + librw::librw + Threads::Threads +) -add_executable(reVC ${Sources}) -target_link_libraries(reVC librw) -target_link_libraries(reVC Threads::Threads) - -if(${REVC_AUDIO} STREQUAL "OAL") - target_link_libraries(reVC ${OPENAL_LIBRARY}) - target_link_libraries(reVC ${MPG123_LIBRARIES}) - target_link_libraries(reVC ${SNDFILE_LIBRARIES}) -endif() - -target_include_directories(reVC - INTERFACE - $ - ) - -target_compile_definitions(reVC +target_include_directories(${EXECUTABLE} PRIVATE - "$,DEBUG,NDEBUG>" - PUBLIC - "RW_${REVC_PLATFORM}" - ) + $ + $ +) -target_compile_definitions(reVC PRIVATE LIBRW=1 AUDIO_OAL=1) +target_compile_definitions(${EXECUTABLE} + PRIVATE + $,DEBUG,NDEBUG> + LIBRW + ${PROJECT}_NO_AUTOLINK +) + +if(LIBRW_PLATFORM_D3D9) + target_compile_definitions(${EXECUTABLE} + PUBLIC + USE_D3D9 + ) +endif() + +if(${PROJECT}_AUDIO STREQUAL "OAL") + find_package(OpenAL REQUIRED) + target_include_directories(${EXECUTABLE} PRIVATE ${OPENAL_INCLUDE_DIR}) + target_link_libraries(${EXECUTABLE} PRIVATE ${OPENAL_LIBRARY}) + target_compile_definitions(${EXECUTABLE} PRIVATE ${OPENAL_DEFINITIONS}) + target_compile_definitions(${EXECUTABLE} PRIVATE AUDIO_OAL) +elseif(${PROJECT}_AUDIO STREQUAL "MSS") + find_package(MilesSDK REQUIRED) + target_compile_definitions(${EXECUTABLE} PRIVATE AUDIO_MSS) + target_link_libraries(${EXECUTABLE} PRIVATE MilesSDK::MilesSDK) +endif() + +find_package(mpg123 REQUIRED) +target_link_libraries(${EXECUTABLE} PRIVATE + MPG123::libmpg123 +) +if(${PROJECT}_WITH_OPUS) + find_package(opusfile REQUIRED) + target_link_libraries(${EXECUTABLE} PRIVATE + opusfile::opusfile + ) + target_compile_definitions(${EXECUTABLE} PRIVATE AUDIO_OPUS) +endif() +if(${PROJECT}_WITH_LIBSNDFILE) + find_package(SndFile REQUIRED) + target_link_libraries(${EXECUTABLE} PRIVATE + SndFile::SndFile + ) + target_compile_definitions(${EXECUTABLE} PRIVATE AUDIO_OAL_USE_SNDFILE) +endif() + +target_compile_definitions(${EXECUTABLE} PRIVATE ) if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") - target_compile_options(reVC + target_compile_options(${EXECUTABLE} PRIVATE "-Wall" - ) - if (NOT REVC_PLATFORM_PS2) - target_compile_options(reVC + ) + if (NOT LIBRW_PLATFORM_PS2) + target_compile_options(${EXECUTABLE} PRIVATE - "-Wextra" - "-Wdouble-promotion" - "-Wpedantic" - ) + -Wextra + -Wdouble-promotion + -Wpedantic + ) endif() elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") - target_compile_options(reVC + target_compile_options(${EXECUTABLE} PUBLIC - /wd4996 /wd4244 - ) + /Zc:sizedDealloc- + ) endif() -set_target_properties(reVC +set_target_properties(${EXECUTABLE} PROPERTIES C_STANDARD 11 C_EXTENSIONS OFF @@ -94,20 +107,15 @@ set_target_properties(reVC CXX_STANDARD 11 CXX_EXTENSIONS OFF CXX_STANDARD_REQUIRED ON - PREFIX "" - ) - -if(REVC_INSTALL) - target_include_directories(reVC - INTERFACE - $ - ) +) +if(${PROJECT}_INSTALL) install( - TARGETS reVC - EXPORT reVC-targets - RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" - LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" - ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" - ) + TARGETS ${EXECUTABLE} + EXPORT ${EXECUTABLE}-targets + RUNTIME DESTINATION "." + ) + if(MSVC) + install(FILES $ DESTINATION "." OPTIONAL) + endif() endif() diff --git a/src/animation/AnimBlendClumpData.cpp b/src/animation/AnimBlendClumpData.cpp index 4e8f3153..620c2229 100644 --- a/src/animation/AnimBlendClumpData.cpp +++ b/src/animation/AnimBlendClumpData.cpp @@ -8,7 +8,7 @@ CAnimBlendClumpData::CAnimBlendClumpData(void) { numFrames = 0; - velocity = nil; + velocity2d = nil; frames = nil; link.Init(); } diff --git a/src/animation/AnimBlendClumpData.h b/src/animation/AnimBlendClumpData.h index 633fc7b9..bb711b28 100644 --- a/src/animation/AnimBlendClumpData.h +++ b/src/animation/AnimBlendClumpData.h @@ -3,7 +3,6 @@ #include "AnimBlendList.h" -// TODO: put somewhere else struct AnimBlendFrameData { enum { @@ -31,7 +30,10 @@ class CAnimBlendClumpData public: CAnimBlendLink link; int32 numFrames; - CVector *velocity; + union { + CVector2D *velocity2d; + CVector *velocity3d; + }; // order of frames is determined by RW hierarchy AnimBlendFrameData *frames; diff --git a/src/animation/FrameUpdate.cpp b/src/animation/FrameUpdate.cpp index a085fd4b..e35bd4c8 100644 --- a/src/animation/FrameUpdate.cpp +++ b/src/animation/FrameUpdate.cpp @@ -33,7 +33,7 @@ FrameUpdateCallBackNonSkinned(AnimBlendFrameData *frame, void *arg) AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg; if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION && - gpAnimBlendClump->velocity){ + gpAnimBlendClump->velocity2d){ if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION_3D) FrameUpdateCallBackWith3dVelocityExtractionNonSkinned(frame, arg); else @@ -142,11 +142,11 @@ FrameUpdateCallBackWithVelocityExtractionNonSkinned(AnimBlendFrameData *frame, v } if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){ - gpAnimBlendClump->velocity->x = transx - curx; - gpAnimBlendClump->velocity->y = transy - cury; + gpAnimBlendClump->velocity2d->x = transx - curx; + gpAnimBlendClump->velocity2d->y = transy - cury; if(looped){ - gpAnimBlendClump->velocity->x += endx; - gpAnimBlendClump->velocity->y += endy; + gpAnimBlendClump->velocity2d->x += endx; + gpAnimBlendClump->velocity2d->y += endy; } mat->pos.x = pos.x - transx; mat->pos.y = pos.y - transy; @@ -222,9 +222,9 @@ FrameUpdateCallBackWith3dVelocityExtractionNonSkinned(AnimBlendFrameData *frame, } if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){ - *gpAnimBlendClump->velocity = trans - cur; + *gpAnimBlendClump->velocity3d = trans - cur; if(looped) - *gpAnimBlendClump->velocity += end; + *gpAnimBlendClump->velocity3d += end; mat->pos.x = (pos - trans).x + frame->resetPos.x; mat->pos.y = (pos - trans).y + frame->resetPos.y; mat->pos.z = (pos - trans).z + frame->resetPos.z; @@ -244,7 +244,7 @@ FrameUpdateCallBackSkinned(AnimBlendFrameData *frame, void *arg) AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg; if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION && - gpAnimBlendClump->velocity){ + gpAnimBlendClump->velocity2d){ if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION_3D) FrameUpdateCallBackWith3dVelocityExtractionSkinned(frame, arg); else @@ -354,11 +354,11 @@ FrameUpdateCallBackWithVelocityExtractionSkinned(AnimBlendFrameData *frame, void } if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){ - gpAnimBlendClump->velocity->x = transx - curx; - gpAnimBlendClump->velocity->y = transy - cury; + gpAnimBlendClump->velocity2d->x = transx - curx; + gpAnimBlendClump->velocity2d->y = transy - cury; if(looped){ - gpAnimBlendClump->velocity->x += endx; - gpAnimBlendClump->velocity->y += endy; + gpAnimBlendClump->velocity2d->x += endx; + gpAnimBlendClump->velocity2d->y += endy; } xform->t.x = pos.x - transx; xform->t.y = pos.y - transy; @@ -434,9 +434,9 @@ FrameUpdateCallBackWith3dVelocityExtractionSkinned(AnimBlendFrameData *frame, vo } if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){ - *gpAnimBlendClump->velocity = trans - cur; + *gpAnimBlendClump->velocity3d = trans - cur; if(looped) - *gpAnimBlendClump->velocity += end; + *gpAnimBlendClump->velocity3d += end; xform->t.x = (pos - trans).x + frame->resetPos.x; xform->t.y = (pos - trans).y + frame->resetPos.y; xform->t.z = (pos - trans).z + frame->resetPos.z; @@ -446,7 +446,7 @@ FrameUpdateCallBackWith3dVelocityExtractionSkinned(AnimBlendFrameData *frame, vo void FrameUpdateCallBackOffscreen(AnimBlendFrameData *frame, void *arg) { - if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION && gpAnimBlendClump->velocity) + if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION && gpAnimBlendClump->velocity2d) FrameUpdateCallBackWithVelocityExtractionSkinned(frame, arg); } @@ -466,7 +466,7 @@ FrameUpdateCallBackNonSkinnedCompressed(AnimBlendFrameData *frame, void *arg) AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg; if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION && - gpAnimBlendClump->velocity){ + gpAnimBlendClump->velocity2d){ if(updateData->foobar) for(node = updateData->nodes; *node; node++) if((*node)->sequence && (*node)->association->IsPartial()) @@ -511,9 +511,9 @@ FrameUpdateCallBackNonSkinnedCompressed(AnimBlendFrameData *frame, void *arg) } if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){ - *gpAnimBlendClump->velocity = trans - cur; + *gpAnimBlendClump->velocity3d = trans - cur; if(looped) - *gpAnimBlendClump->velocity += end; + *gpAnimBlendClump->velocity3d += end; mat->pos.x = (pos - trans).x + frame->resetPos.x; mat->pos.y = (pos - trans).y + frame->resetPos.y; mat->pos.z = (pos - trans).z + frame->resetPos.z; @@ -573,7 +573,7 @@ FrameUpdateCallBackSkinnedCompressed(AnimBlendFrameData *frame, void *arg) AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg; if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION && - gpAnimBlendClump->velocity){ + gpAnimBlendClump->velocity2d){ if(updateData->foobar) for(node = updateData->nodes; *node; node++) if((*node)->sequence && (*node)->association->IsPartial()) @@ -620,9 +620,9 @@ FrameUpdateCallBackSkinnedCompressed(AnimBlendFrameData *frame, void *arg) } if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){ - *gpAnimBlendClump->velocity = trans - cur; + *gpAnimBlendClump->velocity3d = trans - cur; if(looped) - *gpAnimBlendClump->velocity += end; + *gpAnimBlendClump->velocity3d += end; xform->t.x = (pos - trans).x + frame->resetPos.x; xform->t.y = (pos - trans).y + frame->resetPos.y; xform->t.z = (pos - trans).z + frame->resetPos.z; diff --git a/src/animation/RpAnimBlend.cpp b/src/animation/RpAnimBlend.cpp index c4103dbf..9223d198 100644 --- a/src/animation/RpAnimBlend.cpp +++ b/src/animation/RpAnimBlend.cpp @@ -437,7 +437,7 @@ RpAnimBlendNodeUpdateKeyframes(AnimBlendFrameData *frames, AnimBlendFrameUpdateD CAnimBlendAssociation *a = (*node)->association; for(i = 0; i < numNodes; i++) if((frames[i].flag & AnimBlendFrameData::VELOCITY_EXTRACTION) == 0 || - gpAnimBlendClump->velocity == nil){ + gpAnimBlendClump->velocity2d == nil){ if((*node)[i].sequence) (*node)[i].FindKeyFrame(a->currentTime - a->timeStep); } diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp index 7adb4999..aef48217 100644 --- a/src/control/Replay.cpp +++ b/src/control/Replay.cpp @@ -1729,7 +1729,7 @@ void CReplay::SaveReplayToHD(void) CFileMgr::SetDir(""); } -void PlayReplayFromHD(void) +void CReplay::PlayReplayFromHD(void) { CFileMgr::SetDirMyDocuments(); int fr = CFileMgr::OpenFile("replay.rep", "rb"); @@ -1748,17 +1748,17 @@ void PlayReplayFromHD(void) return; } int slot; - for (slot = 0; CFileMgr::Read(fr, (char*)CReplay::Buffers[slot], sizeof(CReplay::Buffers[slot])); slot++) - CReplay::BufferStatus[slot] = CReplay::REPLAYBUFFER_PLAYBACK; - CReplay::BufferStatus[slot - 1] = CReplay::REPLAYBUFFER_RECORD; - while (slot < CReplay::NUM_REPLAYBUFFERS) - CReplay::BufferStatus[slot++] = CReplay::REPLAYBUFFER_UNUSED; + for (slot = 0; CFileMgr::Read(fr, (char*)Buffers[slot], sizeof(Buffers[slot])); slot++) + BufferStatus[slot] = REPLAYBUFFER_PLAYBACK; + BufferStatus[slot - 1] = REPLAYBUFFER_RECORD; + while (slot < NUM_REPLAYBUFFERS) + BufferStatus[slot++] = REPLAYBUFFER_UNUSED; CFileMgr::CloseFile(fr); CFileMgr::SetDir(""); - CReplay::TriggerPlayback(CReplay::REPLAYCAMMODE_ASSTORED, 0.0f, 0.0f, 0.0f, false); - CReplay::bPlayingBackFromFile = true; - CReplay::bAllowLookAroundCam = true; - CReplay::StreamAllNecessaryCarsAndPeds(); + TriggerPlayback(REPLAYCAMMODE_ASSTORED, 0.0f, 0.0f, 0.0f, false); + bPlayingBackFromFile = true; + bAllowLookAroundCam = true; + StreamAllNecessaryCarsAndPeds(); } void CReplay::StreamAllNecessaryCarsAndPeds(void) diff --git a/src/control/Replay.h b/src/control/Replay.h index 84a6bef0..5dd8b651 100644 --- a/src/control/Replay.h +++ b/src/control/Replay.h @@ -64,8 +64,6 @@ struct CStoredDetailedAnimationState uint8 aGroupId2[NUM_PARTIAL_ANIMS_IN_REPLAY]; }; -void PlayReplayFromHD(void); - #ifdef GTA_REPLAY #define REPLAY_STUB #else @@ -410,12 +408,10 @@ private: static void EmptyAllPools(void); static void MarkEverythingAsNew(void); static void SaveReplayToHD(void); + static void PlayReplayFromHD(void); // out of class in III PC and later because of SecuROM static void FindFirstFocusCoordinate(CVector *coord); static void ProcessLookAroundCam(void); static size_t FindSizeOfPacket(uint8); static void GoToNextBlock(void); - - /* Absolute nonsense, but how could this function end up being outside of class? */ - friend void PlayReplayFromHD(void); #endif }; diff --git a/src/control/Script4.cpp b/src/control/Script4.cpp index d7e1d083..12eb179c 100644 --- a/src/control/Script4.cpp +++ b/src/control/Script4.cpp @@ -785,20 +785,20 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) }else{ pPed->m_pMyVehicle->RemovePassenger(pPed); } - if (pPed->m_vehEnterType) { + if (pPed->m_vehDoor) { if (pPed->GetPedState() == PED_EXIT_CAR || pPed->GetPedState() == PED_DRAG_FROM_CAR) { uint8 flags = 0; if (pPed->m_pMyVehicle->IsBike()) { - if (pPed->m_vehEnterType == CAR_DOOR_LF || - pPed->m_vehEnterType == CAR_DOOR_RF || - pPed->m_vehEnterType == CAR_WINDSCREEN) + if (pPed->m_vehDoor == CAR_DOOR_LF || + pPed->m_vehDoor == CAR_DOOR_RF || + pPed->m_vehDoor == CAR_WINDSCREEN) flags = CAR_DOOR_FLAG_LF | CAR_DOOR_FLAG_RF; - else if (pPed->m_vehEnterType == CAR_DOOR_LR || - pPed->m_vehEnterType == CAR_DOOR_RR) + else if (pPed->m_vehDoor == CAR_DOOR_LR || + pPed->m_vehDoor == CAR_DOOR_RR) flags = CAR_DOOR_FLAG_LR | CAR_DOOR_FLAG_RR; } else { - switch (pPed->m_vehEnterType) { + switch (pPed->m_vehDoor) { case CAR_DOOR_LF: flags = pPed->m_pMyVehicle->m_nNumMaxPassengers != 0 ? CAR_DOOR_FLAG_LF : CAR_DOOR_FLAG_LF | CAR_DOOR_FLAG_LR; break; @@ -814,7 +814,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command) } } pPed->m_pMyVehicle->m_nGettingOutFlags &= ~flags; - pPed->m_pMyVehicle->ProcessOpenDoor(pPed->m_vehEnterType, NUM_STD_ANIMS, 0.0f); + pPed->m_pMyVehicle->ProcessOpenDoor(pPed->m_vehDoor, NUM_STD_ANIMS, 0.0f); } } } diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp index d245bb5a..992c7d74 100644 --- a/src/core/Camera.cpp +++ b/src/core/Camera.cpp @@ -2353,7 +2353,7 @@ CCamera::StartTransition(int16 newMode) while(deltaBeta < -PI) deltaBeta += 2*PI; deltaBeta = Abs(deltaBeta); - door = FindPlayerPed()->m_vehEnterType; + door = FindPlayerPed()->m_vehDoor; if(deltaBeta > HALFPI){ if(((CPed*)pTargetEntity)->m_carInObjective){ if(((CPed*)pTargetEntity)->m_carInObjective->IsUpsideDown()){ diff --git a/src/core/Game.cpp b/src/core/Game.cpp index c5154bd4..43e5856c 100644 --- a/src/core/Game.cpp +++ b/src/core/Game.cpp @@ -462,7 +462,7 @@ bool CGame::Initialise(const char* datFile) TestModelIndices(); LoadingScreen("Loading the Game", "Setup water", nil); - WaterLevelInitialise("DATA\\WATER.DAT"); + CWaterLevel::Initialise("DATA\\WATER.DAT"); TheConsole.Init(); CDraw::SetFOV(120.0f); CDraw::ms_fLODDistance = 500.0f; diff --git a/src/core/PlayerInfo.cpp b/src/core/PlayerInfo.cpp index 7289175d..f0f3e2c6 100644 --- a/src/core/PlayerInfo.cpp +++ b/src/core/PlayerInfo.cpp @@ -390,8 +390,8 @@ CPlayerInfo::Process(void) m_pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_PASSENGER, carBelow); } else if (carBelow->IsBoat()) { if (!carBelow->pDriver) { - m_pPed->m_vehEnterType = 0; - m_pPed->SetEnterCar(carBelow, m_pPed->m_vehEnterType); + m_pPed->m_vehDoor = 0; + m_pPed->SetEnterCar(carBelow, m_pPed->m_vehDoor); } } else { m_pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, carBelow); diff --git a/src/core/config.h b/src/core/config.h index 225863f3..58bc9ffd 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -240,12 +240,16 @@ enum Config { # define TIMEBARS // print debug timers #endif -#define FIX_BUGS // fixes bugs that we've came across during reversing, TODO: use this more +#define FIX_BUGS // fixes bugs that we've came across during reversing. You can undefine this only on release builds. //#define MORE_LANGUAGES // Add more translations to the game #define COMPATIBLE_SAVES // this allows changing structs while keeping saves compatible #define LOAD_INI_SETTINGS // as the name suggests. fundamental for CUSTOM_FRONTEND_OPTIONS #define FIX_HIGH_FPS_BUGS_ON_FRONTEND +#if defined(__LP64__) || defined(_WIN64) +#define FIX_BUGS_64 // Must have fixes to be able to run 64 bit build +#endif + // Just debug menu entries #ifdef DEBUGMENU #define RELOADABLES // some debug menu options to reload TXD files diff --git a/src/core/main.cpp b/src/core/main.cpp index e6d83608..7f73c311 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -1426,11 +1426,13 @@ Idle(void *arg) CSprite2d::InitPerFrame(); CFont::InitPerFrame(); + PUSH_MEMID(MEMID_GAME_PROCESS); CPointLights::InitPerFrame(); tbStartTimer(0, "CGame::Process"); CGame::Process(); tbEndTimer("CGame::Process"); + POP_MEMID(); tbStartTimer(0, "DMAudio.Service"); DMAudio.Service(); @@ -1452,6 +1454,8 @@ Idle(void *arg) if(arg == nil) return; + PUSH_MEMID(MEMID_RENDER); + if(!FrontEndMenuManager.m_bMenuActive && TheCamera.GetScreenFadeStatus() != FADE_2) { // This is from SA, but it's nice for windowed mode diff --git a/src/entities/Physical.cpp b/src/entities/Physical.cpp index 706b469c..07d1d0b4 100644 --- a/src/entities/Physical.cpp +++ b/src/entities/Physical.cpp @@ -883,9 +883,13 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl if(B->GetStatus() == STATUS_PLAYER) pointposB *= 0.8f; if(CWorld::bNoMoreCollisionTorque){ - // BUG: the game actually uses A here, but this can't be right +#ifdef FIX_BUGS B->ApplyFrictionMoveForce(fB*-0.3f); B->ApplyFrictionTurnForce(fB*-0.3f, pointposB); +#else + A->ApplyFrictionMoveForce(fB*-0.3f); + A->ApplyFrictionTurnForce(fB*-0.3f, pointposB); +#endif } } if(!A->bInfiniteMass){ @@ -1054,7 +1058,13 @@ CPhysical::ApplyFriction(CPhysical *B, float adhesiveLimit, CColPoint &colpoint) fOtherSpeedA = vOtherSpeedA.Magnitude(); fOtherSpeedB = vOtherSpeedB.Magnitude(); +#ifdef FIX_BUGS // division by 0 + frictionDir = vOtherSpeedA; + frictionDir.Normalise(); +#else frictionDir = vOtherSpeedA * (1.0f/fOtherSpeedA); +#endif + speedSum = (B->m_fMass*fOtherSpeedB + A->m_fMass*fOtherSpeedA)/(B->m_fMass + A->m_fMass); if(fOtherSpeedA > speedSum){ impulseA = (speedSum - fOtherSpeedA) * A->m_fMass; @@ -1084,7 +1094,12 @@ CPhysical::ApplyFriction(CPhysical *B, float adhesiveLimit, CColPoint &colpoint) fOtherSpeedA = vOtherSpeedA.Magnitude(); fOtherSpeedB = vOtherSpeedB.Magnitude(); +#ifdef FIX_BUGS // division by 0 + frictionDir = vOtherSpeedA; + frictionDir.Normalise(); +#else frictionDir = vOtherSpeedA * (1.0f/fOtherSpeedA); +#endif float massB = B->GetMass(pointposB, frictionDir); speedSum = (massB*fOtherSpeedB + A->m_fMass*fOtherSpeedA)/(massB + A->m_fMass); if(fOtherSpeedA > speedSum){ @@ -1112,7 +1127,12 @@ CPhysical::ApplyFriction(CPhysical *B, float adhesiveLimit, CColPoint &colpoint) fOtherSpeedA = vOtherSpeedA.Magnitude(); fOtherSpeedB = vOtherSpeedB.Magnitude(); +#ifdef FIX_BUGS // division by 0 + frictionDir = vOtherSpeedA; + frictionDir.Normalise(); +#else frictionDir = vOtherSpeedA * (1.0f/fOtherSpeedA); +#endif float massA = A->GetMass(pointposA, frictionDir); speedSum = (B->m_fMass*fOtherSpeedB + massA*fOtherSpeedA)/(B->m_fMass + massA); if(fOtherSpeedA > speedSum){ @@ -1140,7 +1160,12 @@ CPhysical::ApplyFriction(CPhysical *B, float adhesiveLimit, CColPoint &colpoint) fOtherSpeedA = vOtherSpeedA.Magnitude(); fOtherSpeedB = vOtherSpeedB.Magnitude(); +#ifdef FIX_BUGS // division by 0 + frictionDir = vOtherSpeedA; + frictionDir.Normalise(); +#else frictionDir = vOtherSpeedA * (1.0f/fOtherSpeedA); +#endif float massA = A->GetMass(pointposA, frictionDir); float massB = B->GetMass(pointposB, frictionDir); speedSum = (massB*fOtherSpeedB + massA*fOtherSpeedA)/(massB + massA); @@ -1178,7 +1203,12 @@ CPhysical::ApplyFriction(float adhesiveLimit, CColPoint &colpoint) fOtherSpeed = vOtherSpeed.Magnitude(); if(fOtherSpeed > 0.0f){ +#ifdef FIX_BUGS // division by 0 + frictionDir = vOtherSpeed; + frictionDir.Normalise(); +#else frictionDir = vOtherSpeed * (1.0f/fOtherSpeed); +#endif // not really impulse but speed // maybe use ApplyFrictionMoveForce instead? fImpulse = -fOtherSpeed; @@ -1196,7 +1226,12 @@ CPhysical::ApplyFriction(float adhesiveLimit, CColPoint &colpoint) fOtherSpeed = vOtherSpeed.Magnitude(); if(fOtherSpeed > 0.0f){ +#ifdef FIX_BUGS // division by 0 + frictionDir = vOtherSpeed; + frictionDir.Normalise(); +#else frictionDir = vOtherSpeed * (1.0f/fOtherSpeed); +#endif fImpulse = -fOtherSpeed * m_fMass; impulseLimit = adhesiveLimit*CTimer::GetTimeStep() * 1.5; if(fImpulse < -impulseLimit) fImpulse = -impulseLimit; diff --git a/src/objects/CutsceneObject.cpp b/src/objects/CutsceneObject.cpp index 01fb038f..803fcf0f 100644 --- a/src/objects/CutsceneObject.cpp +++ b/src/objects/CutsceneObject.cpp @@ -46,7 +46,7 @@ CCutsceneObject::SetModelIndex(uint32 id) CEntity::SetModelIndex(id); assert(RwObjectGetType(m_rwObject) == rpCLUMP); RpAnimBlendClumpInit((RpClump*)m_rwObject); - (*RPANIMBLENDCLUMPDATA(m_rwObject))->velocity = &m_vecMoveSpeed; + (*RPANIMBLENDCLUMPDATA(m_rwObject))->velocity3d = &m_vecMoveSpeed; (*RPANIMBLENDCLUMPDATA(m_rwObject))->frames[0].flag |= AnimBlendFrameData::VELOCITY_EXTRACTION_3D; } diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index f597edea..f5123b39 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -113,15 +113,15 @@ CPed::CPed(uint32 pedType) : m_pedIK(this) m_attackTimer = 0; m_timerUnused = 0; m_lookTimer = 0; - m_standardTimer = 0; + m_chatTimer = 0; m_shootTimer = 0; - m_hitRecoverTimer = 0; + m_carJackTimer = 0; m_duckAndCoverTimer = 0; m_moved = CVector2D(0.0f, 0.0f); m_fRotationCur = 0.0f; m_headingRate = 15.0f; m_fRotationDest = 0.0f; - m_vehEnterType = CAR_DOOR_LF; + m_vehDoor = CAR_DOOR_LF; m_walkAroundType = 0; m_pCurrentPhysSurface = nil; m_vecOffsetFromPhysSurface = CVector(0.0f, 0.0f, 0.0f); @@ -381,7 +381,7 @@ CPed::~CPed(void) GetPedAttractorManager()->DeRegisterPed(this, m_attractor); CRadar::ClearBlipForEntity(BLIP_CHAR, CPools::GetPedPool()->GetIndex(this)); if (InVehicle()){ - uint8 door_flag = GetCarDoorFlag(m_vehEnterType); + uint8 door_flag = GetCarDoorFlag(m_vehDoor); if (m_pMyVehicle->pDriver == this) m_pMyVehicle->pDriver = nil; else { @@ -434,8 +434,7 @@ CPed::SetModelIndex(uint32 mi) if (!CanUseTorsoWhenLooking()) m_pedIK.m_flags |= CPedIK::LOOKAROUND_HEAD_ONLY; - // This is a mistake by R*, velocity is CVector, whereas m_vecAnimMoveDelta is CVector2D. - (*RPANIMBLENDCLUMPDATA(m_rwObject))->velocity = (CVector*) &m_vecAnimMoveDelta; + (*RPANIMBLENDCLUMPDATA(m_rwObject))->velocity2d = &m_vecAnimMoveDelta; if(modelInfo->GetHitColModel() == nil) modelInfo->CreateHitColModelSkinned(GetClump()); @@ -1299,7 +1298,8 @@ CPed::ScanForInterestingStuff(void) if (LookForInterestingNodes()) return; - if (m_nPedType == PEDTYPE_CRIMINAL && m_hitRecoverTimer < CTimer::GetTimeInMilliseconds()) { + if (m_nPedType == PEDTYPE_CRIMINAL && m_carJackTimer < CTimer::GetTimeInMilliseconds()) { + // Find a car to steal or a ped to mug if we haven't already decided to steal a car if (CGeneral::GetRandomNumber() % 100 < 10) { int mostExpensiveVehAround = -1; int bestMonetaryValue = 0; @@ -1322,10 +1322,10 @@ CPed::ScanForInterestingStuff(void) } if (bestMonetaryValue > 2000 && mostExpensiveVehAround != -1 && vehicles[mostExpensiveVehAround]) { SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, vehicles[mostExpensiveVehAround]); - m_hitRecoverTimer = CTimer::GetTimeInMilliseconds() + 5000; + m_carJackTimer = CTimer::GetTimeInMilliseconds() + 5000; return; } - m_hitRecoverTimer = CTimer::GetTimeInMilliseconds() + 5000; + m_carJackTimer = CTimer::GetTimeInMilliseconds() + 5000; } else if (m_objective != OBJECTIVE_MUG_CHAR && !(CGeneral::GetRandomNumber() & 7)) { CPed *charToMug = nil; for (int i = 0; i < m_numNearPeds; ++i) { @@ -1347,13 +1347,13 @@ CPed::ScanForInterestingStuff(void) if (charToMug) SetObjective(OBJECTIVE_MUG_CHAR, charToMug); - m_hitRecoverTimer = CTimer::GetTimeInMilliseconds() + 5000; + m_carJackTimer = CTimer::GetTimeInMilliseconds() + 5000; } } if (m_nPedState == PED_WANDER_PATH) { if (CGeneral::GetRandomNumberInRange(0.0f, 1.0f) < 0.5f) { - if (CTimer::GetTimeInMilliseconds() > m_standardTimer) { + if (CTimer::GetTimeInMilliseconds() > m_chatTimer) { for (int i = 0; i < m_numNearPeds; i ++) { if (m_nearPeds[i] && m_nearPeds[i]->m_nPedState == PED_WANDER_PATH) { if ((GetPosition() - m_nearPeds[i]->GetPosition()).Magnitude() < 1.8f @@ -1369,7 +1369,7 @@ CPed::ScanForInterestingStuff(void) } } } else { - m_standardTimer = CTimer::GetTimeInMilliseconds() + 200; + m_chatTimer = CTimer::GetTimeInMilliseconds() + 200; } } } @@ -3656,7 +3656,7 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj) if (Abs(angleDiffBtwObjCenterAndForward) >= objTopRightHeading) { if (PI - objTopRightHeading >= Abs(angleDiffBtwObjCenterAndForward)) { if ((angleDiffBtwObjCenterAndForward <= 0.0f || objUpsideDown) && (angleDiffBtwObjCenterAndForward < 0.0f || !objUpsideDown)) { - if (goingToEnterCar && (m_vehEnterType == CAR_DOOR_RF || m_vehEnterType == CAR_DOOR_RR)) { + if (goingToEnterCar && (m_vehDoor == CAR_DOOR_RF || m_vehDoor == CAR_DOOR_RR)) { m_walkAroundType = 0; } else { if (CGeneral::LimitRadianAngle(m_fRotationDest - angleToFaceObjCenter) >= 0.0f) { @@ -3674,7 +3674,7 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj) } } } else { - if (goingToEnterCar && (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR)) { + if (goingToEnterCar && (m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_LR)) { m_walkAroundType = 0; } else { if (CGeneral::LimitRadianAngle(m_fRotationDest - angleToFaceObjCenter) <= 0.0f) { @@ -3692,7 +3692,7 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj) } } } - } else if (goingToEnterCar && (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR) + } else if (goingToEnterCar && (m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_LR) || CGeneral::LimitRadianAngle(m_fRotationDest - angleToFaceObjCenter) < 0.0f) { if (entityOnTopLeftOfObj == 1 || entityOnTopLeftOfObj && !entityOnTopRightOfObj && !entityOnBottomRightOfObj) { m_walkAroundType = 3; @@ -3700,7 +3700,7 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj) } else if (entityOnTopRightOfObj == 1 || entityOnTopRightOfObj && !entityOnTopLeftOfObj && !entityOnBottomLeftOfObj) { m_walkAroundType = 4; } - } else if (goingToEnterCar && (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR) + } else if (goingToEnterCar && (m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_LR) || CGeneral::LimitRadianAngle(m_fRotationDest - angleToFaceObjCenter) > 0.0f) { if (entityOnBottomLeftOfObj == 1 || entityOnBottomLeftOfObj && !entityOnTopRightOfObj && !entityOnBottomRightOfObj) { m_walkAroundType = 2; @@ -3723,10 +3723,10 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj) if (Abs(angleDiffBtwObjCenterAndForward) < objTopRightHeading) { if (goingToEnterCar) { if (goingToEnterCarAndItsVan) { - if (m_vehEnterType == CAR_DOOR_LR || m_vehEnterType == CAR_DOOR_RR) + if (m_vehDoor == CAR_DOOR_LR || m_vehDoor == CAR_DOOR_RR) return; } - if (m_vehEnterType != CAR_DOOR_LF && m_vehEnterType != CAR_DOOR_LR && (!entityOnBottomRightOfObj || entityOnBottomLeftOfObj)) { + if (m_vehDoor != CAR_DOOR_LF && m_vehDoor != CAR_DOOR_LR && (!entityOnBottomRightOfObj || entityOnBottomLeftOfObj)) { m_fRotationDest = CGeneral::LimitRadianAngle(dirToSet - HALFPI); localPosToHead.x = adjustedColMax.x; localPosToHead.z = 0.0f; @@ -3755,9 +3755,9 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj) } else { if (PI - objTopRightHeading >= Abs(angleDiffBtwObjCenterAndForward)) { if (angleDiffBtwObjCenterAndForward <= 0.0f) { - if (!goingToEnterCar || !goingToEnterCarAndItsVan || m_vehEnterType != CAR_DOOR_LR && m_vehEnterType != CAR_DOOR_RR) { + if (!goingToEnterCar || !goingToEnterCarAndItsVan || m_vehDoor != CAR_DOOR_LR && m_vehDoor != CAR_DOOR_RR) { if (goingToEnterCar) { - if (m_vehEnterType == CAR_DOOR_RF || (m_vehEnterType == CAR_DOOR_RR && !goingToEnterCarAndItsVan)) + if (m_vehDoor == CAR_DOOR_RF || (m_vehDoor == CAR_DOOR_RR && !goingToEnterCarAndItsVan)) return; } if (m_walkAroundType == 4 || m_walkAroundType == 3 @@ -3779,14 +3779,14 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj) localPosToHead.z = 0.0f; localPosToHead.y = adjustedColMin.y; } - } else if (goingToEnterCar && goingToEnterCarAndItsVan && (m_vehEnterType == CAR_DOOR_LR || m_vehEnterType == CAR_DOOR_RR)) { + } else if (goingToEnterCar && goingToEnterCarAndItsVan && (m_vehDoor == CAR_DOOR_LR || m_vehDoor == CAR_DOOR_RR)) { m_fRotationDest = CGeneral::LimitRadianAngle(PI + dirToSet); localPosToHead.x = adjustedColMin.x; localPosToHead.z = 0.0f; localPosToHead.y = adjustedColMin.y; } else { if (goingToEnterCar) { - if (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR && !goingToEnterCarAndItsVan) + if (m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_LR && !goingToEnterCarAndItsVan) return; } if (m_walkAroundType == 1 || m_walkAroundType == 2 @@ -3804,8 +3804,8 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj) } } } else { - if (goingToEnterCar && (!goingToEnterCarAndItsVan || m_vehEnterType != CAR_DOOR_LR && m_vehEnterType != CAR_DOOR_RR)) { - if (m_vehEnterType != CAR_DOOR_LF && m_vehEnterType != CAR_DOOR_LR && (!entityOnTopRightOfObj || entityOnTopLeftOfObj)) { + if (goingToEnterCar && (!goingToEnterCarAndItsVan || m_vehDoor != CAR_DOOR_LR && m_vehDoor != CAR_DOOR_RR)) { + if (m_vehDoor != CAR_DOOR_LF && m_vehDoor != CAR_DOOR_LR && (!entityOnTopRightOfObj || entityOnTopLeftOfObj)) { m_fRotationDest = CGeneral::LimitRadianAngle(dirToSet - HALFPI); localPosToHead.x = adjustedColMax.x; @@ -4099,9 +4099,9 @@ CPed::PedSetOutCarCB(CAnimBlendAssociation *animAssoc, void *arg) } if (veh && veh->IsBike()) // BUG? - veh->m_nGettingOutFlags &= ~GetBikeDoorFlag(ped->m_vehEnterType); + veh->m_nGettingOutFlags &= ~GetBikeDoorFlag(ped->m_vehDoor); else - veh->m_nGettingOutFlags &= ~GetCarDoorFlag(ped->m_vehEnterType); + veh->m_nGettingOutFlags &= ~GetCarDoorFlag(ped->m_vehDoor); if (veh->pDriver == ped) { veh->RemoveDriver(); @@ -4123,7 +4123,7 @@ CPed::PedSetOutCarCB(CAnimBlendAssociation *animAssoc, void *arg) if (veh->bIsBus && !veh->IsUpsideDown() && !veh->IsOnItsSide()) { float angleAfterExit; - if (ped->m_vehEnterType == CAR_DOOR_LF) { + if (ped->m_vehDoor == CAR_DOOR_LF) { angleAfterExit = HALFPI + veh->GetForward().Heading(); } else { angleAfterExit = veh->GetForward().Heading() - HALFPI; @@ -4174,7 +4174,7 @@ CPed::PedSetDraggedOutCarCB(CAnimBlendAssociation *dragAssoc, void *arg) uint8 exitFlags = 0; quickJackedAssoc = RpAnimBlendClumpGetAssociation(ped->GetClump(), ANIM_CAR_QJACKED); if (dragAssoc && dragAssoc->animId == ANIM_BIKE_HIT && ped->m_pMyVehicle) { - if (ped->m_vehEnterType == CAR_DOOR_LF || ped->m_vehEnterType == CAR_DOOR_RF) { + if (ped->m_vehDoor == CAR_DOOR_LF || ped->m_vehDoor == CAR_DOOR_RF) { CAnimManager::BlendAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_BIKE_FALL_OFF, 100.0f); ped->m_pMyVehicle->m_nGettingOutFlags &= ~(CAR_DOOR_FLAG_RF | CAR_DOOR_FLAG_LF); } else { @@ -4196,9 +4196,9 @@ CPed::PedSetDraggedOutCarCB(CAnimBlendAssociation *dragAssoc, void *arg) vehicle = ped->m_pMyVehicle; if (vehicle && vehicle->IsBike()) - exitFlags = GetBikeDoorFlagInclJumpInFromFront(ped->m_vehEnterType); + exitFlags = GetBikeDoorFlagInclJumpInFromFront(ped->m_vehDoor); else - exitFlags = GetCarDoorFlag(ped->m_vehEnterType); + exitFlags = GetCarDoorFlag(ped->m_vehDoor); if (vehicle) vehicle->m_nGettingOutFlags &= ~exitFlags; @@ -4419,7 +4419,7 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg) } else if (veh->bIsBus) { veh->AddPassenger(ped); } else { - switch (ped->m_vehEnterType) { + switch (ped->m_vehDoor) { case CAR_DOOR_RF: veh->AddPassenger(ped, 0); break; @@ -4449,9 +4449,9 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg) int8 doorFlag; if (veh->IsBike()) { - doorFlag = GetBikeDoorFlagInclJumpInFromFront(ped->m_vehEnterType); + doorFlag = GetBikeDoorFlagInclJumpInFromFront(ped->m_vehDoor); } else { - doorFlag = GetEnterCarDoorFlag(ped->m_vehEnterType, veh->m_nNumMaxPassengers); + doorFlag = GetEnterCarDoorFlag(ped->m_vehDoor, veh->m_nNumMaxPassengers); } veh->m_nGettingInFlags &= ~doorFlag; @@ -5133,13 +5133,13 @@ void CPed::Idle(void) { CVehicle *veh = m_pMyVehicle; - if (veh && veh->m_nGettingOutFlags && m_vehEnterType) { + if (veh && veh->m_nGettingOutFlags && m_vehDoor) { - if (veh->m_nGettingOutFlags & GetCarDoorFlag(m_vehEnterType)) { + if (veh->m_nGettingOutFlags & GetCarDoorFlag(m_vehDoor)) { if (m_objective != OBJECTIVE_KILL_CHAR_ON_FOOT) { - CVector doorPos = GetPositionToOpenCarDoor(veh, m_vehEnterType); + CVector doorPos = GetPositionToOpenCarDoor(veh, m_vehDoor); CVector doorDist = GetPosition() - doorPos; if (doorDist.MagnitudeSqr() < sq(0.5f)) { @@ -5886,7 +5886,7 @@ CPed::ClearFlee(void) { RestorePreviousState(); bUsePedNodeSeek = false; - m_standardTimer = 0; + m_chatTimer = 0; m_fleeTimer = 0; } @@ -5932,7 +5932,7 @@ CPed::Flee(void) if (m_nPedStateTimer < CTimer::GetTimeInMilliseconds() && m_collidingThingTimer < CTimer::GetTimeInMilliseconds()) { - if (m_pNextPathNode && CTimer::GetTimeInMilliseconds() > m_standardTimer) { + if (m_pNextPathNode && CTimer::GetTimeInMilliseconds() > m_chatTimer) { curDirectionShouldBe = CGeneral::GetNodeHeadingFromVector(GetPosition().x - ms_vec2DFleePosition.x, GetPosition().y - ms_vec2DFleePosition.y); if (m_nPathDir < curDirectionShouldBe) @@ -5975,7 +5975,7 @@ CPed::Flee(void) if (m_pNextPathNode && m_pNextPathNode != realLastNode && m_pNextPathNode != m_pLastPathNode && curDirectionShouldBe - nextDirection != 4) { m_nPathDir = nextDirection; - m_standardTimer = CTimer::GetTimeInMilliseconds() + 2000; + m_chatTimer = CTimer::GetTimeInMilliseconds() + 2000; } else { bUsePedNodeSeek = false; SetMoveState(PEDMOVE_RUN); @@ -7215,7 +7215,7 @@ CPed::SetChat(CEntity *chatWith, uint32 time) SetMoveState(PEDMOVE_STILL); m_lookTimer = 0; SetLookFlag(chatWith, true); - m_standardTimer = CTimer::GetTimeInMilliseconds() + time; + m_chatTimer = CTimer::GetTimeInMilliseconds() + time; m_lookTimer = CTimer::GetTimeInMilliseconds() + 3000; } @@ -7236,7 +7236,7 @@ CPed::Chat(void) if (partner->m_nPedState != PED_CHAT) { ClearChat(); - m_standardTimer = CTimer::GetTimeInMilliseconds() + 30000; + m_chatTimer = CTimer::GetTimeInMilliseconds() + 30000; if (partner->m_pedInObjective) { if (partner->m_objective == OBJECTIVE_KILL_CHAR_ON_FOOT || partner->m_objective == OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE) @@ -7269,9 +7269,9 @@ CPed::Chat(void) Say(SOUND_PED_CHAT); } } - if (m_standardTimer && CTimer::GetTimeInMilliseconds() > m_standardTimer) { + if (m_chatTimer && CTimer::GetTimeInMilliseconds() > m_chatTimer) { ClearChat(); - m_standardTimer = CTimer::GetTimeInMilliseconds() + 30000; + m_chatTimer = CTimer::GetTimeInMilliseconds() + 30000; } } @@ -7480,7 +7480,7 @@ CPed::SetSeekCar(CVehicle *car, uint32 doorNode) m_pMyVehicle = car; m_pMyVehicle->RegisterReference((CEntity**) &m_pMyVehicle); // m_pSeekTarget->RegisterReference((CEntity**) &m_pSeekTarget); - m_vehEnterType = doorNode; + m_vehDoor = doorNode; m_distanceToCountSeekDone = 0.5f; SetPedState(PED_SEEK_CAR); @@ -7498,9 +7498,9 @@ CPed::SeekCar(void) } if (m_objective != OBJECTIVE_ENTER_CAR_AS_PASSENGER) { - if (!vehToSeek->IsBike() && m_vehEnterType && m_objective != OBJECTIVE_ENTER_CAR_AS_DRIVER) { + if (!vehToSeek->IsBike() && m_vehDoor && m_objective != OBJECTIVE_ENTER_CAR_AS_DRIVER) { if (IsRoomToBeCarJacked()) { - dest = GetPositionToOpenCarDoor(vehToSeek, m_vehEnterType); + dest = GetPositionToOpenCarDoor(vehToSeek, m_vehDoor); } else if (m_nPedType == PEDTYPE_COP) { dest = GetPositionToOpenCarDoor(vehToSeek, CAR_DOOR_RF); } else { @@ -7509,7 +7509,7 @@ CPed::SeekCar(void) } else GetNearestDoor(vehToSeek, dest); } else { - if (m_hitRecoverTimer > CTimer::GetTimeInMilliseconds()) { + if (m_carJackTimer > CTimer::GetTimeInMilliseconds()) { SetMoveState(PEDMOVE_STILL); return; } @@ -7553,7 +7553,7 @@ CPed::SeekCar(void) if (IsPlayer()) { ClearObjective(); } else if (CharCreatedBy == RANDOM_CHAR) { - m_hitRecoverTimer = CTimer::GetTimeInMilliseconds() + 30000; + m_carJackTimer = CTimer::GetTimeInMilliseconds() + 30000; } SetMoveState(PEDMOVE_STILL); TheCamera.ClearPlayerWeaponMode(); @@ -7581,7 +7581,7 @@ CPed::SeekCar(void) else if (2.0f * vehToSeek->GetColModel()->boundingBox.max.x > distToDestSqr) bCanPedEnterSeekedCar = true; - if (vehToSeek->m_nGettingInFlags & GetCarDoorFlag(m_vehEnterType)) + if (vehToSeek->m_nGettingInFlags & GetCarDoorFlag(m_vehDoor)) bVehEnterDoorIsBlocked = true; else bVehEnterDoorIsBlocked = false; @@ -7592,7 +7592,7 @@ CPed::SeekCar(void) if (1.6f + GetPosition().z > dest.z && GetPosition().z - 0.5f < dest.z) { #ifdef GTA_TRAIN if (vehToSeek->IsTrain()) { - SetEnterTrain(vehToSeek, m_vehEnterType); + SetEnterTrain(vehToSeek, m_vehDoor); } else #endif { @@ -7613,42 +7613,42 @@ CPed::SeekCar(void) case STATUS_PLAYER_DISABLED: if (vehToSeek->IsBike()) { if ((!m_leader || m_leader != vehToSeek->pDriver) && - ((m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_RF || m_vehEnterType == CAR_WINDSCREEN) && vehToSeek->pDriver || - (m_vehEnterType == CAR_DOOR_LR || m_vehEnterType == CAR_DOOR_RR) && vehToSeek->pPassengers[0])) { + ((m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_RF || m_vehDoor == CAR_WINDSCREEN) && vehToSeek->pDriver || + (m_vehDoor == CAR_DOOR_LR || m_vehDoor == CAR_DOOR_RR) && vehToSeek->pPassengers[0])) { SetCarJack(vehToSeek); } else { - SetEnterCar(vehToSeek, m_vehEnterType); + SetEnterCar(vehToSeek, m_vehDoor); } } else if (!vehToSeek->bIsBus && (!m_leader || m_leader != vehToSeek->pDriver) && - (m_vehEnterType == CAR_DOOR_LF && vehToSeek->pDriver || m_vehEnterType == CAR_DOOR_RF && vehToSeek->pPassengers[0] || m_vehEnterType == CAR_DOOR_LR && vehToSeek->pPassengers[1] || m_vehEnterType == CAR_DOOR_RR && vehToSeek->pPassengers[2])) { + (m_vehDoor == CAR_DOOR_LF && vehToSeek->pDriver || m_vehDoor == CAR_DOOR_RF && vehToSeek->pPassengers[0] || m_vehDoor == CAR_DOOR_LR && vehToSeek->pPassengers[1] || m_vehDoor == CAR_DOOR_RR && vehToSeek->pPassengers[2])) { SetCarJack(vehToSeek); - if (m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER && m_vehEnterType != CAR_DOOR_LF) + if (m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER && m_vehDoor != CAR_DOOR_LF) vehToSeek->pDriver->bFleeAfterExitingCar = true; } else { - SetEnterCar(vehToSeek, m_vehEnterType); + SetEnterCar(vehToSeek, m_vehDoor); } break; case STATUS_ABANDONED: if (vehToSeek->IsBike()) { - if ((m_vehEnterType == CAR_DOOR_LR || m_vehEnterType == CAR_DOOR_RR) && vehToSeek->pPassengers[0]) { + if ((m_vehDoor == CAR_DOOR_LR || m_vehDoor == CAR_DOOR_RR) && vehToSeek->pPassengers[0]) { if (vehToSeek->pPassengers[0]->bDontDragMeOutCar) { if (IsPlayer()) - SetEnterCar(vehToSeek, m_vehEnterType); + SetEnterCar(vehToSeek, m_vehDoor); } else { SetCarJack(vehToSeek); } } else { - SetEnterCar(vehToSeek, m_vehEnterType); + SetEnterCar(vehToSeek, m_vehDoor); } - } else if (m_vehEnterType == CAR_DOOR_RF && vehToSeek->pPassengers[0]) { + } else if (m_vehDoor == CAR_DOOR_RF && vehToSeek->pPassengers[0]) { if (vehToSeek->pPassengers[0]->bDontDragMeOutCar) { if (IsPlayer()) - SetEnterCar(vehToSeek, m_vehEnterType); + SetEnterCar(vehToSeek, m_vehDoor); } else { SetCarJack(vehToSeek); } } else { - SetEnterCar(vehToSeek, m_vehEnterType); + SetEnterCar(vehToSeek, m_vehDoor); } break; case STATUS_WRECKED: @@ -7966,7 +7966,7 @@ CPed::LookForInterestingNodes(void) C2dEffect *effect; CMatrix *objMat; - if ((CTimer::GetFrameCounter() + (m_randomSeed % 256)) & 7 || CTimer::GetTimeInMilliseconds() <= m_standardTimer) { + if ((CTimer::GetFrameCounter() + (m_randomSeed % 256)) & 7 || CTimer::GetTimeInMilliseconds() <= m_chatTimer) { return false; } bool found = false; @@ -8076,7 +8076,7 @@ CPed::LookForInterestingNodes(void) float angleToFace = CGeneral::GetRadianAngleBetweenPoints(effectFrontLocal.x, effectFrontLocal.y, 0.0f, 0.0f); randVal = CGeneral::GetRandomNumber() % 256; if (randVal <= m_randomSeed % 256) { - m_standardTimer = CTimer::GetTimeInMilliseconds() + 2000; + m_chatTimer = CTimer::GetTimeInMilliseconds() + 2000; SetLookFlag(angleToFace, true); SetLookTimer(1000); return false; @@ -8299,7 +8299,7 @@ CPed::SetWaitState(eWaitState state, void *time) if (m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER && CharCreatedBy == RANDOM_CHAR && m_nPedState == PED_SEEK_CAR) { ClearObjective(); RestorePreviousState(); - m_hitRecoverTimer = CTimer::GetTimeInMilliseconds() + 30000; + m_carJackTimer = CTimer::GetTimeInMilliseconds() + 30000; } break; case WAITSTATE_TURN180: @@ -8328,7 +8328,7 @@ CPed::SetWaitState(eWaitState state, void *time) if (m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER && CharCreatedBy == RANDOM_CHAR && m_nPedState == PED_SEEK_CAR) { ClearObjective(); RestorePreviousState(); - m_hitRecoverTimer = CTimer::GetTimeInMilliseconds() + 30000; + m_carJackTimer = CTimer::GetTimeInMilliseconds() + 30000; } break; case WAITSTATE_LOOK_ABOUT: @@ -8980,14 +8980,14 @@ CPed::SetSolicit(uint32 time) if (CharCreatedBy != MISSION_CHAR && m_carInObjective->m_nNumGettingIn == 0 && CTimer::GetTimeInMilliseconds() < m_objectiveTimer) { - if (m_vehEnterType == CAR_DOOR_LF) { + if (m_vehDoor == CAR_DOOR_LF) { m_fRotationDest = m_carInObjective->GetForward().Heading() - HALFPI; } else { m_fRotationDest = m_carInObjective->GetForward().Heading() + HALFPI; } if (Abs(m_fRotationDest - m_fRotationCur) < HALFPI) { - m_standardTimer = CTimer::GetTimeInMilliseconds() + time; + m_chatTimer = CTimer::GetTimeInMilliseconds() + time; if(!m_carInObjective->bIsVan && !m_carInObjective->bIsBus) m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_HOOKERTALK, 4.0f); @@ -9001,8 +9001,8 @@ CPed::SetSolicit(uint32 time) void CPed::Solicit(void) { - if (m_standardTimer >= CTimer::GetTimeInMilliseconds() && m_carInObjective) { - CVector doorPos = GetPositionToOpenCarDoor(m_carInObjective, m_vehEnterType, 0.0f); + if (m_chatTimer >= CTimer::GetTimeInMilliseconds() && m_carInObjective) { + CVector doorPos = GetPositionToOpenCarDoor(m_carInObjective, m_vehDoor, 0.0f); Say(SOUND_PED_SOLICIT); if (FindPlayerVehicle() == m_carInObjective) { FindPlayerPed()->Say(SOUND_PED_SOLICIT); @@ -9062,7 +9062,7 @@ CPed::BuyIceCream(void) { if (m_carInObjective) { CPed *driver = m_carInObjective->pDriver; - if (driver && CTimer::GetTimeInMilliseconds() > m_standardTimer) { + if (driver && CTimer::GetTimeInMilliseconds() > m_chatTimer) { SetChat(driver, 8000); driver->SetChat(this, 8000); return; @@ -9138,7 +9138,7 @@ CPed::PossiblyFindBetterPosToSeekCar(CVector *pos, CVehicle *veh) bool canHeadToRf = NTVF_RF <= 0.0f || NTVF_RF >= HALFPI; // Only order of conditions are different among enterTypes. - if (m_vehEnterType == CAR_DOOR_RR) { + if (m_vehDoor == CAR_DOOR_RR) { if (canHeadToRr) { foundPos = rightRearPos; foundIt = true; @@ -9152,7 +9152,7 @@ CPed::PossiblyFindBetterPosToSeekCar(CVector *pos, CVehicle *veh) foundPos = leftFrontPos; foundIt = true; } - } else if(m_vehEnterType == CAR_DOOR_RF) { + } else if(m_vehDoor == CAR_DOOR_RF) { if (canHeadToRf) { foundPos = rightFrontPos; foundIt = true; @@ -9166,7 +9166,7 @@ CPed::PossiblyFindBetterPosToSeekCar(CVector *pos, CVehicle *veh) foundPos = leftRearPos; foundIt = true; } - } else if (m_vehEnterType == CAR_DOOR_LF) { + } else if (m_vehDoor == CAR_DOOR_LF) { if (canHeadToLf) { foundPos = leftFrontPos; foundIt = true; @@ -9180,7 +9180,7 @@ CPed::PossiblyFindBetterPosToSeekCar(CVector *pos, CVehicle *veh) foundPos = rightRearPos; foundIt = true; } - } else if (m_vehEnterType == CAR_DOOR_LR) { + } else if (m_vehDoor == CAR_DOOR_LR) { if (canHeadToLr) { foundPos = leftRearPos; foundIt = true; diff --git a/src/peds/Ped.h b/src/peds/Ped.h index 4056898e..242a86f2 100644 --- a/src/peds/Ped.h +++ b/src/peds/Ped.h @@ -596,7 +596,7 @@ public: float m_fRotationCur; float m_fRotationDest; float m_headingRate; - uint16 m_vehEnterType; + uint16 m_vehDoor; int16 m_walkAroundType; CPhysical *m_pCurrentPhysSurface; CVector m_vecOffsetFromPhysSurface; @@ -650,10 +650,10 @@ public: uint32 m_leaveCarTimer; uint32 m_getUpTimer; uint32 m_lookTimer; - uint32 m_standardTimer; + uint32 m_chatTimer; uint32 m_attackTimer; uint32 m_shootTimer; // shooting is a part of attack - uint32 m_hitRecoverTimer; + uint32 m_carJackTimer; uint32 m_objectiveTimer; uint32 m_duckTimer; uint32 m_duckAndCoverTimer; diff --git a/src/peds/PedAI.cpp b/src/peds/PedAI.cpp index 244c7b84..a28ded8c 100644 --- a/src/peds/PedAI.cpp +++ b/src/peds/PedAI.cpp @@ -1223,7 +1223,7 @@ CPed::ProcessObjective(void) bool foundSeat = false; if (m_carInObjective->IsBike()) { if (!m_carInObjective->pPassengers[0] && !(m_carInObjective->m_nGettingInFlags & (CAR_DOOR_FLAG_RR | CAR_DOOR_FLAG_LR))) { - m_vehEnterType = CAR_DOOR_RR; + m_vehDoor = CAR_DOOR_RR; foundSeat = true; } } else { @@ -1232,27 +1232,27 @@ CPed::ProcessObjective(void) if (m_carInObjective->pPassengers[2] || m_carInObjective->m_nGettingInFlags & CAR_DOOR_FLAG_RR) { foundSeat = false; } else { - m_vehEnterType = CAR_DOOR_RR; + m_vehDoor = CAR_DOOR_RR; foundSeat = true; } } else { - m_vehEnterType = CAR_DOOR_LR; + m_vehDoor = CAR_DOOR_LR; foundSeat = true; } } else { - m_vehEnterType = CAR_DOOR_RF; + m_vehDoor = CAR_DOOR_RF; foundSeat = true; } } for (int i = 2; i < m_carInObjective->m_nNumMaxPassengers; ++i) { if (!m_carInObjective->pPassengers[i] && !(m_carInObjective->m_nGettingInFlags & CAR_DOOR_FLAG_RF)) { - m_vehEnterType = CAR_DOOR_RF; + m_vehDoor = CAR_DOOR_RF; foundSeat = true; } } if (foundSeat) { - SetPosition(GetPositionToOpenCarDoor(m_carInObjective, m_vehEnterType)); - SetEnterCar(m_carInObjective, m_vehEnterType); + SetPosition(GetPositionToOpenCarDoor(m_carInObjective, m_vehDoor)); + SetEnterCar(m_carInObjective, m_vehDoor); } } m_objectiveTimer = 0; @@ -1565,7 +1565,7 @@ CPed::ProcessObjective(void) if (bInVehicle) { bScriptObjectiveCompleted = true; RestorePreviousObjective(); - } else if (m_hitRecoverTimer < CTimer::GetTimeInMilliseconds()) { + } else if (m_carJackTimer < CTimer::GetTimeInMilliseconds()) { CVehicle *carToSteal = nil; float closestCarDist = nEnterCarRangeMultiplier * ENTER_CAR_MAX_DIST; CVector pos = GetPosition(); @@ -1590,7 +1590,7 @@ CPed::ProcessObjective(void) } if (carToSteal) { SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, carToSteal); - m_hitRecoverTimer = CTimer::GetTimeInMilliseconds() + 5000; + m_carJackTimer = CTimer::GetTimeInMilliseconds() + 5000; } else { RestorePreviousObjective(); RestorePreviousState(); @@ -2382,7 +2382,7 @@ CPed::PedAnimAlignCB(CAnimBlendAssociation *animAssoc, void *arg) return; } - if (!ped->m_vehEnterType) { + if (!ped->m_vehDoor) { ped->QuitEnteringCar(); return; } @@ -2396,7 +2396,7 @@ CPed::PedAnimAlignCB(CAnimBlendAssociation *animAssoc, void *arg) bool itsLow = !!veh->bLowVehicle; eDoors enterDoor; - switch (ped->m_vehEnterType) { + switch (ped->m_vehDoor) { case CAR_DOOR_RF: itsVan = false; enterDoor = DOOR_FRONT_RIGHT; @@ -2418,7 +2418,7 @@ CPed::PedAnimAlignCB(CAnimBlendAssociation *animAssoc, void *arg) if (veh->IsBike()) { CPed *pedToDragOut = nil; if (veh->GetStatus() == STATUS_ABANDONED) { - if (ped->m_vehEnterType == CAR_WINDSCREEN) { + if (ped->m_vehDoor == CAR_WINDSCREEN) { ped->m_pVehicleAnim = CAnimManager::BlendAnimation(ped->GetClump(), ((CBike*)veh)->m_bikeAnimType, ANIM_BIKE_KICK, 6.0f); ped->m_pVehicleAnim->SetFinishCallback(PedAnimGetInCB, ped); ((CBike*)veh)->bIsBeingPickedUp = true; @@ -2444,7 +2444,7 @@ CPed::PedAnimAlignCB(CAnimBlendAssociation *animAssoc, void *arg) ped->m_pVehicleAnim->SetFinishCallback(PedAnimGetInCB, ped); ((CBike*)veh)->bIsBeingPickedUp = true; } - } else if (ped->m_vehEnterType == CAR_WINDSCREEN) { + } else if (ped->m_vehDoor == CAR_WINDSCREEN) { if (veh->pDriver->m_nPedState != PED_DRIVING || veh->pDriver->bDontDragMeOutCar) { ped->QuitEnteringCar(); } else { @@ -2458,7 +2458,7 @@ CPed::PedAnimAlignCB(CAnimBlendAssociation *animAssoc, void *arg) if (veh->pDriver) { if (veh->m_vecMoveSpeed.Magnitude() > 0.2f) { ped->QuitEnteringCar(); - ped->SetFall(1000, ped->m_vehEnterType == CAR_DOOR_LF || ped->m_vehEnterType == CAR_DOOR_LR ? ANIM_KO_SPIN_L : ANIM_KO_SPIN_R, false); + ped->SetFall(1000, ped->m_vehDoor == CAR_DOOR_LF || ped->m_vehDoor == CAR_DOOR_LR ? ANIM_KO_SPIN_L : ANIM_KO_SPIN_R, false); return; } if (veh->pDriver->m_nPedState != PED_DRIVING || veh->pDriver->bDontDragMeOutCar) { @@ -2479,7 +2479,7 @@ CPed::PedAnimAlignCB(CAnimBlendAssociation *animAssoc, void *arg) if (veh->pPassengers[0]) { if (veh->m_vecMoveSpeed.Magnitude() > 0.2f) { ped->QuitEnteringCar(); - ped->SetFall(1000, ped->m_vehEnterType == CAR_DOOR_LF || ped->m_vehEnterType == CAR_DOOR_LR ? ANIM_KO_SPIN_L : ANIM_KO_SPIN_R, false); + ped->SetFall(1000, ped->m_vehDoor == CAR_DOOR_LF || ped->m_vehDoor == CAR_DOOR_LR ? ANIM_KO_SPIN_L : ANIM_KO_SPIN_R, false); return; } if (veh->pPassengers[0]->m_nPedState != PED_DRIVING || veh->pPassengers[0]->bDontDragMeOutCar) { @@ -2502,7 +2502,7 @@ CPed::PedAnimAlignCB(CAnimBlendAssociation *animAssoc, void *arg) } if (pedToDragOut) { - pedToDragOut->SetBeingDraggedFromCar(veh, ped->m_vehEnterType, false); + pedToDragOut->SetBeingDraggedFromCar(veh, ped->m_vehDoor, false); if (pedToDragOut->IsGangMember()) pedToDragOut->RegisterThreatWithGangPeds(ped); @@ -2580,7 +2580,7 @@ CPed::PedAnimAlignCB(CAnimBlendAssociation *animAssoc, void *arg) } if (player != veh->pDriver) { - veh->pDriver->SetBeingDraggedFromCar(veh, ped->m_vehEnterType, true); + veh->pDriver->SetBeingDraggedFromCar(veh, ped->m_vehDoor, true); if (veh->pDriver->IsGangMember()) veh->pDriver->RegisterThreatWithGangPeds(ped); } @@ -2630,7 +2630,7 @@ CPed::PedAnimDoorOpenCB(CAnimBlendAssociation* animAssoc, void* arg) eDoors door; CPed *pedInSeat = nil; - switch (ped->m_vehEnterType) { + switch (ped->m_vehDoor) { case CAR_DOOR_RF: door = DOOR_FRONT_RIGHT; pedInSeat = veh->pPassengers[0]; @@ -2688,21 +2688,21 @@ CPed::PedAnimDoorOpenCB(CAnimBlendAssociation* animAssoc, void* arg) if (veh->m_vecMoveSpeed.Magnitude() > 0.2f || veh->IsCar() && veh->GetVehicleAppearance() == VEHICLE_APPEARANCE_HELI && ((CAutomobile*)veh)->m_nWheelsOnGround == 0) { ped->QuitEnteringCar(); - if (ped->m_vehEnterType != CAR_DOOR_LF && ped->m_vehEnterType != CAR_DOOR_LR) + if (ped->m_vehDoor != CAR_DOOR_LF && ped->m_vehDoor != CAR_DOOR_LR) ped->SetFall(1000, ANIM_KO_SPIN_R, false); else ped->SetFall(1000, ANIM_KO_SPIN_L, false); return; } - veh->ProcessOpenDoor(ped->m_vehEnterType, ANIM_CAR_OPEN_LHS, 1.0f); + veh->ProcessOpenDoor(ped->m_vehDoor, ANIM_CAR_OPEN_LHS, 1.0f); - if (ped->m_vehEnterType == CAR_DOOR_LF || ped->m_vehEnterType == CAR_DOOR_RF) + if (ped->m_vehDoor == CAR_DOOR_LF || ped->m_vehDoor == CAR_DOOR_RF) isVan = false; if (ped->m_nPedState != PED_CARJACK || isBus) { - if (ped->m_vehEnterType == CAR_DOOR_LF || ped->m_vehEnterType == CAR_DOOR_LR) { + if (ped->m_vehDoor == CAR_DOOR_LF || ped->m_vehDoor == CAR_DOOR_LR) { if (veh->IsBike()) { ped->m_pVehicleAnim = CAnimManager::AddAnimation(ped->GetClump(), ((CBike*)veh)->m_bikeAnimType, ANIM_BIKE_JUMPON_R); } else if (isVan) { @@ -2727,14 +2727,14 @@ CPed::PedAnimDoorOpenCB(CAnimBlendAssociation* animAssoc, void* arg) ped->m_pVehicleAnim = CAnimManager::AddAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_CAR_GETIN_RHS); } - if (ped->m_vehEnterType == CAR_DOOR_RF && pedInSeat && veh->IsCar()) + if (ped->m_vehDoor == CAR_DOOR_RF && pedInSeat && veh->IsCar()) pedInSeat->SetObjective(OBJECTIVE_LEAVE_CAR, veh); } ped->m_pVehicleAnim->SetFinishCallback(PedAnimGetInCB, ped); } else { CPed *pedToDragOut = nil; - switch (ped->m_vehEnterType) { + switch (ped->m_vehDoor) { case CAR_DOOR_RF: pedToDragOut = veh->pPassengers[0]; break; case CAR_DOOR_RR: pedToDragOut = veh->pPassengers[2]; break; case CAR_DOOR_LF: pedToDragOut = veh->pDriver; break; @@ -2748,7 +2748,7 @@ CPed::PedAnimDoorOpenCB(CAnimBlendAssociation* animAssoc, void* arg) ((CCopPed*)ped)->SetArrestPlayer(ped->m_pedInObjective); } - if (ped->m_vehEnterType != CAR_DOOR_LF && ped->m_vehEnterType != CAR_DOOR_LR) { + if (ped->m_vehDoor != CAR_DOOR_LF && ped->m_vehDoor != CAR_DOOR_LR) { if (pedToDragOut && !pedToDragOut->bDontDragMeOutCar) { if (pedToDragOut->m_nPedState != PED_DRIVING) { @@ -2818,7 +2818,7 @@ CPed::PedAnimDoorOpenCB(CAnimBlendAssociation* animAssoc, void* arg) } if (player != pedToDragOut) { - pedToDragOut->SetBeingDraggedFromCar(veh, ped->m_vehEnterType, false); + pedToDragOut->SetBeingDraggedFromCar(veh, ped->m_vehDoor, false); if (pedToDragOut->IsGangMember()) pedToDragOut->RegisterThreatWithGangPeds(ped); } @@ -2889,7 +2889,7 @@ CPed::PedAnimPullPedOutCB(CAnimBlendAssociation* animAssoc, void* arg) } if (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER) { - if (ped->m_vehEnterType == CAR_DOOR_LF || ped->m_vehEnterType == CAR_DOOR_LR) { + if (ped->m_vehDoor == CAR_DOOR_LF || ped->m_vehDoor == CAR_DOOR_LR) { if (veh->IsBike()) ped->m_pVehicleAnim = CAnimManager::AddAnimation(ped->GetClump(), ((CBike*)veh)->m_bikeAnimType, ANIM_BIKE_JUMPON_R); else if (isLow) @@ -2946,7 +2946,7 @@ CPed::PedAnimGetInCB(CAnimBlendAssociation *animAssoc, void *arg) } return; } - if (ped->IsPlayer() && ped->m_vehEnterType == CAR_DOOR_LF + if (ped->IsPlayer() && ped->m_vehDoor == CAR_DOOR_LF && (Pads[0].GetAccelerate() >= 255.0f || Pads[0].GetBrake() >= 255.0f) && veh->IsCar() && !veh->pDriver) { @@ -2965,7 +2965,7 @@ CPed::PedAnimGetInCB(CAnimBlendAssociation *animAssoc, void *arg) bool isBus = !!veh->bIsBus; bool isLow = !!veh->bLowVehicle; eDoors enterDoor; - switch (ped->m_vehEnterType) { + switch (ped->m_vehDoor) { case CAR_DOOR_RF: isVan = false; enterDoor = DOOR_FRONT_RIGHT; @@ -3011,7 +3011,7 @@ CPed::PedAnimGetInCB(CAnimBlendAssociation *animAssoc, void *arg) ped->m_leaveCarTimer = CTimer::GetTimeInMilliseconds() + 400; return; } - if (driver != ped && ped->m_vehEnterType != CAR_DOOR_LF) { + if (driver != ped && ped->m_vehDoor != CAR_DOOR_LF) { if (!driver->IsPlayer()) { driver->bUsePedNodeSeek = true; driver->m_pLastPathNode = nil; @@ -3094,10 +3094,10 @@ CPed::PedAnimDoorCloseCB(CAnimBlendAssociation *animAssoc, void *arg) bool isLow = !!veh->bLowVehicle; if (!veh->bIsBus) - veh->ProcessOpenDoor(ped->m_vehEnterType, ANIM_CAR_CLOSEDOOR_LHS, 1.0f); + veh->ProcessOpenDoor(ped->m_vehDoor, ANIM_CAR_CLOSEDOOR_LHS, 1.0f); eDoors door; - switch (ped->m_vehEnterType) { + switch (ped->m_vehDoor) { case CAR_DOOR_RF: door = DOOR_FRONT_RIGHT; break; case CAR_DOOR_RR: door = DOOR_REAR_RIGHT; break; case CAR_DOOR_LF: door = DOOR_FRONT_LEFT; break; @@ -3110,7 +3110,7 @@ CPed::PedAnimDoorCloseCB(CAnimBlendAssociation *animAssoc, void *arg) if (door == DOOR_FRONT_LEFT || ped->m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER || veh->bIsBus || veh->m_nNumMaxPassengers == 0) { PedSetInCarCB(nil, ped); - } else if (ped->m_vehEnterType == CAR_DOOR_RF + } else if (ped->m_vehDoor == CAR_DOOR_RF && (veh->m_nGettingInFlags & CAR_DOOR_FLAG_LF || (veh->pDriver != nil && (veh->pDriver->m_objective != OBJECTIVE_LEAVE_CAR @@ -3263,7 +3263,7 @@ CPed::PedAnimStepOutCarCB(CAnimBlendAssociation* animAssoc, void* arg) veh->m_vecMoveSpeed += CVector(0.001f, 0.001f, 0.001f); veh->m_vecTurnSpeed += CVector(0.001f, 0.001f, 0.001f); if (!veh->bIsBus) - veh->ProcessOpenDoor(ped->m_vehEnterType, ANIM_CAR_GETOUT_LHS, 1.0f); + veh->ProcessOpenDoor(ped->m_vehDoor, ANIM_CAR_GETOUT_LHS, 1.0f); /* // Duplicate and only in PC for some reason @@ -3273,7 +3273,7 @@ CPed::PedAnimStepOutCarCB(CAnimBlendAssociation* animAssoc, void* arg) } */ eDoors door; - switch (ped->m_vehEnterType) { + switch (ped->m_vehDoor) { case CAR_DOOR_RF: door = DOOR_FRONT_RIGHT; break; @@ -3442,7 +3442,7 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase) if (veh->GetUp().z <= -0.8f) vehIsUpsideDown = true; - if (m_vehEnterType == CAR_DOOR_RF || m_vehEnterType == CAR_DOOR_RR) { + if (m_vehDoor == CAR_DOOR_RF || m_vehDoor == CAR_DOOR_RR) { if (vehIsUpsideDown) { m_fRotationDest = -PI + veh->GetForward().Heading(); } else if (veh->bIsBus) { @@ -3450,7 +3450,7 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase) } else { m_fRotationDest = veh->GetForward().Heading(); } - } else if (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR) { + } else if (m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_LR) { if (vehIsUpsideDown) { m_fRotationDest = veh->GetForward().Heading(); } else if (veh->bIsBus) { @@ -3465,7 +3465,7 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase) m_fRotationDest = veh->GetForward().Heading(); } else if (veh->bIsBus) { m_fRotationDest = 0.5f * PI + veh->GetForward().Heading(); - } else if (m_vehEnterType == CAR_WINDSCREEN) { + } else if (m_vehDoor == CAR_WINDSCREEN) { m_fRotationDest = veh->GetForward().Heading() + PI; } else { m_fRotationDest = veh->GetForward().Heading(); @@ -3573,7 +3573,7 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase) if (phase == LINE_UP_TO_CAR_2) { neededPos = GetPosition(); } else { - neededPos = GetPositionToOpenCarDoor(veh, m_vehEnterType, seatPosMult); + neededPos = GetPositionToOpenCarDoor(veh, m_vehDoor, seatPosMult); } autoZPos = neededPos; @@ -3690,13 +3690,13 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase) SetHeading(m_fRotationCur); } else { CMatrix vehDoorMat(veh->GetMatrix()); - vehDoorMat.GetPosition() += Multiply3x3(vehDoorMat, GetLocalPositionToOpenCarDoor(veh, m_vehEnterType, 0.0f)); + vehDoorMat.GetPosition() += Multiply3x3(vehDoorMat, GetLocalPositionToOpenCarDoor(veh, m_vehDoor, 0.0f)); - if (m_vehEnterType == CAR_WINDSCREEN || veh->bIsBus) { + if (m_vehDoor == CAR_WINDSCREEN || veh->bIsBus) { CMatrix correctionMat; - if (veh->bIsBus && (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR)) + if (veh->bIsBus && (m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_LR)) correctionMat.SetRotateZ(-HALFPI); - else if (veh->bIsBus && (m_vehEnterType == CAR_DOOR_RF || m_vehEnterType == CAR_DOOR_RR)) + else if (veh->bIsBus && (m_vehDoor == CAR_DOOR_RF || m_vehDoor == CAR_DOOR_RR)) correctionMat.SetRotateZ(HALFPI); else correctionMat.SetRotateZ(PI); @@ -3720,7 +3720,7 @@ CPed::SetCarJack(CVehicle* car) return; if (car->IsBike()) { - switch (m_vehEnterType) { + switch (m_vehDoor) { case CAR_DOOR_RF: doorFlag = CAR_DOOR_FLAG_LF | CAR_DOOR_FLAG_RF; door = DOOR_FRONT_RIGHT; @@ -3747,7 +3747,7 @@ CPed::SetCarJack(CVehicle* car) break; } } else { - switch (m_vehEnterType) { + switch (m_vehDoor) { case CAR_DOOR_RF: doorFlag = CAR_DOOR_FLAG_RF; door = DOOR_FRONT_RIGHT; @@ -3788,7 +3788,7 @@ CPed::SetCarJack(CVehicle* car) if (m_nPedState != PED_CARJACK && !m_pVehicleAnim) if ((car->IsDoorReady(door) || car->IsDoorFullyOpen(door))) if (!car->bIsBeingCarJacked && !(doorFlag & car->m_nGettingInFlags) && !(doorFlag & car->m_nGettingOutFlags)) - SetCarJack_AllClear(car, m_vehEnterType, doorFlag); + SetCarJack_AllClear(car, m_vehDoor, doorFlag); } // --MIAMI: Done @@ -3812,7 +3812,7 @@ CPed::SetCarJack_AllClear(CVehicle* car, uint32 doorNode, uint32 doorFlag) Say(SOUND_PED_CAR_JACKING, 1000); CVector carEnterPos; - carEnterPos = GetPositionToOpenCarDoor(car, m_vehEnterType); + carEnterPos = GetPositionToOpenCarDoor(car, m_vehDoor); car->m_nGettingInFlags |= doorFlag; m_vecOffsetSeek = carEnterPos - GetPosition(); @@ -3825,7 +3825,7 @@ CPed::SetCarJack_AllClear(CVehicle* car, uint32 doorNode, uint32 doorFlag) float zDiff = Max(0.0f, carEnterPos.z - GetPosition().z); bUsesCollision = false; - if (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR) + if (m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_LR) m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, zDiff > 4.4f ? ANIM_CAR_ALIGNHI_LHS : ANIM_CAR_ALIGN_LHS, 4.0f); else m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, zDiff > 4.4f ? ANIM_CAR_ALIGNHI_RHS : ANIM_CAR_ALIGN_RHS, 4.0f); @@ -3851,14 +3851,14 @@ CPed::SetBeingDraggedFromCar(CVehicle *veh, uint32 vehEnterType, bool quickJack) if (veh->IsBike()) { ((CBike*)veh)->bIsBeingPickedUp = true; if (veh->pPassengers[0] != this && (vehEnterType != CAR_WINDSCREEN || veh->pPassengers[0])) - m_vehEnterType = CAR_DOOR_LF; + m_vehDoor = CAR_DOOR_LF; else - m_vehEnterType = CAR_DOOR_LR; + m_vehDoor = CAR_DOOR_LR; } else { - m_vehEnterType = vehEnterType; + m_vehDoor = vehEnterType; } - if (m_vehEnterType == CAR_DOOR_LF) { + if (m_vehDoor == CAR_DOOR_LF) { if (veh->pDriver && veh->pDriver->IsPlayer()) veh->SetStatus(STATUS_PLAYER_DISABLED); else @@ -3878,9 +3878,9 @@ CPed::SetBeingDraggedFromCar(CVehicle *veh, uint32 vehEnterType, bool quickJack) SetRadioStation(); if(veh->IsBike()) - veh->m_nGettingOutFlags |= GetBikeDoorFlagInclJumpInFromFront(m_vehEnterType); + veh->m_nGettingOutFlags |= GetBikeDoorFlagInclJumpInFromFront(m_vehDoor); else - veh->m_nGettingOutFlags |= GetCarDoorFlag(m_vehEnterType); + veh->m_nGettingOutFlags |= GetCarDoorFlag(m_vehDoor); } // --MIAMI: Done @@ -3899,15 +3899,15 @@ CPed::BeingDraggedFromCar(void) assocGroup = ((CBike*)m_pMyVehicle)->m_bikeAnimType; } else { - if (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR) { - if (bWillBeQuickJacked && m_vehEnterType == CAR_DOOR_LF) { + if (m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_LR) { + if (bWillBeQuickJacked && m_vehDoor == CAR_DOOR_LF) { enterAnim = ANIM_CAR_QJACKED; } else if (m_pMyVehicle->bLowVehicle) { enterAnim = ANIM_CAR_LJACKED_LHS; } else { enterAnim = ANIM_CAR_JACKED_LHS; } - } else if (m_vehEnterType == CAR_DOOR_RF || m_vehEnterType == CAR_DOOR_RR) { + } else if (m_vehDoor == CAR_DOOR_RF || m_vehDoor == CAR_DOOR_RR) { if (m_pMyVehicle->bLowVehicle) enterAnim = ANIM_CAR_LJACKED_RHS; else @@ -3944,7 +3944,7 @@ CPed::BeingDraggedFromCar(void) static float mult = 5.f; if (m_objective == OBJECTIVE_LEAVE_CAR_AND_DIE) { if (m_pMyVehicle) { - m_pMyVehicle->ProcessOpenDoor(m_vehEnterType, NUM_STD_ANIMS, m_pVehicleAnim->currentTime * mult); + m_pMyVehicle->ProcessOpenDoor(m_vehDoor, NUM_STD_ANIMS, m_pVehicleAnim->currentTime * mult); } } } @@ -3960,7 +3960,7 @@ CPed::SetEnterCar(CVehicle *car, uint32 unused) uint8 doorFlag; eDoors door; if (car->IsBike()) { - switch (m_vehEnterType) { + switch (m_vehDoor) { case CAR_DOOR_RF: doorFlag = CAR_DOOR_FLAG_RF | CAR_DOOR_FLAG_LF; door = DOOR_FRONT_RIGHT; @@ -3986,7 +3986,7 @@ CPed::SetEnterCar(CVehicle *car, uint32 unused) break; } } else { - switch (m_vehEnterType) { + switch (m_vehDoor) { case CAR_DOOR_RF: doorFlag = CAR_DOOR_FLAG_RF; door = DOOR_FRONT_RIGHT; @@ -4022,7 +4022,7 @@ CPed::SetEnterCar(CVehicle *car, uint32 unused) || doorFlag && !car->IsDoorReady(door) && !car->IsDoorFullyOpen(door)) SetMoveState(PEDMOVE_STILL); else - SetEnterCar_AllClear(car, m_vehEnterType, doorFlag); + SetEnterCar_AllClear(car, m_vehDoor, doorFlag); } } @@ -4038,9 +4038,9 @@ CPed::SetEnterCar_AllClear(CVehicle *car, uint32 doorNode, uint32 doorFlag) m_pSeekTarget = car; m_pSeekTarget->RegisterReference((CEntity **) &m_pSeekTarget); - m_vehEnterType = doorNode; + m_vehDoor = doorNode; SetPedState(PED_ENTER_CAR); - if (m_vehEnterType == CAR_DOOR_RF && m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER && !car->IsBike()) { + if (m_vehDoor == CAR_DOOR_RF && m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER && !car->IsBike()) { car->bIsBeingCarJacked = true; } @@ -4048,7 +4048,7 @@ CPed::SetEnterCar_AllClear(CVehicle *car, uint32 doorNode, uint32 doorFlag) m_pMyVehicle->RegisterReference((CEntity**) &m_pMyVehicle); ((CVehicle*)m_pSeekTarget)->m_nNumGettingIn++; bUsesCollision = false; - CVector doorOpenPos = GetPositionToOpenCarDoor(car, m_vehEnterType); + CVector doorOpenPos = GetPositionToOpenCarDoor(car, m_vehDoor); // Because buses have stairs if (!m_pMyVehicle->bIsBus) @@ -4071,7 +4071,7 @@ CPed::SetEnterCar_AllClear(CVehicle *car, uint32 doorNode, uint32 doorFlag) car->AutoPilot.m_nCruiseSpeed = 0; } else { - if (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR) + if (m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_LR) m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, zDiff > 4.4f ? ANIM_CAR_ALIGNHI_RHS : ANIM_CAR_ALIGN_RHS, 4.0f); else m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, zDiff > 4.4f ? ANIM_CAR_ALIGNHI_LHS : ANIM_CAR_ALIGN_LHS, 4.0f); @@ -4087,11 +4087,11 @@ CPed::EnterCar(void) CVehicle *veh = m_pMyVehicle; // Not used. - // CVector posForDoor = GetPositionToOpenCarDoor(veh, m_vehEnterType); + // CVector posForDoor = GetPositionToOpenCarDoor(veh, m_vehDoor); if (veh->CanPedOpenLocks(this)) { - if (m_vehEnterType && m_pVehicleAnim) { - veh->ProcessOpenDoor(m_vehEnterType, m_pVehicleAnim->animId, m_pVehicleAnim->currentTime); + if (m_vehDoor && m_pVehicleAnim) { + veh->ProcessOpenDoor(m_vehDoor, m_pVehicleAnim->animId, m_pVehicleAnim->currentTime); } } bIsInTheAir = false; @@ -4147,10 +4147,10 @@ CPed::QuitEnteringCar(void) RestorePreviousObjective(); if (veh->IsBike()) { - veh->m_nGettingInFlags &= ~GetBikeDoorFlag(m_vehEnterType); + veh->m_nGettingInFlags &= ~GetBikeDoorFlag(m_vehDoor); ((CBike*)veh)->bIsBeingPickedUp = false; } else - veh->m_nGettingInFlags &= ~GetEnterCarDoorFlag(m_vehEnterType, veh->m_nNumMaxPassengers); + veh->m_nGettingInFlags &= ~GetEnterCarDoorFlag(m_vehDoor, veh->m_nNumMaxPassengers); } bUsesCollision = true; @@ -4184,7 +4184,7 @@ CPed::SetExitBoat(CVehicle *boat) newPos = { 0.0f, 0.0f, boatCol->boundingBox.min.z }; newPos = boat->GetMatrix() * newPos; newPos.z += 1.0f; - m_vehEnterType = CAR_DOOR_RF; + m_vehDoor = CAR_DOOR_RF; PedSetOutCarCB(nil, this); bIsStanding = true; m_pCurSurface = boat; @@ -4193,7 +4193,7 @@ CPed::SetExitBoat(CVehicle *boat) } else { if (boat->m_modelIndex == MI_SKIMMER) { if (!boat->bIsInWater) { - m_vehEnterType = CAR_DOOR_RF; + m_vehDoor = CAR_DOOR_RF; PedSetOutCarCB(nil, this); bIsStanding = true; SetMoveState(PEDMOVE_STILL); @@ -4214,7 +4214,7 @@ CPed::SetExitBoat(CVehicle *boat) newPos.z += 2.0f; } - m_vehEnterType = CAR_DOOR_RF; + m_vehDoor = CAR_DOOR_RF; PedSetOutCarCB(nil, this); bIsStanding = true; m_pCurSurface = boat; @@ -4455,14 +4455,14 @@ CPed::SetExitCar(CVehicle *veh, uint32 wantedDoorNode) // needed for PositionPedOutOfCollision() optedDoorNode = firstOptedDoor; - m_vehEnterType = firstOptedDoor; + m_vehDoor = firstOptedDoor; PositionPedOutOfCollision(); teleportNeeded = true; } } if (!teleportNeeded && veh->IsOnItsSide()) { - m_vehEnterType = optedDoorNode; + m_vehDoor = optedDoorNode; PositionPedOutOfCollision(); teleportNeeded = true; } @@ -4480,7 +4480,7 @@ CPed::SetExitCar(CVehicle *veh, uint32 wantedDoorNode) bUsesCollision = false; m_pSeekTarget = veh; m_pSeekTarget->RegisterReference((CEntity**) &m_pSeekTarget); - m_vehEnterType = optedDoorNode; + m_vehDoor = optedDoorNode; SetPedState(PED_EXIT_CAR); if (m_pVehicleAnim && m_pVehicleAnim->flags & ASSOC_PARTIAL) m_pVehicleAnim->blendDelta = -1000.0f; @@ -4493,16 +4493,16 @@ CPed::SetExitCar(CVehicle *veh, uint32 wantedDoorNode) PedSetOutCarCB(nil, this); } else { if (veh->GetUp().z <= -0.8f && !veh->IsBike()) { - if (m_vehEnterType == CAR_DOOR_RF || m_vehEnterType == CAR_DOOR_RR) { + if (m_vehDoor == CAR_DOOR_RF || m_vehDoor == CAR_DOOR_RR) { m_pVehicleAnim = CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_CRAWLOUT_RHS2); - } else if (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR) { + } else if (m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_LR) { m_pVehicleAnim = CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_CRAWLOUT_RHS); } m_pVehicleAnim->SetFinishCallback(PedSetOutCarCB, this); } else if (veh->IsBike()) { CBike* bike = (CBike*)veh; - switch (m_vehEnterType) { + switch (m_vehDoor) { case CAR_BUMP_REAR: case CAR_BOOT: m_pVehicleAnim = CAnimManager::AddAnimation(GetClump(), bike->m_bikeAnimType, ANIM_BIKE_GETOFF_BACK); @@ -4521,7 +4521,7 @@ CPed::SetExitCar(CVehicle *veh, uint32 wantedDoorNode) int8 exitFlags = 0; // Bike door flags incl. passenger jump off - switch (m_vehEnterType) { + switch (m_vehDoor) { case CAR_BUMP_REAR: case CAR_DOOR_RR: case CAR_DOOR_LR: @@ -4535,7 +4535,7 @@ CPed::SetExitCar(CVehicle *veh, uint32 wantedDoorNode) } // Passenger get off - if (m_vehEnterType == CAR_BUMP_REAR || m_vehEnterType == CAR_BOOT) { + if (m_vehDoor == CAR_BUMP_REAR || m_vehDoor == CAR_BOOT) { m_pVehicleAnim->SetFinishCallback(RestoreHeadingRateCB, this); m_headingRate = 0.0f; @@ -4545,7 +4545,7 @@ CPed::SetExitCar(CVehicle *veh, uint32 wantedDoorNode) } } else { - switch (m_vehEnterType) { + switch (m_vehDoor) { case CAR_DOOR_RF: if (canJumpOut) { m_pVehicleAnim = CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_ROLLOUT_RHS); @@ -4596,7 +4596,7 @@ CPed::SetExitCar(CVehicle *veh, uint32 wantedDoorNode) break; } if (!bBusJacked && !canJumpOut) { - veh->m_nGettingOutFlags |= GetCarDoorFlag(m_vehEnterType); + veh->m_nGettingOutFlags |= GetCarDoorFlag(m_vehDoor); } m_pVehicleAnim->SetFinishCallback(canJumpOut ? RestoreHeadingRateCB : PedAnimStepOutCarCB, this); } @@ -4622,7 +4622,7 @@ CPed::ExitCar(void) if (!m_pVehicleAnim) { if (InVehicle()) { if (m_pMyVehicle->IsBike()) { - if (m_vehEnterType == CAR_BOOT || m_vehEnterType == CAR_BUMP_REAR) { + if (m_vehDoor == CAR_BOOT || m_vehDoor == CAR_BUMP_REAR) { ((CBike*)m_pMyVehicle)->KnockOffRider(WEAPONTYPE_UNARMED, 0, this, false); } } else if (m_pMyVehicle->IsCar()) { @@ -4656,7 +4656,7 @@ CPed::ExitCar(void) LineUpPedWithCar(LINE_UP_TO_CAR_FALL); } } else { - m_pMyVehicle->ProcessOpenDoor(m_vehEnterType, exitAnim, animTime); + m_pMyVehicle->ProcessOpenDoor(m_vehDoor, exitAnim, animTime); if (m_pSeekTarget) { // Car is upside down @@ -4718,17 +4718,17 @@ CPed::GetNearestDoor(CVehicle *veh, CVector &posToOpen) angleDiff += TWOPI; if (Abs(angleDiff) < DEGTORAD(30.f) - && (IsPlayer() && ((CPlayerPed*)this)->m_fMoveSpeed > 1.5f && !m_vehEnterType || + && (IsPlayer() && ((CPlayerPed*)this)->m_fMoveSpeed > 1.5f && !m_vehDoor || !IsPlayer() && m_nPedType != PEDTYPE_COP && m_nMoveState == PEDMOVE_RUN && m_pedStats->m_temper > 65 - && !m_vehEnterType || m_vehEnterType == CAR_WINDSCREEN)) { - m_vehEnterType = CAR_WINDSCREEN; + && !m_vehDoor || m_vehDoor == CAR_WINDSCREEN)) { + m_vehDoor = CAR_WINDSCREEN; posToOpen = GetPositionToOpenCarDoor(veh, CAR_WINDSCREEN); return; } } } - } else if (m_vehEnterType == CAR_DOOR_LF && veh->pDriver && !veh->bLowVehicle && !veh->bIsBus) { + } else if (m_vehDoor == CAR_DOOR_LF && veh->pDriver && !veh->bLowVehicle && !veh->bIsBus) { enterOffset = &vecPedQuickDraggedOutCarAnimOffset; } @@ -4739,10 +4739,10 @@ CPed::GetNearestDoor(CVehicle *veh, CVector &posToOpen) if ((lfPos - GetPosition()).MagnitudeSqr2D() < (rfPos - GetPosition()).MagnitudeSqr2D()) { if (veh->IsRoomForPedToLeaveCar(CAR_DOOR_LF, enterOffset)) { - m_vehEnterType = CAR_DOOR_LF; + m_vehDoor = CAR_DOOR_LF; posToOpen = lfPos; } else if (veh->IsRoomForPedToLeaveCar(CAR_DOOR_RF, enterOffset)) { - m_vehEnterType = CAR_DOOR_RF; + m_vehDoor = CAR_DOOR_RF; posToOpen = rfPos; } } else { @@ -4756,14 +4756,14 @@ CPed::GetNearestDoor(CVehicle *veh, CVector &posToOpen) && veh->IsRoomForPedToLeaveCar(CAR_DOOR_LF, enterOffset) || (veh->m_nGettingInFlags & CAR_DOOR_FLAG_RF) && veh->IsRoomForPedToLeaveCar(CAR_DOOR_LF, enterOffset)) { - m_vehEnterType = CAR_DOOR_LF; + m_vehDoor = CAR_DOOR_LF; posToOpen = lfPos; } else { - m_vehEnterType = CAR_DOOR_RF; + m_vehDoor = CAR_DOOR_RF; posToOpen = rfPos; } } else if (veh->IsRoomForPedToLeaveCar(CAR_DOOR_LF, enterOffset)) { - m_vehEnterType = CAR_DOOR_LF; + m_vehDoor = CAR_DOOR_LF; posToOpen = lfPos; } } @@ -4780,7 +4780,7 @@ CPed::GetNearestPassengerDoor(CVehicle *veh, CVector &posToOpen) switch (veh->GetModelIndex()) { case MI_BUS: - m_vehEnterType = CAR_DOOR_RF; + m_vehDoor = CAR_DOOR_RF; posToOpen = GetPositionToOpenCarDoor(veh, CAR_DOOR_RF); return true; case MI_RHINO: @@ -4839,15 +4839,15 @@ CPed::GetNearestPassengerDoor(CVehicle *veh, CVector &posToOpen) CVector2D nextToCompare = rfPosDist; posToOpen = rfPos; - m_vehEnterType = CAR_DOOR_RF; + m_vehDoor = CAR_DOOR_RF; if (lrPosDist.MagnitudeSqr() < nextToCompare.MagnitudeSqr()) { - m_vehEnterType = CAR_DOOR_LR; + m_vehDoor = CAR_DOOR_LR; posToOpen = lrPos; nextToCompare = lrPosDist; } if (rrPosDist.MagnitudeSqr() < nextToCompare.MagnitudeSqr()) { - m_vehEnterType = CAR_DOOR_RR; + m_vehDoor = CAR_DOOR_RR; posToOpen = rrPos; } return canEnter; @@ -4870,7 +4870,7 @@ void CPed::PedSetGetInCarPositionCB(CAnimBlendAssociation* assoc, void* arg) CPed* pPed = (CPed*)arg; CMatrix mat(pPed->GetMatrix()); CVehicle* pVehicle = pPed->m_pMyVehicle; - const CVector& offset = (pVehicle->bIsVan && (pPed->m_vehEnterType == CAR_DOOR_RR || pPed->m_vehEnterType == CAR_DOOR_LR)) ? vecPedVanRearDoorAnimOffset : vecPedCarDoorAnimOffset; + const CVector& offset = (pVehicle->bIsVan && (pPed->m_vehDoor == CAR_DOOR_RR || pPed->m_vehDoor == CAR_DOOR_LR)) ? vecPedVanRearDoorAnimOffset : vecPedCarDoorAnimOffset; CVector position = Multiply3x3(mat, offset) + pPed->GetPosition(); CPedPlacement::FindZCoorForPed(&position); pPed->SetMoveSpeed(0.0f, 0.0f, 0.0f); @@ -5054,7 +5054,7 @@ CPed::PedSetQuickDraggedOutCarPositionCB(CAnimBlendAssociation *animAssoc, void ped->bUsesCollision = true; ped->RestartNonPartialAnims(); draggedOutOffset = vecPedQuickDraggedOutCarAnimOffset; - if (ped->m_vehEnterType == CAR_DOOR_RF || ped->m_vehEnterType == CAR_DOOR_RR) + if (ped->m_vehDoor == CAR_DOOR_RF || ped->m_vehDoor == CAR_DOOR_RR) draggedOutOffset.x = -draggedOutOffset.x; finalPos = Multiply3x3(pedMat, draggedOutOffset) + ped->GetPosition(); @@ -5067,7 +5067,7 @@ CPed::PedSetQuickDraggedOutCarPositionCB(CAnimBlendAssociation *animAssoc, void ped->m_fRotationCur = ped->m_fRotationDest; ped->CalculateNewOrientation(); - if (!veh->IsRoomForPedToLeaveCar(ped->m_vehEnterType, &vecPedQuickDraggedOutCarAnimOffset)) + if (!veh->IsRoomForPedToLeaveCar(ped->m_vehDoor, &vecPedQuickDraggedOutCarAnimOffset)) ped->PositionPedOutOfCollision(); } @@ -5158,7 +5158,7 @@ CPed::PedSetDraggedOutCarPositionCB(CAnimBlendAssociation* animAssoc, void* arg) } else { draggedOutOffset = vecPedDraggedOutCarAnimOffset; } - if (ped->m_vehEnterType == CAR_DOOR_RF || ped->m_vehEnterType == CAR_DOOR_RR) + if (ped->m_vehDoor == CAR_DOOR_RF || ped->m_vehDoor == CAR_DOOR_RR) draggedOutOffset.x = -draggedOutOffset.x; CVector posAfterBeingDragged = Multiply3x3(pedMat, draggedOutOffset); @@ -5167,7 +5167,7 @@ CPed::PedSetDraggedOutCarPositionCB(CAnimBlendAssociation* animAssoc, void* arg) ped->m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f); ped->SetPosition(posAfterBeingDragged); - if (ped->m_pMyVehicle && !ped->m_pMyVehicle->IsBike() && !ped->m_pMyVehicle->IsRoomForPedToLeaveCar(ped->m_vehEnterType, &vecPedDraggedOutCarAnimOffset)) { + if (ped->m_pMyVehicle && !ped->m_pMyVehicle->IsBike() && !ped->m_pMyVehicle->IsRoomForPedToLeaveCar(ped->m_vehDoor, &vecPedDraggedOutCarAnimOffset)) { ped->PositionPedOutOfCollision(); } @@ -5235,7 +5235,7 @@ CPed::GetNearestTrainDoor(CVehicle *train, CVector &doorPos) CVehicleModelInfo* trainModel = (CVehicleModelInfo*)CModelInfo::GetModelInfo(train->m_modelIndex); CMatrix trainMat = CMatrix(train->GetMatrix()); - doorPos = trainModel->m_positions[m_vehEnterType]; + doorPos = trainModel->m_positions[m_vehDoor]; doorPos.x -= 1.5f; doorPos = Multiply3x3(trainMat, doorPos); doorPos += train->GetPosition(); @@ -5286,17 +5286,17 @@ CPed::GetNearestTrainPedPosition(CVehicle *train, CVector &enterPos) if (distMidEntry < distLeftEntry) { if (distMidEntry < distRightEntry) { enterPos = midEntryPos; - m_vehEnterType = TRAIN_POS_MID_ENTRY; + m_vehDoor = TRAIN_POS_MID_ENTRY; } else { enterPos = rightEntryPos; - m_vehEnterType = TRAIN_POS_RIGHT_ENTRY; + m_vehDoor = TRAIN_POS_RIGHT_ENTRY; } } else if (distRightEntry < distLeftEntry) { enterPos = rightEntryPos; - m_vehEnterType = TRAIN_POS_RIGHT_ENTRY; + m_vehDoor = TRAIN_POS_RIGHT_ENTRY; } else { enterPos = leftEntryPos; - m_vehEnterType = TRAIN_POS_LEFT_ENTRY; + m_vehDoor = TRAIN_POS_LEFT_ENTRY; } return 1; @@ -6075,7 +6075,7 @@ CPed::SeekBoatPosition(void) m_vecSeekPos = boatMat * enterOffset; if (Seek()) { // We arrived to the boat - m_vehEnterType = 0; + m_vehDoor = 0; SetEnterCar(m_carInObjective, 0); } } else @@ -6212,9 +6212,9 @@ CPed::PositionPedOutOfCollision(void) foundAPos = true; } - } else if (m_vehEnterType != 0) { + } else if (m_vehDoor != 0) { // Try the normal way - CVector pos = GetPositionToOpenCarDoor(m_pMyVehicle, m_vehEnterType); + CVector pos = GetPositionToOpenCarDoor(m_pMyVehicle, m_vehDoor); newPos = pos; GetMatrix().SetTranslate(newPos); if (!CheckCollision()) { @@ -6224,7 +6224,7 @@ CPed::PositionPedOutOfCollision(void) } float vehRelativeExitX = vehCol->boundingBox.min.x - 0.355f; - if (m_vehEnterType == CAR_DOOR_RF || m_vehEnterType == CAR_DOOR_RR) + if (m_vehDoor == CAR_DOOR_RF || m_vehDoor == CAR_DOOR_RR) vehRelativeExitX = 0.355f + vehCol->boundingBox.max.x; if (!foundAPos) { @@ -6545,19 +6545,19 @@ CPed::KillCharOnFootArmed(CVector &ourPos, CVector &targetPos, CVector &distWith if (m_nPedType == PEDTYPE_COP || vehOfTarget->bIsBus) { GoToNearestDoor(vehOfTarget); } else { - m_vehEnterType = 0; + m_vehDoor = 0; if (m_pedInObjective == vehOfTarget->pDriver || vehOfTarget->bIsBus) { - m_vehEnterType = CAR_DOOR_LF; + m_vehDoor = CAR_DOOR_LF; } else if (m_pedInObjective == vehOfTarget->pPassengers[0]) { - m_vehEnterType = CAR_DOOR_RF; + m_vehDoor = CAR_DOOR_RF; } else if (m_pedInObjective == vehOfTarget->pPassengers[1]) { - m_vehEnterType = CAR_DOOR_LR; + m_vehDoor = CAR_DOOR_LR; } else if (m_pedInObjective == vehOfTarget->pPassengers[2]) { - m_vehEnterType = CAR_DOOR_RR; + m_vehDoor = CAR_DOOR_RR; } // Unused - // GetPositionToOpenCarDoor(vehOfTarget, m_vehEnterType); - SetSeekCar(vehOfTarget, m_vehEnterType); + // GetPositionToOpenCarDoor(vehOfTarget, m_vehDoor); + SetSeekCar(vehOfTarget, m_vehDoor); SetMoveState(PEDMOVE_RUN); } } @@ -6835,19 +6835,19 @@ CPed::KillCharOnFootMelee(CVector &ourPos, CVector &targetPos, CVector &distWith if (m_nPedType == PEDTYPE_COP || vehOfTarget->bIsBus) { GoToNearestDoor(vehOfTarget); } else { - m_vehEnterType = 0; + m_vehDoor = 0; if (m_pedInObjective == vehOfTarget->pDriver || vehOfTarget->bIsBus) { - m_vehEnterType = CAR_DOOR_LF; + m_vehDoor = CAR_DOOR_LF; } else if (m_pedInObjective == vehOfTarget->pPassengers[0]) { - m_vehEnterType = CAR_DOOR_RF; + m_vehDoor = CAR_DOOR_RF; } else if (m_pedInObjective == vehOfTarget->pPassengers[1]) { - m_vehEnterType = CAR_DOOR_LR; + m_vehDoor = CAR_DOOR_LR; } else if (m_pedInObjective == vehOfTarget->pPassengers[2]) { - m_vehEnterType = CAR_DOOR_RR; + m_vehDoor = CAR_DOOR_RR; } // Unused - // GetPositionToOpenCarDoor(vehOfTarget, m_vehEnterType); - SetSeekCar(vehOfTarget, m_vehEnterType); + // GetPositionToOpenCarDoor(vehOfTarget, m_vehDoor); + SetSeekCar(vehOfTarget, m_vehDoor); SetMoveState(PEDMOVE_RUN); } } diff --git a/src/peds/PedFight.cpp b/src/peds/PedFight.cpp index 0f83cdd1..d1f39491 100644 --- a/src/peds/PedFight.cpp +++ b/src/peds/PedFight.cpp @@ -2418,7 +2418,7 @@ CPed::SetInvestigateEvent(eEventType event, CVector2D pos, float distanceToCount SetStoredState(); bFindNewNodeAfterStateRestore = false; SetPedState(PED_INVESTIGATE); - m_standardTimer = CTimer::GetTimeInMilliseconds() + time; + m_chatTimer = CTimer::GetTimeInMilliseconds() + time; m_eventType = event; m_eventOrThreat = pos; m_distanceToCountSeekDone = distanceToCountDone; @@ -2442,13 +2442,13 @@ CPed::InvestigateEvent(void) if (m_nWaitState == WAITSTATE_TURN180) return; - if (CTimer::GetTimeInMilliseconds() > m_standardTimer) { + if (CTimer::GetTimeInMilliseconds() > m_chatTimer) { - if (m_standardTimer) { + if (m_chatTimer) { if (m_eventType < EVENT_UNK) SetWaitState(WAITSTATE_TURN180, nil); - m_standardTimer = 0; + m_chatTimer = 0; } else { ClearInvestigateEvent(); } @@ -2509,7 +2509,7 @@ CPed::InvestigateEvent(void) Say(SOUND_PED_CHAT_EVENT); } else { - m_standardTimer = 0; + m_chatTimer = 0; } } else if (CTimer::GetTimeInMilliseconds() > m_lookTimer) { @@ -2653,7 +2653,7 @@ CPed::ClearInvestigateEvent(void) animAssoc->flags |= ASSOC_DELETEFADEDOUT; } if (m_eventType > EVENT_EXPLOSION) - m_standardTimer = CTimer::GetTimeInMilliseconds() + 15000; + m_chatTimer = CTimer::GetTimeInMilliseconds() + 15000; bGonnaInvestigateEvent = false; m_pEventEntity = nil; diff --git a/src/render/Font.cpp b/src/render/Font.cpp index 6d569591..d15dc7d3 100644 --- a/src/render/Font.cpp +++ b/src/render/Font.cpp @@ -274,13 +274,13 @@ CFont::Initialise(void) SetScale(1.0f, 1.0f); SetSlantRefPoint(SCREEN_WIDTH, 0.0f); SetSlant(0.0f); - SetColor(CRGBA(0xFF, 0xFF, 0xFF, 0)); + SetColor(CRGBA(255, 255, 255, 0)); SetJustifyOff(); SetCentreOff(); SetWrapx(SCREEN_WIDTH); SetCentreSize(SCREEN_WIDTH); SetBackgroundOff(); - SetBackgroundColor(CRGBA(0x80, 0x80, 0x80, 0x80)); + SetBackgroundColor(CRGBA(128, 128, 128, 128)); SetBackGroundOnlyTextOff(); SetPropOn(); SetFontStyle(FONT_BANK); @@ -614,10 +614,10 @@ CFont::PrintString(float xstart, float ystart, wchar *s) x = xstart; #ifdef MORE_LANGUAGES if (IsJapaneseFont()) - y += 32.0f * CFont::Details.scaleY / 2.75f + 2.0f * CFont::Details.scaleY; + y += 32.0f * Details.scaleY / 2.75f + 2.0f * Details.scaleY; else #endif - y += 32.0f * CFont::Details.scaleY * 0.5f + 2.0f * CFont::Details.scaleY; + y += 32.0f * Details.scaleY * 0.5f + 2.0f * Details.scaleY; start = s; }else break; @@ -653,7 +653,7 @@ CFont::PrintString(float xstart, float ystart, wchar *s) else x = 0.0f; - y += 32.0f * CFont::Details.scaleY / 2.75f + 2.0f * CFont::Details.scaleY; + y += 32.0f * Details.scaleY / 2.75f + 2.0f * Details.scaleY; numSpaces = 0; first = true; lineLength = 0.0f; @@ -676,7 +676,7 @@ CFont::PrintString(float xstart, float ystart, wchar *s) x = xstart; else x = 0.0f; - y += 32.0f * CFont::Details.scaleY / 2.75f + 2.0f * CFont::Details.scaleY; + y += 32.0f * Details.scaleY / 2.75f + 2.0f * Details.scaleY; numSpaces = 0; first = true; lineLength = 0.0f; @@ -753,10 +753,10 @@ CFont::GetNumberLines(float xstart, float ystart, wchar *s) // Why even? #ifdef MORE_LANGUAGES if (IsJapanese()) - y += 32.0f * CFont::Details.scaleY / 2.75f + 2.0f * CFont::Details.scaleY; + y += 32.0f * Details.scaleY / 2.75f + 2.0f * Details.scaleY; else #endif - y += 32.0f * CFont::Details.scaleY * 0.5f + 2.0f * CFont::Details.scaleY; + y += 32.0f * Details.scaleY * 0.5f + 2.0f * Details.scaleY; }else{ // still space in current line t = GetNextSpace(s); @@ -827,7 +827,7 @@ CFont::GetTextRect(CRect *rect, float xstart, float ystart, wchar *s) else x = xstart; numLines++; - y += 32.0f * CFont::Details.scaleY * 0.5f + 2.0f * CFont::Details.scaleY; + y += 32.0f * Details.scaleY * 0.5f + 2.0f * Details.scaleY; }else{ // still space in current line t = GetNextSpace(s); @@ -855,11 +855,11 @@ CFont::GetTextRect(CRect *rect, float xstart, float ystart, wchar *s) rect->right = xstart + maxlength/2 + 4.0f; #ifdef MORE_LANGUAGES if (IsJapaneseFont()) { - rect->bottom = (32.0f * CFont::Details.scaleY / 2.75f + 2.0f * CFont::Details.scaleY) * numLines + ystart + (4.0f / 2.75f); + rect->bottom = (32.0f * Details.scaleY / 2.75f + 2.0f * Details.scaleY) * numLines + ystart + (4.0f / 2.75f); rect->top = ystart - (4.0f / 2.75f); } else { #endif - rect->bottom = (32.0f * CFont::Details.scaleY * 0.5f + 2.0f * CFont::Details.scaleY) * numLines + ystart + 2.0f; + rect->bottom = (32.0f * Details.scaleY * 0.5f + 2.0f * Details.scaleY) * numLines + ystart + 2.0f; rect->top = ystart - 2.0f; #ifdef MORE_LANGUAGES } @@ -869,11 +869,11 @@ CFont::GetTextRect(CRect *rect, float xstart, float ystart, wchar *s) rect->right = xstart + Details.centreSize*0.5f + 4.0f; #ifdef MORE_LANGUAGES if (IsJapaneseFont()) { - rect->bottom = (32.0f * CFont::Details.scaleY / 2.75f + 2.0f * CFont::Details.scaleY) * numLines + ystart + (4.0f / 2.75f); + rect->bottom = (32.0f * Details.scaleY / 2.75f + 2.0f * Details.scaleY) * numLines + ystart + (4.0f / 2.75f); rect->top = ystart - (4.0f / 2.75f); } else { #endif - rect->bottom = (32.0f * CFont::Details.scaleY * 0.5f + 2.0f * CFont::Details.scaleY) * numLines + ystart + 2.0f; + rect->bottom = (32.0f * Details.scaleY * 0.5f + 2.0f * Details.scaleY) * numLines + ystart + 2.0f; rect->top = ystart - 2.0f; #ifdef MORE_LANGUAGES } @@ -886,10 +886,10 @@ CFont::GetTextRect(CRect *rect, float xstart, float ystart, wchar *s) rect->bottom = ystart - 4.0f + 4.0f; #ifdef MORE_LANGUAGES if (IsJapaneseFont()) - rect->top = (32.0f * CFont::Details.scaleY / 2.75f + 2.0f * CFont::Details.scaleY) * numLines + ystart + 2.0f + (4.0f / 2.75f); + rect->top = (32.0f * Details.scaleY / 2.75f + 2.0f * Details.scaleY) * numLines + ystart + 2.0f + (4.0f / 2.75f); else #endif - rect->top = (32.0f * CFont::Details.scaleY * 0.5f + 2.0f * CFont::Details.scaleY) * numLines + ystart + 2.0f + 2.0f; + rect->top = (32.0f * Details.scaleY * 0.5f + 2.0f * Details.scaleY) * numLines + ystart + 2.0f + 2.0f; } } @@ -1315,27 +1315,89 @@ CFont::ParseToken(wchar *s) case 'n': NewLine = 1; break; - case 'b': SetColor(CRGBA(27, 89, 130, 255)); Details.anonymous_23 = true; break; + case 'b': + Details.color.r = 27; + Details.color.g = 89; + Details.color.b = 130; + Details.anonymous_23 = true; + break; case 'f': Details.bFlash = !Details.bFlash; if (!Details.bFlash) Details.color.a = 255; break; - case 'g': SetColor(CRGBA(255, 150, 225, 255)); Details.anonymous_23 = true; break; - case 'h': SetColor(CRGBA(225, 225, 225, 255)); Details.anonymous_23 = true; break; - case 'l': SetColor(CRGBA(0, 0, 0, 255)); Details.anonymous_23 = true; break; - case 'o': SetColor(CRGBA(229, 125, 126, 255)); Details.anonymous_23 = true; break; - case 'p': SetColor(CRGBA(168, 110, 252, 255)); Details.anonymous_23 = true; break; - case 'q': SetColor(CRGBA(199, 144, 203, 255)); Details.anonymous_23 = true; break; - case 'r': SetColor(CRGBA(255, 150, 225, 255)); Details.anonymous_23 = true; break; - case 't': SetColor(CRGBA(86, 212, 146, 255)); Details.anonymous_23 = true; break; - case 'w': SetColor(CRGBA(175, 175, 175, 255)); Details.anonymous_23 = true; break; + case 'g': + Details.color.r = 255; + Details.color.g = 150; + Details.color.b = 225; + Details.anonymous_23 = true; + break; + case 'h': + Details.color.r = 225; + Details.color.g = 225; + Details.color.b = 225; + Details.anonymous_23 = true; + break; + case 'l': + Details.color.r = 0; + Details.color.g = 0; + Details.color.b = 0; + Details.anonymous_23 = true; + break; + case 'o': + Details.color.r = 229; + Details.color.g = 125; + Details.color.b = 126; + Details.anonymous_23 = true; + break; + case 'p': + Details.color.r = 168; + Details.color.g = 110; + Details.color.b = 252; + Details.anonymous_23 = true; + break; + case 'q': + Details.color.r = 199; + Details.color.g = 144; + Details.color.b = 203; + Details.anonymous_23 = true; + break; + case 'r': + Details.color.r = 255; + Details.color.g = 150; + Details.color.b = 225; + Details.anonymous_23 = true; + break; + case 't': + Details.color.r = 86; + Details.color.g = 212; + Details.color.b = 146; + Details.anonymous_23 = true; + break; + case 'w': + Details.color.r = 175; + Details.color.g = 175; + Details.color.b = 175; + Details.anonymous_23 = true; + break; + case 'x': #ifdef FIX_BUGS - case 'x': SetColor(CRGBA(0, 255, 255, 255)); Details.anonymous_23 = true; break; + Details.color.r = 0; + Details.color.g = 255; + Details.color.b = 255; #else - case 'x': SetColor(CRGBA(132, 146, 197, 255)); Details.anonymous_23 = true; break; + Details.color.r = 132; + Details.color.g = 146; + Details.color.b = 197; #endif - case 'y': SetColor(CRGBA(255, 227, 79, 255)); Details.anonymous_23 = true; break; + Details.anonymous_23 = true; + break; + case 'y': + Details.color.r = 255; + Details.color.g = 227; + Details.color.b = 79; + Details.anonymous_23 = true; + break; #ifdef BUTTON_ICONS case 'U': PS2Symbol = BUTTON_UP; break; case 'D': PS2Symbol = BUTTON_DOWN; break; @@ -1542,7 +1604,7 @@ CFont::RenderFontBuffer() if (RenderState.bFontHalfTexture) c = FindNewCharacter(c); else if (c > 155) - c = 0; + c = '\0'; if (RenderState.slant != 0.0f) textPosY = (RenderState.slantRefX - textPosX) * RenderState.slant + RenderState.slantRefY; @@ -1556,7 +1618,7 @@ CFont::RenderFontBuffer() // PS2 uses different chars for some symbols if (!RenderState.bFontHalfTexture && c == 30) c = 61; // wanted star #endif - textPosX += RenderState.scaleX * (RenderState.proportional ? Size[RenderState.style][c] : Size[RenderState.style][209]); + textPosX += RenderState.scaleX * GetCharacterWidth(c); if (c == '\0') textPosX += RenderState.fExtraSpace; } diff --git a/src/render/MBlur.cpp b/src/render/MBlur.cpp index f96fedc5..5abc94b9 100644 --- a/src/render/MBlur.cpp +++ b/src/render/MBlur.cpp @@ -442,7 +442,7 @@ CMBlur::OverlayRender(RwCamera *cam, RwRaster *raster, RwRGBA color, int32 type, RwIm2DVertexSetIntRGBA(&Vertex2[3], r, g, b, 80); RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA); RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA); - // TODO(MIAMI): pBufVertCount = 0; + pBufVertCount = 0; }else{ RwIm2DVertexSetIntRGBA(&Vertex2[0], r*2, g*2, b*2, 30); RwIm2DVertexSetIntRGBA(&Vertex2[1], r*2, g*2, b*2, 30); diff --git a/src/render/WaterLevel.cpp b/src/render/WaterLevel.cpp index 6caac31e..6247c611 100644 --- a/src/render/WaterLevel.cpp +++ b/src/render/WaterLevel.cpp @@ -113,9 +113,9 @@ float fMinWaterAlphaMult = -30.0f; void -WaterLevelInitialise(Const char *pWaterDat) +CWaterLevel::Initialise(Const char *pWaterDat) { - CWaterLevel::ms_nNoOfWaterLevels = 0; + ms_nNoOfWaterLevels = 0; #ifdef MASTER int32 hFile = -1; @@ -131,11 +131,11 @@ WaterLevelInitialise(Const char *pWaterDat) if (hFile > 0) { - CFileMgr::Read(hFile, (char *)&CWaterLevel::ms_nNoOfWaterLevels, sizeof(CWaterLevel::ms_nNoOfWaterLevels)); - CFileMgr::Read(hFile, (char *)CWaterLevel::ms_aWaterZs, sizeof(CWaterLevel::ms_aWaterZs)); - CFileMgr::Read(hFile, (char *)CWaterLevel::ms_aWaterRects, sizeof(CWaterLevel::ms_aWaterRects)); - CFileMgr::Read(hFile, (char *)CWaterLevel::aWaterBlockList, sizeof(CWaterLevel::aWaterBlockList)); - CFileMgr::Read(hFile, (char *)CWaterLevel::aWaterFineBlockList, sizeof(CWaterLevel::aWaterFineBlockList)); + CFileMgr::Read(hFile, (char *)&ms_nNoOfWaterLevels, sizeof(ms_nNoOfWaterLevels)); + CFileMgr::Read(hFile, (char *)ms_aWaterZs, sizeof(ms_aWaterZs)); + CFileMgr::Read(hFile, (char *)ms_aWaterRects, sizeof(ms_aWaterRects)); + CFileMgr::Read(hFile, (char *)aWaterBlockList, sizeof(aWaterBlockList)); + CFileMgr::Read(hFile, (char *)aWaterFineBlockList, sizeof(aWaterFineBlockList)); CFileMgr::CloseFile(hFile); } #ifndef MASTER @@ -157,7 +157,7 @@ WaterLevelInitialise(Const char *pWaterDat) { float z, l, b, r, t; sscanf(line, "%f %f %f %f %f", &z, &l, &b, &r, &t); - CWaterLevel::AddWaterLevel(l, b, r, t, z); + AddWaterLevel(l, b, r, t, z); } } @@ -167,17 +167,17 @@ WaterLevelInitialise(Const char *pWaterDat) { for (int32 y = 0; y < MAX_SMALL_SECTORS; y++) { - CWaterLevel::aWaterFineBlockList[x][y] = NO_WATER; + aWaterFineBlockList[x][y] = NO_WATER; } } // rasterize water rects read from file - for (int32 i = 0; i < CWaterLevel::ms_nNoOfWaterLevels; i++) + for (int32 i = 0; i < ms_nNoOfWaterLevels; i++) { - int32 l = WATER_HUGE_X(CWaterLevel::ms_aWaterRects[i].left + WATER_X_OFFSET); - int32 r = WATER_HUGE_X(CWaterLevel::ms_aWaterRects[i].right + WATER_X_OFFSET) + 1.0f; - int32 t = WATER_HUGE_Y(CWaterLevel::ms_aWaterRects[i].top); - int32 b = WATER_HUGE_Y(CWaterLevel::ms_aWaterRects[i].bottom) + 1.0f; + int32 l = WATER_HUGE_X(ms_aWaterRects[i].left + WATER_X_OFFSET); + int32 r = WATER_HUGE_X(ms_aWaterRects[i].right + WATER_X_OFFSET) + 1.0f; + int32 t = WATER_HUGE_Y(ms_aWaterRects[i].top); + int32 b = WATER_HUGE_Y(ms_aWaterRects[i].bottom) + 1.0f; l = clamp(l, 0, MAX_SMALL_SECTORS - 1); r = clamp(r, 0, MAX_SMALL_SECTORS - 1); @@ -188,7 +188,7 @@ WaterLevelInitialise(Const char *pWaterDat) { for (int32 y = t; y <= b; y++) { - CWaterLevel::aWaterFineBlockList[x][y] = i; + aWaterFineBlockList[x][y] = i; } } } @@ -209,10 +209,10 @@ WaterLevelInitialise(Const char *pWaterDat) { for (int32 j = 0; j <= 8; j++) { - CVector worldPos = CVector(worldX + i * (SMALL_SECTOR_SIZE / 8), worldY + j * (SMALL_SECTOR_SIZE / 8), CWaterLevel::ms_aWaterZs[CWaterLevel::aWaterFineBlockList[x][y]]); + CVector worldPos = CVector(worldX + i * (SMALL_SECTOR_SIZE / 8), worldY + j * (SMALL_SECTOR_SIZE / 8), ms_aWaterZs[aWaterFineBlockList[x][y]]); if ((worldPos.x > WORLD_MIN_X && worldPos.x < WORLD_MAX_X) && (worldPos.y > WORLD_MIN_Y && worldPos.y < WORLD_MAX_Y) && - (!CWaterLevel::WaterLevelAccordingToRectangles(worldPos.x, worldPos.y) || CWaterLevel::TestVisibilityForFineWaterBlocks(worldPos))) + (!WaterLevelAccordingToRectangles(worldPos.x, worldPos.y) || TestVisibilityForFineWaterBlocks(worldPos))) continue; // at least one point in the tile wasn't blocked, so don't remove water @@ -222,37 +222,37 @@ WaterLevelInitialise(Const char *pWaterDat) } if (i < 1000) - CWaterLevel::aWaterFineBlockList[x][y] = NO_WATER; + aWaterFineBlockList[x][y] = NO_WATER; } } } - CWaterLevel::RemoveIsolatedWater(); + RemoveIsolatedWater(); // calculate coarse tiles from fine tiles for (int32 x = 0; x < MAX_LARGE_SECTORS; x++) { for (int32 y = 0; y < MAX_LARGE_SECTORS; y++) { - if (CWaterLevel::aWaterFineBlockList[x * 2][y * 2] >= 0) + if (aWaterFineBlockList[x * 2][y * 2] >= 0) { - CWaterLevel::aWaterBlockList[x][y] = CWaterLevel::aWaterFineBlockList[x * 2][y * 2]; + aWaterBlockList[x][y] = aWaterFineBlockList[x * 2][y * 2]; } - else if (CWaterLevel::aWaterFineBlockList[x * 2 + 1][y * 2] >= 0) + else if (aWaterFineBlockList[x * 2 + 1][y * 2] >= 0) { - CWaterLevel::aWaterBlockList[x][y] = CWaterLevel::aWaterFineBlockList[x * 2 + 1][y * 2]; + aWaterBlockList[x][y] = aWaterFineBlockList[x * 2 + 1][y * 2]; } - else if (CWaterLevel::aWaterFineBlockList[x * 2][y * 2 + 1] >= 0) + else if (aWaterFineBlockList[x * 2][y * 2 + 1] >= 0) { - CWaterLevel::aWaterBlockList[x][y] = CWaterLevel::aWaterFineBlockList[x * 2][y * 2 + 1]; + aWaterBlockList[x][y] = aWaterFineBlockList[x * 2][y * 2 + 1]; } - else if (CWaterLevel::aWaterFineBlockList[x * 2 + 1][y * 2 + 1] >= 0) + else if (aWaterFineBlockList[x * 2 + 1][y * 2 + 1] >= 0) { - CWaterLevel::aWaterBlockList[x][y] = CWaterLevel::aWaterFineBlockList[x * 2 + 1][y * 2 + 1]; + aWaterBlockList[x][y] = aWaterFineBlockList[x * 2 + 1][y * 2 + 1]; } else { - CWaterLevel::aWaterBlockList[x][y] = NO_WATER; + aWaterBlockList[x][y] = NO_WATER; } } } @@ -261,11 +261,11 @@ WaterLevelInitialise(Const char *pWaterDat) if (hFile > 0) { - CFileMgr::Write(hFile, (char *)&CWaterLevel::ms_nNoOfWaterLevels, sizeof(CWaterLevel::ms_nNoOfWaterLevels)); - CFileMgr::Write(hFile, (char *)CWaterLevel::ms_aWaterZs, sizeof(CWaterLevel::ms_aWaterZs)); - CFileMgr::Write(hFile, (char *)CWaterLevel::ms_aWaterRects, sizeof(CWaterLevel::ms_aWaterRects)); - CFileMgr::Write(hFile, (char *)CWaterLevel::aWaterBlockList, sizeof(CWaterLevel::aWaterBlockList)); - CFileMgr::Write(hFile, (char *)CWaterLevel::aWaterFineBlockList, sizeof(CWaterLevel::aWaterFineBlockList)); + CFileMgr::Write(hFile, (char *)&ms_nNoOfWaterLevels, sizeof(ms_nNoOfWaterLevels)); + CFileMgr::Write(hFile, (char *)ms_aWaterZs, sizeof(ms_aWaterZs)); + CFileMgr::Write(hFile, (char *)ms_aWaterRects, sizeof(ms_aWaterRects)); + CFileMgr::Write(hFile, (char *)aWaterBlockList, sizeof(aWaterBlockList)); + CFileMgr::Write(hFile, (char *)aWaterFineBlockList, sizeof(aWaterFineBlockList)); CFileMgr::CloseFile(hFile); } @@ -300,7 +300,7 @@ WaterLevelInitialise(Const char *pWaterDat) CTxdStore::PopCurrentTxd(); - CWaterLevel::CreateWavyAtomic(); + CreateWavyAtomic(); printf("Done Initing waterlevels\n"); } diff --git a/src/render/WaterLevel.h b/src/render/WaterLevel.h index d0c64eb4..d12fb9f6 100644 --- a/src/render/WaterLevel.h +++ b/src/render/WaterLevel.h @@ -116,6 +116,7 @@ public: static RpAtomic *ms_pWavyAtomic; static RpAtomic *ms_pMaskAtomic; + static void Initialise(Const char *pWaterDat); // out of class in III PC and later because of SecuROM static void Shutdown(); static void CreateWavyAtomic(); @@ -181,5 +182,3 @@ public: static void HandleBeachToysStuff(void); static CEntity *CreateBeachToy(CVector const &vec, eBeachToy beachtoy); }; - -extern void WaterLevelInitialise(Const char *datFile); \ No newline at end of file diff --git a/src/rw/MemoryMgr.cpp b/src/rw/MemoryMgr.cpp index e2f6f144..2379692c 100644 --- a/src/rw/MemoryMgr.cpp +++ b/src/rw/MemoryMgr.cpp @@ -93,7 +93,7 @@ MemoryMgrFree(void *ptr) void * RwMallocAlign(RwUInt32 size, RwUInt32 align) { -#ifdef FIX_BUGS +#if defined (FIX_BUGS) || defined(FIX_BUGS_64) uintptr ptralign = align-1; void *mem = (void *)MemoryMgrMalloc(size + sizeof(uintptr) + ptralign); diff --git a/src/rw/RwHelper.cpp b/src/rw/RwHelper.cpp index 38a0f613..d80a3904 100644 --- a/src/rw/RwHelper.cpp +++ b/src/rw/RwHelper.cpp @@ -255,7 +255,8 @@ SkinGetBonePositionsToTable(RpClump *clump, RwV3d *boneTable) parent = stack[sp--]; else parent = i; - assert(parent >= 0 && parent < numBones); + + //assert(parent >= 0 && parent < numBones); } } @@ -263,7 +264,7 @@ RpHAnimAnimation* HAnimAnimationCreateForHierarchy(RpHAnimHierarchy *hier) { int i; -#ifdef FIX_BUGS +#if defined FIX_BUGS || defined LIBRW int numNodes = hier->numNodes*2; // you're supposed to have at least two KFs per node #else int numNodes = hier->numNodes; @@ -277,7 +278,7 @@ HAnimAnimationCreateForHierarchy(RpHAnimHierarchy *hier) frame->q.real = 1.0f; frame->q.imag.x = frame->q.imag.y = frame->q.imag.z = 0.0f; frame->t.x = frame->t.y = frame->t.z = 0.0f; -#ifdef FIX_BUGS +#if defined FIX_BUGS || defined LIBRW // times are subtracted and divided giving NaNs // so they can't both be 0 frame->time = i/hier->numNodes; @@ -483,7 +484,7 @@ CameraSize(RwCamera * camera, RwRect * rect, RwRaster *zRaster; // BUG: game just changes camera raster's sizes, but this is a hack -#ifdef FIX_BUGS +#if defined FIX_BUGS || defined LIBRW /* * Destroy rasters... */ diff --git a/src/text/Text.cpp b/src/text/Text.cpp index fd1659dc..efb8b2a9 100644 --- a/src/text/Text.cpp +++ b/src/text/Text.cpp @@ -113,14 +113,14 @@ wchar* CText::Get(const char *key) { uint8 result = false; -#ifdef FIX_BUGS +#if defined (FIX_BUGS) || defined(FIX_BUGS_64) wchar *outstr = keyArray.Search(key, data.chars, &result); #else wchar *outstr = keyArray.Search(key, &result); #endif if (!result && bHasMissionTextOffsets && bIsMissionTextLoaded) -#ifdef FIX_BUGS +#if defined (FIX_BUGS) || defined(FIX_BUGS_64) outstr = mission_keyArray.Search(key, mission_data.chars, &result); #else outstr = mission_keyArray.Search(key, &result); @@ -347,7 +347,7 @@ CKeyArray::Unload(void) void CKeyArray::Update(wchar *chars) { -#ifndef FIX_BUGS +#if !defined(FIX_BUGS) && !defined(FIX_BUGS_64) int i; for(i = 0; i < numEntries; i++) entries[i].value = (wchar*)((uint8*)chars + (uintptr)entries[i].value); @@ -375,7 +375,7 @@ CKeyArray::BinarySearch(const char *key, CKeyEntry *entries, int16 low, int16 hi } wchar* -#ifdef FIX_BUGS +#if defined (FIX_BUGS) || defined(FIX_BUGS_64) CKeyArray::Search(const char *key, wchar *data, uint8 *result) #else CKeyArray::Search(const char *key, uint8 *result) @@ -385,7 +385,7 @@ CKeyArray::Search(const char *key, uint8 *result) char errstr[25]; int i; -#ifdef FIX_BUGS +#if defined (FIX_BUGS) || defined(FIX_BUGS_64) found = BinarySearch(key, entries, 0, numEntries-1); if (found) { *result = true; diff --git a/src/text/Text.h b/src/text/Text.h index 3e11ea46..05387346 100644 --- a/src/text/Text.h +++ b/src/text/Text.h @@ -7,7 +7,7 @@ void TextCopy(wchar *dst, const wchar *src); struct CKeyEntry { -#ifdef FIX_BUGS +#if defined(FIX_BUGS) || defined(FIX_BUGS_64) uint32 valueOffset; #else wchar *value; @@ -30,7 +30,7 @@ public: void Unload(void); void Update(wchar *chars); CKeyEntry *BinarySearch(const char *key, CKeyEntry *entries, int16 low, int16 high); -#ifdef FIX_BUGS +#if defined (FIX_BUGS) || defined(FIX_BUGS_64) wchar *Search(const char *key, wchar *data, uint8 *result); #else wchar *Search(const char *key, uint8* result); diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index 6f00a2ea..d54c2291 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -5824,7 +5824,7 @@ CAutomobile::KnockPedOutCar(eWeaponType weapon, uint16 door, CPed *ped) if(ped == nil) return; - ped->m_vehEnterType = door; + ped->m_vehDoor = door; ped->SetPedState(PED_IDLE); CAnimManager::BlendAnimation(ped->GetClump(), ped->m_animGroup, ANIM_IDLE_STANCE, 100.0f); CPed::PedSetOutCarCB(nil, ped); diff --git a/src/vehicles/Bike.cpp b/src/vehicles/Bike.cpp index bb613617..293cf58e 100644 --- a/src/vehicles/Bike.cpp +++ b/src/vehicles/Bike.cpp @@ -2609,7 +2609,7 @@ CBike::KnockOffRider(eWeaponType weapon, uint8 direction, CPed *ped, bool bGetBa ped->SetPedState(PED_IDLE); CAnimManager::BlendAnimation(ped->GetClump(), ped->m_animGroup, ANIM_IDLE_STANCE, 100.0f); - ped->m_vehEnterType = CAR_DOOR_LF; + ped->m_vehDoor = CAR_DOOR_LF; CPed::PedSetOutCarCB(nil, ped); ped->SetMoveState(PEDMOVE_STILL); if(GetUp().z < 0.0f) diff --git a/src/vehicles/Cranes.h b/src/vehicles/Cranes.h index 162f9af9..e842ed3f 100644 --- a/src/vehicles/Cranes.h +++ b/src/vehicles/Cranes.h @@ -88,7 +88,7 @@ public: static bool IsThisCarBeingCarriedByAnyCrane(CVehicle* pVehicle); static bool IsThisCarBeingTargettedByAnyCrane(CVehicle* pVehicle); static void Save(uint8* buf, uint32* size); - static void Load(uint8* buf, uint32 size); // on mobile it's CranesLoad outside of the class + static void Load(uint8* buf, uint32 size); // out of class in III PC and later because of SecuROM static uint32 CarsCollectedMilitaryCrane; static int32 NumCranes; diff --git a/src/vehicles/Heli.cpp b/src/vehicles/Heli.cpp index 644fdde8..1c1b2617 100644 --- a/src/vehicles/Heli.cpp +++ b/src/vehicles/Heli.cpp @@ -762,7 +762,7 @@ CHeli::InitHelis(void) } CHeli* -GenerateHeli(bool catalina) +CHeli::GenerateHeli(bool catalina) { CHeli *heli; CVector heliPos; @@ -800,7 +800,7 @@ GenerateHeli(bool catalina) id++; found = true; for(i = 0; i < 4; i++) - if(CHeli::pHelis[i] && CHeli::pHelis[i]->m_nHeliId == id) + if(pHelis[i] && pHelis[i]->m_nHeliId == id) found = false; } heli->m_nHeliId = id; diff --git a/src/vehicles/Heli.h b/src/vehicles/Heli.h index 1f372e42..c5ae08e2 100644 --- a/src/vehicles/Heli.h +++ b/src/vehicles/Heli.h @@ -83,13 +83,14 @@ public: bool SendDownSwat(void); static void InitHelis(void); + static CHeli *GenerateHeli(bool catalina); // out of class in III PC and later because of SecuROM static void UpdateHelis(void); static void SpecialHeliPreRender(void); static bool TestRocketCollision(CVector *coors); static bool TestBulletCollision(CVector *line0, CVector *line1, CVector *bulletPos, int32 damage); static bool TestSniperCollision(CVector *line0, CVector *line1); - static void StartCatalinaFlyBy(void); + static void StartCatalinaFlyBy(void); // out of class in III PC and later because of SecuROM static void RemoveCatalinaHeli(void); static CHeli *FindPointerToCatalinasHeli(void); static void CatalinaTakeOff(void); diff --git a/src/vehicles/Train.cpp b/src/vehicles/Train.cpp index fefe1781..55be4a20 100644 --- a/src/vehicles/Train.cpp +++ b/src/vehicles/Train.cpp @@ -388,7 +388,7 @@ void CTrain::AddPassenger(CPed *ped) { #ifdef GTA_TRAIN - int i = ped->m_vehEnterType; + int i = ped->m_vehDoor; if((i == TRAIN_POS_LEFT_ENTRY || i == TRAIN_POS_MID_ENTRY || i == TRAIN_POS_RIGHT_ENTRY) && pPassengers[i] == nil){ pPassengers[i] = ped; m_nNumPassengers++; diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp index e1e00667..145611b1 100644 --- a/src/vehicles/Vehicle.cpp +++ b/src/vehicles/Vehicle.cpp @@ -1430,13 +1430,13 @@ CVehicle::ShufflePassengersToMakeSpace(void) if (!pPassengers[2] && !(m_nGettingInFlags & CAR_DOOR_FLAG_RR)) { pPassengers[2] = pPassengers[1]; pPassengers[1] = nil; - pPassengers[2]->m_vehEnterType = CAR_DOOR_RR; + pPassengers[2]->m_vehDoor = CAR_DOOR_RR; return true; } if (!pPassengers[0] && !(m_nGettingInFlags & CAR_DOOR_FLAG_RF)) { pPassengers[0] = pPassengers[1]; pPassengers[1] = nil; - pPassengers[0]->m_vehEnterType = CAR_DOOR_RF; + pPassengers[0]->m_vehDoor = CAR_DOOR_RF; return true; } return false; @@ -1447,13 +1447,13 @@ CVehicle::ShufflePassengersToMakeSpace(void) if (!pPassengers[1] && !(m_nGettingInFlags & CAR_DOOR_FLAG_LR)) { pPassengers[1] = pPassengers[2]; pPassengers[2] = nil; - pPassengers[1]->m_vehEnterType = CAR_DOOR_LR; + pPassengers[1]->m_vehDoor = CAR_DOOR_LR; return true; } if (!pPassengers[0] && !(m_nGettingInFlags & CAR_DOOR_FLAG_RF)) { pPassengers[0] = pPassengers[2]; pPassengers[2] = nil; - pPassengers[0]->m_vehEnterType = CAR_DOOR_RF; + pPassengers[0]->m_vehDoor = CAR_DOOR_RF; return true; } return false; @@ -1464,13 +1464,13 @@ CVehicle::ShufflePassengersToMakeSpace(void) if (!pPassengers[1] && !(m_nGettingInFlags & CAR_DOOR_FLAG_LR)) { pPassengers[1] = pPassengers[0]; pPassengers[0] = nil; - pPassengers[1]->m_vehEnterType = CAR_DOOR_LR; + pPassengers[1]->m_vehDoor = CAR_DOOR_LR; return true; } if (!pPassengers[2] && !(m_nGettingInFlags & CAR_DOOR_FLAG_RR)) { pPassengers[2] = pPassengers[0]; pPassengers[0] = nil; - pPassengers[2]->m_vehEnterType = CAR_DOOR_RR; + pPassengers[2]->m_vehDoor = CAR_DOOR_RR; return true; } return false; From 068093aae0817453a9a3fe2ec69ad21130d81673 Mon Sep 17 00:00:00 2001 From: Fire-Head Date: Fri, 15 Jan 2021 19:20:44 +0300 Subject: [PATCH 6/7] Update librw --- vendor/librw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/librw b/vendor/librw index ed9cb45e..61b288a9 160000 --- a/vendor/librw +++ b/vendor/librw @@ -1 +1 @@ -Subproject commit ed9cb45ee9a2749a0a89231bf16f09a5c53bfc92 +Subproject commit 61b288a9fe72ae4073c0ac5fd2a5815ed510c8c8 From 96fdbac69a650db2884a84776e9b8cb5261b38a1 Mon Sep 17 00:00:00 2001 From: Fire-Head Date: Sat, 16 Jan 2021 01:12:27 +0300 Subject: [PATCH 7/7] rem null checks --- src/render/ParticleMgr.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/render/ParticleMgr.cpp b/src/render/ParticleMgr.cpp index c802067d..263c4ae1 100644 --- a/src/render/ParticleMgr.cpp +++ b/src/render/ParticleMgr.cpp @@ -20,8 +20,7 @@ cParticleSystemMgr::cParticleSystemMgr() cParticleSystemMgr::~cParticleSystemMgr() { #ifdef FIX_BUGS - if ( m_aParticles ) - delete [] m_aParticles; + delete [] m_aParticles; #endif } @@ -37,8 +36,7 @@ void cParticleSystemMgr::Initialise() void cParticleSystemMgr::LoadParticleData() { #ifdef FIX_BUGS - if ( m_aParticles ) - delete [] m_aParticles; + delete [] m_aParticles; #endif m_aParticles = new tParticleSystemData[MAX_PARTICLES];