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

Implement .Legacy member for native entity types.

This commit is contained in:
Sandu Liviu Catalin 2022-07-23 22:09:30 +03:00
parent 2f428962c8
commit 4618577ae4
10 changed files with 95 additions and 1 deletions

View File

@ -468,6 +468,16 @@ void CCheckpoint::SetColorA(int32_t a) const
// Perform the requested operation // Perform the requested operation
_Func->SetCheckPointColour(m_ID, r, g, b, a); _Func->SetCheckPointColour(m_ID, r, g, b, a);
} }
#ifdef VCMP_ENABLE_OFFICIAL
// ------------------------------------------------------------------------------------------------
LightObj & CCheckpoint::GetLegacyObject() const
{
// Validate the managed identifier
Validate();
// Return the requested information
return Core::Get().GetCheckpoint(m_ID).mLgObj;
}
#endif
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
static LightObj & Checkpoint_CreateEx1a(int32_t world, bool sphere, float x, float y, float z, static LightObj & Checkpoint_CreateEx1a(int32_t world, bool sphere, float x, float y, float z,
@ -517,6 +527,9 @@ void Register_CCheckpoint(HSQUIRRELVM vm)
.Prop(_SC("Tag"), &CCheckpoint::GetTag, &CCheckpoint::SetTag) .Prop(_SC("Tag"), &CCheckpoint::GetTag, &CCheckpoint::SetTag)
.Prop(_SC("Data"), &CCheckpoint::GetData, &CCheckpoint::SetData) .Prop(_SC("Data"), &CCheckpoint::GetData, &CCheckpoint::SetData)
.Prop(_SC("Active"), &CCheckpoint::IsActive) .Prop(_SC("Active"), &CCheckpoint::IsActive)
#ifdef VCMP_ENABLE_OFFICIAL
.Prop(_SC("Legacy"), &CCheckpoint::GetLegacyObject)
#endif
// Core Methods // Core Methods
.FmtFunc(_SC("SetTag"), &CCheckpoint::ApplyTag) .FmtFunc(_SC("SetTag"), &CCheckpoint::ApplyTag)
.Func(_SC("CustomEvent"), &CCheckpoint::CustomEvent) .Func(_SC("CustomEvent"), &CCheckpoint::CustomEvent)

View File

@ -320,6 +320,12 @@ public:
* Modify the alpha transparency of the managed checkpoint entity. * Modify the alpha transparency of the managed checkpoint entity.
*/ */
void SetColorA(int32_t a) const; void SetColorA(int32_t a) const;
#ifdef VCMP_ENABLE_OFFICIAL
/* --------------------------------------------------------------------------------------------
* Retrieve legacy object instance for this entity.
*/
LightObj & GetLegacyObject() const;
#endif
}; };
} // Namespace:: SqMod } // Namespace:: SqMod

View File

@ -833,6 +833,16 @@ void CObject::RotateByEulerZ(float z) const
// Perform the requested operation // Perform the requested operation
_Func->RotateObjectByEuler(m_ID, 0.0f, 0.0f, z, mRotateByEulerDuration); _Func->RotateObjectByEuler(m_ID, 0.0f, 0.0f, z, mRotateByEulerDuration);
} }
#ifdef VCMP_ENABLE_OFFICIAL
// ------------------------------------------------------------------------------------------------
LightObj & CObject::GetLegacyObject() const
{
// Validate the managed identifier
Validate();
// Return the requested information
return Core::Get().GetObj(m_ID).mLgObj;
}
#endif
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
static LightObj & Object_CreateEx1a(int32_t model, int32_t world, float x, float y, float z, static LightObj & Object_CreateEx1a(int32_t model, int32_t world, float x, float y, float z,
@ -883,6 +893,9 @@ void Register_CObject(HSQUIRRELVM vm)
.Prop(_SC("Tag"), &CObject::GetTag, &CObject::SetTag) .Prop(_SC("Tag"), &CObject::GetTag, &CObject::SetTag)
.Prop(_SC("Data"), &CObject::GetData, &CObject::SetData) .Prop(_SC("Data"), &CObject::GetData, &CObject::SetData)
.Prop(_SC("Active"), &CObject::IsActive) .Prop(_SC("Active"), &CObject::IsActive)
#ifdef VCMP_ENABLE_OFFICIAL
.Prop(_SC("Legacy"), &CObject::GetLegacyObject)
#endif
// Core Methods // Core Methods
.FmtFunc(_SC("SetTag"), &CObject::ApplyTag) .FmtFunc(_SC("SetTag"), &CObject::ApplyTag)
.Func(_SC("CustomEvent"), &CObject::CustomEvent) .Func(_SC("CustomEvent"), &CObject::CustomEvent)

View File

@ -499,6 +499,12 @@ public:
* Modify the rotation on the z axis of the managed object entity. * Modify the rotation on the z axis of the managed object entity.
*/ */
void RotateByEulerZ(float z) const; void RotateByEulerZ(float z) const;
#ifdef VCMP_ENABLE_OFFICIAL
/* --------------------------------------------------------------------------------------------
* Retrieve legacy object instance for this entity.
*/
LightObj & GetLegacyObject() const;
#endif
}; };
} // Namespace:: SqMod } // Namespace:: SqMod

