From a939f0fb48b95d9aa13af640a7f6fdc8e19bc62f Mon Sep 17 00:00:00 2001 From: terminx Date: Sun, 20 Jul 2008 03:29:00 +0000 Subject: [PATCH] CON_SCRIPTSIZE, lets mod authors manually increase the script size to whatever the mod needs, decreasing startup time due to not having to constantly reallocate memory. git-svn-id: https://svn.eduke32.com/eduke32@874 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/gamedef.c | 238 +++++++++++++++++-------------- polymer/eduke32/source/gamedef.h | 1 + 2 files changed, 128 insertions(+), 111 deletions(-) diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index ae5c65046..2fab39ba8 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -43,6 +43,8 @@ static int checking_switch = 0, current_event = -1; static int labelsonly = 0, nokeywordcheck = 0, dynamicremap = 0; static int num_braces = 0; +static int increasescriptsize(int size); + int redefined_quote_count = 0; intptr_t *aplWeaponClip[MAX_WEAPONS]; // number of items in magazine @@ -458,6 +460,7 @@ static const char *keyw[] = "savemapstate", // 326 "loadmapstate", // 327 "clearmapstate", // 328 + "scriptsize", // 329 "" }; @@ -885,10 +888,124 @@ const memberlabel_t inputlabels[]= { "", -1, 0, 0 } // END OF LIST }; +static int increasescriptsize(int size) +{ + intptr_t oscriptptr = (unsigned)(scriptptr-script); + intptr_t ocasescriptptr = (unsigned)(casescriptptr-script); + intptr_t oparsing_event = (unsigned)(parsing_event-script); + intptr_t oparsing_actor = (unsigned)(parsing_actor-script); + char *scriptptrs; + intptr_t *newscript; + intptr_t i, j; + int osize = g_ScriptSize; + + for (i=0;i= (intptr_t)(&script[0]) && (intptr_t)script[i] < (intptr_t)(&script[g_ScriptSize])) + { + scriptptrs[i] = 1; + j = (intptr_t)script[i] - (intptr_t)&script[0]; + script[i] = j; + } + else scriptptrs[i] = 0; + } + + for (i=0;i (unsigned)(g_ScriptSize-32)) - { - intptr_t oscriptptr = (unsigned)(scriptptr-script); - intptr_t ocasescriptptr = (unsigned)(casescriptptr-script); - intptr_t oparsing_event = (unsigned)(parsing_event-script); - intptr_t oparsing_actor = (unsigned)(parsing_actor-script); - char *scriptptrs; - intptr_t *newscript; - - for (i=0;i= (intptr_t)(&script[0]) && (intptr_t)script[i] < (intptr_t)(&script[g_ScriptSize])) - { - scriptptrs[i] = 1; - j = (intptr_t)script[i] - (intptr_t)&script[0]; - script[i] = j; - } - else scriptptrs[i] = 0; - } - - for (i=0;i