From 0bea3955d37440c5fc59e23d6a365a54ef1b8afd Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Mon, 9 Sep 2024 15:14:15 -0400 Subject: [PATCH] object-actor OK mostly copied from pikmin2 decomp --- configure.py | 2 +- include/JSystem/JStage/JSGFog.h | 3 - .../JSystem/JStudio/JStudio/jstudio-object.h | 89 ++++++- .../JSystem/JStudio/JStudio_JStage/control.h | 50 +++- .../JStudio/JStudio/jstudio-object.cpp | 18 +- .../JStudio/JStudio_JAudio/object-sound.cpp | 4 +- .../JStudio_JMessage/object-message.cpp | 2 +- .../JStudio_JParticle/object-particle.cpp | 10 +- .../JStudio/JStudio_JStage/object-actor.cpp | 228 ++++++++++++++---- src/JSystem/JStudio/JStudio_JStage/object.cpp | 2 +- 10 files changed, 320 insertions(+), 88 deletions(-) diff --git a/configure.py b/configure.py index 74bcbec20..9c3f31419 100644 --- a/configure.py +++ b/configure.py @@ -690,7 +690,7 @@ def JSystemLib(lib_name, objects, progress_category="core"): [ Object(Matching, "JSystem/JStudio/JStudio_JStage/control.cpp"), Object(Matching, "JSystem/JStudio/JStudio_JStage/object.cpp"), - Object(NonMatching, "JSystem/JStudio/JStudio_JStage/object-actor.cpp"), + Object(Matching, "JSystem/JStudio/JStudio_JStage/object-actor.cpp"), Object(Matching, "JSystem/JStudio/JStudio_JStage/object-ambientlight.cpp"), Object(NonMatching, "JSystem/JStudio/JStudio_JStage/object-camera.cpp"), Object(Matching, "JSystem/JStudio/JStudio_JStage/object-fog.cpp"), diff --git a/include/JSystem/JStage/JSGFog.h b/include/JSystem/JStage/JSGFog.h index 1b90aa3fc..dfedcc8ff 100644 --- a/include/JSystem/JStage/JSGFog.h +++ b/include/JSystem/JStage/JSGFog.h @@ -7,9 +7,6 @@ namespace JStage { struct TFog : public TObject { - void JSGFDisableFlag(u32 flag) { JSGSetFlag(JSGGetFlag() & ~flag); } - void JSGFEnableFlag(u32 flag) { JSGSetFlag(JSGGetFlag() | flag); } - virtual ~TFog() = 0; virtual s32 JSGFGetType() const; virtual bool JSGGetFogFunction() const; diff --git a/include/JSystem/JStudio/JStudio/jstudio-object.h b/include/JSystem/JStudio/JStudio/jstudio-object.h index 732e19f19..906860b77 100644 --- a/include/JSystem/JStudio/JStudio/jstudio-object.h +++ b/include/JSystem/JStudio/JStudio/jstudio-object.h @@ -9,13 +9,32 @@ typedef struct _GXColor GXColor; namespace JStudio { namespace data { enum TEOperationData { - UNK_0x1 = 0x1, - UNK_0x2 = 0x2, - UNK_0x3 = 0x3, - UNK_0x10 = 0x10, - UNK_0x12 = 0x12, - UNK_0x18 = 0x18, - UNK_0x19 = 0x19, + TEOD_Unknown_00 = 0x00, + TEOD_Unknown_01 = 0x01, + TEOD_Unknown_02 = 0x02, + TEOD_Unknown_03 = 0x03, + TEOD_Unknown_04 = 0x04, + TEOD_Unknown_05 = 0x05, + TEOD_Unknown_06 = 0x06, + TEOD_Unknown_07 = 0x07, + TEOD_Unknown_08 = 0x08, + TEOD_Unknown_09 = 0x09, + TEOD_Unknown_0A = 0x0A, + TEOD_Unknown_0B = 0x0B, + TEOD_Unknown_0C = 0x0C, + TEOD_Unknown_0D = 0x0D, + TEOD_Unknown_0E = 0x0E, + TEOD_Unknown_0F = 0x0F, + TEOD_Unknown_10 = 0x10, + TEOD_Unknown_11 = 0x11, + TEOD_Unknown_12 = 0x12, + TEOD_Unknown_13 = 0x13, + TEOD_Unknown_14 = 0x14, + TEOD_Unknown_15 = 0x15, + TEOD_Unknown_16 = 0x16, + TEOD_Unknown_17 = 0x17, + TEOD_Unknown_18 = 0x18, + TEOD_Unknown_19 = 0x19, }; }; @@ -26,7 +45,7 @@ struct TVariableValue { virtual ~TOutput() = 0; }; // Size: 0x04 - struct TOutput_none_ { + struct TOutput_none_ : public TOutput { ~TOutput_none_(); void operator()(f32, JStudio::TAdaptor*) const; }; @@ -35,7 +54,12 @@ struct TVariableValue { static void update_immediate_(JStudio::TVariableValue*, f64); static void update_time_(JStudio::TVariableValue*, f64); static void update_functionValue_(JStudio::TVariableValue*, f64); - TVariableValue(); + TVariableValue() + : field_0x4(0) + , field_0x8(NULL) + , pOutput_(&soOutput_none_) + { + } void setValue_immediate(f32 value) { field_0x8 = &update_immediate_; @@ -85,7 +109,7 @@ struct TVariableValue { pOutput_ = (output != NULL ? (TOutput*)output : (TOutput*)&soOutput_none_); } - static u8 soOutput_none_[4 + 4 /* padding */]; + static TOutput_none_ soOutput_none_; /* 0x00 */ f32 mValue; /* 0x04 */ u32 field_0x4; @@ -206,12 +230,28 @@ struct TAdaptor_actor : public TAdaptor { { } virtual ~TAdaptor_actor() = 0; + virtual void adaptor_do_prepare(const JStudio::TObject*) = 0; + virtual void adaptor_do_begin(const JStudio::TObject*) = 0; + virtual void adaptor_do_end(const JStudio::TObject*) = 0; + virtual void adaptor_do_update(const JStudio::TObject*, u32) = 0; + virtual void adaptor_do_data(const JStudio::TObject*, void const*, u32, void const*, u32) = 0; + virtual void adaptor_do_PARENT(JStudio::data::TEOperationData, void const*, u32) = 0; + virtual void adaptor_do_PARENT_NODE(JStudio::data::TEOperationData, void const*, u32) = 0; + virtual void adaptor_do_PARENT_ENABLE(JStudio::data::TEOperationData, void const*, u32) = 0; + virtual void adaptor_do_RELATION(JStudio::data::TEOperationData, void const*, u32) = 0; + virtual void adaptor_do_RELATION_NODE(JStudio::data::TEOperationData, void const*, u32) = 0; + virtual void adaptor_do_RELATION_ENABLE(JStudio::data::TEOperationData, void const*, u32) = 0; + virtual void adaptor_do_SHAPE(JStudio::data::TEOperationData, void const*, u32) = 0; + virtual void adaptor_do_ANIMATION(JStudio::data::TEOperationData, void const*, u32) = 0; + virtual void adaptor_do_ANIMATION_MODE(JStudio::data::TEOperationData, void const*, u32) = 0; + virtual void adaptor_do_TEXTURE_ANIMATION(JStudio::data::TEOperationData, void const*, u32) = 0; + virtual void adaptor_do_TEXTURE_ANIMATION_MODE(JStudio::data::TEOperationData, void const*, u32) = 0; /* 0x10 */ TVariableValue mValue[14]; - static u8 const sauVariableValue_3_TRANSLATION_XYZ[12]; - static u8 const sauVariableValue_3_ROTATION_XYZ[12]; - static u8 const sauVariableValue_3_SCALING_XYZ[12]; + static u32 const sauVariableValue_3_TRANSLATION_XYZ[3]; + static u32 const sauVariableValue_3_ROTATION_XYZ[3]; + static u32 const sauVariableValue_3_SCALING_XYZ[3]; }; // Size: 0x128 struct TObject_actor : public TObject { @@ -251,6 +291,14 @@ struct TAdaptor_camera : public TAdaptor { { } virtual ~TAdaptor_camera() = 0; + virtual void adaptor_do_prepare(const JStudio::TObject*) = 0; + virtual void adaptor_do_begin(const JStudio::TObject*) = 0; + virtual void adaptor_do_end(const JStudio::TObject*) = 0; + virtual void adaptor_do_update(const JStudio::TObject*, u32) = 0; + virtual void adaptor_do_data(const JStudio::TObject*, void const*, u32, void const*, u32) = 0; + virtual void adaptor_do_PARENT(JStudio::data::TEOperationData, void const*, u32) = 0; + virtual void adaptor_do_PARENT_NODE(JStudio::data::TEOperationData, void const*, u32) = 0; + virtual void adaptor_do_PARENT_ENABLE(JStudio::data::TEOperationData, void const*, u32) = 0; /* 0x10 */ TVariableValue mValue[11]; @@ -297,6 +345,13 @@ struct TAdaptor_light : public TAdaptor { { } virtual ~TAdaptor_light() = 0; + virtual void adaptor_do_prepare(const JStudio::TObject*) = 0; + virtual void adaptor_do_begin(const JStudio::TObject*) = 0; + virtual void adaptor_do_end(const JStudio::TObject*) = 0; + virtual void adaptor_do_update(const JStudio::TObject*, u32) = 0; + virtual void adaptor_do_data(const JStudio::TObject*, void const*, u32, void const*, u32) = 0; + virtual void adaptor_do_ENABLE(JStudio::data::TEOperationData, void const*, u32) = 0; + virtual void adaptor_do_FACULTY(JStudio::data::TEOperationData, void const*, u32) = 0; /* 0x10 */ TVariableValue mValue[13]; @@ -322,6 +377,7 @@ struct TAdaptor_message : public TAdaptor { } virtual ~TAdaptor_message() = 0; + virtual void adaptor_do_MESSAGE(JStudio::data::TEOperationData, const void*, u32) = 0; }; struct TObject_message : public TObject { @@ -339,6 +395,13 @@ struct TAdaptor_particle : public TAdaptor { { } virtual ~TAdaptor_particle() = 0; + virtual void adaptor_do_prepare(const JStudio::TObject*) = 0; + virtual void adaptor_do_end(const JStudio::TObject*) = 0; + virtual void adaptor_do_update(const JStudio::TObject*, u32) = 0; + virtual void adaptor_do_PARTICLE(JStudio::data::TEOperationData, void const*, u32) = 0; + virtual void adaptor_do_PARENT(JStudio::data::TEOperationData, void const*, u32) = 0; + virtual void adaptor_do_PARENT_NODE(JStudio::data::TEOperationData, void const*, u32) = 0; + virtual void adaptor_do_PARENT_ENABLE(JStudio::data::TEOperationData, void const*, u32) = 0; /* 0x10 */ TVariableValue mValue[20]; diff --git a/include/JSystem/JStudio/JStudio_JStage/control.h b/include/JSystem/JStudio/JStudio_JStage/control.h index 761b7f426..e5f11118e 100644 --- a/include/JSystem/JStudio/JStudio_JStage/control.h +++ b/include/JSystem/JStudio/JStudio_JStage/control.h @@ -55,10 +55,34 @@ struct TAdaptor_object_ { /* 0x8 */ JStage::TObject* mObject; }; -struct TAdaptor_actor : public JStudio::TAdaptor_actor, public JStudio_JStage::TAdaptor_object_ { - struct TVVOutput_ANIMATION_FRAME_ { - void operator()(f32, JStudio::TAdaptor*) const; - ~TVVOutput_ANIMATION_FRAME_(); +struct TAdaptor_actor : public JStudio::TAdaptor_actor { + typedef void (JStage::TActor::*IDFunction)(u32); + typedef TVariableValueOutput_object_ TVVOutputObject; + + struct TVVOutput_ANIMATION_FRAME_ : public JStudio::TVariableValue::TOutput { + typedef void (JStage::TActor::*Setter)(f32); + typedef f32 (JStage::TActor::*Getter)() const; + typedef f32 (JStage::TActor::*MaxGetter)() const; + + TVVOutput_ANIMATION_FRAME_(int valueIndex, u32 val, Setter setter, Getter getter, MaxGetter maxGetter) + : TOutput() + , mValueIndex(valueIndex) + , _08(val) + , mSetter(setter) + , mGetter(getter) + , mMaxGetter(maxGetter) + { + } + + virtual void operator()(f32, JStudio::TAdaptor*) const; + inline virtual ~TVVOutput_ANIMATION_FRAME_(); + + // _00 = VTBL + int mValueIndex; // _04 + u32 _08; // _08 + Setter mSetter; // _0C + Getter mGetter; // _18 + MaxGetter mMaxGetter; // _24 }; TAdaptor_actor(JStage::TSystem const*, JStage::TActor*); @@ -72,7 +96,6 @@ struct TAdaptor_actor : public JStudio::TAdaptor_actor, public JStudio_JStage::T virtual void adaptor_do_PARENT(JStudio::data::TEOperationData, void const*, u32); virtual void adaptor_do_PARENT_NODE(JStudio::data::TEOperationData, void const*, u32); virtual void adaptor_do_PARENT_ENABLE(JStudio::data::TEOperationData, void const*, u32); - virtual void adaptor_do_PARENT_FUNCTION(JStudio::data::TEOperationData, void const*, u32); virtual void adaptor_do_RELATION(JStudio::data::TEOperationData, void const*, u32); virtual void adaptor_do_RELATION_NODE(JStudio::data::TEOperationData, void const*, u32); virtual void adaptor_do_RELATION_ENABLE(JStudio::data::TEOperationData, void const*, u32); @@ -84,13 +107,18 @@ struct TAdaptor_actor : public JStudio::TAdaptor_actor, public JStudio_JStage::T void setJSG_ID_(void (JStage::TActor::*)(u32), JStudio::data::TEOperationData, void const*, u32); - void setJSG_SRT_(JStudio::TControl const*); - void getJSG_SRT_(JStudio::TControl const*); - - static u8 saoVVOutput_[64]; - static u8 saoVVOutput_ANIMATION_FRAME_[144 + 4 /* padding */]; - /* 0x130 */ u8 field_0x130[0x144 - 0x130]; + static const TVVOutputObject saoVVOutput_[]; + static const TVVOutput_ANIMATION_FRAME_ saoVVOutput_ANIMATION_FRAME_[]; + + /* 0x124 */ const JStage::TSystem* mSystem; + /* 0x128 */ JStage::TActor* mObject; + /* 0x12C */ JStage::TObject* m12C; + /* 0x130 */ u32 m130; + /* 0x134 */ JStage::TObject* m134; + /* 0x138 */ u32 m138; + /* 0x13C */ u32 m13C; + /* 0x140 */ u32 m140; }; // Size: 0x144 struct TAdaptor_ambientLight : public JStudio::TAdaptor_ambientLight { diff --git a/src/JSystem/JStudio/JStudio/jstudio-object.cpp b/src/JSystem/JStudio/JStudio/jstudio-object.cpp index ec1d1fc43..2343e9041 100644 --- a/src/JSystem/JStudio/JStudio/jstudio-object.cpp +++ b/src/JSystem/JStudio/JStudio/jstudio-object.cpp @@ -64,19 +64,19 @@ void JStudio::TAdaptor::adaptor_setVariableValue(JStudio::TObject* pObject, u32 /* Nonmatching */ setVarFunc func; switch (param_3) { - case JStudio::data::UNK_0x1: + case JStudio::data::TEOD_Unknown_01: func = &adaptor_setVariableValue_VOID_; break; - case JStudio::data::UNK_0x2: + case JStudio::data::TEOD_Unknown_02: func = &adaptor_setVariableValue_IMMEDIATE_; break; - case JStudio::data::UNK_0x3: + case JStudio::data::TEOD_Unknown_03: func = &adaptor_setVariableValue_TIME_; break; - case JStudio::data::UNK_0x10: + case JStudio::data::TEOD_Unknown_10: func = &adaptor_setVariableValue_FVR_NAME_; break; - case JStudio::data::UNK_0x12: + case JStudio::data::TEOD_Unknown_12: func = &adaptor_setVariableValue_FVR_INDEX_; break; default: @@ -91,19 +91,19 @@ void JStudio::TAdaptor::adaptor_setVariableValue_n(JStudio::TObject* pObject, co setVarFunc pcVar6; u32 iVar7; switch(param_4) { - case JStudio::data::UNK_0x1: + case JStudio::data::TEOD_Unknown_01: iVar7 = 0; pcVar6 = adaptor_setVariableValue_VOID_; break; - case JStudio::data::UNK_0x2: + case JStudio::data::TEOD_Unknown_02: iVar7 = 4; pcVar6 = adaptor_setVariableValue_IMMEDIATE_; break; - case JStudio::data::UNK_0x3: + case JStudio::data::TEOD_Unknown_03: iVar7 = 4; pcVar6 = adaptor_setVariableValue_TIME_; break; - case JStudio::data::UNK_0x12: + case JStudio::data::TEOD_Unknown_12: iVar7 = 4; pcVar6 = adaptor_setVariableValue_FVR_INDEX_; break; diff --git a/src/JSystem/JStudio/JStudio_JAudio/object-sound.cpp b/src/JSystem/JStudio/JStudio_JAudio/object-sound.cpp index a04b0c6e6..c208dd532 100644 --- a/src/JSystem/JStudio/JStudio_JAudio/object-sound.cpp +++ b/src/JSystem/JStudio/JStudio_JAudio/object-sound.cpp @@ -69,7 +69,7 @@ void TAdaptor_sound::adaptor_do_update(const JStudio::TObject* object, u32) { /* 80278FB8-80279064 .text adaptor_do_SOUND__Q214JStudio_JAudio14TAdaptor_soundFQ37JStudio4data15TEOperationDataPCvUl */ void TAdaptor_sound::adaptor_do_SOUND(JStudio::data::TEOperationData op, const void* data, u32) { switch (op) { - case JStudio::data::UNK_0x19: + case JStudio::data::TEOD_Unknown_19: u32 flags = *(s32*)data; if (flags & 0xc0000000) { if (mpSound) { @@ -89,7 +89,7 @@ void TAdaptor_sound::adaptor_do_SOUND(JStudio::data::TEOperationData op, const v /* 80279064-8027908C .text adaptor_do_LOCATED__Q214JStudio_JAudio14TAdaptor_soundFQ37JStudio4data15TEOperationDataPCvUl */ void TAdaptor_sound::adaptor_do_LOCATED(JStudio::data::TEOperationData op, const void* data, u32 flag) { switch (op) { - case JStudio::data::UNK_0x2: + case JStudio::data::TEOD_Unknown_02: Vec* pos = *(Vec**)data; mPosition = NULL; if (!pos) diff --git a/src/JSystem/JStudio/JStudio_JMessage/object-message.cpp b/src/JSystem/JStudio/JStudio_JMessage/object-message.cpp index 30396253f..a51de71fe 100644 --- a/src/JSystem/JStudio/JStudio_JMessage/object-message.cpp +++ b/src/JSystem/JStudio/JStudio_JMessage/object-message.cpp @@ -19,7 +19,7 @@ JStudio_JMessage::TAdaptor_message::~TAdaptor_message() {} /* 8027A6AC-8027A6EC .text adaptor_do_MESSAGE__Q216JStudio_JMessage16TAdaptor_messageFQ37JStudio4data15TEOperationDataPCvUl */ void JStudio_JMessage::TAdaptor_message::adaptor_do_MESSAGE(JStudio::data::TEOperationData operation, const void* param_2, u32 param_3) { switch (operation) { - case JStudio::data::UNK_0x19: + case JStudio::data::TEOD_Unknown_19: mControl->setMessageCode(*(u32*)param_2); break; } diff --git a/src/JSystem/JStudio/JStudio_JParticle/object-particle.cpp b/src/JSystem/JStudio/JStudio_JParticle/object-particle.cpp index 65d2dbc7c..5fac53a0d 100644 --- a/src/JSystem/JStudio/JStudio_JParticle/object-particle.cpp +++ b/src/JSystem/JStudio/JStudio_JParticle/object-particle.cpp @@ -81,7 +81,7 @@ void TAdaptor_particle::adaptor_do_update(const JStudio::TObject* param_1, u32 p /* 80279C2C-80279C40 .text adaptor_do_PARTICLE__Q217JStudio_JParticle17TAdaptor_particleFQ37JStudio4data15TEOperationDataPCvUl */ void TAdaptor_particle::adaptor_do_PARTICLE(JStudio::data::TEOperationData operation, const void* r5, u32) { switch (operation) { - case JStudio::data::UNK_0x19: + case JStudio::data::TEOD_Unknown_19: _188 = *(int*)r5; break; } @@ -90,7 +90,7 @@ void TAdaptor_particle::adaptor_do_PARTICLE(JStudio::data::TEOperationData opera /* 80279C40-80279CA4 .text adaptor_do_PARENT__Q217JStudio_JParticle17TAdaptor_particleFQ37JStudio4data15TEOperationDataPCvUl */ void TAdaptor_particle::adaptor_do_PARENT(JStudio::data::TEOperationData operation, const void* param_2, u32) { switch (operation) { - case JStudio::data::UNK_0x18: + case JStudio::data::TEOD_Unknown_18: if (mSystem != NULL) { _19C = (JStage::TObject*)mSystem->JSGFindObject((const char*)param_2, JStage::TOBJ_ACTOR_UNK); if (_19C == 0) { @@ -105,7 +105,7 @@ void TAdaptor_particle::adaptor_do_PARENT(JStudio::data::TEOperationData operati /* 80279CA4-80279D24 .text adaptor_do_PARENT_NODE__Q217JStudio_JParticle17TAdaptor_particleFQ37JStudio4data15TEOperationDataPCvUl */ void TAdaptor_particle::adaptor_do_PARENT_NODE(JStudio::data::TEOperationData operation, const void* param_2, u32) { switch (operation) { - case JStudio::data::UNK_0x18: + case JStudio::data::TEOD_Unknown_18: if (_19C != NULL) { _1A0 = _19C->JSGFindNodeID((const char*)param_2); if (_1A0 == 0xFFFFFFFF) { @@ -113,7 +113,7 @@ void TAdaptor_particle::adaptor_do_PARENT_NODE(JStudio::data::TEOperationData op } } break; - case JStudio::data::UNK_0x19: + case JStudio::data::TEOD_Unknown_19: _1A0 = *(u32*)param_2; break; } @@ -122,7 +122,7 @@ void TAdaptor_particle::adaptor_do_PARENT_NODE(JStudio::data::TEOperationData op /* 80279D24-80279D40 .text adaptor_do_PARENT_ENABLE__Q217JStudio_JParticle17TAdaptor_particleFQ37JStudio4data15TEOperationDataPCvUl */ void TAdaptor_particle::adaptor_do_PARENT_ENABLE(JStudio::data::TEOperationData operation, const void* param_2, u32 param_3) { switch (operation) { - case JStudio::data::UNK_0x2: + case JStudio::data::TEOD_Unknown_02: _1A4 = *(u32*)param_2; break; } diff --git a/src/JSystem/JStudio/JStudio_JStage/object-actor.cpp b/src/JSystem/JStudio/JStudio_JStage/object-actor.cpp index eba6ab64f..c238ed030 100644 --- a/src/JSystem/JStudio/JStudio_JStage/object-actor.cpp +++ b/src/JSystem/JStudio/JStudio_JStage/object-actor.cpp @@ -6,107 +6,251 @@ #include "JSystem/JStudio/JStudio_JStage/object-actor.h" #include "dolphin/types.h" +namespace JStudio_JStage { + /* 80276264-80276318 .text __ct__Q214JStudio_JStage14TAdaptor_actorFPCQ26JStage7TSystemPQ26JStage6TActor */ -JStudio_JStage::TAdaptor_actor::TAdaptor_actor(const JStage::TSystem*, JStage::TActor*) { - /* Nonmatching */ +TAdaptor_actor::TAdaptor_actor(const JStage::TSystem* system, JStage::TActor* actor) + : JStudio::TAdaptor_actor() + , mSystem(system) + , mObject(actor) + , m12C(NULL) + , m130(0xFFFFFFFF) + , m134(NULL) + , m138(0xFFFFFFFF) + , m13C(0) + , m140(0) +{ } /* 80276318-80276390 .text __dt__Q214JStudio_JStage14TAdaptor_actorFv */ -JStudio_JStage::TAdaptor_actor::~TAdaptor_actor() { - /* Nonmatching */ +TAdaptor_actor::~TAdaptor_actor() { + adaptor_do_end(NULL); } /* 80276390-8027641C .text adaptor_do_prepare__Q214JStudio_JStage14TAdaptor_actorFPCQ27JStudio7TObject */ -void JStudio_JStage::TAdaptor_actor::adaptor_do_prepare(const JStudio::TObject*) { - /* Nonmatching */ +void TAdaptor_actor::adaptor_do_prepare(const JStudio::TObject* object) { + for (const TVVOutputObject* output = saoVVOutput_; output->mValueIndex != -1; output++) { + mVariableValues[output->mValueIndex].setOutput(output); + } + for (const TVVOutput_ANIMATION_FRAME_* output = saoVVOutput_ANIMATION_FRAME_; output->mValueIndex != -1; output++) { + mVariableValues[output->mValueIndex].setOutput(output); + } } /* 8027641C-80276600 .text adaptor_do_begin__Q214JStudio_JStage14TAdaptor_actorFPCQ27JStudio7TObject */ -void JStudio_JStage::TAdaptor_actor::adaptor_do_begin(const JStudio::TObject*) { - /* Nonmatching */ +void TAdaptor_actor::adaptor_do_begin(const JStudio::TObject* object) { + mObject->JSGFEnableFlag(1); + + const JStudio::TControl* pControl = object->getControl(); + Vec sp2C[2]; + Vec sp14[2]; + Vec sp08; + mObject->JSGGetTranslation(&sp2C[0]); + mObject->JSGGetRotation(&sp2C[1]); + mObject->JSGGetScaling(&sp08); + Vec* r29; + if (!pControl->transformOnGet_isEnabled()) { + r29 = sp2C; + } else { + MTXMultVec(pControl->transformOnGet_getMatrix(), &sp2C[0], &sp14[0]); + sp14[1].x = sp2C[1].x; + sp14[1].y = sp2C[1].y + pControl->field_0xa8; + sp14[1].z = sp2C[1].z; + r29 = sp14; + } + adaptor_setVariableValue_Vec(sauVariableValue_3_TRANSLATION_XYZ, r29[0]); + adaptor_setVariableValue_Vec(sauVariableValue_3_ROTATION_XYZ, r29[1]); + adaptor_setVariableValue_Vec(sauVariableValue_3_SCALING_XYZ, sp08); + + for (const TVVOutputObject* output = saoVVOutput_; output->mValueIndex != -1; output++) { + mVariableValues[output->mValueIndex].setValue_immediate((mObject->*(output->mGetter))()); + } + for (const TVVOutput_ANIMATION_FRAME_* output = saoVVOutput_ANIMATION_FRAME_; output->mValueIndex != -1; output++) { + mVariableValues[output->mValueIndex].setValue_immediate((mObject->*(output->mGetter))()); + } } /* 80276600-80276654 .text adaptor_do_end__Q214JStudio_JStage14TAdaptor_actorFPCQ27JStudio7TObject */ -void JStudio_JStage::TAdaptor_actor::adaptor_do_end(const JStudio::TObject*) { - /* Nonmatching */ +void TAdaptor_actor::adaptor_do_end(const JStudio::TObject* object) { + mObject->JSGFDisableFlag(1); } /* 80276654-80276750 .text adaptor_do_update__Q214JStudio_JStage14TAdaptor_actorFPCQ27JStudio7TObjectUl */ -void JStudio_JStage::TAdaptor_actor::adaptor_do_update(const JStudio::TObject*, u32) { - /* Nonmatching */ +void TAdaptor_actor::adaptor_do_update(const JStudio::TObject* object, u32 p2) { + const JStudio::TControl* pControl = object->getControl(); + Vec sp2C[2]; + Vec sp14[2]; + Vec sp08; + adaptor_getVariableValue_Vec(&sp2C[0], sauVariableValue_3_TRANSLATION_XYZ); + adaptor_getVariableValue_Vec(&sp2C[1], sauVariableValue_3_ROTATION_XYZ); + adaptor_getVariableValue_Vec(&sp08, sauVariableValue_3_SCALING_XYZ); + Vec* r31; + if (!pControl->transformOnSet_isEnabled()) { + r31 = sp2C; + } else { + MTXMultVec(pControl->transformOnSet_getMatrix(), &sp2C[0], &sp14[0]); + sp14[1].x = sp2C[1].x; + sp14[1].y = sp2C[1].y + pControl->transformOnSet_getRotationY(); + sp14[1].z = sp2C[1].z; + r31 = sp14; + } + mObject->JSGSetTranslation(r31[0]); + mObject->JSGSetRotation(r31[1]); + mObject->JSGSetScaling(sp08); } /* 80276750-80276784 .text adaptor_do_data__Q214JStudio_JStage14TAdaptor_actorFPCQ27JStudio7TObjectPCvUlPCvUl */ -void JStudio_JStage::TAdaptor_actor::adaptor_do_data(const JStudio::TObject*, const void*, u32, const void*, u32) { - /* Nonmatching */ +void TAdaptor_actor::adaptor_do_data(const JStudio::TObject* object, const void* p2, u32 p3, const void* p4, u32 p5) { + TAdaptor_object_::adaptor_data_(mObject, p2, p3, p4, p5); } /* 80276784-802767DC .text adaptor_do_SHAPE__Q214JStudio_JStage14TAdaptor_actorFQ37JStudio4data15TEOperationDataPCvUl */ -void JStudio_JStage::TAdaptor_actor::adaptor_do_SHAPE(JStudio::data::TEOperationData, const void*, u32) { - /* Nonmatching */ +void TAdaptor_actor::adaptor_do_SHAPE(JStudio::data::TEOperationData operation, const void* p2, u32 p3) { + setJSG_ID_(&JStage::TActor::JSGSetShape, operation, p2, p3); } /* 802767DC-80276834 .text adaptor_do_ANIMATION__Q214JStudio_JStage14TAdaptor_actorFQ37JStudio4data15TEOperationDataPCvUl */ -void JStudio_JStage::TAdaptor_actor::adaptor_do_ANIMATION(JStudio::data::TEOperationData, const void*, u32) { - /* Nonmatching */ +void TAdaptor_actor::adaptor_do_ANIMATION(JStudio::data::TEOperationData operation, const void* p2, u32 p3) { + setJSG_ID_(&JStage::TActor::JSGSetAnimation, operation, p2, p3); } /* 80276834-80276848 .text adaptor_do_ANIMATION_MODE__Q214JStudio_JStage14TAdaptor_actorFQ37JStudio4data15TEOperationDataPCvUl */ -void JStudio_JStage::TAdaptor_actor::adaptor_do_ANIMATION_MODE(JStudio::data::TEOperationData, const void*, u32) { - /* Nonmatching */ +void TAdaptor_actor::adaptor_do_ANIMATION_MODE(JStudio::data::TEOperationData operation, const void* p2, u32 p3) { + if (operation != JStudio::data::TEOD_Unknown_02) { + return; + } + m13C = *(u32*)p2; } /* 80276848-802768A0 .text adaptor_do_TEXTURE_ANIMATION__Q214JStudio_JStage14TAdaptor_actorFQ37JStudio4data15TEOperationDataPCvUl */ -void JStudio_JStage::TAdaptor_actor::adaptor_do_TEXTURE_ANIMATION(JStudio::data::TEOperationData, const void*, u32) { - /* Nonmatching */ +void TAdaptor_actor::adaptor_do_TEXTURE_ANIMATION(JStudio::data::TEOperationData operation, const void* p2, u32 p3) { + setJSG_ID_(&JStage::TActor::JSGSetTextureAnimation, operation, p2, p3); } /* 802768A0-802768B4 .text adaptor_do_TEXTURE_ANIMATION_MODE__Q214JStudio_JStage14TAdaptor_actorFQ37JStudio4data15TEOperationDataPCvUl */ -void JStudio_JStage::TAdaptor_actor::adaptor_do_TEXTURE_ANIMATION_MODE(JStudio::data::TEOperationData, const void*, u32) { - /* Nonmatching */ +void TAdaptor_actor::adaptor_do_TEXTURE_ANIMATION_MODE(JStudio::data::TEOperationData operation, const void* p2, u32 p3) { + if (operation != JStudio::data::TEOD_Unknown_02) { + return; + } + m140 = *(u32*)p2; } /* 802768B4-80276908 .text adaptor_do_PARENT__Q214JStudio_JStage14TAdaptor_actorFQ37JStudio4data15TEOperationDataPCvUl */ -void JStudio_JStage::TAdaptor_actor::adaptor_do_PARENT(JStudio::data::TEOperationData, const void*, u32) { - /* Nonmatching */ +void TAdaptor_actor::adaptor_do_PARENT(JStudio::data::TEOperationData operation, const void* p2, u32 p3) { + switch (operation) { + case JStudio::data::TEOD_Unknown_18: + m12C = (JStage::TObject*)mSystem->JSGFindObject((const char*)p2, JStage::TOBJ_ACTOR_UNK); + break; + } } /* 80276908-80276978 .text adaptor_do_PARENT_NODE__Q214JStudio_JStage14TAdaptor_actorFQ37JStudio4data15TEOperationDataPCvUl */ -void JStudio_JStage::TAdaptor_actor::adaptor_do_PARENT_NODE(JStudio::data::TEOperationData, const void*, u32) { - /* Nonmatching */ +void TAdaptor_actor::adaptor_do_PARENT_NODE(JStudio::data::TEOperationData operation, const void* p2, u32 p3) { + switch (operation) { + case JStudio::data::TEOD_Unknown_18: + if (m12C) { + m130 = m12C->JSGFindNodeID((const char*)p2); + } + break; + case JStudio::data::TEOD_Unknown_19: + m130 = *(u32*)p2; + break; + } } /* 80276978-802769D4 .text adaptor_do_PARENT_ENABLE__Q214JStudio_JStage14TAdaptor_actorFQ37JStudio4data15TEOperationDataPCvUl */ -void JStudio_JStage::TAdaptor_actor::adaptor_do_PARENT_ENABLE(JStudio::data::TEOperationData, const void*, u32) { - /* Nonmatching */ +void TAdaptor_actor::adaptor_do_PARENT_ENABLE(JStudio::data::TEOperationData operation, const void* p2, u32 p3) { + switch (operation) { + case JStudio::data::TEOD_Unknown_02: + bool v0 = (*(u32*)p2 != 0); + JStage::TObject* object = NULL; + u32 v1 = 0xFFFFFFFF; + if (v0 != 0) { + object = m12C; + v1 = m130; + } + mObject->JSGSetParent(object, v1); + } } /* 802769D4-80276A28 .text adaptor_do_RELATION__Q214JStudio_JStage14TAdaptor_actorFQ37JStudio4data15TEOperationDataPCvUl */ -void JStudio_JStage::TAdaptor_actor::adaptor_do_RELATION(JStudio::data::TEOperationData, const void*, u32) { - /* Nonmatching */ +void TAdaptor_actor::adaptor_do_RELATION(JStudio::data::TEOperationData operation, const void* p2, u32 p3) { + switch (operation) { + case JStudio::data::TEOD_Unknown_18: + m134 = (JStage::TObject*)mSystem->JSGFindObject((const char*)p2, JStage::TOBJ_ACTOR_UNK); + break; + } } /* 80276A28-80276A98 .text adaptor_do_RELATION_NODE__Q214JStudio_JStage14TAdaptor_actorFQ37JStudio4data15TEOperationDataPCvUl */ -void JStudio_JStage::TAdaptor_actor::adaptor_do_RELATION_NODE(JStudio::data::TEOperationData, const void*, u32) { - /* Nonmatching */ +void TAdaptor_actor::adaptor_do_RELATION_NODE(JStudio::data::TEOperationData operation, const void* p2, u32 p3) { + switch (operation) { + case JStudio::data::TEOD_Unknown_18: + if (m134) { + m138 = m134->JSGFindNodeID((const char*)p2); + } + break; + case JStudio::data::TEOD_Unknown_19: + m138 = *(u32*)p2; + break; + } } /* 80276A98-80276AF0 .text adaptor_do_RELATION_ENABLE__Q214JStudio_JStage14TAdaptor_actorFQ37JStudio4data15TEOperationDataPCvUl */ -void JStudio_JStage::TAdaptor_actor::adaptor_do_RELATION_ENABLE(JStudio::data::TEOperationData, const void*, u32) { - /* Nonmatching */ +void TAdaptor_actor::adaptor_do_RELATION_ENABLE(JStudio::data::TEOperationData operation, const void* p2, u32 p3) { + switch (operation) { + case JStudio::data::TEOD_Unknown_02: + mObject->JSGSetRelation(*(u32*)p2, m134, m138); + break; + } } /* 80276AF0-80276B2C .text setJSG_ID___Q214JStudio_JStage14TAdaptor_actorFMQ26JStage6TActorFPCvPvUl_vQ37JStudio4data15TEOperationDataPCvUl */ -void JStudio_JStage::TAdaptor_actor::setJSG_ID_(void (JStage::TActor::*)(u32), JStudio::data::TEOperationData, const void*, u32) { - /* Nonmatching */ +void TAdaptor_actor::setJSG_ID_(IDFunction function, JStudio::data::TEOperationData operation, const void* p3, u32 p4) { + switch (operation) { + case JStudio::data::TEOD_Unknown_19: + (mObject->*function)(*(u32*)p3); + break; + } } /* 80276B2C-80276C00 .text __cl__Q314JStudio_JStage14TAdaptor_actor26TVVOutput_ANIMATION_FRAME_CFfPQ27JStudio8TAdaptor */ -void JStudio_JStage::TAdaptor_actor::TVVOutput_ANIMATION_FRAME_::operator()(f32, JStudio::TAdaptor*) const { - /* Nonmatching */ +void TAdaptor_actor::TVVOutput_ANIMATION_FRAME_::operator()(f32 p1, JStudio::TAdaptor* adaptor) const { + JStage::TActor* actor = static_cast(adaptor)->mObject; + // not sure what this bit is + u32 idx = *(u32*)(((u32)adaptor - 1) + _08); + + u8 idx_lowBytes = idx; + u8 idx_highBytes = idx >> 8; + + f32 maxVal = (actor->*mMaxGetter)(); + switch (idx_highBytes) { + case 1: + p1 = maxVal - p1; + break; + case 0: + break; + } + + if (maxVal > 0.0f) { + p1 = (f32)(*JStudio::TFunctionValue::toFunction_outside(idx_lowBytes))(p1, maxVal); + } + (actor->*mSetter)(p1); } /* 80276C00-80276C60 .text __dt__Q314JStudio_JStage14TAdaptor_actor26TVVOutput_ANIMATION_FRAME_Fv */ -JStudio_JStage::TAdaptor_actor::TVVOutput_ANIMATION_FRAME_::~TVVOutput_ANIMATION_FRAME_() { - /* Nonmatching */ +TAdaptor_actor::TVVOutput_ANIMATION_FRAME_::~TVVOutput_ANIMATION_FRAME_() { } + +const TAdaptor_actor::TVVOutputObject TAdaptor_actor::saoVVOutput_[] = { + TVVOutputObject(1, &JStage::TActor::JSGSetAnimationTransition, &JStage::TActor::JSGGetAnimationTransition), + TVVOutputObject(-1, NULL, NULL) +}; + +const TAdaptor_actor::TVVOutput_ANIMATION_FRAME_ TAdaptor_actor::saoVVOutput_ANIMATION_FRAME_[] = { + TVVOutput_ANIMATION_FRAME_(0, 317, &JStage::TActor::JSGSetAnimationFrame, &JStage::TActor::JSGGetAnimationFrame, &JStage::TActor::JSGGetAnimationFrameMax), + TVVOutput_ANIMATION_FRAME_(2, 321, &JStage::TActor::JSGSetTextureAnimationFrame, &JStage::TActor::JSGGetTextureAnimationFrame, &JStage::TActor::JSGGetTextureAnimationFrameMax), + TVVOutput_ANIMATION_FRAME_(-1, 0, NULL, NULL, NULL) +}; + +} // namespace JStudio_JStage diff --git a/src/JSystem/JStudio/JStudio_JStage/object.cpp b/src/JSystem/JStudio/JStudio_JStage/object.cpp index 0286ece13..e2d29898d 100644 --- a/src/JSystem/JStudio/JStudio_JStage/object.cpp +++ b/src/JSystem/JStudio/JStudio_JStage/object.cpp @@ -14,7 +14,7 @@ void JStudio_JStage::TAdaptor_object_::adaptor_data_(JStage::TObject* object, co /* 802761D0-80276264 .text adaptor_ENABLE___Q214JStudio_JStage16TAdaptor_object_FPQ26JStage7TObjectQ37JStudio4data15TEOperationDataPCvUl */ void JStudio_JStage::TAdaptor_object_::adaptor_ENABLE_(JStage::TObject* object, JStudio::data::TEOperationData op, const void* data, u32) { switch (op) { - case JStudio::data::UNK_0x2: + case JStudio::data::TEOD_Unknown_02: if ((*(u32*)data) != 0) { object->JSGFEnableFlag(2); } else {