summaryrefslogtreecommitdiff
path: root/src/doom
diff options
context:
space:
mode:
Diffstat (limited to 'src/doom')
-rw-r--r--src/doom/d_main.c97
-rw-r--r--src/doom/d_net.c3
-rw-r--r--src/doom/doom.desktop.in7
-rw-r--r--src/doom/doomstat.c2
-rw-r--r--src/doom/g_game.c7
-rw-r--r--src/doom/m_menu.c1
-rw-r--r--src/doom/p_map.c59
-rw-r--r--src/doom/p_setup.c27
-rw-r--r--src/doom/st_stuff.c9
9 files changed, 136 insertions, 76 deletions
diff --git a/src/doom/d_main.c b/src/doom/d_main.c
index 991907fa..0e5324b4 100644
--- a/src/doom/d_main.c
+++ b/src/doom/d_main.c
@@ -532,6 +532,9 @@ void D_DoAdvanceDemo (void)
// include a DEMO4 lump, so the game bombs out with an error
// when it reaches this point in the demo sequence.
+ // However! There is an alternate version of Final Doom that
+ // includes a fixed executable.
+
if (gameversion == exe_ultimate || gameversion == exe_final)
demosequence = (demosequence+1)%7;
else
@@ -783,40 +786,6 @@ void D_SetGameDescription(void)
}
}
-static void SetSaveGameDir(char *iwad_filename)
-{
- char *sep;
- char *basefile;
-
- // Extract the base filename
-
- sep = strrchr(iwad_filename, DIR_SEPARATOR);
-
- if (sep == NULL)
- {
- basefile = iwad_filename;
- }
- else
- {
- basefile = sep + 1;
- }
-
- // ~/.chocolate-doom/savegames/
-
- savegamedir = Z_Malloc(strlen(configdir) + 30, PU_STATIC, 0);
- sprintf(savegamedir, "%ssavegames%c", configdir,
- DIR_SEPARATOR);
-
- M_MakeDirectory(savegamedir);
-
- // eg. ~/.chocolate-doom/savegames/doom2.wad/
-
- sprintf(savegamedir + strlen(savegamedir), "%s%c",
- basefile, DIR_SEPARATOR);
-
- M_MakeDirectory(savegamedir);
-}
-
// Check if the IWAD file is the Chex Quest IWAD.
// Returns true if this is chex.wad.
@@ -914,6 +883,7 @@ static struct
{"Hacx", "hacx", exe_hacx},
{"Ultimate Doom", "ultimate", exe_ultimate},
{"Final Doom", "final", exe_final},
+ {"Final Doom (alt)", "final2", exe_final2},
{"Chex Quest", "chex", exe_chex},
{ NULL, NULL, 0},
};
@@ -930,7 +900,7 @@ static void InitGameVersion(void)
// @category compat
//
// Emulate a specific version of Doom. Valid values are "1.9",
- // "ultimate" and "final".
+ // "ultimate", "final", "final2", "hacx" and "chex".
//
p = M_CheckParmWithArgs("-gameversion", 1);
@@ -994,8 +964,10 @@ static void InitGameVersion(void)
else
{
// Final Doom: tnt or plutonia
+ // Default to the "alt" version of the executable that
+ // fixes the demo loop behavior.
- gameversion = exe_final;
+ gameversion = exe_final2;
}
}
}
@@ -1034,11 +1006,37 @@ void PrintGameVersion(void)
static void LoadChexDeh(void)
{
- char *chex_deh;
+ char *chex_deh = NULL;
+ char *sep;
if (gameversion == exe_chex)
{
- chex_deh = D_FindWADByName("chex.deh");
+ // Look for chex.deh in the same directory as the IWAD file.
+
+ sep = strrchr(iwadfile, DIR_SEPARATOR);
+
+ if (sep != NULL)
+ {
+ chex_deh = malloc(strlen(iwadfile) + 9);
+ strcpy(chex_deh, iwadfile);
+ chex_deh[sep - iwadfile + 1] = '\0';
+ strcat(chex_deh, "chex.deh");
+ }
+ else
+ {
+ chex_deh = strdup("chex.deh");
+ }
+
+ // If the dehacked patch isn't found, try searching the WAD
+ // search path instead. We might find it...
+
+ if (!M_FileExists(chex_deh))
+ {
+ free(chex_deh);
+ chex_deh = D_FindWADByName("chex.deh");
+ }
+
+ // Still not found?
if (chex_deh == NULL)
{
@@ -1089,6 +1087,27 @@ static void LoadHacxDeh(void)
}
}
+// Figure out what IWAD name to use for savegames.
+
+static char *SaveGameIWADName(void)
+{
+ // Chex quest hack
+
+ if (gameversion == exe_chex)
+ {
+ return "chex.wad";
+ }
+
+ // Hacx hack
+
+ if (gameversion == exe_hacx)
+ {
+ return "hacx.wad";
+ }
+
+ return D_SaveGameIWADName(gamemission);
+}
+
//
// D_DoomMain
//
@@ -1407,7 +1426,7 @@ void D_DoomMain (void)
LoadChexDeh();
LoadHacxDeh();
D_SetGameDescription();
- SetSaveGameDir(iwadfile);
+ savegamedir = M_GetSaveGameDir(SaveGameIWADName());
// Check for -file in shareware
if (modifiedgame)
diff --git a/src/doom/d_net.c b/src/doom/d_net.c
index dd1ec563..f3155a9b 100644
--- a/src/doom/d_net.c
+++ b/src/doom/d_net.c
@@ -474,7 +474,8 @@ boolean D_InitNetGame(net_connect_data_t *connect_data,
// Start a multiplayer server, listening for connections.
//
- if (M_CheckParm("-server") > 0)
+ if (M_CheckParm("-server") > 0
+ || M_CheckParm("-privateserver") > 0)
{
NET_SV_Init();
NET_SV_AddModule(&net_loop_server_module);
diff --git a/src/doom/doom.desktop.in b/src/doom/doom.desktop.in
new file mode 100644
index 00000000..44b76e62
--- /dev/null
+++ b/src/doom/doom.desktop.in
@@ -0,0 +1,7 @@
+[Desktop Entry]
+Name=@PACKAGE_NAME@
+Exec=@PROGRAM_PREFIX@doom
+Icon=@PROGRAM_PREFIX@doom
+Type=Application
+Comment=@PACKAGE_SHORTDESC@
+Categories=Game;ActionGame;
diff --git a/src/doom/doomstat.c b/src/doom/doomstat.c
index b591358f..2bbb45e7 100644
--- a/src/doom/doomstat.c
+++ b/src/doom/doomstat.c
@@ -32,7 +32,7 @@
// Game Mode - identify IWAD as shareware, retail etc.
GameMode_t gamemode = indetermined;
GameMission_t gamemission = doom;
-GameVersion_t gameversion = exe_final;
+GameVersion_t gameversion = exe_final2;
char *gamedescription;
// Set if homebrew PWAD stuff has been added.
diff --git a/src/doom/g_game.c b/src/doom/g_game.c
index 5662d3f2..598f1c5e 100644
--- a/src/doom/g_game.c
+++ b/src/doom/g_game.c
@@ -361,6 +361,13 @@ int G_CmdChecksum (ticcmd_t* cmd)
static boolean WeaponSelectable(weapontype_t weapon)
{
+ // Can't select the super shotgun in Doom 1.
+
+ if (weapon == wp_supershotgun && gamemission == doom)
+ {
+ return false;
+ }
+
// Can't select a weapon if we don't own it.
if (!players[consoleplayer].weaponowned[weapon])
diff --git a/src/doom/m_menu.c b/src/doom/m_menu.c
index 478e7f66..4a365cfb 100644
--- a/src/doom/m_menu.c
+++ b/src/doom/m_menu.c
@@ -798,6 +798,7 @@ void M_DrawReadThis1(void)
break;
case exe_final:
+ case exe_final2:
// Final Doom always displays "HELP".
diff --git a/src/doom/p_map.c b/src/doom/p_map.c
index 78102bdf..7e92e23a 100644
--- a/src/doom/p_map.c
+++ b/src/doom/p_map.c
@@ -885,24 +885,16 @@ PTR_AimTraverse (intercept_t* in)
dist = FixedMul (attackrange, in->frac);
- // Return false if there is no back sector. This should never
- // be the case if the line is two-sided; however, some WADs
- // (eg. ottawau.wad) use this as an "impassible glass" trick
- // and rely on Vanilla Doom's (unintentional) support for this.
-
- if (li->backsector == NULL)
- {
- return false;
- }
-
- if (li->frontsector->floorheight != li->backsector->floorheight)
+ if (li->backsector == NULL
+ || li->frontsector->floorheight != li->backsector->floorheight)
{
slope = FixedDiv (openbottom - shootz , dist);
if (slope > bottomslope)
bottomslope = slope;
}
- if (li->frontsector->ceilingheight != li->backsector->ceilingheight)
+ if (li->backsector == NULL
+ || li->frontsector->ceilingheight != li->backsector->ceilingheight)
{
slope = FixedDiv (opentop - shootz , dist);
if (slope < topslope)
@@ -983,26 +975,35 @@ boolean PTR_ShootTraverse (intercept_t* in)
dist = FixedMul (attackrange, in->frac);
- // Check if backsector is NULL. See comment in PTR_AimTraverse.
+ // e6y: emulation of missed back side on two-sided lines.
+ // backsector can be NULL when emulating missing back side.
- if (li->backsector == NULL)
+ if (li->backsector == NULL)
{
- goto hitline;
- }
+ slope = FixedDiv (openbottom - shootz , dist);
+ if (slope > aimslope)
+ goto hitline;
- if (li->frontsector->floorheight != li->backsector->floorheight)
- {
- slope = FixedDiv (openbottom - shootz , dist);
- if (slope > aimslope)
- goto hitline;
- }
-
- if (li->frontsector->ceilingheight != li->backsector->ceilingheight)
- {
- slope = FixedDiv (opentop - shootz , dist);
- if (slope < aimslope)
- goto hitline;
- }
+ slope = FixedDiv (opentop - shootz , dist);
+ if (slope < aimslope)
+ goto hitline;
+ }
+ else
+ {
+ if (li->frontsector->floorheight != li->backsector->floorheight)
+ {
+ slope = FixedDiv (openbottom - shootz , dist);
+ if (slope > aimslope)
+ goto hitline;
+ }
+
+ if (li->frontsector->ceilingheight != li->backsector->ceilingheight)
+ {
+ slope = FixedDiv (opentop - shootz , dist);
+ if (slope < aimslope)
+ goto hitline;
+ }
+ }
// shot continues
return true;
diff --git a/src/doom/p_setup.c b/src/doom/p_setup.c
index 3fc95cab..58d5f462 100644
--- a/src/doom/p_setup.c
+++ b/src/doom/p_setup.c
@@ -155,7 +155,24 @@ void P_LoadVertexes (int lump)
W_ReleaseLumpNum(lump);
}
+//
+// GetSectorAtNullAddress
+//
+sector_t* GetSectorAtNullAddress(void)
+{
+ static boolean null_sector_is_initialized = false;
+ static sector_t null_sector;
+
+ if (!null_sector_is_initialized)
+ {
+ memset(&null_sector, 0, sizeof(null_sector));
+ I_GetMemoryValue(0, &null_sector.floorheight, 4);
+ I_GetMemoryValue(4, &null_sector.ceilingheight, 4);
+ null_sector_is_initialized = true;
+ }
+ return &null_sector;
+}
//
// P_LoadSegs
@@ -204,10 +221,12 @@ void P_LoadSegs (int lump)
if (sidenum < 0 || sidenum >= numsides)
{
- sidenum = 0;
+ li->backsector = GetSectorAtNullAddress();
+ }
+ else
+ {
+ li->backsector = sides[sidenum].sector;
}
-
- li->backsector = sides[sidenum].sector;
}
else
{
@@ -681,7 +700,7 @@ static void PadRejectArray(byte *array, unsigned int len)
if (len > sizeof(rejectpad))
{
fprintf(stderr, "PadRejectArray: REJECT lump too short to pad! (%i > %i)\n",
- len, sizeof(rejectpad));
+ len, (int) sizeof(rejectpad));
// Pad remaining space with 0 (or 0xff, if specified on command line).
diff --git a/src/doom/st_stuff.c b/src/doom/st_stuff.c
index 7e5e225c..8595ff50 100644
--- a/src/doom/st_stuff.c
+++ b/src/doom/st_stuff.c
@@ -525,8 +525,13 @@ ST_Responder (event_t* ev)
plyr->message = DEH_String(STSTR_MUS);
cht_GetParam(&cheat_mus, buf);
-
- if (gamemode == commercial)
+
+ // Note: The original v1.9 had a bug that tried to play back
+ // the Doom II music regardless of gamemode. This was fixed
+ // in the Ultimate Doom executable so that it would work for
+ // the Doom 1 music as well.
+
+ if (gamemode == commercial || gameversion < exe_ultimate)
{
musnum = mus_runnin + (buf[0]-'0')*10 + buf[1]-'0' - 1;