rodecomp/Source/Contents/SpriteRidingOffset.cpp
ragnarok-clanker de7ba031af Decompile fn_22576 (SpriteRidingOffset)
Batch #13362 by SapitoSucio: 0 byte-identical, 1 confirmed by peer review.

- fn_22576 SpriteRidingOffset: logic confirmed by peer review

Peer-reviewed-by: eAthena, Yommy, aDw, codeplay
Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
2026-11-07 03:55:33 +00:00

39 lines
1.2 KiB
C++

#include "Contents/SpriteRidingOffset.h"
#include "Contents/EquipmentResourceMgr.h"
#include "Contents/Jobs/JobNames.h"
#include "Resource/ResourceMgr.h"
#include "Resource/Sprites/ActionResource.h"
// OFFSET: 0x00DDE340
// FUNCTION: fn_23394
std::string GetBodyActionResourceName(int job, int sex, int costumeJob, int costume) {
return g_equipmentResourceMgr->GetBodyResourceName(0, job, sex, costumeJob, costume);
}
// OFFSET: 0x00DAAC70
// FUNCTION: fn_22576
int SpriteRidingOffset(const ActionFrame* frame, unsigned animation, unsigned motion, int job, int sex, int costumeJob) {
if (!frame || !&frame->Cell(1)) {
return 0;
}
std::string name = GetBodyActionResourceName(JobNames::BaseJob(job), sex, costumeJob, 0);
std::string resourceName(name);
CActRes* action = static_cast<CActRes*>(ResourceMgr::Instance().Load(resourceName));
if (!action) {
return 0;
}
const ActionFrame* baseFrame = &action->Frame(animation, motion);
if (!baseFrame || baseFrame->anchors.empty() || frame->anchors.empty()) {
return 0;
}
const ActionAnchor& base = baseFrame->anchors.front();
const ActionAnchor& riding = frame->anchors.front();
if (base.unknown_0008 != riding.unknown_0008) {
return 0;
}
return base.y - riding.y;
}