mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-02-26 15:31:03 +00:00
Improve Item Capsule spawning
- Spawn them after player count has been calculated properly. - Move gametype spawning into its own argument. Now instead of 1 flag that said it inverted Time Attack spawning but ACTUALLY just made it spawn in all modes, there's flags for the two gametypes which can be combined. Not setting any will use the old default behavior (rings are in both modes, items are multiplayer-only).
This commit is contained in:
parent
ce2ea138b4
commit
cd37542edf
4 changed files with 75 additions and 20 deletions
55
src/k_kart.c
55
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();
|
||||
|
|
|
|||
17
src/p_mobj.c
17
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;
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue