Split r3159..r3161, part 5: "nowarn" wrapping of printing functions.

git-svn-id: https://svn.eduke32.com/eduke32@3170 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-11-15 14:28:04 +00:00
parent f7eb5adb40
commit 274726be9b
8 changed files with 106 additions and 50 deletions

View File

@ -662,5 +662,38 @@ char *Bstrupr(char *);
if (fileptr) { Bfclose(fileptr); fileptr=NULL; } \ if (fileptr) { Bfclose(fileptr); fileptr=NULL; } \
} while (0) } while (0)
#define NOWARN(print_func, fmt, ...) do { \
print_func(fmt, ## __VA_ARGS__); \
} while (0)
#define NOWARN_RETURN(print_func, var, fmt, ...) do { \
var = print_func(fmt, ## __VA_ARGS__); \
} while (0)
// TODO: add MSVC pragmas to disable equivalent warning, if necessary later
#ifndef _MSC_VER
#ifdef _WIN32
// MinGW's _Pragma is completely broken so our GCC NOWARN macro is useless there
#pragma GCC diagnostic ignored "-Wformat"
#else
#undef NOWARN
#undef NOWARN_RETURN
#define NOWARN(print_func, fmt, ...) do { _Pragma("GCC diagnostic ignored \"-Wformat\"") \
print_func(fmt, ## __VA_ARGS__); \
_Pragma("GCC diagnostic warning \"-Wformat\"") } while (0)
#define NOWARN_RETURN(print_func, var, fmt, ...) do { _Pragma("GCC diagnostic ignored \"-Wformat\"") \
var = print_func(fmt, ## __VA_ARGS__); \
_Pragma("GCC diagnostic warning \"-Wformat\"") } while (0)
#endif
#endif
#define OSD_Printf_nowarn(fmt, ...) NOWARN(OSD_Printf, fmt, ## __VA_ARGS__)
#define Bsprintf_nowarn(fmt, ...) NOWARN(Bsprintf, fmt, ## __VA_ARGS__)
#define Bsprintf_nowarn_return(x, fmt, ...) NOWARN_RETURN(Bsprintf, x, fmt, ## __VA_ARGS__)
#define initprintf_nowarn(fmt, ...) NOWARN(initprintf, fmt, ## __VA_ARGS__)
#define message_nowarn(fmt, ...) NOWARN(message, fmt, ## __VA_ARGS__)
#endif // __compat_h__ #endif // __compat_h__

View File

