diff --git a/source/sw/src/game.h b/source/sw/src/game.h index ab94a1f7d..efe03ec41 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -60,19 +60,23 @@ extern char isShareware; #define ERR_STD_ARG __FILE__, __LINE__ +void _Assert(const char *expr, const char *strFile, unsigned uLine); +#define PRODUCTION_ASSERT(f) \ + do { \ + if (!(f)) \ + _Assert(#f,ERR_STD_ARG); \ + } while (0) + +#if DEBUG || defined DEBUGGINGAIDS +#define ASSERT(f) PRODUCTION_ASSERT(f) +#else +#define ASSERT(f) do { } while (0) +#endif + #if DEBUG void HeapCheck(char *, int); #define HEAP_CHECK() HeapCheck(__FILE__, __LINE__) -void _Assert(const char *expr, const char *strFile, unsigned uLine); -#define ASSERT(f) \ - if (f) \ - do { } while(0); \ - else \ - _Assert(#f,ERR_STD_ARG); - -#define PRODUCTION_ASSERT(f) ASSERT(f) - void dsprintf(char *, char *, ...); #define DSPRINTF dsprintf @@ -90,16 +94,8 @@ extern int DispMono; #define RANDOM_DEBUG 1 // Set this to 1 for network testing. #else -#define ASSERT(f) do { } while(0) #define MONO_PRINT(str) -void _Assert(const char *expr, const char *strFile, unsigned uLine); -#define PRODUCTION_ASSERT(f) \ - if (f) \ - do { } while(0); \ - else \ - _Assert(#f,ERR_STD_ARG); - void dsprintf_null(char *str, const char *format, ...); #define DSPRINTF dsprintf_null //#define DSPRINTF() @@ -1164,7 +1160,7 @@ struct PLAYERstruct short DiveDamageTics; // Death stuff - short DeathType; + uint16_t DeathType; short Kills; short Killer; //who killed me short KilledPlayer[MAX_SW_PLAYERS_REG]; diff --git a/source/sw/src/panel.cpp b/source/sw/src/panel.cpp index e4a1f743e..12361d022 100644 --- a/source/sw/src/panel.cpp +++ b/source/sw/src/panel.cpp @@ -7671,7 +7671,7 @@ pSpriteControl(PLAYERp pp) // RULE: Sprites can only kill themselves PRODUCTION_ASSERT(psp); ASSERT(ValidPtr(psp)); - ASSERT((uint32_t) psp->Next != 0xCCCCCCCC); + // ASSERT((uint32_t) psp->Next != 0xCCCCCCCC); if (psp->State) pStateControl(psp); diff --git a/source/sw/src/sector.cpp b/source/sw/src/sector.cpp index 24b1947d6..bc79eda0b 100644 --- a/source/sw/src/sector.cpp +++ b/source/sw/src/sector.cpp @@ -486,7 +486,7 @@ SectorSetup(void) { SINE_WAVE_FLOOR *swf; short near_sect = i, base_sect = i; - short swf_ndx = 0; + uint16_t swf_ndx = 0; short cnt = 0, sector_cnt; int range; int range_diff = 0; diff --git a/source/sw/src/sprite.cpp b/source/sw/src/sprite.cpp index d3ea67e97..1083ba77d 100644 --- a/source/sw/src/sprite.cpp +++ b/source/sw/src/sprite.cpp @@ -6812,11 +6812,11 @@ SpriteControl(void) u = User[i]; sp = User[i]->SpriteP; STATE_CONTROL(i, sp, u, StateTics) - ASSERT(nexti >= 0 ? User[nexti] != NULL : TRUE); + // ASSERT(nexti >= 0 ? User[nexti] != NULL : TRUE); #else ASSERT(User[i]); StateControl(i); - ASSERT(nexti >= 0 ? User[nexti] != NULL : TRUE); + // ASSERT(nexti >= 0 ? User[nexti] != NULL : TRUE); #endif } diff --git a/source/sw/src/track.cpp b/source/sw/src/track.cpp index a3a147f32..68935f81c 100644 --- a/source/sw/src/track.cpp +++ b/source/sw/src/track.cpp @@ -726,7 +726,7 @@ void SectorObjectSetupBounds(SECTOR_OBJECTp sop) { int xlow, ylow, xhigh, yhigh; - short sp_num, next_sp_num, sn, startwall, endwall; + short sp_num, next_sp_num, startwall, endwall; int i, k, j; SPRITEp BoundSprite; SWBOOL FoundOutsideLoop = FALSE, FoundSector = FALSE; @@ -846,7 +846,7 @@ SectorObjectSetupBounds(SECTOR_OBJECTp sop) sop->num_sectors++; } - ASSERT(sop->num_sectors < SIZ(SectorObject[0].sector)); + ASSERT((uint16_t)sop->num_sectors < SIZ(SectorObject[0].sector)); } // @@ -967,6 +967,7 @@ SectorObjectSetupBounds(SECTOR_OBJECTp sop) // sector // place all sprites on list + uint16_t sn; for (sn = 0; sn < (int)SIZ(sop->sp_num); sn++) { if (sop->sp_num[sn] == -1) @@ -1498,7 +1499,7 @@ PlaceSectorObjectsOnTracks(void) } } - ASSERT(sop->num_walls < SIZ(sop->xorig)); + ASSERT((uint16_t)sop->num_walls < SIZ(sop->xorig)); if (sop->track <= -1) continue; diff --git a/source/sw/src/weapon.cpp b/source/sw/src/weapon.cpp index d5f64cc72..a22b0b22c 100644 --- a/source/sw/src/weapon.cpp +++ b/source/sw/src/weapon.cpp @@ -7748,7 +7748,7 @@ void TraverseBreakableWalls(short start_sect, int x, int y, int z, short ang, in { sect = sectlist[sectlistplc++]; - ASSERT(sectlistplc < SIZ(sectlist)); + ASSERT((uint16_t)sectlistplc < SIZ(sectlist)); startwall = sector[sect].wallptr; endwall = startwall + sector[sect].wallnum; @@ -7798,7 +7798,7 @@ void TraverseBreakableWalls(short start_sect, int x, int y, int z, short ang, in if (k < 0) { sectlist[sectlistend++] = nextsector; - ASSERT(sectlistend < SIZ(sectlist)); + ASSERT((uint16_t)sectlistend < SIZ(sectlist)); } }