From a09ea76025cda9f85eb5cad7dfa2b9ddeb2e1d17 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Wed, 25 Sep 2024 00:18:01 +0200 Subject: [PATCH] [headers] gfx_setupdl.h and z64skin_matrix.h (#2221) * [headers] gfx_setupdl.h and z64skin_matrix.h * include z64skin_matrix.h * bss * bss --- include/functions.h | 52 +------- include/gfx.h | 75 ----------- include/gfx_setupdl.h | 121 ++++++++++++++++++ include/z64.h | 2 + include/z64skin_matrix.h | 25 ++++ src/boot/z_std_dma.c | 2 +- src/code/main.c | 2 +- src/code/z_camera.c | 2 +- .../actors/ovl_En_Po_Field/z_en_po_field.c | 2 + src/overlays/actors/ovl_Fishing/z_fishing.c | 2 +- 10 files changed, 155 insertions(+), 130 deletions(-) create mode 100644 include/gfx_setupdl.h create mode 100644 include/z64skin_matrix.h diff --git a/include/functions.h b/include/functions.h index e146c89301..e8ff3d5b81 100644 --- a/include/functions.h +++ b/include/functions.h @@ -655,42 +655,7 @@ void PreNMI_Init(GameState* thisx); Gfx* Gfx_SetFog(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 near, s32 far); Gfx* Gfx_SetFogWithSync(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 near, s32 far); Gfx* Gfx_SetFog2(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 near, s32 far); -Gfx* Gfx_SetupDL(Gfx* gfx, u32 i); -Gfx* Gfx_SetupDL_57(Gfx* gfx); -Gfx* Gfx_SetupDL_52NoCD(Gfx* gfx); -void Gfx_SetupDL_57Opa(GraphicsContext* gfxCtx); -void Gfx_SetupDL_51Opa(GraphicsContext* gfxCtx); -void Gfx_SetupDL_54Opa(GraphicsContext* gfxCtx); -void Gfx_SetupDL_26Opa(GraphicsContext* gfxCtx); -void Gfx_SetupDL_25Xlu2(GraphicsContext* gfxCtx); -void func_80093C80(PlayState* play); -void Gfx_SetupDL_25Opa(GraphicsContext* gfxCtx); -void Gfx_SetupDL_25Xlu(GraphicsContext* gfxCtx); -Gfx* Gfx_SetupDL_64(Gfx* gfx); -Gfx* Gfx_SetupDL_34(Gfx* gfx); -void Gfx_SetupDL_44Xlu(GraphicsContext* gfxCtx); -void Gfx_SetupDL_36Opa(GraphicsContext* gfxCtx); -void Gfx_SetupDL_28Opa(GraphicsContext* gfxCtx); -Gfx* Gfx_SetupDL_28(Gfx* gfx); -void Gfx_SetupDL_38Xlu(GraphicsContext* gfxCtx); -void Gfx_SetupDL_4Xlu(GraphicsContext* gfxCtx); -void Gfx_SetupDL_37Opa(GraphicsContext* gfxCtx); -Gfx* Gfx_SetupDL_39(Gfx* gfx); -void Gfx_SetupDL_39Opa(GraphicsContext* gfxCtx); -void Gfx_SetupDL_39Overlay(GraphicsContext* gfxCtx); -void Gfx_SetupDL_39Ptr(Gfx** gfxP); -void Gfx_SetupDL_40Opa(GraphicsContext* gfxCtx); -void Gfx_SetupDL_41Opa(GraphicsContext* gfxCtx); -void Gfx_SetupDL_47Xlu(GraphicsContext* gfxCtx); -Gfx* Gfx_SetupDL_20NoCD(Gfx* gfx); -Gfx* Gfx_SetupDL_66(Gfx* gfx); -Gfx* func_800947AC(Gfx* gfx); -void Gfx_SetupDL_42Opa(GraphicsContext* gfxCtx); -void Gfx_SetupDL_42Overlay(GraphicsContext* gfxCtx); -void Gfx_SetupDL_27Xlu(GraphicsContext* gfxCtx); -void Gfx_SetupDL_60NoCDXlu(GraphicsContext* gfxCtx); -void Gfx_SetupDL_61Xlu(GraphicsContext* gfxCtx); -void Gfx_SetupDL_56Ptr(Gfx** gfxP); + Gfx* Gfx_BranchTexScroll(Gfx** gfxP, u32 x, u32 y, s32 width, s32 height); Gfx* func_80094E78(GraphicsContext* gfxCtx, u32 x, u32 y); Gfx* Gfx_TexScroll(GraphicsContext* gfxCtx, u32 x, u32 y, s32 width, s32 height); @@ -738,21 +703,6 @@ void Skin_Init(PlayState* play, Skin* skin, SkeletonHeader* skeletonHeader, Anim void Skin_Free(PlayState* play, Skin* skin); s32 Skin_ApplyAnimTransformations(Skin* skin, MtxF* limbMatrices, Actor* actor, s32 setTranslation); -void SkinMatrix_Vec3fMtxFMultXYZW(MtxF* mf, Vec3f* src, Vec3f* xyzDest, f32* wDest); -void SkinMatrix_Vec3fMtxFMultXYZ(MtxF* mf, Vec3f* src, Vec3f* dest); -void SkinMatrix_MtxFMtxFMult(MtxF* mfA, MtxF* mfB, MtxF* dest); -void SkinMatrix_GetClear(MtxF** mfp); -void SkinMatrix_MtxFCopy(MtxF* src, MtxF* dest); -s32 SkinMatrix_Invert(MtxF* src, MtxF* dest); -void SkinMatrix_SetScale(MtxF* mf, f32 x, f32 y, f32 z); -void SkinMatrix_SetRotateZYX(MtxF* mf, s16 x, s16 y, s16 z); -void SkinMatrix_SetTranslate(MtxF* mf, f32 x, f32 y, f32 z); -void SkinMatrix_SetTranslateRotateYXZScale(MtxF* dest, f32 scaleX, f32 scaleY, f32 scaleZ, s16 rotX, s16 rotY, s16 rotZ, - f32 translateX, f32 translateY, f32 translateZ); -void SkinMatrix_SetTranslateRotateZYX(MtxF* dest, s16 rotX, s16 rotY, s16 rotZ, f32 translateX, f32 translateY, - f32 translateZ); -Mtx* SkinMatrix_MtxFToNewMtx(GraphicsContext* gfxCtx, MtxF* src); -void SkinMatrix_SetRotateAxis(MtxF* mf, s16 angle, f32 axisX, f32 axisY, f32 axisZ); void Sram_InitNewSave(void); void Sram_InitDebugSave(void); void Sram_OpenSave(SramContext* sramCtx); diff --git a/include/gfx.h b/include/gfx.h index d14590a45f..c50f6c1337 100644 --- a/include/gfx.h +++ b/include/gfx.h @@ -51,81 +51,6 @@ typedef struct GraphicsContext { /* 0x02FC */ char unk_2FC[0x04]; } GraphicsContext; // size = 0x300 -typedef enum SetupDL { - /* 0 */ SETUPDL_0, - /* 1 */ SETUPDL_1, - /* 2 */ SETUPDL_2, - /* 3 */ SETUPDL_3, - /* 4 */ SETUPDL_4, - /* 5 */ SETUPDL_5, - /* 6 */ SETUPDL_6, - /* 7 */ SETUPDL_7, - /* 8 */ SETUPDL_8, - /* 9 */ SETUPDL_9, - /* 10 */ SETUPDL_10, - /* 11 */ SETUPDL_11, - /* 12 */ SETUPDL_12, - /* 13 */ SETUPDL_13, - /* 14 */ SETUPDL_14, - /* 15 */ SETUPDL_15, - /* 16 */ SETUPDL_16, - /* 17 */ SETUPDL_17, - /* 18 */ SETUPDL_18, - /* 19 */ SETUPDL_19, - /* 20 */ SETUPDL_20, - /* 21 */ SETUPDL_21, - /* 22 */ SETUPDL_22, - /* 23 */ SETUPDL_23, - /* 24 */ SETUPDL_24, - /* 25 */ SETUPDL_25, - /* 26 */ SETUPDL_26, - /* 27 */ SETUPDL_27, - /* 28 */ SETUPDL_28, - /* 29 */ SETUPDL_29, - /* 30 */ SETUPDL_30, - /* 31 */ SETUPDL_31, - /* 32 */ SETUPDL_32, - /* 33 */ SETUPDL_33, - /* 34 */ SETUPDL_34, - /* 35 */ SETUPDL_35, - /* 36 */ SETUPDL_36, - /* 37 */ SETUPDL_37, - /* 38 */ SETUPDL_38, - /* 39 */ SETUPDL_39, - /* 40 */ SETUPDL_40, - /* 41 */ SETUPDL_41, - /* 42 */ SETUPDL_42, - /* 43 */ SETUPDL_43, - /* 44 */ SETUPDL_44, - /* 45 */ SETUPDL_45, - /* 46 */ SETUPDL_46, - /* 47 */ SETUPDL_47, - /* 48 */ SETUPDL_48, - /* 49 */ SETUPDL_49, - /* 50 */ SETUPDL_50, - /* 51 */ SETUPDL_51, - /* 52 */ SETUPDL_52, - /* 53 */ SETUPDL_53, - /* 54 */ SETUPDL_54, - /* 55 */ SETUPDL_55, - /* 56 */ SETUPDL_56, - /* 57 */ SETUPDL_57, - /* 58 */ SETUPDL_58, - /* 59 */ SETUPDL_59, - /* 60 */ SETUPDL_60, - /* 61 */ SETUPDL_61, - /* 62 */ SETUPDL_62, - /* 63 */ SETUPDL_63, - /* 64 */ SETUPDL_64, - /* 65 */ SETUPDL_65, - /* 66 */ SETUPDL_66, - /* 67 */ SETUPDL_67, - /* 68 */ SETUPDL_68, - /* 69 */ SETUPDL_69, - /* 70 */ SETUPDL_70, - /* 71 */ SETUPDL_MAX -} SetupDL; - void* Graph_Alloc(GraphicsContext* gfxCtx, size_t size); void* Graph_Alloc2(GraphicsContext* gfxCtx, size_t size); diff --git a/include/gfx_setupdl.h b/include/gfx_setupdl.h new file mode 100644 index 0000000000..1eae1f6e2c --- /dev/null +++ b/include/gfx_setupdl.h @@ -0,0 +1,121 @@ +#ifndef GFX_SETUPDL_H +#define GFX_SETUPDL_H + +#include "ultra64.h" + +struct GraphicsContext; +struct PlayState; + +typedef enum SetupDL { + /* 0 */ SETUPDL_0, + /* 1 */ SETUPDL_1, + /* 2 */ SETUPDL_2, + /* 3 */ SETUPDL_3, + /* 4 */ SETUPDL_4, + /* 5 */ SETUPDL_5, + /* 6 */ SETUPDL_6, + /* 7 */ SETUPDL_7, + /* 8 */ SETUPDL_8, + /* 9 */ SETUPDL_9, + /* 10 */ SETUPDL_10, + /* 11 */ SETUPDL_11, + /* 12 */ SETUPDL_12, + /* 13 */ SETUPDL_13, + /* 14 */ SETUPDL_14, + /* 15 */ SETUPDL_15, + /* 16 */ SETUPDL_16, + /* 17 */ SETUPDL_17, + /* 18 */ SETUPDL_18, + /* 19 */ SETUPDL_19, + /* 20 */ SETUPDL_20, + /* 21 */ SETUPDL_21, + /* 22 */ SETUPDL_22, + /* 23 */ SETUPDL_23, + /* 24 */ SETUPDL_24, + /* 25 */ SETUPDL_25, + /* 26 */ SETUPDL_26, + /* 27 */ SETUPDL_27, + /* 28 */ SETUPDL_28, + /* 29 */ SETUPDL_29, + /* 30 */ SETUPDL_30, + /* 31 */ SETUPDL_31, + /* 32 */ SETUPDL_32, + /* 33 */ SETUPDL_33, + /* 34 */ SETUPDL_34, + /* 35 */ SETUPDL_35, + /* 36 */ SETUPDL_36, + /* 37 */ SETUPDL_37, + /* 38 */ SETUPDL_38, + /* 39 */ SETUPDL_39, + /* 40 */ SETUPDL_40, + /* 41 */ SETUPDL_41, + /* 42 */ SETUPDL_42, + /* 43 */ SETUPDL_43, + /* 44 */ SETUPDL_44, + /* 45 */ SETUPDL_45, + /* 46 */ SETUPDL_46, + /* 47 */ SETUPDL_47, + /* 48 */ SETUPDL_48, + /* 49 */ SETUPDL_49, + /* 50 */ SETUPDL_50, + /* 51 */ SETUPDL_51, + /* 52 */ SETUPDL_52, + /* 53 */ SETUPDL_53, + /* 54 */ SETUPDL_54, + /* 55 */ SETUPDL_55, + /* 56 */ SETUPDL_56, + /* 57 */ SETUPDL_57, + /* 58 */ SETUPDL_58, + /* 59 */ SETUPDL_59, + /* 60 */ SETUPDL_60, + /* 61 */ SETUPDL_61, + /* 62 */ SETUPDL_62, + /* 63 */ SETUPDL_63, + /* 64 */ SETUPDL_64, + /* 65 */ SETUPDL_65, + /* 66 */ SETUPDL_66, + /* 67 */ SETUPDL_67, + /* 68 */ SETUPDL_68, + /* 69 */ SETUPDL_69, + /* 70 */ SETUPDL_70, + /* 71 */ SETUPDL_MAX +} SetupDL; + +Gfx* Gfx_SetupDL(Gfx* gfx, u32 i); +Gfx* Gfx_SetupDL_57(Gfx* gfx); +Gfx* Gfx_SetupDL_52NoCD(Gfx* gfx); +void Gfx_SetupDL_57Opa(struct GraphicsContext* gfxCtx); +void Gfx_SetupDL_51Opa(struct GraphicsContext* gfxCtx); +void Gfx_SetupDL_54Opa(struct GraphicsContext* gfxCtx); +void Gfx_SetupDL_26Opa(struct GraphicsContext* gfxCtx); +void Gfx_SetupDL_25Xlu2(struct GraphicsContext* gfxCtx); +void func_80093C80(struct PlayState* play); +void Gfx_SetupDL_25Opa(struct GraphicsContext* gfxCtx); +void Gfx_SetupDL_25Xlu(struct GraphicsContext* gfxCtx); +Gfx* Gfx_SetupDL_64(Gfx* gfx); +Gfx* Gfx_SetupDL_34(Gfx* gfx); +void Gfx_SetupDL_44Xlu(struct GraphicsContext* gfxCtx); +void Gfx_SetupDL_36Opa(struct GraphicsContext* gfxCtx); +void Gfx_SetupDL_28Opa(struct GraphicsContext* gfxCtx); +Gfx* Gfx_SetupDL_28(Gfx* gfx); +void Gfx_SetupDL_38Xlu(struct GraphicsContext* gfxCtx); +void Gfx_SetupDL_4Xlu(struct GraphicsContext* gfxCtx); +void Gfx_SetupDL_37Opa(struct GraphicsContext* gfxCtx); +Gfx* Gfx_SetupDL_39(Gfx* gfx); +void Gfx_SetupDL_39Opa(struct GraphicsContext* gfxCtx); +void Gfx_SetupDL_39Overlay(struct GraphicsContext* gfxCtx); +void Gfx_SetupDL_39Ptr(Gfx** gfxP); +void Gfx_SetupDL_40Opa(struct GraphicsContext* gfxCtx); +void Gfx_SetupDL_41Opa(struct GraphicsContext* gfxCtx); +void Gfx_SetupDL_47Xlu(struct GraphicsContext* gfxCtx); +Gfx* Gfx_SetupDL_20NoCD(Gfx* gfx); +Gfx* Gfx_SetupDL_66(Gfx* gfx); +Gfx* func_800947AC(Gfx* gfx); +void Gfx_SetupDL_42Opa(struct GraphicsContext* gfxCtx); +void Gfx_SetupDL_42Overlay(struct GraphicsContext* gfxCtx); +void Gfx_SetupDL_27Xlu(struct GraphicsContext* gfxCtx); +void Gfx_SetupDL_60NoCDXlu(struct GraphicsContext* gfxCtx); +void Gfx_SetupDL_61Xlu(struct GraphicsContext* gfxCtx); +void Gfx_SetupDL_56Ptr(Gfx** gfxP); + +#endif diff --git a/include/z64.h b/include/z64.h index c7a0a1ea2b..25b470ad71 100644 --- a/include/z64.h +++ b/include/z64.h @@ -34,6 +34,7 @@ #include "z64pause.h" #include "z64play.h" #include "z64skin.h" +#include "z64skin_matrix.h" #include "z64game.h" #include "z64transition.h" #include "z64transition_instances.h" @@ -62,6 +63,7 @@ #include "thga.h" #include "speedmeter.h" #include "gfx.h" +#include "gfx_setupdl.h" #include "jpeg.h" #include "prerender.h" #include "rand.h" diff --git a/include/z64skin_matrix.h b/include/z64skin_matrix.h new file mode 100644 index 0000000000..647790abff --- /dev/null +++ b/include/z64skin_matrix.h @@ -0,0 +1,25 @@ +#ifndef Z64SKIN_MATRIX_H +#define Z64SKIN_MATRIX_H + +#include "ultra64.h" +#include "z64math.h" + +struct GraphicsContext; + +void SkinMatrix_Vec3fMtxFMultXYZW(MtxF* mf, Vec3f* src, Vec3f* xyzDest, f32* wDest); +void SkinMatrix_Vec3fMtxFMultXYZ(MtxF* mf, Vec3f* src, Vec3f* dest); +void SkinMatrix_MtxFMtxFMult(MtxF* mfA, MtxF* mfB, MtxF* dest); +void SkinMatrix_GetClear(MtxF** mfp); +void SkinMatrix_MtxFCopy(MtxF* src, MtxF* dest); +s32 SkinMatrix_Invert(MtxF* src, MtxF* dest); +void SkinMatrix_SetScale(MtxF* mf, f32 x, f32 y, f32 z); +void SkinMatrix_SetRotateZYX(MtxF* mf, s16 x, s16 y, s16 z); +void SkinMatrix_SetTranslate(MtxF* mf, f32 x, f32 y, f32 z); +void SkinMatrix_SetTranslateRotateYXZScale(MtxF* dest, f32 scaleX, f32 scaleY, f32 scaleZ, s16 rotX, s16 rotY, s16 rotZ, + f32 translateX, f32 translateY, f32 translateZ); +void SkinMatrix_SetTranslateRotateZYX(MtxF* dest, s16 rotX, s16 rotY, s16 rotZ, f32 translateX, f32 translateY, + f32 translateZ); +Mtx* SkinMatrix_MtxFToNewMtx(struct GraphicsContext* gfxCtx, MtxF* src); +void SkinMatrix_SetRotateAxis(MtxF* mf, s16 angle, f32 axisX, f32 axisY, f32 axisZ); + +#endif diff --git a/src/boot/z_std_dma.c b/src/boot/z_std_dma.c index 07ce265359..5491e4ca92 100644 --- a/src/boot/z_std_dma.c +++ b/src/boot/z_std_dma.c @@ -27,7 +27,7 @@ #endif #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.2:108" + "ntsc-1.2:106" StackEntry sDmaMgrStackInfo; OSMesgQueue sDmaMgrMsgQueue; diff --git a/src/code/main.c b/src/code/main.c index 010fd9050c..2adf795176 100644 --- a/src/code/main.c +++ b/src/code/main.c @@ -23,7 +23,7 @@ extern struct IrqMgr gIrqMgr; #endif #pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192" \ - "ntsc-1.2:166" + "ntsc-1.2:164" extern u8 _buffersSegmentEnd[]; diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 7464b6ffd3..eeba153abc 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -3638,7 +3638,7 @@ s32 Camera_KeepOn3(Camera* camera) { } #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.2:110" + "ntsc-1.2:108" s32 Camera_KeepOn4(Camera* camera) { static Vec3f D_8015BD50; diff --git a/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c b/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c index c3c9252c94..8018015ea4 100644 --- a/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c +++ b/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c @@ -142,6 +142,8 @@ static EnPoFieldInfo sPoFieldInfo[2] = { static Vec3f D_80AD714C = { 0.0f, 1400.0f, 0.0f }; +#pragma increment_block_number "gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128 ntsc-1.2:128" + static Vec3s sSpawnPositions[10]; static u8 sSpawnSwitchFlags[10]; static MtxF sLimb7Mtx; diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c index 1fe68463ff..91ba0690bd 100644 --- a/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -16,7 +16,7 @@ #include "cic6105.h" #endif -#pragma increment_block_number "gc-eu:131 gc-eu-mq:131 gc-jp:133 gc-jp-ce:133 gc-jp-mq:133 gc-us:133 gc-us-mq:133" +#pragma increment_block_number "gc-eu:129 gc-eu-mq:129 gc-jp:131 gc-jp-ce:131 gc-jp-mq:131 gc-us:131 gc-us-mq:131" #define FLAGS ACTOR_FLAG_4