Identified object size and solidtype as flags. Exported them as functions to Perl.

This commit is contained in:
SecretsOTheP 2014-11-14 18:22:06 -05:00
parent e02e6099aa
commit 51b6db977f
4 changed files with 148 additions and 0 deletions

View File

@ -1,6 +1,9 @@
EQEMu Changelog (Started on Sept 24, 2003 15:50)
-------------------------------------------------------
== 11/14/2014 ==
Secrets: Identified object size and solidtype as flags. Exported them as functions to Perl.
== 11/13/2014 ==
Kayen: Implemented target type (44) 'Beams' (which projects an AE infront of caster with a specified length and width).
Kayen: Implemented target type (32) AE Target HateList

View File

@ -798,6 +798,42 @@ void Object::SetModelName(const char* modelname)
safe_delete(app2);
}
void Object::SetSize(uint16 size)
{
m_data.unknown008 = size;
EQApplicationPacket* app = new EQApplicationPacket();
EQApplicationPacket* app2 = new EQApplicationPacket();
this->CreateDeSpawnPacket(app);
this->CreateSpawnPacket(app2);
entity_list.QueueClients(0, app);
entity_list.QueueClients(0, app2);
safe_delete(app);
safe_delete(app2);
}
void Object::SetSolidType(uint16 solidtype)
{
m_data.unknown010 = solidtype;
EQApplicationPacket* app = new EQApplicationPacket();
EQApplicationPacket* app2 = new EQApplicationPacket();
this->CreateDeSpawnPacket(app);
this->CreateSpawnPacket(app2);
entity_list.QueueClients(0, app);
entity_list.QueueClients(0, app2);
safe_delete(app);
safe_delete(app2);
}
uint16 Object::GetSize()
{
return m_data.unknown008;
}
uint16 Object::GetSolidType()
{
return m_data.unknown010;
}
const char* Object::GetModelName()
{
return this->m_data.object_name;

View File

@ -157,6 +157,10 @@ public:
void SetZ(float pos);
void SetModelName(const char* modelname);
const char* GetModelName();
uint16 GetSize();
void SetSize(uint16 size);
uint16 GetSolidType();
void SetSolidType(uint16 size);
const char* GetEntityVariable(const char *id);
void SetEntityVariable(const char *id, const char *m_var);

View File

@ -909,6 +909,107 @@ XS(XS_Object_SetEntityVariable)
XSRETURN_EMPTY;
}
XS(XS_Object_GetSolidType); /* prototype to pass -Wmissing-prototypes */
XS(XS_Object_GetSolidType)
{
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Object::GetSolidType(THIS)");
{
Object * THIS;
uint16 RETVAL;
dXSTARG;
if (sv_derived_from(ST(0), "Object")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Object *,tmp);
}
else
Perl_croak(aTHX_ "THIS is not of type Object");
if(THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetSolidType();
XSprePUSH; PUSHu((UV)RETVAL);
}
XSRETURN(1);
}
XS(XS_Object_SetSolidType); /* prototype to pass -Wmissing-prototypes */
XS(XS_Object_SetSolidType)
{
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Object::SetSolidType(THIS, type)");
{
Object * THIS;
uint16 type = (uint16)SvUV(ST(1));
if (sv_derived_from(ST(0), "Object")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Object *,tmp);
}
else
Perl_croak(aTHX_ "THIS is not of type Object");
if(THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->SetSolidType(type);
}
XSRETURN_EMPTY;
}
XS(XS_Object_GetSize); /* prototype to pass -Wmissing-prototypes */
XS(XS_Object_GetSize)
{
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: Object::GetSize(THIS)");
{
Object * THIS;
uint16 RETVAL;
dXSTARG;
if (sv_derived_from(ST(0), "Object")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Object *,tmp);
}
else
Perl_croak(aTHX_ "THIS is not of type Object");
if(THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
RETVAL = THIS->GetSize();
XSprePUSH; PUSHu((UV)RETVAL);
}
XSRETURN(1);
}
XS(XS_Object_SetSize); /* prototype to pass -Wmissing-prototypes */
XS(XS_Object_SetSize)
{
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Object::SetSize(THIS, type)");
{
Object * THIS;
uint16 size = (uint16)SvUV(ST(1));
if (sv_derived_from(ST(0), "Object")) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
THIS = INT2PTR(Object *,tmp);
}
else
Perl_croak(aTHX_ "THIS is not of type Object");
if(THIS == nullptr)
Perl_croak(aTHX_ "THIS is nullptr, avoiding crash.");
THIS->SetSize(size);
}
XSRETURN_EMPTY;
}
#ifdef __cplusplus
extern "C"
@ -961,6 +1062,10 @@ XS(boot_Object)
newXSproto(strcpy(buf, "GetEntityVariable"), XS_Object_GetEntityVariable, file, "$$");
newXSproto(strcpy(buf, "SetEntityVariable"), XS_Object_SetEntityVariable, file, "$$$");
newXSproto(strcpy(buf, "EntityVariableExists"), XS_Object_EntityVariableExists, file, "$$");
newXSproto(strcpy(buf, "SetSolidType"),XS_Object_SetSolidType, file, "$$");
newXSproto(strcpy(buf, "GetSolidType"),XS_Object_GetSolidType, file, "$");
newXSproto(strcpy(buf, "SetSize"),XS_Object_SetSize, file, "$$");
newXSproto(strcpy(buf, "GetSize"),XS_Object_GetSize, file, "$");
XSRETURN_YES;
}
#endif //EMBPERL_XS_CLASSES