View File

@ -449,6 +449,16 @@ void CPickup::SetPositionZ(float z) const
// Perform the requested operation // Perform the requested operation
_Func->SetPickupPosition(m_ID, z, y, z); _Func->SetPickupPosition(m_ID, z, y, z);
} }
#ifdef VCMP_ENABLE_OFFICIAL
// ------------------------------------------------------------------------------------------------
LightObj & CPickup::GetLegacyObject() const
{
// Validate the managed identifier
Validate();
// Return the requested information
return Core::Get().GetPickup(m_ID).mLgObj;
}
#endif
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
static LightObj & Pickup_CreateEx1a(int32_t model, int32_t world, int32_t quantity, static LightObj & Pickup_CreateEx1a(int32_t model, int32_t world, int32_t quantity,
@ -496,6 +506,9 @@ void Register_CPickup(HSQUIRRELVM vm)
.Prop(_SC("Tag"), &CPickup::GetTag, &CPickup::SetTag) .Prop(_SC("Tag"), &CPickup::GetTag, &CPickup::SetTag)
.Prop(_SC("Data"), &CPickup::GetData, &CPickup::SetData) .Prop(_SC("Data"), &CPickup::GetData, &CPickup::SetData)
.Prop(_SC("Active"), &CPickup::IsActive) .Prop(_SC("Active"), &CPickup::IsActive)
#ifdef VCMP_ENABLE_OFFICIAL
.Prop(_SC("Legacy"), &CPickup::GetLegacyObject)
#endif
// Core Methods // Core Methods
.FmtFunc(_SC("SetTag"), &CPickup::ApplyTag) .FmtFunc(_SC("SetTag"), &CPickup::ApplyTag)
.Func(_SC("CustomEvent"), &CPickup::CustomEvent) .Func(_SC("CustomEvent"), &CPickup::CustomEvent)

View File

@ -298,6 +298,12 @@ public:
* Modify the position on the z axis of the managed pickup entity. * Modify the position on the z axis of the managed pickup entity.
*/ */
void SetPositionZ(float z) const; void SetPositionZ(float z) const;
#ifdef VCMP_ENABLE_OFFICIAL
/* --------------------------------------------------------------------------------------------
* Retrieve legacy object instance for this entity.
*/
LightObj & GetLegacyObject() const;
#endif
}; };
} // Namespace:: SqMod } // Namespace:: SqMod

View File

