mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-27 01:10:51 +00:00
Minor changes to gamevar error handling
git-svn-id: https://svn.eduke32.com/eduke32@5885 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
b18db99691
commit
d7328f738d
3 changed files with 38 additions and 37 deletions
|
@ -3936,7 +3936,7 @@ finish_qsprintf:
|
||||||
{
|
{
|
||||||
OSD_Printf(OSDTEXT_GREEN "%s: L=%d %s[%d] =%d\n", keyw[g_tw], g_errorLineNum,
|
OSD_Printf(OSDTEXT_GREEN "%s: L=%d %s[%d] =%d\n", keyw[g_tw], g_errorLineNum,
|
||||||
aGameArrays[lVarID].szLabel, index,
|
aGameArrays[lVarID].szLabel, index,
|
||||||
(int32_t)(m*Gv_GetGameArrayValue(lVarID, index)));
|
(int32_t)(m*Gv_GetArrayValue(lVarID, index)));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -4678,7 +4678,7 @@ finish_qsprintf:
|
||||||
int *const pArray = (int32_t *)Xmalloc(sizeof(int32_t) * arraySize);
|
int *const pArray = (int32_t *)Xmalloc(sizeof(int32_t) * arraySize);
|
||||||
|
|
||||||
for (bssize_t k = 0; k < arraySize; k++)
|
for (bssize_t k = 0; k < arraySize; k++)
|
||||||
pArray[k] = Gv_GetGameArrayValue(arrayNum, k);
|
pArray[k] = Gv_GetArrayValue(arrayNum, k);
|
||||||
|
|
||||||
fwrite(pArray, 1, sizeof(int32_t) * arraySize, fil);
|
fwrite(pArray, 1, sizeof(int32_t) * arraySize, fil);
|
||||||
Bfree(pArray);
|
Bfree(pArray);
|
||||||
|
@ -6267,12 +6267,9 @@ int32_t VM_CheckSquished2(int32_t i, int32_t snum)
|
||||||
LUNATIC_EXTERN void VM_DrawTileGeneric(int32_t x, int32_t y, int32_t zoom, int32_t tilenum, int32_t shade,
|
LUNATIC_EXTERN void VM_DrawTileGeneric(int32_t x, int32_t y, int32_t zoom, int32_t tilenum, int32_t shade,
|
||||||
int32_t orientation, int32_t p)
|
int32_t orientation, int32_t p)
|
||||||
{
|
{
|
||||||
int32_t rotAngle = 0;
|
|
||||||
|
|
||||||
orientation &= (ROTATESPRITE_MAX-1);
|
orientation &= (ROTATESPRITE_MAX-1);
|
||||||
|
|
||||||
if (orientation&4)
|
int const rotAngle = (orientation&4) ? 1024 : 0;
|
||||||
rotAngle = 1024;
|
|
||||||
|
|
||||||
if (!(orientation&ROTATESPRITE_FULL16))
|
if (!(orientation&ROTATESPRITE_FULL16))
|
||||||
{
|
{
|
||||||
|
|
|
@ -554,7 +554,7 @@ int32_t Gv_NewVar(const char *pszLabel, intptr_t lValue, uint32_t dwFlags)
|
||||||
|
|
||||||
static int Gv_GetVarIndex(const char *szGameLabel)
|
static int Gv_GetVarIndex(const char *szGameLabel)
|
||||||
{
|
{
|
||||||
int gameVar = hash_find(&h_gamevars,szGameLabel);
|
int const gameVar = hash_find(&h_gamevars,szGameLabel);
|
||||||
|
|
||||||
if (EDUKE32_PREDICT_FALSE(gameVar == -1))
|
if (EDUKE32_PREDICT_FALSE(gameVar == -1))
|
||||||
{
|
{
|
||||||
|
@ -565,7 +565,7 @@ static int Gv_GetVarIndex(const char *szGameLabel)
|
||||||
return gameVar;
|
return gameVar;
|
||||||
}
|
}
|
||||||
|
|
||||||
int __fastcall Gv_GetGameArrayValue(int const id, int index)
|
int __fastcall Gv_GetArrayValue(int const id, int index)
|
||||||
{
|
{
|
||||||
if (aGameArrays[id].flags & GAMEARRAY_STRIDE2)
|
if (aGameArrays[id].flags & GAMEARRAY_STRIDE2)
|
||||||
index <<= 1;
|
index <<= 1;
|
||||||
|
@ -594,7 +594,7 @@ int __fastcall Gv_GetVar(int gameVar, int spriteNum, int playerNum)
|
||||||
int invertResult = !!(gameVar & (MAXGAMEVARS << 1));
|
int invertResult = !!(gameVar & (MAXGAMEVARS << 1));
|
||||||
|
|
||||||
if (EDUKE32_PREDICT_FALSE((gameVar & ~(MAXGAMEVARS << 1)) >= g_gameVarCount))
|
if (EDUKE32_PREDICT_FALSE((gameVar & ~(MAXGAMEVARS << 1)) >= g_gameVarCount))
|
||||||
goto nastyhacks;
|
goto special;
|
||||||
|
|
||||||
gameVar &= (MAXGAMEVARS - 1);
|
gameVar &= (MAXGAMEVARS - 1);
|
||||||
|
|
||||||
|
@ -626,7 +626,7 @@ int __fastcall Gv_GetVar(int gameVar, int spriteNum, int playerNum)
|
||||||
|
|
||||||
return (returnValue ^ -invertResult) + invertResult;
|
return (returnValue ^ -invertResult) + invertResult;
|
||||||
|
|
||||||
nastyhacks:
|
special:
|
||||||
if (gameVar & (MAXGAMEVARS << 2)) // array
|
if (gameVar & (MAXGAMEVARS << 2)) // array
|
||||||
{
|
{
|
||||||
gameVar &= (MAXGAMEVARS - 1); // ~((MAXGAMEVARS<<2)|(MAXGAMEVARS<<1));
|
gameVar &= (MAXGAMEVARS - 1); // ~((MAXGAMEVARS<<2)|(MAXGAMEVARS<<1));
|
||||||
|
@ -639,7 +639,7 @@ nastyhacks:
|
||||||
goto badarrayindex;
|
goto badarrayindex;
|
||||||
}
|
}
|
||||||
|
|
||||||
returnValue = Gv_GetGameArrayValue(gameVar, arrayIndex);
|
returnValue = Gv_GetArrayValue(gameVar, arrayIndex);
|
||||||
}
|
}
|
||||||
else if (gameVar&(MAXGAMEVARS<<3)) // struct shortcut vars
|
else if (gameVar&(MAXGAMEVARS<<3)) // struct shortcut vars
|
||||||
{
|
{
|
||||||
|
@ -901,7 +901,7 @@ int __fastcall Gv_GetSpecialVarX(int gameVar)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
returnValue = Gv_GetGameArrayValue(gameVar, arrayIndex);
|
returnValue = Gv_GetArrayValue(gameVar, arrayIndex);
|
||||||
}
|
}
|
||||||
else if (gameVar & (MAXGAMEVARS << 3)) // struct shortcut vars
|
else if (gameVar & (MAXGAMEVARS << 3)) // struct shortcut vars
|
||||||
{
|
{
|
||||||
|
@ -919,8 +919,8 @@ int __fastcall Gv_GetSpecialVarX(int gameVar)
|
||||||
if (EDUKE32_PREDICT_FALSE((unsigned) arrayIndex >= MAXSPRITES))
|
if (EDUKE32_PREDICT_FALSE((unsigned) arrayIndex >= MAXSPRITES))
|
||||||
{
|
{
|
||||||
gameVar = arrayIndex;
|
gameVar = arrayIndex;
|
||||||
CON_ERRPRINTF("%s %d\n", gvxerrs[GVX_BADSPRITE], gameVar);
|
returnValue = GVX_BADSPRITE;
|
||||||
return -1;
|
goto badindex;
|
||||||
}
|
}
|
||||||
|
|
||||||
returnValue = VM_GetSprite(arrayIndex, labelNum, arrayIndexVar);
|
returnValue = VM_GetSprite(arrayIndex, labelNum, arrayIndexVar);
|
||||||
|
@ -933,8 +933,8 @@ int __fastcall Gv_GetSpecialVarX(int gameVar)
|
||||||
if (EDUKE32_PREDICT_FALSE((unsigned) arrayIndex >= MAXSPRITES))
|
if (EDUKE32_PREDICT_FALSE((unsigned) arrayIndex >= MAXSPRITES))
|
||||||
{
|
{
|
||||||
gameVar = arrayIndex;
|
gameVar = arrayIndex;
|
||||||
CON_ERRPRINTF("%s %d\n", gvxerrs[GVX_BADSPRITE], gameVar);
|
returnValue = GVX_BADSPRITE;
|
||||||
return -1;
|
goto badindex;
|
||||||
}
|
}
|
||||||
|
|
||||||
returnValue = VM_GetTsprite(arrayIndex, labelNum);
|
returnValue = VM_GetTsprite(arrayIndex, labelNum);
|
||||||
|
@ -947,8 +947,8 @@ int __fastcall Gv_GetSpecialVarX(int gameVar)
|
||||||
if (EDUKE32_PREDICT_FALSE((unsigned) arrayIndex >= MAXSPRITES))
|
if (EDUKE32_PREDICT_FALSE((unsigned) arrayIndex >= MAXSPRITES))
|
||||||
{
|
{
|
||||||
gameVar = arrayIndex;
|
gameVar = arrayIndex;
|
||||||
CON_ERRPRINTF("%s %d\n", gvxerrs[GVX_BADSPRITE], gameVar);
|
returnValue = GVX_BADSPRITE;
|
||||||
return -1;
|
goto badindex;
|
||||||
}
|
}
|
||||||
|
|
||||||
returnValue = VM_GetActiveProjectile(arrayIndex, labelNum);
|
returnValue = VM_GetActiveProjectile(arrayIndex, labelNum);
|
||||||
|
@ -962,8 +962,8 @@ int __fastcall Gv_GetSpecialVarX(int gameVar)
|
||||||
if (EDUKE32_PREDICT_FALSE((unsigned) arrayIndex >= MAXTILES))
|
if (EDUKE32_PREDICT_FALSE((unsigned) arrayIndex >= MAXTILES))
|
||||||
{
|
{
|
||||||
gameVar = arrayIndex;
|
gameVar = arrayIndex;
|
||||||
CON_ERRPRINTF("%s %d\n", gvxerrs[GVX_BADTILE], gameVar);
|
returnValue = GVX_BADTILE;
|
||||||
return -1;
|
goto badindex;
|
||||||
}
|
}
|
||||||
|
|
||||||
returnValue = VM_GetProjectile(arrayIndex, labelNum);
|
returnValue = VM_GetProjectile(arrayIndex, labelNum);
|
||||||
|
@ -976,8 +976,8 @@ int __fastcall Gv_GetSpecialVarX(int gameVar)
|
||||||
if (EDUKE32_PREDICT_FALSE((unsigned) arrayIndex >= MAXTILES))
|
if (EDUKE32_PREDICT_FALSE((unsigned) arrayIndex >= MAXTILES))
|
||||||
{
|
{
|
||||||
gameVar = arrayIndex;
|
gameVar = arrayIndex;
|
||||||
CON_ERRPRINTF("%s %d\n", gvxerrs[GVX_BADTILE], gameVar);
|
returnValue = GVX_BADTILE;
|
||||||
return -1;
|
goto badindex;
|
||||||
}
|
}
|
||||||
|
|
||||||
returnValue = VM_GetTileData(arrayIndex, labelNum);
|
returnValue = VM_GetTileData(arrayIndex, labelNum);
|
||||||
|
@ -991,8 +991,8 @@ int __fastcall Gv_GetSpecialVarX(int gameVar)
|
||||||
if (EDUKE32_PREDICT_FALSE((unsigned) arrayIndex >= MAXPALOOKUPS))
|
if (EDUKE32_PREDICT_FALSE((unsigned) arrayIndex >= MAXPALOOKUPS))
|
||||||
{
|
{
|
||||||
gameVar = arrayIndex;
|
gameVar = arrayIndex;
|
||||||
CON_ERRPRINTF("%s %d\n", gvxerrs[GVX_BADPAL], gameVar);
|
returnValue = GVX_BADPAL;
|
||||||
return -1;
|
goto badindex;
|
||||||
}
|
}
|
||||||
|
|
||||||
returnValue = VM_GetPalData(arrayIndex, labelNum);
|
returnValue = VM_GetPalData(arrayIndex, labelNum);
|
||||||
|
@ -1012,8 +1012,8 @@ int __fastcall Gv_GetSpecialVarX(int gameVar)
|
||||||
if (EDUKE32_PREDICT_FALSE((unsigned) arrayIndex >= MAXPLAYERS))
|
if (EDUKE32_PREDICT_FALSE((unsigned) arrayIndex >= MAXPLAYERS))
|
||||||
{
|
{
|
||||||
gameVar = arrayIndex;
|
gameVar = arrayIndex;
|
||||||
CON_ERRPRINTF("%s %d\n", gvxerrs[GVX_BADPLAYER], gameVar);
|
returnValue = GVX_BADPLAYER;
|
||||||
return -1;
|
goto badindex;
|
||||||
}
|
}
|
||||||
|
|
||||||
returnValue = VM_GetPlayer(arrayIndex, labelNum, arrayIndexVar);
|
returnValue = VM_GetPlayer(arrayIndex, labelNum, arrayIndexVar);
|
||||||
|
@ -1029,8 +1029,8 @@ int __fastcall Gv_GetSpecialVarX(int gameVar)
|
||||||
if (EDUKE32_PREDICT_FALSE((unsigned) arrayIndex >= MAXPLAYERS))
|
if (EDUKE32_PREDICT_FALSE((unsigned) arrayIndex >= MAXPLAYERS))
|
||||||
{
|
{
|
||||||
gameVar = arrayIndex;
|
gameVar = arrayIndex;
|
||||||
CON_ERRPRINTF("%s %d\n", gvxerrs[GVX_BADPLAYER], gameVar);
|
returnValue = GVX_BADPLAYER;
|
||||||
return -1;
|
goto badindex;
|
||||||
}
|
}
|
||||||
|
|
||||||
returnValue = VM_GetPlayerInput(arrayIndex, labelNum);
|
returnValue = VM_GetPlayerInput(arrayIndex, labelNum);
|
||||||
|
@ -1050,8 +1050,8 @@ int __fastcall Gv_GetSpecialVarX(int gameVar)
|
||||||
{
|
{
|
||||||
gameVar = arrayIndex;
|
gameVar = arrayIndex;
|
||||||
insptr++;
|
insptr++;
|
||||||
CON_ERRPRINTF("%s %d\n", gvxerrs[GVX_BADSECTOR], gameVar);
|
returnValue = GVX_BADSECTOR;
|
||||||
return -1;
|
goto badindex;
|
||||||
}
|
}
|
||||||
returnValue = VM_GetSector(arrayIndex, *insptr++);
|
returnValue = VM_GetSector(arrayIndex, *insptr++);
|
||||||
break;
|
break;
|
||||||
|
@ -1061,8 +1061,8 @@ int __fastcall Gv_GetSpecialVarX(int gameVar)
|
||||||
{
|
{
|
||||||
gameVar = arrayIndex;
|
gameVar = arrayIndex;
|
||||||
insptr++;
|
insptr++;
|
||||||
CON_ERRPRINTF("%s %d\n", gvxerrs[GVX_BADWALL], gameVar);
|
returnValue = GVX_BADWALL;
|
||||||
return -1;
|
goto badindex;
|
||||||
}
|
}
|
||||||
returnValue = VM_GetWall(arrayIndex, *insptr++);
|
returnValue = VM_GetWall(arrayIndex, *insptr++);
|
||||||
break;
|
break;
|
||||||
|
@ -1076,6 +1076,10 @@ int __fastcall Gv_GetSpecialVarX(int gameVar)
|
||||||
}
|
}
|
||||||
|
|
||||||
return returnValue;
|
return returnValue;
|
||||||
|
|
||||||
|
badindex:
|
||||||
|
CON_ERRPRINTF("%s %d\n", gvxerrs[returnValue], gameVar);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int __fastcall Gv_GetVarX(int gameVar)
|
int __fastcall Gv_GetVarX(int gameVar)
|
||||||
|
|
|
@ -100,7 +100,7 @@ extern gamearray_t aGameArrays[MAXGAMEARRAYS];
|
||||||
extern int32_t g_gameVarCount;
|
extern int32_t g_gameVarCount;
|
||||||
extern int32_t g_gameArrayCount;
|
extern int32_t g_gameArrayCount;
|
||||||
|
|
||||||
int32_t __fastcall Gv_GetGameArrayValue(int const id, int index);
|
int32_t __fastcall Gv_GetArrayValue(int const id, int index);
|
||||||
int32_t __fastcall Gv_GetVar(int id, int spriteNum, int playerNum);
|
int32_t __fastcall Gv_GetVar(int id, int spriteNum, int playerNum);
|
||||||
void __fastcall Gv_SetVar(int const id, int32_t const lValue, int const spriteNum, int const playerNum);
|
void __fastcall Gv_SetVar(int const id, int32_t const lValue, int const spriteNum, int const playerNum);
|
||||||
int32_t __fastcall Gv_GetVarX(int id);
|
int32_t __fastcall Gv_GetVarX(int id);
|
||||||
|
|
Loading…
Reference in a new issue