diff --git a/src/Makefile b/src/Makefile index 2231583e..d6e9d7c6 100644 --- a/src/Makefile +++ b/src/Makefile @@ -97,7 +97,7 @@ CONFIG_CLEAN_FILES = PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) -DEFS = -DPACKAGE=\"apple2-emul\" -DVERSION=\"0.7.4\" -DPC_JOYSTICK=1 -DHAVE_UNISTD_H=1 -DHAVE_GETPAGESIZE=1 -DHAVE_MMAP=1 -DNO_UNDERSCORES=1 -DDEBUGGER=1 -DAPPLE2IX=1 -DAPPLE_IIE=1 -I. -I$(srcdir) +DEFS = -DPACKAGE=\"apple2-emul\" -DVERSION=\"0.7.4\" -DKEYPAD_JOYSTICK=1 -DPC_JOYSTICK=1 -DHAVE_UNISTD_H=1 -DHAVE_GETPAGESIZE=1 -DHAVE_MMAP=1 -DNO_UNDERSCORES=1 -DDEBUGGER=1 -DAPPLE2IX=1 -DAPPLE_IIE=1 -I. -I$(srcdir) CPPFLAGS = LDFLAGS = LIBS = diff --git a/src/interface.c b/src/interface.c index bb04623c..01fd37fe 100644 --- a/src/interface.c +++ b/src/interface.c @@ -22,6 +22,7 @@ #include "video.h" #include "cpu.h" #include "prefs.h" +#include "joystick.h" #include "common.h" #include "zlib-helpers.h" @@ -71,12 +72,7 @@ static void pad_string(char *s, char c, int len) { /* in keys.c */ //extern void c_mouse_close(); -/* from joystick.c */ #ifdef PC_JOYSTICK -extern int c_open_joystick(); -extern void c_calculate_joystick_parms(); -extern void c_close_joystick(); -extern void c_calibrate_joystick(); extern long js_timelimit; #endif @@ -766,11 +762,11 @@ typedef enum interface_enum_t { OPT_CPU = 0, OPT_ALTCPU, OPT_PATH, - OPT_MODE, + //OPT_MODE, OPT_COLOR, - OPT_SOUND, + OPT_VOLUME, OPT_JOYSTICK, - OPT_CALIBRATE, // (NOP) + OPT_CALIBRATE, OPT_JS_RANGE, OPT_ORIGIN_X, OPT_ORIGIN_Y, @@ -784,18 +780,18 @@ typedef enum interface_enum_t { static const char *options[] = { - " CPU% : ", /* 0 */ - " ALT CPU% : ", /* 0 */ + " CPU% : ", + " ALT CPU% : ", " Path : ", - " Mode : ", + //" Mode : ", " Color : ", - " Sound : ", - " Joystick : ", /* 5 */ + " Volume : ", + " Joystick : ", " Calibrate ", " JS Range : ", " Origin X : ", " Origin Y : ", - " JS Sens. : ", /* 10 */ + " JS Sens. : ", " JS Sample: ", " Save Prefs ", " Quit " @@ -891,34 +887,37 @@ void c_interface_parameters() temp[INTERFACE_PATH_MAX] = '\0'; break; +#if 0 case OPT_MODE: sprintf(temp, "%s", (apple_mode == 0) ? "][+ " : (apple_mode == 1) ? "][+ undocumented" : "//e "); break; +#endif case OPT_COLOR: - sprintf(temp, "%s", (color_mode == 0) ? "Black/White " : - (color_mode == 1) ? "Lazy Color " : - (color_mode == 2) ? "Color " : - (color_mode == 3) ? "Lazy Interp." : - "Interpolated"); + sprintf(temp, "%s", (color_mode == COLOR) ? "Color " : + (color_mode == COLOR_INTERP) ? "Interpolated" : "Black/White "); break; - case OPT_SOUND: - sprintf(temp, "%s", (sound_mode == 0) ? "Off " : - "PC Speaker"); + case OPT_VOLUME: + if (sound_volume == 0) + { + snprintf(temp, TEMPSIZE, "%s", "Off "); + } + else + { + snprintf(temp, TEMPSIZE, "%d", sound_volume); + } break; case OPT_JOYSTICK: - sprintf(temp, "%s", (joy_mode == JOY_KYBD) ? "Linear " : - (joy_mode == JOY_DIGITAL) ? "Digital " : - (joy_mode == JOY_PCJOY) ? "PC Joystick" : - "Off "); + snprintf(temp, TEMPSIZE, "%s", (joy_mode == JOY_KPAD) ? "Emulated on Keypad" : + (joy_mode == JOY_PCJOY) ? "PC Joystick " : "Off "); break; case OPT_CALIBRATE: - strcpy( temp, "" ); + strncpy( temp, "", TEMPSIZE ); break; case OPT_JS_RANGE: @@ -1074,6 +1073,7 @@ void c_interface_parameters() } break; +#if 0 case OPT_MODE: apple_mode--; if (apple_mode < 0) @@ -1081,11 +1081,12 @@ void c_interface_parameters() apple_mode = 2; } break; +#endif case OPT_COLOR: if (color_mode == 0) { - color_mode = 4; + color_mode = NUM_COLOROPTS-1; } else { @@ -1093,33 +1094,32 @@ void c_interface_parameters() } break; - case OPT_SOUND: - if (sound_mode == 0) + case OPT_VOLUME: + if (sound_volume > 0) { - sound_mode = 1; - } - else - { - --sound_mode; + --sound_volume; } break; case OPT_JOYSTICK: -#ifdef PC_JOYSTICK + if (joy_mode == JOY_PCJOY) + { + c_close_joystick(); + } + if (joy_mode == 0) { - joy_mode = 3; + joy_mode = NUM_JOYOPTS-1; } -#else - if (joy_mode == 0) - { - joy_mode = 2; - } -#endif else { --joy_mode; } + + if (joy_mode == JOY_PCJOY) + { + c_open_joystick(); + } break; case OPT_CALIBRATE: @@ -1206,6 +1206,7 @@ void c_interface_parameters() } break; +#if 0 case OPT_MODE: apple_mode++; if (apple_mode > 2) @@ -1213,39 +1214,46 @@ void c_interface_parameters() apple_mode = 0; } break; +#endif case OPT_COLOR: - color_mode++; - if (color_mode > 4) + if (color_mode == NUM_COLOROPTS-1) { color_mode = 0; } + else + { + ++color_mode; + } break; - case OPT_SOUND: - sound_mode++; - if (sound_mode > 1) + case OPT_VOLUME: + sound_volume++; + if (sound_volume > 10) { - sound_mode = 0; + sound_volume = 10; } break; case OPT_JOYSTICK: -#ifdef PC_JOYSTICK - if (joy_mode == 3) + if (joy_mode == JOY_PCJOY) + { + c_close_joystick(); + } + + if (joy_mode == NUM_JOYOPTS-1) { joy_mode = 0; } -#else - if (joy_mode == 2) - { - joy_mode = 0; - } -#endif else { ++joy_mode; } + + if (joy_mode == JOY_PCJOY) + { + c_open_joystick(); + } break; case OPT_CALIBRATE: @@ -1299,27 +1307,17 @@ void c_interface_parameters() { timing_initialize(); video_set(0); /* redo colors */ -#ifdef PC_JOYSTICK - if (joy_mode == JOY_PCJOY) - { - c_close_joystick(); /* close the joystick */ - c_open_joystick(); /* reopen the joystick */ - half_joy_range = joy_range/2; - c_calculate_joystick_parms(); - } - else - { - c_close_joystick(); - } -#endif +#if 0 /* reboot machine if different */ if (current_mode != apple_mode) { // FIXME : broken ... - //cpu65_interrupt(RebootSig); + cpu65_interrupt(RebootSig); } +#endif + c_initialize_sound_hooks(); c_interface_exit(); return; } @@ -1403,14 +1401,12 @@ void c_interface_parameters() } } -#ifdef PC_JOYSTICK /* calibrate joystick */ if ((ch == 13) && (option == OPT_CALIBRATE)) { c_calibrate_joystick(); } -#endif /* save settings */ if ((ch == 13) && (option == OPT_SAVE)) { @@ -1471,14 +1467,12 @@ void c_interface_parameters() c_interface_print_screen( screen ); c_eject_6( 1 ); c_interface_print_screen( screen ); -#ifdef PC_JOYSTICK c_close_joystick(); -#endif #ifdef __linux__ LOG("Back to Linux, w00t!\n"); #endif video_shutdown(); - //audio_shutdown(); + //audio_shutdown(); TODO : fixme ... exit( 0 ); } diff --git a/src/joystick.c b/src/joystick.c index 7ad5634b..fb55b4fb 100644 --- a/src/joystick.c +++ b/src/joystick.c @@ -14,7 +14,10 @@ * */ +#ifdef PC_JOYSTICK #include +#endif + #include #include #include @@ -22,12 +25,14 @@ #include #include +#include "joystick.h" #include "interface.h" #include "video.h" #include "keys.h" #include "misc.h" #include "prefs.h" +#ifdef PC_JOYSTICK int js_fd = -1; /* joystick file descriptor */ struct JS_DATA_TYPE js; /* joystick data struct */ @@ -44,11 +49,12 @@ float js_adjusthigh_x, js_adjusthigh_y; - /* ------------------------------------------------------------------------- - c_open_joystick() - opens joystick device and sets timelimit value + c_open_pc_joystick() - opens joystick device and sets timelimit value ------------------------------------------------------------------------- */ -int c_open_joystick() { +static void c_calculate_pc_joystick_parms(); +int c_open_pc_joystick() +{ if (js_fd < 0) { if ((js_fd = open("/dev/js0", O_RDONLY)) < 0) @@ -71,13 +77,17 @@ int c_open_joystick() { } } + half_joy_range = joy_range/2; + c_calculate_pc_joystick_parms(); + return 0; /* no problem */ } /* ------------------------------------------------------------------------- - c_close_joystick() - closes joystick device + c_close_pc_joystick() - closes joystick device ------------------------------------------------------------------------- */ -void c_close_joystick() { +void c_close_pc_joystick() +{ if (js_fd < 0) { return; @@ -89,10 +99,11 @@ void c_close_joystick() { /* ------------------------------------------------------------------------- - * c_calculate_joystick_parms() - calculates parameters for joystick + * c_calculate_pc_joystick_parms() - calculates parameters for joystick * device. assumes that device extremes have already been determined. * ------------------------------------------------------------------------- */ -void c_calculate_joystick_parms() { +static void c_calculate_pc_joystick_parms() +{ js_lowerrange_x = js_center_x - js_min_x; js_upperrange_x = js_max_x - js_center_x; @@ -109,11 +120,12 @@ void c_calculate_joystick_parms() { } /* ------------------------------------------------------------------------- - c_calibrate_joystick() - calibrates joystick. determines extreme + c_calibrate_pcjoystick() - calibrates joystick. determines extreme and center coordinates. assumes that it can write to the interface screen. ------------------------------------------------------------------------- */ -void c_calibrate_joystick() { +static void c_calibrate_pc_joystick() +{ int almost_done, done; unsigned char x_val, y_val; @@ -126,7 +138,7 @@ void c_calibrate_joystick() { /* open joystick device if not open */ if (js_fd < 0) { - if (c_open_joystick()) /* problem opening device */ + if (c_open_pc_joystick()) /* problem opening device */ { c_interface_print( 1, 21, 0, " " ); @@ -198,7 +210,7 @@ void c_calibrate_joystick() { printf("js_center_y = %d\n", js_center_y); printf("\n"); - c_calculate_joystick_parms(); /* determine the parms */ + c_calculate_pc_joystick_parms(); /* determine the parms */ printf("js_lowerrange_x = %d\n", js_lowerrange_x); printf("js_lowerrange_y = %d\n", js_lowerrange_y); @@ -238,3 +250,69 @@ void c_calibrate_joystick() { c_interface_redo_bottom(); video_sync(0); } +#endif // PC_JOYSTICK + +#ifdef KEYPAD_JOYSTICK +static void c_calibrate_keypad_joystick() +{ + // TODO .... +} +#endif + +#ifdef TOUCH_JOYSTICK +// TBD ... +#endif + +/* ---------------------------------------------------------------------- */ + +void c_open_joystick() +{ +#ifdef PC_JOYSTICK + if (joy_mode == JOY_PCJOY) + { + c_open_pc_joystick(); + } +#endif + +#ifdef KEYPAD_JOYSTICK + if (joy_mode == JOY_KPAD) + { + // NOP + } +#endif +} + +void c_close_joystick() +{ +#ifdef PC_JOYSTICK + if (joy_mode == JOY_PCJOY) + { + c_close_pc_joystick(); + } +#endif + +#ifdef KEYPAD_JOYSTICK + if (joy_mode == JOY_KPAD) + { + // NOP + } +#endif +} + +void c_calibrate_joystick() +{ +#ifdef PC_JOYSTICK + if (joy_mode == JOY_PCJOY) + { + c_calibrate_pc_joystick(); + } +#endif + +#ifdef KEYPAD_JOYSTICK + if (joy_mode == JOY_KPAD) + { + c_calibrate_keypad_joystick(); + } +#endif +} + diff --git a/src/joystick.h b/src/joystick.h new file mode 100644 index 00000000..3d597523 --- /dev/null +++ b/src/joystick.h @@ -0,0 +1,26 @@ +/* + * Apple // emulator for *nix + * + * This software package is subject to the GNU General Public License + * version 2 or later (your choice) as published by the Free Software + * Foundation. + * + * THERE ARE NO WARRANTIES WHATSOEVER. + * + */ + +/* + * 65c02 CPU Timing Support. + * + * Copyleft 2013 Aaron Culliney + * + */ + +#ifndef _JOYSTICK_H_ +#define _JOYSTICK_H_ + +void c_open_joystick(); +void c_close_joystick(); +void c_calibrate_joystick(); + +#endif // whole file diff --git a/src/keys.c b/src/keys.c index 61decd36..263541a4 100644 --- a/src/keys.c +++ b/src/keys.c @@ -311,8 +311,8 @@ void c_periodic_update(int dummysig) { } } - /* simulated joystick */ - if (joy_mode == JOY_KYBD) + /* simulated joystick from PC Keypad */ + if (joy_mode == JOY_KPAD) { if (key_pressed[ SCODE_J_U ]) { diff --git a/src/keys.h b/src/keys.h index 52c8b9a2..9d48e421 100644 --- a/src/keys.h +++ b/src/keys.h @@ -79,10 +79,6 @@ extern int js_fd; extern struct JS_DATA_TYPE js; extern int js_offset_x, js_offset_y; extern float js_adjustlow_x, js_adjustlow_y, js_adjusthigh_x, js_adjusthigh_y; -extern int c_open_joystick(void); -extern void c_calculate_joystick_parms(void); -extern void c_close_joystick(void); -extern void c_calibrate_joystick(void); #endif void c_read_raw_key(int scancode, int pressed); diff --git a/src/misc.c b/src/misc.c index 5c64bde9..86225906 100644 --- a/src/misc.c +++ b/src/misc.c @@ -643,9 +643,10 @@ void c_initialize_apple_ii_memory() void c_initialize_sound_hooks() { + SpkrSetVolume(sound_volume * (SPKR_DATA_INIT/10)); for (int i = 0xC030; i < 0xC040; i++) { - cpu65_vmem[i].r = cpu65_vmem[i].w = (sound_mode) ? read_speaker_toggle_pc : ram_nop; + cpu65_vmem[i].r = cpu65_vmem[i].w = (sound_volume > 0) ? read_speaker_toggle_pc : ram_nop; } } diff --git a/src/prefs.c b/src/prefs.c index 305c6d2b..d91fa0b1 100644 --- a/src/prefs.c +++ b/src/prefs.c @@ -27,6 +27,7 @@ #include "interface.h" #include "timing.h" #include "cpu.h" +#include "joystick.h" #define PRM_NONE 0 #define PRM_SPEED 1 @@ -34,13 +35,13 @@ #define PRM_MODE 2 #define PRM_DISK_PATH 3 #define PRM_HIRES_COLOR 4 -#define PRM_SOUND 5 +#define PRM_VOLUME 5 #define PRM_JOY_INPUT 6 #define PRM_JOY_RANGE 7 #define PRM_JOY_OX 8 #define PRM_JOY_OY 9 #define PRM_JOY_PC_CALIBRATE 10 -#define PRM_JOY_KYBD_SENSITIVITY 11 +#define PRM_JOY_KPAD_SENSITIVITY 11 #define PRM_ROM_PATH 12 @@ -48,9 +49,9 @@ char system_path[SYSSIZE]; char disk_path[DISKSIZE]; int apple_mode; -int sound_mode; -int color_mode; -short joy_mode; +int sound_volume; +color_mode_t color_mode; +joystick_mode_t joy_mode; short joy_step; short joy_center_x; short joy_center_y; @@ -85,7 +86,7 @@ static const struct match_table prefs_table[] = { "disk_path", PRM_DISK_PATH }, { "path", PRM_DISK_PATH }, { "color", PRM_HIRES_COLOR }, - { "sound", PRM_SOUND }, + { "volume", PRM_VOLUME }, { "joystick", PRM_JOY_INPUT }, { "joy range", PRM_JOY_RANGE }, { "joystick range", PRM_JOY_RANGE }, @@ -94,7 +95,7 @@ static const struct match_table prefs_table[] = { "origin_y", PRM_JOY_OY }, { "pc joystick parms", PRM_JOY_PC_CALIBRATE }, { "pc_joystick_parms", PRM_JOY_PC_CALIBRATE }, - { "sensitivity", PRM_JOY_KYBD_SENSITIVITY }, + { "sensitivity", PRM_JOY_KPAD_SENSITIVITY }, { "system path", PRM_ROM_PATH }, { "system_path", PRM_ROM_PATH }, { 0, PRM_NONE } @@ -110,37 +111,44 @@ static const struct match_table modes_table[] = static const struct match_table color_table[] = { - { "black/white", NO_COLOR }, - { "lazy color", LAZY_COLOR }, + { "black/white", COLOR_NONE }, + /*{ "lazy color", LAZY_COLOR }, deprecated*/ { "color", COLOR }, - { "lazy interpolated", LAZY_INTERP }, - { "interpolated", INTERP }, + /*{ "lazy interpolated", LAZY_INTERP }, deprecated*/ + { "interpolated", COLOR_INTERP }, { "off", 0 }, { "on", COLOR }, { 0, COLOR } }; -static const struct match_table sound_table[] = +static const struct match_table volume_table[] = { - { "off", 0 }, - { "pc_speaker", 1 }, - { "on", 1 }, - { 0, 1 }, + { "0", 0 }, + { "1", 1 }, + { "2", 2 }, + { "3", 3 }, + { "4", 4 }, + { "5", 5 }, + { "6", 6 }, + { "7", 7 }, + { "8", 8 }, + { "9", 9 }, + { "10", 10 }, + { 0, 10 }, }; static const struct match_table joy_input_table[] = { { "off", JOY_OFF }, - { "keyboard", JOY_KYBD }, - { "linear", JOY_KYBD }, +#ifdef KEYPAD_JOYSTICK + { "joy keypad", JOY_KPAD }, + { "joy_keypad", JOY_KPAD }, +#endif #ifdef PC_JOYSTICK { "pc joystick", JOY_PCJOY }, { "pc_joystick", JOY_PCJOY }, #endif /* PC_JOYSTICK */ -#if 0 - { "digital", JOY_DIGITAL }, -#endif /* 0 */ - { 0, JOY_KYBD } + { 0, JOY_OFF } }; /* Find the number assigned to KEYWORD in a match table PARADIGM. If no match, @@ -288,8 +296,8 @@ void load_settings(void) color_mode = match(color_table, argument); break; - case PRM_SOUND: - sound_mode = match(sound_table, argument); + case PRM_VOLUME: + sound_volume = match(volume_table, argument); break; case PRM_JOY_INPUT: @@ -398,10 +406,9 @@ void load_settings(void) } c_open_joystick(); - c_calculate_joystick_parms(); /* calculate the associated parms */ #endif - case PRM_JOY_KYBD_SENSITIVITY: + case PRM_JOY_KPAD_SENSITIVITY: joy_step = strtol(argument, 0, 0); if (joy_step < 1) { @@ -466,7 +473,7 @@ bool save_settings(void) "mode = %s\n" "disk path = %s\n" "color = %s\n" - "sound = %s\n" + "volume = %s\n" "joystick = %s\n" "joystick range = %d\n" "origin_x = %d\n" @@ -478,7 +485,7 @@ bool save_settings(void) reverse_match(modes_table, apple_mode), disk_path, reverse_match(color_table, color_mode), - reverse_match(sound_table, sound_mode), + reverse_match(volume_table, sound_volume), reverse_match(joy_input_table, joy_mode), joy_range, joy_center_x, diff --git a/src/prefs.h b/src/prefs.h index cbb39d5c..073d5df0 100644 --- a/src/prefs.h +++ b/src/prefs.h @@ -21,17 +21,37 @@ #ifndef __ASSEMBLER__ +typedef enum joystick_mode_t { + JOY_OFF = 0, +#ifdef KEYPAD_JOYSTICK + JOY_KPAD, +#endif +#ifdef PC_JOYSTICK + JOY_PCJOY, +#endif + NUM_JOYOPTS +} joystick_mode_t; + +typedef enum color_mode_t { + COLOR_NONE = 0, + /*LAZY_COLOR, deprecated*/ + COLOR, + /*LAZY_INTERP, deprecated*/ + COLOR_INTERP, + NUM_COLOROPTS +} color_mode_t; + #define SYSSIZE 4096 extern char system_path[SYSSIZE]; #define DISKSIZE 4096 extern char disk_path[DISKSIZE]; extern int apple_mode; /* undocumented instructions or //e mode */ -extern int sound_mode; /* PC speaker or OFF */ -extern int color_mode; +extern int sound_volume; +extern color_mode_t color_mode; /* generic joystick settings */ -extern short joy_mode; +extern joystick_mode_t joy_mode; extern short joy_step; extern short joy_center_x; extern short joy_center_y; @@ -60,17 +80,4 @@ extern bool save_settings(void); #define IIU_MODE 1 #define II_MODE 0 -/* values for color_mode */ -#define NO_COLOR 0 -#define LAZY_COLOR 1 -#define COLOR 2 -#define LAZY_INTERP 3 -#define INTERP 4 - -/* values for joy_mode */ -#define JOY_OFF 0 -#define JOY_KYBD 1 -#define JOY_DIGITAL 2 -#define JOY_PCJOY 3 - #endif /* PREFS_H */ diff --git a/src/speaker.c b/src/speaker.c index ea2b2ade..737606dd 100644 --- a/src/speaker.c +++ b/src/speaker.c @@ -83,9 +83,7 @@ static const DWORD g_dwDSSpkrBufferSize = MAX_SAMPLES * sizeof(short) * g_nSPKR_ static short* g_pSpeakerBuffer = NULL; // Globals (SOUND_WAVE) -#ifdef APPLE2IX -#define SPKR_DATA_INIT 0x4000; -#else +#ifndef APPLE2IX const short SPKR_DATA_INIT = (short)0x8000; #endif @@ -604,7 +602,7 @@ BYTE __stdcall SpkrToggle (WORD, WORD, BYTE, BYTE, ULONG nCyclesLeft) UpdateSpkr(); #ifdef APPLE2IX - g_nSpeakerData *= -1; + g_nSpeakerData *= -1; // amplitude can less than max/min short #else g_nSpeakerData = ~g_nSpeakerData; #endif diff --git a/src/speaker.h b/src/speaker.h index 32dd1a7b..d24f67fe 100644 --- a/src/speaker.h +++ b/src/speaker.h @@ -30,6 +30,7 @@ void Spkr_SetErrorInc(const int nErrorInc); void Spkr_SetErrorMax(const int nErrorMax); DWORD SpkrGetVolume(); #ifdef APPLE2IX +#define SPKR_DATA_INIT 0x4000 void SpkrSetVolume(short amplitude); #else void SpkrSetVolume(DWORD dwVolume, DWORD dwVolumeMax); diff --git a/src/vidsup.c b/src/vidsup.c index 44850764..e6589f5b 100644 --- a/src/vidsup.c +++ b/src/vidsup.c @@ -46,7 +46,7 @@ static unsigned char video__int_font[3][0x4000]; int video__current_page; /* Current visual page */ -int video__strictcolors; +int video__strictcolors = 1;// 0 is deprecated void video_loadfont(int first, int quantity, @@ -202,7 +202,7 @@ static void c_initialize_hires_values(void) } } - if (color_mode == 0) /* Black and White */ + if (color_mode == COLOR_NONE) /* Black and White */ { for (value = 0x00; value <= 0xFF; value++) { @@ -220,6 +220,7 @@ static void c_initialize_hires_values(void) } } } +#if 0 else if (color_mode == LAZY_INTERP) /* Lazy Interpolated color */ { for (value = 0x00; value <= 0xFF; value++) @@ -310,7 +311,8 @@ static void c_initialize_hires_values(void) } } } - else if (color_mode == INTERP) /* Color and strict interpolation */ +#endif + else if (color_mode == COLOR_INTERP) /* Color and strict interpolation */ { for (value = 0x00; value <= 0xFF; value++) { @@ -612,19 +614,7 @@ static void c_initialize_tables_video(void) { void video_set(int flags) { - if (color_mode == COLOR) - { - video__strictcolors = 1; /* strict colors */ - } - else if (color_mode == INTERP) - { - video__strictcolors = 2; /* strict interpolation */ - } - else - { - video__strictcolors = 0; /* lazy coloration */ - - } + video__strictcolors = (color_mode == COLOR_INTERP) ? 2 : 1; c_initialize_hires_values(); /* precalculate hires values */ c_initialize_row_col_tables(); /* precalculate hires offsets */