mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-21 12:53:51 +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
|
@ -220,8 +220,6 @@ void OMW::Engine::go()
|
||||||
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;
|
||||||
|
@ -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