Add compatibility options to Heretic/Hexen
Includes unlimited demo support for both games, savegame buffer overrun suppression for Heretic, and CopyFile allocation fix for Hexen.
This commit is contained in:
parent
ffb988cdec
commit
52cee8eac8
11 changed files with 120 additions and 27 deletions
2
NEWS.md
2
NEWS.md
|
|
@ -52,12 +52,14 @@
|
|||
### Heretic
|
||||
* Added map names for Episode 6, fixing a crash after completing a
|
||||
level in this episode. (thanks J.Benaim)
|
||||
* Add unlimited demo/savegame support. (thanks CapnClever)
|
||||
|
||||
### Hexen
|
||||
* The MRJONES cheat code returns an identical string as vanilla, and
|
||||
enables fully reproducable builds. (thanks Fabian)
|
||||
* Fixed an issue where the game crashed while killing the
|
||||
Wraithverge in 64-bit builds. (thanks J.Benaim)
|
||||
* Add unlimited demo/savegame support. (thanks CapnClever)
|
||||
|
||||
### Strife
|
||||
* Support added for automatic loading of the IWAD from the GOG.com
|
||||
|
|
|
|||
|
|
@ -764,6 +764,8 @@ void D_BindVariables(void)
|
|||
M_BindIntVariable("music_volume", &snd_MusicVolume);
|
||||
M_BindIntVariable("screenblocks", &screenblocks);
|
||||
M_BindIntVariable("snd_channels", &snd_Channels);
|
||||
M_BindIntVariable("vanilla_savegame_limit", &vanilla_savegame_limit);
|
||||
M_BindIntVariable("vanilla_demo_limit", &vanilla_demo_limit);
|
||||
M_BindIntVariable("show_endoom", &show_endoom);
|
||||
M_BindIntVariable("graphical_startup", &graphical_startup);
|
||||
|
||||
|
|
|
|||
|
|
@ -569,6 +569,9 @@ extern boolean autostart;
|
|||
extern boolean testcontrols;
|
||||
extern int testcontrols_mousespeed;
|
||||
|
||||
extern int vanilla_savegame_limit;
|
||||
extern int vanilla_demo_limit;
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
||||
|
|
|
|||
|
|
@ -198,6 +198,8 @@ boolean *joybuttons = &joyarray[1]; // allow [-1]
|
|||
int savegameslot;
|
||||
char savedescription[32];
|
||||
|
||||
int vanilla_demo_limit = 1;
|
||||
|
||||
int inventoryTics;
|
||||
|
||||
// haleyjd: removed WATCOMC
|
||||
|
|
@ -1683,6 +1685,38 @@ void G_ReadDemoTiccmd(ticcmd_t * cmd)
|
|||
cmd->arti = (unsigned char) *demo_p++;
|
||||
}
|
||||
|
||||
// Increase the size of the demo buffer to allow unlimited demos
|
||||
|
||||
static void IncreaseDemoBuffer(void)
|
||||
{
|
||||
int current_length;
|
||||
byte *new_demobuffer;
|
||||
byte *new_demop;
|
||||
int new_length;
|
||||
|
||||
// Find the current size
|
||||
|
||||
current_length = demoend - demobuffer;
|
||||
|
||||
// Generate a new buffer twice the size
|
||||
new_length = current_length * 2;
|
||||
|
||||
new_demobuffer = Z_Malloc(new_length, PU_STATIC, 0);
|
||||
new_demop = new_demobuffer + (demo_p - demobuffer);
|
||||
|
||||
// Copy over the old data
|
||||
|
||||
memcpy(new_demobuffer, demobuffer, current_length);
|
||||
|
||||
// Free the old buffer and point the demo pointers at the new buffer.
|
||||
|
||||
Z_Free(demobuffer);
|
||||
|
||||
demobuffer = new_demobuffer;
|
||||
demo_p = new_demop;
|
||||
demoend = demobuffer + new_length;
|
||||
}
|
||||
|
||||
void G_WriteDemoTiccmd(ticcmd_t * cmd)
|
||||
{
|
||||
byte *demo_start;
|
||||
|
|
@ -1716,9 +1750,19 @@ void G_WriteDemoTiccmd(ticcmd_t * cmd)
|
|||
|
||||
if (demo_p > demoend - 16)
|
||||
{
|
||||
// no more space
|
||||
G_CheckDemoStatus();
|
||||
return;
|
||||
if (vanilla_demo_limit)
|
||||
{
|
||||
// no more space
|
||||
G_CheckDemoStatus();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Vanilla demo limit disabled: unlimited
|
||||
// demo lengths!
|
||||
|
||||
IncreaseDemoBuffer();
|
||||
}
|
||||
}
|
||||
|
||||
G_ReadDemoTiccmd(cmd); // make SURE it is exactly the same
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@
|
|||
static FILE *SaveGameFP;
|
||||
static byte *savebuffer, *save_p;
|
||||
|
||||
int vanilla_savegame_limit = 1;
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
|
@ -82,7 +84,7 @@ void SV_Close(char *fileName)
|
|||
|
||||
// Enforce the same savegame size limit as in Vanilla Heretic
|
||||
|
||||
if (ftell(SaveGameFP) > SAVEGAMESIZE)
|
||||
if (vanilla_savegame_limit && ftell(SaveGameFP) > SAVEGAMESIZE)
|
||||
{
|
||||
I_Error("Savegame buffer overrun");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -165,6 +165,8 @@ boolean *joybuttons = &joyarray[1]; // allow [-1]
|
|||
int savegameslot;
|
||||
char savedescription[32];
|
||||
|
||||
int vanilla_demo_limit = 1;
|
||||
|
||||
int inventoryTics;
|
||||
|
||||
// haleyjd: removed externdriver crap
|
||||
|
|
@ -1842,6 +1844,38 @@ void G_ReadDemoTiccmd(ticcmd_t * cmd)
|
|||
cmd->arti = (unsigned char) *demo_p++;
|
||||
}
|
||||
|
||||
// Increase the size of the demo buffer to allow unlimited demos
|
||||
|
||||
static void IncreaseDemoBuffer(void)
|
||||
{
|
||||
int current_length;
|
||||
byte *new_demobuffer;
|
||||
byte *new_demop;
|
||||
int new_length;
|
||||
|
||||
// Find the current size
|
||||
|
||||
current_length = demoend - demobuffer;
|
||||
|
||||
// Generate a new buffer twice the size
|
||||
new_length = current_length * 2;
|
||||
|
||||
new_demobuffer = Z_Malloc(new_length, PU_STATIC, 0);
|
||||
new_demop = new_demobuffer + (demo_p - demobuffer);
|
||||
|
||||
// Copy over the old data
|
||||
|
||||
memcpy(new_demobuffer, demobuffer, current_length);
|
||||
|
||||
// Free the old buffer and point the demo pointers at the new buffer.
|
||||
|
||||
Z_Free(demobuffer);
|
||||
|
||||
demobuffer = new_demobuffer;
|
||||
demo_p = new_demop;
|
||||
demoend = demobuffer + new_length;
|
||||
}
|
||||
|
||||
void G_WriteDemoTiccmd(ticcmd_t * cmd)
|
||||
{
|
||||
byte *demo_start;
|
||||
|
|
@ -1875,9 +1909,19 @@ void G_WriteDemoTiccmd(ticcmd_t * cmd)
|
|||
|
||||
if (demo_p > demoend - 16)
|
||||
{
|
||||
// no more space
|
||||
G_CheckDemoStatus();
|
||||
return;
|
||||
if (vanilla_demo_limit)
|
||||
{
|
||||
// no more space
|
||||
G_CheckDemoStatus();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Vanilla demo limit disabled: unlimited
|
||||
// demo lengths!
|
||||
|
||||
IncreaseDemoBuffer();
|
||||
}
|
||||
}
|
||||
|
||||
G_ReadDemoTiccmd(cmd); // make SURE it is exactly the same
|
||||
|
|
|
|||
|
|
@ -161,6 +161,8 @@ void D_BindVariables(void)
|
|||
M_BindIntVariable("messageson", &messageson);
|
||||
M_BindIntVariable("screenblocks", &screenblocks);
|
||||
M_BindIntVariable("snd_channels", &snd_Channels);
|
||||
M_BindIntVariable("vanilla_savegame_limit", &vanilla_savegame_limit);
|
||||
M_BindIntVariable("vanilla_demo_limit", &vanilla_demo_limit);
|
||||
|
||||
M_BindStringVariable("savedir", &SavePath);
|
||||
|
||||
|
|
|
|||
|
|
@ -682,6 +682,9 @@ extern boolean autostart;
|
|||
extern boolean testcontrols;
|
||||
extern int testcontrols_mousespeed;
|
||||
|
||||
extern int vanilla_savegame_limit;
|
||||
extern int vanilla_demo_limit;
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
||||
|
|
|
|||
|
|
@ -142,6 +142,8 @@ static void SV_WritePtr(void *ptr);
|
|||
|
||||
char *SavePath = DEFAULT_SAVEPATH;
|
||||
|
||||
int vanilla_savegame_limit = 1;
|
||||
|
||||
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
||||
|
||||
static int MobjCount;
|
||||
|
|
@ -3270,8 +3272,11 @@ static void CopyFile(char *source_name, char *dest_name)
|
|||
// in memory: Chocolate Hexen should force an allocation error here
|
||||
// whenever it's appropriate.
|
||||
|
||||
buffer = Z_Malloc(file_length, PU_STATIC, NULL);
|
||||
Z_Free(buffer);
|
||||
if (vanilla_savegame_limit)
|
||||
{
|
||||
buffer = Z_Malloc(file_length, PU_STATIC, NULL);
|
||||
Z_Free(buffer);
|
||||
}
|
||||
|
||||
write_handle = fopen(dest_name, "wb");
|
||||
if (write_handle == NULL)
|
||||
|
|
|
|||
|
|
@ -45,10 +45,7 @@ void CompatibilitySettings(void)
|
|||
|
||||
void BindCompatibilityVariables(void)
|
||||
{
|
||||
if (gamemission == doom || gamemission == strife)
|
||||
{
|
||||
M_BindIntVariable("vanilla_savegame_limit", &vanilla_savegame_limit);
|
||||
M_BindIntVariable("vanilla_demo_limit", &vanilla_demo_limit);
|
||||
}
|
||||
M_BindIntVariable("vanilla_savegame_limit", &vanilla_savegame_limit);
|
||||
M_BindIntVariable("vanilla_demo_limit", &vanilla_demo_limit);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -226,21 +226,10 @@ void MainMenu(void)
|
|||
(TxtWidgetSignalFunc) ConfigMouse, NULL),
|
||||
TXT_NewButton2("Configure Gamepad/Joystick",
|
||||
(TxtWidgetSignalFunc) ConfigJoystick, NULL),
|
||||
TXT_NewButton2("Compatibility",
|
||||
(TxtWidgetSignalFunc) CompatibilitySettings, NULL),
|
||||
NULL);
|
||||
|
||||
// The compatibility window is only appropriate for Doom/Strife.
|
||||
|
||||
if (gamemission == doom || gamemission == strife)
|
||||
{
|
||||
txt_button_t *button;
|
||||
|
||||
button = TXT_NewButton2("Compatibility",
|
||||
(TxtWidgetSignalFunc) CompatibilitySettings,
|
||||
NULL);
|
||||
|
||||
TXT_AddWidget(window, button);
|
||||
}
|
||||
|
||||
TXT_AddWidgets(window,
|
||||
GetLaunchButton(),
|
||||
TXT_NewStrut(0, 1),
|
||||
|
|
|
|||
Loading…
Reference in a new issue