- 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>
307 lines
6.7 KiB
C++
307 lines
6.7 KiB
C++
#include "classes.h"
|
|
|
|
// 004073d0
|
|
void Sprite::SetColor(ColorMod *color)
|
|
{
|
|
float fVar1;
|
|
float fVar2;
|
|
float fVar3;
|
|
|
|
if (&this->_color != color) {
|
|
fVar1 = color->_tint[1];
|
|
fVar2 = color->_tint[2];
|
|
fVar3 = color->_tint[3];
|
|
(this->_color)._tint[0] = color->_tint[0];
|
|
(this->_color)._tint[1] = fVar1;
|
|
(this->_color)._tint[2] = fVar2;
|
|
(this->_color)._tint[3] = fVar3;
|
|
fVar1 = color->_colorize[1];
|
|
fVar2 = color->_colorize[2];
|
|
fVar3 = color->_colorize[3];
|
|
(this->_color)._colorize[0] = color->_colorize[0];
|
|
(this->_color)._colorize[1] = fVar1;
|
|
(this->_color)._colorize[2] = fVar2;
|
|
(this->_color)._colorize[3] = fVar3;
|
|
*GHIDRA_CAST<uint64_t *>((this->_color)._offset) = *GHIDRA_CAST<uint64_t *>(color->_offset);
|
|
(this->_color)._offset[2] = color->_offset[2];
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 00407420
|
|
uint8_t Sprite::FlipX()
|
|
{
|
|
return this->_flipX;
|
|
}
|
|
|
|
// 00407430
|
|
uint8_t Sprite::FlipY()
|
|
{
|
|
return this->_flipY;
|
|
}
|
|
|
|
// 0040a360
|
|
void Sprite::Play(std_string *animName, uint8_t isForce)
|
|
{
|
|
if (0xf < animName->_capacity) {
|
|
animName = *GHIDRA_CAST<std_string **>(animName->_buf);
|
|
}
|
|
ANM2::Play(GHIDRA_CAST<ANM2 *>(this),GHIDRA_CAST<uint8_t *>(animName),isForce);
|
|
return;
|
|
}
|
|
|
|
// 0040a4b0
|
|
void Sprite::IsPlaying(uint8_t *param_1)
|
|
{
|
|
ANM2 *in_ECX;
|
|
|
|
if (0xf < *GHIDRA_CAST<uint32_t *>((param_1 + 0x14))) {
|
|
param_1 = *GHIDRA_CAST<uint8_t **>(param_1);
|
|
}
|
|
ANM2::IsPlaying(in_ECX,param_1);
|
|
return;
|
|
}
|
|
|
|
// 0040a530
|
|
uint8_t Sprite::IsFinished(std_string *animName)
|
|
{
|
|
uint8_t bVar1;
|
|
|
|
if (0xf < animName->_capacity) {
|
|
animName = *GHIDRA_CAST<std_string **>(animName->_buf);
|
|
}
|
|
bVar1 = ANM2::IsFinishedImpl(GHIDRA_CAST<ANM2 *>(this),GHIDRA_CAST<uint8_t *>(animName));
|
|
return bVar1;
|
|
}
|
|
|
|
// 0040a5b0
|
|
uint8_t Sprite::SetAnimation(std_string *name, uint8_t isReset)
|
|
{
|
|
uint8_t bVar1;
|
|
|
|
if (0xf < name->_capacity) {
|
|
name = *GHIDRA_CAST<std_string **>(name->_buf);
|
|
}
|
|
bVar1 = ANM2::SetAnimation(GHIDRA_CAST<ANM2 *>(this),GHIDRA_CAST<uint8_t *>(name),isReset);
|
|
return bVar1;
|
|
}
|
|
|
|
// 0040a720
|
|
void Sprite::SetFrame_1(int frame)
|
|
{
|
|
if ((this->_animState)._animData != (void *)0x0) {
|
|
AnimationState::SetFrameFloat(&this->_animState,(float)frame);
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 0040a920
|
|
void Sprite::PlayOverlay(uint8_t *param_1, uint8_t param_2)
|
|
{
|
|
ANM2 *in_ECX;
|
|
|
|
if (0xf < *GHIDRA_CAST<uint32_t *>((param_1 + 0x14))) {
|
|
param_1 = *GHIDRA_CAST<uint8_t **>(param_1);
|
|
}
|
|
ANM2::PlayOverlay(in_ECX,param_1,param_2);
|
|
return;
|
|
}
|
|
|
|
// 0040a9d0
|
|
void Sprite::IsOverlayPlaying()
|
|
{
|
|
FUN_0040a9f0();
|
|
return;
|
|
}
|
|
|
|
// 0040aa50
|
|
void Sprite::IsOverlayFinished()
|
|
{
|
|
FUN_0040aa70();
|
|
return;
|
|
}
|
|
|
|
// 0040aad0
|
|
uint8_t Sprite::SetOverlayAnimation(std_string *animName, uint8_t isReset)
|
|
{
|
|
uint8_t bVar1;
|
|
|
|
if (0xf < animName->_capacity) {
|
|
animName = *GHIDRA_CAST<std_string **>(animName->_buf);
|
|
}
|
|
bVar1 = ANM2::SetOverlayAnimation(GHIDRA_CAST<ANM2 *>(this),GHIDRA_CAST<uint8_t *>(animName),isReset);
|
|
return bVar1;
|
|
}
|
|
|
|
// 0040abb0
|
|
void Sprite::SetOverlayFrame(std_string *animName, int frame)
|
|
{
|
|
uint8_t isAnimationSet;
|
|
|
|
if (0xf < animName->_capacity) {
|
|
animName = *GHIDRA_CAST<std_string **>(animName->_buf);
|
|
}
|
|
isAnimationSet = ANM2::SetOverlayAnimation(GHIDRA_CAST<ANM2 *>(this),GHIDRA_CAST<uint8_t *>(animName),1);
|
|
if ((isAnimationSet != 0) && ((this->_overlayAnimState)._animData != (void *)0x0)) {
|
|
AnimationState::SetFrameFloat(&this->_overlayAnimState,(float)frame);
|
|
}
|
|
return;
|
|
}
|
|
|
|
// 0040b000
|
|
uint8_t Sprite::IsEventTriggered(void *eventName)
|
|
{
|
|
uint8_t isTriggered;
|
|
|
|
if (0xf < *GHIDRA_CAST<uint32_t *>((GHIDRA_CAST<char *>(eventName) + 0x14))) {
|
|
eventName = *(void **)eventName;
|
|
}
|
|
if ((this->_animState)._animData == (void *)0x0) {
|
|
return 0;
|
|
}
|
|
isTriggered = AnimationState::IsEventTriggered(&this->_animState,eventName);
|
|
return isTriggered;
|
|
}
|
|
|
|
// 0040b060
|
|
uint8_t Sprite::WasEventTriggered(std_string *eventName)
|
|
{
|
|
uint8_t local_AL_32;
|
|
|
|
if (0xf < eventName->_capacity) {
|
|
eventName = *GHIDRA_CAST<std_string **>(eventName->_buf);
|
|
}
|
|
if ((this->_animState)._animData == (void *)0x0) {
|
|
return 0;
|
|
}
|
|
local_AL_32 = AnimationState::WasEventTriggered(&this->_animState,GHIDRA_CAST<uint8_t *>(eventName));
|
|
return local_AL_32;
|
|
}
|
|
|
|
// 0040b200
|
|
LayerState * Sprite::GetLayer(uint8_t *layerName)
|
|
{
|
|
LayerState *layer;
|
|
|
|
layer = ANM2::GetLayer(GHIDRA_CAST<ANM2 *>(this),layerName);
|
|
return layer;
|
|
}
|
|
|
|
// 0040b590
|
|
KColor * Sprite::GetTexel(KColor *param_2, float param_3, float param_4, float param_5, float param_6, float param_7, int param_8)
|
|
{
|
|
float fVar1;
|
|
float fVar2;
|
|
float fVar3;
|
|
Vector samplePos;
|
|
Vector samplePos_00;
|
|
Vector renderPos;
|
|
Vector renderPos_00;
|
|
KColor *candidateTexel;
|
|
KColor candidateTexelBuf;
|
|
|
|
samplePos.y = param_4;
|
|
samplePos.x = param_3;
|
|
renderPos.y = param_6;
|
|
renderPos.x = param_5;
|
|
ANM2::GetTexel(&this->_overlayAnimState,param_2,param_8,samplePos,renderPos,param_7);
|
|
if (param_2->_alpha <= param_7 && param_7 != param_2->_alpha) {
|
|
samplePos_00.y = param_4;
|
|
samplePos_00.x = param_3;
|
|
renderPos_00.y = param_6;
|
|
renderPos_00.x = param_5;
|
|
candidateTexel =
|
|
ANM2::GetTexel(&this->_animState,&candidateTexelBuf,param_8,samplePos_00,renderPos_00,
|
|
param_7);
|
|
fVar1 = candidateTexel->_green;
|
|
fVar2 = candidateTexel->_blue;
|
|
fVar3 = candidateTexel->_alpha;
|
|
param_2->_red = candidateTexel->_red;
|
|
param_2->_green = fVar1;
|
|
param_2->_blue = fVar2;
|
|
param_2->_alpha = fVar3;
|
|
param_2->_unk = candidateTexel->_unk;
|
|
}
|
|
return param_2;
|
|
}
|
|
|
|
// 0040bff0
|
|
void Sprite::LoadGraphics()
|
|
{
|
|
ANM2::LoadGraphics(GHIDRA_CAST<ANM2 *>(this),(uint8_t)this);
|
|
return;
|
|
}
|
|
|
|
// 00417200
|
|
Vector * Sprite::Scale()
|
|
{
|
|
return &this->_scale;
|
|
}
|
|
|
|
// 00417210
|
|
long double Sprite::Rotation()
|
|
{
|
|
return (long double)this->_rotation;
|
|
}
|
|
|
|
// 00420160
|
|
uint8_t Sprite::IsLoaded()
|
|
{
|
|
return this->_loaded;
|
|
}
|
|
|
|
// 00420170
|
|
void Sprite::SetScale(Vector *scale)
|
|
{
|
|
(this->_scale).x = scale->x;
|
|
(this->_scale).y = scale->y;
|
|
return;
|
|
}
|
|
|
|
// 004312e0
|
|
std_string * Sprite::GetFilename(std_string *outName)
|
|
{
|
|
(GHIDRA_CAST<msvc::string *>((outName->_buf)))->msvc::string::string(this);
|
|
return outName;
|
|
}
|
|
|
|
// 00431300
|
|
void Sprite::SetOverlayRenderPriority(uint8_t param_2)
|
|
{
|
|
this->_overlayRenderFirst = param_2;
|
|
return;
|
|
}
|
|
|
|
// 0043ee80
|
|
void Sprite::SetRotation(float rotation)
|
|
{
|
|
this->_rotation = rotation;
|
|
return;
|
|
}
|
|
|
|
// 00440e40
|
|
int Sprite::GetLayerCount()
|
|
{
|
|
return this->_layerCount;
|
|
}
|
|
|
|
// 00456340
|
|
void Sprite::set_offset(Vector *offset)
|
|
{
|
|
(this->_offset).x = offset->x;
|
|
(this->_offset).y = offset->y;
|
|
return;
|
|
}
|
|
|
|
// 00456360
|
|
long double Sprite::PlaybackSpeed()
|
|
{
|
|
return (long double)this->_playbackSpeed;
|
|
}
|
|
|
|
// 0049cb40
|
|
Vector * Sprite::Offset()
|
|
{
|
|
return &this->_offset;
|
|
}
|