the abs() is necessary; force unsigned shift and signed result

This commit is contained in:
Inuyasha 2016-03-31 06:48:08 -07:00
parent 9286e30366
commit 3812b6bc20
2 changed files with 2 additions and 2 deletions

View File

@ -4336,7 +4336,7 @@ void G_GhostTicker(void)
{
case GHC_SUPER: // Super Sonic (P_DoSuperStuff)
g->mo->color = SKINCOLOR_SUPER1;
g->mo->color += ( ( ( leveltime >> 1 ) % 9) - 4);
g->mo->color += abs( ( (signed)( (unsigned)leveltime >> 1 ) % 9) - 4);
break;
case GHC_INVINCIBLE: // Mario invincibility (P_CheckInvincibilityTimer)
g->mo->color = (UINT8)(leveltime % MAXSKINCOLORS);

View File

@ -3449,7 +3449,7 @@ static void P_DoSuperStuff(player_t *player)
case 2: /* Knux */ player->mo->color = SKINCOLOR_KSUPER1; break;
default: /* everyone */ player->mo->color = SKINCOLOR_SUPER1; break;
}
player->mo->color += ( ( ( leveltime >> 1 ) % 9) - 4);
player->mo->color += abs( ( (signed)( (unsigned)leveltime >> 1 ) % 9) - 4);
if ((cmd->forwardmove != 0 || cmd->sidemove != 0 || player->pflags & (PF_CARRIED|PF_ROPEHANG|PF_ITEMHANG|PF_MACESPIN))
&& !(leveltime % TICRATE) && (player->mo->momx || player->mo->momy))