mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 08:52:00 +00:00
Fix mapster's command-line parsing and copy over some of the 'custom mod dir' logic, currently used in the sound board to also find files outside of GRPs.
git-svn-id: https://svn.eduke32.com/eduke32@1904 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
dd355636ff
commit
116ab2ed99
5 changed files with 248 additions and 220 deletions
|
@ -91,7 +91,7 @@ extern int32_t editorgridextent; // in engine.c
|
|||
|
||||
extern char game_executable[BMAX_PATH];
|
||||
extern char program_origcwd[BMAX_PATH];
|
||||
extern char *mapster32_fullpath;
|
||||
extern const char *mapster32_fullpath;
|
||||
extern char *testplay_addparam;
|
||||
extern const char *g_namesFileName;
|
||||
|
||||
|
@ -114,6 +114,8 @@ extern int32_t autogray;
|
|||
int32_t yax_is121(int16_t bunchnum, int16_t getfloor);
|
||||
#endif
|
||||
|
||||
extern int32_t kopen4loadfrommod(const char *filename, char searchfirst);
|
||||
|
||||
extern int32_t map_revision;
|
||||
extern int32_t map_undoredo(int32_t dir);
|
||||
extern void map_undoredo_free(void);
|
||||
|
|
|
@ -110,7 +110,7 @@ int32_t revertCTRL=0,scrollamount=3;
|
|||
int32_t unrealedlook=1, quickmapcycling=1; //PK
|
||||
|
||||
char program_origcwd[BMAX_PATH];
|
||||
char *mapster32_fullpath;
|
||||
const char *mapster32_fullpath;
|
||||
char *testplay_addparam = 0;
|
||||
|
||||
static char boardfilename[BMAX_PATH], selectedboardfilename[BMAX_PATH];
|
||||
|
@ -8483,8 +8483,8 @@ int32_t loadnames(const char *namesfile)
|
|||
}
|
||||
|
||||
number = p;
|
||||
while (*p != 0) p++;
|
||||
if (*p != 0) *p = 0;
|
||||
while (*p != 0 && *p != 32) p++;
|
||||
*p = 0;
|
||||
|
||||
// add to list
|
||||
num = Bstrtol(number, &endptr, 10);
|
||||
|
@ -8509,7 +8509,6 @@ int32_t loadnames(const char *namesfile)
|
|||
syms++;
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
else // #define_NAME with no number
|
||||
{
|
||||
|
@ -8526,9 +8525,11 @@ int32_t loadnames(const char *namesfile)
|
|||
}
|
||||
else if (*p == '*' && p[1] == '/')
|
||||
{
|
||||
comment--; continue;
|
||||
comment--;
|
||||
continue;
|
||||
}
|
||||
else if (comment)continue;
|
||||
else if (comment)
|
||||
continue;
|
||||
badline:
|
||||
initprintf("Error: Invalid statement found at character %d on line %d\n", (int32_t)(p-buffer), line-1);
|
||||
}
|
||||
|
|
|
@ -167,13 +167,13 @@ int32_t hicsetsubsttex(int32_t picnum, int32_t palnum, const char *filen, float
|
|||
if (tilesizx[picnum]<=0 || tilesizy[picnum]<=0)
|
||||
{
|
||||
static int32_t first=1;
|
||||
initprintf("Warning: defined hightile replacement for empty tile %d.", picnum);
|
||||
if (first)
|
||||
{
|
||||
initprintf("Warning: defined hightile replacement for empty tile %d.", picnum);
|
||||
initprintf(" Maybe some tilesXXX.art are not loaded?");
|
||||
initprintf("\n");
|
||||
first = 0;
|
||||
}
|
||||
initprintf("\n");
|
||||
}
|
||||
|
||||
//printf("Replacement [%d,%d]: %s\n", picnum, palnum, hicreplc[i]->filename);
|
||||
|
|
|
@ -59,6 +59,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
static int32_t floor_over_floor;
|
||||
static int32_t g_fillCurSector = 0;
|
||||
|
||||
static char g_modDir[BMAX_PATH];
|
||||
|
||||
// static char *startwin_labeltext = "Starting Mapster32...";
|
||||
static char setupfilename[]= "mapster32.cfg";
|
||||
static char defaultduke3dgrp[BMAX_PATH] = "duke3d.grp";
|
||||
|
@ -669,6 +671,23 @@ static const char *Help3d[]=
|
|||
" END = PGUP/PGDN MODIFIER (512 UNITS)",
|
||||
};
|
||||
|
||||
int32_t kopen4loadfrommod(const char *filename, char searchfirst)
|
||||
{
|
||||
static char fn[BMAX_PATH];
|
||||
int32_t r=-1;
|
||||
|
||||
if (g_modDir[0])
|
||||
{
|
||||
Bsnprintf(fn,sizeof(fn),"%s/%s",g_modDir,filename);
|
||||
r = kopen4load(fn,searchfirst);
|
||||
}
|
||||
|
||||
if (r < 0)
|
||||
r = kopen4load(filename,searchfirst);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static void clearfilenames(void)
|
||||
{
|
||||
klistfree(finddirs);
|
||||
|
@ -8355,10 +8374,11 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
|
|||
int32_t i = 1, j, maxlen=0, *lengths;
|
||||
char *c, *k;
|
||||
|
||||
mapster32_fullpath = (char *)argv[0];
|
||||
mapster32_fullpath = argv[0];
|
||||
|
||||
if (argc <= 1)
|
||||
return;
|
||||
|
||||
if (argc > 1)
|
||||
{
|
||||
lengths = Bmalloc(argc*sizeof(int32_t));
|
||||
for (j=1; j<argc; j++)
|
||||
{
|
||||
|
@ -8374,6 +8394,7 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
|
|||
while (i < argc)
|
||||
{
|
||||
c = (char *)argv[i];
|
||||
|
||||
if ((*c == '-')
|
||||
#ifdef _WIN32
|
||||
|| (*c == '/')
|
||||
|
@ -8406,9 +8427,12 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
|
|||
#ifdef USE_OPENGL
|
||||
extern char TEXCACHEFILE[BMAX_PATH];
|
||||
|
||||
Bsprintf(tempbuf,"%s/%s",argv[i+1],TEXCACHEFILE);
|
||||
Bstrcpy(TEXCACHEFILE,tempbuf);
|
||||
Bsnprintf(tempbuf,sizeof(tempbuf),"%s/%s",argv[i+1],TEXCACHEFILE);
|
||||
Bstrncpy(TEXCACHEFILE,tempbuf, sizeof(TEXCACHEFILE));
|
||||
TEXCACHEFILE[sizeof(TEXCACHEFILE)-1] = 0;
|
||||
#endif
|
||||
Bstrncpy(g_modDir, argv[i+1], sizeof(g_modDir));
|
||||
g_modDir[sizeof(g_modDir)-1] = 0;
|
||||
AddGamePath(argv[i+1]);
|
||||
|
||||
COPYARG(i);
|
||||
|
@ -8471,7 +8495,7 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
|
|||
i++;
|
||||
continue;
|
||||
}
|
||||
if (!Bstrcasecmp(c+1,"-nm") || Bstrcasecmp(c+1,"-ns"))
|
||||
if (!Bstrcasecmp(c+1,"nm") || !Bstrcasecmp(c+1,"ns"))
|
||||
{
|
||||
COPYARG(i);
|
||||
i++;
|
||||
|
@ -8525,6 +8549,7 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
if ((*c == '-')
|
||||
#ifdef _WIN32
|
||||
|| (*c == '/')
|
||||
|
@ -8608,7 +8633,7 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
|
|||
Bfree(testplay_addparam);
|
||||
testplay_addparam = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#undef COPYARG
|
||||
|
||||
|
|
|
@ -137,8 +137,8 @@ int32_t S_LoadSound(uint32_t num)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (g_sounds[num].filename1) fp = kopen4load(g_sounds[num].filename1,pathsearchmode);
|
||||
if (fp == -1) fp = kopen4load(g_sounds[num].filename,pathsearchmode);
|
||||
if (g_sounds[num].filename1) fp = kopen4loadfrommod(g_sounds[num].filename1,0);//pathsearchmode
|
||||
if (fp == -1) fp = kopen4loadfrommod(g_sounds[num].filename,0);
|
||||
if (fp == -1)
|
||||
{
|
||||
OSD_Printf(OSDTEXT_RED "Sound %s(#%d) not found!\n",g_sounds[num].filename,num);
|
||||
|
|
Loading…
Reference in a new issue