@ -2593,7 +2593,16 @@ SQInteger CPlayer::AnnounceEx(HSQUIRRELVM vm)
// This function does not return a value // This function does not return a value
return 0; return 0;
} }
#ifdef VCMP_ENABLE_OFFICIAL
// ------------------------------------------------------------------------------------------------
LightObj & CPlayer::GetLegacyObject() const
{
// Validate the managed identifier
Validate();
// Return the requested information
return Core::Get().GetPlayer(m_ID).mLgObj;
}
#endif
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
SQInteger Player_FindAuto(HSQUIRRELVM vm) SQInteger Player_FindAuto(HSQUIRRELVM vm)
{ {
@ -2793,6 +2802,9 @@ void Register_CPlayer(HSQUIRRELVM vm)
.Prop(_SC("Tag"), &CPlayer::GetTag, &CPlayer::SetTag) .Prop(_SC("Tag"), &CPlayer::GetTag, &CPlayer::SetTag)
.Prop(_SC("Data"), &CPlayer::GetData, &CPlayer::SetData) .Prop(_SC("Data"), &CPlayer::GetData, &CPlayer::SetData)
.Prop(_SC("Active"), &CPlayer::IsActive) .Prop(_SC("Active"), &CPlayer::IsActive)
#ifdef VCMP_ENABLE_OFFICIAL
.Prop(_SC("Legacy"), &CPlayer::GetLegacyObject)
#endif
// Core Methods // Core Methods
.FmtFunc(_SC("SetTag"), &CPlayer::ApplyTag) .FmtFunc(_SC("SetTag"), &CPlayer::ApplyTag)
.Func(_SC("CustomEvent"), &CPlayer::CustomEvent) .Func(_SC("CustomEvent"), &CPlayer::CustomEvent)

View File

@ -1101,6 +1101,12 @@ public:
* Send a formatted announcement message to the managed player entity. * Send a formatted announcement message to the managed player entity.
*/ */
static SQInteger AnnounceEx(HSQUIRRELVM vm); static SQInteger AnnounceEx(HSQUIRRELVM vm);
#ifdef VCMP_ENABLE_OFFICIAL
/* --------------------------------------------------------------------------------------------
* Retrieve legacy object instance for this entity.
*/
LightObj & GetLegacyObject() const;
#endif
}; };
} // Namespace:: SqMod } // Namespace:: SqMod

View File

@ -2015,6 +2015,16 @@ void CVehicle::SetRelativeTurnSpeedZ(float z) const
// Perform the requested operation // Perform the requested operation
_Func->SetVehicleTurnSpeed(m_ID, z, y, z, static_cast< uint8_t >(false), static_cast< uint8_t >(true)); _Func->SetVehicleTurnSpeed(m_ID, z, y, z, static_cast< uint8_t >(false), static_cast< uint8_t >(true));
} }
#ifdef VCMP_ENABLE_OFFICIAL
// ------------------------------------------------------------------------------------------------
LightObj & CVehicle::GetLegacyObject() const
{
// Validate the managed identifier
Validate();
// Return the requested information
return Core::Get().GetVehicle(m_ID).mLgObj;
}
#endif
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
static LightObj & Vehicle_CreateEx1a(int32_t model, int32_t world, float x, float y, float z, float angle, static LightObj & Vehicle_CreateEx1a(int32_t model, int32_t world, float x, float y, float z, float angle,
@ -2061,6 +2071,9 @@ void Register_CVehicle(HSQUIRRELVM vm)
.Prop(_SC("ID"), &CVehicle::GetID) .Prop(_SC("ID"), &CVehicle::GetID)
.Prop(_SC("Tag"), &CVehicle::GetTag, &CVehicle::SetTag) .Prop(_SC("Tag"), &CVehicle::GetTag, &CVehicle::SetTag)
.Prop(_SC("Data"), &CVehicle::GetData, &CVehicle::SetData) .Prop(_SC("Data"), &CVehicle::GetData, &CVehicle::SetData)
#ifdef VCMP_ENABLE_OFFICIAL
.Prop(_SC("Legacy"), &CVehicle::GetLegacyObject)
#endif
.Prop(_SC("Active"), &CVehicle::IsActive) .Prop(_SC("Active"), &CVehicle::IsActive)
// Core Methods // Core Methods
.FmtFunc(_SC("SetTag"), &CVehicle::ApplyTag) .FmtFunc(_SC("SetTag"), &CVehicle::ApplyTag)

View File

@ -942,6 +942,12 @@ public:
* Modify the relative turn velocity on the z axis of the managed vehicle entity. * Modify the relative turn velocity on the z axis of the managed vehicle entity.
*/ */
void SetRelativeTurnSpeedZ(float z) const; void SetRelativeTurnSpeedZ(float z) const;
#ifdef VCMP_ENABLE_OFFICIAL
/* --------------------------------------------------------------------------------------------
* Retrieve legacy object instance for this entity.
*/
LightObj & GetLegacyObject() const;
#endif
}; };
} // Namespace:: SqMod } // Namespace:: SqMod