mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +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.UseMouse = 1;
|
||||||
ud.config.VoiceToggle = 5; // bitfield, 1 = local, 2 = dummy, 4 = other players in DM
|
ud.config.VoiceToggle = 5; // bitfield, 1 = local, 2 = dummy, 4 = other players in DM
|
||||||
ud.display_bonus_screen = 1;
|
ud.display_bonus_screen = 1;
|
||||||
|
ud.configversion = 0;
|
||||||
|
|
||||||
Bstrcpy(ud.rtsname, "DUKE.RTS");
|
Bstrcpy(ud.rtsname, "DUKE.RTS");
|
||||||
Bstrcpy(myname, "Duke");
|
Bstrcpy(myname, "Duke");
|
||||||
|
@ -648,11 +649,11 @@ int32 CONFIG_ReadSetup(void)
|
||||||
{
|
{
|
||||||
extern char defaultduke3dgrp[BMAX_PATH];
|
extern char defaultduke3dgrp[BMAX_PATH];
|
||||||
if (!Bstrcmp(defaultduke3dgrp,"duke3d.grp"))
|
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] == '/')
|
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);
|
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;
|
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", "FXDevice",&ud.config.FXDevice);
|
||||||
SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "MusicDevice",&ud.config.MusicDevice);
|
SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "MusicDevice",&ud.config.MusicDevice);
|
||||||
SCRIPT_GetNumber(ud.config.scripthandle, "Sound Setup", "FXVolume",&ud.config.FXVolume);
|
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, "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++)
|
for (dummy=0;dummy<MAXMOUSEBUTTONS;dummy++)
|
||||||
{
|
{
|
||||||
Bsprintf(buf,"MouseButton%d",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_PutNumber(ud.config.scripthandle, "Comm Setup", "Rate", packetrate, false, false);
|
||||||
|
|
||||||
|
|
||||||
SCRIPT_PutString(ud.config.scripthandle, "Misc","SelectedGRP",&duke3dgrp[0]);
|
SCRIPT_PutString(ud.config.scripthandle, "Setup","SelectedGRP",&duke3dgrp[0]);
|
||||||
SCRIPT_PutString(ud.config.scripthandle, "Misc","ModDir",&mod_dir[0]);
|
SCRIPT_PutString(ud.config.scripthandle, "Setup","ModDir",&mod_dir[0]);
|
||||||
{
|
{
|
||||||
char commmacro[] = "CommbatMacro# ";
|
char commmacro[] = "CommbatMacro# ";
|
||||||
|
|
||||||
|
|
|
@ -414,6 +414,7 @@ typedef struct {
|
||||||
int player_skill,level_number,volume_number,m_marker,marker,mouseflip;
|
int player_skill,level_number,volume_number,m_marker,marker,mouseflip;
|
||||||
|
|
||||||
int camerax,cameray,cameraz;
|
int camerax,cameray,cameraz;
|
||||||
|
int configversion;
|
||||||
|
|
||||||
short cameraang, camerasect, camerahoriz;
|
short cameraang, camerasect, camerahoriz;
|
||||||
short pause_on,from_bonus;
|
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 GetCrosshairColor(void);
|
||||||
extern void SetCrosshairColor(int r, int g, int b);
|
extern void SetCrosshairColor(int r, int g, int b);
|
||||||
|
extern int kopen4loadfrommod(char *filename, char searchfirst);
|
||||||
#endif // __funct_h__
|
#endif // __funct_h__
|
||||||
|
|
|
@ -151,6 +151,20 @@ int althud_numberpal = 0;
|
||||||
int althud_shadows = 1;
|
int althud_shadows = 1;
|
||||||
int althud_flashing = 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
|
enum
|
||||||
{
|
{
|
||||||
T_EOF = -2,
|
T_EOF = -2,
|
||||||
|
@ -909,7 +923,7 @@ void getpackets(void)
|
||||||
Bcorrectfilename(boardfilename,0);
|
Bcorrectfilename(boardfilename,0);
|
||||||
if (boardfilename[0] != 0)
|
if (boardfilename[0] != 0)
|
||||||
{
|
{
|
||||||
if ((i = kopen4load(boardfilename,0)) < 0)
|
if ((i = kopen4loadfrommod(boardfilename,0)) < 0)
|
||||||
{
|
{
|
||||||
Bmemset(boardfilename,0,sizeof(boardfilename));
|
Bmemset(boardfilename,0,sizeof(boardfilename));
|
||||||
sendboardname();
|
sendboardname();
|
||||||
|
@ -10026,7 +10040,7 @@ static void compilecons(void)
|
||||||
pathsearchmode = 1;
|
pathsearchmode = 1;
|
||||||
if (userconfiles == 0)
|
if (userconfiles == 0)
|
||||||
{
|
{
|
||||||
i = kopen4load(confilename,0);
|
i = kopen4loadfrommod(confilename,0);
|
||||||
if (i!=-1)
|
if (i!=-1)
|
||||||
kclose(i);
|
kclose(i);
|
||||||
else Bsprintf(confilename,"GAME.CON");
|
else Bsprintf(confilename,"GAME.CON");
|
||||||
|
@ -10037,7 +10051,7 @@ static void compilecons(void)
|
||||||
{
|
{
|
||||||
if (userconfiles == 0)
|
if (userconfiles == 0)
|
||||||
{
|
{
|
||||||
i = kopen4load("EDUKE.CON",1);
|
i = kopen4loadfrommod("EDUKE.CON",1);
|
||||||
if (i!=-1)
|
if (i!=-1)
|
||||||
{
|
{
|
||||||
Bsprintf(confilename,"EDUKE.CON");
|
Bsprintf(confilename,"EDUKE.CON");
|
||||||
|
@ -10097,7 +10111,7 @@ static void genspriteremaps(void)
|
||||||
signed char look_pos;
|
signed char look_pos;
|
||||||
char *lookfn = "lookup.dat";
|
char *lookfn = "lookup.dat";
|
||||||
|
|
||||||
fp = kopen4load(lookfn,0);
|
fp = kopen4loadfrommod(lookfn,0);
|
||||||
if (fp != -1)
|
if (fp != -1)
|
||||||
kread(fp,(char *)&g_NumPalettes,1);
|
kread(fp,(char *)&g_NumPalettes,1);
|
||||||
else
|
else
|
||||||
|
@ -10194,7 +10208,7 @@ static void Startup(void)
|
||||||
|
|
||||||
Bcorrectfilename(boardfilename,0);
|
Bcorrectfilename(boardfilename,0);
|
||||||
|
|
||||||
i = kopen4load(boardfilename,0);
|
i = kopen4loadfrommod(boardfilename,0);
|
||||||
if (i!=-1)
|
if (i!=-1)
|
||||||
{
|
{
|
||||||
initprintf("Using level: '%s'.\n",boardfilename);
|
initprintf("Using level: '%s'.\n",boardfilename);
|
||||||
|
@ -10270,8 +10284,24 @@ static void Startup(void)
|
||||||
|
|
||||||
//initprintf("* Hold Esc to Abort. *\n");
|
//initprintf("* Hold Esc to Abort. *\n");
|
||||||
// initprintf("Loading art header...\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)
|
if (loadpics("tiles000.art",MAXCACHE1DSIZE) < 0)
|
||||||
gameexit("Failed loading art.");
|
gameexit("Failed loading art.");
|
||||||
|
}
|
||||||
|
chdir(cwd);
|
||||||
|
}
|
||||||
|
else if (loadpics("tiles000.art",MAXCACHE1DSIZE) < 0)
|
||||||
|
gameexit("Failed loading art.");
|
||||||
|
}
|
||||||
|
|
||||||
// initprintf("Loading palette/lookups...\n");
|
// initprintf("Loading palette/lookups...\n");
|
||||||
genspriteremaps();
|
genspriteremaps();
|
||||||
|
@ -10716,7 +10746,7 @@ void app_main(int argc,const char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (defined RENDERTYPEWIN || (defined RENDERTYPESDL && !defined __APPLE__ && defined HAVE_GTK2))
|
#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())
|
if (quitevent || !startwin_run())
|
||||||
{
|
{
|
||||||
|
@ -10747,6 +10777,9 @@ void app_main(int argc,const char **argv)
|
||||||
Bsprintf(gametype_names[2],"GRUNTMATCH (NO SPAWN)");
|
Bsprintf(gametype_names[2],"GRUNTMATCH (NO SPAWN)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mod_dir[0] != '/')
|
||||||
|
addsearchpath(mod_dir);
|
||||||
|
|
||||||
i = initgroupfile(duke3dgrp);
|
i = initgroupfile(duke3dgrp);
|
||||||
|
|
||||||
if (i == -1)
|
if (i == -1)
|
||||||
|
@ -11179,10 +11212,10 @@ static int opendemoread(int which_demo) // 0 = mine
|
||||||
|
|
||||||
if (which_demo == 1 && firstdemofile[0] != 0)
|
if (which_demo == 1 && firstdemofile[0] != 0)
|
||||||
{
|
{
|
||||||
if ((recfilep = kopen4load(firstdemofile,loadfromgrouponly)) == -1) return(0);
|
if ((recfilep = kopen4loadfrommod(firstdemofile,loadfromgrouponly)) == -1) return(0);
|
||||||
}
|
}
|
||||||
else
|
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,&ud.reccnt,sizeof(int)) != sizeof(int)) goto corrupt;
|
||||||
if (kread(recfilep,&ver,sizeof(char)) != sizeof(char)) goto corrupt;
|
if (kread(recfilep,&ver,sizeof(char)) != sizeof(char)) goto corrupt;
|
||||||
|
|
|
@ -2262,7 +2262,7 @@ static int parsecommand(void)
|
||||||
char parentcompilefile[255];
|
char parentcompilefile[255];
|
||||||
int fp;
|
int fp;
|
||||||
|
|
||||||
fp = kopen4load(tempbuf,loadfromgrouponly);
|
fp = kopen4loadfrommod(tempbuf,loadfromgrouponly);
|
||||||
if (fp < 0)
|
if (fp < 0)
|
||||||
{
|
{
|
||||||
error++;
|
error++;
|
||||||
|
@ -5161,7 +5161,7 @@ void copydefaultcons(void)
|
||||||
|
|
||||||
for (i=0;i<NUM_DEFAULT_CONS;i++)
|
for (i=0;i<NUM_DEFAULT_CONS;i++)
|
||||||
{
|
{
|
||||||
fpi = kopen4load((char *)defaultcons[i] , 1);
|
fpi = kopen4loadfrommod((char *)defaultcons[i] , 1);
|
||||||
if (fpi < 0) continue;
|
if (fpi < 0) continue;
|
||||||
|
|
||||||
fpo = fopenfrompath((char *)defaultcons[i],"wb");
|
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 (fp == -1) // JBF: was 0
|
||||||
{
|
{
|
||||||
if (loadfromgrouponly == 1)
|
if (loadfromgrouponly == 1)
|
||||||
|
|
|
@ -239,7 +239,7 @@ static int osdcmd_map(const osdfuncparm_t *parm)
|
||||||
if (strchr(filename,'.') == 0)
|
if (strchr(filename,'.') == 0)
|
||||||
strcat(filename,".map");
|
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);
|
OSD_Printf(OSD_ERROR "map: file \"%s\" not found.\n", filename);
|
||||||
return OSDCMD_OK;
|
return OSDCMD_OK;
|
||||||
|
@ -353,7 +353,7 @@ static int osdcmd_fileinfo(const osdfuncparm_t *parm)
|
||||||
|
|
||||||
if (parm->numparms != 1) return OSDCMD_SHOWHELP;
|
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]);
|
OSD_Printf("fileinfo: File \"%s\" not found.\n", parm->parms[0]);
|
||||||
return OSDCMD_OK;
|
return OSDCMD_OK;
|
||||||
|
|
|
@ -284,8 +284,8 @@ static int getsound(unsigned int num)
|
||||||
if (ud.config.FXDevice < 0) return 0;
|
if (ud.config.FXDevice < 0) return 0;
|
||||||
|
|
||||||
if (!g_sounds[num].filename) return 0;
|
if (!g_sounds[num].filename) return 0;
|
||||||
if (g_sounds[num].filename1)fp = kopen4load(g_sounds[num].filename1,loadfromgrouponly);
|
if (g_sounds[num].filename1)fp = kopen4loadfrommod(g_sounds[num].filename1,loadfromgrouponly);
|
||||||
if (fp == -1)fp = kopen4load(g_sounds[num].filename,loadfromgrouponly);
|
if (fp == -1)fp = kopen4loadfrommod(g_sounds[num].filename,loadfromgrouponly);
|
||||||
if (fp == -1) return 0;
|
if (fp == -1) return 0;
|
||||||
|
|
||||||
l = kfilelength(fp);
|
l = kfilelength(fp);
|
||||||
|
|
|
@ -68,7 +68,7 @@ int32 RTS_AddFile(const char *filename)
|
||||||
// read the entire file in
|
// read the entire file in
|
||||||
// FIXME: shared opens
|
// FIXME: shared opens
|
||||||
|
|
||||||
handle = kopen4load((char *)filename, 0);
|
handle = kopen4loadfrommod((char *)filename, 0);
|
||||||
if (handle < 0)
|
if (handle < 0)
|
||||||
{
|
{
|
||||||
initprintf("RTS file %s was not found\n",filename);
|
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.MusicToggle == 0) return;
|
||||||
if (ud.config.MusicDevice < 0) return;
|
if (ud.config.MusicDevice < 0) return;
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
fp = kopen4load((char *)fn,0);
|
fp = kopen4loadfrommod((char *)fn,0);
|
||||||
|
|
||||||
if (fp == -1) return;
|
if (fp == -1) return;
|
||||||
|
|
||||||
|
@ -254,8 +254,8 @@ int loadsound(unsigned int num)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_sounds[num].filename1)fp = kopen4load(g_sounds[num].filename1,loadfromgrouponly);
|
if (g_sounds[num].filename1)fp = kopen4loadfrommod(g_sounds[num].filename1,loadfromgrouponly);
|
||||||
if (fp == -1)fp = kopen4load(g_sounds[num].filename,loadfromgrouponly);
|
if (fp == -1)fp = kopen4loadfrommod(g_sounds[num].filename,loadfromgrouponly);
|
||||||
if (fp == -1)
|
if (fp == -1)
|
||||||
{
|
{
|
||||||
// Bsprintf(fta_quotes[113],"g_sounds %s(#%d) not found.",sounds[num],num);
|
// 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;
|
g_GameType = settings.game;
|
||||||
|
|
||||||
if (settings.gamedir != NULL)
|
if (settings.gamedir != NULL)
|
||||||
{
|
|
||||||
addsearchpath(settings.gamedir);
|
|
||||||
Bstrcpy(mod_dir,settings.gamedir);
|
Bstrcpy(mod_dir,settings.gamedir);
|
||||||
}
|
|
||||||
else Bsprintf(mod_dir,"/");
|
else Bsprintf(mod_dir,"/");
|
||||||
|
|
||||||
for (i = 0; i<numgrpfiles; i++) if (settings.crcval == grpfiles[i].crcval) break;
|
for (i = 0; i<numgrpfiles; i++) if (settings.crcval == grpfiles[i].crcval) break;
|
||||||
|
|
Loading…
Reference in a new issue