Files
isaac-port/src/menu_manager.h
T
shweetandClaude Opus 5.5 addd027977 Curation round 6: boot finished, the run starts; HUD, pause screen, minimap, preloads, floor generation
Six agents took over OnlineEmotes (emote wheel), OnlineStatsScreen's deeds, VictoryRunPrompt, RevivePlayerMenu, HUD,
PauseScreen, Minimap, PreloadManager, ProceduralItemManager, Game::LoadBossRushXml, GameState's loading, the menu loose
ends, Manager::StartNewGame, LevelGenerator and Level (Game now derives from Level). Integration: completion_widget.h
breaks an include loop, call sites moved to the new APIs. --mute (main.cpp) keeps the mixer running at zero gain.
build/isaac reaches the main menu by itself (input skips the intro); under gdb, picking a character calls
StartNewGame and stops at Game::Start. 1611 functions taken over, boot path 287/615.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 04:09:22 -05:00

217 lines
6.1 KiB
C++

#pragma once
#include "anm2.h"
#include "kage_graphics.h"
#include "menu_bestiary.h"
#include "menu_challenge.h"
#include "menu_character.h"
#include "menu_collection.h"
#include "menu_controller_select.h"
#include "menu_custom_challenge.h"
#include "menu_cutscenes.h"
#include "menu_daily_challenge.h"
#include "menu_game.h"
#include "menu_key_config.h"
#include "menu_options.h"
#include "menu_save.h"
#include "menu_special_seeds.h"
#include "menu_stats.h"
#include "menu_title.h"
#include "seeds.h"
#include <array>
#include <vector>
// The menus MenuManager shows, by REPENTOGON's MainMenuType, each at its own place on the menu sheet.
enum MenuState : int
{
MENU_NONE,
MENU_TITLE,
MENU_SAVE,
MENU_GAME,
MENU_DAILY_RUN,
MENU_CHARACTER,
MENU_SPECIAL_SEEDS,
MENU_CHALLENGE,
MENU_COLLECTION,
MENU_STATS,
MENU_OPTIONS,
MENU_CONTROLLER_SELECT,
MENU_KEY_CONFIG,
MENU_CUTSCENES,
MENU_BESTIARY,
MENU_CUSTOM_CHALLENGE,
MENU_MODS,
MENU_ONLINE_LOBBY,
MENU_ONLINE_LOBBY_LIST,
MENU_ONLINE,
MENU_ONLINE_OPTIONS,
MENU_CREATE_LOBBY,
MENU_ONLINE_AWARDS,
MENU_COUNT
};
// The game's input actions (Lua's ButtonAction), each bound to up to four buttons or keys of every device.
enum ButtonAction : int
{
ACTION_LEFT,
ACTION_RIGHT,
ACTION_UP,
ACTION_DOWN,
ACTION_SHOOT_LEFT,
ACTION_SHOOT_RIGHT,
ACTION_SHOOT_UP,
ACTION_SHOOT_DOWN,
ACTION_BOMB,
ACTION_ITEM,
ACTION_PILL_CARD,
ACTION_DROP,
ACTION_PAUSE,
ACTION_MAP,
ACTION_MENU_CONFIRM,
ACTION_MENU_BACK,
ACTION_FULLSCREEN,
ACTION_MUTE,
ACTION_RESTART,
ACTION_JOIN_MULTIPLAYER,
ACTION_MENU_LEFT,
ACTION_MENU_RIGHT,
ACTION_MENU_UP,
ACTION_MENU_DOWN,
ACTION_MENU_LB,
ACTION_MENU_RB,
ACTION_MENU_LT,
ACTION_MENU_RT,
ACTION_MENU_TAB,
ACTION_MENU_EX,
ACTION_EMOTES
};
// How an action is asked about: held now, or pressed this frame.
enum ActionTest
{
ACTION_PRESSED,
ACTION_TRIGGERED
};
// Whether SetState keeps the menu history or rebuilds the one leading to the new menu.
enum MenuHistory
{
HISTORY_KEEP,
HISTORY_REBUILD
};
// Whether a menu switch also resets the special seeds when it enters them. Leaving them always does.
enum SeedsEntry
{
SEEDS_ENTRY_KEEP,
SEEDS_ENTRY_RESET
};
constexpr const char* ANIMATION_IDLE = "Idle";
constexpr float MENU_HEIGHT = 270;
constexpr float MENU_WIDTH = 480;
constexpr int DEVICE_NONE = -1;
constexpr int SOUND_BOOK_PAGE_TURN_12 = 8;
constexpr int SOUND_MENU_SCROLL = 282;
constexpr int SOUND_MENU_NOTE_APPEAR = 283;
constexpr int SOUND_MENU_NOTE_HIDE = 284;
constexpr ColorModState COLOR_MOD_NONE = {1, 1, 1, 0, 0, 1};
// Copies are never made. Destruction (00986f30) is the default.
// The main menu (g_menuManager): every menu laid out on one sheet the view scrolls across, the history of menus
// opened, the fades, the fly, the shadow and overlay over everything, and the color modifier it all renders through.
// The online menus are offline: they are never built, entered or drawn. Menu_Mods keeps its generated type.
class MenuManager
{
public:
std::array<Vector, MENU_COUNT> viewPositionSet{};
std::vector<MenuState> menuStateHistory;
ColorModState currentColorModState = COLOR_MOD_NONE;
ColorModState lerpColorModState = COLOR_MOD_NONE;
ColorModState targetColorModState = COLOR_MOD_NONE;
KColor fadeInColor{};
Seeds seedsObject{};
Vector specialSeedsViewPosition{};
Vector viewPosition{};
KAGE::Graphics::ImagePtr emptyScreenImage;
KAGE::Graphics::ImagePtr menuOverlayImage;
ANM2 flySprite;
ANM2 menuShadowSprite;
Menu_Title menuTitle;
Menu_Save menuSave;
Menu_Game menuGame;
Menu_Bestiary menuBestiary;
Menu_Challenge menuChallenge;
Menu_Character menuCharacter;
Menu_Collection menuCollection;
Menu_ControllerSelect menuControllerSelect;
Menu_CustomChallenge menuCustomChallenge;
Menu_Cutscenes menuCutscenes;
Menu_DailyChallenge menuDailyChallenge;
Menu_KeyConfig menuKeyConfig;
Menu_Mods menuMods{};
Menu_Options menuOptions;
Menu_SpecialSeeds menuSpecialSeeds;
Menu_Stats menuStats;
float backWidgetOffsetY = 0;
float fadeInProgress = 0;
float fadeOutProgress = 0;
float scrollInterpolationX = 0;
float scrollInterpolationY = 0;
float selectWidgetOffsetY = 0;
float vignetteIntensity = 0;
MenuState selectedMenuId = MENU_NONE;
bool isColorModLerping = false;
bool isFadeInActive = false;
bool isFadeOutActive = false;
bool isPopupButtonsShown = false;
bool isViewMoving = false;
MenuManager();
MenuManager(const MenuManager&) = delete;
void Init();
void LoadGraphics();
void unload_graphics();
void Update();
void Render();
void SetState(MenuState state, MenuHistory history);
void push_menu(MenuState menu);
void pop_menu();
void scroll_options_menu(MenuState menu, int selectedRow, int rowCount);
void start_game(KColor fadeColor);
Vector menu_position_get(MenuState menu);
SpriteDraw menu_draw_get(Vector position);
private:
Vector view_target_get(MenuState menu);
void menus_init();
void view_update();
void fly_update();
void controller_update();
void menu_update();
void color_mod_update();
void history_rebuild(MenuState state);
SeedsEntry transition_apply(MenuState previous, MenuState state);
SeedsEntry transition_other_apply(MenuState previous, MenuState state);
void popup_buttons_place();
void vignette_update();
void overlay_render();
void color_mod_render();
void fades_render();
};
extern KAGE::Graphics::ImagePtr menuColorModSurface;
KColor kcolor_make(float red, float green, float blue, float alpha);
KColor kcolor_argb(uint32_t argb);
Vector vector_add(Vector a, Vector b);
bool is_action(ButtonAction action, ActionTest test, int* deviceId = nullptr);
bool is_controller_action(int deviceId, ButtonAction action, ActionTest test);
bool is_key_repeat(int heldFrames);
void menu_sound_play(int sound, int frameDelay);
void shader_select(std::string_view shaderName);
void color_mod_surface_create();