void CONFIG_ReadKeys ( int32 scripthandle ) { int32 i; int32 numkeyentries; int32 function; char keyname1[80]; char keyname2[80]; kb_scancode key1, key2; if ( scripthandle < 0 ) { return; } numkeyentries = SCRIPT_NumberEntries ( scripthandle, "KeyDefinitions" ); for ( i = 0; i < numkeyentries; i++ ) { function = CONFIG_FunctionNameToNum ( ( char * ) SCRIPT_Entry ( scripthandle, "KeyDefinitions", i ) ); if ( function != -1 ) { memset ( keyname1, 0, sizeof ( keyname1 ) ); memset ( keyname2, 0, sizeof ( keyname2 ) ); SCRIPT_GetDoubleString ( scripthandle, "KeyDefinitions", SCRIPT_Entry ( scripthandle, "KeyDefinitions", i ), keyname1, keyname2 ); key1 = 0xff; key2 = 0xff; if ( keyname1[0] ) { key1 = ( byte ) KB_StringToScanCode ( keyname1 ); } if ( keyname2[0] ) { key2 = ( byte ) KB_StringToScanCode ( keyname2 ); } KeyboardKeys[function][0] = key1; KeyboardKeys[function][1] = key2; } } for ( i = 0; i < NUMGAMEFUNCTIONS; i++ ) { if ( i == gamefunc_Show_Console ) { OSD_CaptureKey ( KeyboardKeys[i][0] ); } // else // CONTROL_MapKey( i, KeyboardKeys[i][0], KeyboardKeys[i][1] ); } }
// wrapper for CONTROL_MapKey(), generates key bindings to reflect changes to keyboard setup void CONFIG_MapKey(int32_t which, kb_scancode key1, kb_scancode oldkey1, kb_scancode key2, kb_scancode oldkey2) { int32_t i, j, k; int32_t ii[] = { key1, key2, oldkey1, oldkey2 }; char buf[2*MAXGAMEFUNCLEN]; UNREFERENCED_PARAMETER(which); // CONTROL_MapKey(which, key1, key2); if (which == gamefunc_Show_Console) OSD_CaptureKey(key1); for (k = 0; (unsigned)k < ARRAY_SIZE(ii); k++) { if (ii[k] == 0xff || !ii[k]) continue; for (j=0; ConsoleKeys[j].name; j++) if (ii[k] == ConsoleKeys[j].id) break; tempbuf[0] = 0; for (i=NUMGAMEFUNCTIONS-1; i>=0; i--) { if (ud.config.KeyboardKeys[i][0] == ii[k] || ud.config.KeyboardKeys[i][1] == ii[k]) { Bsprintf(buf,"gamefunc_%s; ",CONFIG_FunctionNumToName(i)); Bstrcat(tempbuf,buf); } } i = Bstrlen(tempbuf); if (i >= 2) { tempbuf[i-2] = 0; // cut off the trailing "; " CONTROL_BindKey(ii[k], tempbuf, 1, ConsoleKeys[j].name ? ConsoleKeys[j].name : "<?>"); } else { CONTROL_FreeKeyBind(ii[k]); } } }
void CONFIG_SetDefaultKeys(const char (*keyptr)[MAXGAMEFUNCLEN]) { int32_t i,f; Bmemset(ud.config.KeyboardKeys, 0xff, sizeof(ud.config.KeyboardKeys)); CONTROL_ClearAllBinds(); for (i=0; i < (int32_t)ARRAY_SIZE(keydefaults); i+=3) { f = CONFIG_FunctionNameToNum(keyptr[i+0]); if (f == -1) continue; ud.config.KeyboardKeys[f][0] = KB_StringToScanCode(keyptr[i+1]); ud.config.KeyboardKeys[f][1] = KB_StringToScanCode(keyptr[i+2]); if (f == gamefunc_Show_Console) OSD_CaptureKey(ud.config.KeyboardKeys[f][0]); else CONFIG_MapKey(f, ud.config.KeyboardKeys[f][0], 0, ud.config.KeyboardKeys[f][1], 0); } }
int loadsetup(const char *fn) { scriptfile *cfg; char *token; int item; cfg = scriptfile_fromfile(fn); if (!cfg) { return -1; } scriptfile_clearsymbols(); option[0] = 1; // vesa all the way... option[1] = 1; // sound all the way... option[4] = 0; // no multiplayer option[5] = 0; while (1) { token = scriptfile_gettoken(cfg); if (!token) break; //EOF for (item = 0; configspec[item].name; item++) { if (!Bstrcasecmp(token, configspec[item].name)) { // Seek past any = symbol. token = scriptfile_peektoken(cfg); if (!Bstrcasecmp("=", token)) { scriptfile_gettoken(cfg); } switch (configspec[item].type) { case type_bool: { int value = 0; if (scriptfile_getnumber(cfg, &value)) break; *(int*)configspec[item].store = (value != 0); break; } case type_int: { int value = 0; if (scriptfile_getnumber(cfg, &value)) break; *(int*)configspec[item].store = value; break; } case type_hex: { int value = 0; if (scriptfile_gethex(cfg, &value)) break; *(int*)configspec[item].store = value; break; } case type_double: { double value = 0.0; if (scriptfile_getdouble(cfg, &value)) break; *(double*)configspec[item].store = value; break; } default: { buildputs("loadsetup: unhandled value type\n"); break; } } break; } } if (!configspec[item].name) { buildprintf("loadsetup: error on line %d\n", scriptfile_getlinum(cfg, cfg->ltextptr)); continue; } } #if USE_POLYMOST if (tmprenderer >= 0) { setrendermode(tmprenderer); } #endif if (tmpbrightness >= 0) { brightness = min(max(tmpbrightness,0),15); } OSD_CaptureKey(keys[19]); scriptfile_close(cfg); scriptfile_clearsymbols(); return 0; }
void CONFIG_ReadKeys( void ) { int32 i; int32 numkeyentries; int32 function; char keyname1[80]; char keyname2[80]; #if 0 kb_scancode key1,key2; #else dnKey key1, key2; #endif if (scripthandle < 0) return; numkeyentries = SCRIPT_NumberEntries( scripthandle,"KeyDefinitions" ); #if 0 for (i=0;i<numkeyentries;i++) { function = CONFIG_FunctionNameToNum(SCRIPT_Entry(scripthandle,"KeyDefinitions", i )); if (function != -1) { memset(keyname1,0,sizeof(keyname1)); memset(keyname2,0,sizeof(keyname2)); SCRIPT_GetDoubleString ( scripthandle, "KeyDefinitions", SCRIPT_Entry( scripthandle, "KeyDefinitions", i ), keyname1, keyname2 ); key1 = -1; key2 = -1; if (keyname1[0]) { key1 = KB_StringToScanCode( keyname1 ); } if (keyname2[0]) { key2 = KB_StringToScanCode( keyname2 ); } KeyboardKeys[function][0] = key1; KeyboardKeys[function][1] = key2; } } for (i=0; i<NUMGAMEFUNCTIONS; i++) { if (i == gamefunc_Show_Console) OSD_CaptureKey(KeyboardKeys[i][0]); else CONTROL_MapKey( i, KeyboardKeys[i][0], KeyboardKeys[i][1] ); } #else for (i=0;i<numkeyentries;i++) { function = CONFIG_FunctionNameToNum(SCRIPT_Entry(scripthandle,"KeyDefinitions", i )); if (function != -1) { memset(keyname1,0,sizeof(keyname1)); memset(keyname2,0,sizeof(keyname2)); SCRIPT_GetDoubleString ( scripthandle, "KeyDefinitions", SCRIPT_Entry( scripthandle, "KeyDefinitions", i ), keyname1, keyname2 ); key1 = SDLK_UNKNOWN; key2 = SDLK_UNKNOWN; if (keyname1[0]) { key1 = dnGetKeyByName( keyname1 ); } if (keyname2[0]) { key2 = dnGetKeyByName( keyname2 ); } dnBindFunction(function, 0, key1); dnBindFunction(function, 1, key2); KeyboardKeys[function][0] = -1; KeyboardKeys[function][1] = -1; } } for (i=0; i<NUMGAMEFUNCTIONS; i++) { if (i == gamefunc_Show_Console) OSD_CaptureKey(KeyboardKeys[i][0]); else CONTROL_MapKey( i, KeyboardKeys[i][0], KeyboardKeys[i][1] ); } #endif }
void CONFIG_SetDefaults( void ) { int32 i,f; byte k1,k2; FXDevice = 0; MusicDevice = 0; NumVoices = 16; NumChannels = 2; NumBits = 16; MixRate = 44100; SoundToggle = 1; MusicToggle = 1; VoiceToggle = 1; AmbienceToggle = 1; FXVolume = 220; MusicVolume = 200; ReverseStereo = 0; myaimmode = ps[0].aim_mode = 1; ud.mouseaiming = 0; ud.weaponswitch = 3; // new+empty AutoAim = 0; UseJoystick = 0; UseMouse = 1; ud.mouseflip = 0; ud.runkey_mode = 0; ud.statusbarscale = 100; ud.screen_size = 8; ud.screen_tilting = 1; ud.shadows = 1; ud.detail = 1; ud.lockout = 0; ud.pwlockout[0] = '\0'; ud.crosshair = 1; ud.m_marker = 1; ud.m_ffire = 1; ud.levelstats = 0; ud.vsync = 1; ud.fps_max = 120; ShowOpponentWeapons = 0; Bstrcpy(ud.rtsname, "DUKE.RTS"); Bstrcpy(myname, "Duke"); Bstrcpy(ud.ridecule[0], "An inspiration for birth control."); Bstrcpy(ud.ridecule[1], "You're gonna die for that!"); Bstrcpy(ud.ridecule[2], "It hurts to be you."); Bstrcpy(ud.ridecule[3], "Lucky Son of a Bitch."); Bstrcpy(ud.ridecule[4], "Hmmm....Payback time."); Bstrcpy(ud.ridecule[5], "You bottom dwelling scum sucker."); Bstrcpy(ud.ridecule[6], "Damn, you're ugly."); Bstrcpy(ud.ridecule[7], "Ha ha ha...Wasted!"); Bstrcpy(ud.ridecule[8], "You suck!"); Bstrcpy(ud.ridecule[9], "AARRRGHHHHH!!!"); #if 0 memset(KeyboardKeys, 0xff, sizeof(KeyboardKeys)); for (i=0; i < (int32)(sizeof(keydefaults)/sizeof(keydefaults[0])); i+=3) { f = CONFIG_FunctionNameToNum( keydefaults[i+0] ); if (f == -1) continue; KeyboardKeys[f][0] = KB_StringToScanCode( keydefaults[i+1] ); KeyboardKeys[f][1] = KB_StringToScanCode( keydefaults[i+2] ); if (f == gamefunc_Show_Console) OSD_CaptureKey(KeyboardKeys[f][0]); else CONTROL_MapKey( f, KeyboardKeys[f][0], KeyboardKeys[f][1] ); } memset(MouseFunctions, -1, sizeof(MouseFunctions)); for (i=0; i<MAXMOUSEBUTTONS; i++) { MouseFunctions[i][0] = CONFIG_FunctionNameToNum( mousedefaults[i] ); CONTROL_MapButton( MouseFunctions[i][0], i, 0, controldevice_mouse ); if (i>=4) continue; MouseFunctions[i][1] = CONFIG_FunctionNameToNum( mouseclickeddefaults[i] ); CONTROL_MapButton( MouseFunctions[i][1], i, 1, controldevice_mouse ); } memset(MouseDigitalFunctions, -1, sizeof(MouseDigitalFunctions)); for (i=0; i<MAXMOUSEAXES; i++) { MouseAnalogueScale[i] = -65536; CONTROL_SetAnalogAxisScale( i, MouseAnalogueScale[i], controldevice_mouse ); MouseDigitalFunctions[i][0] = CONFIG_FunctionNameToNum( mousedigitaldefaults[i*2] ); MouseDigitalFunctions[i][1] = CONFIG_FunctionNameToNum( mousedigitaldefaults[i*2+1] ); CONTROL_MapDigitalAxis( i, MouseDigitalFunctions[i][0], 0, controldevice_mouse ); CONTROL_MapDigitalAxis( i, MouseDigitalFunctions[i][1], 1, controldevice_mouse ); MouseAnalogueAxes[i] = CONFIG_AnalogNameToNum( mouseanalogdefaults[i] ); CONTROL_MapAnalogAxis( i, MouseAnalogueAxes[i], controldevice_mouse); } CONTROL_SetMouseSensitivity(32768); memset(JoystickFunctions, -1, sizeof(JoystickFunctions)); for (i=0; i<MAXJOYBUTTONS; i++) { JoystickFunctions[i][0] = CONFIG_FunctionNameToNum( joystickdefaults[i] ); JoystickFunctions[i][1] = CONFIG_FunctionNameToNum( joystickclickeddefaults[i] ); CONTROL_MapButton( JoystickFunctions[i][0], i, 0, controldevice_joystick ); CONTROL_MapButton( JoystickFunctions[i][1], i, 1, controldevice_joystick ); } memset(JoystickDigitalFunctions, -1, sizeof(JoystickDigitalFunctions)); for (i=0; i<MAXJOYAXES; i++) { JoystickAnalogueScale[i] = 65536; JoystickAnalogueDead[i] = 1000; JoystickAnalogueSaturate[i] = 9500; CONTROL_SetAnalogAxisScale( i, JoystickAnalogueScale[i], controldevice_joystick ); JoystickDigitalFunctions[i][0] = CONFIG_FunctionNameToNum( joystickdigitaldefaults[i*2] ); JoystickDigitalFunctions[i][1] = CONFIG_FunctionNameToNum( joystickdigitaldefaults[i*2+1] ); CONTROL_MapDigitalAxis( i, JoystickDigitalFunctions[i][0], 0, controldevice_joystick ); CONTROL_MapDigitalAxis( i, JoystickDigitalFunctions[i][1], 1, controldevice_joystick ); JoystickAnalogueAxes[i] = CONFIG_AnalogNameToNum( joystickanalogdefaults[i] ); CONTROL_MapAnalogAxis(i, JoystickAnalogueAxes[i], controldevice_joystick); } #endif dnResetBindings(); }
int loadsetup(const char *fn) { BFILE *fp; #define VL 32 char val[VL]; int i; if ((fp = Bfopen(fn, "rt")) == NULL) return -1; if (readconfig(fp, "fullscreen", val, VL) > 0) { if (Batoi(val) != 0) fullscreen = 1; else fullscreen = 0; } if (readconfig(fp, "resolution", val, VL) > 0) { i = Batoi(val) & 0x0f; if ((unsigned)i<13) { xdimgame = xdim2d = vesares[i][0]; ydimgame = ydim2d = vesares[i][1]; } } if (readconfig(fp, "2dresolution", val, VL) > 0) { i = Batoi(val) & 0x0f; if ((unsigned)i<13) { xdim2d = vesares[i][0]; ydim2d = vesares[i][1]; } } if (readconfig(fp, "xdim2d", val, VL) > 0) { xdim2d = Batoi(val); } if (readconfig(fp, "ydim2d", val, VL) > 0) { ydim2d = Batoi(val); } if (readconfig(fp, "xdim3d", val, VL) > 0) { xdimgame = Batoi(val); } if (readconfig(fp, "ydim3d", val, VL) > 0) { ydimgame = Batoi(val); } if (readconfig(fp, "samplerate", val, VL) > 0) { option[7] = (Batoi(val) & 0x0f) << 4; } if (readconfig(fp, "music", val, VL) > 0) { if (Batoi(val) != 0) option[2] = 1; else option[2] = 0; } if (readconfig(fp, "mouse", val, VL) > 0) { if (Batoi(val) != 0) option[3] = 1; else option[3] = 0; } if (readconfig(fp, "bpp", val, VL) > 0) { bppgame = Batoi(val); } if (readconfig(fp, "renderer", val, VL) > 0) { i = Batoi(val); setrendermode(i); } if (readconfig(fp, "brightness", val, VL) > 0) { brightness = min(max(Batoi(val),0),15); } #ifdef RENDERTYPEWIN if (readconfig(fp, "maxrefreshfreq", val, VL) > 0) { maxrefreshfreq = Batoi(val); } #endif option[0] = 1; // vesa all the way... option[1] = 1; // sound all the way... option[4] = 0; // no multiplayer option[5] = 0; if (readconfig(fp, "keyforward", val, VL) > 0) keys[0] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keybackward", val, VL) > 0) keys[1] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keyturnleft", val, VL) > 0) keys[2] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keyturnright", val, VL) > 0) keys[3] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keyrun", val, VL) > 0) keys[4] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keystrafe", val, VL) > 0) keys[5] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keyfire", val, VL) > 0) keys[6] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keyuse", val, VL) > 0) keys[7] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keystandhigh", val, VL) > 0) keys[8] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keystandlow", val, VL) > 0) keys[9] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keylookup", val, VL) > 0) keys[10] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keylookdown", val, VL) > 0) keys[11] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keystrafeleft", val, VL) > 0) keys[12] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keystraferight", val, VL) > 0) keys[13] = Bstrtol(val, NULL, 16); if (readconfig(fp, "key2dmode", val, VL) > 0) keys[14] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keyviewcycle", val, VL) > 0) keys[15] = Bstrtol(val, NULL, 16); if (readconfig(fp, "key2dzoomin", val, VL) > 0) keys[16] = Bstrtol(val, NULL, 16); if (readconfig(fp, "key2dzoomout", val, VL) > 0) keys[17] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keychat", val, VL) > 0) keys[18] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keyconsole", val, VL) > 0) { keys[19] = Bstrtol(val, NULL, 16); OSD_CaptureKey(keys[19]); } if (readconfig(fp, "mousesensitivity", val, VL) > 0) msens = Bstrtod(val, NULL); Bfclose(fp); return 0; }
int32_t loadsetup(const char *fn) { BFILE *fp; #define VL 1024 char val[VL]; int32_t i; if ((fp = Bfopen(fn, "rt")) == NULL) return -1; if (readconfig(fp, "forcesetup", val, VL) > 0) { if (atoi_safe(val) != 0) forcesetup = 1; else forcesetup = 0; } if (readconfig(fp, "fullscreen", val, VL) > 0) { if (atoi_safe(val) != 0) fullscreen = 1; else fullscreen = 0; } if (readconfig(fp, "resolution", val, VL) > 0) { i = atoi_safe(val) & 0x0f; if ((unsigned)i<13) { xdimgame = xdim2d = vesares[i][0]; ydimgame = ydim2d = vesares[i][1]; } } if (readconfig(fp, "2dresolution", val, VL) > 0) { i = atoi_safe(val) & 0x0f; if ((unsigned)i<13) { xdim2d = vesares[i][0]; ydim2d = vesares[i][1]; } } if (readconfig(fp, "xdim2d", val, VL) > 0) xdim2d = atoi_safe(val); if (readconfig(fp, "ydim2d", val, VL) > 0) ydim2d = atoi_safe(val); if (readconfig(fp, "xdim3d", val, VL) > 0) xdimgame = atoi_safe(val); if (readconfig(fp, "ydim3d", val, VL) > 0) ydimgame = atoi_safe(val); // if (readconfig(fp, "samplerate", val, VL) > 0) option[7] = (atoi_safe(val) & 0x0f) << 4; // if (readconfig(fp, "music", val, VL) > 0) { if (atoi_safe(val) != 0) option[2] = 1; else option[2] = 0; } // if (readconfig(fp, "mouse", val, VL) > 0) { if (atoi_safe(val) != 0) option[3] = 1; else option[3] = 0; } if (readconfig(fp, "bpp", val, VL) > 0) bppgame = atoi_safe(val); if (readconfig(fp, "vsync", val, VL) > 0) vsync = !!atoi_safe(val); if (readconfig(fp, "editorgridextent", val, VL) > 0) { int32_t tmp = atoi_safe(val); editorgridextent = clamp(tmp, 65536, BXY_MAX); } if (readconfig(fp, "grid", val, VL) > 0) { grid = atoi_safe(val); default_grid = grid; autogrid = (grid==9); grid = clamp(grid, 0, 8); } #ifdef POLYMER if (readconfig(fp, "rendmode", val, VL) > 0) { i = atoi_safe(val); glrendmode = i; } #endif if (readconfig(fp, "vid_gamma", val, VL) > 0) vid_gamma = clampd(Bstrtod(val, NULL), 0.0, 10.0); if (readconfig(fp, "vid_brightness", val, VL) > 0) vid_brightness = clampd(Bstrtod(val, NULL), 0.0, 10.0); if (readconfig(fp, "vid_contrast", val, VL) > 0) vid_contrast = clampd(Bstrtod(val, NULL), 0.0, 10.0); #ifdef RENDERTYPEWIN if (readconfig(fp, "maxrefreshfreq", val, VL) > 0) maxrefreshfreq = atoi_safe(val); #endif #ifdef USE_OPENGL if (readconfig(fp, "usemodels", val, VL) > 0) usemodels = !!atoi_safe(val); if (readconfig(fp, "usehightile", val, VL) > 0) usehightile = !!atoi_safe(val); if (readconfig(fp, "lazytileselector", val, VL) > 0) g_lazy_tileselector = !!atoi_safe(val); glusetexcache = -1; if (readconfig(fp, "glusetexcache", val, VL) > 0) { glusetexcache = clamp(atoi_safe(val), 0, 2); } if (readconfig(fp, "glusememcache", val, VL) > 0) { glusememcache = !!atoi_safe(val); } if (readconfig(fp, "gltexfiltermode", val, VL) > 0) { gltexfiltermode = atoi_safe(val); } if (readconfig(fp, "glanisotropy", val, VL) > 0) { glanisotropy = atoi_safe(val); } if (readconfig(fp, "r_downsize", val, VL) > 0) { r_downsize = atoi_safe(val); r_downsize = clamp(r_downsize, 0, 5); r_downsizevar = r_downsize; } if (readconfig(fp, "r_texcompr", val, VL) > 0) glusetexcompr = !!atoi_safe(val); if (readconfig(fp, "r_shadescale", val, VL) > 0) shadescale = clampd(Bstrtod(val, NULL), 0.0, 10.0); if (readconfig(fp, "r_usenewshading", val, VL) > 0) r_usenewshading = clamp(atoi_safe(val), 0, 2); #endif if (readconfig(fp, "r_usenewaspect", val, VL) > 0) r_usenewaspect = !!atoi_safe(val); #ifndef RENDERTYPEWIN if (readconfig(fp, "r_screenxy", val, VL) > 0) { r_screenxy = clamp(atoi_safe(val), 0, 9999); if (r_screenxy/100==0 || r_screenxy%100==0) r_screenxy = 403; } #endif if (readconfig(fp, "gameexecutable", val, VL) > 0) Bstrcpy(game_executable, val); // option[0] = 1; // vesa all the way... // option[1] = 1; // sound all the way... // option[4] = 0; // no multiplayer // option[5] = 0; #if 1 if (readconfig(fp, "keyforward", val, VL) > 0) keys[0] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keybackward", val, VL) > 0) keys[1] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keyturnleft", val, VL) > 0) keys[2] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keyturnright", val, VL) > 0) keys[3] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keyrun", val, VL) > 0) keys[4] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keystrafe", val, VL) > 0) keys[5] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keyfire", val, VL) > 0) keys[6] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keyuse", val, VL) > 0) keys[7] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keystandhigh", val, VL) > 0) keys[8] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keystandlow", val, VL) > 0) keys[9] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keylookup", val, VL) > 0) keys[10] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keylookdown", val, VL) > 0) keys[11] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keystrafeleft", val, VL) > 0) keys[12] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keystraferight", val, VL) > 0) keys[13] = Bstrtol(val, NULL, 16); if (readconfig(fp, "key2dmode", val, VL) > 0) keys[14] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keyviewcycle", val, VL) > 0) keys[15] = Bstrtol(val, NULL, 16); if (readconfig(fp, "key2dzoomin", val, VL) > 0) keys[16] = Bstrtol(val, NULL, 16); if (readconfig(fp, "key2dzoomout", val, VL) > 0) keys[17] = Bstrtol(val, NULL, 16); if (readconfig(fp, "keychat", val, VL) > 0) keys[18] = Bstrtol(val, NULL, 16); #endif #ifdef RENDERTYPEWIN if (readconfig(fp, "windowpositioning", val, VL) > 0) windowpos = atoi_safe(val); windowx = -1; if (readconfig(fp, "windowposx", val, VL) > 0) windowx = atoi_safe(val); windowy = -1; if (readconfig(fp, "windowposy", val, VL) > 0) windowy = atoi_safe(val); #endif if (readconfig(fp, "keyconsole", val, VL) > 0) { keys[19] = Bstrtol(val, NULL, 16); OSD_CaptureKey(keys[19]); } if (readconfig(fp, "mousesensitivity", val, VL) > 0) msens = Bstrtod(val, NULL); if (readconfig(fp, "mousenavigation", val, VL) > 0) unrealedlook = !!atoi_safe(val); if (readconfig(fp, "mousenavigationaccel", val, VL) > 0) pk_uedaccel = atoi_safe(val); if (readconfig(fp, "quickmapcycling", val, VL) > 0) quickmapcycling = !!atoi_safe(val); if (readconfig(fp, "sideview_reversehorizrot", val, VL) > 0) sideview_reversehrot = !!atoi_safe(val); if (readconfig(fp, "revertCTRL", val, VL) > 0) revertCTRL = !!atoi_safe(val); if (readconfig(fp, "scrollamount", val, VL) > 0) scrollamount = atoi_safe(val); if (readconfig(fp, "turnaccel", val, VL) > 0) pk_turnaccel = atoi_safe(val); if (readconfig(fp, "turndecel", val, VL) > 0) pk_turndecel = atoi_safe(val); if (readconfig(fp, "autosavesec", val, VL) > 0) autosave = max(0, atoi_safe(val)); if (readconfig(fp, "autocorruptchecksec", val, VL) > 0) autocorruptcheck = max(0, atoi_safe(val)); if (readconfig(fp, "corruptcheck_noalreadyrefd", val, VL) > 0) corruptcheck_noalreadyrefd = !!atoi_safe(val); if (readconfig(fp, "fixmaponsave_sprites", val, VL) > 0) fixmaponsave_sprites = !!atoi_safe(val); if (readconfig(fp, "keeptexturestretch", val, VL) > 0) keeptexturestretch = !!atoi_safe(val); if (readconfig(fp, "showheightindicators", val, VL) > 0) showheightindicators = clamp(atoi_safe(val), 0, 2); if (readconfig(fp, "showambiencesounds", val, VL) > 0) showambiencesounds = clamp(atoi_safe(val), 0, 2); if (readconfig(fp, "autogray", val, VL) > 0) autogray = !!atoi_safe(val); // if (readconfig(fp, "showinnergray", val, VL) > 0) // showinnergray = !!atoi_safe(val); if (readconfig(fp, "graphicsmode", val, VL) > 0) graphicsmode = clamp(atoi_safe(val), 0, 2); if (readconfig(fp, "samplerate", val, VL) > 0) MixRate = clamp(atoi_safe(val), 8000, 48000); if (readconfig(fp, "ambiencetoggle", val, VL) > 0) AmbienceToggle = !!atoi_safe(val); if (readconfig(fp, "parlock", val, VL) > 0) ParentalLock = !!atoi_safe(val); if (readconfig(fp, "osdtryscript", val, VL) > 0) m32_osd_tryscript = !!atoi_safe(val); for (i=0; i<256; i++) remap[i]=i; remapinit=1; if (readconfig(fp, "remap", val, VL) > 0) { char *p=val; int32_t v1,v2; while (*p) { if (!sscanf(p,"%x",&v1))break; if ((p=strchr(p,'-'))==0)break; p++; if (!sscanf(p,"%x",&v2))break; remap[v1]=v2; initprintf("Remap %X key to %X\n",v1,v2); if ((p=strchr(p,','))==0)break; p++; } } // load m32script history for (i=0; i<SCRIPTHISTSIZ; i++) { Bsprintf(val, "hist%d", i); if (readconfig(fp, val, val, VL) <= 0) break; scripthist[i] = Bstrdup(val); } scripthistend = i; // copy script history into OSD history for (i=0; i<min(scripthistend, OSD_HISTORYDEPTH); i++) { Bstrncpyz(osdhistorybuf[i], scripthist[scripthistend-1-i], OSD_EDITLENGTH+1); osdhistorysize++; osdhistorytotal++; } scripthistend %= SCRIPTHISTSIZ; Bfclose(fp); return 0; }