diff --git a/src/k_kart.c b/src/k_kart.c index 217bd30d9..33fcd8819 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -104,6 +104,60 @@ void K_TimerReset(void) g_pointlimit = 0; } +static void K_SpawnItemCapsules(void) +{ + mapthing_t *mt = mapthings; + size_t i = SIZE_MAX; + + for (i = 0; i < nummapthings; i++, mt++) + { + boolean isRingCapsule = false; + INT32 modeFlags = 0; + + if (mt->type != mobjinfo[MT_ITEMCAPSULE].doomednum) + { + continue; + } + + isRingCapsule = (mt->args[0] < 1 || mt->args[0] == KITEM_SUPERRING || mt->args[0] >= NUMKARTITEMS); + if (isRingCapsule == true && ((gametyperules & GTR_SPHERES) || (modeattacking & ATTACKING_SPB))) + { + // don't spawn ring capsules in ringless gametypes + continue; + } + + modeFlags = mt->args[3]; + if (modeFlags == TMICM_DEFAULT) + { + if (isRingCapsule == true) + { + modeFlags = TMICM_MULTIPLAYER|TMICM_TIMEATTACK; + } + else + { + modeFlags = TMICM_MULTIPLAYER; + } + } + + if (K_CapsuleTimeAttackRules() == true) + { + if ((modeFlags & TMICM_TIMEATTACK) == 0) + { + continue; + } + } + else + { + if ((modeFlags & TMICM_MULTIPLAYER) == 0) + { + continue; + } + } + + P_SpawnMapThing(mt); + } +} + void K_TimerInit(void) { UINT8 i; @@ -199,6 +253,7 @@ void K_TimerInit(void) } } + K_SpawnItemCapsules(); K_BattleInit(domodeattack); timelimitintics = K_TimeLimitForGametype(); diff --git a/src/p_mobj.c b/src/p_mobj.c index 160a0b019..f0e529a0d 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -4426,7 +4426,7 @@ static void P_RefreshItemCapsuleParts(mobj_t *mobj) color = SKINCOLOR_GOLD; newRenderFlags |= RF_SEMIBRIGHT; } - else if (mobj->args[2] & TMICF_INVERTTIMEATTACK) + else if (mobj->args[3] & TMICM_TIMEATTACK) color = SKINCOLOR_SAPPHIRE; else if (itemType == KITEM_SPB) color = SKINCOLOR_JET; @@ -12180,21 +12180,6 @@ static boolean P_AllowMobjSpawn(mapthing_t* mthing, mobjtype_t i) { switch (i) { - case MT_ITEMCAPSULE: - { - boolean isRingCapsule = (mthing->args[0] < 1 || mthing->args[0] == KITEM_SUPERRING || mthing->args[0] >= NUMKARTITEMS); - - // don't spawn ring capsules in GTR_SPHERES gametypes - if (isRingCapsule && ((gametyperules & GTR_SPHERES) || (modeattacking & ATTACKING_SPB))) - return false; - - // in record attack, only spawn ring capsules - // (behavior can be inverted with the Extra flag, i.e. item capsule spawns and ring capsule does not) - if (K_CapsuleTimeAttackRules() == true - && (!(mthing->args[2] & TMICF_INVERTTIMEATTACK) == !isRingCapsule)) - return false; - } - break; case MT_RING: if (modeattacking & ATTACKING_SPB) return false; diff --git a/src/p_setup.c b/src/p_setup.c index 8ef4aaa76..02e19702d 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -758,8 +758,11 @@ static void P_SpawnMapThings(boolean spawnemblems) continue; // These were already spawned } - if (mt->type == mobjinfo[MT_BATTLECAPSULE].doomednum) - continue; // This will spawn later + if (mt->type == mobjinfo[MT_BATTLECAPSULE].doomednum + || mt->type == mobjinfo[MT_ITEMCAPSULE].doomednum) + { + continue; // These will spawn later + } if (!spawnemblems && mt->type == mobjinfo[MT_EMBLEM].doomednum) continue; @@ -7081,7 +7084,12 @@ static void P_ConvertBinaryThingTypes(void) if (mapthings[i].options & MTF_EXTRA) { - mapthings[i].args[2] |= TMICF_INVERTTIMEATTACK; + // was advertised as an "invert time attack" flag, actually was an "all gamemodes" flag + mapthings[i].args[3] = TMICM_MULTIPLAYER|TMICM_TIMEATTACK; + } + else + { + mapthings[i].args[3] = TMICM_DEFAULT; } if (mapthings[i].options & MTF_AMBUSH) diff --git a/src/p_spec.h b/src/p_spec.h index a4644dbdf..9714d3fc8 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -143,10 +143,17 @@ typedef enum typedef enum { - TMICF_INVERTTIMEATTACK = 1, + //TMICF_UNUSED = 1, TMICF_INVERTSIZE = 1<<1, } textmapitemcapsuleflags_t; +typedef enum +{ + TMICM_DEFAULT = 0, // Time Attack only has rings, multiplayer has everything + TMICM_MULTIPLAYER = 1, + TMICM_TIMEATTACK = 1<<1, +} textmapitemcapsulemodes_t; + typedef enum { TMMA_WARN = 1,