mirror of
https://github.com/joncampbell123/dosbox-x.git
synced 2025-05-09 03:41:10 +08:00
Merge pull request #2814 from cimarronm/monochrome-color-fix
Fixes monochrome color selection for mda and hercules machines
This commit is contained in:
commit
f4fbae6cd0
@ -147,6 +147,21 @@ typedef enum {
|
||||
EGALINE
|
||||
} Drawmode;
|
||||
|
||||
enum MonochromeColor
|
||||
{
|
||||
Green,
|
||||
Amber,
|
||||
Gray,
|
||||
White,
|
||||
First = Green,
|
||||
Last = White
|
||||
};
|
||||
inline MonochromeColor& operator++(MonochromeColor& color)
|
||||
{
|
||||
color = static_cast<MonochromeColor>(static_cast<unsigned>(color)+1);
|
||||
return color;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
bool resizing;
|
||||
Bitu width;
|
||||
@ -204,7 +219,7 @@ typedef struct {
|
||||
uint8_t cga_snow[80]; // one bit per horizontal column where snow should occur
|
||||
|
||||
/*Color and brightness for monochrome display*/
|
||||
uint8_t monochrome_pal;
|
||||
MonochromeColor monochrome_pal;
|
||||
uint8_t monochrome_bright;
|
||||
} VGA_Draw;
|
||||
|
||||
|
@ -1184,7 +1184,7 @@ void RENDER_Init() {
|
||||
}
|
||||
|
||||
//Set monochrome mode color and brightness
|
||||
vga.draw.monochrome_pal=0;
|
||||
vga.draw.monochrome_pal=MonochromeColor::Green;
|
||||
vga.draw.monochrome_bright=1;
|
||||
Prop_multival* prop = section->Get_multival("monochrome_pal");
|
||||
std::string s_bright = prop->GetSection()->Get_string("bright");
|
||||
@ -1194,13 +1194,13 @@ void RENDER_Init() {
|
||||
vga.draw.monochrome_bright=0;
|
||||
}
|
||||
if("green"==s_color){
|
||||
vga.draw.monochrome_pal=0;
|
||||
vga.draw.monochrome_pal=MonochromeColor::Green;
|
||||
}else if("amber"==s_color){
|
||||
vga.draw.monochrome_pal=1;
|
||||
}else if("gray"==s_color){
|
||||
vga.draw.monochrome_pal=2;
|
||||
vga.draw.monochrome_pal=MonochromeColor::Amber;
|
||||
}else if("gray"==s_color || "grey"==s_color){
|
||||
vga.draw.monochrome_pal=MonochromeColor::Gray;
|
||||
}else if("white"==s_color){
|
||||
vga.draw.monochrome_pal=3;
|
||||
vga.draw.monochrome_pal=MonochromeColor::White;
|
||||
}
|
||||
|
||||
//For restarting the renderer.
|
||||
|
@ -297,8 +297,8 @@ static double hue_offset = 0.0;
|
||||
|
||||
static uint8_t cga16_val = 0;
|
||||
static void update_cga16_color(void);
|
||||
static uint8_t herc_pal = 0;
|
||||
static uint8_t mono_cga_pal = 0;
|
||||
static MonochromeColor herc_pal = MonochromeColor::Green;
|
||||
static MonochromeColor mono_cga_pal = MonochromeColor::Green;
|
||||
static uint8_t mono_cga_bright = 0;
|
||||
static uint8_t const mono_cga_palettes[8][16][3] =
|
||||
{
|
||||
@ -932,13 +932,13 @@ static void write_pcjr(Bitu port,Bitu val,Bitu /*iolen*/) {
|
||||
|
||||
void CycleHercPal(bool pressed) {
|
||||
if (!pressed) return;
|
||||
if (++herc_pal>3) herc_pal=0;
|
||||
if (++herc_pal>MonochromeColor::Last) herc_pal=MonochromeColor::First;
|
||||
Herc_Palette();
|
||||
}
|
||||
|
||||
void CycleMonoCGAPal(bool pressed) {
|
||||
if (!pressed) return;
|
||||
if (++mono_cga_pal>3) mono_cga_pal=0;
|
||||
if (++mono_cga_pal>MonochromeColor::Last) mono_cga_pal=MonochromeColor::First;
|
||||
Mono_CGA_Palette();
|
||||
}
|
||||
|
||||
@ -956,19 +956,19 @@ void HercBlend(bool pressed) {
|
||||
|
||||
void Herc_Palette(void) {
|
||||
switch (herc_pal) {
|
||||
case 0: // White
|
||||
case MonochromeColor::White:
|
||||
VGA_DAC_SetEntry(0x7,0x2a,0x2a,0x2a);
|
||||
VGA_DAC_SetEntry(0xf,0x3f,0x3f,0x3f);
|
||||
break;
|
||||
case 1: // Amber
|
||||
case MonochromeColor::Amber:
|
||||
VGA_DAC_SetEntry(0x7,0x34,0x20,0x00);
|
||||
VGA_DAC_SetEntry(0xf,0x3f,0x34,0x00);
|
||||
break;
|
||||
case 2: // Paper-white
|
||||
case MonochromeColor::Gray:
|
||||
VGA_DAC_SetEntry(0x7,0x2c,0x2d,0x2c);
|
||||
VGA_DAC_SetEntry(0xf,0x3f,0x3f,0x3b);
|
||||
break;
|
||||
case 3: // Green
|
||||
case MonochromeColor::Green:
|
||||
VGA_DAC_SetEntry(0x7,0x00,0x26,0x00);
|
||||
VGA_DAC_SetEntry(0xf,0x00,0x3f,0x00);
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user