Add macro CON_ERRPRINTF(Fmt, ...) and use that everywhere.

git-svn-id: https://svn.eduke32.com/eduke32@3000 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-09-05 17:25:47 +00:00
parent 1729f8fa38
commit 7305fbbae9
5 changed files with 156 additions and 155 deletions

View file

@ -112,7 +112,6 @@ extern void VM_AccessTsprite(int32_t iSet, int32_t lVar1, int32_t lLabelID, int3
extern void VM_AccessProjectile(int32_t iSet, int32_t lVar1, int32_t lLabelID, int32_t lVar2); extern void VM_AccessProjectile(int32_t iSet, int32_t lVar1, int32_t lLabelID, int32_t lVar2);
*/ */
#define CON_ERROR OSD_ERROR "Line %d, %s: "
enum vmflags_t { enum vmflags_t {
VM_RETURN = 0x00000001, VM_RETURN = 0x00000001,

View file

@ -781,7 +781,7 @@ static int32_t VM_AddWeapon(int32_t weap, int32_t amount, DukePlayer_t *ps)
{ {
if ((unsigned)weap >= MAX_WEAPONS) if ((unsigned)weap >= MAX_WEAPONS)
{ {
OSD_Printf(CON_ERROR "Invalid weapon ID %d\n",g_errorLineNum,keyw[g_tw], weap); CON_ERRPRINTF("Invalid weapon ID %d\n", weap);
return 1; return 1;
} }
@ -829,7 +829,7 @@ skip_check:
int32_t q = *insptr++, i = *insptr++; int32_t q = *insptr++, i = *insptr++;
if ((ScriptQuotes[q] == NULL || ScriptQuoteRedefinitions[i] == NULL)) if ((ScriptQuotes[q] == NULL || ScriptQuoteRedefinitions[i] == NULL))
{ {
OSD_Printf(CON_ERROR "%d %d null quote\n",g_errorLineNum,keyw[g_tw],q,i); CON_ERRPRINTF("%d %d null quote\n", q,i);
break; break;
} }
Bstrcpy(ScriptQuotes[q],ScriptQuoteRedefinitions[i]); Bstrcpy(ScriptQuotes[q],ScriptQuoteRedefinitions[i]);
@ -1113,7 +1113,7 @@ skip_check:
insptr++; insptr++;
if (((unsigned)vm.g_sp->yvel >= MAXSOUNDS)) if (((unsigned)vm.g_sp->yvel >= MAXSOUNDS))
{ {
OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],vm.g_sp->yvel); CON_ERRPRINTF("Invalid sound %d\n", vm.g_sp->yvel);
insptr++; insptr++;
continue; continue;
} }
@ -1165,7 +1165,7 @@ skip_check:
case CON_SOUNDONCE: case CON_SOUNDONCE:
if (((unsigned)*(++insptr) >= MAXSOUNDS)) if (((unsigned)*(++insptr) >= MAXSOUNDS))
{ {
OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],(int32_t)*insptr++); CON_ERRPRINTF("Invalid sound %d\n", (int32_t)*insptr++);
continue; continue;
} }
if (!S_CheckSoundPlaying(vm.g_i,*insptr++)) if (!S_CheckSoundPlaying(vm.g_i,*insptr++))
@ -1179,7 +1179,7 @@ skip_check:
if (((unsigned)j >= MAXSOUNDS)) if (((unsigned)j >= MAXSOUNDS))
{ {
OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],j); CON_ERRPRINTF("Invalid sound %d\n", j);
insptr++; insptr++;
continue; continue;
} }
@ -1191,7 +1191,7 @@ skip_check:
case CON_IFSOUND: case CON_IFSOUND:
if (((unsigned)*(++insptr) >= MAXSOUNDS)) if (((unsigned)*(++insptr) >= MAXSOUNDS))
{ {
OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],(int32_t)*insptr); CON_ERRPRINTF("Invalid sound %d\n", (int32_t)*insptr);
insptr++; insptr++;
continue; continue;
} }
@ -1202,7 +1202,7 @@ skip_check:
case CON_STOPSOUND: case CON_STOPSOUND:
if (((unsigned)*(++insptr) >= MAXSOUNDS)) if (((unsigned)*(++insptr) >= MAXSOUNDS))
{ {
OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],(int32_t)*insptr); CON_ERRPRINTF("Invalid sound %d\n", (int32_t)*insptr);
insptr++; insptr++;
continue; continue;
} }
@ -1218,7 +1218,7 @@ skip_check:
if ((j<0 || j>=MAXSOUNDS)) if ((j<0 || j>=MAXSOUNDS))
{ {
OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],j); CON_ERRPRINTF("Invalid sound %d\n", j);
continue; continue;
} }
@ -1235,7 +1235,7 @@ skip_check:
if ((j<0 || j>=MAXSOUNDS)) if ((j<0 || j>=MAXSOUNDS))
{ {
OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],j); CON_ERRPRINTF("Invalid sound %d\n", j);
continue; continue;
} }
@ -1247,7 +1247,7 @@ skip_check:
case CON_GLOBALSOUND: case CON_GLOBALSOUND:
if (((unsigned)*(++insptr) >= MAXSOUNDS)) if (((unsigned)*(++insptr) >= MAXSOUNDS))
{ {
OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],(int32_t)*insptr); CON_ERRPRINTF("Invalid sound %d\n", (int32_t)*insptr);
insptr++; insptr++;
continue; continue;
} }
@ -1261,7 +1261,7 @@ skip_check:
case CON_SOUND: case CON_SOUND:
if ((unsigned)*(++insptr) >= MAXSOUNDS) if ((unsigned)*(++insptr) >= MAXSOUNDS)
{ {
OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],(int32_t)*insptr); CON_ERRPRINTF("Invalid sound %d\n", (int32_t)*insptr);
insptr++; insptr++;
continue; continue;
} }
@ -1395,7 +1395,7 @@ skip_check:
if ((unsigned)weap >= MAX_WEAPONS) if ((unsigned)weap >= MAX_WEAPONS)
{ {
OSD_Printf(CON_ERROR "Invalid weapon ID %d\n",g_errorLineNum,keyw[g_tw], weap); CON_ERRPRINTF("Invalid weapon ID %d\n", weap);
break; break;
} }
@ -1577,22 +1577,22 @@ skip_check:
switch (tw) switch (tw)
{ {
case CON_ACTIVATEBYSECTOR: case CON_ACTIVATEBYSECTOR:
if ((unsigned)var1 >= (unsigned)numsectors) {OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],var1); break;} if ((unsigned)var1 >= (unsigned)numsectors) {CON_ERRPRINTF("Invalid sector %d\n", var1); break;}
G_ActivateBySector(var1, var2); G_ActivateBySector(var1, var2);
break; break;
case CON_OPERATESECTORS: case CON_OPERATESECTORS:
if ((unsigned)var1 >= (unsigned)numsectors) {OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],var1); break;} if ((unsigned)var1 >= (unsigned)numsectors) {CON_ERRPRINTF("Invalid sector %d\n", var1); break;}
G_OperateSectors(var1, var2); G_OperateSectors(var1, var2);
break; break;
case CON_OPERATEACTIVATORS: case CON_OPERATEACTIVATORS:
if ((unsigned)var2>=(unsigned)playerswhenstarted) {OSD_Printf(CON_ERROR "Invalid player %d\n",g_errorLineNum,keyw[g_tw],var2); break;} if ((unsigned)var2>=(unsigned)playerswhenstarted) {CON_ERRPRINTF("Invalid player %d\n", var2); break;}
G_OperateActivators(var1, var2); G_OperateActivators(var1, var2);
break; break;
case CON_SETASPECT: case CON_SETASPECT:
setaspect(var1, var2); setaspect(var1, var2);
break; break;
case CON_SSP: case CON_SSP:
if ((unsigned)var1 >= MAXSPRITES) { OSD_Printf(CON_ERROR "Invalid sprite %d\n",g_errorLineNum,keyw[g_tw],var1); break;} if ((unsigned)var1 >= MAXSPRITES) { CON_ERRPRINTF("Invalid sprite %d\n", var1); break;}
A_SetSprite(var1, var2); A_SetSprite(var1, var2);
break; break;
} }
@ -1606,7 +1606,7 @@ skip_check:
if ((unsigned)lVar1 >= MAXSPRITES || (unsigned)lVar2 >= MAXSPRITES) if ((unsigned)lVar1 >= MAXSPRITES || (unsigned)lVar2 >= MAXSPRITES)
{ {
OSD_Printf(CON_ERROR "Invalid sprite %d\n",g_errorLineNum,keyw[g_tw],(unsigned)lVar1 >= MAXSPRITES ? lVar1 : lVar2); CON_ERRPRINTF("Invalid sprite %d\n", (unsigned)lVar1 >= MAXSPRITES ? lVar1 : lVar2);
res=0; res=0;
} }
else res=cansee(sprite[lVar1].x,sprite[lVar1].y,sprite[lVar1].z,sprite[lVar1].sectnum, else res=cansee(sprite[lVar1].x,sprite[lVar1].y,sprite[lVar1].z,sprite[lVar1].sectnum,
@ -1643,7 +1643,7 @@ skip_check:
int32_t j=Gv_GetVarX(*insptr++); int32_t j=Gv_GetVarX(*insptr++);
if ((ScriptQuotes[j] == NULL)) if ((ScriptQuotes[j] == NULL))
{ {
OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],j); CON_ERRPRINTF("null quote %d\n", j);
Gv_SetVarX(i,-1); Gv_SetVarX(i,-1);
continue; continue;
} }
@ -1658,7 +1658,7 @@ skip_check:
int32_t j=Gv_GetVarX(*insptr++); int32_t j=Gv_GetVarX(*insptr++);
if ((unsigned)j > MAXSTATUS) if ((unsigned)j > MAXSTATUS)
{ {
OSD_Printf(CON_ERROR "invalid status list %d\n",g_errorLineNum,keyw[g_tw],j); CON_ERRPRINTF("invalid status list %d\n", j);
continue; continue;
} }
Gv_SetVarX(i,headspritestat[j]); Gv_SetVarX(i,headspritestat[j]);
@ -1672,7 +1672,7 @@ skip_check:
int32_t j=Gv_GetVarX(*insptr++); int32_t j=Gv_GetVarX(*insptr++);
if ((unsigned)j >= MAXSPRITES) if ((unsigned)j >= MAXSPRITES)
{ {
OSD_Printf(CON_ERROR "invalid sprite ID %d\n",g_errorLineNum,keyw[g_tw],j); CON_ERRPRINTF("invalid sprite ID %d\n", j);
continue; continue;
} }
Gv_SetVarX(i,prevspritestat[j]); Gv_SetVarX(i,prevspritestat[j]);
@ -1686,7 +1686,7 @@ skip_check:
int32_t j=Gv_GetVarX(*insptr++); int32_t j=Gv_GetVarX(*insptr++);
if ((unsigned)j >= MAXSPRITES) if ((unsigned)j >= MAXSPRITES)
{ {
OSD_Printf(CON_ERROR "invalid sprite ID %d\n",g_errorLineNum,keyw[g_tw],j); CON_ERRPRINTF("invalid sprite ID %d\n", j);
continue; continue;
} }
Gv_SetVarX(i,nextspritestat[j]); Gv_SetVarX(i,nextspritestat[j]);
@ -1700,7 +1700,7 @@ skip_check:
int32_t j=Gv_GetVarX(*insptr++); int32_t j=Gv_GetVarX(*insptr++);
if ((unsigned)j >= (unsigned)numsectors) if ((unsigned)j >= (unsigned)numsectors)
{ {
OSD_Printf(CON_ERROR "invalid sector %d\n",g_errorLineNum,keyw[g_tw],j); CON_ERRPRINTF("invalid sector %d\n", j);
continue; continue;
} }
Gv_SetVarX(i,headspritesect[j]); Gv_SetVarX(i,headspritesect[j]);
@ -1714,7 +1714,7 @@ skip_check:
int32_t j=Gv_GetVarX(*insptr++); int32_t j=Gv_GetVarX(*insptr++);
if ((unsigned)j >= MAXSPRITES) if ((unsigned)j >= MAXSPRITES)
{ {
OSD_Printf(CON_ERROR "invalid sprite ID %d\n",g_errorLineNum,keyw[g_tw],j); CON_ERRPRINTF("invalid sprite ID %d\n", j);
continue; continue;
} }
Gv_SetVarX(i,prevspritesect[j]); Gv_SetVarX(i,prevspritesect[j]);
@ -1728,7 +1728,7 @@ skip_check:
int32_t j=Gv_GetVarX(*insptr++); int32_t j=Gv_GetVarX(*insptr++);
if ((unsigned)j >= MAXSPRITES) if ((unsigned)j >= MAXSPRITES)
{ {
OSD_Printf(CON_ERROR "invalid sprite ID %d\n",g_errorLineNum,keyw[g_tw],j); CON_ERRPRINTF("invalid sprite ID %d\n", j);
continue; continue;
} }
Gv_SetVarX(i,nextspritesect[j]); Gv_SetVarX(i,nextspritesect[j]);
@ -1743,11 +1743,11 @@ skip_check:
int32_t j = Gv_GetVarX(*insptr++); int32_t j = Gv_GetVarX(*insptr++);
if ((unsigned)i >= MAXQUOTES) if ((unsigned)i >= MAXQUOTES)
OSD_Printf(CON_ERROR "invalid quote ID %d\n",g_errorLineNum,keyw[g_tw],i); CON_ERRPRINTF("invalid quote ID %d\n", i);
else if ((ScriptQuotes[i] == NULL)) else if ((ScriptQuotes[i] == NULL))
OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],i); CON_ERRPRINTF("null quote %d\n", i);
else if ((unsigned)f >= NUMGAMEFUNCTIONS) else if ((unsigned)f >= NUMGAMEFUNCTIONS)
OSD_Printf(CON_ERROR "invalid function %d\n",g_errorLineNum,keyw[g_tw],f); CON_ERRPRINTF("invalid function %d\n", f);
else else
{ {
if (j < 2) if (j < 2)
@ -1777,22 +1777,22 @@ skip_check:
if ((unsigned)q1>=MAXQUOTES) if ((unsigned)q1>=MAXQUOTES)
{ {
OSD_Printf(CON_ERROR "invalid quote ID %d\n",g_errorLineNum,keyw[g_tw],q1); CON_ERRPRINTF("invalid quote ID %d\n", q1);
continue; continue;
} }
if ((ScriptQuotes[q1] == NULL)) if ((ScriptQuotes[q1] == NULL))
{ {
OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],q1); CON_ERRPRINTF("null quote %d\n", q1);
continue; continue;
} }
if ((unsigned)q2>=MAXQUOTES) if ((unsigned)q2>=MAXQUOTES)
{ {
OSD_Printf(CON_ERROR "invalid quote ID %d\n",g_errorLineNum,keyw[g_tw],q2); CON_ERRPRINTF("invalid quote ID %d\n", q2);
continue; continue;
} }
if ((ScriptQuotes[q2] == NULL)) if ((ScriptQuotes[q2] == NULL))
{ {
OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],q2); CON_ERRPRINTF("null quote %d\n", q2);
continue; continue;
} }
@ -1832,7 +1832,7 @@ skip_check:
case CON_GETPNAME: case CON_GETPNAME:
if ((ScriptQuotes[i] == NULL)) if ((ScriptQuotes[i] == NULL))
{ {
OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],i); CON_ERRPRINTF("null quote %d\n", i);
break; break;
} }
if (g_player[j].user_name[0]) if (g_player[j].user_name[0])
@ -1842,7 +1842,7 @@ skip_check:
case CON_QGETSYSSTR: case CON_QGETSYSSTR:
if ((ScriptQuotes[i] == NULL)) if ((ScriptQuotes[i] == NULL))
{ {
OSD_Printf(CON_ERROR "null quote %d %d\n",g_errorLineNum,keyw[g_tw],i,j); CON_ERRPRINTF("null quote %d %d\n", i,j);
break; break;
} }
switch (j) switch (j)
@ -1867,7 +1867,7 @@ skip_check:
Bstrcpy(ScriptQuotes[i],EpisodeNames[ud.volume_number]); Bstrcpy(ScriptQuotes[i],EpisodeNames[ud.volume_number]);
break; break;
default: default:
OSD_Printf(CON_ERROR "unknown str ID %d %d\n",g_errorLineNum,keyw[g_tw],i,j); CON_ERRPRINTF("unknown str ID %d %d\n", i,j);
} }
break; break;
case CON_QSTRCAT: case CON_QSTRCAT:
@ -1885,19 +1885,19 @@ skip_check:
case CON_CHANGESPRITESECT: case CON_CHANGESPRITESECT:
if ((unsigned)i >= MAXSPRITES) if ((unsigned)i >= MAXSPRITES)
{ {
OSD_Printf(CON_ERROR "Invalid sprite %d\n",g_errorLineNum,keyw[g_tw],i); CON_ERRPRINTF("Invalid sprite %d\n", i);
break; break;
} }
if ((unsigned)j >= (unsigned)numsectors) if ((unsigned)j >= (unsigned)numsectors)
{ {
OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],j); CON_ERRPRINTF("Invalid sector %d\n", j);
break; break;
} }
changespritesect(i,j); changespritesect(i,j);
break; break;
default: default:
nullquote: nullquote:
OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],ScriptQuotes[i] ? j : i); CON_ERRPRINTF("null quote %d\n", ScriptQuotes[i] ? j : i);
break; break;
} }
continue; continue;
@ -1911,12 +1911,12 @@ nullquote:
if ((unsigned)i >= MAXSPRITES) if ((unsigned)i >= MAXSPRITES)
{ {
OSD_Printf(CON_ERROR "Invalid sprite: %d\n",g_errorLineNum,keyw[g_tw],i); CON_ERRPRINTF("Invalid sprite: %d\n", i);
continue; continue;
} }
if ((unsigned)j >= MAXSTATUS) if ((unsigned)j >= MAXSTATUS)
{ {
OSD_Printf(CON_ERROR "Invalid statnum: %d\n",g_errorLineNum,keyw[g_tw],j); CON_ERRPRINTF("Invalid statnum: %d\n", j);
continue; continue;
} }
if (sprite[i].statnum == j) continue; if (sprite[i].statnum == j) continue;
@ -1957,13 +1957,13 @@ nullquote:
if ((volnume > MAXVOLUMES-1 || volnume < 0)) if ((volnume > MAXVOLUMES-1 || volnume < 0))
{ {
OSD_Printf(CON_ERROR "invalid volume (%d)\n",g_errorLineNum,keyw[g_tw],volnume); CON_ERRPRINTF("invalid volume (%d)\n", volnume);
continue; continue;
} }
if ((levnume > MAXLEVELS-1 || levnume < 0)) if ((levnume > MAXLEVELS-1 || levnume < 0))
{ {
OSD_Printf(CON_ERROR "invalid level (%d)\n",g_errorLineNum,keyw[g_tw],levnume); CON_ERRPRINTF("invalid level (%d)\n", levnume);
continue; continue;
} }
@ -2101,7 +2101,7 @@ nullquote:
if ((wallnum<0 || wallnum>=numwalls)) if ((wallnum<0 || wallnum>=numwalls))
{ {
OSD_Printf(CON_ERROR "Invalid wall %d\n",g_errorLineNum,keyw[g_tw],wallnum); CON_ERRPRINTF("Invalid wall %d\n", wallnum);
continue; continue;
} }
dragpoint(wallnum,newx,newy); dragpoint(wallnum,newx,newy);
@ -2115,7 +2115,7 @@ nullquote:
if ((unsigned)xvar >= MAXSPRITES || (unsigned)yvar >= MAXSPRITES) if ((unsigned)xvar >= MAXSPRITES || (unsigned)yvar >= MAXSPRITES)
{ {
OSD_Printf(CON_ERROR "invalid sprite\n",g_errorLineNum,keyw[g_tw]); CON_ERRPRINTF("invalid sprite\n");
continue; continue;
} }
@ -2130,7 +2130,7 @@ nullquote:
if ((unsigned)xvar >= MAXSPRITES || (unsigned)yvar >= MAXSPRITES) if ((unsigned)xvar >= MAXSPRITES || (unsigned)yvar >= MAXSPRITES)
{ {
OSD_Printf(CON_ERROR "invalid sprite\n",g_errorLineNum,keyw[g_tw]); CON_ERRPRINTF("invalid sprite\n");
continue; continue;
} }
@ -2196,7 +2196,7 @@ nullquote:
int32_t j; int32_t j;
if ((unsigned)vm.g_sp->sectnum >= (unsigned)numsectors) if ((unsigned)vm.g_sp->sectnum >= (unsigned)numsectors)
{ {
OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],vm.g_sp->sectnum); CON_ERRPRINTF("Invalid sector %d\n", vm.g_sp->sectnum);
continue; continue;
} }
j = A_Spawn(vm.g_i, lIn); j = A_Spawn(vm.g_i, lIn);
@ -2226,7 +2226,7 @@ nullquote:
if ((unsigned)vm.g_sp->sectnum >= (unsigned)numsectors) if ((unsigned)vm.g_sp->sectnum >= (unsigned)numsectors)
{ {
OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],vm.g_sp->sectnum); CON_ERRPRINTF("Invalid sector %d\n", vm.g_sp->sectnum);
insptr++; insptr++;
continue; continue;
} }
@ -2266,7 +2266,7 @@ nullquote:
if ((unsigned)vm.g_sp->sectnum >= (unsigned)numsectors) if ((unsigned)vm.g_sp->sectnum >= (unsigned)numsectors)
{ {
OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],vm.g_sp->sectnum); CON_ERRPRINTF("Invalid sector %d\n", vm.g_sp->sectnum);
insptr++; insptr++;
actor[vm.g_i].shootzvel=0; actor[vm.g_i].shootzvel=0;
continue; continue;
@ -2289,7 +2289,7 @@ nullquote:
if ((unsigned)vm.g_sp->sectnum >= (unsigned)numsectors) if ((unsigned)vm.g_sp->sectnum >= (unsigned)numsectors)
{ {
OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],vm.g_sp->sectnum); CON_ERRPRINTF("Invalid sector %d\n", vm.g_sp->sectnum);
actor[vm.g_i].shootzvel=0; actor[vm.g_i].shootzvel=0;
continue; continue;
} }
@ -2315,7 +2315,7 @@ nullquote:
if ((unsigned)vm.g_sp->sectnum >= (unsigned)numsectors) if ((unsigned)vm.g_sp->sectnum >= (unsigned)numsectors)
{ {
OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],vm.g_sp->sectnum); CON_ERRPRINTF("Invalid sector %d\n", vm.g_sp->sectnum);
actor[vm.g_i].shootzvel=0; actor[vm.g_i].shootzvel=0;
continue; continue;
} }
@ -2342,7 +2342,7 @@ nullquote:
if (j<0 || j>=MAXSOUNDS) if (j<0 || j>=MAXSOUNDS)
{ {
OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],j); CON_ERRPRINTF("Invalid sound %d\n", j);
continue; continue;
} }
@ -2373,7 +2373,7 @@ nullquote:
if (j >= 0 && j < MAXUNIQHUDID-1) if (j >= 0 && j < MAXUNIQHUDID-1)
guniqhudid = j; guniqhudid = j;
else else
OSD_Printf(CON_ERROR "Invalid ID %d\n",g_errorLineNum,keyw[g_tw],j); CON_ERRPRINTF("Invalid ID %d\n", j);
continue; continue;
} }
@ -2453,12 +2453,12 @@ nullquote:
if ((x1 < 0 || y1 < 0 || x2 >= xdim || y2 >= ydim)) if ((x1 < 0 || y1 < 0 || x2 >= xdim || y2 >= ydim))
{ {
OSD_Printf(CON_ERROR "incorrect coordinates\n",g_errorLineNum,keyw[g_tw]); CON_ERRPRINTF("incorrect coordinates\n");
continue; continue;
} }
if ((unsigned)sect >= (unsigned)numsectors) if ((unsigned)sect >= (unsigned)numsectors)
{ {
OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],sect); CON_ERRPRINTF("Invalid sector %d\n", sect);
continue; continue;
} }
@ -2525,13 +2525,13 @@ nullquote:
if ((unsigned)tilenum >= MAXTILES) if ((unsigned)tilenum >= MAXTILES)
{ {
OSD_Printf(CON_ERROR "invalid tilenum %d\n", g_errorLineNum, keyw[g_tw], tilenum); CON_ERRPRINTF("invalid tilenum %d\n", tilenum);
continue; continue;
} }
if (x < -(320<<16) || x >= (640<<16) || y < -(200<<16) || y >= (400<<16)) if (x < -(320<<16) || x >= (640<<16) || y < -(200<<16) || y >= (400<<16))
{ {
OSD_Printf(CON_ERROR "invalid coordinates: %d, %d\n",g_errorLineNum, keyw[g_tw], x, y); CON_ERRPRINTF("invalid coordinates: %d, %d\n", x, y);
continue; continue;
} }
@ -2555,19 +2555,19 @@ nullquote:
if (tilenum < 0 || tilenum+255 >= MAXTILES) if (tilenum < 0 || tilenum+255 >= MAXTILES)
{ {
OSD_Printf(CON_ERROR "invalid base tilenum %d\n", g_errorLineNum, keyw[g_tw], tilenum); CON_ERRPRINTF("invalid base tilenum %d\n", tilenum);
continue; continue;
} }
if ((unsigned)q >= MAXQUOTES) if ((unsigned)q >= MAXQUOTES)
{ {
OSD_Printf(CON_ERROR "invalid quote ID %d\n", g_errorLineNum, keyw[g_tw], q); CON_ERRPRINTF("invalid quote ID %d\n", q);
continue; continue;
} }
if ((ScriptQuotes[q] == NULL)) if ((ScriptQuotes[q] == NULL))
{ {
OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],q); CON_ERRPRINTF("null quote %d\n", q);
if (tw == CON_GAMETEXTZ) if (tw == CON_GAMETEXTZ)
Gv_GetVarX(*insptr++); Gv_GetVarX(*insptr++);
continue; continue;
@ -2594,7 +2594,7 @@ nullquote:
// NOTE: '-' not taken into account, but we have rotatesprite() bound check now anyway // NOTE: '-' not taken into account, but we have rotatesprite() bound check now anyway
if (tilenum < 0 || tilenum+9 >= MAXTILES) if (tilenum < 0 || tilenum+9 >= MAXTILES)
{ {
OSD_Printf(CON_ERROR "invalid base tilenum %d\n", g_errorLineNum, keyw[g_tw], tilenum); CON_ERRPRINTF("invalid base tilenum %d\n", tilenum);
continue; continue;
} }
@ -2612,13 +2612,13 @@ nullquote:
if ((unsigned)q >= MAXQUOTES) if ((unsigned)q >= MAXQUOTES)
{ {
OSD_Printf(CON_ERROR "invalid quote ID %d\n", g_errorLineNum, keyw[g_tw], q); CON_ERRPRINTF("invalid quote ID %d\n", q);
continue; continue;
} }
if ((ScriptQuotes[q] == NULL)) if ((ScriptQuotes[q] == NULL))
{ {
OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],q); CON_ERRPRINTF("null quote %d\n", q);
continue; continue;
} }
minitextshade(x,y,ScriptQuotes[q],shade,pal, 2+8+16); minitextshade(x,y,ScriptQuotes[q],shade,pal, 2+8+16);
@ -2648,7 +2648,7 @@ nullquote:
if ((unsigned)sectnum >= (unsigned)numsectors) if ((unsigned)sectnum >= (unsigned)numsectors)
{ {
OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],sectnum); CON_ERRPRINTF("Invalid sector %d\n", sectnum);
continue; continue;
} }
getzrange(&vect, sectnum, &ceilz, &ceilhit, &florz, &florhit, walldist, clipmask); getzrange(&vect, sectnum, &ceilz, &ceilhit, &florz, &florhit, walldist, clipmask);
@ -2668,7 +2668,7 @@ nullquote:
if ((unsigned)sectnum >= (unsigned)numsectors) if ((unsigned)sectnum >= (unsigned)numsectors)
{ {
OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],sectnum); CON_ERRPRINTF("Invalid sector %d\n", sectnum);
continue; continue;
} }
@ -2739,7 +2739,7 @@ nullquote:
if ((unsigned)sectnum >= (unsigned)numsectors) if ((unsigned)sectnum >= (unsigned)numsectors)
{ {
OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],sectnum); CON_ERRPRINTF("Invalid sector %d\n", sectnum);
Gv_SetVarX(retvar, 0); Gv_SetVarX(retvar, 0);
continue; continue;
} }
@ -2774,7 +2774,7 @@ nullquote:
if ((unsigned)sectnum >= (unsigned)numsectors) if ((unsigned)sectnum >= (unsigned)numsectors)
{ {
OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],sectnum); CON_ERRPRINTF("Invalid sector %d\n", sectnum);
continue; continue;
} }
hitscan((const vec3_t *)&vect, sectnum, vx, vy, vz, &hit, cliptype); hitscan((const vec3_t *)&vect, sectnum, vx, vy, vz, &hit, cliptype);
@ -2798,7 +2798,7 @@ nullquote:
if ((unsigned)sect1 >= (unsigned)numsectors || (unsigned)sect2 >= (unsigned)numsectors) if ((unsigned)sect1 >= (unsigned)numsectors || (unsigned)sect2 >= (unsigned)numsectors)
{ {
OSD_Printf(CON_ERROR "Invalid sector\n",g_errorLineNum,keyw[g_tw]); CON_ERRPRINTF("Invalid sector\n");
Gv_SetVarX(rvar, 0); Gv_SetVarX(rvar, 0);
} }
@ -2838,7 +2838,7 @@ nullquote:
if ((unsigned)sectnum >= (unsigned)numsectors) if ((unsigned)sectnum >= (unsigned)numsectors)
{ {
OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],sectnum); CON_ERRPRINTF("Invalid sector %d\n", sectnum);
continue; continue;
} }
neartag(x, y, z, sectnum, ang, &neartagsector, &neartagwall, &neartagsprite, neartag(x, y, z, sectnum, ang, &neartagsector, &neartagwall, &neartagsprite,
@ -2888,7 +2888,7 @@ nullquote:
{ {
if ((unsigned)spritenum >= MAXSPRITES) if ((unsigned)spritenum >= MAXSPRITES)
{ {
OSD_Printf(CON_ERROR "invalid sprite ID %d\n",g_errorLineNum,keyw[g_tw],spritenum); CON_ERRPRINTF("invalid sprite ID %d\n", spritenum);
continue; continue;
} }
setsprite(spritenum, &davector); setsprite(spritenum, &davector);
@ -2900,7 +2900,7 @@ nullquote:
if ((unsigned)spritenum >= MAXSPRITES) if ((unsigned)spritenum >= MAXSPRITES)
{ {
OSD_Printf(CON_ERROR "invalid sprite ID %d\n",g_errorLineNum,keyw[g_tw],spritenum); CON_ERRPRINTF("invalid sprite ID %d\n", spritenum);
insptr++; insptr++;
continue; continue;
} }
@ -2916,7 +2916,7 @@ nullquote:
int32_t sectnum = Gv_GetVarX(*insptr++), x = Gv_GetVarX(*insptr++), y = Gv_GetVarX(*insptr++); int32_t sectnum = Gv_GetVarX(*insptr++), x = Gv_GetVarX(*insptr++), y = Gv_GetVarX(*insptr++);
if ((unsigned)sectnum >= (unsigned)numsectors) if ((unsigned)sectnum >= (unsigned)numsectors)
{ {
OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],sectnum); CON_ERRPRINTF("Invalid sector %d\n", sectnum);
insptr++; insptr++;
continue; continue;
} }
@ -3209,7 +3209,7 @@ nullquote:
ps->inv_amount[GET_BOOTS] = *insptr; ps->inv_amount[GET_BOOTS] = *insptr;
break; break;
default: default:
OSD_Printf(CON_ERROR "Invalid inventory ID %d\n",g_errorLineNum,keyw[g_tw],(int32_t)*(insptr-1)); CON_ERRPRINTF("Invalid inventory ID %d\n", (int32_t)*(insptr-1));
break; break;
} }
insptr++; insptr++;
@ -3332,7 +3332,7 @@ nullquote:
int32_t j = Gv_GetVarX(*insptr++); int32_t j = Gv_GetVarX(*insptr++);
if ((unsigned)j >= MAXVOLUMES*MAXLEVELS) if ((unsigned)j >= MAXVOLUMES*MAXLEVELS)
{ {
OSD_Printf(CON_ERROR "Invalid map number: %d\n",g_errorLineNum,keyw[g_tw],j); CON_ERRPRINTF("Invalid map number: %d\n", j);
continue; continue;
} }
if (MapInfo[j].savedstate) if (MapInfo[j].savedstate)
@ -3436,7 +3436,7 @@ nullquote:
insptr++; insptr++;
if ((unsigned)vm.g_p >= (unsigned)playerswhenstarted) if ((unsigned)vm.g_p >= (unsigned)playerswhenstarted)
{ {
OSD_Printf(CON_ERROR "invalid player ID %d\n",g_errorLineNum,keyw[g_tw],vm.g_p); CON_ERRPRINTF("invalid player ID %d\n", vm.g_p);
insptr += 4; insptr += 4;
} }
else else
@ -3462,7 +3462,7 @@ nullquote:
int32_t dq = Gv_GetVarX(*insptr++), sq = Gv_GetVarX(*insptr++); int32_t dq = Gv_GetVarX(*insptr++), sq = Gv_GetVarX(*insptr++);
if ((ScriptQuotes[sq] == NULL || ScriptQuotes[dq] == NULL)) if ((ScriptQuotes[sq] == NULL || ScriptQuotes[dq] == NULL))
{ {
OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],ScriptQuotes[sq] ? dq : sq); CON_ERRPRINTF("null quote %d\n", ScriptQuotes[sq] ? dq : sq);
while ((*insptr & 0xFFF) != CON_NULLOP) while ((*insptr & 0xFFF) != CON_NULLOP)
Gv_GetVarX(*insptr++); Gv_GetVarX(*insptr++);
@ -3584,7 +3584,7 @@ nullquote:
} }
else else
{ {
OSD_Printf(CON_ERROR "invalid array index\n",g_errorLineNum,keyw[g_tw]); CON_ERRPRINTF("invalid array index\n");
continue; continue;
} }
} }
@ -3598,7 +3598,7 @@ nullquote:
insptr = oinsptr; insptr = oinsptr;
if ((unsigned)index >= MAXSPRITES-1) if ((unsigned)index >= MAXSPRITES-1)
{ {
OSD_Printf(CON_ERROR "invalid array index\n",g_errorLineNum,keyw[g_tw]); CON_ERRPRINTF("invalid array index\n");
Gv_GetVarX(*insptr++); Gv_GetVarX(*insptr++);
continue; continue;
} }
@ -3615,7 +3615,7 @@ nullquote:
{ {
// invalid varID // invalid varID
insptr++; insptr++;
OSD_Printf(CON_ERROR "invalid variable\n",g_errorLineNum,keyw[g_tw]); CON_ERRPRINTF("invalid variable\n");
continue; // out of switch continue; // out of switch
} }
} }
@ -3995,7 +3995,7 @@ nullquote:
if ((unsigned)lSprite >= MAXSPRITES) if ((unsigned)lSprite >= MAXSPRITES)
{ {
OSD_Printf(CON_ERROR "invalid sprite ID %d\n",g_errorLineNum,keyw[g_tw],lSprite); CON_ERRPRINTF("invalid sprite ID %d\n", lSprite);
if (lVar1 == MAXGAMEVARS || lVar1 & ((MAXGAMEVARS<<2)|(MAXGAMEVARS<<3))) insptr++; if (lVar1 == MAXGAMEVARS || lVar1 & ((MAXGAMEVARS<<2)|(MAXGAMEVARS<<3))) insptr++;
if (lVar2 == MAXGAMEVARS || lVar2 & ((MAXGAMEVARS<<2)|(MAXGAMEVARS<<3))) insptr++; if (lVar2 == MAXGAMEVARS || lVar2 & ((MAXGAMEVARS<<2)|(MAXGAMEVARS<<3))) insptr++;
continue; continue;
@ -4025,7 +4025,7 @@ nullquote:
if ((unsigned)iPlayer >= (unsigned)playerswhenstarted) if ((unsigned)iPlayer >= (unsigned)playerswhenstarted)
{ {
OSD_Printf(CON_ERROR "invalid player ID %d\n",g_errorLineNum,keyw[g_tw],iPlayer); CON_ERRPRINTF("invalid player ID %d\n", iPlayer);
if (lVar1 == MAXGAMEVARS || lVar1 & ((MAXGAMEVARS<<2)|(MAXGAMEVARS<<3))) insptr++; if (lVar1 == MAXGAMEVARS || lVar1 & ((MAXGAMEVARS<<2)|(MAXGAMEVARS<<3))) insptr++;
if (lVar2 == MAXGAMEVARS || lVar2 & ((MAXGAMEVARS<<2)|(MAXGAMEVARS<<3))) insptr++; if (lVar2 == MAXGAMEVARS || lVar2 & ((MAXGAMEVARS<<2)|(MAXGAMEVARS<<3))) insptr++;
continue; continue;
@ -4121,7 +4121,7 @@ nullquote:
if ((unsigned)j >= (unsigned)playerswhenstarted) if ((unsigned)j >= (unsigned)playerswhenstarted)
{ {
OSD_Printf(CON_ERROR "Invalid player ID %d\n",g_errorLineNum,keyw[g_tw],j); CON_ERRPRINTF("Invalid player ID %d\n", j);
continue; continue;
} }
@ -4190,7 +4190,7 @@ nullquote:
if (ScriptQuotes[q] == NULL) if (ScriptQuotes[q] == NULL)
{ {
OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],q); CON_ERRPRINTF("null quote %d\n", q);
continue; continue;
} }
@ -4223,14 +4223,14 @@ nullquote:
if (G_ModDirSnprintf(temp, sizeof(temp), "%s", ScriptQuotes[q])) if (G_ModDirSnprintf(temp, sizeof(temp), "%s", ScriptQuotes[q]))
{ {
OSD_Printf(CON_ERROR "file name too long\n",g_errorLineNum,keyw[g_tw]); CON_ERRPRINTF("file name too long\n");
continue; continue;
} }
fil = fopen(temp,"wb"); fil = fopen(temp,"wb");
if (fil == NULL) if (fil == NULL)
{ {
OSD_Printf(CON_ERROR "couldn't open file",g_errorLineNum,keyw[g_tw]); CON_ERRPRINTF("couldn't open file");
continue; continue;
} }
@ -4314,7 +4314,7 @@ nullquote:
insptr++; insptr++;
if (*(insptr+1) == 0) if (*(insptr+1) == 0)
{ {
OSD_Printf(CON_ERROR "divide by zero!\n",g_errorLineNum,keyw[g_tw]); CON_ERRPRINTF("divide by zero!\n");
insptr += 2; insptr += 2;
continue; continue;
} }
@ -4326,7 +4326,7 @@ nullquote:
insptr++; insptr++;
if (*(insptr+1) == 0) if (*(insptr+1) == 0)
{ {
OSD_Printf(CON_ERROR "mod by zero!\n",g_errorLineNum,keyw[g_tw]); CON_ERRPRINTF("mod by zero!\n");
insptr += 2; insptr += 2;
continue; continue;
} }
@ -4389,7 +4389,7 @@ nullquote:
int32_t j=Gv_GetVarX(*insptr++); int32_t j=Gv_GetVarX(*insptr++);
if ((unsigned)j>=MAX_WEAPONS) if ((unsigned)j>=MAX_WEAPONS)
{ {
OSD_Printf(CON_ERROR "Invalid weapon ID %d\n",g_errorLineNum,keyw[g_tw],j); CON_ERRPRINTF("Invalid weapon ID %d\n", j);
insptr++; insptr++;
continue; continue;
} }
@ -4403,7 +4403,7 @@ nullquote:
int32_t j=Gv_GetVarX(*insptr++); int32_t j=Gv_GetVarX(*insptr++);
if ((unsigned)j>=MAX_WEAPONS) if ((unsigned)j>=MAX_WEAPONS)
{ {
OSD_Printf(CON_ERROR "Invalid weapon ID %d\n",g_errorLineNum,keyw[g_tw],j); CON_ERRPRINTF("Invalid weapon ID %d\n", j);
insptr++; insptr++;
continue; continue;
} }
@ -4428,7 +4428,7 @@ nullquote:
if (!l2) if (!l2)
{ {
OSD_Printf(CON_ERROR "divide by zero!\n",g_errorLineNum,keyw[g_tw]); CON_ERRPRINTF("divide by zero!\n");
continue; continue;
} }
@ -4444,7 +4444,7 @@ nullquote:
if (!l2) if (!l2)
{ {
OSD_Printf(CON_ERROR "mod by zero!\n",g_errorLineNum,keyw[g_tw]); CON_ERRPRINTF("mod by zero!\n");
continue; continue;
} }
@ -4573,7 +4573,7 @@ nullquote:
else g_musicIndex=(ud.volume_number*MAXLEVELS)+(Gv_GetVarX(*(insptr++))); else g_musicIndex=(ud.volume_number*MAXLEVELS)+(Gv_GetVarX(*(insptr++)));
if (MapInfo[g_musicIndex].musicfn == NULL) if (MapInfo[g_musicIndex].musicfn == NULL)
{ {
OSD_Printf(CON_ERROR "null music for map %d\n",g_errorLineNum,keyw[g_tw],g_musicIndex); CON_ERRPRINTF("null music for map %d\n", g_musicIndex);
continue; continue;
} }
S_PlayMusic(&MapInfo[g_musicIndex].musicfn[0],g_musicIndex); S_PlayMusic(&MapInfo[g_musicIndex].musicfn[0],g_musicIndex);
@ -4585,7 +4585,7 @@ nullquote:
int32_t j=Gv_GetVarX(*(insptr++)); int32_t j=Gv_GetVarX(*(insptr++));
if (numplayers != 1 || !(g_player[myconnectindex].ps->gm & MODE_GAME)) if (numplayers != 1 || !(g_player[myconnectindex].ps->gm & MODE_GAME))
{ {
OSD_Printf(CON_ERROR "not in a single-player game.\n",g_errorLineNum,keyw[g_tw]); CON_ERRPRINTF("not in a single-player game.\n");
continue; continue;
} }
osdcmd_cheatsinfo_stat.cheatnum = j; osdcmd_cheatsinfo_stat.cheatnum = j;
@ -4830,7 +4830,7 @@ nullquote:
if (ps->inv_amount[GET_BOOTS] != *insptr) j = 1; if (ps->inv_amount[GET_BOOTS] != *insptr) j = 1;
break; break;
default: default:
OSD_Printf(CON_ERROR "invalid inventory ID: %d\n",g_errorLineNum,keyw[g_tw],(int32_t)*(insptr-1)); CON_ERRPRINTF("invalid inventory ID: %d\n", (int32_t)*(insptr-1));
} }
VM_CONDITIONAL(j); VM_CONDITIONAL(j);
@ -4895,21 +4895,21 @@ nullquote:
if ((unsigned)(*insptr) >= MAXQUOTES) if ((unsigned)(*insptr) >= MAXQUOTES)
{ {
OSD_Printf(CON_ERROR "invalid quote ID %d\n",g_errorLineNum,keyw[g_tw],(int32_t)(*insptr)); CON_ERRPRINTF("invalid quote ID %d\n", (int32_t)(*insptr));
insptr++; insptr++;
continue; continue;
} }
if ((ScriptQuotes[*insptr] == NULL)) if ((ScriptQuotes[*insptr] == NULL))
{ {
OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],(int32_t)*insptr); CON_ERRPRINTF("null quote %d\n", (int32_t)*insptr);
insptr++; insptr++;
continue; continue;
} }
if ((unsigned)vm.g_p >= MAXPLAYERS) if ((unsigned)vm.g_p >= MAXPLAYERS)
{ {
OSD_Printf(CON_ERROR "bad player for quote %d: (%d)\n",g_errorLineNum,keyw[g_tw],(int32_t)*insptr,vm.g_p); CON_ERRPRINTF("bad player for quote %d: (%d)\n", (int32_t)*insptr,vm.g_p);
insptr++; insptr++;
continue; continue;
} }
@ -4924,14 +4924,14 @@ nullquote:
if ((unsigned)i >= MAXQUOTES) if ((unsigned)i >= MAXQUOTES)
{ {
OSD_Printf(CON_ERROR "invalid quote ID %d\n",g_errorLineNum,keyw[g_tw],i); CON_ERRPRINTF("invalid quote ID %d\n", i);
insptr++; insptr++;
continue; continue;
} }
if ((ScriptQuotes[i] == NULL)) if ((ScriptQuotes[i] == NULL))
{ {
OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],i); CON_ERRPRINTF("null quote %d\n", i);
continue; continue;
} }
G_AddUserQuote(ScriptQuotes[i]); G_AddUserQuote(ScriptQuotes[i]);
@ -4945,14 +4945,14 @@ nullquote:
if ((unsigned)i >= MAXQUOTES) if ((unsigned)i >= MAXQUOTES)
{ {
OSD_Printf(CON_ERROR "invalid quote ID %d\n",g_errorLineNum,keyw[g_tw],i); CON_ERRPRINTF("invalid quote ID %d\n", i);
insptr++; insptr++;
continue; continue;
} }
if ((ScriptQuotes[i] == NULL)) if ((ScriptQuotes[i] == NULL))
{ {
OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],i); CON_ERRPRINTF("null quote %d\n", i);
continue; continue;
} }
OSD_Printf("%s\n",ScriptQuotes[i]); OSD_Printf("%s\n",ScriptQuotes[i]);

