mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-03 13:39:40 +00:00
moved stats label <-> GMST text mapping from mwmechanics to mwgui; added missing stats window labels
This commit is contained in:
parent
9fafac1ef8
commit
b584215680
5 changed files with 35 additions and 82 deletions
|
@ -37,7 +37,7 @@ void OMW::Engine::executeLocalScripts()
|
||||||
MWScript::InterpreterContext interpreterContext (mEnvironment,
|
MWScript::InterpreterContext interpreterContext (mEnvironment,
|
||||||
&iter->second.getRefData().getLocals(), MWWorld::Ptr (iter->second));
|
&iter->second.getRefData().getLocals(), MWWorld::Ptr (iter->second));
|
||||||
mScriptManager->run (iter->first, interpreterContext);
|
mScriptManager->run (iter->first, interpreterContext);
|
||||||
|
|
||||||
if (mEnvironment.mWorld->hasCellChanged())
|
if (mEnvironment.mWorld->hasCellChanged())
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ bool OMW::Engine::frameStarted(const Ogre::FrameEvent& evt)
|
||||||
executeLocalScripts(); // This does not handle the case where a global script causes a cell
|
executeLocalScripts(); // This does not handle the case where a global script causes a cell
|
||||||
// change, followed by a cell change in a local script during the same
|
// change, followed by a cell change in a local script during the same
|
||||||
// frame.
|
// frame.
|
||||||
|
|
||||||
// passing of time
|
// passing of time
|
||||||
if (mEnvironment.mWindowManager->getMode()==MWGui::GM_Game)
|
if (mEnvironment.mWindowManager->getMode()==MWGui::GM_Game)
|
||||||
mEnvironment.mWorld->advanceTime (
|
mEnvironment.mWorld->advanceTime (
|
||||||
|
@ -64,7 +64,7 @@ bool OMW::Engine::frameStarted(const Ogre::FrameEvent& evt)
|
||||||
|
|
||||||
if (changed) // keep change flag for another frame, if cell changed happend in local script
|
if (changed) // keep change flag for another frame, if cell changed happend in local script
|
||||||
mEnvironment.mWorld->markCellAsUnchanged();
|
mEnvironment.mWorld->markCellAsUnchanged();
|
||||||
|
|
||||||
// update actors
|
// update actors
|
||||||
mEnvironment.mMechanicsManager->update();
|
mEnvironment.mMechanicsManager->update();
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ OMW::Engine::Engine()
|
||||||
, mNewGame (false)
|
, mNewGame (false)
|
||||||
, mScriptManager (0)
|
, mScriptManager (0)
|
||||||
, mScriptContext (0)
|
, mScriptContext (0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
OMW::Engine::~Engine()
|
OMW::Engine::~Engine()
|
||||||
|
@ -151,7 +151,7 @@ void OMW::Engine::enableDebugMode()
|
||||||
{
|
{
|
||||||
mDebug = true;
|
mDebug = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OMW::Engine::enableVerboseScripts()
|
void OMW::Engine::enableVerboseScripts()
|
||||||
{
|
{
|
||||||
mVerboseScripts = true;
|
mVerboseScripts = true;
|
||||||
|
@ -211,21 +211,19 @@ void OMW::Engine::go()
|
||||||
mScriptContext->setExtensions (&mExtensions);
|
mScriptContext->setExtensions (&mExtensions);
|
||||||
|
|
||||||
mScriptManager = new MWScript::ScriptManager (mEnvironment.mWorld->getStore(), mVerboseScripts,
|
mScriptManager = new MWScript::ScriptManager (mEnvironment.mWorld->getStore(), mVerboseScripts,
|
||||||
*mScriptContext);
|
*mScriptContext);
|
||||||
|
|
||||||
mEnvironment.mGlobalScripts = new MWScript::GlobalScripts (mEnvironment.mWorld->getStore(),
|
mEnvironment.mGlobalScripts = new MWScript::GlobalScripts (mEnvironment.mWorld->getStore(),
|
||||||
*mScriptManager);
|
*mScriptManager);
|
||||||
|
|
||||||
// Create game mechanics system
|
// Create game mechanics system
|
||||||
mEnvironment.mMechanicsManager = new MWMechanics::MechanicsManager (
|
mEnvironment.mMechanicsManager = new MWMechanics::MechanicsManager (
|
||||||
mEnvironment.mWorld->getStore(), *mEnvironment.mWindowManager);
|
mEnvironment.mWorld->getStore(), *mEnvironment.mWindowManager);
|
||||||
|
|
||||||
mEnvironment.mMechanicsManager->configureGUI();
|
|
||||||
|
|
||||||
// load cell
|
// load cell
|
||||||
ESM::Position pos;
|
ESM::Position pos;
|
||||||
pos.pos[0] = pos.pos[1] = pos.pos[2] = 0;
|
pos.pos[0] = pos.pos[1] = pos.pos[2] = 0;
|
||||||
pos.rot[0] = pos.rot[1] = pos.rot[2] = 0;
|
pos.rot[0] = pos.rot[1] = pos.rot[2] = 0;
|
||||||
mEnvironment.mWorld->changeCell (mCellName, pos);
|
mEnvironment.mWorld->changeCell (mCellName, pos);
|
||||||
|
|
||||||
// Sets up the input system
|
// Sets up the input system
|
||||||
|
@ -241,5 +239,3 @@ void OMW::Engine::go()
|
||||||
|
|
||||||
std::cout << "Quitting peacefully.\n";
|
std::cout << "Quitting peacefully.\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef MWGUI_LAYOUTS_H
|
#ifndef MWGUI_LAYOUTS_H
|
||||||
#define MWGUI_LAYOUTS_H
|
#define MWGUI_LAYOUTS_H
|
||||||
|
|
||||||
|
#include <components/esm_store/store.hpp>
|
||||||
|
|
||||||
#include <openengine/gui/layout.hpp>
|
#include <openengine/gui/layout.hpp>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -50,9 +52,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.
|
||||||
setStats(60, 100,
|
|
||||||
30, 100,
|
|
||||||
80, 100);
|
|
||||||
setWeapIcon("icons\\w\\tx_knife_iron.dds");
|
setWeapIcon("icons\\w\\tx_knife_iron.dds");
|
||||||
setWeapStatus(90, 100);
|
setWeapStatus(90, 100);
|
||||||
setSpellIcon("icons\\s\\b_tx_s_rstor_health.dds");
|
setSpellIcon("icons\\s\\b_tx_s_rstor_health.dds");
|
||||||
|
@ -182,18 +181,34 @@ namespace MWGui
|
||||||
setText(tname, out.str().c_str());
|
setText(tname, out.str().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
StatsWindow()
|
StatsWindow (const ESMS::ESMStore& store)
|
||||||
: Layout("openmw_stats_window_layout.xml")
|
: Layout("openmw_stats_window_layout.xml")
|
||||||
{
|
{
|
||||||
setCoord(0,0,498, 342);
|
setCoord(0,0,498, 342);
|
||||||
|
|
||||||
setText("Health_str", "Health");
|
const char *names[][2] =
|
||||||
setText("Magicka_str", "Magicka");
|
{
|
||||||
setText("Fatigue_str", "Fatigue");
|
{ "Attrib1", "sAttributeStrength" },
|
||||||
|
{ "Attrib2", "sAttributeIntelligence" },
|
||||||
|
{ "Attrib3", "sAttributeWillpower" },
|
||||||
|
{ "Attrib4", "sAttributeAgility" },
|
||||||
|
{ "Attrib5", "sAttributeSpeed" },
|
||||||
|
{ "Attrib6", "sAttributeEndurance" },
|
||||||
|
{ "Attrib7", "sAttributePersonality" },
|
||||||
|
{ "Attrib8", "sAttributeLuck" },
|
||||||
|
{ "Health_str", "sHealth" },
|
||||||
|
{ "Magicka_str", "sMagic" },
|
||||||
|
{ "Fatigue_str", "sFatigue" },
|
||||||
|
{ "Level_str", "sLevel" },
|
||||||
|
{ "Race_str", "sRace" },
|
||||||
|
{ "Class_str", "sClass" },
|
||||||
|
{ 0, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
setText("Level_str", "Level");
|
for (int i=0; names[i][0]; ++i)
|
||||||
setText("Race_str", "Race");
|
{
|
||||||
setText("Class_str", "Class");
|
setText (names[i][0], store.gameSettings.find (names[i][1])->str);
|
||||||
|
}
|
||||||
|
|
||||||
// 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.
|
||||||
|
@ -202,15 +217,6 @@ namespace MWGui
|
||||||
setText("LevelText", "5");
|
setText("LevelText", "5");
|
||||||
setText("RaceText", "Wood Elf");
|
setText("RaceText", "Wood Elf");
|
||||||
setText("ClassText", "Pilgrim");
|
setText("ClassText", "Pilgrim");
|
||||||
|
|
||||||
setText("AttribVal1", "30");
|
|
||||||
setText("AttribVal2", "40");
|
|
||||||
setText("AttribVal3", "30");
|
|
||||||
setText("AttribVal4", "75");
|
|
||||||
setText("AttribVal5", "50");
|
|
||||||
setText("AttribVal6", "40");
|
|
||||||
setText("AttribVal7", "50");
|
|
||||||
setText("AttribVal8", "40");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void setPlayerName(const std::string& playerName)
|
void setPlayerName(const std::string& playerName)
|
||||||
|
@ -218,24 +224,6 @@ namespace MWGui
|
||||||
mMainWidget->setCaption(playerName);
|
mMainWidget->setCaption(playerName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set label text for the value with the given ID.
|
|
||||||
void setLabel (const std::string& id, const std::string& label)
|
|
||||||
{
|
|
||||||
static const char *ids[] =
|
|
||||||
{
|
|
||||||
"Attrib1", "Attrib2", "Attrib3", "Attrib4", "Attrib5", "Attrib6",
|
|
||||||
"Attrib7", "Attrib8",
|
|
||||||
0
|
|
||||||
};
|
|
||||||
|
|
||||||
for (int i=0; ids[i]; ++i)
|
|
||||||
if (ids[i]==id)
|
|
||||||
{
|
|
||||||
setText (id, label);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Set value for the given ID.
|
/// Set value for the given ID.
|
||||||
void setValue (const std::string& id, const MWMechanics::Stat<int>& value)
|
void setValue (const std::string& id, const MWMechanics::Stat<int>& value)
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,7 +19,7 @@ WindowManager::WindowManager(MyGUI::Gui *_gui, MWWorld::Environment& environment
|
||||||
hud = new HUD(w,h);
|
hud = new HUD(w,h);
|
||||||
menu = new MainMenu(w,h);
|
menu = new MainMenu(w,h);
|
||||||
map = new MapWindow();
|
map = new MapWindow();
|
||||||
stats = new StatsWindow();
|
stats = new StatsWindow (environment.mWorld->getStore());
|
||||||
console = new Console(w,h, environment, extensions);
|
console = new Console(w,h, environment, extensions);
|
||||||
|
|
||||||
// The HUD is always on
|
// The HUD is always on
|
||||||
|
@ -85,11 +85,6 @@ void WindowManager::updateVisible()
|
||||||
// All other modes are ignored
|
// All other modes are ignored
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowManager::setLabel (const std::string& id, const std::string& label)
|
|
||||||
{
|
|
||||||
stats->setLabel (id, label);
|
|
||||||
}
|
|
||||||
|
|
||||||
void WindowManager::setValue (const std::string& id, const MWMechanics::Stat<int>& value)
|
void WindowManager::setValue (const std::string& id, const MWMechanics::Stat<int>& value)
|
||||||
{
|
{
|
||||||
stats->setValue (id, value);
|
stats->setValue (id, value);
|
||||||
|
|
|
@ -139,9 +139,6 @@ namespace MWGui
|
||||||
|
|
||||||
MyGUI::Gui* getGui() const { return gui; }
|
MyGUI::Gui* getGui() const { return gui; }
|
||||||
|
|
||||||
void setLabel (const std::string& id, const std::string& label);
|
|
||||||
///< Set label text for the value with the given ID.
|
|
||||||
|
|
||||||
void setValue (const std::string& id, const MWMechanics::Stat<int>& value);
|
void setValue (const std::string& id, const MWMechanics::Stat<int>& value);
|
||||||
///< Set value for the given ID.
|
///< Set value for the given ID.
|
||||||
|
|
||||||
|
|
|
@ -14,29 +14,6 @@ namespace MWMechanics
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MechanicsManager::configureGUI()
|
|
||||||
{
|
|
||||||
const char *names[][2] =
|
|
||||||
{
|
|
||||||
{ "Attrib1", "sAttributeStrength" },
|
|
||||||
{ "Attrib2", "sAttributeIntelligence" },
|
|
||||||
{ "Attrib3", "sAttributeWillpower" },
|
|
||||||
{ "Attrib4", "sAttributeAgility" },
|
|
||||||
{ "Attrib5", "sAttributeSpeed" },
|
|
||||||
{ "Attrib6", "sAttributeEndurance" },
|
|
||||||
{ "Attrib7", "sAttributePersonality" },
|
|
||||||
{ "Attrib8", "sAttributeLuck" },
|
|
||||||
{ 0, 0 }
|
|
||||||
};
|
|
||||||
|
|
||||||
for (int i=0; names[i][0]; ++i)
|
|
||||||
{
|
|
||||||
std::string label = mStore.gameSettings.find (names[i][1])->str;
|
|
||||||
|
|
||||||
mWindowManager.setLabel (names[i][0], label);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MechanicsManager::addActor (const MWWorld::Ptr& ptr)
|
void MechanicsManager::addActor (const MWWorld::Ptr& ptr)
|
||||||
{
|
{
|
||||||
mActors.insert (ptr);
|
mActors.insert (ptr);
|
||||||
|
|
Loading…
Reference in a new issue