branch hints for nights and 2d stuff

gotta keep em for compat reasons Zzz..
This commit is contained in:
Alug committed 2025-07-20 16:40:28 +02:00
1 parent 61913b4fce
commit 9a2f964d11
7 files changed
+44 -40

No files matched your search

+2 -2
View File
@@ -250,7 +250,7 @@ boolean P_Move(mobj_t *actor, fixed_t speed)
I_Assert(movedir < NUMDIRS);
tryx = actor->x + FixedMul(speed*xspeed[movedir], actor->scale);
if (twodlevel || actor->flags2 & MF2_TWOD)
if (UNLIKELY(twodlevel || actor->flags2 & MF2_TWOD))
tryy = actor->y;
else
tryy = actor->y + FixedMul(speed*yspeed[movedir], actor->scale);
@@ -4388,7 +4388,7 @@ void A_MouseThink(void *thing)
|| (actor->eflags & MFE_VERTICALFLIP && actor->z + actor->height == actor->ceilingz))
&& !actor->reactiontime)
{
if (twodlevel || actor->flags2 & MF2_TWOD)
if (UNLIKELY(twodlevel || actor->flags2 & MF2_TWOD))
{
if (P_RandomChance(FRACUNIT/2))
actor->angle += ANGLE_180;
+14 -13
View File
@@ -587,7 +587,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
special->momx = special->momy = special->momz = 0;
P_GivePlayerRings(player, 1);
if ((maptol & TOL_NIGHTS) && special->type != MT_FLINGRING)
if (UNLIKELY((maptol & TOL_NIGHTS) && special->type != MT_FLINGRING))
P_DoNightsScore(player);
break;
@@ -599,7 +599,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
special->momx = special->momy = 0;
P_GivePlayerRings(player, 1);
if ((maptol & TOL_NIGHTS) && special->type != MT_FLINGCOIN)
if (UNLIKELY((maptol & TOL_NIGHTS) && special->type != MT_FLINGCOIN))
P_DoNightsScore(player);
break;
case MT_BLUEBALL:
@@ -615,7 +615,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
else
special->scalespeed = 4*FRACUNIT/5;
if (maptol & TOL_NIGHTS)
if (UNLIKELY(maptol & TOL_NIGHTS))
P_DoNightsScore(player);
break;
case MT_AUTOPICKUP:
@@ -832,6 +832,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
if (player->bumpertime < TICRATE/4)
{
S_StartSound(toucher, special->info->seesound);
if (player->pflags & PF_NIGHTSMODE)
{
player->bumpertime = TICRATE/2;
@@ -1226,9 +1227,9 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
return; // SRB2kart - don't need bubbles mucking with the player
if ((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL)
return;
if (maptol & TOL_NIGHTS)
if (UNLIKELY(maptol & TOL_NIGHTS))
return;
if (mariomode)
if (UNLIKELY(mariomode))
return;
else if (toucher->eflags & MFE_VERTICALFLIP)
{
@@ -2391,11 +2392,11 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
if (player->exiting)
return false;
if (!(target->player->pflags & (PF_NIGHTSMODE|PF_NIGHTSFALL)) && (maptol & TOL_NIGHTS))
if (UNLIKELY(!(target->player->pflags & (PF_NIGHTSMODE|PF_NIGHTSFALL)) && (maptol & TOL_NIGHTS)))
return false;
}
if (player->pflags & PF_NIGHTSMODE) // NiGHTS damage handling
if (UNLIKELY(player->pflags & PF_NIGHTSMODE)) // NiGHTS damage handling
{
if (!force)
{
@@ -2640,7 +2641,7 @@ void P_PlayerRingBurst(player_t *player, INT32 num_rings)
ns = FixedMul(((i*FRACUNIT)/16)+2*FRACUNIT, mo->scale);
mo->momx = FixedMul(FINECOSINE(fa),ns);
if (!(twodlevel || (player->mo->flags2 & MF2_TWOD)))
if (LIKELY(!(twodlevel || (player->mo->flags2 & MF2_TWOD))))
mo->momy = FixedMul(FINESINE(fa),ns);
P_SetObjectMomZ(mo, 8*FRACUNIT, false);
@@ -2664,7 +2665,7 @@ void P_PlayerRingBurst(player_t *player, INT32 num_rings)
ns = FixedMul(momxy, mo->scale);
mo->momx = FixedMul(FINECOSINE(fa),ns);
if (!(twodlevel || (player->mo->flags2 & MF2_TWOD)))
if (LIKELY(!(twodlevel || (player->mo->flags2 & MF2_TWOD))))
mo->momy = FixedMul(FINESINE(fa),ns);
ns = momz;
@@ -2771,7 +2772,7 @@ void P_PlayerWeaponPanelBurst(player_t *player)
ns = FixedMul(3*FRACUNIT, mo->scale);
mo->momx = FixedMul(FINECOSINE(fa),ns);
if (!(twodlevel || (player->mo->flags2 & MF2_TWOD)))
if (LIKELY(!(twodlevel || (player->mo->flags2 & MF2_TWOD))))
mo->momy = FixedMul(FINESINE(fa),ns);
P_SetObjectMomZ(mo, 4*FRACUNIT, false);
@@ -2855,7 +2856,7 @@ void P_PlayerWeaponAmmoBurst(player_t *player)
ns = FixedMul(2*FRACUNIT, mo->scale);
mo->momx = FixedMul(FINECOSINE(fa), ns);
if (!(twodlevel || (player->mo->flags2 & MF2_TWOD)))
if (LIKELY(!(twodlevel || (player->mo->flags2 & MF2_TWOD))))
mo->momy = FixedMul(FINESINE(fa),ns);
P_SetObjectMomZ(mo, 3*FRACUNIT, false);
@@ -2971,7 +2972,7 @@ void P_PlayerEmeraldBurst(player_t *player, boolean toss)
momx = FixedMul(FINECOSINE(fa), ns);
if (!(twodlevel || (player->mo->flags2 & MF2_TWOD)))
if (LIKELY(!(twodlevel || (player->mo->flags2 & MF2_TWOD))))
momy = FixedMul(FINESINE(fa),ns);
else
momy = 0;
@@ -3028,7 +3029,7 @@ void P_PlayerFlagBurst(player_t *player, boolean toss)
{
angle_t fa = P_RandomByte()*FINEANGLES/256;
flag->momx = FixedMul(FINECOSINE(fa), FixedMul(6*FRACUNIT, player->mo->scale));
if (!(twodlevel || (player->mo->flags2 & MF2_TWOD)))
if (LIKELY(!(twodlevel || (player->mo->flags2 & MF2_TWOD))))
flag->momy = FixedMul(FINESINE(fa), FixedMul(6*FRACUNIT, player->mo->scale));
}
+5 -5
View File
@@ -140,7 +140,7 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
if (object->player && object->player->spectator)
return false;
if (object->player && (object->player->pflags & PF_NIGHTSMODE))
if (UNLIKELY(object->player && (object->player->pflags & PF_NIGHTSMODE)))
{
/*Someone want to make these work like bumpers?*/
return false;
@@ -335,7 +335,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
#ifdef SEENAMES
// Do name checks all the way up here
// So that NOTHING ELSE can see MT_NAMECHECK because it is client-side.
if (tmthing->type == MT_NAMECHECK)
if (UNLIKELY(tmthing->type == MT_NAMECHECK))
{
// Ignore things that aren't players, ignore spectators, ignore yourself.
// (also don't bother to check that tmthing->target->player is non-NULL because we're not actually using it here.)
@@ -361,8 +361,8 @@ static boolean PIT_CheckThing(mobj_t *thing)
return true;
// Don't collide with your buddies while NiGHTS-flying.
if (tmthing->player && thing->player && (maptol & TOL_NIGHTS)
&& ((tmthing->player->pflags & PF_NIGHTSMODE) || (thing->player->pflags & PF_NIGHTSMODE)))
if (UNLIKELY(tmthing->player && thing->player && (maptol & TOL_NIGHTS)
&& ((tmthing->player->pflags & PF_NIGHTSMODE) || (thing->player->pflags & PF_NIGHTSMODE))))
return true;
blockdist = thing->radius + tmthing->radius;
@@ -3183,7 +3183,7 @@ stairstep:
P_HitSlideLine(bestslideline); // clip the moves
if ((twodlevel || (mo->flags2 & MF2_TWOD)) && mo->player)
if (UNLIKELY((twodlevel || (mo->flags2 & MF2_TWOD)) && mo->player))
{
mo->momx = tmxmove;
tmymove = 0;
+14 -11
View File
@@ -892,7 +892,7 @@ static void P_PlayerFlip(mobj_t *mo)
G_GhostAddFlip((INT32) (mo->player - players));
// Flip aiming to match!
if (mo->player->pflags & PF_NIGHTSMODE) // NiGHTS doesn't use flipcam
if (UNLIKELY(mo->player->pflags & PF_NIGHTSMODE)) // NiGHTS doesn't use flipcam
{
if (mo->tracer)
mo->tracer->eflags ^= MFE_VERTICALFLIP;
@@ -990,7 +990,7 @@ fixed_t P_GetMobjGravity(mobj_t *mo)
//|| (mo->player->charability == CA_FLY && (mo->player->powers[pw_tailsfly]
// || (mo->state >= &states[S_PLAY_SPC1] && mo->state <= &states[S_PLAY_SPC4]))))
// gravityadd = gravityadd/3; // less gravity while flying/gliding
if (mo->player->climbing || (mo->player->pflags & PF_NIGHTSMODE))
if (UNLIKELY(mo->player->climbing || (mo->player->pflags & PF_NIGHTSMODE)))
return 0;
if (!(mo->flags2 & MF2_OBJECTFLIP) != !(mo->player->powers[pw_gravityboots])) // negated to turn numeric into bool - would be double negated, but not needed if both would be
@@ -1586,7 +1586,7 @@ void P_XYMovement(mobj_t *mo)
// Check the gravity status.
P_CheckGravity(mo, false);
if (player && !moved && player->pflags & PF_NIGHTSMODE && mo->target)
if (UNLIKELY(player && !moved && player->pflags & PF_NIGHTSMODE && mo->target))
{
angle_t fa;
@@ -1631,7 +1631,7 @@ void P_XYMovement(mobj_t *mo)
if (player && player->homing) // no friction for homing
return;
if (player && player->pflags & PF_NIGHTSMODE)
if (UNLIKELY(player && player->pflags & PF_NIGHTSMODE))
return; // no friction for NiGHTS players
if ((mo->type == MT_BIGTUMBLEWEED || mo->type == MT_LITTLETUMBLEWEED)
@@ -2192,7 +2192,7 @@ static boolean P_ZMovement(mobj_t *mo)
|| mo->type == MT_CANNONBALLDECOR
|| mo->type == MT_FALLINGROCK)
{
if (maptol & TOL_NIGHTS)
if (UNLIKELY(maptol & TOL_NIGHTS))
mom.z = -FixedDiv(mom.z, 10*FRACUNIT);
else
mom.z = -FixedMul(mom.z, FixedDiv(17*FRACUNIT,20*FRACUNIT));
@@ -2332,9 +2332,9 @@ static boolean P_ZMovement(mobj_t *mo)
mo->momz = -mo->momz;
else
// Flags bounce
if (mo->type == MT_REDFLAG || mo->type == MT_BLUEFLAG)
if (UNLIKELY(mo->type == MT_REDFLAG || mo->type == MT_BLUEFLAG))
{
if (maptol & TOL_NIGHTS)
if (UNLIKELY(maptol & TOL_NIGHTS))
mo->momz = -FixedDiv(mo->momz, 10*FRACUNIT);
else
mo->momz = -FixedMul(mo->momz, FixedDiv(17*FRACUNIT,20*FRACUNIT));
@@ -2401,7 +2401,7 @@ static void P_PlayerZMovement(mobj_t *mo)
else
mo->z = mo->floorz;
if (mo->player->pflags & PF_NIGHTSMODE)
if (UNLIKELY(mo->player->pflags & PF_NIGHTSMODE))
{
// bounce off floor if you were flying towards it
if ((mo->eflags & MFE_VERTICALFLIP && mo->player->flyangle > 0 && mo->player->flyangle < 180)
@@ -2591,7 +2591,7 @@ nightsdone:
else
mo->z = mo->ceilingz - mo->height;
if (mo->player->pflags & PF_NIGHTSMODE)
if (UNLIKELY(mo->player->pflags & PF_NIGHTSMODE))
{
// bounce off ceiling if you were flying towards it
if ((mo->eflags & MFE_VERTICALFLIP && mo->player->flyangle > 180 && mo->player->flyangle <= 359)
@@ -2636,7 +2636,7 @@ nightsdone:
}
// hit the ceiling
if (mariomode)
if (UNLIKELY(mariomode))
S_StartSound(mo, sfx_mario1);
if (!mo->player->climbing)
@@ -3536,15 +3536,18 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
}
else
{
if (!(mobj->player->pflags & PF_NIGHTSMODE)) // "jumping" is used for drilling
if (LIKELY(!(mobj->player->pflags & PF_NIGHTSMODE))) // "jumping" is used for drilling
mobj->player->jumping = 0;
mobj->player->pflags &= ~PF_JUMPED;
if (mobj->player->secondjump || mobj->player->powers[pw_tailsfly])
{
mobj->player->secondjump = 0;
mobj->player->powers[pw_tailsfly] = 0;
P_SetPlayerMobjState(mobj, S_KART_WALK1); // SRB2kart - was S_PLAY_RUN1
}
mobj->eflags &= ~MFE_JUSTHITFLOOR;
}
+3 -3
View File
@@ -3913,7 +3913,7 @@ DoneSection2:
player->kartstuff[k_lapanimation] = 80;
if (player->pflags & PF_NIGHTSMODE)
if (UNLIKELY(player->pflags & PF_NIGHTSMODE))
player->drillmeter += 48*20;
if (netgame && player->laps >= (UINT8)cv_numlaps.value)
@@ -7103,7 +7103,7 @@ static inline boolean PIT_PushThing(mobj_t *thing)
return false;
// Allow this to affect pushable objects at some point?
if (thing->player && (!(thing->flags & (MF_NOGRAVITY | MF_NOCLIP)) || thing->player->pflags & PF_NIGHTSMODE))
if (thing->player && (!(thing->flags & (MF_NOGRAVITY | MF_NOCLIP)) || UNLIKELY(thing->player->pflags & PF_NIGHTSMODE)))
{
INT32 dist;
INT32 speed;
@@ -7134,7 +7134,7 @@ static inline boolean PIT_PushThing(mobj_t *thing)
// Written with bits and pieces of P_HomingAttack
if ((speed > 0) && (P_CheckSight(thing, tmpusher->source)))
{
if (!(thing->player->pflags & PF_NIGHTSMODE))
if (LIKELY(!(thing->player->pflags & PF_NIGHTSMODE)))
{
// only push wrt Z if health & 1 (mapthing has ambush flag)
if (tmpusher->source->health & 1)
+4 -4
View File
@@ -498,9 +498,9 @@ void P_PlayLivesJingle(player_t *player)
if (player && !P_IsLocalPlayer(player))
return;
if (use1upSound)
if (UNLIKELY(use1upSound))
S_StartSound(NULL, sfx_oneup);
else if (mariomode)
else if (UNLIKELY(mariomode))
S_StartSound(NULL, sfx_marioa);
else
{
@@ -528,7 +528,7 @@ void P_PlayRinglossSound(mobj_t *source, mobj_t *damager)
S_StartSound(NULL, sfx);
}
else
S_StartSound(source, (mariomode) ? sfx_mario8 : sfx_khurt1 + key);
S_StartSound(source, UNLIKELY(mariomode) ? sfx_mario8 : sfx_khurt1 + key);
}
else
S_StartSound(source, sfx_slip);
@@ -5062,7 +5062,7 @@ void P_PlayerAfterThink(player_t *player)
}
}
if (player->pflags & PF_NIGHTSMODE)
if (UNLIKELY(player->pflags & PF_NIGHTSMODE))
{
player->powers[pw_gravityboots] = 0;
}
+2 -2
View File
@@ -611,7 +611,7 @@ void S_StartSound(const void *origin, sfxenum_t sfx_id)
if (S_SoundDisabled())
return;
if (mariomode) // Sounds change in Mario mode!
if (UNLIKELY(mariomode)) // Sounds change in Mario mode!
{
switch (sfx_id)
{
@@ -634,7 +634,7 @@ void S_StartSound(const void *origin, sfxenum_t sfx_id)
break;
}
}
if (maptol & TOL_XMAS) // Some sounds change for xmas
if (UNLIKELY(maptol & TOL_XMAS)) // Some sounds change for xmas
{
switch (sfx_id)
{