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/p_setup.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/hexen/p_setup.c') 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; -- 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/p_setup.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src/hexen/p_setup.c') 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 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/p_setup.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/hexen/p_setup.c') 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 -- cgit v1.2.3