git-svn-id: https://svn.eduke32.com/eduke32@552 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2007-07-04 09:15:08 +00:00
parent 94a22e4d62
commit 0b1f6f91a9
6 changed files with 121 additions and 53 deletions

View file

@ -243,15 +243,6 @@ extern int startwin_run(void);
extern char *defsfilename; // set in bstub.c
char **grps = NULL;
char grpstoadd = 0;
void buildaddgroup(const char *buffer)
{
grps = (char**)realloc(grps, sizeof(char*)*(grpstoadd+1));
grps[grpstoadd++] = strdup(buffer);
}
int app_main(int argc, char **argv)
{
char ch, quitflag, cmdsetup = 0;
@ -277,10 +268,6 @@ int app_main(int argc, char **argv)
for (i=1; i<argc; i++) {
if (argv[i][0] == '-') {
if (!strcmp(argv[i], "-setup")) cmdsetup = 1;
else if (!strcmp(argv[i], "-g") || !strcmp(argv[i], "-grp")) {
i++;
buildaddgroup(argv[i]);
}
else if (!strcmp(argv[i], "-help") || !strcmp(argv[i], "--help") || !strcmp(argv[i], "-?")) {
char *s =
"Mapster32\n"
@ -324,15 +311,6 @@ int app_main(int argc, char **argv)
// if (option[3] != 0) moustat =
initmouse();
if (grps && grpstoadd > 0) {
for (i=0;i<grpstoadd;i++) {
initprintf("Adding %s\n",grps[i]);
initgroupfile(grps[i]);
free(grps[i]);
}
free(grps);
}
inittimer(TIMERINTSPERSECOND);
installusertimercallback(keytimerstuff);

View file

@ -481,7 +481,8 @@ void grabmouse(char a)
{
if (a != mouseacquired)
{
#ifndef DEBUGGINGAIDS
// #ifndef DEBUGGINGAIDS
#if 1
SDL_GrabMode g;
g = SDL_WM_GrabInput(a ? SDL_GRAB_ON : SDL_GRAB_OFF);

View file

@ -48,6 +48,7 @@ static char defaultduke3dgrp[BMAX_PATH] = "duke3d.grp";
static char *duke3dgrp = defaultduke3dgrp;
static int usecwd = 0;
static int fixmapbeforesaving = 1;
static int NoAutoLoad = 0;
static struct strllist
{
@ -5056,7 +5057,14 @@ static void addgamepath(const char *buffer)
CommandPaths = s;
}
extern void buildaddgroup(const char *buffer);
static char **grps = NULL;
static signed char grpstoadd = 0;
static void buildaddgroup(const char *buffer)
{
grps = (char**)realloc(grps, sizeof(char*)*(grpstoadd+1));
grps[grpstoadd++] = strdup(buffer);
}
static void checkcommandline(int argc,char **argv)
{
@ -5076,6 +5084,17 @@ static void checkcommandline(int argc,char **argv)
exit(0);
}
if (!Bstrcasecmp(c+1, "-g") || !Bstrcasecmp(c+1, "-grp"))
{
if (argc > i+1)
{
buildaddgroup(argv[i+1]);
i++;
}
i++;
continue;
}
if (!Bstrcasecmp(c+1,"game_dir"))
{
if (argc > i+1)
@ -5096,6 +5115,16 @@ static void checkcommandline(int argc,char **argv)
i++;
continue;
}
if (!Bstrcasecmp(c+1,"gamegrp"))
{
if (argc > i+1)
{
Bstrcpy(defaultduke3dgrp,argv[i+1]);
i++;
}
i++;
continue;
}
if (!Bstrcasecmp(c+1,"nam"))
{
strcpy(duke3dgrp, "nam.grp");
@ -5115,6 +5144,13 @@ static void checkcommandline(int argc,char **argv)
i++;
continue;
}
if (!Bstrcasecmp(c+1,"noautoload"))
{
initprintf("Autoload disabled\n");
NoAutoLoad = 1;
i++;
continue;
}
#if !defined(_WIN32)
if (!Bstrcasecmp(c+1,"usecwd"))
{
@ -5514,6 +5550,19 @@ static int getatoken(scriptfile *sf, tokenlist *tl, int ntokens)
return T_ERROR;
}
static void autoloadgrps(const char *fn)
{
Bsprintf(tempbuf,"autoload/%s",fn);
getfilenames(tempbuf,"*.grp");
while (findfiles) { Bsprintf(tempbuf,"autoload/%s/%s",fn,findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; }
Bsprintf(tempbuf,"autoload/%s",fn);
getfilenames(tempbuf,"*.zip");
while (findfiles) { Bsprintf(tempbuf,"autoload/%s/%s",fn,findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; }
Bsprintf(tempbuf,"autoload/%s",fn);
getfilenames(tempbuf,"*.pk3");
while (findfiles) { Bsprintf(tempbuf,"autoload/%s/%s",fn,findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; }
}
int parsegroupfiles(scriptfile *script)
{
int tokn;
@ -5535,16 +5584,25 @@ int parsegroupfiles(scriptfile *script)
case T_LOADGRP:
{
char *fn;
pathsearchmode = 1;
if (!scriptfile_getstring(script,&fn))
{
int j = initgroupfile(fn);
if (j == -1)
initprintf("Could not find GRP file %s.\n",fn);
initprintf("Could not find group file '%s'.\n",fn);
else
initprintf("Using GRP file %s.\n",fn);
{
initprintf("Using group file '%s'.\n",fn);
if (!NoAutoLoad)
autoloadgrps(fn);
}
}
pathsearchmode = 0;
}
break;
case T_INCLUDE:
{
char *fn;
@ -5754,6 +5812,7 @@ int loadtilegroups(char *fn)
int ExtInit(void)
{
long rv = 0;
int i;
char cwd[BMAX_PATH];
#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
@ -5821,24 +5880,21 @@ int ExtInit(void)
duke3dgrp = getenv("DUKE3DGRP");
initprintf("Using %s as main GRP file\n", duke3dgrp);
}
initgroupfile(duke3dgrp);
Bsprintf(tempbuf,"autoload/%s",duke3dgrp);
getfilenames(tempbuf,"*.grp");
while (findfiles) { Bsprintf(tempbuf,"autoload/%s/%s",duke3dgrp,findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; }
Bsprintf(tempbuf,"autoload/%s",duke3dgrp);
getfilenames(tempbuf,"*.zip");
while (findfiles) { Bsprintf(tempbuf,"autoload/%s/%s",duke3dgrp,findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; }
Bsprintf(tempbuf,"autoload/%s",duke3dgrp);
getfilenames(tempbuf,"*.pk3");
while (findfiles) { Bsprintf(tempbuf,"autoload/%s/%s",duke3dgrp,findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; }
i = initgroupfile(duke3dgrp);
getfilenames("autoload","*.grp");
while (findfiles) { Bsprintf(tempbuf,"autoload/%s",findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; }
getfilenames("autoload","*.zip");
while (findfiles) { Bsprintf(tempbuf,"autoload/%s",findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; }
getfilenames("autoload","*.pk3");
while (findfiles) { Bsprintf(tempbuf,"autoload/%s",findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; }
if (!NoAutoLoad)
{
getfilenames("autoload","*.grp");
while (findfiles) { Bsprintf(tempbuf,"autoload/%s",findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; }
getfilenames("autoload","*.zip");
while (findfiles) { Bsprintf(tempbuf,"autoload/%s",findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; }
getfilenames("autoload","*.pk3");
while (findfiles) { Bsprintf(tempbuf,"autoload/%s",findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; }
if (i != -1)
autoloadgrps(duke3dgrp);
}
if (getenv("DUKE3DDEF"))
{
@ -5847,6 +5903,17 @@ int ExtInit(void)
}
loadgroupfiles(defsfilename);
if (grps && grpstoadd > 0) {
for (i=0;i<grpstoadd;i++) {
initprintf("Adding %s\n",grps[i]);
initgroupfile(grps[i]);
if (!NoAutoLoad)
autoloadgrps(grps[i]);
free(grps[i]);
}
free(grps);
}
bpp = 32;
#if defined(POLYMOST) && defined(USE_OPENGL)

View file

@ -67,6 +67,7 @@ static int qe,cp,usecwd = 0;
static int32 CommandSetup = 0;
static int32 NoSetup = 0;
static int32 NoAutoLoad = 0;
static int32 CommandSoundToggleOff = 0;
static int32 CommandMusicToggleOff = 0;
static char *CommandMap = NULL;
@ -8476,7 +8477,8 @@ static int parsegroupfiles(scriptfile *script)
else
{
initprintf("Using group file '%s'.\n",fn);
autoloadgrps(fn);
if (!NoAutoLoad)
autoloadgrps(fn);
}
}
@ -8641,6 +8643,16 @@ static void checkcommandline(int argc,char **argv)
i++;
continue;
}
if (!Bstrcasecmp(c+1,"gamegrp"))
{
if (argc > i+1)
{
Bstrcpy(defaultduke3dgrp,argv[i+1]);
i++;
}
i++;
continue;
}
if (!Bstrcasecmp(c+1,"nam"))
{
strcpy(defaultduke3dgrp, "nam.grp");
@ -8670,6 +8682,13 @@ static void checkcommandline(int argc,char **argv)
i++;
continue;
}
if (!Bstrcasecmp(c+1,"noautoload"))
{
initprintf("Autoload disabled\n");
NoAutoLoad = 1;
i++;
continue;
}
if (!Bstrcasecmp(c+1,"keepaddr"))
{
keepaddr = 1;
@ -10004,15 +10023,18 @@ void app_main(int argc,char **argv)
else
initprintf("Using group file '%s' as main group file.\n", duke3dgrp);
getfilenames("autoload","*.grp");
while (findfiles) { Bsprintf(tempbuf,"autoload/%s",findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; }
getfilenames("autoload","*.zip");
while (findfiles) { Bsprintf(tempbuf,"autoload/%s",findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; }
getfilenames("autoload","*.pk3");
if (!NoAutoLoad)
{
getfilenames("autoload","*.grp");
while (findfiles) { Bsprintf(tempbuf,"autoload/%s",findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; }
getfilenames("autoload","*.zip");
while (findfiles) { Bsprintf(tempbuf,"autoload/%s",findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; }
getfilenames("autoload","*.pk3");
while (findfiles) { Bsprintf(tempbuf,"autoload/%s",findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; }
if (i != -1)
autoloadgrps(duke3dgrp);
if (i != -1)
autoloadgrps(duke3dgrp);
}
loadgroupfiles(duke3ddef);
@ -10029,7 +10051,8 @@ while (findfiles) { Bsprintf(tempbuf,"autoload/%s",findfiles->name); initprintf(
{
groupfile = j;
initprintf("Using group file '%s'.\n",CommandGrps->str);
autoloadgrps(CommandGrps->str);
if (!NoAutoLoad)
autoloadgrps(CommandGrps->str);
}
free(CommandGrps->str);

View file

@ -1318,7 +1318,7 @@ static void transvartype(int type)
if ((aGameVars[i].dwFlags & GAMEVAR_FLAG_SYNCCHECK) && parsing_actor && CheckEventSync(current_event))
{
ReportError(-1);
initprintf("%s:%ld: warning: found local gamevar `%s' used within %s.\n",compilefile,line_number,label+(labelcnt<<6),parsing_event?"a synced event":"an actor");
initprintf("%s:%ld: warning: found local gamevar `%s' used within %s; expect multiplayer synchronization issues.\n",compilefile,line_number,label+(labelcnt<<6),parsing_event?"a synced event":"an actor");
}
if (!(error || warning) && condebug > 1)
initprintf("%s:%ld: debug: accepted gamevar `%s'.\n",compilefile,line_number,label+(labelcnt<<6));

View file

@ -1533,7 +1533,6 @@ SKIPBULLETHOLE:
else zvel = (100-ps[p].horiz-ps[p].horizoff)*81;
if (atwith == RPG)
spritesound(RPG_SHOOT,i);
}
else
{