Root/alex4/patches/020-gfx-mode.patch

1Index: alex4src/src/main.c
2===================================================================
3--- alex4src.orig/src/main.c 2011-06-07 11:43:11.000000000 +0200
4+++ alex4src/src/main.c 2011-06-07 11:59:26.000000000 +0200
5@@ -62,6 +62,7 @@
6 DATAFILE *maps = NULL;
7 DATAFILE *sfx_data = NULL;
8 BITMAP *swap_screen;
9+BITMAP *colorconv_screen = 0;
10 PALETTE org_pal;
11 Tscroller hscroll;
12 Thisc *hisc_table;
13@@ -484,9 +485,20 @@
14 
15 // blits anything to screen
16 void blit_to_screen(BITMAP *bmp) {
17+ if (!colorconv_screen ||
18+ colorconv_screen->w != bmp->w || colorconv_screen->h != bmp->h)
19+ {
20+ if (colorconv_screen)
21+ destroy_bitmap(colorconv_screen);
22+
23+ colorconv_screen = create_bitmap_ex(bitmap_color_depth(screen),
24+ bmp->w, bmp->h);
25+ }
26+ blit (bmp, colorconv_screen, 0, 0, 0, 0, bmp->w, bmp->h);
27+
28     acquire_screen();
29     if (options.use_vsync) vsync();
30- stretch_blit(bmp, screen, 0, 0, bmp->w, bmp->h, 0, 0, SCREEN_W, SCREEN_H);
31+ stretch_blit(colorconv_screen, screen, 0, 0, bmp->w, bmp->h, 0, 0, SCREEN_W, SCREEN_H);
32     release_screen();
33 }
34 
35@@ -674,6 +686,7 @@
36 
37     log2file(" entering gfx mode set in alex4.ini (%dx%d %s)", w, h, (get_config_int("graphics", "fullscreen", 0) ? "full" : "win"));
38 
39+ set_color_depth(32);
40     if (set_gfx_mode(
41         (get_config_int("graphics", "fullscreen", 0) ? GFX_AUTODETECT_FULLSCREEN : GFX_AUTODETECT_WINDOWED),
42         w, h, 0, 0)) {
43@@ -689,6 +702,7 @@
44             }
45         }
46     }
47+ set_color_depth(8);
48 
49     // show initial loading screen
50     clear(swap_screen);
51

Archive Download this file



interactive