diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/status.cpp | 85 | ||||
-rw-r--r-- | src/gui/status.h | 12 | ||||
-rw-r--r-- | src/localplayer.h | 11 | ||||
-rw-r--r-- | src/main.cpp | 18 |
4 files changed, 52 insertions, 74 deletions
diff --git a/src/gui/status.cpp b/src/gui/status.cpp index b53e0942..bba9f045 100644 --- a/src/gui/status.cpp +++ b/src/gui/status.cpp @@ -40,7 +40,7 @@ StatusWindow::StatusWindow(LocalPlayer *player): setWindowName("Status"); setResizable(true); setDefaultSize((windowContainer->getWidth() - 365) / 2, - (windowContainer->getHeight() - 255) / 2, 365, 255); + (windowContainer->getHeight() - 255) / 2, 365, 280); loadWindowState(); // ---------------------- @@ -62,10 +62,6 @@ StatusWindow::StatusWindow(LocalPlayer *player): mMpBar = new ProgressBar(1.0f, 80, 15, 26, 102, 230); mMpValueLabel = new gcn::Label(""); - mJobXpLabel = new gcn::Label("Job:"); - mJobXpBar = new ProgressBar(1.0f, 60, 15, 220, 135, 203); - mJobValueLabel = new gcn::Label(""); - int y = 3; int x = 5; @@ -95,10 +91,6 @@ StatusWindow::StatusWindow(LocalPlayer *player): x += mMpBar->getWidth() + 5; mMpValueLabel->setPosition(x, y); - mJobXpLabel->setPosition(175, y); - mJobXpBar->setPosition(225, y); - mJobValueLabel->setPosition(290, y); - add(mLvlLabel); add(mMoneyLabel); add(mHpLabel); @@ -107,12 +99,9 @@ StatusWindow::StatusWindow(LocalPlayer *player): add(mMpValueLabel); add(mXpLabel); add(mXpValueLabel); - add(mJobXpLabel); - add(mJobValueLabel); add(mHpBar); add(mMpBar); add(mXpBar); - add(mJobXpBar); // ---------------------- // Stats Part @@ -141,7 +130,7 @@ StatusWindow::StatusWindow(LocalPlayer *player): mStatsReflexPoints = new gcn::Label("% Reflex:"); // New labels - for (int i = 0; i < 6; i++) { + for (int i = 0; i < 7; i++) { mStatsLabel[i] = new gcn::Label(); mStatsDisplayLabel[i] = new gcn::Label(); mPointsLabel[i] = new gcn::Label("0"); @@ -151,10 +140,11 @@ StatusWindow::StatusWindow(LocalPlayer *player): // Set button events Id mStatsButton[0] = new Button("+", "STR", this); mStatsButton[1] = new Button("+", "AGI", this); - mStatsButton[2] = new Button("+", "VIT", this); - mStatsButton[3] = new Button("+", "INT", this); - mStatsButton[4] = new Button("+", "DEX", this); - mStatsButton[5] = new Button("+", "LUK", this); + mStatsButton[2] = new Button("+", "DEX", this); + mStatsButton[3] = new Button("+", "VIT", this); + mStatsButton[4] = new Button("+", "INT", this); + mStatsButton[5] = new Button("+", "WIL", this); + mStatsButton[6] = new Button("+", "CHR", this); // Set position @@ -163,16 +153,17 @@ StatusWindow::StatusWindow(LocalPlayer *player): int totalLabelY = mStatsTotalLabel->getY(); mStatsCostLabel->setPosition(170, totalLabelY); - for (int i = 0; i < 6; i++) + for (int i = 0; i < 7; i++) { - mStatsLabel[i]->setPosition(5, mStatsTotalLabel->getY() + (i * 23) + 15); + mStatsLabel[i]->setPosition(5, + mStatsTotalLabel->getY() + (i * 23) + 15); mStatsDisplayLabel[i]->setPosition(115, totalLabelY + (i * 23) + 15); mStatsButton[i]->setPosition(145, totalLabelY + (i * 23) + 10); mPointsLabel[i]->setPosition(175, totalLabelY + (i * 23) + 15); } - mRemainingStatsPointsLabel->setPosition(5, mPointsLabel[5]->getY() + 25); + mRemainingStatsPointsLabel->setPosition(5, mPointsLabel[6]->getY() + 25); mStatsAttackLabel->setPosition(220, mStatsLabel[0]->getY()); mStatsDefenseLabel->setPosition(220, mStatsLabel[1]->getY()); @@ -180,7 +171,7 @@ StatusWindow::StatusWindow(LocalPlayer *player): mStatsMagicDefenseLabel->setPosition(220, mStatsLabel[3]->getY()); mStatsAccuracyLabel->setPosition(220, mStatsLabel[4]->getY()); mStatsEvadeLabel->setPosition(220, mStatsLabel[5]->getY()); - mStatsReflexLabel->setPosition(220, mRemainingStatsPointsLabel->getY()); + mStatsReflexLabel->setPosition(220, mStatsLabel[6]->getY()); mStatsAttackPoints->setPosition(310, mStatsLabel[0]->getY()); mStatsDefensePoints->setPosition(310, mStatsLabel[1]->getY()); @@ -188,13 +179,13 @@ StatusWindow::StatusWindow(LocalPlayer *player): mStatsMagicDefensePoints->setPosition(310, mStatsLabel[3]->getY()); mStatsAccuracyPoints->setPosition(310, mStatsLabel[4]->getY()); mStatsEvadePoints->setPosition(310, mStatsLabel[5]->getY()); - mStatsReflexPoints->setPosition(310, mRemainingStatsPointsLabel->getY()); + mStatsReflexPoints->setPosition(310, mStatsLabel[6]->getY()); // Assemble add(mStatsTitleLabel); add(mStatsTotalLabel); add(mStatsCostLabel); - for(int i = 0; i < 6; i++) + for(int i = 0; i < 7; i++) { add(mStatsLabel[i]); add(mStatsDisplayLabel[i]); @@ -230,9 +221,6 @@ void StatusWindow::update() mMoneyLabel->setCaption("Money: " + toString(mPlayer->mMoney) + " GP"); mMoneyLabel->adjustSize(); - mJobXpLabel->setCaption("Job: " + toString(mPlayer->mJobLevel)); - mJobXpLabel->adjustSize(); - mHpValueLabel->setCaption(toString(mPlayer->mHp) + "/" + toString(mPlayer->mMaxHp)); mHpValueLabel->adjustSize(); @@ -245,10 +233,6 @@ void StatusWindow::update() "/" + toString(mPlayer->mXpForNextLevel)); mXpValueLabel->adjustSize(); - mJobValueLabel->setCaption(toString(mPlayer->mJobXp) + - "/" + toString(mPlayer->mJobXpForNextLevel)); - mJobValueLabel->adjustSize(); - // HP Bar coloration if (mPlayer->mHp < int(mPlayer->mMaxHp / 3)) { @@ -267,27 +251,26 @@ void StatusWindow::update() // mMpBar->setProgress((float)mPlayer->mp / (float)mPlayer->maxMp); mXpBar->setProgress( - (float)mPlayer->mXp / (float)mPlayer->mXpForNextLevel); - mJobXpBar->setProgress( - (float)mPlayer->mJobXp / (float)mPlayer->mJobXpForNextLevel); + (float) mPlayer->mXp / (float) mPlayer->mXpForNextLevel); // Stats Part // ---------- - static const std::string attrNames[6] = { + const std::string attrNames[7] = { "Strength", "Agility", + "Dexterity", "Vitality", "Intelligence", - "Dexterity", - "Luck" + "Willpower", + "Charisma" }; int statusPoints = mPlayer->mStatsPointsToAttribute; // Update labels - for (int i = 0; i < 6; i++) { + for (int i = 0; i < 7; i++) { mStatsLabel[i]->setCaption(attrNames[i]); - mStatsDisplayLabel[i]->setCaption(toString((int)mPlayer->mAttr[i])); - mPointsLabel[i]->setCaption(toString((int)mPlayer->mAttrUp[i])); + mStatsDisplayLabel[i]->setCaption(toString((int) mPlayer->mAttr[i])); + mPointsLabel[i]->setCaption(toString((int) mPlayer->mAttrUp[i])); mStatsLabel[i]->adjustSize(); mStatsDisplayLabel[i]->adjustSize(); @@ -346,12 +329,6 @@ void StatusWindow::update() mXpValueLabel->setPosition( mXpBar->getX() + mXpBar->getWidth() + 5, mXpLabel->getY()); - - mJobXpLabel->setPosition(mXpLabel->getX(), mMpLabel->getY()); - mJobXpBar->setPosition( - mXpBar->getX() + mXpBar->getWidth() - mJobXpBar->getWidth(), - mJobXpLabel->getY()); - mJobValueLabel->setPosition(290, mJobXpLabel->getY()); } void StatusWindow::draw(gcn::Graphics *g) @@ -370,25 +347,29 @@ void StatusWindow::action(const std::string &eventId, gcn::Widget *widget) { mPlayer->raiseAttribute(LocalPlayer::STR); } - if (eventId == "AGI") + else if (eventId == "AGI") { mPlayer->raiseAttribute(LocalPlayer::AGI); } - if (eventId == "VIT") + else if (eventId == "DEX") + { + mPlayer->raiseAttribute(LocalPlayer::DEX); + } + else if (eventId == "VIT") { mPlayer->raiseAttribute(LocalPlayer::VIT); } - if (eventId == "INT") + else if (eventId == "INT") { mPlayer->raiseAttribute(LocalPlayer::INT); } - if (eventId == "DEX") + else if (eventId == "WIL") { - mPlayer->raiseAttribute(LocalPlayer::DEX); + mPlayer->raiseAttribute(LocalPlayer::WIL); } - if (eventId == "LUK") + else if (eventId == "CHR") { - mPlayer->raiseAttribute(LocalPlayer::LUK); + mPlayer->raiseAttribute(LocalPlayer::CHR); } } } diff --git a/src/gui/status.h b/src/gui/status.h index fe2140e3..43dfe8c2 100644 --- a/src/gui/status.h +++ b/src/gui/status.h @@ -71,9 +71,9 @@ class StatusWindow : public Window, public gcn::ActionListener { */ gcn::Label *mLvlLabel, *mMoneyLabel, *mHpLabel, *mHpValueLabel; gcn::Label *mMpLabel, *mMpValueLabel; - gcn::Label *mXpLabel, *mXpValueLabel, *mJobXpLabel, *mJobValueLabel; + gcn::Label *mXpLabel, *mXpValueLabel; ProgressBar *mHpBar, *mMpBar; - ProgressBar *mXpBar, *mJobXpBar; + ProgressBar *mXpBar; /** * Derived Statistics captions @@ -91,15 +91,15 @@ class StatusWindow : public Window, public gcn::ActionListener { /** * Stats captions. */ - gcn::Label *mStatsLabel[6]; - gcn::Label *mPointsLabel[6]; - gcn::Label *mStatsDisplayLabel[6]; + gcn::Label *mStatsLabel[7]; + gcn::Label *mPointsLabel[7]; + gcn::Label *mStatsDisplayLabel[7]; gcn::Label *mRemainingStatsPointsLabel; /** * Stats buttons. */ - gcn::Button *mStatsButton[6]; + gcn::Button *mStatsButton[7]; }; extern StatusWindow *statusWindow; diff --git a/src/localplayer.h b/src/localplayer.h index 765b7cca..980b1aff 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -39,7 +39,7 @@ class LocalPlayer : public Player { public: enum Attribute { - STR = 0, AGI, VIT, INT, DEX, LUK + STR = 0, AGI, DEX, VIT, INT, WIL, CHR }; /** @@ -137,17 +137,16 @@ class LocalPlayer : public Player Uint32 mCharId; - Uint32 mXp, mJobXp; + Uint32 mXp; Uint16 mLevel; - Uint32 mJobLevel; - Uint32 mXpForNextLevel, mJobXpForNextLevel; + Uint32 mXpForNextLevel; Uint16 mHp, mMaxHp, mMp, mMaxMp; Uint32 mMoney; Uint32 mTotalWeight, mMaxWeight; - Uint8 mAttr[6]; - Uint8 mAttrUp[6]; + Uint8 mAttr[7]; + Uint8 mAttrUp[7]; Sint16 ATK, MATK, DEF, MDEF, HIT, FLEE; Sint16 ATK_BONUS, MATK_BONUS, DEF_BONUS, MDEF_BONUS, FLEE_BONUS; diff --git a/src/main.cpp b/src/main.cpp index 8163cde3..b9eeaeb5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -218,7 +218,7 @@ void initConfiguration(const Options &options) /** * Do all initialization stuff. */ -void init_engine() +void initEngine() { // Initialize SDL logger->log("Initializing SDL..."); @@ -273,11 +273,11 @@ void init_engine() graphics = new Graphics(); #endif - int width = (int)config.getValue("screenwidth", defaultScreenWidth); - int height = (int)config.getValue("screenheight", defaultScreenHeight); + int width = (int) config.getValue("screenwidth", defaultScreenWidth); + int height = (int) config.getValue("screenheight", defaultScreenHeight); int bpp = 0; - bool fullscreen = ((int)config.getValue("screen", 0) == 1); - bool hwaccel = ((int)config.getValue("hwaccel", 0) == 1); + bool fullscreen = ((int) config.getValue("screen", 0) == 1); + bool hwaccel = ((int) config.getValue("hwaccel", 0) == 1); // Try to set the desired video mode if (!graphics->setVideoMode(width, height, bpp, fullscreen, hwaccel)) @@ -511,16 +511,14 @@ int main(int argc, char *argv[]) logger->setLogFile(homeDir + std::string("/tmw.log")); logger->setLogToStandardOut(config.getValue("logToStandardOut", 0)); - initXML(); - initConfiguration(options); - - // Log the tmw version #ifdef PACKAGE_VERSION logger->log("The Mana World v%s", PACKAGE_VERSION); #endif - init_engine(); + initXML(); + initConfiguration(options); + initEngine(); Window *currentDialog = NULL; Image *login_wallpaper = NULL; |