Batch #3090 by eAthena: 0 byte-identical, 5 confirmed by peer review. - fn_18864 CSpriteParticle::UpdateFrame: logic confirmed by peer review - fn_18866 CSpriteParticle::SetAction: logic confirmed by peer review - fn_18867 CSpriteParticle::SetSprite: logic confirmed by peer review - fn_19234 CThrowItemEffect::Slot12: logic confirmed by peer review - fn_19243 CVolcanoEffect::Slot06: logic confirmed by peer review Peer-reviewed-by: meitogi, superintelligence Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). Adds to the build: Source/Contents/Effects/SpriteParticle.cpp, Source/Contents/Effects/ThrowEffects.cpp
62 lines
1.4 KiB
C++
62 lines
1.4 KiB
C++
#include "Contents/Effects/SpriteParticle.h"
|
|
#include "Resource/ResourceMgr.h"
|
|
#include "Resource/Sprites/ActionResource.h"
|
|
#include "Resource/Sprites/SpriteResource.h"
|
|
|
|
// OFFSET: 0x00B40E30
|
|
// FUNCTION: fn_18864
|
|
void CSpriteParticle::UpdateFrame() {
|
|
if (!this->action || this->loopMode == 3) {
|
|
return;
|
|
}
|
|
|
|
const long long frameCount = static_cast<int>(this->action->FrameCount(this->animation));
|
|
const long long delay = static_cast<long long>(this->frameDelay);
|
|
if (delay == 0 || (this->unknown_00E8 >= delay && this->unknown_00E8 % delay == 0)) {
|
|
++this->frame;
|
|
}
|
|
|
|
switch (this->loopMode) {
|
|
case 0:
|
|
if (this->frame >= frameCount) {
|
|
this->frame = 0;
|
|
}
|
|
break;
|
|
case 1:
|
|
if (this->frame >= frameCount) {
|
|
this->life = -1.0f;
|
|
}
|
|
break;
|
|
case 2:
|
|
if (this->frame >= frameCount) {
|
|
this->frame = static_cast<int>(frameCount) - 1;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
// OFFSET: 0x00B41D60
|
|
// FUNCTION: fn_18866
|
|
void CSpriteParticle::SetAction(const char* name) {
|
|
if (this->action) {
|
|
this->action->Unlock();
|
|
}
|
|
|
|
this->action = static_cast<CActRes*>(ResourceMgr::Instance().Load(name));
|
|
if (this->action) {
|
|
this->action->Lock();
|
|
}
|
|
}
|
|
|
|
// OFFSET: 0x00B41DA0
|
|
// FUNCTION: fn_18867
|
|
void CSpriteParticle::SetSprite(const char* name) {
|
|
if (this->sprite) {
|
|
this->sprite->Unlock();
|
|
}
|
|
|
|
this->sprite = static_cast<CSprRes*>(ResourceMgr::Instance().Load(name));
|
|
if (this->sprite) {
|
|
this->sprite->Lock();
|
|
}
|
|
}
|