Decompile fn_19893 (CEffectPrim::RenderOrbitIcons)

Batch #2523 by ragnarok-clanker: 0 byte-identical, 1 confirmed by peer review.

- fn_19893 CEffectPrim::RenderOrbitIcons: logic confirmed by peer review

Peer-reviewed-by: eAthena, meitogi, youko, superintelligence
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 21:01:40 +00:00
commit ea8559f2ba
2 changed files with 58 additions and 0 deletions

View file

@ -137,6 +137,7 @@ struct CEffectPrim : CRenderObject {
void RenderPeongUp(matrix& wtm);
void RenderRipple(matrix& wtm);
void RenderRainbow(matrix& wtm);
void RenderOrbitIcons(matrix& wtm, float scale, unsigned char red, unsigned char green, unsigned char blue);
void RenderLayeredGlow(matrix& wtm);
void RenderSphereCage(matrix& wtm);
void RenderGroundBubbles(matrix& wtm);

View file

@ -3139,6 +3139,63 @@ void CEffectPrim::RenderLayeredGlow(matrix& wtm) {
}
}
// OFFSET: 0x00BD9FC0
// FUNCTION: fn_19893
void CEffectPrim::RenderOrbitIcons(matrix& wtm, float scale, unsigned char red, unsigned char green, unsigned char blue) {
vector3d vec1{};
vector3d vec2{};
vector3d vec3{};
vector3d vec4{};
int rpCnt = 0;
for (int ec = 0; ec < 4; ++ec) {
EffectPrimitiveSlot& slot = this->state.slots[ec];
if (slot.life != 1) {
continue;
}
if (slot.flag1[4] == 1) {
red = 255;
green = 20;
blue = 20;
}
vector3d* const points[4] = {&slot.vecBPre, &slot.vecBNow, &slot.vecTPre, &slot.vecTNow};
for (int item = 0; item < 4; ++item) {
const int angle = static_cast<int>(slot.height[3 + 4 * item]);
points[item]->x = g_cosTable[angle] * 4.0f;
points[item]->z = g_sinTable[angle] * 4.0f;
}
const float rx = scale * slot.distance;
vec1 = {rx * g_cosTable[45], 0.0f, rx * g_sinTable[45]};
vec2 = {rx * g_cosTable[135], 0.0f, rx * g_sinTable[135]};
vec3 = {rx * g_cosTable[225], 0.0f, rx * g_sinTable[225]};
vec4 = {rx * g_cosTable[315], 0.0f, rx * g_sinTable[315]};
this->Tei_TowardScreen(vec1, vec2, vec3, vec4, this->state.slots[0].alphaT, this->state.slots[1].alphaT);
const vector3d quad[4] = {vec1, vec2, vec3, vec4};
for (int item = 0; item < 4; ++item) {
const float mode = slot.height[2 + 4 * item];
const int delta = static_cast<int>(slot.height[3 + 4 * item] - static_cast<float>(this->state.slots[0].alphaT));
const bool back = (delta >= 70 || delta <= -80) && static_cast<unsigned>(delta + 270) <= 540;
const bool flipped = mode == 0.0f || mode == 2.0f ? back : !back;
const vector3d& point = *points[item];
const int order[4] = {flipped ? 1 : 0, flipped ? 0 : 1, flipped ? 3 : 2, flipped ? 2 : 3};
vector3d corners[4];
for (int corner = 0; corner < 4; ++corner) {
const vector3d& local = quad[order[corner]];
corners[corner] = {local.x + point.x, local.y + point.y - slot.height[20], local.z + point.z};
}
this->RenderTeiRect(
&rpCnt, static_cast<short>(static_cast<int>(slot.height[1 + 4 * item])), corners[0], corners[1], corners[2], corners[3], wtm, 0,
static_cast<unsigned char>(static_cast<int>(mode)), 0, red, green, blue, 0.0f, 1.0f, 0.0f, 1.0f, 2
);
}
}
}
// OFFSET: 0x00BDF0A0
// FUNCTION: fn_19908
void CEffectPrim::RenderRainbow(matrix& wtm) {