Decompile 2 functions in Source/Contents/Effects/WindEffect.cpp, Source/Contents/Effects/WindEffect.h, ...
Batch #3827 by sherollyner: 0 byte-identical, 2 confirmed by peer review. - fn_07537 CWindEffect::CWindEffect: logic confirmed by peer review - fn_07544 CWindEffect::Slot03: logic confirmed by peer review Peer-reviewed-by: Yommy, youko Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
This commit is contained in:
parent
bd00a86fc9
commit
ee27db4348
3 changed files with 123 additions and 2 deletions
|
|
@ -1,6 +1,23 @@
|
|||
#include "Contents/Effects/WindEffect.h"
|
||||
|
||||
#include "Contents/Effects/Particle.h"
|
||||
#include "Utility/Math/AffineMatrix.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
// INLINED
|
||||
static vector3d TransformPoint(const matrix& transform, const vector3d& point) {
|
||||
vector3d result;
|
||||
result.x = point.y * transform.values[3] + point.x * transform.values[0] + point.z * transform.values[6] + transform.values[9];
|
||||
result.y = point.y * transform.values[4] + point.x * transform.values[1] + point.z * transform.values[7] + transform.values[10];
|
||||
result.z = point.y * transform.values[5] + point.x * transform.values[2] + point.z * transform.values[8] + transform.values[11];
|
||||
return result;
|
||||
}
|
||||
|
||||
// OFFSET: 0x00730210
|
||||
// FUNCTION: fn_07537
|
||||
CWindEffect::CWindEffect() : CEffect(2343) {
|
||||
}
|
||||
|
||||
// OFFSET: 0x00730870
|
||||
// FUNCTION: fn_07543
|
||||
|
|
@ -8,6 +25,83 @@ bool CWindEffect::Slot06() {
|
|||
return this->ActorExists();
|
||||
}
|
||||
|
||||
// OFFSET: 0x00730880
|
||||
// FUNCTION: fn_07544
|
||||
void CWindEffect::Slot03() {
|
||||
for (std::vector<CParticle*>::iterator it = this->particles.begin(); it != this->particles.end(); ++it) {
|
||||
CParticle* particle = *it;
|
||||
if (particle == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (particle->unknown_00A8) {
|
||||
case 0: {
|
||||
int alpha = particle->alpha + 1;
|
||||
if (alpha >= this->maxAlpha) {
|
||||
alpha = this->maxAlpha;
|
||||
particle->unknown_00A8 = 1;
|
||||
}
|
||||
particle->alpha = alpha;
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
int alpha = particle->alpha - 1;
|
||||
if (alpha <= 0) {
|
||||
alpha = 0;
|
||||
particle->unknown_00A8 = 0;
|
||||
}
|
||||
particle->alpha = alpha;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
float& angle = *reinterpret_cast<float*>(&particle->unknown_00C4);
|
||||
float nextAngle = particle->unknown_00C0 + angle;
|
||||
if (nextAngle > 360.0f) {
|
||||
nextAngle -= 360.0f;
|
||||
}
|
||||
angle = nextAngle;
|
||||
|
||||
const float cosine = static_cast<float>(std::cos(static_cast<double>(angle / 180.0f * 3.141592f)));
|
||||
const float sine = static_cast<float>(std::sin(static_cast<double>(angle / 180.0f * 3.141592f)));
|
||||
|
||||
vector3d points[4] = {};
|
||||
const float scale = particle->scale;
|
||||
points[0].x += scale * cosine;
|
||||
points[0].y = scale * 0.0f - particle->unknown_0054;
|
||||
points[0].z += scale * sine;
|
||||
points[1].x = (cosine + 0.0f) * this->width + points[0].x;
|
||||
points[1].y = this->width + points[0].y;
|
||||
points[1].z = (sine + 0.0f) * this->width + points[0].z;
|
||||
|
||||
matrix transform;
|
||||
transform.MakeXRotation(this->rotation.x / 180.0f * 3.141592f);
|
||||
transform.AppendZRotation(this->rotation.z / 180.0f * 3.141592f);
|
||||
transform.AppendTranslate(this->position);
|
||||
|
||||
const vector3d bottom = TransformPoint(transform, points[0]);
|
||||
const vector3d top = TransformPoint(transform, points[1]);
|
||||
particle->vertices[1].x = top.x;
|
||||
particle->vertices[1].y = top.y;
|
||||
particle->vertices[1].z = top.z;
|
||||
particle->vertices[3].x = bottom.x;
|
||||
particle->vertices[3].y = bottom.y;
|
||||
particle->vertices[3].z = bottom.z;
|
||||
|
||||
if (particle->unknown_000C != 0) {
|
||||
particle->vertices[0].x = this->lastTop.x;
|
||||
particle->vertices[0].y = this->lastTop.y;
|
||||
particle->vertices[0].z = this->lastTop.z;
|
||||
particle->vertices[2].x = this->lastBottom.x;
|
||||
particle->vertices[2].y = this->lastBottom.y;
|
||||
particle->vertices[2].z = this->lastBottom.z;
|
||||
}
|
||||
|
||||
this->lastBottom = bottom;
|
||||
this->lastTop = top;
|
||||
}
|
||||
}
|
||||
|
||||
// OFFSET: 0x00731030
|
||||
// FUNCTION: fn_07545
|
||||
void CWindEffect::Slot04() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue