mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-16 09:21:36 +00:00
More EDUKE32_PREDICT_FALSE, mostly in OSD_Printf(OSD_ERROR...) cases
git-svn-id: https://svn.eduke32.com/eduke32@4699 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
6f5726e015
commit
183b34f48e
4 changed files with 35 additions and 69 deletions
|
@ -590,7 +590,7 @@ void G_Polymer_UnInit(void)
|
|||
// deletesprite() game wrapper
|
||||
void A_DeleteSprite(int32_t s)
|
||||
{
|
||||
if (block_deletesprite)
|
||||
if (EDUKE32_PREDICT_FALSE(block_deletesprite))
|
||||
{
|
||||
OSD_Printf(OSD_ERROR "A_DeleteSprite(): tried to remove sprite %d in EVENT_EGS\n",s);
|
||||
return;
|
||||
|
@ -1525,11 +1525,11 @@ ACTOR_STATIC void G_MoveFallers(void)
|
|||
A_SetSprite(i,CLIPMASK0);
|
||||
}
|
||||
|
||||
if (G_CheckForSpaceFloor(s->sectnum))
|
||||
if (EDUKE32_PREDICT_FALSE(G_CheckForSpaceFloor(s->sectnum)))
|
||||
x = 0;
|
||||
else
|
||||
{
|
||||
if (G_CheckForSpaceCeiling(s->sectnum))
|
||||
if (EDUKE32_PREDICT_FALSE(G_CheckForSpaceCeiling(s->sectnum)))
|
||||
x = g_spriteGravity/6;
|
||||
else
|
||||
x = g_spriteGravity;
|
||||
|
@ -2978,43 +2978,6 @@ ACTOR_STATIC void G_MoveWeapons(void)
|
|||
case RADIUSEXPLOSION__STATIC:
|
||||
case KNEE__STATIC:
|
||||
KILLIT(i);
|
||||
/*
|
||||
case TONGUE__STATIC:
|
||||
T1 = sintable[(T2)&2047]>>9;
|
||||
T2 += 32;
|
||||
if (T2 > 2047)
|
||||
KILLIT(i);
|
||||
|
||||
if (sprite[s->owner].statnum == MAXSTATUS)
|
||||
if (A_CheckEnemySprite(&sprite[s->owner]) == 0)
|
||||
KILLIT(i);
|
||||
|
||||
s->ang = sprite[s->owner].ang;
|
||||
s->x = sprite[s->owner].x;
|
||||
s->y = sprite[s->owner].y;
|
||||
if (sprite[s->owner].picnum == APLAYER)
|
||||
s->z = sprite[s->owner].z-(34<<8);
|
||||
for (k=0; k<T1; k++)
|
||||
{
|
||||
q = A_InsertSprite(s->sectnum,
|
||||
s->x+((k*sintable[(s->ang+512)&2047])>>9),
|
||||
s->y+((k*sintable[s->ang&2047])>>9),
|
||||
s->z+((k*ksgn(s->zvel))*klabs(s->zvel/12)),TONGUE,-40+(k<<1),
|
||||
8,8,0,0,0,i,5);
|
||||
sprite[q].cstat = 128;
|
||||
sprite[q].pal = 8;
|
||||
}
|
||||
q = A_InsertSprite(s->sectnum,
|
||||
s->x+((k*sintable[(s->ang+512)&2047])>>9),
|
||||
s->y+((k*sintable[s->ang&2047])>>9),
|
||||
s->z+((k*ksgn(s->zvel))*klabs(s->zvel/12)),INNERJAW,-40,
|
||||
32,32,0,0,0,i,5);
|
||||
sprite[q].cstat = 128;
|
||||
if (T2 > 512 && T2 < (1024))
|
||||
sprite[q].picnum = INNERJAW+1;
|
||||
|
||||
goto BOLT;
|
||||
*/
|
||||
|
||||
case FREEZEBLAST__STATIC:
|
||||
if (s->yvel < 1 || s->extra < 2 || (s->xvel|s->zvel) == 0)
|
||||
|
|
|
@ -2665,7 +2665,7 @@ void G_PrintGameQuotes(int32_t snum)
|
|||
if (ps->fta <= 1)
|
||||
return;
|
||||
|
||||
if (ScriptQuotes[ps->ftq] == NULL)
|
||||
if (EDUKE32_PREDICT_FALSE(ScriptQuotes[ps->ftq] == NULL))
|
||||
{
|
||||
OSD_Printf(OSD_ERROR "%s %d null quote %d\n",__FILE__,__LINE__,ps->ftq);
|
||||
return;
|
||||
|
@ -2739,7 +2739,7 @@ void P_DoQuote(int32_t q, DukePlayer_t *p)
|
|||
q &= ~MAXQUOTES;
|
||||
}
|
||||
|
||||
if (ScriptQuotes[q] == NULL)
|
||||
if (EDUKE32_PREDICT_FALSE(ScriptQuotes[q] == NULL))
|
||||
{
|
||||
OSD_Printf(OSD_ERROR "%s %d null quote %d\n",__FILE__,__LINE__,q);
|
||||
return;
|
||||
|
@ -4683,7 +4683,7 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio)
|
|||
|
||||
if (dont_draw != 1) // event return values other than 0 and 1 are reserved
|
||||
{
|
||||
if (dont_draw != 0)
|
||||
if (EDUKE32_PREDICT_FALSE(dont_draw != 0))
|
||||
OSD_Printf(OSD_ERROR "ERROR: EVENT_DISPLAYROOMS return value must be 0 or 1, "
|
||||
"other values are reserved.\n");
|
||||
|
||||
|
@ -6005,7 +6005,7 @@ int32_t A_Spawn(int32_t j, int32_t pn)
|
|||
break;
|
||||
}
|
||||
case WATERBUBBLEMAKER__STATIC:
|
||||
if (sp->hitag && sp->picnum == WATERBUBBLEMAKER)
|
||||
if (EDUKE32_PREDICT_FALSE(sp->hitag && sp->picnum == WATERBUBBLEMAKER))
|
||||
{
|
||||
// JBF 20030913: Pisses off X_Move(), eg. in bobsp2
|
||||
OSD_Printf_nowarn(OSD_ERROR "WARNING: WATERBUBBLEMAKER %d @ %d,%d with hitag!=0. Applying fixup.\n",
|
||||
|
@ -6586,10 +6586,9 @@ int32_t A_Spawn(int32_t j, int32_t pn)
|
|||
T3 = sector[sect].floorz; //Stopping loc
|
||||
|
||||
j = nextsectorneighborz(sect,sector[sect].floorz,-1,-1);
|
||||
if (j >= 0)
|
||||
{
|
||||
|
||||
if (EDUKE32_PREDICT_TRUE(j >= 0))
|
||||
T4 = sector[j].ceilingz;
|
||||
}
|
||||
else
|
||||
{
|
||||
// use elevator sector's ceiling as heuristic
|
||||
|
@ -6600,7 +6599,8 @@ int32_t A_Spawn(int32_t j, int32_t pn)
|
|||
}
|
||||
|
||||
j = nextsectorneighborz(sect,sector[sect].ceilingz,1,1);
|
||||
if (j >= 0)
|
||||
|
||||
if (EDUKE32_PREDICT_TRUE(j >= 0))
|
||||
T5 = sector[j].floorz;
|
||||
else
|
||||
{
|
||||
|
@ -6806,7 +6806,7 @@ int32_t A_Spawn(int32_t j, int32_t pn)
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (j == -1)
|
||||
if (EDUKE32_PREDICT_FALSE(j == -1))
|
||||
{
|
||||
OSD_Printf_nowarn(OSD_ERROR "Found lonely Sector Effector (lotag 0) at (%d,%d)\n",
|
||||
TrackerCast(sp->x),TrackerCast(sp->y));
|
||||
|
@ -6825,7 +6825,7 @@ int32_t A_Spawn(int32_t j, int32_t pn)
|
|||
msx[tempwallptr] = wall[s].x-sp->x;
|
||||
msy[tempwallptr] = wall[s].y-sp->y;
|
||||
tempwallptr++;
|
||||
if (tempwallptr > 2047)
|
||||
if (EDUKE32_PREDICT_FALSE(tempwallptr > 2047))
|
||||
{
|
||||
Bsprintf_nowarn(tempbuf, "Too many moving sectors at (%d,%d).\n",
|
||||
TrackerCast(wall[s].x),TrackerCast(wall[s].y));
|
||||
|
|
|
@ -67,8 +67,14 @@ GAMEEXEC_STATIC void VM_Execute(int32_t loop);
|
|||
# include "gamestructures.c"
|
||||
#endif
|
||||
|
||||
#define VM_CONDITIONAL(xxx) { if ((xxx) || ((insptr = (intptr_t *)*(insptr+1)) && (((*insptr) & 0xfff) == CON_ELSE))) \
|
||||
{ insptr += 2; VM_Execute(0); } }
|
||||
#define VM_CONDITIONAL(xxx) \
|
||||
{ \
|
||||
if ((xxx) || ((insptr = (intptr_t *)*(insptr + 1)) && (((*insptr) & 0xfff) == CON_ELSE))) \
|
||||
{ \
|
||||
insptr += 2; \
|
||||
VM_Execute(0); \
|
||||
} \
|
||||
}
|
||||
|
||||
void VM_ScriptInfo(void)
|
||||
{
|
||||
|
@ -782,7 +788,7 @@ dead:
|
|||
|
||||
static void P_AddWeaponMaybeSwitch(DukePlayer_t *ps, int32_t weap)
|
||||
{
|
||||
if ((ps->weaponswitch & 1) && (ps->weaponswitch & 4))
|
||||
if ((ps->weaponswitch & (1|4)) == (1|4))
|
||||
{
|
||||
const int32_t snum = P_Get(ps->i);
|
||||
int32_t i, new_wchoice = -1, curr_wchoice = -1;
|
||||
|
@ -825,7 +831,7 @@ static void P_AddWeaponAmmoCommon(DukePlayer_t *ps, int32_t weap, int32_t amount
|
|||
|
||||
static int32_t VM_AddWeapon(int32_t weap, int32_t amount, DukePlayer_t *ps)
|
||||
{
|
||||
if ((unsigned)weap >= MAX_WEAPONS)
|
||||
if (EDUKE32_PREDICT_FALSE((unsigned)weap >= MAX_WEAPONS))
|
||||
{
|
||||
CON_ERRPRINTF("Invalid weapon ID %d\n", weap);
|
||||
return 1;
|
||||
|
@ -1425,10 +1431,6 @@ skip_check:
|
|||
P_DropWeapon(P_GetP(vm.g_sp));
|
||||
continue;
|
||||
|
||||
case CON_NULLOP:
|
||||
insptr++;
|
||||
continue;
|
||||
|
||||
case CON_MIKESND:
|
||||
insptr++;
|
||||
if (EDUKE32_PREDICT_FALSE(((unsigned)vm.g_sp->yvel >= MAXSOUNDS)))
|
||||
|
@ -1607,8 +1609,9 @@ skip_check:
|
|||
return;
|
||||
case CON_RIGHTBRACE:
|
||||
loop--;
|
||||
case CON_NULLOP:
|
||||
insptr++;
|
||||
continue;;
|
||||
continue;
|
||||
|
||||
case CON_ADDAMMO:
|
||||
insptr++;
|
||||
|
|
|
@ -256,7 +256,7 @@ int32_t S_PlayMusic(const char *fn, const int32_t sel)
|
|||
}
|
||||
while (0);
|
||||
|
||||
if (fp < 0)
|
||||
if (EDUKE32_PREDICT_FALSE(fp < 0))
|
||||
{
|
||||
OSD_Printf(OSD_ERROR "S_PlayMusic(): error: can't open \"%s\" for playback!\n",fn);
|
||||
return 0;
|
||||
|
@ -266,7 +266,7 @@ int32_t S_PlayMusic(const char *fn, const int32_t sel)
|
|||
|
||||
MusicLen = kfilelength(fp);
|
||||
|
||||
if (MusicLen < 4)
|
||||
if (EDUKE32_PREDICT_FALSE(MusicLen < 4))
|
||||
{
|
||||
OSD_Printf(OSD_ERROR "S_PlayMusic(): error: empty music file \"%s\"\n", fn);
|
||||
kclose(fp);
|
||||
|
@ -277,7 +277,7 @@ int32_t S_PlayMusic(const char *fn, const int32_t sel)
|
|||
MusicPtr = (char *)Xmalloc(MusicLen);
|
||||
g_musicSize = kread(fp, (char *)MusicPtr, MusicLen);
|
||||
|
||||
if (g_musicSize != MusicLen)
|
||||
if (EDUKE32_PREDICT_FALSE(g_musicSize != MusicLen))
|
||||
{
|
||||
OSD_Printf(OSD_ERROR "S_PlayMusic(): error: read %d bytes from \"%s\", expected %d\n",
|
||||
g_musicSize, fn, MusicLen);
|
||||
|
@ -371,7 +371,7 @@ void S_Cleanup(void)
|
|||
|
||||
i = g_sounds[num].SoundOwner[j].ow;
|
||||
|
||||
if (g_sounds[num].num > MAXSOUNDINSTANCES)
|
||||
if (EDUKE32_PREDICT_FALSE(g_sounds[num].num > MAXSOUNDINSTANCES))
|
||||
OSD_Printf(OSD_ERROR "S_Cleanup(): num exceeds MAXSOUNDINSTANCES! g_sounds[%d].num %d wtf?\n", num, g_sounds[num].num);
|
||||
|
||||
if (g_sounds[num].num > 0)
|
||||
|
@ -399,7 +399,7 @@ int32_t S_LoadSound(uint32_t num)
|
|||
|
||||
if (num > (unsigned)g_maxSoundPos || ud.config.SoundToggle == 0 || ud.config.FXDevice < 0) return 0;
|
||||
|
||||
if (g_sounds[num].filename == NULL && g_sounds[num].filename1 == NULL)
|
||||
if (EDUKE32_PREDICT_FALSE(g_sounds[num].filename == NULL && g_sounds[num].filename1 == NULL))
|
||||
{
|
||||
OSD_Printf(OSD_ERROR "Sound (#%d) not defined!\n",num);
|
||||
return 0;
|
||||
|
@ -412,7 +412,7 @@ int32_t S_LoadSound(uint32_t num)
|
|||
{
|
||||
fp = kopen4loadfrommod(g_sounds[num].filename,g_loadFromGroupOnly);
|
||||
|
||||
if (fp == -1)
|
||||
if (EDUKE32_PREDICT_FALSE(fp == -1))
|
||||
{
|
||||
OSD_Printf(OSDTEXT_RED "Sound %s(#%d) not found!\n",g_sounds[num].filename,num);
|
||||
return 0;
|
||||
|
@ -607,7 +607,7 @@ int32_t S_PlaySound3D(int32_t num, int32_t i, const vec3_t *pos)
|
|||
while (j < MAXSOUNDINSTANCES && g_sounds[num].SoundOwner[j].voice != voice)
|
||||
j++;
|
||||
|
||||
if (j >= MAXSOUNDINSTANCES)
|
||||
if (EDUKE32_PREDICT_FALSE(j >= MAXSOUNDINSTANCES))
|
||||
{
|
||||
OSD_Printf(OSD_ERROR "%s %d: WTF?\n", __FILE__, __LINE__);
|
||||
return -1;
|
||||
|
@ -818,7 +818,7 @@ void S_StopEnvSound(int32_t num, int32_t i)
|
|||
|
||||
do
|
||||
{
|
||||
if (iter++ > MAXSOUNDINSTANCES<<1)
|
||||
if (EDUKE32_PREDICT_FALSE(iter++ > MAXSOUNDINSTANCES<<1))
|
||||
{
|
||||
initprintf(OSD_ERROR "S_StopEnvSound(): too many iterations! The following IDs are still active for sound %d:\n", num);
|
||||
for (j=MAXSOUNDINSTANCES-1; j>=0; j--)
|
||||
|
@ -831,7 +831,7 @@ void S_StopEnvSound(int32_t num, int32_t i)
|
|||
{
|
||||
if ((i == -1 && g_sounds[num].SoundOwner[j].voice > FX_Ok) || (i != -1 && g_sounds[num].SoundOwner[j].ow == i))
|
||||
{
|
||||
if (i >= 0 && g_sounds[num].SoundOwner[j].voice <= FX_Ok)
|
||||
if (EDUKE32_PREDICT_FALSE(i >= 0 && g_sounds[num].SoundOwner[j].voice <= FX_Ok))
|
||||
initprintf(OSD_ERROR "S_StopEnvSound(): bad voice %d for sound ID %d index %d!\n", g_sounds[num].SoundOwner[j].voice, num, j);
|
||||
else if (g_sounds[num].SoundOwner[j].voice > FX_Ok)
|
||||
{
|
||||
|
@ -857,7 +857,7 @@ void S_ChangeSoundPitch(int32_t num, int32_t i, int32_t pitchoffset)
|
|||
|
||||
if ((i == -1 && voice > FX_Ok) || (i != -1 && g_sounds[num].SoundOwner[j].ow == i))
|
||||
{
|
||||
if (i >= 0 && voice <= FX_Ok)
|
||||
if (EDUKE32_PREDICT_FALSE(i >= 0 && voice <= FX_Ok))
|
||||
initprintf(OSD_ERROR "S_ChangeSoundPitch(): bad voice %d for sound ID %d index %d!\n", voice, num, j);
|
||||
else if (voice > FX_Ok && FX_SoundActive(voice))
|
||||
FX_SetPitch(voice, pitchoffset);
|
||||
|
|
Loading…
Reference in a new issue