diff --git a/include/functions.h b/include/functions.h index 30ab78678b..272beddb41 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1741,13 +1741,13 @@ void func_800F4A10(GlobalContext* globalCtx); void func_800F4C0C(GlobalContext* globalCtx); void func_800F4E20(GlobalContext* globalCtx); void func_800F4F28(GlobalContext* globalCtx); -void Kanfont_Nop800F4F40(GlobalContext* globalCtx, UNK_TYPE4 param_2, UNK_TYPE4 param_3); -void Kanfont_LoadAsciiChar(GlobalContext* globalCtx, u8 character, s32 iParm3); -void Kanfont_LoadMessageBoxEnd(Font* font, u16 type); -void Kanfont_LoadOrderedFont(Font* font); +void Font_LoadChar(GlobalContext* globalCtx, u16 codePointIndex, s32 offset); +void Font_LoadCharNES(GlobalContext* globalCtx, u8 codePointIndex, s32 offset); +void Font_LoadMessageBoxEndIcon(Font* font, u16 icon); +void Font_LoadOrderedFont(Font* font); // void func_800F5090(void); // void func_800F50D4(void); -void Kankyo_Init(GlobalContext* globalCtx, KankyoContext* envCtx); +void Kankyo_Init(GlobalContext* globalCtx, EnvironmentContext* envCtx); u32 func_800F5954(u8* param_1, u32 param_2, u32 param_3, u8 param_4, u8 param_5); // void func_800F5A8C(void); // void func_800F5B10(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5); @@ -1757,16 +1757,16 @@ u32 func_800F5954(u8* param_1, u32 param_2, u32 param_3, u8 param_4, u8 param_5) // void func_800F6A04(void); // void func_800F6A40(void); // void func_800F6AB8(void); -void func_800F6B44(GlobalContext* globalCtx, KankyoContext* envCtx, s32 iParm3, s32 iParm4, s16* param_5); +void func_800F6B44(GlobalContext* globalCtx, EnvironmentContext* envCtx, s32 iParm3, s32 iParm4, s16* param_5); // void func_800F6CEC(void); // void func_800F6EA4(void); // UNK_TYPE4 Kankyo_IsSceneUpsideDown(GlobalContext* globalCtx); -void func_800F6FF8(GlobalContext* globalCtx, KankyoContext* envCtx, LightContext* lightCtx); +void func_800F6FF8(GlobalContext* globalCtx, EnvironmentContext* envCtx, LightContext* lightCtx); // void func_800F8554(void); // void func_800F88C4(void); // void func_800F8970(void); // void func_800F8A9C(void); -// void func_800F8CD4(GlobalContext* globalCtx, KankyoContext* envCtx, LightContext* lightCtx, s32 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); +// void func_800F8CD4(GlobalContext* globalCtx, EnvironmentContext* envCtx, LightContext* lightCtx, s32 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); // void func_800F8D84(void); // void func_800F9728(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7); // void func_800F9824(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8, UNK_TYPE4 param_9, UNK_TYPE2 param_10, UNK_TYPE1 param_11); @@ -2472,7 +2472,7 @@ void Scene_HeaderCmdObjectList(GlobalContext* globalCtx, SceneCmd* cmd); void Scene_HeaderCmdLightList(GlobalContext* globalCtx, SceneCmd* cmd); void Scene_HeaderCmdPathList(GlobalContext* globalCtx, SceneCmd* cmd); void Scene_HeaderCmdTransiActorList(GlobalContext* globalCtx, SceneCmd* cmd); -void Transition_Init(GameState* gamestate, TransitionContext* transitionCtx); +void Door_InitContext(GameState* gamestate, DoorContext* doorCtx); void Scene_HeaderCmdEnvLightSettings(GlobalContext* globalCtx, SceneCmd* cmd); s32 Scene_LoadAreaTextures(GlobalContext* globalCtx, s32 fileIndex); void Scene_HeaderCmdSkyboxSettings(GlobalContext* globalCtx, SceneCmd* cmd); @@ -3086,31 +3086,31 @@ void Play_Init(GlobalContext* globalCtx); void func_8016F5A8(GlobalContext* globalCtx, s8* pcParm2, Input* iParm3); // void func_8016FC78(void); // void func_8016FC98(void); -void PreRender_SetValuesSave(PreRenderContext* this, u32 width, u32 height, void* fbuf, void* zbuf, void* cvg); -void PreRender_Init(PreRenderContext* this); -void PreRender_SetValues(PreRenderContext* this, u32 width, u32 height, void* fbuf, void* zbuf); -void PreRender_Destroy(PreRenderContext* this); -void func_8016FDB8(PreRenderContext* this, Gfx** gfxp, void* buf, void* bufSave, u32 arg4); -void func_8016FF70(PreRenderContext* this, Gfx** gfxp, void* buf, void* bufSave); -void func_8016FF90(PreRenderContext* this, Gfx** gfxp, void* buf, void* bufSave, s32 envR, s32 envG, s32 envB, s32 envA); -void func_80170200(PreRenderContext* this, Gfx** gfxp, void* buf, void* bufSave); -void func_8017023C(PreRenderContext* this, Gfx** gfxp, void* buf, void* bufSave); -void func_8017057C(PreRenderContext* this, Gfx** gfxp); -void func_801705B4(PreRenderContext* this, Gfx** gfxp); -void func_801705EC(PreRenderContext* this, Gfx** gfxp); -void func_80170730(PreRenderContext* this, Gfx** gfxp); -void func_80170774(PreRenderContext* this, Gfx** gfxp); -void func_80170798(PreRenderContext* this, Gfx** gfxp); -void func_80170AE0(PreRenderContext* this, Gfx** gfxp, s32 alpha); -void func_80170B28(PreRenderContext* this, Gfx** gfxp); -void PreRender_AntiAliasAlgorithm(PreRenderContext* this, s32 x, s32 y); -void PreRender_ApplyAntiAliasingFilter(PreRenderContext* this); +void PreRender_SetValuesSave(PreRender* this, u32 width, u32 height, void* fbuf, void* zbuf, void* cvg); +void PreRender_Init(PreRender* this); +void PreRender_SetValues(PreRender* this, u32 width, u32 height, void* fbuf, void* zbuf); +void PreRender_Destroy(PreRender* this); +void func_8016FDB8(PreRender* this, Gfx** gfxp, void* buf, void* bufSave, u32 arg4); +void func_8016FF70(PreRender* this, Gfx** gfxp, void* buf, void* bufSave); +void func_8016FF90(PreRender* this, Gfx** gfxp, void* buf, void* bufSave, s32 envR, s32 envG, s32 envB, s32 envA); +void func_80170200(PreRender* this, Gfx** gfxp, void* buf, void* bufSave); +void func_8017023C(PreRender* this, Gfx** gfxp, void* buf, void* bufSave); +void func_8017057C(PreRender* this, Gfx** gfxp); +void func_801705B4(PreRender* this, Gfx** gfxp); +void func_801705EC(PreRender* this, Gfx** gfxp); +void func_80170730(PreRender* this, Gfx** gfxp); +void func_80170774(PreRender* this, Gfx** gfxp); +void func_80170798(PreRender* this, Gfx** gfxp); +void func_80170AE0(PreRender* this, Gfx** gfxp, s32 alpha); +void func_80170B28(PreRender* this, Gfx** gfxp); +void PreRender_AntiAliasAlgorithm(PreRender* this, s32 x, s32 y); +void PreRender_ApplyAntiAliasingFilter(PreRender* this); u32 func_801716C4(u8* arg0, u8* arg1, u8* arg2); -void func_801717F8(PreRenderContext* this); -void PreRender_ApplyFilters(PreRenderContext* this); -void PreRender_ApplyFiltersSlowlyInit(PreRenderContext* this); -void PreRender_ApplyFiltersSlowlyDestroy(PreRenderContext* this); -void func_801720C4(PreRenderContext* this); +void func_801717F8(PreRender* this); +void PreRender_ApplyFilters(PreRender* this); +void PreRender_ApplyFiltersSlowlyInit(PreRender* this); +void PreRender_ApplyFiltersSlowlyDestroy(PreRender* this); +void func_801720C4(PreRender* this); void func_801720FC(PreRenderParams* params, Gfx** gfxp); void func_80172758(Gfx** gfxp, void* timg, void* tlut, u16 width, u16 height, u8 fmt, u8 siz, u16 tt, u16 arg8, f32 x, f32 y, f32 xScale, f32 yScale, u32 flags); void THGA_Ct(TwoHeadGfxArena* thga, Gfx* start, u32 size); diff --git a/include/z64.h b/include/z64.h index 8fb60933e6..83e9cdbd44 100644 --- a/include/z64.h +++ b/include/z64.h @@ -150,17 +150,22 @@ typedef struct { } CameraStateParams; // size = 0xC typedef struct { - /* 0x00 */ u8 cutsceneCount; - /* 0x01 */ UNK_TYPE1 pad1[0x3]; - /* 0x04 */ u8* segment; - /* 0x08 */ u8 state; - /* 0x09 */ UNK_TYPE1 pad9[0x3]; - /* 0x0C */ f32 unkC; - /* 0x10 */ u16 frames; - /* 0x12 */ u16 unk12; - /* 0x14 */ UNK_TYPE1 pad14[0x14]; - /* 0x28 */ CsCmdActorAction* actorActions[10]; -} CutsceneContext; // size = 0x50 + /* 0x00 */ u8 sceneCsCount; + /* 0x04 */ void* segment; + /* 0x08 */ u8 state; + /* 0x0C */ f32 unk_0C; + /* 0x10 */ u16 frames; + /* 0x12 */ u16 unk_12; + /* 0x14 */ s32 unk_14; + /* 0x18 */ u16 unk_18; + /* 0x1A */ u8 unk_1A; + /* 0x1B */ u8 unk_1B; + /* 0x1C */ CutsceneCameraPoint* cameraFocus; + /* 0x20 */ CutsceneCameraPoint* cameraPosition; + /* 0x24 */ CsCmdActorAction* linkAction; + /* 0x28 */ CsCmdActorAction* npcActions[10]; // "npcdemopnt" + /* 0x50 */ CutsceneEntry* sceneCsList; +} CutsceneContext; // size = 0x54 typedef struct { /* 0x0 */ s16 x; @@ -209,11 +214,22 @@ typedef struct { /* 0x7 */ u8 unk7; } FireObjLightParams; // size = 0x8 +//! @TODO: Make this use `sizeof(AnyFontTextureSymbol)` +#define FONT_CHAR_TEX_SIZE ((16 * 16) / 2) + // Font textures are loaded into here typedef struct { - /* 0x0000 */ u8 unk0[2][120][128]; - /* 0x7800 */ u8 unk7800[93][128]; -} Font; // size = 0xA680 + /* 0x00000 */ u8 charBuf[2][FONT_CHAR_TEX_SIZE * 120]; + /* 0x07800 */ u8 iconBuf[FONT_CHAR_TEX_SIZE]; + /* 0x07880 */ u8 fontBuf[FONT_CHAR_TEX_SIZE * 320]; + /* 0x11880 */ union { + u8 schar[640]; + u16 wchar[640]; + } msgBuf; + /* 0x11D80 */ u8* messageStart; + /* 0x11D84 */ u8* messageEnd; + /* 0x11D88 */ u8 unk_11D88; +} Font; // size = 0x11D8C typedef struct { /* 0x0000 */ u8 unk0; @@ -326,13 +342,17 @@ typedef struct { } ShrinkWindowContext; // size = 0x4 typedef struct { - /* 0x00 */ UNK_TYPE1 pad0[0x4]; - /* 0x04 */ void* savefile; - /* 0x08 */ UNK_TYPE1 pad8[0x4]; - /* 0x0C */ s16 unkC; - /* 0x0E */ UNK_TYPE1 padE[0xA]; - /* 0x18 */ OSTime unk18; -} SramContext; // size = 0x20 + /* 0x00 */ u8* readBuff; + /* 0x04 */ u32* flashReadBuff; + /* 0x08 */ char unk_08[4]; + /* 0x0C */ s16 status; + /* 0x10 */ u32 curPage; + /* 0x14 */ u32 numPages; + /* 0x18 */ OSTime unk_18; + /* 0x20 */ s16 unk_20; + /* 0x22 */ s16 unk_22; + /* 0x24 */ s16 unk_24; +} SramContext; // size = 0x28 typedef struct { /* 0x00 */ UNK_TYPE4 unk0; @@ -615,227 +635,257 @@ typedef struct { typedef void(*fault_update_input_func)(Input* input); +typedef struct { + /* 0x00 */ u8 noteIdx; + /* 0x01 */ u8 state; + /* 0x02 */ u8 pos; +} OcarinaStaff; // size = 0x3; + typedef struct { /* 0x000 */ View view; - /* 0x168 */ UNK_TYPE1 pad168[0x84]; - /* 0x1EC */ u16 unk1EC; - /* 0x1EE */ u16 unk1EE; - /* 0x1F0 */ u8 unk1F0; - /* 0x1F1 */ UNK_TYPE1 pad1F1[0x3]; - /* 0x1F4 */ f32 unk1F4; - /* 0x1F8 */ UNK_TYPE1 pad1F8[0xC]; - /* 0x204 */ u16 unk204; - /* 0x206 */ UNK_TYPE1 pad206[0x6]; - /* 0x20C */ f32 unk20C; - /* 0x210 */ f32 unk210; - /* 0x214 */ f32 unk214; - /* 0x218 */ f32 unk218; - /* 0x21C */ f32 unk21C; - /* 0x220 */ f32 unk220; - /* 0x224 */ UNK_TYPE1 pad224[0xAC]; + /* 0x168 */ u8* iconItemSegment; + /* 0x16C */ u8* iconItem24Segment; + /* 0x170 */ u8* unk_170; + /* 0x174 */ u8* unk_174; + /* 0x178 */ u8* unk_178; + /* 0x17C */ u8* unk_17C; + /* 0x180 */ Vtx* itemPageVtx; + /* 0x184 */ Vtx* mapPageVtx; + /* 0x188 */ Vtx* questPageVtx; + /* 0x18C */ Vtx* maskPageVtx; + /* 0x190 */ Vtx* itemVtx; + /* 0x194 */ Vtx* mapVtx; + /* 0x198 */ Vtx* questVtx; + /* 0x19C */ Vtx* maskVtx; + /* 0x1A0 */ Vtx* unk_1A0; + /* 0x1A4 */ Vtx* unk_1A4; + /* 0x1A8 */ Vtx* cursorVtx; + /* 0x1AC */ OcarinaStaff* ocarinaStaff; + /* 0x1B0 */ DmaRequest unk_1B0; + /* 0x1D0 */ OSMesgQueue loadQueue; + /* 0x1E8 */ OSMesg loadMsg; + /* 0x1EC */ u16 state; + /* 0x1EE */ u16 debugState; + /* 0x1F0 */ u8 unk_1F0; + /* 0x1F4 */ Vec3f eye; + /* 0x200 */ u16 unk_200; + /* 0x202 */ u16 mode; + /* 0x204 */ u16 pageIndex; + /* 0x206 */ u16 unk_206; + /* 0x208 */ u16 unk_208; + /* 0x20C */ f32 unk_20C; + /* 0x210 */ f32 unk_210; + /* 0x214 */ f32 unk_214; + /* 0x218 */ f32 unk_218; + /* 0x21C */ f32 unk_21C; + /* 0x220 */ f32 unk_220; + /* 0x224 */ u16 alpha; + /* 0x226 */ s16 offsetY; + /* 0x228 */ s32 unk_228; + /* 0x22C */ s32 unk_22C; + /* 0x230 */ s32 unk_230; + /* 0x234 */ s32 unk_234; + /* 0x238 */ s16 unk_238[5]; + /* 0x242 */ s16 unk_242[5]; + /* 0x24C */ s16 unk_24C[5]; + /* 0x256 */ s16 unk_256; + /* 0x258 */ s16 unk_258; + /* 0x25A */ s16 unk_25A; + /* 0x25C */ u16 unk_25C; + /* 0x25E */ u16 unk_25E[5]; + /* 0x268 */ u16 unk_268[5]; + /* 0x272 */ u16 equipTargetItem; + /* 0x274 */ u16 equipTargetSlot; + /* 0x276 */ u16 equipTargetCBtn; + /* 0x278 */ s16 equipAnimX; + /* 0x27A */ s16 equipAnimY; + /* 0x27C */ s16 equipAnimAlpha; + /* 0x27E */ s16 unk_27E; + /* 0x280 */ u16 unk_280; + /* 0x282 */ u16 unk_282; + /* 0x284 */ s16 unk_284; + /* 0x286 */ s16 unk_286; + /* 0x288 */ f32 unk_288; + /* 0x28C */ f32 unk_28C; + /* 0x290 */ f32 unk_290; + /* 0x294 */ f32 unk_294; + /* 0x298 */ f32 unk_298; + /* 0x29C */ s16 unk_29C; + /* 0x29E */ s16 unk_29E; + /* 0x2A0 */ s16 unk_2A0; + /* 0x2A2 */ u8 worldMapPoints[20]; + /* 0x2B6 */ u8 unk_2B6; + /* 0x2B7 */ u8 unk_2B7; + /* 0x2B8 */ u8 unk_2B8; + /* 0x2B9 */ u8 unk_2B9; + /* 0x2BA */ s16 unk_2BA; + /* 0x2BC */ s16 unk_2BC; + /* 0x2BE */ s16 unk_2BE[5]; + /* 0x2C8 */ u16 unk_2C8; + /* 0x2CA */ s16 unk_2CA; } PauseContext; // size = 0x2D0 typedef struct { /* 0x000 */ View view; - /* 0x168 */ char unk_168[0xB4]; + /* 0x168 */ Vtx* actionVtx; + /* 0x16C */ Vtx* beatingHeartVtx; + /* 0x170 */ u8* parameterSegment; + /* 0x174 */ u8* doActionSegment; + /* 0x178 */ u8* iconItemSegment; + /* 0x17C */ u8* mapSegment; + /* 0x180 */ u8* unk_180; + /* 0x184 */ DmaRequest dmaRequest_184; + /* 0x1A4 */ DmaRequest dmaRequest_1A4; + /* 0x1C4 */ DmaRequest dmaRequest_1C4; + /* 0x1E4 */ OSMesgQueue loadQueue; + /* 0x1FC */ OSMesg loadMsg; + /* 0x200 */ Viewport viewport; + /* 0x210 */ s16 unk_210; + /* 0x212 */ u16 unk_212; + /* 0x214 */ u16 unk_214; + /* 0x218 */ f32 unk_218; /* 0x21C */ s16 unk_21C; /* 0x21E */ s16 unk_21E; - /* 0x220 */ char unk_220[6]; - /* 0x226 */ s16 lifeColorChange; - /* 0x228 */ s16 lifeColorChangeDirection; - /* 0x22A */ s16 unk22A; - /* 0x22C */ s16 unk22C; - /* 0x22E */ s16 unk22E; - /* 0x230 */ s16 unk230; - /* 0x232 */ s16 unk232; - /* 0x234 */ s16 unk234; - /* 0x236 */ s16 unk236; - /* 0x238 */ s16 unk238; - /* 0x23A */ s16 unk23A; - /* 0x23C */ s16 unk23C; - /* 0x23E */ s16 unk23E; - /* 0x240 */ s16 unk240; - /* 0x242 */ s16 unk242; - /* 0x244 */ s16 unk244; - /* 0x246 */ s16 unk246; - /* 0x248 */ s16 unk248; - /* 0x24A */ s16 unk24A; - /* 0x24C */ s16 unk24C; - /* 0x24E */ s16 unk24E; - /* 0x250 */ s16 unk250; - /* 0x252 */ s16 lifeSizeChange; - /* 0x254 */ s16 lifeSizeChangeDirection; // 1 means shrinking, 0 growing - /* 0x256 */ char unk_256[0x06]; - /* 0x25C */ u16 unk25C; - /* 0x25E */ char unk_25E[0x12]; - /* 0x270 */ s16 lifeAlpha; - /* 0x272 */ char unk_272[0xD6]; + /* 0x220 */ s16 unk_220; + /* 0x222 */ s16 unk_222; + /* 0x224 */ s16 unk_224; + /* 0x226 */ s16 unk_226; + /* 0x228 */ s16 unk_228; + /* 0x22A */ s16 beatingHeartPrim[3]; + /* 0x230 */ s16 beatingHeartEnv[3]; + /* 0x236 */ s16 heartsPrimR[2]; + /* 0x23A */ s16 heartsPrimG[2]; + /* 0x23E */ s16 heartsPrimB[2]; + /* 0x242 */ s16 heartsEnvR[2]; + /* 0x246 */ s16 heartsEnvG[2]; + /* 0x24A */ s16 heartsEnvB[2]; + /* 0x24E */ s16 unk_24E; + /* 0x250 */ s16 unk_250; + /* 0x252 */ s16 unk_252; + /* 0x254 */ s16 beatingHeartState; // 1 means shrinking, 0 growing + /* 0x256 */ s16 unk_256; + /* 0x258 */ s16 unk_258; + /* 0x25A */ u8 numHorseBoosts; + /* 0x25C */ u16 unk_25C; + /* 0x25E */ u16 unk_25E; + /* 0x260 */ u16 hbaAmmo; + /* 0x262 */ u16 unk_262; + /* 0x264 */ s16 unk_264; + /* 0x266 */ s16 aAlpha; + /* 0x268 */ s16 bAlpha; + /* 0x26A */ s16 cLeftAlpha; + /* 0x26C */ s16 cDownAlpha; + /* 0x26E */ s16 cRightAlpha; + /* 0x270 */ s16 healthAlpha; + /* 0x272 */ s16 magicAlpha; + /* 0x274 */ s16 minimapAlpha; + /* 0x276 */ s16 startAlpha; + /* 0x278 */ s16 unk_278; + /* 0x27A */ s16 unk_27A; + /* 0x27C */ s16 mapRoomNum; + /* 0x27E */ u8 unk_27E; + /* 0x27F */ u8 unk_27F; + /* 0x280 */ u8 unk_280; + /* 0x282 */ s16 unk_282; + /* 0x284 */ s16 unk_284; + /* 0x286 */ s16 unk_286; + /* 0x288 */ s16 unk_288; + /* 0x28A */ s16 unk_28A[8]; + /* 0x29A */ u16 unk_29A[8]; + /* 0x2AA */ s16 unk_2AA[8]; + /* 0x2BC */ f32 unk_2BC[8]; + /* 0x2DC */ f32 unk_2DC[8]; + /* 0x2FC */ s16 unk_2FC[4]; + /* 0x304 */ s16 unk_304; + /* 0x306 */ s16 unk_306; + /* 0x308 */ s16 unk_308; + /* 0x30A */ s16 unk_30A; + /* 0x30C */ s16 unk_30C; + struct { + /* 0x30E */ u8 unk_30E; // "h_gauge" + /* 0x30F */ u8 bButton; + /* 0x310 */ u8 aButton; + /* 0x311 */ u8 tradeItems; + /* 0x312 */ u8 unk_312; + /* 0x313 */ u8 unk_313; + /* 0x314 */ u8 unk_314; + /* 0x315 */ u8 songOfSoaring; + /* 0x316 */ u8 songOfStorms; + /* 0x317 */ u8 unk_317; + /* 0x318 */ u8 pictographBox; + /* 0x319 */ u8 all; // "another"; enables all item restrictions + } restrictions; // size = 0xC + /* 0x31A */ u8 unk_31A; + /* 0x31B */ u8 unk_31B; + /* 0x31C */ u8 unk_31C; + /* 0x320 */ OSMesgQueue unk_320; + /* 0x338 */ OSMesg unk_338; + /* 0x33C */ void* unk_33C; + /* 0x340 */ u32 unk_340; + /* 0x344 */ u32 unk_344; } InterfaceContext; // size = 0x348 -// us rev 1: 803FDB24 -typedef struct KankyoContext { - /* 0x00 */ UNK_TYPE1 unk0; - /* 0x01 */ UNK_TYPE1 unk1; - /* 0x02 */ u16 unk2; - /* 0x04 */ f32 unk4; - /* 0x08 */ f32 unk8; - /* 0x0C */ f32 unkC; - /* 0x10 */ u8 unk10; - /* 0x11 */ u8 unk11; - /* 0x12 */ UNK_TYPE1 unk12; - /* 0x13 */ UNK_TYPE1 unk13; - /* 0x14 */ UNK_TYPE1 unk14; - /* 0x15 */ u8 unk15; - /* 0x16 */ u8 unk16; - /* 0x17 */ u8 unk17; - /* 0x18 */ u8 unk18; - /* 0x19 */ UNK_TYPE1 unk19; - /* 0x1A */ UNK_TYPE1 unk1A; - /* 0x1B */ UNK_TYPE1 unk1B; - /* 0x1C */ UNK_TYPE1 unk1C; - /* 0x1D */ UNK_TYPE1 unk1D; - /* 0x1E */ u8 unk1E; - /* 0x1F */ u8 unk1F; - /* 0x20 */ u8 unk20; - /* 0x21 */ u8 unk21; - /* 0x22 */ u16 unk22; - /* 0x24 */ u16 unk24; - /* 0x26 */ UNK_TYPE1 unk26; - /* 0x27 */ UNK_TYPE1 unk27; - /* 0x28 */ LightInfo unk28; - /* 0x36 */ LightInfo unk36; - /* 0x44 */ UNK_TYPE1 unk44; - /* 0x45 */ UNK_TYPE1 unk45; - /* 0x46 */ UNK_TYPE1 unk46; - /* 0x47 */ UNK_TYPE1 unk47; - /* 0x48 */ UNK_TYPE1 unk48; - /* 0x49 */ UNK_TYPE1 unk49; - /* 0x4A */ UNK_TYPE1 unk4A; - /* 0x4B */ UNK_TYPE1 unk4B; - /* 0x4C */ UNK_TYPE1 unk4C; - /* 0x4D */ UNK_TYPE1 unk4D; - /* 0x4E */ UNK_TYPE1 unk4E; - /* 0x4F */ UNK_TYPE1 unk4F; - /* 0x50 */ UNK_TYPE1 unk50; - /* 0x51 */ UNK_TYPE1 unk51; - /* 0x52 */ UNK_TYPE1 unk52; - /* 0x53 */ UNK_TYPE1 unk53; - /* 0x54 */ UNK_TYPE1 unk54; - /* 0x55 */ UNK_TYPE1 unk55; - /* 0x56 */ UNK_TYPE1 unk56; - /* 0x57 */ UNK_TYPE1 unk57; - /* 0x58 */ UNK_TYPE1 unk58; - /* 0x59 */ UNK_TYPE1 unk59; - /* 0x5A */ UNK_TYPE1 unk5A; - /* 0x5B */ UNK_TYPE1 unk5B; - /* 0x5C */ UNK_TYPE1 unk5C; - /* 0x5D */ UNK_TYPE1 unk5D; - /* 0x5E */ UNK_TYPE1 unk5E; - /* 0x5F */ UNK_TYPE1 unk5F; - /* 0x60 */ UNK_TYPE1 unk60; - /* 0x61 */ UNK_TYPE1 unk61; - /* 0x62 */ UNK_TYPE1 unk62; - /* 0x63 */ UNK_TYPE1 unk63; - /* 0x64 */ UNK_TYPE1 unk64; - /* 0x65 */ UNK_TYPE1 unk65; - /* 0x66 */ UNK_TYPE1 unk66; - /* 0x67 */ UNK_TYPE1 unk67; - /* 0x68 */ UNK_TYPE1 unk68; - /* 0x69 */ UNK_TYPE1 unk69; - /* 0x6A */ UNK_TYPE1 unk6A; - /* 0x6B */ UNK_TYPE1 unk6B; - /* 0x6C */ UNK_TYPE1 unk6C; - /* 0x6D */ UNK_TYPE1 unk6D; - /* 0x6E */ UNK_TYPE1 unk6E; - /* 0x6F */ UNK_TYPE1 unk6F; - /* 0x70 */ UNK_TYPE1 unk70; - /* 0x71 */ UNK_TYPE1 unk71; - /* 0x72 */ UNK_TYPE1 unk72; - /* 0x73 */ UNK_TYPE1 unk73; - /* 0x74 */ UNK_TYPE1 unk74; - /* 0x75 */ UNK_TYPE1 unk75; - /* 0x76 */ UNK_TYPE1 unk76; - /* 0x77 */ UNK_TYPE1 unk77; - /* 0x78 */ UNK_TYPE1 unk78; - /* 0x79 */ UNK_TYPE1 unk79; - /* 0x7A */ UNK_TYPE1 unk7A; - /* 0x7B */ UNK_TYPE1 unk7B; - /* 0x7C */ UNK_TYPE1 unk7C; - /* 0x7D */ UNK_TYPE1 unk7D; - /* 0x7E */ UNK_TYPE1 unk7E; - /* 0x7F */ UNK_TYPE1 unk7F; - /* 0x80 */ UNK_TYPE1 unk80; - /* 0x81 */ UNK_TYPE1 unk81; - /* 0x82 */ UNK_TYPE1 unk82; - /* 0x83 */ UNK_TYPE1 unk83; - /* 0x84 */ UNK_TYPE1 unk84; - /* 0x85 */ UNK_TYPE1 unk85; - /* 0x86 */ UNK_TYPE1 unk86; - /* 0x87 */ UNK_TYPE1 unk87; - /* 0x88 */ UNK_TYPE1 unk88; - /* 0x89 */ UNK_TYPE1 unk89; - /* 0x8A */ UNK_TYPE1 unk8A; - /* 0x8B */ UNK_TYPE1 unk8B; - /* 0x8C */ Vec3s unk8C; - /* 0x92 */ Vec3s unk92; - /* 0x98 */ Vec3s unk98; - /* 0x9E */ Vec3s unk9E; - /* 0xA4 */ s16 unkA4; - /* 0xA6 */ s16 unkA6; - /* 0xA8 */ UNK_TYPE1 unkA8; - /* 0xA9 */ UNK_TYPE1 unkA9; - /* 0xAA */ UNK_TYPE1 unkAA; - /* 0xAB */ UNK_TYPE1 unkAB; - /* 0xAC */ s16 windWest; - /* 0xAE */ s16 windVertical; - /* 0xB0 */ s16 windSouth; - /* 0xB2 */ UNK_TYPE1 unkB2; - /* 0xB3 */ UNK_TYPE1 unkB3; - /* 0xB4 */ f32 windClothIntensity; - /* 0xB8 */ u8 environmentSettingsCount; - /* 0xB9 */ UNK_TYPE1 unkB9; - /* 0xBA */ UNK_TYPE1 unkBA; - /* 0xBB */ UNK_TYPE1 unkBB; - /* 0xBC */ void* environmentSettingsList; - /* 0xC0 */ UNK_TYPE1 unkC0; - /* 0xC1 */ u8 unkC1; - /* 0xC2 */ u8 unkC2; - /* 0xC3 */ u8 unkC3; - /* 0xC4 */ Color_RGB8 unkC4; - /* 0xC7 */ s8 unkC7; - /* 0xC8 */ s8 unkC8; - /* 0xC9 */ s8 unkC9; - /* 0xCA */ Color_RGB8 unkCA; - /* 0xCD */ s8 unkCD; - /* 0xCE */ s8 unkCE; - /* 0xCF */ s8 unkCF; - /* 0xD0 */ Color_RGB8 unkD0; - /* 0xD3 */ Color_RGB8 unkD3; - /* 0xD6 */ s16 unkD6; - /* 0xD8 */ s16 unkD8; - /* 0xDA */ UNK_TYPE1 unkDA; - /* 0xDB */ UNK_TYPE1 unkDB; - /* 0xDC */ f32 unkDC; - /* 0xE0 */ u8 unkE0; - /* 0xE1 */ UNK_TYPE1 unkE1; - /* 0xE2 */ s8 unkE2; - /* 0xE3 */ u8 unkE3; // modified by unused func in EnWeatherTag - /* 0xE4 */ UNK_TYPE1 unkE4; - /* 0xE5 */ UNK_TYPE1 unkE5; - /* 0xE6 */ UNK_TYPE1 unkE6; - /* 0xE7 */ UNK_TYPE1 unkE7; - /* 0xE8 */ UNK_TYPE1 unkE8; - /* 0xE9 */ UNK_TYPE1 unkE9; - /* 0xEA */ u8 unkEA; - /* 0xEB */ UNK_TYPE1 unkEB; - /* 0xEC */ UNK_TYPE1 unkEC; - /* 0xED */ UNK_TYPE1 unkED; - /* 0xEE */ UNK_TYPE1 unkEE; - /* 0xEF */ UNK_TYPE1 unkEF; - /* 0xF0 */ UNK_TYPE1 unkF0; - /* 0xF1 */ UNK_TYPE1 unkF1; - /* 0xF2 */ u8 unkF2[0xC]; // F2-F6 are used by weather tag -} KankyoContext; // size = 0xFE +typedef struct { + /* 0x00 */ u16 unk_0; + /* 0x02 */ u16 unk_2; + /* 0x04 */ f32 unk_4; + /* 0x08 */ f32 unk_8; + /* 0x0C */ f32 unk_C; + /* 0x10 */ u8 unk_10; + /* 0x11 */ u8 unk_11; + /* 0x12 */ u8 unk_12; + /* 0x13 */ u8 unk_13; + /* 0x14 */ u8 unk_14; + /* 0x15 */ u8 unk_15; + /* 0x16 */ u8 unk_16; + /* 0x17 */ u8 unk_17; + /* 0x18 */ u8 unk_18; + /* 0x19 */ u8 unk_19; + /* 0x1A */ u16 unk_1A; + /* 0x1C */ u16 unk_1C; + /* 0x1E */ u8 unk_1E; + /* 0x1F */ u8 unk_1F; + /* 0x20 */ u8 unk_20; + /* 0x21 */ u8 unk_21; + /* 0x22 */ u16 unk_22; + /* 0x24 */ u16 unk_24; + /* 0x26 */ u8 unk_26; + /* 0x28 */ LightInfo unk_28; // sun 1 + /* 0x36 */ LightInfo unk_36; // sun 2 + /* 0x44 */ s8 unk_44; + /* 0x48 */ DmaRequest unk_48; + /* 0x68 */ OSMesgQueue unk_68; + /* 0x80 */ OSMesg unk_80; + /* 0x84 */ f32 unk_84; + /* 0x88 */ f32 unk_88; + /* 0x8C */ LightSettings2 unk_8C; + /* 0xA8 */ f32 unk_A8; + /* 0xAC */ Vec3s windDir; + /* 0xB4 */ f32 windSpeed; + /* 0xB8 */ u8 numLightSettings; + /* 0xBC */ LightSettings* lightSettingsList; + /* 0xC0 */ u8 unk_C0; + /* 0xC1 */ u8 unk_C1; + /* 0xC2 */ u8 unk_C2; + /* 0xC3 */ u8 unk_C3; + /* 0xC4 */ LightSettings unk_C4; + /* 0xDA */ u16 unk_DA; + /* 0xDC */ f32 unk_DC; + /* 0xE0 */ u8 unk_E0; + /* 0xE1 */ u8 unk_E1; + /* 0xE2 */ s8 unk_E2; + /* 0xE3 */ u8 unk_E3; // modified by unused func in EnWeatherTag + /* 0xE4 */ u8 unk_E4; + /* 0xE5 */ u8 unk_E5; + /* 0xE6 */ u8 unk_E6[4]; + /* 0xEA */ u8 unk_EA; + /* 0xEB */ u8 unk_EB; + /* 0xEC */ u8 unk_EC; + /* 0xED */ u8 unk_ED; + /* 0xEE */ u8 unk_EE[4]; + /* 0xF2 */ u8 unk_F2[8]; + /* 0xFA */ u8 unk_FA[4]; +} EnvironmentContext; // size = 0x100 typedef struct { /* 0x00000 */ View view; @@ -893,7 +943,7 @@ typedef struct { /* 0x4C */ u8 unk_4C; /* 0x4D */ u8 unk_4D; /* 0x4E */ char unk_4E[2]; -} PreRenderContext; // size = 0x50 +} PreRender; // size = 0x50 typedef struct { /* 0x00 */ void* timg; @@ -914,9 +964,7 @@ typedef struct { typedef struct { /* 0x00000 */ View view; /* 0x00168 */ Font font; - /* 0x0A7E8 */ UNK_TYPE1 padA7E8[0x7708]; - /* 0x11EF0 */ u8 unk11EF0; - /* 0x11EF1 */ UNK_TYPE1 pad11EF1[0x13]; + /* 0x11EF4 */ char unk_11EF4[0x10]; /* 0x11F04 */ u16 unk11F04; /* 0x11F06 */ UNK_TYPE1 pad11F06[0x4]; /* 0x11F0A */ u8 unk11F0A; @@ -938,8 +986,8 @@ typedef struct { /* 0x12070 */ UNK_TYPE1 pad12070[0x8]; /* 0x12078 */ s32 bankRupeesSelected; /* 0x1207C */ s32 bankRupees; - /* 0x12080 */ UNK_TYPE1 pad12080[0x58]; -} MessageContext; // size = 0x120D8 + /* 0x12080 */ UNK_TYPE1 pad12080[0x60]; +} MessageContext; // size = 0x120E0 typedef struct ActorBgMbarChair ActorBgMbarChair; @@ -1076,18 +1124,17 @@ struct PreNMIContext { struct TitleContext { /* 0x000 */ GameState state; - /* 0x0A4 */ u8* nintendo_logo_data; + /* 0x0A4 */ u8* staticSegment; /* 0x0A8 */ View view; - /* 0x210 */ SramContext sram; - /* 0x230 */ UNK_TYPE1 pad230[0x8]; - /* 0x238 */ s16 unk238; - /* 0x23A */ s16 logoCoverAlpha; - /* 0x23C */ s16 logoCoverAlphaChangePerFrame; - /* 0x23E */ s16 logoFullVisibilityDuration; - /* 0x240 */ s16 frameCounter; - /* 0x242 */ UNK_TYPE2 frameCounterMod0x80; - /* 0x244 */ u8 switchToNextGameState; - /* 0x245 */ UNK_TYPE1 pad245[0x3]; + /* 0x210 */ SramContext sramCtx; + /* 0x238 */ s16 mode; + /* 0x23A */ s16 timer; + /* 0x23C */ s16 coverAlpha; + /* 0x23E */ s16 addAlpha; + /* 0x240 */ s16 visibleDuration; + /* 0x242 */ s16 ult; + /* 0x244 */ s16 uls; + /* 0x246 */ u8 exit; }; // size = 0x248 struct DaytelopContext { @@ -1102,52 +1149,96 @@ struct DaytelopContext { }; // size = 0x248 struct FileChooseContext { - /* 0x00000 */ GameState common; - /* 0x000A4 */ UNK_TYPE1 padA4[0x14]; + /* 0x00000 */ GameState state; + /* 0x000A8 */ u8* staticSegment; + /* 0x000AC */ u8* parameterSegment; + /* 0x000B0 */ u8* titleSegment; /* 0x000B8 */ View view; - /* 0x00220 */ SramContext sram; - /* 0x00240 */ UNK_TYPE1 pad240[0x12310]; - /* 0x12550 */ Font unk12550; - /* 0x1CBD0 */ UNK_TYPE1 pad1CBD0[0x78B0]; - /* 0x24480 */ s16 unk24480; - /* 0x24482 */ UNK_TYPE1 pad24482[0x2]; - /* 0x24484 */ s16 unk24484; - /* 0x24486 */ s16 unk24486; - /* 0x24488 */ UNK_TYPE1 pad24488[0x4]; - /* 0x2448C */ s16 unk2448C; - /* 0x2448E */ UNK_TYPE1 pad2448E[0x1A]; - /* 0x244A8 */ s16 unk244A8; - /* 0x244AA */ UNK_TYPE1 pad244AA[0x2]; - /* 0x244AC */ s16 unk244AC; - /* 0x244AE */ s16 unk244AE; - /* 0x244B0 */ s16 unk244B0; - /* 0x244B2 */ s16 unk244B2; - /* 0x244B4 */ s16 unk244B4; - /* 0x244B6 */ s16 unk244B6; - /* 0x244B8 */ s16 unk244B8; - /* 0x244BA */ s16 unk244BA; - /* 0x244BC */ UNK_TYPE1 pad244BC[0x18]; - /* 0x244D4 */ s16 unk244D4; - /* 0x244D6 */ UNK_TYPE1 pad244D6[0x4]; - /* 0x244DA */ s16 unk244DA; - /* 0x244DC */ UNK_TYPE1 pad244DC[0xA]; - /* 0x244E6 */ s16 unk244E6; - /* 0x244E8 */ UNK_TYPE1 pad244E8[0x8]; - /* 0x244F0 */ s16 unk244F0; - /* 0x244F2 */ s16 unk244F2; - /* 0x244F4 */ UNK_TYPE1 pad244F4[0x6]; - /* 0x244FA */ s16 inputXChangeCooldown; - /* 0x244FC */ s16 inputYChangeCooldown; - /* 0x244FE */ s16 inputXDir; - /* 0x24500 */ s16 inputYDir; - /* 0x24502 */ s16 inputX; - /* 0x24504 */ s16 inputY; - /* 0x24506 */ UNK_TYPE1 pad24506[0x2]; - /* 0x24508 */ s16 unk24508; - /* 0x2450A */ s16 unk2450A; - /* 0x2450C */ UNK_TYPE1 pad2450C[0x1C]; - /* 0x24528 */ s16 unk24528; - /* 0x2452A */ UNK_TYPE1 pad2452A[0x2E]; + /* 0x00220 */ SramContext sramCtx; + /* 0x00248 */ SkyboxContext skyboxCtx; + /* 0x00470 */ MessageContext msgCtx; + /* 0x12550 */ Font font; + /* 0x242E0 */ EnvironmentContext envCtx; + /* 0x243E0 */ Vtx* unk_243E0; + /* 0x243E4 */ Vtx* unk_243E4; + /* 0x243E8 */ Vtx* unk_243E8; + /* 0x243EC */ Vtx* unk_243EC; + /* 0x243F0 */ Vtx* unk_243F0; + /* 0x243F4 */ u8 newf[6][4]; + /* 0x2440C */ u16 unk_2440C[4]; + /* 0x24414 */ u8 unk_24414[8][4]; + /* 0x24434 */ s16 healthCapacity[4]; + /* 0x2443C */ s16 health[4]; + /* 0x24444 */ u32 unk_24444[4]; + /* 0x24454 */ s8 unk_24454[4]; + /* 0x24458 */ u16 unk_24458[4]; + /* 0x24460 */ s16 unk_24460[4]; + /* 0x24468 */ u8 unk_24468[4]; + /* 0x2446C */ s16 rupees[4]; + /* 0x24474 */ u8 unk_24474[4]; + /* 0x24478 */ u8 unk_24478[4]; + /* 0x2447C */ u8 unk_2447C[4]; + /* 0x24480 */ s16 unk_24480; + /* 0x24482 */ s16 unk_24482; + /* 0x24484 */ s16 unk_24484; + /* 0x24486 */ s16 unk_24486; + /* 0x24488 */ s16 unk_24488; + /* 0x2448A */ s16 unk_2448A; + /* 0x2448C */ s16 unk_2448C; + /* 0x2448E */ s16 unk_2448E; + /* 0x24490 */ s16 unk_24490; + /* 0x24492 */ s16 unk_24492[3]; + /* 0x24498 */ s16 unk_24498; + /* 0x2449A */ s16 unk_2449A[6]; + /* 0x244A6 */ s16 unk_244A6; + /* 0x244A8 */ s16 unk_244A8; + /* 0x244AA */ s16 unk_244AA; + /* 0x244AC */ s16 unk_244AC; + /* 0x244AE */ s16 unk_244AE; + /* 0x244B0 */ s16 unk_244B0[3]; + /* 0x244B6 */ s16 unk_244B6[2]; + /* 0x244BA */ s16 unk_244BA; + /* 0x244BC */ s16 unk_244BC[3]; + /* 0x244C2 */ s16 unk_244C2[3]; + /* 0x244C8 */ s16 unk_244C8[3]; + /* 0x244CE */ s16 unk_244CE[3]; + /* 0x244D4 */ s16 unk_244D4[3]; + /* 0x244DA */ s16 unk_244DA[4]; + /* 0x244E2 */ s16 unk_244E2; + /* 0x244E4 */ s16 unk_244E4; + /* 0x244E6 */ s16 unk_244E6; + /* 0x244E8 */ s16 unk_244E8; + /* 0x244EA */ s16 unk_244EA[4]; + /* 0x244F2 */ s16 unk_244F2; + /* 0x244F4 */ s16 unk_244F4; + /* 0x244F6 */ s16 unk_244F6[2]; + /* 0x244FA */ s16 unk_244FA; + /* 0x244FC */ s16 unk_244FC; + /* 0x244FE */ s16 unk_244FE; + /* 0x24500 */ s16 unk_24500; + /* 0x24502 */ s16 unk_24502; + /* 0x24504 */ s16 unk_24504; + /* 0x24506 */ s16 unk_24506; + /* 0x24508 */ s16 unk_24508; + /* 0x2450A */ s16 unk_2450A; + /* 0x2450C */ f32 unk_2450C; + /* 0x24510 */ s16 unk_24510; + /* 0x24512 */ s16 unk_24512; + /* 0x24514 */ s16 unk_24514; + /* 0x24516 */ s16 unk_24516; + /* 0x24518 */ s16 unk_24518; + /* 0x2451A */ s16 unk_2451A; + /* 0x2451C */ s16 unk_2451C; + /* 0x2451E */ s16 unk_2451E[5]; + /* 0x24528 */ s16 unk_24528; + /* 0x2452A */ s16 unk_2452A; + /* 0x2452C */ s16 unk_2452C[4]; + /* 0x24534 */ s16 unk_24534[4]; + /* 0x2453C */ s16 unk_2453C[4]; + /* 0x24544 */ s16 unk_24544[4]; + /* 0x2454C */ s16 unk_2454C; + /* 0x2454E */ s16 unk_2454E; + /* 0x24550 */ s16 unk_24550; }; // size = 0x24558 typedef struct AudioThreadStruct AudioThreadStruct; @@ -1488,93 +1579,105 @@ struct ActorContext { /* 0x269 */ UNK_TYPE1 pad269[0x1B]; }; // size = 0x284 +typedef struct { + /* 0x00 */ u8 seqIndex; + /* 0x01 */ u8 nightSeqIndex; + /* 0x02 */ u8 unk_02; +} SoundContext; // size = 0x3 + +typedef struct { + /* 0x00 */ s32 enabled; + /* 0x04 */ s32 timer; +} FrameAdvanceContext; // size = 0x8 + +typedef struct { + /* 0x00 */ u16 state; +} GameOverContext; // size = 0x02 + struct GlobalContext { /* 0x00000 */ GameState state; /* 0x000A4 */ s16 sceneNum; - /* 0x000A6 */ u8 sceneConfig; // TODO: This at least controls the behavior of animated textures. Does it do more? - /* 0x000A7 */ UNK_TYPE1 padA7[0x9]; - /* 0x000B0 */ SceneCmd* currentSceneVram; - /* 0x000B4 */ UNK_TYPE1 padB4[0x4]; + /* 0x000A6 */ u8 sceneConfig; + /* 0x000A7 */ char unk_A7[0x9]; + /* 0x000B0 */ void* sceneSegment; + /* 0x000B4 */ char unk_B4[0x4]; /* 0x000B8 */ View view; - /* 0x00220 */ Camera activeCameras[4]; + /* 0x00220 */ Camera mainCamera; + /* 0x00398 */ Camera subCameras[3]; /* 0x00800 */ Camera* cameraPtrs[4]; /* 0x00810 */ s16 activeCamera; - /* 0x00812 */ s16 unk812; - /* 0x00814 */ u8 unk814; - /* 0x00815 */ u8 unk815; - /* 0x00816 */ UNK_TYPE1 pad816[0x2]; + /* 0x00812 */ s16 nextCamera; + /* 0x00814 */ SoundContext soundCtx; /* 0x00818 */ LightContext lightCtx; - /* 0x00828 */ u32 unk828; - /* 0x0082C */ UNK_TYPE1 pad82C[0x4]; + /* 0x00828 */ FrameAdvanceContext frameAdvCtx; /* 0x00830 */ CollisionContext colCtx; /* 0x01CA0 */ ActorContext actorCtx; /* 0x01F24 */ CutsceneContext csCtx; - /* 0x01F74 */ CutsceneEntry* cutsceneList; /* 0x01F78 */ SoundSource soundSources[16]; - /* 0x02138 */ EffFootmark footmarks[100]; - /* 0x046B8 */ SramContext sram; - /* 0x046D8 */ UNK_TYPE1 pad46D8[0x8]; + /* 0x02138 */ EffFootmark footprintInfo[100]; + /* 0x046B8 */ SramContext sramCtx; /* 0x046E0 */ SkyboxContext skyboxCtx; /* 0x04908 */ MessageContext msgCtx; - /* 0x169E0 */ UNK_TYPE1 pad169E0[0x8]; /* 0x169E8 */ InterfaceContext interfaceCtx; /* 0x16D30 */ PauseContext pauseCtx; - /* 0x17000 */ u16 unk17000; - /* 0x17002 */ UNK_TYPE1 pad17002[0x2]; - /* 0x17004 */ KankyoContext kankyoContext; + /* 0x17000 */ GameOverContext gameOverCtx; + /* 0x17004 */ EnvironmentContext envCtx; /* 0x17104 */ AnimationContext animationCtx; /* 0x17D88 */ ObjectContext objectCtx; - /* 0x186E0 */ RoomContext roomContext; - /* 0x18760 */ TransitionContext transitionCtx; + /* 0x186E0 */ RoomContext roomCtx; + /* 0x18760 */ DoorContext doorCtx; /* 0x18768 */ void (*playerInit)(Player* player, struct GlobalContext* globalCtx, FlexSkeletonHeader* skelHeader); /* 0x1876C */ void (*playerUpdate)(Player* player, struct GlobalContext* globalCtx, Input* input); - /* 0x18770 */ UNK_TYPE1 pad18770[0x8]; + /* 0x18770 */ void* unk_18770; //! @TODO: Determine function prototype + /* 0x18774 */ s32 (*startPlayerFishing)(struct GlobalContext* globalCtx); /* 0x18778 */ s32 (*grabPlayer)(struct GlobalContext* globalCtx, Player* player); - /* 0x1877C */ s32 (*func_1877C)(struct GlobalContext* globalCtx, Player* player, s32 arg2); + /* 0x1877C */ s32 (*startPlayerCutscene)(struct GlobalContext* globalCtx, Player* player, s32 mode); /* 0x18780 */ void (*func_18780)(Player* player, struct GlobalContext* globalCtx); /* 0x18784 */ s32 (*damagePlayer)(struct GlobalContext* globalCtx, s32 damage); - /* 0x18788 */ UNK_TYPE1 pad18788[0x10]; - /* 0x18798 */ void (*func_18798)(struct GlobalContext* globalCtx, void* arg1, s32 arg2); - /* 0x1879C */ UNK_TYPE1 pad1879C[0x14]; - /* 0x187B0 */ MtxF unk187B0; - /* 0x187F0 */ UNK_TYPE1 pad187F0[0xC]; - /* 0x187FC */ MtxF unk187FC; - /* 0x1883C */ UNK_TYPE1 pad1883C[0x4]; + /* 0x18788 */ void (*talkWithPlayer)(struct GlobalContext* globalCtx, Actor* actor); + /* 0x1878C */ void* unk_1878C; //! @TODO: Determine function prototype + /* 0x18790 */ void* unk_18790; //! @TODO: Determine function prototype + /* 0x18794 */ void* unk_18794; //! @TODO: Determine function prototype + /* 0x18798 */ s32 (*setPlayerTalkAnim)(struct GlobalContext* globalCtx, void* talkAnim, s32 arg2); + /* 0x1879C */ s16 unk_1879C[10]; + /* 0x187B0 */ MtxF projectionMatrix; + /* 0x187F0 */ Vec3f unk_187F0; + /* 0x187FC */ MtxF mf_187FC; + /* 0x1883C */ Mtx* unk_1883C; /* 0x18840 */ u32 gameplayFrames; - /* 0x18844 */ u8 unk18844; - /* 0x18845 */ u8 unk18845; - /* 0x18846 */ u16 sceneNumActorsToLoad; + /* 0x18844 */ u8 unk_18844; + /* 0x18845 */ u8 unk_18845; + /* 0x18846 */ s16 numSetupActors; /* 0x18848 */ u8 numRooms; - /* 0x18849 */ UNK_TYPE1 pad18849; - /* 0x1884A */ s16 unk1884A; /* 0x1884C */ RomFile* roomList; /* 0x18850 */ ActorEntry* linkActorEntry; /* 0x18854 */ ActorEntry* setupActorList; - /* 0x18858 */ UNK_PTR unk18858; + /* 0x18858 */ void* unk_18858; /* 0x1885C */ EntranceEntry* setupEntranceList; /* 0x18860 */ u16* setupExitList; /* 0x18864 */ Path* setupPathList; - /* 0x18868 */ UNK_PTR unk18868; + /* 0x18868 */ void* unk_18868; /* 0x1886C */ AnimatedMaterial* sceneMaterialAnims; - /* 0x18870 */ UNK_TYPE1 pad18870[0x4]; - /* 0x18874 */ u8 unk18874; - /* 0x18875 */ s8 unk18875; - /* 0x18876 */ UNK_TYPE1 pad18876[0x4]; + /* 0x18870 */ void* specialEffects; + /* 0x18874 */ u8 skyboxId; + /* 0x18875 */ s8 sceneLoadFlag; // "fade_direction" + /* 0x18876 */ s16 unk_18876; + /* 0x18878 */ s16 unk_18878; /* 0x1887A */ u16 nextEntranceIndex; - /* 0x1887C */ s8 unk1887C; - /* 0x1887D */ UNK_TYPE1 pad1887D[0x2]; - /* 0x1887F */ u8 unk1887F; - /* 0x18880 */ UNK_TYPE1 pad18880[0x4]; - /* 0x18884 */ CollisionCheckContext colCheckCtx; - /* 0x18B20 */ UNK_TYPE1 pad18B20[0x28]; + /* 0x1887C */ s8 unk_1887C; + /* 0x1887D */ s8 unk_1887D; + /* 0x1887E */ s8 unk_1887E; + /* 0x1887F */ u8 unk_1887F; + /* 0x18880 */ u8 unk_18880; + /* 0x18884 */ CollisionCheckContext colChkCtx; + /* 0x18B20 */ u16 envFlags[20]; /* 0x18B48 */ u8 curSpawn; - /* 0x18B49 */ UNK_TYPE1 pad18B49[0x1]; - /* 0x18B4A */ u8 unk18B4A; - /* 0x18B4B */ char pad18B4B[1]; - /* 0x18B4C */ PreRenderContext preRenderCtx; + /* 0x18B49 */ u8 unk_18B49; + /* 0x18B4A */ u8 unk_18B4A; + /* 0x18B4C */ PreRender pauseBgPreRender; /* 0x18B9C */ char unk_18B9C[0x2B8]; - /* 0x18E54 */ SceneTableEntry* currentSceneTableEntry; - /* 0x18E58 */ UNK_TYPE1 pad18E58[0x400]; + /* 0x18E54 */ SceneTableEntry* loadedScene; + /* 0x18E58 */ char unk_18E58[0x400]; }; // size = 0x19258 typedef struct { diff --git a/include/z64actor.h b/include/z64actor.h index a6726a731d..986dd0b5a5 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -103,7 +103,7 @@ typedef struct { /* 0x14 */ ActorInit* initInfo; /* 0x18 */ char* name; /* 0x1C */ u16 allocType; // bit 0: don't allocate memory, use actorContext->0x250? bit 1: Always keep loaded? - /* 0x1E */ s8 nbLoaded; // original name: "clients" + /* 0x1E */ s8 numLoaded; // original name: "clients" /* 0x1F */ UNK_TYPE1 pad1F[0x1]; } ActorOverlay; // size = 0x20 diff --git a/include/z64bgcheck.h b/include/z64bgcheck.h index 6a5e791ad1..7dc380bf2f 100644 --- a/include/z64bgcheck.h +++ b/include/z64bgcheck.h @@ -81,13 +81,13 @@ typedef struct { typedef struct { /* 0x00 */ Vec3s minBounds; // minimum coordinates of poly bounding box /* 0x06 */ Vec3s maxBounds; // maximum coordinates of poly bounding box - /* 0x0C */ u16 nbVertices; + /* 0x0C */ u16 numVertices; /* 0x10 */ Vec3s* vtxList; - /* 0x14 */ u16 nbPolygons; + /* 0x14 */ u16 numPolygons; /* 0x18 */ CollisionPoly* polyList; /* 0x1C */ SurfaceType* surfaceTypeList; /* 0x20 */ CamData* cameraDataList; - /* 0x24 */ u16 nbWaterBoxes; + /* 0x24 */ u16 numWaterBoxes; /* 0x28 */ WaterBox* waterBoxes; } CollisionHeader; // original name: BGDataInfo diff --git a/include/z64cutscene.h b/include/z64cutscene.h index 4bb167da9e..4ef0cc3522 100644 --- a/include/z64cutscene.h +++ b/include/z64cutscene.h @@ -4,6 +4,27 @@ #include #include +typedef struct { + /* 0x00 */ s8 continueFlag; + /* 0x01 */ s8 cameraRoll; + /* 0x02 */ u16 nextPointFrame; + /* 0x04 */ f32 viewAngle; // in degrees + /* 0x08 */ Vec3s pos; +} CutsceneCameraPoint; // size = 0x10 + +typedef struct { + /* 0x00 */ Vec3f at; + /* 0x0C */ Vec3f eye; + /* 0x18 */ s16 roll; + /* 0x1A */ s16 fov; +} CutsceneCameraAngle; // size = 0x1C + +typedef struct { + /* 0x0 */ CutsceneCameraPoint* atPoints; + /* 0x4 */ CutsceneCameraPoint* eyePoints; + /* 0x8 */ s16 relativeToPlayer; +} CutsceneCameraMove; // size = 0xC + typedef struct { /* 0x00 */ u16 unk0; // action; // "dousa" /* 0x02 */ u16 startFrame; diff --git a/include/z64light.h b/include/z64light.h index 6f78a5757a..c891d25ddc 100644 --- a/include/z64light.h +++ b/include/z64light.h @@ -5,6 +5,26 @@ #include #include +typedef struct { + /* 0x00 */ u8 ambientColor[3]; + /* 0x03 */ s8 diffuseDir1[3]; + /* 0x06 */ u8 diffuseColor1[3]; + /* 0x09 */ s8 diffusePos2[3]; + /* 0x0C */ u8 diffuseColor[3]; + /* 0x0F */ u8 fogColor[3]; + /* 0x12 */ u16 fogNear; + /* 0x14 */ u16 fogFar; +} LightSettings; // size = 0x16 + +typedef struct { + /* 0x00 */ s16 ambientColor[3]; + /* 0x06 */ s16 diffuseColor1[3]; + /* 0x0C */ s16 diffuseColor2[3]; + /* 0x12 */ s16 fogColor[3]; + /* 0x18 */ s16 fogNear; + /* 0x1A */ s16 fogFar; +} LightSettings2; // size = 0x1C + typedef struct { /* 0x0 */ s16 x; /* 0x2 */ s16 y; diff --git a/include/z64scene.h b/include/z64scene.h index 243aa73484..bc77076022 100644 --- a/include/z64scene.h +++ b/include/z64scene.h @@ -299,9 +299,9 @@ typedef struct { } TransitionActorEntry; // size = 0x10 typedef struct { - /* 0x00 */ u8 nbTransitionActors; + /* 0x00 */ u8 numTransitionActors; /* 0x04 */ TransitionActorEntry* transitionActorList; -} TransitionContext; +} DoorContext; typedef struct { /* 0x0 */ s16 id; @@ -468,17 +468,6 @@ typedef struct { u32 dListEnd; } MeshHeader2; -typedef struct { - u8 ambientClrR, ambientClrG, ambientClrB; - u8 diffuseClrA_R, diffuseClrA_G, diffuseClrA_B; - u8 diffuseDirA_X, diffuseDirA_Y, diffuseDirA_Z; - u8 diffuseClrB_R, diffuseClrB_G, diffuseClrB_B; - u8 diffuseDirB_X, diffuseDirB_Y, diffuseDirB_Z; - u8 fogClrR, fogClrG, fogClrB; - u16 unk; - u16 drawDistance; -} LightSettings; - typedef struct { /* 0x00 */ u8 count; // number of points in the path /* 0x01 */ s8 unk1; @@ -664,7 +653,7 @@ typedef enum { /* 0x70 */ SCENE_ALLEY } SceneID; -// Scene draw configs +// SceneTableEntry draw configs typedef enum { /* 0 */ SCENE_DRAW_CFG_DEFAULT, /* 1 */ SCENE_DRAW_CFG_MAT_ANIM, @@ -676,7 +665,7 @@ typedef enum { /* 7 */ SCENE_DRAW_CFG_MAT_ANIM_MANUAL_STEP } SceneDrawConfigIds; -// Scene commands +// SceneTableEntry commands typedef enum { /* 0x00 */ SCENE_CMD_ID_SPAWN_LIST, /* 0x01 */ SCENE_CMD_ID_ACTOR_LIST, @@ -759,8 +748,8 @@ typedef enum { #define SCENE_CMD_PATH_LIST(pathList) \ { SCENE_CMD_ID_PATH_LIST, 0, CMD_PTR(pathList) } -#define SCENE_CMD_TRANSITION_ACTOR_LIST(numTransitionActors, transitionActorList) \ - { SCENE_CMD_ID_TRANSI_ACTOR_LIST, numTransitionActors, CMD_PTR(transitionActorList) } +#define SCENE_CMD_TRANSITION_ACTOR_LIST(numTransitionActors, actorList) \ + { SCENE_CMD_ID_TRANSI_ACTOR_LIST, numTransitionActors, CMD_PTR(actorList) } #define SCENE_CMD_ENV_LIGHT_SETTINGS(numLightSettings, lightSettingsList) \ { SCENE_CMD_ID_ENV_LIGHT_SETTINGS, numLightSettings, CMD_PTR(lightSettingsList) } diff --git a/linker_scripts/code_script.txt b/linker_scripts/code_script.txt index cfb4bf1afd..2d32a555b2 100644 --- a/linker_scripts/code_script.txt +++ b/linker_scripts/code_script.txt @@ -514,7 +514,7 @@ SECTIONS build/asm/code/code_data_0x801BD910.o(.data) build/asm/code/code_data_z_horse.o(.data) build/asm/code/code_data_z_jpeg.o(.data) - build/asm/code/code_data_z_kanfont.o(.data) + build/src/code/z_kanfont.o(.data) build/asm/code/code_data_z_kankyo.o(.data) build/src/code/z_lib.o(.data) build/asm/code/code_data_z_lifemeter.o(.data) diff --git a/src/code/PreRender.c b/src/code/PreRender.c index bc799f9fb8..b3888ddcba 100644 --- a/src/code/PreRender.c +++ b/src/code/PreRender.c @@ -2,9 +2,9 @@ #include /** - * Assigns the "save" values in PreRenderContext + * Assigns the "save" values in PreRender */ -void PreRender_SetValuesSave(PreRenderContext* this, u32 width, u32 height, void* fbuf, void* zbuf, void* cvg) { +void PreRender_SetValuesSave(PreRender* this, u32 width, u32 height, void* fbuf, void* zbuf, void* cvg) { this->widthSave = width; this->heightSave = height; this->fbufSave = fbuf; @@ -16,15 +16,15 @@ void PreRender_SetValuesSave(PreRenderContext* this, u32 width, u32 height, void this->lrySave = height - 1; } -void PreRender_Init(PreRenderContext* this) { - bzero(this, sizeof(PreRenderContext)); +void PreRender_Init(PreRender* this) { + bzero(this, sizeof(PreRender)); func_80174AA0(&this->alloc); } /** - * Assigns the current values in PreRenderContext + * Assigns the current values in PreRender */ -void PreRender_SetValues(PreRenderContext* this, u32 width, u32 height, void* fbuf, void* zbuf) { +void PreRender_SetValues(PreRender* this, u32 width, u32 height, void* fbuf, void* zbuf) { this->width = width; this->height = height; this->fbuf = fbuf; @@ -35,11 +35,11 @@ void PreRender_SetValues(PreRenderContext* this, u32 width, u32 height, void* fb this->lry = height - 1; } -void PreRender_Destroy(PreRenderContext* this) { +void PreRender_Destroy(PreRender* this) { func_80174BA0(&this->alloc); } -void func_8016FDB8(PreRenderContext* this, Gfx** gfxp, void* buf, void* bufSave, u32 arg4) { +void func_8016FDB8(PreRender* this, Gfx** gfxp, void* buf, void* bufSave, u32 arg4) { Gfx* gfx = *gfxp; u32 flags; @@ -60,12 +60,11 @@ void func_8016FDB8(PreRenderContext* this, Gfx** gfxp, void* buf, void* bufSave, *gfxp = gfx; } -void func_8016FF70(PreRenderContext* this, Gfx** gfxp, void* buf, void* bufSave) { +void func_8016FF70(PreRender* this, Gfx** gfxp, void* buf, void* bufSave) { func_8016FDB8(this, gfxp, buf, bufSave, false); } -void func_8016FF90(PreRenderContext* this, Gfx** gfxp, void* buf, void* bufSave, s32 envR, s32 envG, s32 envB, - s32 envA) { +void func_8016FF90(PreRender* this, Gfx** gfxp, void* buf, void* bufSave, s32 envR, s32 envG, s32 envB, s32 envA) { Gfx* gfx = *gfxp; gDPPipeSync(gfx++); @@ -97,13 +96,13 @@ void func_8016FF90(PreRenderContext* this, Gfx** gfxp, void* buf, void* bufSave, *gfxp = gfx; } -void func_80170200(PreRenderContext* this, Gfx** gfxp, void* buf, void* bufSave) { +void func_80170200(PreRender* this, Gfx** gfxp, void* buf, void* bufSave) { func_8016FF90(this, gfxp, buf, bufSave, 255, 255, 255, 255); } #ifdef NON_MATCHING // just regalloc -void func_8017023C(PreRenderContext* this, Gfx** gfxp, void* buf, void* bufSave) { +void func_8017023C(PreRender* this, Gfx** gfxp, void* buf, void* bufSave) { Gfx* gfx = *gfxp; s32 x; s32 x2; @@ -152,19 +151,19 @@ void func_8017023C(PreRenderContext* this, Gfx** gfxp, void* buf, void* bufSave) #pragma GLOBAL_ASM("./asm/non_matchings/code/PreRender/func_8017023C.asm") #endif -void func_8017057C(PreRenderContext* this, Gfx** gfxp) { +void func_8017057C(PreRender* this, Gfx** gfxp) { if ((this->zbufSave != NULL) && (this->zbuf != NULL)) { func_8016FF70(this, gfxp, this->zbuf, this->zbufSave); } } -void func_801705B4(PreRenderContext* this, Gfx** gfxp) { +void func_801705B4(PreRender* this, Gfx** gfxp) { if ((this->fbufSave != NULL) && (this->fbuf != NULL)) { func_80170200(this, gfxp, this->fbuf, this->fbufSave); } } -void func_801705EC(PreRenderContext* this, Gfx** gfxp) { +void func_801705EC(PreRender* this, Gfx** gfxp) { Gfx* gfx = *gfxp; gDPPipeSync(gfx++); @@ -181,7 +180,7 @@ void func_801705EC(PreRenderContext* this, Gfx** gfxp) { *gfxp = gfx; } -void func_80170730(PreRenderContext* this, Gfx** gfxp) { +void func_80170730(PreRender* this, Gfx** gfxp) { func_801705EC(this, gfxp); if (this->cvgSave != NULL) { @@ -189,13 +188,13 @@ void func_80170730(PreRenderContext* this, Gfx** gfxp) { } } -void func_80170774(PreRenderContext* this, Gfx** gfxp) { +void func_80170774(PreRender* this, Gfx** gfxp) { func_8016FF70(this, gfxp, this->zbufSave, this->zbuf); } #ifdef NON_MATCHING // just regalloc -void func_80170798(PreRenderContext* this, Gfx** gfxp) { +void func_80170798(PreRender* this, Gfx** gfxp) { Gfx* gfx; s32 y; s32 y2; @@ -253,11 +252,11 @@ void func_80170798(PreRenderContext* this, Gfx** gfxp) { #pragma GLOBAL_ASM("./asm/non_matchings/code/PreRender/func_80170798.asm") #endif -void func_80170AE0(PreRenderContext* this, Gfx** gfxp, s32 alpha) { +void func_80170AE0(PreRender* this, Gfx** gfxp, s32 alpha) { func_8016FF90(this, gfxp, this->fbufSave, this->fbuf, 255, 255, 255, alpha); } -void func_80170B28(PreRenderContext* this, Gfx** gfxp) { +void func_80170B28(PreRender* this, Gfx** gfxp) { func_8016FF70(this, gfxp, this->fbufSave, this->fbuf); } @@ -269,7 +268,7 @@ void func_80170B28(PreRenderContext* this, Gfx** gfxp) { * | A B C D E | * ‾ ‾ ‾ ‾ ‾ */ -void PreRender_AntiAliasAlgorithm(PreRenderContext* this, s32 x, s32 y) { +void PreRender_AntiAliasAlgorithm(PreRender* this, s32 x, s32 y) { s32 i; s32 j; s32 buffA[3 * 5]; @@ -380,7 +379,7 @@ void PreRender_AntiAliasAlgorithm(PreRenderContext* this, s32 x, s32 y) { /** * Applies an anti-alias filter to the current prerender */ -void PreRender_ApplyAntiAliasingFilter(PreRenderContext* this) { +void PreRender_ApplyAntiAliasingFilter(PreRender* this) { s32 x; s32 y; s32 cvg; @@ -405,7 +404,7 @@ void PreRender_ApplyAntiAliasingFilter(PreRenderContext* this) { /** * Applies filters to the framebuffer prerender to make it look smoother */ -void PreRender_ApplyFilters(PreRenderContext* this) { +void PreRender_ApplyFilters(PreRender* this) { if (this->cvgSave == NULL || this->fbufSave == NULL) { this->unk_4D = 0; } else { @@ -419,7 +418,7 @@ void PreRender_ApplyFilters(PreRenderContext* this) { /** * Initializes `PreRender_ApplyFilters` onto a new "slowly" thread */ -void PreRender_ApplyFiltersSlowlyInit(PreRenderContext* this) { +void PreRender_ApplyFiltersSlowlyInit(PreRender* this) { if ((this->cvgSave != NULL) && (this->fbufSave != NULL)) { if (D_801F6FC0) { StackCheck_Cleanup(&slowlyStackEntry); @@ -436,7 +435,7 @@ void PreRender_ApplyFiltersSlowlyInit(PreRenderContext* this) { /** * Destroys the "slowly" thread */ -void PreRender_ApplyFiltersSlowlyDestroy(PreRenderContext* this) { +void PreRender_ApplyFiltersSlowlyDestroy(PreRender* this) { if (D_801F6FC0) { StackCheck_Cleanup(&slowlyStackEntry); Slowly_Stop(&D_801F6E00); @@ -445,7 +444,7 @@ void PreRender_ApplyFiltersSlowlyDestroy(PreRenderContext* this) { } // Unused, likely since `PreRender_ApplyFilters` already handles NULL checks -void func_801720C4(PreRenderContext* this) { +void func_801720C4(PreRender* this) { if ((this->cvgSave != NULL) && (this->fbufSave != NULL)) { PreRender_ApplyFilters(this); } diff --git a/src/code/code_0x800A5AC0.c b/src/code/code_0x800A5AC0.c index 848772c944..416be39f37 100644 --- a/src/code/code_0x800A5AC0.c +++ b/src/code/code_0x800A5AC0.c @@ -43,7 +43,7 @@ void EnAObj_Update2(ActorEnAObj* this, GlobalContext* globalCtx) { void EnAObj_Update(ActorEnAObj* this, GlobalContext* globalCtx) { (this->update)((Actor*)this, (GlobalContext*)globalCtx); Actor_SetHeight((Actor*)this, 45.0f); - CollisionCheck_SetOC(globalCtx, &globalCtx->colCheckCtx, (Collider*)&this->collision); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, (Collider*)&this->collision); } void EnAObj_Draw(ActorEnAObj* this, GlobalContext* globalCtx) { diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 4a947be9cc..94b941c564 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -736,7 +736,7 @@ void Actor_DrawAllSetup(GlobalContext* globalCtx) { void Actor_FreeOverlay(ActorOverlay* entry) { void* ramAddr; - if (entry->nbLoaded == 0) { + if (entry->numLoaded == 0) { ramAddr = entry->loadedRamAddr; if (ramAddr != NULL) { // Bit 1 - always loaded diff --git a/src/code/z_actor_dlftbls.c b/src/code/z_actor_dlftbls.c index 12971cdb19..d63812f669 100644 --- a/src/code/z_actor_dlftbls.c +++ b/src/code/z_actor_dlftbls.c @@ -726,7 +726,7 @@ void ActorOverlayTable_FaultPrint(void* arg0, void* arg1) { overlaySize = (u32)overlayEntry->vramEnd - (u32)overlayEntry->vramStart; if (overlayEntry->loadedRamAddr != NULL) { FaultDrawer_Printf("%3d %08x-%08x %3d %s\n", i, overlayEntry->loadedRamAddr, - (u32)overlayEntry->loadedRamAddr + overlaySize, overlayEntry->nbLoaded, ""); + (u32)overlayEntry->loadedRamAddr + overlaySize, overlayEntry->numLoaded, ""); } } } diff --git a/src/code/z_eff_footmark.c b/src/code/z_eff_footmark.c index 279b65a604..63b2fa4520 100644 --- a/src/code/z_eff_footmark.c +++ b/src/code/z_eff_footmark.c @@ -5,7 +5,7 @@ void EffFootmark_Init(GlobalContext* globalCtx) { EffFootmark* footmark; s32 i; - for (footmark = globalCtx->footmarks, i = 0; i < 100; i++, footmark++) { + for (footmark = globalCtx->footprintInfo, i = 0; i < 100; i++, footmark++) { footmark->actor = NULL; footmark->location.x = 0; footmark->location.y = 0; @@ -25,7 +25,7 @@ void EffFootmark_Add(GlobalContext* globalCtx, MtxF* displayMatrix, Actor* actor EffFootmark* oldest = NULL; s32 isNew = 1; - for (footmark = globalCtx->footmarks, i = 0; i < 100; i++, footmark++) { + for (footmark = globalCtx->footprintInfo, i = 0; i < 100; i++, footmark++) { if (((actor == footmark->actor) && (footmark->id == id)) && ((footmark->flags & 1) == 0)) { if (fabsf((footmark->location).x - location->x) <= 1) { if (fabsf((footmark->location).z - location->z) <= 1) { @@ -75,7 +75,7 @@ void EffFootmark_Update(GlobalContext* globalCtx) { EffFootmark* footmark; s32 i; - for (footmark = globalCtx->footmarks, i = 0; i < 100; i++, footmark++) { + for (footmark = globalCtx->footprintInfo, i = 0; i < 100; i++, footmark++) { if (footmark->actor != NULL) { if ((footmark->flags & 1) == 1) { if (footmark->age < 0xFFFFu) { // TODO replace with MAX_U16 or something @@ -105,7 +105,7 @@ void EffFootmark_Draw(GlobalContext* globalCtx) { gSPDisplayList(gfxCtx->polyXlu.p++, D_801BC240); - for (footmark = globalCtx->footmarks, i = 0; i < 100; i++, footmark++) { + for (footmark = globalCtx->footprintInfo, i = 0; i < 100; i++, footmark++) { if (footmark->actor != NULL) { SysMatrix_SetCurrentState(&footmark->displayMatrix); Matrix_Scale(footmark->size * 0.00390625f * 0.7f, 1, footmark->size * 0.00390625f, 1); diff --git a/src/code/z_effect_soft_sprite_old_init.c b/src/code/z_effect_soft_sprite_old_init.c index 9c64de42ea..af81dad413 100644 --- a/src/code/z_effect_soft_sprite_old_init.c +++ b/src/code/z_effect_soft_sprite_old_init.c @@ -17,7 +17,7 @@ void EffectSs_DrawGEffect(GlobalContext* globalCtx, EffectSs* this, void* textur scale = this->rgScale * D_801DC100; SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z); SkinMatrix_SetScale(&mfScale, scale, scale, scale); - SkinMatrix_MtxFMtxFMult(&mfTrans, &globalCtx->unk187FC, &mfTrans11DA0); + SkinMatrix_MtxFMtxFMult(&mfTrans, &globalCtx->mf_187FC, &mfTrans11DA0); SkinMatrix_MtxFMtxFMult(&mfTrans11DA0, &mfScale, &mfResult); gSegments[6] = PHYSICAL_TO_VIRTUAL(object); gSPSegment(POLY_XLU_DISP++, 0x06, object); diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c index 8d67625a91..97b40002a5 100644 --- a/src/code/z_en_item00.c +++ b/src/code/z_en_item00.c @@ -470,7 +470,7 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { } Collision_CylinderMoveToActor(&this->actor, &this->collider); - Collision_AddAC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + Collision_AddAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); if ((this->actor.params == ITEM00_SHIELD_HERO) || (this->actor.params == ITEM00_MAP) || (this->actor.params == ITEM00_COMPASS)) { @@ -490,7 +490,7 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { } } - if (globalCtx->unk17000 != 0) { + if (globalCtx->gameOverCtx.state != 0) { return; } diff --git a/src/code/z_kanfont.c b/src/code/z_kanfont.c index 25695727e1..01ae5d0433 100644 --- a/src/code/z_kanfont.c +++ b/src/code/z_kanfont.c @@ -1,34 +1,44 @@ #include #include -void Kanfont_Nop800F4F40(GlobalContext* globalCtx, UNK_TYPE param_2, UNK_TYPE param_3) { +// stubbed in NTSC-U +void Font_LoadChar(GlobalContext* globalCtx, u16 codePointIndex, s32 offset) { } -void Kanfont_LoadAsciiChar(GlobalContext* globalCtx, u8 character, s32 iParm3) { - // UB to convert pointer to u32 - DmaMgr_SendRequest0((void*)((u32)&globalCtx->msgCtx.font.unk0[(globalCtx->msgCtx).unk11EF0] + iParm3), - (u32)_nes_font_staticSegmentRomStart + character * 0x80 - 0x1000, 0x80); +void Font_LoadCharNES(GlobalContext* globalCtx, u8 codePointIndex, s32 offset) { + MessageContext* msgCtx = &globalCtx->msgCtx; + Font* font = &msgCtx->font; + + DmaMgr_SendRequest0(&font->charBuf[font->unk_11D88][offset], + &_nes_font_staticSegmentRomStart[(codePointIndex - ' ') * FONT_CHAR_TEX_SIZE], + FONT_CHAR_TEX_SIZE); } -void Kanfont_LoadMessageBoxEnd(Font* font, u16 type) { - // UB to convert pointer to u32 - DmaMgr_SendRequest0(&font->unk7800[0][0], type * 0x80 + (u32)_message_staticSegmentRomStart + 0x5000, 0x80); +void Font_LoadMessageBoxEndIcon(Font* font, u16 icon) { + DmaMgr_SendRequest0(&font->iconBuf, &_message_staticSegmentRomStart[5 * 0x1000 + icon * FONT_CHAR_TEX_SIZE], + FONT_CHAR_TEX_SIZE); } -void Kanfont_LoadOrderedFont(Font* font) { +static char sFontOrdering[] = "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19" + "!\"#$%&\'()*+,-./0123456789:ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "\x00\x0D\x0E\x1A" + "afjmosvwxyz{|}~" + "\x7F\x80\x81\x84\x86\x87\x88\x89\x8A\x8B\x8C"; + +void Font_LoadOrderedFont(Font* font) { u32 loadOffset; s32 codePointIndex = 0; - void* writeLocation; + u8* writeLocation; while (1) { - writeLocation = &font->unk7800[codePointIndex + 1]; - loadOffset = kanfontOrdering[codePointIndex] * 128; - if (kanfontOrdering[codePointIndex] == 0) { + writeLocation = &font->fontBuf[codePointIndex * FONT_CHAR_TEX_SIZE]; + loadOffset = sFontOrdering[codePointIndex] * FONT_CHAR_TEX_SIZE; + if (sFontOrdering[codePointIndex] == 0) { loadOffset = 0; } // UB to convert pointer to u32 - DmaMgr_SendRequest0(writeLocation, (u32)_nes_font_staticSegmentRomStart + loadOffset, 0x80); - if (kanfontOrdering[codePointIndex] == 140) { + DmaMgr_SendRequest0(writeLocation, (u32)_nes_font_staticSegmentRomStart + loadOffset, FONT_CHAR_TEX_SIZE); + if (sFontOrdering[codePointIndex] == 0x8C) { break; } codePointIndex++; diff --git a/src/code/z_lights.c b/src/code/z_lights.c index 161eff7242..4822fa4370 100644 --- a/src/code/z_lights.c +++ b/src/code/z_lights.c @@ -132,7 +132,7 @@ void Lights_BindPoint(Lights* lights, LightParams* params, GlobalContext* global posF.x = params->point.x; posF.y = params->point.y; posF.z = params->point.z; - SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->unk187B0, &posF, &adjustedPos); + SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->projectionMatrix, &posF, &adjustedPos); if ((adjustedPos.z > -radiusF) && (600 + radiusF > adjustedPos.z) && (400 > fabsf(adjustedPos.x) - radiusF) && (400 > fabsf(adjustedPos.y) - radiusF)) { light = Lights_FindSlot(lights); diff --git a/src/code/z_room.c b/src/code/z_room.c index eda1b6e76c..08b7c7e957 100644 --- a/src/code/z_room.c +++ b/src/code/z_room.c @@ -120,8 +120,8 @@ s32 Room_HandleLoadCallbacks(GlobalContext* globalCtx, RoomContext* roomCtx) { if (((globalCtx->sceneNum != SCENE_IKANA) || (roomCtx->currRoom.num != 1)) && (globalCtx->sceneNum != SCENE_IKNINSIDE)) { - globalCtx->kankyoContext.unkC3 = 0xff; - globalCtx->kankyoContext.unkE0 = 0; + globalCtx->envCtx.unk_C3 = 0xff; + globalCtx->envCtx.unk_E0 = 0; } func_800FEAB0(); if (!func_800FE4B8(globalCtx)) { @@ -153,5 +153,5 @@ void func_8012EBF8(GlobalContext* globalCtx, RoomContext* roomCtx) { func_8010A33C(globalCtx, roomCtx->currRoom.num); func_8010A2DC(globalCtx); } - func_801A3CD8(globalCtx->roomContext.currRoom.echo); + func_801A3CD8(globalCtx->roomCtx.currRoom.echo); } diff --git a/src/code/z_scene.c b/src/code/z_scene.c index c6ff043911..c8170b17f2 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -142,7 +142,7 @@ void* func_8012F73C(ObjectContext* objectCtx, s32 iParm2, s16 id) { return (void*)addr; } -// Scene Header Command 0x00: Spawn List +// SceneTableEntry Header Command 0x00: Spawn List void Scene_HeaderCmdSpawnList(GlobalContext* globalCtx, SceneCmd* cmd) { GlobalContext* globalCtx2 = globalCtx; s32 loadedCount; @@ -171,19 +171,19 @@ void Scene_HeaderCmdSpawnList(GlobalContext* globalCtx, SceneCmd* cmd) { globalCtx->objectCtx.status[globalCtx->objectCtx.num].segment = nextObject; } -// Scene Header Command 0x01: Actor List +// SceneTableEntry Header Command 0x01: Actor List void Scene_HeaderCmdActorList(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->sceneNumActorsToLoad = (u16)cmd->actorList.num; + globalCtx->numSetupActors = (u16)cmd->actorList.num; globalCtx->setupActorList = (ActorEntry*)Lib_SegmentedToVirtual(cmd->actorList.segment); globalCtx->actorCtx.unkC = (u16)0; } -// Scene Header Command 0x02: List of cameras for actor cutscenes +// SceneTableEntry Header Command 0x02: List of cameras for actor cutscenes void Scene_HeaderCmdActorCutsceneCamList(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->unk18858 = (UNK_PTR)Lib_SegmentedToVirtual(cmd->csCameraList.segment); + globalCtx->unk_18858 = (UNK_PTR)Lib_SegmentedToVirtual(cmd->csCameraList.segment); } -// Scene Header Command 0x03: Collision Header +// SceneTableEntry Header Command 0x03: Collision Header void Scene_HeaderCmdColHeader(GlobalContext* globalCtx, SceneCmd* cmd) { CollisionHeader* colHeaderTemp; CollisionHeader* colHeader; @@ -208,18 +208,18 @@ void Scene_HeaderCmdColHeader(GlobalContext* globalCtx, SceneCmd* cmd) { BgCheck_Init(&globalCtx->colCtx, globalCtx, colHeader); } -// Scene Header Command 0x04: Room List +// SceneTableEntry Header Command 0x04: Room List void Scene_HeaderCmdRoomList(GlobalContext* globalCtx, SceneCmd* cmd) { globalCtx->numRooms = cmd->roomList.num; globalCtx->roomList = (RomFile*)Lib_SegmentedToVirtual(cmd->roomList.segment); } -// Scene Header Command 0x06: Entrance List +// SceneTableEntry Header Command 0x06: Entrance List void Scene_HeaderCmdEntranceList(GlobalContext* globalCtx, SceneCmd* cmd) { globalCtx->setupEntranceList = (EntranceEntry*)Lib_SegmentedToVirtual(cmd->entranceList.segment); } -// Scene Header Command 0x07: Special Files +// SceneTableEntry Header Command 0x07: Special Files void Scene_HeaderCmdSpecialFiles(GlobalContext* globalCtx, SceneCmd* cmd) { static RomFile tatlMessageFiles[2] = { { (u32)_elf_message_fieldSegmentRomStart, (u32)_elf_message_fieldSegmentRomEnd }, @@ -233,26 +233,26 @@ void Scene_HeaderCmdSpecialFiles(GlobalContext* globalCtx, SceneCmd* cmd) { } if (cmd->specialFiles.cUpElfMsgNum != 0) { - globalCtx->unk18868 = Play_LoadScene(globalCtx, &tatlMessageFiles[cmd->specialFiles.cUpElfMsgNum - 1]); + globalCtx->unk_18868 = Play_LoadScene(globalCtx, &tatlMessageFiles[cmd->specialFiles.cUpElfMsgNum - 1]); } } -// Scene Header Command 0x08: Room Behavior +// SceneTableEntry Header Command 0x08: Room Behavior void Scene_HeaderCmdRoomBehavior(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->roomContext.currRoom.unk3 = cmd->roomBehavior.gpFlag1; - globalCtx->roomContext.currRoom.unk2 = cmd->roomBehavior.gpFlag2 & 0xFF; - globalCtx->roomContext.currRoom.unk5 = (cmd->roomBehavior.gpFlag2 >> 8) & 1; + globalCtx->roomCtx.currRoom.unk3 = cmd->roomBehavior.gpFlag1; + globalCtx->roomCtx.currRoom.unk2 = cmd->roomBehavior.gpFlag2 & 0xFF; + globalCtx->roomCtx.currRoom.unk5 = (cmd->roomBehavior.gpFlag2 >> 8) & 1; globalCtx->msgCtx.unk12044 = (cmd->roomBehavior.gpFlag2 >> 0xa) & 1; - globalCtx->roomContext.currRoom.enablePosLights = (cmd->roomBehavior.gpFlag2 >> 0xb) & 1; - globalCtx->kankyoContext.unkE2 = (cmd->roomBehavior.gpFlag2 >> 0xc) & 1; + globalCtx->roomCtx.currRoom.enablePosLights = (cmd->roomBehavior.gpFlag2 >> 0xb) & 1; + globalCtx->envCtx.unk_E2 = (cmd->roomBehavior.gpFlag2 >> 0xc) & 1; } -// Scene Header Command 0x0A: Mesh Header +// SceneTableEntry Header Command 0x0A: Mesh Header void Scene_HeaderCmdMesh(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->roomContext.currRoom.mesh = (RoomMesh*)Lib_SegmentedToVirtual(cmd->mesh.segment); + globalCtx->roomCtx.currRoom.mesh = (RoomMesh*)Lib_SegmentedToVirtual(cmd->mesh.segment); } -// Scene Header Command 0x0B: Object List +// SceneTableEntry Header Command 0x0B: Object List void Scene_HeaderCmdObjectList(GlobalContext* globalCtx, SceneCmd* cmd) { s32 i, j, k; ObjectStatus* firstObject; @@ -303,7 +303,7 @@ void Scene_HeaderCmdObjectList(GlobalContext* globalCtx, SceneCmd* cmd) { globalCtx->objectCtx.num = i; } -// Scene Header Command 0x0C: Light List +// SceneTableEntry Header Command 0x0C: Light List void Scene_HeaderCmdLightList(GlobalContext* globalCtx, SceneCmd* cmd) { s32 i; LightInfo* lightInfo = (LightInfo*)Lib_SegmentedToVirtual(cmd->lightList.segment); @@ -314,28 +314,28 @@ void Scene_HeaderCmdLightList(GlobalContext* globalCtx, SceneCmd* cmd) { } } -// Scene Header Command 0x0D: Path List +// SceneTableEntry Header Command 0x0D: Path List void Scene_HeaderCmdPathList(GlobalContext* globalCtx, SceneCmd* cmd) { globalCtx->setupPathList = (void*)Lib_SegmentedToVirtual(cmd->pathList.segment); } -// Scene Header Command 0x0E: Transition Actor List +// SceneTableEntry Header Command 0x0E: Transition Actor List void Scene_HeaderCmdTransiActorList(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->transitionCtx.nbTransitionActors = cmd->transiActorList.num; - globalCtx->transitionCtx.transitionActorList = + globalCtx->doorCtx.numTransitionActors = cmd->transiActorList.num; + globalCtx->doorCtx.transitionActorList = (TransitionActorEntry*)Lib_SegmentedToVirtual((void*)cmd->transiActorList.segment); - func_80105818(globalCtx, globalCtx->transitionCtx.nbTransitionActors, globalCtx->transitionCtx.transitionActorList); + func_80105818(globalCtx, globalCtx->doorCtx.numTransitionActors, globalCtx->doorCtx.transitionActorList); } // Init function for the transition system. -void Transition_Init(GameState* gamestate, TransitionContext* transitionCtx) { - transitionCtx->nbTransitionActors = 0; +void Door_InitContext(GameState* state, DoorContext* doorCtx) { + doorCtx->numTransitionActors = 0; } -// Scene Header Command 0x0F: Environment Light Settings List +// SceneTableEntry Header Command 0x0F: Environment Light Settings List void Scene_HeaderCmdEnvLightSettings(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->kankyoContext.environmentSettingsCount = cmd->lightSettingList.num; - globalCtx->kankyoContext.environmentSettingsList = (void*)Lib_SegmentedToVirtual(cmd->lightSettingList.segment); + globalCtx->envCtx.numLightSettings = cmd->lightSettingList.num; + globalCtx->envCtx.lightSettingsList = (void*)Lib_SegmentedToVirtual(cmd->lightSettingList.segment); } /** @@ -358,28 +358,28 @@ s32 Scene_LoadAreaTextures(GlobalContext* globalCtx, s32 fileIndex) { u32 size = sceneTextureFiles[fileIndex].vromEnd - vromStart; if (size != 0) { - globalCtx->roomContext.unk74 = THA_AllocEndAlign16(&globalCtx->state.heap, size); - return DmaMgr_SendRequest0(globalCtx->roomContext.unk74, vromStart, size); + globalCtx->roomCtx.unk74 = THA_AllocEndAlign16(&globalCtx->state.heap, size); + return DmaMgr_SendRequest0(globalCtx->roomCtx.unk74, vromStart, size); } // UB: Undefined behaviour to not have a return statement here, but it breaks matching to add one. } -// Scene Header Command 0x11: Skybox Settings +// SceneTableEntry Header Command 0x11: Skybox Settings void Scene_HeaderCmdSkyboxSettings(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->unk18874 = cmd->skyboxSettings.skyboxId & 3; - globalCtx->kankyoContext.unk17 = globalCtx->kankyoContext.unk18 = cmd->skyboxSettings.unk5; - globalCtx->kankyoContext.unk1E = cmd->skyboxSettings.unk6; + globalCtx->skyboxId = cmd->skyboxSettings.skyboxId & 3; + globalCtx->envCtx.unk_17 = globalCtx->envCtx.unk_18 = cmd->skyboxSettings.unk5; + globalCtx->envCtx.unk_1E = cmd->skyboxSettings.unk6; Scene_LoadAreaTextures(globalCtx, cmd->skyboxSettings.data1); } -// Scene Header Command 0x12: Skybox Disables +// SceneTableEntry Header Command 0x12: Skybox Disables void Scene_HeaderCmdSkyboxDisables(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->kankyoContext.unk15 = cmd->skyboxDisables.unk4; - globalCtx->kankyoContext.unk16 = cmd->skyboxDisables.unk5; + globalCtx->envCtx.unk_15 = cmd->skyboxDisables.unk4; + globalCtx->envCtx.unk_16 = cmd->skyboxDisables.unk5; } -// Scene Header Command 0x10: Time Settings +// SceneTableEntry Header Command 0x10: Time Settings void Scene_HeaderCmdTimeSettings(GlobalContext* globalCtx, SceneCmd* cmd) { u32 dayTime; @@ -389,27 +389,27 @@ void Scene_HeaderCmdTimeSettings(GlobalContext* globalCtx, SceneCmd* cmd) { } if (cmd->timeSettings.unk6 != 0xFF) { - globalCtx->kankyoContext.unk2 = cmd->timeSettings.unk6; + globalCtx->envCtx.unk_2 = cmd->timeSettings.unk6; } else { - globalCtx->kankyoContext.unk2 = 0; + globalCtx->envCtx.unk_2 = 0; } - if ((gSaveContext.inventory.items[0] == 0xFF) && (globalCtx->kankyoContext.unk2 != 0)) { - globalCtx->kankyoContext.unk2 = 5; + if ((gSaveContext.inventory.items[0] == 0xFF) && (globalCtx->envCtx.unk_2 != 0)) { + globalCtx->envCtx.unk_2 = 5; } if (gSaveContext.unk_3F58 == 0) { - REG(15) = globalCtx->kankyoContext.unk2; + REG(15) = globalCtx->envCtx.unk_2; } dayTime = gSaveContext.time; - globalCtx->kankyoContext.unk4 = -(Math_SinS(dayTime - 0x8000) * 120.0f) * 25.0f; + globalCtx->envCtx.unk_4 = -(Math_SinS(dayTime - 0x8000) * 120.0f) * 25.0f; dayTime = gSaveContext.time; - globalCtx->kankyoContext.unk8 = (Math_CosS(dayTime - 0x8000) * 120.0f) * 25.0f; + globalCtx->envCtx.unk_8 = (Math_CosS(dayTime - 0x8000) * 120.0f) * 25.0f; dayTime = gSaveContext.time; - globalCtx->kankyoContext.unkC = (Math_CosS(dayTime - 0x8000) * 20.0f) * 25.0f; + globalCtx->envCtx.unk_C = (Math_CosS(dayTime - 0x8000) * 20.0f) * 25.0f; - if (globalCtx->kankyoContext.unk2 == 0 && gSaveContext.cutscene < 0xFFF0) { + if (globalCtx->envCtx.unk_2 == 0 && gSaveContext.cutscene < 0xFFF0) { gSaveContext.environmentTime = gSaveContext.time; if (gSaveContext.environmentTime >= 0x2AAA && gSaveContext.environmentTime < 0x4555) { @@ -424,43 +424,43 @@ void Scene_HeaderCmdTimeSettings(GlobalContext* globalCtx, SceneCmd* cmd) { } } -// Scene Header Command 0x05: Wind Settings +// SceneTableEntry Header Command 0x05: Wind Settings void Scene_HeaderCmdWindSettings(GlobalContext* globalCtx, SceneCmd* cmd) { s8 temp1 = cmd->windSettings.west; s8 temp2 = cmd->windSettings.vertical; s8 temp3 = cmd->windSettings.south; - globalCtx->kankyoContext.windWest = temp1; - globalCtx->kankyoContext.windVertical = temp2; - globalCtx->kankyoContext.windSouth = temp3; - globalCtx->kankyoContext.windClothIntensity = cmd->windSettings.clothIntensity; + globalCtx->envCtx.windDir.x = temp1; + globalCtx->envCtx.windDir.y = temp2; + globalCtx->envCtx.windDir.z = temp3; + globalCtx->envCtx.windSpeed = cmd->windSettings.clothIntensity; } -// Scene Header Command 0x13: Exit List +// SceneTableEntry Header Command 0x13: Exit List void Scene_HeaderCmdExitList(GlobalContext* globalCtx, SceneCmd* cmd) { globalCtx->setupExitList = (u16*)Lib_SegmentedToVirtual(cmd->exitList.segment); } -// Scene Header Command 0x09: Undefined +// SceneTableEntry Header Command 0x09: Undefined void Scene_HeaderCmd09(GlobalContext* globalCtx, SceneCmd* cmd) { } -// Scene Header Command 0x15: Sound Settings= +// SceneTableEntry Header Command 0x15: Sound Settings= void Scene_HeaderCmdSoundSettings(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->unk814 = cmd->soundSettings.musicSeq; - globalCtx->unk815 = cmd->soundSettings.nighttimeSFX; + globalCtx->soundCtx.seqIndex = cmd->soundSettings.musicSeq; + globalCtx->soundCtx.nightSeqIndex = cmd->soundSettings.nighttimeSFX; if (gSaveContext.seqIndex == 0xFF || func_801A8A50(0) == 0x57) { audio_setBGM(cmd->soundSettings.bgmId); } } -// Scene Header Command 0x16: Echo Setting +// SceneTableEntry Header Command 0x16: Echo Setting void Scene_HeaderCmdEchoSetting(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->roomContext.currRoom.echo = cmd->echoSettings.echo; + globalCtx->roomCtx.currRoom.echo = cmd->echoSettings.echo; } -// Scene Header Command 0x18: Alternate Header List= +// SceneTableEntry Header Command 0x18: Alternate Header List= void Scene_HeaderCmdAltHeaderList(GlobalContext* globalCtx, SceneCmd* cmd) { SceneCmd** altHeaderList; SceneCmd* altHeader; @@ -476,34 +476,34 @@ void Scene_HeaderCmdAltHeaderList(GlobalContext* globalCtx, SceneCmd* cmd) { } } -// Scene Header Command 0x17: Cutscene List +// SceneTableEntry Header Command 0x17: Cutscene List void Scene_HeaderCmdCutsceneList(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->csCtx.cutsceneCount = (u8)cmd->base.data1; - globalCtx->cutsceneList = (CutsceneEntry*)Lib_SegmentedToVirtual((void*)cmd->base.data2); + globalCtx->csCtx.sceneCsCount = (u8)cmd->base.data1; + globalCtx->csCtx.sceneCsList = (CutsceneEntry*)Lib_SegmentedToVirtual((void*)cmd->base.data2); } -// Scene Header Command 0x1B: Actor Cutscene List +// SceneTableEntry Header Command 0x1B: Actor Cutscene List void Scene_HeaderCmdActorCutsceneList(GlobalContext* globalCtx, SceneCmd* cmd) { ActorCutscene_Init(globalCtx, (ActorCutscene*)Lib_SegmentedToVirtual(cmd->cutsceneActorList.segment), cmd->cutsceneActorList.num); } -// Scene Header Command 0x1C: Mini Maps +// SceneTableEntry Header Command 0x1C: Mini Maps void Scene_HeaderCmdMiniMap(GlobalContext* globalCtx, SceneCmd* cmd) { func_80104CF4(globalCtx); func_8010549C(globalCtx, cmd->minimapSettings.segment); } -// Scene Header Command 0x1D: Undefined +// SceneTableEntry Header Command 0x1D: Undefined void Scene_HeaderCmd1D(GlobalContext* globalCtx, SceneCmd* cmd) { } -// Scene Header Command 0x1E: Minimap Compass Icon Info +// SceneTableEntry Header Command 0x1E: Minimap Compass Icon Info void Scene_HeaderCmdMiniMapCompassInfo(GlobalContext* globalCtx, SceneCmd* cmd) { func_8010565C(globalCtx, cmd->minimapChests.num, cmd->minimapChests.segment); } -// Scene Header Command 0x1A: Sets Area Visited Flag +// SceneTableEntry Header Command 0x1A: Sets Area Visited Flag void Scene_HeaderCmdSetAreaVisitedFlag(GlobalContext* globalCtx, SceneCmd* cmd) { s16 j = 0; s16 i = 0; @@ -530,7 +530,7 @@ void Scene_HeaderCmdSetAreaVisitedFlag(GlobalContext* globalCtx, SceneCmd* cmd) } } -// Scene Header Command 0x1A: Material Animations +// SceneTableEntry Header Command 0x1A: Material Animations void Scene_HeaderCmdAnimatedMaterials(GlobalContext* globalCtx, SceneCmd* cmd) { globalCtx->sceneMaterialAnims = (AnimatedMaterial*)Lib_SegmentedToVirtual(cmd->textureAnimations.segment); } @@ -539,7 +539,7 @@ void Scene_HeaderCmdAnimatedMaterials(GlobalContext* globalCtx, SceneCmd* cmd) { * Sets the exit fade from the next entrance index. */ void Scene_SetExitFade(GlobalContext* globalCtx) { - globalCtx->unk1887F = Entrance_GetTransitionFlags(globalCtx->nextEntranceIndex) & 0x7F; + globalCtx->unk_1887F = Entrance_GetTransitionFlags(globalCtx->nextEntranceIndex) & 0x7F; } /** diff --git a/src/code/z_scene_proc.c b/src/code/z_scene_proc.c index d16a561ae3..2f2b3e62b7 100644 --- a/src/code/z_scene_proc.c +++ b/src/code/z_scene_proc.c @@ -40,7 +40,7 @@ void Scene_ExecuteDrawConfig(GlobalContext* globalCtx) { } /** - * Scene Draw Config 0: + * SceneTableEntry Draw Config 0: * Default scene draw config function. This just executes `sSceneDrawDefaultDL`. */ void Scene_DrawConfigDefault(GlobalContext* globalCtx) { @@ -501,7 +501,7 @@ void AnimatedMat_DrawAlphaStepXlu(GlobalContext* globalCtx, AnimatedMaterial* ma } /** - * Scene Draw Config 1: + * SceneTableEntry Draw Config 1: * Allows the usage of the animated material system in scenes. */ void Scene_DrawConfigMatAnim(GlobalContext* globalCtx) { @@ -509,7 +509,7 @@ void Scene_DrawConfigMatAnim(GlobalContext* globalCtx) { } /** - * Scene Draw Config 3: + * SceneTableEntry Draw Config 3: * This config is unused, although it is identical to the grotto scene config from Ocarina of Time. */ void Scene_DrawConfig3(GlobalContext* globalCtx) { @@ -547,7 +547,7 @@ void Scene_DrawConfig3(GlobalContext* globalCtx) { } /** - * Scene Draw Config 4: + * SceneTableEntry Draw Config 4: * This config is unused and just has a single TwoTexScroll intended for two 32x32 textures (likely two water textures). * It is identical to the Castle Courtyard and Sacred Forest Meadow scene config from Ocarina of Time. */ @@ -572,7 +572,7 @@ void Scene_DrawConfig4(GlobalContext* globalCtx) { } /** - * Scene Draw Config 2: + * SceneTableEntry Draw Config 2: * Has no effect, and is only used in SPOT00 (cutscene scene). */ void Scene_DrawConfigDoNothing(GlobalContext* globalCtx) { @@ -666,27 +666,27 @@ void Scene_SetCullFlag(GlobalContext* globalCtx, s32 index, u32 flags) { } /** - * Scene Draw Config 5: + * SceneTableEntry Draw Config 5: * This config is unused, and its purpose is unknown. */ void Scene_DrawConfig5(GlobalContext* globalCtx) { u32 dListIndex; u32 alpha; - if (globalCtx->roomContext.unk7A[0] != 0) { + if (globalCtx->roomCtx.unk7A[0] != 0) { dListIndex = 1; - alpha = globalCtx->roomContext.unk7A[1]; + alpha = globalCtx->roomCtx.unk7A[1]; } else { dListIndex = 0; alpha = 255; } if (alpha == 0) { - globalCtx->roomContext.unk78 = 0; + globalCtx->roomCtx.unk78 = 0; } else { OPEN_DISPS(globalCtx->state.gfxCtx); - globalCtx->roomContext.unk78 = 1; + globalCtx->roomCtx.unk78 = 1; AnimatedMat_Draw(globalCtx, globalCtx->sceneMaterialAnims); Scene_SetRenderModeXlu(globalCtx, dListIndex, 3); gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, alpha); @@ -697,16 +697,16 @@ void Scene_DrawConfig5(GlobalContext* globalCtx) { } /** - * Scene Draw Config 7: + * SceneTableEntry Draw Config 7: * This is a special draw config for Sakon's Hideout, as well as the Music Box House. Its step value is set manually * rather than always animating like `Scene_DrawConfigMatAnim`. */ void Scene_DrawConfigMatAnimManualStep(GlobalContext* globalCtx) { - AnimatedMat_DrawStep(globalCtx, globalCtx->sceneMaterialAnims, globalCtx->roomContext.unk7A[0]); + AnimatedMat_DrawStep(globalCtx, globalCtx->sceneMaterialAnims, globalCtx->roomCtx.unk7A[0]); } /** - * Scene Draw Config 6: + * SceneTableEntry Draw Config 6: * This is a special draw config for Great Bay Temple, which handles both material animations as well as setting the lod * fraction to a certain value when certain flags are set, which are likely used for the pipes whenever they are * activated. diff --git a/src/code/z_snap.c b/src/code/z_snap.c index aea74db3e9..910b28a3cc 100644 --- a/src/code/z_snap.c +++ b/src/code/z_snap.c @@ -150,7 +150,7 @@ s32 func_8013A530(GlobalContext* globalCtx, Actor* actor, s32 flag, Vec3f* pos, actors[0] = actor; actors[1] = &PLAYER->actor; - if (CollisionCheck_LineOCCheck(globalCtx, &globalCtx->colCheckCtx, pos, &camera->eye, actors, 2) != 0) { + if (CollisionCheck_LineOCCheck(globalCtx, &globalCtx->colChkCtx, pos, &camera->eye, actors, 2) != 0) { func_8013A41C(0x3b); ret |= 0x3b; } diff --git a/src/code/z_vr_box.c b/src/code/z_vr_box.c index 9f413f3fe1..bdf60720e0 100644 --- a/src/code/z_vr_box.c +++ b/src/code/z_vr_box.c @@ -95,7 +95,7 @@ void func_80143324(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skyTy if (skyType == 1) { osCreateMesgQueue(&skyboxCtx->loadQueue, &skyboxCtx->loadMsg, 1); - if (globalCtx->kankyoContext.unk10 == 0) { + if (globalCtx->envCtx.unk_10 == 0) { // Send a DMA request for the clear sky texture size = (u32)_d2_fine_staticSegmentRomEnd - (u32)_d2_fine_staticSegmentRomStart; @@ -112,7 +112,7 @@ void func_80143324(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skyTy osRecvMesg(&skyboxCtx->loadQueue, NULL, 1); osCreateMesgQueue(&skyboxCtx->loadQueue, &skyboxCtx->loadMsg, 1); - if (globalCtx->kankyoContext.unk11 == 0) { + if (globalCtx->envCtx.unk_11 == 0) { // Send a DMA request for the clear sky texture size = (u32)_d2_fine_staticSegmentRomEnd - (u32)_d2_fine_staticSegmentRomStart; diff --git a/src/overlays/actors/ovl_Bg_Ctower_Gear/z_bg_ctower_gear.c b/src/overlays/actors/ovl_Bg_Ctower_Gear/z_bg_ctower_gear.c index 34668d9313..e780bd5e9b 100644 --- a/src/overlays/actors/ovl_Bg_Ctower_Gear/z_bg_ctower_gear.c +++ b/src/overlays/actors/ovl_Bg_Ctower_Gear/z_bg_ctower_gear.c @@ -188,7 +188,7 @@ void BgCtowerGear_UpdateOrgan(Actor* thisx, GlobalContext* globalCtx) { BgCtowerGear* this = THIS; if (func_800EE29C(globalCtx, 0x68)) { - switch (globalCtx->csCtx.actorActions[func_800EE200(globalCtx, 0x68)]->unk0) { + switch (globalCtx->csCtx.npcActions[func_800EE200(globalCtx, 0x68)]->unk0) { case 1: this->dyna.actor.draw = NULL; func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); diff --git a/src/overlays/actors/ovl_Bg_Haka_Curtain/z_bg_haka_curtain.c b/src/overlays/actors/ovl_Bg_Haka_Curtain/z_bg_haka_curtain.c index 00839f171a..1274b0bdc3 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Curtain/z_bg_haka_curtain.c +++ b/src/overlays/actors/ovl_Bg_Haka_Curtain/z_bg_haka_curtain.c @@ -122,7 +122,7 @@ void BgHakaCurtain_Update(Actor* thisx, GlobalContext* globalCtx) { CsCmdActorAction* actorAction; if (func_800EE29C(globalCtx, 0x1D5)) { - actorAction = globalCtx->csCtx.actorActions[func_800EE200(globalCtx, 0x1D5)]; + actorAction = globalCtx->csCtx.npcActions[func_800EE200(globalCtx, 0x1D5)]; if (actorAction->startFrame == globalCtx->csCtx.frames && actorAction->unk0 == 2) { func_80B6DD80(this); } diff --git a/src/overlays/actors/ovl_Bg_Icicle/z_bg_icicle.c b/src/overlays/actors/ovl_Bg_Icicle/z_bg_icicle.c index 9bfb828249..af2fb5220f 100644 --- a/src/overlays/actors/ovl_Bg_Icicle/z_bg_icicle.c +++ b/src/overlays/actors/ovl_Bg_Icicle/z_bg_icicle.c @@ -151,7 +151,7 @@ void BgIcicle_Shiver(BgIcicle* this, GlobalContext* globalCtx) { this->dyna.actor.world.pos.x = this->dyna.actor.home.pos.x; this->dyna.actor.world.pos.z = this->dyna.actor.home.pos.z; - CollisionCheck_SetAT(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); this->actionFunc = BgIcicle_Fall; } else { @@ -188,7 +188,7 @@ void BgIcicle_Fall(BgIcicle* this, GlobalContext* globalCtx) { this->dyna.actor.world.pos.y += 40.0f; Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 4); this->dyna.actor.world.pos.y -= 40.0f; - CollisionCheck_SetAT(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); } } @@ -240,7 +240,7 @@ void BgIcicle_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->actionFunc != BgIcicle_Regrow) { Collider_UpdateCylinder(&this->dyna.actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); } } diff --git a/src/overlays/actors/ovl_Bg_Ikana_Ray/z_bg_ikana_ray.c b/src/overlays/actors/ovl_Bg_Ikana_Ray/z_bg_ikana_ray.c index 19836f1f67..9462d17e1a 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Ray/z_bg_ikana_ray.c +++ b/src/overlays/actors/ovl_Bg_Ikana_Ray/z_bg_ikana_ray.c @@ -97,7 +97,7 @@ void BgIkanaRay_SetActivated(BgIkanaRay* this) { } void BgIkanaRay_UpdateActivated(BgIkanaRay* this, GlobalContext* globalCtx) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colCheckCtx, &this->collision.base); + CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collision.base); } void BgIkanaRay_Update(Actor* thisx, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c b/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c index 7bce96703a..caa4021f15 100644 --- a/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c +++ b/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c @@ -130,7 +130,7 @@ void BgIknvObj_UpdateWaterwheel(BgIknvObj* this, GlobalContext* globalCtx) { func_800B9010(&this->dyna.actor, NA_SE_EV_WOOD_WATER_WHEEL - SFX_FLAG); } - if ((globalCtx->csCtx.state != 0) && (gSaveContext.sceneSetupIndex == 1) && (globalCtx->csCtx.unk12 == 4) && + if ((globalCtx->csCtx.state != 0) && (gSaveContext.sceneSetupIndex == 1) && (globalCtx->csCtx.unk_12 == 4) && (globalCtx->csCtx.frames == 0x5D7)) { func_8019F128(NA_SE_EV_DOOR_UNLOCK); } @@ -138,7 +138,7 @@ void BgIknvObj_UpdateWaterwheel(BgIknvObj* this, GlobalContext* globalCtx) { s32 func_80BD7E0C(BgIknvObj* this, s16 targetRotation, GlobalContext* globalCtx) { this->dyna.actor.shape.yOffset = 0.0f; - CollisionCheck_SetOC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); if (targetRotation != this->dyna.actor.shape.rot.y) { Math_SmoothStepToS(&this->dyna.actor.shape.rot.y, targetRotation, 2, 100, 100); this->dyna.actor.world.rot.y = this->dyna.actor.shape.rot.y; @@ -157,7 +157,7 @@ void func_80BD7ED8(BgIknvObj* this, GlobalContext* globalCtx) { this->actionFunc = BgIknvObj_UpdateSakonDoor; gSaveContext.weekEventReg[51] &= (u8)~0x10; } - CollisionCheck_SetOC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); } void func_80BD7F4C(BgIknvObj* this, GlobalContext* globalCtx) { @@ -168,7 +168,7 @@ void func_80BD7F4C(BgIknvObj* this, GlobalContext* globalCtx) { ActorCutscene_Stop(this->dyna.actor.cutscene); this->dyna.actor.home.rot.x = 0; } - CollisionCheck_SetOC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); } void func_80BD7FDC(BgIknvObj* this, GlobalContext* globalCtx) { @@ -183,7 +183,7 @@ void func_80BD8040(BgIknvObj* this, GlobalContext* globalCtx) { if (func_80BD7CEC(this)) { this->actionFunc = func_80BD7FDC; } - CollisionCheck_SetOC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); } void BgIknvObj_UpdateSakonDoor(BgIknvObj* this, GlobalContext* globalCtx) { @@ -191,7 +191,7 @@ void BgIknvObj_UpdateSakonDoor(BgIknvObj* this, GlobalContext* globalCtx) { this->actionFunc = func_80BD8040; gSaveContext.weekEventReg[89] |= 0x80; } - CollisionCheck_SetOC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); } void BgIknvObj_UpdateRaisedDoor(BgIknvObj* this, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c b/src/overlays/actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c index 1259d3f7bc..8deb50f6be 100644 --- a/src/overlays/actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c +++ b/src/overlays/actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c @@ -209,7 +209,7 @@ void BgKin2Fence_HandleMaskCode(BgKin2Fence* this, GlobalContext* globalCtx) { this->cooldownTimer -= 1; return; } - CollisionCheck_SetAC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); } } diff --git a/src/overlays/actors/ovl_Bg_Market_Step/z_bg_market_step.c b/src/overlays/actors/ovl_Bg_Market_Step/z_bg_market_step.c index 11cbe33743..bf31ff8e71 100644 --- a/src/overlays/actors/ovl_Bg_Market_Step/z_bg_market_step.c +++ b/src/overlays/actors/ovl_Bg_Market_Step/z_bg_market_step.c @@ -8,15 +8,9 @@ void BgMarketStep_Init(Actor* thisx, GlobalContext* globalCtx); void BgMarketStep_Draw(Actor* thisx, GlobalContext* globalCtx); const ActorInit Bg_Market_Step_InitVars = { - ACTOR_BG_MARKET_STEP, - ACTORCAT_BG, - FLAGS, - OBJECT_MARKET_OBJ, - sizeof(BgMarketStep), - (ActorFunc)BgMarketStep_Init, - (ActorFunc)Actor_Noop, - (ActorFunc)Actor_Noop, - (ActorFunc)BgMarketStep_Draw, + ACTOR_BG_MARKET_STEP, ACTORCAT_BG, FLAGS, + OBJECT_MARKET_OBJ, sizeof(BgMarketStep), (ActorFunc)BgMarketStep_Init, + (ActorFunc)Actor_Noop, (ActorFunc)Actor_Noop, (ActorFunc)BgMarketStep_Draw, }; static InitChainEntry sInitChain[] = { diff --git a/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.c b/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.c index c9cd9f667e..cf9b8a1b37 100644 --- a/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.c +++ b/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.c @@ -57,7 +57,7 @@ void func_80C1DF18(DmNb* this, GlobalContext* globalCtx) { } if (func_800EE29C(globalCtx, 0x232)) { actionIndex = func_800EE200(globalCtx, 0x232); - actionUnk0 = globalCtx->csCtx.actorActions[actionIndex]->unk0; + actionUnk0 = globalCtx->csCtx.npcActions[actionIndex]->unk0; if (this->unk1EC != (actionUnk0 & 0xFF)) { this->unk1EC = actionUnk0; func_80C1DED0(this, sp2C[actionUnk0]); diff --git a/src/overlays/actors/ovl_Dm_Ravine/z_dm_ravine.c b/src/overlays/actors/ovl_Dm_Ravine/z_dm_ravine.c index 631c3c40a5..fca8d14528 100644 --- a/src/overlays/actors/ovl_Dm_Ravine/z_dm_ravine.c +++ b/src/overlays/actors/ovl_Dm_Ravine/z_dm_ravine.c @@ -37,8 +37,8 @@ void DmRavine_Init(Actor* thisx, GlobalContext* globalCtx) { } this->isActive = false; - globalCtx->roomContext.unk7A[0] = 1; - globalCtx->roomContext.unk7A[1] = 0; + globalCtx->roomCtx.unk7A[0] = 1; + globalCtx->roomCtx.unk7A[1] = 0; this->state = 0; Actor_SetScale(&this->actor, 1.0f); this->actionFunc = DmRavine_DoNothing; @@ -59,12 +59,12 @@ void DmRavine_Update(Actor* thisx, GlobalContext* globalCtx) { return; case DM_RAVINE_STATE_ACTIVE: this->isActive = true; - globalCtx->roomContext.unk7A[1]++; - if (globalCtx->roomContext.unk7A[1] > 254) { - globalCtx->roomContext.unk7A[1] = 254; + globalCtx->roomCtx.unk7A[1]++; + if (globalCtx->roomCtx.unk7A[1] > 254) { + globalCtx->roomCtx.unk7A[1] = 254; if (globalCtx->csCtx.frames > 700) { - globalCtx->roomContext.unk7A[1] = 255; - globalCtx->roomContext.unk7A[0] = 0; + globalCtx->roomCtx.unk7A[1] = 255; + globalCtx->roomCtx.unk7A[0] = 0; this->state++; // -> DM_RAVINE_STATE_PENDING_DEATH } } diff --git a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c index 8d0294a59f..dc5cf1d373 100644 --- a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c +++ b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c @@ -104,7 +104,7 @@ void DoorAna_WaitClosed(DoorAna* this, GlobalContext* globalCtx) { } else { Collider_UpdateCylinder(&this->actor, &this->bombCollider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colCheckCtx, &this->bombCollider.base); + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->bombCollider.base); } } @@ -125,7 +125,7 @@ void DoorAna_WaitOpen(DoorAna* this, GlobalContext* globalCtx) { f32 yDist; if (Math_StepToF(&this->actor.scale.x, 0.01f, 0.001f) != 0) { - if ((this->actor.targetMode != 0) && (globalCtx->unk18875 == 0) && (globalCtx->unk18B4A == 0) && + if ((this->actor.targetMode != 0) && (globalCtx->sceneLoadFlag == 0) && (globalCtx->unk_18B4A == 0) && (player->stateFlags1 & 0x80000000) && (player->unk_AE7 == 0)) { if (dooranaType == DOORANA_TYPE_ADJACENT) { diff --git a/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c b/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c index e6777da703..e767e3f35d 100644 --- a/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c +++ b/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c @@ -119,7 +119,7 @@ s32 DoorSpiral_SetSpiralType(DoorSpiral* this, GlobalContext* globalCtx) { this->spiralType = doorObjectInfo->spiralType; if ((this->spiralType == SPIRAL_DAMPES_HOUSE) || - ((this->spiralType == SPIRAL_WOODFALL_TEMPLE) && globalCtx->roomContext.currRoom.enablePosLights)) { + ((this->spiralType == SPIRAL_WOODFALL_TEMPLE) && globalCtx->roomCtx.currRoom.enablePosLights)) { if (this->spiralType == SPIRAL_WOODFALL_TEMPLE) { this->spiralType = SPIRAL_WOODFALL_TEMPLE_ALT; } @@ -181,7 +181,7 @@ void DoorSpiral_Init(Actor* thisx, GlobalContext* globalCtx) { s32 transition = GET_TRANSITION_ID_PARAM(thisx); s8 objBankId; - if (this->actor.room != globalCtx->transitionCtx.transitionActorList[transition].sides[0].room) { + if (this->actor.room != globalCtx->doorCtx.transitionActorList[transition].sides[0].room) { Actor_MarkForDeath(&this->actor); return; } @@ -205,7 +205,7 @@ void DoorSpiral_Init(Actor* thisx, GlobalContext* globalCtx) { void DoorSpiral_Destroy(Actor* thisx, GlobalContext* globalCtx) { s32 transition = GET_TRANSITION_ID_PARAM(thisx); - globalCtx->transitionCtx.transitionActorList[transition].id *= -1; + globalCtx->doorCtx.transitionActorList[transition].id *= -1; } /** @@ -283,7 +283,7 @@ void DoorSpiral_Wait(DoorSpiral* this, GlobalContext* globalCtx) { player->doorDirection = this->orientation; player->doorActor = &this->actor; transition = GET_TRANSITION_ID_PARAM(this); - player->doorNext = ((u16)globalCtx->transitionCtx.transitionActorList[transition].params) >> 10; + player->doorNext = ((u16)globalCtx->doorCtx.transitionActorList[transition].params) >> 10; func_80122F28(player, globalCtx, &this->actor); } diff --git a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c index 082e5a1ae6..d675609707 100644 --- a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c +++ b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c @@ -290,7 +290,7 @@ void func_80919768(Actor* thisx, GlobalContext* globalCtx2) { initialPositions->z * ((this->dz * aux) + (1.0f - this->dz)), MTXMODE_APPLY); Matrix_Scale(this->scalingFactor, this->scalingFactor, this->scalingFactor, 1); - SysMatrix_NormalizeXYZ(&globalCtx->unk187FC); + SysMatrix_NormalizeXYZ(&globalCtx->mf_187FC); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -347,7 +347,7 @@ void func_809199FC(Actor* thisx, GlobalContext* globalCtx2) { Matrix_Scale(*distanceTraveled * this->scalingFactor, *distanceTraveled * this->scalingFactor, *distanceTraveled * this->scalingFactor, MTXMODE_APPLY); - SysMatrix_NormalizeXYZ(&globalCtx->unk187FC); + SysMatrix_NormalizeXYZ(&globalCtx->mf_187FC); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPClearGeometryMode(POLY_XLU_DISP++, G_FOG | G_LIGHTING); diff --git a/src/overlays/actors/ovl_En_Cha/z_en_cha.c b/src/overlays/actors/ovl_En_Cha/z_en_cha.c index 6ad4307bc7..1df7f22e1c 100644 --- a/src/overlays/actors/ovl_En_Cha/z_en_cha.c +++ b/src/overlays/actors/ovl_En_Cha/z_en_cha.c @@ -107,10 +107,10 @@ void EnCha_Update(Actor* thisx, GlobalContext* globalCtx) { EnCha* this = THIS; GlobalContext* globalCtx2 = globalCtx; - CollisionCheck_SetOC(globalCtx, &globalCtx2->colCheckCtx, &this->collider.base); + CollisionCheck_SetOC(globalCtx, &globalCtx2->colChkCtx, &this->collider.base); this->actionFunc(this, globalCtx); if ((this->actor.shape.rot.z >= -0x1F3F) && (this->actor.shape.rot.z < 0x1F40)) { - CollisionCheck_SetAC(globalCtx, &globalCtx2->colCheckCtx, &this->collider.base); + CollisionCheck_SetAC(globalCtx, &globalCtx2->colChkCtx, &this->collider.base); } } diff --git a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c index a65aaac4a8..f7c4945de0 100644 --- a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c +++ b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c @@ -161,8 +161,8 @@ void EnEncount2_Update(Actor* thisx, GlobalContext* globalCtx) { if (!this->isPopped) { Collider_UpdateSpheresElement(&this->collider, 0, &this->dyna.actor); - CollisionCheck_SetAC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); } } diff --git a/src/overlays/actors/ovl_En_Fg/z_en_fg.c b/src/overlays/actors/ovl_En_Fg/z_en_fg.c index 231369ed1e..0dcca5a8b0 100644 --- a/src/overlays/actors/ovl_En_Fg/z_en_fg.c +++ b/src/overlays/actors/ovl_En_Fg/z_en_fg.c @@ -109,8 +109,8 @@ void func_80A2D348(EnFg* this, GlobalContext* globalCtx) { this->collider.dim.pos.x = this->actor.world.pos.x; this->collider.dim.pos.y = this->actor.world.pos.y; this->collider.dim.pos.z = this->actor.world.pos.z; - CollisionCheck_SetAC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); } } @@ -361,7 +361,7 @@ void EnFg_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec if ((limbIndex == 7) || (limbIndex == 8)) { OPEN_DISPS(globalCtx->state.gfxCtx); SysMatrix_StatePush(); - SysMatrix_NormalizeXYZ(&globalCtx->unk187FC); + SysMatrix_NormalizeXYZ(&globalCtx->mf_187FC); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, *dList); SysMatrix_StatePop(); @@ -455,7 +455,7 @@ void EnFg_DrawDust(GlobalContext* globalCtx, EnFgEffectDust* dustEffect) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, alpha); gDPPipeSync(POLY_XLU_DISP++); SysMatrix_InsertTranslation(dustEffect->pos.x, dustEffect->pos.y, dustEffect->pos.z, MTXMODE_NEW); - SysMatrix_NormalizeXYZ(&globalCtx->unk187FC); + SysMatrix_NormalizeXYZ(&globalCtx->mf_187FC); Matrix_Scale(dustEffect->xyScale, dustEffect->xyScale, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c index 6ff4e79385..e51b28e2ff 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c @@ -667,11 +667,11 @@ void EnFirefly_Update(Actor* thisx, GlobalContext* globalCtx2) { this->collider.dim.worldSphere.center.z = this->actor.world.pos.z; if ((this->actionFunc == EnFirefly_DiveAttack) || (this->actionFunc == EnFirefly_DisturbDiveAttack)) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); } if (this->actor.colChkInfo.health != 0) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); this->actor.world.rot.y = this->actor.shape.rot.y; if (func_801378B8(&this->skelAnime, 5.0f)) { @@ -679,7 +679,7 @@ void EnFirefly_Update(Actor* thisx, GlobalContext* globalCtx2) { } } - CollisionCheck_SetOC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); if (this->unk_2E8.x > 0.0f) { if (this->unk_18F != 0xA) { diff --git a/src/overlays/actors/ovl_En_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c index 7545c40a13..11bb315940 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -211,7 +211,7 @@ void func_808F32A0(EnIn* this, GlobalContext* globalCtx) { this->colliderCylinder.dim.pos.y = this->actor.world.pos.y; this->colliderCylinder.dim.pos.z = this->actor.world.pos.z; if (this->unk23D == 0) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colCheckCtx, &this->colliderCylinder.base); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderCylinder.base); } } @@ -831,8 +831,8 @@ s32 func_808F4414(GlobalContext* globalCtx, EnIn* this, s32 arg2) { SET_FLAGS_START_RACE; func_800FD750(0x40); globalCtx->nextEntranceIndex = 0xCE50; - globalCtx->unk1887F = 5; - globalCtx->unk18875 = 0x14; + globalCtx->unk_1887F = 5; + globalCtx->sceneLoadFlag = 0x14; gSaveContext.weekEventReg[57] |= 1; break; case 0x3478: @@ -1078,8 +1078,8 @@ s32 func_808F4414(GlobalContext* globalCtx, EnIn* this, s32 arg2) { SET_FLAGS_START_RACE; func_800FD750(0x40); globalCtx->nextEntranceIndex = 0xCE50; - globalCtx->unk1887F = 5; - globalCtx->unk18875 = 0x14; + globalCtx->unk_1887F = 5; + globalCtx->sceneLoadFlag = 0x14; gSaveContext.weekEventReg[57] |= 1; break; case 0x349D: diff --git a/src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.c b/src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.c index d046fbf477..7d729c12d8 100644 --- a/src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.c +++ b/src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.c @@ -63,12 +63,12 @@ s32 EnJcMato_CheckForHit(EnJcMato* this, GlobalContext* globalCtx) { if ((this->collider.base.acFlags & AC_HIT) && !this->hitFlag && (this->actor.colChkInfo.damageEffect == 0xF)) { this->collider.base.acFlags &= ~AC_HIT; Audio_PlayActorSound2(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); - globalCtx->interfaceCtx.unk25C = 1; + globalCtx->interfaceCtx.unk_25C = 1; this->hitFlag = 1; return 1; } else { - CollisionCheck_SetOC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); return 0; } } diff --git a/src/overlays/actors/ovl_En_M_Fire1/z_en_m_fire1.c b/src/overlays/actors/ovl_En_M_Fire1/z_en_m_fire1.c index 00729af22c..117c19ee58 100644 --- a/src/overlays/actors/ovl_En_M_Fire1/z_en_m_fire1.c +++ b/src/overlays/actors/ovl_En_M_Fire1/z_en_m_fire1.c @@ -65,6 +65,6 @@ void EnMFire1_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_MarkForDeath(&this->actor); } else { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAT(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); } } diff --git a/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c b/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c index e2c3eeff6f..69f852bd78 100644 --- a/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c +++ b/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c @@ -404,11 +404,11 @@ void EnMaYts_EndCreditsHandler(EnMaYts* this, GlobalContext* globalCtx) { if (func_800EE29C(globalCtx, 0x78) != 0) { actionIndex = func_800EE200(globalCtx, 0x78); - if (globalCtx->csCtx.frames == globalCtx->csCtx.actorActions[actionIndex]->startFrame) { - if (globalCtx->csCtx.actorActions[actionIndex]->unk0 != D_80B8E32C) { - D_80B8E32C = globalCtx->csCtx.actorActions[actionIndex]->unk0; + if (globalCtx->csCtx.frames == globalCtx->csCtx.npcActions[actionIndex]->startFrame) { + if (globalCtx->csCtx.npcActions[actionIndex]->unk0 != D_80B8E32C) { + D_80B8E32C = globalCtx->csCtx.npcActions[actionIndex]->unk0; this->endCreditsFlag = 0; - switch (globalCtx->csCtx.actorActions[actionIndex]->unk0) { + switch (globalCtx->csCtx.npcActions[actionIndex]->unk0) { case 1: this->hasBow = true; EnMaYts_ChangeAnim(this, 0); @@ -515,7 +515,7 @@ void EnMaYts_Update(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc(this, globalCtx); collider = &this->collider; Collider_UpdateCylinder(&this->actor, collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colCheckCtx, &collider->base); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &collider->base); SkelAnime_FrameUpdateMatrix(&this->skelAnime); EnMaYts_UpdateEyes(this); func_80B8D12C(this, globalCtx); diff --git a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c index fbfcecbd40..f1f3a7cb94 100644 --- a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c +++ b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c @@ -416,7 +416,7 @@ void EnMinifrog_NextFrogReturned(EnMinifrog* this, GlobalContext* globalCtx) { this->actionFunc = EnMinifrog_ContinueChoirCutscene; this->flags &= ~(0x2 << MINIFROG_YELLOW | 0x2 << MINIFROG_CYAN | 0x2 << MINIFROG_PINK | 0x2 << MINIFROG_BLUE | 0x2 << MINIFROG_WHITE); - globalCtx->func_18798(globalCtx, &D_0400DEA8, 0); + globalCtx->setPlayerTalkAnim(globalCtx, &D_0400DEA8, 0); } } @@ -447,7 +447,7 @@ void EnMinifrog_SetupNextFrogChoir(EnMinifrog* this, GlobalContext* globalCtx) { this->flags &= ~0x100; this->flags &= ~(0x2 << MINIFROG_YELLOW | 0x2 << MINIFROG_CYAN | 0x2 << MINIFROG_PINK | 0x2 << MINIFROG_BLUE | 0x2 << MINIFROG_WHITE); - globalCtx->func_18798(globalCtx, &D_0400DEA8, 0); + globalCtx->setPlayerTalkAnim(globalCtx, &D_0400DEA8, 0); } else if (this->timer <= 0) { this->actionFunc = EnMinifrog_NextFrogReturned; this->timer = 30; @@ -467,7 +467,7 @@ void EnMinifrog_BeginChoirCutscene(EnMinifrog* this, GlobalContext* globalCtx) { this->timer = 5; func_801A1F00(3, 0x5A); this->flags |= 0x100; - globalCtx->func_18798(globalCtx, &D_0400E2A8, 0); + globalCtx->setPlayerTalkAnim(globalCtx, &D_0400E2A8, 0); } else { ActorCutscene_SetIntentToPlay(this->actor.cutscene); } @@ -593,7 +593,7 @@ void EnMinifrog_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor); Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 25.0f, 12.0f, 0.0f, 0x1D); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); this->actor.focus.rot.y = this->actor.shape.rot.y; } @@ -625,7 +625,7 @@ void EnMinifrog_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis if ((limbIndex == 7) || (limbIndex == 8)) { OPEN_DISPS(globalCtx->state.gfxCtx); - SysMatrix_NormalizeXYZ(&globalCtx->unk187FC); + SysMatrix_NormalizeXYZ(&globalCtx->mf_187FC); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, *dList); CLOSE_DISPS(globalCtx->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Niw/z_en_niw.c b/src/overlays/actors/ovl_En_Niw/z_en_niw.c index 73fad74952..d6ad039f7d 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.c +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.c @@ -1,8 +1,8 @@ -/* - * File: z_en_niw.c +/* + * File: z_en_niw.c * Overlay: ovl_En_Niw * Description: Cucco (Chicken) (Japanese: Niwatori) - */ + */ #include "z_en_niw.h" @@ -451,7 +451,8 @@ void EnNiw_Held(EnNiw* this, GlobalContext* globalCtx) { this->actor.shape.rot.y = rotZ; this->actor.shape.rot.x = rotZ; } - } else if (this->unk2BC.z != 0.0f) { this->actor.shape.rot.z = 0; + } else if (this->unk2BC.z != 0.0f) { + this->actor.shape.rot.z = 0; rotZ = this->actor.shape.rot.z; this->actor.velocity.y = 8.0f; this->actor.speedXZ = 4.0f; @@ -915,12 +916,12 @@ void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) { if (!this->isStormActive) { if (this->niwType == ENNIW_TYPE_REGULAR) { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); if (globalCtx) {} if ((this->unknownState28E != 4) && (this->unknownState28E != 5)) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); } } } @@ -1038,8 +1039,9 @@ void func_808932B0(EnNiw* this, GlobalContext* globalCtx) { flag++; } - SysMatrix_InsertTranslation(this->feathers[i].pos.x, this->feathers[i].pos.y, this->feathers[i].pos.z, MTXMODE_NEW); - SysMatrix_NormalizeXYZ(&globalCtx->unk187FC); + SysMatrix_InsertTranslation(this->feathers[i].pos.x, this->feathers[i].pos.y, this->feathers[i].pos.z, + MTXMODE_NEW); + SysMatrix_NormalizeXYZ(&globalCtx->mf_187FC); Matrix_Scale(this->feathers[i].scale, this->feathers[i].scale, 1.0f, MTXMODE_APPLY); SysMatrix_InsertZRotation_f(this->feathers[i].zRot, MTXMODE_APPLY); SysMatrix_InsertTranslation(0.0f, -1000.0f, 0.0f, MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_En_Nnh/z_en_nnh.c b/src/overlays/actors/ovl_En_Nnh/z_en_nnh.c index 4f53bed574..5ff712d7ea 100644 --- a/src/overlays/actors/ovl_En_Nnh/z_en_nnh.c +++ b/src/overlays/actors/ovl_En_Nnh/z_en_nnh.c @@ -95,7 +95,7 @@ void EnNnh_Update(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc(this, globalCtx); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); } void EnNnh_Draw(Actor* thisx, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c index 1dfb41c2fe..c15d8d5141 100644 --- a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c +++ b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c @@ -150,11 +150,11 @@ void EnNutsball_Update(Actor* thisx, GlobalContext* globalCtx) { this->actor.flags |= 0x1000000; - CollisionCheck_SetAT(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); if (this->timer < this->timerThreshold) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); } } } @@ -164,7 +164,7 @@ void EnNutsball_Draw(Actor* thisx, GlobalContext* globalCtx) { OPEN_DISPS(globalCtx->state.gfxCtx) func_8012C28C(globalCtx->state.gfxCtx); - SysMatrix_InsertMatrix(&globalCtx->unk187FC, 1); + SysMatrix_InsertMatrix(&globalCtx->mf_187FC, 1); SysMatrix_InsertZRotation_s(this->actor.home.rot.z, 1); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, D_04058BA0); diff --git a/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c b/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c index c4c3c1d389..4ae96bafb9 100644 --- a/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c +++ b/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c @@ -34,7 +34,7 @@ void EnOkarinaEffect_Destroy(Actor* thisx, GlobalContext* globalCtx) { void EnOkarinaEffect_Init(Actor* thisx, GlobalContext* globalCtx) { EnOkarinaEffect* this = THIS; - if (globalCtx->kankyoContext.unkF2[1]) { + if (globalCtx->envCtx.unk_F2[1]) { Actor_MarkForDeath(&this->actor); } EnOkarinaEffect_SetupAction(this, func_8096B104); @@ -42,26 +42,26 @@ void EnOkarinaEffect_Init(Actor* thisx, GlobalContext* globalCtx) { void func_8096B104(EnOkarinaEffect* this, GlobalContext* globalCtx) { this->unk144 = 0x50; - globalCtx->kankyoContext.unkF2[4] = 0x3C; + globalCtx->envCtx.unk_F2[4] = 0x3C; D_801F4E70 = 501.0f; - globalCtx->kankyoContext.unkE3 = 2; + globalCtx->envCtx.unk_E3 = 2; func_800FD78C(globalCtx); EnOkarinaEffect_SetupAction(this, func_8096B174); } void func_8096B174(EnOkarinaEffect* this, GlobalContext* globalCtx) { DECR(this->unk144); - if (!globalCtx->pauseCtx.unk1EC && !globalCtx->unk17000 && !globalCtx->msgCtx.unk11F10 && + if (!globalCtx->pauseCtx.state && !globalCtx->gameOverCtx.state && !globalCtx->msgCtx.unk11F10 && !FrameAdvance_IsEnabled(globalCtx) && this->unk144 == 0) { EnOkarinaEffect_SetupAction(this, func_8096B1FC); } } void func_8096B1FC(EnOkarinaEffect* this, GlobalContext* globalCtx) { - if (globalCtx->kankyoContext.unkF2[4]) { + if (globalCtx->envCtx.unk_F2[4]) { if ((globalCtx->state.frames & 3) == 0) { - --globalCtx->kankyoContext.unkF2[4]; - if (globalCtx->kankyoContext.unkF2[4] == 8) { + --globalCtx->envCtx.unk_F2[4]; + if (globalCtx->envCtx.unk_F2[4] == 8) { func_800FD858(globalCtx); } } diff --git a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c index f179b13ecc..c7043f7655 100644 --- a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c +++ b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c @@ -171,7 +171,7 @@ void EnPametfrog_Init(Actor* thisx, GlobalContext* globalCtx) { this->transitionDrawTable, 24); Collider_InitAndSetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colElement); this->params = CLAMP(this->actor.params, 1, 4); - if (Actor_GetRoomCleared(globalCtx, globalCtx->roomContext.currRoom.num)) { + if (Actor_GetRoomCleared(globalCtx, globalCtx->roomCtx.currRoom.num)) { Actor_MarkForDeath(&this->actor); if (!(gSaveContext.weekEventReg[isFrogReturnedFlags[this->actor.params - 1] >> 8] & (u8)isFrogReturnedFlags[this->actor.params - 1])) { @@ -944,7 +944,7 @@ void EnPametfrog_SetupSpawnFrog(EnPametfrog* this, GlobalContext* globalCtx) { this->collider.base.ocFlags1 &= ~OC1_ON; func_800B0DE0(globalCtx, &vec1, &D_801D15B0, &D_801D15B0, &primColor, &envColor, 800, 50); func_800F0568(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_NPC_APPEAR); - Actor_SetRoomClearedTemp(globalCtx, globalCtx->roomContext.currRoom.num); + Actor_SetRoomClearedTemp(globalCtx, globalCtx->roomCtx.currRoom.num); for (i = 0; i < 25; i++) { vel.x = randPlusMinusPoint5Scaled(5.0f); @@ -1324,15 +1324,15 @@ void EnPametfrog_Update(Actor* thisx, GlobalContext* globalCtx) { } if (this->collider.base.atFlags & AT_ON) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); } if (this->collider.base.acFlags & AC_ON) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); } if (this->collider.base.ocFlags1 & OC1_ON) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); } if (this->unk_2C4 > 0.0f) { diff --git a/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c b/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c index 6ad3757005..696f538e8c 100644 --- a/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c +++ b/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c @@ -146,8 +146,8 @@ u16 EnPoFusen_CheckCollision(EnPoFusen* this, GlobalContext* globalCtx) { return 1; } - CollisionCheck_SetOC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); return 0; } diff --git a/src/overlays/actors/ovl_En_Sb/z_en_sb.c b/src/overlays/actors/ovl_En_Sb/z_en_sb.c index 1da26bfb86..384435258c 100644 --- a/src/overlays/actors/ovl_En_Sb/z_en_sb.c +++ b/src/overlays/actors/ovl_En_Sb/z_en_sb.c @@ -350,9 +350,9 @@ void EnSb_Update(Actor* thisx, GlobalContext* globalCtx) { if (player->stateFlags1 & 0x8000000) { Collider_UpdateCylinder(&this->actor, &this->collider); if (this->vulnerableTimer == 0) { - CollisionCheck_SetAT(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); } - CollisionCheck_SetAC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); } SkelAnime_FrameUpdateMatrix(&this->skelAnime); } diff --git a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c index c67894c29a..5b44b710c7 100644 --- a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c +++ b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c @@ -120,7 +120,7 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx) { } else { // Once the player has moved away, update collision and become opaque Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); targetAlpha = 255; } Math_StepToS(&this->alpha, targetAlpha, 8); diff --git a/src/overlays/actors/ovl_En_Toto/z_en_toto.c b/src/overlays/actors/ovl_En_Toto/z_en_toto.c index 6a63f2357c..27e5edd855 100644 --- a/src/overlays/actors/ovl_En_Toto/z_en_toto.c +++ b/src/overlays/actors/ovl_En_Toto/z_en_toto.c @@ -705,7 +705,7 @@ s32 func_80BA4C44(EnToto* this, GlobalContext* globalCtx) { void func_80BA4CB4(EnToto* this, GlobalContext* globalCtx) { CsCmdActorAction* action; - action = globalCtx->csCtx.actorActions[func_800EE200(globalCtx, 0x20D)]; + action = globalCtx->csCtx.npcActions[func_800EE200(globalCtx, 0x20D)]; if (this->unk2B5 != action->unk0) { this->unk2B5 = action->unk0; if (this->unk2B5 != 4) { @@ -743,8 +743,8 @@ void EnToto_Update(Actor* thisx, GlobalContext* globalCtx) { Collider_ResetCylinderAC(globalCtx, &this->collider.base); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); Actor_SetHeight(&this->actor, 40.0f); } diff --git a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c index 20a57c7b3c..31d59e64a6 100644 --- a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c +++ b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c @@ -326,8 +326,8 @@ void EnTuboTrap_Update(Actor* thisx, GlobalContext* globalCtx) { } Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); } void EnTuboTrap_Draw(Actor* thisx, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_En_Warp_Uzu/z_en_warp_uzu.c b/src/overlays/actors/ovl_En_Warp_Uzu/z_en_warp_uzu.c index 35988e8637..56b4e11433 100644 --- a/src/overlays/actors/ovl_En_Warp_Uzu/z_en_warp_uzu.c +++ b/src/overlays/actors/ovl_En_Warp_Uzu/z_en_warp_uzu.c @@ -129,7 +129,7 @@ void EnWarpUzu_Update(Actor* thisx, GlobalContext* globalCtx) { this->actor.uncullZoneForward = 1000.0f; this->actionFunc(this, globalCtx); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); } void EnWarpUzu_Draw(Actor* thisx, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c index d695677588..9773484a07 100644 --- a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c +++ b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c @@ -89,9 +89,9 @@ void EnWeatherTag_Init(Actor* thisx, GlobalContext* globalCtx) { break; case WEATHERTAG_TYPE_UNK5: func_800BC154(globalCtx, &globalCtx->actorCtx, &this->actor, 7); - globalCtx->unk18874 = 3; - globalCtx->kankyoContext.unk1F = 5; - globalCtx->kankyoContext.unk20 = 5; + globalCtx->skyboxId = 3; + globalCtx->envCtx.unk_1F = 5; + globalCtx->envCtx.unk_20 = 5; D_801F4E74 = 1.0f; EnWeatherTag_SetupAction(this, func_80966BF4); break; @@ -115,20 +115,20 @@ u8 func_80966608(EnWeatherTag* this, GlobalContext* globalCtx, UNK_TYPE a3, UNK_ u8 returnVal = 0; if (WEATHER_TAG_RANGE100(this) > Actor_XZDistanceBetweenActors(&player->actor, &this->actor)) { - if (globalCtx->kankyoContext.unk1F == globalCtx->kankyoContext.unk20) { + if (globalCtx->envCtx.unk_1F == globalCtx->envCtx.unk_20) { D_801BDBB8 = 1; - if (!(globalCtx->kankyoContext.unk1E == 0) || - ((globalCtx->kankyoContext.unk1F != 1) && (globalCtx->kankyoContext.unk21 == 0))) { + if (!(globalCtx->envCtx.unk_1E == 0) || + ((globalCtx->envCtx.unk_1F != 1) && (globalCtx->envCtx.unk_21 == 0))) { D_801BDBB8 = 0; if (D_801BDBB0 != weatherMode) { D_801BDBB0 = weatherMode; - globalCtx->kankyoContext.unk21 = 1; - globalCtx->kankyoContext.unk1F = new1F; - globalCtx->kankyoContext.unk20 = new20; + globalCtx->envCtx.unk_21 = 1; + globalCtx->envCtx.unk_1F = new1F; + globalCtx->envCtx.unk_20 = new20; D_801BDBB4 = new20; - globalCtx->kankyoContext.unk24 = new24; - globalCtx->kankyoContext.unk22 = globalCtx->kankyoContext.unk24; + globalCtx->envCtx.unk_24 = new24; + globalCtx->envCtx.unk_22 = globalCtx->envCtx.unk_24; } returnVal = 1; } @@ -145,19 +145,19 @@ u8 func_80966758(EnWeatherTag* this, GlobalContext* globalCtx, UNK_TYPE a3, UNK_ u8 returnVal = 0; if (WEATHER_TAG_RANGE100(this) < Actor_XZDistanceBetweenActors(&player->actor, &this->actor)) { - if (globalCtx->kankyoContext.unk1F == globalCtx->kankyoContext.unk20) { + if (globalCtx->envCtx.unk_1F == globalCtx->envCtx.unk_20) { D_801BDBB8 = 1; - if (!(globalCtx->kankyoContext.unk1E == 0) || - ((globalCtx->kankyoContext.unk1F != 1) && (globalCtx->kankyoContext.unk21 == 0))) { + if (!(globalCtx->envCtx.unk_1E == 0) || + ((globalCtx->envCtx.unk_1F != 1) && (globalCtx->envCtx.unk_21 == 0))) { D_801BDBB8 = 0; D_801BDBB0 = 0; - globalCtx->kankyoContext.unk21 = 1; - globalCtx->kankyoContext.unk1F = new1F; - globalCtx->kankyoContext.unk20 = new20; + globalCtx->envCtx.unk_21 = 1; + globalCtx->envCtx.unk_1F = new1F; + globalCtx->envCtx.unk_20 = new20; D_801BDBB4 = new20; - globalCtx->kankyoContext.unk24 = new24; - globalCtx->kankyoContext.unk22 = globalCtx->kankyoContext.unk24; + globalCtx->envCtx.unk_24 = new24; + globalCtx->envCtx.unk_22 = globalCtx->envCtx.unk_24; returnVal = 1; } } @@ -184,13 +184,13 @@ void func_8096689C(EnWeatherTag* this, GlobalContext* globalCtx) { partialResult = (1.0f - (distance / this->fadeDistance)); // strength based on distance? partialResult = (this->unk154 / 32768.0f) * partialResult; // another scale applied - globalCtx->kankyoContext.windClothIntensity = (this->actor.world.rot.z * partialResult) + 30.0f; + globalCtx->envCtx.windSpeed = (this->actor.world.rot.z * partialResult) + 30.0f; if (partialResult > 0.01f) { - globalCtx->kankyoContext.unkEA = 8; + globalCtx->envCtx.unk_EA = 8; D_801F4E30 = 0x9B; - } else if (globalCtx->kankyoContext.unkEA == 8) { + } else if (globalCtx->envCtx.unk_EA == 8) { D_801F4E30 = 0; - globalCtx->kankyoContext.unkEA = 9; + globalCtx->envCtx.unk_EA = 9; } } @@ -228,11 +228,11 @@ void EnWeatherTag_Die(EnWeatherTag* this, GlobalContext* globalCtx) { // poisoned swamp: placed behind the water fall from ikana // this tag stops spawning after STT cleared? void func_80966B08(EnWeatherTag* this, GlobalContext* globalCtx) { - if (func_80966608(this, globalCtx, 0, 0, globalCtx->kankyoContext.unk1F, 5, 100, 2) || D_801BDBB0 == 2) { - globalCtx->unk18874 = 3; + if (func_80966608(this, globalCtx, 0, 0, globalCtx->envCtx.unk_1F, 5, 100, 2) || D_801BDBB0 == 2) { + globalCtx->skyboxId = 3; EnWeatherTag_SetupAction(this, func_80966D20); } else if (D_801F4E74 <= 0.01f) { - globalCtx->unk18874 = 1; + globalCtx->skyboxId = 1; } else { Math_SmoothStepToF(&D_801F4E74, 0.0f, 0.2f, 0.02f, 0.001f); } @@ -245,7 +245,7 @@ void func_80966BF4(EnWeatherTag* this, GlobalContext* globalCtx) { CsCmdActorAction* tmpAction; if (func_800EE29C(globalCtx, 0x237) != 0) { - tmpAction = globalCtx->csCtx.actorActions[func_800EE200(globalCtx, 0x237)]; + tmpAction = globalCtx->csCtx.npcActions[func_800EE200(globalCtx, 0x237)]; if ((globalCtx->csCtx.frames >= tmpAction->startFrame) && (tmpAction->unk0 >= 2)) { switch (gSaveContext.day) { case 0: @@ -263,11 +263,11 @@ void func_80966BF4(EnWeatherTag* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&D_801F4E74, 0.0f, 0.2f, 0.02f, 0.001f); - if (globalCtx->kankyoContext.unk20 != newUnk20) { - globalCtx->kankyoContext.unk21 = 1; - globalCtx->kankyoContext.unk20 = newUnk20; - globalCtx->kankyoContext.unk24 = 100; - globalCtx->kankyoContext.unk22 = globalCtx->kankyoContext.unk24; + if (globalCtx->envCtx.unk_20 != newUnk20) { + globalCtx->envCtx.unk_21 = 1; + globalCtx->envCtx.unk_20 = newUnk20; + globalCtx->envCtx.unk_24 = 100; + globalCtx->envCtx.unk_22 = globalCtx->envCtx.unk_24; } } } @@ -306,7 +306,7 @@ void func_80966D20(EnWeatherTag* this, GlobalContext* globalCtx) { // path to goron village winter, winter mountain village void func_80966E0C(EnWeatherTag* this, GlobalContext* globalCtx) { if (func_80966608(this, globalCtx, 0, 1, 0, 2, 60, 3)) { - globalCtx->kankyoContext.unkF2[3] = 0x80; + globalCtx->envCtx.unk_F2[3] = 0x80; EnWeatherTag_SetupAction(this, func_80966E84); } } @@ -314,7 +314,7 @@ void func_80966E0C(EnWeatherTag* this, GlobalContext* globalCtx) { // WEATHERTAG_TYPE_WINTERFOG 2 void func_80966E84(EnWeatherTag* this, GlobalContext* globalCtx) { if (func_80966758(this, globalCtx, 1, 0, 2, 0, 60)) { - globalCtx->kankyoContext.unkF2[3] = 0; + globalCtx->envCtx.unk_F2[3] = 0; EnWeatherTag_SetupAction(this, func_80966E0C); } } @@ -325,7 +325,7 @@ void func_80966E84(EnWeatherTag* this, GlobalContext* globalCtx) { void func_80966EF0(EnWeatherTag* this, GlobalContext* globalCtx) { if (func_80966608(this, globalCtx, 0, 1, 0, 2, 100, 4)) { func_800FD78C(globalCtx); - globalCtx->kankyoContext.unkF2[0] = 60; + globalCtx->envCtx.unk_F2[0] = 60; EnWeatherTag_SetupAction(this, func_80966F74); } } @@ -334,7 +334,7 @@ void func_80966EF0(EnWeatherTag* this, GlobalContext* globalCtx) { void func_80966F74(EnWeatherTag* this, GlobalContext* globalCtx) { if (func_80966758(this, globalCtx, 1, 0, 2, 0, 100)) { func_800FD858(globalCtx); - globalCtx->kankyoContext.unkF2[0] = 0; + globalCtx->envCtx.unk_F2[0] = 0; EnWeatherTag_SetupAction(this, func_80966EF0); } } @@ -399,8 +399,8 @@ void EnWeatherTag_DoNothing(EnWeatherTag* this, GlobalContext* globalCtx) { void EnWeatherTag_Unused_809671B8(EnWeatherTag* this, GlobalContext* globalCtx) { if (func_80966608(this, globalCtx, 0, 1, 0, 4, 100, 5)) { func_800FD78C(globalCtx); - globalCtx->kankyoContext.unkE3 = 1; - globalCtx->kankyoContext.unkF2[0] = 60; + globalCtx->envCtx.unk_E3 = 1; + globalCtx->envCtx.unk_F2[0] = 60; EnWeatherTag_SetupAction(this, EnWeatherTag_Unused_80967250); } } @@ -409,8 +409,8 @@ void EnWeatherTag_Unused_809671B8(EnWeatherTag* this, GlobalContext* globalCtx) void EnWeatherTag_Unused_80967250(EnWeatherTag* this, GlobalContext* globalCtx) { if (func_80966758(this, globalCtx, 1, 0, 4, 0, 100)) { func_800FD858(globalCtx); - globalCtx->kankyoContext.unkE3 = 2; - globalCtx->kankyoContext.unkF2[0] = 0; + globalCtx->envCtx.unk_E3 = 2; + globalCtx->envCtx.unk_F2[0] = 0; EnWeatherTag_SetupAction(this, EnWeatherTag_Unused_809671B8); } } @@ -437,20 +437,20 @@ void func_809672DC(EnWeatherTag* this, GlobalContext* globalCtx) { range = WEATHER_TAG_RANGE100(this); if (distance < range) { - globalCtx->kankyoContext.unkEA = 6; + globalCtx->envCtx.unk_EA = 6; strength = 1.0f - (distance / range); if (0.8f < strength) { strength = 1.0f; } D_801F4E30 = (200.0f * strength); } else { - if (globalCtx->kankyoContext.unkEA == 6) { + if (globalCtx->envCtx.unk_EA == 6) { D_801F4E30 = 0; - globalCtx->kankyoContext.unkEA = 7; + globalCtx->envCtx.unk_EA = 7; } } - Math_SmoothStepToS(&globalCtx->kankyoContext.unkA4, (s16)(-40.0f * strength), 1, 1, 1); + Math_SmoothStepToS(&globalCtx->envCtx.unk_8C.fogNear, (s16)(-40.0f * strength), 1, 1, 1); } #else #pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Weather_Tag_0x80966410/func_809672DC.asm") @@ -463,19 +463,18 @@ void func_809674C8(EnWeatherTag* this, GlobalContext* globalCtx) { if (Actor_XZDistanceBetweenActors(&player->actor, &this->actor) < WEATHER_TAG_RANGE100(this)) { if (CURRENT_DAY == 2) { - if ((gSaveContext.time >= 0x4AAA) && (gSaveContext.time < 0xBAAA) && - (globalCtx->kankyoContext.unkF2[2] == 0)) { + if ((gSaveContext.time >= 0x4AAA) && (gSaveContext.time < 0xBAAA) && (globalCtx->envCtx.unk_F2[2] == 0)) { D_801BDBB0 = 1; func_800FD78C(globalCtx); - globalCtx->kankyoContext.unkF2[4] = 0x20; + globalCtx->envCtx.unk_F2[4] = 0x20; EnWeatherTag_SetupAction(this, func_80967608); } } } else { - if ((globalCtx->kankyoContext.unkF2[4] != 0) && !(globalCtx->state.frames & 3)) { - globalCtx->kankyoContext.unkF2[4]--; - if ((globalCtx->kankyoContext.unkF2[4]) == 8) { + if ((globalCtx->envCtx.unk_F2[4] != 0) && !(globalCtx->state.frames & 3)) { + globalCtx->envCtx.unk_F2[4]--; + if ((globalCtx->envCtx.unk_F2[4]) == 8) { func_800FD858(globalCtx); } } @@ -496,8 +495,8 @@ void EnWeatherTag_Update(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc(this, globalCtx); if ((globalCtx->actorCtx.unk5 & 2) && (globalCtx->msgCtx.unk11F22 != 0) && (globalCtx->msgCtx.unk11F04 == 0x5E6) && - (!FrameAdvance_IsEnabled(globalCtx)) && (globalCtx->unk18875 == 0) && (ActorCutscene_GetCurrentIndex() == -1) && - (globalCtx->csCtx.state == 0)) { + (!FrameAdvance_IsEnabled(globalCtx)) && (globalCtx->sceneLoadFlag == 0) && + (ActorCutscene_GetCurrentIndex() == -1) && (globalCtx->csCtx.state == 0)) { oldTime = gSaveContext.time; gSaveContext.time = (u16)REG(0xF) + oldTime; // cast req diff --git a/src/overlays/actors/ovl_Obj_Bell/z_obj_bell.c b/src/overlays/actors/ovl_Obj_Bell/z_obj_bell.c index 95f3dbaebd..069b2516b5 100644 --- a/src/overlays/actors/ovl_Obj_Bell/z_obj_bell.c +++ b/src/overlays/actors/ovl_Obj_Bell/z_obj_bell.c @@ -187,9 +187,9 @@ void func_80A358FC(ObjBell* this, GlobalContext* globalCtx) { this->collider1.dim.worldSphere.radius = (this->collider1.dim.modelSphere.radius * this->collider1.dim.scale); this->collider2.dim.worldSphere.radius = (this->collider2.dim.modelSphere.radius * this->collider2.dim.scale); if (DECR(this->unk_20E) == 0) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colCheckCtx, &this->collider2.base); + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider2.base); } - CollisionCheck_SetOC(globalCtx, &globalCtx->colCheckCtx, &this->collider1.base); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider1.base); } void func_80A359B4(Actor* thisx, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.c b/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.c index df8efe0195..0fba2130ce 100644 --- a/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.c +++ b/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.c @@ -171,10 +171,10 @@ void ObjBoyo_Update(Actor* thisx, GlobalContext* globalCtx2) { this->collider.base.ocFlags1 &= ~OC1_HIT; this->collider.base.ocFlags2 &= ~OC2_HIT_PLAYER; - CollisionCheck_SetOC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); if (thisx->xzDistToPlayer < 2000.0f) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); } } diff --git a/src/overlays/actors/ovl_Obj_Funen/z_obj_funen.c b/src/overlays/actors/ovl_Obj_Funen/z_obj_funen.c index dbc9c6be21..a1c51e097e 100644 --- a/src/overlays/actors/ovl_Obj_Funen/z_obj_funen.c +++ b/src/overlays/actors/ovl_Obj_Funen/z_obj_funen.c @@ -8,15 +8,9 @@ void ObjFunen_Init(Actor* thisx, GlobalContext* globalCtx); void ObjFunen_Draw(Actor* thisx, GlobalContext* globalCtx); const ActorInit Obj_Funen_InitVars = { - ACTOR_OBJ_FUNEN, - ACTORCAT_PROP, - FLAGS, - OBJECT_FUNEN, - sizeof(ObjFunen), - (ActorFunc)ObjFunen_Init, - (ActorFunc)Actor_Noop, - (ActorFunc)Actor_Noop, - (ActorFunc)ObjFunen_Draw, + ACTOR_OBJ_FUNEN, ACTORCAT_PROP, FLAGS, + OBJECT_FUNEN, sizeof(ObjFunen), (ActorFunc)ObjFunen_Init, + (ActorFunc)Actor_Noop, (ActorFunc)Actor_Noop, (ActorFunc)ObjFunen_Draw, }; extern Gfx D_060000D0[]; diff --git a/src/overlays/actors/ovl_Obj_Hgdoor/z_obj_hgdoor.c b/src/overlays/actors/ovl_Obj_Hgdoor/z_obj_hgdoor.c index 76ee99c616..d2878b2ade 100644 --- a/src/overlays/actors/ovl_Obj_Hgdoor/z_obj_hgdoor.c +++ b/src/overlays/actors/ovl_Obj_Hgdoor/z_obj_hgdoor.c @@ -132,9 +132,9 @@ void func_80BD4358(ObjHgdoor* this, GlobalContext* globalCtx) { if (func_800EE29C(globalCtx, 0x1E3)) { actionIndex = func_800EE200(globalCtx, 0x1E3); - if (this->unk166 != globalCtx->csCtx.actorActions[actionIndex]->unk0) { - this->unk166 = globalCtx->csCtx.actorActions[actionIndex]->unk0; - switch (globalCtx->csCtx.actorActions[actionIndex]->unk0) { + if (this->unk166 != globalCtx->csCtx.npcActions[actionIndex]->unk0) { + this->unk166 = globalCtx->csCtx.npcActions[actionIndex]->unk0; + switch (globalCtx->csCtx.npcActions[actionIndex]->unk0) { case 1: Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_WOOD_DOOR_OPEN_SPEEDY); if ((this->dyna.actor.parent != NULL) && (this->dyna.actor.parent->id == ACTOR_EN_HG)) { diff --git a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c index be5427cb82..3a26d2c343 100644 --- a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c +++ b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c @@ -118,7 +118,7 @@ void func_80926318(ObjKibako* this, GlobalContext* globalCtx) { } void func_80926394(ObjKibako* this, GlobalContext* globalCtx) { - if ((this->isDropCollected == 0) && (globalCtx->roomContext.currRoom.num != this->unk199)) { + if ((this->isDropCollected == 0) && (globalCtx->roomCtx.currRoom.num != this->unk199)) { this->isDropCollected = 1; } } @@ -282,7 +282,7 @@ void ObjKibako_Idle(ObjKibako* this, GlobalContext* globalCtx) { Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor); func_809262BC(this); Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 18.0f, 15.0f, 0.0f, 0x45); - + if (!(this->collider.base.ocFlags1 & OC1_TYPE_PLAYER) && (this->actor.xzDistToPlayer > 28.0f)) { this->collider.base.ocFlags1 |= OC1_TYPE_PLAYER; } @@ -296,19 +296,19 @@ void ObjKibako_Idle(ObjKibako* this, GlobalContext* globalCtx) { if ((this->actor.params >> 7) & 1) { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); if (this->actor.xzDistToPlayer < 800.0f) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); func_80926318(this, globalCtx); } } else { if (this->actor.xzDistToPlayer < 800.0f) { Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); if (this->actor.xzDistToPlayer < 180.0f) { - CollisionCheck_SetOC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); func_80926318(this, globalCtx); } } @@ -327,7 +327,7 @@ void ObjKibako_Held(ObjKibako* this, GlobalContext* globalCtx) { func_80926394(this, globalCtx); if (Actor_HasNoParent(&this->actor, globalCtx)) { - this->actor.room = globalCtx->roomContext.currRoom.num; + this->actor.room = globalCtx->roomCtx.currRoom.num; if (fabsf(this->actor.speedXZ) < 0.1f) { ObjKibako_SetupIdle(this); this->collider.base.ocFlags1 &= ~OC1_TYPE_PLAYER; @@ -394,8 +394,8 @@ void ObjKibako_Thrown(ObjKibako* this, GlobalContext* globalCtx) { this->actor.shape.rot.y = (s16)(this->actor.shape.rot.y + D_8092738C); Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 18.0f, 15.0f, 0.0f, 0x45); Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); - CollisionCheck_SetAT(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); } } } diff --git a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c index ea9db39244..f7727e46f6 100644 --- a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c +++ b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c @@ -391,8 +391,8 @@ void ObjLightswitch_Update(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc(this, globalCtx); if (this->actor.update != 0) { this->previousACFlags = this->collider.base.acFlags; - CollisionCheck_SetOC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); - CollisionCheck_SetAC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); } } diff --git a/src/overlays/actors/ovl_Obj_Milk_Bin/z_obj_milk_bin.c b/src/overlays/actors/ovl_Obj_Milk_Bin/z_obj_milk_bin.c index 9f4cd90e2d..5af8763039 100644 --- a/src/overlays/actors/ovl_Obj_Milk_Bin/z_obj_milk_bin.c +++ b/src/overlays/actors/ovl_Obj_Milk_Bin/z_obj_milk_bin.c @@ -91,8 +91,8 @@ void ObjMilkBin_Update(Actor* thisx, GlobalContext* globalCtx2) { } if (!(this->disableDraw & 1)) { - CollisionCheck_SetAC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); - CollisionCheck_SetOC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); } } diff --git a/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.c b/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.c index 8c7e54116d..581ac9cad7 100644 --- a/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.c +++ b/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.c @@ -156,7 +156,7 @@ void ObjMoonStone_Draw(Actor* thisx, GlobalContext* globalCtx) { AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(&D_06001C60)); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, D_06000D78); - SysMatrix_NormalizeXYZ(&globalCtx->unk187FC); + SysMatrix_NormalizeXYZ(&globalCtx->mf_187FC); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, D_06000C80); CLOSE_DISPS(globalCtx->state.gfxCtx); diff --git a/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c b/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c index deffa382e4..295016fea1 100644 --- a/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c +++ b/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c @@ -197,7 +197,7 @@ void ObjTokeiStep_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); BcCheck3_BgActorInit(&this->dyna, 0); - if ((globalCtx->sceneNum == 0x6F) && (gSaveContext.sceneSetupIndex == 2) && (globalCtx->csCtx.unk12 == 0)) { + if ((globalCtx->sceneNum == 0x6F) && (gSaveContext.sceneSetupIndex == 2) && (globalCtx->csCtx.unk_12 == 0)) { BgCheck3_LoadMesh(globalCtx, &this->dyna, &D_06000968); ObjTokeiStep_InitSteps(this); ObjTokeiStep_SetupBeginOpen(this); @@ -226,7 +226,7 @@ void ObjTokeiStep_BeginOpen(ObjTokeiStep* this, GlobalContext* globalCtx) { CsCmdActorAction* action; if (func_800EE29C(globalCtx, 0x86)) { - action = globalCtx->csCtx.actorActions[func_800EE200(globalCtx, 0x86)]; + action = globalCtx->csCtx.npcActions[func_800EE200(globalCtx, 0x86)]; if ((globalCtx->csCtx.frames == (*action).startFrame) && action->unk0) { this->dyna.actor.draw = ObjTokeiStep_DrawOpen; ObjTokeiStep_SetupOpen(this); diff --git a/tables/functions.txt b/tables/functions.txt index 8be5b01742..0914737aba 100644 --- a/tables/functions.txt +++ b/tables/functions.txt @@ -1711,10 +1711,10 @@ 0x800F4C0C:("func_800F4C0C",), 0x800F4E20:("func_800F4E20",), 0x800F4F28:("func_800F4F28",), - 0x800F4F40:("Kanfont_Nop800F4F40",), - 0x800F4F54:("Kanfont_LoadAsciiChar",), - 0x800F4FC0:("Kanfont_LoadMessageBoxEnd",), - 0x800F5004:("Kanfont_LoadOrderedFont",), + 0x800F4F40:("Font_LoadChar",), + 0x800F4F54:("Font_LoadCharNES",), + 0x800F4FC0:("Font_LoadMessageBoxEndIcon",), + 0x800F5004:("Font_LoadOrderedFont",), 0x800F5090:("func_800F5090",), 0x800F50D4:("func_800F50D4",), 0x800F510C:("Kankyo_Init",), @@ -2444,7 +2444,7 @@ 0x8012FDA4:("Scene_HeaderCmdLightList",), 0x8012FE2C:("Scene_HeaderCmdPathList",), 0x8012FE5C:("Scene_HeaderCmdTransiActorList",), - 0x8012FEBC:("Transition_Init",), + 0x8012FEBC:("Door_InitContext",), 0x8012FECC:("Scene_HeaderCmdEnvLightSettings",), 0x8012FF10:("Scene_LoadAreaTextures",), 0x8012FF8C:("Scene_HeaderCmdSkyboxSettings",),