Ring Item Capsule adjustments for Items Tutorial

- A first argument of `0` (default id) does existing automatic Ring-feeding behaviour with a new graphic
- A first argument of `19` (super ring hardcoded id) gives a Super Ring item
- Applies to all courses, so before merger all maps need to be checked if doomednum 2010 has a first argument of 19 in any existing maps
This commit is contained in:
toaster 2025-08-19 20:51:18 +01:00
parent f8f4d6cfd6
commit 435b3b8f09
5 changed files with 19 additions and 10 deletions

View file

@ -225,6 +225,7 @@ typedef enum
NUMKARTRESULTS,
KDROP_STONESHOETRAP,
KCAPSULE_RING,
// Power-ups exist in the same enum as items so it's easy
// for paper items to be reused for them.

View file

@ -5229,6 +5229,7 @@ struct int_const_s const INT_CONST[] = {
{"KRITEM_TRIPLEGACHABOM",KRITEM_TRIPLEGACHABOM},
{"NUMKARTRESULTS",NUMKARTRESULTS},
{"KDROP_STONESHOETRAP",KDROP_STONESHOETRAP},
{"KCAPSULE_RING", KCAPSULE_RING},
{"FIRSTPOWERUP",FIRSTPOWERUP},
{"POWERUP_SMONITOR",POWERUP_SMONITOR},
{"POWERUP_BARRIER",POWERUP_BARRIER},

View file

@ -16273,6 +16273,10 @@ void K_UpdateMobjItemOverlay(mobj_t *part, SINT8 itemType, UINT8 itemCount)
part->sprite = SPR_STON;
part->frame = FF_FULLBRIGHT|FF_PAPERSPRITE|4;
break;
case KCAPSULE_RING:
part->sprite = SPR_ICAP;
part->frame = FF_FULLBRIGHT|FF_PAPERSPRITE|6;
break;
default:
if (itemType >= FIRSTPOWERUP)
{

View file

@ -533,7 +533,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
if (K_IsSPBInGame()) // don't spawn a second SPB
return;
break;
case KITEM_SUPERRING:
case KCAPSULE_RING:
if (!P_CanPickupItem(player, PICKUP_RINGORSPHERE)) // no cheaty rings
return;
break;
@ -546,7 +546,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
}
// Ring Capsules shouldn't affect pickup cheese, they're just used as condensed ground-ring placements.
if (special->threshold != KITEM_SUPERRING)
if (special->threshold != KCAPSULE_RING)
P_UpdateLastPickup(player, 3);
S_StartSound(toucher, special->info->deathsound);
@ -2052,7 +2052,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
target->fuse = 5*TICRATE;
else if (K_CapsuleTimeAttackRules() == true)
; // Don't respawn (internal)
else if (target->threshold == KITEM_SUPERRING)
else if (target->threshold == KCAPSULE_RING)
target->fuse = 20*TICRATE;
else
target->fuse = 40*TICRATE;
@ -2119,7 +2119,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
if (!(target->flags2 & MF2_STRONGBOX))
{
// special behavior for ring capsules
if (target->threshold == KITEM_SUPERRING)
if (target->threshold == KCAPSULE_RING)
{
K_AwardPlayerRings(player, 5 * target->movecount, true);
break;

View file

@ -4452,7 +4452,7 @@ static void P_RefreshItemCapsuleParts(mobj_t *mobj)
UINT32 newRenderFlags = 0;
boolean colorized;
if (itemType < 1 || itemType >= NUMKARTITEMS)
if (itemType < 1 || (itemType >= NUMKARTITEMS && itemType != KCAPSULE_RING))
itemType = KITEM_SAD;
// update invincibility properties
@ -4471,7 +4471,7 @@ static void P_RefreshItemCapsuleParts(mobj_t *mobj)
// update cap colors
if (mobj->extravalue2)
color = mobj->extravalue2;
else if (itemType == KITEM_SUPERRING)
else if (itemType == KCAPSULE_RING)
{
color = SKINCOLOR_GOLD;
newRenderFlags |= RF_SEMIBRIGHT;
@ -4514,7 +4514,8 @@ static void P_RefreshItemCapsuleParts(mobj_t *mobj)
if (mobj->movecount - 1 > K_GetOrbinautItemFrame(mobj->movecount))
count = mobj->movecount;
break;
case KITEM_SUPERRING: // always display the number, and multiply it by 5
case KCAPSULE_RING:
// always display the number, and multiply it by 5
if (mobj->flags2 & MF2_STRONGBOX)
count = mobj->movecount * 20; // give Super Rings
else
@ -11519,7 +11520,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
// set default item & count
#if 0 // set to 1 to test capsules with random items, e.g. with objectplace
if (P_RandomChance(PR_ITEM_SPAWNER, FRACUNIT/3))
mobj->threshold = KITEM_SUPERRING;
mobj->threshold = KCAPSULE_RING;
else if (P_RandomChance(PR_ITEM_SPAWNER, FRACUNIT/3))
mobj->threshold = KITEM_SPB;
else if (P_RandomChance(PR_ITEM_SPAWNER, FRACUNIT/3))
@ -11528,7 +11529,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
mobj->threshold = P_RandomRange(PR_ITEM_SPAWNER, 1, NUMKARTITEMS - 1);
mobj->movecount = P_RandomChance(PR_ITEM_SPAWNER, FRACUNIT/3) ? 1 : P_RandomKey(PR_ITEM_SPAWNER, 32) + 1;
#else
mobj->threshold = KITEM_SUPERRING; // default item is super ring
mobj->threshold = KCAPSULE_RING; // default item is ring
mobj->movecount = 1;
#endif
@ -14118,9 +14119,11 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj)
if (!P_IsObjectOnGround(mobj))
mobj->flags |= MF_NOGRAVITY;
// Angle = item type
// First argument = item type (or 0 for KCAPSULE_RING)
if (mthing->thing_args[0] > 0 && mthing->thing_args[0] < NUMKARTITEMS)
{
mobj->threshold = mthing->thing_args[0];
}
// Parameter = extra items (x5 for rings)
mobj->movecount += mthing->thing_args[1];