diff options
author | Simon Howard | 2006-08-31 18:13:04 +0000 |
---|---|---|
committer | Simon Howard | 2006-08-31 18:13:04 +0000 |
commit | fc15c99c8e943200e6c7da85f1046fd759514e16 (patch) | |
tree | 8e5ae52375816e8b1bdc7e6f30d1c2e8ee53a6de /src | |
parent | 7309335cd2578e6f1bc3c69590bcc7af5840da89 (diff) | |
download | chocolate-doom-fc15c99c8e943200e6c7da85f1046fd759514e16.tar.gz chocolate-doom-fc15c99c8e943200e6c7da85f1046fd759514e16.tar.bz2 chocolate-doom-fc15c99c8e943200e6c7da85f1046fd759514e16.zip |
Allow the demo size limit to be disabled through the config file.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 581
Diffstat (limited to 'src')
-rw-r--r-- | src/g_game.c | 52 | ||||
-rw-r--r-- | src/m_misc.c | 6 |
2 files changed, 51 insertions, 7 deletions
diff --git a/src/g_game.c b/src/g_game.c index e603ee63..3d20d9dc 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1,7 +1,7 @@ // Emacs style mode select -*- C++ -*- //----------------------------------------------------------------------------- // -// $Id: g_game.c 562 2006-06-21 19:08:20Z fraggle $ +// $Id: g_game.c 581 2006-08-31 18:13:04Z fraggle $ // // Copyright(C) 1993-1996 Id Software, Inc. // Copyright(C) 2005 Simon Howard @@ -134,7 +134,7 @@ static const char -rcsid[] = "$Id: g_game.c 562 2006-06-21 19:08:20Z fraggle $"; +rcsid[] = "$Id: g_game.c 581 2006-08-31 18:13:04Z fraggle $"; #include <string.h> #include <stdlib.h> @@ -343,6 +343,7 @@ mobj_t* bodyque[BODYQUESIZE]; int bodyqueslot; int vanilla_savegame_limit = 1; +int vanilla_demo_limit = 1; int G_CmdChecksum (ticcmd_t* cmd) @@ -1680,6 +1681,37 @@ void G_ReadDemoTiccmd (ticcmd_t* cmd) cmd->buttons = (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) { @@ -1712,9 +1744,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 diff --git a/src/m_misc.c b/src/m_misc.c index 899fad01..31cc5723 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -1,7 +1,7 @@ // Emacs style mode select -*- C++ -*- //----------------------------------------------------------------------------- // -// $Id: m_misc.c 535 2006-05-29 00:17:24Z fraggle $ +// $Id: m_misc.c 581 2006-08-31 18:13:04Z fraggle $ // // Copyright(C) 1993-1996 Id Software, Inc. // Copyright(C) 2005 Simon Howard @@ -106,7 +106,7 @@ //----------------------------------------------------------------------------- static const char -rcsid[] = "$Id: m_misc.c 535 2006-05-29 00:17:24Z fraggle $"; +rcsid[] = "$Id: m_misc.c 581 2006-08-31 18:13:04Z fraggle $"; #include <stdio.h> #include <stdlib.h> @@ -296,6 +296,7 @@ extern char* chat_macros[]; extern int show_endoom; extern int vanilla_savegame_limit; +extern int vanilla_demo_limit; // dos specific options: these are unused but should be maintained // so that the config file can be shared between chocolate @@ -405,6 +406,7 @@ static default_t extra_defaults_list[] = {"mouse_threshold", &mouse_threshold}, {"show_endoom", &show_endoom}, {"vanilla_savegame_limit", &vanilla_savegame_limit}, + {"vanilla_demo_limit", &vanilla_demo_limit}, #ifdef FEATURE_MULTIPLAYER {"player_name", &net_player_name, DEFAULT_STRING}, #endif |