diff --git a/c-api/cache/CachedEntity.h b/c-api/cache/CachedEntity.h index 2213e6a..a7195f8 100644 --- a/c-api/cache/CachedEntity.h +++ b/c-api/cache/CachedEntity.h @@ -21,7 +21,8 @@ namespace cache #ifdef ALT_SERVER_API _streamed(base->GetStreamed()), _collision(base->HasCollision()), - _timestamp(base->GetTimestamp()) + _timestamp(base->GetTimestamp()), + _streamingDistance(base->GetStreamingDistance()) #elif ALT_CLIENT_API _scriptId(base->GetScriptID()), _remoteId(base->GetRemoteID()), @@ -211,6 +212,13 @@ namespace cache return _timestamp; } + uint32_t _streamingDistance; + + uint32_t GetStreamingDistance() const override + { + return _streamingDistance; + } + void SetMultipleStreamSyncedMetaData(const std::unordered_map& values) override {} #endif diff --git a/c-api/core.cpp b/c-api/core.cpp index c7c7d19..08f713a 100644 --- a/c-api/core.cpp +++ b/c-api/core.cpp @@ -549,7 +549,7 @@ void Core_TriggerClientEventUnreliableForAll(alt::ICore* core, const char* ev, a core->TriggerClientEventUnreliableForAll(ev, mValues); } -alt::IVehicle* Core_CreateVehicle(alt::ICore* core, uint32_t model, position_t pos, rotation_t rot, uint32_t &id) { +alt::IVehicle* Core_CreateVehicle(alt::ICore* core, uint32_t model, position_t pos, rotation_t rot, uint32_t streamingDistance, uint32_t &id) { alt::Position position; position.x = pos.x; position.y = pos.y; @@ -558,14 +558,14 @@ alt::IVehicle* Core_CreateVehicle(alt::ICore* core, uint32_t model, position_t p rotation.roll = rot.roll; rotation.pitch = rot.pitch; rotation.yaw = rot.yaw; - auto vehicle = core->CreateVehicle(model, position, rotation); + auto vehicle = core->CreateVehicle(model, position, rotation, streamingDistance); if (vehicle != nullptr) { id = vehicle->GetID(); } return vehicle; } -alt::IPed* Core_CreatePed(alt::ICore* core, uint32_t model, position_t pos, rotation_t rot, uint32_t &id) +alt::IPed* Core_CreatePed(alt::ICore* core, uint32_t model, position_t pos, rotation_t rot, uint32_t streamingDistance, uint32_t &id) { alt::Position position; position.x = pos.x; @@ -577,7 +577,7 @@ alt::IPed* Core_CreatePed(alt::ICore* core, uint32_t model, position_t pos, rota rotation.pitch = rot.pitch; rotation.yaw = rot.yaw; - auto ped = core->CreatePed(model, position, rotation); + auto ped = core->CreatePed(model, position, rotation, streamingDistance); if (ped != nullptr) { id = ped->GetID(); } @@ -822,7 +822,7 @@ alt::IMarker* Core_CreateMarker(alt::ICore* core, alt::IPlayer* target, uint8_t } alt::IObject* Core_CreateObject(alt::ICore* core, uint32_t model, position_t position, rotation_t rotation, - uint8_t alpha, uint8_t textureVariation, uint16_t lodDistance, uint32_t& id) + uint8_t alpha, uint8_t textureVariation, uint16_t lodDistance, uint32_t streamingDistance, uint32_t& id) { alt::Position pos; pos.x = position.x; @@ -834,7 +834,7 @@ alt::IObject* Core_CreateObject(alt::ICore* core, uint32_t model, position_t pos rot.pitch = rotation.pitch; rot.yaw = rotation.yaw; - auto networkObject = core->CreateObject(model, pos, rot, alpha, textureVariation, lodDistance); + auto networkObject = core->CreateObject(model, pos, rot, alpha, textureVariation, lodDistance, streamingDistance); if (networkObject != nullptr) { id = networkObject->GetID(); } diff --git a/c-api/core.h b/c-api/core.h index 8758f34..5b365ac 100644 --- a/c-api/core.h +++ b/c-api/core.h @@ -87,8 +87,8 @@ EXPORT_SERVER void Core_TriggerClientEventUnreliable(alt::ICore* core, alt::IPla EXPORT_SERVER void Core_TriggerClientEventUnreliableForSome(alt::ICore* core, alt::IPlayer* targets[], int targetsSize, const char* ev, alt::MValueConst* args[], int argsSize); EXPORT_SERVER void Core_TriggerClientEventUnreliableForAll(alt::ICore* core, const char* ev, alt::MValueConst* args[], int size); -EXPORT_SERVER alt::IVehicle* Core_CreateVehicle(alt::ICore* core, uint32_t model, position_t pos, rotation_t rot, uint32_t &id); -EXPORT_SERVER alt::IPed* Core_CreatePed(alt::ICore* core, uint32_t model, position_t pos, rotation_t rot, uint32_t &id); +EXPORT_SERVER alt::IVehicle* Core_CreateVehicle(alt::ICore* core, uint32_t model, position_t pos, rotation_t rot, uint32_t streamingDistance, uint32_t &id); +EXPORT_SERVER alt::IPed* Core_CreatePed(alt::ICore* core, uint32_t model, position_t pos, rotation_t rot, uint32_t streamingDistance, uint32_t &id); #ifdef ALT_SERVER_API EXPORT_SERVER alt::ICheckpoint* Core_CreateCheckpoint(alt::ICore* core, uint8_t type, position_t pos, float radius, float height, rgba_t color, uint32_t streamingDistance, uint32_t &id); #endif @@ -347,7 +347,7 @@ EXPORT_CLIENT alt::IFont* Core_RegisterFont(alt::ICore* core, alt::IResource* re EXPORT_CLIENT uint8_t Core_IsFullScreen(alt::ICore* core); -EXPORT_SERVER alt::IObject* Core_CreateObject(alt::ICore* core, uint32_t model, position_t position, rotation_t rotation, uint8_t alpha, uint8_t textureVariation, uint16_t lodDistance, uint32_t& id); +EXPORT_SERVER alt::IObject* Core_CreateObject(alt::ICore* core, uint32_t model, position_t position, rotation_t rotation, uint8_t alpha, uint8_t textureVariation, uint16_t lodDistance, uint32_t streamingDistance, uint32_t& id); EXPORT_SERVER alt::Metric* Core_RegisterMetric(alt::ICore* core, const char* metricName, uint8_t type, const char* keys[], const char* values[], uint64_t size); EXPORT_SERVER void Core_UnregisterMetric(alt::ICore* core, alt::Metric* metric); diff --git a/c-api/entities/entity.cpp b/c-api/entities/entity.cpp index 7976e0e..6c8e4ea 100644 --- a/c-api/entities/entity.cpp +++ b/c-api/entities/entity.cpp @@ -140,6 +140,11 @@ void Entity_SetMultipleStreamSyncedMetaData(alt::IEntity* entity, const char* ke entity->SetMultipleStreamSyncedMetaData(data); } + +uint32_t Entity_GetStreamingDistance(alt::IEntity* entity) +{ + return entity->GetStreamingDistance(); +} #endif #ifdef ALT_CLIENT_API diff --git a/c-api/entities/entity.h b/c-api/entities/entity.h index 339c4a6..9c8b396 100644 --- a/c-api/entities/entity.h +++ b/c-api/entities/entity.h @@ -51,4 +51,6 @@ EXPORT_SERVER void Entity_Detach(alt::IEntity* entity); EXPORT_SERVER void Entity_SetMultipleStreamSyncedMetaData(alt::IEntity* entity, const char* keys[], alt::MValueConst* values[], uint64_t size); -EXPORT_SERVER uint32_t Entity_GetTimestamp(alt::IEntity* entity); \ No newline at end of file +EXPORT_SERVER uint32_t Entity_GetTimestamp(alt::IEntity* entity); + +EXPORT_SERVER uint32_t Entity_GetStreamingDistance(alt::IEntity* entity); \ No newline at end of file diff --git a/c-api/func_table.cpp b/c-api/func_table.cpp index 5e3158d..427a4c5 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 = 3798753127100614877UL; +inline uint64_t capiHash = 16969270403256639162UL; inline uint64_t capiHashes[] = { 0, #ifdef ALT_CLIENT_API @@ -1315,9 +1315,9 @@ inline uint64_t capiHashes[] = { 6946126881626778655UL, 3410920088129362997UL, 9200413248217250533UL, - 6986805276481094958UL, - 3289494476065537885UL, - 2859438702466150327UL, + 6778852446992337891UL, + 16295351054968805916UL, + 494948204560226296UL, 16510685691058823138UL, 7933678493039322900UL, 11272860948152964480UL, diff --git a/cpp-sdk b/cpp-sdk index 216cff1..36bb41d 160000 --- a/cpp-sdk +++ b/cpp-sdk @@ -1 +1 @@ -Subproject commit 216cff1fcc155d278a878106b520842ea653f292 +Subproject commit 36bb41d84627095c9394d4751b23914cc00be163