Linedef Action 460 (Award Rings) now supports negative ring counts

UDMF now has a native ring drainer effect.

Also fixes the WriteTextmap warning for the deprecated sector effect, which should have been encouraging you to use this action, not action 462!?
This commit is contained in:
toaster 2023-07-12 13:17:09 +01:00
parent 992840dd0f
commit c5c78df946
2 changed files with 20 additions and 7 deletions

View file

@ -2379,7 +2379,7 @@ static void P_WriteTextmap(void)
{
case 9:
case 10:
CONS_Alert(CONS_WARNING, M_GetText("Sector %s has ring drainer effect, which is not supported in UDMF. Use action 462 instead.\n"), sizeu1(i));
CONS_Alert(CONS_WARNING, M_GetText("Sector %s has ring drainer effect, which is not supported in UDMF. Use action 460 instead.\n"), sizeu1(i));
break;
default:
break;

View file

@ -4194,17 +4194,30 @@ boolean P_ProcessSpecial(activator_t *activator, INT16 special, INT32 *args, cha
{
INT16 rings = args[0];
INT32 delay = args[1];
if (mo && mo->player)
if (
mo && mo->player // Player
&& rings != 0 // Any effect
&& (delay <= 0 || !(leveltime % delay)) // Timing
)
{
// Don't award rings while SPB is targetting you
if (mo->player->pflags & PF_RINGLOCK)
return false;
if (delay <= 0 || !(leveltime % delay))
if (rings > 0)
{
// Don't award rings while SPB is targetting you
if (mo->player->pflags & PF_RINGLOCK)
return false;
// args[2]: don't cap rings to 20
K_AwardPlayerRings(mo->player, rings, args[2]);
}
else
{
// Don't push you below baseline
if (mo->player->rings < 0)
return false;
mo->player->rings--;
S_StartSound(mo, sfx_antiri);
}
}
}
break;