1 //------------------------------------------------------------------------- 2 /* 3 Copyright (C) 2010-2020 EDuke32 developers and contributors 4 Copyright (C) 2020 sirlemonhead, Nuke.YKT 5 This file is part of EWitchaven. 6 EWitchaven is free software; you can redistribute it and/or 7 modify it under the terms of the GNU General Public License version 2 8 as published by the Free Software Foundation. 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 See the GNU General Public License for more details. 13 You should have received a copy of the GNU General Public License 14 along with this program; if not, write to the Free Software 15 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 16 */ 17 //------------------------------------------------------------------------- 18 19 #ifndef __config_h__ 20 #define __config_h__ 21 22 #include "compat.h" 23 24 #define kMaxGameFuncLen 64 25 26 // KEEPINSYNC mact/include/_control.h, build/src/sdlayer.cpp 27 #define MAXJOYBUTTONS 32 28 #define MAXJOYBUTTONSANDHATS (MAXJOYBUTTONS+4) 29 30 // KEEPINSYNC mact/include/_control.h, build/src/sdlayer.cpp 31 #define MAXMOUSEAXES 2 32 #define MAXMOUSEDIGITAL (MAXMOUSEAXES*2) 33 34 // KEEPINSYNC mact/include/_control.h, build/src/sdlayer.cpp 35 #define MAXJOYAXES 9 36 #define MAXJOYDIGITAL (MAXJOYAXES*2) 37 38 // default mouse scale 39 #define DEFAULTMOUSEANALOGUESCALE 65536 40 41 // default joystick settings 42 #define DEFAULTJOYSTICKANALOGUESCALE 65536 43 #define DEFAULTJOYSTICKANALOGUEDEAD 2000 44 #define DEFAULTJOYSTICKANALOGUESATURATE 9500 45 46 enum 47 { 48 gamefunc_Move_Forward, 49 gamefunc_Move_Backward, 50 gamefunc_Turn_Left, 51 gamefunc_Turn_Right, 52 gamefunc_Strafe, 53 gamefunc_Strafe_Left, 54 gamefunc_Strafe_Right, 55 gamefunc_Run, 56 gamefunc_Jump, 57 gamefunc_Crouch, 58 gamefunc_Fire, 59 gamefunc_Open, 60 gamefunc_Fly_Up, 61 gamefunc_Fly_Down, 62 gamefunc_Look_Up, 63 gamefunc_Look_Down, 64 gamefunc_Look_Straight, 65 gamefunc_Aim_Up, 66 gamefunc_Aim_Down, 67 gamefunc_SendMessage, 68 gamefunc_Weapon_0, 69 gamefunc_Weapon_1, 70 gamefunc_Weapon_2, 71 gamefunc_Weapon_3, 72 gamefunc_Weapon_4, 73 gamefunc_Weapon_5, 74 gamefunc_Weapon_6, 75 gamefunc_Weapon_7, 76 gamefunc_Weapon_8, 77 gamefunc_Weapon_9, 78 gamefunc_Spell_Left, 79 gamefunc_Spell_Right, 80 gamefunc_Cast_Spell, 81 gamefunc_Potion_Left, 82 gamefunc_Potion_Right, 83 gamefunc_Use_Potion, 84 gamefunc_Pause, 85 gamefunc_Map, 86 gamefunc_Zoom_In, 87 gamefunc_Zoom_Out, 88 gamefunc_Gamma_Correction, 89 gamefunc_Escape, 90 gamefunc_Shrink_Screen, 91 gamefunc_Enlarge_Screen, 92 gamefunc_Mouse_Sensitivity_Up, 93 gamefunc_Mouse_Sensitivity_Down, 94 gamefunc_Show_Console, 95 gamefunc_Mouse_Aiming, 96 gamefunc_Toggle_Crosshair, 97 kMaxGameFunctions 98 }; 99 100 extern const char gamefunctions[kMaxGameFunctions][kMaxGameFuncLen]; 101 extern const char keydefaults[kMaxGameFunctions * 2][kMaxGameFuncLen]; 102 extern const char oldkeydefaults[kMaxGameFunctions * 2][kMaxGameFuncLen]; 103 104 typedef struct { 105 int32_t usejoystick; 106 int32_t usemouse; 107 int32_t fullscreen; 108 int32_t xdim; 109 int32_t ydim; 110 int32_t bpp; 111 int32_t forcesetup; 112 int32_t noautoload; 113 } ud_setup_t; 114 115 #define kSetupFilename "ewitchaven.cfg" 116 extern char setupfilename[BMAX_PATH]; 117 118 extern hashtable_t h_gamefuncs; 119 120 void SetupInput(); 121 122 int CONFIG_ReadSetup(); 123 void CONFIG_WriteSetup(uint32_t flags); 124 125 extern int lMouseSens; 126 127 extern ud_setup_t gSetup; 128 extern int32_t scripthandle; 129 extern int32_t setupread; 130 extern int32_t useprecache; 131 extern int32_t MouseDeadZone, MouseBias; 132 133 extern int32_t FXVolume; 134 extern int32_t MusicVolume; 135 extern int32_t MixRate; 136 extern int32_t MidiPort; 137 extern int32_t NumVoices; 138 extern int32_t NumChannels; 139 extern int32_t NumBits; 140 extern int32_t ReverseStereo; 141 extern int32_t MusicDevice; 142 extern int32_t FXDevice; 143 144 // JBF 20031211: Store the input settings because 145 // (currently) mact can't regurgitate them 146 extern int32_t MouseFunctions[MAXMOUSEBUTTONS][2]; 147 extern int32_t MouseDigitalFunctions[MAXMOUSEAXES][2]; 148 extern int32_t MouseAnalogueAxes[MAXMOUSEAXES]; 149 extern int32_t MouseAnalogueScale[MAXMOUSEAXES]; 150 extern int32_t JoystickFunctions[MAXJOYBUTTONSANDHATS][2]; 151 extern int32_t JoystickDigitalFunctions[MAXJOYAXES][2]; 152 extern int32_t JoystickAnalogueAxes[MAXJOYAXES]; 153 extern int32_t JoystickAnalogueScale[MAXJOYAXES]; 154 extern int32_t JoystickAnalogueInvert[MAXJOYAXES]; 155 extern int32_t JoystickAnalogueDead[MAXJOYAXES]; 156 extern int32_t JoystickAnalogueSaturate[MAXJOYAXES]; 157 extern uint8_t KeyboardKeys[kMaxGameFunctions][2]; 158 159 extern int32_t MAXCACHE1DSIZE; 160 161 extern int32_t difficulty; 162 extern int32_t goreon; 163 164 void CONFIG_SetDefaultKeys(const char(*keyptr)[kMaxGameFuncLen], bool lazy=false); 165 void CONFIG_MapKey(int which, kb_scancode key1, kb_scancode oldkey1, kb_scancode key2, kb_scancode oldkey2); 166 int32_t CONFIG_FunctionNameToNum(const char* func); 167 168 #endif 169