diff --git a/configure.py b/configure.py index 4899af805..dac79c77c 100755 --- a/configure.py +++ b/configure.py @@ -578,7 +578,7 @@ config.libs = [ Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/actor/d_a_bomb2.cpp"), Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/actor/d_a_boomerang.cpp"), Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/actor/d_a_dai_item.cpp"), - Object(NonMatching, "d/actor/d_a_demo00.cpp"), + Object(Matching, "d/actor/d_a_demo00.cpp"), Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/actor/d_a_disappear.cpp"), Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/actor/d_a_esa.cpp"), Object(NonMatching, "d/actor/d_a_grid.cpp"), diff --git a/include/JSystem/J3DGraphAnimator/J3DModel.h b/include/JSystem/J3DGraphAnimator/J3DModel.h index 20d4d8027..5619c0682 100644 --- a/include/JSystem/J3DGraphAnimator/J3DModel.h +++ b/include/JSystem/J3DGraphAnimator/J3DModel.h @@ -136,6 +136,7 @@ public: void setUserArea(u32 area) { mUserArea = area; } u32 getUserArea() const { return mUserArea; } void setVisibilityManager(J3DVisibilityManager* manager) { mpVisibilityManager = manager; } + J3DSkinDeform* getSkinDeform() { return mpSkinDeform; } private: /* 0x000 */ /* vtable */ diff --git a/include/d/actor/d_a_demo00.h b/include/d/actor/d_a_demo00.h index 6e64141ce..eb66351c2 100644 --- a/include/d/actor/d_a_demo00.h +++ b/include/d/actor/d_a_demo00.h @@ -2,6 +2,7 @@ #define D_A_DEMO00_H #include "f_op/f_op_actor.h" +#include "d/d_bg_s_gnd_chk.h" class dDemo_actor_c; class mDoExt_McaMorf; @@ -16,11 +17,11 @@ class dBgS_GndChk; class daDemo00_shadow_c { public: #if VERSION > VERSION_DEMO - /* 0x00 */ u32 shadowID; + /* 0x00 */ u32 mShadowID; #endif - /* 0x04 */ cXyz pos; - /* 0x10 */ f32 field_0x10; - /* 0x14 */ f32 field_0x14; + /* 0x04 */ cXyz mPos; + /* 0x10 */ f32 mCasterSize; + /* 0x14 */ f32 mSimpleScale; }; class daDemo00_resID_c { @@ -28,16 +29,22 @@ public: void reset(); public: - /* 0x00 */ u32 modelID; - /* 0x04 */ s32 bckID; - /* 0x08 */ s32 field_0x08; - /* 0x0C */ s32 btpID; - /* 0x10 */ s32 btkID; - /* 0x14 */ s32 brkID; - /* 0x18 */ s32 field_0x18; - /* 0x1C */ s32 field_0x1C; - /* 0x20 */ u32 plightID; - /* 0x24 */ s32 shadowID; + /* 0x00 */ u32 mShapeID; + /* 0x04 */ u32 mBckID; + /* 0x08 */ u32 field_0x08; + /* 0x0C */ u32 mBtpID; + /* 0x10 */ u32 mBtkID; + /* 0x14 */ u32 mBrkID; + /* 0x18 */ u32 field_0x18; + /* 0x1C */ u32 field_0x1C; + /* 0x20 */ u32 mPlightID; + /* 0x24 */ u32 mShadowID; +}; + +class daDemo00_bgc_c { +public: + /* 0x00 */ dBgS_GndChk mGndChk; + /* 0x54 */ f32 mGroundY; }; class daDemo00_model_c { @@ -45,19 +52,17 @@ public: void reset(); public: - /* 0x00 */ daDemo00_resID_c resID; - /* 0x28 */ mDoExt_McaMorf* morf; - /* 0x2C */ J3DModel* model; - /* 0x30 */ mDoExt_invisibleModel* invisibleModel; - /* 0x34 */ mDoExt_btpAnm* btpAnm; - /* 0x38 */ mDoExt_btkAnm* btkAnm; - /* 0x3C */ mDoExt_brkAnm* brkAnm; - /* 0x40 */ void * field_0x40; - /* 0x44 */ daDemo00_shadow_c* shadow; - /* 0x48 */ DEMO_PLIGHT* plight; -}; - -class daDemo00_bgc_c { + /* 0x00 */ daDemo00_resID_c mID; + /* 0x28 */ mDoExt_McaMorf* mpMorf; + /* 0x2C */ J3DModel* mpModel; + /* 0x30 */ mDoExt_invisibleModel* mpInvisibleModel; + /* 0x34 */ mDoExt_btpAnm* mpBtpAnm; + /* 0x38 */ mDoExt_btkAnm* mpBtkAnm; + /* 0x3C */ mDoExt_brkAnm* mpBrkAnm; + /* 0x40 */ void* field_0x40; + /* 0x44 */ daDemo00_shadow_c* mpShadow; + /* 0x48 */ DEMO_PLIGHT* mpPlight; + /* 0x4C */ daDemo00_bgc_c* mBgc; }; class daDemo00_c : public fopAc_ac_c { @@ -68,8 +73,8 @@ public: typedef BOOL (daDemo00_c::*ActionFunc)(dDemo_actor_c* act); - BOOL action(dDemo_actor_c* act) { return (this->*actionFunc)(act); } - void setAction(ActionFunc func) { actionFunc = func; } + BOOL action(dDemo_actor_c* act) { return (this->*mActionFunc)(act); } + void setAction(ActionFunc func) { mActionFunc = func; } void setBaseMtx(); void setShadowSize(); @@ -82,14 +87,13 @@ public: inline BOOL execute(); public: - /* 0x290 */ ActionFunc actionFunc; + /* 0x290 */ ActionFunc mActionFunc; /* 0x29C */ u8 field_0x29c; /* 0x29D */ s8 field_0x29d; /* 0x29E */ u8 field_0x29e; /* 0x29F */ u8 field_0x29f; - /* 0x2A0 */ daDemo00_resID_c nextRes; - /* 0x2C8 */ daDemo00_model_c model; - /* 0x314 */ dBgS_GndChk* chk; + /* 0x2A0 */ daDemo00_resID_c mNextID; + /* 0x2C8 */ daDemo00_model_c mModel; }; #endif /* D_A_DEMO00_H */ diff --git a/include/d/d_kankyo_demo.h b/include/d/d_kankyo_demo.h index 662099633..a45d104b6 100644 --- a/include/d/d_kankyo_demo.h +++ b/include/d/d_kankyo_demo.h @@ -13,6 +13,6 @@ struct DEMO_PLIGHT { void dKydm_demo_plight_entry(DEMO_PLIGHT* i_plight, cXyz* i_pos, int param_2, u8 param_3); void dKydm_demo_plight_delete(DEMO_PLIGHT* i_plight); -void dKydm_demo_plight_execute(DEMO_PLIGHT* i_plight); +void dKydm_demo_plight_execute(DEMO_PLIGHT* i_plight, cXyz* i_pos); #endif /* D_KANKYO_DEMO_H */ diff --git a/include/m_Do/m_Do_ext.h b/include/m_Do/m_Do_ext.h index 01bd0b122..5a9cc007d 100644 --- a/include/m_Do/m_Do_ext.h +++ b/include/m_Do/m_Do_ext.h @@ -531,6 +531,8 @@ private: class mDoExt_invisibleModel { public: + mDoExt_invisibleModel() {} + BOOL create(J3DModel*); void entry(); diff --git a/src/d/actor/d_a_demo00.cpp b/src/d/actor/d_a_demo00.cpp index edcd1f013..c1685e422 100644 --- a/src/d/actor/d_a_demo00.cpp +++ b/src/d/actor/d_a_demo00.cpp @@ -25,42 +25,60 @@ #include "JSystem/J3DGraphAnimator/J3DModelData.h" #include "string.h" -static void dummy() { - OSReport("V_24_tri_joint"); +struct light_data_s { + /* 0x00 */ bool useJoint; + /* 0x01 */ u8 m01; + /* 0x04 */ const char* jointName; +}; +static light_data_s l_lightData[] = { + {true, 1, "V_24_tri_joint"}, + {false, 1, NULL}, + {false, 1, NULL}, +}; + +BOOL daDemo00_c::create() { + fopAcM_ct(this, daDemo00_c); + dKy_tevstr_init(&tevStr, dComIfGp_roomControl_getStayNo(), 0xFF); + setAction(&daDemo00_c::actStandby); + mNextID.reset(); +#if VERSION > VERSION_DEMO + field_0x29d = -1; +#endif + return cPhs_COMPLEATE_e; } /* 800E595C-800E598C .text reset__16daDemo00_resID_cFv */ void daDemo00_resID_c::reset() { - modelID = -1; - bckID = -1; + mShapeID = -1; + mBckID = -1; field_0x08 = -1; - btpID = -1; - btkID = -1; - brkID = -1; + mBtpID = -1; + mBtkID = -1; + mBrkID = -1; field_0x18 = -1; field_0x1C = -1; - plightID = -1; - shadowID = -1; + mPlightID = -1; + mShadowID = -1; } /* 800E598C-800E59EC .text reset__16daDemo00_model_cFv */ void daDemo00_model_c::reset() { - resID.reset(); - model = NULL; - btpAnm = NULL; - btkAnm = NULL; - brkAnm = NULL; - if (plight != NULL) { - dKydm_demo_plight_delete(plight); - plight = NULL; + mID.reset(); + mpModel = NULL; + mpBtpAnm = NULL; + mpBtkAnm = NULL; + mpBrkAnm = NULL; + if (mpPlight != NULL) { + dKydm_demo_plight_delete(mpPlight); + mpPlight = NULL; } - shadow = NULL; + mpShadow = NULL; } #if VERSION > VERSION_DEMO daDemo00_c::~daDemo00_c() { - if (heap != NULL && model.morf != NULL) { - model.morf->stopZelAnime(); + if (heap != NULL && mModel.mpMorf != NULL) { + mModel.mpMorf->stopZelAnime(); } } #endif @@ -69,14 +87,14 @@ daDemo00_c::~daDemo00_c() { void daDemo00_c::setBaseMtx() { mDoMtx_stack_c::transS(current.pos); mDoMtx_stack_c::XYZrotM(shape_angle); - model.model->setBaseTRMtx(mDoMtx_stack_c::get()); - model.model->setBaseScale(scale); - model.model->calc(); + mModel.mpModel->setBaseTRMtx(mDoMtx_stack_c::get()); + mModel.mpModel->setBaseScale(scale); + mModel.mpModel->calc(); } /* 800E5AFC-800E5DEC .text setShadowSize__10daDemo00_cFv */ void daDemo00_c::setShadowSize() { - J3DModelData* modelData = model.model->getModelData(); + J3DModelData* modelData = mModel.mpModel->getModelData(); cXyz min(100000000.0f, 100000000.0f, 100000000.0f); cXyz max(-100000000.0f, -100000000.0f, -100000000.0f); @@ -87,8 +105,8 @@ void daDemo00_c::setShadowSize() { cXyz jntMin; cXyz jntMax; - mDoMtx_multVec(model.model->getAnmMtx(i), joint->getMin(), &jntMin); - mDoMtx_multVec(model.model->getAnmMtx(i), joint->getMax(), &jntMax); + mDoMtx_multVec(mModel.mpModel->getAnmMtx(i), joint->getMin(), &jntMin); + mDoMtx_multVec(mModel.mpModel->getAnmMtx(i), joint->getMax(), &jntMax); min.x = jntMin.x < min.x ? jntMin.x : min.x; min.y = jntMin.y < min.y ? jntMin.y : min.y; min.z = jntMin.z < min.z ? jntMin.z : min.z; @@ -98,13 +116,13 @@ void daDemo00_c::setShadowSize() { } } - model.shadow->pos.x = (max.x + min.x) * 0.5f; - model.shadow->pos.y = (max.y + min.y) * 0.5f; - model.shadow->pos.z = (max.z + min.z) * 0.5f; + mModel.mpShadow->mPos.x = (max.x + min.x) * 0.5f; + mModel.mpShadow->mPos.y = (max.y + min.y) * 0.5f; + mModel.mpShadow->mPos.z = (max.z + min.z) * 0.5f; cXyz extents = max - min; - model.shadow->field_0x10 = extents.abs() * 3.0f; - model.shadow->field_0x14 = extents.absXZ() * 0.25f; + mModel.mpShadow->mCasterSize = extents.abs() * 3.0f; + mModel.mpShadow->mSimpleScale = extents.absXZ() * 0.25f; } /* 800E5DEC-800E5FF4 .text awaCheck__FP8J3DModel */ @@ -149,24 +167,144 @@ static BOOL createHeapCallBack(fopAc_ac_c* i_this) { /* 800E6014-800E6620 .text createHeap__10daDemo00_cFv */ BOOL daDemo00_c::createHeap() { - /* Nonmatching */ - J3DModelData* modelData; - JUT_ASSERT(0, modelData != NULL); - void* anm; - JUT_ASSERT(0, anm != NULL); + if (mModel.mID.mShapeID != -1) { + J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectIDRes(dStage_roomControl_c::getDemoArcName(), (u16)mModel.mID.mShapeID); + JUT_ASSERT(DEMO_SELECT(217, 236), modelData != NULL); + u32 r28 = 0x11000002; + + if (mModel.mID.mBtpID != -1) { + mModel.mpBtpAnm = new mDoExt_btpAnm(); + if (mModel.mpBtpAnm == NULL) { + return FALSE; + } + J3DAnmTexPattern* anm = (J3DAnmTexPattern*)dComIfG_getObjectIDRes(dStage_roomControl_c::getDemoArcName(), (u16)mModel.mID.mBtpID); + if (anm == NULL) { + return TRUE; + } + if (mModel.mpBtpAnm->init(modelData, anm, TRUE, J3DFrameCtrl::EMode_NULL) == 0) { + return FALSE; + } else { + r28 |= 0x04020000; + } + } + + if (mModel.mID.mBtkID != -1) { + mModel.mpBtkAnm = new mDoExt_btkAnm(); + if (mModel.mpBtkAnm == NULL) { + return FALSE; + } + J3DAnmTextureSRTKey* anm = (J3DAnmTextureSRTKey*)dComIfG_getObjectIDRes(dStage_roomControl_c::getDemoArcName(), (u16)mModel.mID.mBtkID); + if (anm == NULL) { + return TRUE; + } + if (mModel.mpBtkAnm->init(modelData, anm, TRUE, J3DFrameCtrl::EMode_NULL) == 0) { + return FALSE; +#if VERSION > VERSION_DEMO + } else if (mModel.mID.mBtkID & 0x10000000) { + r28 |= 0x1200; +#endif + } else { + r28 |= 0x200; + } + } + + if (mModel.mID.mBrkID != -1) { + mModel.mpBrkAnm = new mDoExt_brkAnm(); + if (mModel.mpBrkAnm == NULL) { + return FALSE; + } + J3DAnmTevRegKey* anm = (J3DAnmTevRegKey*)dComIfG_getObjectIDRes(dStage_roomControl_c::getDemoArcName(), (u16)mModel.mID.mBrkID); + if (anm == NULL) { + return TRUE; + } + if (mModel.mpBrkAnm->init(modelData, anm, TRUE, J3DFrameCtrl::EMode_NULL) == 0) { + return FALSE; + } + } + + if (mModel.mID.mBckID == -1) { + mModel.mpMorf = NULL; + mModel.mpModel = mDoExt_J3DModel__create(modelData, 0x80000, r28); + if (mModel.mpModel == NULL) { + return FALSE; + } + } else { + J3DAnmTransformKey* anm = (J3DAnmTransformKey*)dComIfG_getObjectIDRes(dStage_roomControl_c::getDemoArcName(), (u16)mModel.mID.mBckID); + JUT_ASSERT(DEMO_SELECT(304, 328), anm != NULL); + mModel.mpMorf = new mDoExt_McaMorf( + modelData, + NULL, + NULL, + anm, + J3DFrameCtrl::EMode_NULL, + 1.0f, + 0, + -1, + 1, + NULL, + 0x80000, + r28 + ); + if (mModel.mpMorf == NULL || mModel.mpMorf->getModel() == NULL) { + return FALSE; + } + mModel.mpModel = mModel.mpMorf->getModel(); + if (!awaCheck(mModel.mpModel)) { + return FALSE; + } + } + + if (field_0x29c == 3) { + mModel.mpInvisibleModel = new mDoExt_invisibleModel(); + if (mModel.mpInvisibleModel == NULL) { + return FALSE; + } + if (!mModel.mpInvisibleModel->create(mModel.mpModel)) { + return FALSE; + } + } else { + mModel.mpInvisibleModel = NULL; + } + + if (mModel.mID.mShadowID != -1) { + mModel.mpShadow = new daDemo00_shadow_c(); + if (mModel.mpShadow == NULL) { + return FALSE; + } + mModel.mpModel->calc(); + setShadowSize(); + } + + mModel.mBgc = new daDemo00_bgc_c(); + if (mModel.mBgc == NULL) { + return FALSE; + } + mModel.mBgc->mGndChk.OffWall(); + } + + if (mModel.mID.mPlightID != -1) { + mModel.mpPlight = new DEMO_PLIGHT(); + if (mModel.mpPlight == NULL) { + return FALSE; + } + light_data_s* light_data = &l_lightData[mModel.mID.mPlightID - 1]; + dKydm_demo_plight_entry(mModel.mpPlight, ¤t.pos, mModel.mID.mPlightID, light_data->m01); + } + + return TRUE; } /* 800E6620-800E6758 .text actStandby__10daDemo00_cFP13dDemo_actor_c */ BOOL daDemo00_c::actStandby(dDemo_actor_c* act) { - if (nextRes.modelID != -1 || nextRes.plightID != -1) { - model.resID = nextRes; + if (mNextID.mShapeID != -1 || mNextID.mPlightID != -1) { + mModel.mID = mNextID; if (fopAcM_entrySolidHeap(this, createHeapCallBack, 0x4000) != 0) { - if (model.model != NULL) { + if (mModel.mpModel != NULL) { setBaseMtx(); - fopAcM_SetMtx(this, model.model->getBaseTRMtx()); - act->setModel(model.model); - if (model.morf != NULL) - act->setAnmFrameMax(model.morf->getEndFrame()); + fopAcM_SetMtx(this, mModel.mpModel->getBaseTRMtx()); + act->setModel(mModel.mpModel); + if (mModel.mpMorf != NULL) + act->setAnmFrameMax(mModel.mpMorf->getEndFrame()); } setAction(&daDemo00_c::actPerformance); @@ -177,15 +315,208 @@ BOOL daDemo00_c::actStandby(dDemo_actor_c* act) { } /* 800E6758-800E6E2C .text actPerformance__10daDemo00_cFP13dDemo_actor_c */ -BOOL daDemo00_c::actPerformance(dDemo_actor_c*) { - /* Nonmatching */ +BOOL daDemo00_c::actPerformance(dDemo_actor_c* actor) { + f32 fVar1; + if (mModel.mID.mShapeID != mNextID.mShapeID || mModel.mID.mPlightID != mNextID.mPlightID) { + mModel.reset(); + setAction(&daDemo00_c::actLeaving); + } else if (mModel.mpModel != NULL) { + if (mModel.mpMorf != NULL && mModel.mID.mBckID != mNextID.mBckID) { + J3DAnmTransform* anm = (J3DAnmTransform*)dComIfG_getObjectIDRes(dStage_roomControl_c::getDemoArcName(), (u16)mNextID.mBckID); + if (anm == NULL) { + return TRUE; + } + + fVar1 = 0.0f; + if (actor->checkEnable(dDemo_actor_c::ENABLE_ANM_FRAME_e)) { + fVar1 = actor->getAnmTransition(); + } + mModel.mpMorf->setAnm(anm, -1, fVar1, 1.0f, 0.0f, -1.0f, NULL); + mModel.mID.mBckID = mNextID.mBckID; + } + + if (mModel.mID.mBtpID != mNextID.mBtpID) { + J3DAnmTexPattern* anmTexPattern = (J3DAnmTexPattern*)dComIfG_getObjectIDRes(dStage_roomControl_c::getDemoArcName(), (u16)mNextID.mBtpID); + if (anmTexPattern == NULL) { + return TRUE; + } + + mModel.mpBtpAnm->init(mModel.mpModel->getModelData(), anmTexPattern, 1, J3DFrameCtrl::EMode_NULL, 1.0f, 0, -1, true); + mModel.mID.mBtpID = mNextID.mBtpID; + } + + if (mModel.mID.mBtkID != mNextID.mBtkID) { + J3DAnmTextureSRTKey* key = (J3DAnmTextureSRTKey*)dComIfG_getObjectIDRes(dStage_roomControl_c::getDemoArcName(), (u16)mNextID.mBtkID); + if (key == NULL) { + return TRUE; + } + + mModel.mpBtkAnm->init( + mModel.mpModel->getModelData(), + key, + TRUE, +#if VERSION <= VERSION_JPN + J3DFrameCtrl::EMode_NULL, +#else + (mModel.mID.mBtkID & 0x10000000) != 0 ? J3DFrameCtrl::EMode_LOOP : J3DFrameCtrl::EMode_NULL, +#endif + 1.0f, +#if VERSION == VERSION_DEMO + 0.0f, +#else + (mModel.mID.mBtkID & 0x10000000) != 0 ? mModel.mpBtkAnm->getFrame() : 0.0f, +#endif + -1, + true + ); + mModel.mID.mBtkID = mNextID.mBtkID; + } + + if (mModel.mID.mBrkID != mNextID.mBrkID) { + J3DAnmTevRegKey* anmTev = (J3DAnmTevRegKey*)dComIfG_getObjectIDRes(dStage_roomControl_c::getDemoArcName(), (u16)mNextID.mBrkID); + if (anmTev == NULL) { + return TRUE; + } + + mModel.mpBrkAnm->init( + mModel.mpModel->getModelData(), + anmTev, + TRUE, +#if VERSION <= VERSION_JPN + J3DFrameCtrl::EMode_NULL, +#else + (mModel.mID.mBrkID & 0x10000000) != 0 ? J3DFrameCtrl::EMode_LOOP : J3DFrameCtrl::EMode_NULL, +#endif + 1.0f, +#if VERSION == VERSION_DEMO + 0.0f, +#else + (mModel.mID.mBrkID & 0x10000000) != 0 ? mModel.mpBrkAnm->getFrame() : 0.0f, +#endif + -1, + true + ); + mModel.mID.mBrkID = mNextID.mBrkID; + } + + dDemo_setDemoData(this, dDemo_actor_c::ENABLE_TRANS_e | dDemo_actor_c::ENABLE_ROTATE_e | dDemo_actor_c::ENABLE_ANM_e, NULL, NULL); + if (mModel.mBgc != NULL) { + cXyz sp70(current.pos.x, current.pos.y + 100.0f, current.pos.z); + mModel.mBgc->mGndChk.SetPos(&sp70); + mModel.mBgc->mGroundY = dComIfG_Bgsp()->GroundCross(&mModel.mBgc->mGndChk); +#if VERSION > VERSION_JPN + field_0x29e = 1; +#endif + } + + setBaseMtx(); + + if (actor->checkEnable(dDemo_actor_c::ENABLE_ANM_FRAME_e)) { + fVar1 = actor->getAnmFrame(); + if (fVar1 > 1.0f) { + fVar1 -= 1.0f; + if (mModel.mpMorf != NULL) { + mModel.mpMorf->setFrame(fVar1); + mModel.mpMorf->play( + ¤t.pos, + mModel.mBgc != NULL && +#if VERSION > VERSION_JPN + field_0x29e != 0 && +#endif + std::fabsf(mModel.mBgc->mGroundY - current.pos.y) < 20.0f ? + dComIfG_Bgsp()->GetMtrlSndId(mModel.mBgc->mGndChk) : + 0, + dComIfGp_getReverb(dComIfGp_roomControl_getStayNo()) + ); + } + + if (mModel.mpBtpAnm != NULL) { + mModel.mpBtpAnm->setFrame(fVar1); + mModel.mpBtpAnm->play(); + } + + if (mModel.mpBtkAnm != NULL) { + if ((mModel.mID.mBtkID & DEMO_SELECT(0x10000, 0x10000000)) == 0) { + mModel.mpBtkAnm->setFrame(fVar1); + } + mModel.mpBtkAnm->play(); + } + + if (mModel.mpBrkAnm != NULL) { + if ((mModel.mID.mBrkID & DEMO_SELECT(0x10000, 0x10000000)) == 0) { + mModel.mpBrkAnm->setFrame(fVar1); + } + mModel.mpBrkAnm->play(); + } + } else { + if (mModel.mpMorf != NULL) { + mModel.mpMorf->setFrame(fVar1); + } + + if (mModel.mpBtpAnm != NULL) { + mModel.mpBtpAnm->setFrame(fVar1); + } + + if (mModel.mpBtkAnm != NULL) { +#if VERSION == VERSION_DEMO + mModel.mpBtkAnm->setFrame(fVar1); +#else + if ((mModel.mID.mBtkID & 0x10000000) == 0) { + mModel.mpBtkAnm->setFrame(fVar1); + } else { + mModel.mpBtkAnm->play(); + } +#endif + } + + if (mModel.mpBrkAnm != NULL) { +#if VERSION == VERSION_DEMO + mModel.mpBrkAnm->setFrame(fVar1); +#else + if ((mModel.mID.mBrkID & 0x10000000) == 0) { + mModel.mpBrkAnm->setFrame(fVar1); + } else { + mModel.mpBrkAnm->play(); + } +#endif + } + } + } else if (mModel.mpMorf != NULL) { + mModel.mpMorf->play(¤t.pos, 0, 0); + } else if (mModel.mpBtpAnm != NULL) { + mModel.mpBtpAnm->play(); + } else if (mModel.mpBtkAnm != NULL) { + mModel.mpBtkAnm->play(); + } else if (mModel.mpBrkAnm != NULL) { + mModel.mpBrkAnm->play(); + } + + if (actor->checkEnable(dDemo_actor_c::ENABLE_SCALE_e)) { + scale = *actor->getScale(); + } + + if (mModel.mpPlight != NULL) { + light_data_s* light_data = &l_lightData[mModel.mID.mPlightID - 1]; + cXyz sp1C = current.pos; + if (light_data->useJoint == true) { + s32 jno = mModel.mpModel->getModelData()->getJointName()->getIndex(light_data->jointName); + mDoMtx_multVecZero(mModel.mpModel->getAnmMtx(jno), &sp1C); + } + dKydm_demo_plight_execute(mModel.mpPlight, &sp1C); + } + } else if (mModel.mpPlight != NULL) { + dDemo_setDemoData(this, dDemo_actor_c::ENABLE_TRANS_e, NULL, NULL); + dKydm_demo_plight_execute(mModel.mpPlight, ¤t.pos); + } + + return TRUE; } /* 800E6E2C-800E6E90 .text actLeaving__10daDemo00_cFP13dDemo_actor_c */ BOOL daDemo00_c::actLeaving(dDemo_actor_c* act) { #if VERSION > VERSION_DEMO - if (model.morf != NULL) { - model.morf->stopZelAnime(); + if (mModel.mpMorf != NULL) { + mModel.mpMorf->stopZelAnime(); } #endif @@ -201,10 +532,96 @@ static BOOL daDemo00_Draw(daDemo00_c* i_this) { /* 800E6EB0-800E7204 .text draw__10daDemo00_cFv */ BOOL daDemo00_c::draw() { - /* Nonmatching */ + if (mModel.mpModel != NULL) { + g_env_light.settingTevStruct(TEV_TYPE_ACTOR, ¤t.pos, &tevStr); + g_env_light.setLightTevColorType(mModel.mpModel, &tevStr); + if (mModel.mpBtpAnm != NULL) { + mModel.mpBtpAnm->entry(mModel.mpModel->getModelData()); + } + if (mModel.mpBtkAnm != NULL) { + mModel.mpBtkAnm->entry(mModel.mpModel->getModelData()); + } + if (mModel.mpBrkAnm != NULL) { + mModel.mpBrkAnm->entry(mModel.mpModel->getModelData()); + } + + if (mModel.mpInvisibleModel) { + if (mModel.mpMorf) { + mModel.mpInvisibleModel->updateDL(mModel.mpMorf); + } else { + mModel.mpInvisibleModel->updateDL(mModel.mpModel); + } + } else { #if VERSION > VERSION_DEMO - OSReport("GTower"); + if (mModel.mpModel->getSkinDeform() != NULL && strcmp(dComIfGp_getStartStageName(), "GTower") == 0) { + dComIfGd_setListInvisisble(); + } #endif + + if (field_0x29c == 2) { + dComIfGd_setListMaskOff(); + } else if (field_0x29c == 8) { + dComIfGd_setListP1(); + } + + if (mModel.mpMorf != NULL) { + mModel.mpMorf->updateDL(); + } else { + mDoExt_modelUpdateDL(mModel.mpModel); + } + + if ( +#if VERSION > VERSION_DEMO + mModel.mpModel->getSkinDeform() != NULL || +#endif + field_0x29c == 2 || field_0x29c == 8 + ) { + dComIfGd_setList(); + } + } + + if ( + mModel.mpShadow != NULL +#if VERSION > VERSION_JPN + && field_0x29e != 0 +#endif + ) { + if (mModel.mID.mShadowID == 0 || mModel.mID.mShadowID == 1) { + cXyz pos = current.pos + mModel.mpShadow->mPos; +#if VERSION > VERSION_DEMO + mModel.mpShadow->mShadowID = +#endif + dComIfGd_setShadow( + DEMO_SELECT(0, mModel.mpShadow->mShadowID), + mModel.mID.mShadowID == 0 ? 0 : 1, + mModel.mpModel, + &pos, + mModel.mpShadow->mCasterSize, + mModel.mpShadow->mSimpleScale, + current.pos.y, + mModel.mBgc->mGroundY, + mModel.mBgc->mGndChk, + &tevStr + ); + } else { + cXyz pos(current.pos.x, mModel.mBgc->mGroundY, current.pos.z); + dComIfGd_setSimpleShadow2( + &pos, pos.y, mModel.mpShadow->mSimpleScale, mModel.mBgc->mGndChk + ); + } + } + + if (mModel.mpBtpAnm != NULL) { + mModel.mpBtpAnm->remove(mModel.mpModel->getModelData()); + } + if (mModel.mpBtkAnm != NULL) { + mModel.mpBtkAnm->remove(mModel.mpModel->getModelData()); + } + if (mModel.mpBrkAnm != NULL) { + mModel.mpBrkAnm->remove(mModel.mpModel->getModelData()); + } + } + return TRUE; } /* 800E7204-800E7224 .text daDemo00_Execute__FP10daDemo00_c */ @@ -214,7 +631,7 @@ static BOOL daDemo00_Execute(daDemo00_c* i_this) { /* 800E7224-800E78A0 .text execute__10daDemo00_cFv */ BOOL daDemo00_c::execute() { -#if VERSION > VERSION_DEMO +#if VERSION > VERSION_JPN field_0x29e = 0; #endif @@ -223,10 +640,10 @@ BOOL daDemo00_c::execute() { fopAcM_delete(this); } else { if (demo_actor->checkEnable(dDemo_actor_c::ENABLE_SHAPE_e)) { - nextRes.modelID = demo_actor->getShapeId(); + mNextID.mShapeID = demo_actor->getShapeId(); } if (demo_actor->checkEnable(dDemo_actor_c::ENABLE_ANM_e)) { - nextRes.bckID = demo_actor->getAnmId(); + mNextID.mBckID = demo_actor->getAnmId(); } if (demo_actor->checkEnable(dDemo_actor_c::ENABLE_UNK_e)) { #if VERSION > VERSION_DEMO @@ -291,7 +708,7 @@ BOOL daDemo00_c::execute() { if (!spCC.isEnd() && spCC.isValid()) { TValueIterator_raw it = spCC.begin(); int argID = *it; - JUT_ASSERT(DEMO_SELECT(771, 832), argID < (sizeof(l_eventBit)/sizeof(u16))); + JUT_ASSERT(VERSION_SELECT(771, 818, 832, 832), argID < (sizeof(l_eventBit)/sizeof(u16))); if (l_eventBit[argID] != 0xFFFF) { dComIfGs_onEventBit(l_eventBit[argID]); } @@ -314,7 +731,7 @@ BOOL daDemo00_c::execute() { if (!spB8.isEnd() && spB8.isValid()) { TValueIterator_raw it = spB8.begin(); int argID = *it; - JUT_ASSERT(DEMO_SELECT(797, 858), argID < (sizeof(l_itemNo)/sizeof(u8))); + JUT_ASSERT(VERSION_SELECT(797, 844, 858, 858), argID < (sizeof(l_itemNo)/sizeof(u8))); if (l_itemNo[argID] != dItem_NONE_e) { execItemGet(l_itemNo[argID]); } @@ -378,29 +795,21 @@ BOOL daDemo00_c::execute() { r5 = *it; } else { if (r5 == 0) { - nextRes.btpID = *it; + mNextID.mBtpID = *it; } else if (r5 == 1) { - nextRes.btkID = *it; + mNextID.mBtkID = *it; } else if (r5 == 2) { - nextRes.plightID = *it; + mNextID.mPlightID = *it; } else if (r5 == 3) { - nextRes.field_0x1C = *it; + mNextID.field_0x1C = *it; } else if (r5 == 4) { - nextRes.brkID = *it; + mNextID.mBrkID = *it; } else if (r5 == 5) { - nextRes.shadowID = *it; + mNextID.mShadowID = *it; } else if (r5 == 6) { -#if VERSION == VERSION_DEMO - nextRes.btkID = *it | 0x10000; -#else - nextRes.btkID = *it | 0x10000000; -#endif + mNextID.mBtkID = *it | DEMO_SELECT(0x10000, 0x10000000); } else if (r5 == 7) { -#if VERSION == VERSION_DEMO - nextRes.brkID = *it | 0x10000; -#else - nextRes.brkID = *it | 0x10000000; -#endif + mNextID.mBrkID = *it | DEMO_SELECT(0x10000, 0x10000000); } r5 = -1; } @@ -428,14 +837,7 @@ static BOOL daDemo00_Delete(daDemo00_c* i_this) { /* 800E78D0-800E7964 .text daDemo00_Create__FP10fopAc_ac_c */ static cPhs_State daDemo00_Create(fopAc_ac_c* i_ac) { daDemo00_c* i_this = (daDemo00_c*)i_ac; - fopAcM_ct(i_this, daDemo00_c); - dKy_tevstr_init(&i_this->tevStr, dComIfGp_roomControl_getStayNo(), 0xFF); - i_this->setAction(&daDemo00_c::actStandby); - i_this->nextRes.reset(); -#if VERSION > VERSION_DEMO - i_this->field_0x29d = -1; -#endif - return cPhs_COMPLEATE_e; + return i_this->create(); } static actor_method_class l_daDemo00_Method = {