From cd150bd170eb290d12de5e587dcab1cff5bd94cc Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sat, 11 Feb 2012 01:04:42 +0000 Subject: [PATCH] - Fixed: Forgot to divide the length of the SVCT chunks in ACS objects by 4 to get the actual number of scripts to set VarCount for. SVN r3352 (trunk) --- src/p_acs.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 639f70313..d24da1275 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -1529,11 +1529,11 @@ void FBehavior::LoadScriptsDirectory () } } - // Load script var counts + // Load script var counts. (Only recorded for scripts that use more than LOCAL_SIZE variables.) scripts.b = FindChunk (MAKE_ID('S','V','C','T')); if (scripts.dw != NULL) { - max = scripts.dw[1]; + max = scripts.dw[1] / 4; scripts.dw += 2; for (i = max; i > 0; --i, scripts.w += 2) { @@ -6999,6 +6999,7 @@ DLevelScript::DLevelScript (AActor *who, line_t *where, int num, const ScriptPtr new DACSThinker; script = num; + assert(code->VarCount >= code->ArgCount); numlocalvars = code->VarCount; localvars = new SDWORD[code->VarCount]; if (code->VarCount > 0)