Try to fix P_LookForPlayers lock up on empty servers

This commit is contained in:
NepDisk 2025-12-14 18:01:21 -05:00
parent 6cd270edd5
commit d621a0f0c4
3 changed files with 5 additions and 4 deletions

View file

@ -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

View file

@ -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)

View file

@ -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)