From 15b57d4dcf5624292a7c3db9380b154947855897 Mon Sep 17 00:00:00 2001 From: terminx Date: Mon, 11 Jan 2016 05:05:13 +0000 Subject: [PATCH] Fix a few instances where bitptr wasn't properly set after writing to the compiled script git-svn-id: https://svn.eduke32.com/eduke32@5535 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/gamedef.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 386e88008..9b1b67d2e 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -2783,6 +2783,7 @@ static void C_FillEventBreakStackWithJump(intptr_t *breakPtr, intptr_t destinati { breakPtr = script + (intptr_t)breakPtr; intptr_t const tempPtr = *breakPtr; + BITPTR_CLEAR(breakPtr-script); *breakPtr = destination; breakPtr = (intptr_t *)tempPtr; } @@ -3510,9 +3511,12 @@ DO_DEFSTATE: else // if (tw == CON_APPENDEVENT) { intptr_t *previous_event_end = script + apScriptGameEventEnd[j]; + BITPTR_CLEAR(previous_event_end-script); *(previous_event_end++) = CON_JUMP | (g_lineNumber << 12); + BITPTR_CLEAR(previous_event_end-script); *(previous_event_end++) = MAXGAMEVARS; C_FillEventBreakStackWithJump((intptr_t *)*previous_event_end, g_parsingEventPtr); + BITPTR_CLEAR(previous_event_end-script); *(previous_event_end++) = g_parsingEventPtr; } @@ -5778,9 +5782,13 @@ repeatcase: if (previous_event) { g_scriptPtr--; + BITPTR_CLEAR(g_scriptPtr-script); *(g_scriptPtr++) = CON_JUMP | (g_lineNumber << 12); + BITPTR_CLEAR(g_scriptPtr-script); *(g_scriptPtr++) = MAXGAMEVARS; + BITPTR_CLEAR(g_scriptPtr-script); *(g_scriptPtr++) = previous_event; + BITPTR_CLEAR(g_scriptPtr-script); *(g_scriptPtr++) = CON_ENDEVENT | (g_lineNumber << 12); C_FillEventBreakStackWithJump((intptr_t *)g_parsingEventBreakPtr, previous_event); @@ -5791,8 +5799,11 @@ repeatcase: { // pad space for the next potential appendevent apScriptGameEventEnd[g_currentEvent] = (g_scriptPtr-1)-script; + BITPTR_CLEAR(g_scriptPtr-script); *(g_scriptPtr++) = CON_ENDEVENT | (g_lineNumber << 12); + BITPTR_CLEAR(g_scriptPtr-script); *(g_scriptPtr++) = g_parsingEventBreakPtr; + BITPTR_CLEAR(g_scriptPtr-script); *(g_scriptPtr++) = CON_ENDEVENT | (g_lineNumber << 12); } @@ -5839,8 +5850,11 @@ repeatcase: else if (g_parsingEventPtr) { g_scriptPtr--; + BITPTR_CLEAR(g_scriptPtr-script); *(g_scriptPtr++) = CON_JUMP | (g_lineNumber << 12); + BITPTR_CLEAR(g_scriptPtr-script); *(g_scriptPtr++) = MAXGAMEVARS; + BITPTR_CLEAR(g_scriptPtr-script); *g_scriptPtr = g_parsingEventBreakPtr; g_parsingEventBreakPtr = g_scriptPtr++ - script; }