diff options
Diffstat (limited to 'setup')
-rw-r--r-- | setup/.gitignore | 6 | ||||
-rw-r--r-- | setup/Makefile.am | 50 | ||||
-rw-r--r-- | setup/compatibility.c | 46 | ||||
-rw-r--r-- | setup/compatibility.h | 31 | ||||
-rw-r--r-- | setup/configfile.c | 725 | ||||
-rw-r--r-- | setup/configfile.h | 44 | ||||
-rw-r--r-- | setup/display.c | 450 | ||||
-rw-r--r-- | setup/display.h | 37 | ||||
-rw-r--r-- | setup/execute.c | 407 | ||||
-rw-r--r-- | setup/execute.h | 45 | ||||
-rw-r--r-- | setup/joystick.c | 439 | ||||
-rw-r--r-- | setup/joystick.h | 42 | ||||
-rw-r--r-- | setup/keyboard.c | 348 | ||||
-rw-r--r-- | setup/keyboard.h | 98 | ||||
-rw-r--r-- | setup/m_argv.c | 65 | ||||
-rw-r--r-- | setup/m_argv.h | 42 | ||||
-rw-r--r-- | setup/mainmenu.c | 237 | ||||
-rw-r--r-- | setup/mouse.c | 157 | ||||
-rw-r--r-- | setup/mouse.h | 45 | ||||
-rw-r--r-- | setup/multiplayer.c | 784 | ||||
-rw-r--r-- | setup/multiplayer.h | 36 | ||||
-rw-r--r-- | setup/setup-manifest.xml | 16 | ||||
-rw-r--r-- | setup/setup-res.rc.in | 24 | ||||
-rw-r--r-- | setup/setup_icon.c | 262 | ||||
-rw-r--r-- | setup/sound.c | 167 | ||||
-rw-r--r-- | setup/sound.h | 39 | ||||
-rw-r--r-- | setup/txt_joybinput.c | 228 | ||||
-rw-r--r-- | setup/txt_joybinput.h | 46 | ||||
-rw-r--r-- | setup/txt_keyinput.c | 193 | ||||
-rw-r--r-- | setup/txt_keyinput.h | 44 | ||||
-rw-r--r-- | setup/txt_mouseinput.c | 186 | ||||
-rw-r--r-- | setup/txt_mouseinput.h | 44 |
32 files changed, 0 insertions, 5383 deletions
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 22bcb224..00000000 --- a/setup/Makefile.am +++ /dev/null @@ -1,50 +0,0 @@ - -gamesdir = $(prefix)/games - -AM_CFLAGS = -I../textscreen -I../src -DINSTALL_DIR="\"$(gamesdir)\"" - -games_PROGRAMS = chocolate-setup - -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 - -chocolate_setup_LDADD = \ - ../wince/libc_wince.a \ - ../textscreen/libtextscreen.a \ - @LDFLAGS@ - -.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 <stdlib.h> - -#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 fe3c13de..00000000 --- a/setup/configfile.c +++ /dev/null @@ -1,725 +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 <stdio.h> -#include <stdlib.h> -#include <ctype.h> -#include <string.h> - -// for mkdir: - -#ifdef _WIN32 -#include <io.h> -#define WIN32_LEAN_AND_MEAN -#include <windows.h> -#else -#include <sys/stat.h> -#include <sys/types.h> -#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 -} - - -// -// M_SetConfigDir: -// -// Sets the location of the configuration directory, where configuration -// files are stored - default.cfg, chocolate-doom.cfg, savegames, etc. -// - -void M_SetConfigDir(void) -{ -#if !defined(_WIN32) || defined(_WIN32_WCE) - - // Configuration settings are stored in ~/.chocolate-doom/, - // except on Windows, where we behave like Vanilla Doom and - // save in the current directory. - - 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%c.%s%c", homedir, DIR_SEPARATOR, - PACKAGE_TARNAME, DIR_SEPARATOR); - - // make the directory if it doesnt already exist - - M_MakeDirectory(configdir); - } - else -#endif /* #ifndef _WIN32 */ - { -#if defined(_WIN32) && !defined(_WIN32_WCE) - // 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}, - - {"key_pause", &key_pause, DEFAULT_KEY, 0, 0}, - {"key_menu_activate", &key_menu_activate, DEFAULT_KEY, 0, 0}, - {"key_menu_up", &key_menu_up, DEFAULT_KEY, 0, 0}, - {"key_menu_down", &key_menu_down, DEFAULT_KEY, 0, 0}, - {"key_menu_left", &key_menu_left, DEFAULT_KEY, 0, 0}, - {"key_menu_right", &key_menu_right, DEFAULT_KEY, 0, 0}, - {"key_menu_back", &key_menu_back, DEFAULT_KEY, 0, 0}, - {"key_menu_forward", &key_menu_forward, DEFAULT_KEY, 0, 0}, - {"key_menu_confirm", &key_menu_confirm, DEFAULT_KEY, 0, 0}, - {"key_menu_abort", &key_menu_abort, DEFAULT_KEY, 0, 0}, - {"key_menu_help", &key_menu_help, DEFAULT_KEY, 0, 0}, - {"key_menu_save", &key_menu_save, DEFAULT_KEY, 0, 0}, - {"key_menu_load", &key_menu_load, DEFAULT_KEY, 0, 0}, - {"key_menu_volume", &key_menu_volume, DEFAULT_KEY, 0, 0}, - {"key_menu_detail", &key_menu_detail, DEFAULT_KEY, 0, 0}, - {"key_menu_qsave", &key_menu_qsave, DEFAULT_KEY, 0, 0}, - {"key_menu_endgame", &key_menu_endgame, DEFAULT_KEY, 0, 0}, - {"key_menu_messages", &key_menu_messages, DEFAULT_KEY, 0, 0}, - {"key_menu_qload", &key_menu_qload, DEFAULT_KEY, 0, 0}, - {"key_menu_quit", &key_menu_quit, DEFAULT_KEY, 0, 0}, - {"key_menu_gamma", &key_menu_gamma, DEFAULT_KEY, 0, 0}, - {"key_menu_incscreen", &key_menu_incscreen, DEFAULT_KEY, 0, 0}, - {"key_menu_decscreen", &key_menu_decscreen, DEFAULT_KEY, 0, 0}, - - {"key_map_toggle", &key_map_toggle, DEFAULT_KEY, 0, 0}, - {"key_map_north", &key_map_north, DEFAULT_KEY, 0, 0}, - {"key_map_south", &key_map_south, DEFAULT_KEY, 0, 0}, - {"key_map_east", &key_map_east, DEFAULT_KEY, 0, 0}, - {"key_map_west", &key_map_west, DEFAULT_KEY, 0, 0}, - {"key_map_zoomin", &key_map_zoomin, DEFAULT_KEY, 0, 0}, - {"key_map_zoomout", &key_map_zoomout, DEFAULT_KEY, 0, 0}, - {"key_map_maxzoom", &key_map_maxzoom, DEFAULT_KEY, 0, 0}, - {"key_map_follow", &key_map_follow, DEFAULT_KEY, 0, 0}, - {"key_map_grid", &key_map_grid, DEFAULT_KEY, 0, 0}, - {"key_map_mark", &key_map_mark, DEFAULT_KEY, 0, 0}, - {"key_map_clearmark", &key_map_clearmark, DEFAULT_KEY, 0, 0}, - {"key_weapon1", &key_weapon1, DEFAULT_KEY, 0, 0}, - {"key_weapon2", &key_weapon2, DEFAULT_KEY, 0, 0}, - {"key_weapon3", &key_weapon3, DEFAULT_KEY, 0, 0}, - {"key_weapon4", &key_weapon4, DEFAULT_KEY, 0, 0}, - {"key_weapon5", &key_weapon5, DEFAULT_KEY, 0, 0}, - {"key_weapon6", &key_weapon6, DEFAULT_KEY, 0, 0}, - {"key_weapon7", &key_weapon7, DEFAULT_KEY, 0, 0}, - {"key_weapon8", &key_weapon8, DEFAULT_KEY, 0, 0}, - {"key_message_refresh", &key_message_refresh, DEFAULT_KEY, 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 ; i<collection->numdefaults ; 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; i<collection->numdefaults; ++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<myargc-1) - { - doom_defaults.filename = myargv[i+1]; - printf (" default file: %s\n",doom_defaults.filename); - } - else - { - doom_defaults.filename = malloc(strlen(configdir) + 20); - sprintf(doom_defaults.filename, "%sdefault.cfg", configdir); - } - -// printf("saving config in %s\n", doom_defaults.filename); - - i = M_CheckParm("-extraconfig"); - - if (i && i<myargc-1) - { - extra_defaults.filename = myargv[i+1]; - printf(" extra configuration file: %s\n", - extra_defaults.filename); - } - else - { - extra_defaults.filename - = malloc(strlen(configdir) + strlen(PACKAGE_TARNAME) + 10); - sprintf(extra_defaults.filename, "%s%s.cfg", - configdir, PACKAGE_TARNAME); - } - - LoadDefaultCollection(&doom_defaults); - LoadDefaultCollection(&extra_defaults); -} - -// -// Save normal (default.cfg) defaults to a given file -// - -void M_SaveMainDefaults(char *filename) -{ - char *main_filename; - - // Save the normal filename and set this one - - main_filename = doom_defaults.filename; - doom_defaults.filename = filename; - - // Save the file - - SaveDefaultCollection(&doom_defaults); - - // Restore the normal filename - - doom_defaults.filename = main_filename; -} - -// -// Save extra (chocolate-doom.cfg) defaults to a given file -// - -void M_SaveExtraDefaults(char *filename) -{ - char *main_filename; - - // Save the normal filename and set this one - - main_filename = extra_defaults.filename; - extra_defaults.filename = filename; - - // Save the file - - SaveDefaultCollection(&extra_defaults); - - // Restore the normal filename - - extra_defaults.filename = main_filename; -} - -#ifdef _WIN32_WCE - -static int SystemHasKeyboard(void) -{ - HKEY key; - DWORD valtype; - DWORD valsize; - DWORD result; - - if (RegOpenKeyExW(HKEY_CURRENT_USER, - L"\\Software\\Microsoft\\Shell", 0, - KEY_READ, &key) != ERROR_SUCCESS) - { - return 0; - } - - valtype = REG_SZ; - valsize = sizeof(DWORD); - - if (RegQueryValueExW(key, L"HasKeyboard", NULL, &valtype, - (LPBYTE) &result, &valsize) != ERROR_SUCCESS) - { - result = 0; - } - - // Close the key - - RegCloseKey(key); - - return result; -} - -// -// Apply custom defaults for Windows CE. -// - -static void M_ApplyWindowsCEDefaults(void) -{ - // If the system doesn't have a keyboard, patch the default - // configuration to use the hardware keys. - - if (!SystemHasKeyboard()) - { - key_use = KEY_F1; - key_fire = KEY_F2; - key_menu_activate = KEY_F3; - key_map_toggle = KEY_F4; - - key_menu_help = 0; - key_menu_save = 0; - key_menu_load = 0; - key_menu_volume = 0; - - key_menu_confirm = KEY_ENTER; - key_menu_back = KEY_F2; - key_menu_abort = KEY_F2; - } -} - - -#endif - -// -// Apply custom patches to the default values depending on the -// platform we are running on. -// - -void M_ApplyPlatformDefaults(void) -{ -#ifdef _WIN32_WCE - M_ApplyWindowsCEDefaults(); -#endif -} - diff --git a/setup/configfile.h b/setup/configfile.h deleted file mode 100644 index 3ef2cf9b..00000000 --- a/setup/configfile.h +++ /dev/null @@ -1,44 +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: -// -// -//----------------------------------------------------------------------------- - - -#ifndef __SETUP_CONFIG__ -#define __SETUP_CONFIG__ - -extern char *configdir; - -void M_LoadDefaults (void); -void M_SaveDefaults (void); - -void M_SetConfigDir(void); - -void M_SaveMainDefaults(char *filename); -void M_SaveExtraDefaults(char *filename); - -void M_ApplyPlatformDefaults(void); - -#endif - diff --git a/setup/display.c b/setup/display.c deleted file mode 100644 index 596b8a43..00000000 --- a/setup/display.c +++ /dev/null @@ -1,450 +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 <string.h> - -#ifdef _WIN32_WCE -#include "libc_wince.h" -#endif - -#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 - { -#if defined(_WIN32) && !defined(_WIN32_WCE) - // 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); - - if (modes == NULL || modes == (SDL_Rect **) -1) - { - num_modes = 0; - } - else - { - 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; i<num_modes; ++i) - { - screen_modes_fullscreen[i].w = modes[i]->w; - 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<num_modes / 2; ++i) - { - m1 = &screen_modes_fullscreen[i]; - m2 = &screen_modes_fullscreen[num_modes - 1 - i]; - - memcpy(&m, m1, sizeof(screen_mode_t)); - memcpy(m1, m2, sizeof(screen_mode_t)); - memcpy(m2, &m, sizeof(screen_mode_t)); - } -} - -static int FindBestMode(screen_mode_t *modes) -{ - int i; - int best_mode; - int best_mode_diff; - int diff; - - best_mode = -1; - best_mode_diff = 0; - - for (i=0; modes[i].w != 0; ++i) - { - if (fullscreen && !GoodFullscreenMode(&modes[i])) - { - continue; - } - - diff = (selected_screen_width - modes[i].w) - * (selected_screen_width - modes[i].w) - + (selected_screen_height - modes[i].h) - * (selected_screen_height - modes[i].h); - - if (best_mode == -1 || diff < best_mode_diff) - { - best_mode_diff = diff; - best_mode = i; - } - } - - return best_mode; -} - -static void GenerateModesTable(TXT_UNCAST_ARG(widget), - TXT_UNCAST_ARG(modes_table)) -{ - TXT_CAST_ARG(txt_table_t, modes_table); - char buf[15]; - screen_mode_t *modes; - txt_radiobutton_t *rbutton; - int i; - - // Pick which modes list to use - - if (fullscreen) - { - if (screen_modes_fullscreen == NULL) - { - BuildFullscreenModesList(); - } - - modes = screen_modes_fullscreen; - } - else if (aspect_ratio_correct) - { - modes = screen_modes_scaled; - } - else - { - modes = screen_modes_unscaled; - } - - // Build the table - - TXT_ClearTable(modes_table); - TXT_SetColumnWidths(modes_table, 15, 15, 15); - - for (i=0; modes[i].w != 0; ++i) - { - // Skip bad fullscreen modes - - if (fullscreen && !GoodFullscreenMode(&modes[i])) - { - continue; - } - - sprintf(buf, "%ix%i", modes[i].w, modes[i].h); - rbutton = TXT_NewRadioButton(buf, &vidmode, i); - TXT_AddWidget(modes_table, rbutton); - TXT_SignalConnect(rbutton, "selected", ModeSelected, &modes[i]); - } - - // Find the nearest mode in the list that matches the current - // settings - - vidmode = FindBestMode(modes); - - screen_width = modes[vidmode].w; - screen_height = modes[vidmode].h; -} - -#if defined(_WIN32) && !defined(_WIN32_WCE) - -static int win32_video_driver = 0; - -static char *win32_video_drivers[] = -{ - "DirectX", - "Windows GDI", -}; - -// Restart the textscreen library. Used when the video_driver variable -// is changed. - -static void RestartTextscreen(void) -{ - TXT_Shutdown(); - - SetDisplayDriver(); - - TXT_Init(); -} - -static void SetWin32VideoDriver(void) -{ - if (!strcmp(video_driver, "windib")) - { - win32_video_driver = 1; - } - else - { - win32_video_driver = 0; - } -} - -static void UpdateVideoDriver(TXT_UNCAST_ARG(widget), - TXT_UNCAST_ARG(modes_table)) -{ - TXT_CAST_ARG(txt_table_t, modes_table); - char *drivers[] = - { - "", - "windib", - }; - - video_driver = drivers[win32_video_driver != 0]; - - // When the video driver is changed, we need to restart the textscreen - // library. - - RestartTextscreen(); - - // Rebuild the video modes list - - BuildFullscreenModesList(); - GenerateModesTable(NULL, modes_table); -} - -#endif - - -void ConfigDisplay(void) -{ - txt_window_t *window; - txt_table_t *modes_table; - txt_checkbox_t *fs_checkbox; - txt_checkbox_t *ar_checkbox; - - // First time in? Initialise selected_screen_{width,height} - - if (selected_screen_width == 0) - { - selected_screen_width = screen_width; - selected_screen_height = screen_height; - } - - // Open the window - - window = TXT_NewWindow("Display Configuration"); - - TXT_SetWindowPosition(window, TXT_HORIZ_CENTER, TXT_VERT_TOP, - TXT_SCREEN_W / 2, 5); - - TXT_AddWidgets(window, - fs_checkbox = TXT_NewCheckBox("Fullscreen", &fullscreen), - ar_checkbox = TXT_NewCheckBox("Correct aspect ratio", - &aspect_ratio_correct), - NULL); - - modes_table = TXT_NewTable(3); - - // On Windows, there is an extra control to change between - // the Windows GDI and DirectX video drivers. - -#if defined(_WIN32) && !defined(_WIN32_WCE) - { - txt_table_t *driver_table; - txt_dropdown_list_t *driver_list; - - driver_table = TXT_NewTable(2); - - TXT_SetColumnWidths(driver_table, 20, 0); - - TXT_AddWidgets(driver_table, - TXT_NewLabel("Video driver"), - driver_list = TXT_NewDropdownList(&win32_video_driver, - win32_video_drivers, - 2), - NULL); - - TXT_SignalConnect(driver_list, "changed", - UpdateVideoDriver, modes_table); - SetWin32VideoDriver(); - - TXT_AddWidget(window, driver_table); - } -#endif - - // Screen modes list - - TXT_AddWidgets(window, - TXT_NewSeparator("Screen mode"), - modes_table, - TXT_NewSeparator("Misc."), - TXT_NewCheckBox("Show ENDOOM screen", &show_endoom), - NULL); - - TXT_SignalConnect(fs_checkbox, "changed", GenerateModesTable, modes_table); - TXT_SignalConnect(ar_checkbox, "changed", GenerateModesTable, modes_table); - - GenerateModesTable(NULL, modes_table); -} - diff --git a/setup/display.h b/setup/display.h deleted file mode 100644 index f0c76184..00000000 --- a/setup/display.h +++ /dev/null @@ -1,37 +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_DISPLAY_H -#define SETUP_DISPLAY_H - -extern int autoadjust_video_settings; -extern int aspect_ratio_correct; -extern int fullscreen; -extern int screen_width, screen_height; -extern int startup_delay; -extern int show_endoom; -extern char *video_driver; - -void ConfigDisplay(void); -void SetDisplayDriver(void); - -#endif /* #ifndef SETUP_DISPLAY_H */ - diff --git a/setup/execute.c b/setup/execute.c deleted file mode 100644 index 03a4f65c..00000000 --- a/setup/execute.c +++ /dev/null @@ -1,407 +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. -// - -// Code for invoking Doom - -#include <stdarg.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include <sys/types.h> - -#if defined(_WIN32_WCE) -#include "libc_wince.h" -#endif - -#ifdef _WIN32 - -#define WIN32_LEAN_AND_MEAN -#include <windows.h> -#include <process.h> - -#else - -#include <sys/wait.h> -#include <unistd.h> - -#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"); -} - -#if defined(_WIN32) - -// Wait for the specified process to exit. Returns the exit code. - -static unsigned int WaitForProcessExit(HANDLE subprocess) -{ - DWORD exit_code; - - for (;;) - { - WaitForSingleObject(subprocess, INFINITE); - - if (!GetExitCodeProcess(subprocess, &exit_code)) - { - return -1; - } - - if (exit_code != STILL_ACTIVE) - { - return exit_code; - } - } -} - -static wchar_t *GetFullExePath(const char *program) -{ - wchar_t *result; - unsigned int path_len; - char *sep; - - // Find the full path to the EXE to execute, by taking the path - // to this program and concatenating the EXE name: - - sep = strrchr(myargv[0], DIR_SEPARATOR); - - if (sep == NULL) - { - path_len = 0; - result = calloc(strlen(program) + 1, sizeof(wchar_t)); - } - else - { - path_len = sep - myargv[0] + 1; - - result = calloc(path_len + strlen(program) + 1, - sizeof(wchar_t)); - MultiByteToWideChar(CP_OEMCP, 0, - myargv[0], path_len, - result, path_len); - } - - MultiByteToWideChar(CP_OEMCP, 0, - program, strlen(program) + 1, - result + path_len, strlen(program) + 1); - - return result; -} - -// Convert command line argument to wchar_t string and add surrounding -// "" quotes: - -static wchar_t *GetPaddedWideArg(const char *arg) -{ - wchar_t *result; - unsigned int len = strlen(arg); - - // Convert the command line arg to a wide char string: - - result = calloc(len + 3, sizeof(wchar_t)); - MultiByteToWideChar(CP_OEMCP, 0, - arg, len + 1, - result + 1, len + 1); - - // Surrounding quotes: - - result[0] = '"'; - result[len + 1] = '"'; - result[len + 2] = 0; - - return result; -} - -static int ExecuteCommand(const char *program, const char *arg) -{ - PROCESS_INFORMATION proc_info; - wchar_t *exe_path; - wchar_t *warg; - int result = 0; - - exe_path = GetFullExePath(program); - warg = GetPaddedWideArg(arg); - - // Invoke the program: - - memset(&proc_info, 0, sizeof(proc_info)); - - if (!CreateProcessW(exe_path, warg, - NULL, NULL, FALSE, 0, NULL, NULL, NULL, - &proc_info)) - { - result = -1; - } - else - { - // Wait for the process to finish, and save the exit code. - - result = WaitForProcessExit(proc_info.hProcess); - - CloseHandle(proc_info.hProcess); - CloseHandle(proc_info.hThread); - } - - free(exe_path); - free(warg); - - return result; -} - -#else - -static int ExecuteCommand(const char *program, const char *arg) -{ - pid_t childpid; - int result; - const char *argv[] = { program, arg, NULL }; - - 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) -{ - 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); - - // Run Doom - - result = ExecuteCommand(DOOM_BINARY, response_file_arg); - - 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 fa59c559..00000000 --- a/setup/joystick.c +++ /dev/null @@ -1,439 +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 <stdlib.h> - -#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<num_joysticks; ++i) - { - all_joysticks[i] = SDL_JoystickOpen(i); - - // If any joystick is successfully opened, return true. - - if (all_joysticks[i] != NULL) - { - result = 1; - } - } - - // Success? Turn on joystick events. - - if (result) - { - SDL_JoystickEventState(SDL_ENABLE); - } - else - { - free(all_joysticks); - all_joysticks = NULL; - } - - return result; -} - -// Close all the joysticks opened with OpenAllJoysticks() - -static void CloseAllJoysticks(void) -{ - int i; - int num_joysticks; - - num_joysticks = SDL_NumJoysticks(); - - for (i=0; i<num_joysticks; ++i) - { - if (all_joysticks[i] != NULL) - { - SDL_JoystickClose(all_joysticks[i]); - } - } - - SDL_JoystickEventState(SDL_DISABLE); - - free(all_joysticks); - all_joysticks = NULL; -} - -static void SetCalibrationLabel(void) -{ - char *message = "???"; - - switch (calibrate_stage) - { - case CALIBRATE_CENTER: - message = "Move the joystick to the\n" - "center, and press a button."; - break; - case CALIBRATE_UP: - message = "Move the joystick up,\n" - "and press a button."; - break; - case CALIBRATE_LEFT: - message = "Move the joystick to the\n" - "left, and press a button."; - break; - } - - TXT_SetLabel(calibration_label, message); -} - -static void CalibrateAxis(int *axis_index, int *axis_invert) -{ - SDL_Joystick *joystick; - int best_axis; - int best_value; - int best_invert; - Sint16 axis_value; - int i; - - joystick = all_joysticks[joystick_index]; - - // Check all axes to find which axis has the largest value. We test - // for one axis at a time, so eg. when we prompt to push the joystick - // left, whichever axis has the largest value is the left axis. - - best_axis = 0; - best_value = 0; - best_invert = 0; - - for (i=0; i<SDL_JoystickNumAxes(joystick); ++i) - { - axis_value = SDL_JoystickGetAxis(joystick, i); - - if (abs(axis_value) > 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<arrlen(all_joystick_buttons); ++i) - { - if (variable != all_joystick_buttons[i] - && *variable == *all_joystick_buttons[i]) - { - *all_joystick_buttons[i] = -1; - } - } -} - - -// -// GUI -// - -static void JoystickWindowClosed(TXT_UNCAST_ARG(window), TXT_UNCAST_ARG(unused)) -{ - if (joystick_initted) - { - SDL_QuitSubSystem(SDL_INIT_JOYSTICK); - joystick_initted = 0; - } -} - -static void AddJoystickControl(txt_table_t *table, char *label, int *var) -{ - txt_joystick_input_t *joy_input; - - joy_input = TXT_NewJoystickInput(var); - - TXT_AddWidget(table, TXT_NewLabel(label)); - TXT_AddWidget(table, joy_input); - - TXT_SignalConnect(joy_input, "set", JoyButtonSetCallback, var); -} - -void ConfigJoystick(void) -{ - txt_window_t *window; - txt_table_t *button_table; - txt_table_t *joystick_table; - - if (!joystick_initted) - { - joystick_initted = SDL_Init(SDL_INIT_JOYSTICK) >= 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 79cb90e7..00000000 --- a/setup/keyboard.c +++ /dev/null @@ -1,348 +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 key_pause = KEY_PAUSE; - -// Menu keys: - -int key_menu_activate = KEY_ESCAPE; -int key_menu_up = KEY_UPARROW; -int key_menu_down = KEY_DOWNARROW; -int key_menu_left = KEY_LEFTARROW; -int key_menu_right = KEY_RIGHTARROW; -int key_menu_back = KEY_BACKSPACE; -int key_menu_forward = KEY_ENTER; -int key_menu_confirm = 'y'; -int key_menu_abort = 'n'; - -int key_menu_help = KEY_F1; -int key_menu_save = KEY_F2; -int key_menu_load = KEY_F3; -int key_menu_volume = KEY_F4; -int key_menu_detail = KEY_F5; -int key_menu_qsave = KEY_F6; -int key_menu_endgame = KEY_F7; -int key_menu_messages = KEY_F8; -int key_menu_qload = KEY_F9; -int key_menu_quit = KEY_F10; -int key_menu_gamma = KEY_F11; - -int key_menu_incscreen = KEY_EQUALS; -int key_menu_decscreen = KEY_MINUS; - -int key_map_north = KEY_UPARROW; -int key_map_south = KEY_DOWNARROW; -int key_map_east = KEY_RIGHTARROW; -int key_map_west = KEY_LEFTARROW; -int key_map_zoomin = '='; -int key_map_zoomout = '-'; -int key_map_toggle = KEY_TAB; -int key_map_maxzoom = '0'; -int key_map_follow = 'f'; -int key_map_grid = 'g'; -int key_map_mark = 'm'; -int key_map_clearmark = 'c'; - -int key_weapon1 = '1'; -int key_weapon2 = '2'; -int key_weapon3 = '3'; -int key_weapon4 = '4'; -int key_weapon5 = '5'; -int key_weapon6 = '6'; -int key_weapon7 = '7'; -int key_weapon8 = '8'; - -int key_message_refresh = KEY_ENTER; - -int vanilla_keyboard_mapping = 1; - -static int always_run = 0; - -// Keys within these groups cannot have the same value. - -static int *controls[] = { &key_left, &key_right, &key_up, &key_down, - &key_strafeleft, &key_straferight, &key_fire, - &key_use, &key_strafe, &key_speed, - &key_pause, - &key_weapon1, &key_weapon2, &key_weapon3, - &key_weapon4, &key_weapon5, &key_weapon6, - &key_weapon7, &key_weapon8, NULL }; - -static int *menu_nav[] = { &key_menu_activate, &key_menu_up, &key_menu_down, - &key_menu_left, &key_menu_right, &key_menu_back, - &key_menu_forward, NULL }; - -static int *shortcuts[] = { &key_menu_help, &key_menu_save, &key_menu_load, - &key_menu_volume, &key_menu_detail, &key_menu_qsave, - &key_menu_endgame, &key_menu_messages, - &key_menu_qload, &key_menu_quit, &key_menu_gamma, - &key_menu_incscreen, &key_menu_decscreen, - &key_message_refresh, NULL }; - -static int *map_keys[] = { &key_map_north, &key_map_south, &key_map_east, - &key_map_west, &key_map_zoomin, &key_map_zoomout, - &key_map_toggle, &key_map_maxzoom, &key_map_follow, - &key_map_grid, &key_map_mark, &key_map_clearmark, - NULL }; - -static void UpdateJoybSpeed(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(var)) -{ - if (always_run) - { - /* - <Janizdreg> 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; - } -} - -static int VarInGroup(int *variable, int **group) -{ - unsigned int i; - - for (i=0; group[i] != NULL; ++i) - { - if (group[i] == variable) - { - return 1; - } - } - - return 0; -} - -static void CheckKeyGroup(int *variable, int **group) -{ - unsigned int i; - - // Don't check unless the variable is in this group. - - if (!VarInGroup(variable, group)) - { - return; - } - - // If another variable has the same value as the new value, reset it. - - for (i=0; group[i] != NULL; ++i) - { - if (*variable == *group[i] && group[i] != variable) - { - // A different key has the same value. Clear the existing - // value. This ensures that no two keys can have the same - // value. - - *group[i] = 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); - - CheckKeyGroup(variable, controls); - CheckKeyGroup(variable, menu_nav); - CheckKeyGroup(variable, shortcuts); - CheckKeyGroup(variable, map_keys); -} - -// Add a label and keyboard input to the specified table. - -static void AddKeyControl(txt_table_t *table, char *name, int *var) -{ - txt_key_input_t *key_input; - - TXT_AddWidget(table, TXT_NewLabel(name)); - key_input = TXT_NewKeyInput(var); - TXT_AddWidget(table, key_input); - - TXT_SignalConnect(key_input, "set", KeySetCallback, var); -} - -static void OtherKeysDialog(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(unused)) -{ - txt_window_t *window; - txt_table_t *table; - txt_scrollpane_t *scrollpane; - - window = TXT_NewWindow("Other keys"); - - table = TXT_NewTable(2); - - TXT_SetColumnWidths(table, 25, 10); - - TXT_AddWidgets(table, TXT_NewLabel(" - Weapons - "), - TXT_NewStrut(0, 0), - NULL); - - AddKeyControl(table, "Weapon 1", &key_weapon1); - AddKeyControl(table, "Weapon 2", &key_weapon2); - AddKeyControl(table, "Weapon 3", &key_weapon3); - AddKeyControl(table, "Weapon 4", &key_weapon4); - AddKeyControl(table, "Weapon 5", &key_weapon5); - AddKeyControl(table, "Weapon 6", &key_weapon6); - AddKeyControl(table, "Weapon 7", &key_weapon7); - AddKeyControl(table, "Weapon 8", &key_weapon8); - - TXT_AddWidgets(table, TXT_NewStrut(0, 1), - TXT_NewStrut(0, 1), - TXT_NewLabel(" - Menu navigation - "), - TXT_NewStrut(0, 0), - NULL); - - AddKeyControl(table, "Activate menu", &key_menu_activate); - AddKeyControl(table, "Move cursor up", &key_menu_up); - AddKeyControl(table, "Move cursor down", &key_menu_down); - AddKeyControl(table, "Move slider left", &key_menu_left); - AddKeyControl(table, "Move slider right", &key_menu_right); - AddKeyControl(table, "Go to previous menu", &key_menu_back); - AddKeyControl(table, "Activate menu item", &key_menu_forward); - AddKeyControl(table, "Confirm action", &key_menu_confirm); - AddKeyControl(table, "Cancel action", &key_menu_abort); - - TXT_AddWidgets(table, TXT_NewStrut(0, 1), - TXT_NewStrut(0, 1), - TXT_NewLabel(" - Shortcut keys - "), - TXT_NewStrut(0, 0), - NULL); - - AddKeyControl(table, "Pause game", &key_pause); - AddKeyControl(table, "Help screen", &key_menu_help); - AddKeyControl(table, "Save game", &key_menu_save); - AddKeyControl(table, "Load game", &key_menu_load); - AddKeyControl(table, "Sound volume", &key_menu_volume); - AddKeyControl(table, "Toggle detail", &key_menu_detail); - AddKeyControl(table, "Quick save", &key_menu_qsave); - AddKeyControl(table, "End game", &key_menu_endgame); - AddKeyControl(table, "Toggle messages", &key_menu_messages); - AddKeyControl(table, "Quick load", &key_menu_qload); - AddKeyControl(table, "Quit game", &key_menu_quit); - AddKeyControl(table, "Toggle gamma", &key_menu_gamma); - - AddKeyControl(table, "Increase screen size", &key_menu_incscreen); - AddKeyControl(table, "Decrease screen size", &key_menu_decscreen); - - AddKeyControl(table, "Display last message", &key_message_refresh); - - TXT_AddWidgets(table, TXT_NewStrut(0, 1), - TXT_NewStrut(0, 1), - TXT_NewLabel(" - Map - "), - TXT_NewStrut(0, 0), - NULL); - - AddKeyControl(table, "Toggle map", &key_map_toggle); - AddKeyControl(table, "Zoom in", &key_map_zoomin); - AddKeyControl(table, "Zoom out", &key_map_zoomout); - AddKeyControl(table, "Maximum zoom out", &key_map_maxzoom); - AddKeyControl(table, "Follow mode", &key_map_follow); - AddKeyControl(table, "Pan north", &key_map_north); - AddKeyControl(table, "Pan south", &key_map_south); - AddKeyControl(table, "Pan east", &key_map_east); - AddKeyControl(table, "Pan west", &key_map_west); - AddKeyControl(table, "Toggle grid", &key_map_grid); - AddKeyControl(table, "Mark location", &key_map_mark); - AddKeyControl(table, "Clear all marks", &key_map_clearmark); - - scrollpane = TXT_NewScrollPane(0, 12, table); - - TXT_AddWidget(window, scrollpane); -} - -void ConfigKeyboard(void) -{ - txt_window_t *window; - txt_table_t *movement_table; - txt_table_t *action_table; - txt_checkbox_t *run_control; - - always_run = joybspeed >= 20; - - window = TXT_NewWindow("Keyboard configuration"); - - TXT_AddWidgets(window, - TXT_NewSeparator("Movement"), - movement_table = TXT_NewTable(4), - - TXT_NewSeparator("Action"), - action_table = TXT_NewTable(4), - TXT_NewButton2("Other keys...", OtherKeysDialog, NULL), - NULL); - - TXT_AddWidgets(window, - 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, 15, 4, 15, 4); - - TXT_SignalConnect(run_control, "changed", UpdateJoybSpeed, NULL); - - AddKeyControl(movement_table, "Move Forward", &key_up); - AddKeyControl(movement_table, " Strafe Left", &key_strafeleft); - AddKeyControl(movement_table, "Move Backward", &key_down); - AddKeyControl(movement_table, " Strafe Right", &key_straferight); - AddKeyControl(movement_table, "Turn Left", &key_left); - AddKeyControl(movement_table, " Speed On", &key_speed); - AddKeyControl(movement_table, "Turn Right", &key_right); - AddKeyControl(movement_table, " Strafe On", &key_strafe); - - TXT_SetColumnWidths(action_table, 15, 4, 15, 4); - - AddKeyControl(action_table, "Fire/Attack", &key_fire); - AddKeyControl(action_table, " Use", &key_use); - - TXT_SetWindowAction(window, TXT_HORIZ_CENTER, TestConfigAction()); -} - diff --git a/setup/keyboard.h b/setup/keyboard.h deleted file mode 100644 index fa3c0db3..00000000 --- a/setup/keyboard.h +++ /dev/null @@ -1,98 +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; - -extern int key_pause; - -// Menu keys: - -extern int key_menu_activate; -extern int key_menu_up; -extern int key_menu_down; -extern int key_menu_left; -extern int key_menu_right; -extern int key_menu_back; -extern int key_menu_forward; -extern int key_menu_confirm; -extern int key_menu_abort; - -extern int key_menu_help; -extern int key_menu_save; -extern int key_menu_load; -extern int key_menu_volume; -extern int key_menu_detail; -extern int key_menu_qsave; -extern int key_menu_endgame; -extern int key_menu_messages; -extern int key_menu_qload; -extern int key_menu_quit; -extern int key_menu_gamma; - -extern int key_menu_incscreen; -extern int key_menu_decscreen; - -// Automap keys: - -extern int key_map_north; -extern int key_map_south; -extern int key_map_east; -extern int key_map_west; -extern int key_map_zoomin; -extern int key_map_zoomout; -extern int key_map_toggle; -extern int key_map_maxzoom; -extern int key_map_follow; -extern int key_map_grid; -extern int key_map_mark; -extern int key_map_clearmark; - -// Weapon keys: - -extern int key_weapon1; -extern int key_weapon2; -extern int key_weapon3; -extern int key_weapon4; -extern int key_weapon5; -extern int key_weapon6; -extern int key_weapon7; -extern int key_weapon8; - -extern int key_message_refresh; - -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 <string.h> - -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 <strings.h> -#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<myargc;i++) - { - if ( !strcasecmp(check, myargv[i]) ) - return i; - } - - return 0; -} - - - - diff --git a/setup/m_argv.h b/setup/m_argv.h deleted file mode 100644 index bd1518b9..00000000 --- a/setup/m_argv.h +++ /dev/null @@ -1,42 +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: -// Nil. -// -//----------------------------------------------------------------------------- - - -#ifndef __M_ARGV__ -#define __M_ARGV__ - -// -// MISC -// -extern int myargc; -extern char** myargv; - -// Returns the position of the given parameter -// in the arg list (0 if not found). -int M_CheckParm (char* check); - - -#endif diff --git a/setup/mainmenu.c b/setup/mainmenu.c deleted file mode 100644 index c7e4f48d..00000000 --- a/setup/mainmenu.c +++ /dev/null @@ -1,237 +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 <stdlib.h> -#include <string.h> - -#ifdef _WIN32_WCE -#include "libc_wince.h" -#endif - -#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) -{ - M_ApplyPlatformDefaults(); - - 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<setup_icon_w * setup_icon_h; ++i) - { - if (setup_icon_data[i * 3] != 0x00 - || setup_icon_data[i * 3 + 1] != 0x00 - || setup_icon_data[i * 3 + 2] != 0x00) - { - mask[i / 8] |= 1 << (7 - i % 8); - } - } - - - surface = SDL_CreateRGBSurfaceFrom(setup_icon_data, - setup_icon_w, - setup_icon_h, - 24, - setup_icon_w * 3, - 0xff << 0, - 0xff << 8, - 0xff << 16, - 0); - - SDL_WM_SetIcon(surface, mask); - SDL_FreeSurface(surface); - free(mask); -} - -// -// Initialise and run the textscreen GUI. -// - -static void RunGUI(void) -{ - SetDisplayDriver(); - - if (!TXT_Init()) - { - fprintf(stderr, "Failed to initialise GUI\n"); - exit(-1); - } - - TXT_SetDesktopTitle(PACKAGE_NAME " Setup ver " PACKAGE_VERSION); - SetIcon(); - - MainMenu(); - - TXT_GUIMainLoop(); -} - -int main(int argc, char *argv[]) -{ - myargc = argc; - myargv = argv; - -#ifdef _WIN32_WCE - - // Windows CE has no environment, but SDL provides an implementation. - // Populate the environment with the values we normally find. - - PopulateEnvironment(); - -#endif - - InitConfig(); - RunGUI(); - - return 0; -} - diff --git a/setup/mouse.c b/setup/mouse.c deleted file mode 100644 index 49266d48..00000000 --- a/setup/mouse.c +++ /dev/null @@ -1,157 +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 <stdlib.h> - -#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<arrlen(all_mouse_buttons); ++i) - { - if (*all_mouse_buttons[i] == *variable - && all_mouse_buttons[i] != variable) - { - *all_mouse_buttons[i] = -1; - } - } -} - -static void AddMouseControl(txt_table_t *table, char *label, int *var) -{ - txt_mouse_input_t *mouse_input; - - TXT_AddWidget(table, TXT_NewLabel(label)); - - mouse_input = TXT_NewMouseInput(var); - TXT_AddWidget(table, mouse_input); - - TXT_SignalConnect(mouse_input, "set", MouseSetCallback, var); -} - -static void ConfigExtraButtons(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(unused)) -{ - txt_window_t *window; - txt_table_t *buttons_table; - - window = TXT_NewWindow("Additional mouse buttons"); - - TXT_AddWidgets(window, - buttons_table = TXT_NewTable(2), - NULL); - - TXT_SetColumnWidths(buttons_table, 29, 5); - - AddMouseControl(buttons_table, "Move backward", &mousebbackward); - AddMouseControl(buttons_table, "Use", &mousebuse); - AddMouseControl(buttons_table, "Strafe left", &mousebstrafeleft); - AddMouseControl(buttons_table, "Strafe right", &mousebstraferight); -} - -void ConfigMouse(void) -{ - txt_window_t *window; - txt_table_t *motion_table; - txt_table_t *buttons_table; - txt_button_t *more_buttons; - - window = TXT_NewWindow("Mouse configuration"); - - TXT_AddWidgets(window, - TXT_NewCheckBox("Enable mouse", &usemouse), - TXT_NewInvertedCheckBox("Allow vertical mouse movement", - &novert), - TXT_NewCheckBox("Grab mouse in windowed mode", - &grabmouse), - TXT_NewCheckBox("Double click acts as \"use\"", - &dclick_use), - - TXT_NewSeparator("Mouse motion"), - motion_table = TXT_NewTable(2), - - TXT_NewSeparator("Buttons"), - buttons_table = TXT_NewTable(2), - more_buttons = TXT_NewButton("More buttons..."), - - NULL); - - TXT_SetColumnWidths(motion_table, 27, 5); - - TXT_AddWidgets(motion_table, - TXT_NewLabel("Speed"), - TXT_NewSpinControl(&mouseSensitivity, 1, 256), - TXT_NewLabel("Acceleration"), - TXT_NewFloatSpinControl(&mouse_acceleration, 1.0, 5.0), - TXT_NewLabel("Acceleration threshold"), - TXT_NewSpinControl(&mouse_threshold, 0, 32), - NULL); - - TXT_SetColumnWidths(buttons_table, 27, 5); - - AddMouseControl(buttons_table, "Move forward", &mousebforward); - AddMouseControl(buttons_table, "Strafe on", &mousebstrafe); - AddMouseControl(buttons_table, "Fire weapon", &mousebfire); - - TXT_SetWindowAction(window, TXT_HORIZ_CENTER, TestConfigAction()); - - TXT_SignalConnect(more_buttons, "pressed", ConfigExtraButtons, NULL); -} - diff --git a/setup/mouse.h b/setup/mouse.h deleted file mode 100644 index f0a39ade..00000000 --- a/setup/mouse.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 SETUP_MOUSE_H -#define SETUP_MOUSE_H - -extern int usemouse; - -extern int novert; -extern int mouseSensitivity; -extern float mouse_acceleration; -extern int mouse_threshold; -extern int grabmouse; -extern int mousebfire; -extern int mousebforward; -extern int mousebstrafe; -extern int mousebstrafeleft; -extern int mousebstraferight; -extern int mousebbackward; -extern int mousebuse; -extern int dclick_use; - -void ConfigMouse(void); - - -#endif /* #ifndef SETUP_MOUSE_H */ - diff --git a/setup/multiplayer.c b/setup/multiplayer.c deleted file mode 100644 index ee46c3f1..00000000 --- a/setup/multiplayer.c +++ /dev/null @@ -1,784 +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 <stdio.h> -#include <stdlib.h> -#include <string.h> - -#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; - -typedef enum -{ - JOIN_AUTO_LAN, - JOIN_ADDRESS, -} jointype_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 int jointype = JOIN_ADDRESS; - -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<arrlen(iwads); ++i) - { - if (!strcmp(iwads[i].description, description)) - { - return &iwads[i]; - } - } - - return NULL; -} - -static iwad_t *GetCurrentIWAD(void) -{ - return GetIWADForDescription(found_iwads[found_iwad_selected]); -} - - -static void AddWADs(execute_context_t *exec) -{ - int have_wads = 0; - int i; - - for (i=0; i<NUM_WADS; ++i) - { - if (wads[i] != NULL && strlen(wads[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<NUM_EXTRA_PARAMS; ++i) - { - if (extra_params[i] != NULL && strlen(extra_params[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<arrlen(iwads); ++i) - { - if (installed_iwads & iwads[i].mask) - { - found_iwads[num_iwads] = iwads[i].description; - ++num_iwads; - } - } - - // If no IWADs are found, provide Doom 2 as an option, but - // we're probably screwed. - - if (num_iwads == 0) - { - found_iwads[0] = "Doom 2"; - num_iwads = 1; - } - - // Build a dropdown list of IWADs - - if (num_iwads < 2) - { - // We have only one IWAD. Show as a label. - - result = (txt_widget_t *) TXT_NewLabel(found_iwads[0]); - } - else - { - // Dropdown list allowing IWAD to be selected. - - dropdown = TXT_NewDropdownList(&found_iwad_selected, - found_iwads, num_iwads); - - TXT_SignalConnect(dropdown, "changed", IWADSelected, NULL); - - result = (txt_widget_t *) dropdown; - } - - // Select first in the list. - - found_iwad_selected = 0; - IWADSelected(NULL, NULL); - - return result; -} - -static txt_window_action_t *StartGameAction(void) -{ - txt_window_action_t *action; - - action = TXT_NewWindowAction(KEY_F10, "Start"); - TXT_SignalConnect(action, "pressed", StartGame, NULL); - - return action; -} - -static void OpenWadsWindow(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(user_data)) -{ - txt_window_t *window; - int i; - - window = TXT_NewWindow("Add WADs"); - - for (i=0; i<NUM_WADS; ++i) - { - TXT_AddWidget(window, TXT_NewInputBox(&wads[i], 60)); - } -} - -static void OpenExtraParamsWindow(TXT_UNCAST_ARG(widget), - TXT_UNCAST_ARG(user_data)) -{ - txt_window_t *window; - int i; - - window = TXT_NewWindow("Extra command line parameters"); - - for (i=0; i<NUM_EXTRA_PARAMS; ++i) - { - TXT_AddWidget(window, TXT_NewInputBox(&extra_params[i], 70)); - } -} - -static txt_window_action_t *WadWindowAction(void) -{ - txt_window_action_t *action; - - action = TXT_NewWindowAction('w', "Add WADs"); - TXT_SignalConnect(action, "pressed", OpenWadsWindow, NULL); - - return action; -} - -void StartMultiGame(void) -{ - txt_window_t *window; - txt_table_t *gameopt_table; - txt_table_t *advanced_table; - txt_widget_t *iwad_selector; - - window = TXT_NewWindow("Start multiplayer game"); - - TXT_AddWidgets(window, - gameopt_table = TXT_NewTable(2), - TXT_NewSeparator("Monster options"), - TXT_NewInvertedCheckBox("Monsters enabled", &nomonsters), - TXT_NewCheckBox("Fast monsters", &fast), - TXT_NewCheckBox("Respawning monsters", &respawn), - TXT_NewSeparator("Advanced"), - advanced_table = TXT_NewTable(2), - TXT_NewButton2("Add extra parameters...", - OpenExtraParamsWindow, NULL), - NULL); - - TXT_SetWindowAction(window, TXT_HORIZ_CENTER, WadWindowAction()); - TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, StartGameAction()); - - TXT_SetColumnWidths(gameopt_table, 12, 12); - - TXT_AddWidgets(gameopt_table, - TXT_NewLabel("Game"), - iwad_selector = IWADSelector(), - TXT_NewLabel("Skill"), - skillbutton = TXT_NewDropdownList(&skill, skills, 5), - TXT_NewLabel("Game type"), - TXT_NewDropdownList(&deathmatch, gamemodes, 3), - TXT_NewLabel("Level warp"), - warpbutton = TXT_NewButton2("????", LevelSelectDialog, NULL), - TXT_NewLabel("Time limit"), - TXT_NewHorizBox(TXT_NewIntInputBox(&timer, 2), - TXT_NewLabel("minutes"), - NULL), - NULL); - - TXT_SetColumnWidths(advanced_table, 12, 12); - - TXT_SignalConnect(iwad_selector, "changed", UpdateWarpType, NULL); - - TXT_AddWidgets(advanced_table, - TXT_NewLabel("UDP port"), - TXT_NewIntInputBox(&udpport, 5), - NULL); - - UpdateWarpType(NULL, NULL); - UpdateWarpButton(); -} - -static void DoJoinGame(void *unused1, void *unused2) -{ - execute_context_t *exec; - - exec = NewExecuteContext(); - - if (jointype == JOIN_ADDRESS) - { - AddCmdLineParameter(exec, "-connect %s", connect_address); - } - else if (jointype == JOIN_AUTO_LAN) - { - AddCmdLineParameter(exec, "-autojoin"); - } - - // Extra parameters come first, so that they can be used to override - // the other parameters. - - AddExtraParameters(exec); - AddIWADParameter(exec); - AddWADs(exec); - - TXT_Shutdown(); - - M_SaveDefaults(); - - AddConfigParameters(exec); - - ExecuteDoom(exec); - - exit(0); -} - -static txt_window_action_t *JoinGameAction(void) -{ - txt_window_action_t *action; - - action = TXT_NewWindowAction(KEY_F10, "Connect"); - TXT_SignalConnect(action, "pressed", DoJoinGame, NULL); - - return action; -} - -// When an address is entered, select "address" mode. - -static void SelectAddressJoin(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(unused)) -{ - jointype = JOIN_ADDRESS; -} - -void JoinMultiGame(void) -{ - txt_window_t *window; - txt_table_t *gameopt_table; - txt_table_t *serveropt_table; - txt_inputbox_t *address_box; - - window = TXT_NewWindow("Join multiplayer game"); - - TXT_AddWidgets(window, - gameopt_table = TXT_NewTable(2), - TXT_NewSeparator("Server"), - serveropt_table = TXT_NewTable(2), - TXT_NewStrut(0, 1), - TXT_NewButton2("Add extra parameters...", OpenExtraParamsWindow, NULL), - NULL); - - TXT_SetColumnWidths(gameopt_table, 12, 12); - - TXT_AddWidgets(gameopt_table, - TXT_NewLabel("Game"), - IWADSelector(), - NULL); - - TXT_AddWidgets(serveropt_table, - TXT_NewRadioButton("Connect to address:", - &jointype, JOIN_ADDRESS), - address_box = TXT_NewInputBox(&connect_address, 30), - TXT_NewRadioButton("Auto-join LAN game", - &jointype, JOIN_AUTO_LAN), - NULL); - - TXT_SignalConnect(address_box, "changed", SelectAddressJoin, NULL); - TXT_SelectWidget(window, address_box); - - TXT_SetWindowAction(window, TXT_HORIZ_CENTER, WadWindowAction()); - TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, JoinGameAction()); -} - -void SetChatMacroDefaults(void) -{ - int i; - char *defaults[] = - { - HUSTR_CHATMACRO1, - HUSTR_CHATMACRO2, - HUSTR_CHATMACRO3, - HUSTR_CHATMACRO4, - HUSTR_CHATMACRO5, - HUSTR_CHATMACRO6, - HUSTR_CHATMACRO7, - HUSTR_CHATMACRO8, - HUSTR_CHATMACRO9, - HUSTR_CHATMACRO0, - }; - - // If the chat macros have not been set, initialise with defaults. - - for (i=0; i<10; ++i) - { - if (chat_macros[i] == NULL) - { - chat_macros[i] = strdup(defaults[i]); - } - } -} - -void SetPlayerNameDefault(void) -{ - if (net_player_name == NULL) - { - net_player_name = getenv("USER"); - } - - if (net_player_name == NULL) - { - net_player_name = getenv("USERNAME"); - } - - if (net_player_name == NULL) - { - net_player_name = "player"; - } -} - -void MultiplayerConfig(void) -{ - txt_window_t *window; - txt_label_t *label; - txt_table_t *table; - char buf[10]; - int i; - - window = TXT_NewWindow("Multiplayer Configuration"); - - TXT_AddWidgets(window, - TXT_NewStrut(0, 1), - TXT_NewHorizBox(TXT_NewLabel("Player name: "), - TXT_NewInputBox(&net_player_name, 25), - NULL), - TXT_NewStrut(0, 1), - TXT_NewSeparator("Chat macros"), - NULL); - - table = TXT_NewTable(2); - - for (i=0; i<10; ++i) - { - sprintf(buf, "#%i ", i + 1); - - label = TXT_NewLabel(buf); - TXT_SetFGColor(label, TXT_COLOR_BRIGHT_CYAN); - - TXT_AddWidgets(table, - label, - TXT_NewInputBox(&chat_macros[(i + 1) % 10], 40), - NULL); - } - - TXT_AddWidget(window, table); -} - diff --git a/setup/multiplayer.h b/setup/multiplayer.h deleted file mode 100644 index b9871ed5..00000000 --- a/setup/multiplayer.h +++ /dev/null @@ -1,36 +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_MULTIPLAYER_H -#define SETUP_MULTIPLAYER_H - -extern char *net_player_name; -extern char *chat_macros[10]; - -void StartMultiGame(void); -void JoinMultiGame(void); -void MultiplayerConfig(void); - -void SetChatMacroDefaults(void); -void SetPlayerNameDefault(void); - -#endif /* #ifndef SETUP_MULTIPLAYER_H */ - diff --git a/setup/setup-manifest.xml b/setup/setup-manifest.xml deleted file mode 100644 index 409a142b..00000000 --- a/setup/setup-manifest.xml +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> -<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> - <!-- The "name" field in this tag should be the same as the executable's - name --> - <assemblyIdentity version="1.2.1.0" processorArchitecture="*" - name="chocolate-setup" type="win32"/> - <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> - <security> - <requestedPrivileges> - <!-- Hi Vista! We don't require elevated privileges. Thanks! --> - <requestedExecutionLevel level="asInvoker"/> - </requestedPrivileges> - </security> - </trustInfo> -</assembly> - 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 <stdlib.h> - -#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 <stdio.h> -#include <stdlib.h> -#include <string.h> - -#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); i<JOYSTICK_INPUT_WIDTH; ++i) - { - TXT_DrawString(" "); - } -} - -static void TXT_JoystickInputDestructor(TXT_UNCAST_ARG(joystick_input)) -{ -} - -static int TXT_JoystickInputKeyPress(TXT_UNCAST_ARG(joystick_input), int joystick) -{ - TXT_CAST_ARG(txt_joystick_input_t, joystick_input); - - if (joystick == KEY_ENTER) - { - // Open a window to prompt for the new joystick press - - OpenPromptWindow(joystick_input); - - return 1; - } - - return 0; -} - -static void TXT_JoystickInputMousePress(TXT_UNCAST_ARG(widget), int x, int y, int b) -{ - TXT_CAST_ARG(txt_joystick_input_t, widget); - - // Clicking is like pressing enter - - if (b == TXT_MOUSE_LEFT) - { - TXT_JoystickInputKeyPress(widget, KEY_ENTER); - } -} - -txt_widget_class_t txt_joystick_input_class = -{ - TXT_JoystickInputSizeCalc, - TXT_JoystickInputDrawer, - TXT_JoystickInputKeyPress, - TXT_JoystickInputDestructor, - TXT_JoystickInputMousePress, - NULL, -}; - -txt_joystick_input_t *TXT_NewJoystickInput(int *variable) -{ - txt_joystick_input_t *joystick_input; - - joystick_input = malloc(sizeof(txt_joystick_input_t)); - - TXT_InitWidget(joystick_input, &txt_joystick_input_class); - joystick_input->variable = 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 e385cc59..00000000 --- a/setup/txt_keyinput.c +++ /dev/null @@ -1,193 +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 <stdlib.h> -#include <string.h> - -#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 ReleaseGrab(TXT_UNCAST_ARG(window), TXT_UNCAST_ARG(unused)) -{ - SDL_WM_GrabInput(SDL_GRAB_OFF); -} - -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); - - // Grab input while reading the key. On Windows Mobile - // handheld devices, the hardware keypresses are only - // detected when input is grabbed. - - SDL_WM_GrabInput(SDL_GRAB_ON); - TXT_SignalConnect(window, "closed", ReleaseGrab, NULL); -} - -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); i<KEY_INPUT_WIDTH; ++i) - { - TXT_DrawString(" "); - } -} - -static void TXT_KeyInputDestructor(TXT_UNCAST_ARG(key_input)) -{ -} - -static int TXT_KeyInputKeyPress(TXT_UNCAST_ARG(key_input), int key) -{ - TXT_CAST_ARG(txt_key_input_t, key_input); - - if (key == KEY_ENTER) - { - // Open a window to prompt for the new key press - - OpenPromptWindow(key_input); - - return 1; - } - - return 0; -} - -static void TXT_KeyInputMousePress(TXT_UNCAST_ARG(widget), int x, int y, int b) -{ - TXT_CAST_ARG(txt_key_input_t, widget); - - // Clicking is like pressing enter - - if (b == TXT_MOUSE_LEFT) - { - TXT_KeyInputKeyPress(widget, KEY_ENTER); - } -} - -txt_widget_class_t txt_key_input_class = -{ - TXT_KeyInputSizeCalc, - TXT_KeyInputDrawer, - TXT_KeyInputKeyPress, - TXT_KeyInputDestructor, - TXT_KeyInputMousePress, - NULL, -}; - -txt_key_input_t *TXT_NewKeyInput(int *variable) -{ - txt_key_input_t *key_input; - - key_input = malloc(sizeof(txt_key_input_t)); - - TXT_InitWidget(key_input, &txt_key_input_class); - key_input->variable = 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 <stdio.h> -#include <stdlib.h> -#include <string.h> - -#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); i<MOUSE_INPUT_WIDTH; ++i) - { - TXT_DrawString(" "); - } -} - -static void TXT_MouseInputDestructor(TXT_UNCAST_ARG(mouse_input)) -{ -} - -static int TXT_MouseInputKeyPress(TXT_UNCAST_ARG(mouse_input), int mouse) -{ - TXT_CAST_ARG(txt_mouse_input_t, mouse_input); - - if (mouse == KEY_ENTER) - { - // Open a window to prompt for the new mouse press - - OpenPromptWindow(mouse_input); - - return 1; - } - - return 0; -} - -static void TXT_MouseInputMousePress(TXT_UNCAST_ARG(widget), int x, int y, int b) -{ - TXT_CAST_ARG(txt_mouse_input_t, widget); - - // Clicking is like pressing enter - - if (b == TXT_MOUSE_LEFT) - { - TXT_MouseInputKeyPress(widget, KEY_ENTER); - } -} - -txt_widget_class_t txt_mouse_input_class = -{ - TXT_MouseInputSizeCalc, - TXT_MouseInputDrawer, - TXT_MouseInputKeyPress, - TXT_MouseInputDestructor, - TXT_MouseInputMousePress, - NULL, -}; - -txt_mouse_input_t *TXT_NewMouseInput(int *variable) -{ - txt_mouse_input_t *mouse_input; - - mouse_input = malloc(sizeof(txt_mouse_input_t)); - - TXT_InitWidget(mouse_input, &txt_mouse_input_class); - mouse_input->variable = 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 */ - - |