summaryrefslogtreecommitdiff
path: root/src/graphic
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2004-12-29 20:41:14 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2004-12-29 20:41:14 +0000
commit7cf46d715e08b8a355ef9ea7be5421a2710d65fc (patch)
tree7aa0166030af099fd82b2d080229497d466009aa /src/graphic
parent9ddc6e0d5208820a374f3bc9b9c5678e013535b2 (diff)
downloadmana-client-7cf46d715e08b8a355ef9ea7be5421a2710d65fc.tar.gz
mana-client-7cf46d715e08b8a355ef9ea7be5421a2710d65fc.tar.bz2
mana-client-7cf46d715e08b8a355ef9ea7be5421a2710d65fc.tar.xz
mana-client-7cf46d715e08b8a355ef9ea7be5421a2710d65fc.zip
Ported the npc text dialog and some other small updates.
Diffstat (limited to 'src/graphic')
-rw-r--r--src/graphic/graphic.cpp39
-rw-r--r--src/graphic/graphic.h2
2 files changed, 12 insertions, 29 deletions
diff --git a/src/graphic/graphic.cpp b/src/graphic/graphic.cpp
index bba04d52..be20aeb9 100644
--- a/src/graphic/graphic.cpp
+++ b/src/graphic/graphic.cpp
@@ -29,12 +29,11 @@ BITMAP *buffer, *chat_background;
char itemCurrenyQ[10] = "0";
int map_x, map_y, camera_x, camera_y;
-DIALOG_PLAYER *npc_player, *skill_player, *sell_player, *skill_list_player, *npc_list_player;
+DIALOG_PLAYER *skill_player, *skill_list_player;
char npc_text[1000] = "";
char statsString2[255] = "n/a";
char skill_points[10] = "";
Chat chatlog("./docs/chatlog.txt", 20);
-int show_npc_dialog = 0;
bool show_skill_dialog = false;
bool show_skill_list_dialog = false;
char npc_button[10] = "Close";
@@ -47,6 +46,7 @@ SellDialog *sellDialog;
BuySellDialog *buySellDialog;
InventoryWindow *inventoryWindow;
NpcListDialog *npcListDialog;
+NpcTextDialog *npcTextDialog;
void ChatListener::action(const std::string& eventId)
{
@@ -81,14 +81,6 @@ void BuySellListener::action(const std::string& eventId)
buySellDialog->setVisible(false);
}
-DIALOG npc_dialog[] = {
- /* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) */
- { tmw_dialog_proc, 300, 200, 260, 150, 0, 0, 0, 0, 0, 0, (char *)"NPC", NULL, NULL },
- { tmw_button_proc, 508, 326, 50, 20, 255, 0, 'c', D_EXIT, 0, 0, (char *)npc_button, NULL, NULL },
- { tmw_textbox_proc, 304, 224, 252, 100, 0, 0, 0, 0, 0, 0, npc_text, NULL, NULL },
- { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }
-};
-
DIALOG skill_list_dialog[] = {
/* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) */
{ tmw_dialog_proc, 300, 200, 260, 200, 0, 0, 0, 0, 0, 0, (char *)"Stats", NULL, NULL },
@@ -121,9 +113,9 @@ int get_x_offset(NODE *node) {
int offset = 0;
char direction = get_direction(node->coordinates);
if (node->action == WALK) {
- if (direction!=NORTH && direction!=SOUTH) {
+ if (direction != NORTH && direction != SOUTH) {
offset = node->frame + 1;
- if (offset==5)offset = 0;
+ if (offset == 5)offset = 0;
offset *= 8;
if (direction == WEST || direction == NW || direction == SW) {
offset = -offset;
@@ -192,16 +184,17 @@ GraphicEngine::GraphicEngine() {
inventoryWindow->setVisible(false);
inventoryWindow->setPosition(100, 100);
+ npcTextDialog = new NpcTextDialog(guiTop);
+ npcTextDialog->setVisible(false);
+
npcListDialog = new NpcListDialog(guiTop);
npcListDialog->setVisible(false);
- npc_player = init_dialog(npc_dialog, -1);
- position_dialog(npc_dialog, 300, 200);
skill_player = init_dialog(skill_dialog, -1);
skill_list_player = init_dialog(skill_list_dialog, -1);
buffer = create_bitmap(SCREEN_W, SCREEN_H);
- if(!buffer) {
+ if (!buffer) {
error("Not enough memory to create buffer");
}
@@ -214,7 +207,6 @@ GraphicEngine::GraphicEngine() {
npcset = new Spriteset("./data/graphic/npcset.dat");
playerset = new Spriteset("./data/graphic/playerset.dat");
monsterset = new Spriteset("./data/graphic/monsterset.dat");
-
}
GraphicEngine::~GraphicEngine() {
@@ -222,10 +214,11 @@ GraphicEngine::~GraphicEngine() {
delete buyDialog;
delete sellDialog;
delete buySellDialog;
+ delete npcListDialog;
+ delete npcTextDialog;
//delete tileset;
- shutdown_dialog(npc_player);
shutdown_dialog(skill_player);
}
@@ -455,18 +448,6 @@ void GraphicEngine::refresh() {
chatlog.chat_draw(buffer, 8, font);
- switch (show_npc_dialog) {
- case 1:
- dialog_message(npc_dialog, MSG_DRAW, 0, 0);
- if (!(show_npc_dialog = gui_update(npc_player))) {
- strcpy(npc_text, "");
- WFIFOW(0) = net_w_value(0x00b9);
- WFIFOL(2) = net_l_value(current_npc);
- WFIFOSET(6);
- }
- break;
- }
-
if (show_skill_dialog) {
update_skill_dialog();
if (gui_update(skill_player) == 0) {
diff --git a/src/graphic/graphic.h b/src/graphic/graphic.h
index 564a380e..05b92acb 100644
--- a/src/graphic/graphic.h
+++ b/src/graphic/graphic.h
@@ -27,6 +27,7 @@
#include "../being.h"
#include "../gui/buy.h"
#include "../gui/npc.h"
+#include "../gui/npc_text.h"
#include "../gui/sell.h"
#include "../gui/buysell.h"
#include "../gui/chat.h"
@@ -60,6 +61,7 @@ extern SellDialog *sellDialog;
extern BuySellDialog *buySellDialog;
extern InventoryWindow *inventoryWindow;
extern NpcListDialog *npcListDialog;
+extern NpcTextDialog *npcTextDialog;
// The action listener for the chat field
class ChatListener : public gcn::ActionListener {