From ad816c1bc28ab81ddb892ff878f65969bddd9764 Mon Sep 17 00:00:00 2001 From: Fabian Greffrath Date: Tue, 20 Jan 2015 06:53:45 +0100 Subject: First shot at support for the Hexen 4-level Demo With these changes it is possible to run the game using the HEXEN.WAD IWAD from the 4-level Demo and start a new game as one of the three player classes. Known missing bits: - The game does not yet identify itself as the demo version - The cheat codes are still unchanged - Bug compatibility, see e.g. http://dengine.net/dew/index.php?title=Libhexen --- src/hexen/g_game.c | 6 ++++++ src/hexen/p_setup.c | 12 +++++++++++- src/hexen/p_switch.c | 7 +++++++ src/hexen/sb_bar.c | 5 +++-- 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/hexen/g_game.c b/src/hexen/g_game.c index 6d10dcfd..4dcd3bd9 100644 --- a/src/hexen/g_game.c +++ b/src/hexen/g_game.c @@ -1467,6 +1467,12 @@ void G_SecretExitLevel (void) void G_Completed(int map, int position) { + if (gamemode == shareware && map > 4) + { + P_SetMessage(&players[consoleplayer], "access denied -- demo", true); + return; + } + gameaction = ga_completed; LeaveMap = map; LeavePosition = position; diff --git a/src/hexen/p_setup.c b/src/hexen/p_setup.c index 1ff6cef5..db9af228 100644 --- a/src/hexen/p_setup.c +++ b/src/hexen/p_setup.c @@ -796,16 +796,26 @@ static void InitMapInfo(void) int mcmdValue; mapInfo_t *info; char songMulch[10]; + char *default_sky_name = DEFAULT_SKY_NAME; mapMax = 1; + // The Hexen Shareware, ne 4-level Demo, is missing the SKY1 lump + // and uses the SKY2 lump instead. Let's use this fact to identify + // it and set gamemode accordingly + if (W_CheckNumForName(default_sky_name) == -1) + { + default_sky_name = "SKY2"; + gamemode = shareware; + } + // Put defaults into MapInfo[0] info = MapInfo; info->cluster = 0; 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; diff --git a/src/hexen/p_switch.c b/src/hexen/p_switch.c index 9d86f92a..92bd0be4 100644 --- a/src/hexen/p_switch.c +++ b/src/hexen/p_switch.c @@ -66,6 +66,13 @@ void P_InitSwitchList(void) switchlist[index] = -1; break; } + + if (R_CheckTextureNumForName(alphSwitchList[i].name1) == -1 && + gamemode == shareware) + { + continue; + } + switchlist[index++] = R_TextureNumForName(alphSwitchList[i].name1); switchlist[index++] = R_TextureNumForName(alphSwitchList[i].name2); } diff --git a/src/hexen/sb_bar.c b/src/hexen/sb_bar.c index bcc5b675..e75edd25 100644 --- a/src/hexen/sb_bar.c +++ b/src/hexen/sb_bar.c @@ -314,6 +314,7 @@ void SB_Init(void) void SB_SetClassData(void) { int class; + int maxplayers = (gamemode == shareware) ? 4 : MAXPLAYERS; class = PlayerClass[consoleplayer]; // original player class (not pig) PatchWEAPONSLOT = W_CacheLumpNum(W_GetNumForName("wpslot0") @@ -330,12 +331,12 @@ void SB_SetClassData(void) 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; -- cgit v1.2.3 From be1a900c9fd873168e82da2efad9f2febc9edcc8 Mon Sep 17 00:00:00 2001 From: Fabian Greffrath Date: Mon, 2 Feb 2015 08:03:18 +0100 Subject: set the max_players limit in network games to 4 in shareware mode --- src/hexen/d_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hexen/d_net.c b/src/hexen/d_net.c index 5bd0eed0..6dd0b74d 100644 --- a/src/hexen/d_net.c +++ b/src/hexen/d_net.c @@ -172,7 +172,7 @@ static void InitConnectData(net_connect_data_t *connect_data) connect_data->lowres_turn = false; connect_data->drone = false; - connect_data->max_players = MAXPLAYERS; + connect_data->max_players = (gamemode == shareware) ? 4 : MAXPLAYERS; //! // @category net -- cgit v1.2.3 From 73c2a3bb31ceaad24ac11bbb8c93c2d76291d418 Mon Sep 17 00:00:00 2001 From: Fabian Greffrath Date: Mon, 2 Feb 2015 09:35:41 +0100 Subject: adapt cheat codes for the demo version --- src/hexen/sb_bar.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/hexen/sb_bar.c b/src/hexen/sb_bar.c index e75edd25..6ca8fec4 100644 --- a/src/hexen/sb_bar.c +++ b/src/hexen/sb_bar.c @@ -303,6 +303,34 @@ void SB_Init(void) 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); + } } //========================================================================== -- cgit v1.2.3 From 50cc0ee15d2db46ee12460ece957b33bb0a10b7f Mon Sep 17 00:00:00 2001 From: Fabian Greffrath Date: Mon, 2 Feb 2015 09:58:30 +0100 Subject: currently, no separate startup banner for the demo version :( --- src/hexen/h2_main.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/hexen/h2_main.c b/src/hexen/h2_main.c index 23131e9b..185a6d70 100644 --- a/src/hexen/h2_main.c +++ b/src/hexen/h2_main.c @@ -335,6 +335,16 @@ void D_DoomMain(void) HandleArgs(); + // The 4 Level Demo Version prints a four-lined banner here + // (and indeed waits for a keypress): + /* +Hexen: Beyond Heretic + +4 Level Demo Version +Press any key to continue. + */ + // However, we currently only detect if we are running the 4 Level Demo Version + // at all much later in P_Init(). I_PrintStartupBanner("Hexen"); ST_Message("MN_Init: Init menu system.\n"); -- cgit v1.2.3 From 006e890f57abda5615a76ae5525a4614425b3227 Mon Sep 17 00:00:00 2001 From: Fabian Greffrath Date: Fri, 13 Feb 2015 11:26:56 +0100 Subject: Identify the "shareware" version early on. Following the concept of Chocolate Doom, D_IdentifyVersion and D_SetGameDescription are introduced and called right after loading the IWAD. The first one checks for the characteristics of the "shareware" IWAD and sets gamemode accordingly, whereas the latter sets the gamedescription string according to gamemode. This string is then used in I_PrintStartupBanner() and I_SetWindowTitle(). So, the "shareware" version identifies itself properly now. I consider support for the 4 Level Hexen Demo pretty complete by now. --- src/hexen/h2_main.c | 56 +++++++++++++++++++++++++++++++++++++++++------------ src/hexen/p_setup.c | 6 +----- 2 files changed, 45 insertions(+), 17 deletions(-) diff --git a/src/hexen/h2_main.c b/src/hexen/h2_main.c index 185a6d70..62cd3d38 100644 --- a/src/hexen/h2_main.c +++ b/src/hexen/h2_main.c @@ -93,6 +93,7 @@ extern boolean askforquit; // PUBLIC DATA DEFINITIONS ------------------------------------------------- GameMode_t gamemode; +char *gamedescription; char *iwadfile; static char demolumpname[9]; // Demo lump to start playing. boolean nomonsters; // checkparm of -nomonsters @@ -252,6 +253,45 @@ static void D_AddFile(char *filename) 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; + } +} + +// 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 @@ -331,21 +371,13 @@ void D_DoomMain(void) D_AddFile(iwadfile); W_CheckCorrectIWAD(hexen); + D_IdentifyVersion(); + D_SetGameDescription(); AdjustForMacIWAD(); HandleArgs(); - // The 4 Level Demo Version prints a four-lined banner here - // (and indeed waits for a keypress): - /* -Hexen: Beyond Heretic - -4 Level Demo Version -Press any key to continue. - */ - // However, we currently only detect if we are running the 4 Level Demo Version - // at all much later in P_Init(). - I_PrintStartupBanner("Hexen"); + I_PrintStartupBanner(gamedescription); ST_Message("MN_Init: Init menu system.\n"); MN_Init(); @@ -673,7 +705,7 @@ void H2_GameLoop(void) 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(); diff --git a/src/hexen/p_setup.c b/src/hexen/p_setup.c index db9af228..428e6166 100644 --- a/src/hexen/p_setup.c +++ b/src/hexen/p_setup.c @@ -800,13 +800,9 @@ static void InitMapInfo(void) mapMax = 1; - // The Hexen Shareware, ne 4-level Demo, is missing the SKY1 lump - // and uses the SKY2 lump instead. Let's use this fact to identify - // it and set gamemode accordingly - if (W_CheckNumForName(default_sky_name) == -1) + if (gamemode == shareware) { default_sky_name = "SKY2"; - gamemode = shareware; } // Put defaults into MapInfo[0] -- cgit v1.2.3 From bfd396ee4184265e11b27c9e87d45c28a713d90c Mon Sep 17 00:00:00 2001 From: Fabian Greffrath Date: Thu, 19 Feb 2015 18:35:40 +0100 Subject: Apparently, the Hexen font only has upper-case chcracters --- src/hexen/g_game.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hexen/g_game.c b/src/hexen/g_game.c index 4df4cb86..d6a73678 100644 --- a/src/hexen/g_game.c +++ b/src/hexen/g_game.c @@ -1473,7 +1473,7 @@ void G_Completed(int map, int position) { if (gamemode == shareware && map > 4) { - P_SetMessage(&players[consoleplayer], "access denied -- demo", true); + P_SetMessage(&players[consoleplayer], "ACCESS DENIED -- DEMO", true); return; } -- cgit v1.2.3 From 909a779a0d54ff91b01fad2cc17a0263ba5419ad Mon Sep 17 00:00:00 2001 From: Fabian Greffrath Date: Mon, 23 Feb 2015 17:39:03 +0100 Subject: Switch pick-up messages for Chaos Device and Disc of Repulsion For bug compatibility with the original 4-level Demo. Confirmed on map04 with the Demo version with the following md5sums: 458d3ff08d32fc50abb55a5b68660b6b HEXEN.EXE 876a5a44c7b68f04b3bb9bc7a5bd69d6 HEXEN.WAD --- src/hexen/p_inter.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/hexen/p_inter.c b/src/hexen/p_inter.c index 587614ff..4f1ecda8 100644 --- a/src/hexen/p_inter.c +++ b/src/hexen/p_inter.c @@ -747,6 +747,12 @@ static void TryPickupArtifact(player_t * player, artitype_t artifactType, TXT_ARTIPUZZGEAR }; + if (gamemode == shareware) + { + artifactMessages[arti_blastradius] = TXT_ARTITELEPORT; + artifactMessages[arti_teleport] = TXT_ARTIBLASTRADIUS; + } + if (P_GiveArtifact(player, artifactType, artifact)) { if (artifact->special) -- cgit v1.2.3 From 19659f3eab0614465577ac71731b4bdce67ce30c Mon Sep 17 00:00:00 2001 From: Fabian Greffrath Date: Mon, 23 Mar 2015 12:12:08 +0100 Subject: maintain an explicit switch list for the demo version instead of interating through the list for the full version and letting missing texture lumps slip through. --- src/hexen/p_switch.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/src/hexen/p_switch.c b/src/hexen/p_switch.c index 92bd0be4..a90269a7 100644 --- a/src/hexen/p_switch.c +++ b/src/hexen/p_switch.c @@ -25,7 +25,14 @@ // 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}, @@ -39,6 +46,8 @@ switchlist_t alphSwitchList[] = { {"\0", "\0", 0} }; +switchlist_t *alphSwitchList = NULL; + int switchlist[MAXSWITCHES * 2]; int numswitches; button_t buttonlist[MAXBUTTONS]; @@ -58,6 +67,18 @@ void P_InitSwitchList(void) int i; int index; + if (!alphSwitchList) + { + if (gamemode == shareware) + { + alphSwitchList = alphSwitchListDemo; + } + else + { + alphSwitchList = alphSwitchListFull; + } + } + for (index = 0, i = 0; i < MAXSWITCHES; i++) { if (!alphSwitchList[i].soundID) @@ -66,13 +87,6 @@ void P_InitSwitchList(void) switchlist[index] = -1; break; } - - if (R_CheckTextureNumForName(alphSwitchList[i].name1) == -1 && - gamemode == shareware) - { - continue; - } - switchlist[index++] = R_TextureNumForName(alphSwitchList[i].name1); switchlist[index++] = R_TextureNumForName(alphSwitchList[i].name2); } -- cgit v1.2.3 From 350ac122030d198b187255b19b2519ef8267364a Mon Sep 17 00:00:00 2001 From: Fabian Greffrath Date: Mon, 23 Mar 2015 12:12:38 +0100 Subject: play sound when trying to enter a forbidden map in the demo version --- src/hexen/g_game.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/hexen/g_game.c b/src/hexen/g_game.c index d6a73678..04e0e5af 100644 --- a/src/hexen/g_game.c +++ b/src/hexen/g_game.c @@ -1474,6 +1474,7 @@ 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; } -- cgit v1.2.3 From a64ebd8e36b6cd13f18163d0a3365f4e80d90805 Mon Sep 17 00:00:00 2001 From: Fabian Greffrath Date: Mon, 30 Mar 2015 16:34:12 +0200 Subject: Turn maxplayers into a global variable ... and decrease its value from MAXPLAYERS (i.e. 8) to 4 if (gamemode == shareware). It seems that it was hard-coded to this value until some time between the releases of the Demo and the Full version. Arrays are still declared with their full width of 8, though, they are just not iterated over the whole range anymore. This fixes playback of the IWAD demos. --- src/hexen/a_action.c | 6 +++--- src/hexen/am_map.c | 16 ++++++++-------- src/hexen/ct_chat.c | 6 +++--- src/hexen/d_net.c | 6 +++--- src/hexen/g_game.c | 26 +++++++++++++------------- src/hexen/h2_main.c | 2 ++ src/hexen/h2def.h | 1 + src/hexen/in_lude.c | 12 ++++++------ src/hexen/p_acs.c | 4 ++-- src/hexen/p_enemy.c | 6 +++--- src/hexen/p_mobj.c | 6 +++--- src/hexen/p_setup.c | 6 +++--- src/hexen/p_tick.c | 2 +- src/hexen/p_user.c | 4 ++-- src/hexen/r_draw.c | 4 ++-- src/hexen/r_things.c | 4 ++-- src/hexen/sb_bar.c | 5 ++--- src/hexen/sv_save.c | 28 ++++++++++++++-------------- 18 files changed, 73 insertions(+), 71 deletions(-) diff --git a/src/hexen/a_action.c b/src/hexen/a_action.c index c4c194e3..1923ff70 100644 --- a/src/hexen/a_action.c +++ b/src/hexen/a_action.c @@ -211,7 +211,7 @@ void A_PotteryCheck(mobj_t * actor) } else { - for (i = 0; i < MAXPLAYERS; i++) + for (i = 0; i < maxplayers; i++) { if (!playeringame[i]) { @@ -905,7 +905,7 @@ void A_Quake(mobj_t * actor) 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 @@ void A_Quake(mobj_t * actor) } else { - for (playnum = 0; playnum < MAXPLAYERS; playnum++) + for (playnum = 0; playnum < maxplayers; playnum++) { localQuakeHappening[playnum] = false; } diff --git a/src/hexen/am_map.c b/src/hexen/am_map.c index 2d082415..6a28b45c 100644 --- a/src/hexen/am_map.c +++ b/src/hexen/am_map.c @@ -292,7 +292,7 @@ void AM_initVariables(void) // 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 @@ void AM_drawPlayers(void) return; } - for (i = 0; i < MAXPLAYERS; i++) + for (i = 0; i < maxplayers; i++) { their_color++; p = &players[i]; @@ -1418,12 +1418,12 @@ void AM_DrawDeathmatchStats(void) 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,14 +1431,14 @@ void AM_DrawDeathmatchStats(void) } else { - for (j = 0; j < MAXPLAYERS; j++) + for (j = 0; j < maxplayers; j++) { if (playeringame[j]) { 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 @@ void AM_DrawDeathmatchStats(void) } 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 @@ void AM_DrawDeathmatchStats(void) } } yPosition = 15; - for (i = 0; i < MAXPLAYERS; i++) + for (i = 0; i < maxplayers; i++) { if (!playeringame[order[i]]) { diff --git a/src/hexen/ct_chat.c b/src/hexen/ct_chat.c index 4785f8b2..55934006 100644 --- a/src/hexen/ct_chat.c +++ b/src/hexen/ct_chat.c @@ -116,7 +116,7 @@ void CT_Init(void) 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 @@ void CT_Ticker(void) char c; int numplayers; - for (i = 0; i < MAXPLAYERS; i++) + for (i = 0; i < maxplayers; i++) { if (!playeringame[i]) { @@ -312,7 +312,7 @@ void CT_Ticker(void) else if (c == KEY_ENTER) { numplayers = 0; - for (j = 0; j < MAXPLAYERS; j++) + for (j = 0; j < maxplayers; j++) { numplayers += playeringame[j]; } diff --git a/src/hexen/d_net.c b/src/hexen/d_net.c index 6dd0b74d..bd0e8b21 100644 --- a/src/hexen/d_net.c +++ b/src/hexen/d_net.c @@ -76,7 +76,7 @@ static void RunTic(ticcmd_t *cmds, boolean *ingame) // 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 @@ static void LoadGameSettings(net_gamesettings_t *settings) respawnparm = settings->respawn_monsters; consoleplayer = settings->consoleplayer; - for (i=0; inum_players; PlayerClass[i] = settings->player_classes[i]; @@ -172,7 +172,7 @@ static void InitConnectData(net_connect_data_t *connect_data) connect_data->lowres_turn = false; connect_data->drone = false; - connect_data->max_players = (gamemode == shareware) ? 4 : MAXPLAYERS; + connect_data->max_players = maxplayers; //! // @category net diff --git a/src/hexen/g_game.c b/src/hexen/g_game.c index 04e0e5af..e0a7afac 100644 --- a/src/hexen/g_game.c +++ b/src/hexen/g_game.c @@ -639,7 +639,7 @@ void G_DoLoadLevel(void) 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 @@ boolean G_Responder(event_t * ev) do { displayplayer++; - if (displayplayer == MAXPLAYERS) + if (displayplayer == maxplayers) { displayplayer = 0; } @@ -899,7 +899,7 @@ void G_Ticker(void) // // 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 @@ void G_Ticker(void) //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 @@ void G_Ticker(void) // // 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 @@ void G_DoReborn(int playernum) 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 @@ -1492,7 +1492,7 @@ void G_DoCompleted(void) { return; } - for (i = 0; i < MAXPLAYERS; i++) + for (i = 0; i < maxplayers; i++) { if (playeringame[i]) { @@ -1519,7 +1519,7 @@ void G_DoCompleted(void) { return; } - for(i = 0; i < MAXPLAYERS; i++) + for(i = 0; i < maxplayers; i++) { if(playeringame[i]) { @@ -1732,7 +1732,7 @@ void G_InitNew(skill_t skill, int episode, int map) } 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; @@ -1755,7 +1755,7 @@ void G_InitNew(skill_t skill, int episode, int map) // Give one null ticcmd_t //gametic = 0; //maketic = 1; - //for (i=0 ; i> 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); diff --git a/src/hexen/p_acs.c b/src/hexen/p_acs.c index b9fd8f08..b7a63fe9 100644 --- a/src/hexen/p_acs.c +++ b/src/hexen/p_acs.c @@ -1681,7 +1681,7 @@ static int CmdEndPrintBold(void) { int i; - for (i = 0; i < MAXPLAYERS; i++) + for (i = 0; i < maxplayers; i++) { if (playeringame[i]) { @@ -1722,7 +1722,7 @@ static int CmdPlayerCount(void) int count; count = 0; - for (i = 0; i < MAXPLAYERS; i++) + for (i = 0; i < maxplayers; i++) { count += playeringame[i]; } diff --git a/src/hexen/p_enemy.c b/src/hexen/p_enemy.c index 18cc79eb..dc2c9fe5 100644 --- a/src/hexen/p_enemy.c +++ b/src/hexen/p_enemy.c @@ -546,8 +546,8 @@ boolean P_LookForPlayers(mobj_t * actor, boolean allaround) // 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 @@ void A_MinotaurLook(mobj_t * actor) 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; diff --git a/src/hexen/p_mobj.c b/src/hexen/p_mobj.c index 98f81984..b868da8c 100644 --- a/src/hexen/p_mobj.c +++ b/src/hexen/p_mobj.c @@ -1190,7 +1190,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) { 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 @@ void P_SpawnPlayer(mapthing_t * mthing) 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 @@ void P_SpawnMapThing(mapthing_t * mthing) else if (deathmatch == false) { // Cooperative spawnMask = 0; - for (i = 0; i < MAXPLAYERS; i++) + for (i = 0; i < maxplayers; i++) { if (playeringame[i]) { diff --git a/src/hexen/p_setup.c b/src/hexen/p_setup.c index 428e6166..f24fb34e 100644 --- a/src/hexen/p_setup.c +++ b/src/hexen/p_setup.c @@ -387,7 +387,7 @@ void P_LoadThings(int lump) return; } playerCount = 0; - for (i = 0; i < MAXPLAYERS; i++) + for (i = 0; i < maxplayers; i++) { playerCount += playeringame[i]; } @@ -672,7 +672,7 @@ void P_SetupLevel(int episode, int map, int playermask, skill_t skill) 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 @@ void P_SetupLevel(int episode, int map, int playermask, skill_t skill) 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 diff --git a/src/hexen/p_tick.c b/src/hexen/p_tick.c index aac61ff8..95242ccd 100644 --- a/src/hexen/p_tick.c +++ b/src/hexen/p_tick.c @@ -58,7 +58,7 @@ void P_Ticker(void) { return; } - for (i = 0; i < MAXPLAYERS; i++) + for (i = 0; i < maxplayers; i++) { if (playeringame[i]) { diff --git a/src/hexen/p_user.c b/src/hexen/p_user.c index d24ec053..c7fa7a3f 100644 --- a/src/hexen/p_user.c +++ b/src/hexen/p_user.c @@ -480,7 +480,7 @@ int P_GetPlayerNum(player_t * player) { int i; - for (i = 0; i < MAXPLAYERS; i++) + for (i = 0; i < maxplayers; i++) { if (player == &players[i]) { @@ -1017,7 +1017,7 @@ void P_TeleportToPlayerStarts(mobj_t * victim) fixed_t destX, destY; angle_t destAngle; - for (i = 0; i < MAXPLAYERS; i++) + for (i = 0; i < maxplayers; i++) { if (!playeringame[i]) continue; diff --git a/src/hexen/r_draw.c b/src/hexen/r_draw.c index e7481934..13a0421b 100644 --- a/src/hexen/r_draw.c +++ b/src/hexen/r_draw.c @@ -320,9 +320,9 @@ void R_InitTranslationTables(void) 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); diff --git a/src/hexen/r_things.c b/src/hexen/r_things.c index aae6dc60..9d1cb6b5 100644 --- a/src/hexen/r_things.c +++ b/src/hexen/r_things.c @@ -388,7 +388,7 @@ void R_DrawVisSprite(vissprite_t * vis, int x1, int x2) { 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 @@ void R_DrawVisSprite(vissprite_t * vis, int x1, int x2) // 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)); } diff --git a/src/hexen/sb_bar.c b/src/hexen/sb_bar.c index 6ca8fec4..3846f4c6 100644 --- a/src/hexen/sb_bar.c +++ b/src/hexen/sb_bar.c @@ -342,7 +342,6 @@ void SB_Init(void) void SB_SetClassData(void) { int class; - int maxplayers = (gamemode == shareware) ? 4 : MAXPLAYERS; class = PlayerClass[consoleplayer]; // original player class (not pig) PatchWEAPONSLOT = W_CacheLumpNum(W_GetNumForName("wpslot0") @@ -1053,7 +1052,7 @@ void DrawMainBar(void) if (deathmatch) { temp = 0; - for (i = 0; i < MAXPLAYERS; i++) + for (i = 0; i < maxplayers; i++) { temp += CPlayer->frags[i]; } @@ -1380,7 +1379,7 @@ void DrawFullScreenStuff(void) if (deathmatch) { temp = 0; - for (i = 0; i < MAXPLAYERS; i++) + for (i = 0; i < maxplayers; i++) { if (playeringame[i]) { diff --git a/src/hexen/sv_save.c b/src/hexen/sv_save.c index b210ad9d..7837b837 100644 --- a/src/hexen/sv_save.c +++ b/src/hexen/sv_save.c @@ -416,7 +416,7 @@ static void StreamIn_player_t(player_t *str) str->pieces = GET_LONG; // signed int frags[MAXPLAYERS]; - for (i=0; ifrags[i] = GET_LONG; } @@ -585,7 +585,7 @@ static void StreamOut_player_t(player_t *str) StreamOutLong(str->pieces); // signed int frags[MAXPLAYERS]; - for (i=0; ifrags[i]); } @@ -2081,7 +2081,7 @@ void SV_LoadGame(int slot) 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 @@ void SV_LoadGame(int slot) // 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 @@ void SV_MapTeleport(int map, int position) // 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 @@ void SV_MapTeleport(int map, int position) 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 @@ void SV_MapTeleport(int map, int position) // Restore player structs targetPlayerMobj = NULL; - for (i = 0; i < MAXPLAYERS; i++) + for (i = 0; i < maxplayers; i++) { if (!playeringame[i]) { @@ -2286,7 +2286,7 @@ void SV_MapTeleport(int map, int position) } // Destroy all things touching players - for (i = 0; i < MAXPLAYERS; i++) + for (i = 0; i < maxplayers; i++) { if (playeringame[i]) { @@ -2403,11 +2403,11 @@ static void ArchivePlayers(void) 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 @@ static void UnarchivePlayers(void) 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 @@ static void ArchiveMisc(void) int ix; StreamOutLong(ASEG_MISC); - for (ix = 0; ix < MAXPLAYERS; ix++) + for (ix = 0; ix < maxplayers; ix++) { StreamOutLong(localQuakeHappening[ix]); } @@ -2985,7 +2985,7 @@ static void UnarchiveMisc(void) int ix; AssertSegment(ASEG_MISC); - for (ix = 0; ix < MAXPLAYERS; ix++) + for (ix = 0; ix < maxplayers; ix++) { localQuakeHappening[ix] = GET_LONG; } -- cgit v1.2.3 From e0eb95922fbda64aca169d62029a5be071e1273f Mon Sep 17 00:00:00 2001 From: Fabian Greffrath Date: Mon, 30 Mar 2015 17:01:47 +0200 Subject: The 4-Level Demo Version also has 3 Info pages --- src/hexen/mn_menu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/hexen/mn_menu.c b/src/hexen/mn_menu.c index ff573317..15170279 100644 --- a/src/hexen/mn_menu.c +++ b/src/hexen/mn_menu.c @@ -1190,11 +1190,13 @@ boolean MN_Responder(event_t * event) if (InfoType) { + /* The 4-Level Demo Version also has 3 Info pages if (gamemode == shareware) { InfoType = (InfoType + 1) % 5; } else + */ { InfoType = (InfoType + 1) % 4; } -- cgit v1.2.3