1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 00:37:15 +01:00

Candidate for backwards compatibility.

This commit is contained in:
Sandu Liviu Catalin 2020-03-20 20:37:17 +02:00
parent f32a7f59f0
commit b269517e6f
16 changed files with 1181 additions and 117 deletions

View File

@ -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;

1042
include/vcmp.new.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -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;

View File

@ -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)
{

View File

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

View File

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

View File

@ -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)

View File

@ -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.
*/

View File

@ -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 >

View File

@ -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.
*/

View File

@ -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

View File

@ -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},

View File

@ -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

View File

@ -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

View File

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

View File

@ -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
*/