- Config work almost done.

The only thing still referencing the old config file is Shadow Warrior's config read function.
This commit is contained in:
Christoph Oelckers 2019-10-27 13:40:24 +01:00
parent 038c1ba4ba
commit c0d5ca8ab8
74 changed files with 362 additions and 1212 deletions

View file

@ -1631,7 +1631,7 @@ int app_main(int argc, char const * const * argv)
initprintf("Initializing network users\n"); initprintf("Initializing network users\n");
netInitialize(true); netInitialize(true);
scrSetGameMode(gSetup.fullscreen, gSetup.xdim, gSetup.ydim, gSetup.bpp); scrSetGameMode( ScreenMode, ScreenWidth, ScreenHeight, ScreenBPP);
scrSetGamma(gGamma); scrSetGamma(gGamma);
viewResizeView(gViewSize); viewResizeView(gViewSize);
initprintf("Initializing sound system\n"); initprintf("Initializing sound system\n");

View file

@ -55,7 +55,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_BLD_NS BEGIN_BLD_NS
int32_t scripthandle;
int32_t setupread; int32_t setupread;
int32_t mus_restartonload; int32_t mus_restartonload;
char szPlayerName[MAXPLAYERNAME]; char szPlayerName[MAXPLAYERNAME];
@ -89,21 +88,6 @@ int gWeaponsV10x;
void CONFIG_SetDefaults(void) void CONFIG_SetDefaults(void)
{ {
scripthandle = -1;
#ifdef __ANDROID__
droidinput.forward_sens = 5.f;
droidinput.gameControlsAlpha = 0.5;
droidinput.hideStick = 0;
droidinput.pitch_sens = 5.f;
droidinput.quickSelectWeapon = 1;
droidinput.strafe_sens = 5.f;
droidinput.toggleCrouch = 1;
droidinput.yaw_sens = 5.f;
gSetup.xdim = droidinfo.screen_width;
gSetup.ydim = droidinfo.screen_height;
#else
# if defined RENDERTYPESDL && SDL_MAJOR_VERSION > 1 # if defined RENDERTYPESDL && SDL_MAJOR_VERSION > 1
uint32_t inited = SDL_WasInit(SDL_INIT_VIDEO); uint32_t inited = SDL_WasInit(SDL_INIT_VIDEO);
if (inited == 0) if (inited == 0)
@ -114,35 +98,33 @@ void CONFIG_SetDefaults(void)
SDL_DisplayMode dm; SDL_DisplayMode dm;
if (SDL_GetDesktopDisplayMode(0, &dm) == 0) if (SDL_GetDesktopDisplayMode(0, &dm) == 0)
{ {
gSetup.xdim = dm.w; ScreenWidth = dm.w;
gSetup.ydim = dm.h; ScreenHeight = dm.h;
} }
else else
# endif
{ {
gSetup.xdim = 1024; ScreenWidth = 1024;
gSetup.ydim = 768; ScreenHeight = 768;
} }
#endif #endif
#ifdef USE_OPENGL #ifdef USE_OPENGL
gSetup.bpp = 32; ScreenBPP = 32;
#else #else
gSetup.bpp = 8; ScreenBPP = 8;
#endif #endif
gSetup.fullscreen = 1; ScreenMode = 1;
//snd_ambience = 1; //snd_ambience = 1;
//ud.config.AutoAim = 1; //ud.config.AutoAim = 1;
gBrightness = 8;
//ud.config.ShowWeapons = 0; //ud.config.ShowWeapons = 0;
//ud.crosshair = 1; //ud.crosshair = 1;
//ud.default_skill = 1; //ud.default_skill = 1;
gUpscaleFactor = 0; gUpscaleFactor = 0;
//ud.display_bonus_screen = 1; //ud.display_bonus_screen = 1;
//ud.lockout = 0; //adult_lockout = 0;
//ud.m_marker = 1; //ud.m_marker = 1;
//ud.maxautosaves = 5; //ud.maxautosaves = 5;
//ud.menu_scrollbartilenum = -1; //ud.menu_scrollbartilenum = -1;
@ -151,7 +133,6 @@ void CONFIG_SetDefaults(void)
//ud.menu_slidebarmargin = 65536; //ud.menu_slidebarmargin = 65536;
//ud.menu_slidebarz = 65536; //ud.menu_slidebarz = 65536;
//ud.menu_slidecursorz = 65536; //ud.menu_slidecursorz = 65536;
//ud.pwlockout[0] = '\0';
//ud.screen_size = 4; //ud.screen_size = 4;
//ud.screen_tilting = 1; //ud.screen_tilting = 1;
//ud.screenfade = 1; //ud.screenfade = 1;
@ -190,91 +171,14 @@ void CONFIG_SetDefaults(void)
int CONFIG_ReadSetup(void) int CONFIG_ReadSetup(void)
{ {
char tempbuf[1024];
CONFIG_SetDefaults(); CONFIG_SetDefaults();
setupread = 1; setupread = 1;
pathsearchmode = 1; pathsearchmode = 1;
if (scripthandle < 0)
{
if (buildvfs_exists(SetupFilename)) // JBF 20031211
scripthandle = SCRIPT_Load(SetupFilename);
#if !defined(EDUKE32_TOUCH_DEVICES) && !defined(EDUKE32_STANDALONE)
else if (buildvfs_exists(SETUPFILENAME))
{
int const i = wm_ynbox("Import Configuration Settings",
"The configuration file \"%s\" was not found. "
"Import configuration data from \"%s\"?",
SetupFilename, SETUPFILENAME);
if (i)
scripthandle = SCRIPT_Load(SETUPFILENAME);
}
#endif
}
pathsearchmode = 0; pathsearchmode = 0;
if (scripthandle < 0) if (ScreenBPP < 8) ScreenBPP = 32;
return -1;
// Nuke: make cvar
///////
SCRIPT_GetNumber(scripthandle, "Game Options", "WeaponsV10x", &gWeaponsV10x);
///////
Bmemset(tempbuf, 0, sizeof(tempbuf));
SCRIPT_GetString(scripthandle, "Comm Setup","PlayerName",&tempbuf[0]);
char nameBuf[64];
while (Bstrlen(OSD_StripColors(nameBuf, tempbuf)) > 10)
tempbuf[Bstrlen(tempbuf) - 1] = '\0';
Bstrncpyz(szPlayerName, tempbuf, sizeof(szPlayerName));
if (gNoSetup == 0 && g_modDir[0] == '/')
{
struct Bstat st;
SCRIPT_GetString(scripthandle, "Setup","ModDir",&g_modDir[0]);
if (Bstat(g_modDir, &st))
{
if ((st.st_mode & S_IFDIR) != S_IFDIR)
{
initprintf("Invalid mod dir in cfg!\n");
Bsprintf(g_modDir,"/");
}
}
}
//if (g_grpNamePtr == NULL && g_addonNum == 0)
//{
// SCRIPT_GetStringPtr(scripthandle, "Setup", "SelectedGRP", &g_grpNamePtr);
// if (g_grpNamePtr && !Bstrlen(g_grpNamePtr))
// g_grpNamePtr = dup_filename(G_DefaultGrpFile());
//}
//
//if (!NAM_WW2GI)
//{
// SCRIPT_GetNumber(scripthandle, "Screen Setup", "Out", &ud.lockout);
// SCRIPT_GetString(scripthandle, "Screen Setup", "Password", &ud.pwlockout[0]);
//}
windowx = -1;
windowy = -1;
SCRIPT_GetNumber(scripthandle, "Screen Setup", "MaxRefreshFreq", (int32_t *)&maxrefreshfreq);
SCRIPT_GetNumber(scripthandle, "Screen Setup", "ScreenBPP", &gSetup.bpp);
SCRIPT_GetNumber(scripthandle, "Screen Setup", "ScreenHeight", &gSetup.ydim);
SCRIPT_GetNumber(scripthandle, "Screen Setup", "ScreenMode", &gSetup.fullscreen);
SCRIPT_GetNumber(scripthandle, "Screen Setup", "ScreenWidth", &gSetup.xdim);
SCRIPT_GetNumber(scripthandle, "Screen Setup", "WindowPosX", (int32_t *)&windowx);
SCRIPT_GetNumber(scripthandle, "Screen Setup", "WindowPosY", (int32_t *)&windowy);
SCRIPT_GetNumber(scripthandle, "Screen Setup", "WindowPositioning", (int32_t *)&windowpos);
if (gSetup.bpp < 8) gSetup.bpp = 32;
setupread = 1; setupread = 1;
return 0; return 0;

View file

@ -36,7 +36,6 @@ BEGIN_BLD_NS
#define MAXPLAYERNAME 16 #define MAXPLAYERNAME 16
extern int32_t scripthandle;
extern int32_t setupread; extern int32_t setupread;
extern char szPlayerName[MAXPLAYERNAME]; extern char szPlayerName[MAXPLAYERNAME];
extern int32_t gTurnSpeed; extern int32_t gTurnSpeed;
@ -64,9 +63,6 @@ extern int gWeaponsV10x;
int CONFIG_ReadSetup(void); int CONFIG_ReadSetup(void);
void CONFIG_SetDefaults(void); void CONFIG_SetDefaults(void);
int32_t CONFIG_GetMapBestTime(char const *mapname, uint8_t const *mapmd4);
int CONFIG_SetMapBestTime(uint8_t const *mapmd4, int32_t tm);
END_BLD_NS END_BLD_NS
#endif #endif

View file

@ -229,7 +229,7 @@ void credPlaySmk(const char *_pzSMK, const char *_pzWAV, int nWav)
Smacker_GetPalette(hSMK, palette); Smacker_GetPalette(hSMK, palette);
paletteSetColorTable(kSMKPal, palette, true); paletteSetColorTable(kSMKPal, palette, true);
videoSetPalette(gBrightness>>2, kSMKPal, 8+2); videoSetPalette(0, kSMKPal, 8+2);
int nScale; int nScale;
@ -269,7 +269,7 @@ void credPlaySmk(const char *_pzSMK, const char *_pzWAV, int nWav)
videoClearScreen(0); videoClearScreen(0);
Smacker_GetPalette(hSMK, palette); Smacker_GetPalette(hSMK, palette);
paletteSetColorTable(kSMKPal, palette, true); paletteSetColorTable(kSMKPal, palette, true);
videoSetPalette(gBrightness >> 2, kSMKPal, 0); videoSetPalette(0, kSMKPal, 0);
tileInvalidate(kSMKTile, 0, 1 << 4); // JBF 20031228 tileInvalidate(kSMKTile, 0, 1 << 4); // JBF 20031228
Smacker_GetFrame(hSMK, pFrame); Smacker_GetFrame(hSMK, pFrame);
rotatesprite_fs(160<<16, 100<<16, nScale, 512, kSMKTile, 0, 0, 2|4|8|64); rotatesprite_fs(160<<16, 100<<16, nScale, 512, kSMKTile, 0, 0, 2|4|8|64);
@ -284,7 +284,7 @@ void credPlaySmk(const char *_pzSMK, const char *_pzWAV, int nWav)
Smacker_Close(hSMK); Smacker_Close(hSMK);
ctrlClearAllInput(); ctrlClearAllInput();
FX_StopAllSounds(); FX_StopAllSounds();
videoSetPalette(gBrightness >> 2, 0, 8+2); videoSetPalette(0, 0, 8+2);
tileDelete(kSMKTile); tileDelete(kSMKTile);
Bfree(pzSMK_); Bfree(pzSMK_);
Bfree(pzWAV_); Bfree(pzWAV_);

View file

@ -33,7 +33,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_BLD_NS BEGIN_BLD_NS
ud_setup_t gSetup;
bool bVanilla = false; bool bVanilla = false;
ClockTicks gFrameClock; ClockTicks gFrameClock;
ClockTicks gFrameTicks; ClockTicks gFrameTicks;

View file

@ -27,14 +27,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_BLD_NS BEGIN_BLD_NS
typedef struct {
int32_t fullscreen;
int32_t xdim;
int32_t ydim;
int32_t bpp;
} ud_setup_t;
extern ud_setup_t gSetup;
extern ClockTicks gFrameClock; extern ClockTicks gFrameClock;
extern ClockTicks gFrameTicks; extern ClockTicks gFrameTicks;
extern int gFrame; extern int gFrame;

View file

@ -1534,17 +1534,17 @@ void SetVideoModeOld(CGameMenuItemChain *pItem)
{ {
if (pItem->at30 == validmodecnt) if (pItem->at30 == validmodecnt)
{ {
gSetup.fullscreen = 0; ScreenMode = 0;
gSetup.xdim = 640; ScreenWidth = 640;
gSetup.ydim = 480; ScreenHeight = 480;
} }
else else
{ {
gSetup.fullscreen = 0; ScreenMode = 0;
gSetup.xdim = validmode[pItem->at30].xdim; ScreenWidth = validmode[pItem->at30].xdim;
gSetup.ydim = validmode[pItem->at30].ydim; ScreenHeight = validmode[pItem->at30].ydim;
} }
scrSetGameMode(gSetup.fullscreen, gSetup.xdim, gSetup.ydim, gSetup.bpp); scrSetGameMode(ScreenMode, ScreenWidth, ScreenHeight, ScreenBPP);
scrSetDac(); scrSetDac();
viewResizeView(gViewSize); viewResizeView(gViewSize);
} }
@ -1580,10 +1580,10 @@ void SetVideoMode(CGameMenuItemChain *pItem)
viewResizeView(gViewSize); viewResizeView(gViewSize);
vid_vsync = videoSetVsync(nvsync); vid_vsync = videoSetVsync(nvsync);
gSetup.fullscreen = fullscreen; ScreenMode = fullscreen;
gSetup.xdim = xres; ScreenWidth = xres;
gSetup.ydim = yres; ScreenHeight = yres;
gSetup.bpp = bpp; ScreenBPP = bpp;
} }
void SetWidescreen(CGameMenuItemZBool *pItem) void SetWidescreen(CGameMenuItemZBool *pItem)
@ -1601,13 +1601,13 @@ void SetupVideoModeMenu(CGameMenuItemChain *pItem)
UNREFERENCED_PARAMETER(pItem); UNREFERENCED_PARAMETER(pItem);
for (int i = 0; i < gResolutionNum; i++) for (int i = 0; i < gResolutionNum; i++)
{ {
if (gSetup.xdim == gResolution[i].xdim && gSetup.ydim == gResolution[i].ydim) if (ScreenWidth == gResolution[i].xdim && ScreenHeight == gResolution[i].ydim)
{ {
itemOptionsDisplayModeResolution.m_nFocus = i; itemOptionsDisplayModeResolution.m_nFocus = i;
break; break;
} }
} }
itemOptionsDisplayModeFullscreen.at20 = gSetup.fullscreen; itemOptionsDisplayModeFullscreen.at20 = ScreenMode;
#ifdef USE_OPENGL #ifdef USE_OPENGL
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
@ -1645,8 +1645,6 @@ void UpdateVideoColorMenu(CGameMenuItemSliderFloat *pItem)
g_videoContrast = itemOptionsDisplayColorContrast.fValue; g_videoContrast = itemOptionsDisplayColorContrast.fValue;
g_videoBrightness = itemOptionsDisplayColorBrightness.fValue; g_videoBrightness = itemOptionsDisplayColorBrightness.fValue;
r_ambientlight = itemOptionsDisplayColorVisibility.fValue; r_ambientlight = itemOptionsDisplayColorVisibility.fValue;
gBrightness = GAMMA_CALC<<2;
videoSetPalette(gBrightness>>2, gLastPal, 0);
} }
void PreDrawDisplayColor(CGameMenuItem *pItem) void PreDrawDisplayColor(CGameMenuItem *pItem)
@ -1663,9 +1661,7 @@ void ResetVideoColor(CGameMenuItemChain *pItem)
g_videoGamma = DEFAULT_GAMMA; g_videoGamma = DEFAULT_GAMMA;
g_videoContrast = DEFAULT_CONTRAST; g_videoContrast = DEFAULT_CONTRAST;
g_videoBrightness = DEFAULT_BRIGHTNESS; g_videoBrightness = DEFAULT_BRIGHTNESS;
gBrightness = 0;
r_ambientlight = 1.f; r_ambientlight = 1.f;
videoSetPalette(gBrightness>>2, gLastPal, 0);
} }
#ifdef USE_OPENGL #ifdef USE_OPENGL
@ -1722,7 +1718,7 @@ void DoModeChange(void)
videoResetMode(); videoResetMode();
if (videoSetGameMode(fullscreen, xres, yres, bpp, upscalefactor)) if (videoSetGameMode(fullscreen, xres, yres, bpp, upscalefactor))
OSD_Printf("restartvid: Reset failed...\n"); OSD_Printf("restartvid: Reset failed...\n");
onvideomodechange(gSetup.bpp > 8); onvideomodechange(ScreenBPP > 8);
} }
#ifdef USE_OPENGL #ifdef USE_OPENGL

View file

@ -209,9 +209,9 @@ int osdcmd_restartvid(osdcmdptr_t UNUSED(parm))
{ {
UNREFERENCED_CONST_PARAMETER(parm); UNREFERENCED_CONST_PARAMETER(parm);
videoResetMode(); videoResetMode();
if (videoSetGameMode(gSetup.fullscreen,gSetup.xdim,gSetup.ydim,gSetup.bpp,0)) if (videoSetGameMode(ScreenMode,ScreenWidth,ScreenHeight,ScreenBPP,0))
ThrowError("restartvid: Reset failed...\n"); ThrowError("restartvid: Reset failed...\n");
onvideomodechange(gSetup.bpp>8); onvideomodechange(ScreenBPP>8);
viewResizeView(gViewSize); viewResizeView(gViewSize);
return OSDCMD_OK; return OSDCMD_OK;
@ -257,8 +257,8 @@ static int osdcmd_music(osdcmdptr_t parm)
static int osdcmd_vidmode(osdcmdptr_t parm) static int osdcmd_vidmode(osdcmdptr_t parm)
{ {
int32_t newbpp = gSetup.bpp, newwidth = gSetup.xdim, int32_t newbpp = ScreenBPP, newwidth = ScreenWidth,
newheight = gSetup.ydim, newfs = gSetup.fullscreen; newheight = ScreenHeight, newfs = ScreenMode;
int32_t tmp; int32_t tmp;
if (parm->numparms < 1 || parm->numparms > 4) return OSDCMD_SHOWHELP; if (parm->numparms < 1 || parm->numparms > 4) return OSDCMD_SHOWHELP;
@ -291,14 +291,14 @@ static int osdcmd_vidmode(osdcmdptr_t parm)
if (videoSetGameMode(newfs,newwidth,newheight,newbpp,upscalefactor)) if (videoSetGameMode(newfs,newwidth,newheight,newbpp,upscalefactor))
{ {
initprintf("vidmode: Mode change failed!\n"); initprintf("vidmode: Mode change failed!\n");
if (videoSetGameMode(gSetup.fullscreen, gSetup.xdim, gSetup.ydim, gSetup.bpp, upscalefactor)) if (videoSetGameMode(ScreenMode, ScreenWidth, ScreenHeight, ScreenBPP, upscalefactor))
ThrowError("vidmode: Reset failed!\n"); ThrowError("vidmode: Reset failed!\n");
} }
gSetup.bpp = newbpp; ScreenBPP = newbpp;
gSetup.xdim = newwidth; ScreenWidth = newwidth;
gSetup.ydim = newheight; ScreenHeight = newheight;
gSetup.fullscreen = newfs; ScreenMode = newfs;
onvideomodechange(gSetup.bpp>8); onvideomodechange(ScreenBPP>8);
viewResizeView(gViewSize); viewResizeView(gViewSize);
return OSDCMD_OK; return OSDCMD_OK;
} }
@ -468,7 +468,7 @@ void onvideomodechange(int32_t newmode)
} }
#endif #endif
videoSetPalette(ud.brightness>>2, palid, 0); videoSetPalette(0, palid, 0);
g_restorePalette = -1; g_restorePalette = -1;
#endif #endif
if (newmode) if (newmode)

View file

@ -73,7 +73,6 @@ static int curPalette;
static int curGamma; static int curGamma;
int gGammaLevels; int gGammaLevels;
bool gFogMode = false; bool gFogMode = false;
int32_t gBrightness;
void scrResetPalette(void) void scrResetPalette(void)
{ {
@ -87,7 +86,7 @@ void gSetDacRange(int start, int end, RGB *pPal)
if (videoGetRenderMode() == REND_CLASSIC) if (videoGetRenderMode() == REND_CLASSIC)
{ {
memcpy(palette, pPal, sizeof(palette)); memcpy(palette, pPal, sizeof(palette));
videoSetPalette(gBrightness>>2, 0, 0); videoSetPalette(0, 0, 0);
} }
} }
@ -278,9 +277,9 @@ void scrSetGameMode(int vidMode, int XRes, int YRes, int nBits)
} }
} }
gSetup.xdim = validmode[resIdx].xdim; ScreenWidth = validmode[resIdx].xdim;
gSetup.ydim = validmode[resIdx].ydim; ScreenHeight = validmode[resIdx].ydim;
gSetup.bpp = bpp; ScreenBPP = bpp;
} }
videoClearViewableArea(0); videoClearViewableArea(0);
scrNextPage(); scrNextPage();

View file

@ -40,7 +40,6 @@ extern RGB curDAC[256];
extern RGB baseDAC[256]; extern RGB baseDAC[256];
extern int gGammaLevels; extern int gGammaLevels;
extern bool gFogMode; extern bool gFogMode;
extern int32_t gBrightness;
void scrCreateStdColors(void); void scrCreateStdColors(void);
void scrResetPalette(void); void scrResetPalette(void);
void gSetDacRange(int start, int end, RGB *pPal); void gSetDacRange(int start, int end, RGB *pPal);

View file

