From b269517e6fa943cb30ed31c7fff268599eb27c8d Mon Sep 17 00:00:00 2001 From: Sandu Liviu Catalin Date: Fri, 20 Mar 2020 20:37:17 +0200 Subject: [PATCH] Candidate for backwards compatibility. --- include/vcmp.h | 93 +--- include/vcmp.new.h | 1042 +++++++++++++++++++++++++++++++++++++ source/Core.hpp | 25 +- source/Core/Events.inc | 6 +- source/Core/Inst.inc | 24 + source/Core/Utils.inc | 8 + source/Entity/Player.cpp | 24 +- source/Entity/Player.hpp | 16 +- source/Entity/Vehicle.cpp | 6 +- source/Entity/Vehicle.hpp | 4 +- source/Main.cpp | 5 +- source/Misc/Constants.cpp | 25 +- source/Misc/Functions.cpp | 4 +- source/Misc/Functions.hpp | 4 +- source/Misc/Register.cpp | 5 +- source/SqBase.hpp | 7 + 16 files changed, 1181 insertions(+), 117 deletions(-) create mode 100644 include/vcmp.new.h diff --git a/include/vcmp.h b/include/vcmp.h index c695d8f9..8a9e99df 100644 --- a/include/vcmp.h +++ b/include/vcmp.h @@ -2,7 +2,7 @@ Project: Vice City Multiplayer 0.4 Server / Plugin Kit File: plugin.h - Copyright 2011-2019 Ago Allikmaa (maxorator) + Copyright 2011-2016 Ago Allikmaa (maxorator) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -31,7 +31,7 @@ typedef struct { } ServerSettings; #define PLUGIN_API_MAJOR 2 -#define PLUGIN_API_MINOR 1 +#define PLUGIN_API_MINOR 0 typedef struct { uint32_t structSize; @@ -60,8 +60,6 @@ typedef enum { vcmpEntityPoolObject = 2, vcmpEntityPoolPickup = 3, vcmpEntityPoolRadio = 4, - vcmpEntityPoolPlayer = 5, - vcmpEntityReserved1 = 6, vcmpEntityPoolBlip = 7, vcmpEntityPoolCheckPoint = 8, forceSizeVcmpEntityPool = INT32_MAX @@ -103,7 +101,7 @@ typedef enum { typedef enum { vcmpPlayerUpdateNormal = 0, - vcmpPlayerUpdateAimingDeprecated = 1, + vcmpPlayerUpdateAiming = 1, vcmpPlayerUpdateDriver = 2, vcmpPlayerUpdatePassenger = 3, forceSizeVcmpPlayerUpdate = INT32_MAX @@ -158,7 +156,6 @@ typedef enum { vcmpServerOptionWallGlitch = 19, vcmpServerOptionDisableBackfaceCulling = 20, vcmpServerOptionDisableHeliBladeDamage = 21, - vcmpServerOptionDisableCrouch = 22, forceSizeVcmpServerOption = INT32_MAX } vcmpServerOption; @@ -172,8 +169,7 @@ typedef enum { vcmpPlayerOptionCanAttack = 6, vcmpPlayerOptionHasMarker = 7, vcmpPlayerOptionChatTagsEnabled = 8, - vcmpPlayerOptionDrunkEffectsDeprecated = 9, - vcmpPlayerOptionBleeding = 10, + vcmpPlayerOptionDrunkEffects = 9, forceSizeVcmpPlayerOption = INT32_MAX } vcmpPlayerOption; @@ -185,9 +181,6 @@ typedef enum { vcmpVehicleOptionGhost = 4, vcmpVehicleOptionSiren = 5, vcmpVehicleOptionSingleUse = 6, - vcmpVehicleOptionEngineDisabled = 7, - vcmpVehicleOptionBootOpen = 8, - vcmpVehicleOptionBonnetOpen = 9, forceSizeVcmpVehicleOption = INT32_MAX } vcmpVehicleOption; @@ -196,31 +189,6 @@ typedef enum { forceSizeVcmpPickupOption = INT32_MAX } vcmpPickupOption; -typedef enum { - vcmpNetworkStatisticsOptionDataSentPerSecond = 0, - vcmpNetworkStatisticsOptionDataResentPerSecond = 1, - vcmpNetworkStatisticsOptionDataReceivedPerSecond = 2, - vcmpNetworkStatisticsOptionDataDiscardedPerSecond = 3, - vcmpNetworkStatisticsOptionAllBytesSentPerSecond = 4, - vcmpNetworkStatisticsOptionAllBytesReceivedPerSecond = 5, - - vcmpNetworkStatisticsOptionDataSentTotal = 6, - vcmpNetworkStatisticsOptionDataResentTotal = 7, - vcmpNetworkStatisticsOptionDataReceivedTotal = 8, - vcmpNetworkStatisticsOptionDataDiscardedTotal = 9, - vcmpNetworkStatisticsOptionAllBytesSentTotal = 10, - vcmpNetworkStatisticsOptionAllBytesReceivedTotal = 11, - - vcmpNetworkStatisticsOptionMessagesWaiting = 12, - vcmpNetworkStatisticsOptionMessagesResending = 13, - vcmpNetworkStatisticsOptionBytesResending = 14, - - vcmpNetworkStatisticsOptionPacketLossPerSecond = 15, - vcmpNetworkStatisticsOptionPacketLossTotal = 16, - - forceSizeVcmpNetworkStatisticsOption = INT32_MAX -} vcmpNetworkStatisticsOption; - typedef struct { uint32_t structSize; @@ -238,7 +206,7 @@ typedef struct { uint32_t (*GetNumberOfPlugins) (void); /* vcmpErrorNoSuchEntity, vcmpErrorNullArgument */ vcmpError (*GetPluginInfo) (int32_t pluginId, PluginInfo* pluginInfo); - /* Return value of -1 indicates vcmpErrorNoSuchEntity */ + /* -1 == vcmpEntityNone */ int32_t (*FindPlugin) (const char* pluginName); /* GetLastError: vcmpErrorNoSuchEntity */ const void** (*GetPluginExports) (int32_t pluginId, size_t* exportCount); @@ -378,7 +346,7 @@ typedef struct { * Key binds */ - /* Return value of -1 indicates vcmpErrorNoSuchEntity */ + /* -1 == vcmpEntityNone */ int32_t (*GetKeyBindUnusedSlot) (void); /* vcmpErrorNoSuchEntity */ vcmpError (*GetKeyBindData) (int32_t bindId, uint8_t* isCalledOnReleaseOut, int32_t* keyOneOut, int32_t* keyTwoOut, int32_t* keyThreeOut); @@ -451,7 +419,7 @@ typedef struct { * Player access and basic info */ - /* Return value of -1 indicates vcmpErrorNoSuchEntity */ + /* -1 == vcmpEntityNone */ int32_t (*GetPlayerIdFromName) (const char* name); /* success */ uint8_t (*IsPlayerConnected) (int32_t playerId); @@ -921,8 +889,7 @@ typedef struct { /* GetLastError: vcmpErrorNoSuchEntity */ uint8_t (*IsObjectTouchedReportEnabled) (int32_t objectId); - /* 04rel005 SDK functions */ - /* ---------------------------------------------------------- */ + // TODO: MOVE LATER vcmpError (*GetPlayerModuleList) (int32_t playerId); /* vcmpErrorNoSuchEntity, vcmpErrorArgumentOutOfBounds */ @@ -936,38 +903,9 @@ typedef struct { uint16_t (*GetFallTimer) (void); /* vcmpErrorNoSuchEntity */ - vcmpError (*SetVehicleLightsData) (int32_t vehicleId, uint32_t lightsData); + vcmpError(*SetVehicleLightsData) (int32_t vehicleId, uint32_t lightsData); /* GetLastError: vcmpErrorNoSuchEntity */ - uint32_t (*GetVehicleLightsData) (int32_t vehicleId); - - /* 04rel007 SDK functions */ - /* ---------------------------------------------------------- */ - /* vcmpErrorNoSuchEntity */ - vcmpError (*KillPlayer) (int32_t playerId); - - /* vcmpErrorNoSuchEntity */ - vcmpError (*SetVehicle3DArrowForPlayer) (int32_t vehicleId, int32_t targetPlayerId, uint8_t isEnabled); - /* GetLastError: vcmpErrorNoSuchEntity */ - uint8_t (*GetVehicle3DArrowForPlayer) (int32_t vehicleId, int32_t targetPlayerId); - /* vcmpErrorNoSuchEntity */ - vcmpError (*SetPlayer3DArrowForPlayer) (int32_t playerId, int32_t targetPlayerId, uint8_t isEnabled); - /* GetLastError: vcmpErrorNoSuchEntity */ - uint8_t (*GetPlayer3DArrowForPlayer) (int32_t playerId, int32_t targetPlayerId); - - /* vcmpErrorNoSuchEntity */ - vcmpError (*SetPlayerDrunkHandling) (int32_t playerId, uint32_t drunkLevel); - /* GetLastError: vcmpErrorNoSuchEntity */ - uint32_t (*GetPlayerDrunkHandling) (int32_t playerId); - /* vcmpErrorNoSuchEntity */ - vcmpError (*SetPlayerDrunkVisuals) (int32_t playerId, uint8_t drunkLevel); - /* GetLastError: vcmpErrorNoSuchEntity */ - uint8_t (*GetPlayerDrunkVisuals) (int32_t playerId); - - /* vcmpErrorNoSuchEntity, vcmpErrorRequestDenied */ - vcmpError (*InterpolateCameraLookAt) (int32_t playerId, float lookX, float lookY, float lookZ, uint32_t interpTimeMS); - - /* GetLastError: vcmpErrorNoSuchEntity, vcmpErrorArgumentOutOfBounds */ - double (*GetNetworkStatistics) (int32_t playerId, vcmpNetworkStatisticsOption option); + uint32_t(*GetVehicleLightsData) (int32_t vehicleId); } PluginFuncs; @@ -1031,12 +969,7 @@ typedef struct { void (*OnEntityPoolChange) (vcmpEntityPool entityType, int32_t entityId, uint8_t isDeleted); void (*OnServerPerformanceReport) (size_t entryCount, const char** descriptions, uint64_t* times); - /* 04rel005 SDK functions */ - /* ---------------------------------------------------------- */ - void (*OnPlayerModuleList) (int32_t playerId, const char* list); + // TODO: MOVE LATER + void(*OnPlayerModuleList) (int32_t playerId, const char* list); - /* 04rel007 SDK functions */ - /* ---------------------------------------------------------- */ - void (*OnEntityStreamingChange) (int32_t playerId, int32_t entityId, vcmpEntityPool entityType, uint8_t isDeleted); - -} PluginCallbacks; +} PluginCallbacks; \ No newline at end of file diff --git a/include/vcmp.new.h b/include/vcmp.new.h new file mode 100644 index 00000000..c695d8f9 --- /dev/null +++ b/include/vcmp.new.h @@ -0,0 +1,1042 @@ +/* + Project: Vice City Multiplayer 0.4 Server / Plugin Kit + File: plugin.h + + Copyright 2011-2019 Ago Allikmaa (maxorator) + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#pragma once + +#include +#include + +typedef struct { + uint32_t structSize; + char serverName[128]; + uint32_t maxPlayers; + uint32_t port; + uint32_t flags; +} ServerSettings; + +#define PLUGIN_API_MAJOR 2 +#define PLUGIN_API_MINOR 1 + +typedef struct { + uint32_t structSize; + uint32_t pluginId; + char name[32]; + uint32_t pluginVersion; + uint16_t apiMajorVersion; + uint16_t apiMinorVersion; +} PluginInfo; + +typedef enum { + vcmpErrorNone = 0, + vcmpErrorNoSuchEntity = 1, + vcmpErrorBufferTooSmall = 2, + vcmpErrorTooLargeInput = 3, + vcmpErrorArgumentOutOfBounds = 4, + vcmpErrorNullArgument = 5, + vcmpErrorPoolExhausted = 6, + vcmpErrorInvalidName = 7, + vcmpErrorRequestDenied = 8, + forceSizeVcmpError = INT32_MAX +} vcmpError; + +typedef enum { + vcmpEntityPoolVehicle = 1, + vcmpEntityPoolObject = 2, + vcmpEntityPoolPickup = 3, + vcmpEntityPoolRadio = 4, + vcmpEntityPoolPlayer = 5, + vcmpEntityReserved1 = 6, + vcmpEntityPoolBlip = 7, + vcmpEntityPoolCheckPoint = 8, + forceSizeVcmpEntityPool = INT32_MAX +} vcmpEntityPool; + +typedef enum { + vcmpDisconnectReasonTimeout = 0, + vcmpDisconnectReasonQuit = 1, + vcmpDisconnectReasonKick = 2, + vcmpDisconnectReasonCrash = 3, + vcmpDisconnectReasonAntiCheat = 4, + forceSizeVcmpDisconnectReason = INT32_MAX +} vcmpDisconnectReason; + +typedef enum { + vcmpBodyPartBody = 0, + vcmpBodyPartTorso = 1, + vcmpBodyPartLeftArm = 2, + vcmpBodyPartRightArm = 3, + vcmpBodyPartLeftLeg = 4, + vcmpBodyPartRightLeg = 5, + vcmpBodyPartHead = 6, + vcmpBodyPartInVehicle = 7, + forceSizeVcmpBodyPart = INT32_MAX +} vcmpBodyPart; + +typedef enum { + vcmpPlayerStateNone = 0, + vcmpPlayerStateNormal = 1, + vcmpPlayerStateAim = 2, + vcmpPlayerStateDriver = 3, + vcmpPlayerStatePassenger = 4, + vcmpPlayerStateEnterDriver = 5, + vcmpPlayerStateEnterPassenger = 6, + vcmpPlayerStateExit = 7, + vcmpPlayerStateUnspawned = 8, + forceSizeVcmpPlayerState = INT32_MAX +} vcmpPlayerState; + +typedef enum { + vcmpPlayerUpdateNormal = 0, + vcmpPlayerUpdateAimingDeprecated = 1, + vcmpPlayerUpdateDriver = 2, + vcmpPlayerUpdatePassenger = 3, + forceSizeVcmpPlayerUpdate = INT32_MAX +} vcmpPlayerUpdate; + +typedef enum { + vcmpPlayerVehicleOut = 0, + vcmpPlayerVehicleEntering = 1, + vcmpPlayerVehicleExiting = 2, + vcmpPlayerVehicleIn = 3, + forceSizeVcmpPlayerVehicle = INT32_MAX +} vcmpPlayerVehicle; + +typedef enum { + vcmpVehicleSyncNone = 0, + vcmpVehicleSyncDriver = 1, + vcmpVehicleSyncPassenger = 3, + vcmpVehicleSyncNear = 4, + forceSizeVcmpVehicleSync = INT32_MAX +} vcmpVehicleSync; + +typedef enum { + vcmpVehicleUpdateDriverSync = 0, + vcmpVehicleUpdateOtherSync = 1, + vcmpVehicleUpdatePosition = 2, + vcmpVehicleUpdateHealth = 4, + vcmpVehicleUpdateColour = 5, + vcmpVehicleUpdateRotation = 6, + forceSizeVcmpVehicleUpdate = INT32_MAX +} vcmpVehicleUpdate; + +typedef enum { + vcmpServerOptionSyncFrameLimiter = 0, + vcmpServerOptionFrameLimiter = 1, + vcmpServerOptionTaxiBoostJump = 2, + vcmpServerOptionDriveOnWater = 3, + vcmpServerOptionFastSwitch = 4, + vcmpServerOptionFriendlyFire = 5, + vcmpServerOptionDisableDriveBy = 6, + vcmpServerOptionPerfectHandling = 7, + vcmpServerOptionFlyingCars = 8, + vcmpServerOptionJumpSwitch = 9, + vcmpServerOptionShowMarkers = 10, + vcmpServerOptionOnlyShowTeamMarkers = 11, + vcmpServerOptionStuntBike = 12, + vcmpServerOptionShootInAir = 13, + vcmpServerOptionShowNameTags = 14, + vcmpServerOptionJoinMessages = 15, + vcmpServerOptionDeathMessages = 16, + vcmpServerOptionChatTagsEnabled = 17, + vcmpServerOptionUseClasses = 18, + vcmpServerOptionWallGlitch = 19, + vcmpServerOptionDisableBackfaceCulling = 20, + vcmpServerOptionDisableHeliBladeDamage = 21, + vcmpServerOptionDisableCrouch = 22, + forceSizeVcmpServerOption = INT32_MAX +} vcmpServerOption; + +typedef enum { + vcmpPlayerOptionControllable = 0, + vcmpPlayerOptionDriveBy = 1, + vcmpPlayerOptionWhiteScanlines = 2, + vcmpPlayerOptionGreenScanlines = 3, + vcmpPlayerOptionWidescreen = 4, + vcmpPlayerOptionShowMarkers = 5, + vcmpPlayerOptionCanAttack = 6, + vcmpPlayerOptionHasMarker = 7, + vcmpPlayerOptionChatTagsEnabled = 8, + vcmpPlayerOptionDrunkEffectsDeprecated = 9, + vcmpPlayerOptionBleeding = 10, + forceSizeVcmpPlayerOption = INT32_MAX +} vcmpPlayerOption; + +typedef enum { + vcmpVehicleOptionDoorsLocked = 0, + vcmpVehicleOptionAlarm = 1, + vcmpVehicleOptionLights = 2, + vcmpVehicleOptionRadioLocked = 3, + vcmpVehicleOptionGhost = 4, + vcmpVehicleOptionSiren = 5, + vcmpVehicleOptionSingleUse = 6, + vcmpVehicleOptionEngineDisabled = 7, + vcmpVehicleOptionBootOpen = 8, + vcmpVehicleOptionBonnetOpen = 9, + forceSizeVcmpVehicleOption = INT32_MAX +} vcmpVehicleOption; + +typedef enum { + vcmpPickupOptionSingleUse = 0, + forceSizeVcmpPickupOption = INT32_MAX +} vcmpPickupOption; + +typedef enum { + vcmpNetworkStatisticsOptionDataSentPerSecond = 0, + vcmpNetworkStatisticsOptionDataResentPerSecond = 1, + vcmpNetworkStatisticsOptionDataReceivedPerSecond = 2, + vcmpNetworkStatisticsOptionDataDiscardedPerSecond = 3, + vcmpNetworkStatisticsOptionAllBytesSentPerSecond = 4, + vcmpNetworkStatisticsOptionAllBytesReceivedPerSecond = 5, + + vcmpNetworkStatisticsOptionDataSentTotal = 6, + vcmpNetworkStatisticsOptionDataResentTotal = 7, + vcmpNetworkStatisticsOptionDataReceivedTotal = 8, + vcmpNetworkStatisticsOptionDataDiscardedTotal = 9, + vcmpNetworkStatisticsOptionAllBytesSentTotal = 10, + vcmpNetworkStatisticsOptionAllBytesReceivedTotal = 11, + + vcmpNetworkStatisticsOptionMessagesWaiting = 12, + vcmpNetworkStatisticsOptionMessagesResending = 13, + vcmpNetworkStatisticsOptionBytesResending = 14, + + vcmpNetworkStatisticsOptionPacketLossPerSecond = 15, + vcmpNetworkStatisticsOptionPacketLossTotal = 16, + + forceSizeVcmpNetworkStatisticsOption = INT32_MAX +} vcmpNetworkStatisticsOption; + +typedef struct { + uint32_t structSize; + + /** + * Plugin system + */ + + /* success */ + uint32_t (*GetServerVersion) (void); + /* vcmpErrorNullArgument */ + vcmpError (*GetServerSettings) (ServerSettings* settings); + /* vcmpErrorNoSuchEntity */ + vcmpError (*ExportFunctions) (int32_t pluginId, const void** functionList, size_t size); + /* success */ + uint32_t (*GetNumberOfPlugins) (void); + /* vcmpErrorNoSuchEntity, vcmpErrorNullArgument */ + vcmpError (*GetPluginInfo) (int32_t pluginId, PluginInfo* pluginInfo); + /* Return value of -1 indicates vcmpErrorNoSuchEntity */ + int32_t (*FindPlugin) (const char* pluginName); + /* GetLastError: vcmpErrorNoSuchEntity */ + const void** (*GetPluginExports) (int32_t pluginId, size_t* exportCount); + /* vcmpErrorNullArgument, vcmpErrorTooLargeInput */ + vcmpError (*SendPluginCommand) (uint32_t commandIdentifier, const char* format, ...); + /* success */ + uint64_t (*GetTime) (void); + /* vcmpErrorNullArgument, vcmpErrorTooLargeInput */ + vcmpError (*LogMessage) (const char* format, ...); + /* success */ + vcmpError (*GetLastError) (void); + + /** + * Client messages + */ + + /* vcmpErrorNoSuchEntity, vcmpErrorNullArgument, vcmpErrorTooLargeInput */ + vcmpError (*SendClientScriptData) (int32_t playerId, const void* data, size_t size); + /* vcmpErrorNoSuchEntity, vcmpErrorNullArgument, vcmpErrorTooLargeInput */ + vcmpError (*SendClientMessage) (int32_t playerId, uint32_t colour, const char* format, ...); + /* vcmpErrorNoSuchEntity, vcmpErrorArgumentOutOfBounds, vcmpErrorNullArgument, vcmpErrorTooLargeInput */ + vcmpError (*SendGameMessage) (int32_t playerId, int32_t type, const char* format, ...); + + /* + * Server settings + */ + + /* vcmpErrorNullArgument, vcmpErrorTooLargeInput */ + vcmpError (*SetServerName) (const char* text); + /* vcmpErrorNullArgument, vcmpErrorBufferTooSmall */ + vcmpError (*GetServerName) (char* buffer, size_t size); + /* vcmpErrorArgumentOutOfBounds */ + vcmpError (*SetMaxPlayers) (uint32_t maxPlayers); + /* success */ + uint32_t (*GetMaxPlayers) (void); + /* vcmpErrorNullArgument, vcmpErrorTooLargeInput */ + vcmpError (*SetServerPassword) (const char* password); + /* vcmpErrorNullArgument, vcmpErrorBufferTooSmall */ + vcmpError (*GetServerPassword) (char* buffer, size_t size); + /* vcmpErrorNullArgument, vcmpErrorTooLargeInput */ + vcmpError (*SetGameModeText) (const char* gameMode); + /* vcmpErrorNullArgument, vcmpErrorBufferTooSmall */ + vcmpError (*GetGameModeText) (char* buffer, size_t size); + /* success */ + void (*ShutdownServer) (void); + + /* + * Game environment settings + */ + + /* vcmpErrorArgumentOutOfBounds */ + vcmpError (*SetServerOption) (vcmpServerOption option, uint8_t toggle); + /* GetLastError: vcmpErrorArgumentOutOfBounds */ + uint8_t (*GetServerOption) (vcmpServerOption option); + /* success */ + void (*SetWorldBounds) (float maxX, float minX, float maxY, float minY); + /* success */ + void (*GetWorldBounds) (float* maxXOut, float* minXOut, float* maxYOut, float* minYOut); + /* success */ + void (*SetWastedSettings) (uint32_t deathTimer, uint32_t fadeTimer, float fadeInSpeed, float fadeOutSpeed, uint32_t fadeColour, uint32_t corpseFadeStart, uint32_t corpseFadeTime); + /* success */ + void (*GetWastedSettings) (uint32_t* deathTimerOut, uint32_t* fadeTimerOut, float* fadeInSpeedOut, float* fadeOutSpeedOut, uint32_t* fadeColourOut, uint32_t* corpseFadeStartOut, uint32_t* corpseFadeTimeOut); + /* success */ + void (*SetTimeRate) (int32_t timeRate); + /* success */ + int32_t (*GetTimeRate) (void); + /* success */ + void (*SetHour) (int32_t hour); + /* success */ + int32_t (*GetHour) (void); + /* success */ + void (*SetMinute) (int32_t minute); + /* success */ + int32_t (*GetMinute) (void); + /* success */ + void (*SetWeather) (int32_t weather); + /* success */ + int32_t (*GetWeather) (void); + /* success */ + void (*SetGravity) (float gravity); + /* success */ + float (*GetGravity) (void); + /* success */ + void (*SetGameSpeed) (float gameSpeed); + /* success */ + float (*GetGameSpeed) (void); + /* success */ + void (*SetWaterLevel) (float waterLevel); + /* success */ + float (*GetWaterLevel) (void); + /* success */ + void (*SetMaximumFlightAltitude) (float height); + /* success */ + float (*GetMaximumFlightAltitude) (void); + /* success */ + void (*SetKillCommandDelay) (int32_t delay); + /* success */ + int32_t (*GetKillCommandDelay) (void); + /* success */ + void (*SetVehiclesForcedRespawnHeight) (float height); + /* success */ + float (*GetVehiclesForcedRespawnHeight) (void); + + /* + * Miscellaneous things + */ + + /* vcmpErrorArgumentOutOfBounds, vcmpErrorNoSuchEntity */ + vcmpError (*CreateExplosion) (int32_t worldId, int32_t type, float x, float y, float z, int32_t responsiblePlayerId, uint8_t atGroundLevel); + /* vcmpErrorArgumentOutOfBounds */ + vcmpError (*PlaySound) (int32_t worldId, int32_t soundId, float x, float y, float z); + /* success */ + void (*HideMapObject) (int32_t modelId, int16_t tenthX, int16_t tenthY, int16_t tenthZ); + /* success */ + void (*ShowMapObject) (int32_t modelId, int16_t tenthX, int16_t tenthY, int16_t tenthZ); + /* success */ + void (*ShowAllMapObjects) (void); + + /* + * Weapon settings + */ + + /* vcmpErrorArgumentOutOfBounds */ + vcmpError (*SetWeaponDataValue) (int32_t weaponId, int32_t fieldId, double value); + /* GetLastError: vcmpErrorArgumentOutOfBounds */ + double (*GetWeaponDataValue) (int32_t weaponId, int32_t fieldId); + /* vcmpErrorArgumentOutOfBounds */ + vcmpError (*ResetWeaponDataValue) (int32_t weaponId, int32_t fieldId); + /* GetLastError: vcmpErrorArgumentOutOfBounds */ + uint8_t (*IsWeaponDataValueModified) (int32_t weaponId, int32_t fieldId); + /* vcmpErrorArgumentOutOfBounds */ + vcmpError (*ResetWeaponData) (int32_t weaponId); + /* success */ + void (*ResetAllWeaponData) (void); + + /* + * Key binds + */ + + /* Return value of -1 indicates vcmpErrorNoSuchEntity */ + int32_t (*GetKeyBindUnusedSlot) (void); + /* vcmpErrorNoSuchEntity */ + vcmpError (*GetKeyBindData) (int32_t bindId, uint8_t* isCalledOnReleaseOut, int32_t* keyOneOut, int32_t* keyTwoOut, int32_t* keyThreeOut); + /* vcmpErrorArgumentOutOfBounds */ + vcmpError (*RegisterKeyBind) (int32_t bindId, uint8_t isCalledOnRelease, int32_t keyOne, int32_t keyTwo, int32_t keyThree); + /* vcmpErrorNoSuchEntity */ + vcmpError (*RemoveKeyBind) (int32_t bindId); + /* success */ + void (*RemoveAllKeyBinds) (void); + + /* + * Coordinate blips + */ + + /* GetLastError: vcmpErrorPoolExhausted */ + int32_t (*CreateCoordBlip) (int32_t index, int32_t world, float x, float y, float z, int32_t scale, uint32_t colour, int32_t sprite); + /* vcmpErrorNoSuchEntity */ + vcmpError (*DestroyCoordBlip) (int32_t index); + /* vcmpErrorNoSuchEntity */ + vcmpError (*GetCoordBlipInfo) (int32_t index, int32_t* worldOut, float* xOut, float* yOUt, float* zOut, int32_t* scaleOut, uint32_t* colourOut, int32_t* spriteOut); + + /* + * Radios + */ + + /* vcmpErrorArgumentOutOfBounds, vcmpErrorNullArgument */ + vcmpError (*AddRadioStream) (int32_t radioId, const char* radioName, const char* radioUrl, uint8_t isListed); + /* vcmpErrorNoSuchEntity */ + vcmpError (*RemoveRadioStream) (int32_t radioId); + + /* + * Spawning and classes + */ + + /* GetLastError: vcmpErrorArgumentOutOfBounds, vcmpErrorPoolExhausted */ + int32_t (*AddPlayerClass) (int32_t teamId, uint32_t colour, int32_t modelIndex, float x, float y, float z, float angle, int32_t weaponOne, int32_t weaponOneAmmo, int32_t weaponTwo, int32_t weaponTwoAmmo, int32_t weaponThree, int32_t weaponThreeAmmo); + /* success */ + void (*SetSpawnPlayerPosition) (float x, float y, float z); + /* success */ + void (*SetSpawnCameraPosition) (float x, float y, float z); + /* success */ + void (*SetSpawnCameraLookAt) (float x, float y, float z); + + /* + * Administration + */ + + /* GetLastError: vcmpErrorNoSuchEntity */ + uint8_t (*IsPlayerAdmin) (int32_t playerId); + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetPlayerAdmin) (int32_t playerId, uint8_t toggle); + /* vcmpErrorNoSuchEntity, vcmpErrorNullArgument, vcmpErrorBufferTooSmall */ + vcmpError (*GetPlayerIP) (int32_t playerId, char* buffer, size_t size); + /* vcmpErrorNoSuchEntity, vcmpErrorNullArgument, vcmpErrorBufferTooSmall */ + vcmpError (*GetPlayerUID) (int32_t playerId, char* buffer, size_t size); + /* vcmpErrorNoSuchEntity, vcmpErrorNullArgument, vcmpErrorBufferTooSmall */ + vcmpError (*GetPlayerUID2) (int32_t playerId, char* buffer, size_t size); + /* vcmpErrorNoSuchEntity */ + vcmpError (*KickPlayer) (int32_t playerId); + /* vcmpErrorNoSuchEntity */ + vcmpError (*BanPlayer) (int32_t playerId); + /* success */ + void (*BanIP) (char* ipAddress); + /* success */ + uint8_t (*UnbanIP) (char* ipAddress); + /* success */ + uint8_t (*IsIPBanned) (char* ipAddress); + + /* + * Player access and basic info + */ + + /* Return value of -1 indicates vcmpErrorNoSuchEntity */ + int32_t (*GetPlayerIdFromName) (const char* name); + /* success */ + uint8_t (*IsPlayerConnected) (int32_t playerId); + /* vcmpErrorNoSuchEntity */ + uint8_t (*IsPlayerStreamedForPlayer) (int32_t checkedPlayerId, int32_t playerId); + /* vcmpErrorNoSuchEntity */ + uint32_t (*GetPlayerKey) (int32_t playerId); + /* vcmpErrorNoSuchEntity, vcmpErrorNullArgument, vcmpErrorBufferTooSmall */ + vcmpError (*GetPlayerName) (int32_t playerId, char* buffer, size_t size); + /* vcmpErrorNoSuchEntity, vcmpErrorNullArgument, vcmpErrorInvalidName, vcmpErrorTooLargeInput */ + vcmpError (*SetPlayerName) (int32_t playerId, const char* name); + /* GetLastError: vcmpErrorNoSuchEntity */ + vcmpPlayerState (*GetPlayerState) (int32_t playerId); + /* vcmpErrorNoSuchEntity, vcmpErrorArgumentOutOfBounds */ + vcmpError (*SetPlayerOption) (int32_t playerId, vcmpPlayerOption option, uint8_t toggle); + /* GetLastError: vcmpErrorNoSuchEntity, vcmpErrorArgumentOutOfBounds */ + uint8_t (*GetPlayerOption) (int32_t playerId, vcmpPlayerOption option); + + /* + * Player world + */ + + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetPlayerWorld) (int32_t playerId, int32_t world); + /* GetLastError: vcmpErrorNoSuchEntity */ + int32_t (*GetPlayerWorld) (int32_t playerId); + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetPlayerSecondaryWorld) (int32_t playerId, int32_t secondaryWorld); + /* GetLastError: vcmpErrorNoSuchEntity */ + int32_t (*GetPlayerSecondaryWorld) (int32_t playerId); + /* GetLastError: vcmpErrorNoSuchEntity */ + int32_t (*GetPlayerUniqueWorld) (int32_t playerId); + /* GetLastError: vcmpErrorNoSuchEntity */ + uint8_t (*IsPlayerWorldCompatible) (int32_t playerId, int32_t world); + + /* + * Player class, team, skin, colour + */ + + /* GetLastError: vcmpErrorNoSuchEntity */ + int32_t (*GetPlayerClass) (int32_t playerId); + /* vcmpErrorNoSuchEntity, vcmpErrorArgumentOutOfBounds */ + vcmpError (*SetPlayerTeam) (int32_t playerId, int32_t teamId); + /* GetLastError: vcmpErrorNoSuchEntity */ + int32_t (*GetPlayerTeam) (int32_t playerId); + /* vcmpErrorNoSuchEntity, vcmpErrorArgumentOutOfBounds */ + vcmpError (*SetPlayerSkin) (int32_t playerId, int32_t skinId); + /* GetLastError: vcmpErrorNoSuchEntity */ + int32_t (*GetPlayerSkin) (int32_t playerId); + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetPlayerColour) (int32_t playerId, uint32_t colour); + /* GetLastError: vcmpErrorNoSuchEntity */ + uint32_t (*GetPlayerColour) (int32_t playerId); + + /* + * Player spawn cycle + */ + + /* vcmpErrorNoSuchEntity */ + uint8_t (*IsPlayerSpawned) (int32_t playerId); + /* vcmpErrorNoSuchEntity */ + vcmpError (*ForcePlayerSpawn) (int32_t playerId); + /* vcmpErrorNoSuchEntity */ + vcmpError (*ForcePlayerSelect) (int32_t playerId); + /* success */ + void (*ForceAllSelect) (void); + /* GetLastError: vcmpErrorNoSuchEntity */ + uint8_t (*IsPlayerTyping) (int32_t playerId); + + /* + * Player money, score, wanted level + */ + + /* vcmpErrorNoSuchEntity */ + vcmpError (*GivePlayerMoney) (int32_t playerId, int32_t amount); + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetPlayerMoney) (int32_t playerId, int32_t amount); + /* GetLastError: vcmpErrorNoSuchEntity */ + int32_t (*GetPlayerMoney) (int32_t playerId); + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetPlayerScore) (int32_t playerId, int32_t score); + /* GetLastError: vcmpErrorNoSuchEntity */ + int32_t (*GetPlayerScore) (int32_t playerId); + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetPlayerWantedLevel) (int32_t playerId, int32_t level); + /* GetLastError: vcmpErrorNoSuchEntity */ + int32_t (*GetPlayerWantedLevel) (int32_t playerId); + /* GetLastError: vcmpErrorNoSuchEntity */ + int32_t (*GetPlayerPing) (int32_t playerId); + /* GetLastError: vcmpErrorNoSuchEntity */ + double (*GetPlayerFPS) (int32_t playerId); + + /* + * Player health and immunity + */ + + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetPlayerHealth) (int32_t playerId, float health); + /* GetLastError: vcmpErrorNoSuchEntity */ + float (*GetPlayerHealth) (int32_t playerId); + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetPlayerArmour) (int32_t playerId, float armour); + /* GetLastError: vcmpErrorNoSuchEntity */ + float (*GetPlayerArmour) (int32_t playerId); + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetPlayerImmunityFlags) (int32_t playerId, uint32_t flags); + /* GetLastError: vcmpErrorNoSuchEntity */ + uint32_t (*GetPlayerImmunityFlags) (int32_t playerId); + + /* + * Player position and rotation + */ + + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetPlayerPosition) (int32_t playerId, float x, float y, float z); + /* vcmpErrorNoSuchEntity */ + vcmpError (*GetPlayerPosition) (int32_t playerId, float* xOut, float* yOut, float* zOut); + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetPlayerSpeed) (int32_t playerId, float x, float y, float z); + /* vcmpErrorNoSuchEntity */ + vcmpError (*GetPlayerSpeed) (int32_t playerId, float* xOut, float* yOut, float* zOut); + /* vcmpErrorNoSuchEntity */ + vcmpError (*AddPlayerSpeed) (int32_t playerId, float x, float y, float z); + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetPlayerHeading) (int32_t playerId, float angle); + /* GetLastError: vcmpErrorNoSuchEntity */ + float (*GetPlayerHeading) (int32_t playerId); + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetPlayerAlpha) (int32_t playerId, int32_t alpha, uint32_t fadeTime); + /* GetLastError: vcmpErrorNoSuchEntity */ + int32_t (*GetPlayerAlpha) (int32_t playerId); + /* vcmpErrorNoSuchEntity */ + vcmpError (*GetPlayerAimPosition) (int32_t playerId, float* xOut, float* yOut, float* zOut); + /* vcmpErrorNoSuchEntity */ + vcmpError (*GetPlayerAimDirection) (int32_t playerId, float* xOut, float* yOut, float* zOut); + + /* + * Player actions and keys + */ + + /* GetLastError: vcmpErrorNoSuchEntity */ + uint8_t (*IsPlayerOnFire) (int32_t playerId); + /* GetLastError: vcmpErrorNoSuchEntity */ + uint8_t (*IsPlayerCrouching) (int32_t playerId); + /* GetLastError: vcmpErrorNoSuchEntity */ + int32_t (*GetPlayerAction) (int32_t playerId); + /* GetLastError: vcmpErrorNoSuchEntity */ + uint32_t (*GetPlayerGameKeys) (int32_t playerId); + + /* + * Player vehicle + */ + + /* vcmpErrorNoSuchEntity, vcmpErrorArgumentOutOfBounds, vcmpErrorRequestDenied */ + vcmpError (*PutPlayerInVehicle) (int32_t playerId, int32_t vehicleId, int32_t slotIndex, uint8_t makeRoom, uint8_t warp); + /* vcmpErrorNoSuchEntity */ + vcmpError (*RemovePlayerFromVehicle) (int32_t playerId); + /* GetLastError: vcmpErrorNoSuchEntity */ + vcmpPlayerVehicle (*GetPlayerInVehicleStatus) (int32_t playerId); + /* GetLastError: vcmpErrorNoSuchEntity */ + int32_t (*GetPlayerInVehicleSlot) (int32_t playerId); + /* GetLastError: vcmpErrorNoSuchEntity */ + int32_t (*GetPlayerVehicleId) (int32_t playerId); + + /* + * Player weapons + */ + + /* vcmpErrorNoSuchEntity, vcmpErrorArgumentOutOfBounds */ + vcmpError (*GivePlayerWeapon) (int32_t playerId, int32_t weaponId, int32_t ammo); + /* vcmpErrorNoSuchEntity, vcmpErrorArgumentOutOfBounds */ + vcmpError (*SetPlayerWeapon) (int32_t playerId, int32_t weaponId, int32_t ammo); + /* GetLastError: vcmpErrorNoSuchEntity */ + int32_t (*GetPlayerWeapon) (int32_t playerId); + /* GetLastError: vcmpErrorNoSuchEntity */ + int32_t (*GetPlayerWeaponAmmo) (int32_t playerId); + /* vcmpErrorNoSuchEntity, vcmpErrorArgumentOutOfBounds */ + vcmpError (*SetPlayerWeaponSlot) (int32_t playerId, int32_t slot); + /* GetLastError: vcmpErrorNoSuchEntity */ + int32_t (*GetPlayerWeaponSlot) (int32_t playerId); + /* GetLastError: vcmpErrorNoSuchEntity, vcmpErrorArgumentOutOfBounds */ + int32_t (*GetPlayerWeaponAtSlot) (int32_t playerId, int32_t slot); + /* GetLastError: vcmpErrorNoSuchEntity, vcmpErrorArgumentOutOfBounds */ + int32_t (*GetPlayerAmmoAtSlot) (int32_t playerId, int32_t slot); + /* vcmpErrorNoSuchEntity */ + vcmpError (*RemovePlayerWeapon) (int32_t playerId, int32_t weaponId); + /* vcmpErrorNoSuchEntity */ + vcmpError (*RemoveAllWeapons) (int32_t playerId); + + /* + * Player camera + */ + + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetCameraPosition) (int32_t playerId, float posX, float posY, float posZ, float lookX, float lookY, float lookZ); + /* vcmpErrorNoSuchEntity */ + vcmpError (*RestoreCamera) (int32_t playerId); + /* GetLastError: vcmpErrorNoSuchEntity */ + uint8_t (*IsCameraLocked) (int32_t playerId); + + /* + * Player miscellaneous stuff + */ + + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetPlayerAnimation) (int32_t playerId, int32_t groupId, int32_t animationId); + /* GetLastError: vcmpErrorNoSuchEntity */ + int32_t (*GetPlayerStandingOnVehicle) (int32_t playerId); + /* GetLastError: vcmpErrorNoSuchEntity */ + int32_t (*GetPlayerStandingOnObject) (int32_t playerId); + /* GetLastError: vcmpErrorNoSuchEntity */ + uint8_t (*IsPlayerAway) (int32_t playerId); + /* vcmpErrorNoSuchEntity */ + int32_t (*GetPlayerSpectateTarget) (int32_t playerId); + /* GetLastError: vcmpErrorNoSuchEntity */ + vcmpError (*SetPlayerSpectateTarget) (int32_t playerId, int32_t targetId); + /* vcmpErrorNoSuchEntity, vcmpErrorNullArgument */ + vcmpError (*RedirectPlayerToServer) (int32_t playerId, const char* ip, uint32_t port, const char* nick, const char* serverPassword, const char* userPassword); + + /* + * All entities + */ + + /* GetLastError: vcmpArgumentOutOfBounds */ + uint8_t (*CheckEntityExists) (vcmpEntityPool entityPool, int32_t index); + + /* + * Vehicles + */ + + /* GetLastError: vcmpErrorArgumentOutOfBounds, vcmpErrorPoolExhausted */ + int32_t (*CreateVehicle) (int32_t modelIndex, int32_t world, float x, float y, float z, float angle, int32_t primaryColour, int32_t secondaryColour); + /* vcmpErrorNoSuchEntity */ + vcmpError (*DeleteVehicle) (int32_t vehicleId); + /* vcmpErrorNoSuchEntity, vcmpErrorArgumentOutOfBounds */ + vcmpError (*SetVehicleOption) (int32_t vehicleId, vcmpVehicleOption option, uint8_t toggle); + /* GetLastError: vcmpErrorNoSuchEntity, vcmpErrorArgumentOutOfBounds */ + uint8_t (*GetVehicleOption) (int32_t vehicleId, vcmpVehicleOption option); + /* GetLastError: vcmpErrorNoSuchEntity */ + int32_t (*GetVehicleSyncSource) (int32_t vehicleId); + /* GetLastError: vcmpErrorNoSuchEntity */ + vcmpVehicleSync (*GetVehicleSyncType) (int32_t vehicleId); + /* GetLastError: vcmpErrorNoSuchEntity */ + uint8_t (*IsVehicleStreamedForPlayer) (int32_t vehicleId, int32_t playerId); + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetVehicleWorld) (int32_t vehicleId, int32_t world); + /* GetLastError: vcmpErrorNoSuchEntity */ + int32_t (*GetVehicleWorld) (int32_t vehicleId); + /* GetLastError: vcmpErrorNoSuchEntity */ + int32_t (*GetVehicleModel) (int32_t vehicleId); + /* GetLastError: vcmpErrorNoSuchEntity, vcmpErrorArgumentOutOfBounds */ + int32_t (*GetVehicleOccupant) (int32_t vehicleId, int32_t slotIndex); + /* vcmpErrorNoSuchEntity */ + vcmpError (*RespawnVehicle) (int32_t vehicleId); + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetVehicleImmunityFlags) (int32_t vehicleId, uint32_t immunityFlags); + /* GetLastError: vcmpErrorNoSuchEntity */ + uint32_t (*GetVehicleImmunityFlags) (int32_t vehicleId); + /* vcmpErrorNoSuchEntity */ + vcmpError (*ExplodeVehicle) (int32_t vehicleId); + /* GetLastError: vcmpErrorNoSuchEntity */ + uint8_t (*IsVehicleWrecked) (int32_t vehicleId); + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetVehiclePosition) (int32_t vehicleId, float x, float y, float z, uint8_t removeOccupants); + /* vcmpErrorNoSuchEntity */ + vcmpError (*GetVehiclePosition) (int32_t vehicleId, float* xOut, float* yOut, float* zOut); + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetVehicleRotation) (int32_t vehicleId, float x, float y, float z, float w); + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetVehicleRotationEuler) (int32_t vehicleId, float x, float y, float z); + /* vcmpErrorNoSuchEntity */ + vcmpError (*GetVehicleRotation) (int32_t vehicleId, float* xOut, float* yOut, float* zOut, float* wOut); + /* vcmpErrorNoSuchEntity */ + vcmpError (*GetVehicleRotationEuler) (int32_t vehicleId, float* xOut, float* yOut, float* zOut); + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetVehicleSpeed) (int32_t vehicleId, float x, float y, float z, uint8_t add, uint8_t relative); + /* vcmpErrorNoSuchEntity */ + vcmpError (*GetVehicleSpeed) (int32_t vehicleId, float* xOut, float* yOut, float* zOut, uint8_t relative); + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetVehicleTurnSpeed) (int32_t vehicleId, float x, float y, float z, uint8_t add, uint8_t relative); + /* vcmpErrorNoSuchEntity */ + vcmpError (*GetVehicleTurnSpeed) (int32_t vehicleId, float* xOut, float* yOut, float* zOut, uint8_t relative); + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetVehicleSpawnPosition) (int32_t vehicleId, float x, float y, float z); + /* vcmpErrorNoSuchEntity */ + vcmpError (*GetVehicleSpawnPosition) (int32_t vehicleId, float* xOut, float* yOut, float* zOut); + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetVehicleSpawnRotation) (int32_t vehicleId, float x, float y, float z, float w); + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetVehicleSpawnRotationEuler) (int32_t vehicleId, float x, float y, float z); + /* vcmpErrorNoSuchEntity */ + vcmpError (*GetVehicleSpawnRotation) (int32_t vehicleId, float* xOut, float* yOut, float* zOut, float* wOut); + /* vcmpErrorNoSuchEntity */ + vcmpError (*GetVehicleSpawnRotationEuler) (int32_t vehicleId, float* xOut, float* yOut, float* zOut); + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetVehicleIdleRespawnTimer) (int32_t vehicleId, uint32_t millis); + /* GetLastError: vcmpErrorNoSuchEntity */ + uint32_t (*GetVehicleIdleRespawnTimer) (int32_t vehicleId); + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetVehicleHealth) (int32_t vehicleId, float health); + /* GetLastError: vcmpErrorNoSuchEntity */ + float (*GetVehicleHealth) (int32_t vehicleId); + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetVehicleColour) (int32_t vehicleId, int32_t primaryColour, int32_t secondaryColour); + /* vcmpErrorNoSuchEntity, vcmpErrorNullArgument */ + vcmpError (*GetVehicleColour) (int32_t vehicleId, int32_t* primaryColourOut, int32_t* secondaryColourOut); + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetVehiclePartStatus) (int32_t vehicleId, int32_t partId, int32_t status); + /* GetLastError: vcmpErrorNoSuchEntity */ + int32_t (*GetVehiclePartStatus) (int32_t vehicleId, int32_t partId); + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetVehicleTyreStatus) (int32_t vehicleId, int32_t tyreId, int32_t status); + /* GetLastError: vcmpErrorNoSuchEntity */ + int32_t (*GetVehicleTyreStatus) (int32_t vehicleId, int32_t tyreId); + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetVehicleDamageData) (int32_t vehicleId, uint32_t damageData); + /* GetLastError: vcmpErrorNoSuchEntity */ + uint32_t (*GetVehicleDamageData) (int32_t vehicleId); + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetVehicleRadio) (int32_t vehicleId, int32_t radioId); + /* GetLastError: vcmpErrorNoSuchEntity */ + int32_t (*GetVehicleRadio) (int32_t vehicleId); + /* vcmpErrorNoSuchEntity */ + vcmpError (*GetVehicleTurretRotation) (int32_t vehicleId, float* horizontalOut, float* verticalOut); + + /* + * Vehicle handling + */ + + /* success */ + void (*ResetAllVehicleHandlings) (void); + /* vcmpErrorArgumentOutOfBounds */ + uint8_t (*ExistsHandlingRule) (int32_t modelIndex, int32_t ruleIndex); + /* vcmpErrorArgumentOutOfBounds */ + vcmpError (*SetHandlingRule) (int32_t modelIndex, int32_t ruleIndex, double value); + /* GetLastError: vcmpErrorArgumentOutOfBounds */ + double (*GetHandlingRule) (int32_t modelIndex, int32_t ruleIndex); + /* vcmpErrorArgumentOutOfBounds */ + vcmpError (*ResetHandlingRule) (int32_t modelIndex, int32_t ruleIndex); + /* vcmpErrorArgumentOutOfBounds */ + vcmpError (*ResetHandling) (int32_t modelIndex); + /* GetLastError: vcmpErrorNoSuchEntity, vcmpErrorArgumentOutOfBounds */ + uint8_t (*ExistsInstHandlingRule) (int32_t vehicleId, int32_t ruleIndex); + /* vcmpErrorNoSuchEntity, vcmpErrorArgumentOutOfBounds */ + vcmpError (*SetInstHandlingRule) (int32_t vehicleId, int32_t ruleIndex, double value); + /* GetLastError: vcmpErrorNoSuchEntity, vcmpErrorArgumentOutOfBounds */ + double (*GetInstHandlingRule) (int32_t vehicleId, int32_t ruleIndex); + /* vcmpErrorNoSuchEntity, vcmpErrorArgumentOutOfBounds */ + vcmpError (*ResetInstHandlingRule) (int32_t vehicleId, int32_t ruleIndex); + /* vcmpErrorNoSuchEntity */ + vcmpError (*ResetInstHandling) (int32_t vehicleId); + + /* + * Pickups + */ + + /* vcmpErrorPoolExhausted */ + int32_t (*CreatePickup) (int32_t modelIndex, int32_t world, int32_t quantity, float x, float y, float z, int32_t alpha, uint8_t isAutomatic); + /* vcmpErrorNoSuchEntity */ + vcmpError (*DeletePickup) (int32_t pickupId); + /* GetLastError: vcmpErrorNoSuchEntity */ + uint8_t (*IsPickupStreamedForPlayer) (int32_t pickupId, int32_t playerId); + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetPickupWorld) (int32_t pickupId, int32_t world); + /* GetLastError: vcmpErrorNoSuchEntity */ + int32_t (*GetPickupWorld) (int32_t pickupId); + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetPickupAlpha) (int32_t pickupId, int32_t alpha); + /* GetLastError: vcmpErrorNoSuchEntity */ + int32_t (*GetPickupAlpha) (int32_t pickupId); + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetPickupIsAutomatic) (int32_t pickupId, uint8_t toggle); + /* GetLastError: vcmpErrorNoSuchEntity */ + uint8_t (*IsPickupAutomatic) (int32_t pickupId); + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetPickupAutoTimer) (int32_t pickupId, uint32_t durationMillis); + /* GetLastError: vcmpErrorNoSuchEntity */ + uint32_t (*GetPickupAutoTimer) (int32_t pickupId); + /* vcmpErrorNoSuchEntity */ + vcmpError (*RefreshPickup) (int32_t pickupId); + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetPickupPosition) (int32_t pickupId, float x, float y, float z); + /* vcmpErrorNoSuchEntity */ + vcmpError (*GetPickupPosition) (int32_t pickupId, float* xOut, float* yOut, float* zOut); + /* GetLastError: vcmpErrorNoSuchEntity */ + int32_t (*GetPickupModel) (int32_t pickupId); + /* GetLastError: vcmpErrorNoSuchEntity */ + int32_t (*GetPickupQuantity) (int32_t pickupId); + + /* + * Checkpoints + */ + + /* vcmpErrorPoolExhausted, vcmpErrorNoSuchEntity */ + int32_t (*CreateCheckPoint) (int32_t playerId, int32_t world, uint8_t isSphere, float x, float y, float z, int32_t red, int32_t green, int32_t blue, int32_t alpha, float radius); + /* vcmpErrorNoSuchEntity */ + vcmpError (*DeleteCheckPoint) (int32_t checkPointId); + /* GetLastError: vcmpErrorNoSuchEntity */ + uint8_t (*IsCheckPointStreamedForPlayer) (int32_t checkPointId, int32_t playerId); + /* GetLastError: vcmpErrorNoSuchEntity */ + uint8_t (*IsCheckPointSphere) (int32_t checkPointId); + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetCheckPointWorld) (int32_t checkPointId, int32_t world); + /* GetLastError: vcmpErrorNoSuchEntity */ + int32_t (*GetCheckPointWorld) (int32_t checkPointId); + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetCheckPointColour) (int32_t checkPointId, int32_t red, int32_t green, int32_t blue, int32_t alpha); + /* vcmpErrorNoSuchEntity */ + vcmpError (*GetCheckPointColour) (int32_t checkPointId, int32_t* redOut, int32_t* greenOut, int32_t* blueOut, int32_t* alphaOut); + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetCheckPointPosition) (int32_t checkPointId, float x, float y, float z); + /* vcmpErrorNoSuchEntity */ + vcmpError (*GetCheckPointPosition) (int32_t checkPointId, float* xOut, float* yOut, float* zOut); + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetCheckPointRadius) (int32_t checkPointId, float radius); + /* GetLastError: vcmpErrorNoSuchEntity */ + float (*GetCheckPointRadius) (int32_t checkPointId); + /* GetLastError: vcmpErrorNoSuchEntity */ + int32_t (*GetCheckPointOwner) (int32_t checkPointId); + + /* + * Objects + */ + + /* GetLastError: vcmpErrorPoolExhausted */ + int32_t (*CreateObject) (int32_t modelIndex, int32_t world, float x, float y, float z, int32_t alpha); + /* vcmpErrorNoSuchEntity */ + vcmpError (*DeleteObject) (int32_t objectId); + /* GetLastError: vcmpErrorNoSuchEntity */ + uint8_t (*IsObjectStreamedForPlayer) (int32_t objectId, int32_t playerId); + /* GetLastError: vcmpErrorNoSuchEntity */ + int32_t (*GetObjectModel) (int32_t objectId); + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetObjectWorld) (int32_t objectId, int32_t world); + /* GetLastError: vcmpErrorNoSuchEntity */ + int32_t (*GetObjectWorld) (int32_t objectId); + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetObjectAlpha) (int32_t objectId, int32_t alpha, uint32_t duration); + /* GetLastError: vcmpErrorNoSuchEntity */ + int32_t (*GetObjectAlpha) (int32_t objectId); + /* vcmpErrorNoSuchEntity */ + vcmpError (*MoveObjectTo) (int32_t objectId, float x, float y, float z, uint32_t duration); + /* vcmpErrorNoSuchEntity */ + vcmpError (*MoveObjectBy) (int32_t objectId, float x, float y, float z, uint32_t duration); + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetObjectPosition) (int32_t objectId, float x, float y, float z); + /* vcmpErrorNoSuchEntity */ + vcmpError (*GetObjectPosition) (int32_t objectId, float* xOut, float* yOut, float* zOut); + /* vcmpErrorNoSuchEntity */ + vcmpError (*RotateObjectTo) (int32_t objectId, float x, float y, float z, float w, uint32_t duration); + /* vcmpErrorNoSuchEntity */ + vcmpError (*RotateObjectToEuler) (int32_t objectId, float x, float y, float z, uint32_t duration); + /* vcmpErrorNoSuchEntity */ + vcmpError (*RotateObjectBy) (int32_t objectId, float x, float y, float z, float w, uint32_t duration); + /* vcmpErrorNoSuchEntity */ + vcmpError (*RotateObjectByEuler) (int32_t objectId, float x, float y, float z, uint32_t duration); + /* vcmpErrorNoSuchEntity */ + vcmpError (*GetObjectRotation) (int32_t objectId, float* xOut, float* yOut, float *zOut, float *wOut); + /* vcmpErrorNoSuchEntity */ + vcmpError (*GetObjectRotationEuler) (int32_t objectId, float* xOut, float* yOut, float *zOut); + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetObjectShotReportEnabled) (int32_t objectId, uint8_t toggle); + /* GetLastError: vcmpErrorNoSuchEntity */ + uint8_t (*IsObjectShotReportEnabled) (int32_t objectId); + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetObjectTouchedReportEnabled) (int32_t objectId, uint8_t toggle); + /* GetLastError: vcmpErrorNoSuchEntity */ + uint8_t (*IsObjectTouchedReportEnabled) (int32_t objectId); + + /* 04rel005 SDK functions */ + /* ---------------------------------------------------------- */ + vcmpError (*GetPlayerModuleList) (int32_t playerId); + + /* vcmpErrorNoSuchEntity, vcmpErrorArgumentOutOfBounds */ + vcmpError (*SetPickupOption) (int32_t pickupId, vcmpPickupOption option, uint8_t toggle); + /* GetLastError: vcmpErrorNoSuchEntity, vcmpErrorArgumentOutOfBounds */ + uint8_t (*GetPickupOption) (int32_t pickupId, vcmpPickupOption option); + + /* success */ + void (*SetFallTimer) (uint16_t timeRate); + /* success */ + uint16_t (*GetFallTimer) (void); + + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetVehicleLightsData) (int32_t vehicleId, uint32_t lightsData); + /* GetLastError: vcmpErrorNoSuchEntity */ + uint32_t (*GetVehicleLightsData) (int32_t vehicleId); + + /* 04rel007 SDK functions */ + /* ---------------------------------------------------------- */ + /* vcmpErrorNoSuchEntity */ + vcmpError (*KillPlayer) (int32_t playerId); + + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetVehicle3DArrowForPlayer) (int32_t vehicleId, int32_t targetPlayerId, uint8_t isEnabled); + /* GetLastError: vcmpErrorNoSuchEntity */ + uint8_t (*GetVehicle3DArrowForPlayer) (int32_t vehicleId, int32_t targetPlayerId); + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetPlayer3DArrowForPlayer) (int32_t playerId, int32_t targetPlayerId, uint8_t isEnabled); + /* GetLastError: vcmpErrorNoSuchEntity */ + uint8_t (*GetPlayer3DArrowForPlayer) (int32_t playerId, int32_t targetPlayerId); + + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetPlayerDrunkHandling) (int32_t playerId, uint32_t drunkLevel); + /* GetLastError: vcmpErrorNoSuchEntity */ + uint32_t (*GetPlayerDrunkHandling) (int32_t playerId); + /* vcmpErrorNoSuchEntity */ + vcmpError (*SetPlayerDrunkVisuals) (int32_t playerId, uint8_t drunkLevel); + /* GetLastError: vcmpErrorNoSuchEntity */ + uint8_t (*GetPlayerDrunkVisuals) (int32_t playerId); + + /* vcmpErrorNoSuchEntity, vcmpErrorRequestDenied */ + vcmpError (*InterpolateCameraLookAt) (int32_t playerId, float lookX, float lookY, float lookZ, uint32_t interpTimeMS); + + /* GetLastError: vcmpErrorNoSuchEntity, vcmpErrorArgumentOutOfBounds */ + double (*GetNetworkStatistics) (int32_t playerId, vcmpNetworkStatisticsOption option); + +} PluginFuncs; + +typedef struct { + uint32_t structSize; + + uint8_t (*OnServerInitialise) (void); + void (*OnServerShutdown) (void); + void (*OnServerFrame) (float elapsedTime); + + uint8_t (*OnPluginCommand) (uint32_t commandIdentifier, const char* message); + uint8_t (*OnIncomingConnection) (char* playerName, size_t nameBufferSize, const char* userPassword, const char* ipAddress); + void (*OnClientScriptData) (int32_t playerId, const uint8_t* data, size_t size); + + void (*OnPlayerConnect) (int32_t playerId); + void (*OnPlayerDisconnect) (int32_t playerId, vcmpDisconnectReason reason); + + uint8_t (*OnPlayerRequestClass) (int32_t playerId, int32_t offset); + uint8_t (*OnPlayerRequestSpawn) (int32_t playerId); + void (*OnPlayerSpawn) (int32_t playerId); + void (*OnPlayerDeath) (int32_t playerId, int32_t killerId, int32_t reason, vcmpBodyPart bodyPart); + void (*OnPlayerUpdate) (int32_t playerId, vcmpPlayerUpdate updateType); + + uint8_t (*OnPlayerRequestEnterVehicle) (int32_t playerId, int32_t vehicleId, int32_t slotIndex); + void (*OnPlayerEnterVehicle) (int32_t playerId, int32_t vehicleId, int32_t slotIndex); + void (*OnPlayerExitVehicle) (int32_t playerId, int32_t vehicleId); + + void (*OnPlayerNameChange) (int32_t playerId, const char* oldName, const char* newName); + void (*OnPlayerStateChange) (int32_t playerId, vcmpPlayerState oldState, vcmpPlayerState newState); + void (*OnPlayerActionChange) (int32_t playerId, int32_t oldAction, int32_t newAction); + void (*OnPlayerOnFireChange) (int32_t playerId, uint8_t isOnFire); + void (*OnPlayerCrouchChange) (int32_t playerId, uint8_t isCrouching); + void (*OnPlayerGameKeysChange) (int32_t playerId, uint32_t oldKeys, uint32_t newKeys); + void (*OnPlayerBeginTyping) (int32_t playerId); + void (*OnPlayerEndTyping) (int32_t playerId); + void (*OnPlayerAwayChange) (int32_t playerId, uint8_t isAway); + + uint8_t (*OnPlayerMessage) (int32_t playerId, const char* message); + uint8_t (*OnPlayerCommand) (int32_t playerId, const char* message); + uint8_t (*OnPlayerPrivateMessage) (int32_t playerId, int32_t targetPlayerId, const char* message); + + void (*OnPlayerKeyBindDown) (int32_t playerId, int32_t bindId); + void (*OnPlayerKeyBindUp) (int32_t playerId, int32_t bindId); + void (*OnPlayerSpectate) (int32_t playerId, int32_t targetPlayerId); + void (*OnPlayerCrashReport) (int32_t playerId, const char* report); + + void (*OnVehicleUpdate) (int32_t vehicleId, vcmpVehicleUpdate updateType); + void (*OnVehicleExplode) (int32_t vehicleId); + void (*OnVehicleRespawn) (int32_t vehicleId); + + void (*OnObjectShot) (int32_t objectId, int32_t playerId, int32_t weaponId); + void (*OnObjectTouched) (int32_t objectId, int32_t playerId); + + uint8_t (*OnPickupPickAttempt) (int32_t pickupId, int32_t playerId); + void (*OnPickupPicked) (int32_t pickupId, int32_t playerId); + void (*OnPickupRespawn) (int32_t pickupId); + + void (*OnCheckpointEntered) (int32_t checkPointId, int32_t playerId); + void (*OnCheckpointExited) (int32_t checkPointId, int32_t playerId); + + void (*OnEntityPoolChange) (vcmpEntityPool entityType, int32_t entityId, uint8_t isDeleted); + void (*OnServerPerformanceReport) (size_t entryCount, const char** descriptions, uint64_t* times); + + /* 04rel005 SDK functions */ + /* ---------------------------------------------------------- */ + void (*OnPlayerModuleList) (int32_t playerId, const char* list); + + /* 04rel007 SDK functions */ + /* ---------------------------------------------------------- */ + void (*OnEntityStreamingChange) (int32_t playerId, int32_t entityId, vcmpEntityPool entityType, uint8_t isDeleted); + +} PluginCallbacks; diff --git a/source/Core.hpp b/source/Core.hpp index c802300f..0ccd69ac 100644 --- a/source/Core.hpp +++ b/source/Core.hpp @@ -194,8 +194,9 @@ protected: // ---------------------------------------------------------------------------------------- SignalPair mOnDestroyed; SignalPair mOnCustom; +#if SQMOD_SDK_LEAST(2, 1) SignalPair mOnStream; - +#endif // ---------------------------------------------------------------------------------------- SignalPair mOnEntered; SignalPair mOnExited; @@ -327,8 +328,9 @@ protected: // ---------------------------------------------------------------------------------------- SignalPair mOnDestroyed; SignalPair mOnCustom; +#if SQMOD_SDK_LEAST(2, 1) SignalPair mOnStream; - +#endif // ---------------------------------------------------------------------------------------- SignalPair mOnShot; SignalPair mOnTouched; @@ -393,8 +395,9 @@ protected: // ---------------------------------------------------------------------------------------- SignalPair mOnDestroyed; SignalPair mOnCustom; +#if SQMOD_SDK_LEAST(2, 1) SignalPair mOnStream; - +#endif // ---------------------------------------------------------------------------------------- SignalPair mOnRespawn; SignalPair mOnClaimed; @@ -487,8 +490,9 @@ protected: // ---------------------------------------------------------------------------------------- SignalPair mOnDestroyed; SignalPair mOnCustom; +#if SQMOD_SDK_LEAST(2, 1) SignalPair mOnStream; - +#endif // ---------------------------------------------------------------------------------------- SignalPair mOnRequestClass; SignalPair mOnRequestSpawn; @@ -545,7 +549,9 @@ protected: SignalPair mOnCheckpointEntered; SignalPair mOnCheckpointExited; SignalPair mOnClientScriptData; +#if SQMOD_SDK_LEAST(2, 1) SignalPair mOnEntityStream; +#endif SignalPair mOnUpdate; SignalPair mOnHealth; SignalPair mOnArmour; @@ -636,8 +642,9 @@ protected: // ---------------------------------------------------------------------------------------- SignalPair mOnDestroyed; SignalPair mOnCustom; +#if SQMOD_SDK_LEAST(2, 1) SignalPair mOnStream; - +#endif // ---------------------------------------------------------------------------------------- SignalPair mOnEmbarking; SignalPair mOnEmbarked; @@ -1265,7 +1272,7 @@ public: * Entity pool changes events. */ void EmitEntityPool(vcmpEntityPool entity_type, Int32 entity_id, bool is_deleted); - +#if SQMOD_SDK_LEAST(2, 1) /* -------------------------------------------------------------------------------------------- * Entity streaming changes events. */ @@ -1275,7 +1282,7 @@ public: void EmitPlayerStream(int32_t player_id, int32_t entity_id, bool is_deleted); void EmitVehicleStream(int32_t player_id, int32_t entity_id, bool is_deleted); void EmitEntityStreaming(int32_t player_id, int32_t entity_id, vcmpEntityPool entity_type, bool is_deleted); - +#endif /* -------------------------------------------------------------------------------------------- * Entity update events. */ @@ -1321,11 +1328,13 @@ public: SignalPair mOnPickupCustom; SignalPair mOnPlayerCustom; SignalPair mOnVehicleCustom; +#if SQMOD_SDK_LEAST(2, 1) SignalPair mOnCheckpointStream; SignalPair mOnObjectStream; SignalPair mOnPickupStream; SignalPair mOnPlayerStream; SignalPair mOnVehicleStream; +#endif SignalPair mOnServerStartup; SignalPair mOnServerShutdown; SignalPair mOnServerFrame; @@ -1432,7 +1441,9 @@ public: SignalPair mOnVehicleHandlingRule; SignalPair mOnVehicleEnterArea; SignalPair mOnVehicleLeaveArea; +#if SQMOD_SDK_LEAST(2, 1) SignalPair mOnEntityStream; +#endif SignalPair mOnServerOption; SignalPair mOnScriptReload; SignalPair mOnScriptLoaded; diff --git a/source/Core/Events.inc b/source/Core/Events.inc index 8c075624..d242f00f 100644 --- a/source/Core/Events.inc +++ b/source/Core/Events.inc @@ -1364,12 +1364,14 @@ void Core::EmitEntityPool(vcmpEntityPool entity_type, Int32 entity_id, bool is_d case vcmpEntityPoolRadio: // @TODO Implement... //break; +#if SQMOD_SDK_LEAST(2, 1) case vcmpEntityPoolPlayer: // @TODO Implement... //break; case vcmpEntityReserved1: // @TODO Implement... break; +#endif case vcmpEntityPoolBlip: // Do we even have this blip that we're trying to delete? if (is_deleted && VALID_ENTITY(m_Blips[entity_id].mID)) @@ -1551,7 +1553,7 @@ void Core::EmitPlayerUpdate(Int32 player_id, vcmpPlayerUpdate update_type) (*mOnPlayerUpdate.first)(inst.mObj, static_cast< Int32 >(update_type)); SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerUpdate") } - +#if SQMOD_SDK_LEAST(2, 1) // ------------------------------------------------------------------------------------------------ void Core::EmitCheckpointStream(int32_t player_id, int32_t entity_id, bool is_deleted) { @@ -1679,7 +1681,7 @@ void Core::EmitEntityStreaming(int32_t player_id, int32_t entity_id, vcmpEntityP } SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::EntityStreaming") } - +#endif // ------------------------------------------------------------------------------------------------ void Core::EmitVehicleUpdate(Int32 vehicle_id, vcmpVehicleUpdate update_type) { diff --git a/source/Core/Inst.inc b/source/Core/Inst.inc index bdd57bab..e5be953a 100644 --- a/source/Core/Inst.inc +++ b/source/Core/Inst.inc @@ -417,7 +417,9 @@ void Core::CheckpointInst::InitEvents() // Proceed to initializing the events InitSignalPair(mOnDestroyed, mEvents, "Destroyed"); InitSignalPair(mOnCustom, mEvents, "Custom"); +#if SQMOD_SDK_LEAST(2, 1) InitSignalPair(mOnStream, mEvents, "Stream"); +#endif InitSignalPair(mOnEntered, mEvents, "Entered"); InitSignalPair(mOnExited, mEvents, "Exited"); InitSignalPair(mOnWorld, mEvents, "World"); @@ -429,7 +431,9 @@ void Core::CheckpointInst::DropEvents() { ResetSignalPair(mOnDestroyed); ResetSignalPair(mOnCustom); +#if SQMOD_SDK_LEAST(2, 1) ResetSignalPair(mOnStream); +#endif ResetSignalPair(mOnEntered); ResetSignalPair(mOnExited); ResetSignalPair(mOnWorld); @@ -485,7 +489,9 @@ void Core::ObjectInst::InitEvents() // Proceed to initializing the events InitSignalPair(mOnDestroyed, mEvents, "Destroyed"); InitSignalPair(mOnCustom, mEvents, "Custom"); +#if SQMOD_SDK_LEAST(2, 1) InitSignalPair(mOnStream, mEvents, "Stream"); +#endif InitSignalPair(mOnShot, mEvents, "Shot"); InitSignalPair(mOnTouched, mEvents, "Touched"); InitSignalPair(mOnWorld, mEvents, "World"); @@ -498,7 +504,9 @@ void Core::ObjectInst::DropEvents() { ResetSignalPair(mOnDestroyed); ResetSignalPair(mOnCustom); +#if SQMOD_SDK_LEAST(2, 1) ResetSignalPair(mOnStream); +#endif ResetSignalPair(mOnShot); ResetSignalPair(mOnTouched); ResetSignalPair(mOnWorld); @@ -524,7 +532,9 @@ void Core::PickupInst::InitEvents() // Proceed to initializing the events InitSignalPair(mOnDestroyed, mEvents, "Destroyed"); InitSignalPair(mOnCustom, mEvents, "Custom"); +#if SQMOD_SDK_LEAST(2, 1) InitSignalPair(mOnStream, mEvents, "Stream"); +#endif InitSignalPair(mOnRespawn, mEvents, "Respawn"); InitSignalPair(mOnClaimed, mEvents, "Claimed"); InitSignalPair(mOnCollected, mEvents, "Collected"); @@ -540,7 +550,9 @@ void Core::PickupInst::DropEvents() { ResetSignalPair(mOnDestroyed); ResetSignalPair(mOnCustom); +#if SQMOD_SDK_LEAST(2, 1) ResetSignalPair(mOnStream); +#endif ResetSignalPair(mOnRespawn); ResetSignalPair(mOnClaimed); ResetSignalPair(mOnCollected); @@ -569,7 +581,9 @@ void Core::PlayerInst::InitEvents() // Proceed to initializing the events InitSignalPair(mOnDestroyed, mEvents, "Destroyed"); InitSignalPair(mOnCustom, mEvents, "Custom"); +#if SQMOD_SDK_LEAST(2, 1) InitSignalPair(mOnStream, mEvents, "Stream"); +#endif InitSignalPair(mOnRequestClass, mEvents, "RequestClass"); InitSignalPair(mOnRequestSpawn, mEvents, "RequestSpawn"); InitSignalPair(mOnSpawn, mEvents, "Spawn"); @@ -625,7 +639,9 @@ void Core::PlayerInst::InitEvents() InitSignalPair(mOnCheckpointEntered, mEvents, "CheckpointEntered"); InitSignalPair(mOnCheckpointExited, mEvents, "CheckpointExited"); InitSignalPair(mOnClientScriptData, mEvents, "ClientScriptData"); +#if SQMOD_SDK_LEAST(2, 1) InitSignalPair(mOnEntityStream, mEvents, "EntityStream"); +#endif InitSignalPair(mOnUpdate, mEvents, "Update"); InitSignalPair(mOnHealth, mEvents, "Health"); InitSignalPair(mOnArmour, mEvents, "Armour"); @@ -651,7 +667,9 @@ void Core::PlayerInst::DropEvents() { ResetSignalPair(mOnDestroyed); ResetSignalPair(mOnCustom); +#if SQMOD_SDK_LEAST(2, 1) ResetSignalPair(mOnStream); +#endif ResetSignalPair(mOnRequestClass); ResetSignalPair(mOnRequestSpawn); ResetSignalPair(mOnSpawn); @@ -707,7 +725,9 @@ void Core::PlayerInst::DropEvents() ResetSignalPair(mOnCheckpointEntered); ResetSignalPair(mOnCheckpointExited); ResetSignalPair(mOnClientScriptData); +#if SQMOD_SDK_LEAST(2, 1) ResetSignalPair(mOnEntityStream); +#endif ResetSignalPair(mOnUpdate); ResetSignalPair(mOnHealth); ResetSignalPair(mOnArmour); @@ -746,7 +766,9 @@ void Core::VehicleInst::InitEvents() // Proceed to initializing the events InitSignalPair(mOnDestroyed, mEvents, "Destroyed"); InitSignalPair(mOnCustom, mEvents, "Custom"); +#if SQMOD_SDK_LEAST(2, 1) InitSignalPair(mOnStream, mEvents, "Stream"); +#endif InitSignalPair(mOnEmbarking, mEvents, "Embarking"); InitSignalPair(mOnEmbarked, mEvents, "Embarked"); InitSignalPair(mOnDisembark, mEvents, "Disembark"); @@ -774,7 +796,9 @@ void Core::VehicleInst::DropEvents() { ResetSignalPair(mOnDestroyed); ResetSignalPair(mOnCustom); +#if SQMOD_SDK_LEAST(2, 1) ResetSignalPair(mOnStream); +#endif ResetSignalPair(mOnEmbarking); ResetSignalPair(mOnEmbarked); ResetSignalPair(mOnDisembark); diff --git a/source/Core/Utils.inc b/source/Core/Utils.inc index f4d10c7b..65fcf367 100644 --- a/source/Core/Utils.inc +++ b/source/Core/Utils.inc @@ -75,11 +75,13 @@ void Core::InitEvents() InitSignalPair(mOnPickupCustom, m_Events, "PickupCustom"); InitSignalPair(mOnPlayerCustom, m_Events, "PlayerCustom"); InitSignalPair(mOnVehicleCustom, m_Events, "VehicleCustom"); +#if SQMOD_SDK_LEAST(2, 1) InitSignalPair(mOnCheckpointStream, m_Events, "CheckpointStream"); InitSignalPair(mOnObjectStream, m_Events, "ObjectStream"); InitSignalPair(mOnPickupStream, m_Events, "PickupStream"); InitSignalPair(mOnPlayerStream, m_Events, "PlayerStream"); InitSignalPair(mOnVehicleStream, m_Events, "VehicleStream"); +#endif InitSignalPair(mOnServerStartup, m_Events, "ServerStartup"); InitSignalPair(mOnServerShutdown, m_Events, "ServerShutdown"); InitSignalPair(mOnServerFrame, m_Events, "ServerFrame"); @@ -186,7 +188,9 @@ void Core::InitEvents() InitSignalPair(mOnVehicleHandlingRule, m_Events, "VehicleHandlingRule"); InitSignalPair(mOnVehicleEnterArea, m_Events, "VehicleEnterArea"); InitSignalPair(mOnVehicleLeaveArea, m_Events, "VehicleLeaveArea"); +#if SQMOD_SDK_LEAST(2, 1) InitSignalPair(mOnEntityStream, m_Events, "EntityStream"); +#endif InitSignalPair(mOnServerOption, m_Events, "ServerOption"); InitSignalPair(mOnScriptReload, m_Events, "ScriptReload"); InitSignalPair(mOnScriptLoaded, m_Events, "ScriptLoaded"); @@ -216,11 +220,13 @@ void Core::DropEvents() ResetSignalPair(mOnPickupCustom); ResetSignalPair(mOnPlayerCustom); ResetSignalPair(mOnVehicleCustom); +#if SQMOD_SDK_LEAST(2, 1) ResetSignalPair(mOnCheckpointStream); ResetSignalPair(mOnObjectStream); ResetSignalPair(mOnPickupStream); ResetSignalPair(mOnPlayerStream); ResetSignalPair(mOnVehicleStream); +#endif ResetSignalPair(mOnServerStartup); ResetSignalPair(mOnServerShutdown); ResetSignalPair(mOnServerFrame); @@ -327,7 +333,9 @@ void Core::DropEvents() ResetSignalPair(mOnVehicleHandlingRule); ResetSignalPair(mOnVehicleEnterArea); ResetSignalPair(mOnVehicleLeaveArea); +#if SQMOD_SDK_LEAST(2, 1) ResetSignalPair(mOnEntityStream); +#endif ResetSignalPair(mOnServerOption); ResetSignalPair(mOnScriptReload); ResetSignalPair(mOnScriptLoaded); diff --git a/source/Entity/Player.cpp b/source/Entity/Player.cpp index efaa8393..5d4f6608 100644 --- a/source/Entity/Player.cpp +++ b/source/Entity/Player.cpp @@ -239,7 +239,7 @@ CSStr CPlayer::GetUID2() const // Return the requested information return s_Buffer; } - +#if SQMOD_SDK_LEAST(2, 1) // ------------------------------------------------------------------------------------------------ void CPlayer::Kill() const { @@ -248,7 +248,7 @@ void CPlayer::Kill() const // Perform the requested operation _Func->KillPlayer(m_ID); } - +#endif // ------------------------------------------------------------------------------------------------ void CPlayer::Kick() const { @@ -400,7 +400,7 @@ void CPlayer::SetOptionEx(Int32 option_id, bool toggle, Int32 header, LightObj & Core::Get().EmitPlayerOption(m_ID, option_id, current, header, payload); } } - +#if SQMOD_SDK_LEAST(2, 1) // ------------------------------------------------------------------------------------------------ SQFloat CPlayer::GetNetworkStatisticsF(Int32 option_id) const { @@ -422,7 +422,7 @@ SQInteger CPlayer::GetNetworkStatisticsI(Int32 option_id) const // Return it in the proper type return static_cast< SQInteger >(value); } - +#endif // ------------------------------------------------------------------------------------------------ Int32 CPlayer::GetWorld() const { @@ -1407,7 +1407,7 @@ void CPlayer::Unspectate() const // Spectate the given target _Func->SetPlayerSpectateTarget(m_ID, -1); } - +#if SQMOD_SDK_LEAST(2, 1) // ------------------------------------------------------------------------------------------------ void CPlayer::SetPlayer3DArrow(CPlayer & target, bool toggle) const { @@ -1460,7 +1460,7 @@ bool CPlayer::InterpolateCameraLookAtEx(Float32 x, Float32 y, Float32 z, Uint32 // Perform the requested operation return _Func->InterpolateCameraLookAt(m_ID, x, y, z, ms) != vcmpErrorRequestDenied; } - +#endif // ------------------------------------------------------------------------------------------------ void CPlayer::Redirect(StackStrF & ip, Uint32 port, StackStrF & nick, StackStrF & server_pass, StackStrF & user_pass) @@ -1492,7 +1492,7 @@ void CPlayer::PlaySound(Int32 sound_id) const // Perform the requested operation _Func->PlaySound(_Func->GetPlayerUniqueWorld(m_ID), sound_id, NAN, NAN, NAN); } - +#if SQMOD_SDK_LEAST(2, 1) // ------------------------------------------------------------------------------------------------ void CPlayer::SetDrunkHandling(SQInteger level) const { @@ -1528,7 +1528,7 @@ SQInteger CPlayer::GetDrunkVisuals() const // Perform the requested operation return _Func->GetPlayerDrunkVisuals(m_ID); } - +#endif // ------------------------------------------------------------------------------------------------ LightObj & CPlayer::CreateCheckpointEx(Int32 world, bool sphere, Float32 x, Float32 y, Float32 z, Uint8 r, Uint8 g, Uint8 b, Uint8 a, Float32 radius) const @@ -2793,8 +2793,10 @@ void Register_CPlayer(HSQUIRRELVM vm) .Prop(_SC("Away"), &CPlayer::IsAway) .Prop(_SC("Spec"), &CPlayer::GetSpectator, &CPlayer::SetSpectator) .Prop(_SC("SpecID"), &CPlayer::GetSpectatorID, &CPlayer::SetSpectatorID) +#if SQMOD_SDK_LEAST(2, 1) .Prop(_SC("DrunkHandling"), &CPlayer::GetDrunkHandling, &CPlayer::SetDrunkHandling) .Prop(_SC("DrunkVisuals"), &CPlayer::GetDrunkVisuals, &CPlayer::SetDrunkVisuals) +#endif .Prop(_SC("CollideAreas"), &CPlayer::GetCollideAreas, &CPlayer::SetCollideAreas) .Prop(_SC("Authority"), &CPlayer::GetAuthority, &CPlayer::SetAuthority) .Prop(_SC("TrackPosition"), &CPlayer::GetTrackPosition, &CPlayer::SetTrackPosition) @@ -2815,7 +2817,9 @@ void Register_CPlayer(HSQUIRRELVM vm) .Prop(_SC("Blue"), &CPlayer::GetColorB, &CPlayer::SetColorB) // Member Methods .Func(_SC("StreamedFor"), &CPlayer::IsStreamedFor) +#if SQMOD_SDK_LEAST(2, 1) .Func(_SC("Kill"), &CPlayer::Kill) +#endif .Func(_SC("Kick"), &CPlayer::Kick) .Func(_SC("Ban"), &CPlayer::Ban) .Func(_SC("KickBecause"), &CPlayer::KickBecause) @@ -2824,8 +2828,10 @@ void Register_CPlayer(HSQUIRRELVM vm) .Func(_SC("GetOption"), &CPlayer::GetOption) .Func(_SC("SetOption"), &CPlayer::SetOption) .Func(_SC("SetOptionEx"), &CPlayer::SetOptionEx) +#if SQMOD_SDK_LEAST(2, 1) .Func(_SC("GetNetworkStatisticsF"), &CPlayer::GetNetworkStatisticsF) .Func(_SC("GetNetworkStatisticsI"), &CPlayer::GetNetworkStatisticsI) +#endif .Func(_SC("WorldCompatible"), &CPlayer::IsWorldCompatible) .Func(_SC("SetColor"), &CPlayer::SetColorEx) .Func(_SC("SetColour"), &CPlayer::SetColorEx) @@ -2847,12 +2853,14 @@ void Register_CPlayer(HSQUIRRELVM vm) .Func(_SC("Spectating"), &CPlayer::GetSpectator) .Func(_SC("Unspectate"), &CPlayer::Unspectate) .Func(_SC("Spectate"), &CPlayer::SetSpectator) +#if SQMOD_SDK_LEAST(2, 1) .Func(_SC("SetPlayer3DArrow"), &CPlayer::SetPlayer3DArrow) .Func(_SC("GetPlayer3DArrow"), &CPlayer::GetPlayer3DArrow) .Func(_SC("SetPlayer3DArrowID"), &CPlayer::SetPlayer3DArrowID) .Func(_SC("GetPlayer3DArrowID"), &CPlayer::GetPlayer3DArrowID) .Func(_SC("InterpolateCameraLookAt"), &CPlayer::InterpolateCameraLookAt) .Func(_SC("InterpolateCameraLookAtEx"), &CPlayer::InterpolateCameraLookAtEx) +#endif .Func(_SC("Redirect"), &CPlayer::Redirect) .Func(_SC("GetModuleList"), &CPlayer::GetModuleList) .Func(_SC("PlaySound"), &CPlayer::PlaySound) diff --git a/source/Entity/Player.hpp b/source/Entity/Player.hpp index 85a1b6eb..dfa152fa 100644 --- a/source/Entity/Player.hpp +++ b/source/Entity/Player.hpp @@ -264,12 +264,12 @@ public: * Retrieve the unique user identifier version 2 of the managed player entity. */ CSStr GetUID2() const; - +#if SQMOD_SDK_LEAST(2, 1) /* -------------------------------------------------------------------------------------------- * Set player's health to 0 and reset the death reason. */ void Kill() const; - +#endif /* -------------------------------------------------------------------------------------------- * Kick the managed player entity from the server. */ @@ -324,7 +324,7 @@ public: * Modify the current option value of the managed player entity. */ void SetOptionEx(Int32 option_id, bool toggle, Int32 header, LightObj & payload); - +#if SQMOD_SDK_LEAST(2, 1) /* -------------------------------------------------------------------------------------------- * Retrieve network statistics related to the managed player entity. */ @@ -334,7 +334,7 @@ public: * Retrieve network statistics related to the managed player entity. */ SQInteger GetNetworkStatisticsI(Int32 option_id) const; - +#endif /* -------------------------------------------------------------------------------------------- * Retrieve the world in which the managed player entity exists. */ @@ -754,7 +754,7 @@ public: * Set the managed player entity to spectate no one. */ void Unspectate() const; - +#if SQMOD_SDK_LEAST(2, 1) /* -------------------------------------------------------------------------------------------- * Set whether the target player will see an objective arrow over a player. */ @@ -784,7 +784,7 @@ public: * Smoothly pivots the camera angle. */ bool InterpolateCameraLookAtEx(Float32 x, Float32 y, Float32 z, Uint32 ms) const; - +#endif /* -------------------------------------------------------------------------------------------- * Redirect the managed player entity to the specified server. */ @@ -800,7 +800,7 @@ public: * Retrieve the authority level of the managed player entity. */ void PlaySound(Int32 sound_id) const; - +#if SQMOD_SDK_LEAST(2, 1) /* -------------------------------------------------------------------------------------------- * Set how delayed a player's turn handling is when in a vehicle. */ @@ -820,7 +820,7 @@ public: * Retrieve how intense the drunk blur overlay is for a player. */ SQInteger GetDrunkVisuals() const; - +#endif /* -------------------------------------------------------------------------------------------- * Create a checkpoint or sphere for this player. */ diff --git a/source/Entity/Vehicle.cpp b/source/Entity/Vehicle.cpp index dcc0d4d5..66175b2c 100644 --- a/source/Entity/Vehicle.cpp +++ b/source/Entity/Vehicle.cpp @@ -1147,7 +1147,7 @@ bool CVehicle::Embark(CPlayer & player, Int32 slot, bool allocate, bool warp) co return (_Func->PutPlayerInVehicle(player.GetID(), m_ID, slot, allocate, warp) != vcmpErrorRequestDenied); } - +#if SQMOD_SDK_LEAST(2, 1) // ------------------------------------------------------------------------------------------------ void CVehicle::SetPlayer3DArrow(CPlayer & target, bool toggle) const { @@ -1183,7 +1183,7 @@ bool CVehicle::GetPlayer3DArrowID(SQInteger id) const // Spectate the given target return _Func->GetVehicle3DArrowForPlayer(m_ID, id); } - +#endif // ------------------------------------------------------------------------------------------------ bool CVehicle::GetCollideAreas() const { @@ -2074,10 +2074,12 @@ void Register_CVehicle(HSQUIRRELVM vm) .Func(_SC("SetHandlingRule"), &CVehicle::SetHandlingRule) .Func(_SC("ResetHandlingRule"), &CVehicle::ResetHandlingRule) .Func(_SC("ResetHandlings"), &CVehicle::ResetHandlings) +#if SQMOD_SDK_LEAST(2, 1) .Func(_SC("SetPlayer3DArrow"), &CVehicle::SetPlayer3DArrow) .Func(_SC("GetPlayer3DArrow"), &CVehicle::GetPlayer3DArrow) .Func(_SC("SetPlayer3DArrowID"), &CVehicle::SetPlayer3DArrowID) .Func(_SC("GetPlayer3DArrowID"), &CVehicle::GetPlayer3DArrowID) +#endif .Func(_SC("AreasCollide"), &CVehicle::SetAreasCollide) // Member Overloads .Overload< void (CVehicle::*)(const Vector3 &, bool) const > diff --git a/source/Entity/Vehicle.hpp b/source/Entity/Vehicle.hpp index 86331a3d..5434fcd2 100644 --- a/source/Entity/Vehicle.hpp +++ b/source/Entity/Vehicle.hpp @@ -621,7 +621,7 @@ public: * Embark the specified player entity into the managed vehicle entity. */ bool Embark(CPlayer & player, Int32 slot, bool allocate, bool warp) const; - +#if SQMOD_SDK_LEAST(2, 1) /* -------------------------------------------------------------------------------------------- * Set whether the target player will see an objective arrow over a vehicle. */ @@ -641,7 +641,7 @@ public: * See whether the target player sees an objective arrow over a vehicle. */ bool GetPlayer3DArrowID(SQInteger id) const; - +#endif /* -------------------------------------------------------------------------------------------- * See whether the managed vehicle entity collides with user defined areas. */ diff --git a/source/Main.cpp b/source/Main.cpp index 6f48f00b..879f580e 100644 --- a/source/Main.cpp +++ b/source/Main.cpp @@ -913,6 +913,7 @@ static void OnEntityPoolChange(vcmpEntityPool entity_type, int32_t entity_id, ui } // ------------------------------------------------------------------------------------------------ +#if SQMOD_SDK_LEAST(2, 1) static void OnEntityStreamingChange(int32_t player_id, int32_t entity_id, vcmpEntityPool entity_type, uint8_t is_deleted) { // Attempt to forward the event @@ -926,7 +927,7 @@ static void OnEntityStreamingChange(int32_t player_id, int32_t entity_id, vcmpEn // See if a reload was requested SQMOD_RELOAD_CHECK(false) } - +#endif // ------------------------------------------------------------------------------------------------ static void OnServerPerformanceReport(size_t /*entry_count*/, CCStr * /*descriptions*/, uint64_t * /*times*/) { @@ -1035,7 +1036,9 @@ SQMOD_API_EXPORT unsigned int VcmpPluginInit(PluginFuncs * funcs, PluginCallback _Clbk->OnEntityPoolChange = OnEntityPoolChange; _Clbk->OnServerPerformanceReport = OnServerPerformanceReport; _Clbk->OnPlayerModuleList = OnPlayerModuleList; +#if SQMOD_SDK_LEAST(2, 1) _Clbk->OnEntityStreamingChange = OnEntityStreamingChange; +#endif // Attempt to initialize the plug-in exports InitExports(); // Dummy spacing diff --git a/source/Misc/Constants.cpp b/source/Misc/Constants.cpp index a599a952..5eb4af36 100644 --- a/source/Misc/Constants.cpp +++ b/source/Misc/Constants.cpp @@ -252,7 +252,9 @@ static const EnumElement g_EntityPoolEnum[] = { {_SC("Object"), vcmpEntityPoolObject}, {_SC("Pickup"), vcmpEntityPoolPickup}, {_SC("Radio"), vcmpEntityPoolRadio}, +#if SQMOD_SDK_LEAST(2, 1) {_SC("Player"), vcmpEntityPoolPlayer}, +#endif {_SC("Blip"), vcmpEntityPoolBlip}, {_SC("Checkpoint"), vcmpEntityPoolCheckPoint}, {_SC("Max"), vcmpEntityPoolCheckPoint} @@ -262,6 +264,9 @@ static const EnumElement g_EntityPoolEnum[] = { static const EnumElement g_PlayerUpdateEnum[] = { {_SC("Unknown"), SQMOD_UNKNOWN}, {_SC("Normal"), vcmpPlayerUpdateNormal}, +#if SQMOD_SDK_PRIOR(2, 1) + {_SC("Aiming"), vcmpPlayerUpdateAiming}, +#endif {_SC("Driver"), vcmpPlayerUpdateDriver}, {_SC("Passenger"), vcmpPlayerUpdatePassenger}, {_SC("Max"), vcmpPlayerUpdatePassenger} @@ -337,8 +342,12 @@ static const EnumElement g_ServerOptionEnum[] = { {_SC("WallGlitch"), vcmpServerOptionWallGlitch}, {_SC("DisableBackfaceCulling"), vcmpServerOptionDisableBackfaceCulling}, {_SC("DisableHeliBladeDamage"), vcmpServerOptionDisableHeliBladeDamage}, +#if SQMOD_SDK_LEAST(2, 1) {_SC("DisableCrouch"), vcmpServerOptionDisableCrouch}, {_SC("Max"), vcmpServerOptionDisableCrouch} +#else + {_SC("Max"), vcmpServerOptionDisableHeliBladeDamage} +#endif }; // ------------------------------------------------------------------------------------------------ @@ -353,8 +362,13 @@ static const EnumElement g_PlayerOptionEnum[] = { {_SC("CanAttack"), vcmpPlayerOptionCanAttack}, {_SC("HasMarker"), vcmpPlayerOptionHasMarker}, {_SC("ChatTagsEnabled"), vcmpPlayerOptionChatTagsEnabled}, +#if SQMOD_SDK_LEAST(2, 1) {_SC("DrunkEffects"), vcmpPlayerOptionBleeding}, {_SC("Max"), vcmpPlayerOptionBleeding} +#else + {_SC("DrunkEffects"), vcmpPlayerOptionDrunkEffects}, + {_SC("Max"), vcmpPlayerOptionDrunkEffects} +#endif }; // ------------------------------------------------------------------------------------------------ @@ -367,10 +381,14 @@ static const EnumElement g_VehicleOptionEnum[] = { {_SC("Ghost"), vcmpVehicleOptionGhost}, {_SC("Siren"), vcmpVehicleOptionSiren}, {_SC("SingleUse"), vcmpVehicleOptionSingleUse}, +#if SQMOD_SDK_LEAST(2, 1) {_SC("EngineDisabled"), vcmpVehicleOptionEngineDisabled}, {_SC("BootOpen"), vcmpVehicleOptionBootOpen}, {_SC("BonnetOpen"), vcmpVehicleOptionBonnetOpen}, - {_SC("Max"), vcmpVehicleOptionBootOpen} + {_SC("Max"), vcmpVehicleOptionBonnetOpen} +#else + {_SC("Max"), vcmpVehicleOptionSingleUse} +#endif }; // ------------------------------------------------------------------------------------------------ @@ -381,6 +399,7 @@ static const EnumElement g_PickupOptionEnum[] = { }; // ------------------------------------------------------------------------------------------------ +#if SQMOD_SDK_LEAST(2, 1) static const EnumElement g_NetworkStatisticsOptionEnum[] = { {_SC("Unknown"), SQMOD_UNKNOWN}, {_SC("DataSentPerSecond"), vcmpNetworkStatisticsOptionDataSentPerSecond}, @@ -402,7 +421,7 @@ static const EnumElement g_NetworkStatisticsOptionEnum[] = { {_SC("PacketLossTotal"), vcmpNetworkStatisticsOptionPacketLossTotal}, {_SC("Max"), vcmpNetworkStatisticsOptionPacketLossTotal} }; - +#endif // ------------------------------------------------------------------------------------------------ static const EnumElement g_BodyPartEnum[] = { {_SC("Unknown"), SQMOD_UNKNOWN}, @@ -1230,7 +1249,9 @@ static const EnumElements g_EnumList[] = { {_SC("SqPlayerOption"), g_PlayerOptionEnum}, {_SC("SqVehicleOption"), g_VehicleOptionEnum}, {_SC("SqPickupOption"), g_PickupOptionEnum}, +#if SQMOD_SDK_LEAST(2, 1) {_SC("NetworkStatisticsOption"), g_NetworkStatisticsOptionEnum}, +#endif {_SC("SqBodyPart"), g_BodyPartEnum}, {_SC("SqPlayerState"), g_PlayerStateEnum}, {_SC("SqPlayerAction"), g_PlayerActionEnum}, diff --git a/source/Misc/Functions.cpp b/source/Misc/Functions.cpp index c0a7c2ff..36fd1090 100644 --- a/source/Misc/Functions.cpp +++ b/source/Misc/Functions.cpp @@ -850,7 +850,7 @@ void SetFallTimer(Uint16 rate) { _Func->SetFallTimer(rate); } - +#if SQMOD_SDK_LEAST(2, 1) // ------------------------------------------------------------------------------------------------ SQFloat GetNetworkStatisticsF(Int32 option_id) { @@ -868,5 +868,5 @@ SQInteger GetNetworkStatisticsI(Int32 option_id) // Return it in the proper type return static_cast< SQInteger >(value); } - +#endif } // Namespace:: SqMod diff --git a/source/Misc/Functions.hpp b/source/Misc/Functions.hpp index 8e287f14..381950ef 100644 --- a/source/Misc/Functions.hpp +++ b/source/Misc/Functions.hpp @@ -478,7 +478,7 @@ Uint16 GetFallTimer(); * Modify the fall timer rate. */ void SetFallTimer(Uint16 rate); - +#if SQMOD_SDK_LEAST(2, 1) /* ------------------------------------------------------------------------------------------------ * Retrieve network statistics related to the server. */ @@ -488,7 +488,7 @@ SQFloat GetNetworkStatisticsF(Int32 option_id); * Retrieve network statistics related to the server. */ SQInteger GetNetworkStatisticsI(Int32 option_id); - +#endif } // Namespace:: SqMod diff --git a/source/Misc/Register.cpp b/source/Misc/Register.cpp index 6846715f..097390b1 100644 --- a/source/Misc/Register.cpp +++ b/source/Misc/Register.cpp @@ -122,8 +122,11 @@ void Register_Misc(HSQUIRRELVM vm) .Func(_SC("GetDistrictNameEx"), &GetDistrictNameEx) .Func(_SC("GetFallTimer"), &GetFallTimer) .Func(_SC("SetFallTimer"), &SetFallTimer) +#if SQMOD_SDK_LEAST(2, 1) .Func(_SC("GetNetworkStatisticsF"), &GetNetworkStatisticsF) - .Func(_SC("GetNetworkStatisticsI"), &GetNetworkStatisticsI); + .Func(_SC("GetNetworkStatisticsI"), &GetNetworkStatisticsI) +#endif + ; // Uggly? I know. But does the job. RootTable(vm).Bind(_SC("SqServer"), srvns); diff --git a/source/SqBase.hpp b/source/SqBase.hpp index 320d12f6..616e298d 100644 --- a/source/SqBase.hpp +++ b/source/SqBase.hpp @@ -121,6 +121,13 @@ #define SQMOD_VERSION_MINOR 0 #define SQMOD_VERSION_PATCH 1 +/* ------------------------------------------------------------------------------------------------ + * VCMP SDK VERSION CHECK. +*/ +#define SQMOD_SDK_MATCH(MJR, MNR) ((PLUGIN_API_MAJOR == MJR) && (PLUGIN_API_MINOR == MNR)) +#define SQMOD_SDK_LEAST(MJR, MNR) ((PLUGIN_API_MAJOR >= MJR) && (PLUGIN_API_MINOR >= MNR)) +#define SQMOD_SDK_PRIOR(MJR, MNR) ((PLUGIN_API_MAJOR < MJR) && (PLUGIN_API_MINOR < MNR)) + /* ------------------------------------------------------------------------------------------------ * SQUIRREL FORWARD DECLARATIONS */