[Client] Add world processors

pull/199/head
Koncord 8 years ago
parent f0805ca6f7
commit fd3a7d2ad0

@ -0,0 +1,32 @@
//
// Created by koncord on 18.04.17.
//
#ifndef OPENMW_BASEOBJECTPROCESSOR_HPP
#define OPENMW_BASEOBJECTPROCESSOR_HPP
#include "apps/openmw/mwmp/WorldProcessor.hpp"
#include "apps/openmw/mwmp/Main.hpp"
#include "apps/openmw/mwmp/WorldController.hpp"
#include "apps/openmw/mwworld/cellstore.hpp"
namespace mwmp
{
class BaseObjectProcessor : public WorldProcessor
{
public:
virtual void Do(WorldPacket &packet, WorldEvent &event)
{
MWWorld::CellStore *ptrCellStore = Main::get().getWorldController()->getCell(event.cell);
if (!ptrCellStore) return;
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Received %s about %s", strPacketID.c_str(), event.cell.getDescription().c_str());
}
protected:
MWWorld::CellStore *ptrCellStore;
};
}
#endif //OPENMW_BASEOBJECTPROCESSOR_HPP

@ -0,0 +1,37 @@
//
// Created by koncord on 18.04.17.
//
#ifndef OPENMW_PROCESSORCONTAINER_HPP
#define OPENMW_PROCESSORCONTAINER_HPP
#include "BaseObjectProcessor.hpp"
namespace mwmp
{
class ProcessorContainer : public BaseObjectProcessor
{
public:
ProcessorContainer()
{
BPP_INIT(ID_CONTAINER)
}
virtual void Do(WorldPacket &packet, WorldEvent &event)
{
BaseObjectProcessor::Do(packet, event);
LOG_APPEND(Log::LOG_VERBOSE, "- action: %i", event.action);
// If we've received a request for information, comply with it
if (event.action == mwmp::BaseEvent::REQUEST)
event.sendContainers(ptrCellStore);
// Otherwise, edit containers based on the information received
else
event.editContainers(ptrCellStore);
}
};
}
#endif //OPENMW_PROCESSORCONTAINER_HPP

@ -0,0 +1,30 @@
//
// Created by koncord on 18.04.17.
//
#ifndef OPENMW_PROCESSDOORSTATE_HPP
#define OPENMW_PROCESSDOORSTATE_HPP
#include "BaseObjectProcessor.hpp"
namespace mwmp
{
class ProcessorDoorState : public BaseObjectProcessor
{
public:
ProcessorDoorState()
{
BPP_INIT(ID_DOOR_STATE)
}
virtual void Do(WorldPacket &packet, WorldEvent &event)
{
BaseObjectProcessor::Do(packet, event);
event.activateDoors(ptrCellStore);
}
};
}
#endif //OPENMW_PROCESSDOORSTATE_HPP

@ -0,0 +1,29 @@
//
// Created by koncord on 18.04.17.
//
#ifndef OPENMW_PROCESSORMUSICPLAY_HPP
#define OPENMW_PROCESSORMUSICPLAY_HPP
#include "apps/openmw/mwmp/WorldProcessor.hpp"
namespace mwmp
{
class ProcessorMusicPlay : public WorldProcessor
{
public:
ProcessorMusicPlay()
{
BPP_INIT(ID_MUSIC_PLAY)
}
virtual void Do(WorldPacket &packet, WorldEvent &event)
{
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Received %s", strPacketID.c_str());
event.playMusic();
}
};
}
#endif //OPENMW_PROCESSORSCRIPTGLOBALSHORT_HPP

@ -0,0 +1,30 @@
//
// Created by koncord on 18.04.17.
//
#ifndef OPENMW_PROCESSOROBJECTANIMPLAY_HPP
#define OPENMW_PROCESSOROBJECTANIMPLAY_HPP
#include "BaseObjectProcessor.hpp"
namespace mwmp
{
class ProcessorObjectAnimPlay : public BaseObjectProcessor
{
public:
ProcessorObjectAnimPlay()
{
BPP_INIT(ID_OBJECT_ANIM_PLAY)
}
virtual void Do(WorldPacket &packet, WorldEvent &event)
{
BaseObjectProcessor::Do(packet, event);
event.animateObjects(ptrCellStore);
}
};
}
#endif //OPENMW_PROCESSOROBJECTANIMPLAY_HPP

@ -0,0 +1,30 @@
//
// Created by koncord on 18.04.17.
//
#ifndef OPENMW_PROCESSOROBJECTDELETE_HPP
#define OPENMW_PROCESSOROBJECTDELETE_HPP
#include "BaseObjectProcessor.hpp"
namespace mwmp
{
class ProcessorObjectDelete : public BaseObjectProcessor
{
public:
ProcessorObjectDelete()
{
BPP_INIT(ID_OBJECT_DELETE)
}
virtual void Do(WorldPacket &packet, WorldEvent &event)
{
BaseObjectProcessor::Do(packet, event);
event.deleteObjects(ptrCellStore);
}
};
}
#endif //OPENMW_PROCESSOROBJECTDELETE_HPP

@ -0,0 +1,30 @@
//
// Created by koncord on 18.04.17.
//
#ifndef OPENMW_PROCESSOROBJECTLOCK_HPP
#define OPENMW_PROCESSOROBJECTLOCK_HPP
#include "BaseObjectProcessor.hpp"
namespace mwmp
{
class ProcessorObjectLock : public BaseObjectProcessor
{
public:
ProcessorObjectLock()
{
BPP_INIT(ID_OBJECT_LOCK)
}
virtual void Do(WorldPacket &packet, WorldEvent &event)
{
BaseObjectProcessor::Do(packet, event);
event.lockObjects(ptrCellStore);
}
};
}
#endif //OPENMW_PROCESSOROBJECTLOCK_HPP

@ -0,0 +1,30 @@
//
// Created by koncord on 18.04.17.
//
#ifndef OPENMW_PROCESSOROBJECTMOVE_HPP
#define OPENMW_PROCESSOROBJECTMOVE_HPP
#include "BaseObjectProcessor.hpp"
namespace mwmp
{
class ProcessorObjectMove : public BaseObjectProcessor
{
public:
ProcessorObjectMove()
{
BPP_INIT(ID_OBJECT_MOVE)
}
virtual void Do(WorldPacket &packet, WorldEvent &event)
{
BaseObjectProcessor::Do(packet, event);
event.moveObjects(ptrCellStore);
}
};
}
#endif //OPENMW_PROCESSOROBJECTMOVE_HPP

@ -0,0 +1,31 @@
//
// Created by koncord on 18.04.17.
//
#ifndef OPENMW_PROCESSOROBJECTPLACE_HPP
#define OPENMW_PROCESSOROBJECTPLACE_HPP
#include "BaseObjectProcessor.hpp"
namespace mwmp
{
class ProcessorObjectPlace : public BaseObjectProcessor
{
public:
ProcessorObjectPlace()
{
BPP_INIT(ID_OBJECT_PLACE)
}
virtual void Do(WorldPacket &packet, WorldEvent &event)
{
BaseObjectProcessor::Do(packet, event);
event.placeObjects(ptrCellStore);
}
};
}
#endif //OPENMW_PROCESSOROBJECTPLACE_HPP

@ -0,0 +1,30 @@
//
// Created by koncord on 18.04.17.
//
#ifndef OPENMW_PROCESSOROBJECTROTATE_HPP
#define OPENMW_PROCESSOROBJECTROTATE_HPP
#include "BaseObjectProcessor.hpp"
namespace mwmp
{
class ProcessorObjectRotate : public BaseObjectProcessor
{
public:
ProcessorObjectRotate()
{
BPP_INIT(ID_OBJECT_ROTATE)
}
virtual void Do(WorldPacket &packet, WorldEvent &event)
{
BaseObjectProcessor::Do(packet, event);
event.rotateObjects(ptrCellStore);
}
};
}
#endif //OPENMW_PROCESSOROBJECTROTATE_HPP

@ -0,0 +1,30 @@
//
// Created by koncord on 18.04.17.
//
#ifndef OPENMW_PROCESSOROBJECTSCALE_HPP
#define OPENMW_PROCESSOROBJECTSCALE_HPP
#include "BaseObjectProcessor.hpp"
namespace mwmp
{
class ProcessorObjectScale : public BaseObjectProcessor
{
public:
ProcessorObjectScale()
{
BPP_INIT(ID_OBJECT_SCALE)
}
virtual void Do(WorldPacket &packet, WorldEvent &event)
{
BaseObjectProcessor::Do(packet, event);
event.scaleObjects(ptrCellStore);
}
};
}
#endif //OPENMW_PROCESSOROBJECTSCALE_HPP

