gamedef.c: factor out some dup'd code into C_BitOrNextValue(), C_FinishBitOr().

git-svn-id: https://svn.eduke32.com/eduke32@4840 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2014-12-26 17:29:57 +00:00
parent b2e09b5a18
commit 2eff7bf6ce

View file

@ -2510,6 +2510,20 @@ LUNATIC_EXTERN void C_SetCfgName(const char *cfgname)
} }
#if !defined LUNATIC #if !defined LUNATIC
static void C_BitOrNextValue(int32_t *valptr)
{
C_GetNextValue(LABEL_DEFINE);
g_scriptPtr--;
*valptr |= *g_scriptPtr;
}
static void C_FinishBitOr(int32_t value)
{
bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7));
*g_scriptPtr = value;
g_scriptPtr++;
}
static int32_t C_ParseCommand(int32_t loop) static int32_t C_ParseCommand(int32_t loop)
{ {
int32_t i, j=0, k=0, tw, otw; int32_t i, j=0, k=0, tw, otw;
@ -2879,15 +2893,9 @@ static int32_t C_ParseCommand(int32_t loop)
j = 0; j = 0;
while (C_GetKeyword() == -1) while (C_GetKeyword() == -1)
{ C_BitOrNextValue(&j);
C_GetNextValue(LABEL_DEFINE);
g_scriptPtr--;
j |= *g_scriptPtr;
}
bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7));
*g_scriptPtr = j;
g_scriptPtr++; C_FinishBitOr(j);
} }
else else
{ {
@ -3059,16 +3067,12 @@ static int32_t C_ParseCommand(int32_t loop)
initprintf("%s:%d: warning: expected a move, found a constant.\n",g_szScriptFileName,g_lineNumber); initprintf("%s:%d: warning: expected a move, found a constant.\n",g_szScriptFileName,g_lineNumber);
g_numCompilerWarnings++; g_numCompilerWarnings++;
} }
k = 0; k = 0;
while (C_GetKeyword() == -1) while (C_GetKeyword() == -1)
{ C_BitOrNextValue(&k);
C_GetNextValue(LABEL_DEFINE);
g_scriptPtr--; C_FinishBitOr(k);
k |= *g_scriptPtr;
}
bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7));
*g_scriptPtr = k;
g_scriptPtr++;
j = 666; j = 666;
break; break;
} }
@ -3221,14 +3225,9 @@ static int32_t C_ParseCommand(int32_t loop)
{ {
j = 0; j = 0;
while (C_GetKeyword() == -1) while (C_GetKeyword() == -1)
{ C_BitOrNextValue(&j);
C_GetNextValue(LABEL_DEFINE);
g_scriptPtr--; C_FinishBitOr(j);
j |= *g_scriptPtr;
}
bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7));
*g_scriptPtr = j;
g_scriptPtr++;
break; break;
} }
else else
@ -5203,15 +5202,9 @@ repeatcase:
case CON_IFP: case CON_IFP:
j = 0; j = 0;
do do
{ C_BitOrNextValue(&j);
C_GetNextValue(LABEL_DEFINE);
g_scriptPtr--;
j |= *g_scriptPtr;
}
while (C_GetKeyword() == -1); while (C_GetKeyword() == -1);
bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7)); C_FinishBitOr(j);
*g_scriptPtr = j;
g_scriptPtr++;
break; break;
case CON_IFSOUND: case CON_IFSOUND:
case CON_IFACTORSOUND: case CON_IFACTORSOUND: