diff --git a/include/variables_overlay.h b/include/variables_overlay.h index 76776c4d3f..ac3fea5621 100644 --- a/include/variables_overlay.h +++ b/include/variables_overlay.h @@ -4867,7 +4867,7 @@ extern UNK_TYPE4 D_8097349C; // D_8097349C extern OverlayRelocationSection oceffSpotOverlayInfo; // D_809734A0 extern u32 oceffSpotOverlayRelocations[37]; // D_809734B4 extern u32 oceffSpotOverlayInfoOffset; // D_8097354C -extern UNK_TYPE1 D_809735E0; // D_809735E0 +extern UNK_TYPE1 En_Torch_InitVars; // En_Torch_InitVars extern UNK_TYPE1 D_80973600; // D_80973600 extern OverlayRelocationSection enTorchOverlayInfo; // D_80973610 extern u32 enTorchOverlayRelocations[3]; // D_80973624 diff --git a/include/z64.h b/include/z64.h index 430e8d8724..8e922b123f 100644 --- a/include/z64.h +++ b/include/z64.h @@ -325,7 +325,9 @@ typedef struct { /* 0x010 */ s32 unk10; /* 0x014 */ UNK_TYPE1 pad14[0x2E]; /* 0x042 */ s16 unk42; - /* 0x044 */ UNK_TYPE1 pad44[0x232]; + /* 0x044 */ UNK_TYPE1 pad44[0x43]; + /* 0x087 */ s8 unk87; + /* 0x088 */ UNK_TYPE1 pad88[0x1EE]; /* 0x276 */ u8 unk276; /* 0x277 */ UNK_TYPE1 pad277[0x9]; /* 0x280 */ u16 unk280; diff --git a/linker_scripts/code_script.txt b/linker_scripts/code_script.txt index be978fc9ad..f5eec1d77b 100644 --- a/linker_scripts/code_script.txt +++ b/linker_scripts/code_script.txt @@ -2239,8 +2239,9 @@ SECTIONS ovl_En_Torch : AT(RomLocation) { build/src/overlays/actors/ovl_En_Torch/z_en_torch.o(.text) - build/asm/ovl_En_Torch_data.o(.data) - build/asm/ovl_En_Torch_rodata.o(.rodata) + build/src/overlays/actors/ovl_En_Torch/z_en_torch.o(.data) + build/src/overlays/actors/ovl_En_Torch/z_en_torch.o(.rodata) + build/src/overlays/actors/ovl_En_Torch/z_en_torch_overlay.o(.ovl) } SegmentEnd = .; SegmentSize = SegmentEnd - SegmentStart; diff --git a/src/overlays/actors/ovl_En_Torch/z_en_torch.c b/src/overlays/actors/ovl_En_Torch/z_en_torch.c index b702a61c41..6104790b19 100644 --- a/src/overlays/actors/ovl_En_Torch/z_en_torch.c +++ b/src/overlays/actors/ovl_En_Torch/z_en_torch.c @@ -6,18 +6,26 @@ void EnTorch_Init(Actor* thisx, GlobalContext* globalCtx); -/* const ActorInit En_Torch_InitVars = { - ACTOR_EN_TORCH, + ACTOR_EN_TORCH, ACTORTYPE_ITEMACTION, FLAGS, GAMEPLAY_KEEP, sizeof(EnTorch), (ActorFunc)EnTorch_Init, - (ActorFunc)NULL, + (ActorFunc)NULL, (ActorFunc)NULL, (ActorFunc)NULL }; -*/ -GLOBAL_ASM("asm/non_matchings/ovl_En_Torch_0x80973550/EnTorch_Init.asm") +static u8 sChestContents[] = { 0x02, 0x04, 0x05, 0x06, 0x36, 0x3A, 0x14, 0x14 }; + +void EnTorch_Init(Actor* thisx, GlobalContext* globalCtx) { + EnTorch* this = THIS; + s8 returnData = gSaveContext.extra.unk87; + + Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOX, this->actor.currPosRot.pos.x, + this->actor.currPosRot.pos.y, this->actor.currPosRot.pos.z, 0, this->actor.shape.rot.y, 0, + (sChestContents[(returnData >> 0x5) & 0x7] << 0x5) | 0x5000 | (returnData & 0x1F)); + Actor_MarkForDeath(&this->actor); +} diff --git a/tables/variables.txt b/tables/variables.txt index 6640f52f59..783bc32253 100644 --- a/tables/variables.txt +++ b/tables/variables.txt @@ -9593,7 +9593,7 @@ 0x809734A0:("oceffSpotOverlayInfo","OverlayRelocationSection","",0x14), 0x809734B4:("oceffSpotOverlayRelocations","u32","[37]",0x94), 0x8097354C:("oceffSpotOverlayInfoOffset","u32","",0x4), - 0x809735E0:("D_809735E0","UNK_TYPE1","",0x1), + 0x809735E0:("En_Torch_InitVars","UNK_TYPE1","",0x1), 0x80973600:("D_80973600","UNK_TYPE1","",0x1), 0x80973610:("enTorchOverlayInfo","OverlayRelocationSection","",0x14), 0x80973624:("enTorchOverlayRelocations","u32","[3]",0xc),