Files
isaac-port/generated-src/entity_text.cpp
T
shweetandClaude Opus 5.5 780767f5e1 Curation round 2, wave A: anm2 (Anm2Ed JSON), text, config as idiomatic classes; SDL3 platform opens a window
- 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>
2026-11-19 23:04:54 -05:00

192 lines
7.5 KiB
C++

#include "classes.h"
// 005ccd80
void Entity_Text::Update()
{
int iVar1;
uint32_t timer;
uint32_t uVar2;
float fVar3;
float velY;
Game *game;
iVar1 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x2c));
if (iVar1 == 0) {
fVar3 = 1.0 - (float)*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x410)) / (float)*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x414));
fVar3 = fVar3 * fVar3;
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x524)) = fVar3;
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0x34c)) = 0;
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x350)) = (1.0 - fVar3) * -50.0;
}
else if (iVar1 == 1) {
iVar1 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x410));
if (iVar1 == 0) {
sprintf_s(GHIDRA_CAST<uint8_t *>((GHIDRA_INT(this) + 0x418)),0x100,&DAT_00b62fe0);
iVar1 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x410));
}
game = g_game;
iVar1 = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x414)) - iVar1;
if (10 < iVar1) {
iVar1 = 10;
}
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x524)) = (float)iVar1 / 10.0;
fVar3 = sin((float)(game->_frameCount - *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x328))) * 0.2);
if ((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(this) + 0x20)) & 1) == 0) {
fVar3 = fVar3 * 15.0;
}
else {
fVar3 = fVar3 * -15.0;
}
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x34c)) = fVar3;
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0x350)) = 0;
}
else if (iVar1 == 2) {
timer = *GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0x410));
if (timer == 0) {
sprintf_s(GHIDRA_CAST<uint8_t *>((GHIDRA_INT(this) + 0x418)),0x100,s__d);
timer = *GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0x410));
}
uVar2 = 0x3f800000;
if ((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x414)) + -0xf <= GHIDRA_INT(timer)) && ((timer & 1) != 0)) {
uVar2 = 0;
}
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0x518)) = 0x3f800000;
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0x51c)) = 0x3f800000;
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0x520)) = 0x3f800000;
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0x524)) = uVar2;
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0x528)) = 0;
}
fVar3 = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x36c)) * *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x360));
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x410)) = *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x410)) + 1;
velY = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x36c)) * *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x364));
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0x36c)) = *GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0x368));
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x360)) = fVar3;
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x364)) = velY;
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x33c)) = fVar3 + *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x33c));
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x340)) = velY + *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x340));
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x414)) < *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x410))) {
this->Remove();
}
return;
}
// 005ccfc0
void Entity_Text::Render(Vector *offset)
{
void *font = this;
uint8_t *str;
Vector pos;
Vector scale;
uint8_t isPaused;
uint32_t flickerPhase;
Font *font;
float fVar1;
double dVar2;
uint32_t fontSettings;
uint32_t local_3c;
uint32_t local_38;
uint32_t local_34;
uint32_t local_30;
uint32_t local_2c;
uint32_t local_28;
float screenY;
float worldY;
int textWidth;
float pixelScale;
float screenX;
void *local_10;
uint8_t *puStack_c;
uint32_t local_8;
local_8 = 0xffffffff;
puStack_c = &LAB_00af5fe5;
local_10 = ExceptionList;
ExceptionList = &local_10;
if (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(font) + 0x172)) != '\0') {
str = GHIDRA_CAST<uint8_t *>((GHIDRA_INT(font) + 0x418));
font = &g_manager->_font6_PFTempestaSevenCondensed;
textWidth = Font::get_string_width_n(font,str,-1);
worldY = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(font) + 0x340)) + *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(font) + 0x350));
screenY = (g_screenHeight - 182.0) * 0.5;
pixelScale = g_displayPixelRatio * g_screenPointScale;
screenX = (((*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(font) + 0x34c)) + *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(font) + 0x33c))) - 60.0) * 0.65 +
(g_screenWidth - 338.0) * 0.5) * pixelScale + 0.5;
dVar2 = floor((double)screenX);
screenX = (float)dVar2 / pixelScale;
screenY = ((worldY - 140.0) * 0.65 + screenY) * pixelScale + 0.5;
dVar2 = floor((double)screenY);
screenY = (float)dVar2;
screenX = screenX + offset->x;
fVar1 = offset->y;
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(font) + 0x1a4)) = screenX;
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(font) + 0x1a8)) = screenY / pixelScale + fVar1;
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(font) + 0x2c)) == 2) {
isPaused = (GHIDRA_CAST<Game *>((g_game)))->Game::IsPaused();
if (isPaused == 0) {
flickerPhase = g_manager->_framecount + 1U & 0x80000001;
if (GHIDRA_INT(flickerPhase) < 0) {
flickerPhase = (flickerPhase - 1 | 0xfffffffe) + 1;
}
}
else {
flickerPhase = 0;
}
fontSettings = 0;
local_3c = 0xffff;
local_38 = 0;
local_34 = 0x3f800000;
local_30 = 0xffffffff;
local_2c = 0;
local_28 = 0;
fVar1 = ((float)GHIDRA_INT((flickerPhase + *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(font) + 0x410)) * 2)) * 0.5 - 0.0) * 0.25;
if (fVar1 <= 0.0) {
fVar1 = 0.0;
}
if (1.0 <= fVar1) {
fVar1 = 1.0;
}
fVar1 = 4.0 - fVar1 * 2.5;
local_8 = 0;
pos.y = *GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(font) + 0x1a8)) - fVar1 * 4.0;
pos.x = screenX - (float)textWidth * 0.5 * fVar1;
scale.y = fVar1;
scale.x = fVar1;
Font::DrawString(font,str,pos,scale,GHIDRA_CAST<KColor *>((GHIDRA_INT(font) + 0x518)),
GHIDRA_CAST<FontSettings *>(&fontSettings));
ExceptionList = local_10;
return;
}
fontSettings = 0;
local_3c = 0xffff;
local_38 = 0;
local_34 = 0x3f800000;
local_30 = 0xffffffff;
local_2c = 0;
local_28 = 0;
local_8 = 1;
Font::DrawString(font,str,GHIDRA_CAST<KColor *>((GHIDRA_INT(font) + 0x518)),&fontSettings,
screenX - (float)textWidth * 0.5,*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(font) + 0x1a8)));
}
ExceptionList = local_10;
return;
}
// 005cd2e0
void Entity_Text::Interpolate()
{
float wobble;
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x2c)) == 1) {
wobble = sin(((float)(g_game->_frameCount - *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x328))) + 0.5) * 0.2);
*GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(this) + 0x350)) = 0;
if ((*GHIDRA_CAST<uint8_t *>((GHIDRA_CAST<char *>(this) + 0x20)) & 1) == 0) {
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x34c)) = wobble * 15.0;
this->Entity::Interpolate();
return;
}
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x34c)) = wobble * -15.0;
}
this->Entity::Interpolate();
return;
}