mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-01-13 18:22:18 +00:00
Immense 25-file diff, so spun off into its own branch.
- Improved appearance
- Not just a big block of text on a blue background
- Well, OK, the main part is, but some stuff has been spun out into its own fields
- Title text
- Text and button prompt for Yes/No or OK
- Slides with pow on and off the screen
- Disabled MM_EVENTHANDLER, which has always been dog but got considerably worse after newmenus to the point nothing's using it anymore
- Required in order to reduce the reliance on FUNCPTRCAST, which prevents Eidolon from compiling some stuff because it's not valid C++
130 lines
2.2 KiB
C++
130 lines
2.2 KiB
C++
/// \brief Extras Menu: Egg TV
|
|
|
|
#include "class-egg-tv/EggTV.hpp"
|
|
|
|
#include "../k_menu.h"
|
|
#include "../s_sound.h"
|
|
|
|
using namespace srb2::menus::egg_tv;
|
|
|
|
namespace
|
|
{
|
|
|
|
std::unique_ptr<EggTV> g_egg_tv;
|
|
|
|
void M_DrawEggTV()
|
|
{
|
|
g_egg_tv->draw();
|
|
}
|
|
|
|
boolean M_QuitEggTV()
|
|
{
|
|
g_egg_tv = {};
|
|
|
|
return true;
|
|
}
|
|
|
|
boolean M_HandleEggTV(INT32 choice)
|
|
{
|
|
(void)choice;
|
|
|
|
const UINT8 pid = 0;
|
|
const EggTV::InputReaction reaction = g_egg_tv->input(pid);
|
|
|
|
if (reaction.bypass)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
if (reaction.effect)
|
|
{
|
|
S_StartSound(nullptr, reaction.sound);
|
|
M_SetMenuDelay(pid);
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
void M_DeleteReplayChoice(INT32 choice)
|
|
{
|
|
if (choice == MA_YES)
|
|
{
|
|
g_egg_tv->erase();
|
|
|
|
//S_StartSound(nullptr, sfx_s3k4e); // BOOM
|
|
S_StartSound(nullptr, sfx_monch); // :)
|
|
}
|
|
}
|
|
|
|
void M_DeleteReplay(INT32 c)
|
|
{
|
|
(void)c;
|
|
M_StartMessage("Egg TV",
|
|
"Are you sure you want to\n"
|
|
"delete this replay?\n"
|
|
"\n"
|
|
"\x85" "This cannot be undone.\n",
|
|
&M_DeleteReplayChoice,
|
|
MM_YESNO,
|
|
nullptr, nullptr
|
|
);
|
|
S_StartSound(nullptr, sfx_s3k36); // lel skid
|
|
}
|
|
|
|
void M_FavoriteReplay(INT32 c)
|
|
{
|
|
(void)c;
|
|
|
|
g_egg_tv->toggle_favorite();
|
|
|
|
S_StartSound(nullptr, sfx_s1c9);
|
|
}
|
|
|
|
}; // namespace
|
|
|
|
// extras menu: replay hut
|
|
menuitem_t EXTRAS_EggTV[] =
|
|
{
|
|
{IT_STRING | IT_CALL, "WATCH REPLAY", NULL, NULL, {.routine = [](auto) { g_egg_tv->watch(); }}, 0, 0},
|
|
{IT_STRING | IT_CALL, "STANDINGS", NULL, NULL, {.routine = [](auto) { g_egg_tv->standings(); }}, 0, 0},
|
|
{IT_STRING | IT_CALL, "FAVORITE", NULL, NULL, {.routine = M_FavoriteReplay}, 0, 0},
|
|
|
|
{IT_SPACE},
|
|
|
|
{IT_STRING | IT_CALL, "DELETE REPLAY", NULL, NULL, {.routine = M_DeleteReplay}, 0, 0},
|
|
|
|
{IT_SPACE},
|
|
|
|
{IT_STRING | IT_CALL, "GO BACK", NULL, NULL, {.routine = [](auto) { g_egg_tv->back(); }}, 0, 0},
|
|
};
|
|
|
|
menu_t EXTRAS_EggTVDef =
|
|
{
|
|
sizeof (EXTRAS_EggTV)/sizeof (menuitem_t),
|
|
&EXTRAS_MainDef,
|
|
0,
|
|
EXTRAS_EggTV,
|
|
30, 80,
|
|
0, 0,
|
|
0,
|
|
"REPLAY", // music
|
|
41, 1,
|
|
M_DrawEggTV,
|
|
NULL,
|
|
NULL,
|
|
M_QuitEggTV,
|
|
M_HandleEggTV
|
|
};
|
|
|
|
// Call this to construct Egg TV menu
|
|
void M_EggTV(INT32 choice)
|
|
{
|
|
g_egg_tv = std::make_unique<EggTV>();
|
|
|
|
M_SetupNextMenu(&EXTRAS_EggTVDef, false);
|
|
}
|
|
|
|
void M_EggTV_RefreshButtonLabels()
|
|
{
|
|
EXTRAS_EggTV[2].text = g_egg_tv->favorited() ? "UNFAVORITE" : "FAVORITE";
|
|
}
|