From 77ec4d491610620338e592a0f853b7c59af7fba5 Mon Sep 17 00:00:00 2001 From: EllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com> Date: Thu, 18 Mar 2021 07:46:42 +0000 Subject: [PATCH] object_bg and object_mir_ray OK (#714) * object_bg and object_mir_ray * remove externs in mir_ray * newline at end of xml * fix a couple of warnings in Obj_Tsubo --- assets/xml/objects/object_bg.xml | 50 ++++++++++++++++ assets/xml/objects/object_mir_ray.xml | 13 +++++ spec | 6 +- .../ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c | 57 ++++++++++++------- src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c | 8 +-- .../actors/ovl_Obj_Tsubo/z_obj_tsubo.c | 8 +-- undefined_syms.txt | 10 ---- 7 files changed, 112 insertions(+), 40 deletions(-) create mode 100644 assets/xml/objects/object_bg.xml create mode 100644 assets/xml/objects/object_mir_ray.xml diff --git a/assets/xml/objects/object_bg.xml b/assets/xml/objects/object_bg.xml new file mode 100644 index 0000000000..067ed2e59d --- /dev/null +++ b/assets/xml/objects/object_bg.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_mir_ray.xml b/assets/xml/objects/object_mir_ray.xml new file mode 100644 index 0000000000..2acc9391ab --- /dev/null +++ b/assets/xml/objects/object_mir_ray.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/spec b/spec index 511c9c5e73..f208bb7184 100644 --- a/spec +++ b/spec @@ -4417,7 +4417,8 @@ endseg beginseg name "object_mir_ray" romalign 0x1000 - include "build/baserom/object_mir_ray.o" + include "build/assets/objects/object_mir_ray/object_mir_ray.o" + number 6 endseg beginseg @@ -5546,7 +5547,8 @@ endseg beginseg name "object_bg" romalign 0x1000 - include "build/baserom/object_bg.o" + include "build/assets/objects/object_bg/object_bg.o" + number 6 endseg beginseg diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c index b998343c06..c570da5e06 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c @@ -2,6 +2,7 @@ #include "vt.h" #include "overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.h" #include "overlays/actors/ovl_En_Ex_Item/z_en_ex_item.h" +#include "objects/object_bg/object_bg.h" #define FLAGS 0x08000039 @@ -35,11 +36,6 @@ void EnBomBowMan_SetupChooseShowPrize(EnBomBowlMan* this, GlobalContext* globalC void EnBomBowMan_ChooseShowPrize(EnBomBowlMan* this, GlobalContext* globalCtx); void EnBomBowlMan_BeginPlayGame(EnBomBowlMan* this, GlobalContext* globalCtx); -extern FlexSkeletonHeader D_06006EB0; -extern AnimationHeader D_06000710; -extern AnimationHeader D_06000080; -extern AnimationHeader D_060072AC; - const ActorInit En_Bom_Bowl_Man_InitVars = { ACTOR_EN_BOM_BOWL_MAN, ACTORCAT_NPC, @@ -62,7 +58,8 @@ void EnBomBowlMan_Init(Actor* thisx, GlobalContext* globalCtx) { GlobalContext* globalCtx2 = globalCtx; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - SkelAnime_InitFlex(globalCtx2, &this->skelAnime, &D_06006EB0, &D_06000710, this->jointTable, this->morphTable, 11); + SkelAnime_InitFlex(globalCtx2, &this->skelAnime, &gChuGirlSkel, &gChuGirlNoddingOffAnim, this->jointTable, + this->morphTable, 11); // ☆ Man, my shoulders hurt~ ☆ osSyncPrintf(VT_FGCOL(GREEN) "☆ もー 肩こっちゃうよねぇ〜 \t\t ☆ \n" VT_RST); // ☆ Isn't there some sort of job that will pay better and be more relaxing? ☆ %d @@ -75,6 +72,7 @@ void EnBomBowlMan_Init(Actor* thisx, GlobalContext* globalCtx) { for (i = 0; i < 2; i++) { cucco = (EnSyatekiNiw*)Actor_Spawn(&globalCtx2->actorCtx, globalCtx2, ACTOR_EN_SYATEKI_NIW, cuccoSpawnPos[i].x, cuccoSpawnPos[i].y, cuccoSpawnPos[i].z, 0, 0, 0, 1); + if (cucco != NULL) { cucco->unk_2F4 = cuccoScales[i]; cucco->collider.dim.radius = (s16)cuccoColliderDims[i][0]; @@ -91,8 +89,8 @@ void EnBomBowlMan_Destroy(Actor* thisx, GlobalContext* globalCtx) { } void EnBomBowMan_SetupWaitAsleep(EnBomBowlMan* this, GlobalContext* globalCtx) { - this->frameCount = (f32)Animation_GetLastFrame(&D_06000710); - Animation_Change(&this->skelAnime, &D_06000710, 1.0f, 0.0f, this->frameCount, ANIMMODE_LOOP, -10.0f); + this->frameCount = (f32)Animation_GetLastFrame(&gChuGirlNoddingOffAnim); + Animation_Change(&this->skelAnime, &gChuGirlNoddingOffAnim, 1.0f, 0.0f, this->frameCount, ANIMMODE_LOOP, -10.0f); this->actor.textId = 0xC0; this->dialogState = 5; this->actionFunc = EnBomBowMan_WaitAsleep; @@ -124,8 +122,8 @@ void EnBomBowMan_TalkAsleep(EnBomBowlMan* this, GlobalContext* globalCtx) { } void EnBomBowMan_WakeUp(EnBomBowlMan* this, GlobalContext* globalCtx) { - this->frameCount = (f32)Animation_GetLastFrame(&D_06000080); - Animation_Change(&this->skelAnime, &D_06000080, 1.0f, 0.0f, this->frameCount, ANIMMODE_ONCE, -10.0f); + this->frameCount = (f32)Animation_GetLastFrame(&gChuGirlWakeUpAnim); + Animation_Change(&this->skelAnime, &gChuGirlWakeUpAnim, 1.0f, 0.0f, this->frameCount, ANIMMODE_ONCE, -10.0f); this->eyeMode = CHU_GIRL_EYES_OPEN_SLOWLY; this->actionFunc = EnBomBowMan_BlinkAwake; } @@ -136,6 +134,7 @@ void EnBomBowMan_BlinkAwake(EnBomBowlMan* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); if (frameCount == 30.0f) { this->dialogState = 5; + // Check for beaten Dodongo's Cavern if ((gSaveContext.eventChkInf[2] & 0x20) || BREG(2)) { this->actor.textId = 0xBF; @@ -160,10 +159,12 @@ void EnBomBowMan_CheckBeatenDC(EnBomBowlMan* this, GlobalContext* globalCtx) { if ((func_8010BDBC(&globalCtx->msgCtx) == this->dialogState) && (func_80106BC8(globalCtx) != 0)) { func_80106CCC(globalCtx); - this->frameCount = (f32)Animation_GetLastFrame(&D_060072AC); - Animation_Change(&this->skelAnime, &D_060072AC, 1.0f, 0.0f, this->frameCount, ANIMMODE_LOOP, -10.0f); + this->frameCount = (f32)Animation_GetLastFrame(&gChuGirlLeanOverCounterAnim); + Animation_Change(&this->skelAnime, &gChuGirlLeanOverCounterAnim, 1.0f, 0.0f, this->frameCount, ANIMMODE_LOOP, + -10.0f); this->eyeMode = CHU_GIRL_EYES_AWAKE; this->blinkTimer = (s16)Rand_ZeroFloat(60.0f) + 20; + // Check for beaten Dodongo's Cavern if (!((gSaveContext.eventChkInf[2] & 0x20) || BREG(2))) { this->actionFunc = EnBomBowMan_WaitNotBeatenDC; @@ -204,11 +205,13 @@ void EnBomBowMan_SetupRunGame(EnBomBowlMan* this, GlobalContext* globalCtx) { } else { this->actor.textId = 0x1A; } + this->dialogState = 4; } else { this->actor.textId = 0x19; this->dialogState = 5; } + this->actionFunc = EnBomBowMan_RunGame; } @@ -230,13 +233,14 @@ void EnBomBowMan_RunGame(EnBomBowlMan* this, GlobalContext* globalCtx) { this->gameResult = 0; - if (this->bowlPit != 0) { + if (this->bowlPit != NULL) { if ((this->wallStatus[0] != 1) && (this->wallStatus[1] != 1) && (this->bowlPit->status == 2)) { this->gameResult = 1; // Won this->bowlPit->status = 0; // Center HIT! osSyncPrintf(VT_FGCOL(PURPLE) "☆☆☆☆☆ 中央HIT!!!! ☆☆☆☆☆ \n" VT_RST); } + if ((globalCtx->bombchuBowlingStatus == -1) && (globalCtx->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].length == 0) && (this->bowlPit->status == 0) && (this->wallStatus[0] != 1) && (this->wallStatus[1] != 1)) { @@ -250,13 +254,16 @@ void EnBomBowMan_RunGame(EnBomBowlMan* this, GlobalContext* globalCtx) { this->actor.textId = 0x1A; this->dialogState = 4; this->minigamePlayStatus = 0; + if ((this->exItem != NULL) && (this->exItem->actor.update != NULL)) { this->exItem->killItem = true; this->exItem = NULL; } + globalCtx->bombchuBowlingStatus = 0; this->playingAgain = true; func_8010B680(globalCtx, this->actor.textId, NULL); + if (this->gameResult == 2) { func_8002DF54(globalCtx, NULL, 8); } @@ -270,6 +277,7 @@ void EnBomBowMan_RunGame(EnBomBowlMan* this, GlobalContext* globalCtx) { } } else { yawDiff = ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)); + if (!(this->actor.xzDistToPlayer > 120.0f) && (yawDiff < 0x4300)) { func_8002F2CC(&this->actor, globalCtx, 120.0f); } @@ -291,6 +299,7 @@ void EnBomBowlMan_HandlePlayChoice(EnBomBowlMan* this, GlobalContext* globalCtx) this->wallStatus[0] = this->wallStatus[1] = 0; globalCtx->bombchuBowlingStatus = 10; Flags_SetSwitch(globalCtx, 0x38); + if (!this->startedPlaying && !this->playingAgain) { this->actor.textId = 0x19; func_8010B720(globalCtx, this->actor.textId); @@ -312,6 +321,7 @@ void EnBomBowlMan_HandlePlayChoice(EnBomBowlMan* this, GlobalContext* globalCtx) this->actionFunc = func_809C41FC; } break; + case 1: // No this->playingAgain = false; this->actor.textId = 0x2D; @@ -326,11 +336,11 @@ void func_809C41FC(EnBomBowlMan* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); if ((func_8010BDBC(&globalCtx->msgCtx) == this->dialogState) && (func_80106BC8(globalCtx) != 0)) { func_80106CCC(globalCtx); - if ((this->actor.textId == 0x2D) || (this->actor.textId == 0x85)) { - if (Flags_GetSwitch(globalCtx, 0x38)) { - Flags_UnsetSwitch(globalCtx, 0x38); - } + + if (((this->actor.textId == 0x2D) || (this->actor.textId == 0x85)) && Flags_GetSwitch(globalCtx, 0x38)) { + Flags_UnsetSwitch(globalCtx, 0x38); } + if (this->minigamePlayStatus == 1) { this->actor.textId = 0x1B; func_8010B720(globalCtx, this->actor.textId); @@ -401,15 +411,19 @@ void EnBomBowMan_ChooseShowPrize(EnBomBowlMan* this, GlobalContext* globalCtx) { prizeTemp = EXITEM_BOMBS_BOWLING; break; } + this->prizeIndex = prizeTemp; + if (BREG(7)) { this->prizeIndex = BREG(7) - 1; } + this->exItem = (EnExItem*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_EX_ITEM, sPrizePosOffset[this->prizeIndex].x + 148.0f, sPrizePosOffset[this->prizeIndex].y + 40.0f, sPrizePosOffset[this->prizeIndex].z + 300.0f, 0, sPrizeRot[this->prizeIndex], 0, this->prizeIndex + EXITEM_COUNTER); + if (!this->startedPlaying) { this->bowlPit = (EnBomBowlPit*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_BOM_BOWL_PIT, 0.0f, 90.0f, -860.0f, 0, 0, 0, 0); @@ -419,11 +433,13 @@ void EnBomBowMan_ChooseShowPrize(EnBomBowlMan* this, GlobalContext* globalCtx) { } else { this->bowlPit->prizeIndex = this->prizeIndex; } + this->bowlPit->start = 1; this->minigamePlayStatus = 2; this->actor.textId = 0x405A; func_8010B720(globalCtx, this->actor.textId); this->dialogState = 5; + // Cycle through prizes in order this->prizeSelect++; if (this->prizeSelect >= 5) { @@ -440,9 +456,11 @@ void EnBomBowlMan_BeginPlayGame(EnBomBowlMan* this, GlobalContext* globalCtx) { func_80106CCC(globalCtx); func_8005B1A4(ACTIVE_CAM); this->startedPlaying = true; + if (BREG(2)) { BREG(2) = 0; } + // "Wow" osSyncPrintf(VT_FGCOL(YELLOW) "☆ わー ☆ %d\n" VT_RST, globalCtx->bombchuBowlingStatus); func_8002DF54(globalCtx, NULL, 7); @@ -497,7 +515,7 @@ s32 EnBomBowlMan_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** void* thisx) { EnBomBowlMan* this = THIS; - if (limbIndex == 4) { + if (limbIndex == 4) { // head rot->x += this->unk_218.y; rot->z += this->unk_218.z; } @@ -505,8 +523,9 @@ s32 EnBomBowlMan_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** return false; } +static u64* eyeTextures[3] = { gChuGirlEyeOpenTex, gChuGirlEyeHalfTex, gChuGirlEyeClosedTex }; + void EnBomBowlMan_Draw(Actor* thisx, GlobalContext* globalCtx) { - static UNK_PTR eyeTextures[] = { 0x06004110, 0x06004910, 0x06005110 }; EnBomBowlMan* this = THIS; OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_bom_bowl_man.c", 907); diff --git a/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c b/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c index a3dcd25a31..fa8c6eeb0c 100644 --- a/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c +++ b/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c @@ -5,6 +5,7 @@ */ #include "z_mir_ray.h" +#include "objects/object_mir_ray/object_mir_ray.h" #define FLAGS 0x00000030 @@ -112,9 +113,6 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP), }; -extern Gfx D_060000B0[]; -extern Gfx D_06000C50[]; - void MirRay_SetupCollider(MirRay* this) { Vec3f colliderOffset; MirRayDataEntry* dataEntry = &sMirRayData[this->actor.params]; @@ -505,7 +503,7 @@ void MirRay_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_mir_ray.c", 972), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 150, (s16)(temp = this->reflectIntensity * 100.0f)); - gSPDisplayList(POLY_XLU_DISP++, D_06000C50); + gSPDisplayList(POLY_XLU_DISP++, &gShieldBeamGlowDL); MirRay_SetupReflectionPolys(this, globalCtx, reflection); MirRay_RemoveSimilarReflections(reflection); MirRay_ReflectedBeam(this, globalCtx, reflection); @@ -529,7 +527,7 @@ void MirRay_Draw(Actor* thisx, GlobalContext* globalCtx) { G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetRenderMode(POLY_XLU_DISP++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_XLU_DECAL2); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 150, reflection[0].opacity); - gSPDisplayList(POLY_XLU_DISP++, D_060000B0); + gSPDisplayList(POLY_XLU_DISP++, &gShieldBeamImageDL); } } diff --git a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c index 28ad710f5c..46e075ec00 100644 --- a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c +++ b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c @@ -15,6 +15,7 @@ void ObjTsubo_Init(Actor* thisx, GlobalContext* globalCtx); void ObjTsubo_Destroy(Actor* thisx, GlobalContext* globalCtx); void ObjTsubo_Update(Actor* thisx, GlobalContext* globalCtx); +void ObjTsubo_Draw(Actor* thisx, GlobalContext* globalCtx); void ObjTsubo_SpawnCollectible(ObjTsubo* this, GlobalContext* globalCtx); void ObjTsubo_ApplyGravity(ObjTsubo* this); @@ -30,7 +31,6 @@ void ObjTsubo_SetupLiftedUp(ObjTsubo* this); void ObjTsubo_LiftedUp(ObjTsubo* this, GlobalContext* globalCtx); void ObjTsubo_SetupThrown(ObjTsubo* this); void ObjTsubo_Thrown(ObjTsubo* this, GlobalContext* globalCtx); -void ObjTsubo_Draw(ObjTsubo* this, GlobalContext* globalCtx); s16 D_80BA1B50 = 0; s16 D_80BA1B54 = 0; @@ -132,7 +132,7 @@ void ObjTsubo_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->actor, sInitChain); ObjTsubo_InitCollider(&this->actor, globalCtx); - CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); + CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, sColChkInfoInit); if (!ObjTsubo_SnapToFloor(this, globalCtx)) { Actor_Kill(&this->actor); return; @@ -333,6 +333,6 @@ void ObjTsubo_Update(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc(this, globalCtx); } -void ObjTsubo_Draw(ObjTsubo* this, GlobalContext* globalCtx) { - Gfx_DrawDListOpa(globalCtx, D_80BA1B84[(this->actor.params >> 8) & 1]); +void ObjTsubo_Draw(Actor* thisx, GlobalContext* globalCtx) { + Gfx_DrawDListOpa(globalCtx, D_80BA1B84[(thisx->params >> 8) & 1]); } diff --git a/undefined_syms.txt b/undefined_syms.txt index 66a461eeda..db709606d0 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -1429,12 +1429,6 @@ D_060000E8 = 0x060000E8; D_060023B0 = 0x060023B0; D_06002428 = 0x06002428; -// z_en_bom_bowl_man -D_06006EB0 = 0x06006EB0; -D_06000710 = 0x06000710; -D_06000080 = 0x06000080; -D_060072AC = 0x060072AC; - // z_bg_ice_turara D_060023D0 = 0x060023D0; D_06002594 = 0x06002594; @@ -2542,10 +2536,6 @@ D_06015470 = 0x06015470; // z_item_shield D_060224F8 = 0x060224F8; -// z_mir_ray -D_060000B0 = 0x060000B0; -D_06000C50 = 0x06000C50; - // z_object_kankyo D_01000000 = 0x01000000; D_06005FF0 = 0x06005FF0;