forked from mirror/openmw-tes3mp
[Client] Allow multiple WorldObjects to be added to a WorldEvent
This commit is contained in:
parent
32284787de
commit
dcc61a095a
13 changed files with 378 additions and 262 deletions
|
@ -73,7 +73,9 @@ namespace MWGui
|
|||
the inventory screen
|
||||
*/
|
||||
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
|
||||
worldEvent->sendObjectPlace(dropped);
|
||||
worldEvent->reset();
|
||||
worldEvent->addObjectPlace(dropped);
|
||||
worldEvent->sendObjectPlace();
|
||||
/*
|
||||
End of tes3mp addition
|
||||
*/
|
||||
|
|
|
@ -666,7 +666,9 @@ namespace MWGui
|
|||
by the player
|
||||
*/
|
||||
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
|
||||
worldEvent->sendObjectDelete(object);
|
||||
worldEvent->reset();
|
||||
worldEvent->addObjectDelete(object);
|
||||
worldEvent->sendObjectDelete();
|
||||
mwmp::Main::get().getLocalPlayer()->sendInventory();
|
||||
/*
|
||||
End of tes3mp addition
|
||||
|
|
|
@ -72,7 +72,9 @@ namespace MWMechanics
|
|||
Send an ID_OBJECT_UNLOCK packet every time an object is unlocked
|
||||
*/
|
||||
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
|
||||
worldEvent->sendObjectUnlock(lock);
|
||||
worldEvent->reset();
|
||||
worldEvent->addObjectUnlock(lock);
|
||||
worldEvent->sendObjectUnlock();
|
||||
/*
|
||||
End of tes3mp addition
|
||||
*/
|
||||
|
|
|
@ -45,6 +45,8 @@ osg::Vec3f MechanicsHelper::getLinearInterpolation(osg::Vec3f start, osg::Vec3f
|
|||
void MechanicsHelper::spawnLeveledCreatures(MWWorld::CellStore* cellStore)
|
||||
{
|
||||
MWWorld::CellRefList<ESM::CreatureLevList> *creatureLevList = cellStore->getCreatureLists();
|
||||
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
|
||||
worldEvent->reset();
|
||||
|
||||
for (typename MWWorld::CellRefList<ESM::CreatureLevList>::List::iterator listIter(creatureLevList->mList.begin());
|
||||
listIter != creatureLevList->mList.end(); ++listIter)
|
||||
|
@ -61,12 +63,12 @@ void MechanicsHelper::spawnLeveledCreatures(MWWorld::CellStore* cellStore)
|
|||
MWWorld::ManualRef manualRef(store, id);
|
||||
manualRef.getPtr().getCellRef().setPosition(ptr.getCellRef().getPosition());
|
||||
MWWorld::Ptr placed = MWBase::Environment::get().getWorld()->placeObject(manualRef.getPtr(), ptr.getCell(), ptr.getCellRef().getPosition());
|
||||
|
||||
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
|
||||
worldEvent->sendObjectPlace(placed);
|
||||
worldEvent->addObjectPlace(placed);
|
||||
MWBase::Environment::get().getWorld()->deleteObject(placed);
|
||||
}
|
||||
}
|
||||
|
||||
worldEvent->sendObjectPlace();
|
||||
}
|
||||
|
||||
Attack *MechanicsHelper::getLocalAttack(const MWWorld::Ptr& ptr)
|
||||
|
|
|
@ -450,6 +450,297 @@ void WorldEvent::playVideo()
|
|||
}
|
||||
}
|
||||
|
||||
void WorldEvent::addObjectPlace(const MWWorld::Ptr& ptr)
|
||||
{
|
||||
cell = *ptr.getCell()->getCell();
|
||||
|
||||
mwmp::WorldObject worldObject;
|
||||
worldObject.refId = ptr.getCellRef().getRefId();
|
||||
worldObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex;
|
||||
worldObject.mpNum = 0;
|
||||
worldObject.charge = ptr.getCellRef().getCharge();
|
||||
|
||||
// Make sure we send the RefData position instead of the CellRef one, because that's what
|
||||
// we actually see on this client
|
||||
worldObject.position = ptr.getRefData().getPosition();
|
||||
|
||||
// We have to get the count from the dropped object because it gets changed
|
||||
// automatically for stacks of gold
|
||||
worldObject.count = ptr.getRefData().getCount();
|
||||
|
||||
// Get the real count of gold in a stack
|
||||
worldObject.goldValue = ptr.getCellRef().getGoldValue();
|
||||
|
||||
addObject(worldObject);
|
||||
}
|
||||
|
||||
void WorldEvent::addObjectDelete(const MWWorld::Ptr& ptr)
|
||||
{
|
||||
cell = *ptr.getCell()->getCell();
|
||||
|
||||
mwmp::WorldObject worldObject;
|
||||
worldObject.refId = ptr.getCellRef().getRefId();
|
||||
worldObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex;
|
||||
worldObject.mpNum = ptr.getCellRef().getMpNum();
|
||||
addObject(worldObject);
|
||||
}
|
||||
|
||||
void WorldEvent::addObjectLock(const MWWorld::Ptr& ptr, int lockLevel)
|
||||
{
|
||||
cell = *ptr.getCell()->getCell();
|
||||
|
||||
mwmp::WorldObject worldObject;
|
||||
worldObject.refId = ptr.getCellRef().getRefId();
|
||||
worldObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex;
|
||||
worldObject.mpNum = ptr.getCellRef().getMpNum();
|
||||
worldObject.lockLevel = lockLevel;
|
||||
addObject(worldObject);
|
||||
}
|
||||
|
||||
void WorldEvent::addObjectUnlock(const MWWorld::Ptr& ptr)
|
||||
{
|
||||
cell = *ptr.getCell()->getCell();
|
||||
|
||||
mwmp::WorldObject worldObject;
|
||||
worldObject.refId = ptr.getCellRef().getRefId();
|
||||
worldObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex;
|
||||
worldObject.mpNum = ptr.getCellRef().getMpNum();
|
||||
addObject(worldObject);
|
||||
}
|
||||
|
||||
void WorldEvent::addObjectScale(const MWWorld::Ptr& ptr, float scale)
|
||||
{
|
||||
cell = *ptr.getCell()->getCell();
|
||||
|
||||
mwmp::WorldObject worldObject;
|
||||
worldObject.refId = ptr.getCellRef().getRefId();
|
||||
worldObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex;
|
||||
worldObject.mpNum = ptr.getCellRef().getMpNum();
|
||||
worldObject.scale = scale;
|
||||
addObject(worldObject);
|
||||
}
|
||||
|
||||
void WorldEvent::addObjectAnimPlay(const MWWorld::Ptr& ptr, std::string group, int mode)
|
||||
{
|
||||
cell = *ptr.getCell()->getCell();
|
||||
|
||||
mwmp::WorldObject worldObject;
|
||||
worldObject.refId = ptr.getCellRef().getRefId();
|
||||
worldObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex;
|
||||
worldObject.mpNum = ptr.getCellRef().getMpNum();
|
||||
worldObject.animGroup = group;
|
||||
worldObject.animMode = mode;
|
||||
addObject(worldObject);
|
||||
}
|
||||
|
||||
void WorldEvent::addDoorState(const MWWorld::Ptr& ptr, int state)
|
||||
{
|
||||
cell = *ptr.getCell()->getCell();
|
||||
|
||||
mwmp::WorldObject worldObject;
|
||||
worldObject.refId = ptr.getCellRef().getRefId();
|
||||
worldObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex;
|
||||
worldObject.mpNum = ptr.getCellRef().getMpNum();
|
||||
worldObject.doorState = state;
|
||||
addObject(worldObject);
|
||||
}
|
||||
|
||||
void WorldEvent::addMusicPlay(std::string filename)
|
||||
{
|
||||
mwmp::WorldObject worldObject;
|
||||
worldObject.filename = filename;
|
||||
addObject(worldObject);
|
||||
}
|
||||
|
||||
void WorldEvent::addVideoPlay(std::string filename, bool allowSkipping)
|
||||
{
|
||||
mwmp::WorldObject worldObject;
|
||||
worldObject.filename = filename;
|
||||
worldObject.allowSkipping = allowSkipping;
|
||||
addObject(worldObject);
|
||||
}
|
||||
|
||||
void WorldEvent::addScriptLocalShort(const MWWorld::Ptr& ptr, int index, int shortVal)
|
||||
{
|
||||
cell = *ptr.getCell()->getCell();
|
||||
|
||||
mwmp::WorldObject worldObject;
|
||||
worldObject.refId = ptr.getCellRef().getRefId();
|
||||
worldObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex;
|
||||
worldObject.mpNum = ptr.getCellRef().getMpNum();
|
||||
worldObject.index = index;
|
||||
worldObject.shortVal = shortVal;
|
||||
addObject(worldObject);
|
||||
}
|
||||
|
||||
void WorldEvent::addScriptLocalFloat(const MWWorld::Ptr& ptr, int index, float floatVal)
|
||||
{
|
||||
cell = *ptr.getCell()->getCell();
|
||||
|
||||
mwmp::WorldObject worldObject;
|
||||
worldObject.refId = ptr.getCellRef().getRefId();
|
||||
worldObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex;
|
||||
worldObject.mpNum = ptr.getCellRef().getMpNum();
|
||||
worldObject.index = index;
|
||||
worldObject.floatVal = floatVal;
|
||||
addObject(worldObject);
|
||||
}
|
||||
|
||||
void WorldEvent::addScriptMemberShort(std::string refId, int index, int shortVal)
|
||||
{
|
||||
mwmp::WorldObject worldObject;
|
||||
worldObject.refId = refId;
|
||||
worldObject.index = index;
|
||||
worldObject.shortVal = shortVal;
|
||||
addObject(worldObject);
|
||||
}
|
||||
|
||||
void WorldEvent::addScriptGlobalShort(std::string varName, int shortVal)
|
||||
{
|
||||
mwmp::WorldObject worldObject;
|
||||
worldObject.varName = varName;
|
||||
worldObject.shortVal = shortVal;
|
||||
addObject(worldObject);
|
||||
}
|
||||
|
||||
void WorldEvent::sendObjectPlace()
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_OBJECT_PLACE about %s", cell.getDescription().c_str());
|
||||
|
||||
for (std::vector<mwmp::WorldObject>::iterator it = objectChanges.objects.begin(); it != objectChanges.objects.end(); ++it)
|
||||
{
|
||||
mwmp::WorldObject worldObject = (*it);
|
||||
|
||||
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s-%i, count: %i",
|
||||
worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.count);
|
||||
}
|
||||
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_PLACE)->setEvent(this);
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_PLACE)->Send();
|
||||
}
|
||||
|
||||
void WorldEvent::sendObjectDelete()
|
||||
{
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_DELETE)->setEvent(this);
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_DELETE)->Send();
|
||||
}
|
||||
|
||||
void WorldEvent::sendObjectLock()
|
||||
{
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_LOCK)->setEvent(this);
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_LOCK)->Send();
|
||||
}
|
||||
|
||||
void WorldEvent::sendObjectUnlock()
|
||||
{
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_UNLOCK)->setEvent(this);
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_UNLOCK)->Send();
|
||||
}
|
||||
|
||||
void WorldEvent::sendObjectScale()
|
||||
{
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_SCALE)->setEvent(this);
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_SCALE)->Send();
|
||||
}
|
||||
|
||||
void WorldEvent::sendObjectAnimPlay()
|
||||
{
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_ANIM_PLAY)->setEvent(this);
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_ANIM_PLAY)->Send();
|
||||
}
|
||||
|
||||
void WorldEvent::sendDoorState()
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_DOOR_STATE about %s", cell.getDescription().c_str());
|
||||
|
||||
for (std::vector<mwmp::WorldObject>::iterator it = objectChanges.objects.begin(); it != objectChanges.objects.end(); ++it)
|
||||
{
|
||||
mwmp::WorldObject worldObject = (*it);
|
||||
|
||||
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s-%i, state: %s",
|
||||
worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.doorState ? "true" : "false");
|
||||
}
|
||||
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_DOOR_STATE)->setEvent(this);
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_DOOR_STATE)->Send();
|
||||
}
|
||||
|
||||
void WorldEvent::sendMusicPlay()
|
||||
{
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_MUSIC_PLAY)->setEvent(this);
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_MUSIC_PLAY)->Send();
|
||||
}
|
||||
|
||||
void WorldEvent::sendVideoPlay()
|
||||
{
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_VIDEO_PLAY)->setEvent(this);
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_VIDEO_PLAY)->Send();
|
||||
}
|
||||
|
||||
void WorldEvent::sendScriptLocalShort()
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_SCRIPT_LOCAL_SHORT about %s", cell.getDescription().c_str());
|
||||
|
||||
for (std::vector<mwmp::WorldObject>::iterator it = objectChanges.objects.begin(); it != objectChanges.objects.end(); ++it)
|
||||
{
|
||||
mwmp::WorldObject worldObject = (*it);
|
||||
|
||||
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s-%i, index: %i, shortVal: %i",
|
||||
worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.index, worldObject.shortVal);
|
||||
}
|
||||
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_LOCAL_SHORT)->setEvent(this);
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_LOCAL_SHORT)->Send();
|
||||
}
|
||||
|
||||
void WorldEvent::sendScriptLocalFloat()
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_SCRIPT_LOCAL_FLOAT about %s", cell.getDescription().c_str());
|
||||
|
||||
for (std::vector<mwmp::WorldObject>::iterator it = objectChanges.objects.begin(); it != objectChanges.objects.end(); ++it)
|
||||
{
|
||||
mwmp::WorldObject worldObject = (*it);
|
||||
|
||||
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s-%i, index: %i, floatVal: %f",
|
||||
worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.index, worldObject.floatVal);
|
||||
}
|
||||
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_LOCAL_FLOAT)->setEvent(this);
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_LOCAL_FLOAT)->Send();
|
||||
}
|
||||
|
||||
void WorldEvent::sendScriptMemberShort()
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_SCRIPT_MEMBER_SHORT");
|
||||
|
||||
for (std::vector<mwmp::WorldObject>::iterator it = objectChanges.objects.begin(); it != objectChanges.objects.end(); ++it)
|
||||
{
|
||||
mwmp::WorldObject worldObject = (*it);
|
||||
|
||||
LOG_APPEND(Log::LOG_VERBOSE, "- cellRef: %s, index: %i, shortVal: %i",
|
||||
worldObject.refId.c_str(), worldObject.index, worldObject.shortVal);
|
||||
}
|
||||
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_MEMBER_SHORT)->setEvent(this);
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_MEMBER_SHORT)->Send();
|
||||
}
|
||||
|
||||
void WorldEvent::sendScriptGlobalShort()
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_SCRIPT_GLOBAL_SHORT");
|
||||
|
||||
for (std::vector<mwmp::WorldObject>::iterator it = objectChanges.objects.begin(); it != objectChanges.objects.end(); ++it)
|
||||
{
|
||||
mwmp::WorldObject worldObject = (*it);
|
||||
|
||||
LOG_APPEND(Log::LOG_VERBOSE, "- varName: %s, shortVal: %i",
|
||||
worldObject.varName.c_str(), worldObject.shortVal);
|
||||
}
|
||||
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_GLOBAL_SHORT)->setEvent(this);
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_GLOBAL_SHORT)->Send();
|
||||
}
|
||||
|
||||
void WorldEvent::sendContainers(MWWorld::CellStore* cellStore)
|
||||
{
|
||||
reset();
|
||||
|
@ -488,230 +779,3 @@ void WorldEvent::sendContainers(MWWorld::CellStore* cellStore)
|
|||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_CONTAINER)->setEvent(this);
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_CONTAINER)->Send();
|
||||
}
|
||||
|
||||
|
||||
void WorldEvent::sendObjectPlace(MWWorld::Ptr ptr)
|
||||
{
|
||||
reset();
|
||||
cell = *ptr.getCell()->getCell();
|
||||
|
||||
mwmp::WorldObject worldObject;
|
||||
worldObject.refId = ptr.getCellRef().getRefId();
|
||||
worldObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex;
|
||||
worldObject.mpNum = 0;
|
||||
worldObject.charge = ptr.getCellRef().getCharge();
|
||||
|
||||
// Make sure we send the RefData position instead of the CellRef one, because that's what
|
||||
// we actually see on this client
|
||||
worldObject.position = ptr.getRefData().getPosition();
|
||||
|
||||
// We have to get the count from the dropped object because it gets changed
|
||||
// automatically for stacks of gold
|
||||
worldObject.count = ptr.getRefData().getCount();
|
||||
|
||||
// Get the real count of gold in a stack
|
||||
worldObject.goldValue = ptr.getCellRef().getGoldValue();
|
||||
|
||||
addObject(worldObject);
|
||||
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_PLACE)->setEvent(this);
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_PLACE)->Send();
|
||||
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_OBJECT_PLACE\n- cellRef: %s, %i\n- count: %i",
|
||||
worldObject.refId.c_str(), worldObject.refNumIndex, worldObject.count);
|
||||
}
|
||||
|
||||
void WorldEvent::sendObjectDelete(MWWorld::Ptr ptr)
|
||||
{
|
||||
reset();
|
||||
cell = *ptr.getCell()->getCell();
|
||||
|
||||
mwmp::WorldObject worldObject;
|
||||
worldObject.refId = ptr.getCellRef().getRefId();
|
||||
worldObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex;
|
||||
worldObject.mpNum = ptr.getCellRef().getMpNum();
|
||||
addObject(worldObject);
|
||||
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_DELETE)->setEvent(this);
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_DELETE)->Send();
|
||||
}
|
||||
|
||||
void WorldEvent::sendObjectLock(MWWorld::Ptr ptr, int lockLevel)
|
||||
{
|
||||
reset();
|
||||
cell = *ptr.getCell()->getCell();
|
||||
|
||||
mwmp::WorldObject worldObject;
|
||||
worldObject.refId = ptr.getCellRef().getRefId();
|
||||
worldObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex;
|
||||
worldObject.mpNum = ptr.getCellRef().getMpNum();
|
||||
worldObject.lockLevel = lockLevel;
|
||||
addObject(worldObject);
|
||||
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_LOCK)->setEvent(this);
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_LOCK)->Send();
|
||||
}
|
||||
|
||||
void WorldEvent::sendObjectUnlock(MWWorld::Ptr ptr)
|
||||
{
|
||||
reset();
|
||||
cell = *ptr.getCell()->getCell();
|
||||
|
||||
mwmp::WorldObject worldObject;
|
||||
worldObject.refId = ptr.getCellRef().getRefId();
|
||||
worldObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex;
|
||||
worldObject.mpNum = ptr.getCellRef().getMpNum();
|
||||
addObject(worldObject);
|
||||
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_UNLOCK)->setEvent(this);
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_UNLOCK)->Send();
|
||||
}
|
||||
|
||||
void WorldEvent::sendObjectScale(MWWorld::Ptr ptr, float scale)
|
||||
{
|
||||
reset();
|
||||
cell = *ptr.getCell()->getCell();
|
||||
|
||||
mwmp::WorldObject worldObject;
|
||||
worldObject.refId = ptr.getCellRef().getRefId();
|
||||
worldObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex;
|
||||
worldObject.mpNum = ptr.getCellRef().getMpNum();
|
||||
worldObject.scale = scale;
|
||||
addObject(worldObject);
|
||||
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_SCALE)->setEvent(this);
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_SCALE)->Send();
|
||||
}
|
||||
|
||||
void WorldEvent::sendObjectAnimPlay(MWWorld::Ptr ptr, std::string group, int mode)
|
||||
{
|
||||
reset();
|
||||
cell = *ptr.getCell()->getCell();
|
||||
|
||||
mwmp::WorldObject worldObject;
|
||||
worldObject.refId = ptr.getCellRef().getRefId();
|
||||
worldObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex;
|
||||
worldObject.mpNum = ptr.getCellRef().getMpNum();
|
||||
worldObject.animGroup = group;
|
||||
worldObject.animMode = mode;
|
||||
addObject(worldObject);
|
||||
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_ANIM_PLAY)->setEvent(this);
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_ANIM_PLAY)->Send();
|
||||
}
|
||||
|
||||
void WorldEvent::sendDoorState(MWWorld::Ptr ptr, int state)
|
||||
{
|
||||
reset();
|
||||
cell = *ptr.getCell()->getCell();
|
||||
|
||||
mwmp::WorldObject worldObject;
|
||||
worldObject.refId = ptr.getCellRef().getRefId();
|
||||
worldObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex;
|
||||
worldObject.mpNum = ptr.getCellRef().getMpNum();
|
||||
worldObject.doorState = state;
|
||||
addObject(worldObject);
|
||||
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_DOOR_STATE)->setEvent(this);
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_DOOR_STATE)->Send();
|
||||
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Door activation 1\n- cellRef: %s, %i\n- cell: %s\n- state: %s",
|
||||
worldObject.refId.c_str(), worldObject.refNumIndex, cell.getDescription().c_str(),
|
||||
worldObject.doorState ? "true" : "false");
|
||||
}
|
||||
|
||||
void WorldEvent::sendMusicPlay(std::string filename)
|
||||
{
|
||||
reset();
|
||||
mwmp::WorldObject worldObject;
|
||||
worldObject.filename = filename;
|
||||
addObject(worldObject);
|
||||
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_MUSIC_PLAY)->setEvent(this);
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_MUSIC_PLAY)->Send();
|
||||
}
|
||||
|
||||
void WorldEvent::sendVideoPlay(std::string filename, bool allowSkipping)
|
||||
{
|
||||
reset();
|
||||
mwmp::WorldObject worldObject;
|
||||
worldObject.filename = filename;
|
||||
worldObject.allowSkipping = allowSkipping;
|
||||
addObject(worldObject);
|
||||
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_VIDEO_PLAY)->setEvent(this);
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_VIDEO_PLAY)->Send();
|
||||
}
|
||||
|
||||
void WorldEvent::sendScriptLocalShort(MWWorld::Ptr ptr, int index, int shortVal)
|
||||
{
|
||||
reset();
|
||||
cell = *ptr.getCell()->getCell();
|
||||
|
||||
mwmp::WorldObject worldObject;
|
||||
worldObject.refId = ptr.getCellRef().getRefId();
|
||||
worldObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex;
|
||||
worldObject.mpNum = ptr.getCellRef().getMpNum();
|
||||
worldObject.index = index;
|
||||
worldObject.shortVal = shortVal;
|
||||
addObject(worldObject);
|
||||
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_LOCAL_SHORT)->setEvent(this);
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_LOCAL_SHORT)->Send();
|
||||
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_SCRIPT_LOCAL_SHORT\n- cellRef: %s, %i\n- cell: %s\n- index: %i\n- shortVal: %i",
|
||||
worldObject.refId.c_str(), worldObject.refNumIndex, cell.getDescription().c_str(),
|
||||
worldObject.index, worldObject.shortVal);
|
||||
}
|
||||
|
||||
void WorldEvent::sendScriptLocalFloat(MWWorld::Ptr ptr, int index, float floatVal)
|
||||
{
|
||||
reset();
|
||||
cell = *ptr.getCell()->getCell();
|
||||
|
||||
mwmp::WorldObject worldObject;
|
||||
worldObject.refId = ptr.getCellRef().getRefId();
|
||||
worldObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex;
|
||||
worldObject.mpNum = ptr.getCellRef().getMpNum();
|
||||
worldObject.index = index;
|
||||
worldObject.floatVal = floatVal;
|
||||
addObject(worldObject);
|
||||
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_LOCAL_FLOAT)->setEvent(this);
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_LOCAL_FLOAT)->Send();
|
||||
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_SCRIPT_LOCAL_FLOAT\n- cellRef: %s, %i\n- cell: %s\n- index: %i\n- floatVal: %f",
|
||||
worldObject.refId.c_str(), worldObject.refNumIndex, cell.getDescription().c_str(),
|
||||
worldObject.index, worldObject.floatVal);
|
||||
}
|
||||
|
||||
void WorldEvent::sendScriptMemberShort(std::string refId, int index, int shortVal)
|
||||
{
|
||||
reset();
|
||||
mwmp::WorldObject worldObject;
|
||||
worldObject.refId = refId;
|
||||
worldObject.index = index;
|
||||
worldObject.shortVal = shortVal;
|
||||
addObject(worldObject);
|
||||
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_MEMBER_SHORT)->setEvent(this);
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_MEMBER_SHORT)->Send();
|
||||
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_SCRIPT_MEMBER_SHORT\n- cellRef: %s\n- index: %i\n- shortVal: %i",
|
||||
worldObject.refId.c_str(), worldObject.index, worldObject.shortVal);
|
||||
}
|
||||
|
||||
void WorldEvent::sendScriptGlobalShort(std::string varName, int shortVal)
|
||||
{
|
||||
reset();
|
||||
mwmp::WorldObject worldObject;
|
||||
worldObject.varName = varName;
|
||||
worldObject.shortVal = shortVal;
|
||||
addObject(worldObject);
|
||||
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_GLOBAL_SHORT)->setEvent(this);
|
||||
mwmp::Main::get().getNetworking()->getWorldPacket(ID_SCRIPT_GLOBAL_SHORT)->Send();
|
||||
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_SCRIPT_GLOBAL_SHORT\n- varName: %s\n- shortVal: %i",
|
||||
worldObject.varName.c_str(), worldObject.shortVal);
|
||||
}
|
||||
|
|
|
@ -38,21 +38,35 @@ namespace mwmp
|
|||
void playMusic();
|
||||
void playVideo();
|
||||
|
||||
void sendContainers(MWWorld::CellStore* cellStore);
|
||||
void addObjectPlace(const MWWorld::Ptr& ptr);
|
||||
void addObjectDelete(const MWWorld::Ptr& ptr);
|
||||
void addObjectLock(const MWWorld::Ptr& ptr, int lockLevel);
|
||||
void addObjectUnlock(const MWWorld::Ptr& ptr);
|
||||
void addObjectScale(const MWWorld::Ptr& ptr, float scale);
|
||||
void addObjectAnimPlay(const MWWorld::Ptr& ptr, std::string group, int mode);
|
||||
void addDoorState(const MWWorld::Ptr& ptr, int state);
|
||||
void addMusicPlay(std::string filename);
|
||||
void addVideoPlay(std::string filename, bool allowSkipping);
|
||||
void addScriptLocalShort(const MWWorld::Ptr& ptr, int index, int shortVal);
|
||||
void addScriptLocalFloat(const MWWorld::Ptr& ptr, int index, float floatVal);
|
||||
void addScriptMemberShort(std::string refId, int index, int shortVal);
|
||||
void addScriptGlobalShort(std::string varName, int shortVal);
|
||||
|
||||
void sendObjectPlace(MWWorld::Ptr ptr);
|
||||
void sendObjectDelete(MWWorld::Ptr ptr);
|
||||
void sendObjectLock(MWWorld::Ptr ptr, int lockLevel);
|
||||
void sendObjectUnlock(MWWorld::Ptr ptr);
|
||||
void sendObjectScale(MWWorld::Ptr ptr, float scale);
|
||||
void sendObjectAnimPlay(MWWorld::Ptr ptr, std::string group, int mode);
|
||||
void sendDoorState(MWWorld::Ptr ptr, int state);
|
||||
void sendMusicPlay(std::string filename);
|
||||
void sendVideoPlay(std::string filename, bool allowSkipping);
|
||||
void sendScriptLocalShort(MWWorld::Ptr ptr, int index, int shortVal);
|
||||
void sendScriptLocalFloat(MWWorld::Ptr ptr, int index, float floatVal);
|
||||
void sendScriptMemberShort(std::string refId, int index, int shortVal);
|
||||
void sendScriptGlobalShort(std::string varName, int shortVal);
|
||||
void sendObjectPlace();
|
||||
void sendObjectDelete();
|
||||
void sendObjectLock();
|
||||
void sendObjectUnlock();
|
||||
void sendObjectScale();
|
||||
void sendObjectAnimPlay();
|
||||
void sendDoorState();
|
||||
void sendMusicPlay();
|
||||
void sendVideoPlay();
|
||||
void sendScriptLocalShort();
|
||||
void sendScriptLocalFloat();
|
||||
void sendScriptMemberShort();
|
||||
void sendScriptGlobalShort();
|
||||
|
||||
void sendContainers(MWWorld::CellStore* cellStore);
|
||||
|
||||
private:
|
||||
Networking *getNetworking();
|
||||
|
|
|
@ -83,7 +83,9 @@ namespace MWScript
|
|||
if (mwmp::Main::isValidPacketScript(ptr.getClass().getScript(ptr)))
|
||||
{
|
||||
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
|
||||
worldEvent->sendObjectAnimPlay(ptr, group, mode);
|
||||
worldEvent->reset();
|
||||
worldEvent->addObjectAnimPlay(ptr, group, mode);
|
||||
worldEvent->sendObjectAnimPlay();
|
||||
}
|
||||
/*
|
||||
End of tes3mp addition
|
||||
|
|
|
@ -211,7 +211,9 @@ namespace MWScript
|
|||
if (sendPackets)
|
||||
{
|
||||
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
|
||||
worldEvent->sendScriptLocalShort(mReference, index, value);
|
||||
worldEvent->reset();
|
||||
worldEvent->addScriptLocalShort(mReference, index, value);
|
||||
worldEvent->sendScriptLocalShort();
|
||||
}
|
||||
/*
|
||||
End of tes3mp addition
|
||||
|
@ -243,7 +245,9 @@ namespace MWScript
|
|||
if (sendPackets && value == (int) value)
|
||||
{
|
||||
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
|
||||
worldEvent->sendScriptLocalFloat(mReference, index, value);
|
||||
worldEvent->reset();
|
||||
worldEvent->addScriptLocalFloat(mReference, index, value);
|
||||
worldEvent->sendScriptLocalFloat();
|
||||
}
|
||||
/*
|
||||
End of tes3mp addition
|
||||
|
@ -300,7 +304,9 @@ namespace MWScript
|
|||
if (sendPackets)
|
||||
{
|
||||
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
|
||||
worldEvent->sendScriptGlobalShort(name, value);
|
||||
worldEvent->reset();
|
||||
worldEvent->addScriptGlobalShort(name, value);
|
||||
worldEvent->sendScriptGlobalShort();
|
||||
}
|
||||
/*
|
||||
End of tes3mp addition
|
||||
|
@ -635,7 +641,9 @@ namespace MWScript
|
|||
if (sendPackets && !global)
|
||||
{
|
||||
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
|
||||
worldEvent->sendScriptMemberShort(id, index, value);
|
||||
worldEvent->reset();
|
||||
worldEvent->addScriptMemberShort(id, index, value);
|
||||
worldEvent->sendScriptMemberShort();
|
||||
}
|
||||
/*
|
||||
End of tes3mp addition
|
||||
|
|
|
@ -104,7 +104,9 @@ namespace MWScript
|
|||
through a script
|
||||
*/
|
||||
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
|
||||
worldEvent->sendVideoPlay(name, allowSkipping);
|
||||
worldEvent->reset();
|
||||
worldEvent->addVideoPlay(name, allowSkipping);
|
||||
worldEvent->sendVideoPlay();
|
||||
/*
|
||||
End of tes3mp addition
|
||||
*/
|
||||
|
@ -214,7 +216,9 @@ namespace MWScript
|
|||
through a script
|
||||
*/
|
||||
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
|
||||
worldEvent->sendObjectLock(ptr, lockLevel);
|
||||
worldEvent->reset();
|
||||
worldEvent->addObjectLock(ptr, lockLevel);
|
||||
worldEvent->sendObjectLock();
|
||||
/*
|
||||
End of tes3mp addition
|
||||
*/
|
||||
|
@ -252,7 +256,9 @@ namespace MWScript
|
|||
through a script
|
||||
*/
|
||||
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
|
||||
worldEvent->sendObjectUnlock(ptr);
|
||||
worldEvent->reset();
|
||||
worldEvent->addObjectUnlock(ptr);
|
||||
worldEvent->sendObjectUnlock();
|
||||
/*
|
||||
End of tes3mp addition
|
||||
*/
|
||||
|
@ -724,7 +730,9 @@ namespace MWScript
|
|||
through a script
|
||||
*/
|
||||
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
|
||||
worldEvent->sendObjectDelete(ptr);
|
||||
worldEvent->reset();
|
||||
worldEvent->addObjectDelete(ptr);
|
||||
worldEvent->sendObjectDelete();
|
||||
/*
|
||||
End of tes3mp addition
|
||||
*/
|
||||
|
|
|
@ -88,7 +88,9 @@ namespace MWScript
|
|||
a script
|
||||
*/
|
||||
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
|
||||
worldEvent->sendMusicPlay(sound);
|
||||
worldEvent->reset();
|
||||
worldEvent->addMusicPlay(sound);
|
||||
worldEvent->sendMusicPlay();
|
||||
/*
|
||||
End of tes3mp addition
|
||||
*/
|
||||
|
|
|
@ -61,7 +61,9 @@ namespace MWScript
|
|||
through a script
|
||||
*/
|
||||
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
|
||||
worldEvent->sendObjectScale(ptr, scale);
|
||||
worldEvent->reset();
|
||||
worldEvent->addObjectScale(ptr, scale);
|
||||
worldEvent->sendObjectScale();
|
||||
/*
|
||||
End of tes3mp addition
|
||||
*/
|
||||
|
@ -556,7 +558,9 @@ namespace MWScript
|
|||
through a script
|
||||
*/
|
||||
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
|
||||
worldEvent->sendObjectPlace(ptr);
|
||||
worldEvent->reset();
|
||||
worldEvent->addObjectPlace(ptr);
|
||||
worldEvent->sendObjectPlace();
|
||||
/*
|
||||
End of tes3mp addition
|
||||
*/
|
||||
|
|
|
@ -43,7 +43,9 @@ namespace MWWorld
|
|||
by the player
|
||||
*/
|
||||
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
|
||||
worldEvent->sendObjectDelete(getTarget());
|
||||
worldEvent->reset();
|
||||
worldEvent->addObjectDelete(getTarget());
|
||||
worldEvent->sendObjectDelete();
|
||||
mwmp::Main::get().getLocalPlayer()->sendInventory();
|
||||
/*
|
||||
End of tes3mp addition
|
||||
|
|
|
@ -2383,7 +2383,9 @@ namespace MWWorld
|
|||
Send an ID_DOOR_STATE packet every time a door is activated
|
||||
*/
|
||||
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
|
||||
worldEvent->sendDoorState(door, state);
|
||||
worldEvent->reset();
|
||||
worldEvent->addDoorState(door, state);
|
||||
worldEvent->sendDoorState();
|
||||
/*
|
||||
End of tes3mp addition
|
||||
*/
|
||||
|
@ -2400,7 +2402,9 @@ namespace MWWorld
|
|||
Send an ID_DOOR_STATE packet every time a door is activated
|
||||
*/
|
||||
mwmp::WorldEvent *worldEvent = mwmp::Main::get().getNetworking()->getWorldEvent();
|
||||
worldEvent->sendDoorState(door, state);
|
||||
worldEvent->reset();
|
||||
worldEvent->addDoorState(door, state);
|
||||
worldEvent->sendDoorState();
|
||||
/*
|
||||
End of tes3mp addition
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue