Decompile 4 functions in Source/Contents/Effects/Particle.cpp, Source/Resource/EZeffectResource.cpp, ...
Batch #16509 by eAthena: 0 byte-identical, 4 confirmed by peer review. - fn_07898 EZeffectClip::Texture: logic confirmed by peer review - fn_18825 CEZ2STRParticle::RenderBillboard: logic confirmed by peer review - fn_18826 CEZ2STRParticle::RenderScreen: logic confirmed by peer review - fn_18827 CEZ2STRParticle::RenderGround: logic confirmed by peer review Peer-reviewed-by: ragnarok-clanker, Yommy, br4yan 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
c7ede4c0f0
commit
e5e26a3bfc
3 changed files with 31 additions and 30 deletions
|
|
@ -35,15 +35,15 @@ static __forceinline void SetClipCorners(RenderVertex* vertices, const EZeffectT
|
|||
vertices[1].x = transform.ax[0];
|
||||
vertices[2].x = transform.ax[2];
|
||||
vertices[3].x = transform.ax[1];
|
||||
vertices[1].u = vertices[0].u = transform.u;
|
||||
vertices[3].u = vertices[2].u = transform.us + transform.u;
|
||||
vertices[0].u = vertices[1].u = transform.u;
|
||||
vertices[2].u = vertices[3].u = transform.us + transform.u;
|
||||
} else {
|
||||
vertices[0].x = transform.ax[2];
|
||||
vertices[1].x = transform.ax[1];
|
||||
vertices[2].x = transform.ax[3];
|
||||
vertices[3].x = transform.ax[0];
|
||||
vertices[1].u = vertices[0].u = transform.us + transform.u;
|
||||
vertices[3].u = vertices[2].u = transform.u;
|
||||
vertices[0].u = vertices[1].u = transform.us + transform.u;
|
||||
vertices[2].u = vertices[3].u = transform.u;
|
||||
}
|
||||
|
||||
if (transform.ay[2] > transform.ay[1]) {
|
||||
|
|
@ -51,32 +51,32 @@ static __forceinline void SetClipCorners(RenderVertex* vertices, const EZeffectT
|
|||
vertices[1].y = transform.ay[0];
|
||||
vertices[2].y = transform.ay[2];
|
||||
vertices[3].y = transform.ay[1];
|
||||
vertices[3].v = vertices[1].v = transform.v;
|
||||
vertices[2].v = vertices[0].v = transform.vs + transform.v;
|
||||
vertices[1].v = vertices[3].v = transform.v;
|
||||
vertices[0].v = vertices[2].v = transform.vs + transform.v;
|
||||
} else {
|
||||
vertices[0].y = transform.ay[0];
|
||||
vertices[1].y = transform.ay[3];
|
||||
vertices[2].y = transform.ay[1];
|
||||
vertices[3].y = transform.ay[2];
|
||||
vertices[2].v = vertices[0].v = transform.v;
|
||||
vertices[3].v = vertices[1].v = transform.vs + transform.v;
|
||||
vertices[0].v = vertices[2].v = transform.v;
|
||||
vertices[1].v = vertices[3].v = transform.vs + transform.v;
|
||||
}
|
||||
}
|
||||
|
||||
// INLINED
|
||||
static __forceinline std::uint32_t ClipColor(const EZeffectTransform& transform, float alpha) {
|
||||
return ((((static_cast<int>(transform.crA * alpha) << 8) + static_cast<unsigned char>(transform.crR)) << 8) + static_cast<unsigned char>(transform.crG)) << 8 |
|
||||
return (((((static_cast<int>(transform.crA * alpha) << 8) + static_cast<unsigned char>(transform.crR)) << 8) + static_cast<unsigned char>(transform.crG)) << 8) +
|
||||
static_cast<unsigned char>(transform.crB);
|
||||
}
|
||||
|
||||
// INLINED
|
||||
static __forceinline CTexture* ClipTexture(EZeffectClip* clip, const EZeffectTransform& transform, const std::string& prefix) {
|
||||
static __forceinline CTexture* ClipTexture(EZeffectClip* clip, const EZeffectTransform& transform, const CEZ2STRParticle& particle) {
|
||||
const int frame = static_cast<int>(transform.aniframe);
|
||||
if (prefix.size() == 0) {
|
||||
if (particle.m_texturePrefix.size() == 0) {
|
||||
return clip->Texture(frame < 0 ? 0 : frame);
|
||||
}
|
||||
|
||||
return clip->Texture(frame < 0 ? 0 : frame, prefix.c_str());
|
||||
return clip->Texture(frame < 0 ? 0 : frame, particle.m_texturePrefix);
|
||||
}
|
||||
|
||||
// OFFSET: 0x00B3C440
|
||||
|
|
@ -468,7 +468,7 @@ void CEZ2STRParticle::RenderBillboard(EZeffectClip* clip, EZeffectTransform* tra
|
|||
RenderVertex* vertices = primitive->vertices;
|
||||
SetClipCorners(vertices, *transform);
|
||||
|
||||
CTexture* texture = ClipTexture(clip, *transform, this->m_texturePrefix);
|
||||
CTexture* texture = ClipTexture(clip, *transform, *this);
|
||||
const float scaleU = static_cast<float>(texture->ImageWidth()) / static_cast<float>(texture->TextureWidth());
|
||||
const float scaleV = static_cast<float>(texture->ImageHeight()) / static_cast<float>(texture->TextureHeight());
|
||||
|
||||
|
|
@ -600,7 +600,7 @@ void CEZ2STRParticle::RenderScreen(EZeffectClip* clip, EZeffectTransform* transf
|
|||
vertices[i].y -= this->m_screenShiftY;
|
||||
}
|
||||
|
||||
CTexture* texture = ClipTexture(clip, *transform, this->m_texturePrefix);
|
||||
CTexture* texture = ClipTexture(clip, *transform, *this);
|
||||
const float depth = static_cast<float>(index) * 1e-05f;
|
||||
const float scaleU = static_cast<float>(texture->ImageWidth()) / static_cast<float>(texture->TextureWidth());
|
||||
const float scaleV = static_cast<float>(texture->ImageHeight()) / static_cast<float>(texture->TextureHeight());
|
||||
|
|
@ -628,7 +628,7 @@ void CEZ2STRParticle::RenderGround(EZeffectClip* clip, EZeffectTransform* transf
|
|||
RenderVertex* vertices = primitive->vertices;
|
||||
SetClipCorners(vertices, *transform);
|
||||
|
||||
CTexture* texture = ClipTexture(clip, *transform, this->m_texturePrefix);
|
||||
CTexture* texture = ClipTexture(clip, *transform, *this);
|
||||
const float scaleU = static_cast<float>(texture->ImageWidth()) / static_cast<float>(texture->TextureWidth());
|
||||
const float scaleV = static_cast<float>(texture->ImageHeight()) / static_cast<float>(texture->TextureHeight());
|
||||
|
||||
|
|
|
|||
|
|
@ -121,26 +121,26 @@ CTexture* EZeffectClip::Texture(int index) {
|
|||
|
||||
// OFFSET: 0x0074D9A0
|
||||
// FUNCTION: fn_07898
|
||||
CTexture* EZeffectClip::Texture(int index, const char* prefix) {
|
||||
if (index >= this->textureCount) {
|
||||
return g_texMgr.Default();
|
||||
}
|
||||
CTexture* EZeffectClip::Texture(int index, const std::string& prefix) {
|
||||
if (index < this->textureCount) {
|
||||
if (!this->textures[index]) {
|
||||
std::string path = std::format("effect\\{}{}", prefix, this->names[index]);
|
||||
|
||||
if (!this->textures[index]) {
|
||||
std::string path = std::format("effect\\{}{}", prefix, this->names[index]);
|
||||
if (path.find_last_of('.') == std::string::npos) {
|
||||
path.append(".bmp", 4);
|
||||
}
|
||||
|
||||
if (path.find_last_of('.') == std::string::npos) {
|
||||
path.append(".bmp", 4);
|
||||
this->textures[index] = g_texMgr.Load(path.c_str(), 1, false, true, false);
|
||||
|
||||
if (this->textures[index]) {
|
||||
this->textures[index]->Retain();
|
||||
}
|
||||
}
|
||||
|
||||
this->textures[index] = g_texMgr.Load(path.c_str(), 1, false, true, false);
|
||||
|
||||
if (this->textures[index]) {
|
||||
this->textures[index]->Retain();
|
||||
}
|
||||
return this->textures[index];
|
||||
}
|
||||
|
||||
return this->textures[index];
|
||||
return g_texMgr.Default();
|
||||
}
|
||||
|
||||
// INLINED
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
class CTexture;
|
||||
|
||||
|
|
@ -45,7 +46,7 @@ struct EZeffectClip {
|
|||
EZeffectClip();
|
||||
~EZeffectClip();
|
||||
CTexture* Texture(int index);
|
||||
CTexture* Texture(int index, const char* prefix);
|
||||
CTexture* Texture(int index, const std::string& prefix);
|
||||
|
||||
/* 0000 */ int textureCount;
|
||||
/* 0004 */ int textureState;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue