From c5c78df94647a01a69f8c4297f64e0f576b2dd3f Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 12 Jul 2023 13:17:09 +0100 Subject: [PATCH] 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!? --- src/p_setup.c | 2 +- src/p_spec.c | 25 +++++++++++++++++++------ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index 27b771df1..985414775 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -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; diff --git a/src/p_spec.c b/src/p_spec.c index d43c6e07b..d03505ea4 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -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;