Difference between revisions of "Talk:PALETTES.DAT"

From UFOpaedia
Jump to navigation Jump to search
(cool)
Line 28: Line 28:
  
 
- [[User:Bomb Bloke|Bomb Bloke]] 17:53, 12 June 2007 (PDT)
 
- [[User:Bomb Bloke|Bomb Bloke]] 17:53, 12 June 2007 (PDT)
 +
: Good work! Very cool.
 +
: This may be boring but I will explain what I meant by palette faking. Its interesting but not terribly useful unless you wanna mod the exe.
 +
: Palette Faking: The CE version of UFO is actually rendered in 32bit color at 640x400. You can take a screenshot of this version using the PrnScn key on your keyboard. The image you get when you press F12 is from UFO's fake internal MCGA buffer.
 +
: When UFO was converted to a windows application the developers cheated, they made a copy of the mode13h memory in the executable, which they use as if it was the actual screen. They also make a fake copy of the palette. Then after each frame is drawn they copy this into the 32bit DirectDraw surface. They convert from the MCGA format into 32bit and run an upsampling filter (2x to 640x400). This is why the edges of letters look smoother in-game then in screenshots.
 +
: The upshot is that the CE game is the exact same game code, only wrapped with a mode13 emulator. Cool huh. This is what allows the Exe Splitter and filter changing mods to work, 90% of the work is already done. --[[User:Darkfred|Darkfred]] 22:03, 12 June 2007 (PDT)

Revision as of 05:03, 13 June 2007

Just for a bit of general information, it might be worth mentioning that some of the palette entries are used for colour cycling. For example the radar pings on the intercept console. That's achieved by shifting a whole block of palette entries to give the effect of movement. (Think KITT's chasing lights) The image doesn't change, but the colour that you see does. It results in a wave movement. If anyone remembers the shifting colours on ye olde Windows startup screens, this was achieved in the same way.

Other palette swaps include the greyscale background bitmaps that are used in the Geoscape screens. They keep the same palette entry, and the game only needs to shift these entries to different shades to change the shades of the backgrounds.

Come to think of it, anyone know what conditions change the normal backgrounds from red to purple? It seems to vary.

Also another random technical tidbit, the game uses mode 13h for its display. In other words 320x200x256clr VGA mode. It used to come standard on all SVGA cards as a safe mode to revert to. The first fifteen colours after the transparency were probably left behind for use by the console. They appear to match the old text mode 16 colour palette.

- NKF


In the case of the background images, the palette swaps are pulled from BACKPALS.DAT, but I never realised the intercept radar was a palette cycle, though it does make sense - I assume that's handled entirely by the executable.

Oooh, I didn't know mode 13 was a *real* display mode! I thought it was just a "prebuilt" mode that QBasic provided to "script kiddies". XD

Not sure what you mean about those fifteen colors and how "They appear to match the old text mode 16 colour palette". I checked QBasic's idea of what the default mode 7 palette should look like (mode 7 being a sixteen color only version of mode 13, but with multiple "screens" you could flip in and out of the display buffer - guess you could call it EGA?) and it doesn't match the colors in any of UFO's palettes. But, I dunno if the palettes QBasic used followed any real standard, or if I even know what I'm talking about. :)

- Bomb Bloke 04:56, 12 June 2007 (PDT)

Xcom was built for mode 13h with a 6 bit ramdac, (hence the 0-64 color values). This was one of the few modes which was widely available and worked the same on all early pc's. It was started via interrupt 13h also called MCGA and the bios did all the setup work. I don't think there was a default mcga palette, but it could be the default EGA palette.
The palette animation could be done either way, I will check on this, but it might just be easier to switch the pal to grayscale, and take a screenshot during the animation. Then look at the color values. In the windows version the palettes are entirely faked anyway so doing it via code wouldn't be any slower.--Darkfred 07:58, 12 June 2007 (PDT)

Not sure what you mean by "palette faking"... I know that if you take a screenshot in the CE version of the game (F12), the resulting image will be a 256 color job using whatever palette the game was supposed to be using at the time.

Hence my thought was to just take multiple screenshots of the animation, and check to see what the palette looked like. Sure enough, colors 112 through to 127 (16 in all) cycle through shades of green, whereas the image itself doesn't actually change.

- Bomb Bloke 17:53, 12 June 2007 (PDT)

Good work! Very cool.
This may be boring but I will explain what I meant by palette faking. Its interesting but not terribly useful unless you wanna mod the exe.
Palette Faking: The CE version of UFO is actually rendered in 32bit color at 640x400. You can take a screenshot of this version using the PrnScn key on your keyboard. The image you get when you press F12 is from UFO's fake internal MCGA buffer.
When UFO was converted to a windows application the developers cheated, they made a copy of the mode13h memory in the executable, which they use as if it was the actual screen. They also make a fake copy of the palette. Then after each frame is drawn they copy this into the 32bit DirectDraw surface. They convert from the MCGA format into 32bit and run an upsampling filter (2x to 640x400). This is why the edges of letters look smoother in-game then in screenshots.
The upshot is that the CE game is the exact same game code, only wrapped with a mode13 emulator. Cool huh. This is what allows the Exe Splitter and filter changing mods to work, 90% of the work is already done. --Darkfred 22:03, 12 June 2007 (PDT)