Selective auto-correction option for the corruption checker. 'corruptcheck now' will print numbered tags for each warning, which can then be used like this: 'corruptcheck tryfix 20 34-64'. General cleanup; make mapster32 not depend on enet objects.

git-svn-id: https://svn.eduke32.com/eduke32@1799 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2011-02-21 23:08:21 +00:00
parent 177e506e01
commit 71d5dc5e59
21 changed files with 230 additions and 123 deletions

View file

@ -205,7 +205,7 @@ ifeq (1,$(RELEASE))
endif endif
endif endif
mapster32$(EXESUFFIX): $(EDITOROBJS) $(EOBJ)/$(EDITORLIB) $(EOBJ)/$(ENGINELIB) $(JAUDIOLIBDIR)/$(JAUDIOLIB) $(ENETDIR)/$(ENETLIB) mapster32$(EXESUFFIX): $(EDITOROBJS) $(EOBJ)/$(EDITORLIB) $(EOBJ)/$(ENGINELIB) $(JAUDIOLIBDIR)/$(JAUDIOLIB)
$(LINK_STATUS) $(LINK_STATUS)
if $(CC) $(CFLAGS) $(OURCFLAGS) -o $@ $^ $(LIBS) $(STDCPPLIB) $(MISCLINKOPTS); then $(LINK_OK); else $(LINK_FAILED); fi if $(CC) $(CFLAGS) $(OURCFLAGS) -o $@ $^ $(LIBS) $(STDCPPLIB) $(MISCLINKOPTS); then $(LINK_OK); else $(LINK_FAILED); fi
ifeq (1,$(RELEASE)) ifeq (1,$(RELEASE))

View file

@ -303,7 +303,7 @@ extern int32_t rendmode;
EXTERN int32_t h_xsize[MAXTILES], h_ysize[MAXTILES]; EXTERN int32_t h_xsize[MAXTILES], h_ysize[MAXTILES];
EXTERN int8_t h_xoffs[MAXTILES], h_yoffs[MAXTILES]; EXTERN int8_t h_xoffs[MAXTILES], h_yoffs[MAXTILES];
extern char *engineerrstr; extern const char *engineerrstr;
extern char noclip; extern char noclip;
EXTERN int32_t editorzrange[2]; EXTERN int32_t editorzrange[2];

View file

@ -549,7 +549,7 @@ int32_t Bcorrectfilename(char *filename, int32_t removefn);
int32_t Bcanonicalisefilename(char *filename, int32_t removefn); int32_t Bcanonicalisefilename(char *filename, int32_t removefn);
char *Bgetsystemdrives(void); char *Bgetsystemdrives(void);
int32_t Bfilelength(int32_t fd); int32_t Bfilelength(int32_t fd);
char *Bstrtoken(char *s, char *delim, char **ptrptr, int32_t chop); char *Bstrtoken(char *s, const char *delim, char **ptrptr, int32_t chop);
int32_t Bwildmatch (const char *i, const char *j); int32_t Bwildmatch (const char *i, const char *j);
#if !defined(_WIN32) #if !defined(_WIN32)
@ -566,5 +566,8 @@ char *Bstrupr(char *);
#define EDUKE32_TMRTIC t[ti++]=getticks() #define EDUKE32_TMRTIC t[ti++]=getticks()
#define EDUKE32_TMRPRN do { int ii=0; fprintf(stderr,"%s: ",tmrstr); for (ii=1; ii<ti; ii++) fprintf(stderr,"%d ", t[ii]-t[ii-1]); fprintf(stderr,"\n"); } while (0) #define EDUKE32_TMRPRN do { int ii=0; fprintf(stderr,"%s: ",tmrstr); for (ii=1; ii<ti; ii++) fprintf(stderr,"%d ", t[ii]-t[ii-1]); fprintf(stderr,"\n"); } while (0)
static inline int32_t ARBNDCHK(int32_t i) { return i<0 ? (*(int32_t *)123=234) : i; }
#define DOUBLEWALL(w) wall[ARBNDCHK(w)]
#endif // __compat_h__ #endif // __compat_h__

View file

@ -116,7 +116,7 @@ extern const char *SaveBoard(const char *fn, uint32_t flags);
#define MAXCORRUPTTHINGS 64 #define MAXCORRUPTTHINGS 64
extern int32_t corruptlevel, numcorruptthings, corruptthings[MAXCORRUPTTHINGS]; extern int32_t corruptlevel, numcorruptthings, corruptthings[MAXCORRUPTTHINGS];
extern int32_t autocorruptcheck; extern int32_t autocorruptcheck;
extern int32_t CheckMapCorruption(int32_t printfromlev, int32_t tryfixing); extern int32_t CheckMapCorruption(int32_t printfromlev, uint64_t tryfixing);
extern void showsectordata(int16_t sectnum, int16_t small); extern void showsectordata(int16_t sectnum, int16_t small);
extern void showwalldata(int16_t wallnum, int16_t small); extern void showwalldata(int16_t wallnum, int16_t small);

View file

@ -42,8 +42,8 @@ enum cvartype_t
typedef struct typedef struct
{ {
char *name; const char *name;
char *helpstr; const char *helpstr;
void *var; void *var;
int32_t type; // see cvartype_t int32_t type; // see cvartype_t
int32_t min; int32_t min;

View file

@ -26,7 +26,7 @@ extern double gcosang, gsinang, gcosang2, gsinang2;
extern double gchang, gshang, gctang, gstang, gvisibility; extern double gchang, gshang, gctang, gstang, gvisibility;
struct glfiltermodes { struct glfiltermodes {
char *name; const char *name;
int32_t min,mag; int32_t min,mag;
}; };
#define numglfiltermodes 6 #define numglfiltermodes 6

View file

@ -147,7 +147,7 @@ static int32_t osdfunc_setrendermode(const osdfuncparm_t *parm)
int32_t m; int32_t m;
char *p; char *p;
char *modestrs[] = const char *modestrs[] =
{ {
"classic software", "", "classic software", "",
"", "polygonal OpenGL", "great justice (Polymer)" "", "polygonal OpenGL", "great justice (Polymer)"

View file

@ -2077,7 +2077,8 @@ void overheadeditor(void)
} }
} }
Bsprintf(cbuf, "map corrupt (level %d): %d errors", corruptlevel, numcorruptthings); Bsprintf(cbuf, "Map corrupt (level %d): %s%d errors", corruptlevel,
numcorruptthings>=MAXCORRUPTTHINGS ? ">=":"", numcorruptthings);
printext16(8,8, editorcolors[13],editorcolors[0],cbuf,0); printext16(8,8, editorcolors[13],editorcolors[0],cbuf,0);
} }
@ -5274,8 +5275,12 @@ int32_t getpointhighlight(int32_t xplc, int32_t yplc, int32_t point)
} }
if (dst <= dist) if (dst <= dist)
{
// prefer white walls
if (dist<dist || closest==-1 || (wall[j].nextwall>=0)-(wall[closest].nextwall>=0) <= 0)
dist = dst, closest = j; dist = dst, closest = j;
} }
}
if (zoom >= 256) if (zoom >= 256)
for (i=0; i<MAXSPRITES; i++) for (i=0; i<MAXSPRITES; i++)