@ -61,12 +61,18 @@ BEGIN_BLD_NS
#define TAB_CONFIG 0 #define TAB_CONFIG 0
#define TAB_MESSAGES 1 #define TAB_MESSAGES 1
typedef struct {
int32_t fullscreen;
int32_t xdim;
int32_t ydim;
int32_t bpp;
} ud_setup_t;
static struct static struct
{ {
ud_setup_t shared;
INICHAIN const * ini; INICHAIN const * ini;
char *gamedir; char *gamedir;
ud_setup_t shared;
int polymer;
} }
settings; settings;
@ -146,7 +152,7 @@ static void PopulateForm(int32_t pgs)
HWND hwnd = GetDlgItem(pages[TAB_CONFIG], IDCVMODE); HWND hwnd = GetDlgItem(pages[TAB_CONFIG], IDCVMODE);
int mode = videoCheckMode(&settings.shared.xdim, &settings.shared.ydim, settings.shared.bpp, settings.shared.fullscreen, 1); int mode = videoCheckMode(&settings.shared.xdim, &settings.shared.ydim, settings.shared.bpp, settings.shared.fullscreen, 1);
if (mode < 0 || (settings.shared.bpp < 15 && (settings.polymer))) if (mode < 0 || (settings.shared.bpp < 15))
{ {
int CONSTEXPR cd[] = { 32, 24, 16, 15, 8, 0 }; int CONSTEXPR cd[] = { 32, 24, 16, 15, 8, 0 };
int i; int i;
@ -173,7 +179,7 @@ static void PopulateForm(int32_t pgs)
for (int i=0; i<validmodecnt; i++) for (int i=0; i<validmodecnt; i++)
{ {
if (validmode[i].fs != (settings.shared.fullscreen)) continue; if (validmode[i].fs != (settings.shared.fullscreen)) continue;
if ((validmode[i].bpp < 15) && (settings.polymer)) continue; if ((validmode[i].bpp < 15)) continue;
// all modes get added to the 3D mode list // all modes get added to the 3D mode list
Bsprintf(buf, "%dx%d %s", validmode[i].xdim, validmode[i].ydim, validmode[i].bpp == 8 ? "software" : "OpenGL"); Bsprintf(buf, "%dx%d %s", validmode[i].xdim, validmode[i].ydim, validmode[i].bpp == 8 ? "software" : "OpenGL");
@ -619,13 +625,7 @@ int32_t startwin_run(void)
SetPage(TAB_CONFIG); SetPage(TAB_CONFIG);
EnableConfig(1); EnableConfig(1);
#ifdef POLYMER settings.shared = { ScreenMode, ScreenWidth, ScreenHeight, ScreenBPP };
settings.polymer = (glrendmode == REND_POLYMER);
#else
settings.polymer = 0;
#endif
settings.shared = gSetup;
settings.ini = pINISelected; settings.ini = pINISelected;
settings.gamedir = g_modDir; settings.gamedir = g_modDir;
@ -657,7 +657,10 @@ int32_t startwin_run(void)
if (done) if (done)
{ {
gSetup = settings.shared; ScreenWidth = settings.shared.xdim;
ScreenHeight = settings.shared.ydim;
ScreenMode = settings.shared.fullscreen;
ScreenBPP = settings.shared.bpp;
pINISelected = settings.ini; pINISelected = settings.ini;
Bstrcpy(g_modDir, (gNoSetup == 0 && settings.gamedir != NULL) ? settings.gamedir : "/"); Bstrcpy(g_modDir, (gNoSetup == 0 && settings.gamedir != NULL) ? settings.gamedir : "/");
} }

View file

@ -810,8 +810,6 @@ static CONSTEXPR const int32_t pow2long[32] =
268435456, 536870912, 1073741824, 2147483647 268435456, 536870912, 1073741824, 2147483647
}; };
EXTERN int32_t windowpos, windowx, windowy;
//These variables are for auto-mapping with the draw2dscreen function. //These variables are for auto-mapping with the draw2dscreen function.
//When you load a new board, these bits are all set to 0 - since //When you load a new board, these bits are all set to 0 - since
//you haven't mapped out anything yet. Note that these arrays are //you haven't mapped out anything yet. Note that these arrays are

View file

@ -11,8 +11,6 @@
#define EDUKE32_SDL_LINKED_PREREQ(x, a, b, c) ((x).major > (a) || ((x).major == (a) && ((x).minor > (b) || ((x).minor == (b) && (x).patch >= (c))))) #define EDUKE32_SDL_LINKED_PREREQ(x, a, b, c) ((x).major > (a) || ((x).major == (a) && ((x).minor > (b) || ((x).minor == (b) && (x).patch >= (c)))))
extern int32_t maxrefreshfreq;
#ifdef _WIN32 #ifdef _WIN32
HWND win_gethwnd(void); HWND win_gethwnd(void);
HINSTANCE win_gethinstance(void); HINSTANCE win_gethinstance(void);

View file

@ -140,8 +140,6 @@ int32_t r_usenewaspect = 1, newaspect_enable=0;
uint32_t r_screenxy = 0; uint32_t r_screenxy = 0;
int32_t r_fpgrouscan = 1; int32_t r_fpgrouscan = 1;
CVAR(int, r_displayindex, 0, CVAR_ARCHIVE|CVAR_VIDEOCONFIG)
CVAR(Int, r_borderless, 2, CVAR_ARCHIVE | CVAR_VIDEOCONFIG)
int32_t globalflags; int32_t globalflags;
float g_videoGamma = DEFAULT_GAMMA; float g_videoGamma = DEFAULT_GAMMA;

View file

@ -764,19 +764,18 @@ void videoSetPalette(char dabrightness, uint8_t dapalid, uint8_t flags)
dapal = basepaltable[curbasepal]; dapal = basepaltable[curbasepal];
// In-scene brightness mode for RR's thunderstorm. This shouldn't affect the global gamma ramp.
if ((videoGetRenderMode() >= REND_POLYMOST) && (flags & 32))
{
if (!(flags & 4)) if (!(flags & 4))
{ {
curbrightness = clamp(dabrightness, 0, 15); curbrightness = clamp(dabrightness, 0, 15);
} }
// In-scene brightness mode for RR's thunderstorm. This shouldn't affect the global gamma ramp.
if ((videoGetRenderMode() >= REND_POLYMOST) && (flags & 32))
{
r_scenebrightness = curbrightness; r_scenebrightness = curbrightness;
} }
else else
{ {
videoSetGamma();
r_scenebrightness = 0; r_scenebrightness = 0;
} }
j = 0; // Assume that the backend can do it. j = 0; // Assume that the backend can do it.

View file

@ -28,6 +28,7 @@
#include "resourcefile.h" #include "resourcefile.h"
#include "sc_man.h" #include "sc_man.h"
#include "i_specialpaths.h" #include "i_specialpaths.h"
#include "c_cvars.h"
#include "../../glbackend/glbackend.h" #include "../../glbackend/glbackend.h"
#ifdef USE_OPENGL #ifdef USE_OPENGL
@ -49,6 +50,13 @@
#include "vfs.h" #include "vfs.h"
CVAR(Int, r_displayindex, 0, CVAR_ARCHIVE | CVAR_VIDEOCONFIG)
CVAR(Int, r_borderless, 2, CVAR_ARCHIVE | CVAR_VIDEOCONFIG)
CVAR(Int, maxrefreshfreq, 0, CVAR_ARCHIVE | CVAR_VIDEOCONFIG)
CVAR(Int, windowpos, 0, CVAR_ARCHIVE | CVAR_VIDEOCONFIG)
CVAR(Int, windowx, -1, CVAR_ARCHIVE | CVAR_VIDEOCONFIG)
CVAR(Int, windowy, -1, CVAR_ARCHIVE | CVAR_VIDEOCONFIG)
#if SDL_MAJOR_VERSION != 1 #if SDL_MAJOR_VERSION != 1
static SDL_version linked; static SDL_version linked;
#endif #endif
@ -110,7 +118,6 @@ static uint16_t sysgamma[3][256];
char nogl=0; char nogl=0;
#endif #endif
static int32_t vsync_renderlayer; static int32_t vsync_renderlayer;
int32_t maxrefreshfreq=0;
// last gamma, contrast, brightness // last gamma, contrast, brightness
@ -1580,12 +1587,14 @@ int32_t videoSetMode(int32_t x, int32_t y, int32_t c, int32_t fs)
x -= 10; x -= 10;
y -= 10; y -= 10;
} }
#endif
if (called++) if (called++)
{ {
assert(0); //assert(0);
return 0;
} }
#endif
ret = setvideomode_sdlcommon(&x, &y, c, fs, &regrab); ret = setvideomode_sdlcommon(&x, &y, c, fs, &regrab);
if (ret != 1) if (ret != 1)
{ {

View file

@ -376,6 +376,41 @@ void CONFIG_ReadCombatMacros()
// //
//========================================================================== //==========================================================================
static FString CONFIG_GetMD4EntryName(uint8_t const* const md4)
{
return FStringf("MD4_%08x%08x%08x%08x",
B_BIG32(B_UNBUF32(&md4[0])), B_BIG32(B_UNBUF32(&md4[4])),
B_BIG32(B_UNBUF32(&md4[8])), B_BIG32(B_UNBUF32(&md4[12])));
}
int32_t CONFIG_GetMapBestTime(char const* const mapname, uint8_t const* const mapmd4)
{
auto m = CONFIG_GetMD4EntryName(mapmd4);
if (GameConfig->SetSection("MapTimes"))
{
auto s = GameConfig->GetValueForKey(m);
if (s) (int)strtoull(s, nullptr, 0);
}
return -1;
}
int CONFIG_SetMapBestTime(uint8_t const* const mapmd4, int32_t tm)
{
FStringf t("%d", tm);
auto m = CONFIG_GetMD4EntryName(mapmd4);
if (GameConfig->SetSection("MapTimes"))
{
GameConfig->SetValueForKey(m, t);
}
return 0;
}
//==========================================================================
//
//
//
//==========================================================================
int32_t MouseFunctions[MAXMOUSEBUTTONS][2]; int32_t MouseFunctions[MAXMOUSEBUTTONS][2];
int32_t MouseDigitalFunctions[MAXMOUSEAXES][2]; int32_t MouseDigitalFunctions[MAXMOUSEAXES][2];
int32_t MouseAnalogueAxes[MAXMOUSEAXES]; int32_t MouseAnalogueAxes[MAXMOUSEAXES];

View file

@ -154,3 +154,6 @@ char const* CONFIG_GetGameFuncOnKeyboard(int gameFunc);
extern FStringCVar* const CombatMacros[]; extern FStringCVar* const CombatMacros[];
void CONFIG_ReadCombatMacros(); void CONFIG_ReadCombatMacros();
int32_t CONFIG_GetMapBestTime(char const* const mapname, uint8_t const* const mapmd4);
int CONFIG_SetMapBestTime(uint8_t const* const mapmd4, int32_t tm);

View file

@ -44,6 +44,7 @@
#include "_control.h" #include "_control.h"
#include "gamecontrol.h" #include "gamecontrol.h"
#include "m_argv.h" #include "m_argv.h"
#include "rts.h"
/* Notes /* Notes
@ -435,30 +436,31 @@ bool G_AllowAutoload()
return true; return true;
} }
#if 0 CVAR(Int, ScreenMode, 0, CVAR_ARCHIVE | CVAR_VIDEOCONFIG)
//CONFIG_PutNumber("Screen Setup", "ScreenBPP", ud.setup.bpp); CVAR(Int, ScreenWidth, 1024, CVAR_ARCHIVE | CVAR_VIDEOCONFIG)
CONFIG_PutNumber("Screen Setup", "ScreenHeight", ud.setup.ydim); CVAR(Int, ScreenHeight, 768, CVAR_ARCHIVE | CVAR_VIDEOCONFIG)
CONFIG_PutNumber("Screen Setup", "ScreenMode", ud.setup.fullscreen); CVAR(Int, ScreenBPP, 32, CVAR_ARCHIVE | CVAR_VIDEOCONFIG)
CONFIG_PutNumber("Screen Setup", "ScreenWidth", ud.setup.xdim);
//GameConfig->SetValueForKey("Setup", "SelectedGRP", g_grpNamePtr); CVAR(Bool, adult_lockout, false, CVAR_ARCHIVE)
//GameConfig->SetValueForKey("Setup", "ModDir", &g_modDir[0]); CUSTOM_CVAR(String, playername, "Player", CVAR_ARCHIVE | CVAR_USERINFO)
CONFIG_PutNumber("Screen Setup", "MaxRefreshFreq", maxrefreshfreq);
CONFIG_PutNumber("Screen Setup", "WindowPosX", windowx);
CONFIG_PutNumber("Screen Setup", "WindowPosY", windowy);
CONFIG_PutNumber("Screen Setup", "WindowPositioning", windowpos);
if (!NAM_WW2GI)
{ {
CONFIG_PutNumber("Screen Setup", "Out", ud.lockout); TArray<char> buffer(strlen(self)+1, 1);
GameConfig->SetValueForKey("Screen Setup", "Password", ud.pwlockout); OSD_StripColors(buffer.Data(), self);
if (buffer.Size() < strlen(self))
{
self = buffer.Data();
}
} }
GameConfig->SetValueForKey("Comm Setup", "PlayerName", &szPlayerName[0]); CUSTOM_CVAR(String, rtsname, "", CVAR_ARCHIVE | CVAR_USERINFO)
{
RTS_Init(self);
}
#if 0
GameConfig->SetValueForKey("Comm Setup", "RTSName", &ud.rtsname[0]); // These will be redone once the resource management has been swapped out.
//GameConfig->SetValueForKey("Setup", "SelectedGRP", g_grpNamePtr);
//GameConfig->SetValueForKey("Setup", "ModDir", &g_modDir[0]);
#endif #endif
@ -495,13 +497,9 @@ GameConfig->SetValueForKey("Comm Setup", "RTSName", &ud.rtsname[0]);
/* /*
else if (!Bstrcasecmp(parm->name, "vid_gamma")) else if (!Bstrcasecmp(parm->name, "vid_gamma"))
{ {
gBrightness = GAMMA_CALC;
gBrightness <<= 2;
videoSetPalette(gBrightness >> 2, gLastPal, 0);
} }
else if (!Bstrcasecmp(parm->name, "vid_brightness") || !Bstrcasecmp(parm->name, "vid_contrast")) else if (!Bstrcasecmp(parm->name, "vid_brightness") || !Bstrcasecmp(parm->name, "vid_contrast"))
{ {
videoSetPalette(gBrightness >> 2, gLastPal, 0);
} }
*/ */
@ -512,7 +510,6 @@ GameConfig->SetValueForKey("Comm Setup", "RTSName", &ud.rtsname[0]);
{ "r_usenewaspect","enable/disable new screen aspect ratio determination code",(void *) &r_usenewaspect, CVAR_BOOL, 0, 1 }, { "r_usenewaspect","enable/disable new screen aspect ratio determination code",(void *) &r_usenewaspect, CVAR_BOOL, 0, 1 },
{ "r_screenaspect","if using r_usenewaspect and in fullscreen, screen aspect ratio in the form XXYY, e.g. 1609 for 16:9", { "r_screenaspect","if using r_usenewaspect and in fullscreen, screen aspect ratio in the form XXYY, e.g. 1609 for 16:9",
(void *) &r_screenxy, SCREENASPECT_CVAR_TYPE, 0, 9999 }, (void *) &r_screenxy, SCREENASPECT_CVAR_TYPE, 0, 9999 },
{ "r_windowpositioning", "enable/disable window position memory", (void *) &windowpos, CVAR_BOOL, 0, 1 },
//{ "vid_gamma","adjusts gamma component of gamma ramp",(void *) &g_videoGamma, CVAR_FLOAT|CVAR_FUNCPTR, 0, 10 }, //{ "vid_gamma","adjusts gamma component of gamma ramp",(void *) &g_videoGamma, CVAR_FLOAT|CVAR_FUNCPTR, 0, 10 },
//{ "vid_contrast","adjusts contrast component of gamma ramp",(void *) &g_videoContrast, CVAR_FLOAT|CVAR_FUNCPTR, 0, 10 }, //{ "vid_contrast","adjusts contrast component of gamma ramp",(void *) &g_videoContrast, CVAR_FLOAT|CVAR_FUNCPTR, 0, 10 },
//{ "vid_brightness","adjusts brightness component of gamma ramp",(void *) &g_videoBrightness, CVAR_FLOAT|CVAR_FUNCPTR, 0, 10 }, //{ "vid_brightness","adjusts brightness component of gamma ramp",(void *) &g_videoBrightness, CVAR_FLOAT|CVAR_FUNCPTR, 0, 10 },

View file

@ -97,6 +97,15 @@ EXTERN_CVAR(String, wchoice)
EXTERN_CVAR(Bool, displaysetup) EXTERN_CVAR(Bool, displaysetup)
EXTERN_CVAR(Bool, noautoload) EXTERN_CVAR(Bool, noautoload)
EXTERN_CVAR(Int, ScreenMode)
EXTERN_CVAR(Int, ScreenWidth)
EXTERN_CVAR(Int, ScreenHeight)
EXTERN_CVAR(Int, ScreenBPP)
EXTERN_CVAR(Bool, adult_lockout)
EXTERN_CVAR(String, playername)
EXTERN_CVAR(String, rtsname)
extern bool gNoAutoLoad; extern bool gNoAutoLoad;
extern float r_ambientlightrecip; extern float r_ambientlightrecip;
extern int hud_statusbarrange; // will be set by the game's configuration setup. extern int hud_statusbarrange; // will be set by the game's configuration setup.

View file

@ -72,6 +72,7 @@ void RTS_Init(const char *filename)
{ {
// Don't do anything before actually requesting some data from it. // Don't do anything before actually requesting some data from it.
// In most cases this is never ever used, so just remember the file name for later. // In most cases this is never ever used, so just remember the file name for later.
// This also simplifies initialization a lot because everything can just call this function and the last one wins.
RTSName = filename; RTSName = filename;
} }

View file

@ -455,7 +455,6 @@ int32_t Anim_Play(const char *fn)
paletteSetColorTable(ANIMPAL, ANIM_GetPalette(), true); paletteSetColorTable(ANIMPAL, ANIM_GetPalette(), true);
// setpalette(0L,256L,tempbuf); // setpalette(0L,256L,tempbuf);
// setbrightness(ud.brightness>>2,tempbuf,2);
P_SetGamePalette(g_player[myconnectindex].ps, ANIMPAL, 8 + 2); P_SetGamePalette(g_player[myconnectindex].ps, ANIMPAL, 8 + 2);
#ifdef USE_OPENGL #ifdef USE_OPENGL

View file

@ -397,9 +397,8 @@ void G_CheckCommandLine(int32_t argc, char const * const * argv)
{ {
if (argc > i+1) if (argc > i+1)
{ {
free(g_rtsNamePtr); RTS_Init(argv[i+1]);
g_rtsNamePtr = dup_filename(argv[i+1]); initprintf("Using RTS file \"%s\".\n", argv[i + 1]);
initprintf("Using RTS file \"%s\".\n", g_rtsNamePtr);
i++; i++;
} }
i++; i++;
@ -727,9 +726,9 @@ void G_CheckCommandLine(int32_t argc, char const * const * argv)
} }
if (!Bstrcasecmp(k, ".rts")) if (!Bstrcasecmp(k, ".rts"))
{ {
free(g_rtsNamePtr); RTS_Init(argv[i]);
g_rtsNamePtr = dup_filename(argv[i++]); initprintf("Using RTS file \"%s\".\n", argv[i]);
initprintf("Using RTS file \"%s\".\n", g_rtsNamePtr); i++;
continue; continue;
} }
} }

View file

