mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-06-15 14:47:13 +02:00
Migrated the host module to C++ exceptions as well.
Also enabled the latest C++ revision in the project. Replaced the Random library with the one provided by C++11. Implemented a simple AES256 encryption class. Various other fixes and improvements.
This commit is contained in:
@ -19,15 +19,20 @@ Uint32 CCheckpoint::s_ColorB;
|
||||
Uint32 CCheckpoint::s_ColorA;
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SQChar CCheckpoint::s_StrID[SQMOD_CHECKPOINT_POOL][8];
|
||||
const Int32 CCheckpoint::Max = SQMOD_CHECKPOINT_POOL;
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
const Int32 CCheckpoint::Max = SQMOD_CHECKPOINT_POOL;
|
||||
SQInteger CCheckpoint::Typename(HSQUIRRELVM vm)
|
||||
{
|
||||
static SQChar name[] = _SC("SqCheckpoint");
|
||||
sq_pushstring(vm, name, sizeof(name));
|
||||
return 1;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
CCheckpoint::CCheckpoint(Int32 id)
|
||||
: m_ID(VALID_ENTITYGETEX(id, SQMOD_CHECKPOINT_POOL))
|
||||
, m_Tag(VALID_ENTITY(m_ID) ? s_StrID[m_ID] : _SC("-1"))
|
||||
, m_Tag(ToStrF("%d", id))
|
||||
{
|
||||
/* ... */
|
||||
}
|
||||
@ -49,282 +54,373 @@ Int32 CCheckpoint::Cmp(const CCheckpoint & o) const
|
||||
return -1;
|
||||
}
|
||||
|
||||
CSStr CCheckpoint::ToString() const
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
const String & CCheckpoint::ToString() const
|
||||
{
|
||||
return VALID_ENTITYEX(m_ID, SQMOD_CHECKPOINT_POOL) ? s_StrID[m_ID] : _SC("-1");
|
||||
return m_Tag;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
CSStr CCheckpoint::GetTag() const
|
||||
const String & CCheckpoint::GetTag() const
|
||||
{
|
||||
return m_Tag.c_str();
|
||||
return m_Tag;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void CCheckpoint::SetTag(CSStr tag)
|
||||
{
|
||||
m_Tag.assign(tag);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Object & CCheckpoint::GetData()
|
||||
{
|
||||
if (Validate())
|
||||
return m_Data;
|
||||
return NullObject();
|
||||
// Validate the managed identifier
|
||||
Validate();
|
||||
// Return the requested information
|
||||
return m_Data;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void CCheckpoint::SetData(Object & data)
|
||||
{
|
||||
if (Validate())
|
||||
m_Data = data;
|
||||
// Validate the managed identifier
|
||||
Validate();
|
||||
// Apply the specified value
|
||||
m_Data = data;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
bool CCheckpoint::Destroy(Int32 header, Object & payload)
|
||||
{
|
||||
// Validate the managed identifier
|
||||
Validate();
|
||||
// Perform the requested operation
|
||||
return _Core->DelCheckpoint(m_ID, header, payload);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
bool CCheckpoint::BindEvent(Int32 evid, Object & env, Function & func) const
|
||||
void CCheckpoint::BindEvent(Int32 evid, Object & env, Function & func) const
|
||||
{
|
||||
if (!Validate())
|
||||
return false;
|
||||
|
||||
// Validate the managed identifier
|
||||
Validate();
|
||||
// Obtain the function instance called for this event
|
||||
Function & event = _Core->GetCheckpointEvent(m_ID, evid);
|
||||
|
||||
// Is the specified callback function null?
|
||||
if (func.IsNull())
|
||||
event.Release();
|
||||
event.Release(); // Then release the current callback
|
||||
// Assign the specified environment and function
|
||||
else
|
||||
event = Function(env.GetVM(), env, func.GetFunc());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
bool CCheckpoint::IsStreamedFor(CPlayer & player) const
|
||||
{
|
||||
// Is the specified player even valid?
|
||||
if (!player.IsActive())
|
||||
SqThrow("Invalid player argument: null");
|
||||
else if (Validate())
|
||||
return _Func->IsCheckpointStreamedForPlayer(m_ID, player.GetID());
|
||||
return false;
|
||||
SqThrowF("Invalid player argument: null");
|
||||
// Validate the managed identifier
|
||||
Validate();
|
||||
// Return the requested information
|
||||
return _Func->IsCheckpointStreamedForPlayer(m_ID, player.GetID());
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Int32 CCheckpoint::GetWorld() const
|
||||
{
|
||||
if (Validate())
|
||||
return _Func->GetCheckpointWorld(m_ID);
|
||||
return -1;
|
||||
// Validate the managed identifier
|
||||
Validate();
|
||||
// Return the requested information
|
||||
return _Func->GetCheckpointWorld(m_ID);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void CCheckpoint::SetWorld(Int32 world) const
|
||||
{
|
||||
if (Validate())
|
||||
_Func->SetCheckpointWorld(m_ID, world);
|
||||
// Validate the managed identifier
|
||||
Validate();
|
||||
// Perform the requested operation
|
||||
_Func->SetCheckpointWorld(m_ID, world);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
const Color4 & CCheckpoint::GetColor() const
|
||||
{
|
||||
// Validate the managed identifier
|
||||
Validate();
|
||||
// Clear previous color information, if any
|
||||
s_Color4.Clear();
|
||||
if (Validate())
|
||||
{
|
||||
_Func->GetCheckpointColor(m_ID, &s_ColorR, &s_ColorG, &s_ColorB, &s_ColorA);
|
||||
s_Color4.Set(s_ColorR, s_ColorG, s_ColorB, s_ColorA);
|
||||
}
|
||||
// Query the server for the color values
|
||||
_Func->GetCheckpointColor(m_ID, &s_ColorR, &s_ColorG, &s_ColorB, &s_ColorA);
|
||||
// Convert and assign the retrieved values
|
||||
s_Color4.Set(s_ColorR, s_ColorG, s_ColorB, s_ColorA);
|
||||
// Return the requested information
|
||||
return s_Color4;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void CCheckpoint::SetColor(const Color4 & col) const
|
||||
{
|
||||
if (Validate())
|
||||
_Func->SetCheckpointColor(m_ID, col.r, col.g, col.b, col.a);
|
||||
// Validate the managed identifier
|
||||
Validate();
|
||||
// Perform the requested operation
|
||||
_Func->SetCheckpointColor(m_ID, col.r, col.g, col.b, col.a);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void CCheckpoint::SetColorEx(Uint8 r, Uint8 g, Uint8 b, Uint8 a) const
|
||||
{
|
||||
if (Validate())
|
||||
_Func->SetCheckpointColor(m_ID, r, g, b, a);
|
||||
// Validate the managed identifier
|
||||
Validate();
|
||||
// Perform the requested operation
|
||||
_Func->SetCheckpointColor(m_ID, r, g, b, a);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
const Vector3 & CCheckpoint::GetPosition() const
|
||||
{
|
||||
// Validate the managed identifier
|
||||
Validate();
|
||||
// Clear previous position information, if any
|
||||
s_Vector3.Clear();
|
||||
if (Validate())
|
||||
_Func->GetCheckpointPos(m_ID, &s_Vector3.x, &s_Vector3.y, &s_Vector3.z);
|
||||
// Query the server for the position values
|
||||
_Func->GetCheckpointPos(m_ID, &s_Vector3.x, &s_Vector3.y, &s_Vector3.z);
|
||||
// Return the requested information
|
||||
return s_Vector3;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void CCheckpoint::SetPosition(const Vector3 & pos) const
|
||||
{
|
||||
if (Validate())
|
||||
_Func->SetCheckpointPos(m_ID, pos.x, pos.y, pos.z);
|
||||
// Validate the managed identifier
|
||||
Validate();
|
||||
// Perform the requested operation
|
||||
_Func->SetCheckpointPos(m_ID, pos.x, pos.y, pos.z);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void CCheckpoint::SetPositionEx(Float32 x, Float32 y, Float32 z) const
|
||||
{
|
||||
if (Validate())
|
||||
_Func->SetCheckpointPos(m_ID, x, y, z);
|
||||
// Validate the managed identifier
|
||||
Validate();
|
||||
// Perform the requested operation
|
||||
_Func->SetCheckpointPos(m_ID, x, y, z);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Float32 CCheckpoint::GetRadius() const
|
||||
{
|
||||
if (Validate())
|
||||
_Func->GetCheckpointRadius(m_ID);
|
||||
return 0;
|
||||
// Validate the managed identifier
|
||||
Validate();
|
||||
// Return the requested information
|
||||
return _Func->GetCheckpointRadius(m_ID);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void CCheckpoint::SetRadius(Float32 radius) const
|
||||
{
|
||||
if (Validate())
|
||||
_Func->SetCheckpointRadius(m_ID, radius);
|
||||
// Validate the managed identifier
|
||||
Validate();
|
||||
// Perform the requested operation
|
||||
_Func->SetCheckpointRadius(m_ID, radius);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Object & CCheckpoint::GetOwner() const
|
||||
{
|
||||
if (Validate())
|
||||
return _Core->GetPlayer(_Func->GetCheckpointOwner(m_ID)).mObj;
|
||||
return NullObject();
|
||||
// Validate the managed identifier
|
||||
Validate();
|
||||
// Return the requested information
|
||||
return _Core->GetPlayer(_Func->GetCheckpointOwner(m_ID)).mObj;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Int32 CCheckpoint::GetOwnerID() const
|
||||
{
|
||||
if (Validate())
|
||||
return _Func->GetCheckpointOwner(m_ID);
|
||||
return -1;
|
||||
// Validate the managed identifier
|
||||
Validate();
|
||||
// Return the requested information
|
||||
return _Func->GetCheckpointOwner(m_ID);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Float32 CCheckpoint::GetPosX() const
|
||||
{
|
||||
// Validate the managed identifier
|
||||
Validate();
|
||||
// Clear previous position information, if any
|
||||
s_Vector3.x = 0;
|
||||
if (Validate())
|
||||
_Func->GetCheckpointPos(m_ID, &s_Vector3.x, NULL, NULL);
|
||||
// Query the server for the requested component value
|
||||
_Func->GetCheckpointPos(m_ID, &s_Vector3.x, NULL, NULL);
|
||||
// Return the requested information
|
||||
return s_Vector3.x;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Float32 CCheckpoint::GetPosY() const
|
||||
{
|
||||
// Validate the managed identifier
|
||||
Validate();
|
||||
// Clear previous position information, if any
|
||||
s_Vector3.y = 0;
|
||||
if (Validate())
|
||||
_Func->GetCheckpointPos(m_ID, NULL, &s_Vector3.y, NULL);
|
||||
// Query the server for the requested component value
|
||||
_Func->GetCheckpointPos(m_ID, NULL, &s_Vector3.y, NULL);
|
||||
// Return the requested information
|
||||
return s_Vector3.y;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Float32 CCheckpoint::GetPosZ() const
|
||||
{
|
||||
// Validate the managed identifier
|
||||
Validate();
|
||||
// Clear previous position information, if any
|
||||
s_Vector3.z = 0;
|
||||
if (Validate())
|
||||
_Func->GetCheckpointPos(m_ID, NULL, NULL, &s_Vector3.z);
|
||||
// Query the server for the requested component value
|
||||
_Func->GetCheckpointPos(m_ID, NULL, NULL, &s_Vector3.z);
|
||||
// Return the requested information
|
||||
return s_Vector3.z;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void CCheckpoint::SetPosX(Float32 x) const
|
||||
{
|
||||
if (Validate())
|
||||
{
|
||||
_Func->GetCheckpointPos(m_ID, NULL, &s_Vector3.y, &s_Vector3.z);
|
||||
_Func->SetCheckpointPos(m_ID, x, s_Vector3.y, s_Vector3.z);
|
||||
}
|
||||
// Validate the managed identifier
|
||||
Validate();
|
||||
// Retrieve the current values for unchanged components
|
||||
_Func->GetCheckpointPos(m_ID, NULL, &s_Vector3.y, &s_Vector3.z);
|
||||
// Perform the requested operation
|
||||
_Func->SetCheckpointPos(m_ID, x, s_Vector3.y, s_Vector3.z);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void CCheckpoint::SetPosY(Float32 y) const
|
||||
{
|
||||
if (Validate())
|
||||
{
|
||||
_Func->GetCheckpointPos(m_ID, &s_Vector3.x, NULL, &s_Vector3.z);
|
||||
_Func->SetCheckpointPos(m_ID, s_Vector3.x, y, s_Vector3.z);
|
||||
}
|
||||
// Validate the managed identifier
|
||||
Validate();
|
||||
// Retrieve the current values for unchanged components
|
||||
_Func->GetCheckpointPos(m_ID, &s_Vector3.x, NULL, &s_Vector3.z);
|
||||
// Perform the requested operation
|
||||
_Func->SetCheckpointPos(m_ID, s_Vector3.x, y, s_Vector3.z);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void CCheckpoint::SetPosZ(Float32 z) const
|
||||
{
|
||||
if (Validate())
|
||||
{
|
||||
_Func->GetCheckpointPos(m_ID, &s_Vector3.x, &s_Vector3.y, NULL);
|
||||
_Func->SetCheckpointPos(m_ID, s_Vector3.z, s_Vector3.y, z);
|
||||
}
|
||||
// Validate the managed identifier
|
||||
Validate();
|
||||
// Retrieve the current values for unchanged components
|
||||
_Func->GetCheckpointPos(m_ID, &s_Vector3.x, &s_Vector3.y, NULL);
|
||||
// Perform the requested operation
|
||||
_Func->SetCheckpointPos(m_ID, s_Vector3.z, s_Vector3.y, z);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Uint32 CCheckpoint::GetColR() const
|
||||
{
|
||||
// Validate the managed identifier
|
||||
Validate();
|
||||
// Clear previous color information, if any
|
||||
s_ColorR = 0;
|
||||
if (Validate())
|
||||
_Func->GetCheckpointColor(m_ID, &s_ColorR, NULL, NULL, NULL);
|
||||
// Query the server for the requested component value
|
||||
_Func->GetCheckpointColor(m_ID, &s_ColorR, NULL, NULL, NULL);
|
||||
// Return the requested information
|
||||
return s_ColorR;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Uint32 CCheckpoint::GetColG() const
|
||||
{
|
||||
// Validate the managed identifier
|
||||
Validate();
|
||||
// Clear previous color information, if any
|
||||
s_ColorG = 0;
|
||||
if (Validate())
|
||||
_Func->GetCheckpointColor(m_ID, NULL, &s_ColorG, NULL, NULL);
|
||||
// Query the server for the requested component value
|
||||
_Func->GetCheckpointColor(m_ID, NULL, &s_ColorG, NULL, NULL);
|
||||
// Return the requested information
|
||||
return s_ColorG;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Uint32 CCheckpoint::GetColB() const
|
||||
{
|
||||
// Validate the managed identifier
|
||||
Validate();
|
||||
// Clear previous color information, if any
|
||||
s_ColorB = 0;
|
||||
if (Validate())
|
||||
_Func->GetCheckpointColor(m_ID, NULL, NULL, &s_ColorB, NULL);
|
||||
// Query the server for the requested component value
|
||||
_Func->GetCheckpointColor(m_ID, NULL, NULL, &s_ColorB, NULL);
|
||||
// Return the requested information
|
||||
return s_ColorB;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Uint32 CCheckpoint::GetColA() const
|
||||
{
|
||||
// Validate the managed identifier
|
||||
Validate();
|
||||
// Clear previous color information, if any
|
||||
s_ColorA = 0;
|
||||
if (Validate())
|
||||
_Func->GetCheckpointColor(m_ID, NULL, NULL, NULL, &s_ColorA);
|
||||
// Query the server for the requested component value
|
||||
_Func->GetCheckpointColor(m_ID, NULL, NULL, NULL, &s_ColorA);
|
||||
// Return the requested information
|
||||
return s_ColorA;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void CCheckpoint::SetColR(Uint32 r) const
|
||||
{
|
||||
if (Validate())
|
||||
{
|
||||
_Func->GetCheckpointColor(m_ID, NULL, &s_ColorG, &s_ColorB, &s_ColorA);
|
||||
_Func->SetCheckpointColor(m_ID, r, s_ColorG, s_ColorB, s_ColorA);
|
||||
}
|
||||
}
|
||||
|
||||
void CCheckpoint::SetColG(Uint32 g) const
|
||||
{
|
||||
if (Validate())
|
||||
{
|
||||
_Func->GetCheckpointColor(m_ID, &s_ColorR, NULL, &s_ColorB, &s_ColorA);
|
||||
_Func->SetCheckpointColor(m_ID, s_ColorR, g, s_ColorB, s_ColorA);
|
||||
}
|
||||
}
|
||||
|
||||
void CCheckpoint::SetColB(Uint32 b) const
|
||||
{
|
||||
if (Validate())
|
||||
{
|
||||
_Func->GetCheckpointColor(m_ID, &s_ColorB, &s_ColorG, NULL, &s_ColorA);
|
||||
_Func->SetCheckpointColor(m_ID, s_ColorB, s_ColorG, b, s_ColorA);
|
||||
}
|
||||
}
|
||||
|
||||
void CCheckpoint::SetColA(Uint32 a) const
|
||||
{
|
||||
if (Validate())
|
||||
{
|
||||
_Func->GetCheckpointColor(m_ID, &s_ColorA, &s_ColorG, &s_ColorB, NULL);
|
||||
_Func->SetCheckpointColor(m_ID, s_ColorA, s_ColorG, s_ColorB, a);
|
||||
}
|
||||
// Validate the managed identifier
|
||||
Validate();
|
||||
// Retrieve the current values for unchanged components
|
||||
_Func->GetCheckpointColor(m_ID, NULL, &s_ColorG, &s_ColorB, &s_ColorA);
|
||||
// Perform the requested operation
|
||||
_Func->SetCheckpointColor(m_ID, r, s_ColorG, s_ColorB, s_ColorA);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static Object & CreateCheckpointEx(CPlayer & player, Int32 world, Float32 x, Float32 y, Float32 z,
|
||||
void CCheckpoint::SetColG(Uint32 g) const
|
||||
{
|
||||
// Validate the managed identifier
|
||||
Validate();
|
||||
// Retrieve the current values for unchanged components
|
||||
_Func->GetCheckpointColor(m_ID, &s_ColorR, NULL, &s_ColorB, &s_ColorA);
|
||||
// Perform the requested operation
|
||||
_Func->SetCheckpointColor(m_ID, s_ColorR, g, s_ColorB, s_ColorA);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void CCheckpoint::SetColB(Uint32 b) const
|
||||
{
|
||||
// Validate the managed identifier
|
||||
Validate();
|
||||
// Retrieve the current values for unchanged components
|
||||
_Func->GetCheckpointColor(m_ID, &s_ColorB, &s_ColorG, NULL, &s_ColorA);
|
||||
// Perform the requested operation
|
||||
_Func->SetCheckpointColor(m_ID, s_ColorB, s_ColorG, b, s_ColorA);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void CCheckpoint::SetColA(Uint32 a) const
|
||||
{
|
||||
// Validate the managed identifier
|
||||
Validate();
|
||||
// Retrieve the current values for unchanged components
|
||||
_Func->GetCheckpointColor(m_ID, &s_ColorA, &s_ColorG, &s_ColorB, NULL);
|
||||
// Perform the requested operation
|
||||
_Func->SetCheckpointColor(m_ID, s_ColorA, s_ColorG, s_ColorB, a);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static Object & Checkpoint_CreateEx(CPlayer & player, Int32 world, Float32 x, Float32 y, Float32 z,
|
||||
Uint8 r, Uint8 g, Uint8 b, Uint8 a, Float32 radius)
|
||||
{
|
||||
return _Core->NewCheckpoint(player.GetID(), world, x, y, z, r, g, b, a, radius,
|
||||
SQMOD_CREATE_DEFAULT, NullObject());
|
||||
}
|
||||
|
||||
static Object & CreateCheckpointEx(CPlayer & player, Int32 world, Float32 x, Float32 y, Float32 z,
|
||||
static Object & Checkpoint_CreateEx(CPlayer & player, Int32 world, Float32 x, Float32 y, Float32 z,
|
||||
Uint8 r, Uint8 g, Uint8 b, Uint8 a, Float32 radius,
|
||||
Int32 header, Object & payload)
|
||||
{
|
||||
@ -332,7 +428,7 @@ static Object & CreateCheckpointEx(CPlayer & player, Int32 world, Float32 x, Flo
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static Object & CreateCheckpoint(CPlayer & player, Int32 world, const Vector3 & pos,
|
||||
static Object & Checkpoint_Create(CPlayer & player, Int32 world, const Vector3 & pos,
|
||||
const Color4 & color, Float32 radius)
|
||||
{
|
||||
return _Core->NewCheckpoint(player.GetID(), world, pos.x, pos.y, pos.z,
|
||||
@ -340,7 +436,7 @@ static Object & CreateCheckpoint(CPlayer & player, Int32 world, const Vector3 &
|
||||
SQMOD_CREATE_DEFAULT, NullObject());
|
||||
}
|
||||
|
||||
static Object & CreateCheckpoint(CPlayer & player, Int32 world, const Vector3 & pos,
|
||||
static Object & Checkpoint_Create(CPlayer & player, Int32 world, const Vector3 & pos,
|
||||
const Color4 & color, Float32 radius, Int32 header, Object & payload)
|
||||
{
|
||||
return _Core->NewCheckpoint(player.GetID(), world, pos.x, pos.y, pos.z,
|
||||
@ -352,22 +448,24 @@ void Register_CCheckpoint(HSQUIRRELVM vm)
|
||||
{
|
||||
RootTable(vm).Bind(_SC("SqCheckpoint"),
|
||||
Class< CCheckpoint, NoConstructor< CCheckpoint > >(vm, _SC("SqCheckpoint"))
|
||||
/* Metamethods */
|
||||
// Metamethods
|
||||
.Func(_SC("_cmp"), &CCheckpoint::Cmp)
|
||||
.SquirrelFunc(_SC("_typename"), &CCheckpoint::Typename)
|
||||
.Func(_SC("_tostring"), &CCheckpoint::ToString)
|
||||
/* Core Properties */
|
||||
// Static values
|
||||
.SetStaticValue(_SC("MaxID"), CCheckpoint::Max)
|
||||
// Core Properties
|
||||
.Prop(_SC("ID"), &CCheckpoint::GetID)
|
||||
.Prop(_SC("Tag"), &CCheckpoint::GetTag, &CCheckpoint::SetTag)
|
||||
.Prop(_SC("Data"), &CCheckpoint::GetData, &CCheckpoint::SetData)
|
||||
.Prop(_SC("MaxID"), &CCheckpoint::GetMaxID)
|
||||
.Prop(_SC("Active"), &CCheckpoint::IsActive)
|
||||
/* Core Functions */
|
||||
// Core Functions
|
||||
.Func(_SC("Bind"), &CCheckpoint::BindEvent)
|
||||
/* Core Overloads */
|
||||
// Core Overloads
|
||||
.Overload< bool (CCheckpoint::*)(void) >(_SC("Destroy"), &CCheckpoint::Destroy)
|
||||
.Overload< bool (CCheckpoint::*)(Int32) >(_SC("Destroy"), &CCheckpoint::Destroy)
|
||||
.Overload< bool (CCheckpoint::*)(Int32, Object &) >(_SC("Destroy"), &CCheckpoint::Destroy)
|
||||
/* Properties */
|
||||
// Properties
|
||||
.Prop(_SC("World"), &CCheckpoint::GetWorld, &CCheckpoint::SetWorld)
|
||||
.Prop(_SC("Color"), &CCheckpoint::GetColor, &CCheckpoint::SetColor)
|
||||
.Prop(_SC("Pos"), &CCheckpoint::GetPosition, &CCheckpoint::SetPosition)
|
||||
@ -382,22 +480,21 @@ void Register_CCheckpoint(HSQUIRRELVM vm)
|
||||
.Prop(_SC("G"), &CCheckpoint::GetColG, &CCheckpoint::SetColG)
|
||||
.Prop(_SC("B"), &CCheckpoint::GetColB, &CCheckpoint::SetColB)
|
||||
.Prop(_SC("A"), &CCheckpoint::GetColA, &CCheckpoint::SetColA)
|
||||
/* Functions */
|
||||
// Functions
|
||||
.Func(_SC("StreamedFor"), &CCheckpoint::IsStreamedFor)
|
||||
.Func(_SC("SetColor"), &CCheckpoint::SetColorEx)
|
||||
.Func(_SC("SetPos"), &CCheckpoint::SetPositionEx)
|
||||
.Func(_SC("SetPosition"), &CCheckpoint::SetPositionEx)
|
||||
// Static Overloads
|
||||
.StaticOverload< Object & (*)(CPlayer &, Int32, Float32, Float32, Float32, Uint8, Uint8, Uint8, Uint8, Float32) >
|
||||
(_SC("CreateEx"), &Checkpoint_CreateEx)
|
||||
.StaticOverload< Object & (*)(CPlayer &, Int32, Float32, Float32, Float32, Uint8, Uint8, Uint8, Uint8, Float32, Int32, Object &) >
|
||||
(_SC("CreateEx"), &Checkpoint_CreateEx)
|
||||
.StaticOverload< Object & (*)(CPlayer &, Int32, const Vector3 &, const Color4 &, Float32) >
|
||||
(_SC("Create"), &Checkpoint_Create)
|
||||
.StaticOverload< Object & (*)(CPlayer &, Int32, const Vector3 &, const Color4 &, Float32, Int32, Object &) >
|
||||
(_SC("Create"), &Checkpoint_Create)
|
||||
);
|
||||
|
||||
RootTable(vm)
|
||||
.Overload< Object & (*)(CPlayer &, Int32, Float32, Float32, Float32, Uint8, Uint8, Uint8, Uint8, Float32) >
|
||||
(_SC("CreateCheckpointEx"), &CreateCheckpointEx)
|
||||
.Overload< Object & (*)(CPlayer &, Int32, Float32, Float32, Float32, Uint8, Uint8, Uint8, Uint8, Float32, Int32, Object &) >
|
||||
(_SC("CreateCheckpointEx"), &CreateCheckpointEx)
|
||||
.Overload< Object & (*)(CPlayer &, Int32, const Vector3 &, const Color4 &, Float32) >
|
||||
(_SC("CreateCheckpoint"), &CreateCheckpoint)
|
||||
.Overload< Object & (*)(CPlayer &, Int32, const Vector3 &, const Color4 &, Float32, Int32, Object &) >
|
||||
(_SC("CreateCheckpoint"), &CreateCheckpoint);
|
||||
}
|
||||
|
||||
} // Namespace:: SqMod
|
||||
} // Namespace:: SqMod
|
||||
|
Reference in New Issue
Block a user