Decompile fn_19941 (CEffectPrim::Prim3DSlotParticle)
Batch #15954 by Yommy: 0 byte-identical, 1 confirmed by peer review. - fn_19941 CEffectPrim::Prim3DSlotParticle: logic confirmed by peer review Peer-reviewed-by: eAthena, bgamez23 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
971bdb9502
commit
b95ae4d596
1 changed files with 55 additions and 53 deletions
|
|
@ -5797,10 +5797,9 @@ bool CEffectPrim::PrimSpiralFade() {
|
|||
// OFFSET: 0x00BE7C40
|
||||
// FUNCTION: fn_19941
|
||||
bool CEffectPrim::Prim3DSlotParticle() {
|
||||
EffectPrimitiveState& particle = this->state;
|
||||
|
||||
for (int index = 0; index < 4; ++index) {
|
||||
EffectPrimitiveSlot& slot = particle.slots[index];
|
||||
EffectPrimitiveSlot& slot = this->state.slots[index];
|
||||
if (slot.life == 1) {
|
||||
const float step = slot.height[0];
|
||||
slot.vecBNow.x += step * g_cosTable[slot.rotStart];
|
||||
|
|
@ -5808,94 +5807,97 @@ bool CEffectPrim::Prim3DSlotParticle() {
|
|||
}
|
||||
}
|
||||
|
||||
const vector3d& anchor = particle.master->render.position;
|
||||
particle.orgPos = {particle.deltaPos2.x + anchor.x, anchor.y + particle.deltaPos2.y, anchor.z + particle.deltaPos2.z};
|
||||
const vector3d& anchor = this->state.master->render.position;
|
||||
this->state.orgPos = {this->state.deltaPos2.x + anchor.x, anchor.y + this->state.deltaPos2.y, anchor.z + this->state.deltaPos2.z};
|
||||
|
||||
if (particle.stateCnt == particle.changePoint) {
|
||||
particle.speed3d = particle.changeSpeed3d;
|
||||
particle.deltaPosAccel = particle.changeAccel3d;
|
||||
if (this->state.stateCnt == this->state.changePoint) {
|
||||
this->state.speed3d = this->state.changeSpeed3d;
|
||||
this->state.deltaPosAccel = this->state.changeAccel3d;
|
||||
}
|
||||
|
||||
particle.speed = particle.accel + particle.speed;
|
||||
particle.sizeSpeed = particle.sizeAccel + particle.sizeSpeed;
|
||||
this->state.speed = this->state.accel + this->state.speed;
|
||||
this->state.sizeSpeed = this->state.sizeAccel + this->state.sizeSpeed;
|
||||
|
||||
if ((particle.pattern & 0x400u) != 0) {
|
||||
particle.speed3d.z = particle.deltaPosAccel.z + particle.speed3d.z;
|
||||
particle.speed3d.x = particle.deltaPosAccel.x + particle.speed3d.x;
|
||||
particle.speed3d.y = particle.deltaPosAccel.y + particle.speed3d.y;
|
||||
particle.deltaPos.z = particle.speed3d.z + particle.deltaPos.z;
|
||||
particle.deltaPos.x = particle.speed3d.x + particle.deltaPos.x;
|
||||
particle.deltaPos.y = particle.speed3d.y + particle.deltaPos.y;
|
||||
particle.roll = particle.rollSpeed + particle.roll;
|
||||
particle.size = particle.size + particle.sizeSpeed;
|
||||
} else if ((particle.pattern & 1u) != 0 || particle.stateCnt > particle.fadeInCnt) {
|
||||
Forward(particle.speed3d, particle.speed, particle.transform);
|
||||
particle.deltaPos.x = particle.speed3d.x + particle.deltaPos.x;
|
||||
particle.deltaPos.y = particle.speed3d.y + particle.deltaPos.y;
|
||||
particle.deltaPos.z = particle.speed3d.z + particle.deltaPos.z;
|
||||
particle.size = particle.sizeSpeed + particle.size;
|
||||
particle.roll = particle.rollSpeed + particle.roll;
|
||||
if ((this->state.pattern & 0x400u) != 0) {
|
||||
this->state.speed3d.z = this->state.deltaPosAccel.z + this->state.speed3d.z;
|
||||
this->state.speed3d.x = this->state.deltaPosAccel.x + this->state.speed3d.x;
|
||||
this->state.speed3d.y = this->state.deltaPosAccel.y + this->state.speed3d.y;
|
||||
this->state.deltaPos.z = this->state.speed3d.z + this->state.deltaPos.z;
|
||||
this->state.deltaPos.x = this->state.speed3d.x + this->state.deltaPos.x;
|
||||
this->state.deltaPos.y = this->state.speed3d.y + this->state.deltaPos.y;
|
||||
this->state.roll = this->state.rollSpeed + this->state.roll;
|
||||
this->state.size = this->state.size + this->state.sizeSpeed;
|
||||
} else if ((this->state.pattern & 1u) != 0 || this->state.stateCnt > this->state.fadeInCnt) {
|
||||
Forward(this->state.speed3d, this->state.speed, this->state.transform);
|
||||
this->state.deltaPos.x = this->state.speed3d.x + this->state.deltaPos.x;
|
||||
this->state.deltaPos.y = this->state.speed3d.y + this->state.deltaPos.y;
|
||||
this->state.deltaPos.z = this->state.speed3d.z + this->state.deltaPos.z;
|
||||
this->state.size = this->state.sizeSpeed + this->state.size;
|
||||
this->state.roll = this->state.rollSpeed + this->state.roll;
|
||||
}
|
||||
|
||||
auto& rotation = *reinterpret_cast<struct matrix*>(particle.transform);
|
||||
auto& rotation = *reinterpret_cast<struct matrix*>(this->state.transform);
|
||||
|
||||
if ((particle.pattern & 2u) != 0) {
|
||||
if (particle.stateCnt % static_cast<int>(particle.chCnt) == 0) {
|
||||
if ((this->state.pattern & 2u) != 0) {
|
||||
if (this->state.stateCnt % static_cast<int>(this->state.chCnt) == 0) {
|
||||
const int delay = std::rand() % 8;
|
||||
particle.chCnt = static_cast<std::uint32_t>((delay >= 0 ? delay : 0) + 12);
|
||||
this->state.chCnt = static_cast<std::uint32_t>((delay >= 0 ? delay : 0) + 12);
|
||||
const int driftX = std::rand() % 5;
|
||||
particle.deltaPos3.x = static_cast<float>((driftX >= 0 ? driftX : 0) + 5) / 100.0f;
|
||||
this->state.deltaPos3.x = static_cast<float>((driftX >= 0 ? driftX : 0) + 5) / 100.0f;
|
||||
const int driftZ = std::rand() % 5;
|
||||
particle.deltaPos3.z = static_cast<float>((driftZ >= 0 ? driftZ : 0) + 5) / 100.0f;
|
||||
this->state.deltaPos3.z = static_cast<float>((driftZ >= 0 ? driftZ : 0) + 5) / 100.0f;
|
||||
const int flipX = std::rand() % 2;
|
||||
if ((flipX >= 0 ? flipX : 0) == 0) {
|
||||
particle.deltaPos3.x *= -1.0f;
|
||||
this->state.deltaPos3.x *= -1.0f;
|
||||
}
|
||||
const int flipZ = std::rand() % 2;
|
||||
if ((flipZ >= 0 ? flipZ : 0) == 0) {
|
||||
particle.deltaPos3.z *= -1.0f;
|
||||
this->state.deltaPos3.z *= -1.0f;
|
||||
}
|
||||
}
|
||||
particle.deltaPos.x = particle.deltaPos3.x + particle.deltaPos.x;
|
||||
this->state.deltaPos.x = this->state.deltaPos3.x + this->state.deltaPos.x;
|
||||
}
|
||||
|
||||
if ((particle.pattern & 4u) != 0 && particle.stateCnt % static_cast<int>(particle.chCnt) == 0) {
|
||||
if ((this->state.pattern & 4u) != 0 && this->state.stateCnt % static_cast<int>(this->state.chCnt) == 0) {
|
||||
const int burst = std::rand() % 35;
|
||||
particle.speed = static_cast<float>((burst >= 0 ? burst : 0) + 15) / 100.0f;
|
||||
this->state.speed = static_cast<float>((burst >= 0 ? burst : 0) + 15) / 100.0f;
|
||||
const int yaw = std::rand() % 80;
|
||||
particle.longitude = static_cast<float>(yaw >= 0 ? yaw : 0) + (particle.longitude - 40.0f);
|
||||
this->state.longitude = static_cast<float>(yaw >= 0 ? yaw : 0) + (this->state.longitude - 40.0f);
|
||||
const int pitch = std::rand() % 80;
|
||||
particle.latitude = static_cast<float>(pitch >= 0 ? pitch : 0) + (particle.latitude - 40.0f);
|
||||
rotation.MakeYRotation(GetRadian(static_cast<int>(particle.longitude)));
|
||||
rotation.AppendXRotation(GetRadian(static_cast<int>(particle.latitude)));
|
||||
this->state.latitude = static_cast<float>(pitch >= 0 ? pitch : 0) + (this->state.latitude - 40.0f);
|
||||
rotation.MakeYRotation(GetRadian(static_cast<int>(this->state.longitude)));
|
||||
rotation.AppendXRotation(GetRadian(static_cast<int>(this->state.latitude)));
|
||||
const int delay = std::rand() % 10;
|
||||
particle.chCnt = static_cast<std::uint32_t>((delay >= 0 ? delay : 0) + 5);
|
||||
this->state.chCnt = static_cast<std::uint32_t>((delay >= 0 ? delay : 0) + 5);
|
||||
}
|
||||
|
||||
if ((particle.pattern & 8u) != 0 && particle.stateCnt % static_cast<int>(particle.chCnt) == 0) {
|
||||
if ((this->state.pattern & 8u) != 0 && this->state.stateCnt % static_cast<int>(this->state.chCnt) == 0) {
|
||||
const int yaw = std::rand() % 10;
|
||||
particle.longitude = static_cast<float>(yaw >= 0 ? yaw : 0) + (particle.longitude - 5.0f);
|
||||
this->state.longitude = static_cast<float>(yaw >= 0 ? yaw : 0) + (this->state.longitude - 5.0f);
|
||||
const int pitch = std::rand() % 10;
|
||||
particle.latitude = static_cast<float>(pitch >= 0 ? pitch : 0) + (particle.latitude - 5.0f);
|
||||
rotation.MakeXRotation(GetRadian(static_cast<int>(particle.latitude)));
|
||||
rotation.AppendYRotation(GetRadian(static_cast<int>(particle.longitude)));
|
||||
this->state.latitude = static_cast<float>(pitch >= 0 ? pitch : 0) + (this->state.latitude - 5.0f);
|
||||
rotation.MakeXRotation(GetRadian(static_cast<int>(this->state.latitude)));
|
||||
rotation.AppendYRotation(GetRadian(static_cast<int>(this->state.longitude)));
|
||||
const int delay = std::rand() % 15;
|
||||
particle.chCnt = static_cast<std::uint32_t>((delay >= 0 ? delay : 0) + 5);
|
||||
this->state.chCnt = static_cast<std::uint32_t>((delay >= 0 ? delay : 0) + 5);
|
||||
}
|
||||
|
||||
this->render.position = {particle.orgPos.x + particle.deltaPos.x, particle.orgPos.y + particle.deltaPos.y, particle.orgPos.z + particle.deltaPos.z};
|
||||
this->render.position = {this->state.orgPos.x + this->state.deltaPos.x, this->state.orgPos.y + this->state.deltaPos.y, this->state.orgPos.z + this->state.deltaPos.z};
|
||||
|
||||
if ((particle.pattern & 0x100u) != 0 && 3.0f >= this->CalcDist(particle.master->state.deltaPos[0], particle.master->state.deltaPos[2])) {
|
||||
if ((this->state.pattern & 0x100u) != 0 && 3.0f >= this->CalcDist(this->state.master->state.deltaPos[0], this->state.master->state.deltaPos[2])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((particle.pattern & 0x20u) != 0) {
|
||||
particle.roll = this->render.angle - static_cast<CGameMode*>(g_modeMgr.GetGameMode())->camera->camera.yaw;
|
||||
if ((this->state.pattern & 0x20u) != 0) {
|
||||
this->state.roll = this->render.angle - static_cast<CGameMode*>(g_modeMgr.GetGameMode())->camera->camera.yaw;
|
||||
}
|
||||
|
||||
particle.ProcessAlpha();
|
||||
this->state.ProcessAlpha();
|
||||
this->ShiftSegment();
|
||||
return this->AnimMotion();
|
||||
if (!this->AnimMotion()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// OFFSET: 0x00BBC080
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue