UFO Catcher can now carry Emeralds other than the Green Chaos Emerald

- Uses P_GetNextEmerald to determine the associated emerald. Earlier work paying dividends!
- Color selected matching Cup Select screen
- New states which can be used in other contexts
    - S_SUPEREMERALD1 and S_SUPEREMERALD2
    - S_SUPEREMERALD_UNDER
This commit is contained in:
toaster 2023-04-07 19:32:46 +01:00
parent 1f018f8d27
commit 8a3d225790
4 changed files with 54 additions and 8 deletions

View file

@ -1219,6 +1219,11 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi
"S_CHAOSEMERALD2",
"S_CHAOSEMERALD_UNDER",
// Super Emeralds
"S_SUPEREMERALD1",
"S_SUPEREMERALD2",
"S_SUPEREMERALD_UNDER",
"S_EMERALDSPARK1",
"S_EMERALDSPARK2",
"S_EMERALDSPARK3",

View file

@ -144,6 +144,7 @@ char sprnames[NUMSPRITES + 1][5] =
"NSTR", // NiGHTS star
"EMBM", // Emblem
"EMRC", // Chaos Emeralds
"SEMR", // Super Emeralds
"ESPK",
"SHRD", // Emerald Hunt
@ -1775,6 +1776,11 @@ state_t states[NUMSTATES] =
{SPR_EMRC, FF_FULLBRIGHT|FF_ADD, 1, {NULL}, 0, 0, S_CHAOSEMERALD1}, // S_CHAOSEMERALD2
{SPR_EMRC, FF_FULLBRIGHT|1, -1, {NULL}, 1, 0, S_NULL}, // S_CHAOSEMERALD_UNDER
// Super Emeralds
{SPR_SEMR, FF_SEMIBRIGHT, 1, {NULL}, 0, 0, S_SUPEREMERALD2}, // S_SUPEREMERALD1
{SPR_SEMR, FF_FULLBRIGHT|FF_ADD, 1, {NULL}, 0, 0, S_SUPEREMERALD1}, // S_SUPEREMERALD2
{SPR_SEMR, FF_FULLBRIGHT|1, -1, {NULL}, 1, 0, S_NULL}, // S_SUPEREMERALD_UNDER
{SPR_ESPK, FF_FULLBRIGHT, 3, {NULL}, 0, 0, S_EMERALDSPARK2}, // S_EMERALDSPARK1
{SPR_ESPK, FF_FULLBRIGHT|1, 3, {NULL}, 0, 0, S_EMERALDSPARK3}, // S_EMERALDSPARK2
{SPR_ESPK, FF_FULLBRIGHT|2, 3, {NULL}, 0, 0, S_EMERALDSPARK4}, // S_EMERALDSPARK3
@ -29318,7 +29324,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
{ // MT_SPECIAL_UFO
-1, // doomednum
S_CHAOSEMERALD1, // spawnstate
S_INVISIBLE, // spawnstate
101, // spawnhealth
S_NULL, // seestate
sfx_None, // seesound

View file

@ -695,6 +695,7 @@ typedef enum sprite
SPR_NSTR, // NiGHTS star
SPR_EMBM, // Emblem
SPR_EMRC, // Chaos Emeralds
SPR_SEMR, // Super Emeralds
SPR_ESPK,
SPR_SHRD, // Emerald Hunt
@ -2256,6 +2257,11 @@ typedef enum state
S_CHAOSEMERALD2,
S_CHAOSEMERALD_UNDER,
// Super Emeralds
S_SUPEREMERALD1,
S_SUPEREMERALD2,
S_SUPEREMERALD_UNDER,
S_EMERALDSPARK1,
S_EMERALDSPARK2,
S_EMERALDSPARK3,

View file

@ -907,15 +907,44 @@ static mobj_t *InitSpecialUFO(waypoint_t *start)
ufo_speed(ufo) = FixedMul(UFO_START_SPEED, K_GetKartGameSpeedScalar(gamespeed));
// TODO: Adjustable Special Stage emerald color
ufo->color = SKINCOLOR_CHAOSEMERALD1;
// Adjustable Special Stage emerald color/shape
{
overlay = P_SpawnMobjFromMobj(ufo, 0, 0, 0, MT_OVERLAY);
overlay = P_SpawnMobjFromMobj(ufo, 0, 0, 0, MT_OVERLAY);
P_SetTarget(&overlay->target, ufo);
overlay->color = ufo->color;
ufo->color = SKINCOLOR_CHAOSEMERALD1;
i = P_GetNextEmerald();
if (i > 0)
{
ufo->color += (i - 1) % 7;
if (i > 7)
{
// Super Emeralds
P_SetMobjState(ufo, S_SUPEREMERALD1);
P_SetMobjState(overlay, S_SUPEREMERALD_UNDER);
}
else
{
// Chaos Emerald
P_SetMobjState(ufo, S_CHAOSEMERALD1);
P_SetMobjState(overlay, S_CHAOSEMERALD_UNDER);
}
}
else
{
// Prize -- todo, currently using standard Emerald
P_SetMobjState(ufo, S_CHAOSEMERALD1);
P_SetMobjState(overlay, S_CHAOSEMERALD_UNDER);
}
// TODO: Super Emeralds / Chaos Rings
P_SetMobjState(overlay, S_CHAOSEMERALD_UNDER);
if (P_MobjWasRemoved(ufo)) // uh oh !
{
// Attempted crash prevention with custom SOC
return NULL;
}
overlay->color = ufo->color;
P_SetTarget(&overlay->target, ufo);
}
// Create UFO pieces.
// First: UFO center.