#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 #include #include #include #include // 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 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 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);