git-svn-id: https://svn.eduke32.com/eduke32@505 1a8010ca-5511-0410-912e-c29ae57300e0

This commit is contained in:
terminx 2007-02-18 22:16:01 +00:00
parent 6440b48ec8
commit eb35e8b927
3 changed files with 70 additions and 27 deletions

View file

@ -4403,7 +4403,8 @@ int osdcmd_quit(const osdfuncparm_t *parm)
enum { enum {
T_EOF = -2, T_EOF = -2,
T_ERROR = -1, T_ERROR = -1,
T_LOADGRP = 0, T_INCLUDE = 0,
T_LOADGRP = 1,
}; };
typedef struct typedef struct
@ -4432,8 +4433,8 @@ static int getatoken(scriptfile *sf, tokenlist *tl, int ntokens)
static tokenlist grptokens[] = static tokenlist grptokens[] =
{ {
{ "loadgrp", T_LOADGRP { "include", T_INCLUDE },
}, { "loadgrp", T_LOADGRP },
}; };
int loadgroupfiles(char *fn) int loadgroupfiles(char *fn)
@ -4464,6 +4465,23 @@ int loadgroupfiles(char *fn)
initprintf("Using GRP file %s.\n",fn); initprintf("Using GRP file %s.\n",fn);
} }
} }
case T_INCLUDE:
{
char *fn;
if (!scriptfile_getstring(script,&fn)) {
scriptfile *included;
included = scriptfile_fromfile(fn);
if (!included) {
initprintf("Warning: Failed including %s on line %s:%d\n",
fn, script->filename,scriptfile_getlinum(script,cmdtokptr));
} else {
loadgroupfiles((const char *)included);
scriptfile_close(included);
}
}
break;
}
break; break;
case T_EOF: case T_EOF:
return(0); return(0);
@ -4737,31 +4755,33 @@ void ExtAnalyzeSprites(void)
} }
// else tspr->cstat&=32767; // else tspr->cstat&=32767;
if (frames!=0) if (!usemodels || md_tilehasmodel(tspr->picnum) < 0)
{ {
if (frames==10) frames=0; if (frames!=0)
k = getangle(tspr->x-posx,tspr->y-posy);
k = (((tspr->ang+3072+128-k)&2047)>>8)&7;
//This guy has only 5 pictures for 8 angles (3 are x-flipped)
if (k <= 4)
{ {
tspr->picnum += k; if (frames==10) frames=0;
tspr->cstat &= ~4; //clear x-flipping bit k = getangle(tspr->x-posx,tspr->y-posy);
} k = (((tspr->ang+3072+128-k)&2047)>>8)&7;
else //This guy has only 5 pictures for 8 angles (3 are x-flipped)
{ if (k <= 4)
tspr->picnum += 8-k; {
tspr->cstat |= 4; //set x-flipping bit tspr->picnum += k;
tspr->cstat &= ~4; //clear x-flipping bit
}
else
{
tspr->picnum += 8-k;
tspr->cstat |= 4; //set x-flipping bit
}
} }
if (frames==2) tspr->picnum+=((((4-(totalclock>>5)))&1)*5);
if (frames==4) tspr->picnum+=((((4-(totalclock>>5)))&3)*5);
if (frames==5) tspr->picnum+=(((totalclock>>5)%5))*5;
if (tilesizx[tspr->picnum] == 0)
tspr->picnum -= 5; //Hack, for actors
} }
if (frames==2) tspr->picnum+=((((4-(totalclock>>5)))&1)*5);
if (frames==4) tspr->picnum+=((((4-(totalclock>>5)))&3)*5);
if (frames==5) tspr->picnum+=(((totalclock>>5)%5))*5;
if (tilesizx[tspr->picnum] == 0)
tspr->picnum -= 5; //Hack, for actors
break; break;
default: default:
break; break;

View file

@ -140,11 +140,12 @@ enum
{ {
T_EOF = -2, T_EOF = -2,
T_ERROR = -1, T_ERROR = -1,
T_INCLUDE = 0,
T_INTERFACE = 0, T_INTERFACE = 0,
T_LOADGRP = 0, T_LOADGRP = 1,
T_MODE = 1, T_MODE = 1,
T_CACHESIZE = 1, T_CACHESIZE = 2,
T_ALLOW T_ALLOW = 2
}; };
typedef struct typedef struct
@ -8373,6 +8374,8 @@ static int loadgroupfiles(const char *fn)
tokenlist grptokens[] = tokenlist grptokens[] =
{ {
{ "include", T_INCLUDE },
{ "#include", T_INCLUDE },
{ "loadgrp", T_LOADGRP }, { "loadgrp", T_LOADGRP },
{ "cachesize", T_CACHESIZE }, { "cachesize", T_CACHESIZE },
}; };
@ -8411,6 +8414,23 @@ static int loadgroupfiles(const char *fn)
if (j > 0) MAXCACHE1DSIZE = j<<10; if (j > 0) MAXCACHE1DSIZE = j<<10;
} }
break; break;
case T_INCLUDE:
{
char *fn;
if (!scriptfile_getstring(script,&fn)) {
scriptfile *included;
included = scriptfile_fromfile(fn);
if (!included) {
initprintf("Warning: Failed including %s on line %s:%d\n",
fn, script->filename,scriptfile_getlinum(script,cmdtokptr));
} else {
loadgroupfiles((const char *)included);
scriptfile_close(included);
}
}
break;
}
case T_EOF: case T_EOF:
return(0); return(0);
default: default:

View file

@ -289,6 +289,7 @@ int AddGameVar(const char *pszLabel, long lValue, unsigned long dwFlags)
if (Bstrlen(pszLabel) > (MAXVARLABEL-1)) if (Bstrlen(pszLabel) > (MAXVARLABEL-1))
{ {
error++; error++;
ReportError(-1);
initprintf("%s:%ld: error: variable name `%s' exceeds limit of %d characters.\n",compilefile,line_number,pszLabel, MAXVARLABEL); initprintf("%s:%ld: error: variable name `%s' exceeds limit of %d characters.\n",compilefile,line_number,pszLabel, MAXVARLABEL);
return 0; return 0;
} }
@ -1171,6 +1172,7 @@ static void AddSystemVars()
AddGameVar("myxvel",(long)&myxvel, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PLONG | GAMEVAR_FLAG_SYNCCHECK); AddGameVar("myxvel",(long)&myxvel, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PLONG | GAMEVAR_FLAG_SYNCCHECK);
AddGameVar("myyvel",(long)&myyvel, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PLONG | GAMEVAR_FLAG_SYNCCHECK); AddGameVar("myyvel",(long)&myyvel, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PLONG | GAMEVAR_FLAG_SYNCCHECK);
AddGameVar("myzvel",(long)&myzvel, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PLONG | GAMEVAR_FLAG_SYNCCHECK); AddGameVar("myzvel",(long)&myzvel, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PLONG | GAMEVAR_FLAG_SYNCCHECK);
AddGameVar("myhoriz",(long)&myhoriz, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PSHORT | GAMEVAR_FLAG_SYNCCHECK); AddGameVar("myhoriz",(long)&myhoriz, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PSHORT | GAMEVAR_FLAG_SYNCCHECK);
AddGameVar("myhorizoff",(long)&myhorizoff, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PSHORT | GAMEVAR_FLAG_SYNCCHECK); AddGameVar("myhorizoff",(long)&myhorizoff, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PSHORT | GAMEVAR_FLAG_SYNCCHECK);
AddGameVar("omyhoriz",(long)&omyhoriz, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PSHORT | GAMEVAR_FLAG_SYNCCHECK); AddGameVar("omyhoriz",(long)&omyhoriz, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PSHORT | GAMEVAR_FLAG_SYNCCHECK);
@ -1179,6 +1181,7 @@ static void AddSystemVars()
AddGameVar("omyang",(long)&omyang, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PSHORT | GAMEVAR_FLAG_SYNCCHECK); AddGameVar("omyang",(long)&omyang, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PSHORT | GAMEVAR_FLAG_SYNCCHECK);
AddGameVar("mycursectnum",(long)&mycursectnum, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PSHORT | GAMEVAR_FLAG_SYNCCHECK); AddGameVar("mycursectnum",(long)&mycursectnum, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PSHORT | GAMEVAR_FLAG_SYNCCHECK);
AddGameVar("myjumpingcounter",(long)&myjumpingcounter, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PSHORT | GAMEVAR_FLAG_SYNCCHECK); AddGameVar("myjumpingcounter",(long)&myjumpingcounter, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PSHORT | GAMEVAR_FLAG_SYNCCHECK);
AddGameVar("myjumpingtoggle",(long)&myjumpingtoggle, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PCHAR | GAMEVAR_FLAG_SYNCCHECK); AddGameVar("myjumpingtoggle",(long)&myjumpingtoggle, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PCHAR | GAMEVAR_FLAG_SYNCCHECK);
AddGameVar("myonground",(long)&myonground, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PCHAR | GAMEVAR_FLAG_SYNCCHECK); AddGameVar("myonground",(long)&myonground, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PCHAR | GAMEVAR_FLAG_SYNCCHECK);
AddGameVar("myhardlanding",(long)&myhardlanding, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PCHAR | GAMEVAR_FLAG_SYNCCHECK); AddGameVar("myhardlanding",(long)&myhardlanding, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PCHAR | GAMEVAR_FLAG_SYNCCHECK);