Skip to content

Commit

Permalink
Merge branch 'rc' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
Doxoh committed Aug 17, 2024
2 parents 10fd480 + 8c85aa6 commit 69f6249
Show file tree
Hide file tree
Showing 9 changed files with 109 additions and 49 deletions.
20 changes: 18 additions & 2 deletions c-api/cache/CachedVehicle.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -405,7 +407,7 @@ namespace cache
return _wheelsCount;
}

uint8_t _steeringAngle;
float _steeringAngle;
float GetSteeringAngle() const override
{
return _steeringAngle;
Expand Down Expand Up @@ -950,9 +952,23 @@ namespace cache
{
return _suspensionHeight;
}
void SetSuspensionHeight(float value) override {}

void SetSuspensionHeight(float value) override {}
void SetSteeringAngle(float value) override {}

std::vector<bool> _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<bool> _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 {}
#endif

};
Expand Down
4 changes: 2 additions & 2 deletions c-api/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<alt::common::Order>(order));
if (entitiesArray.size() < size) {
size = entitiesArray.size();
}
Expand Down
2 changes: 1 addition & 1 deletion c-api/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
41 changes: 33 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,31 @@ void Vehicle_Handling_SetDamageFlags(alt::IVehicle* vehicle, uint32_t value) {
vehicle->GetHandling()->SetDamageFlags(value);
}

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()
19 changes: 14 additions & 5 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,11 @@ 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_SERVER void Vehicle_SetBadge(alt::IVehicle* vehicle, uint32_t textureDictionary, uint32_t texture, vehicleBadgePosition_t vehicleBadgePosition[], uint16_t size);
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);

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);
Loading

0 comments on commit 69f6249

Please sign in to comment.