From d1d578043b50567a6a628329f9dd5f94e550594c Mon Sep 17 00:00:00 2001 From: fullgrowngaming <42490167+fullgrowngaming@users.noreply.github.com> Date: Wed, 23 Sep 2020 17:44:17 -0700 Subject: [PATCH] obj_dinner OK (#26) Co-authored-by: Kenix3 --- include/variables_overlay.h | 2 +- include/z64.h | 4 ++- linker_scripts/code_script.txt | 5 ++-- linker_scripts/object_script.txt | 5 ++-- .../actors/ovl_Obj_Dinner/z_obj_dinner.c | 30 +++++++++++++++---- tables/variables.txt | 2 +- 6 files changed, 35 insertions(+), 13 deletions(-) diff --git a/include/variables_overlay.h b/include/variables_overlay.h index ac3fea5621..ad8e7d4674 100644 --- a/include/variables_overlay.h +++ b/include/variables_overlay.h @@ -13039,7 +13039,7 @@ extern UNK_TYPE4 D_80BEB8BC; // D_80BEB8BC extern OverlayRelocationSection enChaOverlayInfo; // D_80BEB8C0 extern u32 enChaOverlayRelocations[23]; // D_80BEB8D4 extern u32 enChaOverlayInfoOffset; // D_80BEB93C -extern UNK_TYPE1 D_80BEBA70; // D_80BEBA70 +extern UNK_TYPE1 Obj_Dinner_InitVars; // Obj_Dinner_InitVars extern OverlayRelocationSection objDinnerOverlayInfo; // D_80BEBA90 extern u32 objDinnerOverlayRelocations[4]; // D_80BEBAA4 extern u32 objDinnerOverlayInfoOffset; // D_80BEBABC diff --git a/include/z64.h b/include/z64.h index 8e922b123f..bc54959c56 100644 --- a/include/z64.h +++ b/include/z64.h @@ -653,7 +653,9 @@ typedef struct { /* 0x0004 */ UNK_TYPE1 pad4[0x4]; /* 0x0008 */ s32 cutscene; /* 0x000C */ u16 time; - /* 0x000E */ UNK_TYPE1 padE[0xA]; + /* 0x000E */ UNK_TYPE1 padE[0x2]; + /* 0x0010 */ u32 isNight; + /* 0x0014 */ u32 unk14; /* 0x0018 */ u32 day; /* 0x001C */ u32 daysElapsed; /* 0x0020 */ u8 unk20; diff --git a/linker_scripts/code_script.txt b/linker_scripts/code_script.txt index f5eec1d77b..c7b692627a 100644 --- a/linker_scripts/code_script.txt +++ b/linker_scripts/code_script.txt @@ -6794,8 +6794,9 @@ SECTIONS ovl_Obj_Dinner : AT(RomLocation) { build/src/overlays/actors/ovl_Obj_Dinner/z_obj_dinner.o(.text) - build/asm/ovl_Obj_Dinner_data.o(.data) - build/asm/ovl_Obj_Dinner_rodata.o(.rodata) + build/src/overlays/actors/ovl_Obj_Dinner/z_obj_dinner.o(.data) + build/src/overlays/actors/ovl_Obj_Dinner/z_obj_dinner.o(.rodata) + build/src/overlays/actors/ovl_Obj_Dinner/z_obj_dinner_overlay.o(.ovl) } SegmentEnd = .; SegmentSize = SegmentEnd - SegmentStart; diff --git a/linker_scripts/object_script.txt b/linker_scripts/object_script.txt index 19710e0d67..ece99d548f 100644 --- a/linker_scripts/object_script.txt +++ b/linker_scripts/object_script.txt @@ -13,7 +13,8 @@ D_0E000140 = 0x0E000140; D_0E0001C8 = 0x0E0001C8; D_0E0002C8 = 0x0E0002C8; +/* obj_hana */ D_06000500 = 0x06000500; -D_06000288 = 0x06000288; -D_060019B4 = 0x060019B4; \ No newline at end of file +/* obj_dinner */ +D_060011E0 = 0x060011E0; diff --git a/src/overlays/actors/ovl_Obj_Dinner/z_obj_dinner.c b/src/overlays/actors/ovl_Obj_Dinner/z_obj_dinner.c index d487dc7bc5..6e553d6e52 100644 --- a/src/overlays/actors/ovl_Obj_Dinner/z_obj_dinner.c +++ b/src/overlays/actors/ovl_Obj_Dinner/z_obj_dinner.c @@ -9,7 +9,6 @@ void ObjDinner_Destroy(Actor* thisx, GlobalContext* globalCtx); void ObjDinner_Update(Actor* thisx, GlobalContext* globalCtx); void ObjDinner_Draw(Actor* thisx, GlobalContext* globalCtx); -/* const ActorInit Obj_Dinner_InitVars = { ACTOR_OBJ_DINNER, ACTORTYPE_PROP, @@ -21,12 +20,31 @@ const ActorInit Obj_Dinner_InitVars = { (ActorFunc)ObjDinner_Update, (ActorFunc)ObjDinner_Draw }; -*/ -GLOBAL_ASM("asm/non_matchings/ovl_Obj_Dinner_0x80BEB940/ObjDinner_Init.asm") +extern Gfx D_060011E0[]; -GLOBAL_ASM("asm/non_matchings/ovl_Obj_Dinner_0x80BEB940/ObjDinner_Destroy.asm") +void ObjDinner_Init(Actor* thisx, GlobalContext* globalCtx) { + ObjDinner* this = THIS; -GLOBAL_ASM("asm/non_matchings/ovl_Obj_Dinner_0x80BEB940/ObjDinner_Update.asm") + if (gSaveContext.perm.isNight != 1 || + ((s32)gSaveContext.perm.day % 5 == 3 && gSaveContext.perm.weekEventReg[0x16] & 1)) { + Actor_MarkForDeath(&this->actor); + } + Actor_SetScale(&this->actor, 0.1f); +} -GLOBAL_ASM("asm/non_matchings/ovl_Obj_Dinner_0x80BEB940/ObjDinner_Draw.asm") +void ObjDinner_Destroy(Actor* thisx, GlobalContext* globalCtx) { +} + +void ObjDinner_Update(Actor* thisx, GlobalContext* globalCtx) { +} + +void ObjDinner_Draw(Actor* thisx, GlobalContext* globalCtx) { + GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + s32 pad; + + func_8012C28C(gfxCtx); + gSPMatrix(gfxCtx->polyOpa.p++, SysMatrix_AppendStateToPolyOpaDisp(globalCtx->state.gfxCtx), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(gfxCtx->polyOpa.p++, D_060011E0); +} diff --git a/tables/variables.txt b/tables/variables.txt index 783bc32253..610b43e964 100644 --- a/tables/variables.txt +++ b/tables/variables.txt @@ -18105,7 +18105,7 @@ 0x80BEB8C0:("enChaOverlayInfo","OverlayRelocationSection","",0x14), 0x80BEB8D4:("enChaOverlayRelocations","u32","[23]",0x5c), 0x80BEB93C:("enChaOverlayInfoOffset","u32","",0x4), - 0x80BEBA70:("D_80BEBA70","UNK_TYPE1","",0x1), + 0x80BEBA70:("Obj_Dinner_InitVars","UNK_TYPE1","",0x1), 0x80BEBA90:("objDinnerOverlayInfo","OverlayRelocationSection","",0x14), 0x80BEBAA4:("objDinnerOverlayRelocations","u32","[4]",0x10), 0x80BEBABC:("objDinnerOverlayInfoOffset","u32","",0x4),