View file

@ -149,4 +149,8 @@ void Gv_RefreshPointers(void);
int32_t VM_OnEvent(int32_t iEventID,int32_t iActor,int32_t iPlayer,int32_t lDist, int32_t iReturn); int32_t VM_OnEvent(int32_t iEventID,int32_t iActor,int32_t iPlayer,int32_t lDist, int32_t iReturn);
void VM_ScriptInfo(void); void VM_ScriptInfo(void);
#define CON_ERRPRINTF(Text, ...) do { \
OSD_Printf("Line %d, %s: " Text, g_errorLineNum, keyw[g_tw], ## __VA_ARGS__); \
} while (0)
#endif #endif

View file

@ -921,9 +921,9 @@ static void __fastcall VM_AccessActiveProjectile(int32_t iSet, int32_t lVar1, in
if ((unsigned)proj >= MAXSPRITES) if ((unsigned)proj >= MAXSPRITES)
{ {
// OSD_Printf("VM_AccessActiveProjectile(): invalid projectile (%d)\n",proj); // OSD_Printf("VM_AccessActiveProjectile(): invalid projectile (%d)\n",proj);
OSD_Printf(CON_ERROR "tried to %s %s on invalid target projectile (%d) %d %d from %s\n",g_errorLineNum,keyw[g_tw], CON_ERRPRINTF("tried to %s %s on invalid target projectile (%d) %d %d from %s\n",
iSet?"set":"get",ProjectileLabels[lLabelID].name,proj,vm.g_i,vm.g_sp->picnum, iSet?"set":"get",ProjectileLabels[lLabelID].name,proj,vm.g_i,vm.g_sp->picnum,
(lVar1<MAXGAMEVARS)?aGameVars[lVar1].szLabel:"extended"); (lVar1<MAXGAMEVARS)?aGameVars[lVar1].szLabel:"extended");
insptr += (lVar2 == MAXGAMEVARS); insptr += (lVar2 == MAXGAMEVARS);
return; return;
} }
@ -1524,14 +1524,14 @@ static void __fastcall VM_GetPlayer(register int32_t lVar1, register int32_t lLa
badplayer: badplayer:
// OSD_Printf("VM_AccessPlayer(): invalid target player (%d) %d\n",iPlayer,vm.g_i); // OSD_Printf("VM_AccessPlayer(): invalid target player (%d) %d\n",iPlayer,vm.g_i);
OSD_Printf(CON_ERROR "tried to get %s on invalid target player (%d) from spr %d gv %s\n",g_errorLineNum,keyw[g_tw], CON_ERRPRINTF("tried to get %s on invalid target player (%d) from spr %d gv %s\n",
PlayerLabels[lLabelID].name,iPlayer,vm.g_i, PlayerLabels[lLabelID].name,iPlayer,vm.g_i,
(lVar1<MAXGAMEVARS)?aGameVars[lVar1].szLabel:"extended"); (lVar1<MAXGAMEVARS)?aGameVars[lVar1].szLabel:"extended");
return; return;
badpos: badpos:
OSD_Printf(CON_ERROR "tried to get invalid %s position %d on player (%d) from spr %d\n",g_errorLineNum,keyw[g_tw], CON_ERRPRINTF("tried to get invalid %s position %d on player (%d) from spr %d\n",
PlayerLabels[lLabelID].name,lParm2,iPlayer,vm.g_i); PlayerLabels[lLabelID].name,lParm2,iPlayer,vm.g_i);
return; return;
} }
@ -1871,15 +1871,15 @@ static void __fastcall VM_SetPlayer(int32_t lVar1, int32_t lLabelID, int32_t lVa
badplayer: badplayer:
// OSD_Printf("VM_AccessPlayer(): invalid target player (%d) %d\n",iPlayer,vm.g_i); // OSD_Printf("VM_AccessPlayer(): invalid target player (%d) %d\n",iPlayer,vm.g_i);
OSD_Printf(CON_ERROR "tried to set %s on invalid target player (%d) from spr %d gv %s\n",g_errorLineNum,keyw[g_tw], CON_ERRPRINTF("tried to set %s on invalid target player (%d) from spr %d gv %s\n",
PlayerLabels[lLabelID].name,iPlayer,vm.g_i, PlayerLabels[lLabelID].name,iPlayer,vm.g_i,
(lVar1<MAXGAMEVARS)?aGameVars[lVar1].szLabel:"extended"); (lVar1<MAXGAMEVARS)?aGameVars[lVar1].szLabel:"extended");
insptr += (lVar2 == MAXGAMEVARS); insptr += (lVar2 == MAXGAMEVARS);
return; return;
badpos: badpos:
OSD_Printf(CON_ERROR "tried to set invalid %s position %d on player (%d) from spr %d\n",g_errorLineNum,keyw[g_tw], CON_ERRPRINTF("tried to set invalid %s position %d on player (%d) from spr %d\n",
PlayerLabels[lLabelID].name,lParm2,iPlayer,vm.g_i); PlayerLabels[lLabelID].name,lParm2,iPlayer,vm.g_i);
insptr += (lVar2 == MAXGAMEVARS); insptr += (lVar2 == MAXGAMEVARS);
return; return;
} }
@ -1959,7 +1959,7 @@ static void __fastcall VM_AccessPlayerInput(int32_t iSet, int32_t lVar1, int32_t
badplayer: badplayer:
insptr += (lVar2 == MAXGAMEVARS); insptr += (lVar2 == MAXGAMEVARS);
OSD_Printf(CON_ERROR "invalid target player (%d) %d\n",g_errorLineNum,keyw[g_tw],iPlayer,vm.g_i); CON_ERRPRINTF("invalid target player (%d) %d\n", iPlayer,vm.g_i);
return; return;
} }
@ -2134,7 +2134,7 @@ static void __fastcall VM_AccessWall(int32_t iSet, int32_t lVar1, int32_t lLabel
badwall: badwall:
insptr += (lVar2 == MAXGAMEVARS); insptr += (lVar2 == MAXGAMEVARS);
OSD_Printf(CON_ERROR "Invalid wall %d\n",g_errorLineNum,keyw[g_tw],iWall); CON_ERRPRINTF("Invalid wall %d\n", iWall);
return; return;
} }
@ -2378,7 +2378,7 @@ static void __fastcall VM_AccessSector(int32_t iSet, int32_t lVar1, int32_t lLab
} }
badsector: badsector:
OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],iSector); CON_ERRPRINTF("Invalid sector %d\n", iSector);
insptr += (lVar2 == MAXGAMEVARS); insptr += (lVar2 == MAXGAMEVARS);
return; return;
} }
@ -2613,15 +2613,15 @@ static void __fastcall VM_SetSprite(int32_t lVar1, int32_t lLabelID, int32_t lVa
} }
badactor: badactor:
OSD_Printf(CON_ERROR "tried to set %s on invalid target sprite (%d) from spr %d pic %d gv %s\n",g_errorLineNum,keyw[g_tw], CON_ERRPRINTF("tried to set %s on invalid target sprite (%d) from spr %d pic %d gv %s\n",
ActorLabels[lLabelID].name,iActor,vm.g_i,vm.g_sp->picnum, ActorLabels[lLabelID].name,iActor,vm.g_i,vm.g_sp->picnum,
(lVar1<MAXGAMEVARS)?aGameVars[lVar1].szLabel:"extended"); (lVar1<MAXGAMEVARS)?aGameVars[lVar1].szLabel:"extended");
insptr += (lVar2 == MAXGAMEVARS); insptr += (lVar2 == MAXGAMEVARS);
return; return;
badpos: badpos:
OSD_Printf(CON_ERROR "tried to set invalid %s position %d on sprite (%d) from spr %d\n",g_errorLineNum,keyw[g_tw], CON_ERRPRINTF("tried to set invalid %s position %d on sprite (%d) from spr %d\n",
ActorLabels[lLabelID].name,lParm2,iActor,vm.g_i); ActorLabels[lLabelID].name,lParm2,iActor,vm.g_i);
insptr += (lVar2 == MAXGAMEVARS); insptr += (lVar2 == MAXGAMEVARS);
return; return;
} }
@ -2855,15 +2855,15 @@ static void __fastcall VM_GetSprite(int32_t lVar1, int32_t lLabelID, int32_t lVa
} }
badactor: badactor:
OSD_Printf(CON_ERROR "tried to get %s on invalid target sprite (%d) from spr %d pic %d gv %s\n",g_errorLineNum,keyw[g_tw], CON_ERRPRINTF("tried to get %s on invalid target sprite (%d) from spr %d pic %d gv %s\n",
ActorLabels[lLabelID].name,iActor,vm.g_i,vm.g_sp->picnum, ActorLabels[lLabelID].name,iActor,vm.g_i,vm.g_sp->picnum,
(lVar1<MAXGAMEVARS)?aGameVars[lVar1].szLabel:"extended"); (lVar1<MAXGAMEVARS)?aGameVars[lVar1].szLabel:"extended");
insptr += (lVar2 == MAXGAMEVARS); insptr += (lVar2 == MAXGAMEVARS);
return; return;
badpos: badpos:
OSD_Printf(CON_ERROR "tried to get invalid %s position %d on sprite (%d) from spr %d\n",g_errorLineNum,keyw[g_tw], CON_ERRPRINTF("tried to get invalid %s position %d on sprite (%d) from spr %d\n",
ActorLabels[lLabelID].name,lParm2,iActor,vm.g_i); ActorLabels[lLabelID].name,lParm2,iActor,vm.g_i);
insptr += (lVar2 == MAXGAMEVARS); insptr += (lVar2 == MAXGAMEVARS);
return; return;
} }
@ -3102,12 +3102,12 @@ static void __fastcall VM_AccessTsprite(int32_t iSet, int32_t lVar1, int32_t lLa
} }
badsprite: badsprite:
OSD_Printf(CON_ERROR "invalid target sprite (%d) %d %d\n",g_errorLineNum,keyw[g_tw],iActor,vm.g_i,vm.g_sp->picnum); CON_ERRPRINTF("invalid target sprite (%d) %d %d\n", iActor, vm.g_i, vm.g_sp->picnum);
insptr += (lVar2 == MAXGAMEVARS); insptr += (lVar2 == MAXGAMEVARS);
return; return;
badtspr: badtspr:
OSD_Printf(CON_ERROR "Internal bug, tsprite is unavailable\n",g_errorLineNum,keyw[g_tw]); CON_ERRPRINTF("Internal bug, tsprite is unavailable\n");
return; return;
} }
@ -3380,7 +3380,7 @@ static void __fastcall VM_AccessProjectile(int32_t iSet, int32_t lVar1, int32_t
} }
badtile: badtile:
OSD_Printf(CON_ERROR "invalid tile (%d)\n",g_errorLineNum,keyw[g_tw],lVar1); CON_ERRPRINTF("invalid tile (%d)\n", lVar1);
insptr += (lVar2 == MAXGAMEVARS); insptr += (lVar2 == MAXGAMEVARS);
return; return;
} }
@ -3448,8 +3448,8 @@ static int32_t __fastcall VM_AccessSpriteX(int32_t iActor, int32_t lLabelID, int
} }
badpos: badpos:
OSD_Printf(CON_ERROR "tried to get invalid %s position %d on sprite (%d) from spr %d\n", CON_ERRPRINTF("tried to get invalid %s position %d on sprite (%d) from spr %d\n",
g_errorLineNum,keyw[g_tw],ActorLabels[lLabelID].name,lParm2,iActor,vm.g_i); ActorLabels[lLabelID].name,lParm2,iActor,vm.g_i);
return -1; return -1;
} }
@ -3802,8 +3802,8 @@ static int32_t __fastcall VM_AccessPlayerX(int32_t iPlayer, int32_t lLabelID, in
} }
badpos: badpos:
OSD_Printf(CON_ERROR "tried to get invalid %s position %d on player (%d) from spr %d\n", CON_ERRPRINTF("tried to get invalid %s position %d on player (%d) from spr %d\n",
g_errorLineNum,keyw[g_tw],PlayerLabels[lLabelID].name,lParm2,iPlayer,vm.g_i); PlayerLabels[lLabelID].name,lParm2,iPlayer,vm.g_i);
return -1; return -1;
} }

