From 014d7998da77824c7e22010a750002864a8361e9 Mon Sep 17 00:00:00 2001 From: vadzz Date: Sun, 4 Aug 2024 16:00:52 +0300 Subject: [PATCH 1/5] feat(client): add new sdk methods to CachedVehicle --- c-api/cache/CachedVehicle.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/c-api/cache/CachedVehicle.h b/c-api/cache/CachedVehicle.h index 052a651..382911a 100644 --- a/c-api/cache/CachedVehicle.h +++ b/c-api/cache/CachedVehicle.h @@ -950,9 +950,16 @@ namespace cache { return _suspensionHeight; } - void SetSuspensionHeight(float value) override {} + void SetSuspensionHeight(float value) override {} void SetSteeringAngle(float value) override {} + + bool GetWheelDynamicFlag(uint8_t wheel, uint32_t flag) const override { return false; }; + void SetWheelDynamicFlag(uint8_t wheel, uint32_t flag, bool state) override {}; + bool GetWheelConfigFlag(uint8_t wheel, uint32_t flag) const override { return false; }; + void SetWheelConfigFlag(uint8_t wheel, uint32_t flag, bool state) override {}; + + void SetupTransmission() override {}; #endif }; From e645766616558ff9e34854c7148fed4baaccc7a6 Mon Sep 17 00:00:00 2001 From: doxoh Date: Sun, 4 Aug 2024 15:23:41 +0200 Subject: [PATCH 2/5] fix(client): update to sdk changes --- c-api/cache/CachedVehicle.h | 21 +++++++++++++++------ cpp-sdk | 2 +- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/c-api/cache/CachedVehicle.h b/c-api/cache/CachedVehicle.h index 382911a..6f39952 100644 --- a/c-api/cache/CachedVehicle.h +++ b/c-api/cache/CachedVehicle.h @@ -152,6 +152,8 @@ namespace cache _wheelTyreRadiuses[i] = base->GetWheelTyreRadius(i); _wheelTyreWidths[i] = base->GetWheelTyreWidth(i); _wheelSurfaceMaterials[i] = base->GetWheelSurfaceMaterial(i); + _wheelDynamicFlag[i] = base->GetWheelDynamicFlag(i, 0); + _wheelConfigFlag[i] = base->GetWheelConfigFlag(i, 0); #elif ALT_SERVER_API _wheelBurst[i] = base->IsWheelBurst(i); _wheelHasTire[i] = base->DoesWheelHasTire(i); @@ -405,7 +407,7 @@ namespace cache return _wheelsCount; } - uint8_t _steeringAngle; + float _steeringAngle; float GetSteeringAngle() const override { return _steeringAngle; @@ -954,12 +956,19 @@ namespace cache void SetSuspensionHeight(float value) override {} void SetSteeringAngle(float value) override {} - bool GetWheelDynamicFlag(uint8_t wheel, uint32_t flag) const override { return false; }; - void SetWheelDynamicFlag(uint8_t wheel, uint32_t flag, bool state) override {}; - bool GetWheelConfigFlag(uint8_t wheel, uint32_t flag) const override { return false; }; - void SetWheelConfigFlag(uint8_t wheel, uint32_t flag, bool state) override {}; + std::vector _wheelDynamicFlag; + bool GetWheelDynamicFlag(uint8_t wheel, uint32_t flag) const override { + return _wheelDynamicFlag.size() <= wheel ? 0 : _wheelDynamicFlag[wheel]; + } + void SetWheelDynamicFlag(uint8_t wheel, uint32_t flag, bool state) override {} + + std::vector _wheelConfigFlag; + bool GetWheelConfigFlag(uint8_t wheel, uint32_t flag) const override { + return _wheelConfigFlag.size() <= wheel ? 0 : _wheelConfigFlag[wheel]; + } + void SetWheelConfigFlag(uint8_t wheel, uint32_t flag, bool state) override {} - void SetupTransmission() override {}; + void SetupTransmission() override {} #endif }; diff --git a/cpp-sdk b/cpp-sdk index 22e1fdd..cb2ebe2 160000 --- a/cpp-sdk +++ b/cpp-sdk @@ -1 +1 @@ -Subproject commit 22e1fdd37b8e379d04b279161571276cb7bb12da +Subproject commit cb2ebe22c451d51f812c41a257710834c746981b From 8746375d36f9998066a73defbce5b4f2fb5cb76b Mon Sep 17 00:00:00 2001 From: doxoh Date: Sun, 4 Aug 2024 16:02:56 +0200 Subject: [PATCH 3/5] ALTV-278 replace depreacted methods with new one --- c-api/entities/vehicle.cpp | 21 +++++++++++++-------- c-api/entities/vehicle.h | 12 ++++++++---- c-api/func_table.cpp | 36 +++++++++++++++++++----------------- c-api/handling_data.cpp | 16 ++++++++-------- c-api/handling_data.h | 8 ++++---- 5 files changed, 52 insertions(+), 41 deletions(-) diff --git a/c-api/entities/vehicle.cpp b/c-api/entities/vehicle.cpp index 1fbc659..1d04f3f 100644 --- a/c-api/entities/vehicle.cpp +++ b/c-api/entities/vehicle.cpp @@ -1242,13 +1242,13 @@ void Vehicle_Handling_SetDriveBiasFront(alt::IVehicle* vehicle, float value) { vehicle->GetHandling()->SetDriveBiasFront(value); } -float Vehicle_Handling_GetAcceleration(alt::IVehicle* vehicle) { - return vehicle->GetHandling()->GetAcceleration(); +float Vehicle_Handling_GetDriveBiasRear(alt::IVehicle* vehicle) { + return vehicle->GetHandling()->GetDriveBiasRear(); } -void Vehicle_Handling_SetAcceleration(alt::IVehicle* vehicle, float value) { +void Vehicle_Handling_SetDriveBiasRear(alt::IVehicle* vehicle, float value) { vehicle->ReplaceHandling(); - vehicle->GetHandling()->SetAcceleration(value); + vehicle->GetHandling()->SetDriveBiasRear(value); } uint32_t Vehicle_Handling_GetInitialDriveGears(alt::IVehicle* vehicle) { @@ -1296,13 +1296,13 @@ void Vehicle_Handling_SetInitialDriveForce(alt::IVehicle* vehicle, float value) vehicle->GetHandling()->SetInitialDriveForce(value); } -float Vehicle_Handling_GetDriveMaxFlatVel(alt::IVehicle* vehicle) { - return vehicle->GetHandling()->GetDriveMaxFlatVel(); +float Vehicle_Handling_GetInitialDriveMaxVel(alt::IVehicle* vehicle) { + return vehicle->GetHandling()->GetInitialDriveMaxVel(); } -void Vehicle_Handling_SetDriveMaxFlatVel(alt::IVehicle* vehicle, float value) { +void Vehicle_Handling_SetInitialDriveMaxVel(alt::IVehicle* vehicle, float value) { vehicle->ReplaceHandling(); - vehicle->GetHandling()->SetDriveMaxFlatVel(value); + vehicle->GetHandling()->SetInitialDriveMaxVel(value); } float Vehicle_Handling_GetInitialDriveMaxFlatVel(alt::IVehicle* vehicle) { @@ -1737,6 +1737,11 @@ void Vehicle_Handling_SetDamageFlags(alt::IVehicle* vehicle, uint32_t value) { vehicle->GetHandling()->SetDamageFlags(value); } +void Vehicle_SetupTransmission(alt::IVehicle* vehicle) +{ + vehicle->SetupTransmission(); +} + #endif CAPI_END() \ No newline at end of file diff --git a/c-api/entities/vehicle.h b/c-api/entities/vehicle.h index 878ab1e..a7ec7f3 100644 --- a/c-api/entities/vehicle.h +++ b/c-api/entities/vehicle.h @@ -351,8 +351,8 @@ EXPORT_CLIENT float Vehicle_Handling_GetPercentSubmergedRatio(alt::IVehicle* veh EXPORT_CLIENT void Vehicle_Handling_SetPercentSubmergedRatio(alt::IVehicle* vehicle, float value); EXPORT_CLIENT float Vehicle_Handling_GetDriveBiasFront(alt::IVehicle* vehicle); EXPORT_CLIENT void Vehicle_Handling_SetDriveBiasFront(alt::IVehicle* vehicle, float value); -EXPORT_CLIENT float Vehicle_Handling_GetAcceleration(alt::IVehicle* vehicle); -EXPORT_CLIENT void Vehicle_Handling_SetAcceleration(alt::IVehicle* vehicle, float value); +EXPORT_CLIENT void Vehicle_Handling_SetDriveBiasRear(alt::IVehicle* vehicle, float value); +EXPORT_CLIENT float Vehicle_Handling_GetDriveBiasRear(alt::IVehicle* vehicle); EXPORT_CLIENT uint32_t Vehicle_Handling_GetInitialDriveGears(alt::IVehicle* vehicle); EXPORT_CLIENT void Vehicle_Handling_SetInitialDriveGears(alt::IVehicle* vehicle, uint32_t value); EXPORT_CLIENT float Vehicle_Handling_GetDriveInertia(alt::IVehicle* vehicle); @@ -363,8 +363,10 @@ EXPORT_CLIENT float Vehicle_Handling_GetClutchChangeRateScaleDownShift(alt::IVeh EXPORT_CLIENT void Vehicle_Handling_SetClutchChangeRateScaleDownShift(alt::IVehicle* vehicle, float value); EXPORT_CLIENT float Vehicle_Handling_GetInitialDriveForce(alt::IVehicle* vehicle); EXPORT_CLIENT void Vehicle_Handling_SetInitialDriveForce(alt::IVehicle* vehicle, float value); -EXPORT_CLIENT float Vehicle_Handling_GetDriveMaxFlatVel(alt::IVehicle* vehicle); -EXPORT_CLIENT void Vehicle_Handling_SetDriveMaxFlatVel(alt::IVehicle* vehicle, float value); + +EXPORT_CLIENT float Vehicle_Handling_GetInitialDriveMaxVel(alt::IVehicle* vehicle); +EXPORT_CLIENT void Vehicle_Handling_SetInitialDriveMaxVel(alt::IVehicle* vehicle, float value); + EXPORT_CLIENT float Vehicle_Handling_GetInitialDriveMaxFlatVel(alt::IVehicle* vehicle); EXPORT_CLIENT void Vehicle_Handling_SetInitialDriveMaxFlatVel(alt::IVehicle* vehicle, float value); EXPORT_CLIENT float Vehicle_Handling_GetBrakeForce(alt::IVehicle* vehicle); @@ -474,4 +476,6 @@ EXPORT_SERVER float Vehicle_GetBrakeLevel(alt::IVehicle* vehicle); EXPORT_CLIENT float Vehicle_GetSuspensionHeight(alt::IVehicle* vehicle); EXPORT_CLIENT void Vehicle_SetSuspensionHeight(alt::IVehicle* vehicle, float value); +EXPORT_CLIENT void Vehicle_SetupTransmission(alt::IVehicle* vehicle); + EXPORT_SERVER void Vehicle_SetBadge(alt::IVehicle* vehicle, uint32_t textureDictionary, uint32_t texture, vehicleBadgePosition_t vehicleBadgePosition[], uint16_t size); \ No newline at end of file diff --git a/c-api/func_table.cpp b/c-api/func_table.cpp index 71b34bb..d0414c4 100644 --- a/c-api/func_table.cpp +++ b/c-api/func_table.cpp @@ -1,6 +1,6 @@ #include "func_table.h" -inline uint64_t capiHash = 4464148992254491289UL; +inline uint64_t capiHash = 14417011119465511955UL; inline uint64_t capiHashes[] = { 0, #ifdef ALT_CLIENT_API @@ -326,7 +326,6 @@ inline uint64_t capiHashes[] = { 14086618333811829142UL, 16585103183510407847UL, 15955613981878964089UL, - 13640121750592766571UL, 6509087878150057559UL, 10256732486804859248UL, 15070448398404561078UL, @@ -342,8 +341,8 @@ inline uint64_t capiHashes[] = { 5381538823265150070UL, 7829933718567089587UL, 5342300288616537851UL, + 18121403421176376004UL, 14153061510559409341UL, - 7459423795923006317UL, 496589732490112468UL, 6070053561112702062UL, 6962542370431861347UL, @@ -353,6 +352,7 @@ inline uint64_t capiHashes[] = { 2032569468200694716UL, 3477491608161757695UL, 14911638129270116483UL, + 14463284166403326540UL, 3910172163486028031UL, 16503753649195520827UL, 16471152888163436925UL, @@ -392,7 +392,6 @@ inline uint64_t capiHashes[] = { 16356297962238647527UL, 4661719046437834322UL, 277249662807444034UL, - 16866255586563037390UL, 9421920479908058850UL, 16105117954749420927UL, 10250999986359269437UL, @@ -408,8 +407,8 @@ inline uint64_t capiHashes[] = { 10141919336511995253UL, 10480890064636847038UL, 13201673460408288262UL, + 925439942119483315UL, 15611200483174743552UL, - 3861610181173130504UL, 8781324928923140083UL, 7762839872036477605UL, 3536265886880805678UL, @@ -418,6 +417,7 @@ inline uint64_t capiHashes[] = { 12390677840693118275UL, 10521816927365923002UL, 5271240803351310462UL, + 14165419900408701011UL, 14304205891478132450UL, 16520694489329105190UL, 14495929787086383136UL, @@ -673,7 +673,6 @@ inline uint64_t capiHashes[] = { 491499874893114118UL, 4686947598406478597UL, 10175809585401109345UL, - 10078299693896381022UL, 2075764309745505478UL, 5876755422566029523UL, 16400280465546780439UL, @@ -689,8 +688,8 @@ inline uint64_t capiHashes[] = { 4224890290177597729UL, 8794621706814880064UL, 10514767894163983614UL, + 83103673221524187UL, 13091197092896554364UL, - 17653040055654987534UL, 13123198670756185941UL, 15071042556745097419UL, 15712800079613684274UL, @@ -700,6 +699,7 @@ inline uint64_t capiHashes[] = { 14207124342130964195UL, 7988604432980063790UL, 1869896813051298938UL, + 6354378963990998257UL, 12245703430179167058UL, 6108107448568242326UL, 4933176887065087610UL, @@ -739,7 +739,6 @@ inline uint64_t capiHashes[] = { 11893830950833771180UL, 7652662052385596845UL, 11922787843029535275UL, - 18029758670461994365UL, 17130103214803834989UL, 2692497708077112726UL, 18369044924651600610UL, @@ -755,8 +754,8 @@ inline uint64_t capiHashes[] = { 3715895871076668228UL, 14978721618745882503UL, 15668539880874518677UL, + 7338164812375801966UL, 10019280768018311739UL, - 1702635411438007893UL, 17302007799028099256UL, 12276253478525626262UL, 4597845088196659657UL, @@ -765,6 +764,7 @@ inline uint64_t capiHashes[] = { 18270808580206557790UL, 2325663906168656981UL, 4721735489012961441UL, + 10827938811434492364UL, 1596211192320289009UL, 15366979755955923021UL, 8268986722826371337UL, @@ -822,6 +822,7 @@ inline uint64_t capiHashes[] = { 2675407408828596847UL, 10816077278672307073UL, 18123777833957296121UL, + 15515593616288926025UL, 10533830814607560700UL, 14037400183140364255UL, 3095801372631152772UL, @@ -2108,7 +2109,6 @@ inline void* capiPointers[] = { (void*) FreeRmlElementArray, (void*) GetCachedAssembly, (void*) GetNativeFuncTable, - (void*) Handling_GetAcceleration, (void*) Handling_GetAntiRollBarBiasFront, (void*) Handling_GetAntiRollBarBiasRear, (void*) Handling_GetAntiRollBarForce, @@ -2124,8 +2124,8 @@ inline void* capiPointers[] = { (void*) Handling_GetDeformationDamageMult, (void*) Handling_GetDownforceModifier, (void*) Handling_GetDriveBiasFront, + (void*) Handling_GetDriveBiasRear, (void*) Handling_GetDriveInertia, - (void*) Handling_GetDriveMaxFlatVel, (void*) Handling_GetEngineDamageMult, (void*) Handling_GetHandBrakeForce, (void*) Handling_GetHandlingFlags, @@ -2135,6 +2135,7 @@ inline void* capiPointers[] = { (void*) Handling_GetInitialDriveForce, (void*) Handling_GetInitialDriveGears, (void*) Handling_GetInitialDriveMaxFlatVel, + (void*) Handling_GetInitialDriveMaxVel, (void*) Handling_GetLowSpeedTractionLossMult, (void*) Handling_GetMass, (void*) Handling_GetModelFlags, @@ -2174,7 +2175,6 @@ inline void* capiPointers[] = { (void*) Handling_GetunkFloat4, (void*) Handling_GetunkFloat5, (void*) Handling_GetWeaponDamageMult, - (void*) Handling_SetAcceleration, (void*) Handling_SetAntiRollBarBiasFront, (void*) Handling_SetAntiRollBarBiasRear, (void*) Handling_SetAntiRollBarForce, @@ -2190,8 +2190,8 @@ inline void* capiPointers[] = { (void*) Handling_SetDeformationDamageMult, (void*) Handling_SetDownforceModifier, (void*) Handling_SetDriveBiasFront, + (void*) Handling_SetDriveBiasRear, (void*) Handling_SetDriveInertia, - (void*) Handling_SetDriveMaxFlatVel, (void*) Handling_SetEngineDamageMult, (void*) Handling_SetHandBrakeForce, (void*) Handling_SetHandlingFlags, @@ -2200,6 +2200,7 @@ inline void* capiPointers[] = { (void*) Handling_SetInitialDriveForce, (void*) Handling_SetInitialDriveGears, (void*) Handling_SetInitialDriveMaxFlatVel, + (void*) Handling_SetInitialDriveMaxVel, (void*) Handling_SetLowSpeedTractionLossMult, (void*) Handling_SetMass, (void*) Handling_SetModelFlags, @@ -2455,7 +2456,6 @@ inline void* capiPointers[] = { (void*) Vehicle_GetWheelTrackWidth, (void*) Vehicle_GetWheelTyreRadius, (void*) Vehicle_GetWheelTyreWidth, - (void*) Vehicle_Handling_GetAcceleration, (void*) Vehicle_Handling_GetAntiRollBarBiasFront, (void*) Vehicle_Handling_GetAntiRollBarBiasRear, (void*) Vehicle_Handling_GetAntiRollBarForce, @@ -2471,8 +2471,8 @@ inline void* capiPointers[] = { (void*) Vehicle_Handling_GetDeformationDamageMult, (void*) Vehicle_Handling_GetDownforceModifier, (void*) Vehicle_Handling_GetDriveBiasFront, + (void*) Vehicle_Handling_GetDriveBiasRear, (void*) Vehicle_Handling_GetDriveInertia, - (void*) Vehicle_Handling_GetDriveMaxFlatVel, (void*) Vehicle_Handling_GetEngineDamageMult, (void*) Vehicle_Handling_GetHandBrakeForce, (void*) Vehicle_Handling_GetHandlingFlags, @@ -2482,6 +2482,7 @@ inline void* capiPointers[] = { (void*) Vehicle_Handling_GetInitialDriveForce, (void*) Vehicle_Handling_GetInitialDriveGears, (void*) Vehicle_Handling_GetInitialDriveMaxFlatVel, + (void*) Vehicle_Handling_GetInitialDriveMaxVel, (void*) Vehicle_Handling_GetLowSpeedTractionLossMult, (void*) Vehicle_Handling_GetMass, (void*) Vehicle_Handling_GetModelFlags, @@ -2521,7 +2522,6 @@ inline void* capiPointers[] = { (void*) Vehicle_Handling_GetunkFloat4, (void*) Vehicle_Handling_GetunkFloat5, (void*) Vehicle_Handling_GetWeaponDamageMult, - (void*) Vehicle_Handling_SetAcceleration, (void*) Vehicle_Handling_SetAntiRollBarBiasFront, (void*) Vehicle_Handling_SetAntiRollBarBiasRear, (void*) Vehicle_Handling_SetAntiRollBarForce, @@ -2537,8 +2537,8 @@ inline void* capiPointers[] = { (void*) Vehicle_Handling_SetDeformationDamageMult, (void*) Vehicle_Handling_SetDownforceModifier, (void*) Vehicle_Handling_SetDriveBiasFront, + (void*) Vehicle_Handling_SetDriveBiasRear, (void*) Vehicle_Handling_SetDriveInertia, - (void*) Vehicle_Handling_SetDriveMaxFlatVel, (void*) Vehicle_Handling_SetEngineDamageMult, (void*) Vehicle_Handling_SetHandBrakeForce, (void*) Vehicle_Handling_SetHandlingFlags, @@ -2547,6 +2547,7 @@ inline void* capiPointers[] = { (void*) Vehicle_Handling_SetInitialDriveForce, (void*) Vehicle_Handling_SetInitialDriveGears, (void*) Vehicle_Handling_SetInitialDriveMaxFlatVel, + (void*) Vehicle_Handling_SetInitialDriveMaxVel, (void*) Vehicle_Handling_SetLowSpeedTractionLossMult, (void*) Vehicle_Handling_SetMass, (void*) Vehicle_Handling_SetModelFlags, @@ -2604,6 +2605,7 @@ inline void* capiPointers[] = { (void*) Vehicle_SetPetrolLightState, (void*) Vehicle_SetSteeringAngle, (void*) Vehicle_SetSuspensionHeight, + (void*) Vehicle_SetupTransmission, (void*) Vehicle_SetWheelCamber, (void*) Vehicle_SetWheelHeight, (void*) Vehicle_SetWheelRimRadius, diff --git a/c-api/handling_data.cpp b/c-api/handling_data.cpp index 02e6fac..fe9c7c8 100644 --- a/c-api/handling_data.cpp +++ b/c-api/handling_data.cpp @@ -116,14 +116,14 @@ void Handling_SetDriveBiasFront(uint32_t modelHash, float value) { handling->SetDriveBiasFront(value); } -float Handling_GetAcceleration(uint32_t modelHash) { +float Handling_GetDriveBiasRear(uint32_t modelHash) { auto handling = alt::ICore::Instance().GetHandlingData(modelHash); - return handling->GetAcceleration(); + return handling->GetDriveBiasRear(); } -void Handling_SetAcceleration(uint32_t modelHash, float value) { +void Handling_SetDriveBiasRear(uint32_t modelHash, float value) { auto handling = alt::ICore::Instance().GetHandlingData(modelHash); - handling->SetAcceleration(value); + handling->SetDriveBiasRear(value); } uint32_t Handling_GetInitialDriveGears(uint32_t modelHash) { @@ -176,14 +176,14 @@ void Handling_SetInitialDriveForce(uint32_t modelHash, float value) { handling->SetInitialDriveForce(value); } -float Handling_GetDriveMaxFlatVel(uint32_t modelHash) { +float Handling_GetInitialDriveMaxVel(uint32_t modelHash) { auto handling = alt::ICore::Instance().GetHandlingData(modelHash); - return handling->GetDriveMaxFlatVel(); + return handling->GetInitialDriveMaxVel(); } -void Handling_SetDriveMaxFlatVel(uint32_t modelHash, float value) { +void Handling_SetInitialDriveMaxVel(uint32_t modelHash, float value) { auto handling = alt::ICore::Instance().GetHandlingData(modelHash); - handling->SetDriveMaxFlatVel(value); + handling->SetInitialDriveMaxVel(value); } float Handling_GetInitialDriveMaxFlatVel(uint32_t modelHash) { diff --git a/c-api/handling_data.h b/c-api/handling_data.h index 53c22f8..31139cc 100644 --- a/c-api/handling_data.h +++ b/c-api/handling_data.h @@ -42,8 +42,8 @@ EXPORT_CLIENT float Handling_GetPercentSubmergedRatio(uint32_t modelHash); EXPORT_CLIENT void Handling_SetPercentSubmergedRatio(uint32_t modelHash, float value); EXPORT_CLIENT float Handling_GetDriveBiasFront(uint32_t modelHash); EXPORT_CLIENT void Handling_SetDriveBiasFront(uint32_t modelHash, float value); -EXPORT_CLIENT float Handling_GetAcceleration(uint32_t modelHash); -EXPORT_CLIENT void Handling_SetAcceleration(uint32_t modelHash, float value); +EXPORT_CLIENT float Handling_GetDriveBiasRear(uint32_t modelHash); +EXPORT_CLIENT void Handling_SetDriveBiasRear(uint32_t modelHash, float value); EXPORT_CLIENT uint32_t Handling_GetInitialDriveGears(uint32_t modelHash); EXPORT_CLIENT void Handling_SetInitialDriveGears(uint32_t modelHash, uint32_t value); EXPORT_CLIENT float Handling_GetDriveInertia(uint32_t modelHash); @@ -54,8 +54,8 @@ EXPORT_CLIENT float Handling_GetClutchChangeRateScaleDownShift(uint32_t modelHas EXPORT_CLIENT void Handling_SetClutchChangeRateScaleDownShift(uint32_t modelHash, float value); EXPORT_CLIENT float Handling_GetInitialDriveForce(uint32_t modelHash); EXPORT_CLIENT void Handling_SetInitialDriveForce(uint32_t modelHash, float value); -EXPORT_CLIENT float Handling_GetDriveMaxFlatVel(uint32_t modelHash); -EXPORT_CLIENT void Handling_SetDriveMaxFlatVel(uint32_t modelHash, float value); +EXPORT_CLIENT float Handling_GetInitialDriveMaxVel(uint32_t modelHash); +EXPORT_CLIENT void Handling_SetInitialDriveMaxVel(uint32_t modelHash, float value); EXPORT_CLIENT float Handling_GetInitialDriveMaxFlatVel(uint32_t modelHash); EXPORT_CLIENT void Handling_SetInitialDriveMaxFlatVel(uint32_t modelHash, float value); EXPORT_CLIENT float Handling_GetBrakeForce(uint32_t modelHash); From 14d72a68227b3ba522a5d35fd74663a625c17384 Mon Sep 17 00:00:00 2001 From: doxoh Date: Sun, 4 Aug 2024 16:05:54 +0200 Subject: [PATCH 4/5] ALTV-278 add new vehicle methods --- c-api/entities/vehicle.cpp | 20 ++++++++++++++++++++ c-api/entities/vehicle.h | 7 ++++++- c-api/func_table.cpp | 10 +++++++++- 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/c-api/entities/vehicle.cpp b/c-api/entities/vehicle.cpp index 1d04f3f..04dcc8f 100644 --- a/c-api/entities/vehicle.cpp +++ b/c-api/entities/vehicle.cpp @@ -1742,6 +1742,26 @@ void Vehicle_SetupTransmission(alt::IVehicle* vehicle) vehicle->SetupTransmission(); } +uint8_t Vehicle_GetWheelDynamicFlag(alt::IVehicle* vehicle, uint8_t wheelId, uint32_t flag) +{ + return vehicle->GetWheelDynamicFlag(wheelId, flag); +} + +void Vehicle_SetWheelDynamicFlag(alt::IVehicle* vehicle, uint8_t wheelId, uint32_t flag, uint8_t state) +{ + vehicle->SetWheelDynamicFlag(wheelId, flag, state); +} + +uint8_t Vehicle_GetWheelConfigFlag(alt::IVehicle* vehicle, uint8_t wheelId, uint32_t flag) +{ + return vehicle->GetWheelConfigFlag(wheelId, flag); +} + +void Vehicle_SetWheelConfigFlag(alt::IVehicle* vehicle, uint8_t wheelId, uint32_t flag, uint8_t state) +{ + vehicle->SetWheelConfigFlag(wheelId, flag, state); +} + #endif CAPI_END() \ No newline at end of file diff --git a/c-api/entities/vehicle.h b/c-api/entities/vehicle.h index a7ec7f3..a2a0bed 100644 --- a/c-api/entities/vehicle.h +++ b/c-api/entities/vehicle.h @@ -478,4 +478,9 @@ EXPORT_CLIENT void Vehicle_SetSuspensionHeight(alt::IVehicle* vehicle, float val EXPORT_CLIENT void Vehicle_SetupTransmission(alt::IVehicle* vehicle); -EXPORT_SERVER void Vehicle_SetBadge(alt::IVehicle* vehicle, uint32_t textureDictionary, uint32_t texture, vehicleBadgePosition_t vehicleBadgePosition[], uint16_t size); \ No newline at end of file +EXPORT_SERVER void Vehicle_SetBadge(alt::IVehicle* vehicle, uint32_t textureDictionary, uint32_t texture, vehicleBadgePosition_t vehicleBadgePosition[], uint16_t size); + +EXPORT_CLIENT uint8_t Vehicle_GetWheelDynamicFlag(alt::IVehicle* vehicle, uint8_t wheelId, uint32_t flag); +EXPORT_CLIENT void Vehicle_SetWheelDynamicFlag(alt::IVehicle* vehicle, uint8_t wheelId, uint32_t flag, uint8_t state); +EXPORT_CLIENT uint8_t Vehicle_GetWheelConfigFlag(alt::IVehicle* vehicle, uint8_t wheelId, uint32_t flag); +EXPORT_CLIENT void Vehicle_SetWheelConfigFlag(alt::IVehicle* vehicle, uint8_t wheelId, uint32_t flag, uint8_t state); diff --git a/c-api/func_table.cpp b/c-api/func_table.cpp index d0414c4..dd221f1 100644 --- a/c-api/func_table.cpp +++ b/c-api/func_table.cpp @@ -1,6 +1,6 @@ #include "func_table.h" -inline uint64_t capiHash = 14417011119465511955UL; +inline uint64_t capiHash = 8028889173226987673UL; inline uint64_t capiHashes[] = { 0, #ifdef ALT_CLIENT_API @@ -666,6 +666,8 @@ inline uint64_t capiHashes[] = { 9716002269308828916UL, 11483934154441286346UL, 13303370691287708161UL, + 5271385185182015743UL, + 883185529540149226UL, 1338791052731372072UL, 13382865868223894905UL, 13422594452494959622UL, @@ -824,6 +826,8 @@ inline uint64_t capiHashes[] = { 18123777833957296121UL, 15515593616288926025UL, 10533830814607560700UL, + 17284682775935975738UL, + 8015620088058696041UL, 14037400183140364255UL, 3095801372631152772UL, 2293924763385881861UL, @@ -2449,6 +2453,8 @@ inline void* capiPointers[] = { (void*) Vehicle_GetSpeedVector, (void*) Vehicle_GetSuspensionHeight, (void*) Vehicle_GetWheelCamber, + (void*) Vehicle_GetWheelConfigFlag, + (void*) Vehicle_GetWheelDynamicFlag, (void*) Vehicle_GetWheelHeight, (void*) Vehicle_GetWheelRimRadius, (void*) Vehicle_GetWheelSpeed, @@ -2607,6 +2613,8 @@ inline void* capiPointers[] = { (void*) Vehicle_SetSuspensionHeight, (void*) Vehicle_SetupTransmission, (void*) Vehicle_SetWheelCamber, + (void*) Vehicle_SetWheelConfigFlag, + (void*) Vehicle_SetWheelDynamicFlag, (void*) Vehicle_SetWheelHeight, (void*) Vehicle_SetWheelRimRadius, (void*) Vehicle_SetWheelTrackWidth, From 5b7f47874e432b25a8f5167faf7fd2ba4ee8e4ef Mon Sep 17 00:00:00 2001 From: doxoh Date: Thu, 8 Aug 2024 13:03:53 +0200 Subject: [PATCH 5/5] update latest sdk changes --- c-api/core.cpp | 4 ++-- c-api/core.h | 2 +- c-api/func_table.cpp | 4 ++-- cpp-sdk | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/c-api/core.cpp b/c-api/core.cpp index 50b9030..71de297 100644 --- a/c-api/core.cpp +++ b/c-api/core.cpp @@ -818,13 +818,13 @@ void Core_GetEntitiesInRange(alt::ICore* core, vector3_t position, int32_t range entities = entityArr; } -void Core_GetClosestEntities(alt::ICore* core, vector3_t position, int32_t range, int32_t dimension, int32_t limit, uint64_t allowedTypes, void**& entities, uint8_t types[], uint64_t size) { +void Core_GetClosestEntities(alt::ICore* core, vector3_t position, int32_t range, int32_t dimension, int32_t limit, uint64_t allowedTypes, uint8_t order, void**& entities, uint8_t types[], uint64_t size) { alt::Position pos; pos.x = position.x; pos.y = position.y; pos.z = position.z; - auto entitiesArray = core->GetClosestEntities(pos, range, dimension, limit, allowedTypes); + auto entitiesArray = core->GetClosestEntities(pos, range, dimension, limit, allowedTypes, static_cast(order)); if (entitiesArray.size() < size) { size = entitiesArray.size(); } diff --git a/c-api/core.h b/c-api/core.h index f2bc101..60f63b2 100644 --- a/c-api/core.h +++ b/c-api/core.h @@ -138,7 +138,7 @@ EXPORT_SERVER uint64_t Core_GetEntitiesInRangeCount(alt::ICore* core, vector3_t EXPORT_SERVER uint64_t Core_GetClosestEntitiesCount(alt::ICore* core, vector3_t position, int32_t range, int32_t dimension, int32_t limit, uint64_t allowedTypes); EXPORT_SERVER void Core_GetEntitiesInDimension(alt::ICore* core, int32_t dimension, uint64_t allowedTypes, void**& entities, uint8_t types[], uint64_t size); EXPORT_SERVER void Core_GetEntitiesInRange(alt::ICore* core, vector3_t position, int32_t range, int32_t dimension, uint64_t allowedTypes, void**& entities, uint8_t types[], uint64_t size); -EXPORT_SERVER void Core_GetClosestEntities(alt::ICore* core, vector3_t position, int32_t range, int32_t dimension, int32_t limit, uint64_t allowedTypes, void**& entities, uint8_t types[], uint64_t size); +EXPORT_SERVER void Core_GetClosestEntities(alt::ICore* core, vector3_t position, int32_t range, int32_t dimension, int32_t limit, uint64_t allowedTypes, uint8_t order, void**& entities, uint8_t types[], uint64_t size); #ifdef ALT_CLIENT_API EXPORT_CLIENT uint8_t Core_Client_FileExists(alt::ICore* core, alt::IResource* resource, const char* path); diff --git a/c-api/func_table.cpp b/c-api/func_table.cpp index dd221f1..4d77544 100644 --- a/c-api/func_table.cpp +++ b/c-api/func_table.cpp @@ -1,6 +1,6 @@ #include "func_table.h" -inline uint64_t capiHash = 8028889173226987673UL; +inline uint64_t capiHash = 11629663074568386340UL; inline uint64_t capiHashes[] = { 0, #ifdef ALT_CLIENT_API @@ -1367,7 +1367,7 @@ inline uint64_t capiHashes[] = { 16312284234900575747UL, 14452794280175707515UL, 10333270135403224879UL, - 12057843286905322939UL, + 3102729611893259067UL, 419502286495548608UL, 12193205314801108926UL, 13972691773502904173UL, diff --git a/cpp-sdk b/cpp-sdk index cb2ebe2..b1ced94 160000 --- a/cpp-sdk +++ b/cpp-sdk @@ -1 +1 @@ -Subproject commit cb2ebe22c451d51f812c41a257710834c746981b +Subproject commit b1ced94027a7b3c0c2167b12e45da80b49c8527b