diff --git a/configure.py b/configure.py index 8513152f1f3..1b390be3cdf 100755 --- a/configure.py +++ b/configure.py @@ -1948,7 +1948,7 @@ config.libs = [ ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_npc_zelda"), ActorRel(Equivalent, "d_a_npc_zra", extra_cflags=[DANPCF_C_HACK]), # weak func order ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_npc_zrc", extra_cflags=[DANPCF_C_HACK]), - ActorRel(NonMatching, "d_a_npc_zrz", extra_cflags=[DANPCF_C_HACK]), # regalloc + ActorRel(MatchingFor("GZ2E01"), "d_a_npc_zrz", extra_cflags=[DANPCF_C_HACK]), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_Lv5Key"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_Turara"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_TvCdlst"), @@ -2148,7 +2148,7 @@ config.libs = [ ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_pdoor"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_pdtile"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_pdwall"), - ActorRel(NonMatching, "d_a_obj_picture"), + ActorRel(MatchingFor("GZ2E01"), "d_a_obj_picture"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_pillar"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_pleaf"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_poCandle"), @@ -2240,7 +2240,7 @@ config.libs = [ ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_waterfall"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_wchain"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_wdStick"), - ActorRel(NonMatching, "d_a_obj_web0"), + ActorRel(MatchingFor("GZ2E01"), "d_a_obj_web0"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_web1"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_well_cover"), ActorRel(MatchingFor("GZ2E01", "GZ2P01", "GZ2J01"), "d_a_obj_wflag"), diff --git a/include/d/actor/d_a_obj_picture.h b/include/d/actor/d_a_obj_picture.h index 74038216448..02ae88e9c82 100644 --- a/include/d/actor/d_a_obj_picture.h +++ b/include/d/actor/d_a_obj_picture.h @@ -36,7 +36,13 @@ public: int getArg_0() { return fopAcM_GetParamBit(this, 0, 4); } int getSW_0() { return fopAcM_GetParamBit(this, 4, 8); } +#if DEBUG + const +#endif static dCcD_SrcCps s_CcDCps; +#if DEBUG + const +#endif static dCcD_SrcCyl s_CcDCyl_pic_at; private: diff --git a/src/d/actor/d_a_npc_zrz.cpp b/src/d/actor/d_a_npc_zrz.cpp index dd581958b18..55c3408ee92 100644 --- a/src/d/actor/d_a_npc_zrz.cpp +++ b/src/d/actor/d_a_npc_zrz.cpp @@ -1328,6 +1328,8 @@ void daNpc_zrZ_c::lightColorProc() { int prev_key_frame, next_key_frame, next, i; for (i = 0; i < 4; i++) { if (key_frame[i] <= mLightEffectFrame && key_frame[i + 1] > mLightEffectFrame) { + // The following is present to cause dbg asm to use r31 for stack reg: + int nested_var; prev_key_frame = key_frame[i]; next_key_frame = key_frame[i + 1]; next = i + 1; @@ -1336,12 +1338,16 @@ void daNpc_zrZ_c::lightColorProc() { } int frames = next_key_frame - prev_key_frame; - s16 step_r = std::fabs(key_color[i + 1].r - key_color[i].r) / frames; - s16 step_g = std::fabs(key_color[i + 1].g - key_color[i].g) / frames; - s16 step_b = std::fabs(key_color[i + 1].b - key_color[i].b) / frames; - cLib_chaseS(&mLight.mColor.r, key_color[next].r, ++step_r); - cLib_chaseS(&mLight.mColor.g, key_color[next].g, ++step_g); - cLib_chaseS(&mLight.mColor.b, key_color[next].b, ++step_b); + GXColorS10 color; + color.r = std::fabs(key_color[i + 1].r - key_color[i].r) / frames; + color.g = std::fabs(key_color[i + 1].g - key_color[i].g) / frames; + color.b = std::fabs(key_color[i + 1].b - key_color[i].b) / frames; + ++color.r; + ++color.g; + ++color.b; + cLib_chaseS(&mLight.mColor.r, key_color[next].r, color.r); + cLib_chaseS(&mLight.mColor.g, key_color[next].g, color.g); + cLib_chaseS(&mLight.mColor.b, key_color[next].b, color.b); } /* 80B9B1B8-80B9B1C0 0001CC 0008+00 0/0 0/0 0/0 .rodata @5782 */ diff --git a/src/d/actor/d_a_obj_picture.cpp b/src/d/actor/d_a_obj_picture.cpp index 97e8c2575db..0a68e6f752c 100644 --- a/src/d/actor/d_a_obj_picture.cpp +++ b/src/d/actor/d_a_obj_picture.cpp @@ -26,35 +26,6 @@ static Vec l_PIC_AT_OFFSET_POS = { 0.0f, 100.0f, 0.0f }; -/* 80CAF110-80CAF15C 000028 004C+00 1/1 0/0 0/0 .data s_CcDCps__14daObjPicture_c */ -dCcD_SrcCps daObjPicture_c::s_CcDCps = { - { - {0x0, {{0x0, 0x0, 0x0}, {0x20A0, 0x11}, 0x0}}, // mObj - {dCcD_SE_SWORD, 0x0, 0x0, 0x0, 0x0}, // mGObjAt - {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x4}, // mGObjTg - {0x0}, // mGObjCo - }, // mObjInf - { - {{0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f}, 14.0f}, // mCps - } // mCpsAttr -}; - -/* 80CAF15C-80CAF1A0 000074 0044+00 1/1 0/0 0/0 .data s_CcDCyl_pic_at__14daObjPicture_c - */ -dCcD_SrcCyl daObjPicture_c::s_CcDCyl_pic_at = { - { - {0x0, {{0x400, 0x1, 0x11}, {0x0, 0x11}, 0x79}}, // mObj - {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x0}, // mGObjAt - {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x0}, // mGObjTg - {0x0}, // mGObjCo - }, // mObjInf - { - {0.0f, 0.0f, 0.0f}, // mCenter - 0.0f, // mRadius - 0.0f // mHeight - } // mCyl -}; - /* 80CAD318-80CAD498 000098 0180+00 2/2 0/0 0/0 .text __ct__14daObjPicture_cFv */ daObjPicture_c::daObjPicture_c() { memset(mpBgw, 0, 8); @@ -151,7 +122,6 @@ int daObjPicture_c::createHeap() { } /* 80CADC18-80CADFB0 000998 0398+00 1/1 0/0 0/0 .text create__14daObjPicture_cFv */ -// NONMATCHING int daObjPicture_c::create() { fopAcM_ct(this, daObjPicture_c); @@ -577,6 +547,41 @@ static int daObjPicture_draw(daObjPicture_c* i_this) { return i_this->draw(); } +/* 80CAF110-80CAF15C 000028 004C+00 1/1 0/0 0/0 .data s_CcDCps__14daObjPicture_c */ +#if DEBUG +const +#endif +dCcD_SrcCps daObjPicture_c::s_CcDCps = { + { + {0x0, {{0x0, 0x0, 0x0}, {0x20A0, 0x11}, 0x0}}, // mObj + {dCcD_SE_SWORD, 0x0, 0x0, 0x0, 0x0}, // mGObjAt + {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x4}, // mGObjTg + {0x0}, // mGObjCo + }, // mObjInf + { + {{0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f}, 14.0f}, // mCps + } // mCpsAttr +}; + +/* 80CAF15C-80CAF1A0 000074 0044+00 1/1 0/0 0/0 .data s_CcDCyl_pic_at__14daObjPicture_c + */ +#if DEBUG +const +#endif +dCcD_SrcCyl daObjPicture_c::s_CcDCyl_pic_at = { + { + {0x0, {{0x400, 0x1, 0x11}, {0x0, 0x11}, 0x79}}, // mObj + {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x0}, // mGObjAt + {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x0}, // mGObjTg + {0x0}, // mGObjCo + }, // mObjInf + { + {0.0f, 0.0f, 0.0f}, // mCenter + 0.0f, // mRadius + 0.0f // mHeight + } // mCyl +}; + /* 80CAF1A0-80CAF1C0 -00001 0020+00 1/0 0/0 0/0 .data daObjPicture_METHODS */ static actor_method_class daObjPicture_METHODS = { (process_method_func)daObjPicture_create, diff --git a/src/d/actor/d_a_obj_web0.cpp b/src/d/actor/d_a_obj_web0.cpp index 8a553ad4c94..a3dfc53ca14 100644 --- a/src/d/actor/d_a_obj_web0.cpp +++ b/src/d/actor/d_a_obj_web0.cpp @@ -74,9 +74,8 @@ static void damage_check(obj_web0_class* i_this) { /* 80D34794-80D34B24 000354 0390+00 2/1 0/0 0/0 .text daObj_Web0_Execute__FP14obj_web0_class */ // NONMATCHING - reg alloc static int daObj_Web0_Execute(obj_web0_class* i_this) { - u32 sp0C; - s16 sp08; - fopAc_ac_c* player = dComIfGp_getPlayer(0); + fopAc_ac_c* base_p = i_this; + fopAc_ac_c* player = (fopAc_ac_c*) dComIfGp_getPlayer(0); i_this->field_0x57c++; @@ -92,21 +91,21 @@ static int daObj_Web0_Execute(obj_web0_class* i_this) { if (i_this->mDeleteTimer != 0) { if (i_this->mDeleteTimer == 1) { - cXyz sp20(i_this->scale); + cXyz sp20(base_p->scale); sp20.z = 1.0f; - dComIfGp_particle_set(0x840C, &i_this->current.pos, &i_this->shape_angle, &sp20); + dComIfGp_particle_set(0x840C, &base_p->current.pos, &base_p->shape_angle, &sp20); i_this->mpBrk->setPlaySpeed(1.0f); } else if (i_this->mDeleteTimer == 41) { i_this->mpBrk->setPlaySpeed(1.0f); } - fopAcM_seStartLevel(i_this, Z2SE_OBJ_WEB_BURN, 0); + fopAcM_seStartLevel(base_p, Z2SE_OBJ_WEB_BURN, 0); if (i_this->mDeleteTimer == 40 || i_this->mDeleteTimer == 80) { - sp0C = (fopAcM_GetParam(i_this) & 0xff000000) >> 24; - dComIfGs_onSwitch(sp0C, fopAcM_GetRoomNo(i_this)); - fopAcM_delete(i_this); + u32 sp0C = (fopAcM_GetParam(base_p) & 0xff000000) >> 24; + dComIfGs_onSwitch(sp0C, fopAcM_GetRoomNo(base_p)); + fopAcM_delete(base_p); } i_this->mDeleteTimer++; @@ -114,10 +113,10 @@ static int daObj_Web0_Execute(obj_web0_class* i_this) { damage_check(i_this); } - mDoMtx_stack_c::transS(i_this->current.pos.x, i_this->current.pos.y, i_this->current.pos.z); - mDoMtx_stack_c::YrotM((s16)i_this->shape_angle.y); - mDoMtx_stack_c::ZrotM((s16)i_this->shape_angle.z); - mDoMtx_stack_c::scaleM(i_this->scale.x, i_this->scale.y, i_this->scale.z); + mDoMtx_stack_c::transS(base_p->current.pos.x, base_p->current.pos.y, base_p->current.pos.z); + mDoMtx_stack_c::YrotM((s16)base_p->shape_angle.y); + mDoMtx_stack_c::ZrotM((s16)base_p->shape_angle.z); + mDoMtx_stack_c::scaleM(base_p->scale.x, base_p->scale.y, base_p->scale.z); i_this->mpBrk->play(); i_this->mpModel->setBaseTRMtx(mDoMtx_stack_c::get()); @@ -126,11 +125,11 @@ static int daObj_Web0_Execute(obj_web0_class* i_this) { i_this->mReboundTimer--; } - i_this->scale.z = + base_p->scale.z = i_this->mReboundTimer * cM_ssin(i_this->mReboundTimer * 0x1900) * (0.075f + TREG_F(0)); - s16 playerAngle = fopAcM_searchPlayerAngleY(i_this); - sp08 = (playerAngle + 0x4000) - i_this->shape_angle.y; + s16 var_r28 = fopAcM_searchPlayerAngleY(base_p); + s16 sp08 = (var_r28 + 0x4000) - base_p->shape_angle.y; if (sp08 < 0) { mDoMtx_stack_c::YrotM(-0x8000); } @@ -138,14 +137,14 @@ static int daObj_Web0_Execute(obj_web0_class* i_this) { i_this->mpBgW->Move(); - cXyz sp14(i_this->current.pos); + cXyz sp14(base_p->current.pos); if (i_this->field_0x57c & 1) { - sp14.y -= i_this->scale.x * 70.0f; + sp14.y -= base_p->scale.x * 70.0f; } - s16 var_r28 = i_this->shape_angle.y; + var_r28 = base_p->shape_angle.y; if (sp08 < 0) { - var_r28 += -0x8000; + var_r28 += (s16) -0x8000; } var_r28 -= player->shape_angle.y; @@ -154,7 +153,7 @@ static int daObj_Web0_Execute(obj_web0_class* i_this) { } i_this->mSphCc.SetC(sp14); - i_this->mSphCc.SetR((150.0f + TREG_F(2)) * i_this->scale.x); + i_this->mSphCc.SetR((150.0f + TREG_F(2)) * base_p->scale.x); dComIfG_Ccsp()->Set(&i_this->mSphCc); return 1;