Minor change to some gamevar warnings. DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@5512 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2016-01-07 03:30:02 +00:00
parent f372d8184a
commit 085333a5fb

View file

@ -640,13 +640,17 @@ int32_t __fastcall Gv_GetVar(int32_t id, int32_t iActor, int32_t iPlayer)
if (f == GAMEVAR_PERACTOR) if (f == GAMEVAR_PERACTOR)
{ {
if (EDUKE32_PREDICT_FALSE((unsigned) iActor >= MAXSPRITES)) goto badsprite; if (EDUKE32_PREDICT_FALSE((unsigned) iActor >= MAXSPRITES)) goto badindex;
rv = aGameVars[id].val.plValues[iActor]; rv = aGameVars[id].val.plValues[iActor];
} }
else if (!f) rv = aGameVars[id].val.lValue; else if (!f) rv = aGameVars[id].val.lValue;
else if (f == GAMEVAR_PERPLAYER) else if (f == GAMEVAR_PERPLAYER)
{ {
if (EDUKE32_PREDICT_FALSE((unsigned) iPlayer >= MAXPLAYERS)) goto badplayer; if (EDUKE32_PREDICT_FALSE((unsigned) iPlayer >= MAXPLAYERS))
{
iActor = iPlayer;
goto badindex;
}
rv = aGameVars[id].val.plValues[iPlayer]; rv = aGameVars[id].val.plValues[iPlayer];
} }
else switch (f) else switch (f)
@ -669,7 +673,7 @@ nastyhacks:
if (EDUKE32_PREDICT_FALSE((unsigned)index >= (unsigned)aGameArrays[id].size)) if (EDUKE32_PREDICT_FALSE((unsigned)index >= (unsigned)aGameArrays[id].size))
{ {
iActor = index; iActor = index;
goto badindex; goto badarrayindex;
} }
rv = Gv_GetGameArrayValue(id, index); rv = Gv_GetGameArrayValue(id, index);
@ -679,7 +683,9 @@ nastyhacks:
int indexvar = *insptr++; int indexvar = *insptr++;
int32_t index = Gv_GetVar(indexvar, iActor, iPlayer); int32_t index = Gv_GetVar(indexvar, iActor, iPlayer);
switch ((id&(MAXGAMEVARS-1)) - g_iStructVarIDs) id &= (MAXGAMEVARS - 1);
switch (id - g_iStructVarIDs)
{ {
case STRUCT_SPRITE: case STRUCT_SPRITE:
{ {
@ -691,7 +697,7 @@ nastyhacks:
if (EDUKE32_PREDICT_FALSE((unsigned) index >= MAXSPRITES)) if (EDUKE32_PREDICT_FALSE((unsigned) index >= MAXSPRITES))
{ {
iActor = index; iActor = index;
goto badsprite; goto badindex;
} }
rv = VM_GetSprite(index, label, indexvar); rv = VM_GetSprite(index, label, indexvar);
@ -704,7 +710,7 @@ nastyhacks:
if (EDUKE32_PREDICT_FALSE((unsigned) index >= MAXSPRITES)) if (EDUKE32_PREDICT_FALSE((unsigned) index >= MAXSPRITES))
{ {
iActor = index; iActor = index;
goto badsprite; goto badindex;
} }
rv = VM_GetTsprite(index, label); rv = VM_GetTsprite(index, label);
@ -717,7 +723,7 @@ nastyhacks:
if (EDUKE32_PREDICT_FALSE((unsigned) index >= MAXSPRITES)) if (EDUKE32_PREDICT_FALSE((unsigned) index >= MAXSPRITES))
{ {
iActor = index; iActor = index;
goto badsprite; goto badindex;
} }
rv = VM_GetActiveProjectile(index, label); rv = VM_GetActiveProjectile(index, label);
@ -731,7 +737,7 @@ nastyhacks:
if (EDUKE32_PREDICT_FALSE((unsigned) index >= MAXTILES)) if (EDUKE32_PREDICT_FALSE((unsigned) index >= MAXTILES))
{ {
iActor = index; iActor = index;
goto badtile; goto badindex;
} }
rv = VM_GetProjectile(index, label); rv = VM_GetProjectile(index, label);
@ -744,7 +750,7 @@ nastyhacks:
if (EDUKE32_PREDICT_FALSE((unsigned) index >= MAXTILES)) if (EDUKE32_PREDICT_FALSE((unsigned) index >= MAXTILES))
{ {
iActor = index; iActor = index;
goto badtile; goto badindex;
} }
rv = VM_GetTileData(index, label); rv = VM_GetTileData(index, label);
@ -758,7 +764,7 @@ nastyhacks:
if (EDUKE32_PREDICT_FALSE((unsigned) index >= MAXPALOOKUPS)) if (EDUKE32_PREDICT_FALSE((unsigned) index >= MAXPALOOKUPS))
{ {
iActor = index; iActor = index;
goto badpal; goto badindex;
} }
rv = VM_GetPalData(index, label); rv = VM_GetPalData(index, label);
@ -776,8 +782,8 @@ nastyhacks:
if (EDUKE32_PREDICT_FALSE((unsigned) index >= MAXPLAYERS)) if (EDUKE32_PREDICT_FALSE((unsigned) index >= MAXPLAYERS))
{ {
iPlayer = index; iActor = index;
goto badplayer; goto badindex;
} }
rv = VM_GetPlayer(index, label, indexvar); rv = VM_GetPlayer(index, label, indexvar);
@ -791,8 +797,8 @@ nastyhacks:
if (EDUKE32_PREDICT_FALSE((unsigned) index >= MAXPLAYERS)) if (EDUKE32_PREDICT_FALSE((unsigned) index >= MAXPLAYERS))
{ {
iPlayer = index; iActor = index;
goto badplayer; goto badindex;
} }
rv = VM_GetPlayerInput(index, label); rv = VM_GetPlayerInput(index, label);
@ -808,9 +814,9 @@ nastyhacks:
if (indexvar == g_iThisActorID) index = sprite[vm.g_i].sectnum; if (indexvar == g_iThisActorID) index = sprite[vm.g_i].sectnum;
if (EDUKE32_PREDICT_FALSE((unsigned) index >= MAXSECTORS)) if (EDUKE32_PREDICT_FALSE((unsigned) index >= MAXSECTORS))
{ {
iPlayer = index; iActor = index;
insptr++; insptr++;
goto badsector; goto badindex;
} }
rv = VM_GetSector(index, *insptr++); rv = VM_GetSector(index, *insptr++);
break; break;
@ -818,9 +824,9 @@ nastyhacks:
case STRUCT_WALL: case STRUCT_WALL:
if (EDUKE32_PREDICT_FALSE((unsigned) index >= MAXWALLS)) if (EDUKE32_PREDICT_FALSE((unsigned) index >= MAXWALLS))
{ {
iPlayer = index; iActor = index;
insptr++; insptr++;
goto badwall; goto badindex;
} }
rv = VM_GetWall(index, *insptr++); rv = VM_GetWall(index, *insptr++);
break; break;
@ -841,32 +847,12 @@ nastyhacks:
return (rv ^ -negateResult) + negateResult; return (rv ^ -negateResult) + negateResult;
badindex: badarrayindex:
CON_ERRPRINTF("Gv_GetVar(): invalid array index (%s[%d])\n", aGameArrays[id].szLabel,iActor); CON_ERRPRINTF("Gv_GetVar(): invalid array index (%s[%d])\n", aGameArrays[id].szLabel,iActor);
return -1; return -1;
badplayer: badindex:
CON_ERRPRINTF("Gv_GetVar(): invalid player ID %d\n", iPlayer); CON_ERRPRINTF("Gv_GetVar(): invalid index %d for \"%s\"\n", iActor, aGameVars[id].szLabel);
return -1;
badsprite:
CON_ERRPRINTF("Gv_GetVar(): invalid sprite ID %d\n", iActor);
return -1;
badsector:
CON_ERRPRINTF("Gv_GetVar(): invalid sector ID %d\n", iPlayer);
return -1;
badwall:
CON_ERRPRINTF("Gv_GetVar(): invalid wall ID %d\n", iPlayer);
return -1;
badtile:
CON_ERRPRINTF("Gv_GetVar(): invalid tile ID %d\n", iActor);
return -1;
badpal:
CON_ERRPRINTF("Gv_GetVar(): invalid pal ID %d\n", iActor);
return -1; return -1;
} }