- anm2.h/.cpp take over ANM2, AnimationState, LayerState, AnmCache and the frame data. They read Anm2Ed's JSON documents with simdjson and play them as the game does (interpolation baked at load). src/anm2/ and msvc.h are retired. - font, formatted_text, string_table and rich_text take over the text classes. FormattedText::parse is still bit-exact against its assembly. - options_config and challenge_params take over OptionsConfig, ChallengeParams and the .ini helpers. The tests include Save's exact bytes. - platform.h/.cpp and main.cpp run IsaacMain on SDL3: the window and GL context open, and the run stops at the first built-in shader (FUN_00a13fa0). - source_tree.py: a taken-over parent stays bytes, taken-over methods are not re-emitted as a namespace, and every address in a (a, b, c to d) list on a comment counts as taken over. - log.h: reconstruction_missing() for a taken-over class's methods that are not written yet. 206 functions taken over, boot path 89/615. The full build waits for wave B: item_config, entity_config and mod_manager still use the old APIs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
35 lines
1.4 KiB
C++
35 lines
1.4 KiB
C++
#include "rich_text.h"
|
|
#include "log.h"
|
|
|
|
constexpr std::string_view TEXT_ICONS_PATH = "gfx/ui/text_icons.anm2";
|
|
// The animation each icon type is a frame of, empty for the collectible, which is an image of its own.
|
|
constexpr std::string_view ICON_ANIMATIONS[] = {"players", "pickups", "", "rooms"};
|
|
|
|
// 009efb60 Loads the font at path and, the first time, the icon sprite, which it then fits to the font's line height.
|
|
// The game formatted the path into a buffer of 260 characters first. The whole path is used here.
|
|
void RichText::load_font(std::string_view path)
|
|
{
|
|
std::string message = "Failed to load font: " + std::string(path) + " \n";
|
|
|
|
fontPath = path;
|
|
if (!font.Load(fontPath)) KAGE_LogMessage(LOG_ASSERT, (uint8_t*)message.data());
|
|
|
|
if (!icons)
|
|
{
|
|
icons = std::make_unique<RichTextIcon>();
|
|
icons->Load(TEXT_ICONS_PATH, GRAPHICS_LOAD);
|
|
}
|
|
icons->maxHeight = font.lineHeight;
|
|
}
|
|
|
|
// 009f2b10 The text_icons.anm2 animation an icon type is drawn from, or nothing, logged, for the collectible and
|
|
// unknown types.
|
|
std::string_view RichTextIcon::get_animation_name(RichTextIconType type)
|
|
{
|
|
if (type >= ICON_PLAYER && type <= ICON_ROOM && type != ICON_COLLECTIBLE) return ICON_ANIMATIONS[type];
|
|
|
|
std::string message = "Invalid icon type (" + std::to_string(type) + ") for get_animation_name() \n";
|
|
KAGE_LogMessage(LOG_ERROR, (uint8_t*)message.data());
|
|
return {};
|
|
}
|