1. EDuke32 didn't load ART files from the mod_dir. Fixed via the "root" string in "game.c".

2. Saving mod_dir to CFG is a bad idea IMHO so I commented it out. When I tried to load the standard game, EDuke32 would use the last used mod_dir.
3. Fixed tsprites.
4. EDSuke32 doesn't throw errors after 4096-th error. Resets the counter in ResetGameVars.
5. Restored 999 revision. Member names are changed. Extra members can be commented out.
6. Added an option(-sloppycmd) to allow execting of bad commands. This option should be renamed to something else.


git-svn-id: https://svn.eduke32.com/eduke32@1007 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hnt_ts 2008-08-23 15:37:30 +00:00
parent 292672fdc7
commit 0e3ee1289d
9 changed files with 348 additions and 204 deletions

View file

@ -185,7 +185,6 @@ typedef struct BPACK {
#define SPREXT_NOMDANIM 2 #define SPREXT_NOMDANIM 2
#define SPREXT_AWAY1 4 #define SPREXT_AWAY1 4
#define SPREXT_AWAY2 8 #define SPREXT_AWAY2 8
#define SPREXT_TSPRACCESS 16
EXTERN spriteexttype *spriteext; EXTERN spriteexttype *spriteext;
EXTERN spritesmoothtype *spritesmooth; EXTERN spritesmoothtype *spritesmooth;

View file

@ -22,7 +22,7 @@ static int _internal_osdfunc_alias(const osdfuncparm_t *);
// static int _internal_osdfunc_dumpbuildinfo(const osdfuncparm_t *); // static int _internal_osdfunc_dumpbuildinfo(const osdfuncparm_t *);
// static int _internal_osdfunc_setrendermode(const osdfuncparm_t *); // static int _internal_osdfunc_setrendermode(const osdfuncparm_t *);
static int white=-1; // colour of white (used by default display routines) static int white=-1; // colour of white (used by default display routines)
static void _internal_drawosdchar(int, int, char, int, int); static void _internal_drawosdchar(int, int, char, int, int);
static void _internal_drawosdstr(int, int, char*, int, int, int); static void _internal_drawosdstr(int, int, char*, int, int, int);
static void _internal_drawosdcursor(int,int,int,int); static void _internal_drawosdcursor(int,int,int,int);
@ -39,50 +39,51 @@ static char osdversionstring[32];
static int osdversionstringlen; static int osdversionstringlen;
static int osdversionstringshade; static int osdversionstringshade;
static int osdversionstringpal; static int osdversionstringpal;
static int osdpos=0; // position next character will be written at static int osdpos=0; // position next character will be written at
static int osdlines=1; // # lines of text in the buffer static int osdlines=1; // # lines of text in the buffer
static int osdrows=20; // # lines of the buffer that are visible static int osdrows=20; // # lines of the buffer that are visible
static int osdrowscur=-1; static int osdrowscur=-1;
static int osdscroll=0; static int osdscroll=0;
static int osdcols=60; // width of onscreen display in text columns static int osdcols=60; // width of onscreen display in text columns
static int osdmaxrows=20; // maximum number of lines which can fit on the screen static int osdmaxrows=20; // maximum number of lines which can fit on the screen
static int osdmaxlines=TEXTSIZE/60; // maximum lines which can fit in the buffer static int osdmaxlines=TEXTSIZE/60; // maximum lines which can fit in the buffer
static char osdvisible=0; // onscreen display visible? static char osdvisible=0; // onscreen display visible?
static char osdinput=0; // capture input? static char osdinput=0; // capture input?
static int osdhead=0; // topmost visible line number static int osdhead=0; // topmost visible line number
static BFILE *osdlog=NULL; // log filehandle static BFILE *osdlog=NULL; // log filehandle
static char osdinited=0; // text buffer initialized? static char osdinited=0; // text buffer initialized?
static int osdkey=0x29; // tilde shows the osd static int osdkey=0x29; // tilde shows the osd
static int keytime=0; static int keytime=0;
static int osdscrtime = 0; static int osdscrtime = 0;
// command prompt editing // command prompt editing
#define EDITLENGTH 511 #define EDITLENGTH 511
static int osdovertype=0; // insert (0) or overtype (1) static int osdovertype=0; // insert (0) or overtype (1)
static char osdeditbuf[EDITLENGTH+1]; // editing buffer static char osdeditbuf[EDITLENGTH+1]; // editing buffer
static char osdedittmp[EDITLENGTH+1]; // editing buffer temporary workspace static char osdedittmp[EDITLENGTH+1]; // editing buffer temporary workspace
static int osdeditlen=0; // length of characters in edit buffer static int osdeditlen=0; // length of characters in edit buffer
static int osdeditcursor=0; // position of cursor in edit buffer static int osdeditcursor=0; // position of cursor in edit buffer
static int osdeditshift=0; // shift state static int osdeditshift=0; // shift state
static int osdeditcontrol=0; // control state static int osdeditcontrol=0; // control state
static int osdeditcaps=0; // capslock static int osdeditcaps=0; // capslock
static int osdeditwinstart=0; static int osdeditwinstart=0;
static int osdeditwinend=60-1-3; static int osdeditwinend=60-1-3;
#define editlinewidth (osdcols-1-3) #define editlinewidth (osdcols-1-3)
// command processing // command processing
#define HISTORYDEPTH 32 #define HISTORYDEPTH 32
static int osdhistorypos=-1; // position we are at in the history buffer static int osdhistorypos=-1; // position we are at in the history buffer
static char osdhistorybuf[HISTORYDEPTH][EDITLENGTH+1]; // history strings static char osdhistorybuf[HISTORYDEPTH][EDITLENGTH+1]; // history strings
static int osdhistorysize=0; // number of entries in history static int osdhistorysize=0; // number of entries in history
static int osdhistorytotal=0; // number of total history entries static int osdhistorytotal=0; // number of total history entries
// execution buffer // execution buffer
// the execution buffer works from the command history // the execution buffer works from the command history
static int osdexeccount=0; // number of lines from the head of the history buffer to execute static int osdexeccount=0; // number of lines from the head of the history buffer to execute
// maximal log line count // maximal log line count
static int logcutoff=120000; static int logcutoff=120000;
int OSD_errors=0;
static int linecnt; static int linecnt;
static int osdexecscript=0; static int osdexecscript=0;
#ifdef _WIN32 #ifdef _WIN32
@ -747,8 +748,8 @@ static int OSD_FindDiffPoint(const char *str1, const char *str2)
// //
// OSD_HandleKey() -- Handles keyboard input when capturing input. // OSD_HandleKey() -- Handles keyboard input when capturing input.
// Returns 0 if the key was handled internally, or the scancode if it should // Returns 0 if the key was handled internally, or the scancode if it should
// be passed on to the game. // be passed on to the game.
// //
static void OSD_HistoryPrev(void) static void OSD_HistoryPrev(void)
@ -813,18 +814,18 @@ int OSD_HandleChar(char ch)
if (!osdinited || !osdinput) return ch; if (!osdinited || !osdinput) return ch;
if (ch != 9) lastmatch = NULL; // tab if (ch != 9) lastmatch = NULL; // tab
if (ch == 1) // control a. jump to beginning of line if (ch == 1) // control a. jump to beginning of line
{ {
osdeditcursor=0; osdeditcursor=0;
osdeditwinstart=0; osdeditwinstart=0;
osdeditwinend=editlinewidth; osdeditwinend=editlinewidth;
} }
else if (ch == 2) // control b, move one character left else if (ch == 2) // control b, move one character left
{ {
if (osdeditcursor > 0) osdeditcursor--; if (osdeditcursor > 0) osdeditcursor--;
} }
else if (ch == 3) // control c else if (ch == 3) // control c
{ {
osdeditbuf[osdeditlen] = 0; osdeditbuf[osdeditlen] = 0;
OSD_Printf("%s\n",osdeditbuf); OSD_Printf("%s\n",osdeditbuf);
@ -834,7 +835,7 @@ int OSD_HandleChar(char ch)
osdeditwinend=editlinewidth; osdeditwinend=editlinewidth;
osdeditbuf[0] = 0; osdeditbuf[0] = 0;
} }
else if (ch == 5) // control e, jump to end of line else if (ch == 5) // control e, jump to end of line
{ {
osdeditcursor = osdeditlen; osdeditcursor = osdeditlen;
osdeditwinend = osdeditcursor; osdeditwinend = osdeditcursor;
@ -845,11 +846,11 @@ int OSD_HandleChar(char ch)
osdeditwinend = editlinewidth; osdeditwinend = editlinewidth;
} }
} }
else if (ch == 6) // control f, move one character right else if (ch == 6) // control f, move one character right
{ {
if (osdeditcursor < osdeditlen) osdeditcursor++; if (osdeditcursor < osdeditlen) osdeditcursor++;
} }
else if (ch == 8 || ch == 127) // control h, backspace else if (ch == 8 || ch == 127) // control h, backspace
{ {
if (!osdeditcursor || !osdeditlen) return 0; if (!osdeditcursor || !osdeditlen) return 0;
if (!osdovertype) if (!osdovertype)
@ -861,7 +862,7 @@ int OSD_HandleChar(char ch)
osdeditcursor--; osdeditcursor--;
if (osdeditcursor<osdeditwinstart) osdeditwinstart--,osdeditwinend--; if (osdeditcursor<osdeditwinstart) osdeditwinstart--,osdeditwinend--;
} }
else if (ch == 9) // tab else if (ch == 9) // tab
{ {
int commonsize = 512; int commonsize = 512;
@ -925,7 +926,7 @@ int OSD_HandleChar(char ch)
{ {
tabc = findsymbol(osdedittmp, lastmatch->next); tabc = findsymbol(osdedittmp, lastmatch->next);
if (!tabc && lastmatch) if (!tabc && lastmatch)
tabc = findsymbol(osdedittmp, NULL); // wrap */ tabc = findsymbol(osdedittmp, NULL); // wrap */
} }
if (tabc) if (tabc)
@ -947,17 +948,17 @@ int OSD_HandleChar(char ch)
lastmatch = tabc; lastmatch = tabc;
} }
} }
else if (ch == 11) // control k, delete all to end of line else if (ch == 11) // control k, delete all to end of line
{ {
Bmemset(osdeditbuf+osdeditcursor,0,sizeof(osdeditbuf)-osdeditcursor); Bmemset(osdeditbuf+osdeditcursor,0,sizeof(osdeditbuf)-osdeditcursor);
} }
else if (ch == 12) // control l, clear screen else if (ch == 12) // control l, clear screen
{ {
Bmemset(osdtext,0,sizeof(osdtext)); Bmemset(osdtext,0,sizeof(osdtext));
Bmemset(osdfmt,osdtextpal+(osdtextshade<<5),sizeof(osdfmt)); Bmemset(osdfmt,osdtextpal+(osdtextshade<<5),sizeof(osdfmt));
osdlines = 1; osdlines = 1;
} }
else if (ch == 13) // control m, enter else if (ch == 13) // control m, enter
{ {
if (osdeditlen>0) if (osdeditlen>0)
{ {
@ -990,18 +991,18 @@ int OSD_HandleChar(char ch)
osdeditwinstart=0; osdeditwinstart=0;
osdeditwinend=editlinewidth; osdeditwinend=editlinewidth;
} }
else if (ch == 14) // control n, next (ie. down arrow) else if (ch == 14) // control n, next (ie. down arrow)
{ {
OSD_HistoryNext(); OSD_HistoryNext();
} }
else if (ch == 16) // control p, previous (ie. up arrow) else if (ch == 16) // control p, previous (ie. up arrow)
{ {
OSD_HistoryPrev(); OSD_HistoryPrev();
} }
else if (ch == 20) // control t, swap previous two chars else if (ch == 20) // control t, swap previous two chars
{ {
} }
else if (ch == 21) // control u, delete all to beginning else if (ch == 21) // control u, delete all to beginning
{ {
if (osdeditcursor>0 && osdeditlen) if (osdeditcursor>0 && osdeditlen)
{ {
@ -1013,7 +1014,7 @@ int OSD_HandleChar(char ch)
osdeditwinend = editlinewidth; osdeditwinend = editlinewidth;
} }
} }
else if (ch == 23) // control w, delete one word back else if (ch == 23) // control w, delete one word back
{ {
if (osdeditcursor>0 && osdeditlen>0) if (osdeditcursor>0 && osdeditlen>0)
{ {
@ -1031,9 +1032,9 @@ int OSD_HandleChar(char ch)
} }
} }
} }
else if (ch >= 32) // text char else if (ch >= 32) // text char
{ {
if (!osdovertype && osdeditlen == EDITLENGTH) // buffer full, can't insert another char if (!osdovertype && osdeditlen == EDITLENGTH) // buffer full, can't insert another char
return 0; return 0;
if (!osdovertype) if (!osdovertype)
@ -1082,17 +1083,17 @@ int OSD_HandleScanCode(int sc, int press)
{ {
if (sc == 42 || sc == 54) // shift if (sc == 42 || sc == 54) // shift
osdeditshift = 0; osdeditshift = 0;
if (sc == 29 || sc == 157) // control if (sc == 29 || sc == 157) // control
osdeditcontrol = 0; osdeditcontrol = 0;
return 0;//sc; return 0;//sc;
} }
keytime = gettime(); keytime = gettime();
if (sc == 15) // tab if (sc == 15) // tab
{ {
} }
else if (sc == 1) // escape else if (sc == 1) // escape
{ {
// OSD_ShowDisplay(0); // OSD_ShowDisplay(0);
osdscroll = -1; osdscroll = -1;
@ -1100,17 +1101,17 @@ int OSD_HandleScanCode(int sc, int press)
OSD_CaptureInput(0); OSD_CaptureInput(0);
osdscrtime = getticks(); osdscrtime = getticks();
} }
else if (sc == 201) // page up else if (sc == 201) // page up
{ {
if (osdhead < osdlines-1) if (osdhead < osdlines-1)
osdhead++; osdhead++;
} }
else if (sc == 209) // page down else if (sc == 209) // page down
{ {
if (osdhead > 0) if (osdhead > 0)
osdhead--; osdhead--;
} }
else if (sc == 199) // home else if (sc == 199) // home
{ {
if (osdeditcontrol) if (osdeditcontrol)
{ {
@ -1123,7 +1124,7 @@ int OSD_HandleScanCode(int sc, int press)
osdeditwinend = osdeditwinstart+editlinewidth; osdeditwinend = osdeditwinstart+editlinewidth;
} }
} }
else if (sc == 207) // end else if (sc == 207) // end
{ {
if (osdeditcontrol) if (osdeditcontrol)
{ {
@ -1141,11 +1142,11 @@ int OSD_HandleScanCode(int sc, int press)
} }
} }
} }
else if (sc == 210) // insert else if (sc == 210) // insert
{ {
osdovertype ^= 1; osdovertype ^= 1;
} }
else if (sc == 203) // left else if (sc == 203) // left
{ {
if (osdeditcursor>0) if (osdeditcursor>0)
{ {
@ -1168,7 +1169,7 @@ int OSD_HandleScanCode(int sc, int press)
osdeditwinend-=(osdeditwinstart-osdeditcursor), osdeditwinend-=(osdeditwinstart-osdeditcursor),
osdeditwinstart-=(osdeditwinstart-osdeditcursor); osdeditwinstart-=(osdeditwinstart-osdeditcursor);
} }
else if (sc == 205) // right else if (sc == 205) // right
{ {
if (osdeditcursor<osdeditlen) if (osdeditcursor<osdeditlen)
{ {
@ -1191,33 +1192,33 @@ int OSD_HandleScanCode(int sc, int press)
osdeditwinstart+=(osdeditcursor-osdeditwinend), osdeditwinstart+=(osdeditcursor-osdeditwinend),
osdeditwinend+=(osdeditcursor-osdeditwinend); osdeditwinend+=(osdeditcursor-osdeditwinend);
} }
else if (sc == 200) // up else if (sc == 200) // up
{ {
OSD_HistoryPrev(); OSD_HistoryPrev();
} }
else if (sc == 208) // down else if (sc == 208) // down
{ {
OSD_HistoryNext(); OSD_HistoryNext();
} }
else if (sc == 42 || sc == 54) // shift else if (sc == 42 || sc == 54) // shift
{ {
osdeditshift = 1; osdeditshift = 1;
} }
else if (sc == 29 || sc == 157) // control else if (sc == 29 || sc == 157) // control
{ {
osdeditcontrol = 1; osdeditcontrol = 1;
} }
else if (sc == 58) // capslock else if (sc == 58) // capslock
{ {
osdeditcaps ^= 1; osdeditcaps ^= 1;
} }
else if (sc == 28 || sc == 156) // enter else if (sc == 28 || sc == 156) // enter
{ {
} }
else if (sc == 14) // backspace else if (sc == 14) // backspace
{ {
} }
else if (sc == 211) // delete else if (sc == 211) // delete
{ {
if (osdeditcursor == osdeditlen || !osdeditlen) return 0; if (osdeditcursor == osdeditlen || !osdeditlen) return 0;
if (osdeditcursor <= osdeditlen-1) Bmemmove(osdeditbuf+osdeditcursor, osdeditbuf+osdeditcursor+1, osdeditlen-osdeditcursor-1); if (osdeditcursor <= osdeditlen-1) Bmemmove(osdeditbuf+osdeditcursor, osdeditbuf+osdeditcursor+1, osdeditlen-osdeditcursor-1);
@ -1230,7 +1231,7 @@ int OSD_HandleScanCode(int sc, int press)
// //
// OSD_ResizeDisplay() -- Handles readjustment of the display when the screen resolution // OSD_ResizeDisplay() -- Handles readjustment of the display when the screen resolution
// changes on us. // changes on us.
// //
void OSD_ResizeDisplay(int w, int h) void OSD_ResizeDisplay(int w, int h)
{ {
@ -1385,7 +1386,7 @@ static inline void linefeed(void)
Bmemset(osdfmt, osdtextpal, osdcols); Bmemset(osdfmt, osdtextpal, osdcols);
if (osdlines < osdmaxlines) osdlines++; if (osdlines < osdmaxlines) osdlines++;
} }
#define MAX_ERRORS 4096
void OSD_Printf(const char *fmt, ...) void OSD_Printf(const char *fmt, ...)
{ {
static char tmpstr[1024]; static char tmpstr[1024];
@ -1398,6 +1399,16 @@ void OSD_Printf(const char *fmt, ...)
Bvsnprintf(tmpstr, 1024, fmt, va); Bvsnprintf(tmpstr, 1024, fmt, va);
va_end(va); va_end(va);
if (tmpstr[0]=='^' && tmpstr[1]=='1' && tmpstr[2]=='0' && ++OSD_errors > MAX_ERRORS)
{
if(OSD_errors == MAX_ERRORS+1) Bstrcpy(tmpstr,OSD_ERROR "\nToo many errors. Logging errors stopped.\n");
else
{
OSD_errors=MAX_ERRORS+2;
return;
}
}
if (linecnt<logcutoff) if (linecnt<logcutoff)
{ {
if (osdlog&&(!logcutoff||linecnt<logcutoff)) if (osdlog&&(!logcutoff||linecnt<logcutoff))

View file

@ -652,8 +652,8 @@ int32 CONFIG_ReadSetup(void)
SCRIPT_GetString(ud.config.scripthandle, "Setup","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, "Setup","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);
@ -1120,7 +1120,7 @@ void CONFIG_WriteSetup(void)
SCRIPT_PutString(ud.config.scripthandle, "Setup","SelectedGRP",&duke3dgrp[0]); SCRIPT_PutString(ud.config.scripthandle, "Setup","SelectedGRP",&duke3dgrp[0]);
SCRIPT_PutString(ud.config.scripthandle, "Setup","ModDir",&mod_dir[0]); // SCRIPT_PutString(ud.config.scripthandle, "Setup","ModDir",&mod_dir[0]);
{ {
char commmacro[] = "CommbatMacro# "; char commmacro[] = "CommbatMacro# ";

View file

@ -54,6 +54,7 @@ extern int getversionfromwebsite(char *buffer);
#define UPDATEINTERVAL 604800 // 1w #define UPDATEINTERVAL 604800 // 1w
#else #else
static int usecwd = 0; static int usecwd = 0;
int checkCON = 1;
#endif /* _WIN32 */ #endif /* _WIN32 */
#define IDFSIZE 479985668 #define IDFSIZE 479985668
@ -82,6 +83,7 @@ static struct strllist
*CommandPaths = NULL, *CommandGrps = NULL; *CommandPaths = NULL, *CommandGrps = NULL;
char boardfilename[BMAX_PATH] = {0}; char boardfilename[BMAX_PATH] = {0};
char root[BMAX_PATH];
char waterpal[768], slimepal[768], titlepal[768], drealms[768], endingpal[768], animpal[768]; char waterpal[768], slimepal[768], titlepal[768], drealms[768], endingpal[768], animpal[768];
static char firstdemofile[80] = { '\0' }; static char firstdemofile[80] = { '\0' };
static int userconfiles = 0; static int userconfiles = 0;
@ -7431,11 +7433,7 @@ PALONLY:
for (j=0;j < spritesortcnt; j++) for (j=0;j < spritesortcnt; j++)
{ {
if (display_mirror) tsprite[j].statnum = TSPR_MIRROR; if (display_mirror) tsprite[j].statnum = TSPR_MIRROR;
if (tsprite[j].owner > 0 && tsprite[j].owner < MAXSPRITES && spriteext[tsprite[j].owner].flags & SPREXT_TSPRACCESS) OnEvent(EVENT_ANIMATESPRITES, j, myconnectindex, -1);
{
OnEvent(EVENT_ANIMATESPRITES,tsprite[j].owner, myconnectindex, -1);
spriteext[tsprite[j].owner].tspr = NULL;
}
} }
} }
#ifdef _MSC_VER #ifdef _MSC_VER
@ -8659,6 +8657,7 @@ static void comlinehelp(void)
#if !defined(_WIN32) #if !defined(_WIN32)
"-usecwd\t\tRead game data and configuration file from working directory\n" "-usecwd\t\tRead game data and configuration file from working directory\n"
#endif #endif
"-sloppycmd\t\tAllows EDuke to execute unsafe commands. (for compatibility only)\n"
"-vNUM\t\tWarp to volume NUM (1-4), see -l\n" "-vNUM\t\tWarp to volume NUM (1-4), see -l\n"
"-xFILE\t\tLoad CON script FILE (default EDUKE.CON/GAME.CON)\n" "-xFILE\t\tLoad CON script FILE (default EDUKE.CON/GAME.CON)\n"
"-zNUM,\n-condebug\tLine-by-line CON compilation debugging, NUM is verbosity\n" "-zNUM,\n-condebug\tLine-by-line CON compilation debugging, NUM is verbosity\n"
@ -9416,6 +9415,12 @@ static void checkcommandline(int argc, const char **argv)
continue; continue;
} }
#endif #endif
if (!Bstrcasecmp(c+1,"sloppycmd"))
{
checkCON = 0;
i++;
continue;
}
if (!Bstrcasecmp(c+1,"cachesize")) if (!Bstrcasecmp(c+1,"cachesize"))
{ {
if (argc > i+1) if (argc > i+1)
@ -10294,6 +10299,7 @@ static void Startup(void)
if (getcwd(cwd,BMAX_PATH) && mod_dir[0] != '/') if (getcwd(cwd,BMAX_PATH) && mod_dir[0] != '/')
{ {
chdir(mod_dir); chdir(mod_dir);
// initprintf("root '%s'\nmod '%s'\ncwd '%s'\n",root,mod_dir,cwd);
if (loadpics("tiles000.art",MAXCACHE1DSIZE) < 0) if (loadpics("tiles000.art",MAXCACHE1DSIZE) < 0)
{ {
chdir(cwd); chdir(cwd);
@ -10534,7 +10540,6 @@ void app_main(int argc,const char **argv)
{ {
int i, j; int i, j;
char cwd[BMAX_PATH]; char cwd[BMAX_PATH];
char root[BMAX_PATH];
extern char datetimestring[]; extern char datetimestring[];
#ifdef RENDERTYPEWIN #ifdef RENDERTYPEWIN
@ -10555,7 +10560,8 @@ void app_main(int argc,const char **argv)
Bcorrectfilename(root,1); Bcorrectfilename(root,1);
chdir(root); chdir(root);
#else #else
Bmemset(root,0,sizeof(root)); getcwd(root,BMAX_PATH);
strcat(root,"/");
#endif #endif
OSD_SetLogFile("eduke32.log"); OSD_SetLogFile("eduke32.log");

View file

@ -495,7 +495,8 @@ const memberlabel_t sectorlabels[]=
{ "floorxpanning", SECTOR_FLOORXPANNING, 0, 0 }, { "floorxpanning", SECTOR_FLOORXPANNING, 0, 0 },
{ "floorypanning", SECTOR_FLOORYPANNING, 0, 0 }, { "floorypanning", SECTOR_FLOORYPANNING, 0, 0 },
{ "visibility", SECTOR_VISIBILITY, 0, 0 }, { "visibility", SECTOR_VISIBILITY, 0, 0 },
{ "alignto", SECTOR_ALIGNTO, 0, 0 }, { "filler", SECTOR_ALIGNTO, 0, 0 },
{ "alignto", SECTOR_ALIGNTO, 0, 0 }, // aka filler, not used
{ "lotag", SECTOR_LOTAG, 0, 0 }, { "lotag", SECTOR_LOTAG, 0, 0 },
{ "hitag", SECTOR_HITAG, 0, 0 }, { "hitag", SECTOR_HITAG, 0, 0 },
{ "extra", SECTOR_EXTRA, 0, 0 }, { "extra", SECTOR_EXTRA, 0, 0 },
@ -534,7 +535,8 @@ const memberlabel_t actorlabels[]=
{ "shade", ACTOR_SHADE, 0, 0 }, { "shade", ACTOR_SHADE, 0, 0 },
{ "pal", ACTOR_PAL, 0, 0 }, { "pal", ACTOR_PAL, 0, 0 },
{ "clipdist", ACTOR_CLIPDIST, 0, 0 }, { "clipdist", ACTOR_CLIPDIST, 0, 0 },
{ "detail", ACTOR_DETAIL, 0, 0 }, { "filler", ACTOR_DETAIL, 0, 0 },
{ "detail", ACTOR_DETAIL, 0, 0 }, // aka filler, not used
{ "xrepeat", ACTOR_XREPEAT, 0, 0 }, { "xrepeat", ACTOR_XREPEAT, 0, 0 },
{ "yrepeat", ACTOR_YREPEAT, 0, 0 }, { "yrepeat", ACTOR_YREPEAT, 0, 0 },
{ "xoffset", ACTOR_XOFFSET, 0, 0 }, { "xoffset", ACTOR_XOFFSET, 0, 0 },
@ -591,19 +593,32 @@ const memberlabel_t tsprlabels[]=
{ {
// tsprite access // tsprite access
{ "tsprx", ACTOR_TSPRX, 0, 0 }, { "tsprx", ACTOR_X, 0, 0 },
{ "tspry", ACTOR_TSPRY, 0, 0 }, { "tspry", ACTOR_Y, 0, 0 },
{ "tsprz", ACTOR_TSPRZ, 0, 0 }, { "tsprz", ACTOR_Z, 0, 0 },
{ "tsprcstat", ACTOR_TSPRCSTAT, 0, 0 }, { "tsprcstat", ACTOR_CSTAT, 0, 0 },
{ "tsprpicnum", ACTOR_TSPRPICNUM, 0, 0 }, { "tsprpicnum", ACTOR_PICNUM, 0, 0 },
{ "tsprshade", ACTOR_TSPRSHADE, 0, 0 }, { "tsprshade", ACTOR_SHADE, 0, 0 },
{ "tsprpal", ACTOR_TSPRPAL, 0, 0 }, { "tsprpal", ACTOR_PAL, 0, 0 },
{ "tsprxrepeat", ACTOR_TSPRXREPEAT, 0, 0 }, { "tsprclipdist", ACTOR_CLIPDIST, 0, 0 },
{ "tspryrepeat", ACTOR_TSPRYREPEAT, 0, 0 }, { "tsprfiller", ACTOR_DETAIL, 0, 0 },
{ "tsprxoffset", ACTOR_TSPRXOFFSET, 0, 0 }, { "tsprdetail", ACTOR_DETAIL, 0, 0 }, // aka filler, not used
{ "tspryoffset", ACTOR_TSPRYOFFSET, 0, 0 }, { "tsprxrepeat", ACTOR_XREPEAT, 0, 0 },
{ "tsprsectnum", ACTOR_TSPRSECTNUM, 0, 0 }, { "tspryrepeat", ACTOR_YREPEAT, 0, 0 },
{ "tsprang", ACTOR_TSPRANG, 0, 0 }, { "tsprxoffset", ACTOR_XOFFSET, 0, 0 },
{ "tspryoffset", ACTOR_YOFFSET, 0, 0 },
{ "tsprsectnum", ACTOR_SECTNUM, 0, 0 },
{ "tsprstatnum", ACTOR_STATNUM, 0, 0 },
{ "tsprang", ACTOR_ANG, 0, 0 },
{ "tsprowner", ACTOR_OWNER, 0, 0 },
#if 1
{ "tsprxvel", ACTOR_XVEL, 0, 0 },
{ "tspryvel", ACTOR_YVEL, 0, 0 },
{ "tsprzvel", ACTOR_ZVEL, 0, 0 },
{ "tsprlotag", ACTOR_LOTAG, 0, 0 },
{ "tsprhitag", ACTOR_HITAG, 0, 0 },
{ "tsprextra", ACTOR_EXTRA, 0, 0 },
#endif
{ "", -1, 0, 0 } // END OF LIST { "", -1, 0, 0 } // END OF LIST
}; };

View file

@ -450,23 +450,6 @@ enum actorlabels
ACTOR_HTFLAGS, ACTOR_HTFLAGS,
}; };
enum tsprlabels
{
ACTOR_TSPRX,
ACTOR_TSPRY,
ACTOR_TSPRZ,
ACTOR_TSPRCSTAT,
ACTOR_TSPRPICNUM,
ACTOR_TSPRSHADE,
ACTOR_TSPRPAL,
ACTOR_TSPRXREPEAT,
ACTOR_TSPRYREPEAT,
ACTOR_TSPRXOFFSET,
ACTOR_TSPRYOFFSET,
ACTOR_TSPRSECTNUM,
ACTOR_TSPRANG,
};
enum inputlabels enum inputlabels
{ {
INPUT_AVEL, INPUT_AVEL,

View file

@ -43,6 +43,7 @@ static int killit_flag;
int line_num; int line_num;
int g_tw; int g_tw;
extern const char *keyw[]; extern const char *keyw[];
extern int checkCON;
static int parse(void); static int parse(void);
@ -907,7 +908,7 @@ static void DoThisProjectile(int iSet, int lVar1, int lLabelID, int lVar2)
if (lVar1 != g_iThisActorID) if (lVar1 != g_iThisActorID)
proj=GetGameVarID(lVar1, g_i, g_p); proj=GetGameVarID(lVar1, g_i, g_p);
if (proj < 0 || proj >= MAXSPRITES) if ((proj < 0 || proj >= MAXSPRITES) && checkCON)
{ {
// OSD_Printf("DoThisProjectile(): invalid projectile (%d)\n",proj); // OSD_Printf("DoThisProjectile(): invalid projectile (%d)\n",proj);
OSD_Printf(CON_ERROR "tried to %s %s on invalid target projectile (%d) %d %d from %s\n",line_num,keyw[g_tw], OSD_Printf(CON_ERROR "tried to %s %s on invalid target projectile (%d) %d %d from %s\n",line_num,keyw[g_tw],
@ -1187,7 +1188,7 @@ static void DoPlayer(int iSet, int lVar1, int lLabelID, int lVar2, int lParm2)
if (lVar1 != g_iThisActorID) if (lVar1 != g_iThisActorID)
iPlayer=GetGameVarID(lVar1, g_i, g_p); iPlayer=GetGameVarID(lVar1, g_i, g_p);
if (iPlayer<0 || iPlayer >= ud.multimode) if ((iPlayer<0 || iPlayer >= ud.multimode) && checkCON)
{ {
// OSD_Printf("DoPlayer(): invalid target player (%d) %d\n",iPlayer,g_i); // OSD_Printf("DoPlayer(): invalid target player (%d) %d\n",iPlayer,g_i);
OSD_Printf(CON_ERROR "tried to %s %s on invalid target player (%d) from spr %d gv %s\n",line_num,keyw[g_tw], OSD_Printf(CON_ERROR "tried to %s %s on invalid target player (%d) from spr %d gv %s\n",line_num,keyw[g_tw],
@ -1197,7 +1198,7 @@ static void DoPlayer(int iSet, int lVar1, int lLabelID, int lVar2, int lParm2)
return; return;
} }
if (playerlabels[lLabelID].flags & LABEL_HASPARM2 && (lParm2 < 0 || lParm2 >= playerlabels[lLabelID].maxParm2)) if ((playerlabels[lLabelID].flags & LABEL_HASPARM2 && (lParm2 < 0 || lParm2 >= playerlabels[lLabelID].maxParm2)) && checkCON)
{ {
OSD_Printf(CON_ERROR "tried to %s invalid %s position %d on player (%d) from spr %d\n",line_num,keyw[g_tw], OSD_Printf(CON_ERROR "tried to %s invalid %s position %d on player (%d) from spr %d\n",line_num,keyw[g_tw],
iSet?"set":"get",playerlabels[lLabelID].name,lParm2,iPlayer,g_i); iSet?"set":"get",playerlabels[lLabelID].name,lParm2,iPlayer,g_i);
@ -2536,7 +2537,7 @@ static void DoInput(int iSet, int lVar1, int lLabelID, int lVar2)
if (lVar1 != g_iThisActorID) if (lVar1 != g_iThisActorID)
iPlayer=GetGameVarID(lVar1, g_i, g_p); iPlayer=GetGameVarID(lVar1, g_i, g_p);
if (iPlayer<0 || iPlayer >= ud.multimode) if ((iPlayer<0 || iPlayer >= ud.multimode) && checkCON)
{ {
insptr += (lVar2 == MAXGAMEVARS); insptr += (lVar2 == MAXGAMEVARS);
OSD_Printf(CON_ERROR "invalid target player (%d) %d\n",line_num,keyw[g_tw],iPlayer,g_i); OSD_Printf(CON_ERROR "invalid target player (%d) %d\n",line_num,keyw[g_tw],iPlayer,g_i);
@ -2611,7 +2612,7 @@ static void DoWall(int iSet, int lVar1, int lLabelID, int lVar2)
int lValue=0; int lValue=0;
int iWall = GetGameVarID(lVar1, g_i, g_p); int iWall = GetGameVarID(lVar1, g_i, g_p);
if (iWall<0 || iWall >= numwalls) if ((iWall<0 || iWall >= numwalls) && checkCON)
{ {
insptr += (lVar2 == MAXGAMEVARS); insptr += (lVar2 == MAXGAMEVARS);
OSD_Printf(CON_ERROR "Invalid wall %d\n",line_num,keyw[g_tw],iWall); OSD_Printf(CON_ERROR "Invalid wall %d\n",line_num,keyw[g_tw],iWall);
@ -2788,7 +2789,7 @@ static void DoSector(int iSet, int lVar1, int lLabelID, int lVar2)
if (lVar1 != g_iThisActorID) if (lVar1 != g_iThisActorID)
iSector=GetGameVarID(lVar1, g_i, g_p); iSector=GetGameVarID(lVar1, g_i, g_p);
if (iSector<0 || iSector >= numsectors) if ((iSector<0 || iSector >= numsectors) && checkCON)
{ {
OSD_Printf(CON_ERROR "Invalid sector %d\n",line_num,keyw[g_tw],iSector); OSD_Printf(CON_ERROR "Invalid sector %d\n",line_num,keyw[g_tw],iSector);
insptr += (lVar2 == MAXGAMEVARS); insptr += (lVar2 == MAXGAMEVARS);
@ -3020,7 +3021,7 @@ static void DoActor(int iSet, int lVar1, int lLabelID, int lVar2, int lParm2)
if (lVar1 != g_iThisActorID) if (lVar1 != g_iThisActorID)
iActor=GetGameVarID(lVar1, g_i, g_p); iActor=GetGameVarID(lVar1, g_i, g_p);
if (iActor < 0 || iActor >= MAXSPRITES) if ((iActor < 0 || iActor >= MAXSPRITES) && checkCON)
{ {
OSD_Printf(CON_ERROR "tried to %s %s on invalid target sprite (%d) from spr %d pic %d gv %s\n",line_num,keyw[g_tw], OSD_Printf(CON_ERROR "tried to %s %s on invalid target sprite (%d) from spr %d pic %d gv %s\n",line_num,keyw[g_tw],
iSet?"set":"get",actorlabels[lLabelID].name,iActor,g_i,g_sp->picnum, iSet?"set":"get",actorlabels[lLabelID].name,iActor,g_i,g_sp->picnum,
@ -3029,7 +3030,7 @@ static void DoActor(int iSet, int lVar1, int lLabelID, int lVar2, int lParm2)
return; return;
} }
if (actorlabels[lLabelID].flags & LABEL_HASPARM2 && (lParm2 < 0 || lParm2 >= actorlabels[lLabelID].maxParm2)) if ((actorlabels[lLabelID].flags & LABEL_HASPARM2 && (lParm2 < 0 || lParm2 >= actorlabels[lLabelID].maxParm2)) && checkCON)
{ {
OSD_Printf(CON_ERROR "tried to %s invalid %s position %d on sprite (%d) from spr %d\n",line_num,keyw[g_tw], OSD_Printf(CON_ERROR "tried to %s invalid %s position %d on sprite (%d) from spr %d\n",line_num,keyw[g_tw],
iSet?"set":"get",actorlabels[lLabelID].name,lParm2,iActor,g_i); iSet?"set":"get",actorlabels[lLabelID].name,lParm2,iActor,g_i);
@ -3514,7 +3515,7 @@ static void DoTsprite(int iSet, int lVar1, int lLabelID, int lVar2)
if (lVar1 != g_iThisActorID) if (lVar1 != g_iThisActorID)
iActor=GetGameVarID(lVar1, g_i, g_p); iActor=GetGameVarID(lVar1, g_i, g_p);
if (iActor < 0 || iActor >= MAXSPRITES) if ((iActor < 0 || iActor >= MAXSPRITES) && checkCON)
{ {
OSD_Printf(CON_ERROR "invalid target sprite (%d) %d %d\n",line_num,keyw[g_tw],iActor,g_i,g_sp->picnum); OSD_Printf(CON_ERROR "invalid target sprite (%d) %d %d\n",line_num,keyw[g_tw],iActor,g_i,g_sp->picnum);
insptr += (lVar2 == MAXGAMEVARS); insptr += (lVar2 == MAXGAMEVARS);
@ -3524,12 +3525,15 @@ static void DoTsprite(int iSet, int lVar1, int lLabelID, int lVar2)
if (iSet) if (iSet)
lValue=GetGameVarID(lVar2, g_i, g_p); lValue=GetGameVarID(lVar2, g_i, g_p);
if (!spriteext[iActor].tspr) if ((!spriteext[iActor].tspr) && checkCON)
{
OSD_Printf(CON_ERROR "Internal bug, tsprite is unavailable\n",line_num,keyw[g_tw]);
return; return;
}
switch (lLabelID) switch (lLabelID)
{ {
case ACTOR_TSPRX: case ACTOR_X:
if (iSet) if (iSet)
{ {
spriteext[iActor].tspr->x=lValue; spriteext[iActor].tspr->x=lValue;
@ -3538,7 +3542,7 @@ static void DoTsprite(int iSet, int lVar1, int lLabelID, int lVar2)
SetGameVarID(lVar2, spriteext[iActor].tspr->x,g_i,g_p); SetGameVarID(lVar2, spriteext[iActor].tspr->x,g_i,g_p);
return; return;
case ACTOR_TSPRY: case ACTOR_Y:
if (iSet) if (iSet)
{ {
spriteext[iActor].tspr->y=lValue; spriteext[iActor].tspr->y=lValue;
@ -3547,7 +3551,7 @@ static void DoTsprite(int iSet, int lVar1, int lLabelID, int lVar2)
SetGameVarID(lVar2, spriteext[iActor].tspr->y,g_i,g_p); SetGameVarID(lVar2, spriteext[iActor].tspr->y,g_i,g_p);
return; return;
case ACTOR_TSPRZ: case ACTOR_Z:
if (iSet) if (iSet)
{ {
spriteext[iActor].tspr->z=lValue; spriteext[iActor].tspr->z=lValue;
@ -3556,7 +3560,7 @@ static void DoTsprite(int iSet, int lVar1, int lLabelID, int lVar2)
SetGameVarID(lVar2, spriteext[iActor].tspr->z,g_i,g_p); SetGameVarID(lVar2, spriteext[iActor].tspr->z,g_i,g_p);
return; return;
case ACTOR_TSPRCSTAT: case ACTOR_CSTAT:
if (iSet) if (iSet)
{ {
spriteext[iActor].tspr->cstat=lValue; spriteext[iActor].tspr->cstat=lValue;
@ -3565,7 +3569,7 @@ static void DoTsprite(int iSet, int lVar1, int lLabelID, int lVar2)
SetGameVarID(lVar2, spriteext[iActor].tspr->cstat,g_i,g_p); SetGameVarID(lVar2, spriteext[iActor].tspr->cstat,g_i,g_p);
return; return;
case ACTOR_TSPRPICNUM: case ACTOR_PICNUM:
if (iSet) if (iSet)
{ {
spriteext[iActor].tspr->picnum=lValue; spriteext[iActor].tspr->picnum=lValue;
@ -3574,7 +3578,7 @@ static void DoTsprite(int iSet, int lVar1, int lLabelID, int lVar2)
SetGameVarID(lVar2, spriteext[iActor].tspr->picnum,g_i,g_p); SetGameVarID(lVar2, spriteext[iActor].tspr->picnum,g_i,g_p);
return; return;
case ACTOR_TSPRSHADE: case ACTOR_SHADE:
if (iSet) if (iSet)
{ {
spriteext[iActor].tspr->shade=lValue; spriteext[iActor].tspr->shade=lValue;
@ -3583,7 +3587,7 @@ static void DoTsprite(int iSet, int lVar1, int lLabelID, int lVar2)
SetGameVarID(lVar2, spriteext[iActor].tspr->shade,g_i,g_p); SetGameVarID(lVar2, spriteext[iActor].tspr->shade,g_i,g_p);
return; return;
case ACTOR_TSPRPAL: case ACTOR_PAL:
if (iSet) if (iSet)
{ {
spriteext[iActor].tspr->pal=lValue; spriteext[iActor].tspr->pal=lValue;
@ -3592,7 +3596,25 @@ static void DoTsprite(int iSet, int lVar1, int lLabelID, int lVar2)
SetGameVarID(lVar2, spriteext[iActor].tspr->pal,g_i,g_p); SetGameVarID(lVar2, spriteext[iActor].tspr->pal,g_i,g_p);
return; return;
case ACTOR_TSPRXREPEAT: case ACTOR_CLIPDIST:
if (iSet)
{
spriteext[iActor].tspr->clipdist=lValue;
return;
}
SetGameVarID(lVar2, spriteext[iActor].tspr->clipdist,g_i,g_p);
return;
case ACTOR_DETAIL:
if (iSet)
{
spriteext[iActor].tspr->filler=lValue;
return;
}
SetGameVarID(lVar2, spriteext[iActor].tspr->filler,g_i,g_p);
return;
case ACTOR_XREPEAT:
if (iSet) if (iSet)
{ {
spriteext[iActor].tspr->xrepeat=lValue; spriteext[iActor].tspr->xrepeat=lValue;
@ -3601,7 +3623,7 @@ static void DoTsprite(int iSet, int lVar1, int lLabelID, int lVar2)
SetGameVarID(lVar2, spriteext[iActor].tspr->xrepeat,g_i,g_p); SetGameVarID(lVar2, spriteext[iActor].tspr->xrepeat,g_i,g_p);
return; return;
case ACTOR_TSPRYREPEAT: case ACTOR_YREPEAT:
if (iSet) if (iSet)
{ {
spriteext[iActor].tspr->yrepeat=lValue; spriteext[iActor].tspr->yrepeat=lValue;
@ -3610,7 +3632,7 @@ static void DoTsprite(int iSet, int lVar1, int lLabelID, int lVar2)
SetGameVarID(lVar2, spriteext[iActor].tspr->yrepeat,g_i,g_p); SetGameVarID(lVar2, spriteext[iActor].tspr->yrepeat,g_i,g_p);
return; return;
case ACTOR_TSPRXOFFSET: case ACTOR_XOFFSET:
if (iSet) if (iSet)
{ {
spriteext[iActor].tspr->xoffset=lValue; spriteext[iActor].tspr->xoffset=lValue;
@ -3619,7 +3641,7 @@ static void DoTsprite(int iSet, int lVar1, int lLabelID, int lVar2)
SetGameVarID(lVar2, spriteext[iActor].tspr->xoffset,g_i,g_p); SetGameVarID(lVar2, spriteext[iActor].tspr->xoffset,g_i,g_p);
return; return;
case ACTOR_TSPRYOFFSET: case ACTOR_YOFFSET:
if (iSet) if (iSet)
{ {
spriteext[iActor].tspr->yoffset=lValue; spriteext[iActor].tspr->yoffset=lValue;
@ -3628,7 +3650,7 @@ static void DoTsprite(int iSet, int lVar1, int lLabelID, int lVar2)
SetGameVarID(lVar2, spriteext[iActor].tspr->yoffset,g_i,g_p); SetGameVarID(lVar2, spriteext[iActor].tspr->yoffset,g_i,g_p);
return; return;
case ACTOR_TSPRSECTNUM: case ACTOR_SECTNUM:
if (iSet) if (iSet)
{ {
spriteext[iActor].tspr->sectnum=lValue; spriteext[iActor].tspr->sectnum=lValue;
@ -3637,7 +3659,16 @@ static void DoTsprite(int iSet, int lVar1, int lLabelID, int lVar2)
SetGameVarID(lVar2, spriteext[iActor].tspr->sectnum,g_i,g_p); SetGameVarID(lVar2, spriteext[iActor].tspr->sectnum,g_i,g_p);
return; return;
case ACTOR_TSPRANG: case ACTOR_STATNUM:
if (iSet)
{
spriteext[iActor].tspr->statnum=lValue;
return;
}
SetGameVarID(lVar2, spriteext[iActor].tspr->statnum,g_i,g_p);
return;
case ACTOR_ANG:
if (iSet) if (iSet)
{ {
spriteext[iActor].tspr->ang=lValue; spriteext[iActor].tspr->ang=lValue;
@ -3646,6 +3677,71 @@ static void DoTsprite(int iSet, int lVar1, int lLabelID, int lVar2)
SetGameVarID(lVar2, spriteext[iActor].tspr->ang,g_i,g_p); SetGameVarID(lVar2, spriteext[iActor].tspr->ang,g_i,g_p);
return; return;
case ACTOR_OWNER:
if (iSet)
{
spriteext[iActor].tspr->owner=lValue;
return;
}
SetGameVarID(lVar2, spriteext[iActor].tspr->owner,g_i,g_p);
return;
#if 1
case ACTOR_XVEL:
if (iSet)
{
spriteext[iActor].tspr->xvel=lValue;
return;
}
SetGameVarID(lVar2, spriteext[iActor].tspr->xvel,g_i,g_p);
return;
case ACTOR_YVEL:
if (iSet)
{
spriteext[iActor].tspr->yvel=lValue;
return;
}
SetGameVarID(lVar2, spriteext[iActor].tspr->yvel,g_i,g_p);
return;
case ACTOR_ZVEL:
if (iSet)
{
spriteext[iActor].tspr->zvel=lValue;
return;
}
SetGameVarID(lVar2, spriteext[iActor].tspr->zvel,g_i,g_p);
return;
case ACTOR_LOTAG:
if (iSet)
{
spriteext[iActor].tspr->lotag=lValue;
return;
}
SetGameVarID(lVar2, spriteext[iActor].tspr->lotag,g_i,g_p);
return;
case ACTOR_HITAG:
if (iSet)
{
spriteext[iActor].tspr->hitag=lValue;
return;
}
SetGameVarID(lVar2, spriteext[iActor].tspr->hitag,g_i,g_p);
return;
case ACTOR_EXTRA:
if (iSet)
{
spriteext[iActor].tspr->extra=lValue;
return;
}
SetGameVarID(lVar2, spriteext[iActor].tspr->extra,g_i,g_p);
return;
#endif
default: default:
return; return;
} }
@ -3655,7 +3751,7 @@ static void DoProjectile(int iSet, int lVar1, int lLabelID, int lVar2)
{ {
int lValue=0; int lValue=0;
if (lVar1 < 0 || lVar1 >= MAXTILES) if ((lVar1 < 0 || lVar1 >= MAXTILES) && checkCON)
{ {
OSD_Printf(CON_ERROR "invalid tile (%d)\n",line_num,keyw[g_tw],lVar1); OSD_Printf(CON_ERROR "invalid tile (%d)\n",line_num,keyw[g_tw],lVar1);
insptr += (lVar2 == MAXGAMEVARS); insptr += (lVar2 == MAXGAMEVARS);
@ -3926,7 +4022,7 @@ static void DoProjectile(int iSet, int lVar1, int lLabelID, int lVar2)
void OnEvent(int iEventID, int iActor, int iPlayer, int lDist) void OnEvent(int iEventID, int iActor, int iPlayer, int lDist)
{ {
if (iEventID<0 || iEventID >= MAXGAMEEVENTS) if ((iEventID<0 || iEventID >= MAXGAMEEVENTS) && checkCON)
{ {
OSD_Printf(CON_ERROR "invalid event ID",line_num,keyw[g_tw]); OSD_Printf(CON_ERROR "invalid event ID",line_num,keyw[g_tw]);
return; return;
@ -4522,7 +4618,7 @@ static int parse(void)
insptr++; insptr++;
{ {
int q = *insptr++, i = *insptr++; int q = *insptr++, i = *insptr++;
if (fta_quotes[q] == NULL || redefined_quotes[i] == NULL) if ((fta_quotes[q] == NULL || redefined_quotes[i] == NULL) && checkCON)
{ {
OSD_Printf(CON_ERROR "%s %d null quote\n",line_num,keyw[g_tw],q,i); OSD_Printf(CON_ERROR "%s %d null quote\n",line_num,keyw[g_tw],q,i);
break; break;
@ -4780,7 +4876,7 @@ static int parse(void)
case CON_MIKESND: case CON_MIKESND:
insptr++; insptr++;
if (g_sp->yvel<0 || g_sp->yvel>=MAXSOUNDS) if ((g_sp->yvel<0 || g_sp->yvel>=MAXSOUNDS) && checkCON)
{ {
OSD_Printf(CON_ERROR "Invalid sound %d\n",line_num,keyw[g_tw],g_sp->yvel); OSD_Printf(CON_ERROR "Invalid sound %d\n",line_num,keyw[g_tw],g_sp->yvel);
insptr++; insptr++;
@ -4830,7 +4926,11 @@ static int parse(void)
case CON_SOUNDONCE: case CON_SOUNDONCE:
insptr++; insptr++;
if (*insptr<0 || *insptr>=MAXSOUNDS) {OSD_Printf(CON_ERROR "Invalid sound %d\n",line_num,keyw[g_tw],*insptr);insptr++;break;} if ((*insptr<0 || *insptr>=MAXSOUNDS) && checkCON)
{
OSD_Printf(CON_ERROR "Invalid sound %d\n",line_num,keyw[g_tw],*insptr);
insptr++;break;
}
if (!isspritemakingsound(g_i,*insptr)) if (!isspritemakingsound(g_i,*insptr))
spritesound((short) *insptr,g_i); spritesound((short) *insptr,g_i);
insptr++; insptr++;
@ -4838,14 +4938,22 @@ static int parse(void)
case CON_IFSOUND: case CON_IFSOUND:
insptr++; insptr++;
if (*insptr<0 || *insptr>=MAXSOUNDS) {OSD_Printf(CON_ERROR "Invalid sound %d\n",line_num,keyw[g_tw],*insptr);insptr++;break;} if ((*insptr<0 || *insptr>=MAXSOUNDS) && checkCON)
{
OSD_Printf(CON_ERROR "Invalid sound %d\n",line_num,keyw[g_tw],*insptr);
insptr++;break;
}
parseifelse(isspritemakingsound(g_i,*insptr)); parseifelse(isspritemakingsound(g_i,*insptr));
// parseifelse(SoundOwner[*insptr][0].i == g_i); // parseifelse(SoundOwner[*insptr][0].i == g_i);
break; break;
case CON_STOPSOUND: case CON_STOPSOUND:
insptr++; insptr++;
if (*insptr<0 || *insptr>=MAXSOUNDS) {OSD_Printf(CON_ERROR "Invalid sound %d\n",line_num,keyw[g_tw],*insptr);insptr++;break;} if ((*insptr<0 || *insptr>=MAXSOUNDS) && checkCON)
{
OSD_Printf(CON_ERROR "Invalid sound %d\n",line_num,keyw[g_tw],*insptr);
insptr++;break;
}
if (isspritemakingsound(g_i,*insptr)) if (isspritemakingsound(g_i,*insptr))
stopspritesound((short)*insptr,g_i); stopspritesound((short)*insptr,g_i);
insptr++; insptr++;
@ -4853,7 +4961,11 @@ static int parse(void)
case CON_GLOBALSOUND: case CON_GLOBALSOUND:
insptr++; insptr++;
if (*insptr<0 || *insptr>=MAXSOUNDS) {OSD_Printf(CON_ERROR "Invalid sound %d\n",line_num,keyw[g_tw],*insptr);insptr++;break;} if ((*insptr<0 || *insptr>=MAXSOUNDS) && checkCON)
{
OSD_Printf(CON_ERROR "Invalid sound %d\n",line_num,keyw[g_tw],*insptr);
insptr++;break;
}
if (g_p == screenpeek || (gametype_flags[ud.coop]&GAMETYPE_FLAG_COOPSOUND)) if (g_p == screenpeek || (gametype_flags[ud.coop]&GAMETYPE_FLAG_COOPSOUND))
spritesound((short) *insptr,g_player[screenpeek].ps->i); spritesound((short) *insptr,g_player[screenpeek].ps->i);
insptr++; insptr++;
@ -4861,7 +4973,11 @@ static int parse(void)
case CON_SOUND: case CON_SOUND:
insptr++; insptr++;
if (*insptr<0 || *insptr>=MAXSOUNDS) {OSD_Printf(CON_ERROR "Invalid sound %d\n",line_num,keyw[g_tw],*insptr);insptr++;break;} if ((*insptr<0 || *insptr>=MAXSOUNDS) && checkCON)
{
OSD_Printf(CON_ERROR "Invalid sound %d\n",line_num,keyw[g_tw],*insptr);
insptr++;break;
}
spritesound((short) *insptr++,g_i); spritesound((short) *insptr++,g_i);
break; break;
@ -4964,7 +5080,11 @@ static int parse(void)
return 1; return 1;
case CON_ADDAMMO: case CON_ADDAMMO:
insptr++; insptr++;
if (*insptr<0 || *insptr>=MAX_WEAPONS) {OSD_Printf(CON_ERROR "Invalid weapon ID %d\n",line_num,keyw[g_tw],*insptr);insptr+=2;break;} if ((*insptr<0 || *insptr>=MAX_WEAPONS) && checkCON)
{
OSD_Printf(CON_ERROR "Invalid weapon ID %d\n",line_num,keyw[g_tw],*insptr);
insptr+=2;break;
}
if (g_player[g_p].ps->ammo_amount[*insptr] >= g_player[g_p].ps->max_ammo_amount[*insptr]) if (g_player[g_p].ps->ammo_amount[*insptr] >= g_player[g_p].ps->max_ammo_amount[*insptr])
{ {
killit_flag = 2; killit_flag = 2;
@ -5018,7 +5138,11 @@ static int parse(void)
case CON_ADDWEAPON: case CON_ADDWEAPON:
insptr++; insptr++;
if (*insptr<0 ||*insptr>=MAX_WEAPONS) {OSD_Printf(CON_ERROR "Invalid weapon ID %d\n",line_num,keyw[g_tw],*insptr);insptr+=2;break;} if ((*insptr<0 ||*insptr>=MAX_WEAPONS) && checkCON)
{
OSD_Printf(CON_ERROR "Invalid weapon ID %d\n",line_num,keyw[g_tw],*insptr);
insptr+=2;break;
}
if (g_player[g_p].ps->gotweapon[*insptr] == 0) if (g_player[g_p].ps->gotweapon[*insptr] == 0)
{ {
if (!(g_player[g_p].ps->weaponswitch & 1)) addweaponnoswitch(g_player[g_p].ps, *insptr); if (!(g_player[g_p].ps->weaponswitch & 1)) addweaponnoswitch(g_player[g_p].ps, *insptr);
@ -5181,22 +5305,22 @@ static int parse(void)
switch (tw) switch (tw)
{ {
case CON_ACTIVATEBYSECTOR: case CON_ACTIVATEBYSECTOR:
if (var1<0 || var1>=numsectors) {OSD_Printf(CON_ERROR "Invalid sector %d\n",line_num,keyw[g_tw],var1);break;} if ((var1<0 || var1>=numsectors) && checkCON) {OSD_Printf(CON_ERROR "Invalid sector %d\n",line_num,keyw[g_tw],var1);break;}
activatebysector(var1, var2); activatebysector(var1, var2);
break; break;
case CON_OPERATESECTORS: case CON_OPERATESECTORS:
if (var1<0 || var1>=numsectors) {OSD_Printf(CON_ERROR "Invalid sector %d\n",line_num,keyw[g_tw],var1);break;} if ((var1<0 || var1>=numsectors) && checkCON) {OSD_Printf(CON_ERROR "Invalid sector %d\n",line_num,keyw[g_tw],var1);break;}
operatesectors(var1, var2); operatesectors(var1, var2);
break; break;
case CON_OPERATEACTIVATORS: case CON_OPERATEACTIVATORS:
if (var2<0 || var2>=ud.multimode) {OSD_Printf(CON_ERROR "Invalid player %d\n",line_num,keyw[g_tw],var2);break;} if ((var2<0 || var2>=ud.multimode) && checkCON){OSD_Printf(CON_ERROR "Invalid player %d\n",line_num,keyw[g_tw],var2);break;}
operateactivators(var1, var2); operateactivators(var1, var2);
break; break;
case CON_SETASPECT: case CON_SETASPECT:
setaspect(var1, var2); setaspect(var1, var2);
break; break;
case CON_SSP: case CON_SSP:
if (var1<0 || var1>=MAXSPRITES) { OSD_Printf(CON_ERROR "Invalid sprite %d\n",line_num,keyw[g_tw],var1);break;} if ((var1<0 || var1>=MAXSPRITES) && checkCON) { OSD_Printf(CON_ERROR "Invalid sprite %d\n",line_num,keyw[g_tw],var1);break;}
ssp(var1, var2); ssp(var1, var2);
break; break;
} }
@ -5208,7 +5332,7 @@ static int parse(void)
{ {
int lVar1 = GetGameVarID(*insptr++,g_i,g_p), lVar2 = GetGameVarID(*insptr++,g_i,g_p), res; int lVar1 = GetGameVarID(*insptr++,g_i,g_p), lVar2 = GetGameVarID(*insptr++,g_i,g_p), res;
if (lVar1<0 || lVar1>=MAXSPRITES || lVar2<0 || lVar2>=MAXSPRITES) if ((lVar1<0 || lVar1>=MAXSPRITES || lVar2<0 || lVar2>=MAXSPRITES) && checkCON)
{ {
OSD_Printf(CON_ERROR "Invalid sprite %d\n",line_num,keyw[g_tw],lVar1<0||lVar1>=MAXSPRITES?lVar1:lVar2); OSD_Printf(CON_ERROR "Invalid sprite %d\n",line_num,keyw[g_tw],lVar1<0||lVar1>=MAXSPRITES?lVar1:lVar2);
res=0; res=0;
@ -5252,7 +5376,7 @@ static int parse(void)
{ {
int i=*insptr++; int i=*insptr++;
j=GetGameVarID(*insptr++, g_i, g_p); j=GetGameVarID(*insptr++, g_i, g_p);
if (fta_quotes[j] == NULL) if ((fta_quotes[j] == NULL) && checkCON)
{ {
OSD_Printf(CON_ERROR "null quote %d\n",line_num,keyw[g_tw],j); OSD_Printf(CON_ERROR "null quote %d\n",line_num,keyw[g_tw],j);
SetGameVarID(i,-1,g_i,g_p); SetGameVarID(i,-1,g_i,g_p);
@ -5275,7 +5399,7 @@ static int parse(void)
switch (tw) switch (tw)
{ {
case CON_HEADSPRITESTAT: case CON_HEADSPRITESTAT:
if (j < 0 || j > MAXSTATUS) if ((j < 0 || j > MAXSTATUS) && checkCON)
{ {
OSD_Printf(CON_ERROR "invalid status list %d\n",line_num,keyw[g_tw],j); OSD_Printf(CON_ERROR "invalid status list %d\n",line_num,keyw[g_tw],j);
break; break;
@ -5283,7 +5407,7 @@ static int parse(void)
SetGameVarID(i,headspritestat[j],g_i,g_p); SetGameVarID(i,headspritestat[j],g_i,g_p);
break; break;
case CON_PREVSPRITESTAT: case CON_PREVSPRITESTAT:
if (j < 0 || j >= MAXSPRITES) if ((j < 0 || j >= MAXSPRITES) && checkCON)
{ {
OSD_Printf(CON_ERROR "invalid sprite ID %d\n",line_num,keyw[g_tw],j); OSD_Printf(CON_ERROR "invalid sprite ID %d\n",line_num,keyw[g_tw],j);
break; break;
@ -5291,7 +5415,7 @@ static int parse(void)
SetGameVarID(i,prevspritestat[j],g_i,g_p); SetGameVarID(i,prevspritestat[j],g_i,g_p);
break; break;
case CON_NEXTSPRITESTAT: case CON_NEXTSPRITESTAT:
if (j < 0 || j >= MAXSPRITES) if ((j < 0 || j >= MAXSPRITES) && checkCON)
{ {
OSD_Printf(CON_ERROR "invalid sprite ID %d\n",line_num,keyw[g_tw],j); OSD_Printf(CON_ERROR "invalid sprite ID %d\n",line_num,keyw[g_tw],j);
break; break;
@ -5299,7 +5423,7 @@ static int parse(void)
SetGameVarID(i,nextspritestat[j],g_i,g_p); SetGameVarID(i,nextspritestat[j],g_i,g_p);
break; break;
case CON_HEADSPRITESECT: case CON_HEADSPRITESECT:
if (j < 0 || j > numsectors) if ((j < 0 || j > numsectors) && checkCON)
{ {
OSD_Printf(CON_ERROR "invalid sector %d\n",line_num,keyw[g_tw],j); OSD_Printf(CON_ERROR "invalid sector %d\n",line_num,keyw[g_tw],j);
break; break;
@ -5307,7 +5431,7 @@ static int parse(void)
SetGameVarID(i,headspritesect[j],g_i,g_p); SetGameVarID(i,headspritesect[j],g_i,g_p);
break; break;
case CON_PREVSPRITESECT: case CON_PREVSPRITESECT:
if (j < 0 || j >= MAXSPRITES) if ((j < 0 || j >= MAXSPRITES) && checkCON)
{ {
OSD_Printf(CON_ERROR "invalid sprite ID %d\n",line_num,keyw[g_tw],j); OSD_Printf(CON_ERROR "invalid sprite ID %d\n",line_num,keyw[g_tw],j);
break; break;
@ -5315,7 +5439,7 @@ static int parse(void)
SetGameVarID(i,prevspritesect[j],g_i,g_p); SetGameVarID(i,prevspritesect[j],g_i,g_p);
break; break;
case CON_NEXTSPRITESECT: case CON_NEXTSPRITESECT:
if (j < 0 || j >= MAXSPRITES) if ((j < 0 || j >= MAXSPRITES) && checkCON)
{ {
OSD_Printf(CON_ERROR "invalid sprite ID %d\n",line_num,keyw[g_tw],j); OSD_Printf(CON_ERROR "invalid sprite ID %d\n",line_num,keyw[g_tw],j);
break; break;
@ -5332,9 +5456,9 @@ static int parse(void)
int i = GetGameVarID(*insptr++, g_i, g_p), int i = GetGameVarID(*insptr++, g_i, g_p),
f=GetGameVarID(*insptr++, g_i, g_p); f=GetGameVarID(*insptr++, g_i, g_p);
j=GetGameVarID(*insptr++, g_i, g_p); j=GetGameVarID(*insptr++, g_i, g_p);
if (i<0 || i>=MAXQUOTES) OSD_Printf(CON_ERROR "invalid quote ID %d\n",line_num,keyw[g_tw],i); if ((i<0 || i>=MAXQUOTES) && checkCON) OSD_Printf(CON_ERROR "invalid quote ID %d\n",line_num,keyw[g_tw],i);
else if (fta_quotes[i] == NULL) OSD_Printf(CON_ERROR "null quote %d\n",line_num,keyw[g_tw],i); else if ((fta_quotes[i] == NULL) && checkCON) OSD_Printf(CON_ERROR "null quote %d\n",line_num,keyw[g_tw],i);
else if (f<0 || f>=NUMGAMEFUNCTIONS) OSD_Printf(CON_ERROR "invalid function %d\n",line_num,keyw[g_tw],f); else if ((f<0 || f>=NUMGAMEFUNCTIONS) && checkCON) OSD_Printf(CON_ERROR "invalid function %d\n",line_num,keyw[g_tw],f);
else else
{ {
if (j<2) if (j<2)
@ -5362,10 +5486,10 @@ static int parse(void)
st = GetGameVarID(*insptr++, g_i, g_p); st = GetGameVarID(*insptr++, g_i, g_p);
ln = GetGameVarID(*insptr++, g_i, g_p); ln = GetGameVarID(*insptr++, g_i, g_p);
if (q1<0 || q1>=MAXQUOTES) OSD_Printf(CON_ERROR "invalid quote ID %d\n",line_num,keyw[g_tw],q1); if ((q1<0 || q1>=MAXQUOTES) && checkCON) OSD_Printf(CON_ERROR "invalid quote ID %d\n",line_num,keyw[g_tw],q1);
else if (fta_quotes[q1] == NULL) OSD_Printf(CON_ERROR "null quote %d\n",line_num,keyw[g_tw],q1); else if ((fta_quotes[q1] == NULL) && checkCON) OSD_Printf(CON_ERROR "null quote %d\n",line_num,keyw[g_tw],q1);
else if (q2<0 || q2>=MAXQUOTES) OSD_Printf(CON_ERROR "invalid quote ID %d\n",line_num,keyw[g_tw],q2); else if ((q2<0 || q2>=MAXQUOTES) && checkCON) OSD_Printf(CON_ERROR "invalid quote ID %d\n",line_num,keyw[g_tw],q2);
else if (fta_quotes[q2] == NULL) OSD_Printf(CON_ERROR "null quote %d\n",line_num,keyw[g_tw],q2); else if ((fta_quotes[q2] == NULL) && checkCON) OSD_Printf(CON_ERROR "null quote %d\n",line_num,keyw[g_tw],q2);
else else
{ {
s1=fta_quotes[q1]; s1=fta_quotes[q1];
@ -5396,7 +5520,7 @@ static int parse(void)
switch (tw) switch (tw)
{ {
case CON_GETPNAME: case CON_GETPNAME:
if (fta_quotes[i] == NULL) if ((fta_quotes[i] == NULL) && checkCON)
{ {
OSD_Printf(CON_ERROR "null quote %d\n",line_num,keyw[g_tw],i); OSD_Printf(CON_ERROR "null quote %d\n",line_num,keyw[g_tw],i);
break; break;
@ -5406,7 +5530,7 @@ static int parse(void)
else Bsprintf(fta_quotes[i],"%d",j); else Bsprintf(fta_quotes[i],"%d",j);
break; break;
case CON_QGETSYSSTR: case CON_QGETSYSSTR:
if (fta_quotes[i] == NULL) if ((fta_quotes[i] == NULL) && checkCON)
{ {
OSD_Printf(CON_ERROR "null quote %d %d\n",line_num,keyw[g_tw],i,j); OSD_Printf(CON_ERROR "null quote %d %d\n",line_num,keyw[g_tw],i,j);
break; break;
@ -5433,7 +5557,7 @@ static int parse(void)
} }
break; break;
case CON_QSTRCAT: case CON_QSTRCAT:
if (fta_quotes[i] == NULL || fta_quotes[j] == NULL) if ((fta_quotes[i] == NULL || fta_quotes[j] == NULL) && checkCON)
{ {
OSD_Printf(CON_ERROR "null quote %d\n",line_num,keyw[g_tw],fta_quotes[i] ? j : i); OSD_Printf(CON_ERROR "null quote %d\n",line_num,keyw[g_tw],fta_quotes[i] ? j : i);
break; break;
@ -5441,7 +5565,7 @@ static int parse(void)
Bstrncat(fta_quotes[i],fta_quotes[j],(MAXQUOTELEN-1)-Bstrlen(fta_quotes[i])); Bstrncat(fta_quotes[i],fta_quotes[j],(MAXQUOTELEN-1)-Bstrlen(fta_quotes[i]));
break; break;
case CON_QSTRCPY: case CON_QSTRCPY:
if (fta_quotes[i] == NULL || fta_quotes[j] == NULL) if ((fta_quotes[i] == NULL || fta_quotes[j] == NULL) && checkCON)
{ {
OSD_Printf(CON_ERROR "null quote %d\n",line_num,keyw[g_tw],fta_quotes[i] ? j : i); OSD_Printf(CON_ERROR "null quote %d\n",line_num,keyw[g_tw],fta_quotes[i] ? j : i);
break; break;
@ -5449,13 +5573,13 @@ static int parse(void)
Bstrcpy(fta_quotes[i],fta_quotes[j]); Bstrcpy(fta_quotes[i],fta_quotes[j]);
break; break;
case CON_CHANGESPRITESTAT: case CON_CHANGESPRITESTAT:
if (i<0 || i>=MAXSPRITES) {OSD_Printf(CON_ERROR "Invalid sprite %d\n",line_num,keyw[g_tw],i);break;} if ((i<0 || i>=MAXSPRITES) && checkCON){OSD_Printf(CON_ERROR "Invalid sprite %d\n",line_num,keyw[g_tw],i);break;}
if (j<0 || j>=MAXSTATUS) {OSD_Printf(CON_ERROR "Invalid status %d\n",line_num,keyw[g_tw],j);break;} if ((j<0 || j>=MAXSTATUS) && checkCON) {OSD_Printf(CON_ERROR "Invalid status %d\n",line_num,keyw[g_tw],j);break;}
changespritestat(i,j); changespritestat(i,j);
break; break;
case CON_CHANGESPRITESECT: case CON_CHANGESPRITESECT:
if (i<0 || i>=MAXSPRITES) {OSD_Printf(CON_ERROR "Invalid sprite %d\n",line_num,keyw[g_tw],i);break;} if ((i<0 || i>=MAXSPRITES) && checkCON){OSD_Printf(CON_ERROR "Invalid sprite %d\n",line_num,keyw[g_tw],i);break;}
if (j<0 || j>=numsectors) {OSD_Printf(CON_ERROR "Invalid sector %d\n",line_num,keyw[g_tw],j);break;} if ((j<0 || j>=numsectors) && checkCON){OSD_Printf(CON_ERROR "Invalid sector %d\n",line_num,keyw[g_tw],j);break;}
changespritesect(i,j); changespritesect(i,j);
break; break;
} }
@ -5468,13 +5592,13 @@ static int parse(void)
// from 'level' cheat in game.c (about line 6250) // from 'level' cheat in game.c (about line 6250)
int volnume=GetGameVarID(*insptr++,g_i,g_p), levnume=GetGameVarID(*insptr++,g_i,g_p); int volnume=GetGameVarID(*insptr++,g_i,g_p), levnume=GetGameVarID(*insptr++,g_i,g_p);
if (volnume > MAXVOLUMES-1 || volnume < 0) if ((volnume > MAXVOLUMES-1 || volnume < 0) && checkCON)
{ {
OSD_Printf(CON_ERROR "invalid volume (%d)\n",line_num,keyw[g_tw],volnume); OSD_Printf(CON_ERROR "invalid volume (%d)\n",line_num,keyw[g_tw],volnume);
break; break;
} }
if (levnume > MAXLEVELS-1 || levnume < 0) if ((levnume > MAXLEVELS-1 || levnume < 0) && checkCON)
{ {
OSD_Printf(CON_ERROR "invalid level (%d)\n",line_num,keyw[g_tw],levnume); OSD_Printf(CON_ERROR "invalid level (%d)\n",line_num,keyw[g_tw],levnume);
break; break;
@ -5613,7 +5737,7 @@ static int parse(void)
{ {
int wallnum = GetGameVarID(*insptr++, g_i, g_p), newx = GetGameVarID(*insptr++, g_i, g_p), newy = GetGameVarID(*insptr++, g_i, g_p); int wallnum = GetGameVarID(*insptr++, g_i, g_p), newx = GetGameVarID(*insptr++, g_i, g_p), newy = GetGameVarID(*insptr++, g_i, g_p);
if (wallnum<0 || wallnum>=numwalls) {OSD_Printf(CON_ERROR "Invalid wall %d\n",line_num,keyw[g_tw],wallnum);break;} if ((wallnum<0 || wallnum>=numwalls) && checkCON) {OSD_Printf(CON_ERROR "Invalid wall %d\n",line_num,keyw[g_tw],wallnum);break;}
dragpoint(wallnum,newx,newy); dragpoint(wallnum,newx,newy);
break; break;
} }
@ -5624,7 +5748,7 @@ static int parse(void)
{ {
int distvar = *insptr++, xvar = GetGameVarID(*insptr++, g_i, g_p), yvar = GetGameVarID(*insptr++, g_i, g_p), distx=0; int distvar = *insptr++, xvar = GetGameVarID(*insptr++, g_i, g_p), yvar = GetGameVarID(*insptr++, g_i, g_p), distx=0;
if (xvar < 0 || yvar < 0 || xvar >= MAXSPRITES || yvar >= MAXSPRITES) if ((xvar < 0 || yvar < 0 || xvar >= MAXSPRITES || yvar >= MAXSPRITES) && checkCON)
{ {
OSD_Printf(CON_ERROR "invalid sprite\n",line_num,keyw[g_tw]); OSD_Printf(CON_ERROR "invalid sprite\n",line_num,keyw[g_tw]);
break; break;
@ -5683,7 +5807,7 @@ static int parse(void)
insptr++; insptr++;
{ {
int lIn=GetGameVarID(*insptr++, g_i, g_p); int lIn=GetGameVarID(*insptr++, g_i, g_p);
if (g_sp->sectnum < 0 || g_sp->sectnum >= numsectors) if ((g_sp->sectnum < 0 || g_sp->sectnum >= numsectors) && checkCON)
{ {
OSD_Printf(CON_ERROR "Invalid sector %d\n",line_num,keyw[g_tw],g_sp->sectnum); OSD_Printf(CON_ERROR "Invalid sector %d\n",line_num,keyw[g_tw],g_sp->sectnum);
break; break;
@ -5710,7 +5834,7 @@ static int parse(void)
case CON_QSPAWN: case CON_QSPAWN:
insptr++; insptr++;
if (g_sp->sectnum < 0 || g_sp->sectnum >= numsectors) if ((g_sp->sectnum < 0 || g_sp->sectnum >= numsectors) && checkCON)
{ {
OSD_Printf(CON_ERROR "Invalid sector %d\n",line_num,keyw[g_tw],g_sp->sectnum); OSD_Printf(CON_ERROR "Invalid sector %d\n",line_num,keyw[g_tw],g_sp->sectnum);
insptr++; insptr++;
@ -5746,7 +5870,7 @@ static int parse(void)
hittype[g_i].temp_data[9] = 1; hittype[g_i].temp_data[9] = 1;
} }
if (g_sp->sectnum < 0 || g_sp->sectnum >= numsectors) if ((g_sp->sectnum < 0 || g_sp->sectnum >= numsectors) && checkCON)
{ {
OSD_Printf(CON_ERROR "Invalid sector %d\n",line_num,keyw[g_tw],g_sp->sectnum); OSD_Printf(CON_ERROR "Invalid sector %d\n",line_num,keyw[g_tw],g_sp->sectnum);
insptr++; insptr++;
@ -5779,7 +5903,7 @@ static int parse(void)
} }
j=GetGameVarID(*insptr++, g_i, g_p); j=GetGameVarID(*insptr++, g_i, g_p);
if (g_sp->sectnum < 0 || g_sp->sectnum >= numsectors) if ((g_sp->sectnum < 0 || g_sp->sectnum >= numsectors) && checkCON)
{ {
OSD_Printf(CON_ERROR "Invalid sector %d\n",line_num,keyw[g_tw],g_sp->sectnum); OSD_Printf(CON_ERROR "Invalid sector %d\n",line_num,keyw[g_tw],g_sp->sectnum);
hittype[g_i].temp_data[9]=0; hittype[g_i].temp_data[9]=0;
@ -5809,21 +5933,21 @@ static int parse(void)
switch (tw) switch (tw)
{ {
case CON_SOUNDONCEVAR: case CON_SOUNDONCEVAR:
if (j<0 || j>=MAXSOUNDS) {OSD_Printf(CON_ERROR "Invalid sound %d\n",line_num,keyw[g_tw],j);break;} if ((j<0 || j>=MAXSOUNDS) && checkCON) {OSD_Printf(CON_ERROR "Invalid sound %d\n",line_num,keyw[g_tw],j);break;}
if (!isspritemakingsound(g_i,j)) if (!isspritemakingsound(g_i,j))
spritesound((short)j,g_i); spritesound((short)j,g_i);
break; break;
case CON_GLOBALSOUNDVAR: case CON_GLOBALSOUNDVAR:
if (j<0 || j>=MAXSOUNDS) {OSD_Printf(CON_ERROR "Invalid sound %d\n",line_num,keyw[g_tw],j);break;} if ((j<0 || j>=MAXSOUNDS) && checkCON) {OSD_Printf(CON_ERROR "Invalid sound %d\n",line_num,keyw[g_tw],j);break;}
spritesound((short)j,g_player[screenpeek].ps->i); spritesound((short)j,g_player[screenpeek].ps->i);
break; break;
case CON_STOPSOUNDVAR: case CON_STOPSOUNDVAR:
if (j<0 || j>=MAXSOUNDS) {OSD_Printf(CON_ERROR "Invalid sound %d\n",line_num,keyw[g_tw],j);break;} if ((j<0 || j>=MAXSOUNDS) && checkCON) {OSD_Printf(CON_ERROR "Invalid sound %d\n",line_num,keyw[g_tw],j);break;}
if (isspritemakingsound(g_i,j)) if (isspritemakingsound(g_i,j))
stopspritesound((short)j,g_i); stopspritesound((short)j,g_i);
break; break;
case CON_SOUNDVAR: case CON_SOUNDVAR:
if (j<0 || j>=MAXSOUNDS) {OSD_Printf(CON_ERROR "Invalid sound %d\n",line_num,keyw[g_tw],j);break;} if ((j<0 || j>=MAXSOUNDS) && checkCON) {OSD_Printf(CON_ERROR "Invalid sound %d\n",line_num,keyw[g_tw],j);break;}
spritesound((short)j,g_i); spritesound((short)j,g_i);
break; break;
} }
@ -5882,12 +6006,12 @@ static int parse(void)
if (x1 > x2) swaplong(&x1,&x2); if (x1 > x2) swaplong(&x1,&x2);
if (y1 > y2) swaplong(&y1,&y2); if (y1 > y2) swaplong(&y1,&y2);
if (x1 < 0 || y1 < 0 || x2 > xdim-1 || y2 > ydim-1 || x2-x1 < 2 || y2-y1 < 2) if ((x1 < 0 || y1 < 0 || x2 > xdim-1 || y2 > ydim-1 || x2-x1 < 2 || y2-y1 < 2) && checkCON)
{ {
OSD_Printf(CON_ERROR "incorrect coordinates\n",line_num,keyw[g_tw]); OSD_Printf(CON_ERROR "incorrect coordinates\n",line_num,keyw[g_tw]);
break; break;
} }
if (sect<0 || sect>=numsectors) if ((sect<0 || sect>=numsectors) && checkCON)
{ {
OSD_Printf(CON_ERROR "Invalid sector %d\n",line_num,keyw[g_tw],sect); OSD_Printf(CON_ERROR "Invalid sector %d\n",line_num,keyw[g_tw],sect);
break; break;
@ -6001,7 +6125,7 @@ static int parse(void)
if (tw == CON_GAMETEXT || tw == CON_GAMETEXTZ) if (tw == CON_GAMETEXT || tw == CON_GAMETEXTZ)
{ {
int z=65536; int z=65536;
if (fta_quotes[q] == NULL) if ((fta_quotes[q] == NULL) && checkCON)
{ {
OSD_Printf(CON_ERROR "null quote %d\n",line_num,keyw[g_tw],q); OSD_Printf(CON_ERROR "null quote %d\n",line_num,keyw[g_tw],q);
break; break;
@ -6015,7 +6139,7 @@ static int parse(void)
break; break;
} }
if (fta_quotes[q] == NULL) if ((fta_quotes[q] == NULL) && checkCON)
{ {
OSD_Printf(CON_ERROR "null quote %d\n",line_num,keyw[g_tw],q); OSD_Printf(CON_ERROR "null quote %d\n",line_num,keyw[g_tw],q);
break; break;
@ -6038,7 +6162,7 @@ static int parse(void)
int walldist=GetGameVarID(*insptr++,g_i,g_p), clipmask=GetGameVarID(*insptr++,g_i,g_p); int walldist=GetGameVarID(*insptr++,g_i,g_p), clipmask=GetGameVarID(*insptr++,g_i,g_p);
int ceilz, ceilhit, florz, florhit; int ceilz, ceilhit, florz, florhit;
if (sectnum<0 || sectnum>=numsectors) if ((sectnum<0 || sectnum>=numsectors) && checkCON)
{ {
OSD_Printf(CON_ERROR "Invalid sector %d\n",line_num,keyw[g_tw],sectnum); OSD_Printf(CON_ERROR "Invalid sector %d\n",line_num,keyw[g_tw],sectnum);
break; break;
@ -6062,7 +6186,7 @@ static int parse(void)
short hitsect, hitwall, hitsprite; short hitsect, hitwall, hitsprite;
int hitx, hity, hitz; int hitx, hity, hitz;
if (sectnum<0 || sectnum>=numsectors) if ((sectnum<0 || sectnum>=numsectors) && checkCON)
{ {
OSD_Printf(CON_ERROR "Invalid sector %d\n",line_num,keyw[g_tw],sectnum); OSD_Printf(CON_ERROR "Invalid sector %d\n",line_num,keyw[g_tw],sectnum);
break; break;
@ -6085,7 +6209,7 @@ static int parse(void)
int x2=GetGameVarID(*insptr++,g_i,g_p), y2=GetGameVarID(*insptr++,g_i,g_p), z2=GetGameVarID(*insptr++,g_i,g_p); int x2=GetGameVarID(*insptr++,g_i,g_p), y2=GetGameVarID(*insptr++,g_i,g_p), z2=GetGameVarID(*insptr++,g_i,g_p);
int sect2=GetGameVarID(*insptr++,g_i,g_p), rvar=*insptr++; int sect2=GetGameVarID(*insptr++,g_i,g_p), rvar=*insptr++;
if (sect1<0 || sect1>=numsectors || sect2<0 || sect2>=numsectors) if ((sect1<0 || sect1>=numsectors || sect2<0 || sect2>=numsectors) && checkCON)
{ {
OSD_Printf(CON_ERROR "Invalid sector\n",line_num,keyw[g_tw]); OSD_Printf(CON_ERROR "Invalid sector\n",line_num,keyw[g_tw]);
SetGameVarID(rvar, 0, g_i, g_p); SetGameVarID(rvar, 0, g_i, g_p);
@ -6125,7 +6249,7 @@ static int parse(void)
int neartagsectorvar=*insptr++, neartagwallvar=*insptr++, neartagspritevar=*insptr++, neartaghitdistvar=*insptr++; int neartagsectorvar=*insptr++, neartagwallvar=*insptr++, neartagspritevar=*insptr++, neartaghitdistvar=*insptr++;
int neartagrange=GetGameVarID(*insptr++,g_i,g_p), tagsearch=GetGameVarID(*insptr++,g_i,g_p); int neartagrange=GetGameVarID(*insptr++,g_i,g_p), tagsearch=GetGameVarID(*insptr++,g_i,g_p);
if (sectnum<0 || sectnum>=numsectors) if ((sectnum<0 || sectnum>=numsectors) && checkCON)
{ {
OSD_Printf(CON_ERROR "Invalid sector %d\n",line_num,keyw[g_tw],sectnum); OSD_Printf(CON_ERROR "Invalid sector %d\n",line_num,keyw[g_tw],sectnum);
break; break;
@ -6170,7 +6294,7 @@ static int parse(void)
if (tw == CON_SETSPRITE) if (tw == CON_SETSPRITE)
{ {
if (spritenum < 0 || spritenum >= MAXSPRITES) if ((spritenum < 0 || spritenum >= MAXSPRITES) && checkCON)
{ {
OSD_Printf(CON_ERROR "invalid sprite ID %d\n",line_num,keyw[g_tw],spritenum); OSD_Printf(CON_ERROR "invalid sprite ID %d\n",line_num,keyw[g_tw],spritenum);
break; break;
@ -6182,7 +6306,7 @@ static int parse(void)
{ {
int cliptype = GetGameVarID(*insptr++,g_i,g_p); int cliptype = GetGameVarID(*insptr++,g_i,g_p);
if (spritenum < 0 && spritenum >= MAXSPRITES) if ((spritenum < 0 && spritenum >= MAXSPRITES) && checkCON)
{ {
OSD_Printf(CON_ERROR "invalid sprite ID %d\n",line_num,keyw[g_tw],spritenum); OSD_Printf(CON_ERROR "invalid sprite ID %d\n",line_num,keyw[g_tw],spritenum);
insptr++; insptr++;
@ -6198,7 +6322,7 @@ static int parse(void)
insptr++; insptr++;
{ {
int sectnum = GetGameVarID(*insptr++,g_i,g_p), x = GetGameVarID(*insptr++,g_i,g_p), y = GetGameVarID(*insptr++,g_i,g_p); int sectnum = GetGameVarID(*insptr++,g_i,g_p), x = GetGameVarID(*insptr++,g_i,g_p), y = GetGameVarID(*insptr++,g_i,g_p);
if (sectnum<0 || sectnum>=numsectors) if ((sectnum<0 || sectnum>=numsectors) && checkCON)
{ {
OSD_Printf(CON_ERROR "Invalid sector %d\n",line_num,keyw[g_tw],sectnum); OSD_Printf(CON_ERROR "Invalid sector %d\n",line_num,keyw[g_tw],sectnum);
insptr++; insptr++;
@ -6637,7 +6761,7 @@ static int parse(void)
case CON_CLEARMAPSTATE: case CON_CLEARMAPSTATE:
insptr++; insptr++;
j = GetGameVarID(*insptr++,g_i,g_p); j = GetGameVarID(*insptr++,g_i,g_p);
if (j < 0 || j >= MAXVOLUMES*MAXLEVELS) if ((j < 0 || j >= MAXVOLUMES*MAXLEVELS) && checkCON)
{ {
OSD_Printf(CON_ERROR "Invalid map number: %d\n",line_num,keyw[g_tw],j); OSD_Printf(CON_ERROR "Invalid map number: %d\n",line_num,keyw[g_tw],j);
return 0; return 0;
@ -6742,7 +6866,7 @@ static int parse(void)
insptr++; insptr++;
{ {
int dq = *insptr++, sq = *insptr++; int dq = *insptr++, sq = *insptr++;
if (fta_quotes[sq] == NULL || fta_quotes[dq] == NULL) if ((fta_quotes[sq] == NULL || fta_quotes[dq] == NULL) && checkCON)
{ {
OSD_Printf(CON_ERROR "null quote %d\n",line_num,keyw[g_tw],fta_quotes[sq] ? dq : sq); OSD_Printf(CON_ERROR "null quote %d\n",line_num,keyw[g_tw],fta_quotes[sq] ? dq : sq);
insptr += 4; insptr += 4;
@ -7123,7 +7247,7 @@ static int parse(void)
int lSprite=GetGameVarID(*insptr++, g_i, g_p), lVar1=*insptr++; int lSprite=GetGameVarID(*insptr++, g_i, g_p), lVar1=*insptr++;
j=*insptr++; j=*insptr++;
if (lSprite < 0 || lSprite >= MAXSPRITES) if ((lSprite < 0 || lSprite >= MAXSPRITES) && checkCON)
{ {
OSD_Printf(CON_ERROR "invalid sprite ID %d\n",line_num,keyw[g_tw],lSprite); OSD_Printf(CON_ERROR "invalid sprite ID %d\n",line_num,keyw[g_tw],lSprite);
if (lVar1 == MAXGAMEVARS) insptr++; if (lVar1 == MAXGAMEVARS) insptr++;
@ -7154,7 +7278,7 @@ static int parse(void)
{ {
int lVar1=*insptr++, lVar2=*insptr++; int lVar1=*insptr++, lVar2=*insptr++;
if (iPlayer < 0 || iPlayer >= ud.multimode) if ((iPlayer < 0 || iPlayer >= ud.multimode) && checkCON)
{ {
OSD_Printf(CON_ERROR "invalid player ID %d\n",line_num,keyw[g_tw],iPlayer); OSD_Printf(CON_ERROR "invalid player ID %d\n",line_num,keyw[g_tw],iPlayer);
break; break;
@ -7226,7 +7350,7 @@ static int parse(void)
insptr++; insptr++;
if (j < 0 || j >= ud.multimode) if ((j < 0 || j >= ud.multimode) && checkCON)
{ {
OSD_Printf(CON_ERROR "Invalid player ID %d\n",line_num,keyw[g_tw],j); OSD_Printf(CON_ERROR "Invalid player ID %d\n",line_num,keyw[g_tw],j);
break; break;
@ -7372,7 +7496,7 @@ static int parse(void)
case CON_GMAXAMMO: case CON_GMAXAMMO:
insptr++; insptr++;
j=GetGameVarID(*insptr++, g_i, g_p); j=GetGameVarID(*insptr++, g_i, g_p);
if (j<0 || j>=MAX_WEAPONS) if ((j<0 || j>=MAX_WEAPONS) && checkCON)
{ {
OSD_Printf(CON_ERROR "Invalid weapon ID %d\n",line_num,keyw[g_tw],j); OSD_Printf(CON_ERROR "Invalid weapon ID %d\n",line_num,keyw[g_tw],j);
insptr++; insptr++;
@ -7384,7 +7508,7 @@ static int parse(void)
case CON_SMAXAMMO: case CON_SMAXAMMO:
insptr++; insptr++;
j=GetGameVarID(*insptr++, g_i, g_p); j=GetGameVarID(*insptr++, g_i, g_p);
if (j<0 || j>=MAX_WEAPONS) if ((j<0 || j>=MAX_WEAPONS) && checkCON)
{ {
OSD_Printf(CON_ERROR "Invalid weapon ID %d\n",line_num,keyw[g_tw],j); OSD_Printf(CON_ERROR "Invalid weapon ID %d\n",line_num,keyw[g_tw],j);
insptr++; insptr++;
@ -7769,14 +7893,14 @@ static int parse(void)
case CON_QUOTE: case CON_QUOTE:
insptr++; insptr++;
if (fta_quotes[*insptr] == NULL) if ((fta_quotes[*insptr] == NULL) && checkCON)
{ {
OSD_Printf(CON_ERROR "null quote %d\n",line_num,keyw[g_tw],*insptr); OSD_Printf(CON_ERROR "null quote %d\n",line_num,keyw[g_tw],*insptr);
insptr++; insptr++;
break; break;
} }
if (g_p < 0 || g_p >= MAXPLAYERS) if ((g_p < 0 || g_p >= MAXPLAYERS) && checkCON)
{ {
OSD_Printf(CON_ERROR "bad player for quote %d: (%d)\n",line_num,keyw[g_tw],*insptr,g_p); OSD_Printf(CON_ERROR "bad player for quote %d: (%d)\n",line_num,keyw[g_tw],*insptr,g_p);
insptr++; insptr++;
@ -7791,7 +7915,7 @@ static int parse(void)
{ {
int i=GetGameVarID(*insptr++, g_i, g_p); int i=GetGameVarID(*insptr++, g_i, g_p);
if (fta_quotes[i] == NULL) if ((fta_quotes[i] == NULL) && checkCON)
{ {
OSD_Printf(CON_ERROR "null quote %d\n",line_num,keyw[g_tw],i); OSD_Printf(CON_ERROR "null quote %d\n",line_num,keyw[g_tw],i);
break; break;

View file

@ -27,6 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "osd.h" #include "osd.h"
extern int g_i,g_p; extern int g_i,g_p;
extern int OSD_errors;
void ResetPointerVars(void); void ResetPointerVars(void);
extern void FreeMapState(int mapnum); extern void FreeMapState(int mapnum);
@ -382,6 +383,7 @@ void ResetGameVars(void) /* this is called during a new game and nowhere else */
//AddLog("Reset Game Vars"); //AddLog("Reset Game Vars");
FreeGameVars(); FreeGameVars();
OSD_errors=0;
for (i=0;i<MAXGAMEVARS;i++) for (i=0;i<MAXGAMEVARS;i++)
{ {

View file

@ -286,7 +286,11 @@ static int getsound(unsigned int num)
if (!g_sounds[num].filename) return 0; if (!g_sounds[num].filename) return 0;
if (g_sounds[num].filename1)fp = kopen4loadfrommod(g_sounds[num].filename1,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)fp = kopen4loadfrommod(g_sounds[num].filename,loadfromgrouponly);
if (fp == -1) return 0; if (fp == -1)
{
// initprintf("Sound '%s' not found\n",g_sounds[num].filename);
return 0;
}
l = kfilelength(fp); l = kfilelength(fp);
g_sounds[num].soundsiz = l; g_sounds[num].soundsiz = l;
@ -1558,7 +1562,7 @@ void clearfifo(void)
clearbufbyte(&inputfifo,sizeof(input_t)*MOVEFIFOSIZ*MAXPLAYERS,0L); clearbufbyte(&inputfifo,sizeof(input_t)*MOVEFIFOSIZ*MAXPLAYERS,0L);
for (;i<MAXPLAYERS;i++) for (;i<MAXPLAYERS;i++)
{ {
// Bmemset(g_player[i].inputfifo,0,sizeof(g_player[i].inputfifo)); // Bmemset(g_player[i].inputfifo,0,sizeof(g_player[i].inputfifo));
if (g_player[i].sync != NULL) if (g_player[i].sync != NULL)
Bmemset(g_player[i].sync,0,sizeof(input_t)); Bmemset(g_player[i].sync,0,sizeof(input_t));
Bmemset(&g_player[i].movefifoend,0,sizeof(g_player[i].movefifoend)); Bmemset(&g_player[i].movefifoend,0,sizeof(g_player[i].movefifoend));