02-06-2005, 01:45 AM
Code:
SUB ChangePalette (PaletteArray&())
DIM RGBval(0 TO 255, 0 TO 2)
FOR n = 0 TO 255
c& = PaletteArray&(n)
B = c& \ 65536: c& = c& - B * 65536
G = c& \ 256: c& = c& - G * 256
r = c&
RGBval(n, 0) = r
RGBval(n, 1) = G
RGBval(n, 2) = B
NEXT n
'Write colours directly to the video card.
'unsure of the need for the WAIT statement.
'WAIT &H3DA, &H8, &H8: WAIT &H3DA, &H8
FOR n = 0 TO 255
OUT &H3C8, n 'Select attribute.
OUT &H3C9, RGBval(n, 0) 'Write red.
OUT &H3C9, RGBval(n, 1) 'Write green.
OUT &H3C9, RGBval(n, 2) 'Write blue.
NEXT n
END SUB
'-------------------------------------------------------------------------------
SUB Init.PaletteData (Filename$, PaletteArray&())
REDIM PaletteArray&(0 TO 255)
IF Filename$ <> "" THEN
FileNo = FREEFILE
OPEN Filename$ FOR BINARY AS #FileNo
FOR n = 0 TO 255
GET #FileNo, , colour&
PaletteArray&(n) = colour&
NEXT n
CLOSE #FileNo
END IF
END SUB
something about the latest (.11b) version of FBC has caused my 256 color palette to load oddly. instead of loading the colors in the right order, it seams to load them in a different way. at a glance, it looks like all the colors are there, but not in the gradient rows i put them in; they are all scattered and mixed. is it the OUT statement?
mrToad | dannywilfong.com | Alvarian Tales