From d5ce8b1ea3359ad5518e724e32a76ba32be1586b Mon Sep 17 00:00:00 2001 From: withmorten Date: Thu, 14 Jan 2021 23:16:42 +0100 Subject: [PATCH 1/6] add the bad crack "features" behind SECUROM define --- src/control/CarCtrl.cpp | 13 +++++++++++-- src/control/Garages.cpp | 4 ++++ src/control/PathFind.cpp | 6 ++++++ src/control/RoadBlocks.cpp | 11 +++++++++++ src/control/Script.cpp | 6 ++++++ src/core/Frontend.cpp | 16 +++++++++++----- src/core/Game.cpp | 13 ++++++++++++- src/core/Radar.cpp | 4 ++++ src/render/Weather.cpp | 19 +++++++++++++++++-- src/render/Weather.h | 2 ++ src/save/GenericGameStorage.cpp | 5 +++++ src/weapons/Weapon.cpp | 15 +++++++++++++++ 12 files changed, 104 insertions(+), 10 deletions(-) diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp index 6f47db05..3299ce00 100644 --- a/src/control/CarCtrl.cpp +++ b/src/control/CarCtrl.cpp @@ -35,6 +35,7 @@ #include "WaterLevel.h" #include "World.h" #include "Zones.h" +#include "Pickups.h" #define DISTANCE_TO_SPAWN_ROADBLOCK_PEDS (51.0f) #define DISTANCE_TO_SCAN_FOR_DANGER (14.0f) @@ -3184,8 +3185,9 @@ void CCarCtrl::GenerateEmergencyServicesCar(void) CStreaming::RequestModel(MI_AMBULAN, STREAMFLAGS_DEPENDENCY); CStreaming::RequestModel(MI_MEDIC, STREAMFLAGS_DONT_REMOVE); if (CStreaming::HasModelLoaded(MI_AMBULAN) && CStreaming::HasModelLoaded(MI_MEDIC)){ - if (GenerateOneEmergencyServicesCar(MI_AMBULAN, pNearestAccident->m_pVictim->GetPosition())) + if (GenerateOneEmergencyServicesCar(MI_AMBULAN, pNearestAccident->m_pVictim->GetPosition())){ LastTimeAmbulanceCreated = CTimer::GetTimeInMilliseconds(); + } } } } @@ -3203,8 +3205,15 @@ void CCarCtrl::GenerateEmergencyServicesCar(void) CStreaming::RequestModel(MI_FIRETRUCK, STREAMFLAGS_DEPENDENCY); CStreaming::RequestModel(MI_FIREMAN, STREAMFLAGS_DONT_REMOVE); if (CStreaming::HasModelLoaded(MI_FIRETRUCK) && CStreaming::HasModelLoaded(MI_FIREMAN)){ - if (GenerateOneEmergencyServicesCar(MI_FIRETRUCK, pNearestFire->m_vecPos)) + if (GenerateOneEmergencyServicesCar(MI_FIRETRUCK, pNearestFire->m_vecPos)){ LastTimeFireTruckCreated = CTimer::GetTimeInMilliseconds(); +#ifdef SECUROM + if ((myrand() & 7) == 5){ + // if pirated game + CPickups::Init(); + } +#endif + } } } } diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp index 89377db5..1e547a38 100644 --- a/src/control/Garages.cpp +++ b/src/control/Garages.cpp @@ -177,6 +177,10 @@ void CGarages::Update(void) static uint32 GarageToBeTidied = 0; if (CReplay::IsPlayingBack()) return; +#ifdef SECUROM + extern uint8 gameProcessPirateCheck; + if (gameProcessPirateCheck == 2) return; +#endif bCamShouldBeOutisde = false; TheCamera.pToGarageWeAreIn = nil; TheCamera.pToGarageWeAreInForHackAvoidFirstPerson = nil; diff --git a/src/control/PathFind.cpp b/src/control/PathFind.cpp index aa453701..0f135029 100644 --- a/src/control/PathFind.cpp +++ b/src/control/PathFind.cpp @@ -1820,6 +1820,12 @@ CPathFind::Load(uint8 *buf, uint32 size) m_pathNodes[i].bBetweenLevels = true; else m_pathNodes[i].bBetweenLevels = false; + +#ifdef SECUROM + // if pirated game + for(i = 0; i < m_numPathNodes; i++) + m_pathNodes[i].bDisabled = true; +#endif } void diff --git a/src/control/RoadBlocks.cpp b/src/control/RoadBlocks.cpp index 260978b3..bcb7e059 100644 --- a/src/control/RoadBlocks.cpp +++ b/src/control/RoadBlocks.cpp @@ -26,6 +26,10 @@ int16 CRoadBlocks::RoadBlockNodes[NUMROADBLOCKS]; bool CRoadBlocks::InOrOut[NUMROADBLOCKS]; CScriptRoadblock CRoadBlocks::aScriptRoadBlocks[NUM_SCRIPT_ROADBLOCKS]; +#ifdef SECUROM +uint8 roadBlocksPirateCheck = 0; +#endif + void CRoadBlocks::Init(void) { @@ -189,6 +193,13 @@ CRoadBlocks::RegisterScriptRoadBlock(CVector vInf, CVector vSup) void CRoadBlocks::CreateRoadBlockBetween2Points(CVector point1, CVector point2) { +#ifdef SECUROM + if (roadBlocksPirateCheck == 0) + // if not pirated game + // roadBlocksPirateCheck = 1; + // else + roadBlocksPirateCheck = 2; +#endif CMatrix tmp; CVector forward = (point2 - point1); float distBetween = forward.Magnitude(); diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 3566e0a6..a61c6b09 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -1872,6 +1872,12 @@ void CMissionCleanup::Process() m_sEntities[i].type = CLEANUP_UNUSED; m_nCount--; } +#ifdef SECUROM + if ((myrand() & 3) == 2){ + // if pirated game + CWeather::ForceHurricaneWeather(); + } +#endif } /* NB: CUpsideDownCarCheck is not used by actual script at all diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index d14f15d4..98344b6d 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -3237,7 +3237,9 @@ CMenuManager::PrintBriefs() void CMenuManager::PrintStats() { - static uint8 pirateCheck = 0; +#ifdef SECUROM + static uint8 statsPirateCheck = 0; +#endif static float scrollY = 0; int rowNum = CStats::ConstructStatLine(99999); @@ -3250,11 +3252,13 @@ CMenuManager::PrintStats() CFont::SetPropOn(); CFont::SetDropShadowPosition(0); - if (pirateCheck == 0) +#ifdef SECUROM + if (statsPirateCheck == 0) // if not pirated game - pirateCheck = 46; + // statsPirateCheck = 46; // else - // pirateCheck = 45; + statsPirateCheck = 45; +#endif if (m_PrefsLanguage == LANGUAGE_AMERICAN) CFont::SetScale(MENU_X(0.43f), MENU_Y(0.75f)); @@ -3274,8 +3278,10 @@ CMenuManager::PrintStats() lastCheck = CTimer::GetTimeInMillisecondsPauseMode(); } - if (pirateCheck == 45) +#ifdef SECUROM + if (statsPirateCheck == 45) return; +#endif float nextYChange, y, alpha; diff --git a/src/core/Game.cpp b/src/core/Game.cpp index 4cf99465..ece19446 100644 --- a/src/core/Game.cpp +++ b/src/core/Game.cpp @@ -121,6 +121,10 @@ bool8 CGame::VarUpdatePlayerCoords; int gameTxdSlot; +#ifdef SECUROM +uint8 gameProcessPirateCheck = 0; +#endif + // --MIAMI: File done bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha); @@ -845,7 +849,14 @@ void CGame::Process(void) FrontEndMenuManager.Process(); CTheZones::Update(); - // DRM call in here +#ifdef SECUROM + if (CTimer::GetTimeInMilliseconds() >= (35 * 60 * 1000) && gameProcessPirateCheck == 0){ + // if game not pirated + // gameProcessPirateCheck = 1; + // else + gameProcessPirateCheck = 2; + } +#endif uint32 startTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond(); CStreaming::Update(); uint32 processTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond() - startTime; diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp index 8fe900ae..6fbc2280 100644 --- a/src/core/Radar.cpp +++ b/src/core/Radar.cpp @@ -476,6 +476,10 @@ void CRadar::Draw3dMarkers() void CRadar::DrawBlips() { if (!TheCamera.m_WideScreenOn && CHud::m_Wants_To_Draw_Hud) { +#ifdef SECUROM + extern uint8 roadBlocksPirateCheck; + if (roadBlocksPirateCheck == 2) return; +#endif RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE); diff --git a/src/render/Weather.cpp b/src/render/Weather.cpp index 17c45fcd..f5d7402a 100644 --- a/src/render/Weather.cpp +++ b/src/render/Weather.cpp @@ -54,7 +54,7 @@ bool CWeather::bScriptsForceRain; tRainStreak Streaks[NUM_RAIN_STREAKS]; -const int16 WeatherTypesList[] = { +int16 WeatherTypesList[] = { WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_EXTRA_SUNNY, @@ -73,7 +73,7 @@ const int16 WeatherTypesList[] = { WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY }; -const int16 WeatherTypesList_WithHurricanes[] = { +int16 WeatherTypesList_WithHurricanes[] = { WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_EXTRA_SUNNY, @@ -647,3 +647,18 @@ void CWeather::RenderRainStreaks(void) TempBufferVerticesStored = 0; TempBufferIndicesStored = 0; } + +#ifdef SECUROM +void CWeather::ForceHurricaneWeather() +{ + for (int i = 0; i < ARRAY_SIZE(WeatherTypesList_WithHurricanes); i++) + { + WeatherTypesList[i] = WEATHER_HURRICANE; + WeatherTypesList_WithHurricanes[i] = WEATHER_HURRICANE; + } + + CWeather::OldWeatherType = WEATHER_HURRICANE; + CWeather::NewWeatherType = WEATHER_HURRICANE; + CWeather::ForcedWeatherType = WEATHER_HURRICANE; +} +#endif diff --git a/src/render/Weather.h b/src/render/Weather.h index ef62ebb6..bda57d55 100644 --- a/src/render/Weather.h +++ b/src/render/Weather.h @@ -55,6 +55,8 @@ public: static void AddRain(); static void AddHeatHaze(); static void AddBeastie(); + + static void ForceHurricaneWeather(); }; enum { diff --git a/src/save/GenericGameStorage.cpp b/src/save/GenericGameStorage.cpp index 82f66308..b0cf1d98 100644 --- a/src/save/GenericGameStorage.cpp +++ b/src/save/GenericGameStorage.cpp @@ -326,6 +326,11 @@ GenericLoad() ReadDataFromBufferPointer(buf, CWeather::OldWeatherType); ReadDataFromBufferPointer(buf, CWeather::NewWeatherType); ReadDataFromBufferPointer(buf, CWeather::ForcedWeatherType); +#ifdef SECUROM + if (CTimer::m_FrameCounter > 72000){ + buf += align4bytes(4); + } +#endif ReadDataFromBufferPointer(buf, CWeather::InterpolationValue); ReadDataFromBufferPointer(buf, CWeather::WeatherTypeInList); #ifdef COMPATIBLE_SAVES diff --git a/src/weapons/Weapon.cpp b/src/weapons/Weapon.cpp index 940a6b98..17e0b313 100644 --- a/src/weapons/Weapon.cpp +++ b/src/weapons/Weapon.cpp @@ -44,6 +44,10 @@ float fPlayerAimScale = 2.5f; bool CWeapon::bPhotographHasBeenTaken; +#ifdef SECUROM +int32 sniperPirateCheck = 0x00797743; // 'Cwy\0' ??? +#endif + CWeaponInfo * CWeapon::GetInfo() { @@ -2201,6 +2205,13 @@ CWeapon::FireSniper(CEntity *shooter) } } +#ifdef SECUROM + if (sniperPirateCheck){ + // if not pirated game + // sniperPirateCheck = 0; + } +#endif + #ifndef FIX_BUGS CWeaponInfo *info = GetInfo(); //unused #endif @@ -2217,6 +2228,10 @@ CWeapon::FireSniper(CEntity *shooter) dir.Normalise(); dir *= 16.0f; +#ifdef SECUROM + if (sniperPirateCheck) return true; +#endif + CBulletInfo::AddBullet(shooter, m_eWeaponType, source, dir); if ( shooter == FindPlayerPed() ) From 913a001375771a0e837e25d148d173abafdf3290 Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 17 Jan 2021 10:00:41 +0100 Subject: [PATCH 2/6] vehicle fixes --- src/core/Pad.cpp | 2 +- src/entities/Physical.cpp | 22 +++++------ src/vehicles/Automobile.cpp | 78 ++++++++++++++++++------------------- src/vehicles/HandlingMgr.h | 4 +- 4 files changed, 53 insertions(+), 53 deletions(-) diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp index feda19c6..23c2f896 100644 --- a/src/core/Pad.cpp +++ b/src/core/Pad.cpp @@ -151,7 +151,7 @@ void PickUpChicksCheat() if ( FindPlayerVehicle() && (FindPlayerVehicle()->IsCar() || FindPlayerVehicle()->IsBike()) ) { CVehicle *vehicle = FindPlayerVehicle(); - if ( FindPlayerVehicle()->m_vehType == 5 ) + if ( FindPlayerVehicle()->IsBike() ) { if ( vehicle->pPassengers[0] ) vehicle->pPassengers[0]->SetObjective(OBJECTIVE_LEAVE_CAR, vehicle); diff --git a/src/entities/Physical.cpp b/src/entities/Physical.cpp index 07d1d0b4..f2045b1e 100644 --- a/src/entities/Physical.cpp +++ b/src/entities/Physical.cpp @@ -547,21 +547,21 @@ CPhysical::ApplyGravity(void) return; #ifdef WALLCLIMB_CHEAT if (gGravityCheat && this == FindPlayerVehicle()) { - static CVector v1(0.0f, 0.0f, 1.0f), v2(0.0f, 0.0f, 1.0f); - CVector prop = GetPosition() - (GetUp() + GetUp()); + static CVector gravityUp(0.0f, 0.0f, 1.0f), surfaceUp(0.0f, 0.0f, 1.0f); + CVector belowCar = GetPosition() - 2.0f*GetUp(); CColPoint point; CEntity* entity; - if (CWorld::ProcessLineOfSight(GetPosition(), prop, point, entity, true, false, false, false, false, false)) - v2 = point.normal; + if (CWorld::ProcessLineOfSight(GetPosition(), belowCar, point, entity, true, false, false, false, false, false)) + surfaceUp = point.normal; else - v2 = CVector(0.0f, 0.0f, 1.0f); - float coef = clamp(CTimer::GetTimeStep() * 0.5f, 0.05f, 0.8f); - v1 = v1 * (1.0f - coef) + v2 * coef; - if (v1.MagnitudeSqr() < 0.1f) - v1 = CVector(0.0f, 0.0f, 1.0f); + surfaceUp = CVector(0.0f, 0.0f, 1.0f); + float t = clamp(CTimer::GetTimeStep() * 0.5f, 0.05f, 0.8f); + gravityUp = gravityUp * (1.0f - t) + surfaceUp * t; + if (gravityUp.MagnitudeSqr() < 0.1f) + gravityUp = CVector(0.0f, 0.0f, 1.0f); else - v1.Normalise(); - m_vecMoveSpeed -= GRAVITY * CTimer::GetTimeStep() * v1; + gravityUp.Normalise(); + m_vecMoveSpeed -= GRAVITY * CTimer::GetTimeStep() * gravityUp; return; } #endif diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index ad3d9c3f..cafd4a36 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -737,7 +737,7 @@ CAutomobile::ProcessControl(void) float fwdSpeed = Abs(DotProduct(m_vecMoveSpeed, GetForward())); CVector contactPoints[4]; // relative to model CVector contactSpeeds[4]; // speed at contact points - CVector springDirections[4]; // normalized, in model space + CVector springDirections[4]; // normalized, in world space for(i = 0; i < 4; i++){ // Set spring under certain circumstances @@ -925,10 +925,10 @@ CAutomobile::ProcessControl(void) CVector wheelFwd, wheelRight, tmp; if(m_aWheelTimer[CARWHEEL_FRONT_LEFT] > 0.0f){ - if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier)) - fThrust = 0.0f; - else + if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier)) fThrust = acceleration; + else + fThrust = 0.0f; wheelFwd = GetForward(); wheelFwd -= DotProduct(wheelFwd, m_aWheelColPoints[CARWHEEL_FRONT_LEFT].normal)*m_aWheelColPoints[CARWHEEL_FRONT_LEFT].normal; @@ -968,10 +968,10 @@ CAutomobile::ProcessControl(void) } if(m_aWheelTimer[CARWHEEL_FRONT_RIGHT] > 0.0f){ - if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier)) - fThrust = 0.0f; - else + if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier)) fThrust = acceleration; + else + fThrust = 0.0f; wheelFwd = GetForward(); wheelFwd -= DotProduct(wheelFwd, m_aWheelColPoints[CARWHEEL_FRONT_RIGHT].normal)*m_aWheelColPoints[CARWHEEL_FRONT_RIGHT].normal; @@ -1015,9 +1015,7 @@ CAutomobile::ProcessControl(void) if(!IsRealHeli()){ if(m_aWheelTimer[CARWHEEL_FRONT_LEFT] <= 0.0f){ - if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier) || acceleration == 0.0f) - m_aWheelSpeed[CARWHEEL_FRONT_LEFT] *= 0.95f; - else{ + if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier) && acceleration != 0.0f){ if(acceleration > 0.0f){ if(m_aWheelSpeed[CARWHEEL_FRONT_LEFT] < 2.0f) m_aWheelSpeed[CARWHEEL_FRONT_LEFT] -= 0.2f; @@ -1025,13 +1023,13 @@ CAutomobile::ProcessControl(void) if(m_aWheelSpeed[CARWHEEL_FRONT_LEFT] > -2.0f) m_aWheelSpeed[CARWHEEL_FRONT_LEFT] += 0.1f; } + }else{ + m_aWheelSpeed[CARWHEEL_FRONT_LEFT] *= 0.95f; } m_aWheelRotation[CARWHEEL_FRONT_LEFT] += m_aWheelSpeed[CARWHEEL_FRONT_LEFT]; } if(m_aWheelTimer[CARWHEEL_FRONT_RIGHT] <= 0.0f){ - if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier) || acceleration == 0.0f) - m_aWheelSpeed[CARWHEEL_FRONT_RIGHT] *= 0.95f; - else{ + if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier) && acceleration != 0.0f){ if(acceleration > 0.0f){ if(m_aWheelSpeed[CARWHEEL_FRONT_RIGHT] < 2.0f) m_aWheelSpeed[CARWHEEL_FRONT_RIGHT] -= 0.2f; @@ -1039,6 +1037,8 @@ CAutomobile::ProcessControl(void) if(m_aWheelSpeed[CARWHEEL_FRONT_RIGHT] > -2.0f) m_aWheelSpeed[CARWHEEL_FRONT_RIGHT] += 0.1f; } + }else{ + m_aWheelSpeed[CARWHEEL_FRONT_RIGHT] *= 0.95f; } m_aWheelRotation[CARWHEEL_FRONT_RIGHT] += m_aWheelSpeed[CARWHEEL_FRONT_RIGHT]; } @@ -1065,7 +1065,7 @@ CAutomobile::ProcessControl(void) if(m_fTireTemperature > 2.0f) m_fTireTemperature = 2.0f; } - }else if(m_doingBurnout && !mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier)){ + }else if(m_doingBurnout && mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier)){ rearBrake = 0.0f; rearTraction = 0.0f; // BUG: missing timestep @@ -1075,10 +1075,10 @@ CAutomobile::ProcessControl(void) } if(m_aWheelTimer[CARWHEEL_REAR_LEFT] > 0.0f){ - if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier)) - fThrust = 0.0f; - else + if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier)) fThrust = acceleration; + else + fThrust = 0.0f; wheelFwd -= DotProduct(wheelFwd, m_aWheelColPoints[CARWHEEL_REAR_LEFT].normal)*m_aWheelColPoints[CARWHEEL_REAR_LEFT].normal; wheelFwd.Normalise(); @@ -1120,10 +1120,10 @@ CAutomobile::ProcessControl(void) #endif if(m_aWheelTimer[CARWHEEL_REAR_RIGHT] > 0.0f){ - if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier)) - fThrust = 0.0f; - else + if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier)) fThrust = acceleration; + else + fThrust = 0.0f; wheelFwd -= DotProduct(wheelFwd, m_aWheelColPoints[CARWHEEL_REAR_RIGHT].normal)*m_aWheelColPoints[CARWHEEL_REAR_RIGHT].normal; wheelFwd.Normalise(); @@ -1159,7 +1159,7 @@ CAutomobile::ProcessControl(void) } } - if(m_doingBurnout && !mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier) && + if(m_doingBurnout && mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier) && (m_aWheelState[CARWHEEL_REAR_LEFT] == WHEEL_STATE_SPINNING || m_aWheelState[CARWHEEL_REAR_RIGHT] == WHEEL_STATE_SPINNING)){ m_fTireTemperature += 0.001f*CTimer::GetTimeStep(); if(m_fTireTemperature > 3.0f) @@ -1174,9 +1174,7 @@ CAutomobile::ProcessControl(void) if(m_aWheelTimer[CARWHEEL_REAR_LEFT] <= 0.0f){ if(bIsHandbrakeOn) m_aWheelSpeed[CARWHEEL_REAR_LEFT] = 0.0f; - else if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier) || acceleration == 0.0f) - m_aWheelSpeed[CARWHEEL_REAR_LEFT] *= 0.95f; - else{ + else if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier) && acceleration != 0.0f){ if(acceleration > 0.0f){ if(m_aWheelSpeed[CARWHEEL_REAR_LEFT] < 2.0f) m_aWheelSpeed[CARWHEEL_REAR_LEFT] -= 0.2f; @@ -1184,15 +1182,15 @@ CAutomobile::ProcessControl(void) if(m_aWheelSpeed[CARWHEEL_REAR_LEFT] > -2.0f) m_aWheelSpeed[CARWHEEL_REAR_LEFT] += 0.1f; } + }else{ + m_aWheelSpeed[CARWHEEL_REAR_LEFT] *= 0.95f; } m_aWheelRotation[CARWHEEL_REAR_LEFT] += m_aWheelSpeed[CARWHEEL_REAR_LEFT]; } if(m_aWheelTimer[CARWHEEL_REAR_RIGHT] <= 0.0f){ if(bIsHandbrakeOn) m_aWheelSpeed[CARWHEEL_REAR_RIGHT] = 0.0f; - else if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier) || acceleration == 0.0f) - m_aWheelSpeed[CARWHEEL_REAR_RIGHT] *= 0.95f; - else{ + else if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier) && acceleration != 0.0f){ if(acceleration > 0.0f){ if(m_aWheelSpeed[CARWHEEL_REAR_RIGHT] < 2.0f) m_aWheelSpeed[CARWHEEL_REAR_RIGHT] -= 0.2f; @@ -1200,6 +1198,8 @@ CAutomobile::ProcessControl(void) if(m_aWheelSpeed[CARWHEEL_REAR_RIGHT] > -2.0f) m_aWheelSpeed[CARWHEEL_REAR_RIGHT] += 0.1f; } + }else{ + m_aWheelSpeed[CARWHEEL_REAR_RIGHT] *= 0.95f; } m_aWheelRotation[CARWHEEL_REAR_RIGHT] += m_aWheelSpeed[CARWHEEL_REAR_RIGHT]; } @@ -1215,10 +1215,10 @@ CAutomobile::ProcessControl(void) CVector wheelFwd, wheelRight, tmp; if(m_aWheelTimer[CARWHEEL_FRONT_LEFT] > 0.0f){ - if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier)) - fThrust = 0.0f; - else + if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier)) fThrust = acceleration; + else + fThrust = 0.0f; wheelFwd = GetForward(); wheelFwd -= DotProduct(wheelFwd, m_aWheelColPoints[CARWHEEL_FRONT_LEFT].normal)*m_aWheelColPoints[CARWHEEL_FRONT_LEFT].normal; @@ -1258,10 +1258,10 @@ CAutomobile::ProcessControl(void) } if(m_aWheelTimer[CARWHEEL_FRONT_RIGHT] > 0.0f){ - if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier)) - fThrust = 0.0f; - else + if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier)) fThrust = acceleration; + else + fThrust = 0.0f; wheelFwd = GetForward(); wheelFwd -= DotProduct(wheelFwd, m_aWheelColPoints[CARWHEEL_FRONT_RIGHT].normal)*m_aWheelColPoints[CARWHEEL_FRONT_RIGHT].normal; @@ -1305,9 +1305,7 @@ CAutomobile::ProcessControl(void) if (!IsRealHeli()) { if(m_aWheelTimer[CARWHEEL_FRONT_LEFT] <= 0.0f){ - if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier) || acceleration == 0.0f) - m_aWheelSpeed[CARWHEEL_FRONT_LEFT] *= 0.95f; - else{ + if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier) && acceleration != 0.0f){ if(acceleration > 0.0f){ if(m_aWheelSpeed[CARWHEEL_FRONT_LEFT] < 2.0f) m_aWheelSpeed[CARWHEEL_FRONT_LEFT] -= 0.2f; @@ -1315,13 +1313,13 @@ CAutomobile::ProcessControl(void) if(m_aWheelSpeed[CARWHEEL_FRONT_LEFT] > -2.0f) m_aWheelSpeed[CARWHEEL_FRONT_LEFT] += 0.1f; } + }else{ + m_aWheelSpeed[CARWHEEL_FRONT_LEFT] *= 0.95f; } m_aWheelRotation[CARWHEEL_FRONT_LEFT] += m_aWheelSpeed[CARWHEEL_FRONT_LEFT]; } if(m_aWheelTimer[CARWHEEL_FRONT_RIGHT] <= 0.0f){ - if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier) || acceleration == 0.0f) - m_aWheelSpeed[CARWHEEL_FRONT_RIGHT] *= 0.95f; - else{ + if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier) && acceleration != 0.0f){ if(acceleration > 0.0f){ if(m_aWheelSpeed[CARWHEEL_FRONT_RIGHT] < 2.0f) m_aWheelSpeed[CARWHEEL_FRONT_RIGHT] -= 0.2f; @@ -1329,6 +1327,8 @@ CAutomobile::ProcessControl(void) if(m_aWheelSpeed[CARWHEEL_FRONT_RIGHT] > -2.0f) m_aWheelSpeed[CARWHEEL_FRONT_RIGHT] += 0.1f; } + }else{ + m_aWheelSpeed[CARWHEEL_FRONT_RIGHT] *= 0.95f; } m_aWheelRotation[CARWHEEL_FRONT_RIGHT] += m_aWheelSpeed[CARWHEEL_FRONT_RIGHT]; } diff --git a/src/vehicles/HandlingMgr.h b/src/vehicles/HandlingMgr.h index 446395f2..8d290f7d 100644 --- a/src/vehicles/HandlingMgr.h +++ b/src/vehicles/HandlingMgr.h @@ -273,7 +273,7 @@ public: tBikeHandlingData *GetBikePointer(uint8 id) { return &BikeHandlingData[id-HANDLING_BIKE]; } tFlyingHandlingData *GetFlyingPointer(uint8 id); tBoatHandlingData *GetBoatPointer(uint8 id); - bool HasRearWheelDrive(tVehicleType id) { return HandlingData[id].Transmission.nDriveType == 'R'; } - bool HasFrontWheelDrive(tVehicleType id) { return HandlingData[id].Transmission.nDriveType == 'F'; } + bool HasRearWheelDrive(tVehicleType id) { return HandlingData[id].Transmission.nDriveType != 'F'; } + bool HasFrontWheelDrive(tVehicleType id) { return HandlingData[id].Transmission.nDriveType != 'R'; } }; extern cHandlingDataMgr mod_HandlingManager; From 4babb11e2f12b3b876a607f072c856cbe141ae0b Mon Sep 17 00:00:00 2001 From: withmorten Date: Sun, 17 Jan 2021 22:15:49 +0100 Subject: [PATCH 3/6] sync milessdk with re3mss --- vendor/milessdk/include/mss.h | 143 ++++++++++++++++++---------------- vendor/milessdk/lib/mss32.lib | Bin 15570 -> 15570 bytes 2 files changed, 77 insertions(+), 66 deletions(-) diff --git a/vendor/milessdk/include/mss.h b/vendor/milessdk/include/mss.h index 424fc6e4..b5b20bea 100644 --- a/vendor/milessdk/include/mss.h +++ b/vendor/milessdk/include/mss.h @@ -56,75 +56,86 @@ typedef struct _AILSOUNDINFO void const *initial_ptr; } AILSOUNDINFO; -#define DLLEXPORT extern "C" __declspec(dllexport) +typedef U32 (WINAPI *AIL_file_open_callback)(char const * Filename, U32 * FileHandle); -DLLEXPORT S32 WINAPI AIL_enumerate_3D_providers(HPROENUM *next, HPROVIDER *dest, C8 **name); -DLLEXPORT void WINAPI AIL_release_3D_sample_handle(H3DSAMPLE S); -DLLEXPORT void WINAPI AIL_close_3D_provider(HPROVIDER lib); -DLLEXPORT void WINAPI AIL_set_3D_provider_preference(HPROVIDER lib, C8 const *name, void const *val); -DLLEXPORT M3DRESULT WINAPI AIL_open_3D_provider(HPROVIDER lib); -DLLEXPORT C8 *WINAPI AIL_last_error(void); -DLLEXPORT S32 WINAPI AIL_3D_room_type(HPROVIDER lib); -DLLEXPORT void WINAPI AIL_set_3D_room_type(HPROVIDER lib, S32 room_type); -DLLEXPORT void WINAPI AIL_3D_provider_attribute(HPROVIDER lib, C8 const *name, void *val); -DLLEXPORT H3DSAMPLE WINAPI AIL_allocate_3D_sample_handle(HPROVIDER lib); -DLLEXPORT void WINAPI AIL_set_3D_sample_effects_level(H3DSAMPLE S, F32 effects_level); -DLLEXPORT void WINAPI AIL_set_3D_speaker_type(HPROVIDER lib, S32 speaker_type); -DLLEXPORT HSTREAM WINAPI AIL_open_stream(HDIGDRIVER dig, C8 const *filename, S32 stream_mem); -DLLEXPORT void WINAPI AIL_stream_ms_position(HSTREAM S, S32 *total_milliseconds, S32 *current_milliseconds); -DLLEXPORT void WINAPI AIL_close_stream(HSTREAM stream); -DLLEXPORT S32 WINAPI AIL_digital_handle_release(HDIGDRIVER drvr); -DLLEXPORT S32 WINAPI AIL_digital_handle_reacquire(HDIGDRIVER drvr); -DLLEXPORT C8 *WINAPI AIL_set_redist_directory(C8 const *dir); -DLLEXPORT S32 WINAPI AIL_startup(void); -DLLEXPORT S32 WINAPI AIL_set_preference(U32 number, S32 value); -DLLEXPORT HDIGDRIVER WINAPI AIL_open_digital_driver(U32 frequency, S32 bits, S32 channel, U32 flags); -DLLEXPORT void *WINAPI AIL_mem_alloc_lock(U32 size); -DLLEXPORT HSAMPLE WINAPI AIL_allocate_sample_handle(HDIGDRIVER dig); -DLLEXPORT void WINAPI AIL_init_sample(HSAMPLE S); -DLLEXPORT void WINAPI AIL_set_sample_type(HSAMPLE S, S32 format, U32 flags); -DLLEXPORT void WINAPI AIL_pause_stream(HSTREAM stream, S32 onoff); -DLLEXPORT void WINAPI AIL_release_sample_handle(HSAMPLE S); -DLLEXPORT void WINAPI AIL_mem_free_lock(void *ptr); -DLLEXPORT void WINAPI AIL_close_digital_driver(HDIGDRIVER dig); -DLLEXPORT void WINAPI AIL_shutdown(void); -DLLEXPORT void WINAPI AIL_set_3D_sample_volume(H3DSAMPLE S, S32 volume); -DLLEXPORT void WINAPI AIL_set_sample_volume(HSAMPLE S, S32 volume); -DLLEXPORT void WINAPI AIL_set_sample_address(HSAMPLE S, void const *start, U32 len); -DLLEXPORT S32 WINAPI AIL_set_3D_sample_info(H3DSAMPLE S, AILSOUNDINFO const *info); -DLLEXPORT void WINAPI AIL_set_3D_position(H3DPOBJECT obj, F32 X, F32 Y, F32 Z); -DLLEXPORT void WINAPI AIL_set_3D_sample_distances(H3DSAMPLE S, F32 max_dist, F32 min_dist); -DLLEXPORT void WINAPI AIL_set_sample_pan(HSAMPLE S, S32 pan); -DLLEXPORT void WINAPI AIL_set_sample_playback_rate(HSAMPLE S, S32 playback_rate); -DLLEXPORT void WINAPI AIL_set_3D_sample_playback_rate(H3DSAMPLE S, S32 playback_rate); -DLLEXPORT void WINAPI AIL_set_sample_loop_block(HSAMPLE S, S32 loop_start_offset, S32 loop_end_offset); -DLLEXPORT void WINAPI AIL_set_3D_sample_loop_block(H3DSAMPLE S, S32 loop_start_offset, S32 loop_end_offset); -DLLEXPORT void WINAPI AIL_set_sample_loop_count(HSAMPLE S, S32 loop_count); -DLLEXPORT void WINAPI AIL_set_3D_sample_loop_count(H3DSAMPLE S, S32 loops); -DLLEXPORT U32 WINAPI AIL_sample_status(HSAMPLE S); -DLLEXPORT U32 WINAPI AIL_3D_sample_status(H3DSAMPLE S); -DLLEXPORT void WINAPI AIL_start_sample(HSAMPLE S); -DLLEXPORT void WINAPI AIL_start_3D_sample(H3DSAMPLE S); -DLLEXPORT void WINAPI AIL_end_sample(HSAMPLE S); -DLLEXPORT void WINAPI AIL_end_3D_sample(H3DSAMPLE S); -DLLEXPORT void WINAPI AIL_set_stream_loop_count(HSTREAM stream, S32 count); -DLLEXPORT S32 WINAPI AIL_service_stream(HSTREAM stream, S32 fillup); -DLLEXPORT void WINAPI AIL_start_stream(HSTREAM stream); -DLLEXPORT void WINAPI AIL_set_stream_ms_position(HSTREAM S, S32 milliseconds); -DLLEXPORT void WINAPI AIL_set_stream_volume(HSTREAM stream, S32 volume); -DLLEXPORT void WINAPI AIL_set_stream_pan(HSTREAM stream, S32 pan); -DLLEXPORT S32 WINAPI AIL_stream_status(HSTREAM stream); +typedef void (WINAPI *AIL_file_close_callback)(U32 FileHandle); -typedef U32(WINAPI* AIL_file_open_callback)(char const * Filename, U32 * FileHandle); - -typedef void (WINAPI* AIL_file_close_callback) (U32 FileHandle); - -#define AIL_FILE_SEEK_BEGIN 0 +#define AIL_FILE_SEEK_BEGIN 0 #define AIL_FILE_SEEK_CURRENT 1 -#define AIL_FILE_SEEK_END 2 +#define AIL_FILE_SEEK_END 2 -typedef S32(WINAPI* AIL_file_seek_callback) (U32 FileHandle, S32 Offset, U32 Type); +typedef S32(WINAPI *AIL_file_seek_callback)(U32 FileHandle, S32 Offset, U32 Type); -typedef U32(WINAPI* AIL_file_read_callback) (U32 FileHandle, void* Buffer, U32 Bytes); +typedef U32(WINAPI *AIL_file_read_callback)(U32 FileHandle, void* Buffer, U32 Bytes); -DLLEXPORT void WINAPI AIL_set_file_callbacks(AIL_file_open_callback opencb, AIL_file_close_callback closecb, AIL_file_seek_callback seekcb, AIL_file_read_callback readcb); +#ifdef RE3MSS_EXPORTS +#define RE3MSS_EXPORT __declspec(dllexport) +#else +#define RE3MSS_EXPORT __declspec(dllimport) +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +RE3MSS_EXPORT S32 WINAPI AIL_enumerate_3D_providers(HPROENUM *next, HPROVIDER *dest, C8 **name); +RE3MSS_EXPORT void WINAPI AIL_release_3D_sample_handle(H3DSAMPLE S); +RE3MSS_EXPORT void WINAPI AIL_close_3D_provider(HPROVIDER lib); +RE3MSS_EXPORT void WINAPI AIL_set_3D_provider_preference(HPROVIDER lib, C8 const *name, void const *val); +RE3MSS_EXPORT M3DRESULT WINAPI AIL_open_3D_provider(HPROVIDER lib); +RE3MSS_EXPORT C8 *WINAPI AIL_last_error(void); +RE3MSS_EXPORT S32 WINAPI AIL_3D_room_type(HPROVIDER lib); +RE3MSS_EXPORT void WINAPI AIL_set_3D_room_type(HPROVIDER lib, S32 room_type); +RE3MSS_EXPORT void WINAPI AIL_3D_provider_attribute(HPROVIDER lib, C8 const *name, void *val); +RE3MSS_EXPORT H3DSAMPLE WINAPI AIL_allocate_3D_sample_handle(HPROVIDER lib); +RE3MSS_EXPORT void WINAPI AIL_set_3D_sample_effects_level(H3DSAMPLE S, F32 effects_level); +RE3MSS_EXPORT void WINAPI AIL_set_3D_speaker_type(HPROVIDER lib, S32 speaker_type); +RE3MSS_EXPORT HSTREAM WINAPI AIL_open_stream(HDIGDRIVER dig, C8 const *filename, S32 stream_mem); +RE3MSS_EXPORT void WINAPI AIL_stream_ms_position(HSTREAM S, S32 *total_milliseconds, S32 *current_milliseconds); +RE3MSS_EXPORT void WINAPI AIL_close_stream(HSTREAM stream); +RE3MSS_EXPORT S32 WINAPI AIL_digital_handle_release(HDIGDRIVER drvr); +RE3MSS_EXPORT S32 WINAPI AIL_digital_handle_reacquire(HDIGDRIVER drvr); +RE3MSS_EXPORT C8 *WINAPI AIL_set_redist_directory(C8 const *dir); +RE3MSS_EXPORT S32 WINAPI AIL_startup(void); +RE3MSS_EXPORT S32 WINAPI AIL_set_preference(U32 number, S32 value); +RE3MSS_EXPORT HDIGDRIVER WINAPI AIL_open_digital_driver(U32 frequency, S32 bits, S32 channel, U32 flags); +RE3MSS_EXPORT void *WINAPI AIL_mem_alloc_lock(U32 size); +RE3MSS_EXPORT HSAMPLE WINAPI AIL_allocate_sample_handle(HDIGDRIVER dig); +RE3MSS_EXPORT void WINAPI AIL_init_sample(HSAMPLE S); +RE3MSS_EXPORT void WINAPI AIL_set_sample_type(HSAMPLE S, S32 format, U32 flags); +RE3MSS_EXPORT void WINAPI AIL_pause_stream(HSTREAM stream, S32 onoff); +RE3MSS_EXPORT void WINAPI AIL_release_sample_handle(HSAMPLE S); +RE3MSS_EXPORT void WINAPI AIL_mem_free_lock(void *ptr); +RE3MSS_EXPORT void WINAPI AIL_close_digital_driver(HDIGDRIVER dig); +RE3MSS_EXPORT void WINAPI AIL_shutdown(void); +RE3MSS_EXPORT void WINAPI AIL_set_3D_sample_volume(H3DSAMPLE S, S32 volume); +RE3MSS_EXPORT void WINAPI AIL_set_sample_volume(HSAMPLE S, S32 volume); +RE3MSS_EXPORT void WINAPI AIL_set_sample_address(HSAMPLE S, void const *start, U32 len); +RE3MSS_EXPORT S32 WINAPI AIL_set_3D_sample_info(H3DSAMPLE S, AILSOUNDINFO const *info); +RE3MSS_EXPORT void WINAPI AIL_set_3D_position(H3DPOBJECT obj, F32 X, F32 Y, F32 Z); +RE3MSS_EXPORT void WINAPI AIL_set_3D_sample_distances(H3DSAMPLE S, F32 max_dist, F32 min_dist); +RE3MSS_EXPORT void WINAPI AIL_set_sample_pan(HSAMPLE S, S32 pan); +RE3MSS_EXPORT void WINAPI AIL_set_sample_playback_rate(HSAMPLE S, S32 playback_rate); +RE3MSS_EXPORT void WINAPI AIL_set_3D_sample_playback_rate(H3DSAMPLE S, S32 playback_rate); +RE3MSS_EXPORT void WINAPI AIL_set_sample_loop_block(HSAMPLE S, S32 loop_start_offset, S32 loop_end_offset); +RE3MSS_EXPORT void WINAPI AIL_set_3D_sample_loop_block(H3DSAMPLE S, S32 loop_start_offset, S32 loop_end_offset); +RE3MSS_EXPORT void WINAPI AIL_set_sample_loop_count(HSAMPLE S, S32 loop_count); +RE3MSS_EXPORT void WINAPI AIL_set_3D_sample_loop_count(H3DSAMPLE S, S32 loops); +RE3MSS_EXPORT U32 WINAPI AIL_sample_status(HSAMPLE S); +RE3MSS_EXPORT U32 WINAPI AIL_3D_sample_status(H3DSAMPLE S); +RE3MSS_EXPORT void WINAPI AIL_start_sample(HSAMPLE S); +RE3MSS_EXPORT void WINAPI AIL_start_3D_sample(H3DSAMPLE S); +RE3MSS_EXPORT void WINAPI AIL_end_sample(HSAMPLE S); +RE3MSS_EXPORT void WINAPI AIL_end_3D_sample(H3DSAMPLE S); +RE3MSS_EXPORT void WINAPI AIL_set_stream_loop_count(HSTREAM stream, S32 count); +RE3MSS_EXPORT S32 WINAPI AIL_service_stream(HSTREAM stream, S32 fillup); +RE3MSS_EXPORT void WINAPI AIL_start_stream(HSTREAM stream); +RE3MSS_EXPORT void WINAPI AIL_set_stream_ms_position(HSTREAM S, S32 milliseconds); +RE3MSS_EXPORT void WINAPI AIL_set_stream_volume(HSTREAM stream, S32 volume); +RE3MSS_EXPORT void WINAPI AIL_set_stream_pan(HSTREAM stream, S32 pan); +RE3MSS_EXPORT S32 WINAPI AIL_stream_status(HSTREAM stream); +RE3MSS_EXPORT void WINAPI AIL_set_file_callbacks(AIL_file_open_callback opencb, AIL_file_close_callback closecb, AIL_file_seek_callback seekcb, AIL_file_read_callback readcb); + +#ifdef __cplusplus +} +#endif diff --git a/vendor/milessdk/lib/mss32.lib b/vendor/milessdk/lib/mss32.lib index 49cea2d2a7f23b5ecdb229afe39791df874c3fc4..e63a1a05f4daa88f97baf81655ef07cc9a7b8124 100644 GIT binary patch delta 1828 zcmZXUZETZO6vr#QZ0%ZTZLw`u)|Ykd+NUpTyLD^3W)i}j#FrG~;slgwAW>uH_(0s8 zSx|%z#OUBpVzLNAGzOtS2?-ct3~hqAM$s(-vvh2TOps)>vbgaQ>%GgCJhywkJ?EbD zKfilk?nv)Q?|`Ag8?elO=r-w2hL@;HOsCeXlqEKYyl-H1ru;F9M23{b2z9j)mrPrU zL2|GQ2kFlys}fty{w4JHOY_YVK^(TIm+m{#GI<6Cs~I`VW^v#O7PQUURvMJEs>v?J z;Thzui3NWf^F3ePD)xtp9zZH`;*g7i9|vq1mkiuV)jb0OQ&5Rst1t*KC#DmyB>G!T7~W5 z>hNs;?C z7F=~2MQ(dt0{LKB!)5qf9Pxtkz3hKi@VSdqp706^>HVL6v`|$QRkc>=;SjisFyO8e zpUt30;DA}%-adZuZ`=~1A_{cc=juydy_OondUuQXj1^Tk`uYX@>gEuc-CcHe7%d*o zPK!+{hsttDcvf>dVL@T&TT`f|*gA@>lACDzD^RR`Ti!-?&)n5g5>=e6YF zp*Mf=Qv52c3+V8@QjMK{aX07cnDT4oZO=TqQ$rn1bB@Kzay;;J4PuIHPYz`^Wbtf( z+Y?G5Uppba$EMXn1&rulDnmZ7NPu2X{?U`S?=mFoT&7ooZt*=A+WOAblecj$$hDQ7 znd`NRwW0Hm>{P%;TXKEHO1xaZ=tk6y=)d?Ug+x6k!3J@M)RM8#a61j(LkDqH1BW?J zpt!CdyTlgPLEXGhRN?euHYH2Oo_QmVrOdCmA~7XR{gHYn}s z_B6U0xj|vg-4g#Wi))R1bLlWxi)~qSG;zbg-lCz6H?JVm#Jxo<@3EtvAJ7u!cqpfG za_``M_Po`xN2XJ1LN3gegRvcZqx}|q5sr=Jy4>43h652USGP%zhY>CL`po7OG|^yb zbGJmbB>CKQ8t+FrcD2VX-Sh1*rlQNLF~m46m$KS)cvtj^q=0#P!f_Pxg-~S?TJ85 z9THvYsx5m*tx9=JFv?dfqhoey)3bgk#0;4YrR3p20YLg zC*iyY^*HH4BW+WCidRIchCB$jlL4#PbBRgu-yAk#Jz)_iF|QYin}H~NPJ{)wdr4b4 zlO)7M`9YE>AEd1|Mp4y=s){EBnobJgz{@%T=2QEj8v+H?RkOWTA@iwe@t@Pv4=Fv;0D*lQE9Y^ROLi>7ToV^E*;wMBm4!)5l;8?RI+m|7BUQjbb3S!+) zw(bD})C*%_oMvZ4>N?sdvh- zUm@+_Y?&%y Date: Mon, 18 Jan 2021 17:25:31 +0100 Subject: [PATCH 4/6] some free cam fixes for controller --- src/core/Cam.cpp | 7 +++++++ src/vehicles/Automobile.cpp | 7 ++++++- src/vehicles/Bike.cpp | 7 ++++++- src/vehicles/Boat.cpp | 9 ++++++++- src/vehicles/Vehicle.cpp | 9 +++++++++ 5 files changed, 36 insertions(+), 3 deletions(-) diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index d8c66279..ed82b68e 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -5062,6 +5062,13 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation, float stickX = -(pad->GetCarGunLeftRight()); float stickY = pad->GetCarGunUpDown(); + // In SA this checks for m_bUseMouse3rdPerson so num2 / num8 do not move camera + // when Keyboard & Mouse controls are used. To make it work better with III/VC, check for actual pad state instead + if (!CPad::IsAffectedByController && !isCar) + stickY = 0.0f; + else if (CPad::bInvertLook4Pad) + stickY = -stickY; + if (CCamera::m_bUseMouse3rdPerson) stickY = 0.0f; diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index cafd4a36..89ba43d9 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -1424,7 +1424,12 @@ CAutomobile::ProcessControl(void) if (GetModelIndex() == MI_RCRAIDER || GetModelIndex() == MI_RCGOBLIN) FlyingControl(FLIGHT_MODEL_RCHELI); else if (m_nWheelsOnGround < 4 && !(GetModelIndex() == MI_SEASPAR && bTouchingWater) || - CPad::GetPad(0)->GetAccelerate() != 0 || CPad::GetPad(0)->GetCarGunUpDown() > 1.0f || + CPad::GetPad(0)->GetAccelerate() != 0 || +#ifndef FREE_CAM + CPad::GetPad(0)->GetCarGunUpDown() > 1.0f || +#else + ((!CCamera::bFreeCam || (CCamera::bFreeCam && !CPad::IsAffectedByController)) && CPad::GetPad(0)->GetCarGunUpDown() > 1.0f) || +#endif Abs(m_vecMoveSpeed.x) > 0.02f || Abs(m_vecMoveSpeed.y) > 0.02f || Abs(m_vecMoveSpeed.z) > 0.02f) diff --git a/src/vehicles/Bike.cpp b/src/vehicles/Bike.cpp index 17d8592e..d588e777 100644 --- a/src/vehicles/Bike.cpp +++ b/src/vehicles/Bike.cpp @@ -1844,7 +1844,12 @@ CBike::ProcessControlInputs(uint8 pad) m_fSteerInput = clamp(m_fSteerInput, -1.0f, 1.0f); // Lean forward/backward - float updown = -CPad::GetPad(pad)->GetSteeringUpDown()/128.0f + CPad::GetPad(pad)->GetCarGunUpDown()/128.0f; + float updown; +#ifdef FREE_CAM + if (CCamera::bFreeCam) updown = CPad::IsAffectedByController ? -CPad::GetPad(pad)->GetSteeringUpDown()/128.0f : CPad::GetPad(pad)->GetCarGunUpDown()/128.0f; + else +#endif + updown = -CPad::GetPad(pad)->GetSteeringUpDown()/128.0f + CPad::GetPad(pad)->GetCarGunUpDown()/128.0f; m_fLeanInput += (updown - m_fLeanInput)*0.2f*CTimer::GetTimeStep(); m_fLeanInput = clamp(m_fLeanInput, -1.0f, 1.0f); diff --git a/src/vehicles/Boat.cpp b/src/vehicles/Boat.cpp index 8dec0f89..0e978570 100644 --- a/src/vehicles/Boat.cpp +++ b/src/vehicles/Boat.cpp @@ -964,7 +964,14 @@ CBoat::PreRender(void) // FIX: Planes can also be controlled with GetCarGunUpDown #ifdef FIX_BUGS static float steeringUpDown = 0.0f; - steeringUpDown += ((Abs(CPad::GetPad(0)->GetCarGunUpDown()) > 1.0f ? (-CPad::GetPad(0)->GetCarGunUpDown() / 128.0f) : (-CPad::GetPad(0)->GetSteeringUpDown() / 128.0f)) - steeringUpDown) * Min(1.f, CTimer::GetTimeStep() / 5.f); +#ifdef FREE_CAM + if(!CCamera::bFreeCam || (CCamera::bFreeCam && !CPad::IsAffectedByController)) +#endif + steeringUpDown += ((Abs(CPad::GetPad(0)->GetCarGunUpDown()) > 1.0f ? (-CPad::GetPad(0)->GetCarGunUpDown()/128.0f) : (-CPad::GetPad(0)->GetSteeringUpDown()/128.0f)) - steeringUpDown) * Min(1.f, CTimer::GetTimeStep()/5.f); +#ifdef FREE_CAM + else + steeringUpDown = -CPad::GetPad(0)->GetSteeringUpDown()/128.0f; +#endif #else float steeringUpDown = -CPad::GetPad(0)->GetSteeringUpDown()/128.0f; #endif diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp index 5fb5a5d4..a464c128 100644 --- a/src/vehicles/Vehicle.cpp +++ b/src/vehicles/Vehicle.cpp @@ -334,6 +334,9 @@ CVehicle::FlyingControl(eFlightModel flightModel) float fSteerLR = CPad::GetPad(0)->GetSteeringLeftRight() / 128.0f; float fSteerUD = -CPad::GetPad(0)->GetSteeringUpDown() / 128.0f; float fGunUD = Abs(CPad::GetPad(0)->GetCarGunUpDown()); +#ifdef FREE_CAM + if(!CCamera::bFreeCam || (CCamera::bFreeCam && !CPad::IsAffectedByController)) +#endif if(fGunUD > 1.0f) fSteerUD = -CPad::GetPad(0)->GetCarGunUpDown() / 128.0f; @@ -507,9 +510,15 @@ CVehicle::FlyingControl(eFlightModel flightModel) fYaw = CPad::GetPad(0)->GetLookRight(); if (CPad::GetPad(0)->GetLookLeft()) fYaw = -1.0f; +#ifdef FREE_CAM + if (!CCamera::bFreeCam || (CCamera::bFreeCam && !CPad::IsAffectedByController)) +#endif if(Abs(CPad::GetPad(0)->GetCarGunLeftRight()) > 1.0f) fYaw = CPad::GetPad(0)->GetCarGunLeftRight() / 128.0f; } +#ifdef FREE_CAM + if(!CCamera::bFreeCam || (CCamera::bFreeCam && !CPad::IsAffectedByController)) +#endif if(Abs(CPad::GetPad(0)->GetCarGunUpDown()) > 1.0f) fPitch = -CPad::GetPad(0)->GetCarGunUpDown() / 128.0f; if (CPad::GetPad(0)->GetHorn()) { From 20dabf0b490c79362a5a8d11aadf8bda691c72cc Mon Sep 17 00:00:00 2001 From: withmorten Date: Mon, 18 Jan 2021 17:30:18 +0100 Subject: [PATCH 5/6] fix --- src/core/Cam.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index ed82b68e..70d7c899 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -5069,9 +5069,6 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation, else if (CPad::bInvertLook4Pad) stickY = -stickY; - if (CCamera::m_bUseMouse3rdPerson) - stickY = 0.0f; - float xMovement = Abs(stickX) * (FOV / 80.0f * 5.f / 70.f) * stickX * 0.007f * 0.007f; float yMovement = Abs(stickY) * (FOV / 80.0f * 3.f / 70.f) * stickY * 0.007f * 0.007f; From d01deec11dfd6efb7ffaea1ea5e8d50a2d779171 Mon Sep 17 00:00:00 2001 From: aap Date: Mon, 18 Jan 2021 20:03:30 +0100 Subject: [PATCH 6/6] wrong ifdef --- src/extras/custompipes.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/extras/custompipes.h b/src/extras/custompipes.h index 183b85da..7ad239f0 100644 --- a/src/extras/custompipes.h +++ b/src/extras/custompipes.h @@ -1,7 +1,7 @@ #pragma once -#ifdef EXTENDED_PIPELINES #ifdef LIBRW +#ifdef EXTENDED_PIPELINES namespace CustomPipes {