summaryrefslogtreecommitdiff
path: root/src/REL/d/a/e/d_a_e_hb_leaf.cpp
diff options
context:
space:
mode:
authorrobojumper <robojumper@gmail.com>2024-09-12 22:36:34 +0200
committerGitHub <noreply@github.com>2024-09-12 16:36:34 -0400
commit1180e1f4860d62bccd64bfa2a29eaeebd2c4b019 (patch)
treece6e231ef46aacbdad52ad7f6cbcd9d02dba555e /src/REL/d/a/e/d_a_e_hb_leaf.cpp
parente2c4bb7be7fa731a335bce4bc22283d899133e39 (diff)
m3d (#13)
* Initial M3d Pass * `m_bmdl` and `m_bline` left --------- Co-authored-by: elijah-thomas774 <elijahthomas774@gmail.com> Co-authored-by: Elijah Thomas <42302100+elijah-thomas774@users.noreply.github.com>
Diffstat (limited to 'src/REL/d/a/e/d_a_e_hb_leaf.cpp')
-rw-r--r--src/REL/d/a/e/d_a_e_hb_leaf.cpp109
1 files changed, 109 insertions, 0 deletions
diff --git a/src/REL/d/a/e/d_a_e_hb_leaf.cpp b/src/REL/d/a/e/d_a_e_hb_leaf.cpp
index e69de29b..e055631e 100644
--- a/src/REL/d/a/e/d_a_e_hb_leaf.cpp
+++ b/src/REL/d/a/e/d_a_e_hb_leaf.cpp
@@ -0,0 +1,109 @@
+#include <d/a/e/d_a_e_hb_leaf.h>
+
+const f32 dAcEhb_leaf_c::unkFloat0 = 0.0f;
+const f32 dAcEhb_leaf_c::unkFloat1 = -0.0f;
+
+SPECIAL_ACTOR_PROFILE(E_HB_LEAF, dAcEhb_leaf_c, fProfile::E_HB_LEAF, 0x100, 0, 3);
+
+bool dAcEhb_leaf_c::createHeap() {
+ // This is ever so slightly weird but our m_anmMdl really doesn't take ResFile by value
+ // but only ever a single pointer.
+ void *fp = getOarcResFile("Degubaba");
+ TRY_CREATE(mModel.create(fp, "degubaba_leaf", "shake2", &heap_allocator, 0x123));
+ nw4r::g3d::ResFile f = fp;
+ nw4r::g3d::ResMdl mdl = f.GetResMdl("degubaba_leaf");
+ nw4r::g3d::ResAnmTexPat anm = f.GetResAnmTexPat("degubaba_leaf");
+ TRY_CREATE(mAnm.create(mdl, anm, &heap_allocator, nullptr, 1));
+ mModel.getModel().setAnm(mAnm);
+ return true;
+}
+
+int dAcEhb_leaf_c::create() {
+ if (!initAllocatorWork1Heap(-1, "dAcEhb_leaf_c::m_allocator", 0x20)) {
+ return FAILED;
+ }
+
+ setBoundingBox(mVec3_c(-100.0f, -100.0f, -100.0f), mVec3_c(100.0f, 100.0f, 100.0f));
+
+ rotation.y = cM::rndF(65535.0f);
+ someRot = rotation.y.mVal;
+
+ switch (getParam1()) {
+ case 0:
+ case 7:
+ mType = 0;
+ break;
+ case 1:
+ mType = 1;
+ break;
+ case 2:
+ mType = 2;
+ break;
+ case 3:
+ case 4:
+ case 5:
+ rotation.z = -0x8000;
+ break;
+ default:
+ break;
+ }
+
+ if (mType == 0) {
+ u32 param2 = getParam2();
+ if (param2 == 1) {
+ mType = 1;
+ } else if (param2 == 2) {
+ mType = 2;
+ }
+ }
+
+ if (mType == 2) {
+ field_0x3CC = 1;
+ someFloat = 1.0f;
+ }
+
+ if (mType != 0) {
+ actor_properties &= ~1;
+ }
+
+ mStartingPos = position;
+
+ return SUCCEEDED;
+}
+
+int dAcEhb_leaf_c::doDelete() {
+ return 1;
+}
+
+int dAcEhb_leaf_c::actorExecute() {
+ if (mType != 0) {
+ doCheck();
+ if (isNearZero()) {
+ return 1;
+ }
+ }
+
+ updateMatrix();
+ if (mType != 0) {
+ Mtx m;
+ PSMTXScale(m, someFloat, someFloat, someFloat);
+ PSMTXConcat(worldMatrix.m, m, worldMatrix.m);
+ }
+ mModel.getModel().setLocalMtx(worldMatrix);
+ mModel.getModel().calc(false);
+ someRot++;
+
+ return 1;
+}
+
+int dAcEhb_leaf_c::draw() {
+ if (!isHidden()) {
+ drawModelType1(&mModel.getModel());
+ }
+
+ return 1;
+}
+
+void dAcEhb_leaf_c::setAnm(const char *anm, f32 pos) {
+ mModel.setAnm(anm, m3d::PLAY_MODE_4, pos);
+}