Skip to content

Commit

Permalink
m3d::calcRatio_c
Browse files Browse the repository at this point in the history
  • Loading branch information
robojumper committed Jun 20, 2024
1 parent 6761715 commit 5930edd
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 17 deletions.
2 changes: 1 addition & 1 deletion config/SOUE01/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35698,7 +35698,7 @@ __vt__Q23m3d6banm_c = .data:0x80542610; // type:object size:0x18
lbl_80542628 = .data:0x80542628; // type:object size:0x30
lbl_80542658 = .data:0x80542658; // type:object size:0x10
__vt__Q23m3d6bmdl_c = .data:0x80542668; // type:object size:0x30
__vt__Q23m3d11calcRatio_c = .data:0x80542698; // type:object size:0x10
__vt__Q23m3d11calcRatio_c = .data:0x80542698; // type:object size:0xC
__vt__Q23m3d6fanm_c = .data:0x805426A8; // type:object size:0x18
__vt__Q23m3d5mdl_c = .data:0x805426C0; // type:object size:0x2C
__vt__Q33m3d5mdl_c13mdlCallback_c = .data:0x805426F0; // type:object size:0x18
Expand Down
2 changes: 1 addition & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ def nw4rLib(lib_name, objects, extra_cflags=[]):
Object(Matching, "m/m3d/m_anmvis.cpp"),
Object(Matching, "m/m3d/m_banm.cpp"),
Object(NonMatching, "m/m3d/m_bmdl.cpp"),
Object(NonMatching, "m/m3d/m_calc_ratio.cpp"),
Object(Matching, "m/m3d/m_calc_ratio.cpp"),
Object(NonMatching, "m/m3d/m_fanm.cpp"),
Object(NonMatching, "m/m3d/m_mdl.cpp"),
Object(NonMatching, "m/m3d/m_scnLeaf.cpp"),
Expand Down
22 changes: 10 additions & 12 deletions src/m/m3d/m_calc_ratio.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <m/m3d/m_calc_ratio.h>
#include <nw4r/math/math_arithmetic.h>

namespace m3d {

Expand Down Expand Up @@ -45,26 +46,23 @@ void calcRatio_c::set(f32 value) {
}

void calcRatio_c::calc() {
f32 max = 1.0f;
f32 start = mf1;
if (start == 0.0f) {
if (mf1 == 0.0f) {
return;
}

mf2 += mf3;
if (mf2 >= 1.0f) {
reset();
return;
} else {
mb2 = 1;
mf1 = start - start * mf2 * mf2;
max = 1.0f - mf1;
// TODO here be ASM
f32 f4 = mf1 / start + max;
f32 f1 = __fres(f4);
f4 = -(f4 * f1 * f1 - (f1 + f1));
mf4 = (mf1 / start) * f4;
mf5 = max * f4;
f32 start = mf1;
f32 tmp = start - start * mf2 * mf2;
mf1 = tmp;
f32 max = 1.0f - mf1;
tmp = mf1 / start;
f32 inv = nw4r::math::FInv(tmp + max);
mf4 = tmp * inv;
mf5 = max * inv;
}
}

Expand Down
3 changes: 0 additions & 3 deletions tools/rel_sieve.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,11 @@
['fn_80353FF0', 'UnkCollider::init'],
['fn_800C3EC0', 'ActorEventFlowManagerRelated::checkEventFinished'],
['fn_802E6000', 'mdlAnmChr_c::create'],
['fn_802EB6F0', 'm3d::mdl_c::mdl_c'],
['fn_802EDF30', 'm3d::smdl_c::smdl_c'],
['fn_800275C0', 'EffectsStruct::ctor'],
['fn_80027610', 'EffectsStruct::ctor'],
['fn_803465D0', 'ActorCollision::ctor'],
['fn_80341A70', 'checkCollision'],
['fn_80016C10', 'AnimModelWrapper::ctor'],
['fn_802EBBD0', 'm3d::scnLeaf_c::scnLeaf_c'],
['fn_8009C910', 'ActorEventRelated::ctor'],
['fn_802E32B0', 'm2d::FrameCtrl_c::setFrame'],
['fn_802F04A0', 'mFader_c::draw'],
Expand Down

0 comments on commit 5930edd

Please sign in to comment.