Added hybrid parameter

This commit is contained in:
twojstaryzdomu 2022-02-25 20:12:38 +01:00 committed by Gregory Montoir
parent a8950f5beb
commit 31fa5c2d3f
5 changed files with 17 additions and 4 deletions

View File

@ -61,6 +61,7 @@ Usage: blues [OPTIONS]...
--screensize=WxH Graphics screen size (default 320x200) --screensize=WxH Graphics screen size (default 320x200)
--cga Enable CGA colors --cga Enable CGA colors
--dosscroll Enable DOS style screen scrolling --dosscroll Enable DOS style screen scrolling
--hybrid Enable fuchsia color as in Hybrid crack
``` ```
## Downloads ## Downloads

View File

@ -56,6 +56,7 @@ struct options_t {
bool amiga_status_bar; bool amiga_status_bar;
bool dos_scrolling; bool dos_scrolling;
bool cga_colors; bool cga_colors;
bool hybrid_color;
}; };
struct game_t { struct game_t {

10
main.c
View File

@ -24,6 +24,7 @@ static const char *USAGE =
" --screensize=WxH Graphics screen size (default 320x200)\n" " --screensize=WxH Graphics screen size (default 320x200)\n"
" --cga Enable CGA colors\n" " --cga Enable CGA colors\n"
" --dosscroll Enable DOS style screen scrolling\n" " --dosscroll Enable DOS style screen scrolling\n"
" --hybrid Enable fuchsia color as in Hybrid crack\n"
; ;
static struct game_t *detect_game(const char *data_path) { static struct game_t *detect_game(const char *data_path) {
@ -57,8 +58,9 @@ int main(int argc, char *argv[]) {
g_options.amiga_copper_bars = true; g_options.amiga_copper_bars = true;
g_options.amiga_colors = true; g_options.amiga_colors = true;
// g_options.amiga_status_bar = true; // g_options.amiga_status_bar = true;
g_options.dos_scrolling = false;
g_options.cga_colors = false; g_options.cga_colors = false;
g_options.dos_scrolling = false;
g_options.hybrid_color = false;
const char *data_path = DEFAULT_DATA_PATH; const char *data_path = DEFAULT_DATA_PATH;
int scale_factor = DEFAULT_SCALE_FACTOR; int scale_factor = DEFAULT_SCALE_FACTOR;
const char *scale_filter = DEFAULT_SCALE_FILTER; const char *scale_filter = DEFAULT_SCALE_FILTER;
@ -82,6 +84,7 @@ int main(int argc, char *argv[]) {
{ "screensize", required_argument, 0, 9 }, { "screensize", required_argument, 0, 9 },
{ "cga", no_argument, 0, 10 }, { "cga", no_argument, 0, 10 },
{ "dosscroll", no_argument, 0, 11 }, { "dosscroll", no_argument, 0, 11 },
{ "hybrid", no_argument, 0, 12 },
{ 0, 0, 0, 0 }, { 0, 0, 0, 0 },
}; };
int index; int index;
@ -127,6 +130,9 @@ int main(int argc, char *argv[]) {
case 11: case 11:
g_options.dos_scrolling = true; g_options.dos_scrolling = true;
break; break;
case 12:
g_options.hybrid_color = true;
break;
default: default:
fprintf(stdout, USAGE, argv[0]); fprintf(stdout, USAGE, argv[0]);
return -1; return -1;
@ -137,7 +143,7 @@ int main(int argc, char *argv[]) {
fprintf(stdout, "No data files found\n"); fprintf(stdout, "No data files found\n");
} else { } else {
g_sys.init(); g_sys.init();
g_sys.set_screen_size(GAME_SCREEN_W, GAME_SCREEN_H, game->name, scale_factor, scale_filter, fullscreen); g_sys.set_screen_size(GAME_SCREEN_W, GAME_SCREEN_H, game->name, scale_factor, scale_filter, fullscreen, g_options.hybrid_color);
game->run(data_path); game->run(data_path);
g_sys.fini(); g_sys.fini();
} }

2
sys.h
View File

@ -38,7 +38,7 @@ struct sys_t {
struct input_t input; struct input_t input;
int (*init)(); int (*init)();
void (*fini)(); void (*fini)();
void (*set_screen_size)(int w, int h, const char *caption, int scale, const char *filter, bool fullscreen); void (*set_screen_size)(int w, int h, const char *caption, int scale, const char *filter, bool fullscreen, bool hybrid_color);
void (*set_screen_palette)(const uint8_t *colors, int offset, int count, int depth); void (*set_screen_palette)(const uint8_t *colors, int offset, int count, int depth);
void (*set_palette_amiga)(const uint16_t *colors, int offset); void (*set_palette_amiga)(const uint16_t *colors, int offset);
void (*set_copper_bars)(const uint16_t *data); void (*set_copper_bars)(const uint16_t *data);

View File

@ -40,6 +40,7 @@ static uint32_t _screen_palette[256];
static uint32_t *_screen_buffer; static uint32_t *_screen_buffer;
static int _copper_color_key; static int _copper_color_key;
static uint32_t _copper_palette[COPPER_BARS_H]; static uint32_t _copper_palette[COPPER_BARS_H];
static bool _hybrid_color;
static SDL_GameController *_controller; static SDL_GameController *_controller;
static SDL_Joystick *_joystick; static SDL_Joystick *_joystick;
@ -108,7 +109,7 @@ static void sdl2_fini() {
SDL_Quit(); SDL_Quit();
} }
static void sdl2_set_screen_size(int w, int h, const char *caption, int scale, const char *filter, bool fullscreen) { static void sdl2_set_screen_size(int w, int h, const char *caption, int scale, const char *filter, bool fullscreen, bool hybrid_color) {
assert(_screen_w == 0 && _screen_h == 0); // abort if called more than once assert(_screen_w == 0 && _screen_h == 0); // abort if called more than once
_screen_w = w; _screen_w = w;
_screen_h = h; _screen_h = h;
@ -137,6 +138,7 @@ static void sdl2_set_screen_size(int w, int h, const char *caption, int scale, c
_sprites_cliprect.y = 0; _sprites_cliprect.y = 0;
_sprites_cliprect.w = w; _sprites_cliprect.w = w;
_sprites_cliprect.h = h; _sprites_cliprect.h = h;
_hybrid_color = hybrid_color;
} }
static uint32_t convert_amiga_color(uint16_t color) { static uint32_t convert_amiga_color(uint16_t color) {
@ -196,6 +198,9 @@ static void sdl2_set_screen_palette(const uint8_t *colors, int offset, int count
g = (g << shift) | (g >> (depth - shift)); g = (g << shift) | (g >> (depth - shift));
b = (b << shift) | (b >> (depth - shift)); b = (b << shift) | (b >> (depth - shift));
} }
if(_hybrid_color && i < 2){
g = 0;
}
_screen_palette[offset + i] = SDL_MapRGB(_fmt, r, g, b); _screen_palette[offset + i] = SDL_MapRGB(_fmt, r, g, b);
palette_colors[i].r = r; palette_colors[i].r = r;
palette_colors[i].g = g; palette_colors[i].g = g;