Curation round 4: popups, Seeds/Random, Game, KeyConfigs, offline NetplayManager, Console, TextureCache, render passes
Six agents took over PopupButtons/PopupQueue/AchievementOverlay, Seeds with the global Random (now seeded from the clock as in the original), Game (g_game exists from Manager::Init on), KeyConfigs, an offline NetplayManager, Console's output and printing, TextureCache, the color-mod and sprite shader passes, mod shaders and reload_resource_paths. An integration pass moved callers to the new APIs (0 errors, 0 warnings with -Wall -Wextra). build/isaac loads the 34 installed mods and stops at ScoreSheet::ScoreSheet in Game's constructor; with the remaining stubs skipped under gdb the intro cutscene plays through and the main menu's frame loop runs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ddf913f304
commit
fd8b965350
110 files changed
+6500
-40129
No files matched your search
+136
@@ -0,0 +1,136 @@
|
||||
#pragma once
|
||||
|
||||
#include "classes.h"
|
||||
#include <array>
|
||||
#include <compare>
|
||||
#include <cstdint>
|
||||
#include <deque>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
// The console's colors as 0xAARRGGBB. REPENTOGON's Console::Color names white and the warning yellow.
|
||||
constexpr uint32_t CONSOLE_WHITE = 0xffd3d3d3;
|
||||
constexpr uint32_t CONSOLE_WARNING = 0xfffcca03;
|
||||
constexpr uint32_t CONSOLE_ERROR = 0xfff08080;
|
||||
constexpr uint32_t CONSOLE_ECHO = 0xff808080;
|
||||
// How many frames a printed line stays on the faded display.
|
||||
constexpr int CONSOLE_FADE_FRAMES = 150;
|
||||
constexpr int CONSOLE_SUGGESTION_COUNT = 6;
|
||||
|
||||
// Where the console is in sliding open and closed. Nothing known sets CONSOLE_REOPEN, which snaps back to open.
|
||||
enum ConsoleState : int
|
||||
{
|
||||
CONSOLE_CLOSED,
|
||||
CONSOLE_OPENING,
|
||||
CONSOLE_OPEN,
|
||||
CONSOLE_REOPEN,
|
||||
CONSOLE_CLOSING
|
||||
};
|
||||
|
||||
// Whether a line wraps again from its start, or only its last row after text was appended to it.
|
||||
enum LineWrap
|
||||
{
|
||||
WRAP_APPENDED,
|
||||
WRAP_ALL
|
||||
};
|
||||
|
||||
// Whether the output is drawn at full strength, or faded by age and by distance from the newest row.
|
||||
enum HistoryFade
|
||||
{
|
||||
HISTORY_SOLID,
|
||||
HISTORY_FADED
|
||||
};
|
||||
|
||||
// The console's font for the ConsoleFont option, with its row height and how far its glyphs sit from their row.
|
||||
struct ConsoleText
|
||||
{
|
||||
Font* font = nullptr;
|
||||
float lineHeight = 0;
|
||||
float offsetY = 0;
|
||||
};
|
||||
|
||||
// A place in the output: a line, newest first, and a row of that line counted up from its last.
|
||||
struct ConsoleScroll
|
||||
{
|
||||
int line = 0;
|
||||
int row = 0;
|
||||
|
||||
auto operator<=>(const ConsoleScroll&) const = default;
|
||||
};
|
||||
|
||||
// A line of output: its text, where it wraps on screen (each row's start after the first), its color (alpha unused)
|
||||
// and the frames it has left on the faded display.
|
||||
struct ConsoleLine
|
||||
{
|
||||
std::string text;
|
||||
std::vector<size_t> breaks;
|
||||
uint32_t color = CONSOLE_WHITE;
|
||||
int fadeFrames = CONSOLE_FADE_FRAMES;
|
||||
|
||||
// The rows the line takes on screen.
|
||||
int row_count() { return (int)breaks.size() + 1; }
|
||||
std::string_view row_get(int row);
|
||||
void wrap(LineWrap mode);
|
||||
};
|
||||
|
||||
// The debug console (Game's _console): the output, newest line first, the typed input with its cursor and suggestions,
|
||||
// the commands run before, and the panel sliding down over the game.
|
||||
// Destruction (00685fc0) is the default, and so are the std::deque and std::string helpers only the console used
|
||||
// (006935c0, 00693be0, 006938e0, 00693ac0, 00693d20).
|
||||
struct Console
|
||||
{
|
||||
std::array<std::string, CONSOLE_SUGGESTION_COUNT> suggestions;
|
||||
std::deque<ConsoleLine> history;
|
||||
std::deque<std::string> commandHistory;
|
||||
std::vector<size_t> inputBreaks;
|
||||
std::string input;
|
||||
std::string* capture = nullptr;
|
||||
ConsoleScroll scroll;
|
||||
ConsoleState state = CONSOLE_CLOSED;
|
||||
float height = 0;
|
||||
size_t cursor = 0;
|
||||
int animationFrame = 0;
|
||||
int blinkFrame = 0;
|
||||
int commandCursor = 0;
|
||||
int repeatFrames = 0;
|
||||
int repeatKey = 0;
|
||||
bool isTextInputStarted = false;
|
||||
|
||||
void reset();
|
||||
void history_clear();
|
||||
void LoadCommandHistory();
|
||||
void history_push(std::string line);
|
||||
|
||||
void Print(std::string_view text, uint32_t color = CONSOLE_WHITE, int fadeFrames = CONSOLE_FADE_FRAMES);
|
||||
void PrintError(std::string_view error);
|
||||
void print_format(uint32_t color, const char* format, ...) __attribute__((format(printf, 3, 4)));
|
||||
void RunCommand(std::string_view command, std::string* output, Entity_Player* player);
|
||||
|
||||
bool update_state();
|
||||
void Update();
|
||||
void Close();
|
||||
void character_add(uint32_t character);
|
||||
void FillOmnicomplete();
|
||||
|
||||
void Render();
|
||||
void RenderHistory(ConsoleText& text, Vector position, float alpha, HistoryFade fade);
|
||||
|
||||
ConsoleScroll scroll_min_get();
|
||||
ConsoleScroll scroll_max_get();
|
||||
void lines_wrap();
|
||||
void input_wrap();
|
||||
|
||||
private:
|
||||
void line_begin();
|
||||
void line_append(std::string_view text, uint32_t color, int fadeFrames);
|
||||
void scroll_row_clamp();
|
||||
bool is_key_repeated(int key);
|
||||
void control_update();
|
||||
void input_update();
|
||||
void input_erase(size_t position);
|
||||
bool is_input_pasted();
|
||||
void input_submit();
|
||||
};
|
||||
|
||||
ConsoleText console_text_get();
|
||||
Reference in new issue
Block a user