//------------------------------------------------------------------------- /* Copyright (C) 1997, 2005 - 3D Realms Entertainment This file is part of Shadow Warrior version 1.2 Shadow Warrior 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Original Source: 1997 - Frank Maddin and Jim Norwood Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms */ //------------------------------------------------------------------------- #include "build.h" #include "baselayer.h" #include "osd.h" #include "settings.h" #include "mytypes.h" #include "develop.h" #include "scriplib.h" #include "file_lib.h" #include "gamedefs.h" #include "keyboard.h" #include "util_lib.h" #include "function.h" #include "control.h" #include "fx_man.h" #include "sounds.h" #include "config.h" #include "common_game.h" // we load this in to get default button and key assignments // as well as setting up function mappings #include "_functio.h" #include "_config.h" extern void ReadGameSetup(int32 scripthandle); extern void WriteGameSetup(int32 scripthandle); // // Comm variables // char CommPlayerName[32]; int32 NumberPlayers,CommPort,PortSpeed,IrqNumber,UartAddress; // // Sound variables // int32 FXDevice = 0; int32 MusicDevice = 0; int32 NumVoices = 32; int32 NumChannels = 2; int32 NumBits = 16; int32 MixRate = 44100; int32 UseMouse = 1, UseJoystick = 0; byte KeyboardKeys[NUMGAMEFUNCTIONS][2]; int32 MouseButtons[MAXMOUSEBUTTONS]; int32 MouseButtonsClicked[MAXMOUSEBUTTONS]; int32 MouseDigitalAxes[MAXMOUSEAXES][2]; int32 MouseAnalogAxes[MAXMOUSEAXES]; int32 MouseAnalogScale[MAXMOUSEAXES]; int32 JoystickButtons[MAXJOYBUTTONS]; int32 JoystickButtonsClicked[MAXJOYBUTTONS]; int32 JoystickDigitalAxes[MAXJOYAXES][2]; int32 JoystickAnalogAxes[MAXJOYAXES]; int32 JoystickAnalogScale[MAXJOYAXES]; int32 JoystickAnalogDead[MAXJOYAXES]; int32 JoystickAnalogSaturate[MAXJOYAXES]; // // Screen variables // int32 ScreenMode = 1; int32 ScreenWidth = 640; int32 ScreenHeight = 480; int32 ScreenBPP = 8; int32 ForceSetup = 1; extern char WangBangMacro[10][64]; char RTSName[MAXRTSNAMELENGTH]; //static char setupfilename[64]={SETUPFILENAME}; char setupfilename[64]= {SETUPFILENAME}; static int32 scripthandle = -1; /* =================== = = CONFIG_FunctionNameToNum = =================== */ int32 CONFIG_FunctionNameToNum(const char *func) { int32 i; if (!func) return -1; for (i=0; i= (unsigned)NUMGAMEFUNCTIONS) { return NULL; } else { return gamefunctions[func]; } } /* =================== = = CONFIG_AnalogNameToNum = =================== */ int32 CONFIG_AnalogNameToNum(const char *func) { if (!Bstrcasecmp(func,"analog_turning")) { return analog_turning; } if (!Bstrcasecmp(func,"analog_strafing")) { return analog_strafing; } if (!Bstrcasecmp(func,"analog_moving")) { return analog_moving; } if (!Bstrcasecmp(func,"analog_lookingupanddown")) { return analog_lookingupanddown; } return -1; } const char *CONFIG_AnalogNumToName(int32 func) { switch (func) { case analog_turning: return "analog_turning"; case analog_strafing: return "analog_strafing"; case analog_moving: return "analog_moving"; case analog_lookingupanddown: return "analog_lookingupanddown"; default: break; } return NULL; } /* =================== = = CONFIG_SetDefaults = =================== */ void CONFIG_SetDefaults(void) { // JBF 20031211 int32 i,f; byte k1,k2; ScreenMode = 1; ScreenWidth = 640; ScreenHeight = 480; ScreenBPP = 8; FXDevice = 0; MusicDevice = 0; NumVoices = 32; NumChannels = 2; NumBits = 16; MixRate = 44100; memcpy(&gs, &gs_defaults, sizeof(gs)); Bstrcpy(RTSName, DEFAULTRTSFILE); Bstrcpy(CommPlayerName, DEFAULTPLAYERNAME); Bstrcpy(WangBangMacro[0], MACRO1); Bstrcpy(WangBangMacro[1], MACRO2); Bstrcpy(WangBangMacro[2], MACRO3); Bstrcpy(WangBangMacro[3], MACRO4); Bstrcpy(WangBangMacro[4], MACRO5); Bstrcpy(WangBangMacro[5], MACRO6); Bstrcpy(WangBangMacro[6], MACRO7); Bstrcpy(WangBangMacro[7], MACRO8); Bstrcpy(WangBangMacro[8], MACRO9); Bstrcpy(WangBangMacro[9], MACRO10); SetDefaultKeyDefinitions(0); SetMouseDefaults(0); memset(MouseDigitalAxes, -1, sizeof(MouseDigitalAxes)); for (i=0; i= (MAXMOUSEBUTTONS-2)) continue; // scroll wheel Bsprintf(buf,"MouseButtonClicked%d",dummy); SCRIPT_PutString(scripthandle,"Controls", buf, CONFIG_FunctionNumToName(MouseButtonsClicked[dummy])); } for (dummy=0; dummy