2006-04-13 20:47:06 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
2007-02-08 04:19:39 +00:00
|
|
|
Copyright (C) 1996, 2003 - 3D Realms Entertainment
|
|
|
|
Copyright (C) 2000, 2003 - Matt Saettler (EDuke Enhancements)
|
|
|
|
Copyright (C) 2004, 2007 - EDuke32 developers
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
This file is part of EDuke32
|
|
|
|
|
|
|
|
EDuke32 is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License version 2
|
|
|
|
as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
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 <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <time.h>
|
|
|
|
*/
|
|
|
|
|
2008-07-25 04:33:33 +00:00
|
|
|
#include "baselayer.h"
|
2006-04-13 20:47:06 +00:00
|
|
|
#include "duke3d.h"
|
|
|
|
#include "scriplib.h"
|
|
|
|
#include "osd.h"
|
2008-06-30 01:03:51 +00:00
|
|
|
#include "osdcmds.h"
|
2008-07-25 04:33:33 +00:00
|
|
|
#include "osdfuncs.h"
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
// we load this in to get default button and key assignments
|
|
|
|
// as well as setting up function mappings
|
|
|
|
|
|
|
|
#define __SETUP__ // JBF 20031211
|
|
|
|
#include "_functio.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
===================
|
|
|
|
=
|
|
|
|
= CONFIG_FunctionNameToNum
|
|
|
|
=
|
|
|
|
===================
|
|
|
|
*/
|
|
|
|
|
2009-01-10 07:38:50 +00:00
|
|
|
hashtable_t gamefuncH = { NUMGAMEFUNCTIONS<<1, NULL };
|
2008-08-25 02:33:25 +00:00
|
|
|
|
2009-04-26 05:57:42 +00:00
|
|
|
int32_t CONFIG_FunctionNameToNum(char * func)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-04-26 05:57:42 +00:00
|
|
|
int32_t i;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-01-10 07:38:50 +00:00
|
|
|
i = hash_find(&gamefuncH,func);
|
2008-12-31 09:07:49 +00:00
|
|
|
|
|
|
|
if (i < 0)
|
|
|
|
{
|
|
|
|
char *str = strtolower(Bstrdup(func),Bstrlen(func));
|
2009-01-10 07:38:50 +00:00
|
|
|
i = hash_find(&gamefuncH,str);
|
2008-12-31 09:07:49 +00:00
|
|
|
Bfree(str);
|
|
|
|
|
2008-08-25 02:33:25 +00:00
|
|
|
return i;
|
2008-12-31 09:07:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return i;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
===================
|
|
|
|
=
|
|
|
|
= CONFIG_FunctionNumToName
|
|
|
|
=
|
|
|
|
===================
|
|
|
|
*/
|
|
|
|
|
2009-04-26 05:57:42 +00:00
|
|
|
char * CONFIG_FunctionNumToName(int32_t func)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
if ((unsigned)func >= (unsigned)NUMGAMEFUNCTIONS)
|
|
|
|
return NULL;
|
2006-12-23 02:38:47 +00:00
|
|
|
return gamefunctions[func];
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
===================
|
|
|
|
=
|
|
|
|
= CONFIG_AnalogNameToNum
|
|
|
|
=
|
|
|
|
===================
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2009-04-26 05:57:42 +00:00
|
|
|
int32_t CONFIG_AnalogNameToNum(char * func)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-04-26 05:57:42 +00:00
|
|
|
char * CONFIG_AnalogNumToName(int32_t func)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-15 01:16:55 +00:00
|
|
|
switch (func)
|
|
|
|
{
|
2006-11-16 03:02:42 +00:00
|
|
|
case analog_turning:
|
|
|
|
return "analog_turning";
|
|
|
|
case analog_strafing:
|
|
|
|
return "analog_strafing";
|
|
|
|
case analog_moving:
|
|
|
|
return "analog_moving";
|
|
|
|
case analog_lookingupanddown:
|
|
|
|
return "analog_lookingupanddown";
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
===================
|
|
|
|
=
|
|
|
|
= CONFIG_SetDefaults
|
|
|
|
=
|
|
|
|
===================
|
|
|
|
*/
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
void CONFIG_SetDefaultKeys(int32_t type)
|
2007-02-13 09:50:58 +00:00
|
|
|
{
|
2009-04-26 05:57:42 +00:00
|
|
|
int32_t i,f;
|
2007-02-13 09:50:58 +00:00
|
|
|
|
2008-06-30 09:00:33 +00:00
|
|
|
Bmemset(ud.config.KeyboardKeys, 0xff, sizeof(ud.config.KeyboardKeys));
|
2009-01-10 07:38:50 +00:00
|
|
|
Bmemset(&KeyBindings,0,sizeof(KeyBindings));
|
|
|
|
Bmemset(&MouseBindings,0,sizeof(MouseBindings));
|
2007-02-14 00:22:12 +00:00
|
|
|
|
|
|
|
if (type == 1)
|
|
|
|
{
|
2009-04-26 05:57:42 +00:00
|
|
|
for (i=0; i < (int32_t)(sizeof(oldkeydefaults)/sizeof(oldkeydefaults[0])); i+=3)
|
2007-02-14 00:22:12 +00:00
|
|
|
{
|
2007-02-16 00:11:25 +00:00
|
|
|
f = CONFIG_FunctionNameToNum((char *)oldkeydefaults[i+0]);
|
2007-02-14 00:22:12 +00:00
|
|
|
if (f == -1) continue;
|
2007-08-27 00:20:15 +00:00
|
|
|
ud.config.KeyboardKeys[f][0] = KB_StringToScanCode((char *)oldkeydefaults[i+1]);
|
|
|
|
ud.config.KeyboardKeys[f][1] = KB_StringToScanCode((char *)oldkeydefaults[i+2]);
|
2007-02-14 00:22:12 +00:00
|
|
|
|
2007-08-27 00:20:15 +00:00
|
|
|
if (f == gamefunc_Show_Console) OSD_CaptureKey(ud.config.KeyboardKeys[f][0]);
|
2008-07-09 23:25:38 +00:00
|
|
|
else CONFIG_MapKey(f, ud.config.KeyboardKeys[f][0], 0, ud.config.KeyboardKeys[f][1], 0);
|
2007-02-14 00:22:12 +00:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
2007-03-11 00:47:32 +00:00
|
|
|
|
2009-04-26 05:57:42 +00:00
|
|
|
for (i=0; i < (int32_t)(sizeof(keydefaults)/sizeof(keydefaults[0])); i+=3)
|
2007-02-13 09:50:58 +00:00
|
|
|
{
|
|
|
|
f = CONFIG_FunctionNameToNum(keydefaults[i+0]);
|
|
|
|
if (f == -1) continue;
|
2007-08-27 00:20:15 +00:00
|
|
|
ud.config.KeyboardKeys[f][0] = KB_StringToScanCode(keydefaults[i+1]);
|
|
|
|
ud.config.KeyboardKeys[f][1] = KB_StringToScanCode(keydefaults[i+2]);
|
2007-02-13 09:50:58 +00:00
|
|
|
|
2007-08-27 00:20:15 +00:00
|
|
|
if (f == gamefunc_Show_Console) OSD_CaptureKey(ud.config.KeyboardKeys[f][0]);
|
2008-07-09 23:25:38 +00:00
|
|
|
else CONFIG_MapKey(f, ud.config.KeyboardKeys[f][0], 0, ud.config.KeyboardKeys[f][1], 0);
|
2007-02-13 09:50:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
void CONFIG_SetDefaults(void)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
// JBF 20031211
|
2009-04-26 05:57:42 +00:00
|
|
|
int32_t i;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2007-08-27 00:20:15 +00:00
|
|
|
ud.config.scripthandle = -1;
|
2008-02-18 08:10:54 +00:00
|
|
|
ud.config.ScreenWidth = 1024;
|
|
|
|
ud.config.ScreenHeight = 768;
|
|
|
|
ud.config.ScreenMode = 0;
|
|
|
|
#if defined(POLYMOST) && defined(USE_OPENGL)
|
|
|
|
ud.config.ScreenBPP = 32;
|
|
|
|
#else
|
|
|
|
ud.config.ScreenBPP = 8;
|
|
|
|
#endif
|
2007-08-27 00:20:15 +00:00
|
|
|
ud.config.useprecache = 1;
|
|
|
|
ud.config.ForceSetup = 1;
|
2009-05-22 23:49:25 +00:00
|
|
|
ud.config.NoAutoLoad = 1;
|
2007-08-27 00:20:15 +00:00
|
|
|
ud.config.AmbienceToggle = 1;
|
|
|
|
ud.config.AutoAim = 1;
|
|
|
|
ud.config.FXDevice = 0;
|
|
|
|
ud.config.FXVolume = 220;
|
2008-06-30 07:30:48 +00:00
|
|
|
#if defined(_WIN32)
|
2007-08-27 00:20:15 +00:00
|
|
|
ud.config.MixRate = 44100;
|
2008-06-30 07:30:48 +00:00
|
|
|
#else
|
|
|
|
ud.config.MixRate = 48000;
|
|
|
|
#endif
|
2007-08-27 00:20:15 +00:00
|
|
|
ud.config.MouseBias = 0;
|
2008-10-13 01:16:40 +00:00
|
|
|
ud.config.MouseDeadZone = 0;
|
2007-08-27 00:20:15 +00:00
|
|
|
ud.config.MusicDevice = 0;
|
|
|
|
ud.config.MusicToggle = 1;
|
|
|
|
ud.config.MusicVolume = 200;
|
2008-11-20 14:06:36 +00:00
|
|
|
g_myAimMode = g_player[0].ps->aim_mode = 1;
|
2007-08-27 00:20:15 +00:00
|
|
|
ud.config.NumBits = 16;
|
|
|
|
ud.config.NumChannels = 2;
|
|
|
|
ud.config.NumVoices = 32;
|
|
|
|
ud.config.ReverseStereo = 0;
|
|
|
|
ud.config.RunMode = ud.auto_run = 1;
|
|
|
|
ud.config.ShowOpponentWeapons = 0;
|
|
|
|
ud.config.SmoothInput = 1;
|
|
|
|
ud.config.SoundToggle = 1;
|
2008-08-07 07:52:36 +00:00
|
|
|
ud.althud = 1;
|
2006-05-09 23:55:42 +00:00
|
|
|
ud.automsg = 0;
|
|
|
|
ud.autovote = 0;
|
2006-07-18 21:08:38 +00:00
|
|
|
ud.brightness = 8;
|
2007-08-31 06:18:56 +00:00
|
|
|
ud.camerasprite = -1;
|
2006-05-09 23:55:42 +00:00
|
|
|
ud.color = 0;
|
2008-07-21 09:05:53 +00:00
|
|
|
ud.crosshair = 1;
|
|
|
|
ud.crosshairscale = 50;
|
2008-07-31 10:35:23 +00:00
|
|
|
ud.obituaries = 1;
|
2006-05-09 23:55:42 +00:00
|
|
|
ud.democams = 1;
|
|
|
|
ud.detail = 1;
|
|
|
|
ud.drawweapon = 1;
|
|
|
|
ud.idplayers = 1;
|
|
|
|
ud.levelstats = 0;
|
|
|
|
ud.lockout = 0;
|
|
|
|
ud.m_ffire = 1;
|
|
|
|
ud.m_marker = 1;
|
2006-04-13 20:47:06 +00:00
|
|
|
ud.mouseaiming = 0;
|
2006-04-25 01:56:24 +00:00
|
|
|
ud.mouseflip = 1;
|
2006-05-09 23:55:42 +00:00
|
|
|
ud.msgdisptime = 120;
|
|
|
|
ud.pwlockout[0] = '\0';
|
2006-04-13 20:47:06 +00:00
|
|
|
ud.runkey_mode = 0;
|
2006-04-25 01:56:24 +00:00
|
|
|
ud.screen_size = 4;
|
2006-04-13 20:47:06 +00:00
|
|
|
ud.screen_tilting = 1;
|
|
|
|
ud.shadows = 1;
|
2006-04-30 01:39:58 +00:00
|
|
|
ud.statusbarmode = 0;
|
2008-11-26 02:43:47 +00:00
|
|
|
ud.statusbarscale = 100;
|
2006-08-18 23:52:26 +00:00
|
|
|
ud.team = 0;
|
2007-02-23 22:27:22 +00:00
|
|
|
ud.viewbob = 1;
|
|
|
|
ud.weaponsway = 1;
|
2006-05-09 23:55:42 +00:00
|
|
|
ud.weaponswitch = 3; // new+empty
|
2007-03-24 23:17:56 +00:00
|
|
|
ud.angleinterpolation = 0;
|
2007-08-27 00:20:15 +00:00
|
|
|
ud.config.UseJoystick = 0;
|
|
|
|
ud.config.UseMouse = 1;
|
2008-07-28 21:23:10 +00:00
|
|
|
ud.config.VoiceToggle = 5; // bitfield, 1 = local, 2 = dummy, 4 = other players in DM
|
2008-08-19 11:05:21 +00:00
|
|
|
ud.display_bonus_screen = 1;
|
2008-09-29 02:12:53 +00:00
|
|
|
ud.show_level_text = 1;
|
2008-08-20 08:39:07 +00:00
|
|
|
ud.configversion = 0;
|
2008-10-05 11:51:59 +00:00
|
|
|
ud.weaponscale = 100;
|
2008-10-11 09:20:04 +00:00
|
|
|
ud.textscale = 100;
|
2006-05-01 06:30:33 +00:00
|
|
|
|
2009-03-14 02:55:39 +00:00
|
|
|
ud.config.CheckForUpdates = 1;
|
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
Bstrcpy(ud.rtsname, "DUKE.RTS");
|
2008-11-20 14:06:36 +00:00
|
|
|
Bstrcpy(szPlayerName, "Duke");
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
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!!!");
|
|
|
|
|
|
|
|
// JBF 20031211
|
2006-04-25 05:01:27 +00:00
|
|
|
|
2007-03-11 00:47:32 +00:00
|
|
|
CONFIG_SetDefaultKeys(0);
|
2007-02-23 22:27:22 +00:00
|
|
|
|
2007-08-27 00:20:15 +00:00
|
|
|
memset(ud.config.MouseFunctions, -1, sizeof(ud.config.MouseFunctions));
|
2006-11-15 01:16:55 +00:00
|
|
|
for (i=0; i<MAXMOUSEBUTTONS; i++)
|
|
|
|
{
|
2007-08-27 00:20:15 +00:00
|
|
|
ud.config.MouseFunctions[i][0] = CONFIG_FunctionNameToNum(mousedefaults[i]);
|
|
|
|
CONTROL_MapButton(ud.config.MouseFunctions[i][0], i, 0, controldevice_mouse);
|
2006-04-25 22:50:57 +00:00
|
|
|
if (i>=4) continue;
|
2007-08-27 00:20:15 +00:00
|
|
|
ud.config.MouseFunctions[i][1] = CONFIG_FunctionNameToNum(mouseclickeddefaults[i]);
|
|
|
|
CONTROL_MapButton(ud.config.MouseFunctions[i][1], i, 1, controldevice_mouse);
|
2006-04-25 05:01:27 +00:00
|
|
|
}
|
|
|
|
|
2007-08-27 00:20:15 +00:00
|
|
|
memset(ud.config.MouseDigitalFunctions, -1, sizeof(ud.config.MouseDigitalFunctions));
|
2006-11-15 01:16:55 +00:00
|
|
|
for (i=0; i<MAXMOUSEAXES; i++)
|
|
|
|
{
|
2007-08-27 00:20:15 +00:00
|
|
|
ud.config.MouseAnalogueScale[i] = 65536;
|
|
|
|
CONTROL_SetAnalogAxisScale(i, ud.config.MouseAnalogueScale[i], controldevice_mouse);
|
2006-04-25 05:01:27 +00:00
|
|
|
|
2007-08-27 00:20:15 +00:00
|
|
|
ud.config.MouseDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(mousedigitaldefaults[i*2]);
|
|
|
|
ud.config.MouseDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(mousedigitaldefaults[i*2+1]);
|
|
|
|
CONTROL_MapDigitalAxis(i, ud.config.MouseDigitalFunctions[i][0], 0, controldevice_mouse);
|
|
|
|
CONTROL_MapDigitalAxis(i, ud.config.MouseDigitalFunctions[i][1], 1, controldevice_mouse);
|
2006-04-25 05:01:27 +00:00
|
|
|
|
2007-08-27 00:20:15 +00:00
|
|
|
ud.config.MouseAnalogueAxes[i] = CONFIG_AnalogNameToNum(mouseanalogdefaults[i]);
|
|
|
|
CONTROL_MapAnalogAxis(i, ud.config.MouseAnalogueAxes[i], controldevice_mouse);
|
2006-04-25 05:01:27 +00:00
|
|
|
}
|
2009-04-29 19:43:51 +00:00
|
|
|
CONTROL_MouseSensitivity = DEFAULTMOUSESENSITIVITY;
|
2006-04-25 05:01:27 +00:00
|
|
|
|
2007-08-27 00:20:15 +00:00
|
|
|
memset(ud.config.JoystickFunctions, -1, sizeof(ud.config.JoystickFunctions));
|
2006-11-15 01:16:55 +00:00
|
|
|
for (i=0; i<MAXJOYBUTTONS; i++)
|
|
|
|
{
|
2007-08-27 00:20:15 +00:00
|
|
|
ud.config.JoystickFunctions[i][0] = CONFIG_FunctionNameToNum(joystickdefaults[i]);
|
|
|
|
ud.config.JoystickFunctions[i][1] = CONFIG_FunctionNameToNum(joystickclickeddefaults[i]);
|
|
|
|
CONTROL_MapButton(ud.config.JoystickFunctions[i][0], i, 0, controldevice_joystick);
|
|
|
|
CONTROL_MapButton(ud.config.JoystickFunctions[i][1], i, 1, controldevice_joystick);
|
2006-04-25 05:01:27 +00:00
|
|
|
}
|
|
|
|
|
2007-08-27 00:20:15 +00:00
|
|
|
memset(ud.config.JoystickDigitalFunctions, -1, sizeof(ud.config.JoystickDigitalFunctions));
|
2006-11-15 01:16:55 +00:00
|
|
|
for (i=0; i<MAXJOYAXES; i++)
|
|
|
|
{
|
2007-08-27 00:20:15 +00:00
|
|
|
ud.config.JoystickAnalogueScale[i] = 65536;
|
|
|
|
ud.config.JoystickAnalogueDead[i] = 1000;
|
|
|
|
ud.config.JoystickAnalogueSaturate[i] = 9500;
|
|
|
|
CONTROL_SetAnalogAxisScale(i, ud.config.JoystickAnalogueScale[i], controldevice_joystick);
|
2007-08-26 10:35:52 +00:00
|
|
|
|
2007-08-27 00:20:15 +00:00
|
|
|
ud.config.JoystickDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(joystickdigitaldefaults[i*2]);
|
|
|
|
ud.config.JoystickDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(joystickdigitaldefaults[i*2+1]);
|
|
|
|
CONTROL_MapDigitalAxis(i, ud.config.JoystickDigitalFunctions[i][0], 0, controldevice_joystick);
|
|
|
|
CONTROL_MapDigitalAxis(i, ud.config.JoystickDigitalFunctions[i][1], 1, controldevice_joystick);
|
2007-08-26 10:35:52 +00:00
|
|
|
|
2007-08-27 00:20:15 +00:00
|
|
|
ud.config.JoystickAnalogueAxes[i] = CONFIG_AnalogNameToNum(joystickanalogdefaults[i]);
|
|
|
|
CONTROL_MapAnalogAxis(i, ud.config.JoystickAnalogueAxes[i], controldevice_joystick);
|
2006-04-25 05:01:27 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
/*
|
|
|
|
===================
|
|
|
|
=
|
|
|
|
= CONFIG_ReadKeys
|
|
|
|
=
|
|
|
|
===================
|
|
|
|
*/
|
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
void CONFIG_ReadKeys(void)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-04-26 05:57:42 +00:00
|
|
|
int32_t i;
|
|
|
|
int32_t numkeyentries;
|
|
|
|
int32_t function;
|
2006-04-13 20:47:06 +00:00
|
|
|
char keyname1[80];
|
|
|
|
char keyname2[80];
|
|
|
|
kb_scancode key1,key2;
|
|
|
|
|
2007-08-27 00:20:15 +00:00
|
|
|
if (ud.config.scripthandle < 0) return;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2007-08-27 00:20:15 +00:00
|
|
|
numkeyentries = SCRIPT_NumberEntries(ud.config.scripthandle,"KeyDefinitions");
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-01-10 07:38:50 +00:00
|
|
|
Bmemset(&KeyBindings,0,sizeof(KeyBindings));
|
2008-06-29 13:35:52 +00:00
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=0; i<numkeyentries; i++)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2007-08-27 00:20:15 +00:00
|
|
|
function = CONFIG_FunctionNameToNum(SCRIPT_Entry(ud.config.scripthandle,"KeyDefinitions", i));
|
2006-04-13 20:47:06 +00:00
|
|
|
if (function != -1)
|
|
|
|
{
|
|
|
|
memset(keyname1,0,sizeof(keyname1));
|
|
|
|
memset(keyname2,0,sizeof(keyname2));
|
|
|
|
SCRIPT_GetDoubleString
|
|
|
|
(
|
2007-08-27 00:20:15 +00:00
|
|
|
ud.config.scripthandle,
|
2006-04-13 20:47:06 +00:00
|
|
|
"KeyDefinitions",
|
2007-08-27 00:20:15 +00:00
|
|
|
SCRIPT_Entry(ud.config.scripthandle, "KeyDefinitions", i),
|
2006-04-13 20:47:06 +00:00
|
|
|
keyname1,
|
|
|
|
keyname2
|
|
|
|
);
|
|
|
|
key1 = 0xff;
|
|
|
|
key2 = 0xff;
|
|
|
|
if (keyname1[0])
|
|
|
|
{
|
2009-04-26 05:57:42 +00:00
|
|
|
key1 = (uint8_t) KB_StringToScanCode(keyname1);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
if (keyname2[0])
|
|
|
|
{
|
2009-04-26 05:57:42 +00:00
|
|
|
key2 = (uint8_t) KB_StringToScanCode(keyname2);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2007-08-27 00:20:15 +00:00
|
|
|
ud.config.KeyboardKeys[function][0] = key1;
|
|
|
|
ud.config.KeyboardKeys[function][1] = key2;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i=0; i<NUMGAMEFUNCTIONS; i++)
|
|
|
|
{
|
|
|
|
if (i == gamefunc_Show_Console)
|
2007-08-27 00:20:15 +00:00
|
|
|
OSD_CaptureKey(ud.config.KeyboardKeys[i][0]);
|
2006-04-13 20:47:06 +00:00
|
|
|
else
|
2008-07-09 23:25:38 +00:00
|
|
|
CONFIG_MapKey(i, ud.config.KeyboardKeys[i][0], 0, ud.config.KeyboardKeys[i][1], 0);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-07-04 01:15:32 +00:00
|
|
|
// wrapper for CONTROL_MapKey(), generates key bindings to reflect changes to keyboard setup
|
2009-04-26 05:57:42 +00:00
|
|
|
void CONFIG_MapKey(int32_t which, kb_scancode key1, kb_scancode oldkey1, kb_scancode key2, kb_scancode oldkey2)
|
2008-06-30 09:00:33 +00:00
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t i, j, k;
|
|
|
|
int32_t ii[] = { key1, key2, oldkey1, oldkey2 };
|
2008-07-07 06:44:41 +00:00
|
|
|
char buf[64];
|
2008-06-30 09:00:33 +00:00
|
|
|
|
|
|
|
CONTROL_MapKey(which, key1, key2);
|
2008-06-30 11:01:58 +00:00
|
|
|
|
2008-07-04 01:15:32 +00:00
|
|
|
for (k = 0; (unsigned)k < (sizeof(ii) / sizeof(ii[0])); k++)
|
2008-06-30 09:00:33 +00:00
|
|
|
{
|
2008-07-04 01:15:32 +00:00
|
|
|
if (ii[k] == 0xff || !ii[k]) continue;
|
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (j=0; ConsoleKeys[j].name; j++)
|
2009-01-10 07:38:50 +00:00
|
|
|
if (ii[k] == ConsoleKeys[j].id)
|
2008-06-30 09:00:33 +00:00
|
|
|
break;
|
2009-01-10 07:38:50 +00:00
|
|
|
if (ConsoleKeys[j].name)
|
|
|
|
KeyBindings[ii[k]].key=Bstrdup(ConsoleKeys[j].name);
|
2008-06-30 11:01:58 +00:00
|
|
|
|
2009-01-10 07:38:50 +00:00
|
|
|
KeyBindings[ii[k]].repeat = 1;
|
|
|
|
KeyBindings[ii[k]].cmd[0] = 0;
|
2008-07-04 01:15:32 +00:00
|
|
|
tempbuf[0] = 0;
|
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=NUMGAMEFUNCTIONS-1; i>=0; i--)
|
2008-06-30 11:01:58 +00:00
|
|
|
{
|
2008-07-04 01:15:32 +00:00
|
|
|
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);
|
|
|
|
}
|
2008-06-30 11:01:58 +00:00
|
|
|
}
|
2009-01-10 07:38:50 +00:00
|
|
|
Bstrncpy(KeyBindings[ii[k]].cmd,tempbuf, MAXBINDSTRINGLENGTH-1);
|
2008-07-04 01:15:32 +00:00
|
|
|
|
2009-01-10 07:38:50 +00:00
|
|
|
i = Bstrlen(KeyBindings[ii[k]].cmd);
|
2008-07-04 01:15:32 +00:00
|
|
|
if (i)
|
2009-01-10 07:38:50 +00:00
|
|
|
KeyBindings[ii[k]].cmd[i-2] = 0; // cut off the trailing "; "
|
2008-06-30 09:00:33 +00:00
|
|
|
}
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
===================
|
|
|
|
=
|
|
|
|
= CONFIG_SetupMouse
|
|
|
|
=
|
|
|
|
===================
|
|
|
|
*/
|
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
void CONFIG_SetupMouse(void)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-04-26 05:57:42 +00:00
|
|
|
int32_t i;
|
2006-04-22 22:33:52 +00:00
|
|
|
char str[80];
|
2006-04-13 20:47:06 +00:00
|
|
|
char temp[80];
|
2009-04-29 19:43:51 +00:00
|
|
|
int32_t scale;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2007-08-27 00:20:15 +00:00
|
|
|
if (ud.config.scripthandle < 0) return;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=0; i<MAXMOUSEBUTTONS; i++)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2007-12-12 17:42:14 +00:00
|
|
|
Bsprintf(str,"MouseButton%d",i);
|
2006-11-15 01:16:55 +00:00
|
|
|
temp[0] = 0;
|
2007-08-27 00:20:15 +00:00
|
|
|
if (!SCRIPT_GetString(ud.config.scripthandle,"Controls", str,temp))
|
2008-06-01 01:57:01 +00:00
|
|
|
ud.config.MouseFunctions[i][0] = CONFIG_FunctionNameToNum(temp);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2007-12-12 17:42:14 +00:00
|
|
|
Bsprintf(str,"MouseButtonClicked%d",i);
|
2006-11-15 01:16:55 +00:00
|
|
|
temp[0] = 0;
|
2007-08-27 00:20:15 +00:00
|
|
|
if (!SCRIPT_GetString(ud.config.scripthandle,"Controls", str,temp))
|
2008-06-01 01:57:01 +00:00
|
|
|
ud.config.MouseFunctions[i][1] = CONFIG_FunctionNameToNum(temp);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// map over the axes
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=0; i<MAXMOUSEAXES; i++)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2007-12-12 17:42:14 +00:00
|
|
|
Bsprintf(str,"MouseAnalogAxes%d",i);
|
2006-11-15 01:16:55 +00:00
|
|
|
temp[0] = 0;
|
2007-08-27 00:20:15 +00:00
|
|
|
if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp))
|
2006-12-17 21:20:35 +00:00
|
|
|
if (CONFIG_AnalogNameToNum(temp) != -1 || (!temp[0] && CONFIG_FunctionNameToNum(temp) != -1))
|
2007-08-27 00:20:15 +00:00
|
|
|
ud.config.MouseAnalogueAxes[i] = CONFIG_AnalogNameToNum(temp);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2007-12-12 17:42:14 +00:00
|
|
|
Bsprintf(str,"MouseDigitalAxes%d_0",i);
|
2006-11-15 01:16:55 +00:00
|
|
|
temp[0] = 0;
|
2007-08-27 00:20:15 +00:00
|
|
|
if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp))
|
2006-12-17 21:20:35 +00:00
|
|
|
if (CONFIG_FunctionNameToNum(temp) != -1 || (!temp[0] && CONFIG_FunctionNameToNum(temp) != -1))
|
2007-08-27 00:20:15 +00:00
|
|
|
ud.config.MouseDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(temp);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2007-12-12 17:42:14 +00:00
|
|
|
Bsprintf(str,"MouseDigitalAxes%d_1",i);
|
2006-11-15 01:16:55 +00:00
|
|
|
temp[0] = 0;
|
2007-08-27 00:20:15 +00:00
|
|
|
if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp))
|
2006-12-17 21:20:35 +00:00
|
|
|
if (CONFIG_FunctionNameToNum(temp) != -1 || (!temp[0] && CONFIG_FunctionNameToNum(temp) != -1))
|
2007-08-27 00:20:15 +00:00
|
|
|
ud.config.MouseDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(temp);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2007-12-12 17:42:14 +00:00
|
|
|
Bsprintf(str,"MouseAnalogScale%d",i);
|
2007-08-27 00:20:15 +00:00
|
|
|
scale = ud.config.MouseAnalogueScale[i];
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Controls", str,&scale);
|
|
|
|
ud.config.MouseAnalogueScale[i] = scale;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2009-04-29 19:43:51 +00:00
|
|
|
{
|
|
|
|
tempbuf[0] = 0;
|
|
|
|
SCRIPT_GetString(ud.config.scripthandle, "Controls","Mouse_Sensitivity",&tempbuf[0]);
|
|
|
|
if (tempbuf[0]) CONTROL_MouseSensitivity = atof(tempbuf);
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
for (i=0; i<MAXMOUSEBUTTONS; i++)
|
|
|
|
{
|
2007-08-27 00:20:15 +00:00
|
|
|
CONTROL_MapButton(ud.config.MouseFunctions[i][0], i, 0, controldevice_mouse);
|
|
|
|
CONTROL_MapButton(ud.config.MouseFunctions[i][1], i, 1, controldevice_mouse);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
for (i=0; i<MAXMOUSEAXES; i++)
|
|
|
|
{
|
2007-08-27 00:20:15 +00:00
|
|
|
CONTROL_MapAnalogAxis(i, ud.config.MouseAnalogueAxes[i], controldevice_mouse);
|
|
|
|
CONTROL_MapDigitalAxis(i, ud.config.MouseDigitalFunctions[i][0], 0,controldevice_mouse);
|
|
|
|
CONTROL_MapDigitalAxis(i, ud.config.MouseDigitalFunctions[i][1], 1,controldevice_mouse);
|
|
|
|
CONTROL_SetAnalogAxisScale(i, ud.config.MouseAnalogueScale[i], controldevice_mouse);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
===================
|
|
|
|
=
|
|
|
|
= CONFIG_SetupJoystick
|
|
|
|
=
|
|
|
|
===================
|
|
|
|
*/
|
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
void CONFIG_SetupJoystick(void)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-04-26 05:57:42 +00:00
|
|
|
int32_t i;
|
2006-04-22 22:33:52 +00:00
|
|
|
char str[80];
|
2006-04-13 20:47:06 +00:00
|
|
|
char temp[80];
|
2009-04-26 05:57:42 +00:00
|
|
|
int32_t scale;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2007-08-27 00:20:15 +00:00
|
|
|
if (ud.config.scripthandle < 0) return;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=0; i<MAXJOYBUTTONS; i++)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2007-12-12 17:42:14 +00:00
|
|
|
Bsprintf(str,"JoystickButton%d",i);
|
2006-11-15 01:16:55 +00:00
|
|
|
temp[0] = 0;
|
2007-08-27 00:20:15 +00:00
|
|
|
if (!SCRIPT_GetString(ud.config.scripthandle,"Controls", str,temp))
|
2008-06-01 01:57:01 +00:00
|
|
|
ud.config.JoystickFunctions[i][0] = CONFIG_FunctionNameToNum(temp);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2007-12-12 17:42:14 +00:00
|
|
|
Bsprintf(str,"JoystickButtonClicked%d",i);
|
2006-11-15 01:16:55 +00:00
|
|
|
temp[0] = 0;
|
2007-08-27 00:20:15 +00:00
|
|
|
if (!SCRIPT_GetString(ud.config.scripthandle,"Controls", str,temp))
|
2008-06-01 01:57:01 +00:00
|
|
|
ud.config.JoystickFunctions[i][1] = CONFIG_FunctionNameToNum(temp);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// map over the axes
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=0; i<MAXJOYAXES; i++)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2007-12-12 17:42:14 +00:00
|
|
|
Bsprintf(str,"JoystickAnalogAxes%d",i);
|
2006-11-15 01:16:55 +00:00
|
|
|
temp[0] = 0;
|
2007-08-27 00:20:15 +00:00
|
|
|
if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp))
|
2006-12-17 21:20:35 +00:00
|
|
|
if (CONFIG_AnalogNameToNum(temp) != -1 || (!temp[0] && CONFIG_FunctionNameToNum(temp) != -1))
|
2007-08-27 00:20:15 +00:00
|
|
|
ud.config.JoystickAnalogueAxes[i] = CONFIG_AnalogNameToNum(temp);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2007-12-12 17:42:14 +00:00
|
|
|
Bsprintf(str,"JoystickDigitalAxes%d_0",i);
|
2006-11-15 01:16:55 +00:00
|
|
|
temp[0] = 0;
|
2007-08-27 00:20:15 +00:00
|
|
|
if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp))
|
2006-12-17 21:20:35 +00:00
|
|
|
if (CONFIG_FunctionNameToNum(temp) != -1 || (!temp[0] && CONFIG_FunctionNameToNum(temp) != -1))
|
2007-08-27 00:20:15 +00:00
|
|
|
ud.config.JoystickDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(temp);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2007-12-12 17:42:14 +00:00
|
|
|
Bsprintf(str,"JoystickDigitalAxes%d_1",i);
|
2006-11-15 01:16:55 +00:00
|
|
|
temp[0] = 0;
|
2007-08-27 00:20:15 +00:00
|
|
|
if (!SCRIPT_GetString(ud.config.scripthandle, "Controls", str,temp))
|
2006-12-17 21:20:35 +00:00
|
|
|
if (CONFIG_FunctionNameToNum(temp) != -1 || (!temp[0] && CONFIG_FunctionNameToNum(temp) != -1))
|
2007-08-27 00:20:15 +00:00
|
|
|
ud.config.JoystickDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(temp);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2007-12-12 17:42:14 +00:00
|
|
|
Bsprintf(str,"JoystickAnalogScale%d",i);
|
2007-08-27 00:20:15 +00:00
|
|
|
scale = ud.config.JoystickAnalogueScale[i];
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Controls", str,&scale);
|
|
|
|
ud.config.JoystickAnalogueScale[i] = scale;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2007-12-12 17:42:14 +00:00
|
|
|
Bsprintf(str,"JoystickAnalogDead%d",i);
|
2007-08-27 00:20:15 +00:00
|
|
|
scale = ud.config.JoystickAnalogueDead[i];
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Controls", str,&scale);
|
|
|
|
ud.config.JoystickAnalogueDead[i] = scale;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2007-12-12 17:42:14 +00:00
|
|
|
Bsprintf(str,"JoystickAnalogSaturate%d",i);
|
2007-08-27 00:20:15 +00:00
|
|
|
scale = ud.config.JoystickAnalogueSaturate[i];
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Controls", str,&scale);
|
|
|
|
ud.config.JoystickAnalogueSaturate[i] = scale;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=0; i<MAXJOYBUTTONS; i++)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2007-08-27 00:20:15 +00:00
|
|
|
CONTROL_MapButton(ud.config.JoystickFunctions[i][0], i, 0, controldevice_joystick);
|
|
|
|
CONTROL_MapButton(ud.config.JoystickFunctions[i][1], i, 1, controldevice_joystick);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=0; i<MAXJOYAXES; i++)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2007-08-27 00:20:15 +00:00
|
|
|
CONTROL_MapAnalogAxis(i, ud.config.JoystickAnalogueAxes[i], controldevice_joystick);
|
|
|
|
CONTROL_MapDigitalAxis(i, ud.config.JoystickDigitalFunctions[i][0], 0, controldevice_joystick);
|
|
|
|
CONTROL_MapDigitalAxis(i, ud.config.JoystickDigitalFunctions[i][1], 1, controldevice_joystick);
|
|
|
|
CONTROL_SetAnalogAxisScale(i, ud.config.JoystickAnalogueScale[i], controldevice_joystick);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
===================
|
|
|
|
=
|
|
|
|
= CONFIG_ReadSetup
|
|
|
|
=
|
|
|
|
===================
|
|
|
|
*/
|
2006-12-01 04:22:16 +00:00
|
|
|
extern char *duke3dgrp;
|
2009-01-09 09:29:17 +00:00
|
|
|
extern void G_CheckPlayerColor(int32_t *color,int32_t prev_color);
|
2008-11-20 14:06:36 +00:00
|
|
|
extern palette_t CrosshairColors;
|
|
|
|
extern palette_t DefaultCrosshairColors;
|
2008-08-17 09:01:31 +00:00
|
|
|
extern char mod_dir[BMAX_PATH];
|
2009-01-09 09:29:17 +00:00
|
|
|
extern int32_t r_maxfps;
|
|
|
|
extern int32_t g_noSetup;
|
2006-09-12 00:51:50 +00:00
|
|
|
|
2009-04-26 05:57:42 +00:00
|
|
|
int32_t CONFIG_ReadSetup(void)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-04-26 05:57:42 +00:00
|
|
|
int32_t dummy, i = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
char commmacro[] = "CommbatMacro# ";
|
2009-04-26 05:57:42 +00:00
|
|
|
extern int32_t CommandWeaponChoice;
|
2008-08-25 10:27:18 +00:00
|
|
|
char tempbuf[1024];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
CONTROL_ClearAssignments();
|
|
|
|
CONFIG_SetDefaults();
|
|
|
|
|
2007-08-27 00:20:15 +00:00
|
|
|
ud.config.setupread = 1;
|
2006-04-25 04:35:39 +00:00
|
|
|
|
2007-01-22 02:49:58 +00:00
|
|
|
pathsearchmode = 1;
|
2007-08-27 00:20:15 +00:00
|
|
|
if (SafeFileExists(setupfilename) && ud.config.scripthandle < 0) // JBF 20031211
|
|
|
|
ud.config.scripthandle = SCRIPT_Load(setupfilename);
|
2008-12-10 11:36:53 +00:00
|
|
|
else if (SafeFileExists(SETUPFILENAME) && ud.config.scripthandle < 0)
|
|
|
|
{
|
|
|
|
Bsprintf(tempbuf,"The configuration file \"%s\" was not found. "
|
|
|
|
"Import configuration data from \"%s\"?",setupfilename,SETUPFILENAME);
|
|
|
|
|
|
|
|
i=wm_ynbox("Import Configuration Settings",tempbuf);
|
|
|
|
if (i) ud.config.scripthandle = SCRIPT_Load(SETUPFILENAME);
|
|
|
|
}
|
2008-08-12 12:50:20 +00:00
|
|
|
else if (SafeFileExists("duke3d.cfg") && ud.config.scripthandle < 0)
|
|
|
|
{
|
|
|
|
Bsprintf(tempbuf,"The configuration file \"%s\" was not found. "
|
2008-12-10 11:36:53 +00:00
|
|
|
"Import configuration data from \"duke3d.cfg\"?",setupfilename);
|
2008-08-12 12:50:20 +00:00
|
|
|
|
|
|
|
i=wm_ynbox("Import Configuration Settings",tempbuf);
|
|
|
|
if (i) ud.config.scripthandle = SCRIPT_Load("duke3d.cfg");
|
|
|
|
}
|
2007-01-22 02:49:58 +00:00
|
|
|
pathsearchmode = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2007-08-27 00:20:15 +00:00
|
|
|
if (ud.config.scripthandle < 0) return -1;
|
2006-07-01 01:40:18 +00:00
|
|
|
|
2007-08-27 00:20:15 +00:00
|
|
|
if (ud.config.scripthandle >= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2008-10-14 08:40:59 +00:00
|
|
|
char dummybuf[64];
|
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (dummy = 0; dummy < 10; dummy++)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
commmacro[13] = dummy+'0';
|
2007-08-27 00:20:15 +00:00
|
|
|
SCRIPT_GetString(ud.config.scripthandle, "Comm Setup",commmacro,&ud.ridecule[dummy][0]);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2007-08-27 00:20:15 +00:00
|
|
|
SCRIPT_GetString(ud.config.scripthandle, "Comm Setup","PlayerName",&tempbuf[0]);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-10-14 08:40:59 +00:00
|
|
|
while (Bstrlen(stripcolorcodes(dummybuf,tempbuf)) > 10)
|
2006-05-10 21:00:56 +00:00
|
|
|
tempbuf[Bstrlen(tempbuf)-1] = '\0';
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
Bstrncpy(szPlayerName,tempbuf,sizeof(szPlayerName)-1);
|
|
|
|
szPlayerName[sizeof(szPlayerName)-1] = '\0';
|
2006-05-01 22:49:09 +00:00
|
|
|
|
2007-08-27 00:20:15 +00:00
|
|
|
SCRIPT_GetString(ud.config.scripthandle, "Comm Setup","RTSName",&ud.rtsname[0]);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Setup","ConfigVersion",&ud.configversion);
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Setup","ForceSetup",&ud.config.ForceSetup);
|
2009-04-14 22:55:32 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Setup","NoAutoLoad",&ud.config.NoAutoLoad);
|
2008-11-20 14:06:36 +00:00
|
|
|
|
2009-05-28 02:55:46 +00:00
|
|
|
// #ifdef _WIN32
|
2008-11-20 14:06:36 +00:00
|
|
|
if (g_noSetup == 0 && mod_dir[0] == '/')
|
2008-12-17 01:59:36 +00:00
|
|
|
{
|
|
|
|
struct stat st;
|
2008-11-20 14:06:36 +00:00
|
|
|
SCRIPT_GetString(ud.config.scripthandle, "Setup","ModDir",&mod_dir[0]);
|
2008-12-17 01:59:36 +00:00
|
|
|
|
2009-05-28 02:55:46 +00:00
|
|
|
if (stat(mod_dir, &st))
|
2008-12-17 01:59:36 +00:00
|
|
|
{
|
|
|
|
if ((st.st_mode & S_IFDIR) != S_IFDIR)
|
|
|
|
{
|
|
|
|
initprintf("Invalid mod dir in cfg!\n");
|
|
|
|
Bsprintf(mod_dir,"/");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-05-28 02:55:46 +00:00
|
|
|
// #endif
|
2008-11-20 14:06:36 +00:00
|
|
|
|
2007-01-22 05:00:57 +00:00
|
|
|
{
|
|
|
|
extern char defaultduke3dgrp[BMAX_PATH];
|
|
|
|
if (!Bstrcmp(defaultduke3dgrp,"duke3d.grp"))
|
2008-08-20 08:39:07 +00:00
|
|
|
SCRIPT_GetString(ud.config.scripthandle, "Setup","SelectedGRP",&duke3dgrp[0]);
|
2007-02-13 09:50:58 +00:00
|
|
|
}
|
2006-12-01 04:22:16 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
{
|
|
|
|
tempbuf[0] = 0;
|
|
|
|
SCRIPT_GetString(ud.config.scripthandle, "Screen Setup", "AmbientLight",&tempbuf[0]);
|
|
|
|
if (atof(tempbuf))
|
|
|
|
{
|
|
|
|
r_ambientlight = atof(tempbuf);
|
|
|
|
r_ambientlightrecip = 1.f/r_ambientlight;
|
|
|
|
}
|
|
|
|
}
|
2008-08-17 09:01:31 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "Detail",&ud.detail);
|
|
|
|
|
|
|
|
{
|
2009-07-09 02:29:48 +00:00
|
|
|
extern uint32_t g_frameDelay;
|
2008-11-20 14:06:36 +00:00
|
|
|
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "MaxFPS",&r_maxfps);
|
|
|
|
r_maxfps = max(0,min(1000,r_maxfps));
|
|
|
|
|
|
|
|
if (r_maxfps)
|
|
|
|
g_frameDelay = (1000/r_maxfps);
|
|
|
|
else g_frameDelay = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "Messages",&ud.fta_on);
|
2006-07-22 23:02:08 +00:00
|
|
|
|
2006-11-15 01:16:55 +00:00
|
|
|
if (!NAM)
|
|
|
|
{
|
2007-08-27 00:20:15 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "Out",&ud.lockout);
|
2008-11-20 14:06:36 +00:00
|
|
|
SCRIPT_GetString(ud.config.scripthandle, "Screen Setup","Password",&ud.pwlockout[0]);
|
2006-07-22 23:02:08 +00:00
|
|
|
}
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenGamma",&ud.brightness);
|
2007-08-27 00:20:15 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenHeight",&ud.config.ScreenHeight);
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenMode",&ud.config.ScreenMode);
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenSize",&ud.screen_size);
|
2008-11-20 14:06:36 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenWidth",&ud.config.ScreenWidth);
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "Shadows",&ud.shadows);
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "Tilt",&ud.screen_tilting);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-07-27 21:33:28 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
tempbuf[0] = 0;
|
|
|
|
SCRIPT_GetString(ud.config.scripthandle, "Screen Setup", "VidGamma",&tempbuf[0]);
|
|
|
|
if (tempbuf[0]) vid_gamma = atof(tempbuf);
|
2008-07-27 21:33:28 +00:00
|
|
|
}
|
2008-07-20 00:39:06 +00:00
|
|
|
|
2008-10-01 04:38:14 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
tempbuf[0] = 0;
|
|
|
|
SCRIPT_GetString(ud.config.scripthandle, "Screen Setup", "VidBrightness",&tempbuf[0]);
|
|
|
|
if (tempbuf[0]) vid_brightness = atof(tempbuf);
|
|
|
|
}
|
2008-10-01 04:38:14 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
{
|
|
|
|
tempbuf[0] = 0;
|
|
|
|
SCRIPT_GetString(ud.config.scripthandle, "Screen Setup", "VidContrast",&tempbuf[0]);
|
|
|
|
if (tempbuf[0]) vid_contrast = atof(tempbuf);
|
2008-10-01 04:38:14 +00:00
|
|
|
}
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
#ifdef RENDERTYPEWIN
|
|
|
|
{
|
2009-04-26 05:57:42 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "WindowPositioning", (int32_t *)&windowpos);
|
2008-11-20 14:06:36 +00:00
|
|
|
windowx = -1;
|
2009-04-26 05:57:42 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "WindowPosX", (int32_t *)&windowx);
|
2008-11-20 14:06:36 +00:00
|
|
|
windowy = -1;
|
2009-04-26 05:57:42 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "WindowPosY", (int32_t *)&windowy);
|
2008-11-20 14:06:36 +00:00
|
|
|
}
|
2006-06-09 01:28:39 +00:00
|
|
|
#endif
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
{
|
|
|
|
#ifdef _WIN32
|
|
|
|
dummy = 0;
|
|
|
|
#else
|
|
|
|
dummy = 1;
|
|
|
|
#endif
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "OSDTextMode",&dummy);
|
|
|
|
OSD_SetTextMode(dummy);
|
|
|
|
}
|
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
#ifdef RENDERTYPEWIN
|
2009-04-26 05:57:42 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "MaxRefreshFreq", (int32_t*)&maxrefreshfreq);
|
2006-04-13 20:47:06 +00:00
|
|
|
#endif
|
2008-11-20 14:06:36 +00:00
|
|
|
|
2006-05-12 21:55:05 +00:00
|
|
|
#if defined(POLYMOST) && defined(USE_OPENGL)
|
2008-11-20 14:06:36 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLAnimationSmoothing", &r_animsmoothing);
|
2007-08-27 00:20:15 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLAnisotropy", &glanisotropy);
|
2009-01-31 00:02:14 +00:00
|
|
|
/*SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLDepthPeeling", &r_depthpeeling);*/
|
2008-11-20 14:06:36 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLDetailMapping", &r_detailmapping);
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLFullbrights", &r_fullbrights);
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLGlowMapping", &r_glowmapping);
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLOcclusionChecking", &r_modelocclusionchecking);
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLParallaxSkyClamping", &r_parallaxskyclamping);
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLParallaxSkyPanning", &r_parallaxskypanning);
|
2009-01-31 00:02:14 +00:00
|
|
|
/*SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLPeelsCount", &r_peelscount);*/
|
2007-08-27 00:20:15 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLProjectionFix", &glprojectionhacks);
|
2009-04-14 22:55:32 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "Polymer", &dummy);
|
|
|
|
if (dummy > 0) glrendmode = 4;
|
|
|
|
else glrendmode = 3;
|
2008-11-20 14:06:36 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLTextureMode", &gltexfiltermode);
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLTextureQuality", &r_downsize);
|
2009-04-30 01:07:08 +00:00
|
|
|
r_downsizevar = r_downsize;
|
2008-11-20 14:06:36 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLUseCompressedTextureCache", &glusetexcache);
|
2007-08-27 00:20:15 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLUseTextureCompr", &glusetexcompr);
|
2008-11-20 14:06:36 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLVBOCount", &r_vbocount);
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLVBOs", &r_vbos);
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLVertexArrays", &r_vertexarrays);
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLVSync", &vsync);
|
2007-08-27 00:20:15 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLWidescreen", &glwidescreen);
|
2008-11-20 14:06:36 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "OSDHightile",&osdhightile);
|
2006-05-12 21:55:05 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
{
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenBPP", &ud.config.ScreenBPP);
|
|
|
|
if (ud.config.ScreenBPP < 8) ud.config.ScreenBPP = 32;
|
|
|
|
}
|
2006-08-07 19:57:53 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
{
|
|
|
|
dummy = usehightile;
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "UseHightile",&dummy);
|
|
|
|
usehightile = dummy != 0;
|
|
|
|
}
|
2007-01-06 01:29:45 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
{
|
|
|
|
dummy = usemodels;
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "UseModels",&dummy);
|
|
|
|
usemodels = dummy != 0;
|
|
|
|
}
|
|
|
|
#endif
|
2007-01-15 09:08:57 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "AltHud",&ud.althud);
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Misc","AngleInterpolation",&ud.angleinterpolation);
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "AutoMsg",&ud.automsg);
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "AutoVote",&ud.autovote);
|
2008-07-22 21:03:09 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
{
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "Color",&ud.color);
|
2009-01-09 09:29:17 +00:00
|
|
|
G_CheckPlayerColor((int32_t *)&ud.color,-1);
|
2008-11-20 14:06:36 +00:00
|
|
|
g_player[0].ps->palookup = g_player[0].pcolor = ud.color;
|
|
|
|
}
|
2007-03-22 18:28:41 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
{
|
|
|
|
tempbuf[0] = 0;
|
|
|
|
SCRIPT_GetString(ud.config.scripthandle, "Misc", "CrosshairColor",&tempbuf[0]);
|
|
|
|
if (tempbuf[0])
|
|
|
|
{
|
|
|
|
char *ptr = strtok(tempbuf,",");
|
|
|
|
palette_t temppal;
|
|
|
|
char *palptr = (char *)&temppal;
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
while (ptr != NULL && i < 3)
|
|
|
|
{
|
|
|
|
palptr[i++] = atoi(ptr);
|
|
|
|
ptr = strtok(NULL,",");
|
|
|
|
}
|
|
|
|
if (i == 3)
|
|
|
|
{
|
|
|
|
Bmemcpy(&CrosshairColors,&temppal,sizeof(palette_t));
|
|
|
|
DefaultCrosshairColors.f = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-08-08 01:54:43 +00:00
|
|
|
|
2008-07-21 09:05:53 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "CrosshairScale",&ud.crosshairscale);
|
2008-11-20 14:06:36 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "Crosshairs",&ud.crosshair);
|
2008-07-31 10:35:23 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "DeathMessages",&ud.obituaries);
|
2007-08-27 00:20:15 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "DemoCams",&ud.democams);
|
2008-11-20 14:06:36 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "Executions",&ud.executions);
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "IDPlayers",&ud.idplayers);
|
2007-08-27 00:20:15 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "MPMessageDisplayTime",&ud.msgdisptime);
|
2008-11-20 14:06:36 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "RunMode",&ud.config.RunMode);
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "ShowFPS",&ud.tickrate);
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "ShowLevelStats",&ud.levelstats);
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "ShowOpponentWeapons",&ud.config.ShowOpponentWeapons); ud.showweapons = ud.config.ShowOpponentWeapons;
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "ShowViewWeapon",&ud.drawweapon);
|
2007-08-27 00:20:15 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "StatusBarMode",&ud.statusbarmode);
|
2008-11-20 14:06:36 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "StatusBarScale",&ud.statusbarscale);
|
2006-05-04 04:18:55 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
{
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "Team",&dummy);
|
|
|
|
ud.team = 0;
|
|
|
|
if (dummy < 4 && dummy > -1) ud.team = dummy;
|
|
|
|
g_player[0].pteam = ud.team;
|
|
|
|
}
|
|
|
|
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "TextScale",&ud.textscale);
|
2007-08-27 00:20:15 +00:00
|
|
|
dummy = ud.config.useprecache;
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "UsePrecache",&dummy);
|
|
|
|
ud.config.useprecache = dummy != 0;
|
2008-11-20 14:06:36 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "ViewBobbing",&ud.viewbob);
|
2008-10-05 11:51:59 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "WeaponScale",&ud.weaponscale);
|
2008-11-20 14:06:36 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "WeaponSway",&ud.weaponsway);
|
2008-10-05 11:51:59 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
// weapon choices are defaulted in G_CheckCommandLine, which may override them
|
2006-04-25 05:01:27 +00:00
|
|
|
if (!CommandWeaponChoice)
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=0; i<10; i++)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2007-12-12 17:42:14 +00:00
|
|
|
Bsprintf(buf,"WeaponChoice%d",i);
|
2006-04-25 05:01:27 +00:00
|
|
|
dummy = -1;
|
2007-08-27 00:20:15 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", buf, &dummy);
|
|
|
|
if (dummy >= 0) g_player[0].wchoice[i] = dummy;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "AmbienceToggle",&ud.config.AmbienceToggle);
|
2007-08-27 00:20:15 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "FXDevice",&ud.config.FXDevice);
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "FXVolume",&ud.config.FXVolume);
|
2008-11-20 14:06:36 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "MixRate",&ud.config.MixRate);
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "MusicDevice",&ud.config.MusicDevice);
|
2007-08-27 00:20:15 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "MusicToggle",&ud.config.MusicToggle);
|
2008-11-20 14:06:36 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "MusicVolume",&ud.config.MusicVolume);
|
2007-08-27 00:20:15 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "NumBits",&ud.config.NumBits);
|
2008-11-20 14:06:36 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "NumChannels",&ud.config.NumChannels);
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "NumVoices",&ud.config.NumVoices);
|
2007-08-27 00:20:15 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "ReverseStereo",&ud.config.ReverseStereo);
|
2008-11-20 14:06:36 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "SoundToggle",&ud.config.SoundToggle);
|
|
|
|
|
|
|
|
{
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "VoiceToggle",&ud.config.VoiceToggle);
|
2009-03-14 02:55:39 +00:00
|
|
|
// hack to switch old VoiceToggle value over to new bitfield format
|
2008-11-20 14:06:36 +00:00
|
|
|
if (ud.config.VoiceToggle == 2) ud.config.VoiceToggle = 5;
|
|
|
|
}
|
|
|
|
|
2009-04-26 05:57:42 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","AimingFlag",(int32_t *)&g_myAimMode); // (if toggle mode) gives state
|
2008-11-20 14:06:36 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","AutoAim",&ud.config.AutoAim); // JBF 20031125
|
|
|
|
g_player[0].ps->auto_aim = ud.config.AutoAim;
|
|
|
|
}
|
2007-08-27 00:20:15 +00:00
|
|
|
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","MouseAimingFlipped",&ud.mouseflip); // mouse aiming inverted
|
2008-11-20 14:06:36 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","MouseAiming",&ud.mouseaiming); // 1=momentary/0=toggle
|
|
|
|
g_player[0].ps->aim_mode = ud.mouseaiming;
|
|
|
|
}
|
|
|
|
|
2007-08-27 00:20:15 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","MouseBias",&ud.config.MouseBias);
|
2008-10-13 01:16:40 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","MouseDeadZone",&ud.config.MouseDeadZone);
|
2008-11-20 14:06:36 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","RunKeyBehaviour",&ud.runkey_mode); // JBF 20031125
|
|
|
|
|
|
|
|
{
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","SmoothInput",&ud.config.SmoothInput);
|
|
|
|
control_smoothmouse = ud.config.SmoothInput;
|
|
|
|
}
|
|
|
|
|
2007-08-27 00:20:15 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","UseJoystick",&ud.config.UseJoystick);
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","UseMouse",&ud.config.UseMouse);
|
2008-11-20 14:06:36 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Controls","WeaponSwitchMode",&ud.weaponswitch);
|
|
|
|
g_player[0].ps->weaponswitch = ud.weaponswitch;
|
|
|
|
}
|
2006-12-18 08:37:12 +00:00
|
|
|
|
|
|
|
#ifdef _WIN32
|
2007-08-27 00:20:15 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Updates", "CheckForUpdates", &ud.config.CheckForUpdates);
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Updates", "LastUpdateCheck", &ud.config.LastUpdateCheck);
|
2006-12-14 03:34:55 +00:00
|
|
|
#endif
|
2008-08-08 05:03:56 +00:00
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CONFIG_ReadKeys();
|
|
|
|
|
2007-08-27 00:20:15 +00:00
|
|
|
//CONFIG_SetupMouse(ud.config.scripthandle);
|
|
|
|
//CONFIG_SetupJoystick(ud.config.scripthandle);
|
|
|
|
ud.config.setupread = 1;
|
2006-07-01 01:40:18 +00:00
|
|
|
return 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
===================
|
|
|
|
=
|
|
|
|
= CONFIG_WriteSetup
|
|
|
|
=
|
|
|
|
===================
|
|
|
|
*/
|
|
|
|
|
2009-03-14 02:55:39 +00:00
|
|
|
void CONFIG_WriteBinds(void) // save binds and aliases to <cfgname>_binds.cfg
|
2008-06-29 12:29:42 +00:00
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t i;
|
2008-08-12 12:50:20 +00:00
|
|
|
FILE *fp;
|
|
|
|
char *ptr = Bstrdup(setupfilename);
|
2008-08-25 10:27:18 +00:00
|
|
|
char tempbuf[128];
|
2008-08-12 12:50:20 +00:00
|
|
|
|
2009-03-14 02:55:39 +00:00
|
|
|
Bsprintf(tempbuf, "%s_binds.cfg", strtok(ptr, "."));
|
2008-08-12 12:50:20 +00:00
|
|
|
fp = fopen(tempbuf, "wt");
|
2008-06-29 12:29:42 +00:00
|
|
|
|
|
|
|
if (fp)
|
|
|
|
{
|
2008-06-30 00:18:59 +00:00
|
|
|
symbol_t *symb;
|
2009-04-30 21:09:44 +00:00
|
|
|
|
|
|
|
fprintf(fp,"// this file automatically generated by EDuke32\n");
|
|
|
|
fprintf(fp,"// these settings take precedence over your main cfg file\n");
|
|
|
|
fprintf(fp,"// do not modify if you lack common sense\n");
|
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=0; i<MAXBOUNDKEYS; i++)
|
2009-01-10 07:38:50 +00:00
|
|
|
if (KeyBindings[i].cmd[0] && KeyBindings[i].key)
|
|
|
|
fprintf(fp,"bind \"%s\"%s \"%s\"\n",KeyBindings[i].key,KeyBindings[i].repeat?"":" norepeat",KeyBindings[i].cmd);
|
2008-06-30 00:18:59 +00:00
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=0; i<MAXMOUSEBUTTONS; i++)
|
2009-01-10 07:38:50 +00:00
|
|
|
if (MouseBindings[i].cmd[0])
|
|
|
|
fprintf(fp,"bind \"%s\"%s \"%s\"\n",MouseBindings[i].key,MouseBindings[i].repeat?"":" norepeat",MouseBindings[i].cmd);
|
2008-06-30 19:06:05 +00:00
|
|
|
|
2008-06-30 00:18:59 +00:00
|
|
|
for (symb=symbols; symb!=NULL; symb=symb->next)
|
|
|
|
if (symb->func == (void *)OSD_ALIAS)
|
2008-07-20 00:39:06 +00:00
|
|
|
fprintf(fp,"alias \"%s\" \"%s\"\n", symb->name, symb->help);
|
2008-06-30 00:18:59 +00:00
|
|
|
|
2008-07-01 11:14:18 +00:00
|
|
|
/* for (i = 0; i < sizeof(cvar)/sizeof(cvarmappings); i++)
|
|
|
|
if (!(cvar[i].type&CVAR_NOSAVE))
|
2009-01-09 09:29:17 +00:00
|
|
|
fprintf(fp,"%s \"%d\"\n",cvar[i].name,*(int32_t*)cvar[i].var);
|
2008-07-01 11:14:18 +00:00
|
|
|
*/
|
2009-04-30 21:09:44 +00:00
|
|
|
OSD_WriteCvars(fp);
|
2008-06-29 12:29:42 +00:00
|
|
|
fclose(fp);
|
2008-08-12 12:50:20 +00:00
|
|
|
Bsprintf(tempbuf,"Wrote %s_binds.cfg\n",ptr);
|
|
|
|
OSD_Printf(tempbuf);
|
|
|
|
Bfree(ptr);
|
2008-07-08 04:52:39 +00:00
|
|
|
return;
|
2008-06-29 12:29:42 +00:00
|
|
|
}
|
2008-08-12 12:50:20 +00:00
|
|
|
Bsprintf(tempbuf,"Error writing %s_binds.cfg: %s\n",ptr,strerror(errno));
|
|
|
|
OSD_Printf(tempbuf);
|
|
|
|
Bfree(ptr);
|
2008-06-29 12:29:42 +00:00
|
|
|
}
|
|
|
|
|
2006-11-14 21:35:50 +00:00
|
|
|
void CONFIG_WriteSetup(void)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-04-26 05:57:42 +00:00
|
|
|
int32_t dummy;
|
2008-08-25 10:27:18 +00:00
|
|
|
char tempbuf[1024];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2007-08-27 00:20:15 +00:00
|
|
|
if (!ud.config.setupread) return;
|
|
|
|
|
|
|
|
if (ud.config.scripthandle < 0)
|
|
|
|
ud.config.scripthandle = SCRIPT_Init(setupfilename);
|
|
|
|
|
2009-04-26 05:57:42 +00:00
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Controls","AimingFlag",(int32_t) g_myAimMode,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Controls","AutoAim",ud.config.AutoAim,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Controls","MouseAimingFlipped",ud.mouseflip,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Controls","MouseAiming",ud.mouseaiming,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Controls","MouseBias",ud.config.MouseBias,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Controls","MouseDeadZone",ud.config.MouseDeadZone,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Controls","RunKeyBehaviour",ud.runkey_mode,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Controls","SmoothInput",ud.config.SmoothInput,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Controls","UseJoystick",ud.config.UseJoystick,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Controls","UseMouse",ud.config.UseMouse,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Controls","WeaponSwitchMode",ud.weaponswitch,FALSE,FALSE);
|
|
|
|
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "AltHud",ud.althud,FALSE,FALSE);
|
2008-11-20 14:06:36 +00:00
|
|
|
// SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "AngleInterpolation",ud.angleinterpolation,false,false);
|
2009-04-26 05:57:42 +00:00
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "AutoMsg",ud.automsg,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "AutoVote",ud.autovote,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "Color",ud.color,FALSE,FALSE);
|
2008-11-20 14:06:36 +00:00
|
|
|
|
|
|
|
if (CrosshairColors.r != DefaultCrosshairColors.r || CrosshairColors.g != DefaultCrosshairColors.g
|
|
|
|
|| CrosshairColors.b != DefaultCrosshairColors.b)
|
|
|
|
{
|
|
|
|
Bsprintf(tempbuf,"%d,%d,%d",CrosshairColors.r,CrosshairColors.g,CrosshairColors.b);
|
|
|
|
SCRIPT_PutString(ud.config.scripthandle, "Misc", "CrosshairColor",tempbuf);
|
|
|
|
}
|
|
|
|
|
2009-04-26 05:57:42 +00:00
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "CrosshairScale",ud.crosshairscale,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "Crosshairs",ud.crosshair,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "DeathMessages",ud.obituaries,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "DemoCams",ud.democams,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "Executions",++ud.executions,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "IDPlayers",ud.idplayers,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "MPMessageDisplayTime",ud.msgdisptime,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "RunMode",ud.config.RunMode,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "ShowFPS",ud.tickrate,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "ShowLevelStats",ud.levelstats,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "ShowOpponentWeapons",ud.config.ShowOpponentWeapons,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "ShowViewWeapon",ud.drawweapon,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "StatusBarMode",ud.statusbarmode,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "StatusBarScale",ud.statusbarscale,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "Team",ud.team,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "TextScale",ud.textscale,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "UsePrecache",ud.config.useprecache,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "ViewBobbing",ud.viewbob,FALSE,FALSE);
|
2008-11-20 14:06:36 +00:00
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (dummy=0; dummy<10; dummy++)
|
2008-11-20 14:06:36 +00:00
|
|
|
{
|
|
|
|
Bsprintf(buf,"WeaponChoice%d",dummy);
|
2009-04-26 05:57:42 +00:00
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Misc",buf,g_player[myconnectindex].wchoice[dummy],FALSE,FALSE);
|
2008-11-20 14:06:36 +00:00
|
|
|
}
|
2007-08-27 00:20:15 +00:00
|
|
|
|
2009-04-26 05:57:42 +00:00
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "WeaponScale",ud.weaponscale,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "WeaponSway",ud.weaponsway,FALSE,FALSE);
|
2008-11-20 14:06:36 +00:00
|
|
|
|
2009-04-26 05:57:42 +00:00
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Setup","ConfigVersion",BYTEVERSION_JF,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Setup", "ForceSetup",ud.config.ForceSetup,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Setup", "NoAutoLoad",ud.config.NoAutoLoad,FALSE,FALSE);
|
2008-11-20 14:06:36 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
Bsprintf(tempbuf,"%.2f",r_ambientlight);
|
|
|
|
SCRIPT_PutString(ud.config.scripthandle, "Screen Setup", "AmbientLight",tempbuf);
|
|
|
|
}
|
2008-10-05 11:51:59 +00:00
|
|
|
|
2009-04-26 05:57:42 +00:00
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Detail",ud.detail,FALSE,FALSE);
|
2006-05-12 21:55:05 +00:00
|
|
|
#if defined(POLYMOST) && defined(USE_OPENGL)
|
2009-04-26 05:57:42 +00:00
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLAnimationSmoothing",r_animsmoothing,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLAnisotropy",glanisotropy,FALSE,FALSE);
|
2009-01-31 00:02:14 +00:00
|
|
|
/*SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLDepthPeeling",r_depthpeeling,false,false);*/
|
2009-04-26 05:57:42 +00:00
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLDetailMapping", r_detailmapping,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLFullbrights", r_fullbrights,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLGlowMapping", r_glowmapping,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLOcclusionChecking", r_modelocclusionchecking,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLParallaxSkyClamping",r_parallaxskyclamping,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLParallaxSkyPanning",r_parallaxskypanning,FALSE,FALSE);
|
2009-01-31 00:02:14 +00:00
|
|
|
/*SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLPeelsCount",r_peelscount,false,false);*/
|
2009-04-26 05:57:42 +00:00
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLProjectionFix",glprojectionhacks,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Polymer",glrendmode == 4,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLTextureMode",gltexfiltermode,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLTextureQuality", r_downsize,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLUseCompressedTextureCache", glusetexcache,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLUseTextureCompr",glusetexcompr,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLVBOCount", r_vbocount,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLVBOs", r_vbos,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLVertexArrays", r_vertexarrays,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLVSync", vsync,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "GLWidescreen",glwidescreen,FALSE,FALSE);
|
2006-05-12 21:55:05 +00:00
|
|
|
#endif
|
2009-04-26 05:57:42 +00:00
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "MaxFPS", r_maxfps, FALSE, FALSE);
|
2006-05-05 01:20:19 +00:00
|
|
|
#ifdef RENDERTYPEWIN
|
2009-04-26 05:57:42 +00:00
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "MaxRefreshFreq",maxrefreshfreq,FALSE,FALSE);
|
2006-05-05 01:20:19 +00:00
|
|
|
#endif
|
2009-04-26 05:57:42 +00:00
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Messages",ud.fta_on,FALSE,FALSE);
|
2006-07-22 23:02:08 +00:00
|
|
|
|
2009-04-26 05:57:42 +00:00
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "OSDHightile",osdhightile,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "OSDTextMode",OSD_GetTextMode(),FALSE,FALSE);
|
2008-11-20 14:06:36 +00:00
|
|
|
|
2006-11-15 01:16:55 +00:00
|
|
|
if (!NAM)
|
|
|
|
{
|
2009-04-26 05:57:42 +00:00
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Out",ud.lockout,FALSE,FALSE);
|
2007-08-27 00:20:15 +00:00
|
|
|
SCRIPT_PutString(ud.config.scripthandle, "Screen Setup", "Password",ud.pwlockout);
|
2006-11-14 21:35:50 +00:00
|
|
|
}
|
|
|
|
|
2009-04-26 05:57:42 +00:00
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenBPP",ud.config.ScreenBPP,FALSE,FALSE); // JBF 20040523
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenGamma",ud.brightness,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenHeight",ud.config.ScreenHeight,FALSE,FALSE); // JBF 20031206
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenMode",ud.config.ScreenMode,FALSE,FALSE); // JBF 20031206
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenSize",ud.screen_size,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenWidth",ud.config.ScreenWidth,FALSE,FALSE); // JBF 20031206
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Shadows",ud.shadows,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Tilt",ud.screen_tilting,FALSE,FALSE);
|
2008-11-20 14:06:36 +00:00
|
|
|
|
2006-08-07 19:57:53 +00:00
|
|
|
#if defined(POLYMOST) && defined(USE_OPENGL)
|
2009-04-26 05:57:42 +00:00
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "UseHightile",usehightile,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "UseModels",usemodels,FALSE,FALSE);
|
2006-08-07 19:57:53 +00:00
|
|
|
#endif
|
2008-11-20 14:06:36 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
Bsprintf(tempbuf,"%.2f",vid_brightness);
|
|
|
|
SCRIPT_PutString(ud.config.scripthandle, "Screen Setup", "VidBrightness",tempbuf);
|
|
|
|
Bsprintf(tempbuf,"%.2f",vid_contrast);
|
|
|
|
SCRIPT_PutString(ud.config.scripthandle, "Screen Setup", "VidContrast",tempbuf);
|
|
|
|
Bsprintf(tempbuf,"%.2f",vid_gamma);
|
|
|
|
SCRIPT_PutString(ud.config.scripthandle, "Screen Setup", "VidGamma",tempbuf);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef RENDERTYPEWIN
|
2009-04-26 05:57:42 +00:00
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "WindowPositioning", windowpos, FALSE, FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "WindowPosX", windowx, FALSE, FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "WindowPosY", windowy, FALSE, FALSE);
|
2008-11-20 14:06:36 +00:00
|
|
|
#endif
|
|
|
|
|
2009-04-26 05:57:42 +00:00
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "AmbienceToggle",ud.config.AmbienceToggle,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "FXVolume",ud.config.FXVolume,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "MusicToggle",ud.config.MusicToggle,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "MusicVolume",ud.config.MusicVolume,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "NumVoices",ud.config.NumVoices,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "NumChannels",ud.config.NumChannels,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "NumBits",ud.config.NumBits,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "MixRate",ud.config.MixRate,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "ReverseStereo",ud.config.ReverseStereo,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "SoundToggle",ud.config.SoundToggle,FALSE,FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "VoiceToggle",ud.config.VoiceToggle,FALSE,FALSE);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-12-14 03:34:55 +00:00
|
|
|
#ifdef _WIN32
|
2009-04-26 05:57:42 +00:00
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Updates", "CheckForUpdates", ud.config.CheckForUpdates, FALSE, FALSE);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Updates", "LastUpdateCheck", ud.config.LastUpdateCheck, FALSE, FALSE);
|
2006-12-14 03:34:55 +00:00
|
|
|
#endif
|
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
// JBF 20031211
|
2009-02-19 16:47:54 +00:00
|
|
|
for (dummy=0; dummy<NUMGAMEFUNCTIONS; dummy++)
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2007-08-27 00:20:15 +00:00
|
|
|
SCRIPT_PutDoubleString(ud.config.scripthandle, "KeyDefinitions", CONFIG_FunctionNumToName(dummy),
|
|
|
|
KB_ScanCodeToString(ud.config.KeyboardKeys[dummy][0]), KB_ScanCodeToString(ud.config.KeyboardKeys[dummy][1]));
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (dummy=0; dummy<MAXMOUSEBUTTONS; dummy++)
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2007-12-12 17:42:14 +00:00
|
|
|
Bsprintf(buf,"MouseButton%d",dummy);
|
2007-08-27 00:20:15 +00:00
|
|
|
SCRIPT_PutString(ud.config.scripthandle,"Controls", buf, CONFIG_FunctionNumToName(ud.config.MouseFunctions[dummy][0]));
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
if (dummy >= (MAXMOUSEBUTTONS-2)) continue;
|
|
|
|
|
2007-12-12 17:42:14 +00:00
|
|
|
Bsprintf(buf,"MouseButtonClicked%d",dummy);
|
2007-08-27 00:20:15 +00:00
|
|
|
SCRIPT_PutString(ud.config.scripthandle,"Controls", buf, CONFIG_FunctionNumToName(ud.config.MouseFunctions[dummy][1]));
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2008-02-02 16:38:30 +00:00
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (dummy=0; dummy<MAXMOUSEAXES; dummy++)
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2007-12-12 17:42:14 +00:00
|
|
|
Bsprintf(buf,"MouseAnalogAxes%d",dummy);
|
2007-08-27 00:20:15 +00:00
|
|
|
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_AnalogNumToName(ud.config.MouseAnalogueAxes[dummy]));
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2007-12-12 17:42:14 +00:00
|
|
|
Bsprintf(buf,"MouseDigitalAxes%d_0",dummy);
|
2007-08-27 00:20:15 +00:00
|
|
|
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(ud.config.MouseDigitalFunctions[dummy][0]));
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2007-12-12 17:42:14 +00:00
|
|
|
Bsprintf(buf,"MouseDigitalAxes%d_1",dummy);
|
2007-08-27 00:20:15 +00:00
|
|
|
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(ud.config.MouseDigitalFunctions[dummy][1]));
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2007-12-12 17:42:14 +00:00
|
|
|
Bsprintf(buf,"MouseAnalogScale%d",dummy);
|
2009-04-26 05:57:42 +00:00
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Controls", buf, ud.config.MouseAnalogueScale[dummy], FALSE, FALSE);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2009-04-29 19:43:51 +00:00
|
|
|
|
|
|
|
Bsprintf(tempbuf,"%.2f",CONTROL_MouseSensitivity);
|
|
|
|
SCRIPT_PutString(ud.config.scripthandle, "Controls","Mouse_Sensitivity",tempbuf);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (dummy=0; dummy<MAXJOYBUTTONS; dummy++)
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2007-12-12 17:42:14 +00:00
|
|
|
Bsprintf(buf,"JoystickButton%d",dummy);
|
2007-08-27 00:20:15 +00:00
|
|
|
SCRIPT_PutString(ud.config.scripthandle,"Controls", buf, CONFIG_FunctionNumToName(ud.config.JoystickFunctions[dummy][0]));
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2007-12-12 17:42:14 +00:00
|
|
|
Bsprintf(buf,"JoystickButtonClicked%d",dummy);
|
2007-08-27 00:20:15 +00:00
|
|
|
SCRIPT_PutString(ud.config.scripthandle,"Controls", buf, CONFIG_FunctionNumToName(ud.config.JoystickFunctions[dummy][1]));
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2009-02-19 16:47:54 +00:00
|
|
|
for (dummy=0; dummy<MAXJOYAXES; dummy++)
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2007-12-12 17:42:14 +00:00
|
|
|
Bsprintf(buf,"JoystickAnalogAxes%d",dummy);
|
2007-08-27 00:20:15 +00:00
|
|
|
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_AnalogNumToName(ud.config.JoystickAnalogueAxes[dummy]));
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2007-12-12 17:42:14 +00:00
|
|
|
Bsprintf(buf,"JoystickDigitalAxes%d_0",dummy);
|
2007-08-27 00:20:15 +00:00
|
|
|
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(ud.config.JoystickDigitalFunctions[dummy][0]));
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2007-12-12 17:42:14 +00:00
|
|
|
Bsprintf(buf,"JoystickDigitalAxes%d_1",dummy);
|
2007-08-27 00:20:15 +00:00
|
|
|
SCRIPT_PutString(ud.config.scripthandle, "Controls", buf, CONFIG_FunctionNumToName(ud.config.JoystickDigitalFunctions[dummy][1]));
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2007-12-12 17:42:14 +00:00
|
|
|
Bsprintf(buf,"JoystickAnalogScale%d",dummy);
|
2009-04-26 05:57:42 +00:00
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Controls", buf, ud.config.JoystickAnalogueScale[dummy], FALSE, FALSE);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2007-12-12 17:42:14 +00:00
|
|
|
Bsprintf(buf,"JoystickAnalogDead%d",dummy);
|
2009-04-26 05:57:42 +00:00
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Controls", buf, ud.config.JoystickAnalogueDead[dummy], FALSE, FALSE);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2007-12-12 17:42:14 +00:00
|
|
|
Bsprintf(buf,"JoystickAnalogSaturate%d",dummy);
|
2009-04-26 05:57:42 +00:00
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Controls", buf, ud.config.JoystickAnalogueSaturate[dummy], FALSE, FALSE);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
SCRIPT_PutString(ud.config.scripthandle, "Comm Setup","PlayerName",&szPlayerName[0]);
|
2007-08-27 00:20:15 +00:00
|
|
|
SCRIPT_PutString(ud.config.scripthandle, "Comm Setup","RTSName",&ud.rtsname[0]);
|
2007-02-13 09:50:58 +00:00
|
|
|
|
2008-08-20 08:39:07 +00:00
|
|
|
SCRIPT_PutString(ud.config.scripthandle, "Setup","SelectedGRP",&duke3dgrp[0]);
|
2008-08-23 23:37:01 +00:00
|
|
|
|
2009-05-28 02:55:46 +00:00
|
|
|
// #ifdef _WIN32
|
2008-11-20 14:06:36 +00:00
|
|
|
if (g_noSetup == 0)
|
2008-10-11 11:50:02 +00:00
|
|
|
SCRIPT_PutString(ud.config.scripthandle, "Setup","ModDir",&mod_dir[0]);
|
2009-05-28 02:55:46 +00:00
|
|
|
// #endif
|
2008-08-23 23:37:01 +00:00
|
|
|
|
2006-04-22 06:10:28 +00:00
|
|
|
{
|
|
|
|
char commmacro[] = "CommbatMacro# ";
|
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (dummy = 0; dummy < 10; dummy++)
|
2006-04-22 06:10:28 +00:00
|
|
|
{
|
|
|
|
commmacro[13] = dummy+'0';
|
2007-08-27 00:20:15 +00:00
|
|
|
SCRIPT_PutString(ud.config.scripthandle, "Comm Setup",commmacro,&ud.ridecule[dummy][0]);
|
2006-04-22 06:10:28 +00:00
|
|
|
}
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2007-08-27 00:20:15 +00:00
|
|
|
SCRIPT_Save(ud.config.scripthandle, setupfilename);
|
|
|
|
SCRIPT_Free(ud.config.scripthandle);
|
2008-07-08 04:52:39 +00:00
|
|
|
OSD_Printf("Wrote %s\n",setupfilename);
|
|
|
|
CONFIG_WriteBinds();
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-04-26 05:57:42 +00:00
|
|
|
int32_t CONFIG_GetMapBestTime(char *mapname)
|
2006-10-23 21:47:28 +00:00
|
|
|
{
|
2009-04-26 05:57:42 +00:00
|
|
|
int32_t t = -1;
|
2006-10-23 21:47:28 +00:00
|
|
|
char m[BMAX_PATH], *p;
|
|
|
|
|
|
|
|
strcpy(m, mapname);
|
|
|
|
p = strrchr(m, '/');
|
|
|
|
if (!p) p = strrchr(m, '\\');
|
|
|
|
if (p) strcpy(m, p);
|
2009-02-19 16:47:54 +00:00
|
|
|
for (p=m; *p; p++) *p = tolower(*p);
|
2006-10-23 21:47:28 +00:00
|
|
|
|
2008-09-26 04:20:08 +00:00
|
|
|
// cheap hack because SCRIPT_GetNumber doesn't like the slashes
|
|
|
|
p = m;
|
|
|
|
while (*p == '/') p++;
|
|
|
|
|
2007-08-27 00:20:15 +00:00
|
|
|
if (!ud.config.setupread) return -1;
|
|
|
|
if (ud.config.scripthandle < 0) return -1;
|
2006-10-23 21:47:28 +00:00
|
|
|
|
2008-09-26 04:20:08 +00:00
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "MapTimes", p, &t);
|
2006-10-23 21:47:28 +00:00
|
|
|
return t;
|
|
|
|
}
|
|
|
|
|
2009-04-26 05:57:42 +00:00
|
|
|
int32_t CONFIG_SetMapBestTime(char *mapname, int32_t tm)
|
2006-10-23 21:47:28 +00:00
|
|
|
{
|
|
|
|
char m[BMAX_PATH], *p;
|
|
|
|
|
|
|
|
strcpy(m, mapname);
|
|
|
|
p = strrchr(m, '/');
|
|
|
|
if (!p) p = strrchr(m, '\\');
|
|
|
|
if (p) strcpy(m, p);
|
2009-02-19 16:47:54 +00:00
|
|
|
for (p=m; *p; p++) *p = tolower(*p);
|
2006-10-23 21:47:28 +00:00
|
|
|
|
2008-09-26 04:20:08 +00:00
|
|
|
// cheap hack because SCRIPT_GetNumber doesn't like the slashes
|
|
|
|
p = m;
|
|
|
|
while (*p == '/') p++;
|
|
|
|
|
2007-08-27 00:20:15 +00:00
|
|
|
if (ud.config.scripthandle < 0) ud.config.scripthandle = SCRIPT_Init(setupfilename);
|
|
|
|
if (ud.config.scripthandle < 0) return -1;
|
2006-10-23 21:47:28 +00:00
|
|
|
|
2009-04-26 05:57:42 +00:00
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "MapTimes", p, tm, FALSE, FALSE);
|
2006-10-23 21:47:28 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
/*
|
|
|
|
* vim:ts=4:sw=4:
|
|
|
|
*/
|
|
|
|
|