This new feature adds a selectable video palette to the options menu. Pressing 2 on the menu cycles through the available color palettes. The player's choice is saved and reloaded between sessions.
Addresses issue #29.
Implementation
Added new struct VideoPalette to hold the name and color values of each palette:
Options now support a new CONF_INT type, of which conf_video_palette is the first.
Three new functions:
Vid_SetVideoPalette() sets the video palette to a specified entry from the list of palettes
Vid_GetVideoPaletteName() returns the name of a given video palette, for use on the options menu
Vid_GetNumVideoPalettes() counts how many video palettes have been defined
When the options menu is active, there are points at which it must know whether it's dealing with a CONF_BOOL, CONF_INT, or CONF_KEY. In the case of CONF_INT, since the video palettes have names, there is a further check based on the name of the current option being considered.
Testing
I focused on making sure that the game defaults to the original video palette, if sopwith.cfg :
Does not contain an entry for conf_video_palette
Has an invalid character or out of range number for conf_video_palette
Entering the options menu with an invalid setting causes no unwanted behavior.
Video Palettes
Below are the first wave of new video palettes for SDL Sopwith.
To determine some of their color values, I used 86box to emulate PC hardware with a CGA video card installed, hooked up to a variety of displays. I took screenshots and used Photoshop to get the numbers.
In issue #29, @fragglet suggested:
Let's make sure there's enough contrast to see things properly - the amber scheme in your screenshot makes it look like the two darker shades are hard to distinguish
The amber palette is now taken from 86box (and looks great!), but it's worth mentioning that both the grey and green palettes are somewhat hard to distinguish, even though they're "accurate".
I think it's fair to adjust the colors for fun and useability, but I as I was working I kept thinking about accuracy and how nice it would be to have a full CRT shader with scanlines. 😅
Summary
This new feature adds a selectable video palette to the options menu. Pressing
2
on the menu cycles through the available color palettes. The player's choice is saved and reloaded between sessions.Addresses issue #29.
Implementation
VideoPalette
to hold the name and color values of each palette:CONF_INT
type, of whichconf_video_palette
is the first.Vid_SetVideoPalette()
sets the video palette to a specified entry from the list of palettesVid_GetVideoPaletteName()
returns the name of a given video palette, for use on the options menuVid_GetNumVideoPalettes()
counts how many video palettes have been definedWhen the options menu is active, there are points at which it must know whether it's dealing with a
CONF_BOOL
,CONF_INT
, orCONF_KEY
. In the case ofCONF_INT
, since the video palettes have names, there is a further check based on the name of the current option being considered.Testing
I focused on making sure that the game defaults to the original video palette, if
sopwith.cfg
:conf_video_palette
conf_video_palette
Entering the options menu with an invalid setting causes no unwanted behavior.
Video Palettes
Below are the first wave of new video palettes for SDL Sopwith.
To determine some of their color values, I used 86box to emulate PC hardware with a CGA video card installed, hooked up to a variety of displays. I took screenshots and used Photoshop to get the numbers.
In issue #29, @fragglet suggested:
The amber palette is now taken from 86box (and looks great!), but it's worth mentioning that both the grey and green palettes are somewhat hard to distinguish, even though they're "accurate".
I think it's fair to adjust the colors for fun and useability, but I as I was working I kept thinking about accuracy and how nice it would be to have a full CRT shader with scanlines. 😅
CGA 1
CGA 2
CGA Amber
CGA Green
CGA Grey
LCD 1
LCD 2