mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-04 03:40:14 +00:00
Change indentation to four spaces
This commit is contained in:
parent
edcac879d7
commit
03158f4b62
@ -49,61 +49,61 @@ WindowManager::WindowManager(MyGUI::Gui *_gui, MWWorld::Environment& environment
|
|||||||
//Register own widgets with MyGUI
|
//Register own widgets with MyGUI
|
||||||
MyGUI::FactoryManager::getInstance().registerFactory<DialogeHistory>("Widget");
|
MyGUI::FactoryManager::getInstance().registerFactory<DialogeHistory>("Widget");
|
||||||
|
|
||||||
// Get size info from the Gui object
|
// Get size info from the Gui object
|
||||||
assert(gui);
|
assert(gui);
|
||||||
int w = gui->getViewSize().width;
|
int w = gui->getViewSize().width;
|
||||||
int h = gui->getViewSize().height;
|
int h = gui->getViewSize().height;
|
||||||
|
|
||||||
hud = new HUD(w,h, showFPSCounter);
|
hud = new HUD(w,h, showFPSCounter);
|
||||||
menu = new MainMenu(w,h);
|
menu = new MainMenu(w,h);
|
||||||
map = new MapWindow();
|
map = new MapWindow();
|
||||||
stats = new StatsWindow (environment);
|
stats = new StatsWindow (environment);
|
||||||
#if 0
|
#if 0
|
||||||
inventory = new InventoryWindow ();
|
inventory = new InventoryWindow ();
|
||||||
#endif
|
#endif
|
||||||
console = new Console(w,h, environment, extensions);
|
console = new Console(w,h, environment, extensions);
|
||||||
|
|
||||||
// The HUD is always on
|
// The HUD is always on
|
||||||
hud->setVisible(true);
|
hud->setVisible(true);
|
||||||
|
|
||||||
// Setup player stats
|
// Setup player stats
|
||||||
for (int i = 0; i < ESM::Attribute::Length; ++i)
|
for (int i = 0; i < ESM::Attribute::Length; ++i)
|
||||||
{
|
{
|
||||||
playerAttributes.insert(std::make_pair(ESM::Attribute::attributeIds[i], MWMechanics::Stat<int>()));
|
playerAttributes.insert(std::make_pair(ESM::Attribute::attributeIds[i], MWMechanics::Stat<int>()));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < ESM::Skill::Length; ++i)
|
for (int i = 0; i < ESM::Skill::Length; ++i)
|
||||||
{
|
{
|
||||||
playerSkillValues.insert(std::make_pair(ESM::Skill::skillIds[i], MWMechanics::Stat<float>()));
|
playerSkillValues.insert(std::make_pair(ESM::Skill::skillIds[i], MWMechanics::Stat<float>()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set up visibility
|
// Set up visibility
|
||||||
updateVisible();
|
updateVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
WindowManager::~WindowManager()
|
WindowManager::~WindowManager()
|
||||||
{
|
{
|
||||||
delete console;
|
delete console;
|
||||||
delete hud;
|
delete hud;
|
||||||
delete map;
|
delete map;
|
||||||
delete menu;
|
delete menu;
|
||||||
delete stats;
|
delete stats;
|
||||||
#if 0
|
#if 0
|
||||||
delete inventory;
|
delete inventory;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
delete nameDialog;
|
delete nameDialog;
|
||||||
delete raceDialog;
|
delete raceDialog;
|
||||||
delete dialogueWindow;
|
delete dialogueWindow;
|
||||||
delete classChoiceDialog;
|
delete classChoiceDialog;
|
||||||
delete generateClassQuestionDialog;
|
delete generateClassQuestionDialog;
|
||||||
delete generateClassResultDialog;
|
delete generateClassResultDialog;
|
||||||
delete pickClassDialog;
|
delete pickClassDialog;
|
||||||
delete createClassDialog;
|
delete createClassDialog;
|
||||||
delete birthSignDialog;
|
delete birthSignDialog;
|
||||||
delete reviewDialog;
|
delete reviewDialog;
|
||||||
|
|
||||||
cleanupGarbage();
|
cleanupGarbage();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowManager::cleanupGarbage()
|
void WindowManager::cleanupGarbage()
|
||||||
@ -147,181 +147,181 @@ void WindowManager::setGuiMode(GuiMode newMode)
|
|||||||
|
|
||||||
void WindowManager::updateVisible()
|
void WindowManager::updateVisible()
|
||||||
{
|
{
|
||||||
// Start out by hiding everything except the HUD
|
// Start out by hiding everything except the HUD
|
||||||
map->setVisible(false);
|
map->setVisible(false);
|
||||||
menu->setVisible(false);
|
menu->setVisible(false);
|
||||||
stats->setVisible(false);
|
stats->setVisible(false);
|
||||||
#if 0
|
#if 0
|
||||||
inventory->setVisible(false);
|
inventory->setVisible(false);
|
||||||
#endif
|
#endif
|
||||||
console->disable();
|
console->disable();
|
||||||
|
|
||||||
// Mouse is visible whenever we're not in game mode
|
// Mouse is visible whenever we're not in game mode
|
||||||
gui->setVisiblePointer(isGuiMode());
|
gui->setVisiblePointer(isGuiMode());
|
||||||
|
|
||||||
// If in game mode, don't show anything.
|
// If in game mode, don't show anything.
|
||||||
if(mode == GM_Game)
|
if(mode == GM_Game)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mode == GM_MainMenu)
|
if(mode == GM_MainMenu)
|
||||||
{
|
{
|
||||||
// Enable the main menu
|
// Enable the main menu
|
||||||
menu->setVisible(true);
|
menu->setVisible(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mode == GM_Console)
|
if(mode == GM_Console)
|
||||||
{
|
{
|
||||||
console->enable();
|
console->enable();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode == GM_Name)
|
if (mode == GM_Name)
|
||||||
{
|
|
||||||
if (nameDialog)
|
|
||||||
removeDialog(nameDialog);
|
|
||||||
nameDialog = new TextInputDialog(environment);
|
|
||||||
std::string sName = getGameSettingString("sName", "Name");
|
|
||||||
nameDialog->setTextLabel(sName);
|
|
||||||
nameDialog->setTextInput(playerName);
|
|
||||||
nameDialog->setNextButtonShow(nameChosen || reviewNext);
|
|
||||||
nameDialog->eventDone = MyGUI::newDelegate(this, &WindowManager::onNameDialogDone);
|
|
||||||
nameDialog->open();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mode == GM_Race)
|
|
||||||
{
|
|
||||||
if (raceDialog)
|
|
||||||
removeDialog(raceDialog);
|
|
||||||
raceDialog = new RaceDialog(environment);
|
|
||||||
raceDialog->setNextButtonShow(raceChosen || reviewNext);
|
|
||||||
raceDialog->setRaceId(playerRaceId);
|
|
||||||
raceDialog->eventDone = MyGUI::newDelegate(this, &WindowManager::onRaceDialogDone);
|
|
||||||
raceDialog->eventBack = MyGUI::newDelegate(this, &WindowManager::onRaceDialogBack);
|
|
||||||
raceDialog->open();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mode == GM_Class)
|
|
||||||
{
|
|
||||||
if (classChoiceDialog)
|
|
||||||
removeDialog(classChoiceDialog);
|
|
||||||
classChoiceDialog = new ClassChoiceDialog(environment);
|
|
||||||
classChoiceDialog->eventButtonSelected = MyGUI::newDelegate(this, &WindowManager::onClassChoice);
|
|
||||||
classChoiceDialog->open();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mode == GM_ClassGenerate)
|
|
||||||
{
|
|
||||||
generateClassStep = 0;
|
|
||||||
generateClass = "";
|
|
||||||
generateClassSpecializations[0] = 0;
|
|
||||||
generateClassSpecializations[1] = 0;
|
|
||||||
generateClassSpecializations[2] = 0;
|
|
||||||
showClassQuestionDialog();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mode == GM_ClassPick)
|
|
||||||
{
|
|
||||||
if (pickClassDialog)
|
|
||||||
removeDialog(pickClassDialog);
|
|
||||||
pickClassDialog = new PickClassDialog(environment);
|
|
||||||
pickClassDialog->setNextButtonShow(classChosen || reviewNext);
|
|
||||||
pickClassDialog->setClassId(playerClass.name);
|
|
||||||
pickClassDialog->eventDone = MyGUI::newDelegate(this, &WindowManager::onPickClassDialogDone);
|
|
||||||
pickClassDialog->eventBack = MyGUI::newDelegate(this, &WindowManager::onPickClassDialogBack);
|
|
||||||
pickClassDialog->open();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mode == GM_ClassCreate)
|
|
||||||
{
|
|
||||||
if (createClassDialog)
|
|
||||||
removeDialog(createClassDialog);
|
|
||||||
createClassDialog = new CreateClassDialog(environment);
|
|
||||||
createClassDialog->eventDone = MyGUI::newDelegate(this, &WindowManager::onCreateClassDialogDone);
|
|
||||||
createClassDialog->eventBack = MyGUI::newDelegate(this, &WindowManager::onCreateClassDialogBack);
|
|
||||||
createClassDialog->open();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mode == GM_Birth)
|
|
||||||
{
|
|
||||||
if (birthSignDialog)
|
|
||||||
removeDialog(birthSignDialog);
|
|
||||||
birthSignDialog = new BirthDialog(environment);
|
|
||||||
birthSignDialog->setNextButtonShow(birthSignChosen || reviewNext);
|
|
||||||
birthSignDialog->setBirthId(playerBirthSignId);
|
|
||||||
birthSignDialog->eventDone = MyGUI::newDelegate(this, &WindowManager::onBirthSignDialogDone);
|
|
||||||
birthSignDialog->eventBack = MyGUI::newDelegate(this, &WindowManager::onBirthSignDialogBack);
|
|
||||||
birthSignDialog->open();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mode == GM_Review)
|
|
||||||
{
|
|
||||||
reviewNext = false;
|
|
||||||
if (reviewDialog)
|
|
||||||
removeDialog(reviewDialog);
|
|
||||||
reviewDialog = new ReviewDialog(environment);
|
|
||||||
reviewDialog->setPlayerName(playerName);
|
|
||||||
reviewDialog->setRace(playerRaceId);
|
|
||||||
reviewDialog->setClass(playerClass);
|
|
||||||
reviewDialog->setBirthSign(playerBirthSignId);
|
|
||||||
|
|
||||||
reviewDialog->setHealth(playerHealth);
|
|
||||||
reviewDialog->setMagicka(playerMagicka);
|
|
||||||
reviewDialog->setFatigue(playerFatigue);
|
|
||||||
|
|
||||||
{
|
|
||||||
std::map<ESM::Attribute::AttributeID, MWMechanics::Stat<int> >::iterator end = playerAttributes.end();
|
|
||||||
for (std::map<ESM::Attribute::AttributeID, MWMechanics::Stat<int> >::iterator it = playerAttributes.begin(); it != end; ++it)
|
|
||||||
{
|
|
||||||
reviewDialog->setAttribute(it->first, it->second);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
std::map<ESM::Skill::SkillEnum, MWMechanics::Stat<float> >::iterator end = playerSkillValues.end();
|
|
||||||
for (std::map<ESM::Skill::SkillEnum, MWMechanics::Stat<float> >::iterator it = playerSkillValues.begin(); it != end; ++it)
|
|
||||||
{
|
|
||||||
reviewDialog->setSkillValue(it->first, it->second);
|
|
||||||
}
|
|
||||||
reviewDialog->configureSkills(playerMajorSkills, playerMinorSkills);
|
|
||||||
}
|
|
||||||
|
|
||||||
reviewDialog->eventDone = MyGUI::newDelegate(this, &WindowManager::onReviewDialogDone);
|
|
||||||
reviewDialog->eventBack = MyGUI::newDelegate(this, &WindowManager::onReviewDialogBack);
|
|
||||||
|
|
||||||
reviewDialog->eventNameActivated = MyGUI::newDelegate(this, &WindowManager::onNameDialogActivate);
|
|
||||||
reviewDialog->eventRaceActivated = MyGUI::newDelegate(this, &WindowManager::onRaceDialogActivate);
|
|
||||||
reviewDialog->eventClassActivated = MyGUI::newDelegate(this, &WindowManager::onClassDialogActivate);
|
|
||||||
reviewDialog->eventBirthSignActivated = MyGUI::newDelegate(this, &WindowManager::onBirthSignDialogActivate);
|
|
||||||
|
|
||||||
reviewDialog->open();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(mode == GM_Inventory)
|
|
||||||
{
|
{
|
||||||
// Ah, inventory mode. First, compute the effective set of
|
if (nameDialog)
|
||||||
// windows to show. This is controlled both by what windows the
|
removeDialog(nameDialog);
|
||||||
// user has opened/closed (the 'shown' variable) and by what
|
nameDialog = new TextInputDialog(environment);
|
||||||
// windows we are allowed to show (the 'allowed' var.)
|
std::string sName = getGameSettingString("sName", "Name");
|
||||||
int eff = shown & allowed;
|
nameDialog->setTextLabel(sName);
|
||||||
|
nameDialog->setTextInput(playerName);
|
||||||
|
nameDialog->setNextButtonShow(nameChosen || reviewNext);
|
||||||
|
nameDialog->eventDone = MyGUI::newDelegate(this, &WindowManager::onNameDialogDone);
|
||||||
|
nameDialog->open();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Show the windows we want
|
if (mode == GM_Race)
|
||||||
map -> setVisible( (eff & GW_Map) != 0 );
|
{
|
||||||
stats -> setVisible( (eff & GW_Stats) != 0 );
|
if (raceDialog)
|
||||||
|
removeDialog(raceDialog);
|
||||||
|
raceDialog = new RaceDialog(environment);
|
||||||
|
raceDialog->setNextButtonShow(raceChosen || reviewNext);
|
||||||
|
raceDialog->setRaceId(playerRaceId);
|
||||||
|
raceDialog->eventDone = MyGUI::newDelegate(this, &WindowManager::onRaceDialogDone);
|
||||||
|
raceDialog->eventBack = MyGUI::newDelegate(this, &WindowManager::onRaceDialogBack);
|
||||||
|
raceDialog->open();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode == GM_Class)
|
||||||
|
{
|
||||||
|
if (classChoiceDialog)
|
||||||
|
removeDialog(classChoiceDialog);
|
||||||
|
classChoiceDialog = new ClassChoiceDialog(environment);
|
||||||
|
classChoiceDialog->eventButtonSelected = MyGUI::newDelegate(this, &WindowManager::onClassChoice);
|
||||||
|
classChoiceDialog->open();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode == GM_ClassGenerate)
|
||||||
|
{
|
||||||
|
generateClassStep = 0;
|
||||||
|
generateClass = "";
|
||||||
|
generateClassSpecializations[0] = 0;
|
||||||
|
generateClassSpecializations[1] = 0;
|
||||||
|
generateClassSpecializations[2] = 0;
|
||||||
|
showClassQuestionDialog();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode == GM_ClassPick)
|
||||||
|
{
|
||||||
|
if (pickClassDialog)
|
||||||
|
removeDialog(pickClassDialog);
|
||||||
|
pickClassDialog = new PickClassDialog(environment);
|
||||||
|
pickClassDialog->setNextButtonShow(classChosen || reviewNext);
|
||||||
|
pickClassDialog->setClassId(playerClass.name);
|
||||||
|
pickClassDialog->eventDone = MyGUI::newDelegate(this, &WindowManager::onPickClassDialogDone);
|
||||||
|
pickClassDialog->eventBack = MyGUI::newDelegate(this, &WindowManager::onPickClassDialogBack);
|
||||||
|
pickClassDialog->open();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode == GM_ClassCreate)
|
||||||
|
{
|
||||||
|
if (createClassDialog)
|
||||||
|
removeDialog(createClassDialog);
|
||||||
|
createClassDialog = new CreateClassDialog(environment);
|
||||||
|
createClassDialog->eventDone = MyGUI::newDelegate(this, &WindowManager::onCreateClassDialogDone);
|
||||||
|
createClassDialog->eventBack = MyGUI::newDelegate(this, &WindowManager::onCreateClassDialogBack);
|
||||||
|
createClassDialog->open();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode == GM_Birth)
|
||||||
|
{
|
||||||
|
if (birthSignDialog)
|
||||||
|
removeDialog(birthSignDialog);
|
||||||
|
birthSignDialog = new BirthDialog(environment);
|
||||||
|
birthSignDialog->setNextButtonShow(birthSignChosen || reviewNext);
|
||||||
|
birthSignDialog->setBirthId(playerBirthSignId);
|
||||||
|
birthSignDialog->eventDone = MyGUI::newDelegate(this, &WindowManager::onBirthSignDialogDone);
|
||||||
|
birthSignDialog->eventBack = MyGUI::newDelegate(this, &WindowManager::onBirthSignDialogBack);
|
||||||
|
birthSignDialog->open();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode == GM_Review)
|
||||||
|
{
|
||||||
|
reviewNext = false;
|
||||||
|
if (reviewDialog)
|
||||||
|
removeDialog(reviewDialog);
|
||||||
|
reviewDialog = new ReviewDialog(environment);
|
||||||
|
reviewDialog->setPlayerName(playerName);
|
||||||
|
reviewDialog->setRace(playerRaceId);
|
||||||
|
reviewDialog->setClass(playerClass);
|
||||||
|
reviewDialog->setBirthSign(playerBirthSignId);
|
||||||
|
|
||||||
|
reviewDialog->setHealth(playerHealth);
|
||||||
|
reviewDialog->setMagicka(playerMagicka);
|
||||||
|
reviewDialog->setFatigue(playerFatigue);
|
||||||
|
|
||||||
|
{
|
||||||
|
std::map<ESM::Attribute::AttributeID, MWMechanics::Stat<int> >::iterator end = playerAttributes.end();
|
||||||
|
for (std::map<ESM::Attribute::AttributeID, MWMechanics::Stat<int> >::iterator it = playerAttributes.begin(); it != end; ++it)
|
||||||
|
{
|
||||||
|
reviewDialog->setAttribute(it->first, it->second);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
std::map<ESM::Skill::SkillEnum, MWMechanics::Stat<float> >::iterator end = playerSkillValues.end();
|
||||||
|
for (std::map<ESM::Skill::SkillEnum, MWMechanics::Stat<float> >::iterator it = playerSkillValues.begin(); it != end; ++it)
|
||||||
|
{
|
||||||
|
reviewDialog->setSkillValue(it->first, it->second);
|
||||||
|
}
|
||||||
|
reviewDialog->configureSkills(playerMajorSkills, playerMinorSkills);
|
||||||
|
}
|
||||||
|
|
||||||
|
reviewDialog->eventDone = MyGUI::newDelegate(this, &WindowManager::onReviewDialogDone);
|
||||||
|
reviewDialog->eventBack = MyGUI::newDelegate(this, &WindowManager::onReviewDialogBack);
|
||||||
|
|
||||||
|
reviewDialog->eventNameActivated = MyGUI::newDelegate(this, &WindowManager::onNameDialogActivate);
|
||||||
|
reviewDialog->eventRaceActivated = MyGUI::newDelegate(this, &WindowManager::onRaceDialogActivate);
|
||||||
|
reviewDialog->eventClassActivated = MyGUI::newDelegate(this, &WindowManager::onClassDialogActivate);
|
||||||
|
reviewDialog->eventBirthSignActivated = MyGUI::newDelegate(this, &WindowManager::onBirthSignDialogActivate);
|
||||||
|
|
||||||
|
reviewDialog->open();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(mode == GM_Inventory)
|
||||||
|
{
|
||||||
|
// Ah, inventory mode. First, compute the effective set of
|
||||||
|
// windows to show. This is controlled both by what windows the
|
||||||
|
// user has opened/closed (the 'shown' variable) and by what
|
||||||
|
// windows we are allowed to show (the 'allowed' var.)
|
||||||
|
int eff = shown & allowed;
|
||||||
|
|
||||||
|
// Show the windows we want
|
||||||
|
map -> setVisible( (eff & GW_Map) != 0 );
|
||||||
|
stats -> setVisible( (eff & GW_Stats) != 0 );
|
||||||
#if 0
|
#if 0
|
||||||
// inventory -> setVisible( eff & GW_Inventory );
|
// inventory -> setVisible( eff & GW_Inventory );
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode == GM_Dialogue)
|
if (mode == GM_Dialogue)
|
||||||
@ -335,10 +335,10 @@ void WindowManager::updateVisible()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Unsupported mode, switch back to game
|
// Unsupported mode, switch back to game
|
||||||
// Note: The call will eventually end up this method again but
|
// Note: The call will eventually end up this method again but
|
||||||
// will stop at the check if(mode == GM_Game) above.
|
// will stop at the check if(mode == GM_Game) above.
|
||||||
setGuiMode(GM_Game);
|
setGuiMode(GM_Game);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowManager::setValue (const std::string& id, const MWMechanics::Stat<int>& value)
|
void WindowManager::setValue (const std::string& id, const MWMechanics::Stat<int>& value)
|
||||||
@ -1003,3 +1003,4 @@ void WindowManager::onBirthSignDialogActivate()
|
|||||||
reviewNext = true;
|
reviewNext = true;
|
||||||
setGuiMode(GM_Birth);
|
setGuiMode(GM_Birth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user