@ -5836,9 +5836,9 @@ end_point_dragging:
if (!delayerr) if (!delayerr)
message("Outer wall coordinates must coincide for both components"); message("Outer wall coordinates must coincide for both components");
OSD_Printf("wal0:%d (%d,%d)--(%d,%d)\n",(int)(wal0-wall), OSD_Printf_nowarn("wal0:%d (%d,%d)--(%d,%d)\n",(int)(wal0-wall),
wal0->x,wal0->y, wal0p2->x,wal0p2->y); wal0->x,wal0->y, wal0p2->x,wal0p2->y);
OSD_Printf("wal1:%d (%d,%d)--(%d,%d)\n",(int)(wal1-wall), OSD_Printf_nowarn("wal1:%d (%d,%d)--(%d,%d)\n",(int)(wal1-wall),
wal1->x,wal1->y, wal1p2->x,wal1p2->y); wal1->x,wal1->y, wal1p2->x,wal1p2->y);
goto end_join_sectors; goto end_join_sectors;
@ -8572,7 +8572,7 @@ int32_t fixspritesectors(void)
initprintf("--------------------\n"); initprintf("--------------------\n");
printfirsttime = 1; printfirsttime = 1;
} }
initprintf("Changed sectnum of sprite %d from %d to %d\n", i, sprite[i].sectnum, j); initprintf_nowarn("Changed sectnum of sprite %d from %d to %d\n", i, sprite[i].sectnum, j);
changespritesect(i, j); changespritesect(i, j);
} }
break; break;
@ -10021,9 +10021,10 @@ void printcoords16(int32_t posxe, int32_t posye, int16_t ange)
printext16(264, ydim-STATUS2DSIZ+128, v8?editorcolors[10]:whitecol, -1, snotbuf,0); printext16(264, ydim-STATUS2DSIZ+128, v8?editorcolors[10]:whitecol, -1, snotbuf,0);
} }
#define DOPRINT(Yofs, fmt, ...) \ #define DOPRINT(Yofs, fmt, ...) do { \
Bsprintf(snotbuf, fmt, ## __VA_ARGS__); \ Bsprintf_nowarn(snotbuf, fmt, ## __VA_ARGS__); \
printext16(8+col*200, ydim/*-(row*96)*/-STATUS2DSIZ+Yofs, color, -1, snotbuf, 0); printext16(8+col*200, ydim/*-(row*96)*/-STATUS2DSIZ+Yofs, color, -1, snotbuf, 0); \
} while (0)
void showsectordata(int16_t sectnum, int16_t small) void showsectordata(int16_t sectnum, int16_t small)
{ {

View File

@ -9396,7 +9396,7 @@ static void check_sprite(int32_t i)
{ {
if ((unsigned)sprite[i].sectnum >= MYMAXSECTORS()) if ((unsigned)sprite[i].sectnum >= MYMAXSECTORS())
{ {
initprintf(OSD_ERROR "Map error: sprite #%d (%d,%d) with illegal sector (%d). Map is corrupt!\n", initprintf_nowarn(OSD_ERROR "Map error: sprite #%d (%d,%d) with illegal sector (%d). Map is corrupt!\n",
i, sprite[i].x, sprite[i].y, sprite[i].sectnum); i, sprite[i].x, sprite[i].y, sprite[i].sectnum);
updatesector(sprite[i].x, sprite[i].y, &sprite[i].sectnum); updatesector(sprite[i].x, sprite[i].y, &sprite[i].sectnum);
@ -9407,14 +9407,14 @@ static void check_sprite(int32_t i)
if ((unsigned)sprite[i].statnum >= MAXSTATUS) if ((unsigned)sprite[i].statnum >= MAXSTATUS)
{ {
initprintf(OSD_ERROR "Map error: sprite #%d (%d,%d) with illegal statnum (%d). Map is corrupt!\n", initprintf_nowarn(OSD_ERROR "Map error: sprite #%d (%d,%d) with illegal statnum (%d). Map is corrupt!\n",
i, sprite[i].x, sprite[i].y, sprite[i].statnum); i, sprite[i].x, sprite[i].y, sprite[i].statnum);
sprite[i].statnum = 0; sprite[i].statnum = 0;
} }
if ((unsigned)sprite[i].picnum >= MAXTILES) if ((unsigned)sprite[i].picnum >= MAXTILES)
{ {
initprintf(OSD_ERROR "Map error: sprite #%d (%d,%d) with illegal picnum (%d). Map is corrupt!\n", initprintf_nowarn(OSD_ERROR "Map error: sprite #%d (%d,%d) with illegal picnum (%d). Map is corrupt!\n",
i, sprite[i].x, sprite[i].y, sprite[i].picnum); i, sprite[i].x, sprite[i].y, sprite[i].picnum);
sprite[i].picnum = 0; sprite[i].picnum = 0;
} }
@ -10070,14 +10070,14 @@ int32_t saveboard(const char *filename, const vec3_t *dapos, int16_t daang, int1
{ {
if ((unsigned)sprite[j].statnum > MAXSTATUS) if ((unsigned)sprite[j].statnum > MAXSTATUS)
{ {
initprintf("Map error: sprite #%d(%d,%d) with an illegal statnum(%d)\n", initprintf_nowarn("Map error: sprite #%d(%d,%d) with an illegal statnum(%d)\n",
j,sprite[j].x,sprite[j].y,sprite[j].statnum); j,sprite[j].x,sprite[j].y,sprite[j].statnum);
changespritestat(j,0); changespritestat(j,0);
} }
if ((unsigned)sprite[j].sectnum > MAXSECTORS) if ((unsigned)sprite[j].sectnum > MAXSECTORS)
{ {
initprintf("Map error: sprite #%d(%d,%d) with an illegal sectnum(%d)\n", initprintf_nowarn("Map error: sprite #%d(%d,%d) with an illegal sectnum(%d)\n",
j,sprite[j].x,sprite[j].y,sprite[j].sectnum); j,sprite[j].x,sprite[j].y,sprite[j].sectnum);
changespritesect(j,0); changespritesect(j,0);
} }

View File

@ -3485,7 +3485,7 @@ void polymer_updatesprite(int32_t snum)
if (prsprites[tspr->owner] == NULL) if (prsprites[tspr->owner] == NULL)
{ {
if (pr_verbosity >= 1) OSD_Printf("PR : Cannot initialize sprite %i : Bmalloc failed.\n", tspr->owner); if (pr_verbosity >= 1) OSD_Printf_nowarn("PR : Cannot initialize sprite %i : Bmalloc failed.\n", tspr->owner);
return; return;
} }

View File

@ -1315,9 +1315,9 @@ const char *ExtGetSectorCaption(int16_t sectnum)
{ {
Bstrcpy(lo, ExtGetSectorType(sector[sectnum].lotag)); Bstrcpy(lo, ExtGetSectorType(sector[sectnum].lotag));
if (qsetmode != 200) if (qsetmode != 200)
Bsprintf(tempbuf,"%hu,%hu %s", sector[sectnum].hitag, sector[sectnum].lotag, lo); Bsprintf_nowarn(tempbuf,"%hu,%hu %s", sector[sectnum].hitag, sector[sectnum].lotag, lo);
else else
Bsprintf(tempbuf,"%hu %s", sector[sectnum].lotag, lo); Bsprintf_nowarn(tempbuf,"%hu %s", sector[sectnum].lotag, lo);
} }
return(tempbuf); return(tempbuf);
} }
@ -1527,7 +1527,7 @@ const char *ExtGetSpriteCaption(int16_t spritenum)
SpriteName(spritenum,lo); SpriteName(spritenum,lo);
if (sprite[spritenum].extra != -1) if (sprite[spritenum].extra != -1)
Bsprintf(tempbuf,"%s,%s,%d %s", histr, lostr, sprite[spritenum].extra, lo); Bsprintf_nowarn(tempbuf,"%s,%s,%d %s", histr, lostr, sprite[spritenum].extra, lo);
else else
Bsprintf(tempbuf,"%s,%s %s", histr, lostr, lo); Bsprintf(tempbuf,"%s,%s %s", histr, lostr, lo);
} }
@ -4556,7 +4556,7 @@ ENDFOR1:
ExtCheckKeys(); ExtCheckKeys();
printmessage256(0,0,"^251Text entry mode.^31 Navigation keys change vars."); printmessage256(0,0,"^251Text entry mode.^31 Navigation keys change vars.");
Bsprintf(buffer, "Hgap=%d, Vgap=%d, SPCgap=%d, Shd=%d, Pal=%d", Bsprintf_nowarn(buffer, "Hgap=%d, Vgap=%d, SPCgap=%d, Shd=%d, Pal=%d",
hgap, vgap, spcgap[alphidx], sprite[linebegspr].shade, sprite[linebegspr].pal); hgap, vgap, spcgap[alphidx], sprite[linebegspr].shade, sprite[linebegspr].pal);
printmessage256(0, 9, buffer); printmessage256(0, 9, buffer);
showframe(1); showframe(1);
@ -4925,9 +4925,9 @@ static void Keys3d(void)
height3 = sector[nextsect].ceilingz - sector[searchsector].ceilingz; height3 = sector[nextsect].ceilingz - sector[searchsector].ceilingz;
} }
Bsprintf(lines[num++],"Panning: %d, %d", wall[w].xpanning, wall[w].ypanning); Bsprintf_nowarn(lines[num++],"Panning: %d, %d", wall[w].xpanning, wall[w].ypanning);
Bsprintf(lines[num++],"Repeat: %d, %d", wall[searchwall].xrepeat, wall[searchwall].yrepeat); Bsprintf_nowarn(lines[num++],"Repeat: %d, %d", wall[searchwall].xrepeat, wall[searchwall].yrepeat);
Bsprintf(lines[num++],"Overpic: %d", wall[searchwall].overpicnum); Bsprintf_nowarn(lines[num++],"Overpic: %d", wall[searchwall].overpicnum);
lines[num++][0]=0; lines[num++][0]=0;
if (getmessageleng) if (getmessageleng)
@ -4966,7 +4966,7 @@ static void Keys3d(void)
break; break;
Bsprintf(lines[num++],"^251Sector %d^31 %s, Lotag:%s", searchsector, typestr[searchstat], ExtGetSectorCaption(searchsector)); Bsprintf(lines[num++],"^251Sector %d^31 %s, Lotag:%s", searchsector, typestr[searchstat], ExtGetSectorCaption(searchsector));
Bsprintf(lines[num++],"Height: %d, Visibility:%d", height2, sector[searchsector].visibility); Bsprintf_nowarn(lines[num++],"Height: %d, Visibility:%d", height2, sector[searchsector].visibility);
break; break;
case SEARCH_SPRITE: case SEARCH_SPRITE:
@ -4974,10 +4974,10 @@ static void Keys3d(void)
sprite[searchwall].pal, sprite[searchwall].cstat, sprite[searchwall].lotag, sprite[searchwall].pal, sprite[searchwall].cstat, sprite[searchwall].lotag,
sprite[searchwall].hitag, sprite[searchwall].extra,0); sprite[searchwall].hitag, sprite[searchwall].extra,0);
Bsprintf(lines[num++], "Repeat: %d,%d", sprite[searchwall].xrepeat, sprite[searchwall].yrepeat); Bsprintf_nowarn(lines[num++], "Repeat: %d,%d", sprite[searchwall].xrepeat, sprite[searchwall].yrepeat);
Bsprintf(lines[num++], "PosXY: %d,%d%s", sprite[searchwall].x, sprite[searchwall].y, Bsprintf_nowarn(lines[num++], "PosXY: %d,%d%s", sprite[searchwall].x, sprite[searchwall].y,
sprite[searchwall].xoffset|sprite[searchwall].yoffset ? " ^251*":""); sprite[searchwall].xoffset|sprite[searchwall].yoffset ? " ^251*":"");
Bsprintf(lines[num++], "PosZ: "" %d", sprite[searchwall].z);// prevents tab character Bsprintf_nowarn(lines[num++], "PosZ: "" %d", sprite[searchwall].z);// prevents tab character
lines[num++][0]=0; lines[num++][0]=0;
if (getmessageleng) if (getmessageleng)
@ -4991,9 +4991,9 @@ static void Keys3d(void)
if (sprite[searchwall].picnum==SECTOREFFECTOR) if (sprite[searchwall].picnum==SECTOREFFECTOR)
Bsprintf(lines[num++],"^251Sprite %d^31 %s", searchwall, SectorEffectorText(searchwall)); Bsprintf(lines[num++],"^251Sprite %d^31 %s", searchwall, SectorEffectorText(searchwall));
else else
Bsprintf(lines[num++],"^251Sprite %d^31 %s", searchwall, names[sprite[searchwall].picnum]); Bsprintf_nowarn(lines[num++],"^251Sprite %d^31 %s", searchwall, names[sprite[searchwall].picnum]);
} }
else Bsprintf(lines[num++],"^251Sprite %d^31, picnum %d", searchwall, sprite[searchwall].picnum); else Bsprintf_nowarn(lines[num++],"^251Sprite %d^31, picnum %d", searchwall, sprite[searchwall].picnum);
Bsprintf(lines[num++], "Elevation:%d", Bsprintf(lines[num++], "Elevation:%d",
getflorzofslope(searchsector, sprite[searchwall].x, sprite[searchwall].y) - sprite[searchwall].z); getflorzofslope(searchsector, sprite[searchwall].x, sprite[searchwall].y) - sprite[searchwall].z);
@ -5111,7 +5111,7 @@ static void Keys3d(void)
if (AIMING_AT_WALL_OR_MASK) if (AIMING_AT_WALL_OR_MASK)
{ {
wall[searchwall].cstat &= YAX_NEXTWALLBITS; wall[searchwall].cstat &= YAX_NEXTWALLBITS;
message("Wall %d cstat = %d", searchwall, wall[searchwall].cstat); message_nowarn("Wall %d cstat = %d", searchwall, wall[searchwall].cstat);
} }
else if (AIMING_AT_SPRITE) else if (AIMING_AT_SPRITE)
{ {
@ -5277,7 +5277,7 @@ static void Keys3d(void)
{ {
sprite[searchwall].ang += tsign<<(!eitherSHIFT*7); sprite[searchwall].ang += tsign<<(!eitherSHIFT*7);
sprite[searchwall].ang &= 2047; sprite[searchwall].ang &= 2047;
message("Sprite %d angle: %d", searchwall, sprite[searchwall].ang); message_nowarn("Sprite %d angle: %d", searchwall, sprite[searchwall].ang);
} }
} }
@ -8477,7 +8477,7 @@ int32_t ExtPreSaveMap(void)
if (wall[j].point2 < startwall) if (wall[j].point2 < startwall)
startwall = wall[j].point2; startwall = wall[j].point2;
if (sector[i].wallptr != startwall) if (sector[i].wallptr != startwall)
initprintf("Warning: set sector %d's wallptr to %d (was %d)\n", i, initprintf_nowarn("Warning: set sector %d's wallptr to %d (was %d)\n", i,
sector[i].wallptr, startwall); sector[i].wallptr, startwall);
sector[i].wallptr = startwall; sector[i].wallptr = startwall;
} }
@ -11444,6 +11444,7 @@ void ExtCheckKeys(void)
//#define CCHKPREF OSDTEXT_RED "^O" //#define CCHKPREF OSDTEXT_RED "^O"
#define CCHK_CORRECTED OSDTEXT_GREEN " -> " #define CCHK_CORRECTED OSDTEXT_GREEN " -> "
#ifdef _MSC_VER
#define CORRUPTCHK_PRINT(errlev, what, fmt, ...) do \ #define CORRUPTCHK_PRINT(errlev, what, fmt, ...) do \
{ \ { \
bad = max(bad, errlev); \ bad = max(bad, errlev); \
@ -11453,7 +11454,17 @@ void ExtCheckKeys(void)
if (errlev >= printfromlev) \ if (errlev >= printfromlev) \
OSD_Printf("#%d: " fmt "\n", numcorruptthings, ## __VA_ARGS__); \ OSD_Printf("#%d: " fmt "\n", numcorruptthings, ## __VA_ARGS__); \
} while (0) } while (0)
#else
#define CORRUPTCHK_PRINT(errlev, what, fmt, ...) do \
{ \
bad = max(bad, errlev); \
if (numcorruptthings>=MAXCORRUPTTHINGS) \
goto too_many_errors; \
corruptthings[numcorruptthings++] = (what); \
if (errlev >= printfromlev) \
OSD_Printf_nowarn("#%d: " fmt "\n", numcorruptthings, ## __VA_ARGS__); \
} while (0)
#endif
#ifdef YAX_ENABLE #ifdef YAX_ENABLE
static int32_t walls_have_equal_endpoints(int32_t w1, int32_t w2) static int32_t walls_have_equal_endpoints(int32_t w1, int32_t w2)
{ {
@ -12339,7 +12350,8 @@ static void EditSectorData(int16_t sectnum)
#endif #endif
break; break;
case 1: case 1:
for (i=Bsprintf(med_disptext,"(X,Y)pan: %d, %d",sector[sectnum].ceilingxpanning,sector[sectnum].ceilingypanning); i < med_dispwidth; i++) med_disptext[i] = ' '; Bsprintf_nowarn_return(i, med_disptext,"(X,Y)pan: %d, %d",sector[sectnum].ceilingxpanning,sector[sectnum].ceilingypanning);
for (; i < med_dispwidth; i++) med_disptext[i] = ' ';
if (med_editval) if (med_editval)
{ {
Bsprintf(med_edittext,"Sector %d Ceiling X Pan: ",sectnum); Bsprintf(med_edittext,"Sector %d Ceiling X Pan: ",sectnum);
@ -12389,7 +12401,8 @@ static void EditSectorData(int16_t sectnum)
break; break;
case 1: case 1:
for (i=Bsprintf(med_disptext,"(X,Y)pan: %d, %d",sector[sectnum].floorxpanning,sector[sectnum].floorypanning); i < med_dispwidth; i++) med_disptext[i] = ' '; Bsprintf_nowarn_return(i, med_disptext,"(X,Y)pan: %d, %d",sector[sectnum].floorxpanning,sector[sectnum].floorypanning);
for (; i < med_dispwidth; i++) med_disptext[i] = ' ';
if (med_editval) if (med_editval)
{ {
Bsprintf(med_edittext,"Sector %d Floor X Pan: ",sectnum); Bsprintf(med_edittext,"Sector %d Floor X Pan: ",sectnum);
@ -12478,7 +12491,8 @@ static void EditWallData(int16_t wallnum)
sizeof(wall[wallnum].pal), M32_MAXPALOOKUPS, 0); sizeof(wall[wallnum].pal), M32_MAXPALOOKUPS, 0);
break; break;
case 3: case 3:
for (i=Bsprintf(med_disptext,"(X,Y)repeat: %d, %d",wall[wallnum].xrepeat,wall[wallnum].yrepeat); i < med_dispwidth; i++) med_disptext[i] = ' '; Bsprintf_nowarn_return(i, med_disptext,"(X,Y)repeat: %d, %d",wall[wallnum].xrepeat,wall[wallnum].yrepeat);
for (; i < med_dispwidth; i++) med_disptext[i] = ' ';
if (med_editval) if (med_editval)
{ {
Bsprintf(med_edittext,"Wall %d X Repeat: ",wallnum); Bsprintf(med_edittext,"Wall %d X Repeat: ",wallnum);
@ -12490,7 +12504,8 @@ static void EditWallData(int16_t wallnum)
} }
break; break;
case 4: case 4:
for (i=Bsprintf(med_disptext,"(X,Y)pan: %d, %d",wall[wallnum].xpanning,wall[wallnum].ypanning); i < med_dispwidth; i++) med_disptext[i] = ' '; Bsprintf_nowarn_return(i, med_disptext,"(X,Y)pan: %d, %d",wall[wallnum].xpanning,wall[wallnum].ypanning);
for (; i < med_dispwidth; i++) med_disptext[i] = ' ';
if (med_editval) if (med_editval)
{ {
Bsprintf(med_edittext,"Wall %d X Pan: ",wallnum); Bsprintf(med_edittext,"Wall %d X Pan: ",wallnum);
@ -12669,7 +12684,8 @@ static void EditSpriteData(int16_t spritenum)
break; break;
case 3: case 3:
{ {
for (i=Bsprintf(med_disptext,"(X,Y)repeat: %d, %d",sprite[spritenum].xrepeat,sprite[spritenum].yrepeat); i < med_dispwidth; i++) med_disptext[i] = ' '; Bsprintf_nowarn_return(i, med_disptext,"(X,Y)repeat: %d, %d",sprite[spritenum].xrepeat,sprite[spritenum].yrepeat);
for (; i < med_dispwidth; i++) med_disptext[i] = ' ';
if (med_editval) if (med_editval)
{ {
Bsprintf(med_edittext,"Sprite %d X Repeat: ",spritenum); Bsprintf(med_edittext,"Sprite %d X Repeat: ",spritenum);
@ -12683,7 +12699,8 @@ static void EditSpriteData(int16_t spritenum)
break; break;
case 4: case 4:
{ {
for (i=Bsprintf(med_disptext,"(X,Y)offset: %d, %d",sprite[spritenum].xoffset,sprite[spritenum].yoffset); i < med_dispwidth; i++) med_disptext[i] = ' '; Bsprintf_nowarn_return(i, med_disptext,"(X,Y)offset: %d, %d",sprite[spritenum].xoffset,sprite[spritenum].yoffset);
for (; i < med_dispwidth; i++) med_disptext[i] = ' ';
if (med_editval) if (med_editval)
{ {
Bsprintf(med_edittext,"Sprite %d X Offset: ",spritenum); Bsprintf(med_edittext,"Sprite %d X Offset: ",spritenum);

View File

@ -61,6 +61,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "common.h" #include "common.h"
#include "common_game.h" #include "common_game.h"
#include "input.h" #include "input.h"
#include "compat.h"
#ifdef LUNATIC #ifdef LUNATIC
# include "lunatic_game.h" # include "lunatic_game.h"
@ -1725,7 +1726,7 @@ static void G_PrintCoords(int32_t snum)
Bsprintf(tempbuf,"OG= %d SBRIDGE=%d SBS=%d",ps->on_ground, ps->spritebridge, ps->sbs); Bsprintf(tempbuf,"OG= %d SBRIDGE=%d SBS=%d",ps->on_ground, ps->spritebridge, ps->sbs);
printext256(x,y+27,31,-1,tempbuf,0); printext256(x,y+27,31,-1,tempbuf,0);
if (sectnum >= 0) if (sectnum >= 0)
Bsprintf(tempbuf,"SECT= %d (LO=%d EX=%d)",sectnum,sector[sectnum].lotag,sector[sectnum].extra); Bsprintf_nowarn(tempbuf,"SECT= %d (LO=%d EX=%d)",sectnum,sector[sectnum].lotag,sector[sectnum].extra);
else else
Bsprintf(tempbuf,"SECT= %d", sectnum); Bsprintf(tempbuf,"SECT= %d", sectnum);
printext256(x,y+36,31,-1,tempbuf,0); printext256(x,y+36,31,-1,tempbuf,0);
@ -3907,12 +3908,13 @@ static void G_DumpDebugInfo(void)
} }
OSD_Printf("\n"); OSD_Printf("\n");
} }
for (x=0; x<MAXSTATUS; x++) for (x=0; x<MAXSTATUS; x++)
{ {
j = headspritestat[x]; j = headspritestat[x];
while (j >= 0) while (j >= 0)
{ {
OSD_Printf("Sprite %d (%d,%d,%d) (picnum: %d)\n",j,sprite[j].x,sprite[j].y,sprite[j].z,sprite[j].picnum); OSD_Printf_nowarn("Sprite %d (%d,%d,%d) (picnum: %d)\n",j,sprite[j].x,sprite[j].y,sprite[j].z,sprite[j].picnum);
for (i=0; i<g_gameVarCount; i++) for (i=0; i<g_gameVarCount; i++)
{ {
if (aGameVars[i].dwFlags & (GAMEVAR_PERACTOR)) if (aGameVars[i].dwFlags & (GAMEVAR_PERACTOR))
@ -3969,7 +3971,7 @@ int32_t A_InsertSprite(int32_t whatsect,int32_t s_x,int32_t s_y,int32_t s_z,int3
if (i < 0) if (i < 0)
{ {
G_DumpDebugInfo(); G_DumpDebugInfo();
OSD_Printf("Failed spawning pic %d spr from pic %d spr %d at x:%d,y:%d,z:%d,sect:%d\n", OSD_Printf_nowarn("Failed spawning pic %d spr from pic %d spr %d at x:%d,y:%d,z:%d,sect:%d\n",
s_pn,sprite[s_ow].picnum,s_ow,s_x,s_y,s_z,whatsect); s_pn,sprite[s_ow].picnum,s_ow,s_x,s_y,s_z,whatsect);
G_GameExit("Too many sprites spawned."); G_GameExit("Too many sprites spawned.");
} }
@ -4984,7 +4986,7 @@ int32_t A_Spawn(int32_t j, int32_t pn)
if (sp->hitag && sp->picnum == WATERBUBBLEMAKER) if (sp->hitag && sp->picnum == WATERBUBBLEMAKER)
{ {
// JBF 20030913: Pisses off X_Move(), eg. in bobsp2 // JBF 20030913: Pisses off X_Move(), eg. in bobsp2
OSD_Printf(OSD_ERROR "WARNING: WATERBUBBLEMAKER %d @ %d,%d with hitag!=0. Applying fixup.\n", OSD_Printf_nowarn(OSD_ERROR "WARNING: WATERBUBBLEMAKER %d @ %d,%d with hitag!=0. Applying fixup.\n",
i,sp->x,sp->y); i,sp->x,sp->y);
sp->hitag = 0; sp->hitag = 0;
} }
@ -5590,7 +5592,7 @@ int32_t A_Spawn(int32_t j, int32_t pn)
else else
{ {
// XXX: we should return to the menu for this and similar failures // XXX: we should return to the menu for this and similar failures
Bsprintf(tempbuf, "SE 17 (warp elevator) setup failed: sprite %d at (%d, %d)", Bsprintf_nowarn(tempbuf, "SE 17 (warp elevator) setup failed: sprite %d at (%d, %d)",
i, sprite[i].x, sprite[i].y); i, sprite[i].x, sprite[i].y);
G_GameExit(tempbuf); G_GameExit(tempbuf);
} }
@ -5795,7 +5797,7 @@ int32_t A_Spawn(int32_t j, int32_t pn)
} }
if (j == -1) if (j == -1)
{ {
OSD_Printf(OSD_ERROR "Found lonely Sector Effector (lotag 0) at (%d,%d)\n",sp->x,sp->y); OSD_Printf_nowarn(OSD_ERROR "Found lonely Sector Effector (lotag 0) at (%d,%d)\n",sp->x,sp->y);
changespritestat(i, STAT_ACTOR); changespritestat(i, STAT_ACTOR);
if (apScriptGameEvent[EVENT_SPAWN]) if (apScriptGameEvent[EVENT_SPAWN])
{ {
@ -5818,7 +5820,7 @@ int32_t A_Spawn(int32_t j, int32_t pn)
tempwallptr++; tempwallptr++;
if (tempwallptr > 2047) if (tempwallptr > 2047)
{ {
Bsprintf(tempbuf,"Too many moving sectors at (%d,%d).\n",wall[s].x,wall[s].y); Bsprintf_nowarn(tempbuf,"Too many moving sectors at (%d,%d).\n",wall[s].x,wall[s].y);
G_GameExit(tempbuf); G_GameExit(tempbuf);
} }
} }
@ -5876,7 +5878,7 @@ int32_t A_Spawn(int32_t j, int32_t pn)
#endif #endif
if (j == 0) if (j == 0)
{ {
Bsprintf(tempbuf,"Subway found no zero'd sectors with locators\nat (%d,%d).\n",sp->x,sp->y); Bsprintf_nowarn(tempbuf,"Subway found no zero'd sectors with locators\nat (%d,%d).\n",sp->x,sp->y);
G_GameExit(tempbuf); G_GameExit(tempbuf);
} }

View File

@ -24,6 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <stdlib.h> #include <stdlib.h>
#include <math.h> // sqrt #include <math.h> // sqrt
#include "compat.h"
#include "duke3d.h" #include "duke3d.h"
#include "gamedef.h" #include "gamedef.h"
#include "gameexec.h" #include "gameexec.h"
@ -87,7 +89,7 @@ void VM_ScriptInfo(void)
} }
if (vm.g_i) if (vm.g_i)
initprintf("current actor: %d (%d)\n",vm.g_i,vm.g_sp->picnum); initprintf_nowarn("current actor: %d (%d)\n",vm.g_i,vm.g_sp->picnum);
initprintf("g_errorLineNum: %d, g_tw: %d\n",g_errorLineNum,g_tw); initprintf("g_errorLineNum: %d, g_tw: %d\n",g_errorLineNum,g_tw);
} }
@ -442,7 +444,7 @@ GAMEEXEC_STATIC void VM_AlterAng(int32_t a)
{ {
vm.g_t[1] = 0; vm.g_t[1] = 0;
OSD_Printf(OSD_ERROR "bad moveptr for actor %d (%d)!\n", vm.g_i, vm.g_sp->picnum); OSD_Printf_nowarn(OSD_ERROR "bad moveptr for actor %d (%d)!\n", vm.g_i, vm.g_sp->picnum);
return; return;
} }
@ -591,7 +593,7 @@ dead:
if ((unsigned)vm.g_t[1] >= (unsigned)g_scriptSize-1) if ((unsigned)vm.g_t[1] >= (unsigned)g_scriptSize-1)
{ {
vm.g_t[1] = 0; vm.g_t[1] = 0;
OSD_Printf(OSD_ERROR "clearing bad moveptr for actor %d (%d)\n", vm.g_i, vm.g_sp->picnum); OSD_Printf_nowarn(OSD_ERROR "clearing bad moveptr for actor %d (%d)\n", vm.g_i, vm.g_sp->picnum);
return; return;
} }
@ -4165,7 +4167,8 @@ nullquote:
if (j<0 || j >= g_gameArrayCount || index >= aGameArrays[j].size || index < 0) if (j<0 || j >= g_gameArrayCount || index >= aGameArrays[j].size || index < 0)
{ {
OSD_Printf(OSD_ERROR "Gv_SetVar(): tried to set invalid array ID (%d) or index out of bounds from sprite %d (%d), player %d\n",j,vm.g_i,sprite[vm.g_i].picnum,vm.g_p); OSD_Printf_nowarn(OSD_ERROR "Gv_SetVar(): tried to set invalid array ID (%d) or index out of bounds from sprite %d (%d), player %d\n",
j,vm.g_i,sprite[vm.g_i].picnum,vm.g_p);
continue; continue;
} }
aGameArrays[j].plValues[index]=value; aGameArrays[j].plValues[index]=value;

View File

@ -151,7 +151,7 @@ int32_t VM_OnEvent(int32_t iEventID,int32_t iActor,int32_t iPlayer,int32_t lDist
void VM_ScriptInfo(void); void VM_ScriptInfo(void);
#define CON_ERRPRINTF(Text, ...) do { \ #define CON_ERRPRINTF(Text, ...) do { \
OSD_Printf("Line %d, %s: " Text, g_errorLineNum, keyw[g_tw], ## __VA_ARGS__); \ OSD_Printf_nowarn("Line %d, %s: " Text, g_errorLineNum, keyw[g_tw], ## __VA_ARGS__); \
} while (0) } while (0)
#endif #endif