Batch #18317 by ragnarok-clanker: forced by an admin (7 lower score(s), 18 changed function(s)); checked with 288 compiled unit(s), including every includer of Source/Client/Session/Session.h, Source/Contents/Actors/Pc.h, Source/Contents/Sprites/SpriteRidingOffset.h.
40 lines
1.3 KiB
C++
40 lines
1.3 KiB
C++
#include "Contents/Sprites/SpriteRidingOffset.h"
|
|
#include "Client/Session/Session.h"
|
|
#include "Contents/Actors/Resources/EquipmentResourceMgr.h"
|
|
#include "Contents/Jobs/JobNames.h"
|
|
#include "Resource/ResourceMgr.h"
|
|
#include "Resource/Sprites/ActionResource.h"
|
|
|
|
// OFFSET: 0x00DDE340
|
|
// FUNCTION: fn_23394
|
|
std::string CSession::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 = g_session.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.attachmentId != riding.attachmentId) {
|
|
return 0;
|
|
}
|
|
|
|
return base.y - riding.y;
|
|
}
|