diff --git a/src/doomdef.h b/src/doomdef.h index 9eafbfd29..423551974 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -192,6 +192,7 @@ extern char logfilename[1024]; // NOTE: it needs more than this to increase the number of players... #define MAXPLAYERS 32 // 32 + host slot +#define PLAYERSMASK (MAXPLAYERS-1) #define MAXPLAYERNAME 21 #define MAXSPLITSCREENPLAYERS 4 // Max number of players on a single computer #define MAXGAMEPADS (MAXSPLITSCREENPLAYERS * 2) // Number of gamepads we'll be allowing diff --git a/src/p_enemy.c b/src/p_enemy.c index 37d3d5ceb..d371199f6 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -451,9 +451,9 @@ boolean P_LookForPlayers(mobj_t *actor, boolean allaround, boolean tracer, fixed actor->lastlook %= MAXPLAYERS; - stop = (actor->lastlook - 1) % MAXPLAYERS; + stop = (actor->lastlook - 1) % PLAYERSMASK; - for (; ; actor->lastlook = (actor->lastlook + 1) % MAXPLAYERS) + for (; ; actor->lastlook = (actor->lastlook + 1) % PLAYERSMASK) { // done looking if (actor->lastlook == stop) diff --git a/src/p_mobj.c b/src/p_mobj.c index ed2c29bca..6891cba86 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -4276,9 +4276,9 @@ boolean P_BossTargetPlayer(mobj_t *actor, boolean closest) // first time init, this allow minimum lastlook changes if (actor->lastlook < 0) actor->lastlook = P_RandomByte(); - actor->lastlook %= MAXPLAYERS; + actor->lastlook %= PLAYERSMASK; - for( ; ; actor->lastlook = (actor->lastlook+1) % MAXPLAYERS) + for( ; ; actor->lastlook = (actor->lastlook+1) % PLAYERSMASK) { // save the first look so we stop next time. if (stop < 0)