From b411c3b205e60c8ec563f970796b53ea5b0d5043 Mon Sep 17 00:00:00 2001 From: terminx Date: Wed, 20 Aug 2008 08:39:07 +0000 Subject: [PATCH] Force startup window to be displayed if the cfg wasn't saved with an EDuke32 build of matching BYTEVERSION_JF, and use a wrapper around kopen4load to access files from mod_dir first. git-svn-id: https://svn.eduke32.com/eduke32@992 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/config.c | 13 +++++-- polymer/eduke32/source/duke3d.h | 1 + polymer/eduke32/source/funct.h | 2 +- polymer/eduke32/source/game.c | 53 +++++++++++++++++++++----- polymer/eduke32/source/gamedef.c | 6 +-- polymer/eduke32/source/osdcmds.c | 4 +- polymer/eduke32/source/premap.c | 4 +- polymer/eduke32/source/rts.c | 2 +- polymer/eduke32/source/sounds.c | 6 +-- polymer/eduke32/source/startwin.game.c | 3 -- 10 files changed, 65 insertions(+), 29 deletions(-) diff --git a/polymer/eduke32/source/config.c b/polymer/eduke32/source/config.c index 822f3b24b..6e84d2787 100644 --- a/polymer/eduke32/source/config.c +++ b/polymer/eduke32/source/config.c @@ -256,6 +256,7 @@ void CONFIG_SetDefaults(void) ud.config.UseMouse = 1; ud.config.VoiceToggle = 5; // bitfield, 1 = local, 2 = dummy, 4 = other players in DM ud.display_bonus_screen = 1; + ud.configversion = 0; Bstrcpy(ud.rtsname, "DUKE.RTS"); Bstrcpy(myname, "Duke"); @@ -648,11 +649,11 @@ int32 CONFIG_ReadSetup(void) { extern char defaultduke3dgrp[BMAX_PATH]; if (!Bstrcmp(defaultduke3dgrp,"duke3d.grp")) - SCRIPT_GetString(ud.config.scripthandle, "Misc","SelectedGRP",&duke3dgrp[0]); + SCRIPT_GetString(ud.config.scripthandle, "Setup","SelectedGRP",&duke3dgrp[0]); } if (mod_dir[0] == '/') - SCRIPT_GetString(ud.config.scripthandle, "Misc","ModDir",&mod_dir[0]); + SCRIPT_GetString(ud.config.scripthandle, "Setup","ModDir",&mod_dir[0]); SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "Shadows",&ud.shadows); @@ -785,6 +786,8 @@ int32 CONFIG_ReadSetup(void) if (dummy >= 0) g_player[0].wchoice[i] = dummy; } + SCRIPT_GetNumber(ud.config.scripthandle, "Setup","ConfigVersion",&ud.configversion); + SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "FXDevice",&ud.config.FXDevice); SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "MusicDevice",&ud.config.MusicDevice); SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "FXVolume",&ud.config.FXVolume); @@ -1051,6 +1054,8 @@ void CONFIG_WriteSetup(void) SCRIPT_PutNumber(ud.config.scripthandle, "Misc",buf,g_player[myconnectindex].wchoice[dummy],false,false); } + SCRIPT_PutNumber(ud.config.scripthandle, "Setup","ConfigVersion",BYTEVERSION_JF,false,false); + for (dummy=0;dummynumparms != 1) return OSDCMD_SHOWHELP; - if ((i = kopen4load((char *)parm->parms[0],0)) < 0) + if ((i = kopen4loadfrommod((char *)parm->parms[0],0)) < 0) { OSD_Printf("fileinfo: File \"%s\" not found.\n", parm->parms[0]); return OSDCMD_OK; diff --git a/polymer/eduke32/source/premap.c b/polymer/eduke32/source/premap.c index 9ccf76573..ffd386198 100644 --- a/polymer/eduke32/source/premap.c +++ b/polymer/eduke32/source/premap.c @@ -284,8 +284,8 @@ static int getsound(unsigned int num) if (ud.config.FXDevice < 0) return 0; if (!g_sounds[num].filename) return 0; - if (g_sounds[num].filename1)fp = kopen4load(g_sounds[num].filename1,loadfromgrouponly); - if (fp == -1)fp = kopen4load(g_sounds[num].filename,loadfromgrouponly); + if (g_sounds[num].filename1)fp = kopen4loadfrommod(g_sounds[num].filename1,loadfromgrouponly); + if (fp == -1)fp = kopen4loadfrommod(g_sounds[num].filename,loadfromgrouponly); if (fp == -1) return 0; l = kfilelength(fp); diff --git a/polymer/eduke32/source/rts.c b/polymer/eduke32/source/rts.c index c46f0f6e6..5b373eea4 100644 --- a/polymer/eduke32/source/rts.c +++ b/polymer/eduke32/source/rts.c @@ -68,7 +68,7 @@ int32 RTS_AddFile(const char *filename) // read the entire file in // FIXME: shared opens - handle = kopen4load((char *)filename, 0); + handle = kopen4loadfrommod((char *)filename, 0); if (handle < 0) { initprintf("RTS file %s was not found\n",filename); diff --git a/polymer/eduke32/source/sounds.c b/polymer/eduke32/source/sounds.c index fbb8063d6..821acc3dd 100644 --- a/polymer/eduke32/source/sounds.c +++ b/polymer/eduke32/source/sounds.c @@ -206,7 +206,7 @@ void _playmusic(const char *fn) if (ud.config.MusicToggle == 0) return; if (ud.config.MusicDevice < 0) return; #if defined(_WIN32) - fp = kopen4load((char *)fn,0); + fp = kopen4loadfrommod((char *)fn,0); if (fp == -1) return; @@ -254,8 +254,8 @@ int loadsound(unsigned int num) return 0; } - if (g_sounds[num].filename1)fp = kopen4load(g_sounds[num].filename1,loadfromgrouponly); - if (fp == -1)fp = kopen4load(g_sounds[num].filename,loadfromgrouponly); + if (g_sounds[num].filename1)fp = kopen4loadfrommod(g_sounds[num].filename1,loadfromgrouponly); + if (fp == -1)fp = kopen4loadfrommod(g_sounds[num].filename,loadfromgrouponly); if (fp == -1) { // Bsprintf(fta_quotes[113],"g_sounds %s(#%d) not found.",sounds[num],num); diff --git a/polymer/eduke32/source/startwin.game.c b/polymer/eduke32/source/startwin.game.c index c1befeaa8..8bf1902b3 100644 --- a/polymer/eduke32/source/startwin.game.c +++ b/polymer/eduke32/source/startwin.game.c @@ -663,10 +663,7 @@ int startwin_run(void) g_GameType = settings.game; if (settings.gamedir != NULL) - { - addsearchpath(settings.gamedir); Bstrcpy(mod_dir,settings.gamedir); - } else Bsprintf(mod_dir,"/"); for (i = 0; i