summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorEugenio Favalli <elvenprogrammer@gmail.com>2004-10-08 14:01:51 +0000
committerEugenio Favalli <elvenprogrammer@gmail.com>2004-10-08 14:01:51 +0000
commit1e1e15dd3ab111383b27f09f70eb590878254e00 (patch)
tree9f47098a3c1758d6d49b40e3b02442e2cae8fe85 /src/gui
parent75da526f11f74b9bffb9580c2daf63108c294ca8 (diff)
downloadmana-client-1e1e15dd3ab111383b27f09f70eb590878254e00.tar.gz
mana-client-1e1e15dd3ab111383b27f09f70eb590878254e00.tar.bz2
mana-client-1e1e15dd3ab111383b27f09f70eb590878254e00.tar.xz
mana-client-1e1e15dd3ab111383b27f09f70eb590878254e00.zip
*** empty log message ***
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/char_select.cpp6
-rw-r--r--src/gui/char_server.cpp9
-rw-r--r--src/gui/gui.cpp424
-rw-r--r--src/gui/login.cpp6
-rw-r--r--src/gui/shop.cpp11
-rw-r--r--src/gui/skill.cpp109
-rw-r--r--src/gui/skill.h12
-rw-r--r--src/gui/stats.cpp12
8 files changed, 325 insertions, 264 deletions
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp
index d7bc805d..61ba61ab 100644
--- a/src/gui/char_select.cpp
+++ b/src/gui/char_select.cpp
@@ -75,8 +75,7 @@ void char_select() {
int gui_exit = 1;
while ((!key[KEY_ESC])&&(gui_exit)&&(!key[KEY_ENTER])) {
clear_bitmap(buffer);
- if(stretch_mode!=0)blit((BITMAP *)graphic[LOGIN_BMP].dat, buffer, 0, 0, 0, 0, 800, 600);
- else blit((BITMAP *)graphic[LOGIN_BMP].dat, buffer, 0, 0, -120, -90, 640, 480);
+ blit((BITMAP *)graphic[LOGIN_BMP].dat, buffer, 0, 0, 0, 0, 800, 600);
gui_exit = gui_update(player);
blit(buffer, screen, 0, 0, 0, 0, 800, 600);
}
@@ -163,8 +162,7 @@ void server_char_delete() {
int gui_exit = 1;
while ((!key[KEY_ESC])&&(gui_exit)) {
clear_bitmap(buffer);
- if(stretch_mode!=0)blit((BITMAP *)graphic[LOGIN_BMP].dat, buffer, 0, 0, 0, 0, 800, 600);
- else blit((BITMAP *)graphic[LOGIN_BMP].dat, buffer, 0, 0, -120, -90, 640, 480);
+ blit((BITMAP *)graphic[LOGIN_BMP].dat, buffer, 0, 0, -120, -90, 640, 480);
gui_exit = gui_update(player);
blit(buffer, screen, 0, 0, 0, 0, 800, 600);
}
diff --git a/src/gui/char_server.cpp b/src/gui/char_server.cpp
index 63656f78..dd51e0f1 100644
--- a/src/gui/char_server.cpp
+++ b/src/gui/char_server.cpp
@@ -19,6 +19,8 @@
along with The Mana World; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ By ElvenProgrammer aka Eugenio Favalli (umperio@users.sourceforge.net)
+
*/
#include "char_server.h"
@@ -55,8 +57,7 @@ void char_server() {
if(n_server==0)char_server_dialog[2].flags |= D_DISABLED;
while ((!key[KEY_ESC])&&(gui_exit)&&(!key[KEY_ENTER])) {
clear_bitmap(buffer);
- if(stretch_mode!=0)blit((BITMAP *)graphic[LOGIN_BMP].dat, buffer, 0, 0, 0, 0, 800, 600);
- else blit((BITMAP *)graphic[LOGIN_BMP].dat, buffer, 0, 0, -120, -90, 640, 480);
+ blit((BITMAP *)graphic[LOGIN_BMP].dat, buffer, 0, 0, 0, 0, 800, 600);
gui_exit = gui_update(player);
blit(buffer, screen, 0, 0, 0, 0, 800, 600);
}
@@ -102,8 +103,8 @@ void server_char_server() {
char_info[i].max_hp = RFIFOW(24+106*i+44);
char_info[i].xp = RFIFOL(24+106*i+4);
char_info[i].gp = RFIFOL(24+106*i+8);
- char_info[i].job_xp = RFIFOL(24+106*i+16);
- char_info[i].job_lv = RFIFOL(24+106*i+24);
+ char_info[i].job_xp = RFIFOL(24+106*i+12);
+ char_info[i].job_lv = RFIFOL(24+106*i+16);
char_info[i].sp = RFIFOW(24+106*i+46);
char_info[i].max_sp = RFIFOW(24+106*i+48);
char_info[i].lv = RFIFOW(24+106*i+58);
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index f24266d4..e9227453 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -359,7 +359,7 @@ void loadDialogSkin() {
}
}
-void drawSkinnedRect(BITMAP*dst, LexSkinnedRect *skin, int x, int y,int w, int h) {
+void draw_skinned_rect(BITMAP*dst, LexSkinnedRect *skin, int x, int y,int w, int h) {
BITMAP **grid = skin->grid;
@@ -522,17 +522,17 @@ int tmw_button_proc(int msg, DIALOG *d, int c) {
rectfill(gui_bitmap, d->x, d->y, d->x + d->w, d->y+d->h, makecol(255,255,255));
if (d->flags & D_DISABLED) {
- drawSkinnedRect(gui_bitmap, &gui_skin.button.background[3], d->x, d->y, d->w, d->h);
+ draw_skinned_rect(gui_bitmap, &gui_skin.button.background[3], d->x, d->y, d->w, d->h);
col = gui_skin.button.textcolor[3];
} else if (d->flags & D_SELECTED) {
- drawSkinnedRect(gui_bitmap, &gui_skin.button.background[2], d->x, d->y, d->w, d->h);
+ draw_skinned_rect(gui_bitmap, &gui_skin.button.background[2], d->x, d->y, d->w, d->h);
col = gui_skin.button.textcolor[2];
ofs = 1;
} else if (d->flags & D_GOTMOUSE) {
- drawSkinnedRect(gui_bitmap, &gui_skin.button.background[1], d->x, d->y, d->w, d->h);
+ draw_skinned_rect(gui_bitmap, &gui_skin.button.background[1], d->x, d->y, d->w, d->h);
col = gui_skin.button.textcolor[1];
} else {
- drawSkinnedRect(gui_bitmap, &gui_skin.button.background[0], d->x, d->y, d->w, d->h);
+ draw_skinned_rect(gui_bitmap, &gui_skin.button.background[0], d->x, d->y, d->w, d->h);
col = gui_skin.button.textcolor[0];
}
rtm = alfont_text_mode(-1);
@@ -751,7 +751,7 @@ int tmw_edit_proc(int msg, DIALOG *d, int c) {
if (msg == MSG_DRAW) {
rectfill(gui_bitmap, d->x, d->y, d->x + d->w, d->y+d->h, d->bg);
- drawSkinnedRect(gui_bitmap, &gui_skin.textbox.bg, d->x, d->y, d->w, d->h);
+ draw_skinned_rect(gui_bitmap, &gui_skin.textbox.bg, d->x, d->y, d->w, d->h);
if (d->flags & D_DISABLED) {
col = gui_skin.textbox.textcolor[1];
@@ -822,7 +822,7 @@ int tmw_password_proc(int msg, DIALOG *d, int c) {
if (msg == MSG_DRAW) {
rectfill(gui_bitmap, d->x, d->y, d->x + d->w, d->y+d->h, d->bg);
- drawSkinnedRect(gui_bitmap, &gui_skin.textbox.bg, d->x, d->y, d->w, d->h);
+ draw_skinned_rect(gui_bitmap, &gui_skin.textbox.bg, d->x, d->y, d->w, d->h);
if (d->flags & D_DISABLED) {
col = gui_skin.textbox.textcolor[1];
@@ -884,173 +884,149 @@ int tmw_password_proc(int msg, DIALOG *d, int c) {
}
int tmw_list_proc(int msg, DIALOG *d, int c) {
-// BITMAP *box = NULL;
-
- static int ignoreRedraw = FALSE;
-
- int itemCount = 0;
- int firstItem = d->d2;
- int lastItem = 0;
- int selectedItem = d->d1;
- int x,y,delta;
- int a, col;
- int w, h = 0;
- int rtm = 0;
- int cl, cr, cb, ct;
- int th = alfont_text_height(gui_font);
-
- int vscroll = 0;
- int sliderh = 10;
- int slidery = 0;
-
+ static int ignoreRedraw = FALSE;
+ int itemCount = 0;
+ int firstItem = d->d2;
+ int lastItem = 0;
+ int selectedItem = d->d1;
+ int x,y,delta;
+ int a, col;
+ int w, h = 0;
+ int rtm = 0;
+ int cl, cr, cb, ct;
+ int th = alfont_text_height(gui_font);
+
+ int vscroll = 0;
+ int sliderh = 10;
+ int slidery = 0;
+
+ (*(getfuncptr)d->dp)(-1, &itemCount);
+ w = d->w - gui_skin.listbox.bg.grid[0]->w - gui_skin.listbox.bg.grid[2]->w;
+ h = d->h - gui_skin.listbox.bg.grid[1]->h - gui_skin.listbox.bg.grid[7]->h;
+ lastItem = MIN(itemCount-1, firstItem + h / alfont_text_height(gui_font));
+
+ if (msg == MSG_DRAW) {
+ if (ignoreRedraw) {
+ return D_O_K;
+ }
+ rectfill(gui_bitmap, d->x, d->y, d->x + d->w, d->y+d->h, d->bg);
+ draw_skinned_rect(gui_bitmap, &gui_skin.listbox.bg, d->x, d->y, d->w, d->h);
(*(getfuncptr)d->dp)(-1, &itemCount);
-
- w = d->w - gui_skin.listbox.bg.grid[0]->w - gui_skin.listbox.bg.grid[2]->w;
- h = d->h - gui_skin.listbox.bg.grid[1]->h - gui_skin.listbox.bg.grid[7]->h;
- lastItem = MIN(itemCount-1, firstItem + h / alfont_text_height(gui_font));
-
-
-
- if (msg == MSG_DRAW) {
- if (ignoreRedraw) {
- return D_O_K;
- }
- rectfill(gui_bitmap, d->x, d->y, d->x + d->w, d->y+d->h, d->bg);
- drawSkinnedRect(gui_bitmap, &gui_skin.listbox.bg, d->x, d->y, d->w, d->h);
-
- (*(getfuncptr)d->dp)(-1, &itemCount);
- vscroll = (h/th) < (itemCount-1);
- if (vscroll) {
- w = d->w - 17 - gui_skin.listbox.bg.grid[0]->w;
- drawSkinnedRect(gui_bitmap, &gui_skin.listbox.bg, d->x+d->w-15, d->y+1, 14, d->h-2);
- sliderh = MAX(((d->h-2)* (h / th)) / itemCount, gui_skin.listbox.bg.grid[0]->h*2);
- slidery = ((d->h-2-sliderh) * firstItem) / (itemCount);
- slidery+= d->y+1;
- drawSkinnedRect(gui_bitmap, &gui_skin.listbox.vscroll, d->x+d->w-13, slidery, 11, sliderh);
- }
-
- rtm = alfont_text_mode(-1);
- if (gui_bitmap->clip) {
- cl = gui_bitmap->cl;
- ct = gui_bitmap->ct;
- cr = gui_bitmap->cr;
- cb = gui_bitmap->cb;
- } else {
- cl=ct=0;
- cr=gui_bitmap->w;
- cb=gui_bitmap->h;
- }
- x = d->x + gui_skin.listbox.bg.grid[0]->w;
- y = d->y + gui_skin.listbox.bg.grid[0]->h;
- set_clip_rect(gui_bitmap, x,y, x+w, y+h);
-
-
- if (d->flags & D_DISABLED) {
- col = gui_skin.listbox.textcolor[3];
- for (a=firstItem; a < lastItem; a++) {
- alfont_textout_aa(gui_bitmap, gui_font, (*(getfuncptr)d->dp)(a, 0), x, y, col);
- y += alfont_text_height(gui_font);
- }
- } else {
- for (a=firstItem; a <= lastItem; a++) {
- if (a==d->d1) {
- col = gui_skin.listbox.textcolor[1];
- rectfill(gui_bitmap, x, y, x+w, y+alfont_text_height(gui_font)-1, gui_skin.listbox.textcolor[2]);
- } else {
- col = gui_skin.listbox.textcolor[0];
- }
- alfont_textout_aa(gui_bitmap, gui_font, (*(getfuncptr)d->dp)(a, 0), x, y, col);
- y += alfont_text_height(gui_font);
- }
- }
-
- alfont_text_mode(rtm);
- set_clip_rect(gui_bitmap, cl, ct, cr, cb);
-
- } else if (msg == MSG_CLICK) {
-
- x = d->x + gui_skin.listbox.bg.grid[0]->w;
- y = d->y + gui_skin.listbox.bg.grid[0]->h;
-
- sliderh = MAX(((d->h-2)* (h / th)) / itemCount, gui_skin.listbox.bg.grid[0]->h*2);
- //sliderh = ((d->h-2)* (h / th)) / itemCount;
- slidery = ((d->h-2-sliderh) * firstItem) / (itemCount);
- slidery+= d->y+1;
-
- if (mouse_x > (d->x + d->w - 14) && mouse_x < (d->x+d->w-1)) {
- // Ok, scroll bar
- if (mouse_y >= slidery && mouse_y < slidery + sliderh) {
- delta= mouse_y - slidery;
- while (mouse_b) {
- a = mouse_y - delta - d->y -1;
- a *= itemCount;
- a /= (d->h-2);
- a = MID(0, a, itemCount- h/th);
-
- if (a != d->d2) {
- d->d2 = a;
- scare_mouse();
- object_message(d, MSG_DRAW, 0);
- unscare_mouse();
- }
-
- slidery = ((d->h-2) * firstItem) / (itemCount);
- slidery+= d->y+1;
- }
- } else if (mouse_y < slidery) {
- a = d->d2 - (h/th)+1;
- a = MID(0, a, itemCount- h/th);
-
-
- d->d2 = a;
- scare_mouse();
- object_message(d, MSG_DRAW, 0);
- unscare_mouse();
-
- while (mouse_b) {
- }
- } else if (mouse_y > slidery + sliderh) {
- a = d->d2 + (h/th)-1;
- a = MID(0, a, itemCount- h/th);
- d->d2 = a;
-
- scare_mouse();
- object_message(d, MSG_DRAW, 0);
- unscare_mouse();
-
- while (mouse_b) {
- }
- }
- } else if (mouse_x >= x && mouse_x < x+w && mouse_y >= y && mouse_y < y+h) {
-
- while (mouse_b) {
- a = firstItem + (mouse_y-y) / alfont_text_height(gui_font);
-
- if (a <= lastItem && a != selectedItem) {
- d->d1 = selectedItem = a;
- scare_mouse();
- object_message(d, MSG_DRAW, 0);
- unscare_mouse();
- }
- }
- }
- } else {
- ignoreRedraw = (msg == MSG_GOTFOCUS || msg == MSG_LOSTFOCUS);
- a = d_list_proc(msg, d, c);
-
- if (a == D_USED_CHAR) {
- if (d->d1 < d->d2) {
- if (d->d1 > 0) {
- d->d1 = d->d2;
- }
- } else if (d->d1 > d->d2 + h/th -1) {
- d->d2 = d->d1 - h/th + 1;
- }
- }
-
- return a;
+ vscroll = (h/th) < (itemCount-1);
+ if (vscroll) {
+ w = d->w - 17 - gui_skin.listbox.bg.grid[0]->w;
+ draw_skinned_rect(gui_bitmap, &gui_skin.listbox.bg, d->x+d->w-15, d->y+1, 14, d->h-2);
+ sliderh = MAX(((d->h-2)* (h / th)) / itemCount, gui_skin.listbox.bg.grid[0]->h*2);
+ slidery = ((d->h-2-sliderh) * firstItem) / (itemCount);
+ slidery+= d->y+1;
+ draw_skinned_rect(gui_bitmap, &gui_skin.listbox.vscroll, d->x+d->w-13, slidery, 11, sliderh);
}
- return D_O_K;
+
+ rtm = alfont_text_mode(-1);
+ if (gui_bitmap->clip) {
+ cl = gui_bitmap->cl;
+ ct = gui_bitmap->ct;
+ cr = gui_bitmap->cr;
+ cb = gui_bitmap->cb;
+ } else {
+ cl=ct=0;
+ cr=gui_bitmap->w;
+ cb=gui_bitmap->h;
+ }
+ x = d->x + gui_skin.listbox.bg.grid[0]->w;
+ y = d->y + gui_skin.listbox.bg.grid[0]->h;
+ set_clip_rect(gui_bitmap, x,y, x+w, y+h);
+ if (d->flags & D_DISABLED) {
+ col = gui_skin.listbox.textcolor[3];
+ for (a=firstItem; a < lastItem; a++) {
+ alfont_textout_aa(gui_bitmap, gui_font, (*(getfuncptr)d->dp)(a, 0), x, y, col);
+ y += alfont_text_height(gui_font);
+ }
+ } else {
+ for (a=firstItem; a <= lastItem; a++) {
+ if (a==d->d1) {
+ col = gui_skin.listbox.textcolor[1];
+ rectfill(gui_bitmap, x, y, x+w, y+alfont_text_height(gui_font)-1, gui_skin.listbox.textcolor[2]);
+ } else {
+ col = gui_skin.listbox.textcolor[0];
+ }
+ alfont_textout_aa(gui_bitmap, gui_font, (*(getfuncptr)d->dp)(a, 0), x, y, col);
+ y += alfont_text_height(gui_font);
+ }
+ }
+ alfont_text_mode(rtm);
+ set_clip_rect(gui_bitmap, cl, ct, cr, cb);
+ } else if (msg == MSG_CLICK) {
+ x = d->x + gui_skin.listbox.bg.grid[0]->w;
+ y = d->y + gui_skin.listbox.bg.grid[0]->h;
+ sliderh = MAX(((d->h-2)* (h / th)) / itemCount, gui_skin.listbox.bg.grid[0]->h*2);
+ //sliderh = ((d->h-2)* (h / th)) / itemCount;
+ slidery = ((d->h-2-sliderh) * firstItem) / (itemCount);
+ slidery+= d->y+1;
+ if (mouse_x > (d->x + d->w - 14) && mouse_x < (d->x+d->w-1)) {
+ // Ok, scroll bar
+ if (mouse_y >= slidery && mouse_y < slidery + sliderh) {
+ delta= mouse_y - slidery;
+ while (mouse_b) {
+ a = mouse_y - delta - d->y -1;
+ a *= itemCount;
+ a /= (d->h-2);
+ a = MID(0, a, itemCount- h/th);
+ if (a != d->d2) {
+ d->d2 = a;
+ scare_mouse();
+ object_message(d, MSG_DRAW, 0);
+ unscare_mouse();
+ }
+ slidery = ((d->h-2) * firstItem) / (itemCount);
+ slidery+= d->y+1;
+ }
+ } else if (mouse_y < slidery) {
+ a = d->d2 - (h/th)+1;
+ a = MID(0, a, itemCount- h/th);
+
+ d->d2 = a;
+ scare_mouse();
+ object_message(d, MSG_DRAW, 0);
+ unscare_mouse();
+ while (mouse_b) {
+ }
+ } else if (mouse_y > slidery + sliderh) {
+ a = d->d2 + (h/th)-1;
+ a = MID(0, a, itemCount- h/th);
+ d->d2 = a;
+ scare_mouse();
+ object_message(d, MSG_DRAW, 0);
+ unscare_mouse();
+ while (mouse_b) {
+ }
+ }
+ } else if (mouse_x >= x && mouse_x < x+w && mouse_y >= y && mouse_y < y+h) {
+ while (mouse_b) {
+ a = firstItem + (mouse_y-y) / alfont_text_height(gui_font);
+ if (a <= lastItem && a != selectedItem) {
+ d->d1 = selectedItem = a;
+ scare_mouse();
+ object_message(d, MSG_DRAW, 0);
+ unscare_mouse();
+ }
+ }
+ }
+ } else {
+ ignoreRedraw = (msg == MSG_GOTFOCUS || msg == MSG_LOSTFOCUS);
+ a = d_list_proc(msg, d, c);
+ if (a == D_USED_CHAR) {
+ if (d->d1 < d->d2) {
+ if (d->d1 > 0) {
+ d->d1 = d->d2;
+ }
+ } else if (d->d1 > d->d2 + h/th -1) {
+ d->d2 = d->d1 - h/th + 1;
+ }
+ }
+ return a;
+ }
+ return D_O_K;
}
int tmw_plus_proc(int msg, DIALOG *d, int c)
{
@@ -1105,53 +1081,53 @@ else
return D_O_K;
}
-/**
- dialog box w/ left centered head
-*/
+/* Dialog box with left centered head */
int tmw_dialog_proc(int msg, DIALOG *d, int c) {
- int rtm;
+ int rtm;
int x, y;
- if (msg == MSG_CLICK) {
- if(mouse_y < d->y + gui_skin.dialog.bg.grid[1]->h) {
- //drag = true;
- d->d1 = mouse_x - d->x;
- d->d2 = mouse_y - d->y;
- }
- } else if (msg == MSG_DRAW) {
- if((mouse_b & 1)&&(d->d1>=0)&&(d->d2>=0)) {//(drag==true)) {
- x = mouse_x-d->d1;
- y = mouse_y-d->d2;
- if(x<15) {
- x=0;
- position_mouse(d->d1, mouse_y);
- }
- if(y<15) {
- y=0;
- position_mouse(mouse_x, d->d2);
- }
- if(x+d->w>=785) {
- x=800-d->w;
- position_mouse(x+d->d1, mouse_y);
+ switch(msg) {
+
+ case MSG_CLICK:
+ if(mouse_y<d->y+gui_skin.dialog.bg.grid[1]->h) {
+ d->d1 = mouse_x - d->x;
+ d->d2 = mouse_y - d->y;
}
- if(y+d->h>=585) {
- y=600-d->h;
- position_mouse(mouse_x, y+d->d2);
+ break;
+ case MSG_DRAW:
+ if((mouse_b & 1)&&(d->d1>=0)&&(d->d2>=0)) {
+ x = mouse_x-d->d1;
+ y = mouse_y-d->d2;
+ if(x<15) {
+ x=0;
+ position_mouse(d->d1, mouse_y);
+ }
+ if(y<15) {
+ y=0;
+ position_mouse(mouse_x, d->d2);
+ }
+ if(x+d->w>=SCREEN_W-15) {
+ x=SCREEN_W-d->w;
+ position_mouse(x+d->d1, mouse_y);
+ }
+ if(y+d->h>=SCREEN_H-15) {
+ y=SCREEN_H-d->h;
+ position_mouse(mouse_x, y+d->d2);
+ }
+ position_dialog(d, x, y);
+ } else {
+ d->d1 = -1;
+ d->d2 = -1;
}
- position_dialog(active_dialog, x, y);
- } else {
- //drag = false;
- d->d1 = -1;
- d->d2 = -1;
- }
- drawSkinnedRect(gui_bitmap, &gui_skin.dialog.bg, d->x, d->y, d->w, d->h);
- rtm = alfont_text_mode(-1);
- alfont_textprintf_centre_aa(gui_bitmap, gui_font,
- d->x + d->w/2,
- d->y + (gui_skin.dialog.bg.grid[1]->h - alfont_text_height(gui_font))/2, d->fg, "%s", d->dp);
- alfont_text_mode(rtm);
- }
- return D_O_K;
+ draw_skinned_rect(gui_bitmap, &gui_skin.dialog.bg, d->x, d->y, d->w, d->h);
+ rtm = alfont_text_mode(-1);
+ alfont_textprintf_centre_aa(gui_bitmap, gui_font,
+ d->x + d->w/2,
+ d->y + (gui_skin.dialog.bg.grid[1]->h - alfont_text_height(gui_font))/2, d->fg, "%s", d->dp);
+ alfont_text_mode(rtm);
+ break;
+ }
+ return D_O_K;
}
@@ -1194,7 +1170,7 @@ int tmw_ldialog_proc(int msg, DIALOG *d, int c) {
d->d1 = -1;
d->d2 = -1;
}
- drawSkinnedRect(gui_bitmap, &gui_skin.dialog.bg, d->x, d->y, d->w, d->h);
+ draw_skinned_rect(gui_bitmap, &gui_skin.dialog.bg, d->x, d->y, d->w, d->h);
rtm = alfont_text_mode(-1);
alfont_textprintf_aa(gui_bitmap, gui_font, d->x + 4, d->y + (gui_skin.dialog.bg.grid[1]->h - alfont_text_height(gui_font))/2, d->fg, "%s", d->dp);
alfont_text_mode(rtm);
@@ -1225,9 +1201,9 @@ void _gui_draw_scrollable_frame(DIALOG *d, int listsize, int offset, int height,
len = (((d->h-5) * offset) + listsize/2) / listsize;
} else len = 0;
if (yy+i < d->y+d->h-3) {
- drawSkinnedRect(gui_bitmap, &gui_skin.listbox.vscroll, xx, yy+len, 10, i);
+ draw_skinned_rect(gui_bitmap, &gui_skin.listbox.vscroll, xx, yy+len, 10, i);
} else {
- drawSkinnedRect(gui_bitmap, &gui_skin.listbox.vscroll, xx, yy, 10, d->h-3);
+ draw_skinned_rect(gui_bitmap, &gui_skin.listbox.vscroll, xx, yy, 10, d->h-3);
}
}
@@ -1466,14 +1442,10 @@ int tmw_textbox_proc(int msg, DIALOG *d, int c) {
/* figure out if it's on the text or the scrollbar */
bar = (d->d1 > height);
- if ((!bar) || (gui_mouse_x() < d->x+d->w-13)) {
- /* clicked on the text area */
- ret = D_O_K;
- }
- else {
- /* clicked on the scroll area */
- _handle_scrollable_scroll_click(d, d->d1, &d->d2, height);
- }
+ if ((!bar) || (gui_mouse_x() < d->x+d->w-13)) /* clicked on the text area */
+ ret = D_O_K;
+ else /* clicked on the scroll area */
+ //_handle_scrollable_scroll_click(d, d->d1, &d->d2, height);
break;
case MSG_CHAR:
@@ -1555,7 +1527,7 @@ int tmw_textbox_proc(int msg, DIALOG *d, int c) {
int tmw_bitmap_proc(int msg, DIALOG *d, int c) {
if(msg==MSG_DRAW) {
- drawSkinnedRect(gui_bitmap, &gui_skin.textbox.bg, d->x, d->y, d->w, d->h);
+ draw_skinned_rect(gui_bitmap, &gui_skin.textbox.bg, d->x, d->y, d->w, d->h);
if(d->dp!=NULL)
masked_blit(((BITMAP *)d->dp), gui_bitmap, 0, 0, d->x+(d->w-d->d1)/2, d->y+2, d->d1, d->d2);
}
diff --git a/src/gui/login.cpp b/src/gui/login.cpp
index a4fa3592..39a41d27 100644
--- a/src/gui/login.cpp
+++ b/src/gui/login.cpp
@@ -51,10 +51,8 @@ DIALOG login_dialog[] = {
int gui_exit = 1;
while ((!key[KEY_ESC])&&(gui_exit)&&(state!=EXIT)&&(!key[KEY_ENTER])) {
clear_bitmap(buffer);
- if(stretch_mode!=0)blit((BITMAP *)graphic[LOGIN_BMP].dat, buffer, 0, 0, 0, 0, 800, 600);
- else blit((BITMAP *)graphic[LOGIN_BMP].dat, buffer, 0, 0, -120, -90, 640, 480);
-
- gui_exit = gui_update(player);
+ blit((BITMAP *)graphic[LOGIN_BMP].dat, buffer, 0, 0, 0, 0, 800, 600);
+ gui_exit = gui_update(player);
blit(buffer, screen, 0, 0, 0, 0, 800, 600);
}
state = EXIT;
diff --git a/src/gui/shop.cpp b/src/gui/shop.cpp
index 70e984d6..e929f434 100644
--- a/src/gui/shop.cpp
+++ b/src/gui/shop.cpp
@@ -120,6 +120,7 @@ int get_item_quantity(int index) {
}
return item_shop->quantity;
}
+
int get_item_index(int index) {
int iterator = 0;
ITEM_SHOP *item_shop = shop;
@@ -129,6 +130,7 @@ int get_item_index(int index) {
}
return item_shop->index;
}
+
int get_item_price(int index) {
int iterator = 0;
ITEM_SHOP *item_shop = shop;
@@ -138,9 +140,8 @@ int get_item_price(int index) {
}
return item_shop->price;
}
-void changeQ(void *dp3, int d2)
-{
-sprintf(itemCurrenyQ,"%i",d2);
-printf("%s\n",itemCurrenyQ);
-}
+void changeQ(void *dp3, int d2) {
+ sprintf(itemCurrenyQ,"%i",d2);
+ printf("%s\n",itemCurrenyQ);
+}
diff --git a/src/gui/skill.cpp b/src/gui/skill.cpp
index f6c7e041..45095902 100644
--- a/src/gui/skill.cpp
+++ b/src/gui/skill.cpp
@@ -27,6 +27,9 @@
extern PLAYER_INFO *char_info;
+int n_skills = 0;
+SKILL *skill_head = NULL;
+
char str_string[8];
char agi_string[8];
char vit_string[8];
@@ -34,21 +37,46 @@ char int_string[8];
char dex_string[8];
char luk_string[8];
+char *skill_db[] = {
+ // 0-99
+ "", "Basic", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "",
+ // 100-199
+ "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "",
+ "", "", "First aid", "Play as dead", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "", "", "", "",
+};
+
DIALOG skill_dialog[] = {
/* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) */
{ 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_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_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_plus_proc, 354, 244, 16, 16, 0, 0, '0', 0, 2, 1, (void*)increaseStatus,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_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_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 },
+ { 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 }
};
@@ -70,11 +98,62 @@ void update_skill_dialog() {
}
}
-void increaseStatus(void *dp3, int d1)
-{
+void add_skill(short id, short lv, short sp) {
+ SKILL *skill = skill_head;
+ SKILL *temp = (SKILL *)malloc(sizeof(SKILL));
+ temp->id = id;
+ temp->lv = lv;
+ temp->sp = sp;
+ temp->next = NULL;
+ if(!skill_head)
+ skill_head = temp;
+ else {
+ while(skill->next)
+ skill = skill->next;
+ skill->next = temp;
+ }
+}
+
+char *skill_list(int index, int *list_size) {
+ if(index<0) {
+ *list_size = n_skills;
+ return NULL;
+ } else {
+ int iterator = 0;
+ SKILL *temp = skill_head;
+ while(iterator<index) {
+ temp = temp->next;
+ iterator++;
+ }
+ char *name = (char *)malloc(30);
+ sprintf(name, "%s lv:%i %i SP", skill_db[temp->id], temp->lv, temp->sp);
+ return name;
+ // need to clean allocated memory
+ }
+}
+
+int get_skill_id(int index) {
+ int iterator = 0;
+ SKILL *temp = skill_head;
+ while(iterator<index) {
+ temp = temp->next;
+ iterator++;
+ }
+ return temp->id;
+}
+
+SKILL *is_skill(int id) {
+ SKILL *temp = skill_head;
+ while(temp) {
+ if(temp->id==id)return temp;
+ temp = temp->next;
+ }
+ return NULL;
+}
+
+void increaseStatus(void *dp3, int d1) {
WFIFOW(0) = net_w_value(0x00bb);
- switch(d1)
- {
+ switch(d1) {
case 0:
WFIFOW(2) = net_w_value(0x000d);
break;
@@ -83,19 +162,19 @@ void increaseStatus(void *dp3, int d1)
break;
case 2:
WFIFOW(2) = net_w_value(0x000f);
- break;
+ break;
case 3:
WFIFOW(2) = net_w_value(0x0010);
- break;
+ break;
case 4:
WFIFOW(2) = net_w_value(0x0011);
- break;
+ break;
case 5:
WFIFOW(2) = net_w_value(0x0012);
- break;
+ 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 601f9ef5..6ba70ec1 100644
--- a/src/gui/skill.h
+++ b/src/gui/skill.h
@@ -35,6 +35,18 @@
//DIALOG skill_dialog[];
+extern int n_skills;
+
+struct SKILL {
+ short id, lv, sp;
+ SKILL *next;
+};
+
+
void update_skill_dialog();
+void add_skill(short id, short lv, short sp);
+char *skill_list(int index, int *list_size);
+int get_skill_id(int index);
+SKILL *is_skill(int id);
void increaseStatus(void *dp3, int d1);
#endif
diff --git a/src/gui/stats.cpp b/src/gui/stats.cpp
index a6af4ac5..5e6c91a0 100644
--- a/src/gui/stats.cpp
+++ b/src/gui/stats.cpp
@@ -30,12 +30,12 @@ char stats_gp[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, 34, 296, 100, 0, 0, 0, 0, 0, 0, stats_hp, NULL, NULL },
- { tmw_bar_proc, 507, 22, 60, 18, 0, 0, '1', 0, 1, 1, NULL, NULL, NULL },
- { tmw_text_proc, 707, 34, 296, 100, 0, 0, 0, 0, 0, 0, stats_gp, NULL, NULL },
- { tmw_text_proc, 607, 34, 296, 100, 0, 0, 0, 0, 0, 0, stats_sp, NULL, NULL },
- { tmw_bar_proc, 617, 22, 60, 18, 0, 0, '1', 0, 1, 1, NULL, NULL, NULL },
+ { tmw_dialog_proc, 493-10, 0+10, 300, 55, 0, 0, 0, 0, 0, 0, stats_name, NULL, NULL },
+ { tmw_text_proc, 497-10, 34+10, 296, 100, 0, 0, 0, 0, 0, 0, stats_hp, NULL, NULL },
+ { tmw_bar_proc, 507-10, 22+10, 60, 18, 0, 0, '1', 0, 1, 1, NULL, NULL, NULL },
+ { tmw_text_proc, 707-10, 34+10, 296, 100, 0, 0, 0, 0, 0, 0, stats_gp, NULL, NULL },
+ { tmw_text_proc, 607-10, 34+10, 296, 100, 0, 0, 0, 0, 0, 0, stats_sp, NULL, NULL },
+ { tmw_bar_proc, 617-10, 22+10, 60, 18, 0, 0, '1', 0, 1, 1, NULL, NULL, NULL },
{ NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }
};