1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-26 22:37:45 +00:00

fix rotation in objectspawn ipc and send it too

This commit is contained in:
Adam 2018-03-04 17:41:17 +11:00
parent 7659521233
commit bb35edd56b
5 changed files with 11 additions and 8 deletions

View file

@ -1327,15 +1327,15 @@ struct FFXIVIpcObjectSpawn : FFXIVIpcBasePacket<ObjectSpawn>
uint32_t hierachyId;
float scale;
int16_t unknown20a;
uint16_t unknown20b;
uint16_t rotation;
int16_t unknown24a;
int16_t unknown24b;
uint16_t unknown28a;
int16_t unknown28c;
uint32_t unknown2C;
Common::FFXIVARR_POSITION3 position;
int16_t rotation;
int16_t unknown;
int16_t unknown3C;
int16_t unknown3E;
};
struct FFXIVIpcObjectDespawn : FFXIVIpcBasePacket<ObjectDespawn>

View file

@ -9,6 +9,7 @@
#include <common/Network/CommonNetwork.h>
#include <common/Network/PacketDef/Zone/ServerZoneDef.h>
#include <common/Network/PacketContainer.h>
#include <common/Util/UtilMath.h>
using namespace Core::Common;
using namespace Core::Network::Packets;
@ -19,7 +20,7 @@ extern Core::Logger g_log;
Core::Entity::EventObject::EventObject( uint32_t actorId, uint32_t objectId, uint32_t mapLinkId,
uint8_t initialState, Common::FFXIVARR_POSITION3 pos,
const std::string& givenName ) :
float rotation, const std::string& givenName ) :
Core::Entity::Actor( ObjKind::EventObj ),
m_mapLinkId( mapLinkId ),
m_state( initialState ),
@ -30,6 +31,7 @@ Core::Entity::EventObject::EventObject( uint32_t actorId, uint32_t objectId, uin
m_pos.x = pos.x;
m_pos.y = pos.y;
m_pos.z = pos.z;
m_rot = rotation;
}
uint32_t Core::Entity::EventObject::getMapLinkId() const
@ -112,6 +114,7 @@ void Core::Entity::EventObject::spawn( Core::Entity::PlayerPtr pTarget )
eobjStatePacket.data().position = getPos();
eobjStatePacket.data().scale = getScale();
eobjStatePacket.data().actorId = getId();
eobjStatePacket.data().rotation = Math::Util::floatToUInt16Rot( getRot() );
pTarget->queuePacket( eobjStatePacket );
}

View file

@ -11,7 +11,7 @@ namespace Entity
{
public:
EventObject( uint32_t actorId, uint32_t objectId, uint32_t mapLinkId, uint8_t initialState, Common::FFXIVARR_POSITION3 pos,
const std::string& givenName = "none" );
float rotation, const std::string& givenName = "none" );
using OnTalkEventHandler = std::function< void( Entity::Player&, Entity::EventObjectPtr, InstanceContentPtr, uint64_t ) >;

View file

@ -693,9 +693,9 @@ uint32_t Core::Zone::getNextEObjId()
}
Core::Entity::EventObjectPtr Core::Zone::registerEObj( const std::string &name, uint32_t objectId, uint32_t mapLink,
uint8_t state, FFXIVARR_POSITION3 pos, float scale )
uint8_t state, FFXIVARR_POSITION3 pos, float scale, float rotation )
{
auto eObj = Entity::make_EventObject( getNextEObjId(), objectId, mapLink, state, pos, name );
auto eObj = Entity::make_EventObject( getNextEObjId(), objectId, mapLink, state, pos, rotation, name );
eObj->setScale( scale );
registerEObj( eObj );

View file

@ -114,7 +114,7 @@ public:
void updateSessions( bool changedWeather );
Entity::EventObjectPtr registerEObj( const std::string& name, uint32_t objectId, uint32_t mapLink,
uint8_t state, Common::FFXIVARR_POSITION3 pos, float scale );
uint8_t state, Common::FFXIVARR_POSITION3 pos, float scale, float rotation );
void registerEObj( Entity::EventObjectPtr object );
Entity::EventObjectPtr getEObj( uint32_t objId );