Re: [AD] Another GFX_SAFE patch, now the demo

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Sun, Dec 17, 2000 at 06:03:11PM +0100, Grzegorz Adam Hankiewicz wrote:
> Here's a patch which makes the Allegro demo game work on any color depth.
> I touched modesel.c a little bit too. BTW, why doesn't gfx_mode_select
> wrap around gfx_mode_select_ex? Wouldn't it be 'natural'?

Don't they show different fields in the dialog box?

> Since this patch shows that it's not so easy to write games supporting
> every color depth, I think I'm going to write some functions which given a
> datafile convert all of it's BMP/RLE sprites to the actual color depth, so
> that you could do something like this in a program:
> 
> 	set_gfx_mode(GFX_SAFE, 0, 0, 0, 0)
> 	data = load_datafile ("data.dat");
> 	convert_datafile_graphics (data, data[GAME_PAL].dat);
> 
> Does that look right? Any visible problems with such code?

You'd have to turn off the automatic colour conversion before
loading the datafile.  It seems a bit like fixup_datafile, but for
loaded datafiles and more powerful.

OTOH, what's wrong with:

    set_gfx_mode (GFX_SAFE, 0, 0, 0, 0);
    datafile_palette = load_datafile_object ("data.dat",
"GAME_PAL");
    select_palette (datafile_palette->dat);
    unload_datafile_object (datafile_palette);
    data = load_datafile ("data.dat");

It reads the palette first, then converts the datafile according
to that.  Maybe there are some other problems which this doesn't
solve though?

One I can think of is that the datafile contains 256 colour
paletted images, but not all using the same palette -- I believe
this is the case in the demo game.  (Your idea couldn't fix this
either.)  The solution to that is really to either use paletted
bitmaps in the datafile (did this get added in the end?) or to
use multiple datafiles, one for each palette, so that all the
images in one datafile use the same palette.  Or to disable
colour conversion altogether, and blit straight from the 256
colour images having set the appropriate palette (which needs
doing anyway, even in 8bpp modes).  I think in the end it all
comes down to splitting up your data, so that some parts are
converted and some are not.  Maybe we could use datafile
properties to disable conversion on selected images, too.

George

-- 
Random project update:
09/05/2000: Libnet 0.10.8 uploaded -- a few bugfixes
        http://www.canvaslink.com/libnet/  (try changes-0.10.8.txt)



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/