rodecomp/Source/Contents/Effects/Skills/ShadowExceedNewEffect.cpp
ragnarok-clanker 403ab1d8ca Decompile 2 functions in Source/Contents/Effects/Skills/RedLineEffect.cpp, Source/Contents/Effects/Skills/ShadowExceedNewEffect.cpp
Batch #17991 by eAthena: 0 byte-identical, 2 confirmed by peer review.

- fn_19138 CRedLineEffect::OnProcess: logic confirmed by peer review
- fn_07436 CShadowExceedNew::OnProcess: logic confirmed by peer review

Peer-reviewed-by: ragnarok-clanker, Yommy, bibinir
Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
2026-11-12 10:50:34 +00:00

150 lines
5 KiB
C++

#include "Contents/Effects/Skills/SkillEffects.h"
#include "Client/Mode/CGameMode.h"
#include "Client/Mode/ModeMgr.h"
#include "Contents/Actors/RenderObject.h"
#include "Contents/Camera/Camera.h"
#include "Contents/Effects/Core/EffectActor.h"
#include "Contents/Effects/Core/EffectMemoryMgr.h"
#include "Contents/Effects/Particles/Particle.h"
#include "Contents/World/World.h"
#include "Utility/Math/Vector3d.h"
#include <cmath>
#include <string>
// OFFSET: 0x00727EF0
// FUNCTION: fn_07430
void CShadowExceedNew::Close() {
for (CEZ2STRParticle* emitter : this->frontEmitters) {
FreeParticle(emitter);
}
this->frontEmitters.clear();
for (CEZ2STRParticle* emitter : this->backEmitters) {
FreeParticle(emitter);
}
this->backEmitters.clear();
}
// OFFSET: 0x00728500
// FUNCTION: fn_07432
void CShadowExceedNew::Open() {
this->retained = 1;
this->AddEvent(0, "effect\\SHC_SHADOW_EXCEED.wav", 0, 0);
CEZ2STRParticle* emitter = static_cast<CEZ2STRParticle*>(CreateEZ2STRParticle(reinterpret_cast<const vector3d*>(this->position), 5));
if (emitter) {
emitter->Load(std::string("SHADOW_CROSS\\SHC_SHADOW_EXCEED\\shadow_exceed\\shadow_exceed_f_shadow_bottom.str"));
emitter->offsetX = 0.0f;
emitter->offsetY = -12.0f;
emitter->offsetZ = 0.0f;
emitter->m_scale = 0.14f;
this->frontEmitters.push_back(emitter);
}
emitter = static_cast<CEZ2STRParticle*>(CreateEZ2STRParticle(reinterpret_cast<const vector3d*>(this->position), 5));
if (emitter) {
emitter->Load(std::string("SHADOW_CROSS\\SHC_SHADOW_EXCEED\\shadow_exceed\\shadow_exceed_f_shadow.str"));
emitter->offsetX = 0.0f;
emitter->offsetY = -10.0f;
emitter->offsetZ = 0.0f;
emitter->m_scale = 0.14f;
this->frontEmitters.push_back(emitter);
}
emitter = static_cast<CEZ2STRParticle*>(CreateEZ2STRParticle(reinterpret_cast<const vector3d*>(this->position), 5));
if (emitter) {
emitter->Load(std::string("SHADOW_CROSS\\SHC_SHADOW_EXCEED\\shadow_exceed\\shadow_exceed_b_shadow_bottom.str"));
emitter->offsetX = 0.0f;
emitter->offsetY = -12.0f;
emitter->offsetZ = 0.0f;
emitter->m_scale = 0.14f;
emitter->depthOffset = 0.0003f;
this->backEmitters.push_back(emitter);
}
emitter = static_cast<CEZ2STRParticle*>(CreateEZ2STRParticle(reinterpret_cast<const vector3d*>(this->position), 5));
if (emitter) {
emitter->Load(std::string("SHADOW_CROSS\\SHC_SHADOW_EXCEED\\shadow_exceed\\shadow_exceed_b_shadow.str"));
emitter->offsetX = 0.0f;
emitter->offsetY = -10.0f;
emitter->offsetZ = 0.0f;
emitter->m_scale = 0.14f;
emitter->depthOffset = 0.0003f;
this->backEmitters.push_back(emitter);
}
}
// OFFSET: 0x007289D0
// FUNCTION: fn_07434
bool CShadowExceedNew::IsAlive() {
CRenderObject* actor = FindRenderObject(this->actor);
if (actor) {
if (this->frontEmitters.size() != 0 && this->backEmitters.size() != 0) {
return true;
}
if (!static_cast<EffectActor*>(actor)->HasId(1004)) {
static_cast<EffectActor*>(actor)->LaunchEffect(1004, vector3d{0.0f, 0.0f, 0.0f}, 0.0f);
}
}
return false;
}
// OFFSET: 0x00728DC0
// FUNCTION: fn_07436
void CShadowExceedNew::OnProcess() {
CRenderObject* actor = FindRenderObject(this->actor);
if (!actor) {
return;
}
const float angle = actor->render.angle / 180.0f * 3.141592f;
const float cosine = ClientCos(angle);
const float sine = ClientSin(angle);
const float y = actor->render.position.y + 0.0f;
const float z = cosine * 5.0f + actor->render.position.z;
const float x = -sine * 5.0f + actor->render.position.x;
const int direction = actor->render.previousAnimation % 8;
this->drawBackEmitters = static_cast<unsigned int>(direction - 2) <= 3;
for (auto it = this->frontEmitters.begin(); it != this->frontEmitters.end();) {
CEZ2STRParticle* emitter = *it;
const vector3d position = {x + emitter->offsetX, y + emitter->offsetY, z + emitter->offsetZ};
emitter->position = position;
emitter->m_flipX = direction == 0 || direction == 1;
if ((*it)->Process(0.0f, 0.0f, 0.0f)) {
++it;
} else {
FreeParticle(*it);
it = this->frontEmitters.erase(it);
}
}
for (auto it = this->backEmitters.begin(); it != this->backEmitters.end();) {
CEZ2STRParticle* emitter = *it;
const vector3d position = {x + emitter->offsetX, y + emitter->offsetY, z + emitter->offsetZ};
emitter->position = position;
emitter->m_flipX = direction == 4 || direction == 5;
if ((*it)->Process(0.0f, 0.0f, 0.0f)) {
++it;
} else {
FreeParticle(*it);
it = this->backEmitters.erase(it);
}
}
}
// OFFSET: 0x00729280
// FUNCTION: fn_07438
void CShadowExceedNew::Render() {
if (this->drawBackEmitters) {
for (CEZ2STRParticle* emitter : this->backEmitters) {
emitter->DrawBillboards(static_cast<CGameMode*>(g_modeMgr.GetGameMode())->camera->frame.view);
}
} else {
for (CEZ2STRParticle* emitter : this->frontEmitters) {
emitter->DrawBillboards(static_cast<CGameMode*>(g_modeMgr.GetGameMode())->camera->frame.view);
}
}
}