rodecomp/Source/Contents/Effects/ShadowExceedNewEffect.cpp
ragnarok-clanker 6f45fc36d1 Decompile 2 functions in Source/Contents/Effects/ShadowExceedNewEffect.cpp
Batch #15656 by Yommy: 2 byte-identical, 0 confirmed by peer review.

- fn_07430 CShadowExceedNew::Close: byte-identical
- fn_07438 CShadowExceedNew::Render: byte-identical

Merged automatically: every function is byte-identical to the original.
2026-11-10 08:18:41 +00:00

152 lines
5 KiB
C++

#include "Contents/Effects/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/EffectActor.h"
#include "Contents/Effects/EffectMemoryMgr.h"
#include "Contents/Effects/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 = std::cos(angle);
const float sine = std::sin(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) < 4;
for (auto it = this->frontEmitters.begin(); it != this->frontEmitters.end();) {
CEZ2STRParticle* emitter = *it;
emitter->position.x = x + emitter->offsetX;
emitter->position.y = y + emitter->offsetY;
emitter->position.z = z + emitter->offsetZ;
emitter->m_flipX = direction == 0 || direction == 1;
if (!emitter->Process(0.0f, 0.0f, 0.0f)) {
FreeParticle(*it);
it = this->frontEmitters.erase(it);
} else {
++it;
}
}
for (auto it = this->backEmitters.begin(); it != this->backEmitters.end();) {
CEZ2STRParticle* emitter = *it;
emitter->position.x = x + emitter->offsetX;
emitter->position.y = y + emitter->offsetY;
emitter->position.z = z + emitter->offsetZ;
emitter->m_flipX = direction == 4 || direction == 5;
if (!emitter->Process(0.0f, 0.0f, 0.0f)) {
FreeParticle(*it);
it = this->backEmitters.erase(it);
} else {
++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);
}
}
}