forked from mirror/openmw-tes3mp
Add OpenMW-mp target
parent
4be6b362c5
commit
1e29409dd5
@ -0,0 +1,117 @@
|
||||
//
|
||||
// Created by koncord on 01.01.16.
|
||||
//
|
||||
|
||||
#include "Networking.hpp"
|
||||
#include <cassert>
|
||||
#include <apps/openmw/mwworld/manualref.hpp>
|
||||
#include <apps/openmw/mwmechanics/aitravel.hpp>
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwstate/statemanagerimp.hpp"
|
||||
#include "../mwinput/inputmanagerimp.hpp"
|
||||
#include "../mwscript/scriptmanagerimp.hpp"
|
||||
#include "../mwgui/windowmanagerimp.hpp"
|
||||
#include "../mwworld/worldimp.hpp"
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/customdata.hpp"
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
#include "../mwclass/npc.hpp"
|
||||
#include "../mwclass/creature.hpp"
|
||||
#include "../mwmechanics/mechanicsmanagerimp.hpp"
|
||||
|
||||
#include "../mwmechanics/aistate.hpp"
|
||||
#include "Player.hpp"
|
||||
|
||||
using namespace mwmp;
|
||||
using namespace std;
|
||||
|
||||
Main *Main::pMain = 0;
|
||||
|
||||
Main::Main()
|
||||
{
|
||||
std::cout << "Main::Main" << std::endl;
|
||||
}
|
||||
|
||||
Main::~Main()
|
||||
{
|
||||
std::cout << "Main::~Main" << std::endl;
|
||||
}
|
||||
|
||||
void Main::Create()
|
||||
{
|
||||
assert(!pMain);
|
||||
pMain = new Main();
|
||||
const MWBase::Environment &environment = MWBase::Environment::get();
|
||||
environment.getStateManager()->newGame(true);
|
||||
|
||||
}
|
||||
|
||||
void Main::Destroy()
|
||||
{
|
||||
Player::CleanUp();
|
||||
delete pMain;
|
||||
}
|
||||
|
||||
void Main::Frame(float dt)
|
||||
{
|
||||
const MWBase::Environment &environment = MWBase::Environment::get();
|
||||
if (environment.getWindowManager()->containsMode(MWGui::GM_MainMenu))
|
||||
{
|
||||
//environment.getWindowManager()->exitCurrentGuiMode();
|
||||
}
|
||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
MWBase::ScriptManager *script = MWBase::Environment::get().getScriptManager();
|
||||
MWWorld::Ptr player = world->getPlayerPtr();
|
||||
|
||||
float x = player.getRefData().getPosition().pos[0];
|
||||
float y = player.getRefData().getPosition().pos[1];
|
||||
float z = player.getRefData().getPosition().pos[2];
|
||||
float rot_x = player.getRefData().getPosition().rot[0];
|
||||
float rot_y = player.getRefData().getPosition().rot[1];
|
||||
float rot_z = player.getRefData().getPosition().rot[2];
|
||||
|
||||
static bool connected = true;
|
||||
if (connected)
|
||||
{
|
||||
connected = false;
|
||||
world->toggleGodMode();
|
||||
// create item
|
||||
MWWorld::CellStore* store = player.getCell();
|
||||
|
||||
Player::CreatePlayer(1, "Ashot the Orc", "Orc", "b_n_orc_m_head_01", "b_n_orc_m_hair_01");
|
||||
Player *ref = Player::GetPlayer(1);
|
||||
|
||||
ref->getPtr().getCellRef().setPosition(player.getRefData().getPosition());
|
||||
world->moveObject(ref->getPtr(),player.getCell(), x, y, z); // move to player
|
||||
}
|
||||
Player *ref = Player::GetPlayer(1);
|
||||
|
||||
ref->Move(player.getRefData().getPosition(), player.getCell());
|
||||
|
||||
//cout << "x:\t" << x << "\ty:\t" << y << "\tz:\t" << z<< endl;
|
||||
|
||||
//ref->getPtr().getRefData().
|
||||
//loc.getRefData().setPosition(player.getRefData().getPosition());
|
||||
MWMechanics::NpcStats *npcStats = &ref->getPtr().getClass().getNpcStats(ref->getPtr());
|
||||
npcStats->setHealth(1000);
|
||||
npcStats->setMagicka(1000);
|
||||
npcStats->setFatigue(1000);
|
||||
if(npcStats->isDead())
|
||||
npcStats->resurrect();
|
||||
npcStats->setAttacked(false);
|
||||
|
||||
npcStats->setBaseDisposition(255);
|
||||
|
||||
if(player.getClass().getNpcStats(ref->getPtr()).getHealth().getCurrent() <= 0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Main::UpdateWorld(float dt)
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
|
||||
namespace mwmp
|
||||
{
|
||||
class Main
|
||||
{
|
||||
public:
|
||||
Main();
|
||||
~Main();
|
||||
|
||||
static void Create();
|
||||
static void Destroy();
|
||||
static void Frame(float dt);
|
||||
static void UpdateWorld(float dt);
|
||||
private:
|
||||
static Main *pMain;
|
||||
};
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
# Comes form project edunetgames
|
||||
# - Try to find RakNet
|
||||
# Once done this will define
|
||||
#
|
||||
# RakNet_FOUND - system has RakNet
|
||||
# RakNet_INCLUDES - the RakNet include directory
|
||||
# RakNet_LIBRARY - Link these to use RakNet
|
||||
|
||||
if(Win32)
|
||||
SET(RakNet_LIBRARY_Name RakNetLibStatic)
|
||||
SET(RakNet_LIBRARY_Name_Debug RakNetLibStaticDebug)
|
||||
else(Win32)
|
||||
SET(RakNet_LIBRARY_Name RakNetStatic)
|
||||
SET(RakNet_LIBRARY_Name_Debug RakNetStatic_Debug)
|
||||
endif(Win32)
|
||||
|
||||
FIND_LIBRARY (RakNet_LIBRARY_RELEASE NAMES ${RakNet_LIBRARY_Name}
|
||||
PATHS
|
||||
ENV LD_LIBRARY_PATH
|
||||
ENV LIBRARY_PATH
|
||||
/usr/lib64
|
||||
/usr/lib
|
||||
/usr/local/lib64
|
||||
/usr/local/lib
|
||||
/opt/local/lib
|
||||
${RAKNET_ROOT}/lib
|
||||
)
|
||||
|
||||
FIND_LIBRARY (RakNet_LIBRARY_DEBUG NAMES ${RakNet_LIBRARY_Name_Debug}
|
||||
PATHS
|
||||
ENV LD_LIBRARY_PATH
|
||||
ENV LIBRARY_PATH
|
||||
/usr/lib64
|
||||
/usr/lib
|
||||
/usr/local/lib64
|
||||
/usr/local/lib
|
||||
/opt/local/lib
|
||||
${RAKNET_ROOT}/lib
|
||||
)
|
||||
|
||||
|
||||
|
||||
FIND_PATH (RakNet_INCLUDES raknet/RakPeer.h
|
||||
ENV CPATH
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
/opt/local/include
|
||||
${RAKNET_ROOT}/include
|
||||
)
|
||||
|
||||
IF(RakNet_INCLUDES AND RakNet_LIBRARY_RELEASE)
|
||||
SET(RakNet_FOUND TRUE)
|
||||
ENDIF(RakNet_INCLUDES AND RakNet_LIBRARY_RELEASE)
|
||||
|
||||
IF(RakNet_FOUND)
|
||||
SET(RakNet_INCLUDES ${RakNet_INCLUDES})
|
||||
|
||||
|
||||
IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
|
||||
SET(RakNet_LIBRARY optimized ${RakNet_LIBRARY_RELEASE} debug ${RakNet_LIBRARY_DEBUG})
|
||||
ELSE()
|
||||
# if there are no configuration types and CMAKE_BUILD_TYPE has no value
|
||||
# then just use the release libraries
|
||||
SET(RakNet_LIBRARY ${RakNet_LIBRARY_RELEASE} )
|
||||
ENDIF()
|
||||
IF(NOT RakNet_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found RakNet: ${RakNet_LIBRARIES}")
|
||||
ENDIF(NOT RakNet_FIND_QUIETLY)
|
||||
ELSE(RakNet_FOUND)
|
||||
IF(RakNet_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Could not find RakNet")
|
||||
ENDIF(RakNet_FIND_REQUIRED)
|
||||
ENDIF(RakNet_FOUND)
|
||||
|
Loading…
Reference in New Issue