diff options
author | Eugenio Favalli <elvenprogrammer@gmail.com> | 2005-03-04 16:34:02 +0000 |
---|---|---|
committer | Eugenio Favalli <elvenprogrammer@gmail.com> | 2005-03-04 16:34:02 +0000 |
commit | 7a57cee0d153a4db1d82369aae9160e8ece9ba26 (patch) | |
tree | a64fd35942c72d8eb1250effaaca0f4b82768cfc /src/gui | |
parent | 47ddb7669a56c32597510d8153a6aa156bb4a397 (diff) | |
download | mana-client-7a57cee0d153a4db1d82369aae9160e8ece9ba26.tar.gz mana-client-7a57cee0d153a4db1d82369aae9160e8ece9ba26.tar.bz2 mana-client-7a57cee0d153a4db1d82369aae9160e8ece9ba26.tar.xz mana-client-7a57cee0d153a4db1d82369aae9160e8ece9ba26.zip |
A bunch of updates:
- inventory fixes
- equipment fixes
- graphic updates (items and monsters)
- weaponary system
- fixed status window
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/equipment.cpp | 21 | ||||
-rw-r--r-- | src/gui/equipment.h | 11 | ||||
-rw-r--r-- | src/gui/inventory.cpp | 9 | ||||
-rw-r--r-- | src/gui/itemcontainer.cpp | 5 | ||||
-rw-r--r-- | src/gui/itemcontainer.h | 2 | ||||
-rw-r--r-- | src/gui/stats.cpp | 23 | ||||
-rw-r--r-- | src/gui/stats.h | 1 |
7 files changed, 51 insertions, 21 deletions
diff --git a/src/gui/equipment.cpp b/src/gui/equipment.cpp index 410be42b..770a88df 100644 --- a/src/gui/equipment.cpp +++ b/src/gui/equipment.cpp @@ -38,7 +38,8 @@ EquipmentWindow::EquipmentWindow(): itemset = new Spriteset(itemImg, 20, 20); for (int i = 0; i < 10; i++ ) { - equipments[i] = 0; + equipments[i].id = 0; + equipments[i].inventoryIndex = -1; } } @@ -55,12 +56,14 @@ void EquipmentWindow::draw(gcn::Graphics *graphics) Window::draw(graphics); for (int i = 0; i < 8; i++) { - if (equipments[i] > 0) { - itemset->spriteset[equipments[i] - 501]->draw(screen, + if (equipments[i].id > 0) { + itemset->spriteset[equipments[i].id - 501]->draw(screen, x + 22, y + 24 * i + 20); } graphics->setColor(gcn::Color(0, 0, 0)); graphics->drawRectangle(gcn::Rectangle(22, 24 * i + 20, 20, 20)); + + } } @@ -69,10 +72,18 @@ void EquipmentWindow::action(const std::string &eventId) } void EquipmentWindow::addEquipment(int index, int id) { - equipments[index] = id; + equipments[index].id = id; } void EquipmentWindow::removeEquipment(int index) { - equipments[index] = 0; + equipments[index].id = 0; +} + +void EquipmentWindow::setInventoryIndex(int index, int inventoryIndex) { + equipments[index].inventoryIndex = inventoryIndex; +} + +int EquipmentWindow::getInventoryIndex(int index) { + return equipments[index].inventoryIndex; } diff --git a/src/gui/equipment.h b/src/gui/equipment.h index 79f229d4..7a945f4c 100644 --- a/src/gui/equipment.h +++ b/src/gui/equipment.h @@ -28,6 +28,11 @@ #include "gui.h" #include "window.h" +typedef struct { + int id; + int inventoryIndex; +} EQUIPMENT_HOLDER; + /** * Equipment dialog. * @@ -59,7 +64,11 @@ class EquipmentWindow : public Window, gcn::ActionListener { void removeEquipment(int index); - int equipments[10]; + void setInventoryIndex(int index, int inventoryIndex); + + int getInventoryIndex(int index); + + EQUIPMENT_HOLDER equipments[10]; private: diff --git a/src/gui/inventory.cpp b/src/gui/inventory.cpp index 326a8e70..4681d047 100644 --- a/src/gui/inventory.cpp +++ b/src/gui/inventory.cpp @@ -66,19 +66,11 @@ void InventoryWindow::draw(gcn::Graphics *graphics) int InventoryWindow::addItem(int index, int id, int quantity, bool equipment) { - /*items[index].id = id; - items[index].quantity += quantity;*/ items->addItem(index, id, quantity, equipment); return 0; } int InventoryWindow::removeItem(int id) { - /*for (int i = 0; i < INVENTORY_SIZE; i++) { - if (items[i].id == id) { - items[i].id = -1; - items[i].quantity = 0; - } - }*/ items->removeItem(id); return 0; } @@ -128,7 +120,6 @@ void InventoryWindow::unequipItem(int index) { WFIFOW(2) = net_w_value(index); WFIFOSET(4); while ((out_size > 0)) flush(); - } void InventoryWindow::action(const std::string &eventId) diff --git a/src/gui/itemcontainer.cpp b/src/gui/itemcontainer.cpp index 30d6bde3..4398fcb2 100644 --- a/src/gui/itemcontainer.cpp +++ b/src/gui/itemcontainer.cpp @@ -184,3 +184,8 @@ void ItemContainer::setEquipped(int index, bool equipped) { items[index].equipped = equipped; } + +void ItemContainer::setEquipment(int index, bool equipment) +{ + items[index].equipment = equipment; +} diff --git a/src/gui/itemcontainer.h b/src/gui/itemcontainer.h index dc88655a..3dbc3b7c 100644 --- a/src/gui/itemcontainer.h +++ b/src/gui/itemcontainer.h @@ -130,6 +130,8 @@ class ItemContainer : public gcn::Widget bool isEquipped(int index); void setEquipped(int index, bool equipped); + + void setEquipment(int index, bool equipment); }; #endif diff --git a/src/gui/stats.cpp b/src/gui/stats.cpp index bc2e4f34..4629d5fa 100644 --- a/src/gui/stats.cpp +++ b/src/gui/stats.cpp @@ -33,6 +33,7 @@ StatsWindow::StatsWindow(): for (i = 0; i < 6; i++) { statsLabel[i] = new gcn::Label(); statsDisplayLabel[i] = new gcn::Label(); + pointsLabel[i] = new gcn::Label("0"); } remainingStatsPointsLabel = new gcn::Label(); @@ -51,9 +52,10 @@ StatsWindow::StatsWindow(): // Set position for (i = 0; i < 6; i++) { - statsLabel[i]->setPosition(10,(i*23)+10); - statsDisplayLabel[i]->setPosition(120,(i*23)+10); - statsButton[i]->setPosition(170,(i*23)+10); + statsLabel[i]->setPosition(10,(i * 23) + 10); + statsDisplayLabel[i]->setPosition(120,(i * 23) + 10); + statsButton[i]->setPosition(150, (i * 23) + 5); + pointsLabel[i]->setPosition(180, (i * 23) + 10); } remainingStatsPointsLabel->setPosition(10, 156); @@ -62,6 +64,7 @@ StatsWindow::StatsWindow(): add(statsLabel[i]); add(statsDisplayLabel[i]); add(statsButton[i]); + add(pointsLabel[i]); statsButton[i]->addActionListener(this); } add(remainingStatsPointsLabel); @@ -75,6 +78,7 @@ StatsWindow::StatsWindow(): void StatsWindow::update(){ std::stringstream statsStr[6]; std::stringstream figureStr[6]; + std::stringstream pointsStr[6]; std::stringstream remainingStatsPointsStr; statsStr[0] << "Strength:"; @@ -90,9 +94,14 @@ void StatsWindow::update(){ statsStr[5] << "Luck:"; figureStr[5] << (int)char_info->LUK; - // for testing only... - - //remainingStatsPointsStr << "Remaining Status Points : " << char_info->statsPointsToAttribute; + remainingStatsPointsStr << "Remaining Status Points : " << char_info->statsPointsToAttribute; + + pointsStr[0] << (int)char_info->STRUp; + pointsStr[1] << (int)char_info->AGIUp; + pointsStr[2] << (int)char_info->VITUp; + pointsStr[3] << (int)char_info->INTUp; + pointsStr[4] << (int)char_info->DEXUp; + pointsStr[5] << (int)char_info->LUKUp; // Update labels for (i = 0; i < 6; i++) { @@ -100,6 +109,8 @@ void StatsWindow::update(){ statsLabel[i]->adjustSize(); statsDisplayLabel[i]->setCaption(figureStr[i].str()); statsDisplayLabel[i]->adjustSize(); + pointsLabel[i]->setCaption(pointsStr[i].str()); + pointsLabel[i]->adjustSize(); } remainingStatsPointsLabel->setCaption(remainingStatsPointsStr.str()); remainingStatsPointsLabel->adjustSize(); diff --git a/src/gui/stats.h b/src/gui/stats.h index e03c2a86..edd94a73 100644 --- a/src/gui/stats.h +++ b/src/gui/stats.h @@ -57,6 +57,7 @@ class StatsWindow : public Window, public gcn::ActionListener { * Stats captions. */ gcn::Label *statsLabel[6]; + gcn::Label *pointsLabel[6]; gcn::Label *statsDisplayLabel[6]; gcn::Label *remainingStatsPointsLabel; |