summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am2
-rw-r--r--src/game.cpp26
-rw-r--r--src/graphic/graphic.cpp8
-rw-r--r--src/gui/char_select.cpp10
-rw-r--r--src/gui/chat.cpp22
-rw-r--r--src/gui/chat.h8
-rw-r--r--src/gui/gui.cpp150
-rw-r--r--src/gui/gui.h1
-rw-r--r--src/gui/inventory.cpp24
-rw-r--r--src/main.cpp3
10 files changed, 119 insertions, 135 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 14744376..6fdd5fe1 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -30,6 +30,6 @@ INCLUDES= $(all_includes)
# the library search path.
tmw_LDFLAGS = $(all_libraries) $(LIBSDL_RPATH) $(LIBALLEGRO_RPATH)
-tmw_CXXFLAGS = $(LIBSDL_CFLAGS) $(LIBALLEGRO_CFLAGS)
+tmw_CXXFLAGS = $(LIBSDL_CFLAGS) $(LIBALLEGRO_CFLAGS) -Wno-deprecated
tmw_LDADD = $(LIBSDL_LIBS) $(LIBALLEGRO_LIBS)
tmw_TARGET = ../tmw
diff --git a/src/game.cpp b/src/game.cpp
index 8ff147b8..1f54bb95 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -290,10 +290,6 @@ void do_input() {
int npc_x = mouse_x/32+camera_x;
int npc_y = mouse_y/32+camera_y;
int id = find_npc(npc_x, npc_y);
- /*char tyr[20];
- sprintf(tyr,"%i %i %i", npc_x, npc_y, id);
- alert(tyr,"","","","",0,0);
- alfont_textprintf(screen, gui_font, mouse_x+20, mouse_y+20, MAKECOL_WHITE, "%i %i", npc_x, npc_y);*/
if(id!=0) {
WFIFOW(0) = net_w_value(0x0090);
WFIFOL(2) = net_l_value(id);
@@ -363,7 +359,7 @@ void do_parse() {
node->speech = temp;
node->speech_time = SPEECH_TIME;
node->speech_color = makecol(255, 255, 255);
- chatlog.chat_log(node->speech, BY_OTHER, gui_font);
+ chatlog.chat_log(node->speech, BY_OTHER, font);
}
break;
case 0x008e:
@@ -382,9 +378,9 @@ void do_parse() {
player_node->speech_color = makecol(255, 255, 255);
if(id==0x008e)
- chatlog.chat_log(player_node->speech, BY_PLAYER, gui_font);
+ chatlog.chat_log(player_node->speech, BY_PLAYER, font);
else
- chatlog.chat_log(player_node->speech, BY_GM, gui_font);
+ chatlog.chat_log(player_node->speech, BY_GM, font);
}
break;
// Success to walk request
@@ -572,7 +568,7 @@ void do_parse() {
action.bskill == BSKILL_EMOTE ) {
printf("Action: %d/%d", action.bskill, action.success);
}
- chatlog.chat_log(action, gui_font);
+ chatlog.chat_log(action, font);
break;
// Update stat values
case 0x00b0:
@@ -746,26 +742,26 @@ void do_parse() {
show_npc_dialog = 4;
for(int k=0;k<n_items;k++)
add_sell_item(RFIFOW(4+10*k), RFIFOL(4+10*k+2));
- } else chatlog.chat_log("Nothing to sell", BY_SERVER, gui_font);
+ } else chatlog.chat_log("Nothing to sell", BY_SERVER, font);
break;
// Answer to buy
case 0x00ca:
if(RFIFOB(2)==0)
- chatlog.chat_log("Thanks for buying", BY_SERVER, gui_font);
+ chatlog.chat_log("Thanks for buying", BY_SERVER, font);
else
- chatlog.chat_log("Unable to buy", BY_SERVER, gui_font);
+ chatlog.chat_log("Unable to buy", BY_SERVER, font);
break;
// Answer to sell
case 0x00cb:
if(RFIFOB(2)==0)
- chatlog.chat_log("Thanks for selling", BY_SERVER, gui_font);
+ chatlog.chat_log("Thanks for selling", BY_SERVER, font);
else
- chatlog.chat_log("Unable to sell", BY_SERVER, gui_font);
+ chatlog.chat_log("Unable to sell", BY_SERVER, font);
break;
// Add item to inventory after you bought it
case 0x00a0:
if(RFIFOB(22)>0)
- chatlog.chat_log("Unable to pick up item", BY_SERVER, gui_font);
+ chatlog.chat_log("Unable to pick up item", BY_SERVER, font);
else
inventory.add_item(RFIFOW(2), RFIFOW(6), RFIFOW(4));
break;
@@ -807,7 +803,7 @@ void do_parse() {
break;
// Display MVP payer
case 0x010c:
- chatlog.chat_log("MVP player", BY_SERVER, gui_font);
+ chatlog.chat_log("MVP player", BY_SERVER, font);
break;
// Item drop
case 0x009e:
diff --git a/src/graphic/graphic.cpp b/src/graphic/graphic.cpp
index 406c953c..9f1f9abd 100644
--- a/src/graphic/graphic.cpp
+++ b/src/graphic/graphic.cpp
@@ -214,7 +214,6 @@ void init_graphic() {
//buffer = create_bitmap(SCREEN_W/2, SCREEN_H/2);
//double_buffer = create_bitmap(SCREEN_W, SCREEN_H);
- alfont_set_font_size(gui_font, 16);
clear_bitmap(screen);
chat_background = create_bitmap(592, 100);
clear_to_color(chat_background, makecol(0,0,0));
@@ -233,7 +232,7 @@ void init_graphic() {
guiTop->add(chatInput);
chatInput->requestFocus();
-
+
npc_player = init_dialog(npc_dialog, -1);
position_dialog(npc_dialog, 300, 200);
@@ -473,7 +472,7 @@ new_tileset->spriteset[0]->draw(vbuffer, 0, 0);
set_trans_blender(0, 0, 0, 110);
draw_trans_sprite(vpage[page_num], chat_background, 0, SCREEN_H-125);
- chatlog.chat_draw(vpage[page_num], 8, gui_font);
+ chatlog.chat_draw(vpage[page_num], 8, font);
switch(show_npc_dialog) {
case 1:
@@ -506,7 +505,6 @@ new_tileset->spriteset[0]->draw(vbuffer, 0, 0);
buy_dialog[4].dp = &money;
buy_dialog[5].d1 = (int)(char_info->gp/get_item_price(buy_dialog[3].d1));
if(buy_dialog[5].d2>buy_dialog[5].d1)
- //alfont_textprintf(double_buffer, gui_font, 0, 10, MAKECOL_WHITE, "%i", buy_dialog[5].d1);
dialog_message(buy_dialog, MSG_DRAW, 0, 0);
if(!gui_update(buy_player)) {
show_npc_dialog = shutdown_dialog(buy_player);
@@ -529,7 +527,7 @@ new_tileset->spriteset[0]->draw(vbuffer, 0, 0);
//sprintf(ds, "%i", sell_dialog[3].d1);
//ok(ds,"");
- //alfont_textprintf(vpage[page_num], gui_font, 0, 10, MAKECOL_WHITE, "%i", sell_dialog[3].d1);
+ //alfont_textprintf(vpage[page_num], font, 0, 10, MAKECOL_WHITE, "%i", sell_dialog[3].d1);
dialog_message(sell_dialog, MSG_DRAW, 0, 0);
if(!gui_update(sell_player)) {
show_npc_dialog = shutdown_dialog(sell_player);
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp
index 1a109836..ae51be1a 100644
--- a/src/gui/char_select.cpp
+++ b/src/gui/char_select.cpp
@@ -84,7 +84,7 @@ int tmw_incbutt_proc2(int msg, DIALOG *d, int c) {
return D_O_K;
}
return tmw_button_proc(msg, d, c);
-}
+}
int tmw_player_proc(int msg, DIALOG *d, int c) {
if(msg==MSG_DRAW) {
@@ -104,7 +104,7 @@ void char_select() {
state = LOGIN;
if(n_character>0) {
char_select_dialog[1].dp = char_info->name;
- char_select_dialog[1].x = 400-alfont_text_length(gui_font, char_info->name)/2;
+ char_select_dialog[1].x = 400-text_length(font, char_info->name)/2;
//char_select_dialog[2].dp = playerset;
if(playerset==NULL)ok("Error", "Playerset not loaded");
strcpy(button_state, "Del");
@@ -208,8 +208,8 @@ void server_char_delete() {
}
// Create a new character
} else {
- n_character = 1;
-
+ n_character = 1;
+
centre_dialog(char_create_dialog);
DIALOG_PLAYER *player = init_dialog(char_create_dialog, -1);
int gui_exit = 1;
@@ -275,7 +275,7 @@ void server_char_delete() {
} else {
ok("Error", "Unknown error");
n_character = 0;
- }
+ }
} else n_character = 0;
}
}
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index 036b3b7a..f9c87a55 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -60,7 +60,7 @@ void Chat::chat_dlgrsize(int) {
* i already store the width in pixel in the list rather than
* calculating it again and again on every draw event. ;-)
*/
-void Chat::chat_log(std::string line, int own, ALFONT_FONT * font) {
+void Chat::chat_log(std::string line, int own, FONT * font) {
int pos;
CHATLOG tmp;
@@ -103,7 +103,7 @@ void Chat::chat_log(std::string line, int own, ALFONT_FONT * font) {
/*
* function overload -> calls original chat_log() after processing the packet
*/
-void Chat::chat_log(CHATSKILL action, ALFONT_FONT * font) {
+void Chat::chat_log(CHATSKILL action, FONT * font) {
chat_log(const_msg(action), BY_SERVER, font);
}
@@ -114,13 +114,13 @@ void Chat::chat_log(CHATSKILL action, ALFONT_FONT * font) {
*
* BITMAP * bmp: Allegro type bitmap buffer to draw onto
* int n: number of lines to be drawn
- * ALFONT_FONT * font: font to use
+ * FONT * font: Allegro's system font
*
* NOTE:
* take great care using this, make sure the buffer passed is
* empty! ;-) anyway, line wrapping is not supported yet.
*/
-void Chat::chat_draw(BITMAP * bmp, int n, ALFONT_FONT * font) {
+void Chat::chat_draw(BITMAP * bmp, int n, FONT * font) {
int y = 600-35, i = 0;
CHATLOG line;
n -= 1;
@@ -131,19 +131,19 @@ void Chat::chat_draw(BITMAP * bmp, int n, ALFONT_FONT * font) {
switch (line.own) {
case BY_GM :
- alfont_textprintf_aa(bmp, font, 1, y, COLOR_BLUE, "Global announcement: ");
- alfont_textprintf_aa(bmp, font, TEXT_GETWIDTH("Global announcement: "), y, COLOR_GREEN, line.text.c_str());
+ textprintf(bmp, font, 1, y, COLOR_BLUE, "Global announcement: ");
+ textprintf(bmp, font, TEXT_GETWIDTH("Global announcement: "), y, COLOR_GREEN, line.text.c_str());
break;
case BY_PLAYER :
- alfont_textprintf_aa(bmp, font, 1, y, COLOR_YELLOW, line.nick.c_str());
- alfont_textprintf_aa(bmp, font, line.width, y, COLOR_WHITE, line.text.c_str());
+ textprintf(bmp, font, 1, y, COLOR_YELLOW, line.nick.c_str());
+ textprintf(bmp, font, line.width, y, COLOR_WHITE, line.text.c_str());
break;
case BY_OTHER :
- alfont_textprintf_aa(bmp, font, 1, y, COLOR_GREEN, line.nick.c_str());
- alfont_textprintf_aa(bmp, font, line.width, y, COLOR_WHITE, line.text.c_str());
+ textprintf(bmp, font, 1, y, COLOR_GREEN, line.nick.c_str());
+ textprintf(bmp, font, line.width, y, COLOR_WHITE, line.text.c_str());
break;
default :
- alfont_textprintf_aa(bmp, font, 1, y, COLOR_LIGHTBLUE, line.text.c_str());
+ textprintf(bmp, font, 1, y, COLOR_LIGHTBLUE, line.text.c_str());
}
if (i>=n) {
diff --git a/src/gui/chat.h b/src/gui/chat.h
index 109bc981..2321eb09 100644
--- a/src/gui/chat.h
+++ b/src/gui/chat.h
@@ -57,7 +57,7 @@
#define COLOR_LIGHTBLUE (makecol( 83,223,246)) // bright blue
/** calculate text-width in pixel */
-#define TEXT_GETWIDTH(str) (alfont_text_length(font, str))
+#define TEXT_GETWIDTH(str) (text_length(font, str))
/** job dependend identifiers (?) */
#define SKILL_BASIC 0x0001
@@ -112,10 +112,10 @@ class Chat {
Chat(const char *, int);
void chat_dlgrsize(int);
- void chat_log(std::string, int, ALFONT_FONT *);
- void chat_log(CHATSKILL, ALFONT_FONT *);
+ void chat_log(std::string, int, FONT *);
+ void chat_log(CHATSKILL, FONT *);
- void chat_draw(BITMAP *, int, ALFONT_FONT *);
+ void chat_draw(BITMAP *, int, FONT *);
char * chat_send(std::string, std::string);
~Chat();
private :
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index 273d4c7d..270cbb5e 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -46,7 +46,6 @@ static BITMAP *gui__repository[GUI_BMP_COUNT];
/* The currently active skin */
LexSkin gui_skin;
BITMAP *gui_bitmap;
-ALFONT_FONT *gui_font;
bool drag;
DATAFILE *gui_gfx;
@@ -96,9 +95,6 @@ void init_gui(BITMAP *bitmap, const char *skin) {
gui_bitmap = bitmap;
gui_load_skin(skin);
- //alfont_init();
- gui_font = alfont_load_font("./data/Skin/arial.ttf");
- alfont_set_font_size(gui_font, 14);
drag = false;
show_mouse(NULL);
}
@@ -470,9 +466,7 @@ void gui_exit() {
delete guiGraphics;
delete imageLoader;
- //alfont_destroy_font(gui_font);
gui_shutdown();
- //alfont_exit();
}
void gui_shutdown(void) {
@@ -537,19 +531,19 @@ int gui_text(BITMAP *bmp, AL_CONST char *s, int x, int y, int color, int centre)
}
}
usetc(tmp+out_pos, 0);
- pix_len = alfont_text_length(gui_font, tmp);
+ pix_len = text_length(font, tmp);
if (centre)x -= pix_len / 2;
if (bmp) {
- alfont_textout_aa(bmp, gui_font, tmp, x, y, color);
+ textout(bmp, font, tmp, x, y, color);
if (hline_pos >= 0) {
c = ugetat(tmp, hline_pos);
usetat(tmp, hline_pos, 0);
- hline_pos = alfont_text_length(gui_font, tmp);
+ hline_pos = text_length(font, tmp);
c = usetc(tmp, c);
usetc(tmp+c, 0);
- c = alfont_text_length(gui_font, tmp);
- hline(bmp, x+hline_pos, y+alfont_text_height(gui_font)-gui_font_baseline, x+hline_pos+c-1, color);
+ c = text_length(font, tmp);
+ hline(bmp, x+hline_pos, y+text_height(font)-gui_font_baseline, x+hline_pos+c-1, color);
}
}
return pix_len;
@@ -558,9 +552,9 @@ int gui_text(BITMAP *bmp, AL_CONST char *s, int x, int y, int color, int centre)
int tmw_text_proc(int msg, DIALOG *d, int c) {
if (msg==MSG_DRAW) {
int rtm;
- rtm = alfont_text_mode(-1);
+ rtm = text_mode(-1);
gui_text(gui_bitmap, (char *)d->dp, d->x, d->y, d->fg, FALSE);
- alfont_text_mode(rtm);
+ text_mode(rtm);
}
return D_O_K;
}
@@ -590,16 +584,16 @@ int tmw_button_proc(int msg, DIALOG *d, int c) {
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);
- gui_text(gui_bitmap, (const char *)d->dp, d->x+d->w/2+ofs, d->y+d->h/2-alfont_text_height(gui_font)/2+ofs, col, TRUE);
- alfont_text_mode(rtm);
+ rtm = text_mode(-1);
+ gui_text(gui_bitmap, (const char *)d->dp, d->x+d->w/2+ofs, d->y+d->h/2-text_height(font)/2+ofs, col, TRUE);
+ text_mode(rtm);
ret = D_O_K;
} else {
/*if(msg==MSG_CLICK) {
if(d->d1==1)((int)d->dp2) + 1;
else if(d->d1==2)((int)d->dp2) - 1;
}*/
-
+
ret = d_button_proc(msg,d,c);
}
return ret;
@@ -669,11 +663,11 @@ int tmw_slider_proc(int msg, DIALOG *d, int c) {
}
masked_blit(gui_skin.slider.vGrip, gui_bitmap, 0, 0, x, y, gui_skin.slider.vGrip->w, gui_skin.slider.vGrip->h);
}
- //textprintf(gui_bitmap, gui_font,10, 10, makecol(255,255,255), "%i", d->d2);
+ //textprintf(gui_bitmap, font,10, 10, makecol(255,255,255), "%i", d->d2);
} else {
if(d->d1==0)d->d1 = 1;
ret = d_slider_proc(msg,d,c);
- }
+ }
if (watchdog == 1) {
d->dp2 = (void*)gui__external_slider_callback;
@@ -725,13 +719,13 @@ int tmw_radio_proc(int msg, DIALOG *d, int c) {
tx = x - box->w/2 - l;
}
y = d->y + (d->h - box->h)/ 2;
- ty = d->y + (d->h - alfont_text_height(gui_font)) / 2;
+ ty = d->y + (d->h - text_height(font)) / 2;
masked_blit(box, gui_bitmap, 0, 0, x, y, box->w, box->h);
if (d->dp != NULL) {
- rtm = alfont_text_mode(-1);
+ rtm = text_mode(-1);
gui_text(gui_bitmap, (const char *)d->dp, tx, ty, col, 0);
- alfont_text_mode(rtm);
+ text_mode(rtm);
}
@@ -767,13 +761,13 @@ int tmw_edit_proc(int msg, DIALOG *d, int c) {
lb = gui_skin.textbox.bg.grid[0]->w;
rb = gui_skin.textbox.bg.grid[2]->w;
tx = d->x + lb;
- ty = d->y + (d->h - alfont_text_height(gui_font))/2;
+ ty = d->y + (d->h - text_height(font))/2;
text = (char *)d->dp;
start = text;
- rtm = alfont_text_mode(-1);
+ rtm = text_mode(-1);
if (gui_bitmap->clip) {
cl = gui_bitmap->cl;
@@ -785,10 +779,10 @@ int tmw_edit_proc(int msg, DIALOG *d, int c) {
cr=gui_bitmap->w;
cb=gui_bitmap->h;
}
- set_clip_rect(gui_bitmap, tx, ty, d->x+d->w-rb, ty + alfont_text_height(gui_font)); // set_clip() is deprecated use set_clip_rect() instead
+ set_clip_rect(gui_bitmap, tx, ty, d->x+d->w-rb, ty + text_height(font)); // set_clip() is deprecated use set_clip_rect() instead
hack = text[d->d2];
text[d->d2] = '\0';
- l = alfont_text_length(gui_font, text);
+ l = text_length(font, text);
text[d->d2] = hack;
if (l > d->w-lb-rb) {
@@ -800,11 +794,11 @@ int tmw_edit_proc(int msg, DIALOG *d, int c) {
if (d->flags & D_GOTFOCUS) {
hack = text[d->d2];
text[d->d2] = '\0';
- x = tx + alfont_text_length(gui_font, text);
- vline(gui_bitmap, x, ty, ty + alfont_text_height(gui_font), col);
+ x = tx + text_length(font, text);
+ vline(gui_bitmap, x, ty, ty + text_height(font), col);
text[d->d2] = hack;
}
- alfont_text_mode(rtm);
+ text_mode(rtm);
set_clip_rect(gui_bitmap, cl, ct, cr, cb);
} else {
return d_edit_proc(msg, d, c);
@@ -838,7 +832,7 @@ int tmw_password_proc(int msg, DIALOG *d, int c) {
lb = gui_skin.textbox.bg.grid[0]->w;
rb = gui_skin.textbox.bg.grid[2]->w;
tx = d->x + lb;
- ty = d->y + (d->h - alfont_text_height(gui_font))/2;
+ ty = d->y + (d->h - text_height(font))/2;
text = (char *)malloc(strlen((char *)d->dp)+1);
@@ -848,7 +842,7 @@ int tmw_password_proc(int msg, DIALOG *d, int c) {
text[i] = '\0';
start = text;
- rtm = alfont_text_mode(-1);
+ rtm = text_mode(-1);
if (gui_bitmap->clip) {
cl = gui_bitmap->cl;
@@ -860,11 +854,11 @@ int tmw_password_proc(int msg, DIALOG *d, int c) {
cr=gui_bitmap->w;
cb=gui_bitmap->h;
}
- set_clip_rect(gui_bitmap, tx, ty, d->x+d->w-rb, ty + alfont_text_height(gui_font));
+ set_clip_rect(gui_bitmap, tx, ty, d->x+d->w-rb, ty + text_height(font));
hack = text[d->d2];
text[d->d2] = '\0';
- l = alfont_text_length(gui_font, text);
+ l = text_length(font, text);
text[d->d2] = hack;
if (l > d->w-lb-rb) {
@@ -876,11 +870,11 @@ int tmw_password_proc(int msg, DIALOG *d, int c) {
if (d->flags & D_GOTFOCUS) {
hack = text[d->d2];
text[d->d2] = '\0';
- x = tx + alfont_text_length(gui_font, text);
- vline(gui_bitmap, x, ty, ty + alfont_text_height(gui_font), col);
+ x = tx + text_length(font, text);
+ vline(gui_bitmap, x, ty, ty + text_height(font), col);
text[d->d2] = hack;
}
- alfont_text_mode(rtm);
+ text_mode(rtm);
set_clip_rect(gui_bitmap, cl, ct, cr, cb);
} else {
return d_edit_proc(msg, d, c);
@@ -899,7 +893,7 @@ int tmw_list_proc(int msg, DIALOG *d, int c) {
int w, h = 0;
int rtm = 0;
int cl, cr, cb, ct;
- int th = alfont_text_height(gui_font);
+ int th = text_height(font);
int vscroll = 0;
int sliderh = 10;
@@ -908,8 +902,8 @@ int tmw_list_proc(int msg, DIALOG *d, int c) {
(*(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));
-
+ lastItem = MIN(itemCount-1, firstItem + h / text_height(font));
+
if (msg == MSG_DRAW) {
if (ignoreRedraw) {
return D_O_K;
@@ -927,7 +921,7 @@ int tmw_list_proc(int msg, DIALOG *d, int c) {
draw_skinned_rect(gui_bitmap, &gui_skin.listbox.vscroll, d->x+d->w-13, slidery, 11, sliderh);
}
- rtm = alfont_text_mode(-1);
+ rtm = text_mode(-1);
if (gui_bitmap->clip) {
cl = gui_bitmap->cl;
ct = gui_bitmap->ct;
@@ -944,22 +938,22 @@ int tmw_list_proc(int msg, DIALOG *d, int c) {
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);
+ textout(gui_bitmap, font, (*(getfuncptr)d->dp)(a, 0), x, y, col);
+ y += text_height(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]);
+ rectfill(gui_bitmap, x, y, x+w, y+text_height(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);
+ textout(gui_bitmap, font, (*(getfuncptr)d->dp)(a, 0), x, y, col);
+ y += text_height(font);
}
}
- alfont_text_mode(rtm);
+ 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;
@@ -1008,7 +1002,7 @@ int tmw_list_proc(int msg, DIALOG *d, int c) {
}
} 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);
+ a = firstItem + (mouse_y-y) / text_height(font);
if (a <= lastItem && a != selectedItem) {
d->d1 = selectedItem = a;
scare_mouse();
@@ -1060,7 +1054,7 @@ if(mouse_b & 1)
}
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;
}
@@ -1072,7 +1066,7 @@ 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);
@@ -1125,11 +1119,11 @@ int tmw_dialog_proc(int msg, DIALOG *d, int c) {
d->d2 = -1;
}
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,
+ rtm = text_mode(-1);
+ textprintf_centre(gui_bitmap, 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);
+ d->y + (gui_skin.dialog.bg.grid[1]->h - text_height(font))/2, d->fg, "%s", d->dp);
+ text_mode(rtm);
break;
}
return D_O_K;
@@ -1176,9 +1170,9 @@ int tmw_ldialog_proc(int msg, DIALOG *d, int c) {
d->d2 = -1;
}
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);
+ rtm = text_mode(-1);
+ textprintf(gui_bitmap, font, d->x + 4, d->y + (gui_skin.dialog.bg.grid[1]->h - text_height(font))/2, d->fg, "%s", d->dp);
+ text_mode(rtm);
}
return D_O_K;
}
@@ -1252,7 +1246,7 @@ void _gui_draw_textbox(char *thetext, int *listsize, int draw, int offset,
if (disabled)
fg = disable;
- rtm = alfont_text_mode(-1);
+ rtm = text_mode(-1);
/* loop over the entire string */
while (1) {
@@ -1270,11 +1264,11 @@ void _gui_draw_textbox(char *thetext, int *listsize, int draw, int offset,
/* the next character length */
usetc(s+usetc(s, ugetc(scanned)), 0);
- len = alfont_text_length(gui_font, s);
+ len = text_length(font, s);
/* modify length if its a tab */
if (ugetc(s) == '\t')
- len = tabsize * alfont_text_length(gui_font, space);
+ len = tabsize * text_length(font, space);
/* check for the end of a line by excess width of next char */
if (width+len >= ww) {
@@ -1348,8 +1342,8 @@ void _gui_draw_textbox(char *thetext, int *listsize, int draw, int offset,
case '\t':
for (i=0; i<tabsize; i++) {
usetc(s+usetc(s, ' '), 0);
- alfont_textout_aa(gui_bitmap, gui_font, s, x1, y1, fg);
- x1 += alfont_text_length(gui_font, s);
+ textout(gui_bitmap, font, s, x1, y1, fg);
+ x1 += text_length(font, s);
}
break;
@@ -1357,8 +1351,8 @@ void _gui_draw_textbox(char *thetext, int *listsize, int draw, int offset,
default:
if (printed != ignore) {
usetc(s+usetc(s, ugetc(printed)), 0);
- alfont_textout_aa(gui_bitmap, gui_font, s, x1, y1, fg);
- x1 += alfont_text_length(gui_font, s);
+ textout(gui_bitmap, font, s, x1, y1, fg);
+ x1 += text_length(font, s);
}
}
@@ -1367,10 +1361,10 @@ void _gui_draw_textbox(char *thetext, int *listsize, int draw, int offset,
}
/* the last blank bit */
/*if (x1 <= x+w-3)
- rectfill(gui_bitmap, x1, y1, x+w-3, y1+alfont_text_height(gui_font)-1, deselect);*/
+ rectfill(gui_bitmap, x1, y1, x+w-3, y1+alfont_text_height(font)-1, deselect);*/
/* print the line end */
- y1 += alfont_text_height(gui_font);
+ y1 += text_height(font);
}
printed = scanned;
@@ -1385,12 +1379,12 @@ void _gui_draw_textbox(char *thetext, int *listsize, int draw, int offset,
/* tell how many lines we found */
*listsize = line;
- alfont_text_mode(rtm);
+ text_mode(rtm);
return;
}
}
- alfont_text_mode(rtm);
+ text_mode(rtm);
}
int tmw_textbox_proc(int msg, DIALOG *d, int c) {
@@ -1400,7 +1394,7 @@ int tmw_textbox_proc(int msg, DIALOG *d, int c) {
int fg_color = (d->flags & D_DISABLED) ? gui_mg_color : d->fg;
/* calculate the actual height */
- height = (d->h-8) / alfont_text_height(gui_font);
+ height = (d->h-8) / text_height(font);
switch (msg) {
@@ -1447,7 +1441,7 @@ 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 */
+ 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);
@@ -1463,7 +1457,7 @@ int tmw_textbox_proc(int msg, DIALOG *d, int c) {
else
top = 0;
- l = (d->h-8)/alfont_text_height(gui_font);
+ l = (d->h-8)/text_height(font);
bottom = d->d2 + l - 1;
if (bottom >= d->d1-1)
@@ -1503,7 +1497,7 @@ int tmw_textbox_proc(int msg, DIALOG *d, int c) {
break;
case MSG_WHEEL:
- l = (d->h-8)/alfont_text_height(gui_font);
+ l = (d->h-8)/text_height(font);
delta = (l > 3) ? 3 : 1;
/* scroll, making sure that the list stays in bounds */
@@ -1550,10 +1544,10 @@ DIALOG alert_dialog[] = {
BITMAP *temp = gui_bitmap;
gui_bitmap = screen;
show_mouse(screen);
- alert_dialog[0].w = alfont_text_length(gui_font, message)+4;
- alert_dialog[1].w = alfont_text_length(gui_font, message);
- alert_dialog[1].h = alfont_text_height(gui_font);
- alert_dialog[2].x = alfont_text_length(gui_font, message)/2-22;
+ alert_dialog[0].w = text_length(font, message)+4;
+ alert_dialog[1].w = text_length(font, message);
+ alert_dialog[1].h = text_height(font);
+ alert_dialog[2].x = text_length(font, message)/2-22;
position_dialog(alert_dialog, 400-alert_dialog[0].w/2, 270);
do_dialog(alert_dialog, 2);
show_mouse(NULL);
@@ -1573,11 +1567,11 @@ unsigned int yes_no(const char *title, const char *message) {
BITMAP *temp = gui_bitmap;
gui_bitmap = screen;
show_mouse(screen);
- int width = alfont_text_length(gui_font, message)+4;
+ int width = text_length(font, message)+4;
if(width<100)width=100;
alert_dialog[0].w = width;
- alert_dialog[1].w = alfont_text_length(gui_font, message);
- alert_dialog[1].h = alfont_text_height(gui_font);
+ alert_dialog[1].w = text_length(font, message);
+ alert_dialog[1].h = text_height(font);
alert_dialog[2].x = width/2-46;
alert_dialog[2].x = width/2+2;
position_dialog(alert_dialog, 400-width/2, 270);
diff --git a/src/gui/gui.h b/src/gui/gui.h
index 0028cb77..bf411f77 100644
--- a/src/gui/gui.h
+++ b/src/gui/gui.h
@@ -105,7 +105,6 @@ typedef struct {
extern LexSkin gui_skin;
extern BITMAP *gui_bitmap;
-extern ALFONT_FONT *gui_font;
extern gcn::Container* guiTop; // The top container
extern gcn::AllegroGraphics* guiGraphics; // Graphics driver
diff --git a/src/gui/inventory.cpp b/src/gui/inventory.cpp
index 857ab896..d82db607 100644
--- a/src/gui/inventory.cpp
+++ b/src/gui/inventory.cpp
@@ -34,12 +34,12 @@ DIALOG_PLAYER *inventory_player;
/** Initialize inventory */
void TmwInventory::create(int tempxpos, int tempypos) {
itemset = load_datafile("./data/graphic/items.dat");
-
+
for(int i=0;i<INVENTORY_SIZE;i++) {
items[i].id = -1; // if id is negative there's no item
items[i].quantity = 0;
}
-
+
inventory_player = init_dialog(inventory_dialog, -1);
position_dialog(inventory_dialog, x, y);
@@ -57,7 +57,7 @@ void TmwInventory::draw(BITMAP * buffer) {
masked_blit((BITMAP *)itemset[items[i].id-500].dat, gui_bitmap, 0, 0, inventory_dialog[0].x+24*i, inventory_dialog[0].y+26, 22, 22);
else
masked_blit((BITMAP *)itemset[0].dat, gui_bitmap, 0, 0, inventory_dialog[0].x+24*i, inventory_dialog[0].y+26, 22, 22);
- alfont_textprintf_aa(gui_bitmap, gui_font, inventory_dialog[0].x+24*i, inventory_dialog[0].y+44, makecol(0,0,0), "%i", items[i].quantity);
+ textprintf(gui_bitmap, font, inventory_dialog[0].x+24*i, inventory_dialog[0].y+44, makecol(0,0,0), "%i", items[i].quantity);
}
}
}
@@ -72,11 +72,11 @@ void TmwInventory::draw(BITMAP * buffer) {
itemMeny_i = i;
}
}
-
-
+
+
}
-
-
+
+
if(itemMeny){
if(inventory_dialog[0].y+itemMeny_y < mouse_y && inventory_dialog[0].y+itemMeny_y+10 > mouse_y) {
if(mouse_b&1)
@@ -84,9 +84,9 @@ void TmwInventory::draw(BITMAP * buffer) {
use_item(itemMeny_i,items[itemMeny_i].id);
itemMeny = 0;
}
- alfont_textprintf_aa(buffer, gui_font, inventory_dialog[0].x+itemMeny_x, inventory_dialog[0].y+itemMeny_y, makecol(255,237,33), "Use item");
+ textprintf(buffer, font, inventory_dialog[0].x+itemMeny_x, inventory_dialog[0].y+itemMeny_y, makecol(255,237,33), "Use item");
} else {
- alfont_textprintf_aa(buffer, gui_font, inventory_dialog[0].x+itemMeny_x, inventory_dialog[0].y+itemMeny_y, MAKECOL_BLACK, "Use item");
+ textprintf(buffer, font, inventory_dialog[0].x+itemMeny_x, inventory_dialog[0].y+itemMeny_y, MAKECOL_BLACK, "Use item");
}
if(inventory_dialog[0].y+itemMeny_y+10 < mouse_y && inventory_dialog[0].y+itemMeny_y+20 > mouse_y) {
if(mouse_b&1)
@@ -94,9 +94,9 @@ void TmwInventory::draw(BITMAP * buffer) {
drop_item(itemMeny_i,1);
itemMeny = 0;
}
- alfont_textprintf_aa(buffer, gui_font, inventory_dialog[0].x+itemMeny_x, inventory_dialog[0].y+itemMeny_y+10, makecol(255,237,33), "Del item");
+ textprintf(buffer, font, inventory_dialog[0].x+itemMeny_x, inventory_dialog[0].y+itemMeny_y+10, makecol(255,237,33), "Del item");
} else {
- alfont_textprintf_aa(buffer, gui_font, inventory_dialog[0].x+itemMeny_x, inventory_dialog[0].y+itemMeny_y+10, MAKECOL_BLACK, "Del item");
+ textprintf(buffer, font, inventory_dialog[0].x+itemMeny_x, inventory_dialog[0].y+itemMeny_y+10, MAKECOL_BLACK, "Del item");
}
}
@@ -121,7 +121,7 @@ int TmwInventory::remove_item(int id) {
if(items[i].id==id) {
items[i].id = -1;
items[i].quantity = 0;
- }
+ }
return 0;
}
diff --git a/src/main.cpp b/src/main.cpp
index 67a307a3..a15615f6 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -238,8 +238,6 @@ void init_engine() {
error("Unable to install timer");
if(install_mouse()==-1)
error("Unable to install mouse");
- if(alfont_init()!=ALFONT_OK)
- error("Unable to install AllegroFont");
buffer = create_bitmap(800, 600);
if(!buffer)
@@ -263,7 +261,6 @@ void init_engine() {
/** Clear the engine */
void exit_engine() {
gui_exit();
- //alfont_exit();
destroy_bitmap(buffer);
allegro_exit();
}