From 55bb7e8935369cb392c705969ed626fe9c0c391c Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Wed, 17 Sep 2008 01:05:14 +0000 Subject: Convert MAXINT/MININT -> INT_MAX/INT_MIN in Heretic/Hexen code. Subversion-branch: /branches/raven-branch Subversion-revision: 1234 --- src/heretic/am_map.c | 18 +++++++++--------- src/heretic/d_main.c | 2 +- src/heretic/d_net.c | 4 ++-- src/heretic/doomdef.h | 12 +----------- src/heretic/in_lude.c | 2 +- src/heretic/m_misc.c | 4 ++-- src/heretic/p_floor.c | 2 +- src/heretic/p_local.h | 6 +++--- src/heretic/p_maputl.c | 4 ++-- src/heretic/p_sight.c | 4 ++-- src/heretic/p_spec.c | 2 +- src/heretic/r_main.c | 2 +- src/heretic/r_segs.c | 20 ++++++++++---------- src/heretic/r_things.c | 2 +- src/hexen/am_map.c | 18 +++++++++--------- src/hexen/d_net.c | 4 ++-- src/hexen/h2_main.c | 2 +- src/hexen/h2def.h | 12 ++---------- src/hexen/info.c | 20 ++++++++++---------- src/hexen/m_misc.c | 4 ++-- src/hexen/p_local.h | 8 ++++---- src/hexen/p_map.c | 2 +- src/hexen/p_maputl.c | 4 ++-- src/hexen/p_sight.c | 4 ++-- src/hexen/p_spec.c | 2 +- src/hexen/r_main.c | 2 +- src/hexen/r_segs.c | 20 ++++++++++---------- src/hexen/r_things.c | 2 +- 28 files changed, 85 insertions(+), 103 deletions(-) diff --git a/src/heretic/am_map.c b/src/heretic/am_map.c index 0c2ab6ee..9fcc2714 100644 --- a/src/heretic/am_map.c +++ b/src/heretic/am_map.c @@ -178,9 +178,9 @@ void AM_getIslope(mline_t *ml, islope_t *is) dy = ml->a.y - ml->b.y; dx = ml->b.x - ml->a.x; - if (!dy) is->islp = (dx<0?-MAXINT:MAXINT); + if (!dy) is->islp = (dx<0?-INT_MAX:INT_MAX); else is->islp = FixedDiv(dx, dy); - if (!dx) is->slp = (dy<0?-MAXINT:MAXINT); + if (!dx) is->slp = (dy<0?-INT_MAX:INT_MAX); else is->slp = FixedDiv(dy, dx); } */ @@ -244,8 +244,8 @@ void AM_findMinMaxBoundaries(void) int i; fixed_t a, b; - min_x = min_y = MAXINT; - max_x = max_y = -MAXINT; + min_x = min_y = INT_MAX; + max_x = max_y = -INT_MAX; for (i = 0; i < numvertexes; i++) { if (vertexes[i].x < min_x) @@ -275,7 +275,7 @@ void AM_changeWindowLoc(void) if (m_paninc.x || m_paninc.y) { followplayer = 0; - f_oldloc.x = MAXINT; + f_oldloc.x = INT_MAX; } m_x += m_paninc.x; @@ -328,7 +328,7 @@ void AM_initVariables(void) automapactive = true; fb = screen; - f_oldloc.x = MAXINT; + f_oldloc.x = INT_MAX; amclock = 0; lightlev = 0; @@ -567,7 +567,7 @@ boolean AM_Responder(event_t * ev) break; case AM_FOLLOWKEY: followplayer = !followplayer; - f_oldloc.x = MAXINT; + f_oldloc.x = INT_MAX; P_SetMessage(plr, followplayer ? AMSTR_FOLLOWON : AMSTR_FOLLOWOFF, true); @@ -669,7 +669,7 @@ void AM_doFollowPlayer(void) dmapx = (MTOF(plr->mo->x)-MTOF(f_oldloc.x)); //fixed point dmapy = (MTOF(f_oldloc.y)-MTOF(plr->mo->y)); - if(f_oldloc.x == MAXINT) //to eliminate an error when the user first + if(f_oldloc.x == INT_MAX) //to eliminate an error when the user first dmapx=0; //goes into the automap. mapxstart += dmapx; mapystart += dmapy; @@ -743,7 +743,7 @@ void AM_clearFB(int color) oldplr.x = plr->mo->x; oldplr.y = plr->mo->y; -// if(f_oldloc.x == MAXINT) //to eliminate an error when the user first +// if(f_oldloc.x == INT_MAX) //to eliminate an error when the user first // dmapx=0; //goes into the automap. mapxstart += dmapx >> 1; mapystart += dmapy >> 1; diff --git a/src/heretic/d_main.c b/src/heretic/d_main.c index 073b3d36..9d561013 100644 --- a/src/heretic/d_main.c +++ b/src/heretic/d_main.c @@ -75,7 +75,7 @@ fixed_t FixedDiv(fixed_t a, fixed_t b) { if ((abs(a) >> 14) >= abs(b)) { - return ((a ^ b) < 0 ? MININT : MAXINT); + return ((a ^ b) < 0 ? INT_MIN : INT_MAX); } return (FixedDiv2(a, b)); } diff --git a/src/heretic/d_net.c b/src/heretic/d_net.c index 525107a2..50cd7b63 100644 --- a/src/heretic/d_net.c +++ b/src/heretic/d_net.c @@ -689,7 +689,7 @@ void TryRunTics(void) // NetUpdate(); - lowtic = MAXINT; + lowtic = INT_MAX; numplaying = 0; for (i = 0; i < doomcom->numnodes; i++) if (nodeingame[i]) @@ -757,7 +757,7 @@ void TryRunTics(void) { NetUpdate(); - lowtic = MAXINT; + lowtic = INT_MAX; for (i = 0; i < doomcom->numnodes; i++) if (nodeingame[i] && nettics[i] < lowtic) diff --git a/src/heretic/doomdef.h b/src/heretic/doomdef.h index 3cfafad4..969448c6 100644 --- a/src/heretic/doomdef.h +++ b/src/heretic/doomdef.h @@ -32,6 +32,7 @@ #define strcasecmp strcmpi #define strncasecmp strnicmp #endif +#include #define VERSION 130 #define VERSION_TEXT "v1.3" @@ -89,17 +90,6 @@ extern byte *destview, *destscreen; // PC direct to screen pointers #define KEY_LALT KEY_RALT - -#define MAXCHAR ((char)0x7f) -#define MAXSHORT ((short)0x7fff) -#define MAXINT ((int)0x7fffffff) /* max pos 32-bit int */ -#define MAXLONG ((long)0x7fffffff) - -#define MINCHAR ((char)0x80) -#define MINSHORT ((short)0x8000) -#define MININT ((int)0x80000000) /* max negative 32-bit integer */ -#define MINLONG ((long)0x80000000) - #define FINEANGLES 8192 #define FINEMASK (FINEANGLES-1) #define ANGLETOFINESHIFT 19 // 0x100000000 to 0x2000 diff --git a/src/heretic/in_lude.c b/src/heretic/in_lude.c index 88b7d7e6..0d4e1a0e 100644 --- a/src/heretic/in_lude.c +++ b/src/heretic/in_lude.c @@ -400,7 +400,7 @@ void IN_Ticker(void) oldintertime = intertime + 200; break; case 2: - oldintertime = MAXINT; + oldintertime = INT_MAX; break; case 3: cnt = 10; diff --git a/src/heretic/m_misc.c b/src/heretic/m_misc.c index c621ec07..ff155419 100644 --- a/src/heretic/m_misc.c +++ b/src/heretic/m_misc.c @@ -171,8 +171,8 @@ void M_ClearRandom(void) void M_ClearBox(fixed_t * box) { - box[BOXTOP] = box[BOXRIGHT] = MININT; - box[BOXBOTTOM] = box[BOXLEFT] = MAXINT; + box[BOXTOP] = box[BOXRIGHT] = INT_MIN; + box[BOXBOTTOM] = box[BOXLEFT] = INT_MAX; } void M_AddToBox(fixed_t * box, fixed_t x, fixed_t y) diff --git a/src/heretic/p_floor.c b/src/heretic/p_floor.c index 8a32b462..c370f165 100644 --- a/src/heretic/p_floor.c +++ b/src/heretic/p_floor.c @@ -318,7 +318,7 @@ int EV_DoFloor(line_t * line, floor_e floortype) break; case raiseToTexture: { - int minsize = MAXINT; + int minsize = INT_MAX; side_t *side; floor->direction = 1; diff --git a/src/heretic/p_local.h b/src/heretic/p_local.h index 00502e95..0e5337dc 100644 --- a/src/heretic/p_local.h +++ b/src/heretic/p_local.h @@ -134,9 +134,9 @@ int P_GetPlayerNum(player_t * player); #define FLOOR_LAVA 2 #define FLOOR_SLUDGE 3 -#define ONFLOORZ MININT -#define ONCEILINGZ MAXINT -#define FLOATRANDZ (MAXINT-1) +#define ONFLOORZ INT_MIN +#define ONCEILINGZ INT_MAX +#define FLOATRANDZ (INT_MAX-1) extern mobjtype_t PuffType; extern mobj_t *MissileMobj; diff --git a/src/heretic/p_maputl.c b/src/heretic/p_maputl.c index 23aed3b2..72e4993c 100644 --- a/src/heretic/p_maputl.c +++ b/src/heretic/p_maputl.c @@ -622,7 +622,7 @@ boolean P_TraverseIntercepts(traverser_t func, fixed_t maxfrac) while (count--) { - dist = MAXINT; + dist = INT_MAX; for (scan = intercepts; scan < intercept_p; scan++) if (scan->frac < dist) { @@ -645,7 +645,7 @@ boolean P_TraverseIntercepts(traverser_t func, fixed_t maxfrac) if (!func(in)) return false; // don't bother going farther - in->frac = MAXINT; + in->frac = INT_MAX; } return true; // everything was traversed diff --git a/src/heretic/p_sight.c b/src/heretic/p_sight.c index 257c784b..294736ab 100644 --- a/src/heretic/p_sight.c +++ b/src/heretic/p_sight.c @@ -171,7 +171,7 @@ boolean P_SightTraverseIntercepts(void) while (count--) { - dist = MAXINT; + dist = INT_MAX; for (scan = intercepts; scan < intercept_p; scan++) if (scan->frac < dist) { @@ -181,7 +181,7 @@ boolean P_SightTraverseIntercepts(void) if (!PTR_SightTraverse(in)) return false; // don't bother going farther - in->frac = MAXINT; + in->frac = INT_MAX; } return true; // everything was traversed diff --git a/src/heretic/p_spec.c b/src/heretic/p_spec.c index 5a6aee8c..aff01e11 100644 --- a/src/heretic/p_spec.c +++ b/src/heretic/p_spec.c @@ -441,7 +441,7 @@ fixed_t P_FindLowestCeilingSurrounding(sector_t * sec) int i; line_t *check; sector_t *other; - fixed_t height = MAXINT; + fixed_t height = INT_MAX; for (i = 0; i < sec->linecount; i++) { diff --git a/src/heretic/r_main.c b/src/heretic/r_main.c index 2f3d604a..7628e595 100644 --- a/src/heretic/r_main.c +++ b/src/heretic/r_main.c @@ -71,7 +71,7 @@ int viewangletox[FINEANGLES / 2]; angle_t xtoviewangle[SCREENWIDTH + 1]; // the finetangentgent[angle+FINEANGLES/4] table holds the fixed_t tangent -// values for view angles, ranging from MININT to 0 to MAXINT. +// values for view angles, ranging from INT_MIN to 0 to INT_MAX. // fixed_t finetangent[FINEANGLES/2]; // fixed_t finesine[5*FINEANGLES/4]; diff --git a/src/heretic/r_segs.c b/src/heretic/r_segs.c index 0d2940a4..0d4c47ea 100644 --- a/src/heretic/r_segs.c +++ b/src/heretic/r_segs.c @@ -140,7 +140,7 @@ void R_RenderMaskedSegRange(drawseg_t * ds, int x1, int x2) for (dc_x = x1; dc_x <= x2; dc_x++) { // calculate lighting - if (maskedtexturecol[dc_x] != MAXSHORT) + if (maskedtexturecol[dc_x] != SHRT_MAX) { if (!fixedcolormap) { @@ -161,7 +161,7 @@ void R_RenderMaskedSegRange(drawseg_t * ds, int x1, int x2) maskedtexturecol[dc_x]) - 3); R_DrawMaskedColumn(col, -1); - maskedtexturecol[dc_x] = MAXSHORT; + maskedtexturecol[dc_x] = SHRT_MAX; } spryscale += rw_scalestep; } @@ -444,8 +444,8 @@ void R_StoreWallRange(int start, int stop) ds_p->silhouette = SIL_BOTH; ds_p->sprtopclip = screenheightarray; ds_p->sprbottomclip = negonearray; - ds_p->bsilheight = MAXINT; - ds_p->tsilheight = MININT; + ds_p->bsilheight = INT_MAX; + ds_p->tsilheight = INT_MIN; } else { @@ -462,7 +462,7 @@ void R_StoreWallRange(int start, int stop) else if (backsector->floorheight > viewz) { ds_p->silhouette = SIL_BOTTOM; - ds_p->bsilheight = MAXINT; + ds_p->bsilheight = INT_MAX; // ds_p->sprbottomclip = negonearray; } if (frontsector->ceilingheight < backsector->ceilingheight) @@ -473,20 +473,20 @@ void R_StoreWallRange(int start, int stop) else if (backsector->ceilingheight < viewz) { ds_p->silhouette |= SIL_TOP; - ds_p->tsilheight = MININT; + ds_p->tsilheight = INT_MIN; // ds_p->sprtopclip = screenheightarray; } if (backsector->ceilingheight <= frontsector->floorheight) { ds_p->sprbottomclip = negonearray; - ds_p->bsilheight = MAXINT; + ds_p->bsilheight = INT_MAX; ds_p->silhouette |= SIL_BOTTOM; } if (backsector->floorheight >= frontsector->ceilingheight) { ds_p->sprtopclip = screenheightarray; - ds_p->tsilheight = MININT; + ds_p->tsilheight = INT_MIN; ds_p->silhouette |= SIL_TOP; } worldhigh = backsector->ceilingheight - viewz; @@ -660,12 +660,12 @@ void R_StoreWallRange(int start, int stop) if (maskedtexture && !(ds_p->silhouette & SIL_TOP)) { ds_p->silhouette |= SIL_TOP; - ds_p->tsilheight = MININT; + ds_p->tsilheight = INT_MIN; } if (maskedtexture && !(ds_p->silhouette & SIL_BOTTOM)) { ds_p->silhouette |= SIL_BOTTOM; - ds_p->bsilheight = MAXINT; + ds_p->bsilheight = INT_MAX; } ds_p++; } diff --git a/src/heretic/r_things.c b/src/heretic/r_things.c index 8195a543..de51504b 100644 --- a/src/heretic/r_things.c +++ b/src/heretic/r_things.c @@ -851,7 +851,7 @@ void R_SortVisSprites(void) vsprsortedhead.next = vsprsortedhead.prev = &vsprsortedhead; for (i = 0; i < count; i++) { - bestscale = MAXINT; + bestscale = INT_MAX; for (ds = unsorted.next; ds != &unsorted; ds = ds->next) { if (ds->scale < bestscale) diff --git a/src/hexen/am_map.c b/src/hexen/am_map.c index be16a8ac..6678f325 100644 --- a/src/hexen/am_map.c +++ b/src/hexen/am_map.c @@ -126,9 +126,9 @@ void AM_getIslope(mline_t *ml, islope_t *is) dy = ml->a.y - ml->b.y; dx = ml->b.x - ml->a.x; - if (!dy) is->islp = (dx<0?-MAXINT:MAXINT); + if (!dy) is->islp = (dx<0?-INT_MAX:INT_MAX); else is->islp = FixedDiv(dx, dy); - if (!dx) is->slp = (dy<0?-MAXINT:MAXINT); + if (!dx) is->slp = (dy<0?-INT_MAX:INT_MAX); else is->slp = FixedDiv(dy, dx); } */ @@ -192,8 +192,8 @@ void AM_findMinMaxBoundaries(void) int i; fixed_t a, b; - min_x = min_y = MAXINT; - max_x = max_y = -MAXINT; + min_x = min_y = INT_MAX; + max_x = max_y = -INT_MAX; for (i = 0; i < numvertexes; i++) { if (vertexes[i].x < min_x) @@ -223,7 +223,7 @@ void AM_changeWindowLoc(void) if (m_paninc.x || m_paninc.y) { followplayer = 0; - f_oldloc.x = MAXINT; + f_oldloc.x = INT_MAX; } m_x += m_paninc.x; @@ -276,7 +276,7 @@ void AM_initVariables(void) automapactive = true; fb = screen; - f_oldloc.x = MAXINT; + f_oldloc.x = INT_MAX; amclock = 0; lightlev = 0; @@ -487,7 +487,7 @@ boolean AM_Responder(event_t * ev) break; case AM_FOLLOWKEY: followplayer = !followplayer; - f_oldloc.x = MAXINT; + f_oldloc.x = INT_MAX; P_SetMessage(plr, followplayer ? AMSTR_FOLLOWON : AMSTR_FOLLOWOFF, true); @@ -576,7 +576,7 @@ void AM_doFollowPlayer(void) dmapx = (MTOF(plr->mo->x)-MTOF(f_oldloc.x)); //fixed point dmapy = (MTOF(f_oldloc.y)-MTOF(plr->mo->y)); - if(f_oldloc.x == MAXINT) //to eliminate an error when the user first + if(f_oldloc.x == INT_MAX) //to eliminate an error when the user first dmapx=0; //goes into the automap. mapxstart += dmapx; mapystart += dmapy; @@ -650,7 +650,7 @@ void AM_clearFB(int color) oldplr.x = plr->mo->x; oldplr.y = plr->mo->y; -// if(f_oldloc.x == MAXINT) //to eliminate an error when the user first +// if(f_oldloc.x == INT_MAX) //to eliminate an error when the user first // dmapx=0; //goes into the automap. mapxstart += dmapx >> 1; mapystart += dmapy >> 1; diff --git a/src/hexen/d_net.c b/src/hexen/d_net.c index f7381d4e..7527d7f6 100644 --- a/src/hexen/d_net.c +++ b/src/hexen/d_net.c @@ -823,7 +823,7 @@ void TryRunTics(void) // NetUpdate(); - lowtic = MAXINT; + lowtic = INT_MAX; numplaying = 0; for (i = 0; i < doomcom->numnodes; i++) if (nodeingame[i]) @@ -891,7 +891,7 @@ void TryRunTics(void) { NetUpdate(); - lowtic = MAXINT; + lowtic = INT_MAX; for (i = 0; i < doomcom->numnodes; i++) if (nodeingame[i] && nettics[i] < lowtic) diff --git a/src/hexen/h2_main.c b/src/hexen/h2_main.c index 60ae9f64..3518ea37 100644 --- a/src/hexen/h2_main.c +++ b/src/hexen/h2_main.c @@ -844,7 +844,7 @@ fixed_t FixedDiv(fixed_t a, fixed_t b) { if ((abs(a) >> 14) >= abs(b)) { - return ((a ^ b) < 0 ? MININT : MAXINT); + return ((a ^ b) < 0 ? INT_MIN : INT_MAX); } return (FixedDiv2(a, b)); } diff --git a/src/hexen/h2def.h b/src/hexen/h2def.h index 6a4a3a89..61e0fc70 100644 --- a/src/hexen/h2def.h +++ b/src/hexen/h2def.h @@ -27,6 +27,8 @@ #include #include #include +#include + #include "st_start.h" #ifdef __WATCOMC__ #include @@ -118,16 +120,6 @@ extern byte *destview, *destscreen; // PC direct to screen pointers #define KEY_BACKSLASH 0x5C -#define MAXCHAR ((char)0x7f) -#define MAXSHORT ((short)0x7fff) -#define MAXINT ((int)0x7fffffff) /* max pos 32-bit int */ -#define MAXLONG ((long)0x7fffffff) - -#define MINCHAR ((char)0x80) -#define MINSHORT ((short)0x8000) -#define MININT ((int)0x80000000) /* max negative 32-bit integer */ -#define MINLONG ((long)0x80000000) - #define FINEANGLES 8192 #define FINEMASK (FINEANGLES-1) #define ANGLETOFINESHIFT 19 // 0x100000000 to 0x2000 diff --git a/src/hexen/info.c b/src/hexen/info.c index ac050dcf..aa4621d4 100644 --- a/src/hexen/info.c +++ b/src/hexen/info.c @@ -5288,7 +5288,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { 0, // speed 1, // radius 1, // height - MAXINT, // mass + INT_MAX, // mass 0, // damage SFX_NONE, // activesound MF_NOGRAVITY | MF_NOBLOCKMAP | MF_SHADOW | MF_NOCLIP | MF_DROPOFF, // flags @@ -5882,7 +5882,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { 0, // speed 15 * FRACUNIT, // radius 180 * FRACUNIT, // height - MAXINT, // mass + INT_MAX, // mass 0, // damage SFX_NONE, // activesound MF_SOLID | MF_SHOOTABLE | MF_NOBLOOD, // flags @@ -8312,7 +8312,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { 0, // speed 8 * FRACUNIT, // radius 24 * FRACUNIT, // height - MAXINT, // mass + INT_MAX, // mass 0, // damage SFX_NONE, // activesound MF_SOLID | MF_SHOOTABLE | MF_NOBLOOD, // flags @@ -8339,7 +8339,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { 0, // speed 16 * FRACUNIT, // radius 40 * FRACUNIT, // height - MAXINT, // mass + INT_MAX, // mass 0, // damage SFX_NONE, // activesound MF_SOLID | MF_SHOOTABLE | MF_NOBLOOD, // flags @@ -8393,7 +8393,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { 0, // speed 6 * FRACUNIT, // radius 20 * FRACUNIT, // height - MAXINT, // mass + INT_MAX, // mass 0, // damage SFX_NONE, // activesound MF_SHOOTABLE | MF_SOLID | MF_NOBLOOD, // flags @@ -8528,7 +8528,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { 0, // speed 16 * FRACUNIT, // radius 72 * FRACUNIT, // height - MAXINT, // mass + INT_MAX, // mass 0, // damage SFX_NONE, // activesound MF_SOLID | MF_SHOOTABLE | MF_NOBLOOD, // flags @@ -8582,7 +8582,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { 0, // speed 56 * FRACUNIT, // radius 120 * FRACUNIT, // height - MAXINT, // mass + INT_MAX, // mass 0, // damage SFX_NONE, // activesound MF_SOLID | MF_SHOOTABLE | MF_NOBLOOD | MF_NOGRAVITY | MF_SPAWNCEILING, // flags @@ -8663,7 +8663,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { 0, // speed 11 * FRACUNIT, // radius 130 * FRACUNIT, // height - MAXINT, // mass + INT_MAX, // mass 0, // damage SFX_NONE, // activesound MF_SOLID | MF_SHOOTABLE | MF_NOBLOOD, // flags @@ -11660,7 +11660,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { 12, // speed 32 * FRACUNIT, // radius 70 * FRACUNIT, // height - MAXINT, // mass + INT_MAX, // mass 0, // damage SFX_NONE, // activesound MF_SOLID | MF_COUNTKILL | MF_NOBLOOD, // flags @@ -11984,7 +11984,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { 10 * FRACUNIT, // speed 20 * FRACUNIT, // radius 65 * FRACUNIT, // height - MAXINT, // mass + INT_MAX, // mass 0, // damage SFX_DRAGON_ACTIVE, // activesound MF_SOLID | MF_SHOOTABLE | MF_COUNTKILL | MF_FLOAT | MF_NOGRAVITY | MF_NOBLOOD, // flags diff --git a/src/hexen/m_misc.c b/src/hexen/m_misc.c index c493b23f..6955cfb8 100644 --- a/src/hexen/m_misc.c +++ b/src/hexen/m_misc.c @@ -188,8 +188,8 @@ void M_ClearRandom(void) void M_ClearBox(fixed_t * box) { - box[BOXTOP] = box[BOXRIGHT] = MININT; - box[BOXBOTTOM] = box[BOXLEFT] = MAXINT; + box[BOXTOP] = box[BOXRIGHT] = INT_MIN; + box[BOXBOTTOM] = box[BOXLEFT] = INT_MAX; } void M_AddToBox(fixed_t * box, fixed_t x, fixed_t y) diff --git a/src/hexen/p_local.h b/src/hexen/p_local.h index 55f5e72a..b9e6c5dc 100644 --- a/src/hexen/p_local.h +++ b/src/hexen/p_local.h @@ -135,10 +135,10 @@ enum FLOOR_SLUDGE }; -#define ONFLOORZ MININT -#define ONCEILINGZ MAXINT -#define FLOATRANDZ (MAXINT-1) -#define FROMCEILINGZ128 (MAXINT-2) +#define ONFLOORZ INT_MIN +#define ONCEILINGZ INT_MAX +#define FLOATRANDZ (INT_MAX-1) +#define FROMCEILINGZ128 (INT_MAX-2) extern mobjtype_t PuffType; extern mobj_t *MissileMobj; diff --git a/src/hexen/p_map.c b/src/hexen/p_map.c index 5078b340..27c8386f 100644 --- a/src/hexen/p_map.c +++ b/src/hexen/p_map.c @@ -505,7 +505,7 @@ boolean PIT_CheckThing(mobj_t * thing) { if (thing->flags & MF_SHOOTABLE && thing != tmthing->target) { - if (thing->info->mass != MAXINT) + if (thing->info->mass != INT_MAX) { thing->momx += tmthing->momx >> 4; thing->momy += tmthing->momy >> 4; diff --git a/src/hexen/p_maputl.c b/src/hexen/p_maputl.c index 762b9dbf..3c92717c 100644 --- a/src/hexen/p_maputl.c +++ b/src/hexen/p_maputl.c @@ -653,7 +653,7 @@ boolean P_TraverseIntercepts(traverser_t func, fixed_t maxfrac) while (count--) { - dist = MAXINT; + dist = INT_MAX; for (scan = intercepts; scan < intercept_p; scan++) if (scan->frac < dist) { @@ -676,7 +676,7 @@ boolean P_TraverseIntercepts(traverser_t func, fixed_t maxfrac) if (!func(in)) return false; // don't bother going farther - in->frac = MAXINT; + in->frac = INT_MAX; } return true; // everything was traversed diff --git a/src/hexen/p_sight.c b/src/hexen/p_sight.c index a2377bde..423c26de 100644 --- a/src/hexen/p_sight.c +++ b/src/hexen/p_sight.c @@ -215,7 +215,7 @@ boolean P_SightTraverseIntercepts(void) while (count--) { - dist = MAXINT; + dist = INT_MAX; for (scan = intercepts; scan < intercept_p; scan++) if (scan->frac < dist) { @@ -225,7 +225,7 @@ boolean P_SightTraverseIntercepts(void) if (!PTR_SightTraverse(in)) return false; // don't bother going farther - in->frac = MAXINT; + in->frac = INT_MAX; } return true; // everything was traversed diff --git a/src/hexen/p_spec.c b/src/hexen/p_spec.c index 44c9c713..f7a820ca 100644 --- a/src/hexen/p_spec.c +++ b/src/hexen/p_spec.c @@ -274,7 +274,7 @@ fixed_t P_FindLowestCeilingSurrounding(sector_t * sec) int i; line_t *check; sector_t *other; - fixed_t height = MAXINT; + fixed_t height = INT_MAX; for (i = 0; i < sec->linecount; i++) { diff --git a/src/hexen/r_main.c b/src/hexen/r_main.c index 066f5579..d61b5114 100644 --- a/src/hexen/r_main.c +++ b/src/hexen/r_main.c @@ -67,7 +67,7 @@ int viewangletox[FINEANGLES / 2]; angle_t xtoviewangle[SCREENWIDTH + 1]; // the finetangentgent[angle+FINEANGLES/4] table holds the fixed_t tangent -// values for view angles, ranging from MININT to 0 to MAXINT. +// values for view angles, ranging from INT_MIN to 0 to INT_MAX. // fixed_t finetangent[FINEANGLES/2]; // fixed_t finesine[5*FINEANGLES/4]; diff --git a/src/hexen/r_segs.c b/src/hexen/r_segs.c index ac7c1934..4eef6040 100644 --- a/src/hexen/r_segs.c +++ b/src/hexen/r_segs.c @@ -131,7 +131,7 @@ void R_RenderMaskedSegRange(drawseg_t * ds, int x1, int x2) for (dc_x = x1; dc_x <= x2; dc_x++) { // calculate lighting - if (maskedtexturecol[dc_x] != MAXSHORT) + if (maskedtexturecol[dc_x] != SHRT_MAX) { if (!fixedcolormap) { @@ -152,7 +152,7 @@ void R_RenderMaskedSegRange(drawseg_t * ds, int x1, int x2) maskedtexturecol[dc_x]) - 3); R_DrawMaskedColumn(col, -1); - maskedtexturecol[dc_x] = MAXSHORT; + maskedtexturecol[dc_x] = SHRT_MAX; } spryscale += rw_scalestep; } @@ -435,8 +435,8 @@ void R_StoreWallRange(int start, int stop) ds_p->silhouette = SIL_BOTH; ds_p->sprtopclip = screenheightarray; ds_p->sprbottomclip = negonearray; - ds_p->bsilheight = MAXINT; - ds_p->tsilheight = MININT; + ds_p->bsilheight = INT_MAX; + ds_p->tsilheight = INT_MIN; } else { @@ -453,7 +453,7 @@ void R_StoreWallRange(int start, int stop) else if (backsector->floorheight > viewz) { ds_p->silhouette = SIL_BOTTOM; - ds_p->bsilheight = MAXINT; + ds_p->bsilheight = INT_MAX; // ds_p->sprbottomclip = negonearray; } if (frontsector->ceilingheight < backsector->ceilingheight) @@ -464,20 +464,20 @@ void R_StoreWallRange(int start, int stop) else if (backsector->ceilingheight < viewz) { ds_p->silhouette |= SIL_TOP; - ds_p->tsilheight = MININT; + ds_p->tsilheight = INT_MIN; // ds_p->sprtopclip = screenheightarray; } if (backsector->ceilingheight <= frontsector->floorheight) { ds_p->sprbottomclip = negonearray; - ds_p->bsilheight = MAXINT; + ds_p->bsilheight = INT_MAX; ds_p->silhouette |= SIL_BOTTOM; } if (backsector->floorheight >= frontsector->ceilingheight) { ds_p->sprtopclip = screenheightarray; - ds_p->tsilheight = MININT; + ds_p->tsilheight = INT_MIN; ds_p->silhouette |= SIL_TOP; } worldhigh = backsector->ceilingheight - viewz; @@ -652,12 +652,12 @@ void R_StoreWallRange(int start, int stop) if (maskedtexture && !(ds_p->silhouette & SIL_TOP)) { ds_p->silhouette |= SIL_TOP; - ds_p->tsilheight = MININT; + ds_p->tsilheight = INT_MIN; } if (maskedtexture && !(ds_p->silhouette & SIL_BOTTOM)) { ds_p->silhouette |= SIL_BOTTOM; - ds_p->bsilheight = MAXINT; + ds_p->bsilheight = INT_MAX; } ds_p++; } diff --git a/src/hexen/r_things.c b/src/hexen/r_things.c index 2ba32dbf..b460d6a7 100644 --- a/src/hexen/r_things.c +++ b/src/hexen/r_things.c @@ -879,7 +879,7 @@ void R_SortVisSprites(void) vsprsortedhead.next = vsprsortedhead.prev = &vsprsortedhead; for (i = 0; i < count; i++) { - bestscale = MAXINT; + bestscale = INT_MAX; for (ds = unsorted.next; ds != &unsorted; ds = ds->next) { if (ds->scale < bestscale) -- cgit v1.2.3