Files
isaac-port/src/manager.h
T
shweetandClaude Opus 5.5 28e2e48842 Curation round 2, wave B: ItemConfig, EntityConfig, mods, Manager and the KAGE platform on SDL3; boots to LuaEngine::Init
- item_config, entity_config and mod_manager take over their families as idiomatic classes (std containers,
  unique_ptr, bitset tear flags). Every big loader reads the imported JSON: entities2.xml gives 1349 entities.
- manager.h/.cpp take over Manager (g_manager) and IsaacStartup. Members are the curated subsystems by value.
- kage_graphics, kage_input and kage_sound take over KAGE's graphics (shaders, render targets, batches, PNG through
  stb_image), input (SDL3 keyboard, mouse, gamepads) and sound (SDL3 audio, wav and stb_vorbis ogg, pitch and volume).
- source_tree.py: classes inside a namespace block in src/ headers count as taken over, and a still-generated class's
  vtable slot keeps its stub unless src/ defines that exact method.
build/isaac opens the window, sets up GL 4.6, framebuffers and PulseAudio, logs the version, and stops at
LuaEngine::Init. 522 functions taken over, boot path 156/615.

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

176 lines
5.2 KiB
C++

#pragma once
#include "anm2.h"
#include "challenge_params.h"
#include "entity_config.h"
#include "font.h"
#include "item_config.h"
#include "mod_manager.h"
#include "options_config.h"
#include "platform.h"
#include "string_table.h"
#include <array>
#include <cstdint>
#include <string>
#include <string_view>
#include <vector>
// What the game shows, as Manager::Update dispatches on it.
enum ManagerState : int
{
MANAGER_STATE_NONE,
MANAGER_STATE_MENU,
MANAGER_STATE_GAME,
MANAGER_STATE_CUTSCENE,
MANAGER_STATE_IDLE,
MANAGER_STATE_NIGHTMARE
};
// Whether a cutscene unloads the current state first and returns to a menu after it.
enum CutsceneCleanup
{
CUTSCENE_KEEP_STATE,
CUTSCENE_UNLOAD_STATE
};
// How the view fits a cutscene's frame into the window.
enum ScreenFit
{
SCREEN_FIT_INSIDE,
SCREEN_FIT_FILL
};
// The game's top object (g_manager): every subsystem that outlives a run, the state it shows (menus, game, cutscene,
// nightmare) and the transitions queued between them, the UI sprites and fonts, and the run about to start.
// Members of classes not taken over yet keep their generated types and start zeroed.
class Manager
{
public:
PersistentGameData persistentGameData{};
GameState gamestate{};
Cutscene cutsceneManager{};
NightmareScene nightmareScene{};
AchievementOverlay achievementOverlay{};
MusicManager musicManager{};
SoundEffects sfxManager{};
OptionsConfig optionsConfig;
ItemConfig itemConfig;
InfoDisplay infoDisplay{};
std::vector<ChallengeParam> challengeParams;
EntityConfig entityConfig;
ModManager modManager;
StringTable stringTable;
StringTable stringTablePc;
PopupButtons popupButtons{};
KeyConfigs keyConfigs{};
LobbySettings lobbySettings{};
DailyChallenge dailyChallenge{};
NetplayManager netplayManager{};
PopupQueue popupQueue{};
std_vector lobbyMembers{};
ANM2 buttonsSprite;
ANM2 cursorSprite;
ANM2 platformIconsSprite;
Font font1_TeamMeatEx10;
Font font2_TeamMeatEx12;
Font font3_TeamMeatEx16;
Font font4_terminus;
Font font5_terminus8;
Font font6_PFTempestaSevenCondensed;
Font font7_Upheaval;
Font font8_LuaMiniOutlined;
Font font9_PFTempestaSevenCondensedAgain;
std::array<TexturePtr, 2> loadImages{};
uint64_t loadImagesTime = 0;
Seeds startSeeds{};
std::string startRoomPath;
int startChallenge = 0;
int startDifficulty = 0;
int startPlayerType = 0;
int startStage = 0;
int startStageType = 0;
KColor pendingMenuFadeColor{};
Vector lastMousePosition{};
ManagerState previousState = MANAGER_STATE_NONE;
ManagerState state = MANAGER_STATE_NONE;
int activeControllerIndex = 0;
int consecutiveResetCount = 0;
int controllerDisconnectedPopupId = -1;
int cursorVisibleTimer = 0;
int cutsceneNextMenuState = 0;
int framesPerSecond = 0;
int pendingCutsceneId = 0;
int pendingMenuState = 0;
int selectedDifficulty = 0;
int unrecognizedControllerPopupId = -1;
uint32_t currentSaveSlot = 0;
unsigned int framecount = 0;
uint8_t pendingNightmareId = 0;
bool isConsoleEnabled = false;
bool isControllerReselectPopup = false;
bool isCutsceneCleanupPending = false;
bool isCutscenePending = false;
bool isDebugStart = false;
bool isFrameStepPending = false;
bool isHotkeysEnabled = false;
bool isIdlePending = false;
bool isMenuPending = false;
bool isNetworkPlay = false;
bool isNetworkTest = false;
bool isNightmarePending = false;
bool isPersistentDataWritable = false;
bool isRenderSurfaceResetPending = false;
bool isRerunAvailable = false;
bool isSaveOnExit = false;
bool isSavingGameState = false;
bool isStarting = false;
bool isStartingFromRerun = false;
bool isUpdatePaused = false;
bool isWindowFocused = false;
Manager();
~Manager();
static void Init();
void LoadConfigs();
static void unload_configs();
void load_fonts();
void create_render_surfaces();
void validate_language();
static std::string_view GetLanguage();
ChallengeParam& GetChallengeParams(int challengeId);
static void* LoadImage(void* outImage, uint8_t* path);
static void Update();
void Render();
static void update_ingame_input();
void update_hotkeys();
void update_controller_popups();
static void update_state_loading();
static void render_loading_icon(float alpha);
static void render_button_sprite(int frame, Vector position);
static void apply_device_key_config(int deviceId);
static bool IsGameplayInputActive();
static void queue_achievement_popup(int achievementId);
static void ResizeWindowCallback(Size size);
static void set_viewport_size(Size size);
static void update_screen_scale(Size size, ScreenFit fit);
void StartNewGame(int playerType, int challenge, Seeds seeds, int difficulty);
static void RestartGame();
void ShowCutscene(uint32_t cutsceneId, CutsceneCleanup cleanup, int nextMenuState);
void start_pending_game();
void start_pending_menu();
void unload_state();
static void save_game_state();
void SetSaveSlot(uint32_t slot);
void BackupSaveFile();
};
void IsaacStartup(int argc, uint8_t** argv);