2015-09-30 02:56:11 +02:00
|
|
|
#include "Entity/Blip.hpp"
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
namespace SqMod {
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-10-29 21:07:15 +01:00
|
|
|
SQInteger CBlip::GetWorld() const noexcept
|
|
|
|
{
|
|
|
|
if (VALID_ENTITY(m_ID))
|
|
|
|
{
|
|
|
|
RefType::Get(m_ID).World;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
LogWrn(_SC("Attempting to <get blip world> using an invalid reference: %d"), m_ID);
|
|
|
|
}
|
|
|
|
return SQMOD_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
SQInteger CBlip::GetScale() const noexcept
|
|
|
|
{
|
|
|
|
if (VALID_ENTITY(m_ID))
|
|
|
|
{
|
|
|
|
RefType::Get(m_ID).Scale;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
LogWrn(_SC("Attempting to <get blip scale> using an invalid reference: %d"), m_ID);
|
|
|
|
}
|
|
|
|
return SQMOD_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
const Vector3 & CBlip::GetPosition() const noexcept
|
|
|
|
{
|
|
|
|
if (VALID_ENTITY(m_ID))
|
|
|
|
{
|
|
|
|
RefType::Get(m_ID).Position;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
LogWrn(_SC("Attempting to <get blip position> using an invalid reference: %d"), m_ID);
|
|
|
|
}
|
|
|
|
|
|
|
|
return Vector3::NIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
SQFloat CBlip::GetPositionX() const noexcept
|
|
|
|
{
|
|
|
|
if (VALID_ENTITY(m_ID))
|
|
|
|
{
|
|
|
|
RefType::Get(m_ID).Position.x;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
LogWrn(_SC("Attempting to <get blip position> using an invalid reference: %d"), m_ID);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
SQFloat CBlip::GetPositionY() const noexcept
|
|
|
|
{
|
|
|
|
if (VALID_ENTITY(m_ID))
|
|
|
|
{
|
|
|
|
RefType::Get(m_ID).Position.y;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
LogWrn(_SC("Attempting to <get blip position> using an invalid reference: %d"), m_ID);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
SQFloat CBlip::GetPositionZ() const noexcept
|
|
|
|
{
|
|
|
|
if (VALID_ENTITY(m_ID))
|
|
|
|
{
|
|
|
|
RefType::Get(m_ID).Position.z;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
LogWrn(_SC("Attempting to <get blip position> using an invalid reference: %d"), m_ID);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
const Color4 & CBlip::GetColor() const noexcept
|
|
|
|
{
|
|
|
|
if (VALID_ENTITY(m_ID))
|
|
|
|
{
|
|
|
|
RefType::Get(m_ID).Color;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
LogWrn(_SC("Attempting to <get blip color> using an invalid reference: %d"), m_ID);
|
|
|
|
}
|
|
|
|
|
|
|
|
return Color4::NIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
SQInt32 CBlip::GetSprID() const noexcept
|
|
|
|
{
|
|
|
|
if (VALID_ENTITY(m_ID))
|
|
|
|
{
|
|
|
|
RefType::Get(m_ID).SprID;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
LogWrn(_SC("Attempting to <get blip sprite> using an invalid reference: %d"), m_ID);
|
|
|
|
}
|
|
|
|
|
|
|
|
return SQMOD_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ================================================================================================
|
2015-09-30 02:56:11 +02:00
|
|
|
bool Register_CBlip(HSQUIRRELVM vm)
|
|
|
|
{
|
2015-10-29 21:07:15 +01:00
|
|
|
// Attempt to register the base reference type before the actual implementation
|
2015-09-30 02:56:11 +02:00
|
|
|
if (!Register_Reference< CBlip >(vm, _SC("BaseBlip")))
|
|
|
|
{
|
2015-10-29 21:07:15 +01:00
|
|
|
LogFtl("Unable to register the base class <BaseBlip> for <CBlip> type");
|
|
|
|
// Registration failed
|
2015-09-30 02:56:11 +02:00
|
|
|
return false;
|
|
|
|
}
|
2015-10-29 21:07:15 +01:00
|
|
|
// Output debugging information
|
2015-09-30 02:56:11 +02:00
|
|
|
LogDbg("Beginning registration of <CBlip> type");
|
2015-10-29 21:07:15 +01:00
|
|
|
// Attempt to register the actual reference that implements all of the entity functionality
|
2015-09-30 02:56:11 +02:00
|
|
|
Sqrat::RootTable(vm).Bind(_SC("CBlip"), Sqrat::DerivedClass< CBlip, Reference< CBlip > >(vm, _SC("CBlip"))
|
2015-10-29 21:07:15 +01:00
|
|
|
/* Constructors */
|
2015-09-30 02:56:11 +02:00
|
|
|
.Ctor()
|
|
|
|
.Ctor< SQInt32 >()
|
2015-10-29 21:07:15 +01:00
|
|
|
/* Properties */
|
|
|
|
.Prop(_SC("world"), &CBlip::GetWorld)
|
|
|
|
.Prop(_SC("scale"), &CBlip::GetScale)
|
|
|
|
.Prop(_SC("pos"), &CBlip::GetPosition)
|
|
|
|
.Prop(_SC("position"), &CBlip::GetPosition)
|
|
|
|
.Prop(_SC("color"), &CBlip::GetColor)
|
|
|
|
.Prop(_SC("spr_id"), &CBlip::GetSprID)
|
|
|
|
.Prop(_SC("pos_x"), &CBlip::GetPositionX)
|
|
|
|
.Prop(_SC("pos_y"), &CBlip::GetPositionY)
|
|
|
|
.Prop(_SC("pos_z"), &CBlip::GetPositionZ)
|
2015-09-30 02:56:11 +02:00
|
|
|
);
|
2015-10-29 21:07:15 +01:00
|
|
|
// Output debugging information
|
2015-09-30 02:56:11 +02:00
|
|
|
LogDbg("Registration of <CBlip> type was successful");
|
2015-10-29 21:07:15 +01:00
|
|
|
// Registration succeeded
|
2015-09-30 02:56:11 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // Namespace:: SqMod
|