From 33bcf31d8eb5c7712e8a9d0b31489186a5c68521 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Tue, 28 Dec 2004 10:48:44 +0000 Subject: Renamed stats dialog to status dialog, which it is and to make room for the real stats dialog that is currently called the skill dialog. --- The Mana World.dev | 4 +-- file.list | 2 +- src/Makefile.am | 2 +- src/game.cpp | 2 +- src/game.h | 1 - src/graphic/graphic.cpp | 12 ++++---- src/graphic/graphic.h | 4 +-- src/gui/buysell.cpp | 6 ---- src/gui/buysell.h | 7 +---- src/gui/stats.cpp | 81 ------------------------------------------------- src/gui/stats.h | 57 ---------------------------------- src/gui/status.cpp | 81 +++++++++++++++++++++++++++++++++++++++++++++++++ src/gui/status.h | 57 ++++++++++++++++++++++++++++++++++ src/main.h | 1 - 14 files changed, 152 insertions(+), 165 deletions(-) delete mode 100644 src/gui/stats.cpp delete mode 100644 src/gui/stats.h create mode 100644 src/gui/status.cpp create mode 100644 src/gui/status.h diff --git a/The Mana World.dev b/The Mana World.dev index 38354190..2054d75f 100644 --- a/The Mana World.dev +++ b/The Mana World.dev @@ -78,7 +78,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit15] -FileName=src\gui\stats.h +FileName=src\gui\status.h CompileCpp=1 Folder=gui Compile=1 @@ -200,7 +200,7 @@ OverrideBuildCmd=0 BuildCmd= [Unit32] -FileName=src\gui\stats.cpp +FileName=src\gui\status.cpp CompileCpp=1 Folder=gui Compile=1 diff --git a/file.list b/file.list index f55f76af..50518f26 100644 --- a/file.list +++ b/file.list @@ -22,7 +22,7 @@ MODULES = src/sound/sound.cpp \ src/gui/shop.cpp \ src/gui/skill.cpp \ src/gui/slider.cpp \ - src/gui/stats.cpp \ + src/gui/status.cpp \ src/gui/textfield.cpp \ src/gui/window.cpp \ src/net/network.cpp \ diff --git a/src/Makefile.am b/src/Makefile.am index ef31f4c4..482168c6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -23,7 +23,7 @@ tmw_SOURCES = sound/sound.cpp \ gui/shop.cpp \ gui/skill.cpp \ gui/slider.cpp \ - gui/stats.cpp \ + gui/status.cpp \ gui/textfield.cpp \ gui/window.cpp \ net/network.cpp \ diff --git a/src/game.cpp b/src/game.cpp index b37d77bc..ff6e2c5f 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -620,7 +620,7 @@ void do_parse() { char_info->job_lv = RFIFOW(4); break; } - statsDialog->update(); + statusDialog->update(); if(char_info->hp==0) { OkDialog *death = new OkDialog(guiTop, "You're now dead, press ok to restart"); diff --git a/src/game.h b/src/game.h index 6b7cc073..fc9376f4 100644 --- a/src/game.h +++ b/src/game.h @@ -32,7 +32,6 @@ #include "main.h" #include "./gui/gui.h" #include "./gui/skill.h" -#include "./gui/stats.h" #include "./graphic/2xsai.h" #include #include diff --git a/src/graphic/graphic.cpp b/src/graphic/graphic.cpp index d37cafac..8627edd2 100644 --- a/src/graphic/graphic.cpp +++ b/src/graphic/graphic.cpp @@ -22,8 +22,8 @@ #include "graphic.h" #include "2xsai.h" #include "../gui/gui.h" -#include "../gui/stats.h" #include "../gui/textfield.h" +#include "../gui/status.h" #define TILESET_W 480 #define TILESET_H 320 @@ -53,7 +53,7 @@ char npc_button[10] = "Close"; gcn::TextField *chatInput; -StatsDialog *statsDialog; +StatusDialog *statusDialog; BuyDialog *buyDialog; BuySellDialog *buySellDialog; InventoryDialog *inventoryDialog; @@ -213,8 +213,8 @@ void init_graphic() { // Create dialogs - statsDialog = new StatsDialog(guiTop); - statsDialog->setPosition(SCREEN_W - statsDialog->getWidth() - 10, 10); + statusDialog = new StatusDialog(guiTop); + statusDialog->setPosition(SCREEN_W - statusDialog->getWidth() - 10, 10); buyDialog = new BuyDialog(guiTop); buyDialog->setVisible(false); @@ -607,7 +607,7 @@ void do_graphic(void) { } // Update character status display - statsDialog->update(); + statusDialog->update(); // Update GUI guiGraphics->setTarget(vpage[page_num]); @@ -625,7 +625,7 @@ void do_graphic(void) { } void exit_graphic() { - delete statsDialog; + delete statusDialog; delete buyDialog; shutdown_dialog(npc_player); diff --git a/src/graphic/graphic.h b/src/graphic/graphic.h index 6ad42676..5b6acdc4 100644 --- a/src/graphic/graphic.h +++ b/src/graphic/graphic.h @@ -33,7 +33,7 @@ #include "../gui/chat.h" #include "../gui/inventory.h" #include "../gui/npc.h" -#include "../gui/stats.h" +#include "../gui/status.h" #include "../../data/graphic/gfx_data.h" #include "image.h" #include @@ -50,7 +50,7 @@ extern int map_x, map_y, camera_x, camera_y; extern BITMAP *hairset; extern char npc_button[10]; -extern StatsDialog *statsDialog; +extern StatusDialog *statusDialog; extern BuyDialog *buyDialog; extern BuySellDialog *buySellDialog; extern InventoryDialog *inventoryDialog; diff --git a/src/gui/buysell.cpp b/src/gui/buysell.cpp index 730689e0..eae19917 100644 --- a/src/gui/buysell.cpp +++ b/src/gui/buysell.cpp @@ -61,9 +61,3 @@ BuySellDialog::~BuySellDialog() delete sellButton; delete cancelButton; } - -void BuySellDialog::action(const std::string& eventId) -{ - if (eventId == "cancel") { - } -} diff --git a/src/gui/buysell.h b/src/gui/buysell.h index fb03cc9e..5289f649 100644 --- a/src/gui/buysell.h +++ b/src/gui/buysell.h @@ -32,7 +32,7 @@ * * \ingroup GUI */ -class BuySellDialog : public Window, public gcn::ActionListener { +class BuySellDialog : public Window { public: /** * Constructor. The action listener passed will receive "sell", "buy" @@ -47,11 +47,6 @@ class BuySellDialog : public Window, public gcn::ActionListener { */ ~BuySellDialog(); - /** - * Called when receiving actions from the widgets. - */ - void action(const std::string& eventId); - private: gcn::Button *buyButton; gcn::Button *sellButton; diff --git a/src/gui/stats.cpp b/src/gui/stats.cpp deleted file mode 100644 index 949c6c27..00000000 --- a/src/gui/stats.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * The Mana World - * Copyright 2004 The Mana World Development Team - * - * This file is part of The Mana World. - * - * The Mana World is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * The Mana World is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with The Mana World; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * $Id$ - */ - -#include "stats.h" - -StatsDialog::StatsDialog(gcn::Container *parent): - Window(parent, "%s Lvl: % 2i Job: % 2i") -{ - hp = new gcn::Label("HP"); - sp = new gcn::Label("SP"); - gp = new gcn::Label("GP"); - healthBar = new ProgressBar(1.0f); - manaBar = new ProgressBar(1.0f); - - setSize(270, 40); - hp->setPosition(6, 20); - sp->setPosition(106, 20); - gp->setPosition(206, 20); - healthBar->setDimension(gcn::Rectangle(16, 6, 60, 18)); - manaBar->setDimension(gcn::Rectangle(116, 6, 60, 18)); - - add(hp); - add(sp); - add(gp); - add(healthBar); - add(manaBar); -} - -StatsDialog::~StatsDialog() -{ - delete hp; - delete sp; - delete gp; - delete healthBar; - delete manaBar; -} - -void StatsDialog::update() -{ - char *tempstr = new char[64]; - - sprintf(tempstr, "%s Lvl: % 2i Job: % 2i", - char_info->name, char_info->lv, char_info->job_lv); - setTitle(tempstr); - - sprintf(tempstr, "HP % 4d / % 4d", char_info->hp, char_info->max_hp); - hp->setCaption(tempstr); - hp->adjustSize(); - - sprintf(tempstr, "GP % 6i", char_info->gp); - gp->setCaption(tempstr); - gp->adjustSize(); - - sprintf(tempstr, "SP % 4d / % 4d", char_info->sp, char_info->max_sp); - sp->setCaption(tempstr); - sp->adjustSize(); - - healthBar->setProgress((float)char_info->hp / (float)char_info->max_hp); - - delete tempstr; -} diff --git a/src/gui/stats.h b/src/gui/stats.h deleted file mode 100644 index 19971469..00000000 --- a/src/gui/stats.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * The Mana World - * Copyright 2004 The Mana World Development Team - * - * This file is part of The Mana World. - * - * The Mana World is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * The Mana World is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with The Mana World; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * $Id$ - */ - -#ifdef WIN32 -#pragma warning(disable:4312) -#endif - -#ifndef _STATS_H -#define _STATS_H - -#include "../main.h" -#include "gui.h" -#include "window.h" -#include "progressbar.h" -#include - -/** - * The player statistics dialog. - * - * \ingroup GUI - */ -class StatsDialog : public Window { - public: - StatsDialog(gcn::Container *parent); - ~StatsDialog(); - - /** - * Updates this dialog with values from PLAYER_INFO *char_info - */ - void update(); - - private: - gcn::Label *hp, *sp, *gp; - ProgressBar *healthBar, *manaBar; -}; - -#endif diff --git a/src/gui/status.cpp b/src/gui/status.cpp new file mode 100644 index 00000000..026ac9a3 --- /dev/null +++ b/src/gui/status.cpp @@ -0,0 +1,81 @@ +/* + * The Mana World + * Copyright 2004 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * $Id$ + */ + +#include "status.h" + +StatusDialog::StatusDialog(gcn::Container *parent): + Window(parent, "%s Lvl: % 2i Job: % 2i") +{ + hp = new gcn::Label("HP"); + sp = new gcn::Label("SP"); + gp = new gcn::Label("GP"); + healthBar = new ProgressBar(1.0f); + manaBar = new ProgressBar(1.0f); + + setSize(270, 40); + hp->setPosition(6, 20); + sp->setPosition(106, 20); + gp->setPosition(206, 20); + healthBar->setDimension(gcn::Rectangle(16, 6, 60, 18)); + manaBar->setDimension(gcn::Rectangle(116, 6, 60, 18)); + + add(hp); + add(sp); + add(gp); + add(healthBar); + add(manaBar); +} + +StatusDialog::~StatusDialog() +{ + delete hp; + delete sp; + delete gp; + delete healthBar; + delete manaBar; +} + +void StatusDialog::update() +{ + char *tempstr = new char[64]; + + sprintf(tempstr, "%s Lvl: % 2i Job: % 2i", + char_info->name, char_info->lv, char_info->job_lv); + setTitle(tempstr); + + sprintf(tempstr, "HP % 4d / % 4d", char_info->hp, char_info->max_hp); + hp->setCaption(tempstr); + hp->adjustSize(); + + sprintf(tempstr, "GP % 6i", char_info->gp); + gp->setCaption(tempstr); + gp->adjustSize(); + + sprintf(tempstr, "SP % 4d / % 4d", char_info->sp, char_info->max_sp); + sp->setCaption(tempstr); + sp->adjustSize(); + + healthBar->setProgress((float)char_info->hp / (float)char_info->max_hp); + + delete tempstr; +} diff --git a/src/gui/status.h b/src/gui/status.h new file mode 100644 index 00000000..49a9595d --- /dev/null +++ b/src/gui/status.h @@ -0,0 +1,57 @@ +/* + * The Mana World + * Copyright 2004 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * $Id$ + */ + +#ifdef WIN32 +#pragma warning(disable:4312) +#endif + +#ifndef _STATS_H +#define _STATS_H + +#include "../main.h" +#include "gui.h" +#include "window.h" +#include "progressbar.h" +#include + +/** + * The player status dialog. + * + * \ingroup GUI + */ +class StatusDialog : public Window { + public: + StatusDialog(gcn::Container *parent); + ~StatusDialog(); + + /** + * Updates this dialog with values from PLAYER_INFO *char_info + */ + void update(); + + private: + gcn::Label *hp, *sp, *gp; + ProgressBar *healthBar, *manaBar; +}; + +#endif diff --git a/src/main.h b/src/main.h index 268eddad..69cc8706 100644 --- a/src/main.h +++ b/src/main.h @@ -36,7 +36,6 @@ #include "./configuration.h" #include "./gui/login.h" #include "./gui/gui.h" -#include "./gui/stats.h" #include "./gui/char_server.h" #include "./gui/char_select.h" #include "./gui/inventory.h" -- cgit v1.2.3-70-g09d2