mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 11:10:47 +00:00
Syntax changes for gamevar and gamearray declarations:
Gamevar: default value and flags are now optional. A var declared without a value will default to 0 and a var declared without flags will default to global. Multiple flags can now be stacked one after another in a var declaration, and the most useful ones (GAMEVAR_PERPLAYER, GAMEVAR_PERACTOR, GAMEVAR_NODEFAULT, and GAMEVAR_NORESET) are now pre-defined tokens for easy use. Gamearray: flags field now allows stacking of multiple flags as described above. Arrays can now be defined with specific data types, including int16_t, uint8_t, and a new bit-packed boolean data type. The tokens GAMEARRAY_RESTORE, GAMEARRAY_INT16, GAMEARRAY_UINT8, and GAMEARRAY_BOOLEAN are pre-defined for use of this feature. This is all still pretty experimental. git-svn-id: https://svn.eduke32.com/eduke32@6356 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
1c4c1e9b55
commit
01d92aeed2
4 changed files with 153 additions and 124 deletions
|
@ -2824,8 +2824,7 @@ static inline void C_BitOrNextValue(int32_t *valptr)
|
|||
static inline void C_FinishBitOr(int32_t value)
|
||||
{
|
||||
BITPTR_CLEAR(g_scriptPtr-apScript);
|
||||
*g_scriptPtr = value;
|
||||
g_scriptPtr++;
|
||||
*g_scriptPtr++ = value;
|
||||
}
|
||||
|
||||
static void C_FillEventBreakStackWithJump(intptr_t *breakPtr, intptr_t destination)
|
||||
|
@ -2991,6 +2990,7 @@ DO_DEFSTATE:
|
|||
}
|
||||
|
||||
case CON_GAMEVAR:
|
||||
{
|
||||
// syntax: gamevar <var1> <initial value> <flags>
|
||||
// defines var1 and sets initial value.
|
||||
// flags are used to define usage
|
||||
|
@ -3002,33 +3002,52 @@ DO_DEFSTATE:
|
|||
g_errorCnt++;
|
||||
C_ReportError(ERROR_SYNTAXERROR);
|
||||
C_GetNextValue(LABEL_DEFINE);
|
||||
C_GetNextValue(LABEL_DEFINE);
|
||||
j = 0;
|
||||
while (C_GetKeyword() == -1)
|
||||
C_BitOrNextValue(&j);
|
||||
C_FinishBitOr(j);
|
||||
g_scriptPtr -= 3; // we complete the process anyways just to skip past the fucked up section
|
||||
continue;
|
||||
}
|
||||
|
||||
g_scriptPtr--;
|
||||
|
||||
C_GetNextLabelName();
|
||||
|
||||
if (EDUKE32_PREDICT_FALSE(hash_find(&h_keywords,label+(g_labelCnt<<6))>=0))
|
||||
if (EDUKE32_PREDICT_FALSE(hash_find(&h_keywords, label+(g_labelCnt<<6))>=0))
|
||||
{
|
||||
g_warningCnt++;
|
||||
C_ReportError(WARNING_VARMASKSKEYWORD);
|
||||
hash_delete(&h_keywords, label+(g_labelCnt<<6));
|
||||
}
|
||||
|
||||
C_GetNextValue(LABEL_DEFINE); // get initial value
|
||||
C_GetNextValue(LABEL_DEFINE); // get flags
|
||||
int32_t defaultValue = 0;
|
||||
int32_t varFlags = 0;
|
||||
|
||||
if (EDUKE32_PREDICT_FALSE((*(g_scriptPtr-1)&GAMEVAR_USER_MASK)==3))
|
||||
if (C_GetKeyword() == -1)
|
||||
{
|
||||
g_warningCnt++;
|
||||
*(g_scriptPtr-1)^=GAMEVAR_PERPLAYER;
|
||||
C_ReportError(WARNING_BADGAMEVAR);
|
||||
C_GetNextValue(LABEL_DEFINE); // get initial value
|
||||
defaultValue = *(--g_scriptPtr);
|
||||
|
||||
j = 0;
|
||||
|
||||
while (C_GetKeyword() == -1)
|
||||
C_BitOrNextValue(&j);
|
||||
|
||||
C_FinishBitOr(j);
|
||||
varFlags = *(--g_scriptPtr);
|
||||
|
||||
if (EDUKE32_PREDICT_FALSE((*(g_scriptPtr)&GAMEVAR_USER_MASK)==(GAMEVAR_PERPLAYER|GAMEVAR_PERACTOR)))
|
||||
{
|
||||
g_warningCnt++;
|
||||
varFlags ^= GAMEVAR_PERPLAYER;
|
||||
C_ReportError(WARNING_BADGAMEVAR);
|
||||
}
|
||||
}
|
||||
|
||||
Gv_NewVar(label+(g_labelCnt<<6), *(g_scriptPtr-2), (*(g_scriptPtr-1)) & (~GAMEVAR_DEFAULT));
|
||||
g_scriptPtr -= 3;
|
||||
Gv_NewVar(label+(g_labelCnt<<6), defaultValue, varFlags);
|
||||
continue;
|
||||
}
|
||||
|
||||
case CON_GAMEARRAY:
|
||||
{
|
||||
|
@ -3061,14 +3080,15 @@ DO_DEFSTATE:
|
|||
C_GetNextValue(LABEL_DEFINE);
|
||||
|
||||
char const * const arrayName = label+(g_labelCnt<<6);
|
||||
int arrayFlags = GAMEARRAY_NORMAL;
|
||||
int arrayFlags = 0;
|
||||
|
||||
if (C_GetKeyword() == -1)
|
||||
{
|
||||
C_GetNextValue(LABEL_DEFINE);
|
||||
arrayFlags = GAMEARRAY_NORMAL | *(g_scriptPtr-1);
|
||||
g_scriptPtr--;
|
||||
}
|
||||
while (C_GetKeyword() == -1)
|
||||
C_BitOrNextValue(&arrayFlags);
|
||||
|
||||
C_FinishBitOr(arrayFlags);
|
||||
|
||||
arrayFlags = *(g_scriptPtr-1);
|
||||
g_scriptPtr--;
|
||||
|
||||
Gv_NewArray(arrayName, NULL, *(g_scriptPtr-1), arrayFlags);
|
||||
|
||||
|
@ -6245,7 +6265,16 @@ static void C_AddDefaultDefinitions(void)
|
|||
C_AddDefinition("PROJ_XREPEAT", PROJ_XREPEAT, LABEL_DEFINE);
|
||||
C_AddDefinition("PROJ_YREPEAT", PROJ_YREPEAT, LABEL_DEFINE);
|
||||
|
||||
C_AddDefinition("GAMEVAR_PERPLAYER", GAMEVAR_PERPLAYER, LABEL_DEFINE);
|
||||
C_AddDefinition("GAMEVAR_PERACTOR", GAMEVAR_PERACTOR, LABEL_DEFINE);
|
||||
C_AddDefinition("GAMEVAR_NODEFAULT", GAMEVAR_NODEFAULT, LABEL_DEFINE);
|
||||
C_AddDefinition("GAMEVAR_NORESET", GAMEVAR_NORESET, LABEL_DEFINE);
|
||||
C_AddDefinition("GAMEVAR_NOMULTI", GAMEVAR_NOMULTI, LABEL_DEFINE);
|
||||
|
||||
C_AddDefinition("GAMEARRAY_RESTORE", GAMEARRAY_RESTORE, LABEL_DEFINE);
|
||||
C_AddDefinition("GAMEARRAY_INT16", GAMEARRAY_INT16, LABEL_DEFINE);
|
||||
C_AddDefinition("GAMEARRAY_UINT8", GAMEARRAY_UINT8, LABEL_DEFINE);
|
||||
C_AddDefinition("GAMEARRAY_BOOLEAN", GAMEARRAY_BITMAP, LABEL_DEFINE);
|
||||
|
||||
C_AddDefinition("MAXSPRITESONSCREEN", MAXSPRITESONSCREEN, LABEL_DEFINE);
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ static int Gv_Free(void)
|
|||
|
||||
for (bssize_t i=0; i<g_gameArrayCount; ++i)
|
||||
{
|
||||
if (aGameArrays[i].flags & GAMEARRAY_NORMAL)
|
||||
if (aGameArrays[i].flags & GAMEARRAY_ALLOCATED)
|
||||
ALIGNED_FREE_AND_NULL(aGameArrays[i].pValues);
|
||||
|
||||
aGameArrays[i].flags |= GAMEARRAY_RESET;
|
||||
|
@ -327,11 +327,11 @@ void Gv_DumpValues(void)
|
|||
{
|
||||
buildprint("gamevar ", aGameVars[i].szLabel, " ");
|
||||
|
||||
if (aGameVars[i].flags & (GAMEVAR_INTPTR))
|
||||
if (aGameVars[i].flags & (GAMEVAR_INT32PTR))
|
||||
buildprint(*(int32_t *)aGameVars[i].global);
|
||||
else if (aGameVars[i].flags & (GAMEVAR_SHORTPTR))
|
||||
else if (aGameVars[i].flags & (GAMEVAR_INT16PTR))
|
||||
buildprint(*(int16_t *)aGameVars[i].global);
|
||||
else if (aGameVars[i].flags & (GAMEVAR_CHARPTR))
|
||||
else if (aGameVars[i].flags & (GAMEVAR_UINT8PTR))
|
||||
buildprint(*(int8_t *)aGameVars[i].global);
|
||||
else
|
||||
buildprint(aGameVars[i].global);
|
||||
|
@ -647,9 +647,9 @@ int __fastcall Gv_GetVar(int gameVar, int spriteNum, int playerNum)
|
|||
}
|
||||
else switch (varFlags)
|
||||
{
|
||||
case GAMEVAR_INTPTR: returnValue = *(int32_t *)aGameVars[gameVar].global; break;
|
||||
case GAMEVAR_SHORTPTR: returnValue = *(int16_t *)aGameVars[gameVar].global; break;
|
||||
case GAMEVAR_CHARPTR: returnValue = *(char *)aGameVars[gameVar].global; break;
|
||||
case GAMEVAR_INT32PTR: returnValue = *(int32_t *)aGameVars[gameVar].global; break;
|
||||
case GAMEVAR_INT16PTR: returnValue = *(int16_t *)aGameVars[gameVar].global; break;
|
||||
case GAMEVAR_UINT8PTR: returnValue = *(char *)aGameVars[gameVar].global; break;
|
||||
default: EDUKE32_UNREACHABLE_SECTION(returnValue = 0; break);
|
||||
}
|
||||
|
||||
|
@ -798,9 +798,9 @@ void __fastcall Gv_SetVar(int const gameVar, int const newValue, int const sprit
|
|||
{
|
||||
switch (varFlags)
|
||||
{
|
||||
case GAMEVAR_INTPTR: *((int32_t *)aGameVars[gameVar].global) = (int32_t)newValue; break;
|
||||
case GAMEVAR_SHORTPTR: *((int16_t *)aGameVars[gameVar].global) = (int16_t)newValue; break;
|
||||
case GAMEVAR_CHARPTR: *((uint8_t *)aGameVars[gameVar].global) = (uint8_t)newValue; break;
|
||||
case GAMEVAR_INT32PTR: *((int32_t *)aGameVars[gameVar].global) = (int32_t)newValue; break;
|
||||
case GAMEVAR_INT16PTR: *((int16_t *)aGameVars[gameVar].global) = (int16_t)newValue; break;
|
||||
case GAMEVAR_UINT8PTR: *((uint8_t *)aGameVars[gameVar].global) = (uint8_t)newValue; break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
@ -995,9 +995,9 @@ int __fastcall Gv_GetVarX(int gameVar)
|
|||
returnValue = aGameVars[gameVar].pValues[vm.spriteNum];
|
||||
else switch (varFlags)
|
||||
{
|
||||
case GAMEVAR_INTPTR: returnValue = (*((int32_t *)aGameVars[gameVar].global)); break;
|
||||
case GAMEVAR_SHORTPTR: returnValue = (*((int16_t *)aGameVars[gameVar].global)); break;
|
||||
case GAMEVAR_CHARPTR: returnValue = (*((uint8_t *)aGameVars[gameVar].global)); break;
|
||||
case GAMEVAR_INT32PTR: returnValue = (*((int32_t *)aGameVars[gameVar].global)); break;
|
||||
case GAMEVAR_INT16PTR: returnValue = (*((int16_t *)aGameVars[gameVar].global)); break;
|
||||
case GAMEVAR_UINT8PTR: returnValue = (*((uint8_t *)aGameVars[gameVar].global)); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1051,9 +1051,9 @@ void __fastcall Gv_GetManyVars(int const numVars, int32_t * const outBuf)
|
|||
{
|
||||
switch (varFlags)
|
||||
{
|
||||
case GAMEVAR_INTPTR: value = (*((int32_t *)aGameVars[gameVar].global)); break;
|
||||
case GAMEVAR_SHORTPTR: value = (*((int16_t *)aGameVars[gameVar].global)); break;
|
||||
case GAMEVAR_CHARPTR: value = (*((uint8_t *)aGameVars[gameVar].global)); break;
|
||||
case GAMEVAR_INT32PTR: value = (*((int32_t *)aGameVars[gameVar].global)); break;
|
||||
case GAMEVAR_INT16PTR: value = (*((int16_t *)aGameVars[gameVar].global)); break;
|
||||
case GAMEVAR_UINT8PTR: value = (*((uint8_t *)aGameVars[gameVar].global)); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1082,9 +1082,9 @@ void __fastcall Gv_SetVarX(int const gameVar, int const newValue)
|
|||
}
|
||||
else switch (varFlags)
|
||||
{
|
||||
case GAMEVAR_INTPTR: *((int32_t *)aGameVars[gameVar].global) = (int32_t)newValue; break;
|
||||
case GAMEVAR_SHORTPTR: *((int16_t *)aGameVars[gameVar].global) = (int16_t)newValue; break;
|
||||
case GAMEVAR_CHARPTR: *((uint8_t *)aGameVars[gameVar].global) = (uint8_t)newValue; break;
|
||||
case GAMEVAR_INT32PTR: *((int32_t *)aGameVars[gameVar].global) = (int32_t)newValue; break;
|
||||
case GAMEVAR_INT16PTR: *((int16_t *)aGameVars[gameVar].global) = (int16_t)newValue; break;
|
||||
case GAMEVAR_UINT8PTR: *((uint8_t *)aGameVars[gameVar].global) = (uint8_t)newValue; break;
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -1466,17 +1466,17 @@ static void Gv_AddSystemVars(void)
|
|||
Gv_NewVar("TRIPBOMB_CONTROL", TRIPBOMB_TRIPWIRE, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM);
|
||||
Gv_NewVar("PIPEBOMB_CONTROL", NAM_WW2GI ? PIPEBOMB_TIMER : PIPEBOMB_REMOTE, GAMEVAR_PERPLAYER | GAMEVAR_SYSTEM);
|
||||
|
||||
Gv_NewVar("RESPAWN_MONSTERS", (intptr_t)&ud.respawn_monsters,GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
||||
Gv_NewVar("RESPAWN_ITEMS",(intptr_t)&ud.respawn_items, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
||||
Gv_NewVar("RESPAWN_INVENTORY",(intptr_t)&ud.respawn_inventory, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
||||
Gv_NewVar("MONSTERS_OFF",(intptr_t)&ud.monsters_off, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
||||
Gv_NewVar("MARKER",(intptr_t)&ud.marker, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
||||
Gv_NewVar("FFIRE",(intptr_t)&ud.ffire, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
||||
Gv_NewVar("LEVEL",(intptr_t)&ud.level_number, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY);
|
||||
Gv_NewVar("VOLUME",(intptr_t)&ud.volume_number, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY);
|
||||
Gv_NewVar("RESPAWN_MONSTERS", (intptr_t)&ud.respawn_monsters,GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
||||
Gv_NewVar("RESPAWN_ITEMS",(intptr_t)&ud.respawn_items, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
||||
Gv_NewVar("RESPAWN_INVENTORY",(intptr_t)&ud.respawn_inventory, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
||||
Gv_NewVar("MONSTERS_OFF",(intptr_t)&ud.monsters_off, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
||||
Gv_NewVar("MARKER",(intptr_t)&ud.marker, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
||||
Gv_NewVar("FFIRE",(intptr_t)&ud.ffire, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
||||
Gv_NewVar("LEVEL",(intptr_t)&ud.level_number, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR | GAMEVAR_READONLY);
|
||||
Gv_NewVar("VOLUME",(intptr_t)&ud.volume_number, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR | GAMEVAR_READONLY);
|
||||
|
||||
Gv_NewVar("COOP",(intptr_t)&ud.coop, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
||||
Gv_NewVar("MULTIMODE",(intptr_t)&ud.multimode, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
||||
Gv_NewVar("COOP",(intptr_t)&ud.coop, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
||||
Gv_NewVar("MULTIMODE",(intptr_t)&ud.multimode, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
||||
|
||||
Gv_NewVar("WEAPON", 0, GAMEVAR_PERPLAYER | GAMEVAR_READONLY | GAMEVAR_SYSTEM);
|
||||
Gv_NewVar("WORKSLIKE", 0, GAMEVAR_PERPLAYER | GAMEVAR_READONLY | GAMEVAR_SYSTEM);
|
||||
|
@ -1505,55 +1505,55 @@ static void Gv_AddSystemVars(void)
|
|||
Gv_NewVar("tiledata", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_SPECIAL);
|
||||
Gv_NewVar("paldata", -1, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_SPECIAL);
|
||||
|
||||
Gv_NewVar("myconnectindex", (intptr_t)&myconnectindex, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
|
||||
Gv_NewVar("screenpeek", (intptr_t)&screenpeek, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
|
||||
Gv_NewVar("currentweapon",(intptr_t)&hudweap.cur, GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
|
||||
Gv_NewVar("gs",(intptr_t)&hudweap.shade, GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
|
||||
Gv_NewVar("looking_arc",(intptr_t)&hudweap.lookhoriz, GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
|
||||
Gv_NewVar("gun_pos",(intptr_t)&hudweap.gunposy, GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
|
||||
Gv_NewVar("weapon_xoffset",(intptr_t)&hudweap.gunposx, GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
|
||||
Gv_NewVar("weaponcount",(intptr_t)&hudweap.count, GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
|
||||
Gv_NewVar("looking_angSR1",(intptr_t)&hudweap.lookhalfang, GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
|
||||
Gv_NewVar("xdim",(intptr_t)&xdim, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY);
|
||||
Gv_NewVar("ydim",(intptr_t)&ydim, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY);
|
||||
Gv_NewVar("windowx1",(intptr_t)&windowxy1.x, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY);
|
||||
Gv_NewVar("windowx2",(intptr_t)&windowxy2.x, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY);
|
||||
Gv_NewVar("windowy1",(intptr_t)&windowxy1.y, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY);
|
||||
Gv_NewVar("windowy2",(intptr_t)&windowxy2.y, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY);
|
||||
Gv_NewVar("totalclock",(intptr_t)&totalclock, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY);
|
||||
Gv_NewVar("lastvisinc",(intptr_t)&lastvisinc, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
||||
Gv_NewVar("numsectors",(intptr_t)&numsectors, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_READONLY);
|
||||
Gv_NewVar("myconnectindex", (intptr_t)&myconnectindex, GAMEVAR_READONLY | GAMEVAR_INT32PTR | GAMEVAR_SYSTEM);
|
||||
Gv_NewVar("screenpeek", (intptr_t)&screenpeek, GAMEVAR_READONLY | GAMEVAR_INT32PTR | GAMEVAR_SYSTEM);
|
||||
Gv_NewVar("currentweapon",(intptr_t)&hudweap.cur, GAMEVAR_INT32PTR | GAMEVAR_SYSTEM);
|
||||
Gv_NewVar("gs",(intptr_t)&hudweap.shade, GAMEVAR_INT32PTR | GAMEVAR_SYSTEM);
|
||||
Gv_NewVar("looking_arc",(intptr_t)&hudweap.lookhoriz, GAMEVAR_INT32PTR | GAMEVAR_SYSTEM);
|
||||
Gv_NewVar("gun_pos",(intptr_t)&hudweap.gunposy, GAMEVAR_INT32PTR | GAMEVAR_SYSTEM);
|
||||
Gv_NewVar("weapon_xoffset",(intptr_t)&hudweap.gunposx, GAMEVAR_INT32PTR | GAMEVAR_SYSTEM);
|
||||
Gv_NewVar("weaponcount",(intptr_t)&hudweap.count, GAMEVAR_INT32PTR | GAMEVAR_SYSTEM);
|
||||
Gv_NewVar("looking_angSR1",(intptr_t)&hudweap.lookhalfang, GAMEVAR_INT32PTR | GAMEVAR_SYSTEM);
|
||||
Gv_NewVar("xdim",(intptr_t)&xdim, GAMEVAR_INT32PTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY);
|
||||
Gv_NewVar("ydim",(intptr_t)&ydim, GAMEVAR_INT32PTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY);
|
||||
Gv_NewVar("windowx1",(intptr_t)&windowxy1.x, GAMEVAR_INT32PTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY);
|
||||
Gv_NewVar("windowx2",(intptr_t)&windowxy2.x, GAMEVAR_INT32PTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY);
|
||||
Gv_NewVar("windowy1",(intptr_t)&windowxy1.y, GAMEVAR_INT32PTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY);
|
||||
Gv_NewVar("windowy2",(intptr_t)&windowxy2.y, GAMEVAR_INT32PTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY);
|
||||
Gv_NewVar("totalclock",(intptr_t)&totalclock, GAMEVAR_INT32PTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY);
|
||||
Gv_NewVar("lastvisinc",(intptr_t)&lastvisinc, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
||||
Gv_NewVar("numsectors",(intptr_t)&numsectors, GAMEVAR_SYSTEM | GAMEVAR_INT16PTR | GAMEVAR_READONLY);
|
||||
|
||||
Gv_NewVar("current_menu",(intptr_t)&g_currentMenu, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY);
|
||||
Gv_NewVar("numplayers",(intptr_t)&numplayers, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY);
|
||||
Gv_NewVar("viewingrange",(intptr_t)&viewingrange, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY);
|
||||
Gv_NewVar("yxaspect",(intptr_t)&yxaspect, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY);
|
||||
Gv_NewVar("gravitationalconstant",(intptr_t)&g_spriteGravity, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
||||
Gv_NewVar("gametype_flags",(intptr_t)&g_gametypeFlags[ud.coop], GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
||||
Gv_NewVar("framerate",(intptr_t)&g_frameRate, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY);
|
||||
Gv_NewVar("current_menu",(intptr_t)&g_currentMenu, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR | GAMEVAR_READONLY);
|
||||
Gv_NewVar("numplayers",(intptr_t)&numplayers, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR | GAMEVAR_READONLY);
|
||||
Gv_NewVar("viewingrange",(intptr_t)&viewingrange, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR | GAMEVAR_READONLY);
|
||||
Gv_NewVar("yxaspect",(intptr_t)&yxaspect, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR | GAMEVAR_READONLY);
|
||||
Gv_NewVar("gravitationalconstant",(intptr_t)&g_spriteGravity, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
||||
Gv_NewVar("gametype_flags",(intptr_t)&g_gametypeFlags[ud.coop], GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
||||
Gv_NewVar("framerate",(intptr_t)&g_frameRate, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR | GAMEVAR_READONLY);
|
||||
Gv_NewVar("CLIPMASK0", CLIPMASK0, GAMEVAR_SYSTEM|GAMEVAR_READONLY);
|
||||
Gv_NewVar("CLIPMASK1", CLIPMASK1, GAMEVAR_SYSTEM|GAMEVAR_READONLY);
|
||||
|
||||
Gv_NewVar("camerax",(intptr_t)&ud.camerapos.x, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
||||
Gv_NewVar("cameray",(intptr_t)&ud.camerapos.y, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
||||
Gv_NewVar("cameraz",(intptr_t)&ud.camerapos.z, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
||||
Gv_NewVar("cameraang",(intptr_t)&ud.cameraang, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR);
|
||||
Gv_NewVar("camerahoriz",(intptr_t)&ud.camerahoriz, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR);
|
||||
Gv_NewVar("camerasect",(intptr_t)&ud.camerasect, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR);
|
||||
Gv_NewVar("cameradist",(intptr_t)&g_cameraDistance, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
||||
Gv_NewVar("cameraclock",(intptr_t)&g_cameraClock, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
||||
Gv_NewVar("camerax",(intptr_t)&ud.camerapos.x, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
||||
Gv_NewVar("cameray",(intptr_t)&ud.camerapos.y, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
||||
Gv_NewVar("cameraz",(intptr_t)&ud.camerapos.z, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
||||
Gv_NewVar("cameraang",(intptr_t)&ud.cameraang, GAMEVAR_SYSTEM | GAMEVAR_INT16PTR);
|
||||
Gv_NewVar("camerahoriz",(intptr_t)&ud.camerahoriz, GAMEVAR_SYSTEM | GAMEVAR_INT16PTR);
|
||||
Gv_NewVar("camerasect",(intptr_t)&ud.camerasect, GAMEVAR_SYSTEM | GAMEVAR_INT16PTR);
|
||||
Gv_NewVar("cameradist",(intptr_t)&g_cameraDistance, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
||||
Gv_NewVar("cameraclock",(intptr_t)&g_cameraClock, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
||||
|
||||
Gv_NewVar("display_mirror",(intptr_t)&display_mirror, GAMEVAR_SYSTEM | GAMEVAR_CHARPTR);
|
||||
Gv_NewVar("randomseed",(intptr_t)&randomseed, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
||||
Gv_NewVar("display_mirror",(intptr_t)&display_mirror, GAMEVAR_SYSTEM | GAMEVAR_UINT8PTR);
|
||||
Gv_NewVar("randomseed",(intptr_t)&randomseed, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
||||
|
||||
Gv_NewVar("NUMWALLS",(intptr_t)&numwalls, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_READONLY);
|
||||
Gv_NewVar("NUMSECTORS",(intptr_t)&numsectors, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_READONLY);
|
||||
Gv_NewVar("Numsprites",(intptr_t)&Numsprites, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY);
|
||||
Gv_NewVar("NUMWALLS",(intptr_t)&numwalls, GAMEVAR_SYSTEM | GAMEVAR_INT16PTR | GAMEVAR_READONLY);
|
||||
Gv_NewVar("NUMSECTORS",(intptr_t)&numsectors, GAMEVAR_SYSTEM | GAMEVAR_INT16PTR | GAMEVAR_READONLY);
|
||||
Gv_NewVar("Numsprites",(intptr_t)&Numsprites, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR | GAMEVAR_READONLY);
|
||||
|
||||
Gv_NewVar("lastsavepos",(intptr_t)&g_lastSaveSlot, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
||||
Gv_NewVar("lastsavepos",(intptr_t)&g_lastSaveSlot, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);
|
||||
|
||||
# ifdef USE_OPENGL
|
||||
Gv_NewVar("rendmode",(intptr_t)&rendmode, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
|
||||
Gv_NewVar("rendmode",(intptr_t)&rendmode, GAMEVAR_READONLY | GAMEVAR_INT32PTR | GAMEVAR_SYSTEM);
|
||||
# else
|
||||
Gv_NewVar("rendmode", 0, GAMEVAR_READONLY | GAMEVAR_SYSTEM);
|
||||
# endif
|
||||
|
|
|
@ -39,10 +39,10 @@ enum GamevarFlags_t
|
|||
GAMEVAR_NODEFAULT = 0x00000400, // don't reset on actor spawn
|
||||
GAMEVAR_SYSTEM = 0x00000800, // cannot change mode flags...(only default value)
|
||||
GAMEVAR_READONLY = 0x00001000, // values are read-only (no setvar allowed)
|
||||
GAMEVAR_INTPTR = 0x00002000, // plValues is a pointer to an int32_t
|
||||
GAMEVAR_SHORTPTR = 0x00008000, // plValues is a pointer to a short
|
||||
GAMEVAR_CHARPTR = 0x00010000, // plValues is a pointer to a char
|
||||
GAMEVAR_PTR_MASK = (GAMEVAR_INTPTR | GAMEVAR_SHORTPTR | GAMEVAR_CHARPTR),
|
||||
GAMEVAR_INT32PTR = 0x00002000, // plValues is a pointer to an int32_t
|
||||
GAMEVAR_INT16PTR = 0x00008000, // plValues is a pointer to a short
|
||||
GAMEVAR_UINT8PTR = 0x00010000, // plValues is a pointer to a char
|
||||
GAMEVAR_PTR_MASK = (GAMEVAR_INT32PTR | GAMEVAR_INT16PTR | GAMEVAR_UINT8PTR),
|
||||
GAMEVAR_NORESET = 0x00020000, // var values are not reset when restoring map state
|
||||
GAMEVAR_SPECIAL = 0x00040000, // flag for structure member shortcut vars
|
||||
GAMEVAR_NOMULTI = 0x00080000, // don't attach to multiplayer packets
|
||||
|
@ -59,19 +59,19 @@ enum GamevarFlags_t
|
|||
|
||||
enum GamearrayFlags_t
|
||||
{
|
||||
GAMEARRAY_READONLY = 0x00001000,
|
||||
GAMEARRAY_WARN = 0x00002000,
|
||||
GAMEARRAY_NORMAL = 0x00004000,
|
||||
GAMEARRAY_UINT8 = 0x00000001,
|
||||
GAMEARRAY_INT16 = 0x00000002,
|
||||
GAMEARRAY_INT32 = 0x00000004,
|
||||
GAMEARRAY_RESET = 0x00000008,
|
||||
GAMEARRAY_RESTORE = 0x00000010,
|
||||
GAMEARRAY_VARSIZE = 0x00000020,
|
||||
GAMEARRAY_STRIDE2 = 0x00000100,
|
||||
GAMEARRAY_ALLOCATED = 0x00000200, // memory allocated for user array
|
||||
GAMEARRAY_BITMAP = 0x00000400,
|
||||
GAMEARRAY_SYSTEM = 0x00000800,
|
||||
GAMEARRAY_READONLY = 0x00001000,
|
||||
GAMEARRAY_INT32 = 0x00002000,
|
||||
GAMEARRAY_NORMAL = 0x00004000,
|
||||
GAMEARRAY_INT16 = 0x00008000,
|
||||
GAMEARRAY_UINT8 = 0x00010000,
|
||||
GAMEARRAY_BITMAP = 0x00100000,
|
||||
GAMEARRAY_WARN = 0x00200000,
|
||||
|
||||
GAMEARRAY_TYPE_MASK = GAMEARRAY_UINT8 | GAMEARRAY_INT16 | GAMEARRAY_INT32 | GAMEARRAY_BITMAP,
|
||||
};
|
||||
|
@ -148,26 +148,26 @@ void Gv_Init(void);
|
|||
void Gv_FinalizeWeaponDefaults(void);
|
||||
|
||||
#if !defined LUNATIC
|
||||
#define VM_GAMEVAR_OPERATOR(func, operator) \
|
||||
static FORCE_INLINE void __fastcall func(int const id, int32_t const operand) \
|
||||
{ \
|
||||
switch (aGameVars[id].flags & (GAMEVAR_USER_MASK | GAMEVAR_PTR_MASK)) \
|
||||
{ \
|
||||
default: aGameVars[id].global operator operand; break; \
|
||||
case GAMEVAR_PERPLAYER: \
|
||||
if (EDUKE32_PREDICT_FALSE((unsigned)vm.playerNum > MAXPLAYERS - 1)) \
|
||||
break; \
|
||||
aGameVars[id].pValues[vm.playerNum] operator operand; \
|
||||
break; \
|
||||
case GAMEVAR_PERACTOR: \
|
||||
if (EDUKE32_PREDICT_FALSE((unsigned)vm.spriteNum > MAXSPRITES - 1)) \
|
||||
break; \
|
||||
aGameVars[id].pValues[vm.spriteNum] operator operand; \
|
||||
break; \
|
||||
case GAMEVAR_INTPTR: *((int32_t *)aGameVars[id].global) operator(int32_t) operand; break; \
|
||||
case GAMEVAR_SHORTPTR: *((int16_t *)aGameVars[id].global) operator(int16_t) operand; break; \
|
||||
case GAMEVAR_CHARPTR: *((uint8_t *)aGameVars[id].global) operator(uint8_t) operand; break; \
|
||||
} \
|
||||
#define VM_GAMEVAR_OPERATOR(func, operator) \
|
||||
static FORCE_INLINE void __fastcall func(int const id, int32_t const operand) \
|
||||
{ \
|
||||
switch (aGameVars[id].flags & (GAMEVAR_USER_MASK | GAMEVAR_PTR_MASK)) \
|
||||
{ \
|
||||
default: aGameVars[id].global operator operand; break; \
|
||||
case GAMEVAR_PERPLAYER: \
|
||||
if (EDUKE32_PREDICT_FALSE((unsigned)vm.playerNum > MAXPLAYERS - 1)) \
|
||||
break; \
|
||||
aGameVars[id].pValues[vm.playerNum] operator operand; \
|
||||
break; \
|
||||
case GAMEVAR_PERACTOR: \
|
||||
if (EDUKE32_PREDICT_FALSE((unsigned)vm.spriteNum > MAXSPRITES - 1)) \
|
||||
break; \
|
||||
aGameVars[id].pValues[vm.spriteNum] operator operand; \
|
||||
break; \
|
||||
case GAMEVAR_INT32PTR: *((int32_t *)aGameVars[id].global) operator(int32_t) operand; break; \
|
||||
case GAMEVAR_INT16PTR: *((int16_t *)aGameVars[id].global) operator(int16_t) operand; break; \
|
||||
case GAMEVAR_UINT8PTR: *((uint8_t *)aGameVars[id].global) operator(uint8_t) operand; break; \
|
||||
} \
|
||||
}
|
||||
|
||||
#if defined(__arm__) || defined(LIBDIVIDE_ALWAYS)
|
||||
|
@ -193,15 +193,15 @@ skip:
|
|||
case GAMEVAR_PERPLAYER: iptr = &aGameVars[id].pValues[vm.playerNum];
|
||||
default: break;
|
||||
case GAMEVAR_PERACTOR: iptr = &aGameVars[id].pValues[vm.spriteNum]; break;
|
||||
case GAMEVAR_INTPTR:
|
||||
case GAMEVAR_INT32PTR:
|
||||
*((int32_t *)aGameVars[id].global) =
|
||||
(int32_t)libdivide_s32_do(*((int32_t *)aGameVars[id].global), dptr);
|
||||
return;
|
||||
case GAMEVAR_SHORTPTR:
|
||||
case GAMEVAR_INT16PTR:
|
||||
*((int16_t *)aGameVars[id].global) =
|
||||
(int16_t)libdivide_s32_do(*((int16_t *)aGameVars[id].global), dptr);
|
||||
return;
|
||||
case GAMEVAR_CHARPTR:
|
||||
case GAMEVAR_UINT8PTR:
|
||||
*((uint8_t *)aGameVars[id].global) =
|
||||
(uint8_t)libdivide_s32_do(*((uint8_t *)aGameVars[id].global), dptr);
|
||||
return;
|
||||
|
|
|
@ -1190,8 +1190,8 @@ static uint8_t *svdiff;
|
|||
#include "gamedef.h"
|
||||
|
||||
#if !defined LUNATIC
|
||||
# define SV_SKIPMASK (/*GAMEVAR_SYSTEM|*/GAMEVAR_READONLY|GAMEVAR_INTPTR| \
|
||||
GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR /*|GAMEVAR_NORESET*/ |GAMEVAR_SPECIAL)
|
||||
# define SV_SKIPMASK (/*GAMEVAR_SYSTEM|*/GAMEVAR_READONLY|GAMEVAR_INT32PTR| \
|
||||
GAMEVAR_INT16PTR|GAMEVAR_UINT8PTR /*|GAMEVAR_NORESET*/ |GAMEVAR_SPECIAL)
|
||||
|
||||
static char svgm_vars_string [] = "blK:vars";
|
||||
// setup gamevar data spec for snapshotting and diffing... gamevars must be loaded when called
|
||||
|
|
Loading…
Reference in a new issue