www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/03/03/10:21:07

From: Matteo Sasso <icemaze AT tin DOT it>
Newsgroups: comp.os.msdos.djgpp
Subject: select_palette: why it doesn't work?
Date: Wed, 03 Mar 1999 15:32:42 +0100
Organization: TIN
Lines: 52
Message-ID: <36DD480A.381FCA8E@tin.it>
NNTP-Posting-Host: a-mi36-2.tin.it
Mime-Version: 1.0
X-Mailer: Mozilla 4.5 [en] (Win98; I)
X-Accept-Language: en
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I'm writing a map editor which loads 8 bits bitmaps and displays them in
32 bit mode.
The problem is that even if I loaded the palette from a datafile and
selected it using the select_palette functions, bitmaps' colours aren't
right!
I used
  select_palette(*(PALETTE *)tilefile[bks].dat);
  select_palette((RGB *)tilefile[bks].dat);
  select_palette(tilefile[bks].dat);
but NONE of these worked! (is any of them correct? which is the most
"fair"?)
(tilefile is a datafile and bks is the position of the palette,
obviously!)
Here are some pieces of source (I omitted some working parts using
"[...]"):

--- SOURCE ---

[...] (definitions and procedures that WORK)

void main()
{
  allegro_init();
  set_color_depth(32);
  set_gfx_mode(GFX_AUTODETECT,800,600,0,0);
[...]
  tilefile = load_datafile("BKG.DAT");
  if (tilefile == NULL)
  {
[...]
  }

[...]

  select_palette(*(PALETTE *)tilefile[bks].dat); // Selects the palette
  // I'm sure that bks is set correctly!
[...]
  for (i = 0; i < bks; i++)
    blit(tilefile[i].dat,screen,0,0,100 + (i * 40),100,32,32); //
Displays the bitmaps
  getch();
[...]
  set_gfx_mode(GFX_TEXT,80,25,0,0);
}

--- END OF SOURCE ---

Thanks a lot to whoever will help me!!

+ I C E M A Z E +
icemaze AT tin DOT it

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019