Changed some variable names to follow Morrowind naming.

This commit is contained in:
Jan Borsodi 2010-09-12 14:14:54 +02:00
parent beee17b36f
commit 4d36cf2b55
3 changed files with 45 additions and 45 deletions

View file

@ -8,7 +8,7 @@ using namespace MWGui;
RaceDialog::RaceDialog() RaceDialog::RaceDialog()
: Layout("openmw_chargen_race_layout.xml") : Layout("openmw_chargen_race_layout.xml")
, sexIndex(0) , genderIndex(0)
, faceIndex(0) , faceIndex(0)
, hairIndex(0) , hairIndex(0)
, faceCount(10) , faceCount(10)
@ -31,10 +31,10 @@ RaceDialog::RaceDialog()
// Set up next/previous buttons // Set up next/previous buttons
MyGUI::ButtonPtr prevButton, nextButton; MyGUI::ButtonPtr prevButton, nextButton;
getWidget(prevButton, "PrevSexButton"); getWidget(prevButton, "PrevGenderButton");
getWidget(nextButton, "NextSexButton"); getWidget(nextButton, "NextGenderButton");
prevButton->eventMouseButtonClick = MyGUI::newDelegate(this, &RaceDialog::onSelectPreviousSex); prevButton->eventMouseButtonClick = MyGUI::newDelegate(this, &RaceDialog::onSelectPreviousGender);
nextButton->eventMouseButtonClick = MyGUI::newDelegate(this, &RaceDialog::onSelectNextSex); nextButton->eventMouseButtonClick = MyGUI::newDelegate(this, &RaceDialog::onSelectNextGender);
getWidget(prevButton, "PrevFaceButton"); getWidget(prevButton, "PrevFaceButton");
getWidget(nextButton, "NextFaceButton"); getWidget(nextButton, "NextFaceButton");
@ -53,11 +53,11 @@ RaceDialog::RaceDialog()
raceList->eventListMouseItemActivate = MyGUI::newDelegate(this, &RaceDialog::onSelectRace); raceList->eventListMouseItemActivate = MyGUI::newDelegate(this, &RaceDialog::onSelectRace);
getWidget(skillList, "SkillList"); getWidget(skillList, "SkillList");
getWidget(specialsList, "SpecialsList"); getWidget(spellPowerList, "SpellPowerList");
updateRaces(); updateRaces();
updateSkills(); updateSkills();
updateSpecials(); updateSpellPowers();
} }
int wrap(int index, int max) int wrap(int index, int max)
@ -70,14 +70,14 @@ int wrap(int index, int max)
return index; return index;
} }
void RaceDialog::selectPreviousSex() void RaceDialog::selectPreviousGender()
{ {
sexIndex = wrap(sexIndex - 1, 2); genderIndex = wrap(genderIndex - 1, 2);
} }
void RaceDialog::selectNextSex() void RaceDialog::selectNextGender()
{ {
sexIndex = wrap(sexIndex + 1, 2); genderIndex = wrap(genderIndex + 1, 2);
} }
void RaceDialog::selectPreviousFace() void RaceDialog::selectPreviousFace()
@ -107,14 +107,14 @@ void RaceDialog::onHeadRotate(MyGUI::VScroll*, size_t _position)
// TODO: Rotate head // TODO: Rotate head
} }
void RaceDialog::onSelectPreviousSex(MyGUI::Widget*) void RaceDialog::onSelectPreviousGender(MyGUI::Widget*)
{ {
selectPreviousSex(); selectPreviousGender();
} }
void RaceDialog::onSelectNextSex(MyGUI::Widget*) void RaceDialog::onSelectNextGender(MyGUI::Widget*)
{ {
selectNextSex(); selectNextGender();
} }
void RaceDialog::onSelectPreviousFace(MyGUI::Widget*) void RaceDialog::onSelectPreviousFace(MyGUI::Widget*)
@ -141,7 +141,7 @@ void RaceDialog::onSelectRace(MyGUI::List* _sender, size_t _index)
{ {
// TODO: Select actual race // TODO: Select actual race
updateSkills(); updateSkills();
updateSpecials(); updateSpellPowers();
} }
// update widget content // update widget content
@ -167,7 +167,7 @@ void RaceDialog::updateSkills()
} }
skillItems.clear(); skillItems.clear();
MyGUI::StaticTextPtr skillName, skillLevel; MyGUI::StaticTextPtr skillName, skillBonus;
const int lineHeight = 18; const int lineHeight = 18;
MyGUI::IntCoord coord1(0, 0, skillList->getWidth() - (40 + 4), 18); MyGUI::IntCoord coord1(0, 0, skillList->getWidth() - (40 + 4), 18);
MyGUI::IntCoord coord2(coord1.left + coord1.width, 0, 40, 18); MyGUI::IntCoord coord2(coord1.left + coord1.width, 0, 40, 18);
@ -187,28 +187,28 @@ void RaceDialog::updateSkills()
{ {
skillName = skillList->createWidget<MyGUI::StaticText>("SandText", coord1, MyGUI::Align::Default, "SkillName0"); skillName = skillList->createWidget<MyGUI::StaticText>("SandText", coord1, MyGUI::Align::Default, "SkillName0");
skillName->setCaption(inputList[i][0]); skillName->setCaption(inputList[i][0]);
skillLevel = skillList->createWidget<MyGUI::StaticText>("SandTextRight", coord2, MyGUI::Align::Default, "SkillLevel0"); skillBonus = skillList->createWidget<MyGUI::StaticText>("SandTextRight", coord2, MyGUI::Align::Default, "SkillBonus0");
skillLevel->setCaption(inputList[i][1]); skillBonus->setCaption(inputList[i][1]);
skillItems.push_back(skillName); skillItems.push_back(skillName);
skillItems.push_back(skillLevel); skillItems.push_back(skillBonus);
coord1.top += lineHeight; coord1.top += lineHeight;
coord2.top += lineHeight; coord2.top += lineHeight;
} }
} }
void RaceDialog::updateSpecials() void RaceDialog::updateSpellPowers()
{ {
for (std::vector<MyGUI::WidgetPtr>::iterator it = specialsItems.begin(); it != specialsItems.end(); ++it) for (std::vector<MyGUI::WidgetPtr>::iterator it = spellPowerItems.begin(); it != spellPowerItems.end(); ++it)
{ {
MyGUI::Gui::getInstance().destroyWidget(*it); MyGUI::Gui::getInstance().destroyWidget(*it);
} }
specialsItems.clear(); spellPowerItems.clear();
MyGUI::StaticTextPtr specialsName; MyGUI::StaticTextPtr spellPowerName;
const int lineHeight = 18; const int lineHeight = 18;
MyGUI::IntCoord coord(0, 0, specialsList->getWidth(), 18); MyGUI::IntCoord coord(0, 0, spellPowerList->getWidth(), 18);
const char *inputList[] = { const char *inputList[] = {
"Depth Perception", "Depth Perception",
@ -219,12 +219,12 @@ void RaceDialog::updateSpecials()
for (int i = 0; inputList[i]; ++i) for (int i = 0; inputList[i]; ++i)
{ {
std::string name = "specialsName"; std::string name = "spellPowerName";
name += i; name += i;
specialsName = specialsList->createWidget<MyGUI::StaticText>("SandText", coord, MyGUI::Align::Default, name); spellPowerName = spellPowerList->createWidget<MyGUI::StaticText>("SandText", coord, MyGUI::Align::Default, name);
specialsName->setCaption(inputList[i]); spellPowerName->setCaption(inputList[i]);
specialsItems.push_back(specialsName); spellPowerItems.push_back(spellPowerName);
coord.top += lineHeight; coord.top += lineHeight;
} }

View file

@ -29,8 +29,8 @@ namespace MWGui
public: public:
RaceDialog(); RaceDialog();
void selectPreviousSex(); void selectPreviousGender();
void selectNextSex(); void selectNextGender();
void selectPreviousFace(); void selectPreviousFace();
void selectNextFace(); void selectNextFace();
@ -41,8 +41,8 @@ namespace MWGui
protected: protected:
void onHeadRotate(MyGUI::VScroll* _sender, size_t _position); void onHeadRotate(MyGUI::VScroll* _sender, size_t _position);
void onSelectPreviousSex(MyGUI::Widget* _sender); void onSelectPreviousGender(MyGUI::Widget* _sender);
void onSelectNextSex(MyGUI::Widget* _sender); void onSelectNextGender(MyGUI::Widget* _sender);
void onSelectPreviousFace(MyGUI::Widget* _sender); void onSelectPreviousFace(MyGUI::Widget* _sender);
void onSelectNextFace(MyGUI::Widget* _sender); void onSelectNextFace(MyGUI::Widget* _sender);
@ -55,7 +55,7 @@ namespace MWGui
private: private:
void updateRaces(); void updateRaces();
void updateSkills(); void updateSkills();
void updateSpecials(); void updateSpellPowers();
MyGUI::CanvasPtr appearanceBox; MyGUI::CanvasPtr appearanceBox;
MyGUI::ListPtr raceList; MyGUI::ListPtr raceList;
@ -64,10 +64,10 @@ namespace MWGui
MyGUI::WidgetPtr skillList; MyGUI::WidgetPtr skillList;
std::vector<MyGUI::WidgetPtr> skillItems; std::vector<MyGUI::WidgetPtr> skillItems;
MyGUI::WidgetPtr specialsList; MyGUI::WidgetPtr spellPowerList;
std::vector<MyGUI::WidgetPtr> specialsItems; std::vector<MyGUI::WidgetPtr> spellPowerItems;
int sexIndex, faceIndex, hairIndex; int genderIndex, faceIndex, hairIndex;
int faceCount, hairCount; int faceCount, hairCount;
}; };
} }

