forked from teamnwah/openmw-tes3coop
handle name change during character creation
This commit is contained in:
parent
edb2df7d27
commit
9dffa75a15
7 changed files with 46 additions and 20 deletions
|
@ -256,8 +256,7 @@ void OMW::Engine::go()
|
||||||
*mScriptManager);
|
*mScriptManager);
|
||||||
|
|
||||||
// Create game mechanics system
|
// Create game mechanics system
|
||||||
mEnvironment.mMechanicsManager = new MWMechanics::MechanicsManager (
|
mEnvironment.mMechanicsManager = new MWMechanics::MechanicsManager (mEnvironment);
|
||||||
mEnvironment.mWorld->getStore(), *mEnvironment.mWindowManager);
|
|
||||||
|
|
||||||
// Create dialog system
|
// Create dialog system
|
||||||
mEnvironment.mDialogueManager = new MWDialogue::DialogueManager (mEnvironment);
|
mEnvironment.mDialogueManager = new MWDialogue::DialogueManager (mEnvironment);
|
||||||
|
|
|
@ -214,8 +214,6 @@ namespace MWGui
|
||||||
|
|
||||||
// These are just demo values, you should replace these with
|
// These are just demo values, you should replace these with
|
||||||
// real calls from outside the class later.
|
// real calls from outside the class later.
|
||||||
setPlayerName("ThePlayer");
|
|
||||||
|
|
||||||
setText("LevelText", "5");
|
setText("LevelText", "5");
|
||||||
setText("RaceText", "Wood Elf");
|
setText("RaceText", "Wood Elf");
|
||||||
setText("ClassText", "Pilgrim");
|
setText("ClassText", "Pilgrim");
|
||||||
|
@ -269,6 +267,12 @@ namespace MWGui
|
||||||
setBar (id, id + "T", value.getCurrent(), value.getModified());
|
setBar (id, id + "T", value.getCurrent(), value.getModified());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setValue (const std::string& id, const std::string& value)
|
||||||
|
{
|
||||||
|
if (id=="name")
|
||||||
|
setPlayerName (value);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class InventoryWindow : public OEngine::GUI::Layout
|
class InventoryWindow : public OEngine::GUI::Layout
|
||||||
|
|
|
@ -140,6 +140,11 @@ void WindowManager::setValue (const std::string& id, const MWMechanics::DynamicS
|
||||||
hud->setValue (id, value);
|
hud->setValue (id, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WindowManager::setValue (const std::string& id, const std::string& value)
|
||||||
|
{
|
||||||
|
stats->setValue (id, value);
|
||||||
|
}
|
||||||
|
|
||||||
void WindowManager::messageBox (const std::string& message, const std::vector<std::string>& buttons)
|
void WindowManager::messageBox (const std::string& message, const std::vector<std::string>& buttons)
|
||||||
{
|
{
|
||||||
std::cout << "message box: " << message << std::endl;
|
std::cout << "message box: " << message << std::endl;
|
||||||
|
|
|
@ -164,6 +164,9 @@ namespace MWGui
|
||||||
void setValue (const std::string& id, const MWMechanics::DynamicStat<int>& value);
|
void setValue (const std::string& id, const MWMechanics::DynamicStat<int>& value);
|
||||||
///< Set value for the given ID.
|
///< Set value for the given ID.
|
||||||
|
|
||||||
|
void setValue (const std::string& id, const std::string& value);
|
||||||
|
///< set value for the given ID.
|
||||||
|
|
||||||
void messageBox (const std::string& message, const std::vector<std::string>& buttons);
|
void messageBox (const std::string& message, const std::vector<std::string>& buttons);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -6,12 +6,13 @@
|
||||||
#include "../mwgui/window_manager.hpp"
|
#include "../mwgui/window_manager.hpp"
|
||||||
|
|
||||||
#include "../mwworld/class.hpp"
|
#include "../mwworld/class.hpp"
|
||||||
|
#include "../mwworld/environment.hpp"
|
||||||
|
#include "../mwworld/world.hpp"
|
||||||
|
|
||||||
namespace MWMechanics
|
namespace MWMechanics
|
||||||
{
|
{
|
||||||
MechanicsManager::MechanicsManager (const ESMS::ESMStore& store,
|
MechanicsManager::MechanicsManager (MWWorld::Environment& environment)
|
||||||
MWGui::WindowManager& windowManager)
|
: mEnvironment (environment), mSetName (true)
|
||||||
: mStore (store), mWindowManager (windowManager)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -68,7 +69,7 @@ namespace MWMechanics
|
||||||
{
|
{
|
||||||
mWatchedCreature.mAttributes[i] = stats.mAttributes[i];
|
mWatchedCreature.mAttributes[i] = stats.mAttributes[i];
|
||||||
|
|
||||||
mWindowManager.setValue (attributeNames[i], stats.mAttributes[i]);
|
mEnvironment.mWindowManager->setValue (attributeNames[i], stats.mAttributes[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,15 +79,22 @@ namespace MWMechanics
|
||||||
{
|
{
|
||||||
mWatchedCreature.mDynamic[i] = stats.mDynamic[i];
|
mWatchedCreature.mDynamic[i] = stats.mDynamic[i];
|
||||||
|
|
||||||
mWindowManager.setValue (dynamicNames[i], stats.mDynamic[i]);
|
mEnvironment.mWindowManager->setValue (dynamicNames[i], stats.mDynamic[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mSetName)
|
||||||
|
{
|
||||||
|
mEnvironment.mWindowManager->setValue ("name", mEnvironment.mWorld->getPlayerPos().getName());
|
||||||
|
mSetName = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MechanicsManager::setPlayerName (const std::string& name)
|
void MechanicsManager::setPlayerName (const std::string& name)
|
||||||
{
|
{
|
||||||
|
mEnvironment.mWorld->getPlayerPos().setName (name);
|
||||||
|
mSetName = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MechanicsManager::setPlayerRace (const std::string& race, bool male)
|
void MechanicsManager::setPlayerRace (const std::string& race, bool male)
|
||||||
|
|
|
@ -7,29 +7,24 @@
|
||||||
|
|
||||||
#include "creaturestats.hpp"
|
#include "creaturestats.hpp"
|
||||||
|
|
||||||
namespace ESMS
|
namespace MWWorld
|
||||||
{
|
{
|
||||||
struct ESMStore;
|
class Environment;
|
||||||
}
|
|
||||||
|
|
||||||
namespace MWGui
|
|
||||||
{
|
|
||||||
class WindowManager;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace MWMechanics
|
namespace MWMechanics
|
||||||
{
|
{
|
||||||
class MechanicsManager
|
class MechanicsManager
|
||||||
{
|
{
|
||||||
const ESMS::ESMStore& mStore;
|
MWWorld::Environment& mEnvironment;
|
||||||
MWGui::WindowManager& mWindowManager;
|
|
||||||
std::set<MWWorld::Ptr> mActors;
|
std::set<MWWorld::Ptr> mActors;
|
||||||
MWWorld::Ptr mWatched;
|
MWWorld::Ptr mWatched;
|
||||||
CreatureStats mWatchedCreature;
|
CreatureStats mWatchedCreature;
|
||||||
|
bool mSetName;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
MechanicsManager (const ESMS::ESMStore& store, MWGui::WindowManager& windowManager);
|
MechanicsManager (MWWorld::Environment& environment);
|
||||||
|
|
||||||
void configureGUI();
|
void configureGUI();
|
||||||
|
|
||||||
|
|
|
@ -24,12 +24,14 @@ namespace MWRender
|
||||||
MWWorld::Ptr::CellStore *mCellStore;
|
MWWorld::Ptr::CellStore *mCellStore;
|
||||||
Ogre::Camera *camera;
|
Ogre::Camera *camera;
|
||||||
MWWorld::World& mWorld;
|
MWWorld::World& mWorld;
|
||||||
|
std::string mName;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PlayerPos(Ogre::Camera *cam, const ESM::NPC *player, MWWorld::World& world) :
|
PlayerPos(Ogre::Camera *cam, const ESM::NPC *player, MWWorld::World& world) :
|
||||||
mCellStore (0), camera(cam), mWorld (world)
|
mCellStore (0), camera(cam), mWorld (world)
|
||||||
{
|
{
|
||||||
mPlayer.base = player;
|
mPlayer.base = player;
|
||||||
|
mName = player->name;
|
||||||
mPlayer.ref.pos.pos[0] = mPlayer.ref.pos.pos[1] = mPlayer.ref.pos.pos[2] = 0;
|
mPlayer.ref.pos.pos[0] = mPlayer.ref.pos.pos[1] = mPlayer.ref.pos.pos[2] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,6 +75,16 @@ namespace MWRender
|
||||||
MWWorld::Ptr ptr (&mPlayer, mCellStore);
|
MWWorld::Ptr ptr (&mPlayer, mCellStore);
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setName (const std::string& name)
|
||||||
|
{
|
||||||
|
mName = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string getName() const
|
||||||
|
{
|
||||||
|
return mName;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue