Decompile 4 functions in Source/Contents/Actors/RenderObjectState.h, Source/Contents/Actors/RenderObjectState.cpp, ...

Batch #1949 by ragnarok-clanker: 1 byte-identical, 3 confirmed by peer review.

- fn_21086 RenderObjectState::Reset: logic confirmed by peer review
- fn_19865 DrawEffectPrimitive15: logic confirmed by peer review
- fn_19762 EffectPrimitiveSlot::EffectPrimitiveSlot: byte-identical (already on main)
- fn_20088 UpdatePartyEffect: logic confirmed by peer review

Peer-reviewed-by: Yommy
Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
This commit is contained in:
ragnarok-clanker 2026-10-29 00:03:44 +00:00
commit 97cf23ebda
11 changed files with 175 additions and 171 deletions

View file

@ -27,8 +27,8 @@ float __stdcall CRenderObject::Heading(float x, float z, float targetX, float ta
// OFFSET: 0x00CA9610
// FUNCTION: fn_21008
void CRenderObject::Face(float x, float z) {
const float deltaX = x - this->render.position[0];
const float deltaZ = z - this->render.position[2];
const float deltaX = x - this->render.position.x;
const float deltaZ = z - this->render.position.z;
if (deltaX != 0.0f || deltaZ != 0.0f) {
float angle = (static_cast<float>(std::atan2(static_cast<double>(deltaX), static_cast<double>(-deltaZ))) / 3.141592f) * 180.0f;
this->render.angle = angle;
@ -46,17 +46,17 @@ void CRenderObject::Face(float x, float z) {
// OFFSET: 0x00CA96C0
// FUNCTION: fn_21009
float CRenderObject::HorizontalDistance(float x, float z) const {
const float deltaX = x - this->render.position[0];
const float deltaZ = z - this->render.position[2];
const float deltaX = x - this->render.position.x;
const float deltaZ = z - this->render.position.z;
return SquareRoot(deltaZ * deltaZ + deltaX * deltaX);
}
// OFFSET: 0x00CA9700
// FUNCTION: fn_21010
float CRenderObject::Distance(float x, float y, float z) const {
const float deltaX = x - this->render.position[0];
const float deltaZ = z - this->render.position[2];
const float deltaY = y - this->render.position[1];
const float deltaX = x - this->render.position.x;
const float deltaZ = z - this->render.position.z;
const float deltaY = y - this->render.position.y;
const float horizontal = SquareRoot(deltaZ * deltaZ + deltaX * deltaX);
return SquareRoot(horizontal * horizontal + deltaY * deltaY);
}
@ -68,19 +68,19 @@ bool CRenderObject::GetTargetPos(std::uint32_t targetAid, vector3d& targetPos) c
const CRenderObject* player = reinterpret_cast<const CRenderObject*>(world->player);
if (targetAid == g_session.m_aid) {
targetPos = {player->render.position[0], player->render.position[1], player->render.position[2]};
targetPos = {player->render.position.x, player->render.position.y, player->render.position.z};
return true;
}
if (const CRenderObject* actor = world->GetGameActorByAID(targetAid)) {
targetPos = {actor->render.position[0], actor->render.position[1], actor->render.position[2]};
targetPos = {actor->render.position.x, actor->render.position.y, actor->render.position.z};
return true;
}
const float* position = this->render.position;
const vector3d& position = this->render.position;
targetPos = {
position[0] - (player->render.position[0] - position[0]), position[1] - (player->render.position[1] - position[1]),
position[2] - (player->render.position[2] - position[2])
position.x - (player->render.position.x - position.x), position.y - (player->render.position.y - position.y),
position.z - (player->render.position.z - position.z)
};
return false;
}

View file

@ -27,9 +27,9 @@ RenderObjectState::~RenderObjectState() {
// OFFSET: 0x00CAF990
// FUNCTION: fn_21086
void RenderObjectState::Reset(ResourceMgr& resources, JobNames& names) {
this->position[0] = 0;
this->position[1] = 0;
this->position[2] = 0;
this->position.x = 0;
this->position.y = 0;
this->position.z = 0;
this->animation = 0;
this->previousAnimation = 0;
this->unknown_0040 = 0;

View file

@ -2,6 +2,7 @@
#define RAGNAROK_SOURCE_CONTENTS_ACTORS_RENDEROBJECTSTATE_H
#include "Contents/InstantVar.h"
#include "Utility/Math/Vector3d.h"
#include <cstddef>
#include <cstdint>
@ -19,7 +20,7 @@ struct RenderObjectState {
RenderObjectState(const RenderObjectState&) = delete;
RenderObjectState& operator=(const RenderObjectState&) = delete;
/* 0010 */ float position[3];
/* 0010 */ vector3d position;
/* 001C */ std::string name;
/* 0034 */ int animation;
/* 0038 */ int previousAnimation;

View file

@ -85,8 +85,8 @@ namespace {
// FUNCTION: fn_19785
bool MoveEffectPrimitive(EffectPrimitiveState& particle, RenderObjectState& render, EffectMotionContext& context) {
particle.origin = {
context.parentRender.position[0] + particle.velocity.x, context.parentRender.position[1] + particle.velocity.y,
context.parentRender.position[2] + particle.velocity.z
context.parentRender.position.x + particle.velocity.x, context.parentRender.position.y + particle.velocity.y,
context.parentRender.position.z + particle.velocity.z
};
if (particle.unknown_0200 == particle.unknown_01E0) {
@ -166,8 +166,8 @@ bool MoveEffectPrimitive(EffectPrimitiveState& particle, RenderObjectState& rend
}
if ((particle.flags & 0x400u) != 0) {
const float x = particle.master->state.offset[0] - render.position[0];
const float z = particle.master->state.offset[2] - render.position[2];
const float x = particle.master->state.offset[0] - render.position.x;
const float z = particle.master->state.offset[2] - render.position.z;
const float distance = std::sqrt(z * z + x * x);
if (3.0f >= distance) {
@ -178,9 +178,9 @@ bool MoveEffectPrimitive(EffectPrimitiveState& particle, RenderObjectState& rend
particle.unknown_030C = render.angle;
}
render.position[0] = particle.origin.x + particle.offset.x;
render.position[1] = particle.offset.y + particle.origin.y;
render.position[2] = particle.offset.z + particle.origin.z;
render.position.x = particle.origin.x + particle.offset.x;
render.position.y = particle.offset.y + particle.origin.y;
render.position.z = particle.offset.z + particle.origin.z;
particle.unknown_0354 = particle.unknown_0358 + particle.unknown_0354;
particle.unknown_0360 = particle.unknown_0364 + particle.unknown_0360;
particle.unknown_030C = particle.unknown_030C + particle.unknown_0330;
@ -223,7 +223,7 @@ bool MoveEffectPrimitive(EffectPrimitiveState& particle, RenderObjectState& rend
particle.master->state.offset[2] = particle.offset.z + particle.velocity.z;
}
if ((particle.flags & 4u) != 0 && render.position[1] > context.ground.Height(render.position[0], render.position[2])) {
if ((particle.flags & 4u) != 0 && render.position.y > context.ground.Height(render.position.x, render.position.z)) {
particle.flags &= ~4u;
particle.unknown_01E0 = particle.lifetime - 25;
particle.unknown_02BC = 0;
@ -303,9 +303,10 @@ bool UpdateEffectPrimitive15(EffectPrimitiveState& particle, RenderObjectState&
// OFFSET: 0x00BB6180
// FUNCTION: fn_19773
bool ShrinkEffectPrimitiveSlots(EffectPrimitiveState& particle, RenderObjectState& render, EffectMotionContext& context) {
render.position[0] = context.parentRender.position[0];
render.position[1] = context.parentRender.position[1];
render.position[2] = context.parentRender.position[2];
const vector3d& parent = context.parentRender.position;
render.position.x = parent.x;
render.position.y = parent.y;
render.position.z = parent.z;
for (int index = 0; index < 4; ++index) {
EffectPrimitiveSlot& slot = particle.slots[index];
@ -354,9 +355,10 @@ bool ShrinkEffectPrimitiveSlots(EffectPrimitiveState& particle, RenderObjectStat
// OFFSET: 0x00BB62A0
// FUNCTION: fn_19774
bool PulseEffectPrimitiveSlots(EffectPrimitiveState& particle, RenderObjectState& render, EffectMotionContext& context) {
render.position[0] = context.parentRender.position[0];
render.position[1] = context.parentRender.position[1];
render.position[2] = context.parentRender.position[2];
const vector3d& parent = context.parentRender.position;
render.position.x = parent.x;
render.position.y = parent.y;
render.position.z = parent.z;
for (int index = 0; index < 4; ++index) {
EffectPrimitiveSlot& slot = particle.slots[index];
@ -414,8 +416,8 @@ bool PulseEffectPrimitiveSlots(EffectPrimitiveState& particle, RenderObjectState
// FUNCTION: fn_19777
bool SpinEffectPrimitive(EffectPrimitiveState& particle, RenderObjectState& render, EffectMotionContext& context) {
particle.origin = {
context.parentRender.position[0] + particle.velocity.x, context.parentRender.position[1] + particle.velocity.y,
context.parentRender.position[2] + particle.velocity.z
context.parentRender.position.x + particle.velocity.x, context.parentRender.position.y + particle.velocity.y,
context.parentRender.position.z + particle.velocity.z
};
particle.unknown_02BC = particle.unknown_02C0 + particle.unknown_02BC;
@ -437,9 +439,9 @@ bool SpinEffectPrimitive(EffectPrimitiveState& particle, RenderObjectState& rend
particle.offset.z = particle.unknown_0370.z + particle.offset.z;
particle.unknown_030C = particle.unknown_0330 + particle.unknown_030C;
particle.unknown_02F4 += particle.unknown_02FC;
render.position[0] = particle.offset.x + particle.origin.x;
render.position[1] = particle.offset.y + particle.origin.y;
render.position[2] = particle.offset.z + particle.origin.z;
render.position.x = particle.offset.x + particle.origin.x;
render.position.y = particle.offset.y + particle.origin.y;
render.position.z = particle.offset.z + particle.origin.z;
particle.unknown_02F8 += particle.unknown_0300;
particle.unknown_0360 = particle.unknown_0364 + particle.unknown_0360;
@ -471,8 +473,8 @@ bool SpinEffectPrimitive(EffectPrimitiveState& particle, RenderObjectState& rend
// FUNCTION: fn_19778
bool RollEffectPrimitive(EffectPrimitiveState& particle, RenderObjectState& render, EffectMotionContext& context) {
particle.origin = {
context.parentRender.position[0] + particle.velocity.x, context.parentRender.position[1] + particle.velocity.y,
context.parentRender.position[2] + particle.velocity.z
context.parentRender.position.x + particle.velocity.x, context.parentRender.position.y + particle.velocity.y,
context.parentRender.position.z + particle.velocity.z
};
particle.unknown_02BC = particle.unknown_02C0 + particle.unknown_02BC;
@ -488,9 +490,9 @@ bool RollEffectPrimitive(EffectPrimitiveState& particle, RenderObjectState& rend
particle.offset.x = particle.unknown_0370.x + particle.offset.x;
particle.offset.y = particle.unknown_0370.y + particle.offset.y;
particle.offset.z = particle.unknown_0370.z + particle.offset.z;
render.position[0] = particle.offset.x + particle.origin.x;
render.position[1] = particle.offset.y + particle.origin.y;
render.position[2] = particle.offset.z + particle.origin.z;
render.position.x = particle.offset.x + particle.origin.x;
render.position.y = particle.offset.y + particle.origin.y;
render.position.z = particle.offset.z + particle.origin.z;
particle.unknown_030C = particle.unknown_0330 + particle.unknown_030C;
particle.unknown_02F8 = particle.unknown_0300 + particle.unknown_02F8;
particle.unknown_02F4 = particle.unknown_02FC + particle.unknown_02F4;
@ -524,8 +526,8 @@ bool RollEffectPrimitive(EffectPrimitiveState& particle, RenderObjectState& rend
// FUNCTION: fn_19784
void AdvanceEffectPrimitive(EffectPrimitiveState& particle, RenderObjectState& render, EffectMotionContext& context) {
particle.origin = {
context.parentRender.position[0] + particle.velocity.x, context.parentRender.position[1] + particle.velocity.y,
context.parentRender.position[2] + particle.velocity.z
context.parentRender.position.x + particle.velocity.x, context.parentRender.position.y + particle.velocity.y,
context.parentRender.position.z + particle.velocity.z
};
if (particle.unknown_01E0 == particle.unknown_0200) {
@ -538,9 +540,9 @@ void AdvanceEffectPrimitive(EffectPrimitiveState& particle, RenderObjectState& r
particle.offset.x = particle.unknown_0370.x + particle.offset.x;
particle.offset.y = particle.unknown_0370.y + particle.offset.y;
particle.offset.z = particle.unknown_0370.z + particle.offset.z;
render.position[0] = particle.offset.x + particle.origin.x;
render.position[1] = particle.offset.y + particle.origin.y;
render.position[2] = particle.offset.z + particle.origin.z;
render.position.x = particle.offset.x + particle.origin.x;
render.position.y = particle.offset.y + particle.origin.y;
render.position.z = particle.offset.z + particle.origin.z;
if ((particle.flags & 1u) != 0 && particle.unknown_01E0 == static_cast<int>(particle.unknown_01D4)) {
particle.unknown_02C0 = 0;
@ -590,9 +592,9 @@ bool EffectParticle::AdvanceFrame() {
// FUNCTION: fn_19772
bool EffectParticle::UpdateFireWall() {
const AttachedEffect* master = this->state.master;
this->render.position[0] = master->render.position[0];
this->render.position[1] = master->render.position[1];
this->render.position[2] = master->render.position[2];
this->render.position.x = master->render.position.x;
this->render.position.y = master->render.position.y;
this->render.position.z = master->render.position.z;
for (int index = 0; index < 4; ++index) {
if (this->state.scale == 3.0f && index < 3) {
@ -713,9 +715,9 @@ bool EffectParticle::UpdateFireWall() {
// FUNCTION: fn_19775
bool EffectParticle::UpdateStoneCurse() {
const AttachedEffect* master = this->state.master;
this->render.position[0] = master->render.position[0];
this->render.position[1] = master->render.position[1];
this->render.position[2] = master->render.position[2];
this->render.position.x = master->render.position.x;
this->render.position.y = master->render.position.y;
this->render.position.z = master->render.position.z;
for (int index = 0; index < 4; ++index) {
if (this->state.scale == 3.0f && index < 3) {
@ -789,9 +791,9 @@ bool EffectParticle::UpdateStoneCurse() {
// FUNCTION: fn_19776
void EffectParticle::UpdateBeginSpell() {
const AttachedEffect* master = this->state.master;
this->state.origin.x = master->render.position[0] + this->state.velocity.x;
this->state.origin.y = master->render.position[1] + this->state.velocity.y;
this->state.origin.z = master->render.position[2] + this->state.velocity.z;
this->state.origin.x = master->render.position.x + this->state.velocity.x;
this->state.origin.y = master->render.position.y + this->state.velocity.y;
this->state.origin.z = master->render.position.z + this->state.velocity.z;
float base;
@ -827,9 +829,9 @@ void EffectParticle::UpdateBeginSpell() {
this->state.offset.x = offsetX;
this->state.offset.y = offsetY;
this->state.offset.z = offsetZ;
this->render.position[0] = offsetX + this->state.origin.x;
this->render.position[1] = offsetY + this->state.origin.y;
this->render.position[2] = offsetZ + this->state.origin.z;
this->render.position.x = offsetX + this->state.origin.x;
this->render.position.y = offsetY + this->state.origin.y;
this->render.position.z = offsetZ + this->state.origin.z;
float scale = this->state.unknown_02F4;
@ -846,9 +848,9 @@ void EffectParticle::UpdateBeginSpell() {
// FUNCTION: fn_19790
void EffectParticle::PrimBottom2() {
const AttachedEffect* master = this->state.master;
this->render.position[0] = master->render.position[0];
this->render.position[1] = master->render.position[1];
this->render.position[2] = master->render.position[2];
this->render.position.x = master->render.position.x;
this->render.position.y = master->render.position.y;
this->render.position.z = master->render.position.z;
for (int index = 0; index < 4; ++index) {
EffectPrimitiveSlot& slot = this->state.slots[index];
@ -880,9 +882,9 @@ void EffectParticle::PrimBottom() {
FaceCamera(slots);
const AttachedEffect* master = this->state.master;
this->render.position[0] = master->render.position[0];
this->render.position[1] = master->render.position[1];
this->render.position[2] = master->render.position[2];
this->render.position.x = master->render.position.x;
this->render.position.y = master->render.position.y;
this->render.position.z = master->render.position.z;
EffectPrimitiveSlot& slot = slots[0];
@ -928,9 +930,9 @@ void EffectParticle::PrimBottom() {
slot.rotStart -= 360;
}
slot.vecBNow.x = this->render.position[0];
slot.vecBNow.z = this->render.position[2];
slot.vecBPre.y = this->render.position[1] - 6.0f;
slot.vecBNow.x = this->render.position.x;
slot.vecBNow.z = this->render.position.z;
slot.vecBPre.y = this->render.position.y - 6.0f;
slot.vecBNow.y = slot.vecBPre.y + 3.0f * g_sinTable[slot.rotStart];
if (slot.flag1[2] == 7) {
@ -948,9 +950,9 @@ void EffectParticle::PrimBottomOut() {
FaceCamera(this->state.slots);
const AttachedEffect* master = this->state.master;
this->render.position[0] = master->render.position[0];
this->render.position[1] = master->render.position[1];
this->render.position[2] = master->render.position[2];
this->render.position.x = master->render.position.x;
this->render.position.y = master->render.position.y;
this->render.position.z = master->render.position.z;
for (int index = 0; index < 4; ++index) {
EffectPrimitiveSlot& slot = this->state.slots[index];
@ -969,7 +971,7 @@ void EffectParticle::PrimBottomOut() {
if (slot.alphaB <= 0) {
slot.alphaB = 0;
slot.process = 0;
slot.vecBNow.y = slot.flag1[1] == 0 ? this->render.position[1] : this->render.position[1] - 5.0f;
slot.vecBNow.y = slot.flag1[1] == 0 ? this->render.position.y : this->render.position.y - 5.0f;
}
slot.vecBNow.y -= 0.2f;
@ -998,9 +1000,9 @@ void EffectParticle::PrimBubbleDrop() {
FaceCamera(slots);
const AttachedEffect* master = this->state.master;
this->render.position[0] = master->render.position[0];
this->render.position[1] = master->render.position[1];
this->render.position[2] = master->render.position[2];
this->render.position.x = master->render.position.x;
this->render.position.y = master->render.position.y;
this->render.position.z = master->render.position.z;
EffectPrimitiveSlot& slot = slots[0];
@ -1039,7 +1041,7 @@ void EffectParticle::PrimBubbleDrop() {
slot.vecBPre.y += slot.height[1];
slot.vecBNow = {
this->render.position[0] + slot.vecBPre.x, this->render.position[1] + slot.vecBPre.y, this->render.position[2] + slot.vecBPre.z
this->render.position.x + slot.vecBPre.x, this->render.position.y + slot.vecBPre.y, this->render.position.z + slot.vecBPre.z
};
} else {
slot.alphaB -= 10;
@ -1056,9 +1058,9 @@ void EffectParticle::PrimChemical2() {
FaceCamera(this->state.slots);
const AttachedEffect* master = this->state.master;
this->render.position[0] = master->render.position[0];
this->render.position[1] = master->render.position[1];
this->render.position[2] = master->render.position[2];
this->render.position.x = master->render.position.x;
this->render.position.y = master->render.position.y;
this->render.position.z = master->render.position.z;
for (int index = 0; index < 4; ++index) {
EffectPrimitiveSlot& slot = this->state.slots[index];
@ -1193,9 +1195,9 @@ void EffectParticle::PrimEffectTexture_Ani() {
FaceCamera(this->state.slots);
const AttachedEffect* master = this->state.master;
this->render.position[0] = master->render.position[0];
this->render.position[1] = master->render.position[1];
this->render.position[2] = master->render.position[2];
this->render.position.x = master->render.position.x;
this->render.position.y = master->render.position.y;
this->render.position.z = master->render.position.z;
EffectPrimitiveSlot& slot = this->state.slots[0];
@ -1224,8 +1226,8 @@ void EffectParticle::PrimEffectTexture_Ani() {
}
slot.vecBNow.y = slot.vecBPre.y;
slot.vecBNow.x = this->render.position[0];
slot.vecBNow.z = this->render.position[2];
slot.vecBNow.x = this->render.position.x;
slot.vecBNow.z = this->render.position.z;
}
// OFFSET: 0x00BBD480
@ -1234,9 +1236,9 @@ void EffectParticle::PrimFirstAid() {
FaceCamera(this->state.slots);
const AttachedEffect* master = this->state.master;
this->render.position[0] = master->render.position[0];
this->render.position[1] = master->render.position[1];
this->render.position[2] = master->render.position[2];
this->render.position.x = master->render.position.x;
this->render.position.y = master->render.position.y;
this->render.position.z = master->render.position.z;
EffectPrimitiveSlot& slot = this->state.slots[0];
@ -1322,9 +1324,9 @@ void EffectParticle::PrimPoison() {
FaceCamera(this->state.slots);
const AttachedEffect* master = this->state.master;
this->render.position[0] = master->render.position[0];
this->render.position[1] = master->render.position[1];
this->render.position[2] = master->render.position[2];
this->render.position.x = master->render.position.x;
this->render.position.y = master->render.position.y;
this->render.position.z = master->render.position.z;
for (int index = 0; index < 4; ++index) {
EffectPrimitiveSlot& slot = this->state.slots[index];
@ -1359,9 +1361,9 @@ void EffectParticle::PrimPoison() {
// FUNCTION: fn_19813
void EffectParticle::PrimGuard() {
const AttachedEffect* master = this->state.master;
this->render.position[0] = master->render.position[0];
this->render.position[1] = master->render.position[1];
this->render.position[2] = master->render.position[2];
this->render.position.x = master->render.position.x;
this->render.position.y = master->render.position.y;
this->render.position.z = master->render.position.z;
for (int index = 0; index < 4; ++index) {
EffectPrimitiveSlot& slot = this->state.slots[index];
@ -1407,14 +1409,14 @@ bool EffectParticle::PrimLineLink() {
const CRenderObject* target = nullptr;
const AttachedEffect* master = this->state.master;
this->render.position[0] = master->render.position[0];
this->render.position[1] = master->render.position[1];
this->render.position[2] = master->render.position[2];
this->render.position.x = master->render.position.x;
this->render.position.y = master->render.position.y;
this->render.position.z = master->render.position.z;
EffectPrimitiveSlot& slot = this->state.slots[0];
++slot.process;
slot.vecTNow = {this->render.position[0], this->render.position[1], this->render.position[2]};
slot.vecTNow = {this->render.position.x, this->render.position.y, this->render.position.z};
slot.vecTNow.y -= 8.0f;
if (slot.height[4] == 2.0f) {
@ -1453,7 +1455,7 @@ bool EffectParticle::PrimLineLink() {
slot.life = 0;
slot.alphaB = 0;
} else {
slot.vecTPre = {target->render.position[0], target->render.position[1], target->render.position[2]};
slot.vecTPre = {target->render.position.x, target->render.position.y, target->render.position.z};
slot.vecTPre.y -= 8.0f;
}
@ -1477,8 +1479,8 @@ void EffectParticle::PrimSMA() {
}
if (slot.process == 1) {
const float x = this->state.offset.x - this->render.position[0];
const float z = this->state.offset.z - this->render.position[2];
const float x = this->state.offset.x - this->render.position.x;
const float z = this->state.offset.z - this->render.position.z;
CalculateVectorAngle(x, z, &slot.rotStart);
}
@ -1494,9 +1496,9 @@ void EffectParticle::PrimShieldBoomerang3() {
FaceCamera(slots);
const AttachedEffect* master = this->state.master;
this->render.position[0] = master->render.position[0];
this->render.position[1] = master->render.position[1];
this->render.position[2] = master->render.position[2];
this->render.position.x = master->render.position.x;
this->render.position.y = master->render.position.y;
this->render.position.z = master->render.position.z;
EffectPrimitiveSlot& slot = slots[0];
@ -1556,9 +1558,9 @@ void EffectParticle::PrimShieldBoomerang3() {
// FUNCTION: fn_19840
bool EffectParticle::PrimSuperAngel() {
const AttachedEffect* master = this->state.master;
this->render.position[0] = master->render.position[0];
this->render.position[1] = master->render.position[1];
this->render.position[2] = master->render.position[2];
this->render.position.x = master->render.position.x;
this->render.position.y = master->render.position.y;
this->render.position.z = master->render.position.z;
EffectPrimitiveSlot& slot = this->state.slots[0];
@ -1694,9 +1696,9 @@ bool EffectParticle::PrimSuperAngel() {
}
}
this->render.position[0] = this->state.offset.x;
this->render.position[1] = this->state.offset.y;
this->render.position[2] = this->state.offset.z;
this->render.position.x = this->state.offset.x;
this->render.position.y = this->state.offset.y;
this->render.position.z = this->state.offset.z;
this->UpdateRecords();
return true;
}
@ -1708,9 +1710,9 @@ void EffectParticle::PrimThrowItem() {
FaceCamera(slots);
const AttachedEffect* master = this->state.master;
this->render.position[0] = master->render.position[0];
this->render.position[1] = master->render.position[1];
this->render.position[2] = master->render.position[2];
this->render.position.x = master->render.position.x;
this->render.position.y = master->render.position.y;
this->render.position.z = master->render.position.z;
EffectPrimitiveSlot& slot = slots[0];
@ -1884,9 +1886,9 @@ void EffectParticle::PrimWaterFall() {
// FUNCTION: fn_19779
bool EffectParticle::UpdateHit6() {
const AttachedEffect* master = this->state.master;
this->state.origin.x = master->render.position[0] + this->state.velocity.x;
this->state.origin.y = master->render.position[1] + this->state.velocity.y;
this->state.origin.z = master->render.position[2] + this->state.velocity.z;
this->state.origin.x = master->render.position.x + this->state.velocity.x;
this->state.origin.y = master->render.position.y + this->state.velocity.y;
this->state.origin.z = master->render.position.z + this->state.velocity.z;
const int frame = this->state.unknown_01E0;
@ -1962,9 +1964,10 @@ bool EffectParticle::UpdateHit6() {
this->state.unknown_01D4 = rand() % 15 + 5;
}
this->render.position[0] = this->state.offset.x + this->state.origin.x;
this->render.position[1] = this->state.offset.y + this->state.origin.y;
this->render.position[2] = this->state.offset.z + this->state.origin.z;
this->render.position = {
this->state.offset.x + this->state.origin.x, this->state.offset.y + this->state.origin.y,
this->state.offset.z + this->state.origin.z
};
if ((this->state.flags & 0x100u) != 0) {
if (3.0f >= this->HorizontalDistance(this->state.master->state.offset[0], this->state.master->state.offset[2])) {
@ -1986,9 +1989,9 @@ bool EffectParticle::UpdateHit6() {
bool EffectParticle::UpdateCoin() {
CGameMode* mode = static_cast<CGameMode*>(g_world.ActiveGameMode());
const AttachedEffect* master = this->state.master;
this->state.origin.z = master->render.position[2] + this->state.velocity.z;
this->state.origin.y = master->render.position[1] + this->state.velocity.y;
this->state.origin.x = master->render.position[0] + this->state.velocity.x;
this->state.origin.z = master->render.position.z + this->state.velocity.z;
this->state.origin.y = master->render.position.y + this->state.velocity.y;
this->state.origin.x = master->render.position.x + this->state.velocity.x;
this->state.unknown_02EC = this->state.unknown_02F0 + this->state.unknown_02EC;
const float speed = this->state.unknown_02C0 + this->state.unknown_02BC;
@ -1999,12 +2002,12 @@ bool EffectParticle::UpdateCoin() {
this->state.offset.y = this->state.offset.y + this->state.unknown_02EC;
this->state.offset.z = this->state.unknown_0370.z + this->state.offset.z;
this->render.position[0] = this->state.offset.x + this->state.origin.x;
this->render.position[1] = this->state.offset.y + this->state.origin.y;
this->render.position[2] = this->state.offset.z + this->state.origin.z;
this->render.position.x = this->state.offset.x + this->state.origin.x;
this->render.position.y = this->state.offset.y + this->state.origin.y;
this->render.position.z = this->state.offset.z + this->state.origin.z;
this->state.scale = this->state.unknown_031C + this->state.scale;
if (this->state.unknown_02EC > 0.0f && this->render.position[1] > mode->scene->terrain->Grid().Height(this->render.position[0], this->render.position[2])) {
if (this->state.unknown_02EC > 0.0f && this->render.position.y > mode->scene->terrain->Grid().Height(this->render.position.x, this->render.position.z)) {
this->state.unknown_02EC = this->state.unknown_02EC / -1.5f;
if (this->state.unknown_0208 == 1) {
@ -2012,7 +2015,7 @@ bool EffectParticle::UpdateCoin() {
std::sprintf(name, "effect\\EF_Coin%d.wav", rand() % 3 + 1);
const auto* player = reinterpret_cast<const CRenderObject*>(static_cast<CGameMode*>(g_world.ActiveGameMode())->scene->player);
g_soundMgr->PlayWave(
name, this->render.position[0] - player->render.position[0], 0.0f, this->render.position[2] - player->render.position[2], 250, 40, 1.0f, 0
name, this->render.position.x - player->render.position.x, 0.0f, this->render.position.z - player->render.position.z, 250, 40, 1.0f, 0
);
}
}
@ -2103,9 +2106,9 @@ bool EffectParticle::UpdateDetoxication() {
flags = this->state.flags;
}
this->render.position[0] = positionX + this->state.offset.x;
this->render.position[1] = positionY + this->state.offset.y;
this->render.position[2] = positionZ + this->state.offset.z;
this->render.position.x = positionX + this->state.offset.x;
this->render.position.y = positionY + this->state.offset.y;
this->render.position.z = positionZ + this->state.offset.z;
if ((flags & 0x20u) != 0) {
this->state.unknown_0314 = this->render.angle - static_cast<CGameMode*>(g_world.ActiveGameMode())->camera->camera.yaw;
@ -2120,7 +2123,7 @@ bool EffectParticle::UpdateDetoxication() {
// FUNCTION: fn_19782
bool EffectParticle::UpdateExit() {
const AttachedEffect* master = this->state.master;
this->state.origin = {master->render.position[0], master->render.position[1], master->render.position[2]};
this->state.origin = {master->render.position.x, master->render.position.y, master->render.position.z};
const float lateral = this->state.unknown_033C + this->state.unknown_0330;
float vertical = this->state.unknown_02EC + this->state.unknown_02F0;
@ -2166,9 +2169,9 @@ bool EffectParticle::UpdateExit() {
const float distance = this->state.unknown_0348;
this->state.offset = Forward(distance, this->state.matrix1);
this->render.position[0] = this->state.offset.x + this->state.origin.x;
this->render.position[1] = this->state.offset.y + this->state.origin.y;
this->render.position[2] = this->state.offset.z + this->state.origin.z;
this->render.position.x = this->state.offset.x + this->state.origin.x;
this->render.position.y = this->state.offset.y + this->state.origin.y;
this->render.position.z = this->state.offset.z + this->state.origin.z;
this->state.scale = this->state.unknown_031C + this->state.scale;
const float rotation = this->state.unknown_0334 + this->state.unknown_0310;
@ -2185,8 +2188,8 @@ bool EffectParticle::UpdateExit() {
bool EffectParticle::UpdateWarp() {
const AttachedEffect* master = this->state.master;
this->state.origin = {
master->render.position[0] + this->state.velocity.x, master->render.position[1] + this->state.velocity.y,
master->render.position[2] + this->state.velocity.z
master->render.position.x + this->state.velocity.x, master->render.position.y + this->state.velocity.y,
master->render.position.z + this->state.velocity.z
};
const int angle = static_cast<int>(this->state.unknown_0314);
@ -2208,9 +2211,9 @@ bool EffectParticle::UpdateWarp() {
this->state.offset.y = this->state.offset.y - this->state.unknown_0370.y;
this->state.offset.z = this->state.offset.z - this->state.unknown_0370.z;
this->render.position[0] = this->state.offset.x + this->state.origin.x + this->state.unknown_03A0.x;
this->render.position[1] = this->state.offset.y + this->state.origin.y + this->state.unknown_03A0.y;
this->render.position[2] = this->state.offset.z + this->state.origin.z + this->state.unknown_03A0.z;
this->render.position.x = this->state.offset.x + this->state.origin.x + this->state.unknown_03A0.x;
this->render.position.y = this->state.offset.y + this->state.origin.y + this->state.unknown_03A0.y;
this->render.position.z = this->state.offset.z + this->state.origin.z + this->state.unknown_03A0.z;
this->state.UpdateColor();
this->UpdateRecords();
@ -2244,9 +2247,9 @@ void EffectParticle::UpdateRecords() {
}
EffectPrimitiveRecord& first = this->state.records[0];
first.position.x = this->render.position[0];
first.position.y = this->render.position[1];
first.position.z = this->render.position[2];
first.position.x = this->render.position.x;
first.position.y = this->render.position.y;
first.position.z = this->render.position.z;
for (int corner = 0; corner < 4; ++corner) {
first.corners[corner] = this->state.corners[corner];

View file

@ -9,7 +9,7 @@
void EffectPrimitiveState::InitializeRecords(const RenderObjectState& render) {
for (int index = 0; index < this->unknown_01F4; ++index) {
EffectPrimitiveRecord& record = this->records[index];
record.position = {render.position[0], render.position[1], render.position[2]};
record.position = {render.position.x, render.position.y, render.position.z};
std::memcpy(record.corners, this->corners, sizeof(record.corners));
record.unknown_003C = this->unknown_0348;
record.scale = this->scale;

View file

@ -58,7 +58,7 @@ void DrawEffectPrimitive15(EffectPrimitiveState& particle, const RenderObjectSta
for (unsigned vertexIndex = 0; vertexIndex < 3; ++vertexIndex) {
const vector3d& corner = corners[indices[triangleIndex][vertexIndex]];
const float position[3] = {corner.x + render.position[0], corner.y + render.position[1], corner.z + render.position[2]};
const float position[3] = {corner.x + render.position.x, corner.y + render.position.y, corner.z + render.position.z};
RenderVertex projected{0, 0, 0, 0, 0, 0xFF000000u, 0, 0};
context.projection.Project(position, context.cameraMatrix, projected);
RenderVertex& vertex = triangle.vertices[vertexIndex];

View file

@ -206,9 +206,9 @@ void EffectPrimitiveState::Initialize(
this->offset.x = first;
this->offset.y = y + this->offset.y;
this->offset.z = z + this->offset.z;
this->origin = {masterRender.position[0], masterRender.position[1], masterRender.position[2]};
render.position[0] = this->origin.x;
render.position[1] = this->origin.y;
render.position[2] = this->origin.z;
this->origin = {masterRender.position.x, masterRender.position.y, masterRender.position.z};
render.position.x = this->origin.x;
render.position.y = this->origin.y;
render.position.z = this->origin.z;
this->unknown_013C = 0;
}

View file

@ -30,9 +30,9 @@ bool UpdatePartyEffect(
}
const RenderObjectState& actor = effect.parent->render;
render.position[0] = actor.position[0];
render.position[1] = actor.position[1];
render.position[2] = actor.position[2];
render.position.x = actor.position.x;
render.position.y = actor.position.y;
render.position.z = actor.position.z;
if (effect.unknown_0178 == 9998) {
effect.unknown_0178 = 0;
@ -56,7 +56,7 @@ bool UpdatePartyEffect(
state.textures[0] = textures.Load("effect\\party.tga", 0, false, true, false);
}
render.position[1] = ground.Height(render.position[0], render.position[2]) - 2.0f;
render.position.y = ground.Height(render.position.x, render.position.z) - 2.0f;
++effect.unknown_0178;
return effect.unknown_0178 < effect.lifetime;
}

View file

@ -688,9 +688,9 @@ void InitializeRagEffect(
) {
effect.id = id;
effect.parent = parent;
render.position[0] = parentState.position[0];
render.position[1] = parentState.position[1];
render.position[2] = parentState.position[2];
render.position.x = parentState.position.x;
render.position.y = parentState.position.y;
render.position.z = parentState.position.z;
effect.unknown_013C[4] = std::bit_cast<std::uint32_t>(parentState.angle);
effect.lifetime = EffectLifetime(effect.id);
effect.offset[0] = x;

View file

@ -74,7 +74,7 @@ bool CHalluPlant::Update() {
bool CNumEffect::Update() {
const float elapsed = static_cast<float>((timeGetTime() - this->render.unknown_008C) / 24.0);
this->render.previousAnimation = this->render.animation;
this->render.position[1] = this->baseHeight - elapsed * 0.18f;
this->render.position.y = this->baseHeight - elapsed * 0.18f;
this->SetColor(static_cast<int>(255.0f - (elapsed + elapsed)), -1, -1, -1);
if (this->render.scale > 1.0f) {
@ -98,13 +98,13 @@ bool CSoundMaker::Update() {
return true;
}
const float distance = this->HorizontalDistance(player->render.position[0], player->render.position[2]);
const float distance = this->HorizontalDistance(player->render.position.x, player->render.position.z);
if (distance - (this->radius + this->range) > 130.0f) {
return true;
}
const float deltaX = player->render.position[0] - this->render.position[0];
const float deltaZ = player->render.position[2] - this->render.position[2];
const float deltaX = player->render.position.x - this->render.position.x;
const float deltaZ = player->render.position.z - this->render.position.z;
float signX = 1.0f;
float signZ = 1.0f;
if (deltaX < 0.0f && deltaZ >= 0.0f) {
@ -127,8 +127,8 @@ bool CSoundMaker::Update() {
offsetZ = slope * offsetX;
}
const float x = this->render.position[0] + offsetX;
const float z = this->render.position[2] + offsetZ;
const float x = this->render.position.x + offsetX;
const float z = this->render.position.z + offsetZ;
if (player->HorizontalDistance(x, z) - this->range > 75.0f || this->file.empty()) {
return true;
}
@ -136,7 +136,7 @@ bool CSoundMaker::Update() {
if (timeGetTime() > this->lastTick + this->cycle) {
this->lastTick = timeGetTime();
g_soundMgr->PlayWave(
this->file.c_str(), x - player->render.position[0], 0.0f, z - player->render.position[2], TruncateToInt(this->range),
this->file.c_str(), x - player->render.position.x, 0.0f, z - player->render.position.z, TruncateToInt(this->range),
TruncateToInt(this->range / 6.0f), this->volume, 0
);
}
@ -172,9 +172,9 @@ void CBlowEffect::SendObjectMessage(
}
const float* position = reinterpret_cast<const float*>(b);
this->render.position[0] = position[0];
this->render.position[1] = position[1];
this->render.position[2] = position[2];
this->render.position.x = position[0];
this->render.position.y = position[1];
this->render.position.z = position[2];
this->render.visible = 1;
this->render.color = (d | e) ? 0xFFFF0000u : 0xFFFFFFFFu;
this->render.unknown_008C = timeGetTime();
@ -345,12 +345,12 @@ void CNumEffect::SendObjectMessage(
) {
if (message == 14 && a == 0) {
const float* position = reinterpret_cast<const float*>(b);
this->render.position[0] = position[0];
this->render.position[1] = position[1];
this->render.position[2] = position[2];
this->render.position.x = position[0];
this->render.position.y = position[1];
this->render.position.z = position[2];
this->render.visible = 1;
this->render.position[1] -= 12.0f;
this->baseHeight = this->render.position[1];
this->render.position.y -= 12.0f;
this->baseHeight = this->render.position.y;
this->render.curMotion = d;
if (d > 9 || d < 0) {
@ -387,9 +387,9 @@ void CSoundMaker::SendObjectMessage(
this->width = sound.width;
this->height = sound.height;
this->range = sound.range;
this->render.position[0] = sound.position[0];
this->render.position[1] = sound.position[1];
this->render.position[2] = sound.position[2];
this->render.position.x = sound.position[0];
this->render.position.y = sound.position[1];
this->render.position.z = sound.position[2];
this->radius = SquareRoot(static_cast<float>(this->width * this->width + this->height * this->height));
this->cycle = static_cast<std::int64_t>(sound.cycle * 1000.0f);
this->lastTick = timeGetTime() - this->cycle;

View file

@ -19,5 +19,5 @@ bool CNavigationManager::PlayerCell(int* column, int* row) {
// FUNCTION: fn_21282
void CGameMode::PlayerCell(int* column, int* row) const {
const auto* player = reinterpret_cast<const CRenderObject*>(this->scene->player);
this->WorldCell(player->render.position[0], player->render.position[2], *column, *row);
this->WorldCell(player->render.position.x, player->render.position.z, *column, *row);
}