From 5cebe7ab35710a0568d3b0a27bb21118412d82b8 Mon Sep 17 00:00:00 2001 From: James R Date: Wed, 8 Mar 2023 01:12:34 -0800 Subject: [PATCH] Battle: count emeralds inside of monitors during Overtime too Don't spawn extra emeralds during Overtime since some monitors could survive. --- src/k_battle.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/k_battle.c b/src/k_battle.c index 9aef1c107..c2fa396e1 100644 --- a/src/k_battle.c +++ b/src/k_battle.c @@ -312,6 +312,21 @@ static inline boolean IsOnInterval(tic_t interval) return ((leveltime - starttime) % interval) == 0; } +static UINT32 CountEmeraldsSpawned(const mobj_t *mo) +{ + switch (mo->type) + { + case MT_EMERALD: + return mo->extravalue1; + + case MT_MONITOR: + return Obj_MonitorGetEmerald(mo); + + default: + return 0U; + } +} + void K_RunPaperItemSpawners(void) { const boolean overtime = (battleovertime.enabled >= 10*TICRATE); @@ -375,10 +390,7 @@ void K_RunPaperItemSpawners(void) mo = (mobj_t *)th; - if (mo->type == MT_EMERALD) - { - emeraldsSpawned |= mo->extravalue1; - } + emeraldsSpawned |= CountEmeraldsSpawned(mo); } if (canmakeemeralds) @@ -437,15 +449,7 @@ void K_RunPaperItemSpawners(void) mo = (mobj_t *)th; - if (mo->type == MT_EMERALD) - { - emeraldsSpawned |= mo->extravalue1; - } - - if (mo->type == MT_MONITOR) - { - emeraldsSpawned |= Obj_MonitorGetEmerald(mo); - } + emeraldsSpawned |= CountEmeraldsSpawned(mo); if (mo->type != MT_PAPERITEMSPOT) continue;