@ -0,0 +1,30 @@
//
// Created by koncord on 18.04.17.
//
#ifndef OPENMW_PROCESSOROBJECTUNLOCK_HPP
#define OPENMW_PROCESSOROBJECTUNLOCK_HPP
#include "BaseObjectProcessor.hpp"
namespace mwmp
{
class ProcessorObjectUnlock : public BaseObjectProcessor
{
public:
ProcessorObjectUnlock()
{
BPP_INIT(ID_OBJECT_UNLOCK)
}
virtual void Do(WorldPacket &packet, WorldEvent &event)
{
BaseObjectProcessor::Do(packet, event);
event.unlockObjects(ptrCellStore);
}
};
}
#endif //OPENMW_PROCESSOROBJECTUNLOCK_HPP

@ -0,0 +1,29 @@
//
// Created by koncord on 18.04.17.
//
#ifndef OPENMW_PROCESSORSCRIPTGLOBALSHORT_HPP
#define OPENMW_PROCESSORSCRIPTGLOBALSHORT_HPP
#include "apps/openmw/mwmp/WorldProcessor.hpp"
namespace mwmp
{
class ProcessorScriptGlobalShort : public WorldProcessor
{
public:
ProcessorScriptGlobalShort()
{
BPP_INIT(ID_SCRIPT_GLOBAL_SHORT)
}
virtual void Do(WorldPacket &packet, WorldEvent &event)
{
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Received %s", strPacketID.c_str());
event.setGlobalShorts();
}
};
}
#endif //OPENMW_PROCESSORSCRIPTGLOBALSHORT_HPP

@ -0,0 +1,30 @@
//
// Created by koncord on 18.04.17.
//
#ifndef OPENMW_PROCESSORSCRIPTLOCALFLOAT_HPP
#define OPENMW_PROCESSORSCRIPTLOCALFLOAT_HPP
#include "BaseObjectProcessor.hpp"
namespace mwmp
{
class ProcessorScriptLocalFloat : public BaseObjectProcessor
{
public:
ProcessorScriptLocalFloat()
{
BPP_INIT(ID_SCRIPT_LOCAL_FLOAT)
}
virtual void Do(WorldPacket &packet, WorldEvent &event)
{
BaseObjectProcessor::Do(packet, event);
event.setLocalFloats(ptrCellStore);
}
};
}
#endif //OPENMW_PROCESSORSCRIPTLOCALFLOAT_HPP

@ -0,0 +1,30 @@
//
// Created by koncord on 18.04.17.
//
#ifndef OPENMW_PROCESSORSCRIPTLOCALSHORT_HPP
#define OPENMW_PROCESSORSCRIPTLOCALSHORT_HPP
#include "BaseObjectProcessor.hpp"
namespace mwmp
{
class ProcessorScriptLocalShort : public BaseObjectProcessor
{
public:
ProcessorScriptLocalShort()
{
BPP_INIT(ID_SCRIPT_LOCAL_SHORT)
}
virtual void Do(WorldPacket &packet, WorldEvent &event)
{
BaseObjectProcessor::Do(packet, event);
event.setLocalShorts(ptrCellStore);
}
};
}
#endif //OPENMW_PROCESSORSCRIPTLOCALSHORT_HPP

@ -0,0 +1,29 @@
//
// Created by koncord on 18.04.17.
//
#ifndef OPENMW_PROCESSORSCRIPTMEMBERSHORT_HPP
#define OPENMW_PROCESSORSCRIPTMEMBERSHORT_HPP
#include "apps/openmw/mwmp/WorldProcessor.hpp"
namespace mwmp
{
class ProcessorScriptMemberShort : public WorldProcessor
{
public:
ProcessorScriptMemberShort()
{
BPP_INIT(ID_SCRIPT_MEMBER_SHORT)
}
virtual void Do(WorldPacket &packet, WorldEvent &event)
{
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Received %s", strPacketID.c_str());
event.setMemberShorts();
}
};
}
#endif //OPENMW_PROCESSORSCRIPTMEMBERSHORT_HPP

@ -0,0 +1,29 @@
//
// Created by koncord on 18.04.17.
//
#ifndef OPENMW_PROCESSORVIDEOPLAY_HPP
#define OPENMW_PROCESSORVIDEOPLAY_HPP
#include "apps/openmw/mwmp/WorldProcessor.hpp"
namespace mwmp
{
class ProcessorVideoPlay : public WorldProcessor
{
public:
ProcessorVideoPlay()
{
BPP_INIT(ID_VIDEO_PLAY)
}
virtual void Do(WorldPacket &packet, WorldEvent &event)
{
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Received %s", strPacketID.c_str());
event.playVideo();
}
};
}
#endif //OPENMW_PROCESSORVIDEOPLAY_HPP
Loading…
Cancel
Save