@ -11,6 +11,7 @@
#include "gamecvars.h" #include "gamecvars.h"
#include "cmdlib.h" #include "cmdlib.h"
#include "grpscan.h" #include "grpscan.h"
#include "rts.h"
#include "vfs.h" #include "vfs.h"
@ -56,8 +57,6 @@ static const char *defaultgameconfilename[GAMECOUNT] = { "EDUKE.CON", "NAM.CON",
char *g_grpNamePtr = NULL; char *g_grpNamePtr = NULL;
// g_scriptNamePtr can ONLY point to a malloc'd block (length BMAX_PATH) // g_scriptNamePtr can ONLY point to a malloc'd block (length BMAX_PATH)
char *g_scriptNamePtr = NULL; char *g_scriptNamePtr = NULL;
// g_rtsNamePtr can ONLY point to a malloc'd block (length BMAX_PATH)
char *g_rtsNamePtr = NULL;
void clearGrpNamePtr(void) void clearGrpNamePtr(void)
{ {
@ -430,8 +429,8 @@ void G_LoadGroups()
if (type->defname && g_defNamePtr == NULL) if (type->defname && g_defNamePtr == NULL)
g_defNamePtr = dup_filename(type->defname); g_defNamePtr = dup_filename(type->defname);
if (type->rtsname && g_rtsNamePtr == NULL) if (type->rtsname)
g_rtsNamePtr = dup_filename(type->rtsname); RTS_Init(type->rtsname);
} }
else else
{ {
@ -1149,7 +1148,6 @@ void Duke_CommonCleanup(void)
{ {
DO_FREE_AND_NULL(g_grpNamePtr); DO_FREE_AND_NULL(g_grpNamePtr);
DO_FREE_AND_NULL(g_scriptNamePtr); DO_FREE_AND_NULL(g_scriptNamePtr);
DO_FREE_AND_NULL(g_rtsNamePtr);
} }
#endif #endif

View file

@ -90,7 +90,6 @@ extern const char *g_gameNamePtr;
extern char *g_grpNamePtr; extern char *g_grpNamePtr;
extern char *g_scriptNamePtr; extern char *g_scriptNamePtr;
extern char *g_rtsNamePtr;
extern const char *G_DefaultGrpFile(void); extern const char *G_DefaultGrpFile(void);
extern const char *G_GrpFile(void); extern const char *G_GrpFile(void);

View file

@ -46,7 +46,6 @@ BEGIN_DUKE_NS
void CONFIG_SetDefaults(void) void CONFIG_SetDefaults(void)
{ {
ud.config.scripthandle = -1;
# if defined RENDERTYPESDL && SDL_MAJOR_VERSION > 1 # if defined RENDERTYPESDL && SDL_MAJOR_VERSION > 1
uint32_t inited = SDL_WasInit(SDL_INIT_VIDEO); uint32_t inited = SDL_WasInit(SDL_INIT_VIDEO);
@ -58,28 +57,27 @@ void CONFIG_SetDefaults(void)
SDL_DisplayMode dm; SDL_DisplayMode dm;
if (SDL_GetDesktopDisplayMode(0, &dm) == 0) if (SDL_GetDesktopDisplayMode(0, &dm) == 0)
{ {
ud.setup.xdim = dm.w; ScreenWidth = dm.w;
ud.setup.ydim = dm.h; ScreenHeight = dm.h;
} }
else else
# endif # endif
{ {
ud.setup.xdim = 1024; ScreenWidth = 1024;
ud.setup.ydim = 768; ScreenHeight = 768;
} }
ud.setup.bpp = 32; ScreenBPP = 32;
ud.camera_time = 0;//4; ud.camera_time = 0;//4;
g_player[0].ps->aim_mode = 1; g_player[0].ps->aim_mode = 1;
ud.setup.fullscreen = 1; ScreenMode = 1;
ud.althud = 1; ud.althud = 1;
ud.angleinterpolation = 0; ud.angleinterpolation = 0;
ud.brightness = 8;
ud.camerasprite = -1; ud.camerasprite = -1;
ud.color = 0; ud.color = 0;
ud.config.ShowWeapons = 0; ud.config.ShowWeapons = 0;
@ -88,7 +86,6 @@ void CONFIG_SetDefaults(void)
ud.display_bonus_screen = 1; ud.display_bonus_screen = 1;
hud_position = 0; hud_position = 0;
ud.lockout = 0;
ud.m_marker = 1; ud.m_marker = 1;
ud.menu_scrollbartilenum = -1; ud.menu_scrollbartilenum = -1;
ud.menu_scrollbarz = 65536; ud.menu_scrollbarz = 65536;
@ -97,7 +94,6 @@ void CONFIG_SetDefaults(void)
ud.menu_slidebarz = 65536; ud.menu_slidebarz = 65536;
ud.menu_slidecursorz = 65536; ud.menu_slidecursorz = 65536;
ud.menubackground = 1; ud.menubackground = 1;
ud.pwlockout[0] = '\0';
ud.runkey_mode = 0; ud.runkey_mode = 0;
ud.screen_size = 4; ud.screen_size = 4;
ud.screen_tilting = 1; ud.screen_tilting = 1;
@ -110,10 +106,6 @@ void CONFIG_SetDefaults(void)
ud.statusbarscale = 100; ud.statusbarscale = 100;
ud.team = 0; ud.team = 0;
Bstrcpy(ud.rtsname, G_DefaultRtsFile());
Bstrcpy(szPlayerName, "Player");
VM_OnEvent(EVENT_SETDEFAULTS, g_player[myconnectindex].ps->i, myconnectindex); VM_OnEvent(EVENT_SETDEFAULTS, g_player[myconnectindex].ps->i, myconnectindex);
} }
@ -122,83 +114,12 @@ void CONFIG_SetDefaults(void)
int CONFIG_ReadSetup(void) int CONFIG_ReadSetup(void)
{ {
char tempbuf[1024];
CONFIG_SetDefaults(); CONFIG_SetDefaults();
ud.config.setupread = 1; ud.config.setupread = 1;
pathsearchmode = 1;
if (ud.config.scripthandle < 0)
{
if (buildvfs_exists(g_setupFileName)) // JBF 20031211
ud.config.scripthandle = SCRIPT_Load(g_setupFileName);
#if !defined(EDUKE32_TOUCH_DEVICES) && !defined(EDUKE32_STANDALONE)
else if (buildvfs_exists(SETUPFILENAME))
{
int const i = wm_ynbox("Import Configuration Settings",
"The configuration file \"%s\" was not found. "
"Import configuration data from \"%s\"?",
g_setupFileName, SETUPFILENAME);
if (i)
ud.config.scripthandle = SCRIPT_Load(SETUPFILENAME);
}
#endif
}
pathsearchmode = 0; pathsearchmode = 0;
if (ud.config.scripthandle < 0) if (ScreenBPP < 8) ScreenBPP = 32;
return -1;
Bmemset(tempbuf, 0, sizeof(tempbuf));
SCRIPT_GetString(ud.config.scripthandle, "Comm Setup","PlayerName",&tempbuf[0]);
char nameBuf[64];
while (Bstrlen(OSD_StripColors(nameBuf, tempbuf)) > 10)
tempbuf[Bstrlen(tempbuf) - 1] = '\0';
Bstrncpyz(szPlayerName, tempbuf, sizeof(szPlayerName));
SCRIPT_GetString(ud.config.scripthandle, "Comm Setup","RTSName",&ud.rtsname[0]);
if (g_noSetup == 0 && g_modDir[0] == '/')
{
SCRIPT_GetString(ud.config.scripthandle, "Setup","ModDir",&g_modDir[0]);
if (!buildvfs_isdir(g_modDir))
{
initprintf("Invalid mod dir in cfg!\n");
Bsprintf(g_modDir,"/");
}
}
if (g_grpNamePtr == NULL && g_addonNum == 0)
{
SCRIPT_GetStringPtr(ud.config.scripthandle, "Setup", "SelectedGRP", &g_grpNamePtr);
if (g_grpNamePtr && !Bstrlen(g_grpNamePtr))
g_grpNamePtr = dup_filename(G_DefaultGrpFile());
}
if (!NAM_WW2GI)
{
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "Out", &ud.lockout);
SCRIPT_GetString(ud.config.scripthandle, "Screen Setup", "Password", &ud.pwlockout[0]);
}
windowx = -1;
windowy = -1;
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "MaxRefreshFreq", (int32_t *)&maxrefreshfreq);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenHeight", &ud.setup.ydim);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenMode", &ud.setup.fullscreen);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenWidth", &ud.setup.xdim);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "WindowPosX", (int32_t *)&windowx);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "WindowPosY", (int32_t *)&windowy);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "WindowPositioning", (int32_t *)&windowpos);
if (ud.setup.bpp < 8) ud.setup.bpp = 32;
ud.config.setupread = 1; ud.config.setupread = 1;
return 0; return 0;
@ -210,62 +131,4 @@ void CONFIG_WriteSettings(void) // save binds and aliases to <cfgname>_settings.
} }
static const char *CONFIG_GetMapEntryName(char m[], char const * const mapname)
{
strcpy(m, mapname);
char *p = strrchr(m, '/');
if (!p) p = strrchr(m, '\\');
if (p) Bmemmove(m, p, Bstrlen(p)+1);
for (p=m; *p; p++) *p = tolower(*p);
// cheap hack because SCRIPT_GetNumber doesn't like the slashes
p = m;
while (*p == '/') p++;
return p;
}
static void CONFIG_GetMD4EntryName(char m[], uint8_t const * const md4)
{
sprintf(m, "MD4_%08x%08x%08x%08x",
B_BIG32(B_UNBUF32(&md4[0])), B_BIG32(B_UNBUF32(&md4[4])),
B_BIG32(B_UNBUF32(&md4[8])), B_BIG32(B_UNBUF32(&md4[12])));
}
int32_t CONFIG_GetMapBestTime(char const * const mapname, uint8_t const * const mapmd4)
{
if (!ud.config.setupread || ud.config.scripthandle < 0)
return -1;
char m[37];
CONFIG_GetMD4EntryName(m, mapmd4);
int32_t t = -1;
if (SCRIPT_GetNumber(ud.config.scripthandle, "MapTimes", m, &t))
{
// fall back to map filenames
char m2[BMAX_PATH];
auto p = CONFIG_GetMapEntryName(m2, mapname);
SCRIPT_GetNumber(ud.config.scripthandle, "MapTimes", p, &t);
}
return t;
}
int CONFIG_SetMapBestTime(uint8_t const * const mapmd4, int32_t tm)
{
if (ud.config.scripthandle < 0 && (ud.config.scripthandle = SCRIPT_Init(g_setupFileName)) < 0)
return -1;
char m[37];
CONFIG_GetMD4EntryName(m, mapmd4);
SCRIPT_PutNumber(ud.config.scripthandle, "MapTimes", m, tm, FALSE, FALSE);
return 0;
}
END_DUKE_NS END_DUKE_NS

View file

@ -31,8 +31,5 @@ BEGIN_DUKE_NS
int CONFIG_ReadSetup(void); int CONFIG_ReadSetup(void);
void CONFIG_SetDefaults(void); void CONFIG_SetDefaults(void);
int32_t CONFIG_GetMapBestTime(char const *mapname, uint8_t const *mapmd4);
int CONFIG_SetMapBestTime(uint8_t const *mapmd4, int32_t tm);
END_DUKE_NS END_DUKE_NS
#endif #endif

View file