View file

@ -69,7 +69,7 @@ static int32_t lockrecip[200];
static char toupperlookup[256]; static char toupperlookup[256];
static void reportandexit(char *errormessage); static void reportandexit(const char *errormessage);
extern char pow2char[8]; extern char pow2char[8];
@ -226,7 +226,7 @@ void agecache(void)
} }
} }
static void reportandexit(char *errormessage) static void reportandexit(const char *errormessage)
{ {
int32_t i, j; int32_t i, j;
@ -841,7 +841,7 @@ void kclose(int32_t handle)
filehan[handle] = -1; filehan[handle] = -1;
} }
static int32_t klistaddentry(CACHE1D_FIND_REC **rec, char *name, int32_t type, int32_t source) static int32_t klistaddentry(CACHE1D_FIND_REC **rec, const char *name, int32_t type, int32_t source)
{ {
CACHE1D_FIND_REC *r = NULL, *attach = NULL; CACHE1D_FIND_REC *r = NULL, *attach = NULL;

View file

@ -707,7 +707,7 @@ int32_t Bclosedir(BDIR *dir)
} }
char *Bstrtoken(char *s, char *delim, char **ptrptr, int32_t chop) char *Bstrtoken(char *s, const char *delim, char **ptrptr, int32_t chop)
{ {
char *p, *start; char *p, *start;

View file

@ -82,7 +82,7 @@ enum scripttoken_t
T_TILEFROMTEXTURE, T_XOFFSET, T_YOFFSET T_TILEFROMTEXTURE, T_XOFFSET, T_YOFFSET
}; };
typedef struct { char *text; int32_t tokenid; } tokenlist; typedef struct { const char *text; int32_t tokenid; } tokenlist;
static int32_t getatoken(scriptfile *sf, const tokenlist *tl, int32_t ntokens) static int32_t getatoken(scriptfile *sf, const tokenlist *tl, int32_t ntokens)
{ {

View file

@ -155,7 +155,7 @@ char britable[16][256]; // JBF 20040207: full 8bit precision
extern char textfont[2048], smalltextfont[2048]; extern char textfont[2048], smalltextfont[2048];
static char kensmessage[128]; static char kensmessage[128];
char *engineerrstr = "No error"; const char *engineerrstr = "No error";
int32_t showfirstwall=0; int32_t showfirstwall=0;
int32_t showheightindicators=2; int32_t showheightindicators=2;
@ -7912,7 +7912,7 @@ int32_t loadmaphack(const char *filename)
T_LIGHT, T_LIGHT,
}; };
static struct { char *text; int32_t tokenid; } legaltokens[] = static struct { const char *text; int32_t tokenid; } legaltokens[] =
{ {
{ "sprite", T_SPRITE }, { "sprite", T_SPRITE },
{ "angleoff", T_ANGOFF }, { "angleoff", T_ANGOFF },
@ -9696,7 +9696,9 @@ int32_t lastwall(int16_t point)
} }
////////// ////////// CLIPMOVE //////////
int32_t clipmoveboxtracenum = 3;
static int32_t clipsprite_try(const spritetype *spr, int32_t xmin, int32_t ymin, int32_t xmax, int32_t ymax) static int32_t clipsprite_try(const spritetype *spr, int32_t xmin, int32_t ymin, int32_t xmax, int32_t ymax)
{ {
@ -9821,17 +9823,24 @@ static int32_t clipsprite_initindex(int32_t curidx, spritetype *curspr, int32_t
return flipmul; return flipmul;
} }
#define addclipline(dax1, day1, dax2, day2, daoval) \
{ \
if (clipnum < MAXCLIPNUM) { \
clipit[clipnum].x1 = dax1; clipit[clipnum].y1 = day1; \
clipit[clipnum].x2 = dax2; clipit[clipnum].y2 = day2; \
clipobjectval[clipnum] = daoval; \
clipnum++; \
} else if (!warned) { initprintf("!!clipnum\n"); warned=1; } \
} \
int32_t clipmoveboxtracenum = 3; static int32_t clipmove_warned=0;
static void addclipline(int32_t dax1, int32_t day1, int32_t dax2, int32_t day2, int32_t daoval)
{
if (clipnum < MAXCLIPNUM)
{
clipit[clipnum].x1 = dax1; clipit[clipnum].y1 = day1;
clipit[clipnum].x2 = dax2; clipit[clipnum].y2 = day2;
clipobjectval[clipnum] = daoval;
clipnum++;
}
else if (!clipmove_warned)
{
initprintf("!!clipnum\n");
clipmove_warned = 1;
}
}
// //
// clipmove // clipmove
@ -9852,11 +9861,13 @@ int32_t clipmove(vec3_t *vect, int16_t *sectnum,
int32_t hitwall, cnt, clipyou; int32_t hitwall, cnt, clipyou;
spritetype *curspr=NULL; // non-NULL when handling sprite with sector-like clipping spritetype *curspr=NULL; // non-NULL when handling sprite with sector-like clipping
int32_t curidx=-1, warned=0, clipspritecnt; int32_t curidx=-1, clipspritecnt;
if (((xvect|yvect) == 0) || (*sectnum < 0)) return(0); if (((xvect|yvect) == 0) || (*sectnum < 0)) return(0);
retval = 0; retval = 0;
clipmove_warned = 0;
oxvect = xvect; oxvect = xvect;
oyvect = yvect; oyvect = yvect;

View file

@ -42,7 +42,9 @@ defstate arraytest
ends ends
defstate itertest defstate itertest
var gi gj gk
// iteration and break test // iteration and break test
for i range 10 for i range 10
{ {
addlogvar i addlogvar i
@ -82,70 +84,70 @@ define MIN_CONSTANT -2147483648
defstate consttest defstate consttest
quote " --- Constants test ---", quote " " quote " --- Constants test ---", quote " "
quote "Shoud be 0:" quote "Should be 0:"
set i 0, set j TEST_ZERO set i 0, set j TEST_ZERO
qsprintf TQUOTE "%d %d %d %d" 0 TEST_ZERO i j qsprintf TQUOTE "%d %d %d %d" 0 TEST_ZERO i j
quote TQUOTE, quote " " quote TQUOTE, quote " "
quote "Shoud be 1:" quote "Should be 1:"
set i 1, set j TEST_PLUS_ONE set i 1, set j TEST_PLUS_ONE
qsprintf TQUOTE "%d %d %d %d" 1 TEST_PLUS_ONE i j qsprintf TQUOTE "%d %d %d %d" 1 TEST_PLUS_ONE i j
quote TQUOTE, quote " " quote TQUOTE, quote " "
quote "Shoud be -1:" quote "Should be -1:"
set i -1, set j TEST_MINUS_ONE set i -1, set j TEST_MINUS_ONE
qsprintf TQUOTE "%d %d %d %d" -1 TEST_MINUS_ONE i j qsprintf TQUOTE "%d %d %d %d" -1 TEST_MINUS_ONE i j
quote TQUOTE, quote " " quote TQUOTE, quote " "
quote "Shoud be 32767:" quote "Should be 32767:"
set i 32767, set j MOST_POSITIVE_DIRECT set i 32767, set j MOST_POSITIVE_DIRECT
qsprintf TQUOTE "%d %d %d %d" 32767 MOST_POSITIVE_DIRECT i j qsprintf TQUOTE "%d %d %d %d" 32767 MOST_POSITIVE_DIRECT i j
quote TQUOTE, quote " " quote TQUOTE, quote " "
quote "Shoud be -32768:" quote "Should be -32768:"
set i -32768, set j MOST_NEGATIVE_DIRECT set i -32768, set j MOST_NEGATIVE_DIRECT
qsprintf TQUOTE "%d %d %d %d" -32768 MOST_NEGATIVE_DIRECT i j qsprintf TQUOTE "%d %d %d %d" -32768 MOST_NEGATIVE_DIRECT i j
quote TQUOTE, quote " " quote TQUOTE, quote " "
quote "Shoud be 32768:" quote "Should be 32768:"
set i 32768, set j LEAST_POSITIVE_INDIRECT set i 32768, set j LEAST_POSITIVE_INDIRECT
qsprintf TQUOTE "%d %d %d %d" 32768 LEAST_POSITIVE_INDIRECT i j qsprintf TQUOTE "%d %d %d %d" 32768 LEAST_POSITIVE_INDIRECT i j
quote TQUOTE, quote " " quote TQUOTE, quote " "
quote "Shoud be -32769:" quote "Should be -32769:"
set i -32769, set j LEAST_NEGATIVE_INDIRECT set i -32769, set j LEAST_NEGATIVE_INDIRECT
qsprintf TQUOTE "%d %d %d %d" -32769 LEAST_NEGATIVE_INDIRECT i j qsprintf TQUOTE "%d %d %d %d" -32769 LEAST_NEGATIVE_INDIRECT i j
quote TQUOTE, quote " " quote TQUOTE, quote " "
quote "Hex tests:" quote "Hex tests:"
quote "Shoud be 32767:" quote "Should be 32767:"
set i 0x7fff, set j HEX_MOST_POSITIVE_DIRECT set i 0x7fff, set j HEX_MOST_POSITIVE_DIRECT
qsprintf TQUOTE "%d %d %d %d" 0x7fff HEX_MOST_POSITIVE_DIRECT i j qsprintf TQUOTE "%d %d %d %d" 0x7fff HEX_MOST_POSITIVE_DIRECT i j
quote TQUOTE, quote " " quote TQUOTE, quote " "
quote "Shoud be -32768:" quote "Should be -32768:"
set i 0xffff8000, set j HEX_MOST_NEGATIVE_DIRECT set i 0xffff8000, set j HEX_MOST_NEGATIVE_DIRECT
qsprintf TQUOTE "%d %d %d %d" 0xffff8000 HEX_MOST_NEGATIVE_DIRECT i j qsprintf TQUOTE "%d %d %d %d" 0xffff8000 HEX_MOST_NEGATIVE_DIRECT i j
quote TQUOTE, quote " " quote TQUOTE, quote " "
quote "Shoud be 32768:" quote "Should be 32768:"
set i 0x8000, set j HEX_LEAST_POSITIVE_INDIRECT set i 0x8000, set j HEX_LEAST_POSITIVE_INDIRECT
qsprintf TQUOTE "%d %d %d %d" 0x8000 HEX_LEAST_POSITIVE_INDIRECT i j qsprintf TQUOTE "%d %d %d %d" 0x8000 HEX_LEAST_POSITIVE_INDIRECT i j
quote TQUOTE, quote " " quote TQUOTE, quote " "
quote "Shoud be -32769:" quote "Should be -32769:"
set i 0xffff7fff, set j HEX_LEAST_NEGATIVE_INDIRECT set i 0xffff7fff, set j HEX_LEAST_NEGATIVE_INDIRECT
qsprintf TQUOTE "%d %d %d %d" 0xffff7fff HEX_LEAST_NEGATIVE_INDIRECT i j qsprintf TQUOTE "%d %d %d %d" 0xffff7fff HEX_LEAST_NEGATIVE_INDIRECT i j
quote TQUOTE, quote " " quote TQUOTE, quote " "
quote "min/max tests:" quote "min/max tests:"
quote "Shoud be 2147483647:" quote "Should be 2147483647:"
set i 2147483647, set j MAX_CONSTANT set i 2147483647, set j MAX_CONSTANT
qsprintf TQUOTE "%d %d %d %d" 2147483647 MAX_CONSTANT i j qsprintf TQUOTE "%d %d %d %d" 2147483647 MAX_CONSTANT i j
quote TQUOTE, quote " " quote TQUOTE, quote " "
quote "Shoud be -2147483648:" quote "Should be -2147483648:"
set i -2147483648, set j MIN_CONSTANT set i -2147483648, set j MIN_CONSTANT
qsprintf TQUOTE "%d %d %d %d" -2147483648 MIN_CONSTANT i j qsprintf TQUOTE "%d %d %d %d" -2147483648 MIN_CONSTANT i j
quote TQUOTE, quote " " quote TQUOTE, quote " "

View file

@ -3,8 +3,6 @@
#include "names.h" #include "names.h"
// tilegroup "All named" with the hotkey "Y" is constructed automatically
tilegroup "Actors" tilegroup "Actors"
{ {
hotkey "A" hotkey "A"

View file

@ -3788,7 +3788,7 @@ static inline void getnumber_doint64(int64_t *ptr, int32_t num)
*ptr = (int64_t) num; *ptr = (int64_t) num;
} }
void getnumberptr256(char *namestart, void *num, int32_t bytes, int32_t maxnumber, char sign, void *(func)(int32_t)) static void getnumberptr256(const char *namestart, void *num, int32_t bytes, int32_t maxnumber, char sign, void *(func)(int32_t))
{ {
char buffer[80], ch; char buffer[80], ch;
int32_t n, danum = 0, oldnum; int32_t n, danum = 0, oldnum;
@ -7090,8 +7090,8 @@ static void Keys2d(void)
} }
else x=editorgridextent+1; else x=editorgridextent+1;
printmessage16("%s Corrupt %s %d%s", tsign<0?"<":">", secwalspr[j], i, printmessage16("#%d: %s Corrupt %s %d%s", curcorruptthing+1, tsign<0?"<":">", secwalspr[j],
(x==editorgridextent+1) ? " (outside grid)" : (wrap ? " (wrap)" : "")); i, (x==editorgridextent+1) ? " (outside grid)" : (wrap ? " (wrap)" : ""));
} }
} }
else if (wallsprite==0) else if (wallsprite==0)
@ -7346,7 +7346,7 @@ void ExtPreSaveMap(void)
static void G_ShowParameterHelp(void) static void G_ShowParameterHelp(void)
{ {
char *s = "Usage: mapster32 [OPTIONS] [FILE]\n\n" const char *s = "Usage: mapster32 [OPTIONS] [FILE]\n\n"
"-gFILE, -grp FILE\tUse extra group file FILE\n" "-gFILE, -grp FILE\tUse extra group file FILE\n"
"-hFILE\t\tUse definitions file FILE\n" "-hFILE\t\tUse definitions file FILE\n"
"-jDIR, -game_dir DIR\n\t\tAdds DIR to the file path stack\n" "-jDIR, -game_dir DIR\n\t\tAdds DIR to the file path stack\n"
@ -7655,6 +7655,11 @@ int32_t ExtPreInit(int32_t argc,const char **argv)
return 0; return 0;
} }
static int32_t atoi_safe(const char *str)
{
return (int32_t)strtol(str, NULL, 10);
}
static int32_t osdcmd_quit(const osdfuncparm_t *parm) static int32_t osdcmd_quit(const osdfuncparm_t *parm)
{ {
UNREFERENCED_PARAMETER(parm); UNREFERENCED_PARAMETER(parm);
@ -7784,7 +7789,7 @@ static int32_t osdcmd_vars_pk(const osdfuncparm_t *parm)
OSD_Printf("Turning acceleration+declaration is %d\n", pk_turnaccel); OSD_Printf("Turning acceleration+declaration is %d\n", pk_turnaccel);
else else
{ {
pk_turnaccel = atoi(parm->parms[0]); pk_turnaccel = atoi_safe(parm->parms[0]);
pk_turnaccel = pk_turnaccel<=pk_turndecel ? (pk_turndecel+1):pk_turnaccel; pk_turnaccel = pk_turnaccel<=pk_turndecel ? (pk_turndecel+1):pk_turnaccel;
pk_turnaccel = pk_turnaccel>256 ? 256:pk_turnaccel; pk_turnaccel = pk_turnaccel>256 ? 256:pk_turnaccel;
} }
@ -7795,7 +7800,7 @@ static int32_t osdcmd_vars_pk(const osdfuncparm_t *parm)
OSD_Printf("Turning deceleration is %d\n", pk_turndecel); OSD_Printf("Turning deceleration is %d\n", pk_turndecel);
else else
{ {
pk_turndecel = atoi(parm->parms[0]); pk_turndecel = atoi_safe(parm->parms[0]);
pk_turndecel = pk_turndecel<=0 ? 1:pk_turndecel; pk_turndecel = pk_turndecel<=0 ? 1:pk_turndecel;
pk_turndecel = pk_turndecel>=pk_turnaccel ? (pk_turnaccel-1):pk_turndecel; pk_turndecel = pk_turndecel>=pk_turnaccel ? (pk_turnaccel-1):pk_turndecel;
pk_turndecel = pk_turndecel>128 ? 128:pk_turndecel; pk_turndecel = pk_turndecel>128 ? 128:pk_turndecel;
@ -7810,7 +7815,7 @@ static int32_t osdcmd_vars_pk(const osdfuncparm_t *parm)
{ {
if (parm->numparms==1) if (parm->numparms==1)
{ {
pk_uedaccel = atoi(parm->parms[0]); pk_uedaccel = atoi_safe(parm->parms[0]);
pk_uedaccel = pk_uedaccel<0 ? 0:pk_uedaccel; pk_uedaccel = pk_uedaccel<0 ? 0:pk_uedaccel;
pk_uedaccel = pk_uedaccel>5 ? 5:pk_uedaccel; pk_uedaccel = pk_uedaccel>5 ? 5:pk_uedaccel;
} }
@ -7843,7 +7848,7 @@ static int32_t osdcmd_vars_pk(const osdfuncparm_t *parm)
static const char *how[3] = {"none", "two-sided walls only", "all"}; static const char *how[3] = {"none", "two-sided walls only", "all"};
if (parm->numparms == 1) if (parm->numparms == 1)
showheightindicators = clamp(atoi(parm->parms[0]), 0, 2); showheightindicators = clamp(atoi_safe(parm->parms[0]), 0, 2);
if (parm->numparms <= 1) if (parm->numparms <= 1)
OSD_Printf("height indicators: %s\n", how[showheightindicators]); OSD_Printf("height indicators: %s\n", how[showheightindicators]);
@ -7855,7 +7860,7 @@ static int32_t osdcmd_vars_pk(const osdfuncparm_t *parm)
static const char *how[3] = {"none", "current sector only", "all"}; static const char *how[3] = {"none", "current sector only", "all"};
if (parm->numparms == 1) if (parm->numparms == 1)
showambiencesounds = clamp(atoi(parm->parms[0]), 0, 2); showambiencesounds = clamp(atoi_safe(parm->parms[0]), 0, 2);
if (parm->numparms <= 1) if (parm->numparms <= 1)
OSD_Printf("ambience sound circles: %s\n", how[showambiencesounds]); OSD_Printf("ambience sound circles: %s\n", how[showambiencesounds]);
@ -7864,7 +7869,9 @@ static int32_t osdcmd_vars_pk(const osdfuncparm_t *parm)
} }
else if (!Bstrcasecmp(parm->name, "corruptcheck")) else if (!Bstrcasecmp(parm->name, "corruptcheck"))
{ {
if (parm->numparms == 1) int32_t tryfix = parm->numparms>=1 && !Bstrcasecmp(parm->parms[0], "tryfix");
if (parm->numparms == 1 || tryfix)
{ {
if (!Bstrcasecmp(parm->parms[0], "now")) if (!Bstrcasecmp(parm->parms[0], "now"))
{ {
@ -7872,14 +7879,47 @@ static int32_t osdcmd_vars_pk(const osdfuncparm_t *parm)
OSD_Printf("All OK.\n"); OSD_Printf("All OK.\n");
return OSDCMD_OK; return OSDCMD_OK;
} }
else if (!Bstrcasecmp(parm->parms[0], "tryfix")) else if (tryfix)
{ {
CheckMapCorruption(3, 1); uint64_t whicherrs = parm->numparms==1 ? ULONG_LONG_MAX : 0;
if (whicherrs==0)
{
int32_t i, n, m;
char *endptr;
for (i=1; i<parm->numparms; i++)
{
n = (int32_t)Bstrtol(parm->parms[i], &endptr, 10);
if (endptr != parm->parms[i])
{
if (*endptr=='-')
{
m = (int32_t)Bstrtol(endptr+1, NULL, 10);
if (n>=1 && n<=m && m<=MAXCORRUPTTHINGS)
{
uint64_t mask = ULONG_LONG_MAX;
m = m-n+1;
mask >>= (MAXCORRUPTTHINGS-m);
mask <<= (n-1);
whicherrs |= mask;
}
}
else
{
if (n>=1 && n<=MAXCORRUPTTHINGS)
whicherrs |= (1ull<<(n-1));
}
}
}
}
CheckMapCorruption(3, whicherrs);
return OSDCMD_OK; return OSDCMD_OK;
} }
else if (isdigit(parm->parms[0][0])) else if (isdigit(parm->parms[0][0]))
{ {
autocorruptcheck = clamp(atoi(parm->parms[0]), 0, 3600); autocorruptcheck = clamp(atoi_safe(parm->parms[0]), 0, 3600);
corruptchecktimer = totalclock + 120*autocorruptcheck; corruptchecktimer = totalclock + 120*autocorruptcheck;
} }
} }
@ -7891,7 +7931,7 @@ static int32_t osdcmd_vars_pk(const osdfuncparm_t *parm)
else else
OSD_Printf("auto corruption check: off\n"); OSD_Printf("auto corruption check: off\n");
} }
else else if (!tryfix)
return OSDCMD_SHOWHELP; return OSDCMD_SHOWHELP;
} }
@ -7906,7 +7946,7 @@ static int32_t osdcmd_tint(const osdfuncparm_t *parm)
if (parm->numparms==1) if (parm->numparms==1)
{ {
i = atoi(parm->parms[0]); i = atoi_safe(parm->parms[0]);
if (i>=0 && i<MAXPALOOKUPS-RESERVEDPALS) if (i>=0 && i<MAXPALOOKUPS-RESERVEDPALS)
{ {
p = &hictinting[i]; p = &hictinting[i];
@ -7922,15 +7962,15 @@ static int32_t osdcmd_tint(const osdfuncparm_t *parm)
} }
else if (parm->numparms>=2) else if (parm->numparms>=2)
{ {
i = atoi(parm->parms[0]); i = atoi_safe(parm->parms[0]);
if (i<0 || i>=MAXPALOOKUPS-RESERVEDPALS) if (i<0 || i>=MAXPALOOKUPS-RESERVEDPALS)
return OSDCMD_SHOWHELP; return OSDCMD_SHOWHELP;
p = &hictinting[i]; p = &hictinting[i];
p->r = atoi(parm->parms[1]); p->r = atoi_safe(parm->parms[1]);
p->g = (parm->numparms>=3) ? atoi(parm->parms[2]) : 255; p->g = (parm->numparms>=3) ? atoi_safe(parm->parms[2]) : 255;
p->b = (parm->numparms>=4) ? atoi(parm->parms[3]) : 255; p->b = (parm->numparms>=4) ? atoi_safe(parm->parms[3]) : 255;
p->f = (parm->numparms>=5) ? atoi(parm->parms[4])&HICEFFECTMASK : 0; p->f = (parm->numparms>=5) ? atoi_safe(parm->parms[4])&HICEFFECTMASK : 0;
} }
return OSDCMD_OK; return OSDCMD_OK;
} }
@ -7965,7 +8005,7 @@ static int32_t osdcmd_disasm(const osdfuncparm_t *parm)
if (!isdigit(parm->parms[1][0])) if (!isdigit(parm->parms[1][0]))
return OSDCMD_SHOWHELP; return OSDCMD_SHOWHELP;
i=atoi(parm->parms[1]); i=atoi_safe(parm->parms[1]);
if (parm->parms[0][0]=='s') if (parm->parms[0][0]=='s')
{ {
@ -8122,7 +8162,7 @@ static int32_t osdcmd_endisableevent(const osdfuncparm_t *parm)
if (isdigit(parm->parms[i][0])) if (isdigit(parm->parms[i][0]))
{ {
j = atoi(parm->parms[i]); j = atoi_safe(parm->parms[i]);
Bsprintf(buf2, "event %d", j); Bsprintf(buf2, "event %d", j);
} }
else if (!Bstrncmp(parm->parms[i], "EVENT_", 6)) else if (!Bstrncmp(parm->parms[i], "EVENT_", 6))
@ -8349,12 +8389,12 @@ enum
typedef struct typedef struct
{ {
char *text; const char *text;
int32_t tokenid; int32_t tokenid;
} }
tokenlist; tokenlist;
static int32_t getatoken(scriptfile *sf, tokenlist *tl, int32_t ntokens) static int32_t getatoken(scriptfile *sf, const tokenlist *tl, int32_t ntokens)
{ {
char *tok; char *tok;
int32_t i; int32_t i;
@ -8466,7 +8506,7 @@ int32_t parsegroupfiles(scriptfile *script)
return 0; return 0;
} }
int32_t loadgroupfiles(char *fn) int32_t loadgroupfiles(const char *fn)
{ {
scriptfile *script; scriptfile *script;
@ -10038,48 +10078,57 @@ void ExtCheckKeys(void)
//// port of a.m32's corruptchk //// //// port of a.m32's corruptchk ////
// returns value from 0 (all OK) to 5 (panic!) // returns value from 0 (all OK) to 5 (panic!)
#define CCHK_PANIC OSDTEXT_DARKRED "PANIC!!!^O " #define CCHK_PANIC OSDTEXT_DARKRED "PANIC!!!^O "
#define CCHKPREF OSDTEXT_RED "* ^O" //#define CCHKPREF OSDTEXT_RED "^O"
#define CCHK_CORRECTED OSDTEXT_GREEN " -> " #define CCHK_CORRECTED OSDTEXT_GREEN " -> "
#define CORRUPTCHK_PRINT(errlev, what, fmt, ...) do \ #define CORRUPTCHK_PRINT(errlev, what, fmt, ...) do \
{ \ { \
bad = max(bad, errlev); \ bad = max(bad, errlev); \
if (numcorruptthings<MAXCORRUPTTHINGS) \ if (numcorruptthings>=MAXCORRUPTTHINGS) \
goto too_many_errors; \
corruptthings[numcorruptthings++] = what; \ corruptthings[numcorruptthings++] = what; \
if (errlev >= printfromlev) \ if (errlev >= printfromlev) \
OSD_Printf(CCHKPREF fmt "\n", ## __VA_ARGS__); \ OSD_Printf("#%d: " fmt "\n", numcorruptthings, ## __VA_ARGS__); \
} while (0) } while (0)
static int32_t walls_are_consistent(int32_t nw, int32_t j)
{
return (wall[j].x==POINT2(nw).x && wall[j].y==POINT2(nw).y
&& POINT2(j).x==wall[nw].x && POINT2(j).y==wall[nw].y);
}
static void suggest_nextsector_correction(int32_t nw, int32_t j) static void suggest_nextsector_correction(int32_t nw, int32_t j)
{ {
if (nw>=0 && nw<numwalls) if (nw>=0 && nw<numwalls)
{ {
// maybe nextwall is right? // maybe nextwall is right?
if (wall[nw].nextwall==j && wall[j].x==POINT2(nw).x && wall[j].y==POINT2(nw).y) if (wall[nw].nextwall==j && walls_are_consistent(nw, j))
OSD_Printf(" suggest setting wall[%d].nextsector to %d\n", j, sectorofwall_noquick(nw)); OSD_Printf(" suggest setting wall[%d].nextsector to %d\n",
j, sectorofwall_noquick(nw));
} }
} }
static void do_nextsector_correction(int32_t nw, int32_t j) static void do_nextsector_correction(int32_t nw, int32_t j)
{ {
if (nw>=0 && nw<numwalls) if (nw>=0 && nw<numwalls)
if (wall[nw].nextwall==j && wall[j].x==POINT2(nw).x && wall[j].y==POINT2(nw).y) if (wall[nw].nextwall==j && walls_are_consistent(nw, j))
{ {
int32_t newns = sectorofwall_noquick(nw); int32_t newns = sectorofwall_noquick(nw);
wall[j].nextsector = newns; wall[j].nextsector = newns;
OSD_Printf(CCHK_CORRECTED "auto-correction: set wall[%d].nextsector=%d\n", j, newns); OSD_Printf(CCHK_CORRECTED "auto-correction: set wall[%d].nextsector=%d\n",
j, newns);
} }
} }
int32_t CheckMapCorruption(int32_t printfromlev, int32_t tryfixing) int32_t CheckMapCorruption(int32_t printfromlev, uint64_t tryfixing)
{ {
int32_t i, j, w0, numw, endwall, ns, nw; int32_t i, j, w0, numw, endwall, ns, nw;
int32_t ewall=0; // expected wall index int32_t ewall=0; // expected wall index
int32_t errlevel=0, bad=0; int32_t errlevel=0, bad=0;
uint8_t *seen_nextwalls; uint8_t *seen_nextwalls = NULL;
int16_t *lastnextwallsource; int16_t *lastnextwallsource = NULL;
numcorruptthings = 0; numcorruptthings = 0;
@ -10124,9 +10173,9 @@ int32_t CheckMapCorruption(int32_t printfromlev, int32_t tryfixing)
if (endwall > numwalls) if (endwall > numwalls)
CORRUPTCHK_PRINT(4, CORRUPT_SECTOR|i, "SECTOR[%d]: wallptr+wallnum=%d out of range: numwalls=%d", i, endwall, numwalls); CORRUPTCHK_PRINT(4, CORRUPT_SECTOR|i, "SECTOR[%d]: wallptr+wallnum=%d out of range: numwalls=%d", i, endwall, numwalls);
if (bad)
errlevel = max(errlevel, bad); errlevel = max(errlevel, bad);
else
if (bad<4)
{ {
endwall--; endwall--;
@ -10162,28 +10211,33 @@ int32_t CheckMapCorruption(int32_t printfromlev, int32_t tryfixing)
{ {
if (!bad) if (!bad)
{ {
int32_t onumct = numcorruptthings;
CORRUPTCHK_PRINT(4, CORRUPT_WALL|j, "WALL[%d].NEXTSECTOR is its own sector", j); CORRUPTCHK_PRINT(4, CORRUPT_WALL|j, "WALL[%d].NEXTSECTOR is its own sector", j);
if (tryfixing) if (onumct < MAXCORRUPTTHINGS)
{
if (tryfixing & (1ull<<onumct))
do_nextsector_correction(nw, j); do_nextsector_correction(nw, j);
else if (4>=printfromlev) else if (4>=printfromlev)
suggest_nextsector_correction(nw, j); suggest_nextsector_correction(nw, j);
} }
} }
}
if (nw>=0 && nw<numwalls) if (nw>=0 && nw<numwalls)
{ {
if (seen_nextwalls[nw>>3]&(1<<(nw&7))) if (seen_nextwalls[nw>>3]&(1<<(nw&7)))
{ {
int16_t nwnw, lnws; int16_t nwnw, lnws;
int32_t onumct = numcorruptthings;
lnws = lastnextwallsource[nw]; lnws = lastnextwallsource[nw];
CORRUPTCHK_PRINT(3, CORRUPT_WALL|j, "WALL[%d].NEXTWALL=%d already referenced from wall %d", CORRUPTCHK_PRINT(3, CORRUPT_WALL|j, "WALL[%d].NEXTWALL=%d already referenced from wall %d",
j, nw, lnws); j, nw, lnws);
nwnw = wall[nw].nextwall; nwnw = wall[nw].nextwall;
if (nwnw==j || nwnw==lnws) if (onumct < MAXCORRUPTTHINGS && (nwnw==j || nwnw==lnws))
{ {
int32_t walltoclear = nwnw==j ? lnws : j; int32_t walltoclear = nwnw==j ? lnws : j;
if (tryfixing) if (tryfixing & (1ull<<onumct))
{ {
wall[walltoclear].nextsector = wall[walltoclear].nextwall = -1; wall[walltoclear].nextsector = wall[walltoclear].nextwall = -1;
OSD_Printf(CCHK_CORRECTED "auto-correction: cleared wall %d's nextwall and nextsector tags to -1\n", OSD_Printf(CCHK_CORRECTED "auto-correction: cleared wall %d's nextwall and nextsector tags to -1\n",
@ -10203,32 +10257,39 @@ int32_t CheckMapCorruption(int32_t printfromlev, int32_t tryfixing)
if (bad<4) if (bad<4)
{ {
int32_t onumct = numcorruptthings;
if ((ns^nw)<0) if ((ns^nw)<0)
{ {
CORRUPTCHK_PRINT(4, CORRUPT_WALL|j, "WALL[%d].NEXTSECTOR=%d and .NEXTWALL=%d inconsistent:" CORRUPTCHK_PRINT(4, CORRUPT_WALL|j, "WALL[%d].NEXTSECTOR=%d and .NEXTWALL=%d inconsistent:"
" missing one next pointer", j, ns, nw); " missing one next pointer", j, ns, nw);
if (tryfixing) if (onumct < MAXCORRUPTTHINGS)
{
if (tryfixing & (1ull<<onumct))
do_nextsector_correction(nw, j); do_nextsector_correction(nw, j);
else if (4>=printfromlev) else if (4>=printfromlev)
suggest_nextsector_correction(nw, j); suggest_nextsector_correction(nw, j);
} }
}
else if (ns>=0) else if (ns>=0)
{ {
if (nw<sector[ns].wallptr || nw>=sector[ns].wallptr+sector[ns].wallnum) if (nw<sector[ns].wallptr || nw>=sector[ns].wallptr+sector[ns].wallnum)
{ {
CORRUPTCHK_PRINT(4, CORRUPT_WALL|j, "WALL[%d].NEXTWALL=%d out of .NEXTSECTOR=%d's bounds", CORRUPTCHK_PRINT(4, CORRUPT_WALL|j, "WALL[%d].NEXTWALL=%d out of .NEXTSECTOR=%d's bounds",
j, nw, ns); j, nw, ns);
if (tryfixing) if (onumct < MAXCORRUPTTHINGS)
{
if (tryfixing & (1ull<<onumct))
do_nextsector_correction(nw, j); do_nextsector_correction(nw, j);
else if (4 >= printfromlev) else if (4 >= printfromlev)
{ {
OSD_Printf(" sector %d's walls: [%d .. %d]\n", ns, sector[ns].wallptr, OSD_Printf(" sector %d's walls: [%d .. %d]\n", ns,
sector[ns].wallptr+sector[ns].wallnum-1); sector[ns].wallptr, sector[ns].wallptr+sector[ns].wallnum-1);
suggest_nextsector_correction(nw, j); suggest_nextsector_correction(nw, j);
} }
} }
} }
} }
}
errlevel = max(errlevel, bad); errlevel = max(errlevel, bad);
} }
@ -10251,6 +10312,13 @@ int32_t CheckMapCorruption(int32_t printfromlev, int32_t tryfixing)
} }
} }
if (0)
{
too_many_errors:
if (printfromlev<=errlevel)
OSD_Printf("!! too many errors, stopping. !!\n");
}
errlevel = max(errlevel, bad); errlevel = max(errlevel, bad);
if (errlevel) if (errlevel)
@ -10259,8 +10327,11 @@ int32_t CheckMapCorruption(int32_t printfromlev, int32_t tryfixing)
OSD_Printf("-- corruption level: %d\n", errlevel); OSD_Printf("-- corruption level: %d\n", errlevel);
} }
if (seen_nextwalls)
{
Bfree(seen_nextwalls); Bfree(seen_nextwalls);
Bfree(lastnextwallsource); Bfree(lastnextwallsource);
}
corruptlevel = errlevel; corruptlevel = errlevel;
@ -10506,7 +10577,7 @@ static void EditSectorData(int16_t sectnum)
break; break;
} }
} }
if (col == 2) else if (col == 2)
{ {
switch (row) switch (row)
{ {
@ -10606,10 +10677,10 @@ static void EditWallData(int16_t wallnum)
{ {
Bsprintf(med_edittext,"Wall %d X Repeat: ",wallnum); Bsprintf(med_edittext,"Wall %d X Repeat: ",wallnum);
printmessage16("%s", med_edittext); printmessage16("%s", med_edittext);
wall[wallnum].xrepeat = (char)getnumber16(med_edittext,(int32_t)wall[wallnum].xrepeat,256L,0); wall[wallnum].xrepeat = (char)getnumber16(med_edittext,(int32_t)wall[wallnum].xrepeat,255,0);
Bsprintf(med_edittext,"Wall %d Y Repeat: ",wallnum); Bsprintf(med_edittext,"Wall %d Y Repeat: ",wallnum);
printmessage16("%s", med_edittext); printmessage16("%s", med_edittext);
wall[wallnum].yrepeat = (char)getnumber16(med_edittext,(int32_t)wall[wallnum].yrepeat,256L,0); wall[wallnum].yrepeat = (char)getnumber16(med_edittext,(int32_t)wall[wallnum].yrepeat,255,0);
} }
break; break;
case 4: case 4:
@ -10618,10 +10689,10 @@ static void EditWallData(int16_t wallnum)
{ {
Bsprintf(med_edittext,"Wall %d X Pan: ",wallnum); Bsprintf(med_edittext,"Wall %d X Pan: ",wallnum);
printmessage16("%s", med_edittext); printmessage16("%s", med_edittext);
wall[wallnum].xpanning = (char)getnumber16(med_edittext,(int32_t)wall[wallnum].xpanning,256L,0); wall[wallnum].xpanning = (char)getnumber16(med_edittext,(int32_t)wall[wallnum].xpanning,255,0);
Bsprintf(med_edittext,"Wall %d Y Pan: ",wallnum); Bsprintf(med_edittext,"Wall %d Y Pan: ",wallnum);
printmessage16("%s", med_edittext); printmessage16("%s", med_edittext);
wall[wallnum].ypanning = (char)getnumber16(med_edittext,(int32_t)wall[wallnum].ypanning,256L,0); wall[wallnum].ypanning = (char)getnumber16(med_edittext,(int32_t)wall[wallnum].ypanning,255,0);
} }
break; break;
case 5: case 5:
@ -10889,7 +10960,7 @@ static void GenericSpriteSearch()
int32_t rowmax[3]= {6,5,6}, dispwidth[3] = {24,24,28}; int32_t rowmax[3]= {6,5,6}, dispwidth[3] = {24,24,28};
int32_t xpos[3] = {8,200,400}, ypos = ydim-STATUS2DSIZ+48; int32_t xpos[3] = {8,200,400}, ypos = ydim-STATUS2DSIZ+48;
static char *labels[7][3] = static const char *labels[7][3] =
{ {
{"X-coordinate", "Flags (hex)", "Angle (2048 degrees)"}, {"X-coordinate", "Flags (hex)", "Angle (2048 degrees)"},
{"Y-coordinate", "Shade", "X-Velocity"}, {"Y-coordinate", "Shade", "X-Velocity"},

View file

@ -909,6 +909,26 @@ static int32_t GetGamearrayID(const char *szGameLabel, int32_t searchlocals)
#define GV_WRITABLE GAMEVAR_READONLY #define GV_WRITABLE GAMEVAR_READONLY
#define GV_SIMPLE GAMEVAR_SPECIAL #define GV_SIMPLE GAMEVAR_SPECIAL
static int32_t parse_integer_literal(int32_t *num)
{
if (tolower(textptr[1])=='x')
sscanf(textptr+2, "%" SCNx32, num);
else
{
long lnum;
errno = 0;
lnum = strtol(textptr, NULL, 10);
if (errno || (sizeof(long)>4 && (lnum<INT_MIN || lnum>INT_MAX)))
{
C_CUSTOMERROR("integer literal exceeds bitwidth.");
return 1;
}
*num = (int32_t)lnum;
}
return 0;
}
static void C_GetNextVarType(int32_t type) static void C_GetNextVarType(int32_t type)
{ {
int32_t i, id=0, flags=0, num, indirect=0; //, thenum; int32_t i, id=0, flags=0, num, indirect=0; //, thenum;
@ -940,10 +960,7 @@ static void C_GetNextVarType(int32_t type)
// if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug) // if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug)
// initprintf("%s:%d: debug: accepted constant %d in place of gamevar.\n",g_szScriptFileName,g_lineNumber,atol(textptr)); // initprintf("%s:%d: debug: accepted constant %d in place of gamevar.\n",g_szScriptFileName,g_lineNumber,atol(textptr));
if (tolower(textptr[1])=='x') parse_integer_literal(&num);
sscanf(textptr+2, "%" SCNx32, &num);
else
num = atoi(textptr);
//thenum=num; //thenum=num;
if (type==GV_SIMPLE && (num<0 || num>=65536)) if (type==GV_SIMPLE && (num<0 || num>=65536))
C_CUSTOMERROR("array index %d out of bounds. (max: 65535)", num); C_CUSTOMERROR("array index %d out of bounds. (max: 65535)", num);
@ -1442,10 +1459,7 @@ static int32_t C_GetNextValue(int32_t type)
// if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug > 1) // if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug > 1)
// initprintf("%s:%d: debug: accepted constant %d.\n",g_szScriptFileName,g_lineNumber,atol(textptr)); // initprintf("%s:%d: debug: accepted constant %d.\n",g_szScriptFileName,g_lineNumber,atol(textptr));
if (tolower(textptr[1])=='x') parse_integer_literal(g_scriptPtr);
sscanf(textptr+2,"%" SCNx32 "",g_scriptPtr);
else
*g_scriptPtr = atol(textptr);
g_scriptPtr++; g_scriptPtr++;

View file

@ -70,7 +70,7 @@ extern int32_t g_stateCount;
typedef struct typedef struct
{ {
char *name; const char *name;
int16_t lId; int16_t lId;
int16_t flags; // 1: read-only int16_t flags; // 1: read-only
int32_t min, max; int32_t min, max;
@ -82,7 +82,8 @@ extern const memberlabel_t SpriteLabels[];
typedef struct { typedef struct {
char* token; int32_t val; const char* token;
int32_t val;
} tokenmap_t; } tokenmap_t;
extern const tokenmap_t iter_tokens[]; extern const tokenmap_t iter_tokens[];

View file

@ -440,9 +440,11 @@ skip_check:
//AddLog("Done Executing Case"); //AddLog("Done Executing Case");
bMatched=1; bMatched=1;
} }
if (right-left < 0) if (right-left < 0)
break; break;
} }
if (!bMatched) if (!bMatched)
{ {
if (*lpDefault >= 0) if (*lpDefault >= 0)

View file

@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// #define VULGARITY // #define VULGARITY
char *defsfilename = "duke3d.def"; const char *defsfilename = "duke3d.def";
extern char keystatus[]; extern char keystatus[];
extern int16_t defaultspritecstat; extern int16_t defaultspritecstat;

View file

@ -937,7 +937,7 @@ static uint8_t savegame_comprthres;
// 64 // 64
#define DS_LOADFN 128 // .ptr is function that is run when loading #define DS_LOADFN 128 // .ptr is function that is run when loading
#define DS_SAVEFN 256 // .ptr is function that is run when saving #define DS_SAVEFN 256 // .ptr is function that is run when saving
#define DS_NOCHK 1024 // don't check for diffs (and don't write out in dump) since assumend constant throughout demo #define DS_NOCHK 1024 // don't check for diffs (and don't write out in dump) since assumed constant throughout demo
#define DS_END (0x70000000) #define DS_END (0x70000000)
static int32_t ds_getcnt(const dataspec_t *sp) static int32_t ds_getcnt(const dataspec_t *sp)

View file

@ -226,7 +226,7 @@ fallback:
} }
{ {
static char *s[] = { "/etc/timidity.cfg", "/etc/timidity/timidity.cfg", "/etc/timidity/freepats.cfg" }; static const char *s[] = { "/etc/timidity.cfg", "/etc/timidity/timidity.cfg", "/etc/timidity/freepats.cfg" };
FILE *fp; FILE *fp;
int32_t i; int32_t i;