Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable smaller MAXPLAYERS values #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doomgeneric/doomdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@
#define RANGECHECK

// The maximum number of players, multiplayer/networking.
#ifndef MAXPLAYERS
#define MAXPLAYERS 4
#endif

// The current state of the game: whether we are
// playing, gazing at the intermission screen,
Expand Down
10 changes: 7 additions & 3 deletions doomgeneric/g_game.c
Original file line number Diff line number Diff line change
Expand Up @@ -1709,11 +1709,13 @@ G_DeferedInitNew

void G_DoNewGame (void)
{
int i;
demoplayback = false;
netdemo = false;
netgame = false;
deathmatch = false;
playeringame[1] = playeringame[2] = playeringame[3] = 0;
for (i = 1; i < MAXPLAYERS; i++)
playeringame[i] = 0;
respawnparm = false;
fastparm = false;
nomonsters = false;
Expand Down Expand Up @@ -2247,7 +2249,8 @@ void G_TimeDemo (char* name)

boolean G_CheckDemoStatus (void)
{
int endtime;
int endtime;
int i;

if (timingdemo)
{
Expand All @@ -2273,7 +2276,8 @@ boolean G_CheckDemoStatus (void)
netdemo = false;
netgame = false;
deathmatch = false;
playeringame[1] = playeringame[2] = playeringame[3] = 0;
for (i = 1; i < MAXPLAYERS; i++)
playeringame[i] = 0;
respawnparm = false;
fastparm = false;
nomonsters = false;
Expand Down
4 changes: 2 additions & 2 deletions doomgeneric/p_enemy.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,9 +495,9 @@ P_LookForPlayers
fixed_t dist;

c = 0;
stop = (actor->lastlook-1)&3;
stop = (actor->lastlook-1)%MAXPLAYERS;

for ( ; ; actor->lastlook = (actor->lastlook+1)&3 )
for ( ; ; actor->lastlook = (actor->lastlook+1)%MAXPLAYERS)
{
if (!playeringame[actor->lastlook])
continue;
Expand Down
1 change: 1 addition & 0 deletions doomgeneric/p_mobj.c
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,7 @@ void P_SpawnMapThing (mapthing_t* mthing)
// check for players specially
if (mthing->type <= 4)
{
if (mthing->type > MAXPLAYERS) return;
// save spots for respawning in network games
playerstarts[mthing->type-1] = *mthing;
if (!deathmatch)
Expand Down