Skip to content

Commit

Permalink
NWN: Change "loyalty" -> "lawfulness" in the character generator
Browse files Browse the repository at this point in the history
The ethical axis goes from "chaotic" (0) to "lawful" (100).
  • Loading branch information
DrMcCoy committed Oct 19, 2016
1 parent 6d194e4 commit 8f80f0e
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 32 deletions.
4 changes: 2 additions & 2 deletions src/engines/nwn/creature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1038,8 +1038,8 @@ uint8 Creature::getLawChaos() const {
return _lawChaos;
}

void Creature::setLawChaos(uint8 loyalty) {
_lawChaos = loyalty;
void Creature::setLawChaos(uint8 lawfulness) {
_lawChaos = lawfulness;
}

void Creature::setSoundSet(uint32 soundSet) {
Expand Down
2 changes: 1 addition & 1 deletion src/engines/nwn/creature.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class Creature : public Object {
/** Get the creature's law-chaos alignment. */
uint8 getLawChaos() const;
/** Set the creature's law-chaos alignment. */
void setLawChaos(uint8 loyalty);
void setLawChaos(uint8 lawfulness);

/** Set the creature's sound set. */
void setSoundSet(uint32 soundSet);
Expand Down
34 changes: 17 additions & 17 deletions src/engines/nwn/gui/chargen/charalignment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ namespace NWN {
CharAlignment::CharAlignment(CharGenChoices &choices, ::Engines::Console *console) :
CharGenBase(console) {

_choices = &choices;
_loyalty = 101;
_goodness = 101;
_choices = &choices;
_lawfulness = 101;
_goodness = 101;

load("cg_alignment");

Expand Down Expand Up @@ -72,9 +72,9 @@ void CharAlignment::reset() {
getEditBox("HelpEdit", true)->setText("fnt_galahad14", TalkMan.getString(458));

_buttons->setAllInactive();
_goodness = 101;
_loyalty = 101;
_choices->setAlign(_goodness, _loyalty);
_lawfulness = 101;
_goodness = 101;
_choices->setAlign(_goodness, _lawfulness);
}

void CharAlignment::show() {
Expand All @@ -92,19 +92,19 @@ void CharAlignment::hide() {

if (_returnCode == 1) {
// If alignment has been previously select, set it back.
if (_choices->getAlign(_goodness, _loyalty)) {
if (_choices->getAlign(_goodness, _lawfulness)) {
uint8 point[3] = { 0, 100, 50 };

uint loyalButton = 0;
uint lawfulnessButton = 0;
uint goodnessButton = 0;
for (uint a = 0; a < 3; ++a) {
if (point[a] == _loyalty)
loyalButton = 3 * a;
if (point[a] == _lawfulness)
lawfulnessButton = 3 * a;

if (point[a] == _goodness)
goodnessButton = a;
}
_buttons->setActive(loyalButton + goodnessButton);
_buttons->setActive(lawfulnessButton + goodnessButton);
} else {
reset();
}
Expand All @@ -113,7 +113,7 @@ void CharAlignment::hide() {

void CharAlignment::callbackActive(Widget &widget) {
if (widget.getTag() == "OkButton") {
_choices->setAlign(_goodness, _loyalty);
_choices->setAlign(_goodness, _lawfulness);
_returnCode = 2;
return;
}
Expand Down Expand Up @@ -153,12 +153,12 @@ void CharAlignment::setRestrict() {
uint axisRestrict[5] = { 0x01, 0x02, 0x04, 0x08, 0x10 };
uint good[] = { 1, 4, 7 };
uint evil[] = { 0, 3, 6 };
uint loyal[] = { 3, 4, 5 };
uint lawful[] = { 3, 4, 5 };
uint chaos[] = { 0, 1, 2 };

std::vector<uint> goodAxis(good, good + sizeof(good) / sizeof(uint));
std::vector<uint> evilAxis(evil, evil + sizeof(evil) / sizeof(uint));
std::vector<uint> loyalAxis(loyal, loyal + sizeof(loyal) / sizeof(uint));
std::vector<uint> lawfulAxis(lawful, lawful + sizeof(lawful) / sizeof(uint));
std::vector<uint> chaosAxis(chaos, chaos + sizeof(chaos) / sizeof(uint));
std::vector<uint> neutralAxis;

Expand All @@ -181,7 +181,7 @@ void CharAlignment::setRestrict() {

std::vector<std::vector<uint> > axis;
axis.push_back(neutralAxis);
axis.push_back(loyalAxis);
axis.push_back(lawfulAxis);
axis.push_back(chaosAxis);
axis.push_back(goodAxis);
axis.push_back(evilAxis);
Expand All @@ -204,8 +204,8 @@ void CharAlignment::getAlignment() {

uint8 point[3] = { 0, 100, 50 };
size_t rest = button % 3;
_goodness = point[rest];
_loyalty = point[(button - rest) / 3];
_goodness = point[rest];
_lawfulness = point[(button - rest) / 3];
}

} // End of namespace NWN
Expand Down
2 changes: 1 addition & 1 deletion src/engines/nwn/gui/chargen/charalignment.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class CharAlignment : public CharGenBase {
ButtonsGroup *_buttons;

uint8 _goodness;
uint8 _loyalty;
uint8 _lawfulness;
};

} // End of namespace NWN
Expand Down
16 changes: 8 additions & 8 deletions src/engines/nwn/gui/chargen/chargenchoices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void CharGenChoices::init() {
_classId = 0;

_goodness = 101;
_loyalty = 101;
_lawfulness = 101;

_soundSet = 0;
_notUsedSkills = 0;
Expand All @@ -75,7 +75,7 @@ void CharGenChoices::applyChoices() {

// Set Alignment
_creature->setGoodEvil(_goodness);
_creature->setLawChaos(_loyalty);
_creature->setLawChaos(_lawfulness);

// Set Abilities
size_t ab = 0;
Expand Down Expand Up @@ -210,9 +210,9 @@ void CharGenChoices::setClass(uint32 classId) {
}
}

void CharGenChoices::setAlign(uint8 goodness, uint8 loyalty) {
_goodness = goodness;
_loyalty = loyalty;
void CharGenChoices::setAlign(uint8 goodness, uint8 lawfulness) {
_goodness = goodness;
_lawfulness = lawfulness;
}

void CharGenChoices::setAbilities(std::vector<uint8> abilities,
Expand Down Expand Up @@ -442,13 +442,13 @@ uint32 CharGenChoices::getRace() const {
return _creature->getRace();
}

bool CharGenChoices::getAlign(uint8 &goodness, uint8 &loyalty) const {
bool CharGenChoices::getAlign(uint8 &goodness, uint8 &lawfulness) const {
// Check if alignment has been previously set.
if (_goodness > 100)
return false;

goodness = _goodness;
loyalty = _loyalty;
goodness = _goodness;
lawfulness = _lawfulness;
return true;
}

Expand Down
6 changes: 3 additions & 3 deletions src/engines/nwn/gui/chargen/chargenchoices.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class CharGenChoices {
void setRace(uint32 race);
void setPortrait(const Common::UString &portrait);
void setClass(uint32 classId);
void setAlign(uint8 goodness, uint8 loyalty);
void setAlign(uint8 goodness, uint8 lawfulness);
void setAbilities(std::vector<uint8> abilities, std::vector<uint8> racialAbilities);
void setPackage(uint8 package);
void setSkill(size_t skillIndex, uint8 rank);
Expand All @@ -96,7 +96,7 @@ class CharGenChoices {
bool hasPrereqFeat(uint32 featId, bool isClassFeat);
uint32 getClass() const;
uint32 getRace() const;
bool getAlign(uint8 &goodness, uint8 &loyalty) const;
bool getAlign(uint8 &goodness, uint8 &lawfulness) const;
uint8 getAbility(Ability ability) const;
uint8 getTotalAbility(Ability ability) const;
int8 getAbilityModifier(Ability ability);
Expand Down Expand Up @@ -127,7 +127,7 @@ class CharGenChoices {
uint32 _classId;
uint32 _soundSet;
uint8 _goodness;
uint8 _loyalty;
uint8 _lawfulness;
uint8 _package;
uint8 _notUsedSkills;
uint8 _spellSchool;
Expand Down

0 comments on commit 8f80f0e

Please sign in to comment.