@ -200,15 +200,15 @@ void G_HandleSpecialKeys(void)
if (g_networkMode != NET_DEDICATED_SERVER && ALT_IS_PRESSED && KB_KeyPressed(sc_Enter)) if (g_networkMode != NET_DEDICATED_SERVER && ALT_IS_PRESSED && KB_KeyPressed(sc_Enter))
{ {
if (videoSetGameMode(!ud.setup.fullscreen, ud.setup.xdim, ud.setup.ydim, ud.setup.bpp, ud.detail)) if (videoSetGameMode(!ScreenMode, ScreenWidth, ScreenHeight, ScreenBPP, ud.detail))
{ {
OSD_Printf(OSD_ERROR "Failed setting video mode!\n"); OSD_Printf(OSD_ERROR "Failed setting video mode!\n");
if (videoSetGameMode(ud.setup.fullscreen, ud.setup.xdim, ud.setup.ydim, ud.setup.bpp, ud.detail)) if (videoSetGameMode(ScreenMode, ScreenWidth, ScreenHeight, ScreenBPP, ud.detail))
G_GameExit("Fatal error: unable to recover from failure setting video mode!\n"); G_GameExit("Fatal error: unable to recover from failure setting video mode!\n");
} }
else else
ud.setup.fullscreen = !ud.setup.fullscreen; ScreenMode = !ScreenMode;
KB_ClearKeyDown(sc_Enter); KB_ClearKeyDown(sc_Enter);
g_restorePalette = 1; g_restorePalette = 1;
@ -296,7 +296,7 @@ void G_GameExit(const char *msg)
g_mostConcurrentPlayers > 1 && g_player[myconnectindex].ps->gm & MODE_GAME && GTFLAGS(GAMETYPE_SCORESHEET) && *msg == ' ') g_mostConcurrentPlayers > 1 && g_player[myconnectindex].ps->gm & MODE_GAME && GTFLAGS(GAMETYPE_SCORESHEET) && *msg == ' ')
{ {
G_BonusScreen(1); G_BonusScreen(1);
videoSetGameMode(ud.setup.fullscreen, ud.setup.xdim, ud.setup.ydim, ud.setup.bpp, ud.detail); videoSetGameMode(ScreenMode, ScreenWidth, ScreenHeight, ScreenBPP, ud.detail);
} }
// shareware and TEN screens // shareware and TEN screens
@ -3667,7 +3667,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t ourz, int32_t oura
case BLOODSPLAT2__STATIC: case BLOODSPLAT2__STATIC:
case BLOODSPLAT3__STATIC: case BLOODSPLAT3__STATIC:
case BLOODSPLAT4__STATIC: case BLOODSPLAT4__STATIC:
if (ud.lockout) t->xrepeat = t->yrepeat = 0; if (adult_lockout) t->xrepeat = t->yrepeat = 0;
else if (t->pal == 6) else if (t->pal == 6)
{ {
t->shade = -127; t->shade = -127;
@ -3729,7 +3729,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t ourz, int32_t oura
auto const pSprite = (i < 0) ? (uspriteptr_t)&tsprite[j] : (uspriteptr_t)&sprite[i]; auto const pSprite = (i < 0) ? (uspriteptr_t)&tsprite[j] : (uspriteptr_t)&sprite[i];
#ifndef EDUKE32_STANDALONE #ifndef EDUKE32_STANDALONE
if (ud.lockout && G_CheckAdultTile(DYNAMICTILEMAP(pSprite->picnum))) if (adult_lockout && G_CheckAdultTile(DYNAMICTILEMAP(pSprite->picnum)))
{ {
t->xrepeat = t->yrepeat = 0; t->xrepeat = t->yrepeat = 0;
continue; continue;
@ -3802,7 +3802,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t ourz, int32_t oura
//case MAIL+1__STATIC: //case MAIL+1__STATIC:
case PAPER__STATIC: case PAPER__STATIC:
//case PAPER+1__STATIC: //case PAPER+1__STATIC:
if (ud.lockout && pSprite->pal == 2) if (adult_lockout && pSprite->pal == 2)
{ {
t->xrepeat = t->yrepeat = 0; t->xrepeat = t->yrepeat = 0;
continue; continue;
@ -4090,7 +4090,7 @@ PALONLY:
case DUKELEG__STATIC: case DUKELEG__STATIC:
case DUKEGUN__STATIC: case DUKEGUN__STATIC:
case DUKETORSO__STATIC: case DUKETORSO__STATIC:
if (ud.lockout) if (adult_lockout)
{ {
t->xrepeat = t->yrepeat = 0; t->xrepeat = t->yrepeat = 0;
continue; continue;
@ -4454,7 +4454,7 @@ static int32_t g_RTSPlaying;
// Returns: started playing? // Returns: started playing?
extern int G_StartRTS(int lumpNum, int localPlayer) extern int G_StartRTS(int lumpNum, int localPlayer)
{ {
if (!ud.lockout && snd_enabled && if (!adult_lockout && snd_enabled &&
RTS_IsInitialized() && g_RTSPlaying == 0 && (snd_speech & (localPlayer ? 1 : 4))) RTS_IsInitialized() && g_RTSPlaying == 0 && (snd_speech & (localPlayer ? 1 : 4)))
{ {
char *const pData = (char *)RTS_GetSound(lumpNum - 1); char *const pData = (char *)RTS_GetSound(lumpNum - 1);
@ -6487,9 +6487,6 @@ int app_main(int argc, const char * const*argv)
g_mostConcurrentPlayers = ud.multimode; // XXX: redundant? g_mostConcurrentPlayers = ud.multimode; // XXX: redundant?
char const * rtsname = g_rtsNamePtr ? g_rtsNamePtr : ud.rtsname;
RTS_Init(rtsname);
ud.last_level = -1; ud.last_level = -1;
initprintf("Initializing OSD...\n"); initprintf("Initializing OSD...\n");
@ -6532,16 +6529,16 @@ int app_main(int argc, const char * const*argv)
if (g_networkMode != NET_DEDICATED_SERVER && validmodecnt > 0) if (g_networkMode != NET_DEDICATED_SERVER && validmodecnt > 0)
{ {
if (videoSetGameMode(ud.setup.fullscreen, ud.setup.xdim, ud.setup.ydim, ud.setup.bpp, ud.detail) < 0) if (videoSetGameMode(ScreenMode, ScreenWidth, ScreenHeight, ScreenBPP, ud.detail) < 0)
{ {
initprintf("Failure setting video mode %dx%dx%d %s! Trying next mode...\n", ud.setup.xdim, ud.setup.ydim, initprintf("Failure setting video mode %dx%dx%d %s! Trying next mode...\n", *ScreenWidth, *ScreenHeight,
ud.setup.bpp, ud.setup.fullscreen ? "fullscreen" : "windowed"); *ScreenBPP, *ScreenMode ? "fullscreen" : "windowed");
int resIdx = 0; int resIdx = 0;
for (int i=0; i < validmodecnt; i++) for (int i=0; i < validmodecnt; i++)
{ {
if (validmode[i].xdim == ud.setup.xdim && validmode[i].ydim == ud.setup.ydim) if (validmode[i].xdim == ScreenWidth && validmode[i].ydim == ScreenHeight)
{ {
resIdx = i; resIdx = i;
break; break;
@ -6549,7 +6546,7 @@ int app_main(int argc, const char * const*argv)
} }
int const savedIdx = resIdx; int const savedIdx = resIdx;
int bpp = ud.setup.bpp; int bpp = ScreenBPP;
while (videoSetGameMode(0, validmode[resIdx].xdim, validmode[resIdx].ydim, bpp, ud.detail) < 0) while (videoSetGameMode(0, validmode[resIdx].xdim, validmode[resIdx].ydim, bpp, ud.detail) < 0)
{ {
@ -6566,12 +6563,12 @@ int app_main(int argc, const char * const*argv)
} }
} }
ud.setup.xdim = validmode[resIdx].xdim; ScreenWidth = validmode[resIdx].xdim;
ud.setup.ydim = validmode[resIdx].ydim; ScreenHeight = validmode[resIdx].ydim;
ud.setup.bpp = bpp; ScreenBPP = bpp;
} }
videoSetPalette(ud.brightness>>2, myplayer.palette, 0); videoSetPalette(0, myplayer.palette, 0);
S_SoundStartup(); S_SoundStartup();
S_MusicStartup(); S_MusicStartup();
} }

View file

@ -155,14 +155,6 @@ extern camera_t g_camera;
#define MAX_RETURN_VALUES 6 #define MAX_RETURN_VALUES 6
// KEEPINSYNC lunatic/_defs_game.lua
typedef struct {
int32_t fullscreen;
int32_t xdim;
int32_t ydim;
int32_t bpp;
} ud_setup_t;
typedef struct { typedef struct {
#if !defined LUNATIC #if !defined LUNATIC
vec3_t camerapos; vec3_t camerapos;
@ -180,7 +172,7 @@ typedef struct {
int32_t menu_scrollbartilenum, menu_scrollbarz, menu_scrollcursorz; int32_t menu_scrollbartilenum, menu_scrollbarz, menu_scrollcursorz;
int32_t entered_name,screen_tilting,fta_on; int32_t entered_name,screen_tilting,fta_on;
int32_t m_coop,coop,screen_size,lockout; int32_t m_coop,coop,screen_size;
int32_t playerai,angleinterpolation; int32_t playerai,angleinterpolation;
int32_t respawn_monsters,respawn_items,respawn_inventory,recstat,monsters_off,brightness; int32_t respawn_monsters,respawn_items,respawn_inventory,recstat,monsters_off,brightness;
@ -227,17 +219,13 @@ typedef struct {
int32_t JoystickAnalogueDead[MAXJOYAXES]; int32_t JoystickAnalogueDead[MAXJOYAXES];
int32_t JoystickAnalogueSaturate[MAXJOYAXES]; int32_t JoystickAnalogueSaturate[MAXJOYAXES];
int32_t scripthandle;
int32_t setupread; int32_t setupread;
} config; } config;
ud_setup_t setup;
char overhead_on,last_overhead,showweapons; char overhead_on,last_overhead,showweapons;
char god,warp_on,cashman,eog,showallmap; char god,warp_on,cashman,eog,showallmap;
char show_help,scrollmode,noclip; char show_help,scrollmode,noclip;
char pwlockout[MAXPWLOCKOUT],rtsname[MAXRTSNAME];
char display_bonus_screen; char display_bonus_screen;
char show_level_text; char show_level_text;

View file

@ -4255,11 +4255,6 @@ badindex:
{ {
int32_t nValue = 0; int32_t nValue = 0;
insptr++; insptr++;
if (ud.config.scripthandle < 0)
{
insptr++;
dispatch();
}
FString section = currentGame + ".Gamevars"; FString section = currentGame + ".Gamevars";
GameConfig->SetSection(section); GameConfig->SetSection(section);
switch (VM_DECODE_INST(tw)) switch (VM_DECODE_INST(tw))
@ -6802,7 +6797,7 @@ void G_RestoreMapState(void)
screenpeek = myconnectindex; screenpeek = myconnectindex;
#ifndef EDUKE32_STANDALONE #ifndef EDUKE32_STANDALONE
if (ud.lockout) if (adult_lockout)
{ {
for (native_t x=g_animWallCnt-1; x>=0; x--) for (native_t x=g_animWallCnt-1; x>=0; x--)
switch (DYNAMICTILEMAP(wall[animwall[x].wallnum].picnum)) switch (DYNAMICTILEMAP(wall[animwall[x].wallnum].picnum))

View file

@ -1417,7 +1417,7 @@ int32_t __fastcall VM_GetUserdef(int32_t labelNum, int const lParm2)
case USERDEFS_M_COOP: labelNum = ud.m_coop; break; case USERDEFS_M_COOP: labelNum = ud.m_coop; break;
case USERDEFS_COOP: labelNum = ud.coop; break; case USERDEFS_COOP: labelNum = ud.coop; break;
case USERDEFS_SCREEN_SIZE: labelNum = ud.screen_size; break; case USERDEFS_SCREEN_SIZE: labelNum = ud.screen_size; break;
case USERDEFS_LOCKOUT: labelNum = ud.lockout; break; case USERDEFS_LOCKOUT: labelNum = adult_lockout; break;
case USERDEFS_CROSSHAIR: labelNum = cl_crosshair; break; case USERDEFS_CROSSHAIR: labelNum = cl_crosshair; break;
case USERDEFS_PLAYERAI: labelNum = ud.playerai; break; case USERDEFS_PLAYERAI: labelNum = ud.playerai; break;
case USERDEFS_RESPAWN_MONSTERS: labelNum = ud.respawn_monsters; break; case USERDEFS_RESPAWN_MONSTERS: labelNum = ud.respawn_monsters; break;
@ -1425,7 +1425,7 @@ int32_t __fastcall VM_GetUserdef(int32_t labelNum, int const lParm2)
case USERDEFS_RESPAWN_INVENTORY: labelNum = ud.respawn_inventory; break; case USERDEFS_RESPAWN_INVENTORY: labelNum = ud.respawn_inventory; break;
case USERDEFS_RECSTAT: labelNum = ud.recstat; break; case USERDEFS_RECSTAT: labelNum = ud.recstat; break;
case USERDEFS_MONSTERS_OFF: labelNum = ud.monsters_off; break; case USERDEFS_MONSTERS_OFF: labelNum = ud.monsters_off; break;
case USERDEFS_BRIGHTNESS: labelNum = ud.brightness; break; case USERDEFS_BRIGHTNESS: labelNum = 8;/*ud.brightness;*/ break;
case USERDEFS_M_RESPAWN_ITEMS: labelNum = ud.m_respawn_items; break; case USERDEFS_M_RESPAWN_ITEMS: labelNum = ud.m_respawn_items; break;
case USERDEFS_M_RESPAWN_MONSTERS: labelNum = ud.m_respawn_monsters; break; case USERDEFS_M_RESPAWN_MONSTERS: labelNum = ud.m_respawn_monsters; break;
case USERDEFS_M_RESPAWN_INVENTORY: labelNum = ud.m_respawn_inventory; break; case USERDEFS_M_RESPAWN_INVENTORY: labelNum = ud.m_respawn_inventory; break;
@ -1611,7 +1611,7 @@ void __fastcall VM_SetUserdef(int const labelNum, int const lParm2, int32_t cons
G_UpdateScreenArea(); G_UpdateScreenArea();
} }
break; break;
case USERDEFS_LOCKOUT: ud.lockout = iSet; break; case USERDEFS_LOCKOUT: adult_lockout = iSet; break;
case USERDEFS_CROSSHAIR: cl_crosshair.SetGenericRepDefault(iSet, CVAR_Int); break; case USERDEFS_CROSSHAIR: cl_crosshair.SetGenericRepDefault(iSet, CVAR_Int); break;
case USERDEFS_PLAYERAI: ud.playerai = iSet; break; case USERDEFS_PLAYERAI: ud.playerai = iSet; break;
case USERDEFS_RESPAWN_MONSTERS: ud.respawn_monsters = iSet; break; case USERDEFS_RESPAWN_MONSTERS: ud.respawn_monsters = iSet; break;
@ -1619,7 +1619,7 @@ void __fastcall VM_SetUserdef(int const labelNum, int const lParm2, int32_t cons
case USERDEFS_RESPAWN_INVENTORY: ud.respawn_inventory = iSet; break; case USERDEFS_RESPAWN_INVENTORY: ud.respawn_inventory = iSet; break;
case USERDEFS_RECSTAT: ud.recstat = iSet; break; case USERDEFS_RECSTAT: ud.recstat = iSet; break;
case USERDEFS_MONSTERS_OFF: ud.monsters_off = iSet; break; case USERDEFS_MONSTERS_OFF: ud.monsters_off = iSet; break;
case USERDEFS_BRIGHTNESS: ud.brightness = iSet; break; case USERDEFS_BRIGHTNESS: /*ud.brightness = iSet;*/ break; //Oh, no, I won't give modding access to this at all!
case USERDEFS_M_RESPAWN_ITEMS: ud.m_respawn_items = iSet; break; case USERDEFS_M_RESPAWN_ITEMS: ud.m_respawn_items = iSet; break;
case USERDEFS_M_RESPAWN_MONSTERS: ud.m_respawn_monsters = iSet; break; case USERDEFS_M_RESPAWN_MONSTERS: ud.m_respawn_monsters = iSet; break;
case USERDEFS_M_RESPAWN_INVENTORY: ud.m_respawn_inventory = iSet; break; case USERDEFS_M_RESPAWN_INVENTORY: ud.m_respawn_inventory = iSet; break;

View file

@ -408,10 +408,8 @@ static MenuOptionSet_t MEOS_DemoRec = MAKE_MENUOPTIONSET( MEOSN_DemoRec, NULL, 0
static MenuOption_t MEO_GAMESETUP_DEMOREC = MAKE_MENUOPTION( &MF_Redfont, &MEOS_OffOn, &ud.m_recstat ); static MenuOption_t MEO_GAMESETUP_DEMOREC = MAKE_MENUOPTION( &MF_Redfont, &MEOS_OffOn, &ud.m_recstat );
static MenuEntry_t ME_GAMESETUP_DEMOREC = MAKE_MENUENTRY( "Record demo:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_GAMESETUP_DEMOREC, Option ); static MenuEntry_t ME_GAMESETUP_DEMOREC = MAKE_MENUENTRY( "Record demo:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_GAMESETUP_DEMOREC, Option );
static MenuOption_t MEO_ADULTMODE = MAKE_MENUOPTION(&MF_Redfont, &MEOS_OffOn, &ud.lockout); static MenuOption_t MEO_ADULTMODE = MAKE_MENUOPTION(&MF_Redfont, &MEOS_OffOn, &adult_lockout.Value);
static MenuEntry_t ME_ADULTMODE = MAKE_MENUENTRY( "Parental lock:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_ADULTMODE, Option ); static MenuEntry_t ME_ADULTMODE = MAKE_MENUENTRY( "Parental lock:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_ADULTMODE, Option );
// static MenuLink_t MEO_ADULTMODE_PASSWORD = { MENU_ADULTPASSWORD, MA_None, };
// static MenuEntry_t ME_ADULTMODE_PASSWORD = MAKE_MENUENTRY( "Enter Password", &MF_Redfont, &, &MEO_ADULTMODE_PASSWORD, Link );
#if defined(EDUKE32_ANDROID_MENU) || !defined(EDUKE32_SIMPLE_MENU) #if defined(EDUKE32_ANDROID_MENU) || !defined(EDUKE32_SIMPLE_MENU)
static MenuLink_t MEO_GAMESETUP_CHEATS = { MENU_CHEATS, MA_Advance, }; static MenuLink_t MEO_GAMESETUP_CHEATS = { MENU_CHEATS, MA_Advance, };
@ -3197,10 +3195,10 @@ static void Menu_EntryLinkActivate(MenuEntry_t *entry)
g_restorePalette = -1; g_restorePalette = -1;
G_UpdateScreenArea(); G_UpdateScreenArea();
ud.setup.fullscreen = fullscreen; ScreenMode = fullscreen;
ud.setup.xdim = xres; ScreenWidth = xres;
ud.setup.ydim = yres; ScreenHeight = yres;
ud.setup.bpp = bpp; ScreenBPP = bpp;
} }
else if (entry == &ME_SOUND_RESTART) else if (entry == &ME_SOUND_RESTART)
{ {
@ -3327,30 +3325,10 @@ static int32_t Menu_EntryOptionModify(MenuEntry_t *entry, int32_t newOption)
wall[animwall[x].wallnum].picnum = SCREENBREAK6; wall[animwall[x].wallnum].picnum = SCREENBREAK6;
break; break;
} }
ud.pwlockout[0] = 0;
Menu_Change(MENU_ADULTPASSWORD);
// return -1;
} }
else else
{ {
if (ud.pwlockout[0] == 0) adult_lockout = 0;
{
ud.lockout = 0;
#if 0
for (x=0; x<g_numAnimWalls; x++)
if (wall[animwall[x].wallnum].picnum != W_SCREENBREAK &&
wall[animwall[x].wallnum].picnum != W_SCREENBREAK+1 &&
wall[animwall[x].wallnum].picnum != W_SCREENBREAK+2)
if (wall[animwall[x].wallnum].extra >= 0)
wall[animwall[x].wallnum].picnum = wall[animwall[x].wallnum].extra;
#endif
}
else
{
Menu_Change(MENU_ADULTPASSWORD);
return -1;
}
} }
} }
@ -3412,7 +3390,7 @@ static void Menu_EntryOptionDidModify(MenuEntry_t *entry)
videoResetMode(); videoResetMode();
if (videoSetGameMode(fullscreen, xres, yres, bpp, upscalefactor)) if (videoSetGameMode(fullscreen, xres, yres, bpp, upscalefactor))
OSD_Printf("restartvid: Reset failed...\n"); OSD_Printf("restartvid: Reset failed...\n");
onvideomodechange(ud.setup.bpp>8); onvideomodechange(ScreenBPP>8);
G_RefreshLights(); G_RefreshLights();
} }
#endif #endif
@ -3464,16 +3442,6 @@ static int32_t Menu_EntryRangeFloatModify(MenuEntry_t *entry, float newValue)
static int32_t Menu_EntryRangeFloatDidModify(MenuEntry_t *entry) static int32_t Menu_EntryRangeFloatDidModify(MenuEntry_t *entry)
{ {
if (entry == &ME_COLCORR_GAMMA)
{
ud.brightness = GAMMA_CALC<<2;
videoSetPalette(ud.brightness>>2, g_player[myconnectindex].ps->palette, 0);
}
else if (entry == &ME_COLCORR_CONTRAST || entry == &ME_COLCORR_BRIGHTNESS)
{
videoSetPalette(ud.brightness>>2, g_player[myconnectindex].ps->palette, 0);
}
return 0; return 0;
} }
@ -3685,9 +3653,8 @@ static void Menu_Verify(int32_t input)
g_videoGamma = DEFAULT_GAMMA; g_videoGamma = DEFAULT_GAMMA;
g_videoContrast = DEFAULT_CONTRAST; g_videoContrast = DEFAULT_CONTRAST;
g_videoBrightness = DEFAULT_BRIGHTNESS; g_videoBrightness = DEFAULT_BRIGHTNESS;
ud.brightness = 0;
r_ambientlight = 1.f; r_ambientlight = 1.f;
videoSetPalette(ud.brightness>>2,g_player[myconnectindex].ps->palette,0); videoSetPalette(0,g_player[myconnectindex].ps->palette,0);
} }
break; break;
@ -3762,21 +3729,6 @@ static void Menu_TextFormSubmit(char *input)
switch (g_currentMenu) switch (g_currentMenu)
{ {
case MENU_ADULTPASSWORD: case MENU_ADULTPASSWORD:
if (Bstrlen(input) && (ud.pwlockout[0] == 0 || ud.lockout == 0))
Bstrcpy(&ud.pwlockout[0], input);
else if (Bstrcmp(input, &ud.pwlockout[0]) == 0)
{
for (int x=0; x<g_animWallCnt; x++)
if ((unsigned) animwall[x].wallnum < (unsigned)numwalls && wall[animwall[x].wallnum].picnum != W_SCREENBREAK &&
wall[animwall[x].wallnum].picnum != W_SCREENBREAK+1 &&
wall[animwall[x].wallnum].picnum != W_SCREENBREAK+2)
if (wall[animwall[x].wallnum].extra >= 0)
wall[animwall[x].wallnum].picnum = wall[animwall[x].wallnum].extra;
ud.lockout = 0;
}
S_PlaySound(PISTOL_BODYHIT);
Menu_Change(MENU_GAMESETUP);
break; break;
case MENU_CHEATENTRY: case MENU_CHEATENTRY:

View file

@ -420,9 +420,9 @@ int osdcmd_restartvid(osdcmdptr_t UNUSED(parm))
{ {
UNREFERENCED_CONST_PARAMETER(parm); UNREFERENCED_CONST_PARAMETER(parm);
videoResetMode(); videoResetMode();
if (videoSetGameMode(ud.setup.fullscreen,ud.setup.xdim,ud.setup.ydim,ud.setup.bpp,ud.detail)) if (videoSetGameMode(ScreenMode,ScreenWidth,ScreenHeight,ScreenBPP,ud.detail))
G_GameExit("restartvid: Reset failed...\n"); G_GameExit("restartvid: Reset failed...\n");
onvideomodechange(ud.setup.bpp>8); onvideomodechange(ScreenBPP>8);
G_UpdateScreenArea(); G_UpdateScreenArea();
return OSDCMD_OK; return OSDCMD_OK;
@ -440,8 +440,8 @@ int osdcmd_restartmap(osdcmdptr_t UNUSED(parm))
static int osdcmd_vidmode(osdcmdptr_t parm) static int osdcmd_vidmode(osdcmdptr_t parm)
{ {
int32_t newbpp = ud.setup.bpp, newwidth = ud.setup.xdim, int32_t newbpp = ScreenBPP, newwidth = ScreenWidth,
newheight = ud.setup.ydim, newfs = ud.setup.fullscreen; newheight = ScreenHeight, newfs = ScreenMode;
int32_t tmp; int32_t tmp;
if (parm->numparms < 1 || parm->numparms > 4) return OSDCMD_SHOWHELP; if (parm->numparms < 1 || parm->numparms > 4) return OSDCMD_SHOWHELP;
@ -474,14 +474,14 @@ static int osdcmd_vidmode(osdcmdptr_t parm)
if (videoSetGameMode(newfs,newwidth,newheight,newbpp,upscalefactor)) if (videoSetGameMode(newfs,newwidth,newheight,newbpp,upscalefactor))
{ {
initprintf("vidmode: Mode change failed!\n"); initprintf("vidmode: Mode change failed!\n");
if (videoSetGameMode(ud.setup.fullscreen, ud.setup.xdim, ud.setup.ydim, ud.setup.bpp, upscalefactor)) if (videoSetGameMode(ScreenMode, ScreenWidth, ScreenHeight, ScreenBPP, upscalefactor))
G_GameExit("vidmode: Reset failed!\n"); G_GameExit("vidmode: Reset failed!\n");
} }
ud.setup.bpp = newbpp; ScreenBPP = newbpp;
ud.setup.xdim = newwidth; ScreenWidth = newwidth;
ud.setup.ydim = newheight; ScreenHeight = newheight;
ud.setup.fullscreen = newfs; ScreenMode = newfs;
onvideomodechange(ud.setup.bpp>8); onvideomodechange(ScreenBPP>8);
G_UpdateScreenArea(); G_UpdateScreenArea();
return OSDCMD_OK; return OSDCMD_OK;
} }
@ -852,7 +852,7 @@ void onvideomodechange(int32_t newmode)
} }
#endif #endif
videoSetPalette(ud.brightness>>2, palid, 0); videoSetPalette(0, palid, 0);
g_restorePalette = -1; g_restorePalette = -1;
g_crosshairSum = -1; g_crosshairSum = -1;
} }

View file

@ -1065,7 +1065,7 @@ static void G_SetupSpecialWalls(void)
case FEMPIC3__STATIC: case FEMPIC3__STATIC:
w.extra = w.picnum; w.extra = w.picnum;
if (ud.lockout) if (adult_lockout)
w.picnum = (w.picnum == FEMPIC1) ? BLANKSCREEN : SCREENBREAK6; w.picnum = (w.picnum == FEMPIC1) ? BLANKSCREEN : SCREENBREAK6;
aw.tag = w.picnum; aw.tag = w.picnum;
@ -1349,7 +1349,7 @@ void G_NewGame(int volumeNum, int levelNum, int skillNum)
// we don't want the intro to play after the multiplayer setup screen // we don't want the intro to play after the multiplayer setup screen
if ((!g_netServer && ud.multimode < 2) && !Menu_HaveUserMap() if ((!g_netServer && ud.multimode < 2) && !Menu_HaveUserMap()
&& !VM_OnEventWithReturn(EVENT_NEWGAMESCREEN, g_player[myconnectindex].ps->i, myconnectindex, 0) && !VM_OnEventWithReturn(EVENT_NEWGAMESCREEN, g_player[myconnectindex].ps->i, myconnectindex, 0)
&& !levelNum && volumeNum == 3 && !ud.lockout && !(G_GetLogoFlags() & LOGO_NOE4CUTSCENE)) && !levelNum && volumeNum == 3 && !adult_lockout && !(G_GetLogoFlags() & LOGO_NOE4CUTSCENE))
G_PlayE4Cutscene(); G_PlayE4Cutscene();
#ifdef EDUKE32_TOUCH_DEVICES #ifdef EDUKE32_TOUCH_DEVICES
@ -1794,7 +1794,7 @@ int G_EnterLevel(int gameMode)
FX_StopAllSounds(); FX_StopAllSounds();
S_ClearSoundLocks(); S_ClearSoundLocks();
FX_SetReverb(0); FX_SetReverb(0);
videoSetGameMode(ud.setup.fullscreen, ud.setup.xdim, ud.setup.ydim, ud.setup.bpp, upscalefactor); videoSetGameMode(ScreenMode, ScreenWidth, ScreenHeight, ScreenBPP, upscalefactor);
} }
if (Menu_HaveUserMap()) if (Menu_HaveUserMap())

View file

@ -2480,7 +2480,7 @@ static void postloadplayer(int32_t savegamep)
if (savegamep) if (savegamep)
{ {
#ifndef EDUKE32_STANDALONE #ifndef EDUKE32_STANDALONE
if (ud.lockout) if (adult_lockout)
{ {
for (i=0; i<g_animWallCnt; i++) for (i=0; i<g_animWallCnt; i++)
switch (DYNAMICTILEMAP(wall[animwall[i].wallnum].picnum)) switch (DYNAMICTILEMAP(wall[animwall[i].wallnum].picnum))

View file

@ -90,7 +90,7 @@ void P_SetGamePalette(DukePlayer_t *player, uint32_t palid, int32_t set)
if (player != g_player[screenpeek].ps) if (player != g_player[screenpeek].ps)
return; return;
videoSetPalette(ud.brightness>>2, palid, set); videoSetPalette(0, palid, set);
} }
void G_GetCrosshairColor(void) void G_GetCrosshairColor(void)
@ -1719,7 +1719,7 @@ static void G_BonusCutscenes(void)
if ((G_GetLogoFlags() & LOGO_NOE1BONUSSCENE) && (G_GetLogoFlags() & LOGO_NOE1ENDSCREEN)) if ((G_GetLogoFlags() & LOGO_NOE1BONUSSCENE) && (G_GetLogoFlags() & LOGO_NOE1ENDSCREEN))
return; return;
if (ud.lockout == 0 && !(G_GetLogoFlags() & LOGO_NOE1BONUSSCENE)) if (adult_lockout == 0 && !(G_GetLogoFlags() & LOGO_NOE1BONUSSCENE))
{ {
int bonuscnt=0; int bonuscnt=0;
int const bossmove [] = int const bossmove [] =
@ -1832,7 +1832,7 @@ static void G_BonusCutscenes(void)
videoClearScreen(0L); videoClearScreen(0L);
videoNextPage(); videoNextPage();
if (ud.lockout == 0 && !(G_GetLogoFlags() & LOGO_NOE2BONUSSCENE)) if (adult_lockout == 0 && !(G_GetLogoFlags() & LOGO_NOE2BONUSSCENE))
{ {
fadepal(0, 0, 0, 252, 0, -4); fadepal(0, 0, 0, 252, 0, -4);
Anim_Play("cineov2.anm"); Anim_Play("cineov2.anm");
@ -1866,7 +1866,7 @@ static void G_BonusCutscenes(void)
videoClearScreen(0L); videoClearScreen(0L);
videoNextPage(); videoNextPage();
if (ud.lockout == 0 && !(G_GetLogoFlags() & LOGO_NOE4BONUSSCENE)) if (adult_lockout == 0 && !(G_GetLogoFlags() & LOGO_NOE4BONUSSCENE))
{ {
fadepal(0, 0, 0, 252, 0, -4); fadepal(0, 0, 0, 252, 0, -4);
@ -1947,7 +1947,7 @@ static void G_BonusCutscenes(void)
S_StopMusic(); S_StopMusic();
videoClearScreen(0L); videoClearScreen(0L);
videoNextPage(); videoNextPage();
if (ud.lockout == 0 && !(G_GetLogoFlags() & LOGO_NOE3BONUSSCENE)) if (adult_lockout == 0 && !(G_GetLogoFlags() & LOGO_NOE3BONUSSCENE))
{ {
fadepal(0, 0, 0, 252, 0, -4); fadepal(0, 0, 0, 252, 0, -4);
Anim_Play("cineov3.anm"); Anim_Play("cineov3.anm");
@ -1967,7 +1967,7 @@ static void G_BonusCutscenes(void)
Anim_Play("RADLOGO.ANM"); Anim_Play("RADLOGO.ANM");
if (ud.lockout == 0 && !I_GeneralTrigger()) if (adult_lockout == 0 && !I_GeneralTrigger())
{ {
if (G_PlaySoundWhileNoInput(ENDSEQVOL3SND5)) goto ENDANM; if (G_PlaySoundWhileNoInput(ENDSEQVOL3SND5)) goto ENDANM;
if (G_PlaySoundWhileNoInput(ENDSEQVOL3SND6)) goto ENDANM; if (G_PlaySoundWhileNoInput(ENDSEQVOL3SND6)) goto ENDANM;

View file

@ -3281,7 +3281,7 @@ void P_CheckSectors(int playerNum)
case STALL__STATIC: case STALL__STATIC:
if (pPlayer->last_pissed_time == 0) if (pPlayer->last_pissed_time == 0)
{ {
if (ud.lockout == 0) if (adult_lockout == 0)
A_PlaySound(DUKE_URINATE, pPlayer->i); A_PlaySound(DUKE_URINATE, pPlayer->i);
pPlayer->last_pissed_time = GAMETICSPERSEC * 220; pPlayer->last_pissed_time = GAMETICSPERSEC * 220;

View file

@ -678,7 +678,7 @@ int S_PlaySound3D(int num, int spriteNum, const vec3_t *pos)
auto const pPlayer = g_player[myconnectindex].ps; auto const pPlayer = g_player[myconnectindex].ps;
if (((snd.m & SF_ADULT) && ud.lockout) || (unsigned)spriteNum >= MAXSPRITES || (pPlayer->gm & MODE_MENU) || !FX_VoiceAvailable(snd.pr) if (((snd.m & SF_ADULT) && adult_lockout) || (unsigned)spriteNum >= MAXSPRITES || (pPlayer->gm & MODE_MENU) || !FX_VoiceAvailable(snd.pr)
|| (pPlayer->timebeforeexit > 0 && pPlayer->timebeforeexit <= GAMETICSPERSEC * 3)) || (pPlayer->timebeforeexit > 0 && pPlayer->timebeforeexit <= GAMETICSPERSEC * 3))
return -1; return -1;
@ -817,7 +817,7 @@ int S_PlaySound(int num)
return -1; return -1;
} }
if ((!(snd_speech & 1) && (snd.m & SF_TALK)) || ((snd.m & SF_ADULT) && ud.lockout) || !FX_VoiceAvailable(snd.pr)) if ((!(snd_speech & 1) && (snd.m & SF_TALK)) || ((snd.m & SF_ADULT) && adult_lockout) || !FX_VoiceAvailable(snd.pr))
return -1; return -1;
int const pitch = S_GetPitch(num); int const pitch = S_GetPitch(num);

View file

@ -58,6 +58,13 @@ BEGIN_DUKE_NS
#define TAB_CONFIG 0 #define TAB_CONFIG 0
#define TAB_MESSAGES 1 #define TAB_MESSAGES 1
typedef struct {
int32_t fullscreen;
int32_t xdim;
int32_t ydim;
int32_t bpp;
} ud_setup_t;
static struct static struct
{ {
struct grpfile_t const * grp; struct grpfile_t const * grp;
@ -618,7 +625,7 @@ int32_t startwin_run(void)
settings.polymer = 0; settings.polymer = 0;
#endif #endif
settings.shared = ud.setup; settings.shared = { ScreenMode, ScreenWidth, ScreenHeight, ScreenBPP };
settings.grp = g_selectedGrp; settings.grp = g_selectedGrp;
settings.gamedir = g_modDir; settings.gamedir = g_modDir;
@ -650,7 +657,10 @@ int32_t startwin_run(void)
if (done) if (done)
{ {
ud.setup = settings.shared; ScreenWidth = settings.shared.xdim;
ScreenHeight = settings.shared.ydim;
ScreenMode = settings.shared.fullscreen;
ScreenBPP = settings.shared.bpp;
g_selectedGrp = settings.grp; g_selectedGrp = settings.grp;
Bstrcpy(g_modDir, (g_noSetup == 0 && settings.gamedir != NULL) ? settings.gamedir : "/"); Bstrcpy(g_modDir, (g_noSetup == 0 && settings.gamedir != NULL) ? settings.gamedir : "/");
} }

View file

@ -492,7 +492,6 @@ int32_t Anim_Play(const char *fn)
paletteSetColorTable(ANIMPAL, ANIM_GetPalette(), true); paletteSetColorTable(ANIMPAL, ANIM_GetPalette(), true);
// setpalette(0L,256L,tempbuf); // setpalette(0L,256L,tempbuf);
// setbrightness(ud.brightness>>2,tempbuf,2);
P_SetGamePalette(g_player[myconnectindex].ps, ANIMPAL, 8 + 2); P_SetGamePalette(g_player[myconnectindex].ps, ANIMPAL, 8 + 2);
timerUpdate(); timerUpdate();

View file

@ -366,9 +366,8 @@ void G_CheckCommandLine(int32_t argc, char const * const * argv)
{ {
if (argc > i+1) if (argc > i+1)
{ {
free(g_rtsNamePtr); RTS_Init(argv[i+1]);
g_rtsNamePtr = dup_filename(argv[i+1]); initprintf("Using RTS file \"%s\".\n", argv[i + 1]);
initprintf("Using RTS file \"%s\".\n", g_rtsNamePtr);
i++; i++;
} }
i++; i++;
@ -696,9 +695,9 @@ void G_CheckCommandLine(int32_t argc, char const * const * argv)
} }
if (!Bstrcasecmp(k, ".rts")) if (!Bstrcasecmp(k, ".rts"))
{ {
free(g_rtsNamePtr); RTS_Init(argv[i]);
g_rtsNamePtr = dup_filename(argv[i++]); initprintf("Using RTS file \"%s\".\n", argv[i]);
initprintf("Using RTS file \"%s\".\n", g_rtsNamePtr); i++;
continue; continue;
} }
} }

View file

@ -10,6 +10,7 @@
#include "cmdlib.h" #include "cmdlib.h"
#include "grpscan.h" #include "grpscan.h"
#include "gamecvars.h" #include "gamecvars.h"
#include "rts.h"
#ifdef _WIN32 #ifdef _WIN32
# define NEED_SHLWAPI_H # define NEED_SHLWAPI_H
@ -50,8 +51,6 @@ static const char *defaultgameconfilename[GAMECOUNT] = { "GAME.CON", "GAME.CON",
char *g_grpNamePtr = NULL; char *g_grpNamePtr = NULL;
// g_scriptNamePtr can ONLY point to a malloc'd block (length BMAX_PATH) // g_scriptNamePtr can ONLY point to a malloc'd block (length BMAX_PATH)
char *g_scriptNamePtr = NULL; char *g_scriptNamePtr = NULL;
// g_rtsNamePtr can ONLY point to a malloc'd block (length BMAX_PATH)
char *g_rtsNamePtr = NULL;
void clearGrpNamePtr(void) void clearGrpNamePtr(void)
{ {
@ -388,8 +387,8 @@ void G_LoadGroups()
if (type->defname && g_defNamePtr == NULL) if (type->defname && g_defNamePtr == NULL)
g_defNamePtr = dup_filename(type->defname); g_defNamePtr = dup_filename(type->defname);
if (type->rtsname && g_rtsNamePtr == NULL) if (type->rtsname)
g_rtsNamePtr = dup_filename(type->rtsname); RTS_Init(type->rtsname);
} }
else else
{ {
@ -1166,7 +1165,6 @@ void Duke_CommonCleanup(void)
{ {
DO_FREE_AND_NULL(g_grpNamePtr); DO_FREE_AND_NULL(g_grpNamePtr);
DO_FREE_AND_NULL(g_scriptNamePtr); DO_FREE_AND_NULL(g_scriptNamePtr);
DO_FREE_AND_NULL(g_rtsNamePtr);
} }
#endif #endif

View file

@ -98,7 +98,6 @@ extern const char *g_gameNamePtr;
extern char *g_grpNamePtr; extern char *g_grpNamePtr;
extern char *g_scriptNamePtr; extern char *g_scriptNamePtr;
extern char *g_rtsNamePtr;
extern const char *G_DefaultGrpFile(void); extern const char *G_DefaultGrpFile(void);
extern const char *G_GrpFile(void); extern const char *G_GrpFile(void);

View file

@ -47,10 +47,7 @@ BEGIN_RR_NS
void CONFIG_SetDefaults(void) void CONFIG_SetDefaults(void)
{ {
// JBF 20031211
int32_t i;
ud.config.scripthandle = -1;
# if defined RENDERTYPESDL && SDL_MAJOR_VERSION > 1 # if defined RENDERTYPESDL && SDL_MAJOR_VERSION > 1
uint32_t inited = SDL_WasInit(SDL_INIT_VIDEO); uint32_t inited = SDL_WasInit(SDL_INIT_VIDEO);
if (inited == 0) if (inited == 0)
@ -61,35 +58,32 @@ void CONFIG_SetDefaults(void)
SDL_DisplayMode dm; SDL_DisplayMode dm;
if (SDL_GetDesktopDisplayMode(0, &dm) == 0) if (SDL_GetDesktopDisplayMode(0, &dm) == 0)
{ {
ud.setup.xdim = dm.w; ScreenWidth = dm.w;
ud.setup.ydim = dm.h; ScreenHeight = dm.h;
} }
else else
# endif # endif
{ {
ud.setup.xdim = 1024; ScreenWidth = 1024;
ud.setup.ydim = 768; ScreenHeight = 768;
} }
ud.setup.bpp = 32; ScreenBPP = 32;
g_player[0].ps->aim_mode = 1; g_player[0].ps->aim_mode = 1;
ud.config.ShowOpponentWeapons = 0; ud.config.ShowOpponentWeapons = 0;
ud.althud = 1; ud.althud = 1;
ud.automsg = 0; ud.automsg = 0;
ud.brightness = 8;
ud.camerasprite = -1; ud.camerasprite = -1;
ud.camera_time = 0;//4; ud.camera_time = 0;//4;
ud.color = 0; ud.color = 0;
ud.detail = 0; ud.detail = 0;
ud.lockout = 0;
ud.m_ffire = 1; ud.m_ffire = 1;
ud.m_marker = 1; ud.m_marker = 1;
ud.menu_slidebarz = 65536; ud.menu_slidebarz = 65536;
ud.menu_slidebarmargin = RR ? 6 * 65536 : 65536; ud.menu_slidebarmargin = RR ? 6 * 65536 : 65536;
ud.menu_slidecursorz = RR ? 32768 : 65536; ud.menu_slidecursorz = RR ? 32768 : 65536;
ud.pwlockout[0] = '\0';
ud.runkey_mode = 0; ud.runkey_mode = 0;
ud.screen_size = 4; ud.screen_size = 4;
ud.screen_tilting = 1; ud.screen_tilting = 1;
@ -99,7 +93,7 @@ void CONFIG_SetDefaults(void)
ud.team = 0; ud.team = 0;
ud.angleinterpolation = 0; ud.angleinterpolation = 0;
ud.setup.fullscreen = 1; ScreenMode = 1;
ud.display_bonus_screen = 1; ud.display_bonus_screen = 1;
ud.show_level_text = 1; ud.show_level_text = 1;
@ -111,95 +105,20 @@ void CONFIG_SetDefaults(void)
ud.menu_scrollbartilenum = -1; ud.menu_scrollbartilenum = -1;
ud.menu_scrollbarz = 65536; ud.menu_scrollbarz = 65536;
ud.menu_scrollcursorz = 65536; ud.menu_scrollcursorz = 65536;
Bstrcpy(ud.rtsname, G_DefaultRtsFile());
Bstrcpy(szPlayerName, "Player");
} }
int32_t CONFIG_ReadSetup(void) int32_t CONFIG_ReadSetup(void)
{ {
int32_t dummy;
char tempbuf[1024];
CONFIG_SetDefaults(); CONFIG_SetDefaults();
ud.config.setupread = 1; ud.config.setupread = 1;
pathsearchmode = 1; pathsearchmode = 1;
if (ud.config.scripthandle < 0)
{
if (buildvfs_exists(g_setupFileName)) // JBF 20031211
ud.config.scripthandle = SCRIPT_Load(g_setupFileName);
#if !defined(EDUKE32_TOUCH_DEVICES)
else if (buildvfs_exists(SETUPFILENAME))
{
int32_t i;
i=wm_ynbox("Import Configuration Settings", "The configuration file \"%s\" was not found. "
"Import configuration data from \"%s\"?", g_setupFileName, SETUPFILENAME);
if (i) ud.config.scripthandle = SCRIPT_Load(SETUPFILENAME);
}
else if (buildvfs_exists("duke3d.cfg"))
{
int32_t i;
i=wm_ynbox("Import Configuration Settings", "The configuration file \"%s\" was not found. "
"Import configuration data from \"duke3d.cfg\"?", g_setupFileName);
if (i) ud.config.scripthandle = SCRIPT_Load("duke3d.cfg");
}
#endif
}
pathsearchmode = 0; pathsearchmode = 0;
if (ud.config.scripthandle < 0)
return -1;
Bmemset(tempbuf, 0, sizeof(tempbuf)); if (ScreenBPP < 8) ScreenBPP = 32;
SCRIPT_GetString(ud.config.scripthandle, "Comm Setup","PlayerName",&tempbuf[0]);
char nameBuf[64];
while (Bstrlen(OSD_StripColors(nameBuf, tempbuf)) > 10)
tempbuf[Bstrlen(tempbuf) - 1] = '\0';
Bstrncpyz(szPlayerName, tempbuf, sizeof(szPlayerName));
SCRIPT_GetString(ud.config.scripthandle, "Comm Setup","RTSName",&ud.rtsname[0]);
if (g_noSetup == 0 && g_modDir[0] == '/')
{
SCRIPT_GetString(ud.config.scripthandle, "Setup","ModDir",&g_modDir[0]);
if (!buildvfs_isdir(g_modDir))
{
initprintf("Invalid mod dir in cfg!\n");
Bsprintf(g_modDir,"/");
}
}
if (g_grpNamePtr == NULL && g_addonNum == 0)
{
SCRIPT_GetStringPtr(ud.config.scripthandle, "Setup", "SelectedGRP", &g_grpNamePtr);
if (g_grpNamePtr && !Bstrlen(g_grpNamePtr))
g_grpNamePtr = dup_filename(G_DefaultGrpFile());
}
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "Out",&ud.lockout);
SCRIPT_GetString(ud.config.scripthandle, "Screen Setup","Password",&ud.pwlockout[0]);
windowx = -1;
windowy = -1;
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "MaxRefreshFreq", (int32_t *)&maxrefreshfreq);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenHeight", &ud.setup.ydim);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenMode", &ud.setup.fullscreen);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "ScreenWidth", &ud.setup.xdim);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "WindowPosX", (int32_t *)&windowx);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "WindowPosY", (int32_t *)&windowy);
SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "WindowPositioning", (int32_t *)&windowpos);
if (ud.setup.bpp < 8) ud.setup.bpp = 32;
ud.config.setupread = 1; ud.config.setupread = 1;
return 0; return 0;
@ -211,62 +130,5 @@ void CONFIG_WriteSettings(void) // save binds and aliases to <cfgname>_settings.
} }
static const char *CONFIG_GetMapEntryName(char m[], char const * const mapname)
{
strcpy(m, mapname);
char *p = strrchr(m, '/');
if (!p) p = strrchr(m, '\\');
if (p) Bmemmove(m, p, Bstrlen(p)+1);
for (p=m; *p; p++) *p = tolower(*p);
// cheap hack because SCRIPT_GetNumber doesn't like the slashes
p = m;
while (*p == '/') p++;
return p;
}
static void CONFIG_GetMD4EntryName(char m[], uint8_t const * const md4)
{
sprintf(m, "MD4_%08x%08x%08x%08x",
B_BIG32(B_UNBUF32(&md4[0])), B_BIG32(B_UNBUF32(&md4[4])),
B_BIG32(B_UNBUF32(&md4[8])), B_BIG32(B_UNBUF32(&md4[12])));
}
int32_t CONFIG_GetMapBestTime(char const * const mapname, uint8_t const * const mapmd4)
{
if (!ud.config.setupread || ud.config.scripthandle < 0)
return -1;
char m[37];
CONFIG_GetMD4EntryName(m, mapmd4);
int32_t t = -1;
if (SCRIPT_GetNumber(ud.config.scripthandle, "MapTimes", m, &t))
{
// fall back to map filenames
char m2[BMAX_PATH];
auto p = CONFIG_GetMapEntryName(m2, mapname);
SCRIPT_GetNumber(ud.config.scripthandle, "MapTimes", p, &t);
}
return t;
}
int32_t CONFIG_SetMapBestTime(uint8_t const * const mapmd4, int32_t const tm)
{
if (ud.config.scripthandle < 0 && (ud.config.scripthandle = SCRIPT_Init(g_setupFileName)) < 0)
return -1;
char m[37];
CONFIG_GetMD4EntryName(m, mapmd4);
SCRIPT_PutNumber(ud.config.scripthandle, "MapTimes", m, tm, FALSE, FALSE);
return 0;
}
END_RR_NS END_RR_NS

View file

@ -32,9 +32,6 @@ BEGIN_RR_NS
int32_t CONFIG_ReadSetup( void ); int32_t CONFIG_ReadSetup( void );
void CONFIG_GetSetupFilename( void ); void CONFIG_GetSetupFilename( void );
int32_t CONFIG_GetMapBestTime(char const * mapname, uint8_t const * mapmd4);
int32_t CONFIG_SetMapBestTime(uint8_t const * mapmd4, int32_t tm);
void CONFIG_SetDefaults(void); void CONFIG_SetDefaults(void);
END_RR_NS END_RR_NS

View file

@ -177,13 +177,13 @@ void G_HandleSpecialKeys(void)
if (/*g_networkMode != NET_DEDICATED_SERVER && */ALT_IS_PRESSED && KB_KeyPressed(sc_Enter)) if (/*g_networkMode != NET_DEDICATED_SERVER && */ALT_IS_PRESSED && KB_KeyPressed(sc_Enter))
{ {
if (videoSetGameMode(!ud.setup.fullscreen,ud.setup.xdim,ud.setup.ydim,ud.setup.bpp,ud.detail)) if (videoSetGameMode(!ScreenMode,ScreenWidth,ScreenHeight,ScreenBPP,ud.detail))
{ {
OSD_Printf(OSD_ERROR "Failed setting fullscreen video mode.\n"); OSD_Printf(OSD_ERROR "Failed setting fullscreen video mode.\n");
if (videoSetGameMode(ud.setup.fullscreen, ud.setup.xdim, ud.setup.ydim, ud.setup.bpp, ud.detail)) if (videoSetGameMode(ScreenMode, ScreenWidth, ScreenHeight, ScreenBPP, ud.detail))
G_GameExit("Failed to recover from failure to set fullscreen video mode.\n"); G_GameExit("Failed to recover from failure to set fullscreen video mode.\n");
} }
else ud.setup.fullscreen = !ud.setup.fullscreen; else ScreenMode = !ScreenMode;
KB_ClearKeyDown(sc_Enter); KB_ClearKeyDown(sc_Enter);
g_restorePalette = 1; g_restorePalette = 1;
G_UpdateScreenArea(); G_UpdateScreenArea();
@ -381,7 +381,7 @@ void G_GameExit(const char *msg)
if (g_mostConcurrentPlayers > 1 && g_player[myconnectindex].ps->gm&MODE_GAME && GTFLAGS(GAMETYPE_SCORESHEET) && *msg == ' ') if (g_mostConcurrentPlayers > 1 && g_player[myconnectindex].ps->gm&MODE_GAME && GTFLAGS(GAMETYPE_SCORESHEET) && *msg == ' ')
{ {
G_BonusScreen(1); G_BonusScreen(1);
videoSetGameMode(ud.setup.fullscreen,ud.setup.xdim,ud.setup.ydim,ud.setup.bpp,ud.detail); videoSetGameMode(ScreenMode,ScreenWidth,ScreenHeight,ScreenBPP,ud.detail);
} }
// shareware and TEN screens // shareware and TEN screens
@ -4802,7 +4802,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t ourz, int32_t oura
case BLOODSPLAT2__STATIC: case BLOODSPLAT2__STATIC:
case BLOODSPLAT3__STATIC: case BLOODSPLAT3__STATIC:
case BLOODSPLAT4__STATIC: case BLOODSPLAT4__STATIC:
if (ud.lockout) t->xrepeat = t->yrepeat = 0; if (adult_lockout) t->xrepeat = t->yrepeat = 0;
else if (t->pal == 6) else if (t->pal == 6)
{ {
t->shade = -127; t->shade = -127;
@ -4880,7 +4880,7 @@ default_case1:
// NOTE: not const spritetype because set at SET_SPRITE_NOT_TSPRITE (see below). // NOTE: not const spritetype because set at SET_SPRITE_NOT_TSPRITE (see below).
uspritetype *const pSprite = (i < 0) ? &tsprite[j] : (uspritetype *)&sprite[i]; uspritetype *const pSprite = (i < 0) ? &tsprite[j] : (uspritetype *)&sprite[i];
if (ud.lockout && G_CheckAdultTile(DYNAMICTILEMAP(pSprite->picnum))) if (adult_lockout && G_CheckAdultTile(DYNAMICTILEMAP(pSprite->picnum)))
{ {
t->xrepeat = t->yrepeat = 0; t->xrepeat = t->yrepeat = 0;
continue; continue;
@ -4973,7 +4973,7 @@ default_case1:
case PAPER__STATIC: case PAPER__STATIC:
//case PAPER+1__STATIC: //case PAPER+1__STATIC:
if (RR && (switchpic == PUKE || switchpic == MAIL || switchpic == PAPER)) goto default_case2; if (RR && (switchpic == PUKE || switchpic == MAIL || switchpic == PAPER)) goto default_case2;
if (ud.lockout && pSprite->pal == 2) if (adult_lockout && pSprite->pal == 2)
{ {
t->xrepeat = t->yrepeat = 0; t->xrepeat = t->yrepeat = 0;
continue; continue;
@ -5490,7 +5490,7 @@ PALONLY:
} }
if (RRRA && t->pal == 19 && (switchpic == MINJIBA || switchpic == MINJIBB || switchpic == MINJIBC)) if (RRRA && t->pal == 19 && (switchpic == MINJIBA || switchpic == MINJIBB || switchpic == MINJIBC))
t->shade = -127; t->shade = -127;
if (ud.lockout) if (adult_lockout)
{ {
t->xrepeat = t->yrepeat = 0; t->xrepeat = t->yrepeat = 0;
continue; continue;
@ -5961,7 +5961,7 @@ static int32_t g_RTSPlaying;
// Returns: started playing? // Returns: started playing?
extern int G_StartRTS(int lumpNum, int localPlayer) extern int G_StartRTS(int lumpNum, int localPlayer)
{ {
if (!ud.lockout && snd_enabled && if (!adult_lockout && snd_enabled &&
RTS_IsInitialized() && g_RTSPlaying == 0 && (snd_speech & (localPlayer ? 1 : 4))) RTS_IsInitialized() && g_RTSPlaying == 0 && (snd_speech & (localPlayer ? 1 : 4)))
{ {
char *const pData = (char *)RTS_GetSound(lumpNum - 1); char *const pData = (char *)RTS_GetSound(lumpNum - 1);
@ -7863,9 +7863,6 @@ int app_main(int argc, char const * const * argv)
g_mostConcurrentPlayers = ud.multimode; // XXX: redundant? g_mostConcurrentPlayers = ud.multimode; // XXX: redundant?
char const * rtsname = g_rtsNamePtr ? g_rtsNamePtr : ud.rtsname;
RTS_Init(rtsname);
ud.last_level = -1; ud.last_level = -1;
initprintf("Initializing OSD...\n"); initprintf("Initializing OSD...\n");
@ -7906,16 +7903,16 @@ int app_main(int argc, char const * const * argv)
//if (g_networkMode != NET_DEDICATED_SERVER) //if (g_networkMode != NET_DEDICATED_SERVER)
{ {
if (videoSetGameMode(ud.setup.fullscreen, ud.setup.xdim, ud.setup.ydim, ud.setup.bpp, ud.detail) < 0) if (videoSetGameMode(ScreenMode, ScreenWidth, ScreenHeight, ScreenBPP, ud.detail) < 0)
{ {
initprintf("Failure setting video mode %dx%dx%d %s! Trying next mode...\n", ud.setup.xdim, ud.setup.ydim, initprintf("Failure setting video mode %dx%dx%d %s! Trying next mode...\n", *ScreenWidth, *ScreenHeight,
ud.setup.bpp, ud.setup.fullscreen ? "fullscreen" : "windowed"); *ScreenBPP, *ScreenMode ? "fullscreen" : "windowed");
int resIdx = 0; int resIdx = 0;
for (int i=0; i < validmodecnt; i++) for (int i=0; i < validmodecnt; i++)
{ {
if (validmode[i].xdim == ud.setup.xdim && validmode[i].ydim == ud.setup.ydim) if (validmode[i].xdim == ScreenWidth && validmode[i].ydim == ScreenHeight)
{ {
resIdx = i; resIdx = i;
break; break;
@ -7923,7 +7920,7 @@ int app_main(int argc, char const * const * argv)
} }
int const savedIdx = resIdx; int const savedIdx = resIdx;
int bpp = ud.setup.bpp; int bpp = ScreenBPP;
while (videoSetGameMode(0, validmode[resIdx].xdim, validmode[resIdx].ydim, bpp, ud.detail) < 0) while (videoSetGameMode(0, validmode[resIdx].xdim, validmode[resIdx].ydim, bpp, ud.detail) < 0)
{ {
@ -7940,12 +7937,12 @@ int app_main(int argc, char const * const * argv)
} }
} }
ud.setup.xdim = validmode[resIdx].xdim; ScreenWidth = validmode[resIdx].xdim;
ud.setup.ydim = validmode[resIdx].ydim; ScreenHeight = validmode[resIdx].ydim;
ud.setup.bpp = bpp; ScreenBPP = bpp;
} }
videoSetPalette(ud.brightness>>2, g_player[myconnectindex].ps->palette, 0); videoSetPalette(0, g_player[myconnectindex].ps->palette, 0);
S_MusicStartup(); S_MusicStartup();
S_SoundStartup(); S_SoundStartup();
} }

View file

@ -137,13 +137,6 @@ void A_DeleteSprite(int spriteNum);
// KEEPINSYNC lunatic/_defs_game.lua // KEEPINSYNC lunatic/_defs_game.lua
typedef struct {
int32_t fullscreen;
int32_t xdim;
int32_t ydim;
int32_t bpp;
} ud_setup_t;
typedef struct { typedef struct {
vec3_t camerapos; vec3_t camerapos;
int32_t const_visibility,uw_framerate; int32_t const_visibility,uw_framerate;
@ -188,16 +181,12 @@ typedef struct {
int32_t AutoAim; int32_t AutoAim;
int32_t ShowOpponentWeapons; int32_t ShowOpponentWeapons;
int32_t scripthandle;
int32_t setupread; int32_t setupread;
} config; } config;
ud_setup_t setup;
char overhead_on,last_overhead,showweapons; char overhead_on,last_overhead,showweapons;
char god,warp_on,cashman,eog,showallmap; char god,warp_on,cashman,eog,showallmap;
char show_help,scrollmode,noclip; char show_help,scrollmode,noclip;
char pwlockout[MAXPWLOCKOUT],rtsname[MAXRTSNAME];
char display_bonus_screen; char display_bonus_screen;
char show_level_text; char show_level_text;

View file

@ -393,10 +393,8 @@ static MenuOptionSet_t MEOS_DemoRec = MAKE_MENUOPTIONSET( MEOSN_DemoRec, NULL, 0
static MenuOption_t MEO_GAMESETUP_DEMOREC = MAKE_MENUOPTION( &MF_Redfont, &MEOS_OffOn, &ud.m_recstat ); static MenuOption_t MEO_GAMESETUP_DEMOREC = MAKE_MENUOPTION( &MF_Redfont, &MEOS_OffOn, &ud.m_recstat );
static MenuEntry_t ME_GAMESETUP_DEMOREC = MAKE_MENUENTRY( "Record demo:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_GAMESETUP_DEMOREC, Option ); static MenuEntry_t ME_GAMESETUP_DEMOREC = MAKE_MENUENTRY( "Record demo:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_GAMESETUP_DEMOREC, Option );
static MenuOption_t MEO_ADULTMODE = MAKE_MENUOPTION(&MF_Redfont, &MEOS_OffOn, &ud.lockout); static MenuOption_t MEO_ADULTMODE = MAKE_MENUOPTION(&MF_Redfont, &MEOS_OffOn, &adult_lockout.Value);
static MenuEntry_t ME_ADULTMODE = MAKE_MENUENTRY( "Parental lock:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_ADULTMODE, Option ); static MenuEntry_t ME_ADULTMODE = MAKE_MENUENTRY( "Parental lock:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_ADULTMODE, Option );
// static MenuLink_t MEO_ADULTMODE_PASSWORD = { MENU_ADULTPASSWORD, MA_None, };
// static MenuEntry_t ME_ADULTMODE_PASSWORD = MAKE_MENUENTRY( "Enter Password", &MF_Redfont, &, &MEO_ADULTMODE_PASSWORD, Link );
#ifdef EDUKE32_ANDROID_MENU #ifdef EDUKE32_ANDROID_MENU
static MenuOption_t MEO_GAMESETUP_CROUCHLOCK = MAKE_MENUOPTION(&MF_Redfont, &MEOS_OffOn, &droidinput.toggleCrouch); static MenuOption_t MEO_GAMESETUP_CROUCHLOCK = MAKE_MENUOPTION(&MF_Redfont, &MEOS_OffOn, &droidinput.toggleCrouch);
@ -3582,10 +3580,10 @@ static void Menu_EntryLinkActivate(MenuEntry_t *entry)
G_UpdateScreenArea(); G_UpdateScreenArea();
videoSetRenderMode(nrend); videoSetRenderMode(nrend);
vid_vsync = videoSetVsync(nvsync); vid_vsync = videoSetVsync(nvsync);
ud.setup.fullscreen = fullscreen; ScreenMode = fullscreen;
ud.setup.xdim = xres; ScreenWidth = xres;
ud.setup.ydim = yres; ScreenHeight = yres;
ud.setup.bpp = bpp; ScreenBPP = bpp;
} }
else if (entry == &ME_SOUND_RESTART) else if (entry == &ME_SOUND_RESTART)
{ {
@ -3614,9 +3612,8 @@ static void Menu_EntryLinkActivate(MenuEntry_t *entry)
g_videoGamma = DEFAULT_GAMMA; g_videoGamma = DEFAULT_GAMMA;
g_videoContrast = DEFAULT_CONTRAST; g_videoContrast = DEFAULT_CONTRAST;
g_videoBrightness = DEFAULT_BRIGHTNESS; g_videoBrightness = DEFAULT_BRIGHTNESS;
ud.brightness = 0;
r_ambientlight = 1.f; r_ambientlight = 1.f;
videoSetPalette(ud.brightness>>2,g_player[myconnectindex].ps->palette,0); videoSetPalette(0,g_player[myconnectindex].ps->palette,0);
} }
else if (entry == &ME_KEYBOARDSETUP_RESET) else if (entry == &ME_KEYBOARDSETUP_RESET)
CONFIG_SetDefaultKeys("demolition/defbinds.txt"); CONFIG_SetDefaultKeys("demolition/defbinds.txt");
@ -3717,29 +3714,10 @@ static int32_t Menu_EntryOptionModify(MenuEntry_t *entry, int32_t newOption)
break; break;
} }
ud.pwlockout[0] = 0;
Menu_Change(MENU_ADULTPASSWORD);
// return -1;
} }
else else
{ {
if (ud.pwlockout[0] == 0) adult_lockout = 0;
{
ud.lockout = 0;
#if 0
for (x=0; x<g_numAnimWalls; x++)
if (wall[animwall[x].wallnum].picnum != W_SCREENBREAK &&
wall[animwall[x].wallnum].picnum != W_SCREENBREAK+1 &&
wall[animwall[x].wallnum].picnum != W_SCREENBREAK+2)
if (wall[animwall[x].wallnum].extra >= 0)
wall[animwall[x].wallnum].picnum = wall[animwall[x].wallnum].extra;
#endif
}
else
{
Menu_Change(MENU_ADULTPASSWORD);
return -1;
}
} }
} }
@ -3804,7 +3782,7 @@ static void Menu_EntryOptionDidModify(MenuEntry_t *entry)
videoResetMode(); videoResetMode();
if (videoSetGameMode(fullscreen, xres, yres, bpp, upscalefactor)) if (videoSetGameMode(fullscreen, xres, yres, bpp, upscalefactor))
OSD_Printf("restartvid: Reset failed...\n"); OSD_Printf("restartvid: Reset failed...\n");
onvideomodechange(ud.setup.bpp>8); onvideomodechange(ScreenBPP>8);
G_RefreshLights(); G_RefreshLights();
} }
#endif #endif
@ -3856,16 +3834,6 @@ static int32_t Menu_EntryRangeFloatModify(MenuEntry_t *entry, float newValue)
static int32_t Menu_EntryRangeFloatDidModify(MenuEntry_t *entry) static int32_t Menu_EntryRangeFloatDidModify(MenuEntry_t *entry)
{ {
if (entry == &ME_COLCORR_GAMMA)
{
ud.brightness = GAMMA_CALC<<2;
videoSetPalette(ud.brightness>>2, g_player[myconnectindex].ps->palette, 0);
}
else if (entry == &ME_COLCORR_CONTRAST || entry == &ME_COLCORR_BRIGHTNESS)
{
videoSetPalette(ud.brightness>>2, g_player[myconnectindex].ps->palette, 0);
}
return 0; return 0;
} }
@ -4119,21 +4087,6 @@ static void Menu_TextFormSubmit(char *input)
switch (g_currentMenu) switch (g_currentMenu)
{ {
case MENU_ADULTPASSWORD: case MENU_ADULTPASSWORD:
if (Bstrlen(input) && (ud.pwlockout[0] == 0 || ud.lockout == 0))
Bstrcpy(&ud.pwlockout[0], input);
else if (Bstrcmp(input, &ud.pwlockout[0]) == 0)
{
for (int x=0; x<g_animWallCnt; x++)
if ((unsigned) animwall[x].wallnum < (unsigned)numwalls && wall[animwall[x].wallnum].picnum != W_SCREENBREAK &&
wall[animwall[x].wallnum].picnum != W_SCREENBREAK+1 &&
wall[animwall[x].wallnum].picnum != W_SCREENBREAK+2)
if (wall[animwall[x].wallnum].extra >= 0)
wall[animwall[x].wallnum].picnum = wall[animwall[x].wallnum].extra;
ud.lockout = 0;
}
S_PlaySound(RR ? 341 : PISTOL_BODYHIT);
Menu_Change(MENU_GAMESETUP);
break; break;
case MENU_CHEATENTRY: case MENU_CHEATENTRY:

View file

@ -415,9 +415,9 @@ int osdcmd_restartvid(osdcmdptr_t UNUSED(parm))
{ {
UNREFERENCED_CONST_PARAMETER(parm); UNREFERENCED_CONST_PARAMETER(parm);
videoResetMode(); videoResetMode();
if (videoSetGameMode(ud.setup.fullscreen,ud.setup.xdim,ud.setup.ydim,ud.setup.bpp,ud.detail)) if (videoSetGameMode(ScreenMode,ScreenWidth,ScreenHeight,ScreenBPP,ud.detail))
G_GameExit("restartvid: Reset failed...\n"); G_GameExit("restartvid: Reset failed...\n");
onvideomodechange(ud.setup.bpp>8); onvideomodechange(ScreenBPP>8);
G_UpdateScreenArea(); G_UpdateScreenArea();
return OSDCMD_OK; return OSDCMD_OK;
@ -435,8 +435,8 @@ int osdcmd_restartmap(osdcmdptr_t UNUSED(parm))
static int osdcmd_vidmode(osdcmdptr_t parm) static int osdcmd_vidmode(osdcmdptr_t parm)
{ {
int32_t newbpp = ud.setup.bpp, newwidth = ud.setup.xdim, int32_t newbpp = ScreenBPP, newwidth = ScreenWidth,
newheight = ud.setup.ydim, newfs = ud.setup.fullscreen; newheight = ScreenHeight, newfs = ScreenMode;
int32_t tmp; int32_t tmp;
if (parm->numparms < 1 || parm->numparms > 4) return OSDCMD_SHOWHELP; if (parm->numparms < 1 || parm->numparms > 4) return OSDCMD_SHOWHELP;
@ -469,14 +469,14 @@ static int osdcmd_vidmode(osdcmdptr_t parm)
if (videoSetGameMode(newfs,newwidth,newheight,newbpp,upscalefactor)) if (videoSetGameMode(newfs,newwidth,newheight,newbpp,upscalefactor))
{ {
initprintf("vidmode: Mode change failed!\n"); initprintf("vidmode: Mode change failed!\n");
if (videoSetGameMode(ud.setup.fullscreen, ud.setup.xdim, ud.setup.ydim, ud.setup.bpp, upscalefactor)) if (videoSetGameMode(ScreenMode, ScreenWidth, ScreenHeight, ScreenBPP, upscalefactor))
G_GameExit("vidmode: Reset failed!\n"); G_GameExit("vidmode: Reset failed!\n");
} }
ud.setup.bpp = newbpp; ScreenBPP = newbpp;
ud.setup.xdim = newwidth; ScreenWidth = newwidth;
ud.setup.ydim = newheight; ScreenHeight = newheight;
ud.setup.fullscreen = newfs; ScreenMode = newfs;
onvideomodechange(ud.setup.bpp>8); onvideomodechange(ScreenBPP>8);
G_UpdateScreenArea(); G_UpdateScreenArea();
return OSDCMD_OK; return OSDCMD_OK;
} }
@ -707,7 +707,7 @@ void onvideomodechange(int32_t newmode)
} }
#endif #endif
videoSetPalette(ud.brightness>>2, palid, 0); videoSetPalette(0, palid, 0);
g_restorePalette = -1; g_restorePalette = -1;
g_crosshairSum = -1; g_crosshairSum = -1;
} }

View file

@ -3754,7 +3754,7 @@ static int32_t P_DoCounters(int playerNum)
if (pPlayer->drink_amt > 66 && (pPlayer->last_pissed_time % GAMETICSPERSEC) == 0) if (pPlayer->drink_amt > 66 && (pPlayer->last_pissed_time % GAMETICSPERSEC) == 0)
pPlayer->drink_amt--; pPlayer->drink_amt--;
if (!ud.lockout) if (!adult_lockout)
{ {
switch (pPlayer->last_pissed_time) switch (pPlayer->last_pissed_time)
{ {

View file

@ -1804,7 +1804,7 @@ static void prelevel(char g)
pWall->extra = pWall->picnum; pWall->extra = pWall->picnum;
animwall[g_animWallCnt].tag = -1; animwall[g_animWallCnt].tag = -1;
if (ud.lockout) if (adult_lockout)
pWall->picnum = (pWall->picnum == FEMPIC1) ? BLANKSCREEN : SCREENBREAK6; pWall->picnum = (pWall->picnum == FEMPIC1) ? BLANKSCREEN : SCREENBREAK6;
animwall[g_animWallCnt].wallnum = i; animwall[g_animWallCnt].wallnum = i;
@ -1852,7 +1852,7 @@ static void prelevel(char g)
if (RR && !g_thunderOn) if (RR && !g_thunderOn)
{ {
videoSetPalette(ud.brightness >> 2,BASEPAL,0); videoSetPalette(0,BASEPAL,0);
g_visibility = g_player[screenpeek].ps->visibility; g_visibility = g_player[screenpeek].ps->visibility;
} }
if (RR) if (RR)
@ -1910,7 +1910,7 @@ void G_NewGame(int volumeNum, int levelNum, int skillNum)
// we don't want the intro to play after the multiplayer setup screen // we don't want the intro to play after the multiplayer setup screen
if (!RR && (!g_netServer && ud.multimode < 2) && UserMap == 0 && if (!RR && (!g_netServer && ud.multimode < 2) && UserMap == 0 &&
levelNum == 0 && volumeNum == 3 && ud.lockout == 0) levelNum == 0 && volumeNum == 3 && adult_lockout == 0)
{ {
S_PlaySpecialMusicOrNothing(MUS_BRIEFING); S_PlaySpecialMusicOrNothing(MUS_BRIEFING);
@ -2320,7 +2320,7 @@ int G_EnterLevel(int gameMode)
FX_StopAllSounds(); FX_StopAllSounds();
S_ClearSoundLocks(); S_ClearSoundLocks();
FX_SetReverb(0); FX_SetReverb(0);
videoSetGameMode(ud.setup.fullscreen, ud.setup.xdim, ud.setup.ydim, ud.setup.bpp, upscalefactor); videoSetGameMode(ScreenMode, ScreenWidth, ScreenHeight, ScreenBPP, upscalefactor);
} }
if (Menu_HaveUserMap()) if (Menu_HaveUserMap())

View file

@ -1910,7 +1910,7 @@ static void postloadplayer(int32_t savegamep)
//4 //4
if (savegamep) if (savegamep)
{ {
if (ud.lockout) if (adult_lockout)
{ {
for (i=0; i<g_animWallCnt; i++) for (i=0; i<g_animWallCnt; i++)
switch (DYNAMICTILEMAP(wall[animwall[i].wallnum].picnum)) switch (DYNAMICTILEMAP(wall[animwall[i].wallnum].picnum))

View file

@ -89,7 +89,7 @@ void P_SetGamePalette(DukePlayer_t *player, uint32_t palid, int32_t set)
if (player != g_player[screenpeek].ps) if (player != g_player[screenpeek].ps)
return; return;
videoSetPalette(ud.brightness>>2, palid, set); videoSetPalette(0, palid, set);
} }
void G_GetCrosshairColor(void) void G_GetCrosshairColor(void)
@ -1713,7 +1713,7 @@ static void G_BonusCutscenes(void)
case 0: case 0:
videoClearScreen(0L); videoClearScreen(0L);
videoNextPage(); videoNextPage();
if (ud.lockout == 0) if (adult_lockout == 0)
{ {
Anim_Play("turdmov.anm"); Anim_Play("turdmov.anm");
I_ClearAllInput(); I_ClearAllInput();
@ -1738,7 +1738,7 @@ static void G_BonusCutscenes(void)
case 1: case 1:
videoClearScreen(0L); videoClearScreen(0L);
videoNextPage(); videoNextPage();
if (ud.lockout == 0) if (adult_lockout == 0)
{ {
Anim_Play("rr_outro.anm"); Anim_Play("rr_outro.anm");
I_ClearAllInput(); I_ClearAllInput();
@ -1769,7 +1769,7 @@ static void G_BonusCutscenes(void)
switch (ud.volume_number) switch (ud.volume_number)
{ {
case 0: case 0:
if (ud.lockout == 0) if (adult_lockout == 0)
{ {
int32_t bonuscnt=0; int32_t bonuscnt=0;
int32_t const bossmove [] = int32_t const bossmove [] =
@ -1876,7 +1876,7 @@ static void G_BonusCutscenes(void)
videoClearScreen(0L); videoClearScreen(0L);
videoNextPage(); videoNextPage();
if (ud.lockout == 0) if (adult_lockout == 0)
{ {
fadepal(0, 0, 0, 252, 0, -4); fadepal(0, 0, 0, 252, 0, -4);
Anim_Play("cineov2.anm"); Anim_Play("cineov2.anm");
@ -1904,7 +1904,7 @@ static void G_BonusCutscenes(void)
videoClearScreen(0L); videoClearScreen(0L);
videoNextPage(); videoNextPage();
if (ud.lockout == 0) if (adult_lockout == 0)
{ {
fadepal(0, 0, 0, 252, 0, -4); fadepal(0, 0, 0, 252, 0, -4);
@ -1971,7 +1971,7 @@ static void G_BonusCutscenes(void)
S_StopMusic(); S_StopMusic();
videoClearScreen(0L); videoClearScreen(0L);
videoNextPage(); videoNextPage();
if (ud.lockout == 0) if (adult_lockout == 0)
{ {
fadepal(0, 0, 0, 252, 0, -4); fadepal(0, 0, 0, 252, 0, -4);
Anim_Play("cineov3.anm"); Anim_Play("cineov3.anm");
@ -1988,7 +1988,7 @@ static void G_BonusCutscenes(void)
Anim_Play("RADLOGO.ANM"); Anim_Play("RADLOGO.ANM");
if (ud.lockout == 0 && !I_CheckAllInput()) if (adult_lockout == 0 && !I_CheckAllInput())
{ {
if (G_PlaySoundWhileNoInput(ENDSEQVOL3SND5)) goto ENDANM; if (G_PlaySoundWhileNoInput(ENDSEQVOL3SND5)) goto ENDANM;
if (G_PlaySoundWhileNoInput(ENDSEQVOL3SND6)) goto ENDANM; if (G_PlaySoundWhileNoInput(ENDSEQVOL3SND6)) goto ENDANM;

View file

@ -3609,7 +3609,7 @@ void P_HandleSharedKeys(int playerNum)
&& (!RRRA || sprite[pPlayer->i].extra > 0)) && (!RRRA || sprite[pPlayer->i].extra > 0))
{ {
pPlayer->last_pissed_time = 4000; pPlayer->last_pissed_time = 4000;
if (!ud.lockout) if (!adult_lockout)
A_PlaySound(437, pPlayer->i); A_PlaySound(437, pPlayer->i);
if (sprite[pPlayer->i].extra <= pPlayer->max_player_health - pPlayer->max_player_health / 10) if (sprite[pPlayer->i].extra <= pPlayer->max_player_health - pPlayer->max_player_health / 10)
{ {
@ -4576,7 +4576,7 @@ void P_CheckSectors(int playerNum)
case RRTILE2122__STATICRR: case RRTILE2122__STATICRR:
if (pPlayer->last_pissed_time == 0) if (pPlayer->last_pissed_time == 0)
{ {
if (ud.lockout == 0) if (adult_lockout == 0)
A_PlaySound(RR ? 435 : DUKE_URINATE, pPlayer->i); A_PlaySound(RR ? 435 : DUKE_URINATE, pPlayer->i);
pPlayer->last_pissed_time = GAMETICSPERSEC * 220; pPlayer->last_pissed_time = GAMETICSPERSEC * 220;
@ -5223,7 +5223,7 @@ void G_Thunder(void)
} }
else else
{ {
brightness = ud.brightness>>2; brightness = 0;
g_visibility = g_player[screenpeek].ps->visibility; g_visibility = g_player[screenpeek].ps->visibility;
} }
} }
@ -5232,9 +5232,9 @@ void G_Thunder(void)
g_thunderTime -= 4; g_thunderTime -= 4;
if (g_thunderTime < 0) if (g_thunderTime < 0)
{ {
brightness = ud.brightness>>2; brightness = 0;
g_thunderFlash = 0; g_thunderFlash = 0;
videoSetPalette(brightness,g_player[screenpeek].ps->palette,32); videoSetPalette(0,g_player[screenpeek].ps->palette,32);
g_visibility = g_player[screenpeek].ps->visibility; g_visibility = g_player[screenpeek].ps->visibility;
} }
} }

View file

@ -616,7 +616,7 @@ int S_PlaySound3D(int num, int spriteNum, const vec3_t *pos)
const DukePlayer_t *const pPlayer = g_player[myconnectindex].ps; const DukePlayer_t *const pPlayer = g_player[myconnectindex].ps;
if (((snd.m & SF_ADULT) && ud.lockout) || (unsigned)spriteNum >= MAXSPRITES || (pPlayer->gm & MODE_MENU) || !FX_VoiceAvailable(snd.pr) if (((snd.m & SF_ADULT) && adult_lockout) || (unsigned)spriteNum >= MAXSPRITES || (pPlayer->gm & MODE_MENU) || !FX_VoiceAvailable(snd.pr)
|| (pPlayer->timebeforeexit > 0 && pPlayer->timebeforeexit <= GAMETICSPERSEC * 3)) || (pPlayer->timebeforeexit > 0 && pPlayer->timebeforeexit <= GAMETICSPERSEC * 3))
return -1; return -1;
@ -752,7 +752,7 @@ int S_PlaySound(int num)
return -1; return -1;
} }
if ((!(snd_speech & 1) && (snd.m & SF_TALK)) || ((snd.m & SF_ADULT) && ud.lockout) || !FX_VoiceAvailable(snd.pr)) if ((!(snd_speech & 1) && (snd.m & SF_TALK)) || ((snd.m & SF_ADULT) && adult_lockout) || !FX_VoiceAvailable(snd.pr))
return -1; return -1;
int const pitch = S_GetPitch(num); int const pitch = S_GetPitch(num);

View file

@ -56,6 +56,14 @@ BEGIN_RR_NS
#define TAB_CONFIG 0 #define TAB_CONFIG 0
#define TAB_MESSAGES 1 #define TAB_MESSAGES 1
typedef struct {
int32_t fullscreen;
int32_t xdim;
int32_t ydim;
int32_t bpp;
} ud_setup_t;
static struct static struct
{ {
struct grpfile_t const * grp; struct grpfile_t const * grp;
@ -618,7 +626,7 @@ int32_t startwin_run(void)
settings.polymer = 0; settings.polymer = 0;
#endif #endif
settings.shared = ud.setup; settings.shared = { ScreenMode, ScreenWidth, ScreenHeight, ScreenBPP };
settings.grp = g_selectedGrp; settings.grp = g_selectedGrp;
settings.gamedir = g_modDir; settings.gamedir = g_modDir;
@ -650,8 +658,11 @@ int32_t startwin_run(void)
if (done) if (done)
{ {
ud.setup = settings.shared; ScreenWidth = settings.shared.xdim;
glrendmode = (settings.polymer) ? REND_POLYMER : REND_POLYMOST; ScreenHeight = settings.shared.ydim;
ScreenMode = settings.shared.fullscreen;
ScreenBPP = settings.shared.bpp;
glrendmode = REND_POLYMOST;
g_selectedGrp = settings.grp; g_selectedGrp = settings.grp;
Bstrcpy(g_modDir, (g_noSetup == 0 && settings.gamedir != NULL) ? settings.gamedir : "/"); Bstrcpy(g_modDir, (g_noSetup == 0 && settings.gamedir != NULL) ? settings.gamedir : "/");
} }

View file

@ -307,7 +307,7 @@ playanm(short anim_num)
videoClearViewableArea(0L); videoClearViewableArea(0L);
paletteSetColorTable(0, ANIMvesapal, true); paletteSetColorTable(0, ANIMvesapal, true);
videoSetPalette(gs.Brightness,0,2); videoSetPalette(0,0,2);
if (ANIMnum == 1) if (ANIMnum == 1)
{ {
// draw the first frame // draw the first frame
@ -379,7 +379,7 @@ ENDOFANIMLOOP:
palookup[0] = palook_bak; palookup[0] = palook_bak;
paletteSetColorTable(0, (unsigned char *)palette_data); paletteSetColorTable(0, (unsigned char *)palette_data);
videoSetPalette(gs.Brightness, 0, 2); videoSetPalette(0, 0, 2);
KB_FlushKeyboardQueue(); KB_FlushKeyboardQueue();
KB_ClearKeysDown(); KB_ClearKeysDown();

View file

@ -1092,7 +1092,7 @@ DoBunnyQuickJump(short SpriteNum)
NewStateGroup(SpriteNum, sg_BunnyScrew); NewStateGroup(SpriteNum, sg_BunnyScrew);
NewStateGroup(hit_sprite, sg_BunnyScrew); NewStateGroup(hit_sprite, sg_BunnyScrew);
if (gs.ParentalLock || Global_PLock) if (adult_lockout || Global_PLock)
{ {
SET(sp->cstat, CSTAT_SPRITE_INVISIBLE); // Turn em' invisible SET(sp->cstat, CSTAT_SPRITE_INVISIBLE); // Turn em' invisible
SET(tsp->cstat, CSTAT_SPRITE_INVISIBLE); // Turn em' invisible SET(tsp->cstat, CSTAT_SPRITE_INVISIBLE); // Turn em' invisible
@ -1487,7 +1487,7 @@ DoBunnyScrew(short SpriteNum)
if (RANDOM_RANGE(1000) > 990) // Bunny sex sounds if (RANDOM_RANGE(1000) > 990) // Bunny sex sounds
{ {
if (!gs.ParentalLock && !Global_PLock) if (!adult_lockout && !Global_PLock)
PlaySound(DIGI_BUNNYATTACK, &sp->x, &sp->y, &sp->z, v3df_follow); PlaySound(DIGI_BUNNYATTACK, &sp->x, &sp->y, &sp->z, v3df_follow);
} }

View file

@ -75,11 +75,6 @@ int32_t UseMouse = 1, UseJoystick = 0;
// Screen variables // Screen variables
// //
int32_t ScreenMode = 1;
int32_t ScreenWidth = 640;
int32_t ScreenHeight = 480;
int32_t ScreenBPP = 8;
char RTSName[MAXRTSNAMELENGTH]; char RTSName[MAXRTSNAMELENGTH];
static int32_t scripthandle = -1; static int32_t scripthandle = -1;
@ -96,10 +91,6 @@ static int32_t scripthandle = -1;
void CONFIG_SetDefaults(void) void CONFIG_SetDefaults(void)
{ {
// JBF 20031211
int32_t i;// , f;
//uint8_t k1,k2;
ScreenMode = 1; ScreenMode = 1;
#if defined RENDERTYPESDL && SDL_MAJOR_VERSION > 1 #if defined RENDERTYPESDL && SDL_MAJOR_VERSION > 1
@ -153,18 +144,6 @@ int32_t CONFIG_ReadSetup(void)
CONFIG_SetDefaults(); CONFIG_SetDefaults();
if (buildvfs_exists(setupfilename))
scripthandle = SCRIPT_Load(setupfilename);
if (scripthandle < 0) return -1;
// What was here is no longer needed with a globally stored config that's being read automatically.
ReadGameSetup(scripthandle);
if (PlayerNameArg[0] != '\0')
{
strcpy(CommPlayerName, PlayerNameArg);
}
return 0; return 0;
} }

View file

@ -38,10 +38,6 @@ BEGIN_SW_NS
#define SETUPNAMEPARM "SETUPFILE" #define SETUPNAMEPARM "SETUPFILE"
// screen externs // screen externs
extern int32_t ScreenMode; // Screen mode
extern int32_t ScreenWidth;
extern int32_t ScreenHeight;
extern int32_t ScreenBPP;
extern int32_t ScreenBufferMode; extern int32_t ScreenBufferMode;
extern int32_t VesaBufferMode; extern int32_t VesaBufferMode;

View file

@ -717,7 +717,7 @@ analyzesprites(int viewx, int viewy, int viewz, SWBOOL mirror)
} }
// Diss any parentally locked sprites // Diss any parentally locked sprites
if (gs.ParentalLock || Global_PLock) if (adult_lockout || Global_PLock)
{ {
if (aVoxelArray[tsp->picnum].Parental == 6145) if (aVoxelArray[tsp->picnum].Parental == 6145)
{ {

View file

@ -202,7 +202,6 @@ const GAME_SET gs_defaults =
128, // music vol 128, // music vol
192, // fx vol 192, // fx vol
2, // border 2, // border
0, // brightness
0, // border tile 0, // border tile
FALSE, // mouse aiming FALSE, // mouse aiming
FALSE, // mouse look FALSE, // mouse look
@ -225,13 +224,10 @@ const GAME_SET gs_defaults =
0, // Kill Limit 0, // Kill Limit
0, // Time Limit 0, // Time Limit
0, // Color 0, // Color
0, // Parental Lock
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", // Password
TRUE, // nuke TRUE, // nuke
TRUE, // voxels TRUE, // voxels
FALSE, // stats FALSE, // stats
FALSE, // mouse aiming on FALSE, // mouse aiming on
FALSE, // play cd
"Track??", // waveform track name "Track??", // waveform track name
}; };
GAME_SET gs; GAME_SET gs;
@ -792,7 +788,6 @@ void DisplayDemoText(void)
void Set_GameMode(void) void Set_GameMode(void)
{ {
extern int ScreenMode, ScreenWidth, ScreenHeight, ScreenBPP;
int result; int result;
char ch; char ch;
@ -803,7 +798,7 @@ void Set_GameMode(void)
if (result < 0) if (result < 0)
{ {
buildprintf("Failure setting video mode %dx%dx%d %s! Attempting safer mode...", buildprintf("Failure setting video mode %dx%dx%d %s! Attempting safer mode...",
ScreenWidth,ScreenHeight,ScreenBPP,ScreenMode ? "fullscreen" : "windowed"); *ScreenWidth,*ScreenHeight,*ScreenBPP,*ScreenMode ? "fullscreen" : "windowed");
ScreenMode = 0; ScreenMode = 0;
ScreenWidth = 640; ScreenWidth = 640;
ScreenHeight = 480; ScreenHeight = 480;
@ -1077,7 +1072,7 @@ InitGame(int32_t argc, char const * const * argv)
GraphicsMode = TRUE; GraphicsMode = TRUE;
SetupAspectRatio(); SetupAspectRatio();
COVERsetbrightness(gs.Brightness,&palette_data[0][0]); COVERsetbrightness(0, &palette_data[0][0]);
InitFX(); // JBF: do it down here so we get a hold of the window handle InitFX(); // JBF: do it down here so we get a hold of the window handle
InitMusic(); InitMusic();
@ -1752,7 +1747,7 @@ LogoLevel(void)
if (pal.Size() >= 768) if (pal.Size() >= 768)
{ {
paletteSetColorTable(1, pal.Data()); paletteSetColorTable(1, pal.Data());
videoSetPalette(gs.Brightness, 1, 2); videoSetPalette(0, 1, 2);
} }
DSPRINTF(ds,"Just read in 3drealms.pal..."); DSPRINTF(ds,"Just read in 3drealms.pal...");
MONO_PRINT(ds); MONO_PRINT(ds);
@ -1797,7 +1792,7 @@ LogoLevel(void)
videoNextPage(); videoNextPage();
//SetPaletteToVESA(backup_pal); //SetPaletteToVESA(backup_pal);
paletteSetColorTable(0, &palette_data[0][0]); paletteSetColorTable(0, &palette_data[0][0]);
videoSetPalette(gs.Brightness, 0, 2); videoSetPalette(0, 0, 2);
// put up a blank screen while loading // put up a blank screen while loading
@ -2640,7 +2635,7 @@ void EndGameSequence(void)
SWBOOL anim_ok = TRUE; SWBOOL anim_ok = TRUE;
FadeOut(0, 5); FadeOut(0, 5);
if ((gs.ParentalLock || Global_PLock) && FinishAnim == ANIM_SUMO) if ((adult_lockout || Global_PLock) && FinishAnim == ANIM_SUMO)
anim_ok = FALSE; anim_ok = FALSE;
if (anim_ok) if (anim_ok)
@ -4191,9 +4186,6 @@ SinglePlayInput(PLAYERp pp)
tp = Player + screenpeek; tp = Player + screenpeek;
PlayerUpdatePanelInfo(tp); PlayerUpdatePanelInfo(tp);
if (getrendermode() < 3)
COVERsetbrightness(gs.Brightness,(char *)palette_data);
else
setpalettefade(0,0,0,0); setpalettefade(0,0,0,0);
memcpy(pp->temp_pal, palette_data, sizeof(palette_data)); memcpy(pp->temp_pal, palette_data, sizeof(palette_data));
DoPlayerDivePalette(tp); DoPlayerDivePalette(tp);
@ -4285,7 +4277,7 @@ SinglePlayInput(PLAYERp pp)
// This sets the palette to whatever it is of the player you // This sets the palette to whatever it is of the player you
// just chose to view the game through. // just chose to view the game through.
// printf("SingPlayInput ALT+1-9 set_pal: pp->PlayerSprite = %d\n",pp->PlayerSprite); // printf("SingPlayInput ALT+1-9 set_pal: pp->PlayerSprite = %d\n",pp->PlayerSprite);
COVERsetbrightness(gs.Brightness,(char *)palette_data); // JBF: figure out what's going on here //COVERsetbrightness(0,(char *)palette_data); // JBF: figure out what's going on here
DoPlayerNightVisionPalette(pp); DoPlayerNightVisionPalette(pp);
@ -4446,7 +4438,7 @@ FunctionKeys(PLAYERp pp)
if (KEY_PRESSED(KEYSC_ALT) || KEY_PRESSED(KEYSC_RALT)) if (KEY_PRESSED(KEYSC_ALT) || KEY_PRESSED(KEYSC_RALT))
{ {
if (rts_delay > 16 && fn_key && CommEnabled && !gs.ParentalLock && !Global_PLock) if (rts_delay > 16 && fn_key && CommEnabled && !adult_lockout && !Global_PLock)
{ {
KEY_PRESSED(sc_F1 + fn_key - 1) = 0; KEY_PRESSED(sc_F1 + fn_key - 1) = 0;
@ -4615,21 +4607,7 @@ FunctionKeys(PLAYERp pp)
if (KEY_PRESSED(KEYSC_F11) > 0) if (KEY_PRESSED(KEYSC_F11) > 0)
{ {
KEY_PRESSED(KEYSC_F11) = 0; KEY_PRESSED(KEYSC_F11) = 0;
// Do this entirely in the video backend.
gs.Brightness++;
if (gs.Brightness >= SLDR_BRIGHTNESSMAX)
gs.Brightness = 0;
sprintf(ds,"Brightness level (%d)",gs.Brightness+1);
PutStringInfoLine(pp, ds);
if (!pp->NightVision && pp->FadeAmt <= 0)
{
COVERsetbrightness(gs.Brightness,&palette_data[0][0]);
}
//DoPlayerDivePalette(pp);
//DoPlayerNightVisionPalette(pp);
} }
} }
@ -5408,7 +5386,6 @@ getinput(SW_PACKET *loc)
if (dimensionmode != 2 && screenpeek == myconnectindex) if (dimensionmode != 2 && screenpeek == myconnectindex)
{ {
// JBF: figure out what's going on here // JBF: figure out what's going on here
COVERsetbrightness(gs.Brightness,&palette_data[0][0]);
memcpy(pp->temp_pal, palette_data, sizeof(palette_data)); memcpy(pp->temp_pal, palette_data, sizeof(palette_data));
DoPlayerDivePalette(pp); // Check Dive again DoPlayerDivePalette(pp); // Check Dive again
DoPlayerNightVisionPalette(pp); // Check Night Vision again DoPlayerNightVisionPalette(pp); // Check Night Vision again
@ -5421,7 +5398,6 @@ getinput(SW_PACKET *loc)
memcpy(pp->temp_pal, palette_data, sizeof(palette_data)); memcpy(pp->temp_pal, palette_data, sizeof(palette_data));
else else
memcpy(pp->temp_pal, tp->temp_pal, sizeof(tp->temp_pal)); memcpy(pp->temp_pal, tp->temp_pal, sizeof(tp->temp_pal));
COVERsetbrightness(gs.Brightness,&palette_data[0][0]);
DoPlayerDivePalette(tp); DoPlayerDivePalette(tp);
DoPlayerNightVisionPalette(tp); DoPlayerNightVisionPalette(tp);
} }
@ -5921,7 +5897,7 @@ extern int32_t startwin_settitle(const char*);
extern int32_t startwin_idle(void*); extern int32_t startwin_idle(void*);
extern int32_t startwin_run(void); extern int32_t startwin_run(void);
/*extern*/ bool validate_hud(int requested_size) { return requested_size; } /*extern*/ bool validate_hud(int requested_size) { return requested_size; }
/*extern*/ void set_hud(int requested_size) {} /*extern*/ void set_hud(int requested_size) { /* the relevant setting is gs.BorderNum */}
GameInterface Interface = { GameInterface Interface = {
140, // Huh? 140, // Huh?

View file

@ -563,53 +563,6 @@ StopInventoryEnvironSuit(PLAYERp pp, short InventoryNum)
static char sectorfloorpals[MAXSECTORS], sectorceilingpals[MAXSECTORS], wallpals[MAXWALLS]; static char sectorfloorpals[MAXSECTORS], sectorceilingpals[MAXSECTORS], wallpals[MAXWALLS];
#if 0
void
DoPlayerNightVisionPalette(PLAYERp pp)
{
short i;
if (pp->InventoryActive[INVENTORY_NIGHT_VISION] && (pp - Player == screenpeek))
{
if (NightVision)
return; // Already using night vision, don't
// bother.
g_visibility = 0;
for (i = 0; i < numsectors; i++)
{
sectorfloorpals[i] = sector[i].floorpal;
sectorceilingpals[i] = sector[i].ceilingpal;
sector[i].floorpal = PALETTE_GREEN_LIGHTING;
sector[i].ceilingpal = PALETTE_GREEN_LIGHTING;
}
for (i = 0; i < numwalls; i++)
{
wallpals[i] = wall[i].pal;
wall[i].pal = PALETTE_GREEN_LIGHTING;
}
NightVision = TRUE;
COVERsetbrightness(4, (char *) &palette_data[0][0]);
}
else
{
g_visibility = NormalVisibility;
for (i = 0; i < numsectors; i++)
{
sector[i].floorpal = sectorfloorpals[i];
sector[i].ceilingpal = sectorceilingpals[i];
}
for (i = 0; i < numwalls; i++)
{
wall[i].pal = wallpals[i];
}
DoPlayerDivePalette(pp); // Check again to see if its a water palette
NightVision = FALSE;
COVERsetbrightness(gs.Brightness, (char *) &palette_data[0][0]);
}
}
#endif
void void
DoPlayerNightVisionPalette(PLAYERp pp) DoPlayerNightVisionPalette(PLAYERp pp)
@ -631,9 +584,6 @@ DoPlayerNightVisionPalette(PLAYERp pp)
memcpy(pp->temp_pal, palette_data, sizeof(palette_data)); memcpy(pp->temp_pal, palette_data, sizeof(palette_data));
memcpy(palookup[PALETTE_DEFAULT], DefaultPalette, 256 * 32); memcpy(palookup[PALETTE_DEFAULT], DefaultPalette, 256 * 32);
pp->FadeAmt = 0; pp->FadeAmt = 0;
if (videoGetRenderMode() < REND_POLYMOST)
COVERsetbrightness(gs.Brightness, &palette_data[0][0]);
else
videoFadePalette(0,0,0,0); videoFadePalette(0,0,0,0);
} }
pp->NightVision = FALSE; pp->NightVision = FALSE;

View file

@ -1337,7 +1337,7 @@ JS_ToggleLockouts(void)
{ {
short picnum; short picnum;
if (gs.ParentalLock) if (adult_lockout)
{ {
picnum = wall[i].picnum; picnum = wall[i].picnum;
ASSERT(aVoxelArray[picnum].Parental < INVISTILE); // Invalid, walls can't ASSERT(aVoxelArray[picnum].Parental < INVISTILE); // Invalid, walls can't
@ -1351,7 +1351,7 @@ JS_ToggleLockouts(void)
wall[i].picnum = tp->orgpicnum; // Restore them wall[i].picnum = tp->orgpicnum; // Restore them
if (gs.ParentalLock) if (adult_lockout)
{ {
picnum = wall[i].overpicnum; picnum = wall[i].overpicnum;
ASSERT(aVoxelArray[picnum].Parental < INVISTILE); // Invalid, walls can't ASSERT(aVoxelArray[picnum].Parental < INVISTILE); // Invalid, walls can't
@ -1370,7 +1370,7 @@ JS_ToggleLockouts(void)
{ {
short picnum; short picnum;
if (gs.ParentalLock) if (adult_lockout)
{ {
picnum = sector[i].ceilingpicnum; picnum = sector[i].ceilingpicnum;
ASSERT(aVoxelArray[picnum].Parental < INVISTILE); // Invalid, walls can't ASSERT(aVoxelArray[picnum].Parental < INVISTILE); // Invalid, walls can't
@ -1384,7 +1384,7 @@ JS_ToggleLockouts(void)
sector[i].ceilingpicnum = tp->orgpicnum; // Restore them sector[i].ceilingpicnum = tp->orgpicnum; // Restore them
if (gs.ParentalLock) if (adult_lockout)
{ {
picnum = sector[i].floorpicnum; picnum = sector[i].floorpicnum;
ASSERT(aVoxelArray[picnum].Parental < INVISTILE); // Invalid, walls can't ASSERT(aVoxelArray[picnum].Parental < INVISTILE); // Invalid, walls can't

View file

@ -181,7 +181,6 @@ static SWBOOL ApplyModeSettings(void)
videoSetGameMode(lastfs, lastx, lasty, lastbpp, upscalefactor); videoSetGameMode(lastfs, lastx, lasty, lastbpp, upscalefactor);
else else
{ {
extern int32_t ScreenMode,ScreenWidth,ScreenHeight,ScreenBPP; // Because I'm too lazy to include config.h
ScreenMode = newfs; ScreenMode = newfs;
ScreenWidth = newx; ScreenWidth = newx;
ScreenHeight = newy; ScreenHeight = newy;
@ -216,11 +215,10 @@ MenuGroup soundgroup = {110,5,"^Sound",sound_i,pic_optionstitl,0,m_defshade, NUL
MenuItem parental_i[] = MenuItem parental_i[] =
{ {
{DefButton(btn_parental, 0, "Kid Mode"), OPT_XS, OPT_LINE(0), 1, m_defshade, 0, NULL, NULL, NULL}, {DefButton(btn_parental, 0, "Kid Mode"), OPT_XS, OPT_LINE(0), 1, m_defshade, 0, NULL, NULL, NULL},
{DefOption(KEYSC_P, "Change Password"), OPT_XS, OPT_LINE(1), 1, m_defshade, 0, MNU_ParentalCustom, NULL, NULL},
{DefNone} {DefNone}
}; };
MenuGroup parentalgroup = {65, 5, "^Kid Mode", parental_i, pic_newgametitl, 0, m_defshade, MNU_DoParentalPassword,NULL,0}; MenuGroup parentalgroup = {65, 5, "^Kid Mode", parental_i, pic_newgametitl, 0, m_defshade, NULL,NULL,0};
MenuItem screen_i[] = MenuItem screen_i[] =
{ {
@ -610,128 +608,6 @@ MNU_DoEpisodeSelect(UserCall call, MenuItem *item)
return TRUE; return TRUE;
} }
SWBOOL
MNU_DoParentalPassword(UserCall call, MenuItem_p item)
{
short w,h;
static SWBOOL cur_show;
char TempString[80];
const char *extra_text;
extra_text = "This mode should remove most of the";
MNU_MeasureString(extra_text, &w, &h);
MNU_DrawString(TEXT_XCENTER(w), 60, extra_text, 1, 16);
extra_text = "offensive content. We still recommend";
MNU_MeasureString(extra_text, &w, &h);
MNU_DrawString(TEXT_XCENTER(w), 70, extra_text, 1, 16);
extra_text = "you review the game prior to play.";
MNU_MeasureString(extra_text, &w, &h);
MNU_DrawString(TEXT_XCENTER(w), 80, extra_text, 1, 16);
// get input
if (MenuInputMode)
{
switch (MNU_InputString(MessageInputString, 80))
{
case -1: // Cancel Input (pressed ESC) or Err
KB_ClearKeysDown();
KB_FlushKeyboardQueue();
MenuInputMode = FALSE;
memset(MessageInputString, '\0', sizeof(MessageInputString));
break;
case FALSE: // Input finished (RETURN)
if (MessageInputString[0] == '\0')
{
MenuInputMode = FALSE;
KB_ClearKeysDown();
KB_FlushKeyboardQueue();
memset(MessageInputString, '\0', sizeof(MessageInputString));
}
else
{
MenuInputMode = FALSE;
KB_ClearKeysDown();
KB_FlushKeyboardQueue();
if (gs.Password[0] != '\0' && passwordvalid == FALSE)
{
if (!Bstrcasecmp(gs.Password,MessageInputString))
{
passwordvalid = TRUE;
if (currentmenu->cursor == 0 && gs.ParentalLock == TRUE)
{
buttonsettings[btn_parental] = gs.ParentalLock = FALSE;
if (!InMenuLevel)
JS_ToggleLockouts();
}
if (currentmenu->cursor == 1) // Is it on the password line?
{
MenuInputMode = TRUE;
KB_ClearKeysDown();
KB_FlushKeyboardQueue();
}
//memset(gs.Password, '\0', sizeof(gs.Password));
}
}
else
{
if (currentmenu->cursor == 1) // Is it on the password line?
{
strcpy(gs.Password,MessageInputString);
passwordvalid = FALSE;
}
}
memset(MessageInputString, '\0', sizeof(MessageInputString));
}
break;
case TRUE: // Got input
break;
}
//CON_Message("Password = '%s'",gs.Password);
//CON_Message("Passwordvalid = %d",passwordvalid);
if (gs.Password[0] != '\0' && passwordvalid == FALSE && currentmenu->cursor == 1)
{
sprintf(TempString,"Enter Old Password");
MNU_MeasureString(TempString, &w, &h);
MNU_DrawString(TEXT_XCENTER(w), MESSAGE_LINE-10, TempString,1,16);
}
else if (passwordvalid == TRUE && currentmenu->cursor == 1)
{
sprintf(TempString,"Enter New Password");
MNU_MeasureString(TempString, &w, &h);
MNU_DrawString(TEXT_XCENTER(w), MESSAGE_LINE-10, TempString,1,16);
}
else
{
sprintf(TempString,"Enter Password");
MNU_MeasureString(TempString, &w, &h);
MNU_DrawString(TEXT_XCENTER(w), MESSAGE_LINE-10, TempString,1,16);
}
MNU_MeasureString(MessageInputString, &w, &h);
cur_show ^= 1;
if (cur_show)
{
MNU_DrawString(TEXT_XCENTER(w), MESSAGE_LINE, MessageInputString,1,16);
rotatesprite((TEXT_XCENTER(w)+w+7)<<16,(MESSAGE_LINE+3)<<16,64<<9,0,COINCURSOR+(((int32_t) totalclock>>3)%7),0,0,MenuDrawFlags,0,0,xdim-1,ydim-1);
}
else
{
MNU_DrawString(TEXT_XCENTER(w), MESSAGE_LINE, MessageInputString,1,16);
rotatesprite((TEXT_XCENTER(w)+w+7)<<16,(MESSAGE_LINE+3)<<16,64<<9,0,COINCURSOR+(((int32_t) totalclock>>3)%7),0,0,MenuDrawFlags,0,0,xdim-1,ydim-1);
}
}
return TRUE;
}
SWBOOL SWBOOL
MNU_ParentalCustom(void) MNU_ParentalCustom(void)
{ {
@ -2214,7 +2090,7 @@ MNU_InitMenus(void)
slidersettings[sldr_sndfxvolume] = gs.SoundVolume / (FX_VOL_MAX_VALUE/SLDR_SNDFXVOLMAX); slidersettings[sldr_sndfxvolume] = gs.SoundVolume / (FX_VOL_MAX_VALUE/SLDR_SNDFXVOLMAX);
slidersettings[sldr_musicvolume] = mus_volume / (MUSIC_VOL_MAX_VALUE/SLDR_MUSICVOLMAX); slidersettings[sldr_musicvolume] = mus_volume / (MUSIC_VOL_MAX_VALUE/SLDR_MUSICVOLMAX);
slidersettings[sldr_scrsize] = gs.BorderNum; slidersettings[sldr_scrsize] = gs.BorderNum;
slidersettings[sldr_brightness] = gs.Brightness; slidersettings[sldr_brightness] = 10;
slidersettings[sldr_bordertile] = gs.BorderTile; slidersettings[sldr_bordertile] = gs.BorderTile;
{ {
@ -2249,7 +2125,7 @@ MNU_InitMenus(void)
buttonsettings[btn_voxels] = gs.Voxels; buttonsettings[btn_voxels] = gs.Voxels;
buttonsettings[btn_ambience] = snd_ambience; buttonsettings[btn_ambience] = snd_ambience;
buttonsettings[btn_playcd] = gs.PlayCD; buttonsettings[btn_playcd] = true;// gs.PlayCD;
buttonsettings[btn_flipstereo] = snd_reversestereo; buttonsettings[btn_flipstereo] = snd_reversestereo;
buttonsettings[btn_stats] = gs.Stats; buttonsettings[btn_stats] = gs.Stats;
@ -2264,7 +2140,7 @@ MNU_InitMenus(void)
buttonsettings[btn_markers] = gs.NetSpawnMarkers; buttonsettings[btn_markers] = gs.NetSpawnMarkers;
buttonsettings[btn_teamplay] = gs.NetTeamPlay; buttonsettings[btn_teamplay] = gs.NetTeamPlay;
buttonsettings[btn_friendlyfire] = gs.NetHurtTeammate; buttonsettings[btn_friendlyfire] = gs.NetHurtTeammate;
buttonsettings[btn_parental] = gs.ParentalLock; buttonsettings[btn_parental] = adult_lockout;
//slidersettings[sldr_mousescalex] = MouseAnalogScale[0]>>13; //slidersettings[sldr_mousescalex] = MouseAnalogScale[0]>>13;
//slidersettings[sldr_mousescaley] = MouseAnalogScale[1]>>13; //slidersettings[sldr_mousescaley] = MouseAnalogScale[1]>>13;
@ -3450,8 +3326,8 @@ MNU_DoButton(MenuItem_p item, SWBOOL draw)
snd_speech = state = buttonsettings[item->button]; snd_speech = state = buttonsettings[item->button];
break; break;
case btn_playcd: case btn_playcd:
last_value = gs.PlayCD; last_value = true;
gs.PlayCD = state = buttonsettings[item->button]; state = buttonsettings[item->button];
break; break;
case btn_ambience: case btn_ambience:
last_value = snd_ambience; last_value = snd_ambience;
@ -3476,29 +3352,9 @@ MNU_DoButton(MenuItem_p item, SWBOOL draw)
break; break;
case btn_parental: case btn_parental:
if (gs.Password[0] != '\0' && gs.ParentalLock == TRUE) state = buttonsettings[btn_parental] = adult_lockout = FALSE;
{
if (passwordvalid)
{
state = buttonsettings[btn_parental] = gs.ParentalLock = FALSE;
if (!InMenuLevel) if (!InMenuLevel)
JS_ToggleLockouts(); JS_ToggleLockouts();
}
else
{
state = buttonsettings[btn_parental] = gs.ParentalLock = TRUE;
MenuInputMode = TRUE;
memset(MessageInputString, '\0', sizeof(MessageInputString));
KB_ClearKeysDown();
KB_FlushKeyboardQueue();
}
}
else
{
gs.ParentalLock = state = buttonsettings[item->button];
if (!InMenuLevel)
JS_ToggleLockouts();
}
break; break;
case btn_videofs: case btn_videofs:
@ -3705,11 +3561,6 @@ MNU_DoSlider(short dir, MenuItem_p item, SWBOOL draw)
offset = min(offset, short(SLDR_BRIGHTNESSMAX - 1)); offset = min(offset, short(SLDR_BRIGHTNESSMAX - 1));
slidersettings[sldr_brightness] = offset; slidersettings[sldr_brightness] = offset;
if (gs.Brightness != offset)
{
gs.Brightness = offset;
COVERsetbrightness(gs.Brightness,&palette_data[0][0]);
}
break; break;
case sldr_bordertile: case sldr_bordertile:
@ -5047,9 +4898,6 @@ SetFadeAmt(PLAYERp pp, short damage, unsigned char startcolor)
// Reset the palette // Reset the palette
if (pp == Player + screenpeek) if (pp == Player + screenpeek)
{ {
if (videoGetRenderMode() < REND_POLYMOST)
COVERsetbrightness(gs.Brightness,&palette_data[0][0]);
else
videoFadePalette(0,0,0,0); videoFadePalette(0,0,0,0);
if (pp->FadeAmt <= 0) if (pp->FadeAmt <= 0)
GetPaletteFromVESA(&ppalette[screenpeek][0]); GetPaletteFromVESA(&ppalette[screenpeek][0]);
@ -5164,9 +5012,6 @@ DoPaletteFlash(PLAYERp pp)
pp->StartColor = 0; pp->StartColor = 0;
if (pp == Player + screenpeek) if (pp == Player + screenpeek)
{ {
if (videoGetRenderMode() < REND_POLYMOST)
COVERsetbrightness(gs.Brightness,&palette_data[0][0]);
else
videoFadePalette(0,0,0,0); videoFadePalette(0,0,0,0);
memcpy(pp->temp_pal, palette_data, sizeof(palette_data)); memcpy(pp->temp_pal, palette_data, sizeof(palette_data));
DoPlayerDivePalette(pp); // Check Dive again DoPlayerDivePalette(pp); // Check Dive again
@ -5203,9 +5048,6 @@ DoPaletteFlash(PLAYERp pp)
pp->StartColor = 0; pp->StartColor = 0;
if (pp == Player + screenpeek) if (pp == Player + screenpeek)
{ {
if (videoGetRenderMode() < REND_POLYMOST)
COVERsetbrightness(gs.Brightness,&palette_data[0][0]);
else
videoFadePalette(0,0,0,0); videoFadePalette(0,0,0,0);
memcpy(pp->temp_pal, palette_data, sizeof(palette_data)); memcpy(pp->temp_pal, palette_data, sizeof(palette_data));
DoPlayerDivePalette(pp); // Check Dive again DoPlayerDivePalette(pp); // Check Dive again
@ -5257,9 +5099,6 @@ DoPaletteFlash(PLAYERp pp)
void ResetPalette(PLAYERp pp) void ResetPalette(PLAYERp pp)
{ {
if (videoGetRenderMode() < REND_POLYMOST)
COVERsetbrightness(gs.Brightness,&palette_data[0][0]);
else
videoFadePalette(0,0,0,0); videoFadePalette(0,0,0,0);
memcpy(pp->temp_pal, palette_data, sizeof(palette_data)); memcpy(pp->temp_pal, palette_data, sizeof(palette_data));
//DoPlayerDivePalette(pp); // Check Dive again //DoPlayerDivePalette(pp); // Check Dive again

View file

@ -284,7 +284,6 @@ typedef struct MenuGroup
SWBOOL MNU_QuitCustom(UserCall call, MenuItem *item); SWBOOL MNU_QuitCustom(UserCall call, MenuItem *item);
SWBOOL MNU_QuickLoadCustom(UserCall call, MenuItem *item); SWBOOL MNU_QuickLoadCustom(UserCall call, MenuItem *item);
SWBOOL MNU_LoadSaveTouchupCustom(UserCall call, MenuItem *item); SWBOOL MNU_LoadSaveTouchupCustom(UserCall call, MenuItem *item);
SWBOOL MNU_DoParentalPassword(UserCall call, MenuItem *item);
SWBOOL MNU_OrderCustom(UserCall call, MenuItem *item); SWBOOL MNU_OrderCustom(UserCall call, MenuItem *item);
SWBOOL MNU_DoEpisodeSelect(UserCall call, MenuItem *item); SWBOOL MNU_DoEpisodeSelect(UserCall call, MenuItem *item);

View file

@ -2336,9 +2336,6 @@ PlayerGameReset(PLAYERp pp)
if (pp == Player+screenpeek) if (pp == Player+screenpeek)
{ {
if (videoGetRenderMode() < REND_POLYMOST)
COVERsetbrightness(gs.Brightness,&palette_data[0][0]);
else
videoFadePalette(0,0,0,0); videoFadePalette(0,0,0,0);
memcpy(pp->temp_pal, palette_data, sizeof(palette_data)); memcpy(pp->temp_pal, palette_data, sizeof(palette_data));
} }
@ -2440,9 +2437,6 @@ InitPlayerSprite(PLAYERp pp)
if (pp == Player+screenpeek) if (pp == Player+screenpeek)
{ {
if (videoGetRenderMode() < REND_POLYMOST)
COVERsetbrightness(gs.Brightness,&palette_data[0][0]);
else
videoFadePalette(0,0,0,0); videoFadePalette(0,0,0,0);
memcpy(pp->temp_pal, palette_data, sizeof(palette_data)); memcpy(pp->temp_pal, palette_data, sizeof(palette_data));
} }

View file

@ -7419,7 +7419,7 @@ pDisplaySprites(PLAYERp pp)
break; break;
} }
if (pp->Bloody && !gs.ParentalLock && !Global_PLock) if (pp->Bloody && !adult_lockout && !Global_PLock)
{ {
switch (picnum) switch (picnum)
{ {

View file

@ -5056,9 +5056,6 @@ DoPlayerDivePalette(PLAYERp pp)
{ {
memcpy(pp->temp_pal, palette_data, sizeof(palette_data)); memcpy(pp->temp_pal, palette_data, sizeof(palette_data));
memcpy(palookup[PALETTE_DEFAULT], DefaultPalette, 256 * 32); memcpy(palookup[PALETTE_DEFAULT], DefaultPalette, 256 * 32);
if (videoGetRenderMode() < REND_POLYMOST)
COVERsetbrightness(gs.Brightness, &palette_data[0][0]);
else
videoFadePalette(0,0,0,0); videoFadePalette(0,0,0,0);
pp->FadeAmt = 0; pp->FadeAmt = 0;
} }
@ -6911,9 +6908,6 @@ void DoPlayerDeathCheckKeys(PLAYERp pp)
if (pp == Player + screenpeek) if (pp == Player + screenpeek)
{ {
if (videoGetRenderMode() < REND_POLYMOST)
COVERsetbrightness(gs.Brightness,&palette_data[0][0]);
else
videoFadePalette(0,0,0,0); videoFadePalette(0,0,0,0);
//memcpy(&palette_data[0][0],&palette_data[0][0],768); //memcpy(&palette_data[0][0],&palette_data[0][0],768);
memcpy(&pp->temp_pal[0],&palette_data[0][0],768); memcpy(&pp->temp_pal[0],&palette_data[0][0],768);

View file

@ -1170,8 +1170,6 @@ int LoadGame(short save_num)
MREAD(&gs,sizeof(gs),1,fil); MREAD(&gs,sizeof(gs),1,fil);
//COVERsetbrightness(gs.Brightness,(char *)palette_data);
for (int i = 0; i < MAXTILES; i++) for (int i = 0; i < MAXTILES; i++)
{ {
MREAD(&picanm[i], sizeof(picanm[i]), 1, fil); MREAD(&picanm[i], sizeof(picanm[i]), 1, fil);
@ -1273,7 +1271,7 @@ int LoadGame(short save_num)
SetupAspectRatio(); SetupAspectRatio();
SetRedrawScreen(Player + myconnectindex); SetRedrawScreen(Player + myconnectindex);
COVERsetbrightness(gs.Brightness,&palette_data[0][0]); COVERsetbrightness(0,&palette_data[0][0]);
screenpeek = myconnectindex; screenpeek = myconnectindex;
PlayingLevel = Level; PlayingLevel = Level;

View file

@ -35,7 +35,6 @@ typedef struct
int mus_volume; int mus_volume;
int SoundVolume; int SoundVolume;
int8_t BorderNum; int8_t BorderNum;
int8_t Brightness;
int8_t BorderTile; int8_t BorderTile;
SWBOOL MouseAimingType; SWBOOL MouseAimingType;
SWBOOL MouseLook; SWBOOL MouseLook;
@ -57,13 +56,11 @@ typedef struct
uint8_t NetKillLimit; // Number of frags at which game ends uint8_t NetKillLimit; // Number of frags at which game ends
uint8_t NetTimeLimit; // Limit time of game uint8_t NetTimeLimit; // Limit time of game
uint8_t NetColor; // Chosen color for player uint8_t NetColor; // Chosen color for player
uint8_t ParentalLock; // Parental Lock on/off
char Password[20]; // Parental Lock password
SWBOOL NetNuke; SWBOOL NetNuke;
SWBOOL Voxels; SWBOOL Voxels;
SWBOOL Stats; SWBOOL Stats;
SWBOOL MouseAimingOn; // whether it was on or off - NOT the type of mouse aiming SWBOOL MouseAimingOn; // whether it was on or off - NOT the type of mouse aiming
SWBOOL PlayCD; //SWBOOL PlayCD; // Not implemented and no idea how to support it without the music assets.
char WaveformTrackName[MAXWAVEFORMTRACKLENGTH]; char WaveformTrackName[MAXWAVEFORMTRACKLENGTH];
} GAME_SET, *GAME_SETp; } GAME_SET, *GAME_SETp;

View file

@ -446,7 +446,7 @@ PlaySong(char *song_file_name, int cdaudio_track, SWBOOL loop, SWBOOL restart)
if (!SW_SHAREWARE) if (!SW_SHAREWARE)
{ {
if (cdaudio_track >= 0) if (cdaudio_track >= 0 && mus_redbook)
{ {
char waveformtrack[MAXWAVEFORMTRACKLENGTH]; char waveformtrack[MAXWAVEFORMTRACKLENGTH];
Bstrncpy(waveformtrack, gs.WaveformTrackName, MAXWAVEFORMTRACKLENGTH - 1); Bstrncpy(waveformtrack, gs.WaveformTrackName, MAXWAVEFORMTRACKLENGTH - 1);
@ -805,7 +805,7 @@ PlaySound(int num, int *x, int *y, int *z, Voc3D_Flags flags)
//if (UsingMenus && (*x!=0 || *y!=0 || *z!=0)) return(-1); //if (UsingMenus && (*x!=0 || *y!=0 || *z!=0)) return(-1);
// Weed out parental lock sounds if PLock is active // Weed out parental lock sounds if PLock is active
if (gs.ParentalLock || Global_PLock) if (adult_lockout || Global_PLock)
{ {
unsigned i; unsigned i;

View file

@ -5788,7 +5788,7 @@ KeyMain:
// Say something witty // Say something witty
if (pp == Player+myconnectindex && gs.Messages) if (pp == Player+myconnectindex && gs.Messages)
{ {
if (gs.ParentalLock || Global_PLock) if (adult_lockout || Global_PLock)
sprintf(ds,"Fortune Say: %s\n",ReadFortune[STD_RANDOM_RANGE(10)]); sprintf(ds,"Fortune Say: %s\n",ReadFortune[STD_RANDOM_RANGE(10)]);
else else
sprintf(ds,"Fortune Say: %s\n",ReadFortune[STD_RANDOM_RANGE(MAX_FORTUNES)]); sprintf(ds,"Fortune Say: %s\n",ReadFortune[STD_RANDOM_RANGE(MAX_FORTUNES)]);

View file

@ -113,18 +113,6 @@ void ReadGameSetup(int32_t scripthandle)
int dummy; int dummy;
int ret; int ret;
SCRIPT_GetString(scripthandle, "Options","Rooster",gs.Password);
DecodePassword(gs.Password);
// option stuff
dummy = -1;
ret = SCRIPT_GetNumber(scripthandle, "Options", "BorderNum",&dummy);
if (dummy != -1) gs.BorderNum = dummy;
dummy = -1;
SCRIPT_GetNumber(scripthandle, "Options", "Brightness",&dummy);
if (dummy != -1) gs.Brightness = dummy;
dummy = -1; dummy = -1;
SCRIPT_GetNumber(scripthandle, "Options", "BorderTile",&dummy); SCRIPT_GetNumber(scripthandle, "Options", "BorderTile",&dummy);
if (dummy != -1) gs.BorderTile = dummy; if (dummy != -1) gs.BorderTile = dummy;
@ -149,10 +137,6 @@ void ReadGameSetup(int32_t scripthandle)
SCRIPT_GetNumber(scripthandle, "Options", "Crosshair",&dummy); SCRIPT_GetNumber(scripthandle, "Options", "Crosshair",&dummy);
if (dummy != -1) gs.Crosshair = dummy; if (dummy != -1) gs.Crosshair = dummy;
dummy = -1;
SCRIPT_GetNumber(scripthandle, "Options", "AutoAim",&dummy);
if (dummy != -1) cl_autoaim = dummy;
dummy = -1; dummy = -1;
SCRIPT_GetNumber(scripthandle, "Options", "Messages",&dummy); SCRIPT_GetNumber(scripthandle, "Options", "Messages",&dummy);
if (dummy != -1) gs.Messages = dummy; if (dummy != -1) gs.Messages = dummy;
@ -213,32 +197,6 @@ void ReadGameSetup(int32_t scripthandle)
SCRIPT_GetNumber(scripthandle, "Options", "MouseInvert",&dummy); SCRIPT_GetNumber(scripthandle, "Options", "MouseInvert",&dummy);
if (dummy != -1) gs.MouseInvert = dummy; if (dummy != -1) gs.MouseInvert = dummy;
dummy = -1;
SCRIPT_GetNumber(scripthandle, "Options", "Kiwi",&dummy);
if (dummy != -1) gs.ParentalLock = dummy;
dummy = -1;
SCRIPT_GetNumber(scripthandle, "Options", "PlayCD",&dummy);
if (dummy != -1) gs.PlayCD = dummy;
dummy = -1;
SCRIPT_GetNumber(scripthandle, "Options", "CDDevice",&dummy);
if (dummy < 0) dummy = -1;
if (SW_SHAREWARE)
{
dummy = -1;
SCRIPT_GetNumber(scripthandle, "Options", "Chickens",&dummy);
if (dummy != -1) GamePlays = dummy;
buildprintf(
"\n"
"You have played Shadow Warrior %d times. Please call and order the full\n"
"version at 1(800)-3DREALMS or see the ORDER.FRM file.\n\n"
,GamePlays);
GamePlays++;
}
} }
/* /*
@ -251,72 +209,6 @@ void ReadGameSetup(int32_t scripthandle)
void WriteGameSetup(int32_t scripthandle) void WriteGameSetup(int32_t scripthandle)
{ {
int dummy;
dummy = gs.BorderNum;
SCRIPT_PutNumber(scripthandle, "Options", "BorderNum",dummy,FALSE,FALSE);
dummy = gs.Brightness;
SCRIPT_PutNumber(scripthandle, "Options", "Brightness",dummy,FALSE,FALSE);
dummy = gs.BorderTile;
SCRIPT_PutNumber(scripthandle, "Options", "BorderTile",dummy,FALSE,FALSE);
dummy = gs.Bobbing;
SCRIPT_PutNumber(scripthandle, "Options", "Bobbing",dummy,FALSE,FALSE);
dummy = gs.Tilting;
SCRIPT_PutNumber(scripthandle, "Options", "Tilting",dummy,FALSE,FALSE);
dummy = gs.Shadows;
SCRIPT_PutNumber(scripthandle, "Options", "Shadows",dummy,FALSE,FALSE);
dummy = gs.AutoRun;
SCRIPT_PutNumber(scripthandle, "Options", "AutoRun",dummy,FALSE,FALSE);
dummy = gs.Crosshair;
SCRIPT_PutNumber(scripthandle, "Options", "Crosshair",dummy,FALSE,FALSE);
dummy = gs.Messages;
SCRIPT_PutNumber(scripthandle, "Options", "Messages",dummy,FALSE,FALSE);
dummy = gs.MouseAimingType;
SCRIPT_PutNumber(scripthandle, "Controls", "MouseAiming",dummy,FALSE,FALSE);
dummy = gs.NetGameType;
SCRIPT_PutNumber(scripthandle, "Options", "NetGameType",dummy,FALSE,FALSE);
dummy = gs.NetLevel;
SCRIPT_PutNumber(scripthandle, "Options", "NetLevel",dummy,FALSE,FALSE);
dummy = gs.NetMonsters;
SCRIPT_PutNumber(scripthandle, "Options", "NetMonsters",dummy,FALSE,FALSE);
dummy = gs.NetHurtTeammate;
SCRIPT_PutNumber(scripthandle, "Options", "NetHurtTeammate",dummy,FALSE,FALSE);
dummy = gs.NetSpawnMarkers;
SCRIPT_PutNumber(scripthandle, "Options", "NetSpawnMarkers",dummy,FALSE,FALSE);
dummy = gs.NetTeamPlay;
SCRIPT_PutNumber(scripthandle, "Options", "NetTeamPlay",dummy,FALSE,FALSE);
dummy = gs.NetKillLimit;
SCRIPT_PutNumber(scripthandle, "Options", "NetKillLimit",dummy,FALSE,FALSE);
dummy = gs.NetTimeLimit;
SCRIPT_PutNumber(scripthandle, "Options", "NetTimeLimit",dummy,FALSE,FALSE);
dummy = gs.NetColor;
SCRIPT_PutNumber(scripthandle, "Options", "NetColor",dummy,FALSE,FALSE);
dummy = gs.Voxels;
SCRIPT_PutNumber(scripthandle, "Options", "Voxels",dummy,FALSE,FALSE);
dummy = gs.MouseAimingOn;
SCRIPT_PutNumber(scripthandle, "Options", "MouseAimingOn",dummy,FALSE,FALSE);
dummy = gs.MouseInvert;
SCRIPT_PutNumber(scripthandle, "Options", "MouseInvert",dummy,FALSE,FALSE);
dummy = gs.Stats;
SCRIPT_PutNumber(scripthandle, "Options", "Stats",dummy,FALSE,FALSE);
EncodePassword(gs.Password);
SCRIPT_PutString(scripthandle, "Options","Rooster",gs.Password);
DecodePassword(gs.Password);
dummy = gs.ParentalLock;
SCRIPT_PutNumber(scripthandle, "Options", "Kiwi",dummy,FALSE,FALSE);
dummy = gs.PlayCD;
SCRIPT_PutNumber(scripthandle, "Options", "PlayCD",dummy,FALSE,FALSE);
SCRIPT_PutNumber(scripthandle, "Options", "CDDevice",0,FALSE,FALSE);
if (SW_SHAREWARE)
{
dummy = GamePlays;
SCRIPT_PutNumber(scripthandle, "Options", "Chickens",dummy,FALSE,FALSE);
}
} }
void TermSetup(void) void TermSetup(void)