diff --git a/changelog.txt b/changelog.txt index aac15127e..eac7536d8 100644 --- a/changelog.txt +++ b/changelog.txt @@ -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 diff --git a/zone/object.cpp b/zone/object.cpp index 51d0e924a..0201434c0 100644 --- a/zone/object.cpp +++ b/zone/object.cpp @@ -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; diff --git a/zone/object.h b/zone/object.h index da41d9815..9f5cb8cb3 100644 --- a/zone/object.h +++ b/zone/object.h @@ -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); diff --git a/zone/perl_object.cpp b/zone/perl_object.cpp index 9c71ec6ed..036d555a1 100644 --- a/zone/perl_object.cpp +++ b/zone/perl_object.cpp @@ -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