diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/gui.cpp | 48 | ||||
-rw-r--r-- | src/gui/gui.h | 7 | ||||
-rw-r--r-- | src/gui/skill.cpp | 53 | ||||
-rw-r--r-- | src/gui/skill.h | 2 |
4 files changed, 103 insertions, 7 deletions
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 72a21928..8eee90de 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -57,6 +57,8 @@ extern TmwSound sound; int (*gui__external_slider_callback)(void *, int); int reroute_slider_proc(void *dp3, int d2); + + /** Initialize gui system */ void init_gui(BITMAP *bitmap, const char *skin) { gui_bitmap = bitmap; @@ -315,6 +317,16 @@ 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 loadPlusSkin() { +//BITMAP *temp1 = load_bitmap("data/bar.bmp", NULL); +//BITMAP *temp2 = load_bitmap("data/bar_filled.bmp", NULL); +gui_skin.plus.bg.grid[0] = load_bitmap("data/plus.bmp", NULL); +gui_skin.plus.bg.grid[1] = load_bitmap("data/plus_sel.bmp", NULL); +gui_skin.plus.bg.grid[2] = load_bitmap("data/plus_dis.bmp", NULL); +//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); +} void loadDialogSkin() { char **tokens; int tokenCount; @@ -397,6 +409,7 @@ int gui_load_skin(const char* skinname) { loadListboxSkin(); loadDialogSkin(); loadBarSkin(); + loadPlusSkin(); pop_config_state(); set_mouse_sprite((BITMAP *)gui_gfx[7].dat); @@ -1039,6 +1052,38 @@ int tmw_list_proc(int msg, DIALOG *d, int c) { } return D_O_K; } +int tmw_plus_proc(int msg, DIALOG *d, int c) +{ +//d->d1 = 0; +bool draw = false; + +if(mouse_b & 1) + { + if(d->x+d->w > mouse_x && d->x < mouse_x && d->y+d->h > mouse_y && d->y < mouse_y) + if(d->d2==1) + { + //d->d1 = 1; + (*(getfuncptr)d->dp)(NULL, d->d1); + masked_blit(gui_skin.plus.bg.grid[1], gui_bitmap, 0, 0, d->x, d->y, gui_bitmap->w, gui_bitmap->h); + draw = true; + } else { + masked_blit(gui_skin.plus.bg.grid[0], gui_bitmap, 0, 0, d->x, d->y, gui_bitmap->w, gui_bitmap->h); + draw = true; + } + } else { + if (!d->d2) { + //disable + masked_blit(gui_skin.plus.bg.grid[2], gui_bitmap, 0, 0, d->x, d->y, gui_bitmap->w, gui_bitmap->h); + draw = true; + } + } + if(!draw) + masked_blit(gui_skin.plus.bg.grid[0], gui_bitmap, 0, 0, d->x, d->y, gui_bitmap->w, gui_bitmap->h); + + +return D_O_K; +} + int tmw_bar_proc(int msg, DIALOG *d, int c) { float share2 = ((float)d->d1 / (float)d->d2); @@ -1109,6 +1154,7 @@ int tmw_dialog_proc(int msg, DIALOG *d, int c) { return D_O_K; } + /** dialog box w/ left aligned head */ @@ -1562,4 +1608,4 @@ unsigned int yes_no(const char *title, const char *message) { show_mouse(NULL); gui_bitmap = temp; return ret-2; -} +}
\ No newline at end of file diff --git a/src/gui/gui.h b/src/gui/gui.h index e14a0140..dfa89bd7 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -24,7 +24,7 @@ #ifdef WIN32 #pragma warning (disable:4312) #endif - +#include "login.h" #ifndef _TMW_GUI #define _TMW_GUI @@ -83,6 +83,9 @@ typedef struct { LexSkinnedRect bg; } LexBar; +typedef struct { + LexSkinnedRect bg; +} LexPlus; typedef struct { LexButton button; @@ -93,6 +96,7 @@ typedef struct { LexListbox listbox; LexDialog dialog; LexBar bar; + LexPlus plus; } LexSkin; extern LexSkin gui_skin; @@ -122,6 +126,7 @@ 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); +int tmw_plus_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/skill.cpp b/src/gui/skill.cpp index bf9c2d86..f6c7e041 100644 --- a/src/gui/skill.cpp +++ b/src/gui/skill.cpp @@ -36,21 +36,66 @@ char luk_string[8]; DIALOG skill_dialog[] = { /* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) */ - { tmw_dialog_proc, 300, 200, 120, 60, 0, 0, 0, 0, 0, 0, (char *)"Skill", NULL, NULL }, + { tmw_dialog_proc, 300, 200, 150, 60, 0, 0, 0, 0, 0, 0, (char *)"Skill", NULL, NULL }, { tmw_text_proc, 304, 224, 252, 100, 0, 0, 0, 0, 0, 0, str_string, NULL, NULL }, + { tmw_plus_proc, 354, 224, 16, 16, 0, 0, '0', 0, 0, 1, (void*)increaseStatus,NULL, NULL }, { tmw_text_proc, 304, 234, 252, 100, 0, 0, 0, 0, 0, 0, agi_string, NULL, NULL }, + { tmw_plus_proc, 354, 234, 16, 16, 0, 0, '0', 0, 1, 1, (void*)increaseStatus,NULL, NULL }, { tmw_text_proc, 304, 244, 252, 100, 0, 0, 0, 0, 0, 0, vit_string, NULL, NULL }, - { tmw_text_proc, 364, 224, 252, 100, 0, 0, 0, 0, 0, 0, int_string, NULL, NULL }, - { tmw_text_proc, 364, 234, 252, 100, 0, 0, 0, 0, 0, 0, dex_string, NULL, NULL }, - { tmw_text_proc, 364, 244, 252, 100, 0, 0, 0, 0, 0, 0, luk_string, NULL, NULL }, + { tmw_plus_proc, 354, 244, 16, 16, 0, 0, '0', 0, 2, 1, (void*)increaseStatus,NULL, NULL }, + { tmw_text_proc, 374, 224, 252, 100, 0, 0, 0, 0, 0, 0, int_string, NULL, NULL }, + { tmw_plus_proc, 424, 224, 16, 16, 0, 0, '0', 0, 3, 1, (void*)increaseStatus,NULL, NULL }, + { tmw_text_proc, 374, 234, 252, 100, 0, 0, 0, 0, 0, 0, dex_string, NULL, NULL }, + { tmw_plus_proc, 424, 234, 16, 16, 0, 0, '0', 0, 4, 1, (void*)increaseStatus,NULL, NULL }, + { tmw_text_proc, 374, 244, 252, 100, 0, 0, 0, 0, 0, 0, luk_string, NULL, NULL }, + { tmw_plus_proc, 424, 244, 16, 16, 0, 0, '0', 0, 5, 1, (void*)increaseStatus,NULL, NULL }, { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } }; void update_skill_dialog() { + int skillTemp = 0; + for(int loop = 0; loop<=char_info->lv;loop++) + skillTemp += int( (float)loop / (float)5.0 ) + (int)2; sprintf(str_string, "STR: %i", char_info->STR); sprintf(agi_string, "AGI: %i", char_info->AGI); sprintf(vit_string, "VIT: %i", char_info->VIT); sprintf(int_string, "INT: %i", char_info->INT); sprintf(dex_string, "DEX: %i", char_info->DEX); sprintf(luk_string, "LUK: %i", char_info->LUK); + if(char_info->STR+char_info->AGI+char_info->VIT+char_info->INT+char_info->DEX+char_info->LUK == skillTemp) + { + skill_dialog[2].d2 = skill_dialog[4].d2 = skill_dialog[6].d2 =skill_dialog[8].d2 =skill_dialog[10].d2 = 0; + } else { + skill_dialog[2].d2 = skill_dialog[4].d2 = skill_dialog[6].d2 =skill_dialog[8].d2 =skill_dialog[10].d2 = 1; + } } + +void increaseStatus(void *dp3, int d1) +{ + WFIFOW(0) = net_w_value(0x00bb); + switch(d1) + { + case 0: + WFIFOW(2) = net_w_value(0x000d); + break; + case 1: + WFIFOW(2) = net_w_value(0x000e); + break; + case 2: + WFIFOW(2) = net_w_value(0x000f); + break; + case 3: + WFIFOW(2) = net_w_value(0x0010); + break; + case 4: + WFIFOW(2) = net_w_value(0x0011); + break; + case 5: + WFIFOW(2) = net_w_value(0x0012); + break; + } + WFIFOW(4) = net_b_value(1); + WFIFOSET(5); + while((out_size>0))flush(); + skill_dialog[2].d2 = skill_dialog[4].d2 = skill_dialog[6].d2 =skill_dialog[8].d2 =skill_dialog[10].d2 = 0; +}
\ No newline at end of file diff --git a/src/gui/skill.h b/src/gui/skill.h index a0ce031d..601f9ef5 100644 --- a/src/gui/skill.h +++ b/src/gui/skill.h @@ -36,5 +36,5 @@ //DIALOG skill_dialog[]; void update_skill_dialog(); - +void increaseStatus(void *dp3, int d1); #endif |