mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-16 01:11:44 +00:00
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
This commit is contained in:
parent
78f205f1a9
commit
b411c3b205
10 changed files with 65 additions and 29 deletions
|
@ -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;dummy<MAXMOUSEBUTTONS;dummy++)
|
||||
{
|
||||
Bsprintf(buf,"MouseButton%d",dummy);
|
||||
|
@ -1114,8 +1119,8 @@ void CONFIG_WriteSetup(void)
|
|||
SCRIPT_PutNumber(ud.config.scripthandle, "Comm Setup", "Rate", packetrate, false, false);
|
||||
|
||||
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Misc","SelectedGRP",&duke3dgrp[0]);
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Misc","ModDir",&mod_dir[0]);
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Setup","SelectedGRP",&duke3dgrp[0]);
|
||||
SCRIPT_PutString(ud.config.scripthandle, "Setup","ModDir",&mod_dir[0]);
|
||||
{
|
||||
char commmacro[] = "CommbatMacro# ";
|
||||
|
||||
|
|
|
@ -414,6 +414,7 @@ typedef struct {
|
|||
int player_skill,level_number,volume_number,m_marker,marker,mouseflip;
|
||||
|
||||
int camerax,cameray,cameraz;
|
||||
int configversion;
|
||||
|
||||
short cameraang, camerasect, camerahoriz;
|
||||
short pause_on,from_bonus;
|
||||
|
|
|
@ -257,5 +257,5 @@ extern void getlevelfromfilename(const char *fn, char *volume, char *level);
|
|||
|
||||
extern void GetCrosshairColor(void);
|
||||
extern void SetCrosshairColor(int r, int g, int b);
|
||||
|
||||
extern int kopen4loadfrommod(char *filename, char searchfirst);
|
||||
#endif // __funct_h__
|
||||
|
|
|
@ -151,6 +151,20 @@ int althud_numberpal = 0;
|
|||
int althud_shadows = 1;
|
||||
int althud_flashing = 1;
|
||||
|
||||
int kopen4loadfrommod(char *filename, char searchfirst)
|
||||
{
|
||||
static char fn[BMAX_PATH];
|
||||
int r;
|
||||
|
||||
Bstrcpy(fn,mod_dir);
|
||||
Bstrcat(fn,"/");
|
||||
Bstrcat(fn,filename);
|
||||
r = kopen4load(fn,searchfirst);
|
||||
if (r == -1)
|
||||
r = kopen4load(filename,searchfirst);
|
||||
return r;
|
||||
}
|
||||
|
||||
enum
|
||||
{
|
||||
T_EOF = -2,
|
||||
|
@ -909,7 +923,7 @@ void getpackets(void)
|
|||
Bcorrectfilename(boardfilename,0);
|
||||
if (boardfilename[0] != 0)
|
||||
{
|
||||
if ((i = kopen4load(boardfilename,0)) < 0)
|
||||
if ((i = kopen4loadfrommod(boardfilename,0)) < 0)
|
||||
{
|
||||
Bmemset(boardfilename,0,sizeof(boardfilename));
|
||||
sendboardname();
|
||||
|
@ -10026,7 +10040,7 @@ static void compilecons(void)
|
|||
pathsearchmode = 1;
|
||||
if (userconfiles == 0)
|
||||
{
|
||||
i = kopen4load(confilename,0);
|
||||
i = kopen4loadfrommod(confilename,0);
|
||||
if (i!=-1)
|
||||
kclose(i);
|
||||
else Bsprintf(confilename,"GAME.CON");
|
||||
|
@ -10037,7 +10051,7 @@ static void compilecons(void)
|
|||
{
|
||||
if (userconfiles == 0)
|
||||
{
|
||||
i = kopen4load("EDUKE.CON",1);
|
||||
i = kopen4loadfrommod("EDUKE.CON",1);
|
||||
if (i!=-1)
|
||||
{
|
||||
Bsprintf(confilename,"EDUKE.CON");
|
||||
|
@ -10097,7 +10111,7 @@ static void genspriteremaps(void)
|
|||
signed char look_pos;
|
||||
char *lookfn = "lookup.dat";
|
||||
|
||||
fp = kopen4load(lookfn,0);
|
||||
fp = kopen4loadfrommod(lookfn,0);
|
||||
if (fp != -1)
|
||||
kread(fp,(char *)&g_NumPalettes,1);
|
||||
else
|
||||
|
@ -10194,7 +10208,7 @@ static void Startup(void)
|
|||
|
||||
Bcorrectfilename(boardfilename,0);
|
||||
|
||||
i = kopen4load(boardfilename,0);
|
||||
i = kopen4loadfrommod(boardfilename,0);
|
||||
if (i!=-1)
|
||||
{
|
||||
initprintf("Using level: '%s'.\n",boardfilename);
|
||||
|
@ -10270,8 +10284,24 @@ static void Startup(void)
|
|||
|
||||
//initprintf("* Hold Esc to Abort. *\n");
|
||||
// initprintf("Loading art header...\n");
|
||||
|
||||
{
|
||||
char cwd[BMAX_PATH];
|
||||
|
||||
if (getcwd(cwd,BMAX_PATH) && mod_dir[0] != '/')
|
||||
{
|
||||
chdir(mod_dir);
|
||||
if (loadpics("tiles000.art",MAXCACHE1DSIZE) < 0)
|
||||
{
|
||||
chdir(cwd);
|
||||
if (loadpics("tiles000.art",MAXCACHE1DSIZE) < 0)
|
||||
gameexit("Failed loading art.");
|
||||
}
|
||||
chdir(cwd);
|
||||
}
|
||||
else if (loadpics("tiles000.art",MAXCACHE1DSIZE) < 0)
|
||||
gameexit("Failed loading art.");
|
||||
}
|
||||
|
||||
// initprintf("Loading palette/lookups...\n");
|
||||
genspriteremaps();
|
||||
|
@ -10716,7 +10746,7 @@ void app_main(int argc,const char **argv)
|
|||
}
|
||||
|
||||
#if (defined RENDERTYPEWIN || (defined RENDERTYPESDL && !defined __APPLE__ && defined HAVE_GTK2))
|
||||
if (i < 0 || (!g_NoSetup && ud.config.ForceSetup) || g_CommandSetup)
|
||||
if (i < 0 || (!g_NoSetup && (ud.configversion != BYTEVERSION_JF || ud.config.ForceSetup)) || g_CommandSetup)
|
||||
{
|
||||
if (quitevent || !startwin_run())
|
||||
{
|
||||
|
@ -10747,6 +10777,9 @@ void app_main(int argc,const char **argv)
|
|||
Bsprintf(gametype_names[2],"GRUNTMATCH (NO SPAWN)");
|
||||
}
|
||||
|
||||
if (mod_dir[0] != '/')
|
||||
addsearchpath(mod_dir);
|
||||
|
||||
i = initgroupfile(duke3dgrp);
|
||||
|
||||
if (i == -1)
|
||||
|
@ -11179,10 +11212,10 @@ static int opendemoread(int which_demo) // 0 = mine
|
|||
|
||||
if (which_demo == 1 && firstdemofile[0] != 0)
|
||||
{
|
||||
if ((recfilep = kopen4load(firstdemofile,loadfromgrouponly)) == -1) return(0);
|
||||
if ((recfilep = kopen4loadfrommod(firstdemofile,loadfromgrouponly)) == -1) return(0);
|
||||
}
|
||||
else
|
||||
if ((recfilep = kopen4load(d,loadfromgrouponly)) == -1) return(0);
|
||||
if ((recfilep = kopen4loadfrommod(d,loadfromgrouponly)) == -1) return(0);
|
||||
|
||||
if (kread(recfilep,&ud.reccnt,sizeof(int)) != sizeof(int)) goto corrupt;
|
||||
if (kread(recfilep,&ver,sizeof(char)) != sizeof(char)) goto corrupt;
|
||||
|
|
|
@ -2262,7 +2262,7 @@ static int parsecommand(void)
|
|||
char parentcompilefile[255];
|
||||
int fp;
|
||||
|
||||
fp = kopen4load(tempbuf,loadfromgrouponly);
|
||||
fp = kopen4loadfrommod(tempbuf,loadfromgrouponly);
|
||||
if (fp < 0)
|
||||
{
|
||||
error++;
|
||||
|
@ -5161,7 +5161,7 @@ void copydefaultcons(void)
|
|||
|
||||
for (i=0;i<NUM_DEFAULT_CONS;i++)
|
||||
{
|
||||
fpi = kopen4load((char *)defaultcons[i] , 1);
|
||||
fpi = kopen4loadfrommod((char *)defaultcons[i] , 1);
|
||||
if (fpi < 0) continue;
|
||||
|
||||
fpo = fopenfrompath((char *)defaultcons[i],"wb");
|
||||
|
@ -5381,7 +5381,7 @@ void loadefs(const char *filenam)
|
|||
}
|
||||
}
|
||||
*/
|
||||
fp = kopen4load((char *)filenam,loadfromgrouponly);
|
||||
fp = kopen4loadfrommod((char *)filenam,loadfromgrouponly);
|
||||
if (fp == -1) // JBF: was 0
|
||||
{
|
||||
if (loadfromgrouponly == 1)
|
||||
|
|
|
@ -239,7 +239,7 @@ static int osdcmd_map(const osdfuncparm_t *parm)
|
|||
if (strchr(filename,'.') == 0)
|
||||
strcat(filename,".map");
|
||||
|
||||
if ((i = kopen4load(filename,0)) < 0)
|
||||
if ((i = kopen4loadfrommod(filename,0)) < 0)
|
||||
{
|
||||
OSD_Printf(OSD_ERROR "map: file \"%s\" not found.\n", filename);
|
||||
return OSDCMD_OK;
|
||||
|
@ -353,7 +353,7 @@ static int osdcmd_fileinfo(const osdfuncparm_t *parm)
|
|||
|
||||
if (parm->numparms != 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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<numgrpfiles; i++) if (settings.crcval == grpfiles[i].crcval) break;
|
||||
|
|
Loading…
Reference in a new issue