Fix issue with veh handling #85 & veh spawn

This commit is contained in:
Grinch_ 2023-01-06 21:16:42 +06:00
parent 7008df4e95
commit 12e5c206f1
3 changed files with 14 additions and 9 deletions

View File

@ -15,7 +15,8 @@ void FileHandler::GenerateHandlingFile(tHandlingData *pHandling, std::map<int, s
float tractionMultiplier = pHandling->m_fTractionMultiplier; float tractionMultiplier = pHandling->m_fTractionMultiplier;
float tractionLoss = pHandling->m_fTractionLoss; float tractionLoss = pHandling->m_fTractionLoss;
float tractionBias = pHandling->m_fTractionBias; float tractionBias = pHandling->m_fTractionBias;
float engineAcceleration = pHandling->m_transmissionData.m_fEngineAcceleration * 12500; float engineAcceleration = pHandling->m_transmissionData.m_fEngineAcceleration * 25000.0f;
engineAcceleration /= pHandling->m_transmissionData.m_nDriveType == 52 ? 4.0f : 2.0f;
float engineInertia = pHandling->m_transmissionData.m_fEngineInertia; float engineInertia = pHandling->m_transmissionData.m_fEngineInertia;
int driveType = pHandling->m_transmissionData.m_nDriveType; int driveType = pHandling->m_transmissionData.m_nDriveType;
int engineType = pHandling->m_transmissionData.m_nEngineType; int engineType = pHandling->m_transmissionData.m_nEngineType;

View File

@ -639,9 +639,11 @@ void VehCustmzrMgr::Draw()
Widget::EditRadioBtnAddr(TEXT("Vehicle.DriveType"), (int)&pHandlingData->m_transmissionData.m_nDriveType, drive_type); Widget::EditRadioBtnAddr(TEXT("Vehicle.DriveType"), (int)&pHandlingData->m_transmissionData.m_nDriveType, drive_type);
// Engine acceleration calculation // Engine acceleration calculation
float fEngineAcceleration = pHandlingData->m_transmissionData.m_fEngineAcceleration * 12500; float fEngineAcceleration = pHandlingData->m_transmissionData.m_fEngineAcceleration * 25000.0f;
Widget::EditAddr(TEXT("Vehicle.EngineAccel"), (int)&fEngineAcceleration, 0.0f, 0.0f, 49.0f, 12500.0f); fEngineAcceleration /= pHandlingData->m_transmissionData.m_nDriveType == 52 ? 4.0f : 2.0f;
pHandlingData->m_transmissionData.m_fEngineAcceleration = fEngineAcceleration / 12500; Widget::EditAddr(TEXT("Vehicle.EngineAccel"), (int)&fEngineAcceleration, 0.0f, 0.0f, 49.0f, 1.0f);
fEngineAcceleration *= pHandlingData->m_transmissionData.m_nDriveType == 52 ? 4.0f : 2.0f;
pHandlingData->m_transmissionData.m_fEngineAcceleration = fEngineAcceleration / 25000.0f;
Widget::EditAddr(TEXT("Vehicle.EngineInertia"), (int)&pHandlingData->m_transmissionData.m_fEngineInertia, 0.1f, 0.1f, 400.0f); Widget::EditAddr(TEXT("Vehicle.EngineInertia"), (int)&pHandlingData->m_transmissionData.m_fEngineInertia, 0.1f, 0.1f, 400.0f);
@ -664,7 +666,7 @@ void VehCustmzrMgr::Draw()
Widget::EditBits(TEXT("Vehicle.HandlingFlags"), (int)&pHandlingData->m_nHandlingFlags, m_HandlingFlagNames); Widget::EditBits(TEXT("Vehicle.HandlingFlags"), (int)&pHandlingData->m_nHandlingFlags, m_HandlingFlagNames);
Widget::EditAddr(TEXT("Vehicle.HighSpeedDamping"), (int)&pHandlingData->m_fSuspensionDampingLevel, -10.0f, -10.0f, 10.0f); // test later Widget::EditAddr(TEXT("Vehicle.HighSpeedDamping"), (int)&pHandlingData->m_fSuspensionDampingLevel, -10.0f, -10.0f, 10.0f); // test later
Widget::EditAddr(TEXT("Vehicle.LowerKimit"), (int)&pHandlingData->m_fSuspensionLowerLimit, -10.0f, -10.0f, 10.0f); // test later Widget::EditAddr(TEXT("Vehicle.LowerLimit"), (int)&pHandlingData->m_fSuspensionLowerLimit, -10.0f, -10.0f, 10.0f); // test later
Widget::EditAddr(TEXT("Vehicle.Mass"), (int)&pHandlingData->m_fMass, 1.0f, 1.0f, 50000.0f); Widget::EditAddr(TEXT("Vehicle.Mass"), (int)&pHandlingData->m_fMass, 1.0f, 1.0f, 50000.0f);
// Max Velocity calculation // Max Velocity calculation

View File

@ -9,6 +9,7 @@
#include "custom/filehandler.h" #include "custom/filehandler.h"
#include "custom/vehcustmzr.h" #include "custom/vehcustmzr.h"
#include "custom/autodrive.h" #include "custom/autodrive.h"
#include <CMatrix.h>
VehiclePage& vehiclePage = VehiclePage::Get(); VehiclePage& vehiclePage = VehiclePage::Get();
VehiclePage::VehiclePage() VehiclePage::VehiclePage()
@ -446,20 +447,21 @@ void VehiclePage::SpawnVehicle(std::string& rootkey, std::string& vehName, std::
float x,y,z; float x,y,z;
player->m_placement.GetOrientation(x, y, z); player->m_placement.GetOrientation(x, y, z);
veh->m_placement.SetOrientation(x, y, z); veh->m_placement.SetOrientation(x, y, z);
Command<Commands::WARP_CHAR_INTO_CAR>(hplayer, hveh);
#else #else
float x,y,z; float x,y,z;
player->GetOrientation(x, y, z); player->GetOrientation(x, y, z);
player->SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER);
player->WarpPedIntoCar(veh);
veh->SetOrientation(x, y, z); veh->SetOrientation(x, y, z);
#endif #endif
CWorld::Remove(player);
Command<Commands::WARP_CHAR_INTO_CAR>(hplayer, hveh);
CWorld::Add(player);
Util::SetCarForwardSpeed(veh, speed); Util::SetCarForwardSpeed(veh, speed);
} }
else else
{ {
player->TransformFromObjectSpace(pos); player->TransformFromObjectSpace(pos);
Command<Commands::CREATE_CAR>(imodel, pos.x, pos.y, pos.z + 3.0f, &hveh); Command<Commands::CREATE_CAR>(imodel, pos.x, pos.y, pos.z + 4.0f, &hveh);
veh = CPools::GetVehicle(hveh); veh = CPools::GetVehicle(hveh);
#ifdef GTAVC #ifdef GTAVC
float x,y,z; float x,y,z;