Skip to content

Commit

Permalink
ALTV-278 replace depreacted methods with new one
Browse files Browse the repository at this point in the history
  • Loading branch information
Doxoh committed Aug 4, 2024
1 parent e645766 commit 8746375
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 41 deletions.
21 changes: 13 additions & 8 deletions c-api/entities/vehicle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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()
12 changes: 8 additions & 4 deletions c-api/entities/vehicle.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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);
36 changes: 19 additions & 17 deletions c-api/func_table.cpp
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -326,7 +326,6 @@ inline uint64_t capiHashes[] = {
14086618333811829142UL,
16585103183510407847UL,
15955613981878964089UL,
13640121750592766571UL,
6509087878150057559UL,
10256732486804859248UL,
15070448398404561078UL,
Expand All @@ -342,8 +341,8 @@ inline uint64_t capiHashes[] = {
5381538823265150070UL,
7829933718567089587UL,
5342300288616537851UL,
18121403421176376004UL,
14153061510559409341UL,
7459423795923006317UL,
496589732490112468UL,
6070053561112702062UL,
6962542370431861347UL,
Expand All @@ -353,6 +352,7 @@ inline uint64_t capiHashes[] = {
2032569468200694716UL,
3477491608161757695UL,
14911638129270116483UL,
14463284166403326540UL,
3910172163486028031UL,
16503753649195520827UL,
16471152888163436925UL,
Expand Down Expand Up @@ -392,7 +392,6 @@ inline uint64_t capiHashes[] = {
16356297962238647527UL,
4661719046437834322UL,
277249662807444034UL,
16866255586563037390UL,
9421920479908058850UL,
16105117954749420927UL,
10250999986359269437UL,
Expand All @@ -408,8 +407,8 @@ inline uint64_t capiHashes[] = {
10141919336511995253UL,
10480890064636847038UL,
13201673460408288262UL,
925439942119483315UL,
15611200483174743552UL,
3861610181173130504UL,
8781324928923140083UL,
7762839872036477605UL,
3536265886880805678UL,
Expand All @@ -418,6 +417,7 @@ inline uint64_t capiHashes[] = {
12390677840693118275UL,
10521816927365923002UL,
5271240803351310462UL,
14165419900408701011UL,
14304205891478132450UL,
16520694489329105190UL,
14495929787086383136UL,
Expand Down Expand Up @@ -673,7 +673,6 @@ inline uint64_t capiHashes[] = {
491499874893114118UL,
4686947598406478597UL,
10175809585401109345UL,
10078299693896381022UL,
2075764309745505478UL,
5876755422566029523UL,
16400280465546780439UL,
Expand All @@ -689,8 +688,8 @@ inline uint64_t capiHashes[] = {
4224890290177597729UL,
8794621706814880064UL,
10514767894163983614UL,
83103673221524187UL,
13091197092896554364UL,
17653040055654987534UL,
13123198670756185941UL,
15071042556745097419UL,
15712800079613684274UL,
Expand All @@ -700,6 +699,7 @@ inline uint64_t capiHashes[] = {
14207124342130964195UL,
7988604432980063790UL,
1869896813051298938UL,
6354378963990998257UL,
12245703430179167058UL,
6108107448568242326UL,
4933176887065087610UL,
Expand Down Expand Up @@ -739,7 +739,6 @@ inline uint64_t capiHashes[] = {
11893830950833771180UL,
7652662052385596845UL,
11922787843029535275UL,
18029758670461994365UL,
17130103214803834989UL,
2692497708077112726UL,
18369044924651600610UL,
Expand All @@ -755,8 +754,8 @@ inline uint64_t capiHashes[] = {
3715895871076668228UL,
14978721618745882503UL,
15668539880874518677UL,
7338164812375801966UL,
10019280768018311739UL,
1702635411438007893UL,
17302007799028099256UL,
12276253478525626262UL,
4597845088196659657UL,
Expand All @@ -765,6 +764,7 @@ inline uint64_t capiHashes[] = {
18270808580206557790UL,
2325663906168656981UL,
4721735489012961441UL,
10827938811434492364UL,
1596211192320289009UL,
15366979755955923021UL,
8268986722826371337UL,
Expand Down Expand Up @@ -822,6 +822,7 @@ inline uint64_t capiHashes[] = {
2675407408828596847UL,
10816077278672307073UL,
18123777833957296121UL,
15515593616288926025UL,
10533830814607560700UL,
14037400183140364255UL,
3095801372631152772UL,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
16 changes: 8 additions & 8 deletions c-api/handling_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
8 changes: 4 additions & 4 deletions c-api/handling_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 8746375

Please sign in to comment.