From 890aba88eb30abb838158e0279a7a254370a1525 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Mon, 26 Nov 2012 08:26:04 +0000 Subject: [PATCH] Fix warnings involving printf() requiring explicit casts on tracked types. git-svn-id: https://svn.eduke32.com/eduke32@3238 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/include/build.h | 2 + polymer/eduke32/build/include/tracker.hpp | 8 ++ .../build/include/tracker_operator.hpp | 2 +- polymer/eduke32/build/src/build.c | 112 +++++++++--------- polymer/eduke32/build/src/engine.c | 10 +- polymer/eduke32/build/src/polymer.c | 2 +- polymer/eduke32/source/astub.c | 64 +++++----- polymer/eduke32/source/game.c | 19 +-- polymer/eduke32/source/gameexec.c | 20 ++-- polymer/eduke32/source/gamestructures.c | 8 +- polymer/eduke32/source/gamevars.c | 2 +- 11 files changed, 135 insertions(+), 114 deletions(-) diff --git a/polymer/eduke32/build/include/build.h b/polymer/eduke32/build/include/build.h index b9135cfa1..7dbd9bc89 100644 --- a/polymer/eduke32/build/include/build.h +++ b/polymer/eduke32/build/include/build.h @@ -193,10 +193,12 @@ static inline void sprite_tracker_hook(uintptr_t address); #undef __TRACKER_GLOBAL_HOOK #define Tracker(Container, Type) Container##Tracker +#define TrackerCast(x) x.cast() #else #define Tracker(Container, Type) Type +#define TrackerCast(x) x #endif // __cplusplus diff --git a/polymer/eduke32/build/include/tracker.hpp b/polymer/eduke32/build/include/tracker.hpp index ed34140d7..e365094bc 100644 --- a/polymer/eduke32/build/include/tracker.hpp +++ b/polymer/eduke32/build/include/tracker.hpp @@ -57,6 +57,8 @@ class __TRACKER_NAME inline TrackedType operator >>= (TrackedType); inline operator TrackedType() const; + + inline TrackedType cast() const; }; #ifndef __tracker_hpp @@ -82,3 +84,9 @@ __TRACKER_NAME::operator TrackedType() const { return this->TrackedValue; } + +template +inline TrackedType __TRACKER_NAME::cast() const +{ + return this->TrackedValue; +} diff --git a/polymer/eduke32/build/include/tracker_operator.hpp b/polymer/eduke32/build/include/tracker_operator.hpp index 73361afcc..57f4c38f2 100644 --- a/polymer/eduke32/build/include/tracker_operator.hpp +++ b/polymer/eduke32/build/include/tracker_operator.hpp @@ -27,4 +27,4 @@ inline TrackedType __TRACKER_NAME::operator __TRACKER_OPERATOR (__T } else { return this->TrackedValue; } -} \ No newline at end of file +} diff --git a/polymer/eduke32/build/src/build.c b/polymer/eduke32/build/src/build.c index dc2cecd3d..76df5818d 100644 --- a/polymer/eduke32/build/src/build.c +++ b/polymer/eduke32/build/src/build.c @@ -5839,9 +5839,9 @@ end_point_dragging: if (!delayerr) message("Outer wall coordinates must coincide for both components"); OSD_Printf_nowarn("wal0:%d (%d,%d)--(%d,%d)\n",(int)(wal0-wall), - wal0->x,wal0->y, wal0p2->x,wal0p2->y); + TrackerCast(wal0->x),TrackerCast(wal0->y), TrackerCast(wal0p2->x),TrackerCast(wal0p2->y)); OSD_Printf_nowarn("wal1:%d (%d,%d)--(%d,%d)\n",(int)(wal1-wall), - wal1->x,wal1->y, wal1p2->x,wal1p2->y); + TrackerCast(wal1->x),TrackerCast(wal1->y), TrackerCast(wal1p2->x),TrackerCast(wal1p2->y)); goto end_join_sectors; } @@ -8574,7 +8574,7 @@ int32_t fixspritesectors(void) initprintf("--------------------\n"); printfirsttime = 1; } - initprintf_nowarn("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, TrackerCast(sprite[i].sectnum), j); changespritesect(i, j); } break; @@ -10044,19 +10044,19 @@ void showsectordata(int16_t sectnum, int16_t small) } DOPRINT(32, "^10Sector %d", sectnum); - DOPRINT(48, "Firstwall: %d", sec->wallptr); - DOPRINT(56, "Numberofwalls: %d", sec->wallnum); + DOPRINT(48, "Firstwall: %d", TrackerCast(sec->wallptr)); + DOPRINT(56, "Numberofwalls: %d", TrackerCast(sec->wallnum)); DOPRINT(64, "Firstsprite: %d", headspritesect[sectnum]); - DOPRINT(72, "Tags: %d, %d", sec->hitag, sec->lotag); - DOPRINT(80, " (0x%x), (0x%x)", sec->hitag, sec->lotag); - DOPRINT(88, "Extra: %d", sec->extra); - DOPRINT(96, "Visibility: %d", sec->visibility); + DOPRINT(72, "Tags: %d, %d", TrackerCast(sec->hitag), TrackerCast(sec->lotag)); + DOPRINT(80, " (0x%x), (0x%x)", TrackerCast(sec->hitag), TrackerCast(sec->lotag)); + DOPRINT(88, "Extra: %d", TrackerCast(sec->extra)); + DOPRINT(96, "Visibility: %d", TrackerCast(sec->visibility)); DOPRINT(104, "Pixel height: %d", (sec->floorz-sec->ceilingz)>>8); col++; DOPRINT(32, "^10CEILING:^O"); - DOPRINT(48, "Flags (hex): %x", sec->ceilingstat); + DOPRINT(48, "Flags (hex): %x", TrackerCast(sec->ceilingstat)); { int32_t xp=sec->ceilingxpanning, yp=sec->ceilingypanning; #ifdef YAX_ENABLE @@ -10065,11 +10065,11 @@ void showsectordata(int16_t sectnum, int16_t small) #endif DOPRINT(56, "(X,Y)pan: %d, %d", xp, yp); } - DOPRINT(64, "Shade byte: %d", sec->ceilingshade); - DOPRINT(72, "Z-coordinate: %d", sec->ceilingz); - DOPRINT(80, "Tile number: %d", sec->ceilingpicnum); - DOPRINT(88, "Ceiling heinum: %d", sec->ceilingheinum); - DOPRINT(96, "Palookup number: %d", sec->ceilingpal); + DOPRINT(64, "Shade byte: %d", TrackerCast(sec->ceilingshade)); + DOPRINT(72, "Z-coordinate: %d", TrackerCast(sec->ceilingz)); + DOPRINT(80, "Tile number: %d", TrackerCast(sec->ceilingpicnum)); + DOPRINT(88, "Ceiling heinum: %d", TrackerCast(sec->ceilingheinum)); + DOPRINT(96, "Palookup number: %d", TrackerCast(sec->ceilingpal)); #ifdef YAX_ENABLE DOPRINT(104, "Bunch number: %d", yax_getbunch(sectnum, YAX_CEILING)); #endif @@ -10077,7 +10077,7 @@ void showsectordata(int16_t sectnum, int16_t small) col++; DOPRINT(32, "^10FLOOR:^O"); - DOPRINT(48, "Flags (hex): %x", sec->floorstat); + DOPRINT(48, "Flags (hex): %x", TrackerCast(sec->floorstat)); { int32_t xp=sec->floorxpanning, yp=sec->floorypanning; #ifdef YAX_ENABLE @@ -10086,11 +10086,11 @@ void showsectordata(int16_t sectnum, int16_t small) #endif DOPRINT(56, "(X,Y)pan: %d, %d", xp, yp); } - DOPRINT(64, "Shade byte: %d", sec->floorshade); - DOPRINT(72, "Z-coordinate: %d", sec->floorz); - DOPRINT(80, "Tile number: %d", sec->floorpicnum); - DOPRINT(88, "Floor heinum: %d", sec->floorheinum); - DOPRINT(96, "Palookup number: %d", sec->floorpal); + DOPRINT(64, "Shade byte: %d", TrackerCast(sec->floorshade)); + DOPRINT(72, "Z-coordinate: %d", TrackerCast(sec->floorz)); + DOPRINT(80, "Tile number: %d", TrackerCast(sec->floorpicnum)); + DOPRINT(88, "Floor heinum: %d", TrackerCast(sec->floorheinum)); + DOPRINT(96, "Palookup number: %d", TrackerCast(sec->floorpal)); #ifdef YAX_ENABLE DOPRINT(104, "Bunch number: %d", yax_getbunch(sectnum, YAX_FLOOR)); #endif @@ -10114,31 +10114,31 @@ void showwalldata(int16_t wallnum, int16_t small) } DOPRINT(32, "^10Wall %d", wallnum); - DOPRINT(48, "X-coordinate: %d", wal->x); - DOPRINT(56, "Y-coordinate: %d", wal->y); - DOPRINT(64, "Point2: %d", wal->point2); + DOPRINT(48, "X-coordinate: %d", TrackerCast(wal->x)); + DOPRINT(56, "Y-coordinate: %d", TrackerCast(wal->y)); + DOPRINT(64, "Point2: %d", TrackerCast(wal->point2)); DOPRINT(72, "Sector: ^010%d", sectorofwall(wallnum)); - DOPRINT(88, "Tags: %d, %d", wal->hitag, wal->lotag); - DOPRINT(96, " (0x%x), (0x%x)", wal->hitag, wal->lotag); + DOPRINT(88, "Tags: %d, %d", TrackerCast(wal->hitag), TrackerCast(wal->lotag)); + DOPRINT(96, " (0x%x), (0x%x)", TrackerCast(wal->hitag), TrackerCast(wal->lotag)); col++; DOPRINT(32, "^10%s^O", (wal->picnum>=0 && wal->picnumpicnum] : "!INVALID!"); - DOPRINT(48, "Flags (hex): %x", wal->cstat); - DOPRINT(56, "Shade: %d", wal->shade); - DOPRINT(64, "Pal: %d", wal->pal); - DOPRINT(72, "(X,Y)repeat: %d, %d", wal->xrepeat, wal->yrepeat); - DOPRINT(80, "(X,Y)pan: %d, %d", wal->xpanning, wal->ypanning); - DOPRINT(88, "Tile number: %d", wal->picnum); - DOPRINT(96, "OverTile number: %d", wal->overpicnum); + DOPRINT(48, "Flags (hex): %x", TrackerCast(wal->cstat)); + DOPRINT(56, "Shade: %d", TrackerCast(wal->shade)); + DOPRINT(64, "Pal: %d", TrackerCast(wal->pal)); + DOPRINT(72, "(X,Y)repeat: %d, %d", TrackerCast(wal->xrepeat), TrackerCast(wal->yrepeat)); + DOPRINT(80, "(X,Y)pan: %d, %d", TrackerCast(wal->xpanning), TrackerCast(wal->ypanning)); + DOPRINT(88, "Tile number: %d", TrackerCast(wal->picnum)); + DOPRINT(96, "OverTile number: %d", TrackerCast(wal->overpicnum)); col++; - DOPRINT(48-(small?16:0), "nextsector: %d", wal->nextsector); - DOPRINT(56-(small?16:0), "nextwall: %d", wal->nextwall); + DOPRINT(48-(small?16:0), "nextsector: %d", TrackerCast(wal->nextsector)); + DOPRINT(56-(small?16:0), "nextwall: %d", TrackerCast(wal->nextwall)); - DOPRINT(72-(small?16:0), "Extra: %d", wal->extra); + DOPRINT(72-(small?16:0), "Extra: %d", TrackerCast(wal->extra)); // TX 20050102 I'm not sure what unit dist<<4 is supposed to be, but dist itself is correct in terms of game coordinates as one would expect DOPRINT(96-(small?16:0), "Wall length: %d", wallength(wallnum)); @@ -10163,36 +10163,36 @@ void showspritedata(int16_t spritenum, int16_t small) } DOPRINT(32, "^10Sprite %d", spritenum); - DOPRINT(48, "X-coordinate: %d", spr->x); - DOPRINT(56, "Y-coordinate: %d", spr->y); - DOPRINT(64, "Z-coordinate: %d", spr->z); + DOPRINT(48, "X-coordinate: %d", TrackerCast(spr->x)); + DOPRINT(56, "Y-coordinate: %d", TrackerCast(spr->y)); + DOPRINT(64, "Z-coordinate: %d", TrackerCast(spr->z)); - DOPRINT(72, "Sectnum: ^010%d", spr->sectnum); - DOPRINT(80, "Statnum: %d", spr->statnum); + DOPRINT(72, "Sectnum: ^010%d", TrackerCast(spr->sectnum)); + DOPRINT(80, "Statnum: %d", TrackerCast(spr->statnum)); - DOPRINT(96, "Tags: %d, %d", spr->hitag, spr->lotag); - DOPRINT(104, " (0x%x), (0x%x)", spr->hitag, spr->lotag); + DOPRINT(96, "Tags: %d, %d", TrackerCast(spr->hitag), TrackerCast(spr->lotag)); + DOPRINT(104, " (0x%x), (0x%x)", TrackerCast(spr->hitag), TrackerCast(spr->lotag)); col++; DOPRINT(32, "^10,0 ^O"); // 24 blanks DOPRINT(32, "^10%s^O", (spr->picnum>=0 && spr->picnumpicnum] : "!INVALID!"); - DOPRINT(48, "Flags (hex): %x", spr->cstat); - DOPRINT(56, "Shade: %d", spr->shade); - DOPRINT(64, "Pal: %d", spr->pal); - DOPRINT(72, "(X,Y)repeat: %d, %d", spr->xrepeat, spr->yrepeat); - DOPRINT(80, "(X,Y)offset: %d, %d", spr->xoffset, spr->yoffset); - DOPRINT(88, "Tile number: %d", spr->picnum); + DOPRINT(48, "Flags (hex): %x", TrackerCast(spr->cstat)); + DOPRINT(56, "Shade: %d", TrackerCast(spr->shade)); + DOPRINT(64, "Pal: %d", TrackerCast(spr->pal)); + DOPRINT(72, "(X,Y)repeat: %d, %d", TrackerCast(spr->xrepeat), TrackerCast(spr->yrepeat)); + DOPRINT(80, "(X,Y)offset: %d, %d", TrackerCast(spr->xoffset), TrackerCast(spr->yoffset)); + DOPRINT(88, "Tile number: %d", TrackerCast(spr->picnum)); col++; - DOPRINT(48, "Angle (2048 degrees): %d", spr->ang); - DOPRINT(56, "X-Velocity: %d", spr->xvel); - DOPRINT(64, "Y-Velocity: %d", spr->yvel); - DOPRINT(72, "Z-Velocity: %d", spr->zvel); - DOPRINT(80, "Owner: %d", spr->owner); - DOPRINT(88, "Clipdist: %d", spr->clipdist); - DOPRINT(96, "Extra: %d", spr->extra); + DOPRINT(48, "Angle (2048 degrees): %d", TrackerCast(spr->ang)); + DOPRINT(56, "X-Velocity: %d", TrackerCast(spr->xvel)); + DOPRINT(64, "Y-Velocity: %d", TrackerCast(spr->yvel)); + DOPRINT(72, "Z-Velocity: %d", TrackerCast(spr->zvel)); + DOPRINT(80, "Owner: %d", TrackerCast(spr->owner)); + DOPRINT(88, "Clipdist: %d", TrackerCast(spr->clipdist)); + DOPRINT(96, "Extra: %d", TrackerCast(spr->extra)); } #undef DOPRINT diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 2d4c3c6a4..337c5f544 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -9431,7 +9431,7 @@ static void check_sprite(int32_t i) if ((unsigned)sprite[i].sectnum >= MYMAXSECTORS()) { 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, TrackerCast(sprite[i].x), TrackerCast(sprite[i].y), TrackerCast(sprite[i].sectnum)); updatesector(sprite[i].x, sprite[i].y, &sprite[i].sectnum); @@ -9442,14 +9442,14 @@ static void check_sprite(int32_t i) if ((unsigned)sprite[i].statnum >= MAXSTATUS) { 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, TrackerCast(sprite[i].x), TrackerCast(sprite[i].y), TrackerCast(sprite[i].statnum)); sprite[i].statnum = 0; } if ((unsigned)sprite[i].picnum >= MAXTILES) { 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, TrackerCast(sprite[i].x), TrackerCast(sprite[i].y), TrackerCast(sprite[i].sectnum)); sprite[i].picnum = 0; } } @@ -10105,14 +10105,14 @@ int32_t saveboard(const char *filename, const vec3_t *dapos, int16_t daang, int1 if ((unsigned)sprite[j].statnum > MAXSTATUS) { 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,TrackerCast(sprite[j].x),TrackerCast(sprite[j].y),TrackerCast(sprite[j].statnum)); changespritestat(j,0); } if ((unsigned)sprite[j].sectnum > MAXSECTORS) { 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,TrackerCast(sprite[j].x),TrackerCast(sprite[j].y),TrackerCast(sprite[j].sectnum)); changespritesect(j,0); } } diff --git a/polymer/eduke32/build/src/polymer.c b/polymer/eduke32/build/src/polymer.c index 110648d8c..80ed3c19a 100644 --- a/polymer/eduke32/build/src/polymer.c +++ b/polymer/eduke32/build/src/polymer.c @@ -3485,7 +3485,7 @@ void polymer_updatesprite(int32_t snum) if (prsprites[tspr->owner] == NULL) { - if (pr_verbosity >= 1) OSD_Printf_nowarn("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", TrackerCast(tspr->owner)); return; } diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 022c6eef4..0f3a27049 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -1257,9 +1257,9 @@ const char *ExtGetSectorCaption(int16_t sectnum) { Bstrcpy(lo, ExtGetSectorType(sector[sectnum].lotag)); if (qsetmode != 200) - Bsprintf_nowarn(tempbuf,"%hu,%hu %s", sector[sectnum].hitag, sector[sectnum].lotag, lo); + Bsprintf_nowarn(tempbuf,"%hu,%hu %s", TrackerCast(sector[sectnum].hitag), TrackerCast(sector[sectnum].lotag), lo); else - Bsprintf_nowarn(tempbuf,"%hu %s", sector[sectnum].lotag, lo); + Bsprintf_nowarn(tempbuf,"%hu %s", TrackerCast(sector[sectnum].lotag), lo); } return(tempbuf); } @@ -1469,7 +1469,7 @@ const char *ExtGetSpriteCaption(int16_t spritenum) SpriteName(spritenum,lo); if (sprite[spritenum].extra != -1) - Bsprintf_nowarn(tempbuf,"%s,%s,%d %s", histr, lostr, sprite[spritenum].extra, lo); + Bsprintf_nowarn(tempbuf,"%s,%s,%d %s", histr, lostr, TrackerCast(sprite[spritenum].extra), lo); else Bsprintf(tempbuf,"%s,%s %s", histr, lostr, lo); } @@ -4502,7 +4502,7 @@ ENDFOR1: printmessage256(0,0,"^251Text entry mode.^31 Navigation keys change vars."); 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], TrackerCast(sprite[linebegspr].shade), TrackerCast(sprite[linebegspr].pal)); printmessage256(0, 9, buffer); showframe(1); @@ -4870,9 +4870,9 @@ static void Keys3d(void) height3 = sector[nextsect].ceilingz - sector[searchsector].ceilingz; } - Bsprintf_nowarn(lines[num++],"Panning: %d, %d", wall[w].xpanning, wall[w].ypanning); - Bsprintf_nowarn(lines[num++],"Repeat: %d, %d", wall[searchwall].xrepeat, wall[searchwall].yrepeat); - Bsprintf_nowarn(lines[num++],"Overpic: %d", wall[searchwall].overpicnum); + Bsprintf_nowarn(lines[num++],"Panning: %d, %d", TrackerCast(wall[w].xpanning), TrackerCast(wall[w].ypanning)); + Bsprintf_nowarn(lines[num++],"Repeat: %d, %d", TrackerCast(wall[searchwall].xrepeat), TrackerCast(wall[searchwall].yrepeat)); + Bsprintf_nowarn(lines[num++],"Overpic: %d", TrackerCast(wall[searchwall].overpicnum)); lines[num++][0]=0; if (getmessageleng) @@ -4911,7 +4911,7 @@ static void Keys3d(void) break; Bsprintf(lines[num++],"^251Sector %d^31 %s, Lotag:%s", searchsector, typestr[searchstat], ExtGetSectorCaption(searchsector)); - Bsprintf_nowarn(lines[num++],"Height: %d, Visibility:%d", height2, sector[searchsector].visibility); + Bsprintf_nowarn(lines[num++],"Height: %d, Visibility:%d", height2, TrackerCast(sector[searchsector].visibility)); break; case SEARCH_SPRITE: @@ -4919,10 +4919,12 @@ static void Keys3d(void) sprite[searchwall].pal, sprite[searchwall].cstat, sprite[searchwall].lotag, sprite[searchwall].hitag, sprite[searchwall].extra,0); - Bsprintf_nowarn(lines[num++], "Repeat: %d,%d", sprite[searchwall].xrepeat, sprite[searchwall].yrepeat); - Bsprintf_nowarn(lines[num++], "PosXY: %d,%d%s", sprite[searchwall].x, sprite[searchwall].y, + Bsprintf_nowarn(lines[num++], "Repeat: %d,%d", + TrackerCast(sprite[searchwall].xrepeat), TrackerCast(sprite[searchwall].yrepeat)); + Bsprintf_nowarn(lines[num++], "PosXY: %d,%d%s", + TrackerCast(sprite[searchwall].x), TrackerCast(sprite[searchwall].y), sprite[searchwall].xoffset|sprite[searchwall].yoffset ? " ^251*":""); - Bsprintf_nowarn(lines[num++], "PosZ: "" %d", sprite[searchwall].z);// prevents tab character + Bsprintf_nowarn(lines[num++], "PosZ: "" %d", TrackerCast(sprite[searchwall].z));// prevents tab character lines[num++][0]=0; if (getmessageleng) @@ -4938,7 +4940,7 @@ static void Keys3d(void) else Bsprintf_nowarn(lines[num++],"^251Sprite %d^31 %s", searchwall, names[sprite[searchwall].picnum]); } - else Bsprintf_nowarn(lines[num++],"^251Sprite %d^31, picnum %d", searchwall, sprite[searchwall].picnum); + else Bsprintf_nowarn(lines[num++],"^251Sprite %d^31, picnum %d", searchwall, TrackerCast(sprite[searchwall].picnum)); Bsprintf(lines[num++], "Elevation:%d", getflorzofslope(searchsector, sprite[searchwall].x, sprite[searchwall].y) - sprite[searchwall].z); @@ -5056,7 +5058,7 @@ static void Keys3d(void) if (AIMING_AT_WALL_OR_MASK) { wall[searchwall].cstat &= YAX_NEXTWALLBITS; - message_nowarn("Wall %d cstat = %d", searchwall, wall[searchwall].cstat); + message_nowarn("Wall %d cstat = %d", searchwall, TrackerCast(wall[searchwall].cstat)); } else if (AIMING_AT_SPRITE) { @@ -5222,7 +5224,7 @@ static void Keys3d(void) { sprite[searchwall].ang += tsign<<(!eitherSHIFT*7); sprite[searchwall].ang &= 2047; - message_nowarn("Sprite %d angle: %d", searchwall, sprite[searchwall].ang); + message_nowarn("Sprite %d angle: %d", searchwall, TrackerCast(sprite[searchwall].ang)); } } @@ -8425,7 +8427,7 @@ int32_t ExtPreSaveMap(void) startwall = wall[j].point2; if (sector[i].wallptr != startwall) initprintf_nowarn("Warning: set sector %d's wallptr to %d (was %d)\n", i, - sector[i].wallptr, startwall); + TrackerCast(sector[i].wallptr), startwall); sector[i].wallptr = startwall; } @@ -11760,10 +11762,10 @@ int32_t CheckMapCorruption(int32_t printfromlev, uint64_t tryfixing) { if (wall[j].point2 < 0 || wall[j].point2 >= MAXWALLS) CORRUPTCHK_PRINT(5, CORRUPT_WALL|j, CCHK_PANIC "WALL[%d].POINT2=%d INVALID!!!", - j, wall[j].point2); + j, TrackerCast(wall[j].point2)); else CORRUPTCHK_PRINT(4, CORRUPT_WALL|j, "WALL[%d].POINT2=%d out of range [%d, %d]", - j, wall[j].point2, w0, endwall); + j, TrackerCast(wall[j].point2), w0, endwall); } nw = wall[j].nextwall; @@ -11956,7 +11958,7 @@ int32_t CheckMapCorruption(int32_t printfromlev, uint64_t tryfixing) if (nw=sector[ns].wallptr+sector[ns].wallnum) { CORRUPTCHK_PRINT(4, CORRUPT_WALL|j, "WALL[%d].NEXTWALL=%d out of .NEXTSECTOR=%d's bounds [%d .. %d]", - j, nw, ns, sector[ns].wallptr, sector[ns].wallptr+sector[ns].wallnum-1); + j, nw, ns, TrackerCast(sector[ns].wallptr), sector[ns].wallptr+sector[ns].wallnum-1); if (onumct < MAXCORRUPTTHINGS) { if (tryfixing & (1ull<=numsectors) - CORRUPTCHK_PRINT(4, CORRUPT_SPRITE|i, "SPRITE[%d].SECTNUM=%d. Expect problems!", i, sprite[i].sectnum); + CORRUPTCHK_PRINT(4, CORRUPT_SPRITE|i, "SPRITE[%d].SECTNUM=%d. Expect problems!", i, TrackerCast(sprite[i].sectnum)); if (sprite[i].statnum<0 || sprite[i].statnum>MAXSTATUS) - CORRUPTCHK_PRINT(4, CORRUPT_SPRITE|i, "SPRITE[%d].STATNUM=%d. Expect problems!", i, sprite[i].statnum); + CORRUPTCHK_PRINT(4, CORRUPT_SPRITE|i, "SPRITE[%d].STATNUM=%d. Expect problems!", i, TrackerCast(sprite[i].statnum)); if (sprite[i].picnum<0 || sprite[i].picnum>=MAXTILES) { sprite[i].picnum = 0; - CORRUPTCHK_PRINT(0, CORRUPT_SPRITE|i, "SPRITE[%d].PICNUM=%d out of range, resetting to 0", i, sprite[i].picnum); + CORRUPTCHK_PRINT(0, CORRUPT_SPRITE|i, "SPRITE[%d].PICNUM=%d out of range, resetting to 0", i, TrackerCast(sprite[i].picnum)); } if (klabs(sprite[i].x) > BXY_MAX || klabs(sprite[i].y) > BXY_MAX) @@ -12004,7 +12006,7 @@ int32_t CheckMapCorruption(int32_t printfromlev, uint64_t tryfixing) int32_t onumct = numcorruptthings; CORRUPTCHK_PRINT(3, CORRUPT_SPRITE|i, "SPRITE %d at [%d, %d] is out of the maximal grid range [%d, %d]", - sprite[i].x, sprite[i].y, i, -BXY_MAX, BXY_MAX); + TrackerCast(sprite[i].x), TrackerCast(sprite[i].y), i, -BXY_MAX, BXY_MAX); if (onumct < MAXCORRUPTTHINGS) { @@ -12295,7 +12297,8 @@ static void EditSectorData(int16_t sectnum) #endif break; case 1: - Bsprintf_nowarn_return(i, med_disptext,"(X,Y)pan: %d, %d",sector[sectnum].ceilingxpanning,sector[sectnum].ceilingypanning); + Bsprintf_nowarn_return(i, med_disptext,"(X,Y)pan: %d, %d", + TrackerCast(sector[sectnum].ceilingxpanning),TrackerCast(sector[sectnum].ceilingypanning)); for (; i < med_dispwidth; i++) med_disptext[i] = ' '; if (med_editval) { @@ -12346,7 +12349,8 @@ static void EditSectorData(int16_t sectnum) break; case 1: - Bsprintf_nowarn_return(i, med_disptext,"(X,Y)pan: %d, %d",sector[sectnum].floorxpanning,sector[sectnum].floorypanning); + Bsprintf_nowarn_return(i, med_disptext,"(X,Y)pan: %d, %d", + TrackerCast(sector[sectnum].floorxpanning),TrackerCast(sector[sectnum].floorypanning)); for (; i < med_dispwidth; i++) med_disptext[i] = ' '; if (med_editval) { @@ -12436,7 +12440,8 @@ static void EditWallData(int16_t wallnum) sizeof(wall[wallnum].pal), M32_MAXPALOOKUPS, 0); break; case 3: - Bsprintf_nowarn_return(i, med_disptext,"(X,Y)repeat: %d, %d",wall[wallnum].xrepeat,wall[wallnum].yrepeat); + Bsprintf_nowarn_return(i, med_disptext,"(X,Y)repeat: %d, %d", + TrackerCast(wall[wallnum].xrepeat),TrackerCast(wall[wallnum].yrepeat)); for (; i < med_dispwidth; i++) med_disptext[i] = ' '; if (med_editval) { @@ -12449,7 +12454,8 @@ static void EditWallData(int16_t wallnum) } break; case 4: - Bsprintf_nowarn_return(i, med_disptext,"(X,Y)pan: %d, %d",wall[wallnum].xpanning,wall[wallnum].ypanning); + Bsprintf_nowarn_return(i, med_disptext,"(X,Y)pan: %d, %d", + TrackerCast(wall[wallnum].xpanning),TrackerCast(wall[wallnum].ypanning)); for (; i < med_dispwidth; i++) med_disptext[i] = ' '; if (med_editval) { @@ -12629,7 +12635,8 @@ static void EditSpriteData(int16_t spritenum) break; case 3: { - Bsprintf_nowarn_return(i, med_disptext,"(X,Y)repeat: %d, %d",sprite[spritenum].xrepeat,sprite[spritenum].yrepeat); + Bsprintf_nowarn_return(i, med_disptext,"(X,Y)repeat: %d, %d", + TrackerCast(sprite[spritenum].xrepeat),TrackerCast(sprite[spritenum].yrepeat)); for (; i < med_dispwidth; i++) med_disptext[i] = ' '; if (med_editval) { @@ -12644,7 +12651,8 @@ static void EditSpriteData(int16_t spritenum) break; case 4: { - Bsprintf_nowarn_return(i, med_disptext,"(X,Y)offset: %d, %d",sprite[spritenum].xoffset,sprite[spritenum].yoffset); + Bsprintf_nowarn_return(i, med_disptext,"(X,Y)offset: %d, %d", + TrackerCast(sprite[spritenum].xoffset),TrackerCast(sprite[spritenum].yoffset)); for (; i < med_dispwidth; i++) med_disptext[i] = ' '; if (med_editval) { diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 9f4c8fd48..951f407be 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -1724,7 +1724,7 @@ static void G_PrintCoords(int32_t snum) Bsprintf(tempbuf,"OG= %d SBRIDGE=%d SBS=%d",ps->on_ground, ps->spritebridge, ps->sbs); printext256(x,y+27,31,-1,tempbuf,0); if (sectnum >= 0) - Bsprintf_nowarn(tempbuf,"SECT= %d (LO=%d EX=%d)",sectnum,sector[sectnum].lotag,sector[sectnum].extra); + Bsprintf_nowarn(tempbuf,"SECT= %d (LO=%d EX=%d)",sectnum,TrackerCast(sector[sectnum].lotag),TrackerCast(sector[sectnum].extra)); else Bsprintf(tempbuf,"SECT= %d", sectnum); printext256(x,y+36,31,-1,tempbuf,0); @@ -3911,7 +3911,8 @@ static void G_DumpDebugInfo(void) j = headspritestat[x]; while (j >= 0) { - OSD_Printf_nowarn("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, + TrackerCast(sprite[j].x),TrackerCast(sprite[j].y),TrackerCast(sprite[j].z),TrackerCast(sprite[j].picnum)); for (i=0; ix,sp->y); + i,TrackerCast(sp->x),TrackerCast(sp->y)); sp->hitag = 0; } sp->cstat |= 32768; @@ -5590,7 +5591,7 @@ int32_t A_Spawn(int32_t j, int32_t pn) { // XXX: we should return to the menu for this and similar failures Bsprintf_nowarn(tempbuf, "SE 17 (warp elevator) setup failed: sprite %d at (%d, %d)", - i, sprite[i].x, sprite[i].y); + i, TrackerCast(sprite[i].x), TrackerCast(sprite[i].y)); G_GameExit(tempbuf); } @@ -5794,7 +5795,8 @@ int32_t A_Spawn(int32_t j, int32_t pn) } if (j == -1) { - OSD_Printf_nowarn(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", + TrackerCast(sp->x),TrackerCast(sp->y)); changespritestat(i, STAT_ACTOR); if (apScriptGameEvent[EVENT_SPAWN]) { @@ -5817,7 +5819,7 @@ int32_t A_Spawn(int32_t j, int32_t pn) tempwallptr++; if (tempwallptr > 2047) { - Bsprintf_nowarn(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",TrackerCast(wall[s].x),TrackerCast(wall[s].y)); G_GameExit(tempbuf); } } @@ -5875,7 +5877,8 @@ int32_t A_Spawn(int32_t j, int32_t pn) #endif if (j == 0) { - Bsprintf_nowarn(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", + TrackerCast(sp->x),TrackerCast(sp->y)); G_GameExit(tempbuf); } diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index 5f566f75d..f81c06295 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -89,7 +89,7 @@ void VM_ScriptInfo(void) } if (vm.g_i) - initprintf_nowarn("current actor: %d (%d)\n",vm.g_i,vm.g_sp->picnum); + initprintf_nowarn("current actor: %d (%d)\n",vm.g_i,TrackerCast(vm.g_sp->picnum)); initprintf("g_errorLineNum: %d, g_tw: %d\n",g_errorLineNum,g_tw); } @@ -444,7 +444,7 @@ GAMEEXEC_STATIC void VM_AlterAng(int32_t a) { vm.g_t[1] = 0; - OSD_Printf_nowarn(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, TrackerCast(vm.g_sp->picnum)); return; } @@ -593,7 +593,7 @@ dead: if ((unsigned)vm.g_t[1] >= (unsigned)g_scriptSize-1) { vm.g_t[1] = 0; - OSD_Printf_nowarn(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, TrackerCast(vm.g_sp->picnum)); return; } @@ -1111,7 +1111,7 @@ skip_check: insptr++; if (((unsigned)vm.g_sp->yvel >= MAXSOUNDS)) { - CON_ERRPRINTF("Invalid sound %d\n", vm.g_sp->yvel); + CON_ERRPRINTF("Invalid sound %d\n", TrackerCast(vm.g_sp->yvel)); insptr++; continue; } @@ -2203,7 +2203,7 @@ nullquote: int32_t j; if ((unsigned)vm.g_sp->sectnum >= (unsigned)numsectors) { - CON_ERRPRINTF("Invalid sector %d\n", vm.g_sp->sectnum); + CON_ERRPRINTF("Invalid sector %d\n", TrackerCast(vm.g_sp->sectnum)); continue; } j = A_Spawn(vm.g_i, lIn); @@ -2233,7 +2233,7 @@ nullquote: if ((unsigned)vm.g_sp->sectnum >= (unsigned)numsectors) { - CON_ERRPRINTF("Invalid sector %d\n", vm.g_sp->sectnum); + CON_ERRPRINTF("Invalid sector %d\n", TrackerCast(vm.g_sp->sectnum)); insptr++; continue; } @@ -2273,7 +2273,7 @@ nullquote: if ((unsigned)vm.g_sp->sectnum >= (unsigned)numsectors) { - CON_ERRPRINTF("Invalid sector %d\n", vm.g_sp->sectnum); + CON_ERRPRINTF("Invalid sector %d\n", TrackerCast(vm.g_sp->sectnum)); insptr++; actor[vm.g_i].shootzvel=0; continue; @@ -2296,7 +2296,7 @@ nullquote: if ((unsigned)vm.g_sp->sectnum >= (unsigned)numsectors) { - CON_ERRPRINTF("Invalid sector %d\n", vm.g_sp->sectnum); + CON_ERRPRINTF("Invalid sector %d\n", TrackerCast(vm.g_sp->sectnum)); actor[vm.g_i].shootzvel=0; continue; } @@ -2322,7 +2322,7 @@ nullquote: if ((unsigned)vm.g_sp->sectnum >= (unsigned)numsectors) { - CON_ERRPRINTF("Invalid sector %d\n", vm.g_sp->sectnum); + CON_ERRPRINTF("Invalid sector %d\n", TrackerCast(vm.g_sp->sectnum)); actor[vm.g_i].shootzvel=0; continue; } @@ -4177,7 +4177,7 @@ nullquote: if (j<0 || j >= g_gameArrayCount || index >= aGameArrays[j].size || index < 0) { 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); + j,vm.g_i,TrackerCast(sprite[vm.g_i].picnum),vm.g_p); continue; } aGameArrays[j].plValues[index]=value; diff --git a/polymer/eduke32/source/gamestructures.c b/polymer/eduke32/source/gamestructures.c index 14b5e6f3a..de2a31b4b 100644 --- a/polymer/eduke32/source/gamestructures.c +++ b/polymer/eduke32/source/gamestructures.c @@ -931,7 +931,7 @@ static void __fastcall VM_AccessActiveProjectile(int32_t iSet, int32_t lVar1, in { // OSD_Printf("VM_AccessActiveProjectile(): invalid projectile (%d)\n",proj); CON_ERRPRINTF("tried to %s %s on invalid target projectile (%d) %d %d from %s\n", - iSet?"set":"get",ProjectileLabels[lLabelID].name,proj,vm.g_i,vm.g_sp->picnum, + iSet?"set":"get",ProjectileLabels[lLabelID].name,proj,vm.g_i,TrackerCast(vm.g_sp->picnum), (lVar1picnum, + ActorLabels[lLabelID].name,iActor,vm.g_i,TrackerCast(vm.g_sp->picnum), (lVar1picnum, + ActorLabels[lLabelID].name,iActor,vm.g_i,TrackerCast(vm.g_sp->picnum), (lVar1picnum); + CON_ERRPRINTF("invalid target sprite (%d) %d %d\n", iActor, vm.g_i, TrackerCast(vm.g_sp->picnum)); insptr += (lVar2 == MAXGAMEVARS); return; diff --git a/polymer/eduke32/source/gamevars.c b/polymer/eduke32/source/gamevars.c index 72a3ff1e5..934e0e090 100644 --- a/polymer/eduke32/source/gamevars.c +++ b/polymer/eduke32/source/gamevars.c @@ -727,7 +727,7 @@ void __fastcall Gv_SetVar(register int32_t id, register int32_t lValue, register badvarid: CON_ERRPRINTF("Gv_SetVar(): invalid gamevar (%d) from sprite %d (%d), player %d\n", - id,vm.g_i,sprite[vm.g_i].picnum,vm.g_p); + id,vm.g_i,TrackerCast(sprite[vm.g_i].picnum),vm.g_p); return; badindex: