rodecomp/Source/Contents/Effects/RectUpEffect.cpp
ragnarok-clanker b93dbdf725 Decompile 16 functions in Source/Contents/Effects/Bash.cpp, Source/Contents/Effects/ElectricEffect.cpp, ...
Batch #12326 by cremane: 16 byte-identical, 0 confirmed by peer review.

- fn_07035 CHitLineEffect::Close: byte-identical
- fn_07055 CMeteorEffect::Close: byte-identical
- fn_07072 CNyanggrassEffect::Close: byte-identical
- fn_07075 CNyanggrassEffect::Slot03: byte-identical
- fn_07098 CRectUpEffect::Close: byte-identical
- fn_19162 CSaintCastingEffect::Close: byte-identical
- fn_19169 CScatterEffect::Close: byte-identical
- fn_19176 CSmokeEffect::Close: byte-identical
- fn_19188 CSphereWindEffect::Close: byte-identical
- fn_19196 CSpriteEffect::Close: byte-identical
- fn_19229 CThrowItemEffect::Close: byte-identical
- fn_19241 CVolcanoEffect::Close: byte-identical
- fn_18869 CBash::Close: byte-identical
- fn_07477 CStarEmperorEffect::Close: byte-identical
- fn_07483 CStarEmperorEffect::Slot04: byte-identical
- fn_18971 CSteal::Close: byte-identical

Merged automatically: every function is byte-identical to the original.
2026-11-05 13:26:33 +00:00

174 lines
5.5 KiB
C++

#include "Contents/Effects/RectUpEffect.h"
#include "Client/Mode/CGameMode.h"
#include "Client/Mode/ModeMgr.h"
#include "Contents/Camera/Camera.h"
#include "Contents/Effects/Particle.h"
#include "Contents/Effects/EffectMemoryMgr.h"
#include "Utility/Math/AffineMatrix.h"
#include <algorithm>
#include <cstdlib>
#include <cstring>
// OFFSET: 0x00709F50
// FUNCTION: fn_07096
CRectUpEffect::CRectUpEffect() : CEffect(1088), unknown_00CC{} {
}
// OFFSET: 0x0070A410
// FUNCTION: fn_07100
void CRectUpEffect::Slot12() {
if (this->id == 1088) {
this->AddEvent(0, "effect\\EF_FireWall.wav", 0, 0);
}
}
// OFFSET: 0x0070A430
// FUNCTION: fn_07101
bool CRectUpEffect::Slot06() {
return this->ActorExists();
}
// OFFSET: 0x0070A440
// FUNCTION: fn_07102
void CRectUpEffect::Slot03() {
for (auto it = this->particles.begin(); it != this->particles.end(); ++it) {
CParticle* particle = *it;
particle->position.x = this->position[0] + particle->unknown_00D0;
particle->position.y = this->position[1] + particle->unknown_00D4;
particle->position.z = this->position[2] + particle->unknown_00D8;
int& phase = *reinterpret_cast<int*>(particle->unknown_0050);
phase += phase + 1 < 360 ? 1 : -359;
if (particle->unknown_00E8 > this->unknown_00E4) {
particle->alpha = std::max(particle->alpha - 2, 0);
}
float height = particle->unknown_00C0 * g_sinTable[phase] * 0.35f + particle->unknown_00C0 * 0.65f;
if (particle->unknown_00E8 < 90) {
height *= g_sinTable[particle->unknown_00E8];
}
particle->unknown_0054 = height;
this->Slot34(particle);
matrix rotation;
std::memcpy(rotation.values, g_identityMatrix, sizeof(rotation.values));
rotation.AppendYRotation(static_cast<CGameMode*>(g_modeMgr.GetGameMode())->camera->camera.yaw / -180.0f * 3.141592f);
++particle->unknown_00E8;
particle->transform = rotation;
}
}
// OFFSET: 0x0070A700
// FUNCTION: fn_07103
void CRectUpEffect::Slot04() {
for (auto it = this->particles.begin(); it != this->particles.end(); ++it) {
CParticle* particle = *it;
if (particle) {
const int previous = particle->unknown_000C;
const int angle = static_cast<int>(*reinterpret_cast<float*>(&particle->unknown_00C4)) % 360;
const float x = particle->scale * g_cosTable[angle];
const float z = particle->scale * g_sinTable[angle];
vector3d edge[2] = {};
edge[0].x = x;
edge[0].y = 0.0f;
edge[0].z = z;
edge[1].x = x;
edge[1].y = -particle->unknown_0054;
edge[1].z = z;
particle->vertices[1].x = edge[1].x;
particle->vertices[1].y = edge[1].y;
particle->vertices[1].z = edge[1].z;
particle->vertices[3].x = edge[0].x;
particle->vertices[3].y = edge[0].y;
particle->vertices[3].z = edge[0].z;
if (previous) {
particle->vertices[0].x = this->unknown_00CC[1].x;
particle->vertices[0].y = this->unknown_00CC[1].y;
particle->vertices[0].z = this->unknown_00CC[1].z;
particle->vertices[2].x = this->unknown_00CC[0].x;
particle->vertices[2].y = this->unknown_00CC[0].y;
particle->vertices[2].z = this->unknown_00CC[0].z;
}
this->unknown_00CC[0] = edge[0];
this->unknown_00CC[1] = edge[1];
if (previous) {
particle->Render(false, 0.0f, 1.0f, 0.0f, 1.0f, false, true);
}
}
}
}
// OFFSET: 0x0070AA30
// FUNCTION: fn_07104
void CRectUpEffect::Slot34(CParticle* particle) {
if (particle && this->id == 1088) {
particle->unknown_004C += particle->unknown_004C + 1 < 360 ? 1 : -359;
const int base = *reinterpret_cast<int*>(particle->unknown_0048);
particle->SetColor(255, 255, static_cast<short>(g_sinTable[particle->unknown_004C] * 100.0f + static_cast<float>(base)));
}
}
// OFFSET: 0x0070AAA0
// FUNCTION: fn_07105
void CRectUpEffect::Slot35(CParticle* particle) {
if (particle && this->id == 1088) {
particle->SetTexture("effect\\ring_yellow.tga");
}
}
// OFFSET: 0x0070A220
// FUNCTION: fn_07098
void CRectUpEffect::Close() {
for (auto it = this->particles.begin(); it != this->particles.end(); ++it) {
FreeParticle(*it);
}
this->particles.clear();
}
// OFFSET: 0x0070A260
// FUNCTION: fn_07099
void CRectUpEffect::Slot02() {
if (this->id != 1088) {
return;
}
this->unknown_00E4 = 1880;
for (int z = -5; z < 10; z += 5) {
for (int x = -5; x < 10; x += 5) {
int index = 0;
for (int angle = 45; angle <= 405; angle += 90, ++index) {
CParticle* particle = CreateParticle(reinterpret_cast<const vector3d*>(this->position), 5);
if (!particle) {
continue;
}
particle->unknown_00D0 = static_cast<float>(x);
particle->unknown_00D4 = 0.0f;
particle->unknown_00D8 = static_cast<float>(z);
particle->unknown_0004 = this->id;
particle->unknown_000C = index;
particle->unknown_0010 = 0;
particle->unknown_0008 = 1;
particle->unknown_0050 = std::max(rand() % 360, 0);
*reinterpret_cast<float*>(&particle->unknown_00C4) = static_cast<float>(angle);
particle->unknown_0054 = 0.0f;
if (this->id == 1088) {
particle->unknown_00C0 = 16.0f;
particle->alpha = 120;
particle->scale = 3.5f;
const int shade = std::max(rand() % 50, 0) + 100;
std::memcpy(particle->unknown_0048, &shade, sizeof(shade));
particle->unknown_004C = 0;
}
this->Slot35(particle);
InitParticleQuad(particle->vertices);
this->particles.push_back(particle);
}
}
}
}