diff options
author | Simon Edwardsson <simon@crossnet.se> | 2004-10-03 13:47:44 +0000 |
---|---|---|
committer | Simon Edwardsson <simon@crossnet.se> | 2004-10-03 13:47:44 +0000 |
commit | 9c4d57c8a76f8494d702f733998aaa70eaab0e5e (patch) | |
tree | a66dd5ac210317766a247d80673b32b499280ef9 /src | |
parent | 1c44e1f097d387fcce872f4b67c9996c050e83f9 (diff) | |
download | mana-client-9c4d57c8a76f8494d702f733998aaa70eaab0e5e.tar.gz mana-client-9c4d57c8a76f8494d702f733998aaa70eaab0e5e.tar.bz2 mana-client-9c4d57c8a76f8494d702f733998aaa70eaab0e5e.tar.xz mana-client-9c4d57c8a76f8494d702f733998aaa70eaab0e5e.zip |
tmw_bar_proc is added
Diffstat (limited to 'src')
-rw-r--r-- | src/graphic/graphic.cpp | 2 | ||||
-rw-r--r-- | src/gui/gui.cpp | 38 | ||||
-rw-r--r-- | src/gui/gui.h | 7 | ||||
-rw-r--r-- | src/gui/stats.cpp | 7 |
4 files changed, 51 insertions, 3 deletions
diff --git a/src/graphic/graphic.cpp b/src/graphic/graphic.cpp index 9946b613..052ec402 100644 --- a/src/graphic/graphic.cpp +++ b/src/graphic/graphic.cpp @@ -41,6 +41,7 @@ int map_x, map_y, camera_x, camera_y; DIALOG_PLAYER *chat_player, *npc_player, *skill_player, *buy_sell_player, *buy_player, *sell_player, *stats_player; char speech[255] = ""; char npc_text[1000] = ""; +char statsString2[255] = "n/a"; TmwInventory inventory; Chat chatlog("./docs/chatlog.txt", 20); int show_npc_dialog = 0; @@ -54,6 +55,7 @@ DIALOG npc_dialog[] = { { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } }; + DIALOG buy_sell_dialog[] = { /* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) */ { tmw_dialog_proc, 350, 200, 100, 105, 0, 0, 0, 0, 0, 0, (char *)"Shop", NULL, NULL }, diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 18dcfb41..72a21928 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -299,7 +299,22 @@ void loadListboxSkin() { } } - +void loadBarSkin() { +BITMAP *temp1 = load_bitmap("data/bar.bmp", NULL); +BITMAP *temp2 = load_bitmap("data/bar_filled.bmp", NULL); +gui_skin.bar.bg.grid[0] = create_bitmap(3,11); +gui_skin.bar.bg.grid[1] = create_bitmap(1,11); +gui_skin.bar.bg.grid[2] = create_bitmap(3,11); +blit(temp1, gui_skin.bar.bg.grid[0], 0, 0, 0, 0, 3, 11); +blit(temp1, gui_skin.bar.bg.grid[1], 4, 0, 0, 0, 1, 11); +blit(temp1, gui_skin.bar.bg.grid[2], 13, 0, 0, 0, 3, 11); +gui_skin.bar.bg.grid[3] = create_bitmap(3,11); +gui_skin.bar.bg.grid[4] = create_bitmap(1,11); +gui_skin.bar.bg.grid[5] = create_bitmap(3,11); +blit(temp2, gui_skin.bar.bg.grid[3], 0, 0, 0, 0, 3, 11); +blit(temp2, gui_skin.bar.bg.grid[4], 4, 0, 0, 0, 1, 11); +blit(temp2, gui_skin.bar.bg.grid[5], 13, 0, 0, 0, 3, 11); +} void loadDialogSkin() { char **tokens; int tokenCount; @@ -381,6 +396,7 @@ int gui_load_skin(const char* skinname) { loadTextboxSkin(); loadListboxSkin(); loadDialogSkin(); + loadBarSkin(); pop_config_state(); set_mouse_sprite((BITMAP *)gui_gfx[7].dat); @@ -1023,6 +1039,26 @@ int tmw_list_proc(int msg, DIALOG *d, int c) { } return D_O_K; } +int tmw_bar_proc(int msg, DIALOG *d, int c) +{ +float share2 = ((float)d->d1 / (float)d->d2); +if(share2!=0) + masked_blit(gui_skin.bar.bg.grid[3], gui_bitmap, 0, 0, d->x, d->y, gui_bitmap->w, gui_bitmap->h); +else + masked_blit(gui_skin.bar.bg.grid[0], gui_bitmap, 0, 0, d->x, d->y, gui_bitmap->w, gui_bitmap->h); + +for(int i = 3; i < (d->w-3); i++) + if(i<share2*d->w-3) + masked_blit(gui_skin.bar.bg.grid[4], gui_bitmap, 0, 0, d->x+1*i, d->y, gui_bitmap->w, gui_bitmap->h); + else + masked_blit(gui_skin.bar.bg.grid[1], gui_bitmap, 0, 0, d->x+1*i, d->y, gui_bitmap->w, gui_bitmap->h); + +if(share2==1) + masked_blit(gui_skin.bar.bg.grid[5], gui_bitmap, 0, 0, d->x+d->w-3, d->y, gui_bitmap->w, gui_bitmap->h); +else + masked_blit(gui_skin.bar.bg.grid[2], gui_bitmap, 0, 0, d->x+d->w-3, d->y, gui_bitmap->w, gui_bitmap->h); +return D_O_K; +} /** dialog box w/ left centered head diff --git a/src/gui/gui.h b/src/gui/gui.h index 47362466..e14a0140 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -80,6 +80,11 @@ typedef struct { } LexDialog; typedef struct { + LexSkinnedRect bg; +} LexBar; + + +typedef struct { LexButton button; LexSlider slider; LexCheckbox checkbox; @@ -87,6 +92,7 @@ typedef struct { LexTextbox textbox; LexListbox listbox; LexDialog dialog; + LexBar bar; } LexSkin; extern LexSkin gui_skin; @@ -115,6 +121,7 @@ int tmw_dialog_proc(int msg, DIALOG *d, int c); int tmw_ldialog_proc(int msg, DIALOG *d, int c); int tmw_textbox_proc(int msg, DIALOG *d, int c); int tmw_bitmap_proc(int msg, DIALOG *d, int c); +int tmw_bar_proc(int msg, DIALOG *d, int c); void ok(const char *title, const char *message); unsigned int yes_no(const char *title, const char *message); diff --git a/src/gui/stats.cpp b/src/gui/stats.cpp index d036c58b..f4d8c661 100644 --- a/src/gui/stats.cpp +++ b/src/gui/stats.cpp @@ -31,9 +31,10 @@ char stats_zeny[24]; DIALOG stats_dialog[] = { /* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) */ { tmw_ldialog_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_hp, NULL, NULL }, + { tmw_bar_proc, 497, 22, 60, 18, 0, 0, '1', 0, 1, 1, NULL, NULL, NULL }, { tmw_text_proc, 607, 22, 296, 100, 0, 0, 0, 0, 0, 0, stats_zeny, NULL, NULL }, - { tmw_text_proc, 497, 34, 296, 100, 0, 0, 0, 0, 0, 0, stats_sp, NULL, NULL }, + { tmw_text_proc, 607, 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 } }; @@ -45,4 +46,6 @@ void update_stats_dialog() { sprintf(stats_hp, "HP % 4d / % 4d", char_info->hp, char_info->max_hp); sprintf(stats_zeny, "Zeny % 5i", char_info->zeny); sprintf(stats_sp, "SP % 4d / % 4d", char_info->sp, char_info->max_sp); + stats_dialog[2].d1 = char_info->hp; + stats_dialog[2].d2 = char_info->max_hp; } |