shithub: choc

Download patch

ref: 535b4edd143ceeae870e9c13cdac65ce17e2be48
parent: 833d8a838b44a950ebde587db1d888bf0a98e690
parent: e0eb95922fbda64aca169d62029a5be071e1273f
author: Fabian Greffrath <fabian@greffrath.com>
date: Mon Mar 30 14:13:10 EDT 2015

Merge pull request #523 from chocolate-doom/hexndemo

Add support for the Hexen 4 Level Demo Version

--- a/src/hexen/a_action.c
+++ b/src/hexen/a_action.c
@@ -211,7 +211,7 @@
     }
     else
     {
-        for (i = 0; i < MAXPLAYERS; i++)
+        for (i = 0; i < maxplayers; i++)
         {
             if (!playeringame[i])
             {
@@ -905,7 +905,7 @@
 
     if (actor->args[1]-- > 0)
     {
-        for (playnum = 0; playnum < MAXPLAYERS; playnum++)
+        for (playnum = 0; playnum < maxplayers; playnum++)
         {
             player = &players[playnum];
             if (!playeringame[playnum])
@@ -934,7 +934,7 @@
     }
     else
     {
-        for (playnum = 0; playnum < MAXPLAYERS; playnum++)
+        for (playnum = 0; playnum < maxplayers; playnum++)
         {
             localQuakeHappening[playnum] = false;
         }
--- a/src/hexen/am_map.c
+++ b/src/hexen/am_map.c
@@ -292,7 +292,7 @@
 
     // find player to center on initially
     if (!playeringame[pnum = consoleplayer])
-        for (pnum = 0; pnum < MAXPLAYERS; pnum++)
+        for (pnum = 0; pnum < maxplayers; pnum++)
             if (playeringame[pnum])
                 break;
     plr = &players[pnum];
@@ -1280,7 +1280,7 @@
         return;
     }
 
-    for (i = 0; i < MAXPLAYERS; i++)
+    for (i = 0; i < maxplayers; i++)
     {
         their_color++;
         p = &players[i];
@@ -1418,12 +1418,12 @@
     char textBuffer[80];
     int yPosition;
 
-    for (i = 0; i < MAXPLAYERS; i++)
+    for (i = 0; i < maxplayers; i++)
     {
         fragCount[i] = 0;
         order[i] = -1;
     }
-    for (i = 0; i < MAXPLAYERS; i++)
+    for (i = 0; i < maxplayers; i++)
     {
         if (!playeringame[i])
         {
@@ -1431,7 +1431,7 @@
         }
         else
         {
-            for (j = 0; j < MAXPLAYERS; j++)
+            for (j = 0; j < maxplayers; j++)
             {
                 if (playeringame[j])
                 {
@@ -1438,7 +1438,7 @@
                     fragCount[i] += players[i].frags[j];
                 }
             }
-            for (k = 0; k < MAXPLAYERS; k++)
+            for (k = 0; k < maxplayers; k++)
             {
                 if (order[k] == -1)
                 {
@@ -1447,7 +1447,7 @@
                 }
                 else if (fragCount[i] > fragCount[order[k]])
                 {
-                    for (m = MAXPLAYERS - 1; m > k; m--)
+                    for (m = maxplayers - 1; m > k; m--)
                     {
                         order[m] = order[m - 1];
                     }
@@ -1458,7 +1458,7 @@
         }
     }
     yPosition = 15;
-    for (i = 0; i < MAXPLAYERS; i++)
+    for (i = 0; i < maxplayers; i++)
     {
         if (!playeringame[order[i]])
         {
--- a/src/hexen/ct_chat.c
+++ b/src/hexen/ct_chat.c
@@ -116,7 +116,7 @@
     tail = 0;
     chatmodeon = false;
     memset(ChatQueue, 0, QUEUESIZE);
-    for (i = 0; i < MAXPLAYERS; i++)
+    for (i = 0; i < maxplayers; i++)
     {
         chat_dest[i] = 0;
         msgptr[i] = 0;
@@ -292,7 +292,7 @@
     char c;
     int numplayers;
 
-    for (i = 0; i < MAXPLAYERS; i++)
+    for (i = 0; i < maxplayers; i++)
     {
         if (!playeringame[i])
         {
@@ -312,7 +312,7 @@
             else if (c == KEY_ENTER)
             {
                 numplayers = 0;
-                for (j = 0; j < MAXPLAYERS; j++)
+                for (j = 0; j < maxplayers; j++)
                 {
                     numplayers += playeringame[j];
                 }
--- a/src/hexen/d_net.c
+++ b/src/hexen/d_net.c
@@ -76,7 +76,7 @@
 
     // Check for player quits.
 
-    for (i = 0; i < MAXPLAYERS; ++i)
+    for (i = 0; i < maxplayers; ++i)
     {
         if (!demoplayback && playeringame[i] && !ingame[i])
         {
@@ -120,7 +120,7 @@
     respawnparm = settings->respawn_monsters;
     consoleplayer = settings->consoleplayer;
 
-    for (i=0; i<MAXPLAYERS; ++i)
+    for (i=0; i<maxplayers; ++i)
     {
         playeringame[i] = i < settings->num_players;
         PlayerClass[i] = settings->player_classes[i];
@@ -172,7 +172,7 @@
 
     connect_data->lowres_turn = false;
     connect_data->drone = false;
-    connect_data->max_players = MAXPLAYERS;
+    connect_data->max_players = maxplayers;
 
     //!
     // @category net
--- a/src/hexen/g_game.c
+++ b/src/hexen/g_game.c
@@ -639,7 +639,7 @@
 
     levelstarttic = gametic;    // for time calculation 
     gamestate = GS_LEVEL;
-    for (i = 0; i < MAXPLAYERS; i++)
+    for (i = 0; i < maxplayers; i++)
     {
         if (playeringame[i] && players[i].playerstate == PST_DEAD)
             players[i].playerstate = PST_REBORN;
@@ -756,7 +756,7 @@
         do
         {
             displayplayer++;
-            if (displayplayer == MAXPLAYERS)
+            if (displayplayer == maxplayers)
             {
                 displayplayer = 0;
             }
@@ -899,7 +899,7 @@
 //
 // do player reborns if needed
 //
-    for (i = 0; i < MAXPLAYERS; i++)
+    for (i = 0; i < maxplayers; i++)
         if (playeringame[i] && players[i].playerstate == PST_REBORN)
             G_DoReborn(i);
 
@@ -963,7 +963,7 @@
     //buf = gametic%BACKUPTICS;
     buf = (gametic / ticdup) % BACKUPTICS;
 
-    for (i = 0; i < MAXPLAYERS; i++)
+    for (i = 0; i < maxplayers; i++)
         if (playeringame[i])
         {
             cmd = &players[i].cmd;
@@ -993,7 +993,7 @@
 //
 // check for special buttons
 //
-    for (i = 0; i < MAXPLAYERS; i++)
+    for (i = 0; i < maxplayers; i++)
         if (playeringame[i])
         {
             if (players[i].cmd.buttons & BT_SPECIAL)
@@ -1335,7 +1335,7 @@
         else
         {
             // Try to spawn at one of the other player start spots
-            for (i = 0; i < MAXPLAYERS; i++)
+            for (i = 0; i < maxplayers; i++)
             {
                 if (G_CheckSpot(playernum, &playerstarts[RebornPosition][i]))
                 {               // Found an open start spot
@@ -1471,6 +1471,13 @@
 
 void G_Completed(int map, int position)
 {
+    if (gamemode == shareware && map > 4)
+    {
+        P_SetMessage(&players[consoleplayer], "ACCESS DENIED -- DEMO", true);
+        S_StartSound(NULL, SFX_CHAT);
+        return;
+    }
+
     gameaction = ga_completed;
     LeaveMap = map;
     LeavePosition = position;
@@ -1485,7 +1492,7 @@
     {
         return;
     }
-    for (i = 0; i < MAXPLAYERS; i++)
+    for (i = 0; i < maxplayers; i++)
     {
         if (playeringame[i])
         {
@@ -1512,7 +1519,7 @@
 	{
 		return;
 	}
-	for(i = 0; i < MAXPLAYERS; i++)
+	for(i = 0; i < maxplayers; i++)
 	{
 		if(playeringame[i])
 		{
@@ -1725,7 +1732,7 @@
     }
     M_ClearRandom();
     // Force players to be initialized upon first level load
-    for (i = 0; i < MAXPLAYERS; i++)
+    for (i = 0; i < maxplayers; i++)
     {
         players[i].playerstate = PST_REBORN;
         players[i].worldTimer = 0;
@@ -1748,7 +1755,7 @@
     // Give one null ticcmd_t
     //gametic = 0;
     //maketic = 1;
-    //for (i=0 ; i<MAXPLAYERS ; i++)
+    //for (i=0 ; i<maxplayers ; i++)
     //      nettics[i] = 1; // one null event for this gametic
     //memset (localcmds,0,sizeof(localcmds));
     //memset (netcmds,0,sizeof(netcmds));
@@ -1819,7 +1826,7 @@
     *demo_p++ = episode;
     *demo_p++ = map;
 
-    for (i = 0; i < MAXPLAYERS; i++)
+    for (i = 0; i < maxplayers; i++)
     {
         *demo_p++ = playeringame[i];
         *demo_p++ = PlayerClass[i];
@@ -1855,7 +1862,7 @@
     episode = *demo_p++;
     map = *demo_p++;
 
-    for (i = 0; i < MAXPLAYERS; i++)
+    for (i = 0; i < maxplayers; i++)
     {
         playeringame[i] = *demo_p++;
         PlayerClass[i] = *demo_p++;
@@ -1890,7 +1897,7 @@
     episode = *demo_p++;
     map = *demo_p++;
 
-    for (i = 0; i < MAXPLAYERS; i++)
+    for (i = 0; i < maxplayers; i++)
     {
         playeringame[i] = *demo_p++;
         PlayerClass[i] = *demo_p++;
--- a/src/hexen/h2_main.c
+++ b/src/hexen/h2_main.c
@@ -93,6 +93,7 @@
 // PUBLIC DATA DEFINITIONS -------------------------------------------------
 
 GameMode_t gamemode;
+char *gamedescription;
 char *iwadfile;
 static char demolumpname[9];    // Demo lump to start playing.
 boolean nomonsters;             // checkparm of -nomonsters
@@ -112,6 +113,7 @@
 boolean advancedemo;
 FILE *debugfile;
 int UpdateState;
+int maxplayers = MAXPLAYERS;
 
 // PRIVATE DATA DEFINITIONS ------------------------------------------------
 
@@ -253,6 +255,46 @@
     W_AddFile(filename);
 }
 
+// Find out what version of Hexen is playing.
+
+void D_IdentifyVersion(void)
+{
+    // The Hexen Shareware, ne 4 Level Demo Version, is missing the SKY1 lump
+    // and uses the SKY2 lump instead. Let's use this fact and the missing
+    // levels from MAP05 onward to identify it and set gamemode accordingly.
+
+    if (W_CheckNumForName("SKY1") == -1 &&
+        W_CheckNumForName("MAP05") == -1 )
+    {
+	gamemode = shareware;
+	maxplayers = 4;
+    }
+}
+
+// Set the gamedescription string.
+
+void D_SetGameDescription(void)
+{
+/*
+    NB: The 4 Level Demo Version actually prints a four-lined banner
+    (and indeed waits for a keypress):
+
+    Hexen:  Beyond Heretic
+
+    4 Level Demo Version
+    Press any key to continue.
+*/
+
+    if (gamemode == shareware)
+    {
+	gamedescription = "Hexen: 4 Level Demo Version";
+    }
+    else
+    {
+	gamedescription = "Hexen";
+    }
+}
+
 //==========================================================================
 //
 // H2_Main
@@ -332,11 +374,13 @@
 
     D_AddFile(iwadfile);
     W_CheckCorrectIWAD(hexen);
+    D_IdentifyVersion();
+    D_SetGameDescription();
     AdjustForMacIWAD();
 
     HandleArgs();
 
-    I_PrintStartupBanner("Hexen");
+    I_PrintStartupBanner(gamedescription);
 
     ST_Message("MN_Init: Init menu system.\n");
     MN_Init();
@@ -664,7 +708,7 @@
         M_snprintf(filename, sizeof(filename), "debug%i.txt", consoleplayer);
         debugfile = fopen(filename, "w");
     }
-    I_SetWindowTitle("Hexen");
+    I_SetWindowTitle(gamedescription);
     I_GraphicsCheckCommandLine();
     I_SetGrabMouseCallback(D_GrabMouseCallback);
     I_InitGraphics();
--- a/src/hexen/h2def.h
+++ b/src/hexen/h2def.h
@@ -655,6 +655,7 @@
 
 #define MAX_PLAYER_STARTS 8
 extern mapthing_t playerstarts[MAX_PLAYER_STARTS][MAXPLAYERS];
+extern int maxplayers;
 
 extern int mouseSensitivity;
 
--- a/src/hexen/in_lude.c
+++ b/src/hexen/in_lude.c
@@ -106,7 +106,7 @@
     skipintermission = false;
     intertime = 0;
     AM_Stop();
-    for (i = 0; i < MAXPLAYERS; i++)
+    for (i = 0; i < maxplayers; i++)
     {
         players[i].messageTics = 0;
         players[i].message[0] = 0;
@@ -208,13 +208,13 @@
         posnum = 0;
         playercount = 0;
         slaughtercount = 0;
-        for (i = 0; i < MAXPLAYERS; i++)
+        for (i = 0; i < maxplayers; i++)
         {
             totalFrags[i] = 0;
             if (playeringame[i])
             {
                 playercount++;
-                for (j = 0; j < MAXPLAYERS; j++)
+                for (j = 0; j < maxplayers; j++)
                 {
                     if (playeringame[j])
                     {
@@ -338,7 +338,7 @@
     player_t *player;
     static boolean triedToSkip;
 
-    for (i = 0, player = players; i < MAXPLAYERS; i++, player++)
+    for (i = 0, player = players; i < maxplayers; i++, player++)
     {
         if (playeringame[i])
         {
@@ -478,10 +478,10 @@
         S_StartSound(NULL, SFX_PLATFORM_STOP);
     }
     y = yPos >> FRACBITS;
-    for (i = 0; i < MAXPLAYERS; i++)
+    for (i = 0; i < maxplayers; i++)
     {
         xPos = xStart;
-        for (j = 0; j < MAXPLAYERS; j++, xPos += xDelta)
+        for (j = 0; j < maxplayers; j++, xPos += xDelta)
         {
             x = xPos >> FRACBITS;
             bold = (i == consoleplayer || j == consoleplayer);
--- a/src/hexen/mn_menu.c
+++ b/src/hexen/mn_menu.c
@@ -1190,11 +1190,13 @@
 
     if (InfoType)
     {
+        /* The 4-Level Demo Version also has 3 Info pages
         if (gamemode == shareware)
         {
             InfoType = (InfoType + 1) % 5;
         }
         else
+        */
         {
             InfoType = (InfoType + 1) % 4;
         }
--- a/src/hexen/p_acs.c
+++ b/src/hexen/p_acs.c
@@ -1681,7 +1681,7 @@
 {
     int i;
 
-    for (i = 0; i < MAXPLAYERS; i++)
+    for (i = 0; i < maxplayers; i++)
     {
         if (playeringame[i])
         {
@@ -1722,7 +1722,7 @@
     int count;
 
     count = 0;
-    for (i = 0; i < MAXPLAYERS; i++)
+    for (i = 0; i < maxplayers; i++)
     {
         count += playeringame[i];
     }
--- a/src/hexen/p_enemy.c
+++ b/src/hexen/p_enemy.c
@@ -546,8 +546,8 @@
     // stop = (actor->lastlook - 1) & 3;
     // for (;; actor->lastlook = (actor->lastlook + 1) & 3)
 
-    stop = (actor->lastlook + MAXPLAYERS - 1) % MAXPLAYERS;
-    for (;; actor->lastlook = (actor->lastlook + 1) % MAXPLAYERS)
+    stop = (actor->lastlook + maxplayers - 1) % maxplayers;
+    for (;; actor->lastlook = (actor->lastlook + 1) % maxplayers)
     {
         if (!playeringame[actor->lastlook])
             continue;
@@ -1179,7 +1179,7 @@
     actor->target = NULL;
     if (deathmatch)             // Quick search for players
     {
-        for (i = 0; i < MAXPLAYERS; i++)
+        for (i = 0; i < maxplayers; i++)
         {
             if (!playeringame[i])
                 continue;
--- a/src/hexen/p_inter.c
+++ b/src/hexen/p_inter.c
@@ -747,6 +747,12 @@
         TXT_ARTIPUZZGEAR
     };
 
+    if (gamemode == shareware)
+    {
+        artifactMessages[arti_blastradius] = TXT_ARTITELEPORT;
+        artifactMessages[arti_teleport] = TXT_ARTIBLASTRADIUS;
+    }
+
     if (P_GiveArtifact(player, artifactType, artifact))
     {
         if (artifact->special)
--- a/src/hexen/p_mobj.c
+++ b/src/hexen/p_mobj.c
@@ -1190,7 +1190,7 @@
     {
         mobj->reactiontime = info->reactiontime;
     }
-    mobj->lastlook = P_Random() % MAXPLAYERS;
+    mobj->lastlook = P_Random() % maxplayers;
 
     // Set the state, but do not use P_SetMobjState, because action
     // routines can't be called yet.  If the spawnstate has an action
@@ -1295,7 +1295,7 @@
     fixed_t x, y, z;
     mobj_t *mobj;
 
-    if (mthing->type - 1 >= MAXPLAYERS || !playeringame[mthing->type - 1])
+    if (mthing->type - 1 >= maxplayers || !playeringame[mthing->type - 1])
     {                           // Not playing
         return;
     }
@@ -1500,7 +1500,7 @@
     else if (deathmatch == false)
     {                           // Cooperative
         spawnMask = 0;
-        for (i = 0; i < MAXPLAYERS; i++)
+        for (i = 0; i < maxplayers; i++)
         {
             if (playeringame[i])
             {
--- a/src/hexen/p_setup.c
+++ b/src/hexen/p_setup.c
@@ -387,7 +387,7 @@
         return;
     }
     playerCount = 0;
-    for (i = 0; i < MAXPLAYERS; i++)
+    for (i = 0; i < maxplayers; i++)
     {
         playerCount += playeringame[i];
     }
@@ -672,7 +672,7 @@
     int lumpnum;
     mobj_t *mobj;
 
-    for (i = 0; i < MAXPLAYERS; i++)
+    for (i = 0; i < maxplayers; i++)
     {
         players[i].killcount = players[i].secretcount
             = players[i].itemcount = 0;
@@ -722,7 +722,7 @@
     TimerGame = 0;
     if (deathmatch)
     {
-        for (i = 0; i < MAXPLAYERS; i++)
+        for (i = 0; i < maxplayers; i++)
         {
             if (playeringame[i])
             {                   // must give a player spot before deathmatchspawn
@@ -796,9 +796,15 @@
     int mcmdValue;
     mapInfo_t *info;
     char songMulch[10];
+    char *default_sky_name = DEFAULT_SKY_NAME;
 
     mapMax = 1;
 
+    if (gamemode == shareware)
+    {
+	default_sky_name = "SKY2";
+    }
+
     // Put defaults into MapInfo[0]
     info = MapInfo;
     info->cluster = 0;
@@ -805,7 +811,7 @@
     info->warpTrans = 0;
     info->nextMap = 1;          // Always go to map 1 if not specified
     info->cdTrack = 1;
-    info->sky1Texture = R_TextureNumForName(DEFAULT_SKY_NAME);
+    info->sky1Texture = R_TextureNumForName(default_sky_name);
     info->sky2Texture = info->sky1Texture;
     info->sky1ScrollDelta = 0;
     info->sky2ScrollDelta = 0;
--- a/src/hexen/p_switch.c
+++ b/src/hexen/p_switch.c
@@ -25,9 +25,16 @@
 //      CHANGE THE TEXTURE OF A WALL SWITCH TO ITS OPPOSITE
 //
 //==================================================================
-switchlist_t alphSwitchList[] = {
+switchlist_t alphSwitchListDemo[] = {
     {"SW_1_UP", "SW_1_DN", SFX_SWITCH1},
     {"SW_2_UP", "SW_2_DN", SFX_SWITCH1},
+    {"SW52_OFF", "SW52_ON", SFX_SWITCH2},
+    {"\0", "\0", 0}
+};
+
+switchlist_t alphSwitchListFull[] = {
+    {"SW_1_UP", "SW_1_DN", SFX_SWITCH1},
+    {"SW_2_UP", "SW_2_DN", SFX_SWITCH1},
     {"VALVE1", "VALVE2", SFX_VALVE_TURN},
     {"SW51_OFF", "SW51_ON", SFX_SWITCH2},
     {"SW52_OFF", "SW52_ON", SFX_SWITCH2},
@@ -39,6 +46,8 @@
     {"\0", "\0", 0}
 };
 
+switchlist_t *alphSwitchList = NULL;
+
 int switchlist[MAXSWITCHES * 2];
 int numswitches;
 button_t buttonlist[MAXBUTTONS];
@@ -57,6 +66,18 @@
 {
     int i;
     int index;
+
+    if (!alphSwitchList)
+    {
+        if (gamemode == shareware)
+        {
+            alphSwitchList = alphSwitchListDemo;
+        }
+        else
+        {
+            alphSwitchList = alphSwitchListFull;
+        }
+    }
 
     for (index = 0, i = 0; i < MAXSWITCHES; i++)
     {
--- a/src/hexen/p_tick.c
+++ b/src/hexen/p_tick.c
@@ -58,7 +58,7 @@
     {
         return;
     }
-    for (i = 0; i < MAXPLAYERS; i++)
+    for (i = 0; i < maxplayers; i++)
     {
         if (playeringame[i])
         {
--- a/src/hexen/p_user.c
+++ b/src/hexen/p_user.c
@@ -480,7 +480,7 @@
 {
     int i;
 
-    for (i = 0; i < MAXPLAYERS; i++)
+    for (i = 0; i < maxplayers; i++)
     {
         if (player == &players[i])
         {
@@ -1017,7 +1017,7 @@
     fixed_t destX, destY;
     angle_t destAngle;
 
-    for (i = 0; i < MAXPLAYERS; i++)
+    for (i = 0; i < maxplayers; i++)
     {
         if (!playeringame[i])
             continue;
--- a/src/hexen/r_draw.c
+++ b/src/hexen/r_draw.c
@@ -320,9 +320,9 @@
     V_LoadTintTable();
 
     // Allocate translation tables
-    translationtables = Z_Malloc(256 * 3 * (MAXPLAYERS - 1), PU_STATIC, 0);
+    translationtables = Z_Malloc(256 * 3 * (maxplayers - 1), PU_STATIC, 0);
 
-    for (i = 0; i < 3 * (MAXPLAYERS - 1); i++)
+    for (i = 0; i < 3 * (maxplayers - 1); i++)
     {
         lumpnum = W_GetNumForName("trantbl0") + i;
         transLump = W_CacheLumpNum(lumpnum, PU_STATIC);
--- a/src/hexen/r_things.c
+++ b/src/hexen/r_things.c
@@ -388,7 +388,7 @@
         {
             colfunc = R_DrawTranslatedTLColumn;
             dc_translation = translationtables - 256
-                + vis->class * ((MAXPLAYERS - 1) * 256) +
+                + vis->class * ((maxplayers - 1) * 256) +
                 ((vis->mobjflags & MF_TRANSLATION) >> (MF_TRANSSHIFT - 8));
         }
         else if (vis->mobjflags & MF_SHADOW)
@@ -405,7 +405,7 @@
         // Draw using translated column function
         colfunc = R_DrawTranslatedColumn;
         dc_translation = translationtables - 256
-            + vis->class * ((MAXPLAYERS - 1) * 256) +
+            + vis->class * ((maxplayers - 1) * 256) +
             ((vis->mobjflags & MF_TRANSLATION) >> (MF_TRANSSHIFT - 8));
     }
 
--- a/src/hexen/sb_bar.c
+++ b/src/hexen/sb_bar.c
@@ -303,6 +303,34 @@
         PatchKILLS = W_CacheLumpName("KILLS", PU_STATIC);
     }
     SB_SetClassData();
+
+    if (gamemode == shareware)
+    {
+	CheatGodSeq = (cheatseq_t) CHEAT("bgokey", 0);
+	CheatNoClipSeq = (cheatseq_t) CHEAT("rjohnson", 0);
+	CheatWeaponsSeq = (cheatseq_t) CHEAT("crhinehart", 0);
+	CheatHealthSeq =  (cheatseq_t) CHEAT("sgurno", 0);
+	CheatKeysSeq = (cheatseq_t) CHEAT("mraymondjudy", 0);
+	CheatSoundSeq = (cheatseq_t) CHEAT("kschilder", 0);
+	CheatTickerSeq = (cheatseq_t) CHEAT("rrettenmund", 0);
+	CheatArtifactAllSeq = (cheatseq_t) CHEAT("braffel", 0);
+	CheatPuzzleSeq = (cheatseq_t) CHEAT("tmoore", 0);
+	CheatWarpSeq = (cheatseq_t) CHEAT("bpelletier", 2);
+	CheatPigSeq = (cheatseq_t) CHEAT("ebiessman", 0);
+	CheatMassacreSeq = (cheatseq_t) CHEAT("cstika", 0);
+	CheatIDKFASeq = (cheatseq_t) CHEAT("rambo", 0);
+	CheatQuickenSeq1 = (cheatseq_t) CHEAT("quicken", 0);
+	CheatQuickenSeq2 = (cheatseq_t) CHEAT("quickenquicken", 0);
+	CheatQuickenSeq3 = (cheatseq_t) CHEAT("quickenquickenquicken", 0);
+	CheatClass1Seq = (cheatseq_t) CHEAT("plipo", 0);
+	CheatClass2Seq = (cheatseq_t) CHEAT("plipo", 1);
+	CheatVersionSeq = (cheatseq_t) CHEAT("pmacarther", 0);
+	CheatDebugSeq = (cheatseq_t) CHEAT("jsumwalt", 0);
+	CheatScriptSeq1 = (cheatseq_t) CHEAT("mwagabaza", 0);
+	CheatScriptSeq2 = (cheatseq_t) CHEAT("mwagabaza", 1);
+	CheatScriptSeq3 = (cheatseq_t) CHEAT("mwagabaza", 2);
+	CheatRevealSeq = (cheatseq_t) CHEAT("reveal", 0);
+    }
 }
 
 //==========================================================================
@@ -330,12 +358,12 @@
     if (!netgame)
     {                           // single player game uses red life gem (the second gem)
         PatchLIFEGEM = W_CacheLumpNum(W_GetNumForName("lifegem")
-                                      + MAXPLAYERS * class + 1, PU_STATIC);
+                                      + maxplayers * class + 1, PU_STATIC);
     }
     else
     {
         PatchLIFEGEM = W_CacheLumpNum(W_GetNumForName("lifegem")
-                                      + MAXPLAYERS * class + consoleplayer,
+                                      + maxplayers * class + consoleplayer,
                                       PU_STATIC);
     }
     SB_state = -1;
@@ -1024,7 +1052,7 @@
     if (deathmatch)
     {
         temp = 0;
-        for (i = 0; i < MAXPLAYERS; i++)
+        for (i = 0; i < maxplayers; i++)
         {
             temp += CPlayer->frags[i];
         }
@@ -1351,7 +1379,7 @@
     if (deathmatch)
     {
         temp = 0;
-        for (i = 0; i < MAXPLAYERS; i++)
+        for (i = 0; i < maxplayers; i++)
         {
             if (playeringame[i])
             {
--- a/src/hexen/sv_save.c
+++ b/src/hexen/sv_save.c
@@ -416,7 +416,7 @@
     str->pieces = GET_LONG;
 
     // signed int frags[MAXPLAYERS];
-    for (i=0; i<MAXPLAYERS; ++i)
+    for (i=0; i<maxplayers; ++i)
     {
         str->frags[i] = GET_LONG;
     }
@@ -585,7 +585,7 @@
     StreamOutLong(str->pieces);
 
     // signed int frags[MAXPLAYERS];
-    for (i=0; i<MAXPLAYERS; ++i)
+    for (i=0; i<maxplayers; ++i)
     {
         StreamOutLong(str->frags[i]);
     }
@@ -2081,7 +2081,7 @@
     Z_Free(SaveBuffer);
 
     // Save player structs
-    for (i = 0; i < MAXPLAYERS; i++)
+    for (i = 0; i < maxplayers; i++)
     {
         playerBackup[i] = players[i];
     }
@@ -2095,7 +2095,7 @@
     // Restore player structs
     inv_ptr = 0;
     curpos = 0;
-    for (i = 0; i < MAXPLAYERS; i++)
+    for (i = 0; i < maxplayers; i++)
     {
         mobj = players[i].mo;
         players[i] = playerBackup[i];
@@ -2170,7 +2170,7 @@
     // Store player structs for later
     rClass = randomclass;
     randomclass = false;
-    for (i = 0; i < MAXPLAYERS; i++)
+    for (i = 0; i < maxplayers; i++)
     {
         playerBackup[i] = players[i];
     }
@@ -2194,7 +2194,7 @@
         G_InitNew(gameskill, gameepisode, gamemap);
 
         // Destroy all freshly spawned players
-        for (i = 0; i < MAXPLAYERS; i++)
+        for (i = 0; i < maxplayers; i++)
         {
             if (playeringame[i])
             {
@@ -2205,7 +2205,7 @@
 
     // Restore player structs
     targetPlayerMobj = NULL;
-    for (i = 0; i < MAXPLAYERS; i++)
+    for (i = 0; i < maxplayers; i++)
     {
         if (!playeringame[i])
         {
@@ -2286,7 +2286,7 @@
     }
 
     // Destroy all things touching players
-    for (i = 0; i < MAXPLAYERS; i++)
+    for (i = 0; i < maxplayers; i++)
     {
         if (playeringame[i])
         {
@@ -2403,11 +2403,11 @@
     int i;
 
     StreamOutLong(ASEG_PLAYERS);
-    for (i = 0; i < MAXPLAYERS; i++)
+    for (i = 0; i < maxplayers; i++)
     {
         StreamOutByte(playeringame[i]);
     }
-    for (i = 0; i < MAXPLAYERS; i++)
+    for (i = 0; i < maxplayers; i++)
     {
         if (!playeringame[i])
         {
@@ -2429,11 +2429,11 @@
     int i;
 
     AssertSegment(ASEG_PLAYERS);
-    for (i = 0; i < MAXPLAYERS; i++)
+    for (i = 0; i < maxplayers; i++)
     {
         playeringame[i] = GET_BYTE;
     }
-    for (i = 0; i < MAXPLAYERS; i++)
+    for (i = 0; i < maxplayers; i++)
     {
         if (!playeringame[i])
         {
@@ -2968,7 +2968,7 @@
     int ix;
 
     StreamOutLong(ASEG_MISC);
-    for (ix = 0; ix < MAXPLAYERS; ix++)
+    for (ix = 0; ix < maxplayers; ix++)
     {
         StreamOutLong(localQuakeHappening[ix]);
     }
@@ -2985,7 +2985,7 @@
     int ix;
 
     AssertSegment(ASEG_MISC);
-    for (ix = 0; ix < MAXPLAYERS; ix++)
+    for (ix = 0; ix < maxplayers; ix++)
     {
         localQuakeHappening[ix] = GET_LONG;
     }