summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--src/game.cpp44
-rw-r--r--src/gui/char_select.cpp26
-rw-r--r--src/gui/char_server.cpp18
-rw-r--r--src/gui/ministatus.cpp8
-rw-r--r--src/gui/skill.cpp18
-rw-r--r--src/gui/status.cpp31
-rw-r--r--src/gui/status.h3
-rw-r--r--src/playerinfo.h9
9 files changed, 86 insertions, 77 deletions
diff --git a/ChangeLog b/ChangeLog
index 2f10a23e..d5598b49 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,7 +2,11 @@
* src/game.cpp, src/gui/ministatus.cpp, src/gui/ministatus.h,
src/gui/menuwindow.h, src/gui/menuwindow.cpp, src/gui/status.cpp,
- src/gui/status.h: Improving General Layout.
+ src/gui/status.h: Improving General Layout.
+ * src/games.cpp, src/playerinfo.h, src/gui/char_server.cpp,
+ src/gui/char_select.cpp, src/gui/ministatus.cpp, src/gui/skill.cpp,
+ src/gui/status.cpp, src/gui/status.h : Now the derived stats values
+ are got from the server, and then, are correct ones.
2005-09-16 Bjørn Lindeijer <bjorn@lindeijer.nl>
diff --git a/src/game.cpp b/src/game.cpp
index 62787dff..0eed5da9 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -286,8 +286,8 @@ void do_init()
player_node->x = startX;
player_node->y = startY;
player_node->speed = 150;
- player_node->setHairColor(player_info->hair_color);
- player_node->setHairStyle(player_info->hair_style);
+ player_node->setHairColor(player_info->hairColor);
+ player_node->setHairStyle(player_info->hairStyle);
if (player_info->weapon == 11)
{
@@ -751,7 +751,7 @@ void do_input()
// Mouse button middle
else if (event.button.button == SDL_BUTTON_MIDDLE)
{
- /**
+ /*
* Some people haven't a mouse with three buttons,
* right Usiu??? ;-)
*/
@@ -1489,20 +1489,20 @@ void do_parse()
player_info->hp = msg.readLong();
break;
case 0x0006:
- player_info->max_hp = msg.readLong();
+ player_info->maxHp = msg.readLong();
break;
case 0x0007:
- player_info->sp = msg.readLong();
+ player_info->mp = msg.readLong();
break;
case 0x0008:
- player_info->max_sp = msg.readLong();
+ player_info->maxMp = msg.readLong();
break;
case 0x000b:
- player_info->lv = msg.readLong();
+ player_info->lvl = msg.readLong();
break;
case 0x000c:
- player_info->skill_point = msg.readLong();
- skillDialog->setPoints(player_info->skill_point);
+ player_info->skillPoint = msg.readLong();
+ skillDialog->setPoints(player_info->skillPoint);
break;
case 0x0018:
player_info->totalWeight = msg.readLong();
@@ -1511,7 +1511,7 @@ void do_parse()
player_info->maxWeight = msg.readLong();
break;
case 0x0037:
- player_info->job_lv = msg.readLong();
+ player_info->jobLvl = msg.readLong();
break;
case 0x0009:
player_info->statsPointsToAttribute = msg.readLong();
@@ -1595,7 +1595,7 @@ void do_parse()
player_info->xp = msg.readLong();
break;
case 0x0002:
- player_info->job_xp = msg.readLong();
+ player_info->jobXp = msg.readLong();
break;
case 0x0014:
player_info->gp = msg.readLong();
@@ -2010,17 +2010,17 @@ void do_parse()
player_info->DEXUp = msg.readByte();
player_info->LUK = msg.readByte();
player_info->LUKUp = msg.readByte();
- msg.readShort(); // ATK
- msg.readShort(); // ATK bonus
- msg.readShort(); // MATK max
- msg.readShort(); // MATK min
- msg.readShort(); // DEF
- msg.readShort(); // DEF bonus
- msg.readShort(); // MDEF
- msg.readShort(); // MDEF bonus
- msg.readShort(); // HIT
- msg.readShort(); // FLEE
- msg.readShort(); // FLEE bonus
+ player_info->ATK = msg.readShort(); // ATK
+ player_info->ATKBonus = msg.readShort(); // ATK bonus
+ player_info->MATK = msg.readShort(); // MATK max
+ player_info->MATKBonus = msg.readShort(); // MATK min
+ player_info->DEF = msg.readShort(); // DEF
+ player_info->DEFBonus = msg.readShort(); // DEF bonus
+ player_info->MDEF = msg.readShort(); // MDEF
+ player_info->MDEFBonus = msg.readShort(); // MDEF bonus
+ player_info->HIT = msg.readShort(); // HIT
+ player_info->FLEE = msg.readShort(); // FLEE
+ player_info->FLEEBonus = msg.readShort(); // FLEE bonus
msg.readShort(); // critical
msg.readShort(); // unknown
break;
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp
index e86c5d5a..44165707 100644
--- a/src/gui/char_select.cpp
+++ b/src/gui/char_select.cpp
@@ -158,8 +158,8 @@ void CharSelectDialog::setPlayerInfo(PLAYER_INFO *pi)
std::stringstream nameCaption, levelCaption, jobCaption, moneyCaption;
nameCaption << pi->name;
- levelCaption << "Lvl: " << pi->lv;
- jobCaption << "Job Lvl: " << pi->job_lv;
+ levelCaption << "Lvl: " << pi->lvl;
+ jobCaption << "Job Lvl: " << pi->jobLvl;
moneyCaption << "Gold: " << pi->gp;
nameLabel->setCaption(nameCaption.str());
@@ -170,8 +170,8 @@ void CharSelectDialog::setPlayerInfo(PLAYER_INFO *pi)
delCharButton->setEnabled(true);
selectButton->setEnabled(true);
- playerBox->hairStyle = pi->hair_style - 1;
- playerBox->hairColor = pi->hair_color - 1;
+ playerBox->hairStyle = pi->hairStyle - 1;
+ playerBox->hairColor = pi->hairColor - 1;
playerBox->showPlayer = true;
}
else {
@@ -430,28 +430,28 @@ void CharCreateDialog::serverCharCreate()
char_info[0]->id = msg.readLong();
char_info[0]->xp = msg.readLong();
char_info[0]->gp = msg.readLong();
- char_info[0]->job_xp = msg.readLong();
- char_info[0]->job_lv = msg.readLong();
+ char_info[0]->jobXp = msg.readLong();
+ char_info[0]->jobLvl = msg.readLong();
msg.skip(8); // unknown
msg.readLong(); // option
msg.readLong(); // karma
msg.readLong(); // manner
msg.skip(2); // unknown
char_info[0]->hp = msg.readShort();
- char_info[0]->max_hp = msg.readShort();
- char_info[0]->sp = msg.readShort();
- char_info[0]->max_sp = msg.readShort();
+ char_info[0]->maxHp = msg.readShort();
+ char_info[0]->mp = msg.readShort();
+ char_info[0]->maxMp = msg.readShort();
msg.readShort(); // speed
msg.readShort(); // class
- char_info[0]->hair_style = msg.readShort();
+ char_info[0]->hairStyle = msg.readShort();
char_info[0]->weapon = msg.readShort();
- char_info[0]->lv = msg.readShort();
+ char_info[0]->lvl = msg.readShort();
msg.readShort(); // skill point
msg.readShort(); // head bottom
msg.readShort(); // shield
msg.readShort(); // head option top
msg.readShort(); // head option mid
- char_info[0]->hair_color = msg.readShort();
+ char_info[0]->hairColor = msg.readShort();
msg.readShort(); // unknown
char_info[0]->name = msg.readString(24);
char_info[0]->STR = msg.readByte();
@@ -460,7 +460,7 @@ void CharCreateDialog::serverCharCreate()
char_info[0]->INT = msg.readByte();
char_info[0]->DEX = msg.readByte();
char_info[0]->LUK = msg.readByte();
- msg.readByte(); // character number
+ char_info[0]->characterNumber = msg.readByte(); // character number
msg.readByte(); // unknown
n_character = 1;
diff --git a/src/gui/char_server.cpp b/src/gui/char_server.cpp
index 79269a2e..4da8db84 100644
--- a/src/gui/char_server.cpp
+++ b/src/gui/char_server.cpp
@@ -179,28 +179,28 @@ void server_char_server(int serverIndex)
char_info[i]->id = msg.readLong();
char_info[i]->xp = msg.readLong();
char_info[i]->gp = msg.readLong();
- char_info[i]->job_xp = msg.readLong();
- char_info[i]->job_lv = msg.readLong();
+ char_info[i]->jobXp = msg.readLong();
+ char_info[i]->jobLvl = msg.readLong();
msg.skip(8); // unknown
msg.readLong(); // option
msg.readLong(); // karma
msg.readLong(); // manner
msg.skip(2); // unknown
char_info[i]->hp = msg.readShort();
- char_info[i]->max_hp = msg.readShort();
- char_info[i]->sp = msg.readShort();
- char_info[i]->max_sp = msg.readShort();
+ char_info[i]->maxHp = msg.readShort();
+ char_info[i]->mp = msg.readShort();
+ char_info[i]->maxMp = msg.readShort();
msg.readShort(); // speed
msg.readShort(); // class
- char_info[i]->hair_style = msg.readShort();
+ char_info[i]->hairStyle = msg.readShort();
char_info[i]->weapon = msg.readShort();
- char_info[i]->lv = msg.readShort();
+ char_info[i]->lvl = msg.readShort();
msg.readShort(); // skill point
msg.readShort(); // head bottom
msg.readShort(); // shield
msg.readShort(); // head option top
msg.readShort(); // head option mid
- char_info[i]->hair_color = msg.readShort();
+ char_info[i]->hairColor = msg.readShort();
msg.readShort(); // unknown
char_info[i]->name = msg.readString(24);
char_info[i]->STR = msg.readByte();
@@ -209,7 +209,7 @@ void server_char_server(int serverIndex)
char_info[i]->INT = msg.readByte();
char_info[i]->DEX = msg.readByte();
char_info[i]->LUK = msg.readByte();
- msg.readByte(); // character number
+ char_info[i]->characterNumber = msg.readByte(); // character number
msg.readByte(); // unknown
}
diff --git a/src/gui/ministatus.cpp b/src/gui/ministatus.cpp
index 7318ba74..2d834949 100644
--- a/src/gui/ministatus.cpp
+++ b/src/gui/ministatus.cpp
@@ -61,13 +61,13 @@ MiniStatusWindow::~MiniStatusWindow()
void MiniStatusWindow::update()
{
// HP Bar coloration
- if (player_info->hp < int(player_info->max_hp / 3))
+ if (player_info->hp < int(player_info->maxHp / 3))
{
hpBar->setColor(223, 32, 32); // Red
}
else
{
- if (player_info->hp < int((player_info->max_hp / 3) * 2))
+ if (player_info->hp < int((player_info->maxHp / 3) * 2))
{
hpBar->setColor(230, 171, 34); // Orange
}
@@ -77,8 +77,8 @@ void MiniStatusWindow::update()
}
}
- hpBar->setProgress((float)player_info->hp / (float)player_info->max_hp);
- // mpBar->setProgress((float)player_info->mp / (float)player_info->max_mp);
+ hpBar->setProgress((float)player_info->hp / (float)player_info->maxHp);
+ // mpBar->setProgress((float)player_info->mp / (float)player_info->maxMp);
}
void MiniStatusWindow::draw(gcn::Graphics *graphics)
diff --git a/src/gui/skill.cpp b/src/gui/skill.cpp
index 0e641768..a82b5c6a 100644
--- a/src/gui/skill.cpp
+++ b/src/gui/skill.cpp
@@ -122,7 +122,7 @@ void SkillDialog::action(const std::string& eventId)
{
// Increment skill
int selectedSkill = skillListBox->getSelected();
- if (player_info->skill_point > 0 && selectedSkill >= 0)
+ if (player_info->skillPoint > 0 && selectedSkill >= 0)
{
writeWord(0, 0x0112);
writeWord(2, skillList[selectedSkill]->id);
@@ -166,8 +166,8 @@ std::string SkillDialog::getElementAt(int i)
char tmp[128];
sprintf(tmp, "%s Lv: %i Sp: %i",
skill_db[skillList[i]->id],
- skillList[i]->lv,
- skillList[i]->sp);
+ skillList[i]->lvl,
+ skillList[i]->mp);
return tmp;
}
return "";
@@ -183,22 +183,22 @@ bool SkillDialog::hasSkill(int id)
return false;
}
-void SkillDialog::addSkill(int id, int lv, int sp)
+void SkillDialog::addSkill(int id, int lvl, int mp)
{
printf("%i\n", id);
SKILL *tmp = new SKILL();
tmp->id = id;
- tmp->lv = lv;
- tmp->sp = sp;
+ tmp->lvl = lvl;
+ tmp->mp = mp;
skillList.push_back(tmp);
}
-void SkillDialog::setSkill(int id, int lv, int sp)
+void SkillDialog::setSkill(int id, int lvl, int mp)
{
for (unsigned int i = 0; i < skillList.size(); i++) {
if (skillList[i]->id == id) {
- skillList[i]->lv = lv;
- skillList[i]->sp = sp;
+ skillList[i]->lvl = lvl;
+ skillList[i]->mp = mp;
}
}
}
diff --git a/src/gui/status.cpp b/src/gui/status.cpp
index 152e3ff3..9bdb95a6 100644
--- a/src/gui/status.cpp
+++ b/src/gui/status.cpp
@@ -249,7 +249,7 @@ void StatusWindow::update()
// Status Part
// -----------
updateText.str("");
- updateText << "Level: " << player_info->lv;
+ updateText << "Level: " << player_info->lvl;
lvlLabel->setCaption(updateText.str());
lvlLabel->adjustSize();
@@ -259,17 +259,17 @@ void StatusWindow::update()
gpLabel->adjustSize();
updateText.str("");
- updateText << "Job: " << player_info->job_lv;
+ updateText << "Job: " << player_info->jobLvl;
jobXpLabel->setCaption(updateText.str());
jobXpLabel->adjustSize();
updateText.str("");
- updateText << player_info->hp << "/" << player_info->max_hp;
+ updateText << player_info->hp << "/" << player_info->maxHp;
hpValueLabel->setCaption(updateText.str());
hpValueLabel->adjustSize();
updateText.str("");
- updateText << player_info->sp << "/" << player_info->max_sp;
+ updateText << player_info->mp << "/" << player_info->maxMp;
mpValueLabel->setCaption(updateText.str());
mpValueLabel->adjustSize();
@@ -279,18 +279,18 @@ void StatusWindow::update()
xpValueLabel->adjustSize();
updateText.str("");
- updateText << (int)player_info->job_xp << "/" << (int)player_info->jobXpForNextLevel;
+ updateText << (int)player_info->jobXp << "/" << (int)player_info->jobXpForNextLevel;
jobValueLabel->setCaption(updateText.str());
jobValueLabel->adjustSize();
// HP Bar coloration
- if (player_info->hp < int(player_info->max_hp / 3))
+ if (player_info->hp < int(player_info->maxHp / 3))
{
hpBar->setColor(223, 32, 32); // Red
}
else
{
- if (player_info->hp < int((player_info->max_hp / 3) * 2))
+ if (player_info->hp < int((player_info->maxHp / 3) * 2))
{
hpBar->setColor(230, 171, 34); // Orange
}
@@ -300,12 +300,13 @@ void StatusWindow::update()
}
}
- hpBar->setProgress((float)player_info->hp / (float)player_info->max_hp);
+ hpBar->setProgress((float)player_info->hp / (float)player_info->maxHp);
+ // mpBar->setProgress((float)player_info->mp / (float)player_info->maxMp);
xpBar->setProgress(
(float)player_info->xp / (float)player_info->xpForNextLevel);
jobXpBar->setProgress(
- (float)player_info->job_xp / (float)player_info->jobXpForNextLevel);
+ (float)player_info->jobXp / (float)player_info->jobXpForNextLevel);
// Stats Part
// ----------
@@ -362,37 +363,37 @@ void StatusWindow::update()
// Attack TODO: Count equipped Weapons and items attack bonuses
updateText.str("");
- updateText << (10 + (int)player_info->STR);
+ updateText << int(player_info->ATK + player_info->ATKBonus);
statsAttackPoints->setCaption(updateText.str());
statsAttackPoints->adjustSize();
// Defense TODO: Count equipped Armors and items defense bonuses
updateText.str("");
- updateText << (int)player_info->VIT;
+ updateText << int(player_info->DEF + player_info->DEFBonus);
statsDefensePoints->setCaption(updateText.str());
statsDefensePoints->adjustSize();
// Magic Attack TODO: Count equipped items M.Attack bonuses
updateText.str("");
- updateText << (10 + (int)player_info->INT);
+ updateText << int(player_info->MATK + player_info->MATKBonus);
statsMagicAttackPoints->setCaption(updateText.str());
statsMagicAttackPoints->adjustSize();
// Magic Defense TODO: Count equipped items M.Defense bonuses
updateText.str("");
- updateText << (int)player_info->AGI;
+ updateText << int(player_info->MDEF + player_info->MDEFBonus);
statsMagicDefensePoints->setCaption(updateText.str());
statsMagicDefensePoints->adjustSize();
// Accuracy %
updateText.str("");
- updateText << (50 + (int)player_info->DEX + (int)player_info->AGI);
+ updateText << (int)player_info->HIT;
statsAccuracyPoints->setCaption(updateText.str());
statsAccuracyPoints->adjustSize();
// Evasion %
updateText.str("");
- updateText << (((int)player_info->DEX / 2) + (int)player_info->AGI);
+ updateText << (int)player_info->FLEE;
statsEvadePoints->setCaption(updateText.str());
statsEvadePoints->adjustSize();
diff --git a/src/gui/status.h b/src/gui/status.h
index 3d9165af..1c5ed7ff 100644
--- a/src/gui/status.h
+++ b/src/gui/status.h
@@ -62,12 +62,13 @@ class StatusWindow : public Window, public gcn::ActionListener {
*/
void draw(gcn::Graphics *graphics);
- private:
/**
* Updates this dialog with values from PLAYER_INFO *char_info
*/
void update();
+ private:
+
/**
* Status Part
*/
diff --git a/src/playerinfo.h b/src/playerinfo.h
index c4028131..b351b083 100644
--- a/src/playerinfo.h
+++ b/src/playerinfo.h
@@ -31,12 +31,15 @@ struct PLAYER_INFO
int id;
float lastAttackTime; /**< Used to synchronize the charge dialog */
std::string name; /**< Player name */
- short hp, max_hp, sp, max_sp, lv;
+ short hp, maxHp, mp, maxMp, lvl;
short statsPointsToAttribute;
- int xp, xpForNextLevel, gp, job_xp, jobXpForNextLevel, job_lv;
- short statp, skill_point, hair_color, hair_style;
+ int xp, xpForNextLevel, gp, jobXp, jobXpForNextLevel, jobLvl;
+ short statPoint, skillPoint, hairColor, hairStyle;
char STR, AGI, VIT, INT, DEX, LUK;
char STRUp, AGIUp, VITUp, INTUp, DEXUp, LUKUp;
+ char ATK, ATKBonus, MATK, MATKBonus, DEF, DEFBonus, MDEF;
+ char MDEFBonus, HIT, FLEE, FLEEBonus;
+ char characterNumber;
int totalWeight, maxWeight;
short weapon;
};