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/g_game.c | |
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/g_game.c')
-rw-r--r-- | src/g_game.c | 52 |
1 files changed, 47 insertions, 5 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 |