View file

@ -661,35 +661,35 @@ int32_t __fastcall Gv_GetVar(register int32_t id, register int32_t iActor, regis
} }
bad_id: bad_id:
OSD_Printf(CON_ERROR "Gv_GetVar(): invalid sprite/player ID %d/%d\n",g_errorLineNum,keyw[g_tw],iActor,iPlayer); CON_ERRPRINTF("Gv_GetVar(): invalid sprite/player ID %d/%d\n", iActor,iPlayer);
return -1; return -1;
badvarid: badvarid:
OSD_Printf(CON_ERROR "Gv_GetVar(): invalid gamevar ID (%d)\n",g_errorLineNum,keyw[g_tw],id); CON_ERRPRINTF("Gv_GetVar(): invalid gamevar ID (%d)\n", id);
return -1; return -1;
badindex: badindex:
OSD_Printf(CON_ERROR "Gv_GetVar(): invalid array index (%s[%d])\n",g_errorLineNum,keyw[g_tw],aGameArrays[id].szLabel,iActor); CON_ERRPRINTF("Gv_GetVar(): invalid array index (%s[%d])\n", aGameArrays[id].szLabel,iActor);
return -1; return -1;
badplayer: badplayer:
OSD_Printf(CON_ERROR "Gv_GetVar(): invalid player ID %d\n",g_errorLineNum,keyw[g_tw], iPlayer); CON_ERRPRINTF("Gv_GetVar(): invalid player ID %d\n", iPlayer);
return -1; return -1;
badsprite: badsprite:
OSD_Printf(CON_ERROR "Gv_GetVar(): invalid sprite ID %d\n",g_errorLineNum,keyw[g_tw], iPlayer); CON_ERRPRINTF("Gv_GetVar(): invalid sprite ID %d\n", iPlayer);
return -1; return -1;
badsector: badsector:
OSD_Printf(CON_ERROR "Gv_GetVar(): invalid sector ID %d\n",g_errorLineNum,keyw[g_tw], iPlayer); CON_ERRPRINTF("Gv_GetVar(): invalid sector ID %d\n", iPlayer);
return -1; return -1;
badwall: badwall:
OSD_Printf(CON_ERROR "Gv_GetVar(): invalid wall ID %d\n",g_errorLineNum,keyw[g_tw], iPlayer); CON_ERRPRINTF("Gv_GetVar(): invalid wall ID %d\n", iPlayer);
return -1; return -1;
wtf: wtf:
OSD_Printf(CON_ERROR "Gv_GetVar(): WTF?\n",g_errorLineNum,keyw[g_tw]); CON_ERRPRINTF("Gv_GetVar(): WTF?\n");
return -1; return -1;
} }
@ -726,13 +726,12 @@ void __fastcall Gv_SetVar(register int32_t id, register int32_t lValue, register
} }
badvarid: badvarid:
OSD_Printf(CON_ERROR "Gv_SetVar(): invalid gamevar (%d) from sprite %d (%d), player %d\n", CON_ERRPRINTF("Gv_SetVar(): invalid gamevar (%d) from sprite %d (%d), player %d\n",
g_errorLineNum,keyw[g_tw],id,vm.g_i,sprite[vm.g_i].picnum,vm.g_p); id,vm.g_i,sprite[vm.g_i].picnum,vm.g_p);
return; return;
badindex: badindex:
OSD_Printf(CON_ERROR "Gv_SetVar(): invalid index (%d) for gamevar %s from sprite %d, player %d\n", CON_ERRPRINTF("Gv_SetVar(): invalid index (%d) for gamevar %s from sprite %d, player %d\n",
g_errorLineNum,keyw[g_tw],
aGameVars[id].dwFlags & GAMEVAR_PERACTOR ? iActor : iPlayer, aGameVars[id].dwFlags & GAMEVAR_PERACTOR ? iActor : iPlayer,
aGameVars[id].szLabel,vm.g_i,vm.g_p); aGameVars[id].szLabel,vm.g_i,vm.g_p);
return; return;
@ -856,31 +855,31 @@ int32_t __fastcall Gv_GetVarX(register int32_t id)
} }
badindex: badindex:
OSD_Printf(CON_ERROR "Gv_GetVarX(): invalid array index (%s[%d])\n",g_errorLineNum,keyw[g_tw],aGameArrays[id].szLabel,(int32_t)negateResult); CON_ERRPRINTF("Gv_GetVarX(): invalid array index (%s[%d])\n", aGameArrays[id].szLabel, (int32_t)negateResult);
return -1; return -1;
badvarid: badvarid:
OSD_Printf(CON_ERROR "Gv_GetVarX(): invalid gamevar ID (%d)\n",g_errorLineNum,keyw[g_tw],id); CON_ERRPRINTF("Gv_GetVarX(): invalid gamevar ID (%d)\n", id);
return -1; return -1;
badplayer: badplayer:
OSD_Printf(CON_ERROR "Gv_GetVarX(): invalid player ID %d\n",g_errorLineNum,keyw[g_tw], id); CON_ERRPRINTF("Gv_GetVarX(): invalid player ID %d\n", id);
return -1; return -1;
badsprite: badsprite:
OSD_Printf(CON_ERROR "Gv_GetVarX(): invalid sprite ID %d\n",g_errorLineNum,keyw[g_tw], id); CON_ERRPRINTF("Gv_GetVarX(): invalid sprite ID %d\n", id);
return -1; return -1;
badsector: badsector:
OSD_Printf(CON_ERROR "Gv_GetVarX(): invalid sector ID %d\n",g_errorLineNum,keyw[g_tw], id); CON_ERRPRINTF("Gv_GetVarX(): invalid sector ID %d\n", id);
return -1; return -1;
badwall: badwall:
OSD_Printf(CON_ERROR "Gv_GetVarX(): invalid wall ID %d\n",g_errorLineNum,keyw[g_tw], id); CON_ERRPRINTF("Gv_GetVarX(): invalid wall ID %d\n", id);
return -1; return -1;
wtf: wtf:
OSD_Printf(CON_ERROR "Gv_GetVar(): WTF?\n",g_errorLineNum,keyw[g_tw]); CON_ERRPRINTF("Gv_GetVar(): WTF?\n");
return -1; return -1;
} }
} }
@ -912,8 +911,7 @@ void __fastcall Gv_SetVarX(register int32_t id, register int32_t lValue)
} }
badindex: badindex:
OSD_Printf(CON_ERROR "Gv_SetVar(): invalid index (%d) for gamevar %s\n", CON_ERRPRINTF("Gv_SetVar(): invalid index (%d) for gamevar %s\n",
g_errorLineNum,keyw[g_tw],
aGameVars[id].dwFlags & GAMEVAR_PERACTOR ? vm.g_i : vm.g_p, aGameVars[id].dwFlags & GAMEVAR_PERACTOR ? vm.g_i : vm.g_p,
aGameVars[id].szLabel); aGameVars[id].szLabel);
return; return;
@ -939,7 +937,7 @@ static intptr_t *Gv_GetVarDataPtr(const char *szGameLabel)
if (aGameVars[i].dwFlags & (GAMEVAR_PERACTOR | GAMEVAR_PERPLAYER)) if (aGameVars[i].dwFlags & (GAMEVAR_PERACTOR | GAMEVAR_PERPLAYER))
{ {
if (!aGameVars[i].val.plValues) if (!aGameVars[i].val.plValues)
OSD_Printf(CON_ERROR "Gv_GetVarDataPtr(): INTERNAL ERROR: NULL array !!!\n",g_errorLineNum,keyw[g_tw]); CON_ERRPRINTF("Gv_GetVarDataPtr(): INTERNAL ERROR: NULL array !!!\n");
return aGameVars[i].val.plValues; return aGameVars[i].val.plValues;
} }