View file

@ -15,12 +15,12 @@
<!-- Rotation of head --> <!-- Rotation of head -->
<Widget type="HScroll" skin="MW_HScroll" position="8 276 241 14" name="HeadRotate"/> <Widget type="HScroll" skin="MW_HScroll" position="8 276 241 14" name="HeadRotate"/>
<!-- Sex choice --> <!-- Gender choice -->
<Widget type="Button" skin="MW_ScrollLeft" position="8 298 14 14" name="PrevSexButton"/> <Widget type="Button" skin="MW_ScrollLeft" position="8 298 14 14" name="PrevGenderButton"/>
<Widget type="StaticText" skin="HeaderText" position="14 298 227 14" name="SexChoiceT"> <Widget type="StaticText" skin="HeaderText" position="14 298 227 14" name="GenderChoiceT">
<Property key="Widget_Caption" value="Change Sex"/> <Property key="Widget_Caption" value="Change Sex"/>
</Widget> </Widget>
<Widget type="Button" skin="MW_ScrollRight" position="235 298 14 14" name="NextSexButton"/> <Widget type="Button" skin="MW_ScrollRight" position="235 298 14 14" name="NextGenderButton"/>
<!-- Face choice --> <!-- Face choice -->
<Widget type="Button" skin="MW_ScrollLeft" position="8 320 14 14" name="PrevFaceButton"/> <Widget type="Button" skin="MW_ScrollLeft" position="8 320 14 14" name="PrevFaceButton"/>
@ -44,13 +44,13 @@
<Widget type="List" skin="MW_List" position="264 39 132 161" name="RaceList"> <Widget type="List" skin="MW_List" position="264 39 132 161" name="RaceList">
</Widget> </Widget>
<!-- Specials --> <!-- Spell powers -->
<Widget type="StaticText" skin="HeaderText" position="261 200 132 18" name="SpecialsT" align="ALIGN_LEFT ALIGN_TOP"> <Widget type="StaticText" skin="HeaderText" position="261 200 132 18" name="SpellPowerT" align="ALIGN_LEFT ALIGN_TOP">
<Property key="Widget_Caption" value="Specials"/> <Property key="Widget_Caption" value="Specials"/>
<Property key="Widget_AlignText" value="ALIGN_LEFT ALIGN_TOP"/> <Property key="Widget_AlignText" value="ALIGN_LEFT ALIGN_TOP"/>
</Widget> </Widget>
<!-- Specials sub-widgets will be placed here, no skin to make it invisible --> <!-- Spell power sub-widgets will be placed here, no skin to make it invisible -->
<Widget type="Widget" skin="" position="261 220 132 140" name="SpecialsList" /> <Widget type="Widget" skin="" position="261 220 132 140" name="SpellPowerList" />
<!-- Skill bonus --> <!-- Skill bonus -->
<Widget type="StaticText" skin="HeaderText" position="403 39 159 18" name="SkillsT" align="ALIGN_LEFT ALIGN_TOP"> <Widget type="StaticText" skin="HeaderText" position="403 39 159 18" name="SkillsT" align="ALIGN_LEFT ALIGN_TOP">