diff options
author | Alexander Baldeck <alexander@archlinux.org> | 2004-10-03 11:39:13 +0000 |
---|---|---|
committer | Alexander Baldeck <alexander@archlinux.org> | 2004-10-03 11:39:13 +0000 |
commit | aa48bc3bf9cae0fbf52173e81bc3c640c8c024c4 (patch) | |
tree | 79f0f2f7aa2c3ecd5001bad258059863120094cd /src | |
parent | 0635bb5b29e3a865889f9ddcf5b6867f53ee6281 (diff) | |
download | mana-aa48bc3bf9cae0fbf52173e81bc3c640c8c024c4.tar.gz mana-aa48bc3bf9cae0fbf52173e81bc3c640c8c024c4.tar.bz2 mana-aa48bc3bf9cae0fbf52173e81bc3c640c8c024c4.tar.xz mana-aa48bc3bf9cae0fbf52173e81bc3c640c8c024c4.zip |
1st permament stats-dialog
Diffstat (limited to 'src')
-rw-r--r-- | src/game.cpp | 4 | ||||
-rw-r--r-- | src/game.h | 1 | ||||
-rw-r--r-- | src/graphic/graphic.cpp | 36 | ||||
-rw-r--r-- | src/graphic/graphic.h | 8 | ||||
-rw-r--r-- | src/gui/stats.cpp | 31 | ||||
-rw-r--r-- | src/gui/stats.h | 3 |
6 files changed, 57 insertions, 26 deletions
diff --git a/src/game.cpp b/src/game.cpp index 5aca7bad..5b776845 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -265,7 +265,7 @@ void do_input() { action_time = false; } else if(key[KEY_I]) { inventory.toggle(); - action_time = false; + action_time = false; } } @@ -531,7 +531,7 @@ void do_parse() { char_info->lv = RFIFOW(4); break; } - //charstats_display(char_info); + update_stats_dialog(); if(char_info->hp==0) { ok("Message", "You're now dead, press ok to restart"); WFIFOW(0) = net_w_value(0x00b2); @@ -71,6 +71,7 @@ extern char map_path[480]; extern DIALOG skill_dialog[]; +extern DIALOG stats_dialog[]; extern int fps, frame, current_npc; extern char walk_status; extern unsigned short src_x, src_y, x, y; diff --git a/src/graphic/graphic.cpp b/src/graphic/graphic.cpp index 7390d283..48d1b5c7 100644 --- a/src/graphic/graphic.cpp +++ b/src/graphic/graphic.cpp @@ -32,22 +32,13 @@ #pragma warning (disable:4312) #endif -#include <allegro.h> -#include "../game.h" -#include "../map.h" -#include "../being.h" -#include "../gui/chat.h" -#include "../gui/inventory.h" -#include "../gui/shop.h" -#include "../../data/graphic/gfx_data.h" - BITMAP *buffer, *double_buffer, *chat_background; DATAFILE *tileset; //extern char* itemCurrenyQ; char itemCurrenyQ[10] = "0"; char page_num; int map_x, map_y, camera_x, camera_y; -DIALOG_PLAYER *chat_player, *npc_player, *skill_player, *buy_sell_player, *buy_player, *sell_player; +DIALOG_PLAYER *chat_player, *npc_player, *skill_player, *buy_sell_player, *buy_player, *sell_player, *stats_player; char speech[255] = ""; char npc_text[1000] = ""; TmwInventory inventory; @@ -94,7 +85,7 @@ DIALOG sell_dialog[] = { { tmw_text_proc, 514, 326, 40, 100, 0, 0, 0, 0, 0, 0, (char *)itemCurrenyQ, NULL, NULL }, { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } }; - + DIALOG chat_dialog[] = { /* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) */ { tmw_edit_proc, 0, 574, 592, 25, 0, 0, 'c', 0, 90, 0, speech, NULL, NULL }, @@ -152,6 +143,7 @@ void init_graphic() { npc_player = init_dialog(npc_dialog, -1); position_dialog(npc_dialog, 300, 200); skill_player = init_dialog(skill_dialog, -1); + stats_player = init_dialog(stats_dialog, -1); buy_sell_player = init_dialog(buy_sell_dialog, -1); buy_player = init_dialog(buy_dialog, -1); sell_player = init_dialog(sell_dialog, -1); @@ -172,8 +164,8 @@ void do_graphic(void) { int offset_y = map_y & 15; sort(); - - + + for(int j=0;j<20;j++) for(int i=0;i<26;i++) { if( /* get_tile(i+camera_x, j+camera_y, 0) >= 0 && */ get_tile(i+camera_x, j+camera_y, 0) < 600) @@ -186,7 +178,7 @@ void do_graphic(void) { NODE *old_node = NULL; while(node) { if((node->job>=100)&&(node->job<=110)) { // Draw a NPC - masked_blit((BITMAP *)graphic[NPCSET_BMP].dat, buffer, (get_direction(node->coordinates)/2+4*(node->job-100))*25, 0, (get_x(node->coordinates)-camera_x)*16-4-offset_x, (get_y(node->coordinates)-camera_y)*16-24-offset_y, 25, 40); + masked_blit((BITMAP *)graphic[NPCSET_BMP].dat, buffer, (get_direction(node->coordinates)/2+4*(node->job-100))*25, 0, (get_x(node->coordinates)-camera_x)*16-4-offset_x, (get_y(node->coordinates)-camera_y)*16-24-offset_y, 25, 40); } else if(node->job<10) { // Draw a player node->text_x = (get_x(node->coordinates)-camera_x)*16-34+get_x_offset(node)-offset_x; node->text_y = (get_y(node->coordinates)-camera_y)*16-36+get_y_offset(node)-offset_y; @@ -206,7 +198,7 @@ void do_graphic(void) { node->action = STAND; // node->tick_time; if(node->id==player_node->id) - walk_status = 0; + walk_status = 0; } } @@ -257,7 +249,7 @@ void do_graphic(void) { alfont_textprintf_aa(double_buffer, gui_font, node->text_x*2+90-alfont_text_length(gui_font, node->speech)/2, node->text_y*2, node->speech_color, "%s", node->speech); else alfont_textprintf_aa(double_buffer, gui_font, node->text_x*2+60-alfont_text_length(gui_font, node->speech)/2, node->text_y*2, node->speech_color, "%s", node->speech); - + node->speech_time--; if(node->speech_time==0) { free(node->speech); @@ -265,13 +257,13 @@ void do_graphic(void) { } } node = node->next; - } + } inventory.draw(double_buffer); set_trans_blender(0, 0, 0, 110); draw_trans_sprite(double_buffer, chat_background, 0, SCREEN_H-125); - + chatlog.chat_draw(double_buffer, 8, gui_font); gui_update(chat_player); @@ -343,9 +335,13 @@ void do_graphic(void) { if(show_skill_dialog) { update_skill_dialog(); - if(gui_update(skill_player)==0)show_skill_dialog = false; + if(gui_update(skill_player)==0)show_skill_dialog = false; } - + + // character status display + update_stats_dialog(); + gui_update(stats_player); + alfont_textprintf(double_buffer, gui_font, 0, 0, MAKECOL_WHITE, "FPS:%i", fps); blit(double_buffer, screen, 0, 0, 0, 0, 800, 600); diff --git a/src/graphic/graphic.h b/src/graphic/graphic.h index 95f2ae8a..2ba3cc74 100644 --- a/src/graphic/graphic.h +++ b/src/graphic/graphic.h @@ -31,8 +31,15 @@ #endif #include <allegro.h> +#include "../game.h" +#include "../map.h" +#include "../being.h" #include "../gui/chat.h" #include "../gui/inventory.h" +#include "../gui/shop.h" +#include "../gui/chat.h" +#include "../gui/inventory.h" +#include "../../data/graphic/gfx_data.h" extern BITMAP *buffer, *double_buffer; extern char speech[255]; @@ -42,7 +49,6 @@ extern bool show_skill_dialog; extern int show_npc_dialog; extern TmwInventory inventory; extern int map_x, map_y, camera_x, camera_y; -extern TmwInventory inventory; void do_graphic(void); void init_graphic(void); diff --git a/src/gui/stats.cpp b/src/gui/stats.cpp index 5350fc50..d339d79a 100644 --- a/src/gui/stats.cpp +++ b/src/gui/stats.cpp @@ -25,6 +25,33 @@ #include <iostream> -void charstats_display() { - std::cout << "char_stats: " << std::endl; +extern PLAYER_INFO *char_info; + +char stats_name[48]; +char stats_hp[24]; +char stats_sp[24]; + +DIALOG stats_dialog[] = { + /* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) */ + { tmw_dialog_proc, 493, 0, 300, 55, 0, 0, 0, 0, 0, 0, stats_name, NULL, NULL }, + { tmw_text_proc, 497, 22, 296, 100, 0, 0, 0, 0, 0, 0, stats_hp, NULL, NULL }, + { tmw_text_proc, 497, 34, 296, 100, 0, 0, 0, 0, 0, 0, stats_sp, NULL, NULL }, + { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } +}; + +void update_stats_dialog() { + sprintf(stats_name, "%s Lvl:%i Job:%i", char_info->name, char_info->lv, char_info->job_lv); + sprintf(stats_hp, "HP %i / %i", char_info->hp, char_info->max_hp); + sprintf(stats_sp, "SP %i / %i", char_info->sp, char_info->max_sp); } + +/* +typedef struct { + int id; + char name[24]; + short hp, max_hp, sp, max_sp, lv; + int xp, zeny, job_xp, job_lv; + short statp, skillp; + char STR, AGI, VIT, INT, DEX, LUK; +} PLAYER_INFO; +*/ diff --git a/src/gui/stats.h b/src/gui/stats.h index e99206bd..a34dd1cc 100644 --- a/src/gui/stats.h +++ b/src/gui/stats.h @@ -24,9 +24,10 @@ #ifndef _STATS_H #define _STATS_H +#include <allegro.h> #include "../main.h" #include "gui.h" -void charstats_display(); +void update_stats_dialog(); #endif |