From ae18d8c4b6f7f918aa5ec496ca32899793cbe41e Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Fri, 21 Nov 2008 18:03:06 +0000 Subject: Move setup/ into src/ and merge with main codebase. Remove duplicated code. Split out I_Endoom to separate i_endoom.c file. Subversion-branch: /branches/raven-branch Subversion-revision: 1384 --- configure.in | 4 +- setup/.gitignore | 6 - setup/Makefile.am | 46 --- setup/compatibility.c | 46 --- setup/compatibility.h | 31 -- setup/configfile.c | 599 ---------------------------------- setup/configfile.h | 42 --- setup/display.c | 438 ------------------------- setup/display.h | 37 --- setup/execute.c | 291 ----------------- setup/execute.h | 45 --- setup/joystick.c | 440 ------------------------- setup/joystick.h | 42 --- setup/keyboard.c | 143 --------- setup/keyboard.h | 41 --- setup/m_argv.c | 65 ---- setup/m_argv.h | 42 --- setup/mainmenu.c | 220 ------------- setup/mouse.c | 157 --------- setup/mouse.h | 45 --- setup/multiplayer.c | 750 ------------------------------------------- setup/multiplayer.h | 36 --- setup/setup-manifest.xml | 16 - setup/setup-res.rc.in | 24 -- setup/setup_icon.c | 262 --------------- setup/sound.c | 167 ---------- setup/sound.h | 39 --- setup/txt_joybinput.c | 228 ------------- setup/txt_joybinput.h | 46 --- setup/txt_keyinput.c | 181 ----------- setup/txt_keyinput.h | 44 --- setup/txt_mouseinput.c | 186 ----------- setup/txt_mouseinput.h | 44 --- src/Makefile.am | 45 ++- src/d_dedicated.c | 23 -- src/doom/d_main.c | 11 +- src/heretic/d_main.c | 12 +- src/hexen/h2_main.c | 10 +- src/i_endoom.c | 71 ++++ src/i_endoom.h | 37 +++ src/i_system.c | 59 +--- src/i_system.h | 5 - src/i_timer.c | 5 + src/i_timer.h | 3 + src/i_video.h | 3 - src/m_config.c | 25 ++ src/m_config.h | 1 + src/setup-res.rc.in | 24 ++ src/setup/.gitignore | 6 + src/setup/Makefile.am | 25 ++ src/setup/compatibility.c | 46 +++ src/setup/compatibility.h | 31 ++ src/setup/display.c | 438 +++++++++++++++++++++++++ src/setup/display.h | 37 +++ src/setup/execute.c | 290 +++++++++++++++++ src/setup/execute.h | 45 +++ src/setup/joystick.c | 440 +++++++++++++++++++++++++ src/setup/joystick.h | 42 +++ src/setup/keyboard.c | 143 +++++++++ src/setup/keyboard.h | 41 +++ src/setup/mainmenu.c | 218 +++++++++++++ src/setup/mouse.c | 157 +++++++++ src/setup/mouse.h | 45 +++ src/setup/multiplayer.c | 749 ++++++++++++++++++++++++++++++++++++++++++ src/setup/multiplayer.h | 36 +++ src/setup/setup-manifest.xml | 16 + src/setup/setup_icon.c | 262 +++++++++++++++ src/setup/sound.c | 167 ++++++++++ src/setup/sound.h | 39 +++ src/setup/txt_joybinput.c | 228 +++++++++++++ src/setup/txt_joybinput.h | 46 +++ src/setup/txt_keyinput.c | 181 +++++++++++ src/setup/txt_keyinput.h | 44 +++ src/setup/txt_mouseinput.c | 186 +++++++++++ src/setup/txt_mouseinput.h | 44 +++ 75 files changed, 4236 insertions(+), 4903 deletions(-) delete mode 100644 setup/.gitignore delete mode 100644 setup/Makefile.am delete mode 100644 setup/compatibility.c delete mode 100644 setup/compatibility.h delete mode 100644 setup/configfile.c delete mode 100644 setup/configfile.h delete mode 100644 setup/display.c delete mode 100644 setup/display.h delete mode 100644 setup/execute.c delete mode 100644 setup/execute.h delete mode 100644 setup/joystick.c delete mode 100644 setup/joystick.h delete mode 100644 setup/keyboard.c delete mode 100644 setup/keyboard.h delete mode 100644 setup/m_argv.c delete mode 100644 setup/m_argv.h delete mode 100644 setup/mainmenu.c delete mode 100644 setup/mouse.c delete mode 100644 setup/mouse.h delete mode 100644 setup/multiplayer.c delete mode 100644 setup/multiplayer.h delete mode 100644 setup/setup-manifest.xml delete mode 100644 setup/setup-res.rc.in delete mode 100644 setup/setup_icon.c delete mode 100644 setup/sound.c delete mode 100644 setup/sound.h delete mode 100644 setup/txt_joybinput.c delete mode 100644 setup/txt_joybinput.h delete mode 100644 setup/txt_keyinput.c delete mode 100644 setup/txt_keyinput.h delete mode 100644 setup/txt_mouseinput.c delete mode 100644 setup/txt_mouseinput.h create mode 100644 src/i_endoom.c create mode 100644 src/i_endoom.h create mode 100644 src/setup-res.rc.in create mode 100644 src/setup/.gitignore create mode 100644 src/setup/Makefile.am create mode 100644 src/setup/compatibility.c create mode 100644 src/setup/compatibility.h create mode 100644 src/setup/display.c create mode 100644 src/setup/display.h create mode 100644 src/setup/execute.c create mode 100644 src/setup/execute.h create mode 100644 src/setup/joystick.c create mode 100644 src/setup/joystick.h create mode 100644 src/setup/keyboard.c create mode 100644 src/setup/keyboard.h create mode 100644 src/setup/mainmenu.c create mode 100644 src/setup/mouse.c create mode 100644 src/setup/mouse.h create mode 100644 src/setup/multiplayer.c create mode 100644 src/setup/multiplayer.h create mode 100644 src/setup/setup-manifest.xml create mode 100644 src/setup/setup_icon.c create mode 100644 src/setup/sound.c create mode 100644 src/setup/sound.h create mode 100644 src/setup/txt_joybinput.c create mode 100644 src/setup/txt_joybinput.h create mode 100644 src/setup/txt_keyinput.c create mode 100644 src/setup/txt_keyinput.h create mode 100644 src/setup/txt_mouseinput.c create mode 100644 src/setup/txt_mouseinput.h diff --git a/configure.in b/configure.in index 5703560e..f4b6202a 100644 --- a/configure.in +++ b/configure.in @@ -79,15 +79,15 @@ AC_OUTPUT([ Makefile textscreen/Makefile textscreen/examples/Makefile -setup/Makefile man/Makefile src/Makefile src/doom/Makefile src/heretic/Makefile src/hexen/Makefile +src/setup/Makefile pcsound/Makefile src/resource.rc +src/setup-res.rc src/doom-screensaver.desktop -setup/setup-res.rc ]) diff --git a/setup/.gitignore b/setup/.gitignore deleted file mode 100644 index e2da8a59..00000000 --- a/setup/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile.in -Makefile -.deps -chocolate-setup -*.rc -*.exe diff --git a/setup/Makefile.am b/setup/Makefile.am deleted file mode 100644 index f845f853..00000000 --- a/setup/Makefile.am +++ /dev/null @@ -1,46 +0,0 @@ - -gamesdir = $(prefix)/games - -AM_CFLAGS = @SDL_CFLAGS@ -I../textscreen -I../src -DINSTALL_DIR="\"$(gamesdir)\"" - -games_PROGRAMS = chocolate-setup - -chocolate_setup_LDADD = ../textscreen/libtextscreen.a @LDFLAGS@ @SDL_LIBS@ -SOURCE_FILES = \ - compatibility.c compatibility.h \ - configfile.c configfile.h \ - display.c display.h \ - joystick.c joystick.h \ - keyboard.c keyboard.h \ - m_argv.c m_argv.h \ - mainmenu.c \ - mouse.c mouse.h \ - multiplayer.c multiplayer.h \ - sound.c sound.h \ - execute.c execute.h \ - txt_joybinput.c txt_joybinput.h \ - txt_keyinput.c txt_keyinput.h \ - txt_mouseinput.c txt_mouseinput.h - -EXTRA_DIST= \ - setup_icon.c \ - setup-manifest.xml - -if HAVE_WINDRES -chocolate_setup_SOURCES=$(SOURCE_FILES) setup-res.rc -else -chocolate_setup_SOURCES=$(SOURCE_FILES) -endif - -.rc.o: - $(WINDRES) $^ -o $@ -%.o : %.rc - $(WINDRES) $^ -o $@ - -if HAVE_PYTHON - -setup_icon.c : ../data/setup.ico - ../data/convert-icon $^ $@ - -endif - diff --git a/setup/compatibility.c b/setup/compatibility.c deleted file mode 100644 index bebf5a87..00000000 --- a/setup/compatibility.c +++ /dev/null @@ -1,46 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// Copyright(C) 2006 Simon Howard -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -// 02111-1307, USA. -// - -// Sound control menu - -#include - -#include "textscreen.h" - -#include "compatibility.h" - -int vanilla_savegame_limit = 1; -int vanilla_demo_limit = 1; - -void CompatibilitySettings(void) -{ - txt_window_t *window; - - window = TXT_NewWindow("Compatibility"); - - TXT_AddWidgets(window, - TXT_NewCheckBox("Vanilla savegame limit", - &vanilla_savegame_limit), - TXT_NewCheckBox("Vanilla demo limit", - &vanilla_demo_limit), - NULL); -} - diff --git a/setup/compatibility.h b/setup/compatibility.h deleted file mode 100644 index 1d46b174..00000000 --- a/setup/compatibility.h +++ /dev/null @@ -1,31 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// Copyright(C) 2006 Simon Howard -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -// 02111-1307, USA. -// - -#ifndef SETUP_COMPATIBILITY_H -#define SETUP_COMPATIBILITY_H - -extern int vanilla_savegame_limit; -extern int vanilla_demo_limit; - -void CompatibilitySettings(void); - -#endif /* #ifndef SETUP_COMPATIBILITY_H */ - diff --git a/setup/configfile.c b/setup/configfile.c deleted file mode 100644 index 3f75d7f1..00000000 --- a/setup/configfile.c +++ /dev/null @@ -1,599 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// Copyright(C) 1993-1996 Id Software, Inc. -// Copyright(C) 2005 Simon Howard -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -// 02111-1307, USA. -// -// -// DESCRIPTION: -// Configuration file load/save code. -// -//----------------------------------------------------------------------------- - - -#include -#include -#include -#include - -// for mkdir: - -#ifdef _WIN32 -#include -#else -#include -#include -#endif - -#include "config.h" - -#include "doomfeatures.h" -#include "doomkeys.h" -#include "doomtype.h" -#include "d_englsh.h" - -#include "m_argv.h" - -#include "compatibility.h" -#include "display.h" -#include "joystick.h" -#include "keyboard.h" -#include "mouse.h" -#include "multiplayer.h" -#include "sound.h" - -char *configdir; - -// -// Create a directory -// - -void M_MakeDirectory(char *path) -{ -#ifdef _WIN32 - mkdir(path); -#else - mkdir(path, 0755); -#endif -} - - -// -// SetConfigDir: -// -// Sets the location of the configuration directory, where configuration -// files are stored - default.cfg, chocolate-doom.cfg, savegames, etc. -// - -void M_SetConfigDir(void) -{ -#ifndef _WIN32 - // Ignore the HOME environment variable on Windows - just behave - // like Vanilla Doom. - - char *homedir; - - homedir = getenv("HOME"); - - if (homedir != NULL) - { - // put all configuration in a config directory off the - // homedir - - configdir = malloc(strlen(homedir) + strlen(PACKAGE_TARNAME) + 5); - - sprintf(configdir, "%s/.%s/", homedir, PACKAGE_TARNAME); - - // make the directory if it doesnt already exist - - M_MakeDirectory(configdir); - } - else -#endif /* #ifndef _WIN32 */ - { -#ifdef _WIN32 - // when given the -cdrom option, save config+savegames in - // c:\doomdata. This only applies under Windows. - - if (M_CheckParm("-cdrom") > 0) - { - printf(D_CDROM); - configdir = strdup("c:\\doomdata\\"); - - M_MakeDirectory(configdir); - } - else -#endif - { - configdir = strdup(""); - } - } -} - - - -// -// DEFAULTS -// - -// These are options that are not controlled by setup. - -static int showMessages = 1; -static int screenblocks = 9; -static int detailLevel = 0; -static int usegamma = 0; - -// dos specific options: these are unused but should be maintained -// so that the config file can be shared between chocolate -// doom and doom.exe - -static int snd_sbport = 0; -static int snd_sbirq = 0; -static int snd_sbdma = 0; -static int snd_mport = 0; - -typedef enum -{ - DEFAULT_INT, - DEFAULT_STRING, - DEFAULT_FLOAT, - DEFAULT_KEY, -} default_type_t; - -typedef struct -{ - // Name of the variable - char * name; - - // Pointer to the location in memory of the variable - void * location; - - // Type of the variable - default_type_t type; - - // If this is a key value, the original integer scancode we read from - // the config file before translating it to the internal key value. - // If zero, we didn't read this value from a config file. - int untranslated; - - // The value we translated the scancode into when we read the - // config file on startup. If the variable value is different from - // this, it has been changed and needs to be converted; otherwise, - // use the 'untranslated' value. - int original_translated; -} default_t; - -typedef struct -{ - default_t *defaults; - int numdefaults; - char *filename; -} default_collection_t; - -static default_t doom_defaults_list[] = -{ - {"mouse_sensitivity", &mouseSensitivity, DEFAULT_INT, 0, 0}, - {"sfx_volume",&sfxVolume, DEFAULT_INT, 0, 0}, - {"music_volume",&musicVolume, DEFAULT_INT, 0, 0}, - {"show_messages",&showMessages, DEFAULT_INT, 0, 0}, - - {"key_right",&key_right, DEFAULT_KEY, 0, 0}, - {"key_left",&key_left, DEFAULT_KEY, 0, 0}, - {"key_up",&key_up, DEFAULT_KEY, 0, 0}, - {"key_down",&key_down, DEFAULT_KEY, 0, 0}, - {"key_strafeleft",&key_strafeleft, DEFAULT_KEY, 0, 0}, - {"key_straferight",&key_straferight, DEFAULT_KEY, 0, 0}, - - {"key_fire",&key_fire, DEFAULT_KEY, 0, 0}, - {"key_use",&key_use, DEFAULT_KEY, 0, 0}, - {"key_strafe",&key_strafe, DEFAULT_KEY, 0, 0}, - {"key_speed",&key_speed, DEFAULT_KEY, 0, 0}, - - {"use_mouse",&usemouse, DEFAULT_INT, 0, 0}, - {"mouseb_fire",&mousebfire, DEFAULT_INT, 0, 0}, - {"mouseb_strafe",&mousebstrafe, DEFAULT_INT, 0, 0}, - {"mouseb_forward",&mousebforward, DEFAULT_INT, 0, 0}, - - {"use_joystick",&usejoystick, DEFAULT_INT, 0, 0}, - {"joyb_fire",&joybfire, DEFAULT_INT, 0, 0}, - {"joyb_strafe",&joybstrafe, DEFAULT_INT, 0, 0}, - {"joyb_use",&joybuse, DEFAULT_INT, 0, 0}, - {"joyb_speed",&joybspeed, DEFAULT_INT, 0, 0}, - - {"screenblocks",&screenblocks, DEFAULT_INT, 0, 0}, - {"detaillevel",&detailLevel, DEFAULT_INT, 0, 0}, - - {"snd_channels",&numChannels, DEFAULT_INT, 0, 0}, - - {"snd_musicdevice", &snd_musicdevice, DEFAULT_INT, 0, 0}, - {"snd_sfxdevice", &snd_sfxdevice, DEFAULT_INT, 0, 0}, - {"snd_sbport", &snd_sbport, DEFAULT_INT, 0, 0}, - {"snd_sbirq", &snd_sbirq, DEFAULT_INT, 0, 0}, - {"snd_sbdma", &snd_sbdma, DEFAULT_INT, 0, 0}, - {"snd_mport", &snd_mport, DEFAULT_INT, 0, 0}, - - {"usegamma", &usegamma, DEFAULT_INT, 0, 0}, - - {"chatmacro0", &chat_macros[0], DEFAULT_STRING, 0, 0 }, - {"chatmacro1", &chat_macros[1], DEFAULT_STRING, 0, 0 }, - {"chatmacro2", &chat_macros[2], DEFAULT_STRING, 0, 0 }, - {"chatmacro3", &chat_macros[3], DEFAULT_STRING, 0, 0 }, - {"chatmacro4", &chat_macros[4], DEFAULT_STRING, 0, 0 }, - {"chatmacro5", &chat_macros[5], DEFAULT_STRING, 0, 0 }, - {"chatmacro6", &chat_macros[6], DEFAULT_STRING, 0, 0 }, - {"chatmacro7", &chat_macros[7], DEFAULT_STRING, 0, 0 }, - {"chatmacro8", &chat_macros[8], DEFAULT_STRING, 0, 0 }, - {"chatmacro9", &chat_macros[9], DEFAULT_STRING, 0, 0 }, -}; - -static default_collection_t doom_defaults = -{ - doom_defaults_list, - arrlen(doom_defaults_list), - NULL, -}; - -static default_t extra_defaults_list[] = -{ - {"autoadjust_video_settings", &autoadjust_video_settings, DEFAULT_INT, 0, 0}, - {"fullscreen", &fullscreen, DEFAULT_INT, 0, 0}, - {"aspect_ratio_correct", &aspect_ratio_correct, DEFAULT_INT, 0, 0}, - {"startup_delay", &startup_delay, DEFAULT_INT, 0, 0}, - {"screen_width", &screen_width, DEFAULT_INT, 0, 0}, - {"screen_height", &screen_height, DEFAULT_INT, 0, 0}, - {"grabmouse", &grabmouse, DEFAULT_INT, 0, 0}, - {"novert", &novert, DEFAULT_INT, 0, 0}, - {"mouse_acceleration", &mouse_acceleration, DEFAULT_FLOAT, 0, 0}, - {"mouse_threshold", &mouse_threshold, DEFAULT_INT, 0, 0}, - {"snd_samplerate", &snd_samplerate, DEFAULT_INT, 0, 0}, - {"show_endoom", &show_endoom, DEFAULT_INT, 0, 0}, - {"vanilla_savegame_limit", &vanilla_savegame_limit, DEFAULT_INT, 0, 0}, - {"vanilla_demo_limit", &vanilla_demo_limit, DEFAULT_INT, 0, 0}, - {"vanilla_keyboard_mapping", &vanilla_keyboard_mapping, DEFAULT_INT, 0, 0}, -#ifdef FEATURE_MULTIPLAYER - {"player_name", &net_player_name, DEFAULT_STRING, 0, 0}, -#endif - {"video_driver", &video_driver, DEFAULT_STRING, 0, 0}, - {"joystick_index", &joystick_index, DEFAULT_INT, 0, 0}, - {"joystick_x_axis", &joystick_x_axis, DEFAULT_INT, 0, 0}, - {"joystick_x_invert", &joystick_x_invert, DEFAULT_INT, 0, 0}, - {"joystick_y_axis", &joystick_y_axis, DEFAULT_INT, 0, 0}, - {"joystick_y_invert", &joystick_y_invert, DEFAULT_INT, 0, 0}, - {"joyb_strafeleft", &joybstrafeleft, DEFAULT_INT, 0, 0}, - {"joyb_straferight", &joybstraferight, DEFAULT_INT, 0, 0}, - {"dclick_use", &dclick_use, DEFAULT_INT, 0, 0}, - {"mouseb_strafeleft", &mousebstrafeleft, DEFAULT_INT, 0, 0}, - {"mouseb_straferight", &mousebstraferight, DEFAULT_INT, 0, 0}, - {"mouseb_use", &mousebuse, DEFAULT_INT, 0, 0}, - {"mouseb_backward", &mousebbackward, DEFAULT_INT, 0, 0}, - {"use_libsamplerate", &use_libsamplerate, DEFAULT_INT, 0, 0}, -}; - -static default_collection_t extra_defaults = -{ - extra_defaults_list, - arrlen(extra_defaults_list), - NULL, -}; - -static int scantokey[128] = -{ - 0 , 27, '1', '2', '3', '4', '5', '6', - '7', '8', '9', '0', '-', '=', KEY_BACKSPACE, 9, - 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', - 'o', 'p', '[', ']', 13, KEY_RCTRL, 'a', 's', - 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', - '\'', '`', KEY_RSHIFT,'\\', 'z', 'x', 'c', 'v', - 'b', 'n', 'm', ',', '.', '/', KEY_RSHIFT,KEYP_MULTIPLY, - KEY_RALT, ' ', KEY_CAPSLOCK,KEY_F1, KEY_F2, KEY_F3, KEY_F4, KEY_F5, - KEY_F6, KEY_F7, KEY_F8, KEY_F9, KEY_F10, KEY_PAUSE,KEY_SCRLCK,KEY_HOME, - KEY_UPARROW,KEY_PGUP,KEYP_MINUS,KEY_LEFTARROW,KEYP_5,KEY_RIGHTARROW,KEYP_PLUS,KEY_END, - KEY_DOWNARROW,KEY_PGDN,KEY_INS,KEY_DEL,0, 0, 0, KEY_F11, - KEY_F12, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 -}; - - -static void SaveDefaultCollection(default_collection_t *collection) -{ - default_t *defaults; - int i, v; - FILE *f; - - f = fopen (collection->filename, "w"); - if (!f) - return; // can't write the file, but don't complain - - defaults = collection->defaults; - - for (i=0 ; inumdefaults ; i++) - { - int chars_written; - - // Print the name and line up all values at 30 characters - - chars_written = fprintf(f, "%s ", defaults[i].name); - - for (; chars_written < 30; ++chars_written) - fprintf(f, " "); - - // Print the value - - switch (defaults[i].type) - { - case DEFAULT_KEY: - - // use the untranslated version if we can, to reduce - // the possibility of screwing up the user's config - // file - - v = * (int *) defaults[i].location; - - if (defaults[i].untranslated - && v == defaults[i].original_translated) - { - // Has not been changed since the last time we - // read the config file. - - v = defaults[i].untranslated; - } - else - { - // search for a reverse mapping back to a scancode - // in the scantokey table - - int s; - - for (s=0; s<128; ++s) - { - if (scantokey[s] == v) - { - v = s; - break; - } - } - } - - fprintf(f, "%i", v); - break; - - case DEFAULT_INT: - fprintf(f, "%i", * (int *) defaults[i].location); - break; - - case DEFAULT_FLOAT: - fprintf(f, "%f", * (float *) defaults[i].location); - break; - - case DEFAULT_STRING: - fprintf(f,"\"%s\"", * (char **) (defaults[i].location)); - break; - } - - fprintf(f, "\n"); - } - - fclose (f); -} - -// Parses integer values in the configuration file - -static int ParseIntParameter(char *strparm) -{ - int parm; - - if (strparm[0] == '0' && strparm[1] == 'x') - sscanf(strparm+2, "%x", &parm); - else - sscanf(strparm, "%i", &parm); - - return parm; -} - -static void LoadDefaultCollection(default_collection_t *collection) -{ - default_t *defaults = collection->defaults; - int i; - FILE* f; - char defname[80]; - char strparm[100]; - - // read the file in, overriding any set defaults - f = fopen(collection->filename, "r"); - - if (!f) - { - // File not opened, but don't complain - - return; - } - - while (!feof(f)) - { - if (fscanf (f, "%79s %[^\n]\n", defname, strparm) != 2) - { - // This line doesn't match - - continue; - } - - // Strip off trailing non-printable characters (\r characters - // from DOS text files) - - while (strlen(strparm) > 0 && !isprint(strparm[strlen(strparm)-1])) - { - strparm[strlen(strparm)-1] = '\0'; - } - - // Find the setting in the list - - for (i=0; inumdefaults; ++i) - { - default_t *def = &collection->defaults[i]; - char *s; - int intparm; - - if (strcmp(defname, def->name) != 0) - { - // not this one - continue; - } - - // parameter found - - switch (def->type) - { - case DEFAULT_STRING: - s = strdup(strparm + 1); - s[strlen(s) - 1] = '\0'; - * (char **) def->location = s; - break; - - case DEFAULT_INT: - * (int *) def->location = ParseIntParameter(strparm); - break; - - case DEFAULT_KEY: - - // translate scancodes read from config - // file (save the old value in untranslated) - - intparm = ParseIntParameter(strparm); - defaults[i].untranslated = intparm; - intparm = scantokey[intparm]; - - defaults[i].original_translated = intparm; - * (int *) def->location = intparm; - break; - - case DEFAULT_FLOAT: - * (float *) def->location = atof(strparm); - break; - } - - // finish - - break; - } - } - - fclose (f); -} - -// -// M_SaveDefaults -// - -void M_SaveDefaults (void) -{ - SaveDefaultCollection(&doom_defaults); - SaveDefaultCollection(&extra_defaults); -} - - -// -// M_LoadDefaults -// - -void M_LoadDefaults (void) -{ - int i; - - // check for a custom default file - i = M_CheckParm ("-config"); - - if (i && i - -#include "textscreen.h" - -#include "display.h" - -typedef struct -{ - int w, h; -} screen_mode_t; - -// List of aspect ratio-uncorrected modes - -static screen_mode_t screen_modes_unscaled[] = -{ - { 320, 200 }, - { 640, 400 }, - { 960, 600 }, - { 1280, 800 }, - { 1600, 1000 }, - { 0, 0}, -}; - -// List of aspect ratio-corrected modes - -static screen_mode_t screen_modes_scaled[] = -{ - { 256, 200 }, - { 320, 240 }, - { 512, 400 }, - { 640, 480 }, - { 800, 600 }, - { 960, 720 }, - { 1024, 800 }, - { 1280, 960 }, - { 1280, 1000 }, - { 1600, 1200 }, - { 0, 0}, -}; - -// List of fullscreen modes generated at runtime - -static screen_mode_t *screen_modes_fullscreen = NULL; - -static int vidmode = 0; - -char *video_driver = ""; -int autoadjust_video_settings = 1; -int aspect_ratio_correct = 1; -int fullscreen = 1; -int screen_width = 320; -int screen_height = 200; -int startup_delay = 1000; -int show_endoom = 1; - -// These are the last screen width/height values that were chosen by the -// user. These are used when finding the "nearest" mode, so when -// changing the fullscreen / aspect ratio options, the setting does not -// jump around. - -static int selected_screen_width = 0, selected_screen_height; - -static int system_video_env_set; - -// Set the SDL_VIDEODRIVER environment variable - -void SetDisplayDriver(void) -{ - static int first_time = 1; - - if (first_time) - { - system_video_env_set = getenv("SDL_VIDEODRIVER") != NULL; - - first_time = 0; - } - - // Don't override the command line environment, if it has been set. - - if (system_video_env_set) - { - return; - } - - // Use the value from the configuration file, if it has been set. - - if (strcmp(video_driver, "") != 0) - { - char *env_string; - - env_string = malloc(strlen(video_driver) + 30); - sprintf(env_string, "SDL_VIDEODRIVER=%s", video_driver); - putenv(env_string); - free(env_string); - } - else - { -#ifdef _WIN32 - // On Windows, use DirectX over windib by default. - - putenv("SDL_VIDEODRIVER=directx"); -#endif - } -} - -static void ModeSelected(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(mode)) -{ - TXT_CAST_ARG(screen_mode_t, mode); - - screen_width = mode->w; - screen_height = mode->h; - - // This is now the most recently selected screen width - - selected_screen_width = screen_width; - selected_screen_height = screen_height; -} - -static int GoodFullscreenMode(screen_mode_t *mode) -{ - int w, h; - - w = mode->w; - h = mode->h; - - // 320x200 and 640x400 are always good (special case) - - if ((w == 320 && h == 200) || (w == 640 && h == 400)) - { - return 1; - } - - // Special case: 320x240 letterboxed mode is okay (but not aspect - // ratio corrected 320x240) - - if (w == 320 && h == 240 && !aspect_ratio_correct) - { - return 1; - } - - // Ignore all modes less than 640x480 - - return w >= 640 && h >= 480; -} - -// Build screen_modes_fullscreen - -static void BuildFullscreenModesList(void) -{ - SDL_Rect **modes; - screen_mode_t *m1; - screen_mode_t *m2; - screen_mode_t m; - int num_modes; - int i; - - // Free the existing modes list, if one exists - - if (screen_modes_fullscreen != NULL) - { - free(screen_modes_fullscreen); - } - - // Get a list of fullscreen modes and find out how many - // modes are in the list. - - modes = SDL_ListModes(NULL, SDL_FULLSCREEN); - - for (num_modes=0; modes[num_modes] != NULL; ++num_modes); - - // Build the screen_modes_fullscreen array - - screen_modes_fullscreen = malloc(sizeof(screen_mode_t) * (num_modes + 1)); - - for (i=0; iw; - screen_modes_fullscreen[i].h = modes[i]->h; - } - - screen_modes_fullscreen[i].w = 0; - screen_modes_fullscreen[i].h = 0; - - // Reverse the order of the modes list (smallest modes first) - - for (i=0; i -#include -#include -#include - -#include - -#ifndef _WIN32 - #include - #include -#else - #include -#endif - -#include "textscreen.h" - -#include "config.h" -#include "configfile.h" -#include "execute.h" -#include "m_argv.h" - -#ifdef _WIN32 -#define DOOM_BINARY PACKAGE_TARNAME ".exe" -#else -#define DOOM_BINARY INSTALL_DIR "/" PACKAGE_TARNAME -#endif - -#ifdef _WIN32 -#define DIR_SEPARATOR '\\' -#define PATH_SEPARATOR ';' -#else -#define DIR_SEPARATOR '/' -#define PATH_SEPARATOR ':' -#endif - -struct execute_context_s -{ - char *response_file; - FILE *stream; -}; - -// Returns the path to a temporary file of the given name, stored -// inside the system temporary directory. - -static char *TempFile(char *s) -{ - char *result; - char *tempdir; - -#ifdef _WIN32 - - // Check the TEMP environment variable to find the location. - - tempdir = getenv("TEMP"); - - if (tempdir == NULL) - { - tempdir = "."; - } -#else - // In Unix, just use /tmp. - - tempdir = "/tmp"; -#endif - - result = malloc(strlen(tempdir) + strlen(s) + 2); - sprintf(result, "%s%c%s", tempdir, DIR_SEPARATOR, s); - - return result; -} - -execute_context_t *NewExecuteContext(void) -{ - execute_context_t *result; - - result = malloc(sizeof(execute_context_t)); - - result->response_file = TempFile("chocolat.rsp"); - result->stream = fopen(result->response_file, "w"); - - if (result->stream == NULL) - { - fprintf(stderr, "Error opening response file\n"); - exit(-1); - } - - return result; -} - -void AddConfigParameters(execute_context_t *context) -{ - int p; - - p = M_CheckParm("-config"); - - if (p > 0) - { - AddCmdLineParameter(context, "-config \"%s\"", myargv[p + 1]); - } - - p = M_CheckParm("-extraconfig"); - - if (p > 0) - { - AddCmdLineParameter(context, "-extraconfig \"%s\"", myargv[p + 1]); - } -} - -void AddCmdLineParameter(execute_context_t *context, char *s, ...) -{ - va_list args; - - va_start(args, s); - - vfprintf(context->stream, s, args); - fprintf(context->stream, "\n"); -} - -#ifdef _WIN32 - -static int ExecuteCommand(const char **argv) -{ - return _spawnv(_P_WAIT, argv[0], argv); -} - -#else - -static int ExecuteCommand(const char **argv) -{ - pid_t childpid; - int result; - - childpid = fork(); - - if (childpid == 0) - { - // This is the child. Execute the command. - - execv(argv[0], (char **) argv); - - exit(-1); - } - else - { - // This is the parent. Wait for the child to finish, and return - // the status code. - - waitpid(childpid, &result, 0); - - if (WIFEXITED(result)) - { - return WEXITSTATUS(result); - } - else - { - return -1; - } - } -} - -#endif - -int ExecuteDoom(execute_context_t *context) -{ - const char *argv[3]; - char *response_file_arg; - int result; - - fclose(context->stream); - - // Build the command line - - response_file_arg = malloc(strlen(context->response_file) + 2); - sprintf(response_file_arg, "@%s", context->response_file); - - argv[0] = DOOM_BINARY; - argv[1] = response_file_arg; - argv[2] = NULL; - - // Run Doom - - result = ExecuteCommand(argv); - - free(response_file_arg); - - // Destroy context - remove(context->response_file); - free(context->response_file); - free(context); - - return result; -} - -static void TestCallback(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(data)) -{ - execute_context_t *exec; - char *main_cfg; - char *extra_cfg; - txt_window_t *testwindow; - txt_label_t *label; - - testwindow = TXT_NewWindow("Starting Doom"); - - label = TXT_NewLabel("Starting Doom to test the\n" - "settings. Please wait."); - TXT_SetWidgetAlign(label, TXT_HORIZ_CENTER); - TXT_AddWidget(testwindow, label); - TXT_DrawDesktop(); - - // Save temporary configuration files with the current configuration - - main_cfg = TempFile("tmp.cfg"); - extra_cfg = TempFile("extratmp.cfg"); - - M_SaveMainDefaults(main_cfg); - M_SaveExtraDefaults(extra_cfg); - - // Run with the -testcontrols parameter - - exec = NewExecuteContext(); - AddCmdLineParameter(exec, "-testcontrols"); - AddCmdLineParameter(exec, "-config %s", main_cfg); - AddCmdLineParameter(exec, "-extraconfig %s", extra_cfg); - ExecuteDoom(exec); - - TXT_CloseWindow(testwindow); - - // Delete the temporary config files - - remove(main_cfg); - remove(extra_cfg); - free(main_cfg); - free(extra_cfg); -} - -txt_window_action_t *TestConfigAction(void) -{ - txt_window_action_t *test_action; - - test_action = TXT_NewWindowAction('t', "Test"); - TXT_SignalConnect(test_action, "pressed", TestCallback, NULL); - - return test_action; -} - -// Invokes Doom to find which IWADs are installed. -// This is a cheap hack to avoid duplication of the complicated install -// path searching code inside Doom. - -int FindInstalledIWADs(void) -{ - execute_context_t *context; - int result; - - context = NewExecuteContext(); - AddCmdLineParameter(context, "-findiwads"); - result = ExecuteDoom(context); - - if (result < 0) - { - return 0; - } - else - { - return result; - } -} - diff --git a/setup/execute.h b/setup/execute.h deleted file mode 100644 index 24711a16..00000000 --- a/setup/execute.h +++ /dev/null @@ -1,45 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// Copyright(C) 2006 Simon Howard -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -// 02111-1307, USA. -// - -#ifndef TESTCONFIG_H -#define TESTCONFIG_H - -#include "textscreen.h" - -typedef struct execute_context_s execute_context_t; - -#define IWAD_DOOM2 (1 << 0) /* doom2.wad */ -#define IWAD_PLUTONIA (1 << 1) /* plutonia.wad */ -#define IWAD_TNT (1 << 2) /* tnt.wad */ -#define IWAD_DOOM (1 << 3) /* doom.wad */ -#define IWAD_DOOM1 (1 << 4) /* doom1.wad */ -#define IWAD_CHEX (1 << 5) /* chex.wad */ - -execute_context_t *NewExecuteContext(void); -void AddCmdLineParameter(execute_context_t *context, char *s, ...); -void AddConfigParameters(execute_context_t *context); -int ExecuteDoom(execute_context_t *context); -int FindInstalledIWADs(void); - -txt_window_action_t *TestConfigAction(void); - -#endif /* #ifndef TESTCONFIG_H */ - diff --git a/setup/joystick.c b/setup/joystick.c deleted file mode 100644 index 69c0e508..00000000 --- a/setup/joystick.c +++ /dev/null @@ -1,440 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// Copyright(C) 2007 Simon Howard -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -// 02111-1307, USA. -// - -#include -#include - -#include "doomtype.h" -#include "textscreen.h" -#include "txt_joybinput.h" - -#include "joystick.h" - -typedef enum -{ - CALIBRATE_CENTER, - CALIBRATE_LEFT, - CALIBRATE_UP, -} calibration_stage_t; - -// SDL joystick successfully initialised? - -static int joystick_initted = 0; - -// Joystick enable/disable - -int usejoystick = 0; - -// Button mappings - -int joybfire = 0; -int joybstrafe = 1; -int joybuse = 2; -int joybspeed = 3; -int joybstrafeleft = -1; -int joybstraferight = -1; - -// Joystick to use, as an SDL joystick index: - -int joystick_index = -1; - -// Which joystick axis to use for horizontal movement, and whether to -// invert the direction: - -int joystick_x_axis = 0; -int joystick_x_invert = 0; - -// Which joystick axis to use for vertical movement, and whether to -// invert the direction: - -int joystick_y_axis = 1; -int joystick_y_invert = 0; - -static txt_button_t *joystick_button; - -static int *all_joystick_buttons[] = { - &joybstraferight, &joybstrafeleft, &joybfire, &joybspeed, - &joybuse, &joybstrafe, -}; - -// -// Calibration -// - -static txt_window_t *calibration_window; -static txt_label_t *calibration_label; -static calibration_stage_t calibrate_stage; -static SDL_Joystick **all_joysticks = NULL; - -// Set the label showing the name of the currently selected joystick - -static void SetJoystickButtonLabel(void) -{ - char *name; - - name = "None set"; - - if (joystick_initted - && joystick_index >= 0 && joystick_index < SDL_NumJoysticks()) - { - name = (char *) SDL_JoystickName(joystick_index); - } - - TXT_SetButtonLabel(joystick_button, name); -} - -// Try to open all joysticks visible to SDL. - -static int OpenAllJoysticks(void) -{ - int i; - int num_joysticks; - int result; - - if (!joystick_initted) - { - return 0; - } - - // SDL_JoystickOpen() all joysticks. - - num_joysticks = SDL_NumJoysticks(); - - all_joysticks = malloc(sizeof(SDL_Joystick *) * num_joysticks); - - result = 0; - - for (i=0; i best_value) - { - best_value = abs(axis_value); - best_invert = axis_value > 0; - best_axis = i; - } - } - - // Save the best values we have found - - *axis_index = best_axis; - *axis_invert = best_invert; -} - -static int CalibrationEventCallback(SDL_Event *event, void *user_data) -{ - if (event->type == SDL_JOYBUTTONDOWN - && (joystick_index == -1 || event->jbutton.which == joystick_index)) - { - switch (calibrate_stage) - { - case CALIBRATE_CENTER: - // Centering stage selects which joystick to use. - joystick_index = event->jbutton.which; - break; - - case CALIBRATE_LEFT: - CalibrateAxis(&joystick_x_axis, &joystick_x_invert); - break; - - case CALIBRATE_UP: - CalibrateAxis(&joystick_y_axis, &joystick_y_invert); - break; - } - - if (calibrate_stage == CALIBRATE_UP) - { - // Final stage; close the window - - TXT_CloseWindow(calibration_window); - } - else - { - // Advance to the next calibration stage - - ++calibrate_stage; - SetCalibrationLabel(); - } - - return 1; - } - - return 0; -} - -static void NoJoystick(void) -{ - txt_window_t *window; - - window = TXT_NewWindow(NULL); - - TXT_AddWidget(window, - TXT_NewLabel("No joysticks could be opened.\n\n" - "Try configuring your joystick from within\n" - "your OS first.")); - - TXT_SetWindowAction(window, TXT_HORIZ_LEFT, NULL); - TXT_SetWindowAction(window, TXT_HORIZ_CENTER, - TXT_NewWindowEscapeAction(window)); - TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, NULL); - - joystick_index = -1; - SetJoystickButtonLabel(); -} - -static void CalibrateWindowClosed(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(unused)) -{ - CloseAllJoysticks(); - TXT_SDL_SetEventCallback(NULL, NULL); - SetJoystickButtonLabel(); -} - -static void CalibrateJoystick(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(unused)) -{ - calibrate_stage = CALIBRATE_CENTER; - - // Try to open all available joysticks. If none are opened successfully, - // bomb out with an error. - - if (!OpenAllJoysticks()) - { - NoJoystick(); - return; - } - - calibration_window = TXT_NewWindow("Joystick calibration"); - - TXT_AddWidgets(calibration_window, - TXT_NewLabel("Please follow the following instructions\n" - "in order to calibrate your joystick."), - TXT_NewStrut(0, 1), - calibration_label = TXT_NewLabel("zzz"), - TXT_NewStrut(0, 1), - NULL); - - TXT_SetWindowAction(calibration_window, TXT_HORIZ_LEFT, NULL); - TXT_SetWindowAction(calibration_window, TXT_HORIZ_CENTER, - TXT_NewWindowAbortAction(calibration_window)); - TXT_SetWindowAction(calibration_window, TXT_HORIZ_RIGHT, NULL); - - TXT_SetWidgetAlign(calibration_label, TXT_HORIZ_CENTER); - TXT_SDL_SetEventCallback(CalibrationEventCallback, NULL); - - TXT_SignalConnect(calibration_window, "closed", CalibrateWindowClosed, NULL); - - // Start calibration - - joystick_index = -1; - calibrate_stage = CALIBRATE_CENTER; - - SetCalibrationLabel(); -} - -void JoyButtonSetCallback(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(variable)) -{ - TXT_CAST_ARG(int, variable); - unsigned int i; - - // Only allow a button to be bound to one action at a time. If - // we assign a key that another action is using, set that other action - // to -1. - - for (i=0; i= 0; - } - - window = TXT_NewWindow("Joystick configuration"); - - TXT_AddWidgets(window, - TXT_NewCheckBox("Enable joystick", &usejoystick), - joystick_table = TXT_NewTable(2), - TXT_NewSeparator("Joystick buttons"), - button_table = TXT_NewTable(2), - NULL); - - TXT_SetColumnWidths(joystick_table, 20, 15); - - TXT_AddWidgets(joystick_table, - TXT_NewLabel("Current joystick"), - joystick_button = TXT_NewButton("zzzz"), - NULL); - - TXT_SetColumnWidths(button_table, 20, 15); - - AddJoystickControl(button_table, "Fire", &joybfire); - AddJoystickControl(button_table, "Use", &joybuse); - - // High values of joybspeed are used to activate the "always run mode" - // trick in Vanilla Doom. If this has been enabled, not only is the - // joybspeed value meaningless, but the control itself is useless. - - if (joybspeed < 20) - { - AddJoystickControl(button_table, "Speed", &joybspeed); - } - - AddJoystickControl(button_table, "Strafe", &joybstrafe); - - AddJoystickControl(button_table, "Strafe Left", &joybstrafeleft); - AddJoystickControl(button_table, "Strafe Right", &joybstraferight); - - TXT_SignalConnect(joystick_button, "pressed", CalibrateJoystick, NULL); - TXT_SignalConnect(window, "closed", JoystickWindowClosed, NULL); - - SetJoystickButtonLabel(); -} - diff --git a/setup/joystick.h b/setup/joystick.h deleted file mode 100644 index 39cf0bf4..00000000 --- a/setup/joystick.h +++ /dev/null @@ -1,42 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// Copyright(C) 2006 Simon Howard -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -// 02111-1307, USA. -// - -#ifndef SETUP_JOYSTICK_H -#define SETUP_JOYSTICK_H - -extern int usejoystick; -extern int joybfire; -extern int joybstrafe; -extern int joybuse; -extern int joybspeed; -extern int joybstrafeleft; -extern int joybstraferight; - -extern int joystick_index; -extern int joystick_x_axis; -extern int joystick_x_invert; -extern int joystick_y_axis; -extern int joystick_y_invert; - -void ConfigJoystick(void); - -#endif /* #ifndef SETUP_JOYSTICK_H */ - diff --git a/setup/keyboard.c b/setup/keyboard.c deleted file mode 100644 index 3a7ccb8f..00000000 --- a/setup/keyboard.c +++ /dev/null @@ -1,143 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// Copyright(C) 2006 Simon Howard -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -// 02111-1307, USA. -// -#include "textscreen.h" -#include "doomtype.h" - -#include "execute.h" -#include "txt_keyinput.h" - -#include "joystick.h" -#include "keyboard.h" - -int key_left = KEY_LEFTARROW; -int key_right = KEY_RIGHTARROW; -int key_up = KEY_UPARROW; -int key_down = KEY_DOWNARROW; -int key_strafeleft = ','; -int key_straferight = '.'; -int key_fire = KEY_RCTRL; -int key_use = ' '; -int key_strafe = KEY_RALT; -int key_speed = KEY_RSHIFT; - -int vanilla_keyboard_mapping = 1; - -static int always_run = 0; - -static int *allkeys[] = {&key_left, &key_right, &key_up, &key_down, - &key_strafeleft, &key_straferight, &key_fire, - &key_use, &key_strafe, &key_speed}; - -static void UpdateJoybSpeed(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(var)) -{ - if (always_run) - { - /* - if you want to pick one for chocolate doom to use, - pick 29, since that is the most universal one that - also works with heretic, hexen and strife =P - - NB. This choice also works with original, ultimate and final exes. - */ - - joybspeed = 29; - } - else - { - joybspeed = 0; - } -} - -// Callback invoked when a key control is set - -static void KeySetCallback(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(variable)) -{ - TXT_CAST_ARG(int, variable); - unsigned int i; - - for (i=0; i= 20; - - window = TXT_NewWindow("Keyboard configuration"); - - TXT_AddWidgets(window, - TXT_NewSeparator("Movement"), - movement_table = TXT_NewTable(2), - - TXT_NewSeparator("Action"), - action_table = TXT_NewTable(2), - - TXT_NewSeparator("Misc."), - run_control = TXT_NewCheckBox("Always run", &always_run), - TXT_NewInvertedCheckBox("Use native keyboard mapping", - &vanilla_keyboard_mapping), - NULL); - - TXT_SetColumnWidths(movement_table, 20, 8); - - TXT_SignalConnect(run_control, "changed", UpdateJoybSpeed, NULL); - - AddKeyControl(movement_table, "Move Forward", &key_up); - AddKeyControl(movement_table, "Move Backward", &key_down); - AddKeyControl(movement_table, "Turn Left", &key_left); - AddKeyControl(movement_table, "Turn Right", &key_right); - AddKeyControl(movement_table, "Strafe Left", &key_strafeleft); - AddKeyControl(movement_table, "Strafe Right", &key_straferight); - AddKeyControl(movement_table, "Speed On", &key_speed); - AddKeyControl(movement_table, "Strafe On", &key_strafe); - - TXT_SetColumnWidths(action_table, 20, 8); - - AddKeyControl(action_table, "Use", &key_use); - AddKeyControl(action_table, "Fire", &key_fire); - - TXT_SetWindowAction(window, TXT_HORIZ_CENTER, TestConfigAction()); -} - diff --git a/setup/keyboard.h b/setup/keyboard.h deleted file mode 100644 index 6442e1e4..00000000 --- a/setup/keyboard.h +++ /dev/null @@ -1,41 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// Copyright(C) 2006 Simon Howard -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -// 02111-1307, USA. -// - -#ifndef SETUP_KEYBOARD_H -#define SETUP_KEYBOARD_H - -extern int key_left; -extern int key_right; -extern int key_up; -extern int key_down; -extern int key_strafeleft; -extern int key_straferight; -extern int key_fire; -extern int key_use; -extern int key_strafe; -extern int key_speed; -extern int joybspeed; -extern int vanilla_keyboard_mapping; - -void ConfigKeyboard(void); - -#endif /* #ifndef SETUP_KEYBOARD_H */ - diff --git a/setup/m_argv.c b/setup/m_argv.c deleted file mode 100644 index ae9ab917..00000000 --- a/setup/m_argv.c +++ /dev/null @@ -1,65 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// Copyright(C) 1993-1996 Id Software, Inc. -// Copyright(C) 2005 Simon Howard -// Copyright(C) 2008 "GhostlyDeath" (ghostlydeath@gmail.com) -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -// 02111-1307, USA. -// -// DESCRIPTION: -// -//----------------------------------------------------------------------------- - - - -#include - -int myargc; -char** myargv; - -// From doomdef.h -- no need to include it all! -#ifdef _WIN32 -#define snprintf _snprintf -#define vsnprintf _vsnprintf -#define strcasecmp stricmp -#define strncasecmp strnicmp -#else -#include -#endif - -// -// M_CheckParm -// Checks for the given parameter -// in the program's command line arguments. -// Returns the argument number (1 to argc-1) -// or 0 if not present -int M_CheckParm (char *check) -{ - int i; - - for (i = 1;i - -#include "config.h" -#include "textscreen.h" - -#include "execute.h" - -#include "configfile.h" -#include "m_argv.h" - -#include "setup_icon.c" - -#include "compatibility.h" -#include "display.h" -#include "joystick.h" -#include "keyboard.h" -#include "mouse.h" -#include "multiplayer.h" -#include "sound.h" - -static void DoQuit(void *widget, void *dosave) -{ - if (dosave != NULL) - { - M_SaveDefaults(); - } - - exit(0); -} - -static void QuitConfirm(void *unused1, void *unused2) -{ - txt_window_t *window; - txt_label_t *label; - txt_button_t *yes_button; - txt_button_t *no_button; - - window = TXT_NewWindow(NULL); - - TXT_AddWidgets(window, - label = TXT_NewLabel("Exiting setup.\nSave settings?"), - TXT_NewStrut(24, 0), - yes_button = TXT_NewButton2(" Yes ", DoQuit, DoQuit), - no_button = TXT_NewButton2(" No ", DoQuit, NULL), - NULL); - - TXT_SetWidgetAlign(label, TXT_HORIZ_CENTER); - TXT_SetWidgetAlign(yes_button, TXT_HORIZ_CENTER); - TXT_SetWidgetAlign(no_button, TXT_HORIZ_CENTER); - - // Only an "abort" button in the middle. - TXT_SetWindowAction(window, TXT_HORIZ_LEFT, NULL); - TXT_SetWindowAction(window, TXT_HORIZ_CENTER, - TXT_NewWindowAbortAction(window)); - TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, NULL); -} - -static void LaunchDoom(void *unused1, void *unused2) -{ - execute_context_t *exec; - - // Save configuration first - - M_SaveDefaults(); - - // Shut down textscreen GUI - - TXT_Shutdown(); - - // Launch Doom - - exec = NewExecuteContext(); - AddConfigParameters(exec); - ExecuteDoom(exec); - - exit(0); -} - -void MainMenu(void) -{ - txt_window_t *window; - txt_window_action_t *quit_action; - - window = TXT_NewWindow("Main Menu"); - - TXT_AddWidgets(window, - TXT_NewButton2("Configure Display", - (TxtWidgetSignalFunc) ConfigDisplay, NULL), - TXT_NewButton2("Configure Joystick", - (TxtWidgetSignalFunc) ConfigJoystick, NULL), - TXT_NewButton2("Configure Keyboard", - (TxtWidgetSignalFunc) ConfigKeyboard, NULL), - TXT_NewButton2("Configure Mouse", - (TxtWidgetSignalFunc) ConfigMouse, NULL), - TXT_NewButton2("Configure Sound", - (TxtWidgetSignalFunc) ConfigSound, NULL), - TXT_NewButton2("Compatibility", - (TxtWidgetSignalFunc) CompatibilitySettings, NULL), - TXT_NewButton2("Save parameters and launch DOOM", LaunchDoom, NULL), - TXT_NewStrut(0, 1), - TXT_NewButton2("Start a Network Game", - (TxtWidgetSignalFunc) StartMultiGame, NULL), - TXT_NewButton2("Join a Network Game", - (TxtWidgetSignalFunc) JoinMultiGame, NULL), - TXT_NewButton2("Multiplayer Configuration", - (TxtWidgetSignalFunc) MultiplayerConfig, NULL), - NULL); - - quit_action = TXT_NewWindowAction(KEY_ESCAPE, "Quit"); - TXT_SignalConnect(quit_action, "pressed", QuitConfirm, NULL); - TXT_SetWindowAction(window, TXT_HORIZ_LEFT, quit_action); -} - -// -// Initialise all configuration variables, load config file, etc -// - -static void InitConfig(void) -{ - SetChatMacroDefaults(); - SetPlayerNameDefault(); - - M_SetConfigDir(); - M_LoadDefaults(); -} - -// -// Application icon -// - -static void SetIcon(void) -{ - SDL_Surface *surface; - Uint8 *mask; - int i; - - // Generate the mask - - mask = malloc(setup_icon_w * setup_icon_h / 8); - memset(mask, 0, setup_icon_w * setup_icon_h / 8); - - for (i=0; i - -#include "textscreen.h" -#include "doomtype.h" - -#include "execute.h" -#include "txt_mouseinput.h" - -#include "mouse.h" - -int usemouse = 1; - -int novert = 0; -int mouseSensitivity = 5; -float mouse_acceleration = 1.0; -int mouse_threshold = 10; -int grabmouse = 1; - -int mousebfire = 0; -int mousebforward = 1; -int mousebstrafe = 2; -int mousebstrafeleft = -1; -int mousebstraferight = -1; -int mousebbackward = -1; -int mousebuse = -1; - -int dclick_use = 1; - -static int *all_mouse_buttons[] = { - &mousebfire, - &mousebstrafe, - &mousebforward, - &mousebstrafeleft, - &mousebstraferight, - &mousebbackward, - &mousebuse, -}; - -static void MouseSetCallback(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(variable)) -{ - TXT_CAST_ARG(int, variable); - unsigned int i; - - // Check if the same mouse button is used for a different action - // If so, set the other action(s) to -1 (unset) - - for (i=0; i -#include -#include - -#include "d_englsh.h" -#include "textscreen.h" -#include "doomtype.h" - -#include "configfile.h" - -#include "execute.h" - -#include "multiplayer.h" - -#define NUM_WADS 10 -#define NUM_EXTRA_PARAMS 10 - -typedef struct -{ - char *filename; - char *description; - int mask; -} iwad_t; - -typedef enum -{ - WARP_DOOM1, - WARP_DOOM2, -} warptype_t; - -static iwad_t iwads[] = -{ - { "doom.wad", "Doom", IWAD_DOOM }, - { "doom2.wad", "Doom 2", IWAD_DOOM2 }, - { "tnt.wad", "Final Doom: TNT: Evilution", IWAD_TNT }, - { "plutonia.wad", "Final Doom: The Plutonia Experiment", IWAD_PLUTONIA }, - { "doom1.wad", "Doom shareware", IWAD_DOOM1 }, - { "chex.wad", "Chex Quest", IWAD_CHEX }, -}; - -// Array of IWADs found to be installed - -static char *found_iwads[6]; - -// Index of the currently selected IWAD - -static int found_iwad_selected; - -// Filename to pass to '-iwad'. - -static char *iwadfile; - -static char *skills[] = -{ - "I'm too young to die!", - "Hey, not too rough.", - "Hurt me plenty.", - "Ultra-violence", - "NIGHTMARE!", -}; - -static char *chex_skills[] = -{ - "Easy does it", - "Not so sticky", - "Gobs of goo", - "Extreme ooze", - "SUPER SLIMEY!" -}; - -static char *gamemodes[] = -{ - "Co-operative", - "Deathmatch", - "Deathmatch 2.0", -}; - -char *net_player_name; -char *chat_macros[10]; - -static char *wads[NUM_WADS]; -static char *extra_params[NUM_EXTRA_PARAMS]; -static int skill = 2; -static int nomonsters = 0; -static int deathmatch = 0; -static int fast = 0; -static int respawn = 0; -static int udpport = 2342; -static int timer = 0; - -static txt_dropdown_list_t *skillbutton; -static txt_button_t *warpbutton; -static warptype_t warptype = WARP_DOOM2; -static int warpepisode = 1; -static int warpmap = 1; - -// Address to connect to when joining a game - -static char *connect_address = NULL; - -// Find an IWAD from its description - -static iwad_t *GetIWADForDescription(char *description) -{ - unsigned int i; - - for (i=0; i 0) - { - if (!have_wads) - { - AddCmdLineParameter(exec, "-file"); - } - - AddCmdLineParameter(exec, "\"%s\"", wads[i]); - } - } -} - -static void AddExtraParameters(execute_context_t *exec) -{ - int i; - - for (i=0; i 0) - { - AddCmdLineParameter(exec, extra_params[i]); - } - } -} - -static void AddIWADParameter(execute_context_t *exec) -{ - if (iwadfile != NULL) - { - AddCmdLineParameter(exec, "-iwad %s", iwadfile); - } -} - -static void StartGame(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(user_data)) -{ - execute_context_t *exec; - - exec = NewExecuteContext(); - - // Extra parameters come first, before all others; this way, - // they can override any of the options set in the dialog. - - AddExtraParameters(exec); - - AddIWADParameter(exec); - AddCmdLineParameter(exec, "-server"); - AddCmdLineParameter(exec, "-skill %i", skill + 1); - - if (nomonsters) - { - AddCmdLineParameter(exec, "-nomonsters"); - } - - if (fast) - { - AddCmdLineParameter(exec, "-fast"); - } - - if (respawn) - { - AddCmdLineParameter(exec, "-respawn"); - } - - if (deathmatch == 1) - { - AddCmdLineParameter(exec, "-deathmatch"); - } - else if (deathmatch == 2) - { - AddCmdLineParameter(exec, "-altdeath"); - } - - if (timer > 0) - { - AddCmdLineParameter(exec, "-timer %i", timer); - } - - if (warptype == WARP_DOOM1) - { - // TODO: select IWAD based on warp type - AddCmdLineParameter(exec, "-warp %i %i", warpepisode, warpmap); - } - else if (warptype == WARP_DOOM2) - { - AddCmdLineParameter(exec, "-warp %i", warpmap); - } - - AddCmdLineParameter(exec, "-port %i", udpport); - - AddWADs(exec); - - TXT_Shutdown(); - - M_SaveDefaults(); - AddConfigParameters(exec); - - ExecuteDoom(exec); - - exit(0); -} - -static void UpdateWarpButton(void) -{ - char buf[10]; - - if (warptype == WARP_DOOM1) - { - sprintf(buf, "E%iM%i", warpepisode, warpmap); - } - else if (warptype == WARP_DOOM2) - { - sprintf(buf, "MAP%02i", warpmap); - } - - TXT_SetButtonLabel(warpbutton, buf); -} - -static void UpdateSkillButton(void) -{ - iwad_t *iwad = GetCurrentIWAD(); - - if (iwad->mask == IWAD_CHEX) - { - skillbutton->values = chex_skills; - } - else - { - skillbutton->values = skills; - } -} - -static void SetDoom1Warp(TXT_UNCAST_ARG(widget), void *val) -{ - int l; - - l = (int) val; - - warpepisode = l / 10; - warpmap = l % 10; - - UpdateWarpButton(); -} - -static void SetDoom2Warp(TXT_UNCAST_ARG(widget), void *val) -{ - int l; - - l = (int) val; - - warpmap = l; - - UpdateWarpButton(); -} - -static void CloseLevelSelectDialog(TXT_UNCAST_ARG(button), TXT_UNCAST_ARG(window)) -{ - TXT_CAST_ARG(txt_window_t, window); - - TXT_CloseWindow(window); -} - -static void LevelSelectDialog(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(user_data)) -{ - txt_window_t *window; - txt_table_t *table; - txt_button_t *button; - iwad_t *iwad; - char buf[10]; - int x, y; - int l; - int i; - - window = TXT_NewWindow("Select level"); - - table = TXT_NewTable(4); - - TXT_AddWidget(window, table); - - if (warptype == WARP_DOOM1) - { - // ExMy levels - - iwad = GetCurrentIWAD(); - - for (i=0; i<4 * 9; ++i) - { - x = (i % 4) + 1; - y = (i / 4) + 1; - - // chex.wad only has E1M1-E1M5. - - if (iwad->mask == IWAD_CHEX && (x > 1 || y > 5)) - { - continue; - } - - // doom1.wad only has E1 - - if (iwad->mask == IWAD_DOOM1 && x > 1) - { - continue; - } - - sprintf(buf, " E%iM%i ", x, y); - button = TXT_NewButton(buf); - TXT_SignalConnect(button, "pressed", - SetDoom1Warp, (void *) (x * 10 + y)); - TXT_SignalConnect(button, "pressed", - CloseLevelSelectDialog, window); - TXT_AddWidget(table, button); - - if (warpepisode == x && warpmap == y) - { - TXT_SelectWidget(table, button); - } - } - } - else - { - for (i=0; i<32; ++i) - { - x = i % 4; - y = i / 4; - - l = x * 8 + y + 1; - - sprintf(buf, " MAP%02i ", l); - button = TXT_NewButton(buf); - TXT_SignalConnect(button, "pressed", - SetDoom2Warp, (void *) l); - TXT_SignalConnect(button, "pressed", - CloseLevelSelectDialog, window); - TXT_AddWidget(table, button); - - if (warpmap == l) - { - TXT_SelectWidget(table, button); - } - } - } -} - -static void IWADSelected(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(unused)) -{ - iwad_t *iwad; - - // Find the iwad_t selected - - iwad = GetCurrentIWAD(); - - // Update iwadfile - - iwadfile = iwad->filename; -} - -// Called when the IWAD button is changed, to update warptype. - -static void UpdateWarpType(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(unused)) -{ - warptype_t new_warptype; - iwad_t *iwad; - - // Get the selected IWAD - - iwad = GetIWADForDescription(found_iwads[found_iwad_selected]); - - // Find the new warp type - - if (iwad->mask & (IWAD_DOOM | IWAD_DOOM1 | IWAD_CHEX)) - { - new_warptype = WARP_DOOM1; - } - else - { - new_warptype = WARP_DOOM2; - } - - // Reset to E1M1 / MAP01 when the warp type is changed. - - if (new_warptype != warptype) - { - warpepisode = 1; - warpmap = 1; - } - - warptype = new_warptype; - - UpdateWarpButton(); - UpdateSkillButton(); -} - -static txt_widget_t *IWADSelector(void) -{ - txt_dropdown_list_t *dropdown; - txt_widget_t *result; - int installed_iwads; - int num_iwads; - unsigned int i; - - // Find out what WADs are installed - - installed_iwads = FindInstalledIWADs(); - - // Build a list of the descriptions for all installed IWADs - - num_iwads = 0; - - for (i=0; i - - - - - - - - - - - - - diff --git a/setup/setup-res.rc.in b/setup/setup-res.rc.in deleted file mode 100644 index dc25135a..00000000 --- a/setup/setup-res.rc.in +++ /dev/null @@ -1,24 +0,0 @@ -1 ICON "../data/setup.ico" - -CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "setup-manifest.xml" - -1 VERSIONINFO -PRODUCTVERSION @WINDOWS_RC_VERSION@ -FILEVERSION @WINDOWS_RC_VERSION@ -FILETYPE 1 -{ - BLOCK "StringFileInfo" - { - BLOCK "040904E4" - { - VALUE "FileVersion", "@PACKAGE_VERSION@" - VALUE "FileDescription", "@PACKAGE_STRING@ Setup" - VALUE "InternalName", "@PACKAGE_TARNAME@" - VALUE "CompanyName", "@PACKAGE_BUGREPORT@" - VALUE "LegalCopyright", "GNU General Public License" - VALUE "ProductName", "@PACKAGE_NAME@ Setup" - VALUE "ProductVersion", "@PACKAGE_VERSION@" - } - } -} - diff --git a/setup/setup_icon.c b/setup/setup_icon.c deleted file mode 100644 index 1c18c56f..00000000 --- a/setup/setup_icon.c +++ /dev/null @@ -1,262 +0,0 @@ -static int setup_icon_w = 32; -static int setup_icon_h = 32; - -static unsigned char setup_icon_data[] = { - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0xa2,0x86,0x73, - 0xa9,0x8d,0x7a, 0xbc,0x9f,0x8c, 0xda,0xba,0xa0, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0xbe,0x8e,0x68, 0xd7,0xb9,0xa5, 0xeb,0xd8,0xcd, 0xd3,0xbf,0xae, - 0xbe,0xa1,0x8d, 0xeb,0xd8,0xcd, 0xc2,0x9d,0x86, 0x95,0x5d,0x38, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x78,0x7a,0x77, 0x78,0x7a,0x77, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x78,0x7a,0x77, 0x78,0x7a,0x77, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x9f,0x82,0x6a, - 0xc5,0x9e,0x81, 0xd1,0xb2,0x98, 0xd4,0xac,0x8e, 0xeb,0xd8,0xcd, - 0xc4,0x9b,0x79, 0xad,0x71,0x45, 0xd4,0xac,0x8e, 0xb9,0x93,0x76, - 0xa1,0x75,0x56, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x78,0x7a,0x77, 0x6d,0x6f,0x6c, 0xcb,0xce,0xca, - 0x51,0x52,0x50, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x5b,0x5d,0x5a, - 0xca,0xcc,0xc9, 0x77,0x79,0x76, 0x78,0x7a,0x77, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0xda,0xb4,0x9c, 0xd3,0xa3,0x83, - 0xaf,0x91,0x78, 0xa7,0x83,0x6d, 0xc4,0xa7,0x93, 0xee,0xe2,0xd5, - 0xeb,0xd8,0xcd, 0x8c,0x60,0x3d, 0x92,0x6f,0x59, 0xd0,0xa7,0x84, - 0x84,0x54,0x33, 0xba,0x83,0x5b, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x78,0x7a,0x77, 0xa0,0xa2,0x9f, 0xdf,0xe1,0xde, - 0x58,0x5a,0x58, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x64,0x65,0x63, - 0xdd,0xdf,0xdc, 0xa8,0xaa,0xa7, 0x78,0x7a,0x77, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0xd4,0xb5,0x9b, 0xc3,0x8c,0x63, 0xc4,0x94,0x6e, - 0x98,0x66,0x45, 0x78,0x50,0x2d, 0xd7,0xb9,0xa5, 0xee,0xdc,0xd1, - 0xc4,0x9b,0x79, 0xb6,0x80,0x58, 0x65,0x45,0x26, 0xb6,0x79,0x4d, - 0xcf,0xa5,0x83, 0x9a,0x6e,0x50, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x82,0x83,0x81, 0xbb,0xbd,0xba, 0xde,0xe0,0xdd, - 0x58,0x5a,0x58, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x64,0x65,0x63, - 0xdc,0xde,0xdb, 0xc4,0xc6,0xc3, 0x78,0x7a,0x77, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x9e,0x7b,0x65, 0xbc,0x8c,0x67, 0xaa,0x7d,0x5e, 0xa1,0x75,0x56, - 0x89,0x5f,0x41, 0xc4,0xa7,0x93, 0xb7,0x88,0x63, 0x90,0x6c,0x51, - 0x79,0x4b,0x2b, 0x8c,0x5b,0x34, 0x76,0x4e,0x31, 0x7f,0x50,0x30, - 0xcf,0xa5,0x83, 0xd4,0xac,0x8e, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x77,0x79,0x76, 0xd2,0xd4,0xd1, 0xde,0xe0,0xdd, - 0x64,0x65,0x63, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x68,0x69,0x67, - 0xdb,0xdd,0xda, 0xda,0xdc,0xd9, 0x78,0x7a,0x77, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0xd8,0xb8,0x9e, - 0xd4,0xac,0x8e, 0xc5,0x9e,0x81, 0xab,0x7e,0x5f, 0x9c,0x6f,0x4b, - 0xbe,0xa1,0x8d, 0x8c,0x60,0x3d, 0x6e,0x47,0x2b, 0x87,0x5e,0x40, - 0x5a,0x3b,0x23, 0x68,0x42,0x26, 0x65,0x40,0x23, 0x53,0x36,0x22, - 0x7e,0x55,0x38, 0xce,0x9f,0x7e, 0xc3,0x8c,0x63, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x77,0x79,0x76, 0xe1,0xe4,0xe0, 0xe1,0xe4,0xe0, - 0xc4,0xc6,0xc3, 0x83,0x85,0x82, 0x8c,0x8d,0x8a, 0xd2,0xd4,0xd1, - 0xee,0xdc,0xd1, 0xe1,0xe4,0xe0, 0x78,0x7a,0x77, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0xcb,0x9a,0x74, - 0xb6,0x80,0x58, 0x8c,0x60,0x3d, 0x76,0x4e,0x31, 0x88,0x57,0x31, - 0x83,0x53,0x33, 0x84,0x54,0x33, 0x95,0x5d,0x38, 0x79,0x4b,0x2b, - 0x5c,0x38,0x22, 0x84,0x54,0x33, 0x55,0x37,0x1e, 0x96,0x6b,0x4d, - 0xb4,0x7f,0x5c, 0xba,0x83,0x5b, 0xb8,0x7b,0x4f, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x9a,0x9b,0x98, 0xd9,0xdb,0xd7, - 0xe1,0xe4,0xe0, 0xde,0xe0,0xdd, 0xdd,0xdf,0xdc, 0xe0,0xe2,0xdf, - 0xda,0xdc,0xd9, 0xa3,0xa5,0xa1, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0xc0,0x89,0x60, - 0x89,0x5f,0x41, 0x84,0x54,0x33, 0x84,0x54,0x33, 0x8a,0x5a,0x39, - 0x8f,0x5d,0x37, 0x78,0x50,0x2d, 0x8c,0x5b,0x34, 0x5a,0x3b,0x23, - 0x5e,0x3f,0x27, 0x76,0x4e,0x31, 0x97,0x64,0x3d, 0x74,0x4b,0x29, - 0x78,0x50,0x2d, 0x7b,0x4d,0x2c, 0xb6,0x80,0x58, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x64,0x65,0x63, - 0xbe,0xc1,0xbd, 0xee,0xdc,0xd1, 0xe1,0xe4,0xe0, 0xc2,0xc4,0xc1, - 0x68,0x69,0x67, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x95,0x62,0x3b, - 0x84,0x54,0x33, 0x88,0x57,0x31, 0x7e,0x6e,0x64, 0xc4,0x94,0x6e, - 0x76,0x4e,0x31, 0x90,0x6c,0x51, 0xa1,0x7c,0x60, 0x9a,0x6e,0x50, - 0x95,0x5d,0x38, 0xbc,0x7f,0x53, 0xad,0x71,0x45, 0x76,0x4e,0x31, - 0x53,0x36,0x22, 0x4b,0x2f,0x1c, 0x70,0x49,0x2c, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x51,0x52,0x50, 0xd2,0xd4,0xd1, 0xe0,0xe2,0xdf, 0x77,0x79,0x76, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x84,0x54,0x33, - 0xa3,0x86,0x6e, 0xc4,0x94,0x6e, 0x88,0x64,0x44, 0xbc,0x8c,0x67, - 0x9c,0x6f,0x4b, 0xa1,0x6d,0x45, 0x93,0x60,0x3a, 0xad,0x71,0x3f, - 0xb4,0x7f,0x5c, 0xbc,0x8c,0x67, 0xc0,0x89,0x60, 0xb3,0x76,0x4b, - 0xb8,0x7b,0x4f, 0x88,0x64,0x44, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x4a,0x4b,0x49, 0xdc,0xde,0xdb, 0xe1,0xe4,0xe0, 0x79,0x7b,0x78, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0xa7,0x83,0x6d, - 0xac,0x86,0x6a, 0x76,0x4e,0x31, 0x84,0x54,0x33, 0x5c,0x38,0x22, - 0x57,0x38,0x20, 0x6c,0x46,0x29, 0x95,0x62,0x3b, 0xa3,0x6e,0x41, - 0xb3,0x76,0x4b, 0xb8,0x7b,0x4f, 0x9d,0x64,0x3f, 0x7e,0x4f,0x2f, - 0x63,0x3e,0x27, 0x95,0x62,0x3b, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x51,0x52,0x50, 0xdd,0xdf,0xdc, 0xe0,0xe2,0xdf, 0x82,0x83,0x81, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0xb6,0x80,0x58, - 0x98,0x74,0x59, 0x67,0x41,0x25, 0x4b,0x35,0x25, 0x81,0x52,0x31, - 0x76,0x4e,0x31, 0x7b,0x4d,0x2c, 0x7e,0x4f,0x2f, 0x84,0x54,0x33, - 0x8f,0x5d,0x37, 0x95,0x5d,0x38, 0x78,0x50,0x2d, 0x65,0x45,0x26, - 0x65,0x40,0x23, 0x7e,0x4f,0x2f, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x55,0x56,0x54, 0xee,0xdc,0xd1, 0xde,0xe0,0xdd, 0x8c,0x8d,0x8a, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0xb4,0x7f,0x5c, - 0x86,0x56,0x35, 0x8c,0x60,0x3d, 0x89,0x5f,0x41, 0x63,0x44,0x2b, - 0x57,0x38,0x20, 0x86,0x56,0x35, 0x88,0x57,0x31, 0x95,0x5d,0x38, - 0x97,0x64,0x3d, 0x63,0x3e,0x27, 0x50,0x33,0x20, 0x78,0x50,0x2d, - 0x78,0x50,0x2d, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x58,0x5a,0x58, 0xe0,0xe2,0xdf, 0xde,0xe0,0xdd, 0x8c,0x8d,0x8a, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x86,0x56,0x35, 0x63,0x3e,0x27, 0xa8,0x6d,0x42, 0x50,0x33,0x20, - 0x63,0x3e,0x27, 0x74,0x4b,0x29, 0x53,0x36,0x22, 0x78,0x50,0x2d, - 0x42,0x30,0x14, 0x4d,0x3e,0x15, 0x4d,0x3e,0x15, 0x7c,0x5b,0x29, - 0x8a,0x71,0x27, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x64,0x65,0x63, 0xe1,0xe4,0xe0, 0xe1,0xe4,0xe0, 0x91,0x93,0x90, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x6e,0x47,0x2b, 0x65,0x45,0x26, 0x5d,0x42,0x22, 0x65,0x45,0x26, - 0x78,0x50,0x2d, 0x5d,0x42,0x22, 0x5e,0x3f,0x27, 0x4d,0x3e,0x15, - 0x4d,0x3e,0x15, 0x67,0x58,0x21, 0x4f,0x44,0x19, 0x5f,0x51,0x19, - 0x8a,0x76,0x2a, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x68,0x69,0x67, 0xdf,0xe1,0xde, 0xe0,0xe2,0xdf, 0x9a,0x9b,0x98, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x8a,0x71,0x27, 0x53,0x46,0x15, - 0x53,0x46,0x15, 0x67,0x58,0x21, 0x58,0x4c,0x1b, 0x5b,0x4f,0x1d, - 0x5b,0x4f,0x1d, 0x67,0x58,0x21, 0x5b,0x4f,0x1d, 0x8a,0x71,0x27, - 0x8c,0x77,0x24, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x70,0x72,0x6f, 0xe1,0xe4,0xe0, 0xe1,0xe4,0xe0, 0x9a,0x9b,0x98, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0xac,0x93,0x39, 0x7e,0x66,0x23, - 0x69,0x5a,0x1b, 0x6b,0x5b,0x1d, 0x67,0x58,0x21, 0x53,0x46,0x15, - 0x4d,0x3e,0x15, 0x9f,0x88,0x35, 0xb7,0x9c,0x3b, 0xac,0x93,0x39, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x77,0x79,0x76, 0xdf,0xe1,0xde, 0xe0,0xe2,0xdf, 0xa3,0xa5,0xa1, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0xb1,0x97,0x36, 0x6f,0x5f,0x21, - 0x7e,0x66,0x23, 0x8c,0x77,0x24, 0x84,0x70,0x24, 0x78,0x67,0x22, - 0x8e,0x79,0x26, 0x8a,0x71,0x27, 0xb7,0x9c,0x3b, 0x9b,0x84,0x29, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x82,0x83,0x81, 0xe1,0xe4,0xe0, 0xe1,0xe4,0xe0, 0xa8,0xaa,0xa7, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0xac,0x93,0x39, 0x89,0x75,0x29, - 0x7e,0x66,0x23, 0x75,0x64,0x1f, 0x94,0x7e,0x2b, 0x7e,0x66,0x23, - 0x9f,0x88,0x35, 0xb6,0x9d,0x4a, 0xb6,0x9d,0x4a, 0xc4,0xa8,0x3f, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x82,0x83,0x81, 0xe0,0xe2,0xdf, 0xde,0xe0,0xdd, 0xab,0xad,0xaa, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x80,0x6d,0x28, - 0xac,0x93,0x39, 0x97,0x82,0x36, 0xac,0x94,0x41, 0xac,0x93,0x39, - 0x97,0x82,0x36, 0xa2,0x8a,0x30, 0xbd,0xa3,0x48, 0x8a,0x71,0x27, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x77,0x79,0x76, 0xe0,0xe2,0xdf, 0xd8,0xda,0xd6, 0xab,0xad,0xaa, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0xae,0x95,0x33, - 0x7e,0x66,0x23, 0x9f,0x88,0x35, 0x9f,0x88,0x35, 0x7e,0x66,0x23, - 0x8a,0x71,0x27, 0xaf,0x96,0x3c, 0xbd,0xa2,0x41, 0x8a,0x76,0x2a, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x68,0x69,0x67, - 0xc2,0xc4,0xc1, 0xe0,0xe2,0xdf, 0xdf,0xe1,0xde, 0xbe,0xc1,0xbd, - 0x5f,0x61,0x5e, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0xaf,0x96,0x3c, - 0x87,0x73,0x27, 0xb2,0x99,0x3f, 0x6f,0x5f,0x21, 0xa8,0x90,0x36, - 0x97,0x82,0x36, 0x9f,0x88,0x35, 0xb7,0x9c,0x3b, 0x8c,0x77,0x24, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0xa3,0xa5,0xa1, 0xeb,0xd8,0xcd, - 0xe0,0xe2,0xdf, 0xee,0xdc,0xd1, 0xdf,0xe1,0xde, 0xe1,0xe4,0xe0, - 0xda,0xdc,0xd9, 0x9a,0x9b,0x98, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0xb2,0x99,0x3f, - 0xaf,0x96,0x3c, 0x96,0x80,0x2d, 0xbd,0xa3,0x48, 0x97,0x82,0x36, - 0xb6,0x9d,0x4a, 0xb8,0xa0,0x4c, 0xc1,0xa7,0x4c, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x78,0x7a,0x77, 0xdf,0xe1,0xde, 0xe0,0xe2,0xdf, - 0xd2,0xd4,0xd1, 0x8c,0x8d,0x8a, 0x82,0x83,0x81, 0xc7,0xc9,0xc6, - 0xe1,0xe4,0xe0, 0xe1,0xe4,0xe0, 0x78,0x7a,0x77, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x96,0x80,0x2d, 0xb5,0x9c,0x49, 0xb2,0x99,0x3f, 0xb2,0x9a,0x47, - 0xb0,0x97,0x3d, 0xc1,0xa7,0x4c, 0x96,0x80,0x2d, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x78,0x7a,0x77, 0xd9,0xdb,0xd7, 0xda,0xdc,0xd9, - 0x68,0x69,0x67, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x64,0x65,0x63, - 0xdd,0xdf,0xdc, 0xd2,0xd4,0xd1, 0x78,0x7a,0x77, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x9c,0x85,0x2b, 0xaa,0x91,0x2f, 0xb1,0x97,0x36, 0xa2,0x8a,0x30, - 0x7e,0x66,0x23, 0xb1,0x97,0x36, 0xb4,0x99,0x30, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x79,0x7b,0x78, 0xc4,0xc6,0xc3, 0xd9,0xdb,0xd7, - 0x64,0x65,0x63, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x55,0x56,0x54, - 0xdf,0xe1,0xde, 0xbb,0xbd,0xba, 0x78,0x7a,0x77, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x9f,0x88,0x35, 0xb8,0x9e,0x44, 0x8a,0x71,0x27, 0xa6,0x8f,0x3c, - 0xbd,0xa3,0x48, 0x96,0x80,0x2d, 0x9f,0x88,0x35, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x82,0x83,0x81, 0xa8,0xaa,0xa7, 0xdf,0xe1,0xde, - 0x64,0x65,0x63, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x58,0x5a,0x58, - 0xee,0xdc,0xd1, 0xa0,0xa2,0x9f, 0x78,0x7a,0x77, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0xb0,0x97,0x3d, 0xb7,0x9c,0x3b, 0xac,0x94,0x41, 0xb2,0x99,0x3f, - 0xb6,0x9b,0x32, 0xb7,0x9c,0x3b, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x77,0x79,0x76, 0x77,0x79,0x76, 0xca,0xcc,0xc9, - 0x5b,0x5d,0x5a, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x51,0x52,0x50, - 0xcb,0xce,0xca, 0x68,0x69,0x67, 0x79,0x7b,0x78, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0xbd,0xa2,0x41, 0xa6,0x8f,0x3c, 0xb0,0x97,0x3d, 0xb2,0x9a,0x47, - 0xac,0x93,0x39, 0x9f,0x88,0x35, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x77,0x79,0x76, 0x78,0x7a,0x77, - 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, - 0x82,0x83,0x81, 0x79,0x7b,0x78, 0x00,0x00,0x00, 0x00,0x00,0x00, - -}; diff --git a/setup/sound.c b/setup/sound.c deleted file mode 100644 index 72414c83..00000000 --- a/setup/sound.c +++ /dev/null @@ -1,167 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// Copyright(C) 2006 Simon Howard -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -// 02111-1307, USA. -// - -// Sound control menu - -#include - -#include "textscreen.h" - -#include "sound.h" - -enum -{ - SNDDEVICE_NONE = 0, - SNDDEVICE_PCSPEAKER = 1, - SNDDEVICE_ADLIB = 2, - SNDDEVICE_SB = 3, - SNDDEVICE_PAS = 4, - SNDDEVICE_GUS = 5, - SNDDEVICE_WAVEBLASTER = 6, - SNDDEVICE_SOUNDCANVAS = 7, - SNDDEVICE_GENMIDI = 8, - SNDDEVICE_AWE32 = 9, -}; - -typedef enum -{ - SFXMODE_DISABLED, - SFXMODE_PCSPEAKER, - SFXMODE_DIGITAL, - NUM_SFXMODES -} sfxmode_t; - -static char *sfxmode_strings[] = -{ - "Disabled", - "PC speaker", - "Digital", -}; - -// Disable MIDI music on OSX: there are problems with the native -// MIDI code in SDL_mixer. - -#ifdef __MACOSX__ -#define DEFAULT_MUSIC_DEVICE SNDDEVICE_NONE -#else -#define DEFAULT_MUSIC_DEVICE SNDDEVICE_SB -#endif - -int snd_sfxdevice = SNDDEVICE_SB; -int numChannels = 8; -int sfxVolume = 15; - -int snd_musicdevice = DEFAULT_MUSIC_DEVICE; -int musicVolume = 15; - -int snd_samplerate = 22050; - -int use_libsamplerate = 0; - -static int snd_sfxmode; -static int snd_musicenabled; - -static void UpdateSndDevices(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(data)) -{ - switch (snd_sfxmode) - { - case SFXMODE_DISABLED: - snd_sfxdevice = SNDDEVICE_NONE; - break; - case SFXMODE_PCSPEAKER: - snd_sfxdevice = SNDDEVICE_PCSPEAKER; - break; - case SFXMODE_DIGITAL: - snd_sfxdevice = SNDDEVICE_SB; - break; - } - - if (snd_musicenabled) - { - snd_musicdevice = SNDDEVICE_SB; - } - else - { - snd_musicdevice = SNDDEVICE_NONE; - } -} - -void ConfigSound(void) -{ - txt_window_t *window; - txt_table_t *sfx_table; - txt_table_t *music_table; - txt_dropdown_list_t *sfx_mode_control; - txt_checkbox_t *music_enabled_control; - - if (snd_sfxdevice == SNDDEVICE_PCSPEAKER) - { - snd_sfxmode = SFXMODE_PCSPEAKER; - } - else if (snd_sfxdevice >= SNDDEVICE_SB) - { - snd_sfxmode = SFXMODE_DIGITAL; - } - else - { - snd_sfxmode = SFXMODE_DISABLED; - } - - snd_musicenabled = snd_musicdevice != SNDDEVICE_NONE; - - window = TXT_NewWindow("Sound configuration"); - - TXT_AddWidgets(window, - TXT_NewSeparator("Sound effects"), - sfx_table = TXT_NewTable(2), - TXT_NewSeparator("Music"), - music_enabled_control = TXT_NewCheckBox("Music enabled", - &snd_musicenabled), - music_table = TXT_NewTable(2), - NULL); - - TXT_SetColumnWidths(sfx_table, 20, 5); - - TXT_AddWidgets(sfx_table, - TXT_NewLabel("Sound effects"), - sfx_mode_control = TXT_NewDropdownList(&snd_sfxmode, - sfxmode_strings, - NUM_SFXMODES), - TXT_NewLabel("Sound channels"), - TXT_NewSpinControl(&numChannels, 1, 8), - TXT_NewLabel("SFX volume"), - TXT_NewSpinControl(&sfxVolume, 0, 15), - NULL); - - TXT_SetColumnWidths(music_table, 20, 5); - - TXT_AddWidgets(music_table, - TXT_NewLabel("Music volume"), - TXT_NewSpinControl(&musicVolume, 0, 15), - NULL); - - TXT_SignalConnect(sfx_mode_control, "changed", - UpdateSndDevices, NULL); - TXT_SignalConnect(music_enabled_control, "changed", - UpdateSndDevices, NULL); - -} - diff --git a/setup/sound.h b/setup/sound.h deleted file mode 100644 index 170dda0a..00000000 --- a/setup/sound.h +++ /dev/null @@ -1,39 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// Copyright(C) 2006 Simon Howard -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -// 02111-1307, USA. -// - -#ifndef SETUP_SOUND_H -#define SETUP_SOUND_H - -extern int snd_sfxdevice; -extern int numChannels; -extern int sfxVolume; - -extern int snd_musicdevice; -extern int musicVolume; - -extern int snd_samplerate; - -extern int use_libsamplerate; - -void ConfigSound(void); - -#endif /* #ifndef SETUP_SOUND_H */ - diff --git a/setup/txt_joybinput.c b/setup/txt_joybinput.c deleted file mode 100644 index 1e132962..00000000 --- a/setup/txt_joybinput.c +++ /dev/null @@ -1,228 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// Copyright(C) 2006 Simon Howard -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -// 02111-1307, USA. -// - -#include -#include -#include - -#include "SDL_joystick.h" - -#include "doomkeys.h" -#include "joystick.h" - -#include "txt_joybinput.h" -#include "txt_gui.h" -#include "txt_io.h" -#include "txt_label.h" -#include "txt_sdl.h" -#include "txt_window.h" - -#define JOYSTICK_INPUT_WIDTH 10 - -// Called in response to SDL events when the prompt window is open: - -static int EventCallback(SDL_Event *event, TXT_UNCAST_ARG(joystick_input)) -{ - TXT_CAST_ARG(txt_joystick_input_t, joystick_input); - - // Got the joystick button press? - - if (event->type == SDL_JOYBUTTONDOWN) - { - *joystick_input->variable = event->jbutton.button; - TXT_EmitSignal(joystick_input, "set"); - TXT_CloseWindow(joystick_input->prompt_window); - return 1; - } - - return 0; -} - -// When the prompt window is closed, disable the event callback function; -// we are no longer interested in receiving notification of events. - -static void PromptWindowClosed(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(joystick)) -{ - TXT_CAST_ARG(SDL_Joystick, joystick); - - SDL_JoystickClose(joystick); - TXT_SDL_SetEventCallback(NULL, NULL); - SDL_JoystickEventState(SDL_DISABLE); - SDL_QuitSubSystem(SDL_INIT_JOYSTICK); -} - -static void OpenErrorWindow(void) -{ - txt_window_t *window; - - window = TXT_NewWindow(NULL); - - TXT_AddWidget(window, TXT_NewLabel("Please configure a joystick first!")); - - TXT_SetWindowAction(window, TXT_HORIZ_LEFT, NULL); - TXT_SetWindowAction(window, TXT_HORIZ_CENTER, - TXT_NewWindowEscapeAction(window)); - TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, NULL); -} - -static void OpenPromptWindow(txt_joystick_input_t *joystick_input) -{ - txt_window_t *window; - txt_label_t *label; - SDL_Joystick *joystick; - - if (SDL_Init(SDL_INIT_JOYSTICK) < 0) - { - return; - } - - // Check the current joystick is valid - - joystick = SDL_JoystickOpen(joystick_index); - - if (joystick == NULL) - { - OpenErrorWindow(); - return; - } - - // Open the prompt window - - window = TXT_NewWindow(NULL); - TXT_SetWindowAction(window, TXT_HORIZ_LEFT, NULL); - TXT_SetWindowAction(window, TXT_HORIZ_CENTER, - TXT_NewWindowAbortAction(window)); - TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, NULL); - - label = TXT_NewLabel("Press the new joystick button..."); - - TXT_AddWidget(window, label); - TXT_SetWidgetAlign(label, TXT_HORIZ_CENTER); - TXT_SDL_SetEventCallback(EventCallback, joystick_input); - TXT_SignalConnect(window, "closed", PromptWindowClosed, joystick); - joystick_input->prompt_window = window; - - SDL_JoystickEventState(SDL_ENABLE); -} - -static void TXT_JoystickInputSizeCalc(TXT_UNCAST_ARG(joystick_input)) -{ - TXT_CAST_ARG(txt_joystick_input_t, joystick_input); - - // All joystickinputs are the same size. - - joystick_input->widget.w = JOYSTICK_INPUT_WIDTH; - joystick_input->widget.h = 1; -} - -static void GetJoystickButtonDescription(int button, char *buf) -{ - sprintf(buf, "BUTTON #%i", button + 1); -} - -static void TXT_JoystickInputDrawer(TXT_UNCAST_ARG(joystick_input), int selected) -{ - TXT_CAST_ARG(txt_joystick_input_t, joystick_input); - char buf[20]; - int i; - - if (*joystick_input->variable < 0) - { - strcpy(buf, "(none)"); - } - else - { - GetJoystickButtonDescription(*joystick_input->variable, buf); - } - - if (selected) - { - TXT_BGColor(TXT_COLOR_GREY, 0); - } - else - { - TXT_BGColor(TXT_COLOR_BLUE, 0); - } - - TXT_FGColor(TXT_COLOR_BRIGHT_WHITE); - - TXT_DrawString(buf); - - for (i=strlen(buf); ivariable = variable; - - return joystick_input; -} - diff --git a/setup/txt_joybinput.h b/setup/txt_joybinput.h deleted file mode 100644 index b2920b88..00000000 --- a/setup/txt_joybinput.h +++ /dev/null @@ -1,46 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// Copyright(C) 2007 Simon Howard -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -// 02111-1307, USA. -// - -#ifndef TXT_JOYB_INPUT_H -#define TXT_JOYB_INPUT_H - -typedef struct txt_joystick_input_s txt_joystick_input_t; - -#include "txt_widget.h" -#include "txt_window.h" - -// -// A joystick input is like an input box. When selected, a box pops up -// allowing a joystick button to be pressed to select it. -// - -struct txt_joystick_input_s -{ - txt_widget_t widget; - int *variable; - txt_window_t *prompt_window; -}; - -txt_joystick_input_t *TXT_NewJoystickInput(int *variable); - -#endif /* #ifndef TXT_JOYB_INPUT_H */ - - diff --git a/setup/txt_keyinput.c b/setup/txt_keyinput.c deleted file mode 100644 index b7e68f44..00000000 --- a/setup/txt_keyinput.c +++ /dev/null @@ -1,181 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// Copyright(C) 2006 Simon Howard -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -// 02111-1307, USA. -// - -#include -#include - -#include "doomkeys.h" - -#include "txt_keyinput.h" -#include "txt_gui.h" -#include "txt_io.h" -#include "txt_label.h" -#include "txt_window.h" - -#define KEY_INPUT_WIDTH 8 - -static int KeyPressCallback(txt_window_t *window, int key, - TXT_UNCAST_ARG(key_input)) -{ - TXT_CAST_ARG(txt_key_input_t, key_input); - - if (key != KEY_ESCAPE) - { - // Got the key press. Save to the variable and close the window. - - *key_input->variable = key; - TXT_EmitSignal(key_input, "set"); - TXT_CloseWindow(window); - - // Re-enable key mappings now that we have the key - - TXT_EnableKeyMapping(1); - - return 1; - } - else - { - return 0; - } -} - -static void OpenPromptWindow(txt_key_input_t *key_input) -{ - txt_window_t *window; - txt_label_t *label; - - window = TXT_NewWindow(NULL); - TXT_SetWindowAction(window, TXT_HORIZ_LEFT, NULL); - TXT_SetWindowAction(window, TXT_HORIZ_CENTER, - TXT_NewWindowAbortAction(window)); - TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, NULL); - - label = TXT_NewLabel("Press the new key..."); - - TXT_AddWidget(window, label); - TXT_SetWidgetAlign(label, TXT_HORIZ_CENTER); - - TXT_SetKeyListener(window, KeyPressCallback, key_input); - - // Disable key mappings while we prompt for the key press - - TXT_EnableKeyMapping(0); -} - -static void TXT_KeyInputSizeCalc(TXT_UNCAST_ARG(key_input)) -{ - TXT_CAST_ARG(txt_key_input_t, key_input); - - // All keyinputs are the same size. - - key_input->widget.w = KEY_INPUT_WIDTH; - key_input->widget.h = 1; -} - - -static void TXT_KeyInputDrawer(TXT_UNCAST_ARG(key_input), int selected) -{ - TXT_CAST_ARG(txt_key_input_t, key_input); - char buf[20]; - int i; - - if (*key_input->variable == 0) - { - strcpy(buf, ""); - } - else - { - TXT_GetKeyDescription(*key_input->variable, buf); - } - - if (selected) - { - TXT_BGColor(TXT_COLOR_GREY, 0); - } - else - { - TXT_BGColor(TXT_COLOR_BLUE, 0); - } - - TXT_FGColor(TXT_COLOR_BRIGHT_WHITE); - - TXT_DrawString(buf); - - for (i=strlen(buf); ivariable = variable; - - return key_input; -} - diff --git a/setup/txt_keyinput.h b/setup/txt_keyinput.h deleted file mode 100644 index 4952a970..00000000 --- a/setup/txt_keyinput.h +++ /dev/null @@ -1,44 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// Copyright(C) 2006 Simon Howard -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -// 02111-1307, USA. -// - -#ifndef TXT_KEY_INPUT_H -#define TXT_KEY_INPUT_H - -typedef struct txt_key_input_s txt_key_input_t; - -#include "txt_widget.h" - -// -// A key input is like an input box. When selected, a box pops up -// allowing a key to be selected. -// - -struct txt_key_input_s -{ - txt_widget_t widget; - int *variable; -}; - -txt_key_input_t *TXT_NewKeyInput(int *variable); - -#endif /* #ifndef TXT_KEY_INPUT_H */ - - diff --git a/setup/txt_mouseinput.c b/setup/txt_mouseinput.c deleted file mode 100644 index 05c89b39..00000000 --- a/setup/txt_mouseinput.c +++ /dev/null @@ -1,186 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// Copyright(C) 2006 Simon Howard -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -// 02111-1307, USA. -// - -#include -#include -#include - -#include "doomkeys.h" - -#include "txt_mouseinput.h" -#include "txt_gui.h" -#include "txt_io.h" -#include "txt_label.h" -#include "txt_window.h" - -#define MOUSE_INPUT_WIDTH 8 - -static int MousePressCallback(txt_window_t *window, - int x, int y, int b, - TXT_UNCAST_ARG(mouse_input)) -{ - TXT_CAST_ARG(txt_mouse_input_t, mouse_input); - - // Got the mouse press. Save to the variable and close the window. - - *mouse_input->variable = b - TXT_MOUSE_BASE; - TXT_EmitSignal(mouse_input, "set"); - TXT_CloseWindow(window); - - return 1; -} - -static void OpenPromptWindow(txt_mouse_input_t *mouse_input) -{ - txt_window_t *window; - txt_label_t *label; - - window = TXT_NewWindow(NULL); - TXT_SetWindowAction(window, TXT_HORIZ_LEFT, NULL); - TXT_SetWindowAction(window, TXT_HORIZ_CENTER, - TXT_NewWindowAbortAction(window)); - TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, NULL); - - label = TXT_NewLabel("Press the new mouse button..."); - - TXT_AddWidget(window, label); - TXT_SetWidgetAlign(label, TXT_HORIZ_CENTER); - - TXT_SetMouseListener(window, MousePressCallback, mouse_input); -} - -static void TXT_MouseInputSizeCalc(TXT_UNCAST_ARG(mouse_input)) -{ - TXT_CAST_ARG(txt_mouse_input_t, mouse_input); - - // All mouseinputs are the same size. - - mouse_input->widget.w = MOUSE_INPUT_WIDTH; - mouse_input->widget.h = 1; -} - -static void GetMouseButtonDescription(int button, char *buf) -{ - switch (button) - { - case 0: - strcpy(buf, "LEFT"); - break; - case 1: - strcpy(buf, "RIGHT"); - break; - case 2: - strcpy(buf, "MID"); - break; - default: - sprintf(buf, "BUTTON #%i", button); - break; - } -} - -static void TXT_MouseInputDrawer(TXT_UNCAST_ARG(mouse_input), int selected) -{ - TXT_CAST_ARG(txt_mouse_input_t, mouse_input); - char buf[20]; - int i; - - if (*mouse_input->variable < 0) - { - strcpy(buf, "(none)"); - } - else - { - GetMouseButtonDescription(*mouse_input->variable, buf); - } - - if (selected) - { - TXT_BGColor(TXT_COLOR_GREY, 0); - } - else - { - TXT_BGColor(TXT_COLOR_BLUE, 0); - } - - TXT_FGColor(TXT_COLOR_BRIGHT_WHITE); - - TXT_DrawString(buf); - - for (i=strlen(buf); ivariable = variable; - - return mouse_input; -} - diff --git a/setup/txt_mouseinput.h b/setup/txt_mouseinput.h deleted file mode 100644 index 57c258eb..00000000 --- a/setup/txt_mouseinput.h +++ /dev/null @@ -1,44 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// Copyright(C) 2006 Simon Howard -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -// 02111-1307, USA. -// - -#ifndef TXT_MOUSE_INPUT_H -#define TXT_MOUSE_INPUT_H - -typedef struct txt_mouse_input_s txt_mouse_input_t; - -#include "txt_widget.h" - -// -// A mouse input is like an input box. When selected, a box pops up -// allowing a mouse to be selected. -// - -struct txt_mouse_input_s -{ - txt_widget_t widget; - int *variable; -}; - -txt_mouse_input_t *TXT_NewMouseInput(int *variable); - -#endif /* #ifndef TXT_MOUSE_INPUT_H */ - - diff --git a/src/Makefile.am b/src/Makefile.am index 8f9f11d3..8e1e7544 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,22 +1,30 @@ -SUBDIRS=doom heretic hexen +SUBDIRS=doom heretic hexen setup gamesdir = $(prefix)/games games_PROGRAMS = chocolate-doom \ chocolate-heretic \ chocolate-hexen \ - chocolate-server + chocolate-server \ + chocolate-setup AM_CFLAGS = -Idoom -I../textscreen -I../pcsound @SDL_CFLAGS@ @SDLMIXER_CFLAGS@ @SDLNET_CFLAGS@ +# Common source files used by absolutely everything: + +COMMON_SOURCE_FILES=\ +i_main.c \ +i_system.c i_system.h \ +m_argv.c m_argv.h \ +m_misc.c m_misc.h + +# Dedicated server (chocolate-server): + DEDSERV_FILES=\ d_dedicated.c \ d_mode.c d_mode.h \ -i_main.c \ i_timer.c i_timer.h \ -m_argv.c m_argv.h \ -m_misc.c m_misc.h \ net_common.c net_common.h \ net_dedicated.c net_dedicated.h \ net_io.c net_io.h \ @@ -26,10 +34,12 @@ net_server.c net_server.h \ net_structrw.c net_structrw.h \ z_native.c z_zone.h -chocolate_server_SOURCES=$(DEDSERV_FILES) +chocolate_server_SOURCES=$(COMMON_SOURCE_FILES) $(DEDSERV_FILES) chocolate_server_LDADD = @LDFLAGS@ @SDL_LIBS@ @SDLNET_LIBS@ -MAIN_SOURCE_FILES=\ +# Source files used by the game binaries (chocolate-doom, etc.) + +GAME_SOURCE_FILES=\ d_event.c d_event.h \ doomkeys.h \ doomfeatures.h \ @@ -38,22 +48,19 @@ d_iwad.c d_iwad.h \ d_mode.c d_mode.h \ d_ticcmd.h \ i_cdmus.c i_cdmus.h \ -i_main.c \ +i_endoom.c i_endoom.h \ i_joystick.c i_joystick.h \ i_scale.c i_scale.h \ i_swap.h \ i_sound.c i_sound.h \ -i_system.c i_system.h \ i_timer.c i_timer.h \ i_video.c i_video.h \ i_videohr.c i_videohr.h \ -m_argv.c m_argv.h \ m_bbox.c m_bbox.h \ m_cheat.c m_cheat.h \ m_config.c m_config.h \ m_controls.c m_controls.h \ m_fixed.c m_fixed.h \ -m_misc.c m_misc.h \ md5.c md5.h \ memio.c memio.h \ tables.c tables.h \ @@ -65,7 +72,7 @@ w_file.c w_file.h \ w_file_stdc.c \ w_file_posix.c \ w_file_win32.c \ -z_zone.c z_zone.h +z_zone.c z_zone.h # source files needed for FEATURE_DEHACKED @@ -101,7 +108,8 @@ i_sdlsound.c \ i_sdlmusic.c \ mus2mid.c mus2mid.h -SOURCE_FILES = $(MAIN_SOURCE_FILES) \ +SOURCE_FILES = $(COMMON_SOURCE_FILES) \ + $(GAME_SOURCE_FILES) \ $(FEATURE_DEHACKED_SOURCE_FILES) \ $(FEATURE_WAD_MERGE_SOURCE_FILES) \ $(FEATURE_SOUND_SOURCE_FILES) @@ -138,6 +146,17 @@ endif chocolate_hexen_LDADD = hexen/libhexen.a $(EXTRA_LIBS) +# Source files needed for chocolate-setup: + +SETUP_FILES= \ +m_config.c m_config.h \ +z_native.c z_zone.h + +chocolate_setup_SOURCES=$(SETUP_FILES) $(COMMON_SOURCE_FILES) +chocolate_setup_LDADD = setup/libsetup.a \ + ../textscreen/libtextscreen.a \ + @LDFLAGS@ @SDL_LIBS@ @SDLNET_LIBS@ + EXTRA_DIST = \ icon.c \ doom-screensaver.desktop.in diff --git a/src/d_dedicated.c b/src/d_dedicated.c index 158fa40c..defe8083 100644 --- a/src/d_dedicated.c +++ b/src/d_dedicated.c @@ -43,29 +43,6 @@ void NET_CL_Run(void) // In a standalone dedicated server, we don't have a client. } -// -// I_Error -// -// We have our own I_Error function for the dedicated server. -// The normal one does extra things like shutdown graphics, etc. - -void I_Error (char *error, ...) -{ - va_list argptr; - - // Message first. - va_start(argptr,error); - fprintf(stderr, "Error: "); - vfprintf(stderr,error,argptr); - fprintf(stderr, "\n"); - va_end(argptr); - - fflush(stderr); - - exit(-1); -} - - void D_DoomMain(void) { printf(PACKAGE_NAME " standalone dedicated server\n"); diff --git a/src/doom/d_main.c b/src/doom/d_main.c index 419e871c..91224e88 100644 --- a/src/doom/d_main.c +++ b/src/doom/d_main.c @@ -60,6 +60,8 @@ #include "m_menu.h" #include "p_saveg.h" +#include "i_endoom.h" +#include "i_joystick.h" #include "i_system.h" #include "i_timer.h" #include "i_video.h" @@ -346,7 +348,10 @@ void D_BindVariables(void) { int i; - I_BindVariables(); + I_BindVideoVariables(); + I_BindJoystickVariables(); + I_BindSoundVariables(); + M_BindBaseControls(); #ifdef FEATURE_MULTIPLAYER NET_BindVariables(); @@ -1674,7 +1679,9 @@ void D_DoomMain (void) P_Init (); printf (DEH_String("I_Init: Setting up machine state.\n")); - I_Init (); + I_CheckIsScreensaver(); + I_InitTimer(); + I_InitJoystick(); #ifdef FEATURE_MULTIPLAYER printf ("NET_Init: Initialise network subsystem.\n"); diff --git a/src/heretic/d_main.c b/src/heretic/d_main.c index 2ac92b44..b8edd430 100644 --- a/src/heretic/d_main.c +++ b/src/heretic/d_main.c @@ -34,7 +34,11 @@ #include "ct_chat.h" #include "doomdef.h" #include "d_iwad.h" +#include "i_endoom.h" +#include "i_joystick.h" +#include "i_sound.h" #include "i_system.h" +#include "i_timer.h" #include "i_video.h" #include "m_argv.h" #include "m_config.h" @@ -744,7 +748,9 @@ void D_BindVariables(void) extern int snd_Channels; int i; - I_BindVariables(); + I_BindVideoVariables(); + I_BindJoystickVariables(); + I_BindSoundVariables(); M_BindBaseControls(); M_BindHereticControls(); @@ -975,7 +981,9 @@ void D_DoomMain(void) IncThermo(); tprintf("I_Init: Setting up machine state.\n", 1); - I_Init(); + I_CheckIsScreensaver(); + I_InitTimer(); + I_InitJoystick(); IncThermo(); tprintf("S_Init: Setting up sound.\n", 1); diff --git a/src/hexen/h2_main.c b/src/hexen/h2_main.c index f1d6ca90..f7bc665e 100644 --- a/src/hexen/h2_main.c +++ b/src/hexen/h2_main.c @@ -42,7 +42,9 @@ #include "d_mode.h" #include "m_misc.h" #include "s_sound.h" +#include "i_joystick.h" #include "i_system.h" +#include "i_timer.h" #include "m_argv.h" #include "m_config.h" #include "m_controls.h" @@ -154,7 +156,9 @@ void D_BindVariables(void) { int i; - I_BindVariables(); + I_BindVideoVariables(); + I_BindJoystickVariables(); + I_BindSoundVariables(); M_BindBaseControls(); M_BindHereticControls(); M_BindHexenControls(); @@ -296,7 +300,9 @@ void D_DoomMain(void) ST_Message("SN_InitSequenceScript: Registering sound sequences.\n"); SN_InitSequenceScript(); ST_Message("I_Init: Setting up machine state.\n"); - I_Init(); + I_CheckIsScreensaver(); + I_InitTimer(); + I_InitJoystick(); S_Init(); S_Start(); diff --git a/src/i_endoom.c b/src/i_endoom.c new file mode 100644 index 00000000..b943e47c --- /dev/null +++ b/src/i_endoom.c @@ -0,0 +1,71 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright(C) 2005-8 Simon Howard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// +// DESCRIPTION: +// Exit text-mode ENDOOM screen. +// +//----------------------------------------------------------------------------- + +#include "doomtype.h" +#include "i_video.h" + +#include "txt_main.h" + +// +// Displays the text mode ending screen after the game quits +// + +void I_Endoom(byte *endoom_data) +{ + unsigned char *screendata; + + // Set up text mode screen + + TXT_Init(); + + // Make sure the new window has the right title and icon + + I_SetWindowTitle("Exit screen"); + I_SetWindowIcon(); + + // Write the data to the screen memory + + screendata = TXT_GetScreenData(); + memcpy(screendata, endoom_data, 4000); + + // Wait for a keypress + + while (true) + { + TXT_UpdateScreen(); + + if (TXT_GetChar() >= 0) + { + break; + } + + TXT_Sleep(0); + } + + // Shut down text mode screen + + TXT_Shutdown(); +} + diff --git a/src/i_endoom.h b/src/i_endoom.h new file mode 100644 index 00000000..b4fa34dd --- /dev/null +++ b/src/i_endoom.h @@ -0,0 +1,37 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright(C) 1993-1996 Id Software, Inc. +// Copyright(C) 2005 Simon Howard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// +// DESCRIPTION: +// Exit text-mode ENDOOM screen. +// +//----------------------------------------------------------------------------- + + +#ifndef __I_ENDOOM__ +#define __I_ENDOOM__ + +// Display the Endoom screen on shutdown. Pass a pointer to the +// ENDOOM lump. + +void I_Endoom(byte *data); + +#endif + diff --git a/src/i_system.c b/src/i_system.c index 77c06436..1003075f 100644 --- a/src/i_system.c +++ b/src/i_system.c @@ -51,7 +51,6 @@ #include "i_video.h" #include "i_system.h" -#include "txt_main.h" #include "w_wad.h" #include "z_zone.h" @@ -178,53 +177,21 @@ boolean I_ConsoleStdout(void) // // I_Init // +/* void I_Init (void) { I_CheckIsScreensaver(); I_InitTimer(); I_InitJoystick(); } - -// -// Displays the text mode ending screen after the game quits -// - -void I_Endoom(byte *endoom_data) +void I_BindVariables(void) { - unsigned char *screendata; - - // Set up text mode screen - - TXT_Init(); - - // Make sure the new window has the right title and icon - - I_SetWindowTitle("Exit screen"); - I_SetWindowIcon(); - - // Write the data to the screen memory - - screendata = TXT_GetScreenData(); - memcpy(screendata, endoom_data, 4000); - - // Wait for a keypress - - while (true) - { - TXT_UpdateScreen(); - - if (TXT_GetChar() >= 0) - { - break; - } - - TXT_Sleep(0); - } - - // Shut down text mode screen - - TXT_Shutdown(); + I_BindVideoVariables(); + I_BindJoystickVariables(); + I_BindSoundVariables(); } +*/ + // // I_Quit @@ -247,11 +214,6 @@ void I_Quit (void) exit(0); } -void I_WaitVBL(int count) -{ - I_Sleep((count * 1000) / 70); -} - // // I_Error // @@ -314,10 +276,3 @@ void I_Error (char *error, ...) exit(-1); } -void I_BindVariables(void) -{ - I_BindVideoVariables(); - I_BindJoystickVariables(); - I_BindSoundVariables(); -} - diff --git a/src/i_system.h b/src/i_system.h index 2af3aa33..b34f61e4 100644 --- a/src/i_system.h +++ b/src/i_system.h @@ -80,11 +80,6 @@ void I_AtExit(atexit_func_t func, boolean run_if_error); void I_BindVariables(void); -// Display the Endoom screen on shutdown. Pass a pointer to the -// ENDOOM lump. - -void I_Endoom(byte *data); - // Print startup banner copyright message. void I_PrintStartupBanner(char *gamedescription); diff --git a/src/i_timer.c b/src/i_timer.c index 8ae68b82..ef97b7b7 100644 --- a/src/i_timer.c +++ b/src/i_timer.c @@ -73,6 +73,11 @@ void I_Sleep(int ms) SDL_Delay(ms); } +void I_WaitVBL(int count) +{ + I_Sleep((count * 1000) / 70); +} + void I_InitTimer(void) { diff --git a/src/i_timer.h b/src/i_timer.h index 85816064..17390884 100644 --- a/src/i_timer.h +++ b/src/i_timer.h @@ -43,5 +43,8 @@ void I_Sleep(int ms); // Initialise timer void I_InitTimer(void); +// Wait for vertical retrace or pause a bit. +void I_WaitVBL(int count); + #endif diff --git a/src/i_video.h b/src/i_video.h index 5af31e92..1c668474 100644 --- a/src/i_video.h +++ b/src/i_video.h @@ -85,9 +85,6 @@ void I_SetPalette (byte* palette); void I_UpdateNoBlit (void); void I_FinishUpdate (void); -// Wait for vertical retrace or pause a bit. -void I_WaitVBL(int count); - void I_ReadScreen (byte* scr); void I_BeginRead (void); diff --git a/src/m_config.c b/src/m_config.c index 4f92d09e..a4db1c98 100644 --- a/src/m_config.c +++ b/src/m_config.c @@ -980,6 +980,31 @@ void M_SaveDefaults (void) SaveDefaultCollection(&extra_defaults); } +// +// Save defaults to alternate filenames +// + +void M_SaveDefaultsAlternate(char *main, char *extra) +{ + char *orig_main; + char *orig_extra; + + // Temporarily change the filenames + + orig_main = doom_defaults.filename; + orig_extra = extra_defaults.filename; + + doom_defaults.filename = main; + extra_defaults.filename = extra; + + M_SaveDefaults(); + + // Restore normal filenames + + doom_defaults.filename = orig_main; + extra_defaults.filename = orig_extra; +} + // // M_LoadDefaults // diff --git a/src/m_config.h b/src/m_config.h index 16468b5d..6f2bb894 100644 --- a/src/m_config.h +++ b/src/m_config.h @@ -30,6 +30,7 @@ void M_LoadDefaults(void); void M_SaveDefaults(void); +void M_SaveDefaultsAlternate(char *main, char *extra); void M_SetConfigDir(void); void M_BindVariable(char *name, void *variable); void M_SetConfigFilenames(char *main_config, char *extra_config); diff --git a/src/setup-res.rc.in b/src/setup-res.rc.in new file mode 100644 index 00000000..dc25135a --- /dev/null +++ b/src/setup-res.rc.in @@ -0,0 +1,24 @@ +1 ICON "../data/setup.ico" + +CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "setup-manifest.xml" + +1 VERSIONINFO +PRODUCTVERSION @WINDOWS_RC_VERSION@ +FILEVERSION @WINDOWS_RC_VERSION@ +FILETYPE 1 +{ + BLOCK "StringFileInfo" + { + BLOCK "040904E4" + { + VALUE "FileVersion", "@PACKAGE_VERSION@" + VALUE "FileDescription", "@PACKAGE_STRING@ Setup" + VALUE "InternalName", "@PACKAGE_TARNAME@" + VALUE "CompanyName", "@PACKAGE_BUGREPORT@" + VALUE "LegalCopyright", "GNU General Public License" + VALUE "ProductName", "@PACKAGE_NAME@ Setup" + VALUE "ProductVersion", "@PACKAGE_VERSION@" + } + } +} + diff --git a/src/setup/.gitignore b/src/setup/.gitignore new file mode 100644 index 00000000..e2da8a59 --- /dev/null +++ b/src/setup/.gitignore @@ -0,0 +1,6 @@ +Makefile.in +Makefile +.deps +chocolate-setup +*.rc +*.exe diff --git a/src/setup/Makefile.am b/src/setup/Makefile.am new file mode 100644 index 00000000..6028eab7 --- /dev/null +++ b/src/setup/Makefile.am @@ -0,0 +1,25 @@ + +AM_CFLAGS = @SDL_CFLAGS@ -I../../textscreen -I.. -DINSTALL_DIR="\"$(gamesdir)\"" + +noinst_LIBRARIES = libsetup.a + +SOURCE_FILES = \ + compatibility.c compatibility.h \ + display.c display.h \ + joystick.c joystick.h \ + keyboard.c keyboard.h \ + mainmenu.c \ + mouse.c mouse.h \ + multiplayer.c multiplayer.h \ + sound.c sound.h \ + execute.c execute.h \ + txt_joybinput.c txt_joybinput.h \ + txt_keyinput.c txt_keyinput.h \ + txt_mouseinput.c txt_mouseinput.h + +libsetup_a_SOURCES = $(SOURCE_FILES) + +EXTRA_DIST= \ + setup_icon.c \ + setup-manifest.xml + diff --git a/src/setup/compatibility.c b/src/setup/compatibility.c new file mode 100644 index 00000000..bebf5a87 --- /dev/null +++ b/src/setup/compatibility.c @@ -0,0 +1,46 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright(C) 2006 Simon Howard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// + +// Sound control menu + +#include + +#include "textscreen.h" + +#include "compatibility.h" + +int vanilla_savegame_limit = 1; +int vanilla_demo_limit = 1; + +void CompatibilitySettings(void) +{ + txt_window_t *window; + + window = TXT_NewWindow("Compatibility"); + + TXT_AddWidgets(window, + TXT_NewCheckBox("Vanilla savegame limit", + &vanilla_savegame_limit), + TXT_NewCheckBox("Vanilla demo limit", + &vanilla_demo_limit), + NULL); +} + diff --git a/src/setup/compatibility.h b/src/setup/compatibility.h new file mode 100644 index 00000000..1d46b174 --- /dev/null +++ b/src/setup/compatibility.h @@ -0,0 +1,31 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright(C) 2006 Simon Howard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// + +#ifndef SETUP_COMPATIBILITY_H +#define SETUP_COMPATIBILITY_H + +extern int vanilla_savegame_limit; +extern int vanilla_demo_limit; + +void CompatibilitySettings(void); + +#endif /* #ifndef SETUP_COMPATIBILITY_H */ + diff --git a/src/setup/display.c b/src/setup/display.c new file mode 100644 index 00000000..5e9d4fcf --- /dev/null +++ b/src/setup/display.c @@ -0,0 +1,438 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright(C) 2006 Simon Howard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// + +#include + +#include "textscreen.h" + +#include "display.h" + +typedef struct +{ + int w, h; +} screen_mode_t; + +// List of aspect ratio-uncorrected modes + +static screen_mode_t screen_modes_unscaled[] = +{ + { 320, 200 }, + { 640, 400 }, + { 960, 600 }, + { 1280, 800 }, + { 1600, 1000 }, + { 0, 0}, +}; + +// List of aspect ratio-corrected modes + +static screen_mode_t screen_modes_scaled[] = +{ + { 256, 200 }, + { 320, 240 }, + { 512, 400 }, + { 640, 480 }, + { 800, 600 }, + { 960, 720 }, + { 1024, 800 }, + { 1280, 960 }, + { 1280, 1000 }, + { 1600, 1200 }, + { 0, 0}, +}; + +// List of fullscreen modes generated at runtime + +static screen_mode_t *screen_modes_fullscreen = NULL; + +static int vidmode = 0; + +char *video_driver = ""; +int autoadjust_video_settings = 1; +int aspect_ratio_correct = 1; +int fullscreen = 1; +int screen_width = 320; +int screen_height = 200; +int startup_delay = 1000; +int show_endoom = 1; + +// These are the last screen width/height values that were chosen by the +// user. These are used when finding the "nearest" mode, so when +// changing the fullscreen / aspect ratio options, the setting does not +// jump around. + +static int selected_screen_width = 0, selected_screen_height; + +static int system_video_env_set; + +// Set the SDL_VIDEODRIVER environment variable + +void SetDisplayDriver(void) +{ + static int first_time = 1; + + if (first_time) + { + system_video_env_set = getenv("SDL_VIDEODRIVER") != NULL; + + first_time = 0; + } + + // Don't override the command line environment, if it has been set. + + if (system_video_env_set) + { + return; + } + + // Use the value from the configuration file, if it has been set. + + if (strcmp(video_driver, "") != 0) + { + char *env_string; + + env_string = malloc(strlen(video_driver) + 30); + sprintf(env_string, "SDL_VIDEODRIVER=%s", video_driver); + putenv(env_string); + free(env_string); + } + else + { +#ifdef _WIN32 + // On Windows, use DirectX over windib by default. + + putenv("SDL_VIDEODRIVER=directx"); +#endif + } +} + +static void ModeSelected(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(mode)) +{ + TXT_CAST_ARG(screen_mode_t, mode); + + screen_width = mode->w; + screen_height = mode->h; + + // This is now the most recently selected screen width + + selected_screen_width = screen_width; + selected_screen_height = screen_height; +} + +static int GoodFullscreenMode(screen_mode_t *mode) +{ + int w, h; + + w = mode->w; + h = mode->h; + + // 320x200 and 640x400 are always good (special case) + + if ((w == 320 && h == 200) || (w == 640 && h == 400)) + { + return 1; + } + + // Special case: 320x240 letterboxed mode is okay (but not aspect + // ratio corrected 320x240) + + if (w == 320 && h == 240 && !aspect_ratio_correct) + { + return 1; + } + + // Ignore all modes less than 640x480 + + return w >= 640 && h >= 480; +} + +// Build screen_modes_fullscreen + +static void BuildFullscreenModesList(void) +{ + SDL_Rect **modes; + screen_mode_t *m1; + screen_mode_t *m2; + screen_mode_t m; + int num_modes; + int i; + + // Free the existing modes list, if one exists + + if (screen_modes_fullscreen != NULL) + { + free(screen_modes_fullscreen); + } + + // Get a list of fullscreen modes and find out how many + // modes are in the list. + + modes = SDL_ListModes(NULL, SDL_FULLSCREEN); + + for (num_modes=0; modes[num_modes] != NULL; ++num_modes); + + // Build the screen_modes_fullscreen array + + screen_modes_fullscreen = malloc(sizeof(screen_mode_t) * (num_modes + 1)); + + for (i=0; iw; + screen_modes_fullscreen[i].h = modes[i]->h; + } + + screen_modes_fullscreen[i].w = 0; + screen_modes_fullscreen[i].h = 0; + + // Reverse the order of the modes list (smallest modes first) + + for (i=0; i +#include +#include +#include + +#include + +#ifndef _WIN32 + #include + #include +#else + #include +#endif + +#include "textscreen.h" + +#include "config.h" +#include "execute.h" +#include "m_argv.h" +#include "m_config.h" + +#ifdef _WIN32 +#define DOOM_BINARY PACKAGE_TARNAME ".exe" +#else +#define DOOM_BINARY INSTALL_DIR "/" PACKAGE_TARNAME +#endif + +#ifdef _WIN32 +#define DIR_SEPARATOR '\\' +#define PATH_SEPARATOR ';' +#else +#define DIR_SEPARATOR '/' +#define PATH_SEPARATOR ':' +#endif + +struct execute_context_s +{ + char *response_file; + FILE *stream; +}; + +// Returns the path to a temporary file of the given name, stored +// inside the system temporary directory. + +static char *TempFile(char *s) +{ + char *result; + char *tempdir; + +#ifdef _WIN32 + + // Check the TEMP environment variable to find the location. + + tempdir = getenv("TEMP"); + + if (tempdir == NULL) + { + tempdir = "."; + } +#else + // In Unix, just use /tmp. + + tempdir = "/tmp"; +#endif + + result = malloc(strlen(tempdir) + strlen(s) + 2); + sprintf(result, "%s%c%s", tempdir, DIR_SEPARATOR, s); + + return result; +} + +execute_context_t *NewExecuteContext(void) +{ + execute_context_t *result; + + result = malloc(sizeof(execute_context_t)); + + result->response_file = TempFile("chocolat.rsp"); + result->stream = fopen(result->response_file, "w"); + + if (result->stream == NULL) + { + fprintf(stderr, "Error opening response file\n"); + exit(-1); + } + + return result; +} + +void AddConfigParameters(execute_context_t *context) +{ + int p; + + p = M_CheckParm("-config"); + + if (p > 0) + { + AddCmdLineParameter(context, "-config \"%s\"", myargv[p + 1]); + } + + p = M_CheckParm("-extraconfig"); + + if (p > 0) + { + AddCmdLineParameter(context, "-extraconfig \"%s\"", myargv[p + 1]); + } +} + +void AddCmdLineParameter(execute_context_t *context, char *s, ...) +{ + va_list args; + + va_start(args, s); + + vfprintf(context->stream, s, args); + fprintf(context->stream, "\n"); +} + +#ifdef _WIN32 + +static int ExecuteCommand(const char **argv) +{ + return _spawnv(_P_WAIT, argv[0], argv); +} + +#else + +static int ExecuteCommand(const char **argv) +{ + pid_t childpid; + int result; + + childpid = fork(); + + if (childpid == 0) + { + // This is the child. Execute the command. + + execv(argv[0], (char **) argv); + + exit(-1); + } + else + { + // This is the parent. Wait for the child to finish, and return + // the status code. + + waitpid(childpid, &result, 0); + + if (WIFEXITED(result)) + { + return WEXITSTATUS(result); + } + else + { + return -1; + } + } +} + +#endif + +int ExecuteDoom(execute_context_t *context) +{ + const char *argv[3]; + char *response_file_arg; + int result; + + fclose(context->stream); + + // Build the command line + + response_file_arg = malloc(strlen(context->response_file) + 2); + sprintf(response_file_arg, "@%s", context->response_file); + + argv[0] = DOOM_BINARY; + argv[1] = response_file_arg; + argv[2] = NULL; + + // Run Doom + + result = ExecuteCommand(argv); + + free(response_file_arg); + + // Destroy context + remove(context->response_file); + free(context->response_file); + free(context); + + return result; +} + +static void TestCallback(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(data)) +{ + execute_context_t *exec; + char *main_cfg; + char *extra_cfg; + txt_window_t *testwindow; + txt_label_t *label; + + testwindow = TXT_NewWindow("Starting Doom"); + + label = TXT_NewLabel("Starting Doom to test the\n" + "settings. Please wait."); + TXT_SetWidgetAlign(label, TXT_HORIZ_CENTER); + TXT_AddWidget(testwindow, label); + TXT_DrawDesktop(); + + // Save temporary configuration files with the current configuration + + main_cfg = TempFile("tmp.cfg"); + extra_cfg = TempFile("extratmp.cfg"); + + M_SaveDefaultsAlternate(main_cfg, extra_cfg); + + // Run with the -testcontrols parameter + + exec = NewExecuteContext(); + AddCmdLineParameter(exec, "-testcontrols"); + AddCmdLineParameter(exec, "-config %s", main_cfg); + AddCmdLineParameter(exec, "-extraconfig %s", extra_cfg); + ExecuteDoom(exec); + + TXT_CloseWindow(testwindow); + + // Delete the temporary config files + + remove(main_cfg); + remove(extra_cfg); + free(main_cfg); + free(extra_cfg); +} + +txt_window_action_t *TestConfigAction(void) +{ + txt_window_action_t *test_action; + + test_action = TXT_NewWindowAction('t', "Test"); + TXT_SignalConnect(test_action, "pressed", TestCallback, NULL); + + return test_action; +} + +// Invokes Doom to find which IWADs are installed. +// This is a cheap hack to avoid duplication of the complicated install +// path searching code inside Doom. + +int FindInstalledIWADs(void) +{ + execute_context_t *context; + int result; + + context = NewExecuteContext(); + AddCmdLineParameter(context, "-findiwads"); + result = ExecuteDoom(context); + + if (result < 0) + { + return 0; + } + else + { + return result; + } +} + diff --git a/src/setup/execute.h b/src/setup/execute.h new file mode 100644 index 00000000..24711a16 --- /dev/null +++ b/src/setup/execute.h @@ -0,0 +1,45 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright(C) 2006 Simon Howard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// + +#ifndef TESTCONFIG_H +#define TESTCONFIG_H + +#include "textscreen.h" + +typedef struct execute_context_s execute_context_t; + +#define IWAD_DOOM2 (1 << 0) /* doom2.wad */ +#define IWAD_PLUTONIA (1 << 1) /* plutonia.wad */ +#define IWAD_TNT (1 << 2) /* tnt.wad */ +#define IWAD_DOOM (1 << 3) /* doom.wad */ +#define IWAD_DOOM1 (1 << 4) /* doom1.wad */ +#define IWAD_CHEX (1 << 5) /* chex.wad */ + +execute_context_t *NewExecuteContext(void); +void AddCmdLineParameter(execute_context_t *context, char *s, ...); +void AddConfigParameters(execute_context_t *context); +int ExecuteDoom(execute_context_t *context); +int FindInstalledIWADs(void); + +txt_window_action_t *TestConfigAction(void); + +#endif /* #ifndef TESTCONFIG_H */ + diff --git a/src/setup/joystick.c b/src/setup/joystick.c new file mode 100644 index 00000000..69c0e508 --- /dev/null +++ b/src/setup/joystick.c @@ -0,0 +1,440 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright(C) 2007 Simon Howard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// + +#include +#include + +#include "doomtype.h" +#include "textscreen.h" +#include "txt_joybinput.h" + +#include "joystick.h" + +typedef enum +{ + CALIBRATE_CENTER, + CALIBRATE_LEFT, + CALIBRATE_UP, +} calibration_stage_t; + +// SDL joystick successfully initialised? + +static int joystick_initted = 0; + +// Joystick enable/disable + +int usejoystick = 0; + +// Button mappings + +int joybfire = 0; +int joybstrafe = 1; +int joybuse = 2; +int joybspeed = 3; +int joybstrafeleft = -1; +int joybstraferight = -1; + +// Joystick to use, as an SDL joystick index: + +int joystick_index = -1; + +// Which joystick axis to use for horizontal movement, and whether to +// invert the direction: + +int joystick_x_axis = 0; +int joystick_x_invert = 0; + +// Which joystick axis to use for vertical movement, and whether to +// invert the direction: + +int joystick_y_axis = 1; +int joystick_y_invert = 0; + +static txt_button_t *joystick_button; + +static int *all_joystick_buttons[] = { + &joybstraferight, &joybstrafeleft, &joybfire, &joybspeed, + &joybuse, &joybstrafe, +}; + +// +// Calibration +// + +static txt_window_t *calibration_window; +static txt_label_t *calibration_label; +static calibration_stage_t calibrate_stage; +static SDL_Joystick **all_joysticks = NULL; + +// Set the label showing the name of the currently selected joystick + +static void SetJoystickButtonLabel(void) +{ + char *name; + + name = "None set"; + + if (joystick_initted + && joystick_index >= 0 && joystick_index < SDL_NumJoysticks()) + { + name = (char *) SDL_JoystickName(joystick_index); + } + + TXT_SetButtonLabel(joystick_button, name); +} + +// Try to open all joysticks visible to SDL. + +static int OpenAllJoysticks(void) +{ + int i; + int num_joysticks; + int result; + + if (!joystick_initted) + { + return 0; + } + + // SDL_JoystickOpen() all joysticks. + + num_joysticks = SDL_NumJoysticks(); + + all_joysticks = malloc(sizeof(SDL_Joystick *) * num_joysticks); + + result = 0; + + for (i=0; i best_value) + { + best_value = abs(axis_value); + best_invert = axis_value > 0; + best_axis = i; + } + } + + // Save the best values we have found + + *axis_index = best_axis; + *axis_invert = best_invert; +} + +static int CalibrationEventCallback(SDL_Event *event, void *user_data) +{ + if (event->type == SDL_JOYBUTTONDOWN + && (joystick_index == -1 || event->jbutton.which == joystick_index)) + { + switch (calibrate_stage) + { + case CALIBRATE_CENTER: + // Centering stage selects which joystick to use. + joystick_index = event->jbutton.which; + break; + + case CALIBRATE_LEFT: + CalibrateAxis(&joystick_x_axis, &joystick_x_invert); + break; + + case CALIBRATE_UP: + CalibrateAxis(&joystick_y_axis, &joystick_y_invert); + break; + } + + if (calibrate_stage == CALIBRATE_UP) + { + // Final stage; close the window + + TXT_CloseWindow(calibration_window); + } + else + { + // Advance to the next calibration stage + + ++calibrate_stage; + SetCalibrationLabel(); + } + + return 1; + } + + return 0; +} + +static void NoJoystick(void) +{ + txt_window_t *window; + + window = TXT_NewWindow(NULL); + + TXT_AddWidget(window, + TXT_NewLabel("No joysticks could be opened.\n\n" + "Try configuring your joystick from within\n" + "your OS first.")); + + TXT_SetWindowAction(window, TXT_HORIZ_LEFT, NULL); + TXT_SetWindowAction(window, TXT_HORIZ_CENTER, + TXT_NewWindowEscapeAction(window)); + TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, NULL); + + joystick_index = -1; + SetJoystickButtonLabel(); +} + +static void CalibrateWindowClosed(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(unused)) +{ + CloseAllJoysticks(); + TXT_SDL_SetEventCallback(NULL, NULL); + SetJoystickButtonLabel(); +} + +static void CalibrateJoystick(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(unused)) +{ + calibrate_stage = CALIBRATE_CENTER; + + // Try to open all available joysticks. If none are opened successfully, + // bomb out with an error. + + if (!OpenAllJoysticks()) + { + NoJoystick(); + return; + } + + calibration_window = TXT_NewWindow("Joystick calibration"); + + TXT_AddWidgets(calibration_window, + TXT_NewLabel("Please follow the following instructions\n" + "in order to calibrate your joystick."), + TXT_NewStrut(0, 1), + calibration_label = TXT_NewLabel("zzz"), + TXT_NewStrut(0, 1), + NULL); + + TXT_SetWindowAction(calibration_window, TXT_HORIZ_LEFT, NULL); + TXT_SetWindowAction(calibration_window, TXT_HORIZ_CENTER, + TXT_NewWindowAbortAction(calibration_window)); + TXT_SetWindowAction(calibration_window, TXT_HORIZ_RIGHT, NULL); + + TXT_SetWidgetAlign(calibration_label, TXT_HORIZ_CENTER); + TXT_SDL_SetEventCallback(CalibrationEventCallback, NULL); + + TXT_SignalConnect(calibration_window, "closed", CalibrateWindowClosed, NULL); + + // Start calibration + + joystick_index = -1; + calibrate_stage = CALIBRATE_CENTER; + + SetCalibrationLabel(); +} + +void JoyButtonSetCallback(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(variable)) +{ + TXT_CAST_ARG(int, variable); + unsigned int i; + + // Only allow a button to be bound to one action at a time. If + // we assign a key that another action is using, set that other action + // to -1. + + for (i=0; i= 0; + } + + window = TXT_NewWindow("Joystick configuration"); + + TXT_AddWidgets(window, + TXT_NewCheckBox("Enable joystick", &usejoystick), + joystick_table = TXT_NewTable(2), + TXT_NewSeparator("Joystick buttons"), + button_table = TXT_NewTable(2), + NULL); + + TXT_SetColumnWidths(joystick_table, 20, 15); + + TXT_AddWidgets(joystick_table, + TXT_NewLabel("Current joystick"), + joystick_button = TXT_NewButton("zzzz"), + NULL); + + TXT_SetColumnWidths(button_table, 20, 15); + + AddJoystickControl(button_table, "Fire", &joybfire); + AddJoystickControl(button_table, "Use", &joybuse); + + // High values of joybspeed are used to activate the "always run mode" + // trick in Vanilla Doom. If this has been enabled, not only is the + // joybspeed value meaningless, but the control itself is useless. + + if (joybspeed < 20) + { + AddJoystickControl(button_table, "Speed", &joybspeed); + } + + AddJoystickControl(button_table, "Strafe", &joybstrafe); + + AddJoystickControl(button_table, "Strafe Left", &joybstrafeleft); + AddJoystickControl(button_table, "Strafe Right", &joybstraferight); + + TXT_SignalConnect(joystick_button, "pressed", CalibrateJoystick, NULL); + TXT_SignalConnect(window, "closed", JoystickWindowClosed, NULL); + + SetJoystickButtonLabel(); +} + diff --git a/src/setup/joystick.h b/src/setup/joystick.h new file mode 100644 index 00000000..39cf0bf4 --- /dev/null +++ b/src/setup/joystick.h @@ -0,0 +1,42 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright(C) 2006 Simon Howard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// + +#ifndef SETUP_JOYSTICK_H +#define SETUP_JOYSTICK_H + +extern int usejoystick; +extern int joybfire; +extern int joybstrafe; +extern int joybuse; +extern int joybspeed; +extern int joybstrafeleft; +extern int joybstraferight; + +extern int joystick_index; +extern int joystick_x_axis; +extern int joystick_x_invert; +extern int joystick_y_axis; +extern int joystick_y_invert; + +void ConfigJoystick(void); + +#endif /* #ifndef SETUP_JOYSTICK_H */ + diff --git a/src/setup/keyboard.c b/src/setup/keyboard.c new file mode 100644 index 00000000..3a7ccb8f --- /dev/null +++ b/src/setup/keyboard.c @@ -0,0 +1,143 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright(C) 2006 Simon Howard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// +#include "textscreen.h" +#include "doomtype.h" + +#include "execute.h" +#include "txt_keyinput.h" + +#include "joystick.h" +#include "keyboard.h" + +int key_left = KEY_LEFTARROW; +int key_right = KEY_RIGHTARROW; +int key_up = KEY_UPARROW; +int key_down = KEY_DOWNARROW; +int key_strafeleft = ','; +int key_straferight = '.'; +int key_fire = KEY_RCTRL; +int key_use = ' '; +int key_strafe = KEY_RALT; +int key_speed = KEY_RSHIFT; + +int vanilla_keyboard_mapping = 1; + +static int always_run = 0; + +static int *allkeys[] = {&key_left, &key_right, &key_up, &key_down, + &key_strafeleft, &key_straferight, &key_fire, + &key_use, &key_strafe, &key_speed}; + +static void UpdateJoybSpeed(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(var)) +{ + if (always_run) + { + /* + if you want to pick one for chocolate doom to use, + pick 29, since that is the most universal one that + also works with heretic, hexen and strife =P + + NB. This choice also works with original, ultimate and final exes. + */ + + joybspeed = 29; + } + else + { + joybspeed = 0; + } +} + +// Callback invoked when a key control is set + +static void KeySetCallback(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(variable)) +{ + TXT_CAST_ARG(int, variable); + unsigned int i; + + for (i=0; i= 20; + + window = TXT_NewWindow("Keyboard configuration"); + + TXT_AddWidgets(window, + TXT_NewSeparator("Movement"), + movement_table = TXT_NewTable(2), + + TXT_NewSeparator("Action"), + action_table = TXT_NewTable(2), + + TXT_NewSeparator("Misc."), + run_control = TXT_NewCheckBox("Always run", &always_run), + TXT_NewInvertedCheckBox("Use native keyboard mapping", + &vanilla_keyboard_mapping), + NULL); + + TXT_SetColumnWidths(movement_table, 20, 8); + + TXT_SignalConnect(run_control, "changed", UpdateJoybSpeed, NULL); + + AddKeyControl(movement_table, "Move Forward", &key_up); + AddKeyControl(movement_table, "Move Backward", &key_down); + AddKeyControl(movement_table, "Turn Left", &key_left); + AddKeyControl(movement_table, "Turn Right", &key_right); + AddKeyControl(movement_table, "Strafe Left", &key_strafeleft); + AddKeyControl(movement_table, "Strafe Right", &key_straferight); + AddKeyControl(movement_table, "Speed On", &key_speed); + AddKeyControl(movement_table, "Strafe On", &key_strafe); + + TXT_SetColumnWidths(action_table, 20, 8); + + AddKeyControl(action_table, "Use", &key_use); + AddKeyControl(action_table, "Fire", &key_fire); + + TXT_SetWindowAction(window, TXT_HORIZ_CENTER, TestConfigAction()); +} + diff --git a/src/setup/keyboard.h b/src/setup/keyboard.h new file mode 100644 index 00000000..6442e1e4 --- /dev/null +++ b/src/setup/keyboard.h @@ -0,0 +1,41 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright(C) 2006 Simon Howard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// + +#ifndef SETUP_KEYBOARD_H +#define SETUP_KEYBOARD_H + +extern int key_left; +extern int key_right; +extern int key_up; +extern int key_down; +extern int key_strafeleft; +extern int key_straferight; +extern int key_fire; +extern int key_use; +extern int key_strafe; +extern int key_speed; +extern int joybspeed; +extern int vanilla_keyboard_mapping; + +void ConfigKeyboard(void); + +#endif /* #ifndef SETUP_KEYBOARD_H */ + diff --git a/src/setup/mainmenu.c b/src/setup/mainmenu.c new file mode 100644 index 00000000..1585c96b --- /dev/null +++ b/src/setup/mainmenu.c @@ -0,0 +1,218 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright(C) 2006 Simon Howard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// + +#include + +#include "config.h" +#include "textscreen.h" + +#include "execute.h" + +#include "m_argv.h" +#include "m_config.h" + +#include "setup_icon.c" + +#include "compatibility.h" +#include "display.h" +#include "joystick.h" +#include "keyboard.h" +#include "mouse.h" +#include "multiplayer.h" +#include "sound.h" + +static void DoQuit(void *widget, void *dosave) +{ + if (dosave != NULL) + { + // DANGER: this is broken. Do not save. +// M_SaveDefaults(); + } + + exit(0); +} + +static void QuitConfirm(void *unused1, void *unused2) +{ + txt_window_t *window; + txt_label_t *label; + txt_button_t *yes_button; + txt_button_t *no_button; + + window = TXT_NewWindow(NULL); + + TXT_AddWidgets(window, + label = TXT_NewLabel("Exiting setup.\nSave settings?"), + TXT_NewStrut(24, 0), + yes_button = TXT_NewButton2(" Yes ", DoQuit, DoQuit), + no_button = TXT_NewButton2(" No ", DoQuit, NULL), + NULL); + + TXT_SetWidgetAlign(label, TXT_HORIZ_CENTER); + TXT_SetWidgetAlign(yes_button, TXT_HORIZ_CENTER); + TXT_SetWidgetAlign(no_button, TXT_HORIZ_CENTER); + + // Only an "abort" button in the middle. + TXT_SetWindowAction(window, TXT_HORIZ_LEFT, NULL); + TXT_SetWindowAction(window, TXT_HORIZ_CENTER, + TXT_NewWindowAbortAction(window)); + TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, NULL); +} + +static void LaunchDoom(void *unused1, void *unused2) +{ + execute_context_t *exec; + + // Save configuration first + + M_SaveDefaults(); + + // Shut down textscreen GUI + + TXT_Shutdown(); + + // Launch Doom + + exec = NewExecuteContext(); + AddConfigParameters(exec); + ExecuteDoom(exec); + + exit(0); +} + +void MainMenu(void) +{ + txt_window_t *window; + txt_window_action_t *quit_action; + + window = TXT_NewWindow("Main Menu"); + + TXT_AddWidgets(window, + TXT_NewButton2("Configure Display", + (TxtWidgetSignalFunc) ConfigDisplay, NULL), + TXT_NewButton2("Configure Joystick", + (TxtWidgetSignalFunc) ConfigJoystick, NULL), + TXT_NewButton2("Configure Keyboard", + (TxtWidgetSignalFunc) ConfigKeyboard, NULL), + TXT_NewButton2("Configure Mouse", + (TxtWidgetSignalFunc) ConfigMouse, NULL), + TXT_NewButton2("Configure Sound", + (TxtWidgetSignalFunc) ConfigSound, NULL), + TXT_NewButton2("Compatibility", + (TxtWidgetSignalFunc) CompatibilitySettings, NULL), + TXT_NewButton2("Save parameters and launch DOOM", LaunchDoom, NULL), + TXT_NewStrut(0, 1), + TXT_NewButton2("Start a Network Game", + (TxtWidgetSignalFunc) StartMultiGame, NULL), + TXT_NewButton2("Join a Network Game", + (TxtWidgetSignalFunc) JoinMultiGame, NULL), + TXT_NewButton2("Multiplayer Configuration", + (TxtWidgetSignalFunc) MultiplayerConfig, NULL), + NULL); + + quit_action = TXT_NewWindowAction(KEY_ESCAPE, "Quit"); + TXT_SignalConnect(quit_action, "pressed", QuitConfirm, NULL); + TXT_SetWindowAction(window, TXT_HORIZ_LEFT, quit_action); +} + +// +// Initialise all configuration variables, load config file, etc +// + +static void InitConfig(void) +{ + SetChatMacroDefaults(); + SetPlayerNameDefault(); + + M_SetConfigFilenames("default.cfg", "chocolate-doom.cfg"); + M_SetConfigDir(); + M_LoadDefaults(); +} + +// +// Application icon +// + +static void SetIcon(void) +{ + SDL_Surface *surface; + Uint8 *mask; + int i; + + // Generate the mask + + mask = malloc(setup_icon_w * setup_icon_h / 8); + memset(mask, 0, setup_icon_w * setup_icon_h / 8); + + for (i=0; i + +#include "textscreen.h" +#include "doomtype.h" + +#include "execute.h" +#include "txt_mouseinput.h" + +#include "mouse.h" + +int usemouse = 1; + +int novert = 0; +int mouseSensitivity = 5; +float mouse_acceleration = 1.0; +int mouse_threshold = 10; +int grabmouse = 1; + +int mousebfire = 0; +int mousebforward = 1; +int mousebstrafe = 2; +int mousebstrafeleft = -1; +int mousebstraferight = -1; +int mousebbackward = -1; +int mousebuse = -1; + +int dclick_use = 1; + +static int *all_mouse_buttons[] = { + &mousebfire, + &mousebstrafe, + &mousebforward, + &mousebstrafeleft, + &mousebstraferight, + &mousebbackward, + &mousebuse, +}; + +static void MouseSetCallback(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(variable)) +{ + TXT_CAST_ARG(int, variable); + unsigned int i; + + // Check if the same mouse button is used for a different action + // If so, set the other action(s) to -1 (unset) + + for (i=0; i +#include +#include + +#include "doom/d_englsh.h" +#include "textscreen.h" +#include "doomtype.h" + +#include "execute.h" + +#include "multiplayer.h" +#include "m_config.h" + +#define NUM_WADS 10 +#define NUM_EXTRA_PARAMS 10 + +typedef struct +{ + char *filename; + char *description; + int mask; +} iwad_t; + +typedef enum +{ + WARP_DOOM1, + WARP_DOOM2, +} warptype_t; + +static iwad_t iwads[] = +{ + { "doom.wad", "Doom", IWAD_DOOM }, + { "doom2.wad", "Doom 2", IWAD_DOOM2 }, + { "tnt.wad", "Final Doom: TNT: Evilution", IWAD_TNT }, + { "plutonia.wad", "Final Doom: The Plutonia Experiment", IWAD_PLUTONIA }, + { "doom1.wad", "Doom shareware", IWAD_DOOM1 }, + { "chex.wad", "Chex Quest", IWAD_CHEX }, +}; + +// Array of IWADs found to be installed + +static char *found_iwads[6]; + +// Index of the currently selected IWAD + +static int found_iwad_selected; + +// Filename to pass to '-iwad'. + +static char *iwadfile; + +static char *skills[] = +{ + "I'm too young to die!", + "Hey, not too rough.", + "Hurt me plenty.", + "Ultra-violence", + "NIGHTMARE!", +}; + +static char *chex_skills[] = +{ + "Easy does it", + "Not so sticky", + "Gobs of goo", + "Extreme ooze", + "SUPER SLIMEY!" +}; + +static char *gamemodes[] = +{ + "Co-operative", + "Deathmatch", + "Deathmatch 2.0", +}; + +char *net_player_name; +char *chat_macros[10]; + +static char *wads[NUM_WADS]; +static char *extra_params[NUM_EXTRA_PARAMS]; +static int skill = 2; +static int nomonsters = 0; +static int deathmatch = 0; +static int fast = 0; +static int respawn = 0; +static int udpport = 2342; +static int timer = 0; + +static txt_dropdown_list_t *skillbutton; +static txt_button_t *warpbutton; +static warptype_t warptype = WARP_DOOM2; +static int warpepisode = 1; +static int warpmap = 1; + +// Address to connect to when joining a game + +static char *connect_address = NULL; + +// Find an IWAD from its description + +static iwad_t *GetIWADForDescription(char *description) +{ + unsigned int i; + + for (i=0; i 0) + { + if (!have_wads) + { + AddCmdLineParameter(exec, "-file"); + } + + AddCmdLineParameter(exec, "\"%s\"", wads[i]); + } + } +} + +static void AddExtraParameters(execute_context_t *exec) +{ + int i; + + for (i=0; i 0) + { + AddCmdLineParameter(exec, extra_params[i]); + } + } +} + +static void AddIWADParameter(execute_context_t *exec) +{ + if (iwadfile != NULL) + { + AddCmdLineParameter(exec, "-iwad %s", iwadfile); + } +} + +static void StartGame(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(user_data)) +{ + execute_context_t *exec; + + exec = NewExecuteContext(); + + // Extra parameters come first, before all others; this way, + // they can override any of the options set in the dialog. + + AddExtraParameters(exec); + + AddIWADParameter(exec); + AddCmdLineParameter(exec, "-server"); + AddCmdLineParameter(exec, "-skill %i", skill + 1); + + if (nomonsters) + { + AddCmdLineParameter(exec, "-nomonsters"); + } + + if (fast) + { + AddCmdLineParameter(exec, "-fast"); + } + + if (respawn) + { + AddCmdLineParameter(exec, "-respawn"); + } + + if (deathmatch == 1) + { + AddCmdLineParameter(exec, "-deathmatch"); + } + else if (deathmatch == 2) + { + AddCmdLineParameter(exec, "-altdeath"); + } + + if (timer > 0) + { + AddCmdLineParameter(exec, "-timer %i", timer); + } + + if (warptype == WARP_DOOM1) + { + // TODO: select IWAD based on warp type + AddCmdLineParameter(exec, "-warp %i %i", warpepisode, warpmap); + } + else if (warptype == WARP_DOOM2) + { + AddCmdLineParameter(exec, "-warp %i", warpmap); + } + + AddCmdLineParameter(exec, "-port %i", udpport); + + AddWADs(exec); + + TXT_Shutdown(); + + M_SaveDefaults(); + AddConfigParameters(exec); + + ExecuteDoom(exec); + + exit(0); +} + +static void UpdateWarpButton(void) +{ + char buf[10]; + + if (warptype == WARP_DOOM1) + { + sprintf(buf, "E%iM%i", warpepisode, warpmap); + } + else if (warptype == WARP_DOOM2) + { + sprintf(buf, "MAP%02i", warpmap); + } + + TXT_SetButtonLabel(warpbutton, buf); +} + +static void UpdateSkillButton(void) +{ + iwad_t *iwad = GetCurrentIWAD(); + + if (iwad->mask == IWAD_CHEX) + { + skillbutton->values = chex_skills; + } + else + { + skillbutton->values = skills; + } +} + +static void SetDoom1Warp(TXT_UNCAST_ARG(widget), void *val) +{ + int l; + + l = (int) val; + + warpepisode = l / 10; + warpmap = l % 10; + + UpdateWarpButton(); +} + +static void SetDoom2Warp(TXT_UNCAST_ARG(widget), void *val) +{ + int l; + + l = (int) val; + + warpmap = l; + + UpdateWarpButton(); +} + +static void CloseLevelSelectDialog(TXT_UNCAST_ARG(button), TXT_UNCAST_ARG(window)) +{ + TXT_CAST_ARG(txt_window_t, window); + + TXT_CloseWindow(window); +} + +static void LevelSelectDialog(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(user_data)) +{ + txt_window_t *window; + txt_table_t *table; + txt_button_t *button; + iwad_t *iwad; + char buf[10]; + int x, y; + int l; + int i; + + window = TXT_NewWindow("Select level"); + + table = TXT_NewTable(4); + + TXT_AddWidget(window, table); + + if (warptype == WARP_DOOM1) + { + // ExMy levels + + iwad = GetCurrentIWAD(); + + for (i=0; i<4 * 9; ++i) + { + x = (i % 4) + 1; + y = (i / 4) + 1; + + // chex.wad only has E1M1-E1M5. + + if (iwad->mask == IWAD_CHEX && (x > 1 || y > 5)) + { + continue; + } + + // doom1.wad only has E1 + + if (iwad->mask == IWAD_DOOM1 && x > 1) + { + continue; + } + + sprintf(buf, " E%iM%i ", x, y); + button = TXT_NewButton(buf); + TXT_SignalConnect(button, "pressed", + SetDoom1Warp, (void *) (x * 10 + y)); + TXT_SignalConnect(button, "pressed", + CloseLevelSelectDialog, window); + TXT_AddWidget(table, button); + + if (warpepisode == x && warpmap == y) + { + TXT_SelectWidget(table, button); + } + } + } + else + { + for (i=0; i<32; ++i) + { + x = i % 4; + y = i / 4; + + l = x * 8 + y + 1; + + sprintf(buf, " MAP%02i ", l); + button = TXT_NewButton(buf); + TXT_SignalConnect(button, "pressed", + SetDoom2Warp, (void *) l); + TXT_SignalConnect(button, "pressed", + CloseLevelSelectDialog, window); + TXT_AddWidget(table, button); + + if (warpmap == l) + { + TXT_SelectWidget(table, button); + } + } + } +} + +static void IWADSelected(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(unused)) +{ + iwad_t *iwad; + + // Find the iwad_t selected + + iwad = GetCurrentIWAD(); + + // Update iwadfile + + iwadfile = iwad->filename; +} + +// Called when the IWAD button is changed, to update warptype. + +static void UpdateWarpType(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(unused)) +{ + warptype_t new_warptype; + iwad_t *iwad; + + // Get the selected IWAD + + iwad = GetIWADForDescription(found_iwads[found_iwad_selected]); + + // Find the new warp type + + if (iwad->mask & (IWAD_DOOM | IWAD_DOOM1 | IWAD_CHEX)) + { + new_warptype = WARP_DOOM1; + } + else + { + new_warptype = WARP_DOOM2; + } + + // Reset to E1M1 / MAP01 when the warp type is changed. + + if (new_warptype != warptype) + { + warpepisode = 1; + warpmap = 1; + } + + warptype = new_warptype; + + UpdateWarpButton(); + UpdateSkillButton(); +} + +static txt_widget_t *IWADSelector(void) +{ + txt_dropdown_list_t *dropdown; + txt_widget_t *result; + int installed_iwads; + int num_iwads; + unsigned int i; + + // Find out what WADs are installed + + installed_iwads = FindInstalledIWADs(); + + // Build a list of the descriptions for all installed IWADs + + num_iwads = 0; + + for (i=0; i + + + + + + + + + + + + + diff --git a/src/setup/setup_icon.c b/src/setup/setup_icon.c new file mode 100644 index 00000000..1c18c56f --- /dev/null +++ b/src/setup/setup_icon.c @@ -0,0 +1,262 @@ +static int setup_icon_w = 32; +static int setup_icon_h = 32; + +static unsigned char setup_icon_data[] = { + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0xa2,0x86,0x73, + 0xa9,0x8d,0x7a, 0xbc,0x9f,0x8c, 0xda,0xba,0xa0, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0xbe,0x8e,0x68, 0xd7,0xb9,0xa5, 0xeb,0xd8,0xcd, 0xd3,0xbf,0xae, + 0xbe,0xa1,0x8d, 0xeb,0xd8,0xcd, 0xc2,0x9d,0x86, 0x95,0x5d,0x38, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x78,0x7a,0x77, 0x78,0x7a,0x77, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x78,0x7a,0x77, 0x78,0x7a,0x77, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x9f,0x82,0x6a, + 0xc5,0x9e,0x81, 0xd1,0xb2,0x98, 0xd4,0xac,0x8e, 0xeb,0xd8,0xcd, + 0xc4,0x9b,0x79, 0xad,0x71,0x45, 0xd4,0xac,0x8e, 0xb9,0x93,0x76, + 0xa1,0x75,0x56, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x78,0x7a,0x77, 0x6d,0x6f,0x6c, 0xcb,0xce,0xca, + 0x51,0x52,0x50, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x5b,0x5d,0x5a, + 0xca,0xcc,0xc9, 0x77,0x79,0x76, 0x78,0x7a,0x77, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0xda,0xb4,0x9c, 0xd3,0xa3,0x83, + 0xaf,0x91,0x78, 0xa7,0x83,0x6d, 0xc4,0xa7,0x93, 0xee,0xe2,0xd5, + 0xeb,0xd8,0xcd, 0x8c,0x60,0x3d, 0x92,0x6f,0x59, 0xd0,0xa7,0x84, + 0x84,0x54,0x33, 0xba,0x83,0x5b, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x78,0x7a,0x77, 0xa0,0xa2,0x9f, 0xdf,0xe1,0xde, + 0x58,0x5a,0x58, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x64,0x65,0x63, + 0xdd,0xdf,0xdc, 0xa8,0xaa,0xa7, 0x78,0x7a,0x77, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0xd4,0xb5,0x9b, 0xc3,0x8c,0x63, 0xc4,0x94,0x6e, + 0x98,0x66,0x45, 0x78,0x50,0x2d, 0xd7,0xb9,0xa5, 0xee,0xdc,0xd1, + 0xc4,0x9b,0x79, 0xb6,0x80,0x58, 0x65,0x45,0x26, 0xb6,0x79,0x4d, + 0xcf,0xa5,0x83, 0x9a,0x6e,0x50, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x82,0x83,0x81, 0xbb,0xbd,0xba, 0xde,0xe0,0xdd, + 0x58,0x5a,0x58, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x64,0x65,0x63, + 0xdc,0xde,0xdb, 0xc4,0xc6,0xc3, 0x78,0x7a,0x77, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x9e,0x7b,0x65, 0xbc,0x8c,0x67, 0xaa,0x7d,0x5e, 0xa1,0x75,0x56, + 0x89,0x5f,0x41, 0xc4,0xa7,0x93, 0xb7,0x88,0x63, 0x90,0x6c,0x51, + 0x79,0x4b,0x2b, 0x8c,0x5b,0x34, 0x76,0x4e,0x31, 0x7f,0x50,0x30, + 0xcf,0xa5,0x83, 0xd4,0xac,0x8e, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x77,0x79,0x76, 0xd2,0xd4,0xd1, 0xde,0xe0,0xdd, + 0x64,0x65,0x63, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x68,0x69,0x67, + 0xdb,0xdd,0xda, 0xda,0xdc,0xd9, 0x78,0x7a,0x77, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0xd8,0xb8,0x9e, + 0xd4,0xac,0x8e, 0xc5,0x9e,0x81, 0xab,0x7e,0x5f, 0x9c,0x6f,0x4b, + 0xbe,0xa1,0x8d, 0x8c,0x60,0x3d, 0x6e,0x47,0x2b, 0x87,0x5e,0x40, + 0x5a,0x3b,0x23, 0x68,0x42,0x26, 0x65,0x40,0x23, 0x53,0x36,0x22, + 0x7e,0x55,0x38, 0xce,0x9f,0x7e, 0xc3,0x8c,0x63, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x77,0x79,0x76, 0xe1,0xe4,0xe0, 0xe1,0xe4,0xe0, + 0xc4,0xc6,0xc3, 0x83,0x85,0x82, 0x8c,0x8d,0x8a, 0xd2,0xd4,0xd1, + 0xee,0xdc,0xd1, 0xe1,0xe4,0xe0, 0x78,0x7a,0x77, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0xcb,0x9a,0x74, + 0xb6,0x80,0x58, 0x8c,0x60,0x3d, 0x76,0x4e,0x31, 0x88,0x57,0x31, + 0x83,0x53,0x33, 0x84,0x54,0x33, 0x95,0x5d,0x38, 0x79,0x4b,0x2b, + 0x5c,0x38,0x22, 0x84,0x54,0x33, 0x55,0x37,0x1e, 0x96,0x6b,0x4d, + 0xb4,0x7f,0x5c, 0xba,0x83,0x5b, 0xb8,0x7b,0x4f, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x9a,0x9b,0x98, 0xd9,0xdb,0xd7, + 0xe1,0xe4,0xe0, 0xde,0xe0,0xdd, 0xdd,0xdf,0xdc, 0xe0,0xe2,0xdf, + 0xda,0xdc,0xd9, 0xa3,0xa5,0xa1, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0xc0,0x89,0x60, + 0x89,0x5f,0x41, 0x84,0x54,0x33, 0x84,0x54,0x33, 0x8a,0x5a,0x39, + 0x8f,0x5d,0x37, 0x78,0x50,0x2d, 0x8c,0x5b,0x34, 0x5a,0x3b,0x23, + 0x5e,0x3f,0x27, 0x76,0x4e,0x31, 0x97,0x64,0x3d, 0x74,0x4b,0x29, + 0x78,0x50,0x2d, 0x7b,0x4d,0x2c, 0xb6,0x80,0x58, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x64,0x65,0x63, + 0xbe,0xc1,0xbd, 0xee,0xdc,0xd1, 0xe1,0xe4,0xe0, 0xc2,0xc4,0xc1, + 0x68,0x69,0x67, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x95,0x62,0x3b, + 0x84,0x54,0x33, 0x88,0x57,0x31, 0x7e,0x6e,0x64, 0xc4,0x94,0x6e, + 0x76,0x4e,0x31, 0x90,0x6c,0x51, 0xa1,0x7c,0x60, 0x9a,0x6e,0x50, + 0x95,0x5d,0x38, 0xbc,0x7f,0x53, 0xad,0x71,0x45, 0x76,0x4e,0x31, + 0x53,0x36,0x22, 0x4b,0x2f,0x1c, 0x70,0x49,0x2c, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x51,0x52,0x50, 0xd2,0xd4,0xd1, 0xe0,0xe2,0xdf, 0x77,0x79,0x76, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x84,0x54,0x33, + 0xa3,0x86,0x6e, 0xc4,0x94,0x6e, 0x88,0x64,0x44, 0xbc,0x8c,0x67, + 0x9c,0x6f,0x4b, 0xa1,0x6d,0x45, 0x93,0x60,0x3a, 0xad,0x71,0x3f, + 0xb4,0x7f,0x5c, 0xbc,0x8c,0x67, 0xc0,0x89,0x60, 0xb3,0x76,0x4b, + 0xb8,0x7b,0x4f, 0x88,0x64,0x44, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x4a,0x4b,0x49, 0xdc,0xde,0xdb, 0xe1,0xe4,0xe0, 0x79,0x7b,0x78, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0xa7,0x83,0x6d, + 0xac,0x86,0x6a, 0x76,0x4e,0x31, 0x84,0x54,0x33, 0x5c,0x38,0x22, + 0x57,0x38,0x20, 0x6c,0x46,0x29, 0x95,0x62,0x3b, 0xa3,0x6e,0x41, + 0xb3,0x76,0x4b, 0xb8,0x7b,0x4f, 0x9d,0x64,0x3f, 0x7e,0x4f,0x2f, + 0x63,0x3e,0x27, 0x95,0x62,0x3b, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x51,0x52,0x50, 0xdd,0xdf,0xdc, 0xe0,0xe2,0xdf, 0x82,0x83,0x81, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0xb6,0x80,0x58, + 0x98,0x74,0x59, 0x67,0x41,0x25, 0x4b,0x35,0x25, 0x81,0x52,0x31, + 0x76,0x4e,0x31, 0x7b,0x4d,0x2c, 0x7e,0x4f,0x2f, 0x84,0x54,0x33, + 0x8f,0x5d,0x37, 0x95,0x5d,0x38, 0x78,0x50,0x2d, 0x65,0x45,0x26, + 0x65,0x40,0x23, 0x7e,0x4f,0x2f, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x55,0x56,0x54, 0xee,0xdc,0xd1, 0xde,0xe0,0xdd, 0x8c,0x8d,0x8a, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0xb4,0x7f,0x5c, + 0x86,0x56,0x35, 0x8c,0x60,0x3d, 0x89,0x5f,0x41, 0x63,0x44,0x2b, + 0x57,0x38,0x20, 0x86,0x56,0x35, 0x88,0x57,0x31, 0x95,0x5d,0x38, + 0x97,0x64,0x3d, 0x63,0x3e,0x27, 0x50,0x33,0x20, 0x78,0x50,0x2d, + 0x78,0x50,0x2d, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x58,0x5a,0x58, 0xe0,0xe2,0xdf, 0xde,0xe0,0xdd, 0x8c,0x8d,0x8a, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x86,0x56,0x35, 0x63,0x3e,0x27, 0xa8,0x6d,0x42, 0x50,0x33,0x20, + 0x63,0x3e,0x27, 0x74,0x4b,0x29, 0x53,0x36,0x22, 0x78,0x50,0x2d, + 0x42,0x30,0x14, 0x4d,0x3e,0x15, 0x4d,0x3e,0x15, 0x7c,0x5b,0x29, + 0x8a,0x71,0x27, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x64,0x65,0x63, 0xe1,0xe4,0xe0, 0xe1,0xe4,0xe0, 0x91,0x93,0x90, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x6e,0x47,0x2b, 0x65,0x45,0x26, 0x5d,0x42,0x22, 0x65,0x45,0x26, + 0x78,0x50,0x2d, 0x5d,0x42,0x22, 0x5e,0x3f,0x27, 0x4d,0x3e,0x15, + 0x4d,0x3e,0x15, 0x67,0x58,0x21, 0x4f,0x44,0x19, 0x5f,0x51,0x19, + 0x8a,0x76,0x2a, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x68,0x69,0x67, 0xdf,0xe1,0xde, 0xe0,0xe2,0xdf, 0x9a,0x9b,0x98, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x8a,0x71,0x27, 0x53,0x46,0x15, + 0x53,0x46,0x15, 0x67,0x58,0x21, 0x58,0x4c,0x1b, 0x5b,0x4f,0x1d, + 0x5b,0x4f,0x1d, 0x67,0x58,0x21, 0x5b,0x4f,0x1d, 0x8a,0x71,0x27, + 0x8c,0x77,0x24, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x70,0x72,0x6f, 0xe1,0xe4,0xe0, 0xe1,0xe4,0xe0, 0x9a,0x9b,0x98, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0xac,0x93,0x39, 0x7e,0x66,0x23, + 0x69,0x5a,0x1b, 0x6b,0x5b,0x1d, 0x67,0x58,0x21, 0x53,0x46,0x15, + 0x4d,0x3e,0x15, 0x9f,0x88,0x35, 0xb7,0x9c,0x3b, 0xac,0x93,0x39, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x77,0x79,0x76, 0xdf,0xe1,0xde, 0xe0,0xe2,0xdf, 0xa3,0xa5,0xa1, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0xb1,0x97,0x36, 0x6f,0x5f,0x21, + 0x7e,0x66,0x23, 0x8c,0x77,0x24, 0x84,0x70,0x24, 0x78,0x67,0x22, + 0x8e,0x79,0x26, 0x8a,0x71,0x27, 0xb7,0x9c,0x3b, 0x9b,0x84,0x29, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x82,0x83,0x81, 0xe1,0xe4,0xe0, 0xe1,0xe4,0xe0, 0xa8,0xaa,0xa7, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0xac,0x93,0x39, 0x89,0x75,0x29, + 0x7e,0x66,0x23, 0x75,0x64,0x1f, 0x94,0x7e,0x2b, 0x7e,0x66,0x23, + 0x9f,0x88,0x35, 0xb6,0x9d,0x4a, 0xb6,0x9d,0x4a, 0xc4,0xa8,0x3f, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x82,0x83,0x81, 0xe0,0xe2,0xdf, 0xde,0xe0,0xdd, 0xab,0xad,0xaa, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x80,0x6d,0x28, + 0xac,0x93,0x39, 0x97,0x82,0x36, 0xac,0x94,0x41, 0xac,0x93,0x39, + 0x97,0x82,0x36, 0xa2,0x8a,0x30, 0xbd,0xa3,0x48, 0x8a,0x71,0x27, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x77,0x79,0x76, 0xe0,0xe2,0xdf, 0xd8,0xda,0xd6, 0xab,0xad,0xaa, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0xae,0x95,0x33, + 0x7e,0x66,0x23, 0x9f,0x88,0x35, 0x9f,0x88,0x35, 0x7e,0x66,0x23, + 0x8a,0x71,0x27, 0xaf,0x96,0x3c, 0xbd,0xa2,0x41, 0x8a,0x76,0x2a, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x68,0x69,0x67, + 0xc2,0xc4,0xc1, 0xe0,0xe2,0xdf, 0xdf,0xe1,0xde, 0xbe,0xc1,0xbd, + 0x5f,0x61,0x5e, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0xaf,0x96,0x3c, + 0x87,0x73,0x27, 0xb2,0x99,0x3f, 0x6f,0x5f,0x21, 0xa8,0x90,0x36, + 0x97,0x82,0x36, 0x9f,0x88,0x35, 0xb7,0x9c,0x3b, 0x8c,0x77,0x24, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0xa3,0xa5,0xa1, 0xeb,0xd8,0xcd, + 0xe0,0xe2,0xdf, 0xee,0xdc,0xd1, 0xdf,0xe1,0xde, 0xe1,0xe4,0xe0, + 0xda,0xdc,0xd9, 0x9a,0x9b,0x98, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0xb2,0x99,0x3f, + 0xaf,0x96,0x3c, 0x96,0x80,0x2d, 0xbd,0xa3,0x48, 0x97,0x82,0x36, + 0xb6,0x9d,0x4a, 0xb8,0xa0,0x4c, 0xc1,0xa7,0x4c, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x78,0x7a,0x77, 0xdf,0xe1,0xde, 0xe0,0xe2,0xdf, + 0xd2,0xd4,0xd1, 0x8c,0x8d,0x8a, 0x82,0x83,0x81, 0xc7,0xc9,0xc6, + 0xe1,0xe4,0xe0, 0xe1,0xe4,0xe0, 0x78,0x7a,0x77, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x96,0x80,0x2d, 0xb5,0x9c,0x49, 0xb2,0x99,0x3f, 0xb2,0x9a,0x47, + 0xb0,0x97,0x3d, 0xc1,0xa7,0x4c, 0x96,0x80,0x2d, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x78,0x7a,0x77, 0xd9,0xdb,0xd7, 0xda,0xdc,0xd9, + 0x68,0x69,0x67, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x64,0x65,0x63, + 0xdd,0xdf,0xdc, 0xd2,0xd4,0xd1, 0x78,0x7a,0x77, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x9c,0x85,0x2b, 0xaa,0x91,0x2f, 0xb1,0x97,0x36, 0xa2,0x8a,0x30, + 0x7e,0x66,0x23, 0xb1,0x97,0x36, 0xb4,0x99,0x30, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x79,0x7b,0x78, 0xc4,0xc6,0xc3, 0xd9,0xdb,0xd7, + 0x64,0x65,0x63, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x55,0x56,0x54, + 0xdf,0xe1,0xde, 0xbb,0xbd,0xba, 0x78,0x7a,0x77, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x9f,0x88,0x35, 0xb8,0x9e,0x44, 0x8a,0x71,0x27, 0xa6,0x8f,0x3c, + 0xbd,0xa3,0x48, 0x96,0x80,0x2d, 0x9f,0x88,0x35, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x82,0x83,0x81, 0xa8,0xaa,0xa7, 0xdf,0xe1,0xde, + 0x64,0x65,0x63, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x58,0x5a,0x58, + 0xee,0xdc,0xd1, 0xa0,0xa2,0x9f, 0x78,0x7a,0x77, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0xb0,0x97,0x3d, 0xb7,0x9c,0x3b, 0xac,0x94,0x41, 0xb2,0x99,0x3f, + 0xb6,0x9b,0x32, 0xb7,0x9c,0x3b, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x77,0x79,0x76, 0x77,0x79,0x76, 0xca,0xcc,0xc9, + 0x5b,0x5d,0x5a, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x51,0x52,0x50, + 0xcb,0xce,0xca, 0x68,0x69,0x67, 0x79,0x7b,0x78, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0xbd,0xa2,0x41, 0xa6,0x8f,0x3c, 0xb0,0x97,0x3d, 0xb2,0x9a,0x47, + 0xac,0x93,0x39, 0x9f,0x88,0x35, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x77,0x79,0x76, 0x78,0x7a,0x77, + 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, + 0x82,0x83,0x81, 0x79,0x7b,0x78, 0x00,0x00,0x00, 0x00,0x00,0x00, + +}; diff --git a/src/setup/sound.c b/src/setup/sound.c new file mode 100644 index 00000000..72414c83 --- /dev/null +++ b/src/setup/sound.c @@ -0,0 +1,167 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright(C) 2006 Simon Howard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// + +// Sound control menu + +#include + +#include "textscreen.h" + +#include "sound.h" + +enum +{ + SNDDEVICE_NONE = 0, + SNDDEVICE_PCSPEAKER = 1, + SNDDEVICE_ADLIB = 2, + SNDDEVICE_SB = 3, + SNDDEVICE_PAS = 4, + SNDDEVICE_GUS = 5, + SNDDEVICE_WAVEBLASTER = 6, + SNDDEVICE_SOUNDCANVAS = 7, + SNDDEVICE_GENMIDI = 8, + SNDDEVICE_AWE32 = 9, +}; + +typedef enum +{ + SFXMODE_DISABLED, + SFXMODE_PCSPEAKER, + SFXMODE_DIGITAL, + NUM_SFXMODES +} sfxmode_t; + +static char *sfxmode_strings[] = +{ + "Disabled", + "PC speaker", + "Digital", +}; + +// Disable MIDI music on OSX: there are problems with the native +// MIDI code in SDL_mixer. + +#ifdef __MACOSX__ +#define DEFAULT_MUSIC_DEVICE SNDDEVICE_NONE +#else +#define DEFAULT_MUSIC_DEVICE SNDDEVICE_SB +#endif + +int snd_sfxdevice = SNDDEVICE_SB; +int numChannels = 8; +int sfxVolume = 15; + +int snd_musicdevice = DEFAULT_MUSIC_DEVICE; +int musicVolume = 15; + +int snd_samplerate = 22050; + +int use_libsamplerate = 0; + +static int snd_sfxmode; +static int snd_musicenabled; + +static void UpdateSndDevices(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(data)) +{ + switch (snd_sfxmode) + { + case SFXMODE_DISABLED: + snd_sfxdevice = SNDDEVICE_NONE; + break; + case SFXMODE_PCSPEAKER: + snd_sfxdevice = SNDDEVICE_PCSPEAKER; + break; + case SFXMODE_DIGITAL: + snd_sfxdevice = SNDDEVICE_SB; + break; + } + + if (snd_musicenabled) + { + snd_musicdevice = SNDDEVICE_SB; + } + else + { + snd_musicdevice = SNDDEVICE_NONE; + } +} + +void ConfigSound(void) +{ + txt_window_t *window; + txt_table_t *sfx_table; + txt_table_t *music_table; + txt_dropdown_list_t *sfx_mode_control; + txt_checkbox_t *music_enabled_control; + + if (snd_sfxdevice == SNDDEVICE_PCSPEAKER) + { + snd_sfxmode = SFXMODE_PCSPEAKER; + } + else if (snd_sfxdevice >= SNDDEVICE_SB) + { + snd_sfxmode = SFXMODE_DIGITAL; + } + else + { + snd_sfxmode = SFXMODE_DISABLED; + } + + snd_musicenabled = snd_musicdevice != SNDDEVICE_NONE; + + window = TXT_NewWindow("Sound configuration"); + + TXT_AddWidgets(window, + TXT_NewSeparator("Sound effects"), + sfx_table = TXT_NewTable(2), + TXT_NewSeparator("Music"), + music_enabled_control = TXT_NewCheckBox("Music enabled", + &snd_musicenabled), + music_table = TXT_NewTable(2), + NULL); + + TXT_SetColumnWidths(sfx_table, 20, 5); + + TXT_AddWidgets(sfx_table, + TXT_NewLabel("Sound effects"), + sfx_mode_control = TXT_NewDropdownList(&snd_sfxmode, + sfxmode_strings, + NUM_SFXMODES), + TXT_NewLabel("Sound channels"), + TXT_NewSpinControl(&numChannels, 1, 8), + TXT_NewLabel("SFX volume"), + TXT_NewSpinControl(&sfxVolume, 0, 15), + NULL); + + TXT_SetColumnWidths(music_table, 20, 5); + + TXT_AddWidgets(music_table, + TXT_NewLabel("Music volume"), + TXT_NewSpinControl(&musicVolume, 0, 15), + NULL); + + TXT_SignalConnect(sfx_mode_control, "changed", + UpdateSndDevices, NULL); + TXT_SignalConnect(music_enabled_control, "changed", + UpdateSndDevices, NULL); + +} + diff --git a/src/setup/sound.h b/src/setup/sound.h new file mode 100644 index 00000000..170dda0a --- /dev/null +++ b/src/setup/sound.h @@ -0,0 +1,39 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright(C) 2006 Simon Howard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// + +#ifndef SETUP_SOUND_H +#define SETUP_SOUND_H + +extern int snd_sfxdevice; +extern int numChannels; +extern int sfxVolume; + +extern int snd_musicdevice; +extern int musicVolume; + +extern int snd_samplerate; + +extern int use_libsamplerate; + +void ConfigSound(void); + +#endif /* #ifndef SETUP_SOUND_H */ + diff --git a/src/setup/txt_joybinput.c b/src/setup/txt_joybinput.c new file mode 100644 index 00000000..1e132962 --- /dev/null +++ b/src/setup/txt_joybinput.c @@ -0,0 +1,228 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright(C) 2006 Simon Howard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// + +#include +#include +#include + +#include "SDL_joystick.h" + +#include "doomkeys.h" +#include "joystick.h" + +#include "txt_joybinput.h" +#include "txt_gui.h" +#include "txt_io.h" +#include "txt_label.h" +#include "txt_sdl.h" +#include "txt_window.h" + +#define JOYSTICK_INPUT_WIDTH 10 + +// Called in response to SDL events when the prompt window is open: + +static int EventCallback(SDL_Event *event, TXT_UNCAST_ARG(joystick_input)) +{ + TXT_CAST_ARG(txt_joystick_input_t, joystick_input); + + // Got the joystick button press? + + if (event->type == SDL_JOYBUTTONDOWN) + { + *joystick_input->variable = event->jbutton.button; + TXT_EmitSignal(joystick_input, "set"); + TXT_CloseWindow(joystick_input->prompt_window); + return 1; + } + + return 0; +} + +// When the prompt window is closed, disable the event callback function; +// we are no longer interested in receiving notification of events. + +static void PromptWindowClosed(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(joystick)) +{ + TXT_CAST_ARG(SDL_Joystick, joystick); + + SDL_JoystickClose(joystick); + TXT_SDL_SetEventCallback(NULL, NULL); + SDL_JoystickEventState(SDL_DISABLE); + SDL_QuitSubSystem(SDL_INIT_JOYSTICK); +} + +static void OpenErrorWindow(void) +{ + txt_window_t *window; + + window = TXT_NewWindow(NULL); + + TXT_AddWidget(window, TXT_NewLabel("Please configure a joystick first!")); + + TXT_SetWindowAction(window, TXT_HORIZ_LEFT, NULL); + TXT_SetWindowAction(window, TXT_HORIZ_CENTER, + TXT_NewWindowEscapeAction(window)); + TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, NULL); +} + +static void OpenPromptWindow(txt_joystick_input_t *joystick_input) +{ + txt_window_t *window; + txt_label_t *label; + SDL_Joystick *joystick; + + if (SDL_Init(SDL_INIT_JOYSTICK) < 0) + { + return; + } + + // Check the current joystick is valid + + joystick = SDL_JoystickOpen(joystick_index); + + if (joystick == NULL) + { + OpenErrorWindow(); + return; + } + + // Open the prompt window + + window = TXT_NewWindow(NULL); + TXT_SetWindowAction(window, TXT_HORIZ_LEFT, NULL); + TXT_SetWindowAction(window, TXT_HORIZ_CENTER, + TXT_NewWindowAbortAction(window)); + TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, NULL); + + label = TXT_NewLabel("Press the new joystick button..."); + + TXT_AddWidget(window, label); + TXT_SetWidgetAlign(label, TXT_HORIZ_CENTER); + TXT_SDL_SetEventCallback(EventCallback, joystick_input); + TXT_SignalConnect(window, "closed", PromptWindowClosed, joystick); + joystick_input->prompt_window = window; + + SDL_JoystickEventState(SDL_ENABLE); +} + +static void TXT_JoystickInputSizeCalc(TXT_UNCAST_ARG(joystick_input)) +{ + TXT_CAST_ARG(txt_joystick_input_t, joystick_input); + + // All joystickinputs are the same size. + + joystick_input->widget.w = JOYSTICK_INPUT_WIDTH; + joystick_input->widget.h = 1; +} + +static void GetJoystickButtonDescription(int button, char *buf) +{ + sprintf(buf, "BUTTON #%i", button + 1); +} + +static void TXT_JoystickInputDrawer(TXT_UNCAST_ARG(joystick_input), int selected) +{ + TXT_CAST_ARG(txt_joystick_input_t, joystick_input); + char buf[20]; + int i; + + if (*joystick_input->variable < 0) + { + strcpy(buf, "(none)"); + } + else + { + GetJoystickButtonDescription(*joystick_input->variable, buf); + } + + if (selected) + { + TXT_BGColor(TXT_COLOR_GREY, 0); + } + else + { + TXT_BGColor(TXT_COLOR_BLUE, 0); + } + + TXT_FGColor(TXT_COLOR_BRIGHT_WHITE); + + TXT_DrawString(buf); + + for (i=strlen(buf); ivariable = variable; + + return joystick_input; +} + diff --git a/src/setup/txt_joybinput.h b/src/setup/txt_joybinput.h new file mode 100644 index 00000000..b2920b88 --- /dev/null +++ b/src/setup/txt_joybinput.h @@ -0,0 +1,46 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright(C) 2007 Simon Howard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// + +#ifndef TXT_JOYB_INPUT_H +#define TXT_JOYB_INPUT_H + +typedef struct txt_joystick_input_s txt_joystick_input_t; + +#include "txt_widget.h" +#include "txt_window.h" + +// +// A joystick input is like an input box. When selected, a box pops up +// allowing a joystick button to be pressed to select it. +// + +struct txt_joystick_input_s +{ + txt_widget_t widget; + int *variable; + txt_window_t *prompt_window; +}; + +txt_joystick_input_t *TXT_NewJoystickInput(int *variable); + +#endif /* #ifndef TXT_JOYB_INPUT_H */ + + diff --git a/src/setup/txt_keyinput.c b/src/setup/txt_keyinput.c new file mode 100644 index 00000000..b7e68f44 --- /dev/null +++ b/src/setup/txt_keyinput.c @@ -0,0 +1,181 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright(C) 2006 Simon Howard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// + +#include +#include + +#include "doomkeys.h" + +#include "txt_keyinput.h" +#include "txt_gui.h" +#include "txt_io.h" +#include "txt_label.h" +#include "txt_window.h" + +#define KEY_INPUT_WIDTH 8 + +static int KeyPressCallback(txt_window_t *window, int key, + TXT_UNCAST_ARG(key_input)) +{ + TXT_CAST_ARG(txt_key_input_t, key_input); + + if (key != KEY_ESCAPE) + { + // Got the key press. Save to the variable and close the window. + + *key_input->variable = key; + TXT_EmitSignal(key_input, "set"); + TXT_CloseWindow(window); + + // Re-enable key mappings now that we have the key + + TXT_EnableKeyMapping(1); + + return 1; + } + else + { + return 0; + } +} + +static void OpenPromptWindow(txt_key_input_t *key_input) +{ + txt_window_t *window; + txt_label_t *label; + + window = TXT_NewWindow(NULL); + TXT_SetWindowAction(window, TXT_HORIZ_LEFT, NULL); + TXT_SetWindowAction(window, TXT_HORIZ_CENTER, + TXT_NewWindowAbortAction(window)); + TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, NULL); + + label = TXT_NewLabel("Press the new key..."); + + TXT_AddWidget(window, label); + TXT_SetWidgetAlign(label, TXT_HORIZ_CENTER); + + TXT_SetKeyListener(window, KeyPressCallback, key_input); + + // Disable key mappings while we prompt for the key press + + TXT_EnableKeyMapping(0); +} + +static void TXT_KeyInputSizeCalc(TXT_UNCAST_ARG(key_input)) +{ + TXT_CAST_ARG(txt_key_input_t, key_input); + + // All keyinputs are the same size. + + key_input->widget.w = KEY_INPUT_WIDTH; + key_input->widget.h = 1; +} + + +static void TXT_KeyInputDrawer(TXT_UNCAST_ARG(key_input), int selected) +{ + TXT_CAST_ARG(txt_key_input_t, key_input); + char buf[20]; + int i; + + if (*key_input->variable == 0) + { + strcpy(buf, ""); + } + else + { + TXT_GetKeyDescription(*key_input->variable, buf); + } + + if (selected) + { + TXT_BGColor(TXT_COLOR_GREY, 0); + } + else + { + TXT_BGColor(TXT_COLOR_BLUE, 0); + } + + TXT_FGColor(TXT_COLOR_BRIGHT_WHITE); + + TXT_DrawString(buf); + + for (i=strlen(buf); ivariable = variable; + + return key_input; +} + diff --git a/src/setup/txt_keyinput.h b/src/setup/txt_keyinput.h new file mode 100644 index 00000000..4952a970 --- /dev/null +++ b/src/setup/txt_keyinput.h @@ -0,0 +1,44 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright(C) 2006 Simon Howard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// + +#ifndef TXT_KEY_INPUT_H +#define TXT_KEY_INPUT_H + +typedef struct txt_key_input_s txt_key_input_t; + +#include "txt_widget.h" + +// +// A key input is like an input box. When selected, a box pops up +// allowing a key to be selected. +// + +struct txt_key_input_s +{ + txt_widget_t widget; + int *variable; +}; + +txt_key_input_t *TXT_NewKeyInput(int *variable); + +#endif /* #ifndef TXT_KEY_INPUT_H */ + + diff --git a/src/setup/txt_mouseinput.c b/src/setup/txt_mouseinput.c new file mode 100644 index 00000000..05c89b39 --- /dev/null +++ b/src/setup/txt_mouseinput.c @@ -0,0 +1,186 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright(C) 2006 Simon Howard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// + +#include +#include +#include + +#include "doomkeys.h" + +#include "txt_mouseinput.h" +#include "txt_gui.h" +#include "txt_io.h" +#include "txt_label.h" +#include "txt_window.h" + +#define MOUSE_INPUT_WIDTH 8 + +static int MousePressCallback(txt_window_t *window, + int x, int y, int b, + TXT_UNCAST_ARG(mouse_input)) +{ + TXT_CAST_ARG(txt_mouse_input_t, mouse_input); + + // Got the mouse press. Save to the variable and close the window. + + *mouse_input->variable = b - TXT_MOUSE_BASE; + TXT_EmitSignal(mouse_input, "set"); + TXT_CloseWindow(window); + + return 1; +} + +static void OpenPromptWindow(txt_mouse_input_t *mouse_input) +{ + txt_window_t *window; + txt_label_t *label; + + window = TXT_NewWindow(NULL); + TXT_SetWindowAction(window, TXT_HORIZ_LEFT, NULL); + TXT_SetWindowAction(window, TXT_HORIZ_CENTER, + TXT_NewWindowAbortAction(window)); + TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, NULL); + + label = TXT_NewLabel("Press the new mouse button..."); + + TXT_AddWidget(window, label); + TXT_SetWidgetAlign(label, TXT_HORIZ_CENTER); + + TXT_SetMouseListener(window, MousePressCallback, mouse_input); +} + +static void TXT_MouseInputSizeCalc(TXT_UNCAST_ARG(mouse_input)) +{ + TXT_CAST_ARG(txt_mouse_input_t, mouse_input); + + // All mouseinputs are the same size. + + mouse_input->widget.w = MOUSE_INPUT_WIDTH; + mouse_input->widget.h = 1; +} + +static void GetMouseButtonDescription(int button, char *buf) +{ + switch (button) + { + case 0: + strcpy(buf, "LEFT"); + break; + case 1: + strcpy(buf, "RIGHT"); + break; + case 2: + strcpy(buf, "MID"); + break; + default: + sprintf(buf, "BUTTON #%i", button); + break; + } +} + +static void TXT_MouseInputDrawer(TXT_UNCAST_ARG(mouse_input), int selected) +{ + TXT_CAST_ARG(txt_mouse_input_t, mouse_input); + char buf[20]; + int i; + + if (*mouse_input->variable < 0) + { + strcpy(buf, "(none)"); + } + else + { + GetMouseButtonDescription(*mouse_input->variable, buf); + } + + if (selected) + { + TXT_BGColor(TXT_COLOR_GREY, 0); + } + else + { + TXT_BGColor(TXT_COLOR_BLUE, 0); + } + + TXT_FGColor(TXT_COLOR_BRIGHT_WHITE); + + TXT_DrawString(buf); + + for (i=strlen(buf); ivariable = variable; + + return mouse_input; +} + diff --git a/src/setup/txt_mouseinput.h b/src/setup/txt_mouseinput.h new file mode 100644 index 00000000..57c258eb --- /dev/null +++ b/src/setup/txt_mouseinput.h @@ -0,0 +1,44 @@ +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright(C) 2006 Simon Howard +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// + +#ifndef TXT_MOUSE_INPUT_H +#define TXT_MOUSE_INPUT_H + +typedef struct txt_mouse_input_s txt_mouse_input_t; + +#include "txt_widget.h" + +// +// A mouse input is like an input box. When selected, a box pops up +// allowing a mouse to be selected. +// + +struct txt_mouse_input_s +{ + txt_widget_t widget; + int *variable; +}; + +txt_mouse_input_t *TXT_NewMouseInput(int *variable); + +#endif /* #ifndef TXT_MOUSE_INPUT_H */ + + -- cgit v1.2.3