updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / alex4 / allegro-4.2.patch
bloba5f869091ac1cc1b165709fef8fdeeb803c9f877
1 Description: Get rid of deprecated Allegro functions.
2 Forwarded: yes
3 Author: Peter De Wachter <pdewacht@gmail.com>
4 Last-Update: 2009-05-07
6 --- a/src/edit.c
7 +++ b/src/edit.c
8 @@ -69,8 +69,8 @@
11 // show stuff
12 - textprintf(bmp, data[THE_FONT].dat, 1, 1, 0, "TILE: %d,%d", tx, ty);
13 - textprintf(bmp, data[THE_FONT].dat, 1, 11, 0, "SIZE: %d,%d", map->width, map->height);
14 + textprintf_ex(bmp, data[THE_FONT].dat, 1, 1, 0, -1, "TILE: %d,%d", tx, ty);
15 + textprintf_ex(bmp, data[THE_FONT].dat, 1, 11, 0, -1, "SIZE: %d,%d", map->width, map->height);
17 // show start pos
18 x = (ABS(map->start_x) << 4) - map->offset_x;
19 @@ -80,7 +80,7 @@
21 // draw status bar
22 rectfill(bmp, 0, 110, 159, 119, 1);
23 - textprintf(bmp, data[THE_FONT].dat, 1, 111, 4, "EDITING: %s", get_filename(edit_path_and_file));
24 + textprintf_ex(bmp, data[THE_FONT].dat, 1, 111, 4, -1, "EDITING: %s", get_filename(edit_path_and_file));
26 else if (edit_mode == EDIT_MODE_SELECT) { // draw tile palette
27 // calculate offset depending on mouse pointer
28 @@ -104,16 +104,16 @@
29 else if (edit_mode == EDIT_MODE_STATS) { // draw map properties
30 int ty = 16;
31 clear_to_color(bmp, 3);
32 - textprintf(bmp, data[THE_FONT].dat, 1, 1, 1, "%s (props)", get_filename(edit_path_and_file));
33 + textprintf_ex(bmp, data[THE_FONT].dat, 1, 1, 1, -1, "%s (props)", get_filename(edit_path_and_file));
34 line(bmp, 0, 10, 159, 10, 1);
35 - textprintf(bmp, data[THE_FONT].dat, 1, ty+=10, 1, "Win by:");
36 - textprintf(bmp, data[THE_FONT].dat, 1, ty+=10, 1, " 1) reach exit (%s)", (map->win_conditions & MAP_WIN_EXIT ? "X" : " "));
37 - textprintf(bmp, data[THE_FONT].dat, 1, ty+=10, 1, " 2) kill boss (%s)", (map->win_conditions & MAP_WIN_KILL_GUARDIAN ? "X" : " "));
38 - textprintf(bmp, data[THE_FONT].dat, 1, ty+=10, 1, " 3) kill all (%s)", (map->win_conditions & MAP_WIN_KILL_ALL ? "X" : " "));
39 - textprintf(bmp, data[THE_FONT].dat, 1, ty+=10, 1, "4) Boss level: (%s)", (map->boss_level ? "X" : " "));
40 - textprintf(bmp, data[THE_FONT].dat, 1, ty+=10, 1, "5) Name: %s", map->name);
41 + textprintf_ex(bmp, data[THE_FONT].dat, 1, ty+=10, 1, -1, "Win by:");
42 + textprintf_ex(bmp, data[THE_FONT].dat, 1, ty+=10, 1, -1, " 1) reach exit (%s)", (map->win_conditions & MAP_WIN_EXIT ? "X" : " "));
43 + textprintf_ex(bmp, data[THE_FONT].dat, 1, ty+=10, 1, -1, " 2) kill boss (%s)", (map->win_conditions & MAP_WIN_KILL_GUARDIAN ? "X" : " "));
44 + textprintf_ex(bmp, data[THE_FONT].dat, 1, ty+=10, 1, -1, " 3) kill all (%s)", (map->win_conditions & MAP_WIN_KILL_ALL ? "X" : " "));
45 + textprintf_ex(bmp, data[THE_FONT].dat, 1, ty+=10, 1, -1, "4) Boss level: (%s)", (map->boss_level ? "X" : " "));
46 + textprintf_ex(bmp, data[THE_FONT].dat, 1, ty+=10, 1, -1, "5) Name: %s", map->name);
48 - textprintf(bmp, data[THE_FONT].dat, 1, 110, 1, "F1: back to editor");
49 + textprintf_ex(bmp, data[THE_FONT].dat, 1, 110, 1, -1, "F1: back to editor");
52 if (edit_mode != EDIT_MODE_STATS) {
53 --- a/src/hisc.c
54 +++ b/src/hisc.c
55 @@ -153,9 +153,9 @@
57 // draws a single hisc post
58 void draw_hisc_post(Thisc *table, BITMAP *bmp, FONT *fnt, int x, int y, int color, int show_level) {
59 - textprintf(bmp, fnt, x, y, color, "%s", table->name);
60 - if (show_level) textprintf_right(bmp, fnt, x+80, y, color, "%2d", table->level);
61 - textprintf_right(bmp, fnt, x+140, y, color, "%d", table->score);
62 + textprintf_ex(bmp, fnt, x, y, color, -1, "%s", table->name);
63 + if (show_level) textprintf_right_ex(bmp, fnt, x+80, y, color, -1, "%2d", table->level);
64 + textprintf_right_ex(bmp, fnt, x+140, y, color, -1, "%d", table->score);
67 // draws the entire table
68 --- a/src/main.c
69 +++ b/src/main.c
70 @@ -496,15 +496,15 @@
72 rectfill(bmp, 0, y, 159, y+9, 1);
73 draw_sprite_h_flip(bmp, data[HERO_NORM].dat, 0, y+1);
74 - textprintf(bmp, data[THE_FONT].dat, 9, y+1, 4, " :%d", player.lives);
75 + textprintf_ex(bmp, data[THE_FONT].dat, 9, y+1, 4, -1, " :%d", player.lives);
77 for(i = 0; i < player.health; i ++)
78 draw_sprite(bmp, data[HEART2].dat, 40 + 10 * i, y-3);
80 draw_sprite(bmp, data[EGG].dat, 80, y-5);
81 - textprintf(bmp, data[THE_FONT].dat, 85, y+1, 4, " :%d", player.ammo);
82 + textprintf_ex(bmp, data[THE_FONT].dat, 85, y+1, 4, -1, " :%d", player.ammo);
84 - textprintf_right(bmp, data[THE_FONT].dat, 158, y+1, 4, "%d", player.score);
85 + textprintf_right_ex(bmp, data[THE_FONT].dat, 158, y+1, 4, -1, "%d", player.score);
89 @@ -626,7 +626,6 @@
91 // various allegro things
92 log2file(" initializing allegro");
93 - text_mode(-1);
94 garble_string(init_string, 53);
95 #ifdef __unix__
96 snprintf(filename, sizeof(filename), "%s/.alex4/alex4.ini",
97 @@ -635,7 +634,6 @@
98 #else
99 set_config_file("alex4.ini");
100 #endif
101 - set_window_close_button(FALSE);
103 // install timers
104 log2file(" installing timers");
105 @@ -701,7 +699,7 @@
107 // show initial loading screen
108 clear(swap_screen);
109 - textout_centre(swap_screen, font, "loading...", 320, 200, 1);
110 + textout_centre_ex(swap_screen, font, "loading...", 320, 200, 1, -1);
111 blit_to_screen(swap_screen);
113 #ifndef __unix__
114 @@ -788,8 +786,8 @@
115 clear_to_color(swap_screen, 3);
117 bmp = data[FLD_LOGO].dat;
118 - draw_character(swap_screen, bmp, 80 - bmp->w / 2 + 0, 50 + 1, 1);
119 - draw_character(swap_screen, bmp, 80 - bmp->w / 2, 50, 4);
120 + draw_character_ex(swap_screen, bmp, 80 - bmp->w / 2 + 0, 50 + 1, 1, -1);
121 + draw_character_ex(swap_screen, bmp, 80 - bmp->w / 2, 50, 4, -1);
123 blit_to_screen(swap_screen);
125 @@ -1100,11 +1098,11 @@
127 // draws text with an outline
128 void textout_outline(BITMAP *bmp, const char *txt, int x, int y) {
129 - textout(bmp, data[THE_FONT].dat, txt, x+1, y, 1);
130 - textout(bmp, data[THE_FONT].dat, txt, x-1, y, 1);
131 - textout(bmp, data[THE_FONT].dat, txt, x, y+1, 1);
132 - textout(bmp, data[THE_FONT].dat, txt, x, y-1, 1);
133 - textout(bmp, data[THE_FONT].dat, txt, x, y, 4);
134 + textout_ex(bmp, data[THE_FONT].dat, txt, x+1, y, 1, -1);
135 + textout_ex(bmp, data[THE_FONT].dat, txt, x-1, y, 1, -1);
136 + textout_ex(bmp, data[THE_FONT].dat, txt, x, y+1, 1, -1);
137 + textout_ex(bmp, data[THE_FONT].dat, txt, x, y-1, 1, -1);
138 + textout_ex(bmp, data[THE_FONT].dat, txt, x, y, 4, -1);
142 @@ -1451,12 +1449,12 @@
144 sprintf(buf, "%s %d %s", (level > min ? "<" : " "), level, (level < max ? ">" : " "));
145 clear_bitmap(stuff);
146 - textout_centre(stuff, data[THE_FONT].dat, buf, stuff->w/2 + 1, 1, 2);
147 - textout_centre(stuff, data[THE_FONT].dat, buf, stuff->w/2, 0, 1);
148 + textout_centre_ex(stuff, data[THE_FONT].dat, buf, stuff->w/2 + 1, 1, 2, -1);
149 + textout_centre_ex(stuff, data[THE_FONT].dat, buf, stuff->w/2, 0, 1, -1);
150 stretch_sprite(bmp, stuff, 80 - 4*stuff->w/2, 30, 4*stuff->w, 4*stuff->h);
152 - textout_centre(bmp, data[THE_FONT].dat, "SELECT START LEVEL", 80, 90, 1);
153 - textout_centre(bmp, data[THE_FONT].dat, "SELECT START LEVEL", 79, 89, 4);
154 + textout_centre_ex(bmp, data[THE_FONT].dat, "SELECT START LEVEL", 80, 90, 1, -1);
155 + textout_centre_ex(bmp, data[THE_FONT].dat, "SELECT START LEVEL", 79, 89, 4, -1);
157 if (options.one_hundred) {
158 if (game_count & 32 || game_count & 16) draw_sprite(bmp, data[SHIP100].dat, xpos, 2);
159 @@ -2532,20 +2530,20 @@
161 y = 60;
162 x = 50;
163 - textout(bmp, data[THE_FONT].dat, start_string, x+1, y+1, 1);
164 - textout(bmp, data[THE_FONT].dat, start_string, x, y, 4);
165 + textout_ex(bmp, data[THE_FONT].dat, start_string, x+1, y+1, 1, -1);
166 + textout_ex(bmp, data[THE_FONT].dat, start_string, x, y, 4, -1);
168 y += step;
169 - textout(bmp, data[THE_FONT].dat, "HIGH SCORES", x+1, y+1, 1);
170 - textout(bmp, data[THE_FONT].dat, "HIGH SCORES", x, y, 4);
171 + textout_ex(bmp, data[THE_FONT].dat, "HIGH SCORES", x+1, y+1, 1, -1);
172 + textout_ex(bmp, data[THE_FONT].dat, "HIGH SCORES", x, y, 4, -1);
174 y += step;
175 - textout(bmp, data[THE_FONT].dat, "EDITOR", x+1, y+1, 1);
176 - textout(bmp, data[THE_FONT].dat, "EDITOR", x, y, 4);
177 + textout_ex(bmp, data[THE_FONT].dat, "EDITOR", x+1, y+1, 1, -1);
178 + textout_ex(bmp, data[THE_FONT].dat, "EDITOR", x, y, 4, -1);
180 y += step;
181 - textout(bmp, data[THE_FONT].dat, "QUIT", x+1, y+1, 1);
182 - textout(bmp, data[THE_FONT].dat, "QUIT", x, y, 4);
183 + textout_ex(bmp, data[THE_FONT].dat, "QUIT", x+1, y+1, 1, -1);
184 + textout_ex(bmp, data[THE_FONT].dat, "QUIT", x, y, 4, -1);
186 draw_sprite(bmp, data[POINTER].dat, x - 25 + fixtoi(3 * fcos(itofix(tick << 2))), 44 + menu_choice * step);
188 @@ -2597,7 +2595,7 @@
189 string[i] = letters[current_letter];
190 string[i + 1] = '\0';
191 blit(block, bmp, 0, 0, pos_x - 1, pos_y - 1, block->w, block->h);
192 - textout(bmp, f, string, pos_x, pos_y, colour);
193 + textout_ex(bmp, f, string, pos_x, pos_y, colour, -1);
194 blit_to_screen(bmp);
196 if (pad != NULL) {
197 --- a/src/map.c
198 +++ b/src/map.c
199 @@ -280,7 +280,7 @@
201 if (sm == NULL) return;
203 - set_clip(bmp, dx, dy, dx+w-1, dy+h-1);
204 + set_clip_rect(bmp, dx, dy, dx+w-1, dy+h-1);
206 for(y=0;y<7;y++) {
207 for(x=0;x<11;x++) {
208 @@ -330,13 +330,13 @@
210 if (edit) {
211 if (sm->dat[pos].type == MAP_DEAD) {
212 - textout(bmp, font, "D", dx + x*16 + ax, dy + y*16 + ay, 0);
213 + textout_ex(bmp, font, "D", dx + x*16 + ax, dy + y*16 + ay, 0, -1);
215 if (sm->dat[pos].type == MAP_EXIT) {
216 - textout(bmp, font, "XT", dx + x*16 + ax, dy + y*16 + ay, 255);
217 + textout_ex(bmp, font, "XT", dx + x*16 + ax, dy + y*16 + ay, 255, -1);
219 if (sm->dat[pos].type == MAP_BRK) {
220 - textout(bmp, font, "GL", dx + x*16 + ax, dy + y*16 + ay, 255);
221 + textout_ex(bmp, font, "GL", dx + x*16 + ax, dy + y*16 + ay, 255, -1);
223 if (sm->dat[pos].type == MAP_ENEMY1) {
224 draw_sprite(bmp, sm->data[ENEMY1_01 + ((ABS(game_count) >> 3) % 4)].dat, dx + x*16 + ax, dy + y*16 + ay);
225 @@ -367,7 +367,7 @@
229 - set_clip(bmp, 0, 0, SCREEN_W - 1, SCREEN_H - 1);
230 + set_clip_rect(bmp, 0, 0, SCREEN_W - 1, SCREEN_H - 1);
234 --- a/src/script.c
235 +++ b/src/script.c
236 @@ -89,7 +89,7 @@
238 // draw text
239 for(i = 0; i < lines; i ++) {
240 - textout(bmp, d[THE_FONT].dat, rows[i], x1 + 4, y1 + 5 + i * 9, 1);
241 + textout_ex(bmp, d[THE_FONT].dat, rows[i], x1 + 4, y1 + 5 + i * 9, 1, -1);
245 --- a/src/scroller.c
246 +++ b/src/scroller.c
247 @@ -65,22 +65,22 @@
248 if (sc->horizontal) {
249 if (sc->offset < -sc->length) return;
250 if (sc->offset > sc->width) return;
251 - set_clip(bmp, x, y, x + sc->width, y + sc->height);
252 - textout(bmp, sc->fnt, sc->text, x + sc->offset + 1, y + 1, 1);
253 - textout(bmp, sc->fnt, sc->text, x + sc->offset, y, 3);
254 - set_clip(bmp, 0, 0, bmp->w-1, bmp->h-1);
255 + set_clip_rect(bmp, x, y, x + sc->width, y + sc->height);
256 + textout_ex(bmp, sc->fnt, sc->text, x + sc->offset + 1, y + 1, 1, -1);
257 + textout_ex(bmp, sc->fnt, sc->text, x + sc->offset, y, 3, -1);
258 + set_clip_rect(bmp, 0, 0, bmp->w-1, bmp->h-1);
260 else {
261 int i;
262 if (sc->offset < -sc->rows * sc->font_height) return;
263 if (sc->offset > sc->height) return;
264 - set_clip(bmp, x, y, x + sc->width, y + sc->height);
265 + set_clip_rect(bmp, x, y, x + sc->width, y + sc->height);
266 for(i=0;i<sc->rows;i++) {
267 if (i * sc->font_height + sc->offset <= sc->height)
268 if ((i+1) * sc->font_height + sc->offset >= 0)
269 - textout_centre(bmp, sc->fnt, sc->lines[i], x+(sc->width>>1) , i * sc->font_height + y + sc->offset, -1);
270 + textout_centre_ex(bmp, sc->fnt, sc->lines[i], x+(sc->width>>1) , i * sc->font_height + y + sc->offset, -1, -1);
272 - set_clip(bmp, 0, 0, bmp->w-1, bmp->h-1);
273 + set_clip_rect(bmp, 0, 0, bmp->w-1, bmp->h-1);
277 --- a/src/shooter.c
278 +++ b/src/shooter.c
279 @@ -341,7 +341,7 @@
280 if (!o->hit || o->type == SO_PLAYER_BULLET)
281 draw_sprite(bmp, s_data[o->image].dat, (int)o->x, (int)o->y);
282 else
283 - draw_character(bmp, s_data[o->image].dat, (int)o->x, (int)o->y, 4);
284 + draw_character_ex(bmp, s_data[o->image].dat, (int)o->x, (int)o->y, 4, -1);
286 else {
287 int c = (o->energy + 8) >> 3;
288 @@ -379,8 +379,8 @@
289 padding_str[i] = '0';
290 padding_str[i] = '\0';
291 strcat(padding_str, score_str);
292 - textprintf_right(bmp, s_data[SPACE_FONT].dat, x + 160, y + 2, 3, "%s", padding_str);
293 - if (s_var.score) textprintf_right(bmp, s_data[SPACE_FONT].dat, x + 160, y + 2, 4, "%s", score_str);
294 + textprintf_right_ex(bmp, s_data[SPACE_FONT].dat, x + 160, y + 2, 3, -1, "%s", padding_str);
295 + if (s_var.score) textprintf_right_ex(bmp, s_data[SPACE_FONT].dat, x + 160, y + 2, 4, -1, "%s", score_str);