diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 63f1f2e1..9856a8aa 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -3582,9 +3582,9 @@ int8 CRunningScript::ProcessCommands100To199(int32 command) car->AutoPilot.m_nCruiseSpeed = *(float*)&ScriptParams[1]; if (missionRetryScriptIndex == 40 && car->GetModelIndex() == MI_CHEETAH) // Turismo car->AutoPilot.m_nCruiseSpeed = 8 * car->AutoPilot.m_nCruiseSpeed / 10; - car->AutoPilot.m_nCruiseSpeed = Min(car->AutoPilot.m_nCruiseSpeed, 60.0f * car->pHandling->Transmission.fMaxCruiseVelocity); + car->AutoPilot.m_nCruiseSpeed = Min(car->AutoPilot.m_nCruiseSpeed, 60.0f * car->pHandling->Transmission.fUnkMaxVelocity); #else - car->AutoPilot.m_nCruiseSpeed = Min(*(float*)&ScriptParams[1], 60.0f * car->pHandling->Transmission.fMaxCruiseVelocity); + car->AutoPilot.m_nCruiseSpeed = Min(*(float*)&ScriptParams[1], 60.0f * car->pHandling->Transmission.fUnkMaxVelocity); #endif return 0; } diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp index fd48ba97..7dc9aba0 100644 --- a/src/core/Pad.cpp +++ b/src/core/Pad.cpp @@ -1109,11 +1109,14 @@ void CPad::UpdatePads(void) bUpdate = false; if ( bUpdate ) + { GetPad(0)->Update(0); +#ifndef SQUEEZE_PERFORMANCE + GetPad(1)->Update(0); +#endif + } -#ifndef MASTER - GetPad(1)->Update(1); -#else +#if defined(MASTER) && !defined(XINPUT) GetPad(1)->NewState.Clear(); GetPad(1)->OldState.Clear(); #endif diff --git a/src/core/config.h b/src/core/config.h index 9f4ccd1f..fcfe980f 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -235,6 +235,7 @@ enum Config { #ifdef DEBUGMENU #define MISSION_SWITCHER // from debug menu #endif +//#define LOG_TO_FILE // Rendering/display //#define EXTRA_MODEL_FLAGS // from mobile to optimize rendering diff --git a/src/extras/ini_parser.hpp b/src/extras/ini_parser.hpp index 8e88bc29..99acf1ee 100644 --- a/src/extras/ini_parser.hpp +++ b/src/extras/ini_parser.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2015 Denilson das MercÊs Amorim + * Copyright (c) 2013-2015 Denilson das Mercęs Amorim * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/src/extras/screendroplets.cpp b/src/extras/screendroplets.cpp index ac3a17b2..6ea72f09 100644 --- a/src/extras/screendroplets.cpp +++ b/src/extras/screendroplets.cpp @@ -391,7 +391,7 @@ void ScreenDroplets::RegisterSplash(CParticleObject *pobj) { CVector dist = pobj->GetPosition() - ms_prevCamPos; - if(dist.MagnitudeSqr() < 50.0f){ // 20 originally + if(dist.MagnitudeSqr() < 20.0f){ ms_splashDuration = 14; ms_splashObject = pobj; } diff --git a/src/peds/PedAI.cpp b/src/peds/PedAI.cpp index cc27992c..a747c684 100644 --- a/src/peds/PedAI.cpp +++ b/src/peds/PedAI.cpp @@ -832,10 +832,10 @@ CPed::ProcessObjective(void) m_pMyVehicle->SetStatus(STATUS_PHYSICS); m_pMyVehicle->AutoPilot.m_nPrevRouteNode = 0; if (m_nPedType == PEDTYPE_COP) { - m_pMyVehicle->AutoPilot.m_nCruiseSpeed = (FindPlayerPed()->m_pWanted->m_nWantedLevel * 0.1f + 0.6f) * (GAME_SPEED_TO_CARAI_SPEED * m_pMyVehicle->pHandling->Transmission.fMaxCruiseVelocity); + m_pMyVehicle->AutoPilot.m_nCruiseSpeed = (FindPlayerPed()->m_pWanted->m_nWantedLevel * 0.1f + 0.6f) * (GAME_SPEED_TO_CARAI_SPEED * m_pMyVehicle->pHandling->Transmission.fUnkMaxVelocity); m_pMyVehicle->AutoPilot.m_nCarMission = CCarAI::FindPoliceCarMissionForWantedLevel(); } else { - m_pMyVehicle->AutoPilot.m_nCruiseSpeed = GAME_SPEED_TO_CARAI_SPEED * m_pMyVehicle->pHandling->Transmission.fMaxCruiseVelocity * 0.8f; + m_pMyVehicle->AutoPilot.m_nCruiseSpeed = GAME_SPEED_TO_CARAI_SPEED * m_pMyVehicle->pHandling->Transmission.fUnkMaxVelocity * 0.8f; m_pMyVehicle->AutoPilot.m_nCarMission = MISSION_RAMPLAYER_FARAWAY; } m_pMyVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_AVOID_CARS; @@ -4775,7 +4775,7 @@ CPed::RegisterThreatWithGangPeds(CEntity *attacker) if (nearVehDriver && nearVehDriver != this && nearVehDriver->m_nPedType == m_nPedType) { if (nearVeh->IsVehicleNormal() && nearVeh->IsCar()) { - nearVeh->AutoPilot.m_nCruiseSpeed = GAME_SPEED_TO_CARAI_SPEED * nearVeh->pHandling->Transmission.fMaxCruiseVelocity * 0.8f; + nearVeh->AutoPilot.m_nCruiseSpeed = GAME_SPEED_TO_CARAI_SPEED * nearVeh->pHandling->Transmission.fUnkMaxVelocity * 0.8f; nearVeh->AutoPilot.m_nCarMission = MISSION_RAMPLAYER_FARAWAY; nearVeh->SetStatus(STATUS_PHYSICS); nearVeh->AutoPilot.m_nTempAction = TEMPACT_NONE; diff --git a/src/render/WaterLevel.cpp b/src/render/WaterLevel.cpp index 7aa01f5a..a0c7ae31 100644 --- a/src/render/WaterLevel.cpp +++ b/src/render/WaterLevel.cpp @@ -37,7 +37,7 @@ bool CWaterLevel::WavesCalculatedThisFrame; RpAtomic *CWaterLevel::ms_pWavyAtomic; RpGeometry *CWaterLevel::apGeomArray[8]; int16 CWaterLevel::nGeomUsed; -//"Custom" Don't Render Water Toggle +//"Custom" Donīt Render Water Toggle bool gbDontRenderWater; //RwTexture *gpWaterTex; @@ -638,7 +638,7 @@ SectorRadius(float fSize) void CWaterLevel::RenderWater() { -//"Custom" Don't Render Water Toggle +//"Custom" Donīt Render Water Toggle #ifndef MASTER if (gbDontRenderWater) return; diff --git a/src/skel/glfw/glfw.cpp b/src/skel/glfw/glfw.cpp index 93bfde5a..99b1e380 100644 --- a/src/skel/glfw/glfw.cpp +++ b/src/skel/glfw/glfw.cpp @@ -1488,6 +1488,10 @@ WinMain(HINSTANCE instance, int main(int argc, char *argv[]) { +#endif +#ifdef LOG_TO_FILE + freopen("re3_log.txt", "w", stdout); + freopen("re3_errors.txt", "w", stderr); #endif RwV2d pos; RwInt32 i; diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index e66865da..79d3f6af 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -216,8 +216,6 @@ CAutomobile::SetModelIndex(uint32 id) CVector vecDAMAGE_ENGINE_POS_SMALL(-0.1f, -0.1f, 0.0f); CVector vecDAMAGE_ENGINE_POS_BIG(-0.5f, -0.3f, 0.0f); -#pragma optimize("", off) // that's what R* did - void CAutomobile::ProcessControl(void) { @@ -1216,8 +1214,6 @@ CAutomobile::ProcessControl(void) } } -#pragma optimize("", on) - void CAutomobile::Teleport(CVector pos) { diff --git a/src/vehicles/HandlingMgr.cpp b/src/vehicles/HandlingMgr.cpp index fde280e8..3ac6f057 100644 --- a/src/vehicles/HandlingMgr.cpp +++ b/src/vehicles/HandlingMgr.cpp @@ -143,7 +143,7 @@ cHandlingDataMgr::LoadHandlingData(void) case 11: handling->fTractionBias = strtod(word, nil); break; case 12: handling->Transmission.nNumberOfGears = atoi(word); break; case 13: handling->Transmission.fMaxVelocity = strtod(word, nil); break; - case 14: handling->Transmission.fEngineAcceleration = strtod(word, nil) * 0.4; break; + case 14: handling->Transmission.fEngineAcceleration = strtod(word, nil) * 0.4f; break; case 15: handling->Transmission.nDriveType = word[0]; break; case 16: handling->Transmission.nEngineType = word[0]; break; case 17: handling->fBrakeDeceleration = strtod(word, nil); break; @@ -202,27 +202,21 @@ cHandlingDataMgr::ConvertDataToGameUnits(tHandlingData *handling) handling->fInvMass = 1.0f/handling->fMass; handling->fBuoyancy = 100.0f/handling->nPercentSubmerged * GRAVITY*handling->fMass; - // Don't quite understand this. What seems to be going on is that - // we calculate a drag (air resistance) deceleration for a given velocity and - // find the intersection between that and the max engine acceleration. - // at that point the car cannot accelerate any further and we've found the max velocity. + // What the hell is going on here? + specificVolume = handling->Dimension.x*handling->Dimension.z*0.5f / handling->fMass; // ? a = 0.0f; b = 100.0f; velocity = handling->Transmission.fMaxVelocity; while(a < b && velocity > 0.0f){ velocity -= 0.01f; - // what's the 1/6? a = handling->Transmission.fEngineAcceleration/6.0f; - // no density or drag coefficient here... - float a_drag = 0.5f*SQR(velocity) * handling->Dimension.x*handling->Dimension.z / handling->fMass; - // can't make sense of this... maybe v - v/(drag + 1) ? but that doesn't make so much sense either - b = -velocity * (1.0f/(a_drag + 1.0f) - 1.0f); + b = -velocity * (1.0f/(specificVolume * sq(velocity) + 1.0f) - 1.0f); } if(handling->nIdentifier == HANDLING_RCBANDIT){ - handling->Transmission.fMaxCruiseVelocity = handling->Transmission.fMaxVelocity; + handling->Transmission.fUnkMaxVelocity = handling->Transmission.fMaxVelocity; }else{ - handling->Transmission.fMaxCruiseVelocity = velocity; + handling->Transmission.fUnkMaxVelocity = velocity; handling->Transmission.fMaxVelocity = velocity * 1.2f; } handling->Transmission.fMaxReverseVelocity = -0.2f; diff --git a/src/vehicles/Transmission.cpp b/src/vehicles/Transmission.cpp index 109847a5..5287055d 100644 --- a/src/vehicles/Transmission.cpp +++ b/src/vehicles/Transmission.cpp @@ -128,7 +128,7 @@ cTransmission::CalculateDriveAcceleration(const float &gasPedal, uint8 &gear, fl else fCheat = 1.0f; float targetVelocity = Gears[gear].fMaxVelocity*speedMul*fCheat; - float accel = (targetVelocity - fVelocity) * (fEngineAcceleration*accelMul) / Abs(targetVelocity); + float accel = fEngineAcceleration*accelMul * (targetVelocity - fVelocity)/Abs(targetVelocity); if(Abs(fVelocity) < Abs(Gears[gear].fMaxVelocity*fCheat)) fAcceleration = gasPedal * accel * CTimer::GetTimeStep(); else diff --git a/src/vehicles/Transmission.h b/src/vehicles/Transmission.h index a3d15513..8eeef1e8 100644 --- a/src/vehicles/Transmission.h +++ b/src/vehicles/Transmission.h @@ -18,7 +18,7 @@ public: uint8 Flags; float fEngineAcceleration; float fMaxVelocity; - float fMaxCruiseVelocity; + float fUnkMaxVelocity; float fMaxReverseVelocity; float fCurVelocity; diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp index 465d9a9e..ba9348f0 100644 --- a/src/vehicles/Vehicle.cpp +++ b/src/vehicles/Vehicle.cpp @@ -531,9 +531,9 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon if(!bBraking){ if(m_fGasPedal < 0.01f){ if(GetModelIndex() == MI_RCBANDIT) - brake = 0.2f * mod_HandlingManager.fWheelFriction / pHandling->fMass; + brake = 0.2f * mod_HandlingManager.fWheelFriction / m_fMass; else - brake = mod_HandlingManager.fWheelFriction / pHandling->fMass; + brake = mod_HandlingManager.fWheelFriction / m_fMass; #ifdef FIX_BUGS brake *= CTimer::GetTimeStepFix(); #endif @@ -659,7 +659,7 @@ CVehicle::InflictDamage(CEntity* damagedBy, eWeaponType weaponType, float damage if (m_randomSeed < DAMAGE_FLEE_IN_CAR_PROBABILITY_VALUE) { CCarCtrl::SwitchVehicleToRealPhysics(this); AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_AVOID_CARS; - AutoPilot.m_nCruiseSpeed = GAME_SPEED_TO_CARAI_SPEED * pHandling->Transmission.fMaxCruiseVelocity; + AutoPilot.m_nCruiseSpeed = GAME_SPEED_TO_CARAI_SPEED * pHandling->Transmission.fUnkMaxVelocity; SetStatus(STATUS_PHYSICS); } }