Debloating z64.h 1: Introducing z64skybox.h (#1150)

* z64skybox.h

* Add a few placeholder values on the enum

* Remove unused structs on z64.h

* Update include/z64skybox.h

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* move skybox functions

* format

* Revert ARRAY_COUNT(msg)

* bss

* whoops

* Update include/z64.h

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* SkyboxDraw -> Skybox_

* use enum in z_play

* format

---------

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>
This commit is contained in:
Anghelo Carvajal
2023-02-21 16:31:11 -03:00
committed by GitHub
parent 5bc388b9a9
commit a7fd595136
11 changed files with 102 additions and 120 deletions
-10
View File
@@ -2164,16 +2164,6 @@ void func_801420C0(void* arg0);
void func_801420F4(void* arg0);
void func_80142100(void* arg0, Gfx** gfx, u32 arg2);
s32 func_80142440(SkyboxContext* skyboxCtx, Vtx* roomVtx, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6, s32 arg7, s32 arg8);
void func_80143148(SkyboxContext* skyboxCtx, s32 arg1);
void Skybox_Setup(GameState* gameState, SkyboxContext* skyboxCtx, s16 skyboxId);
void func_80143324(PlayState* play, SkyboxContext* skyboxCtx, s16 skyboxId);
void Skybox_Init(GameState* gameState, SkyboxContext* skyboxCtx, s16 skyboxId);
Mtx* SkyboxDraw_UpdateMatrix(SkyboxContext* skyboxCtx, f32 x, f32 y, f32 z);
void SkyboxDraw_SetColors(SkyboxContext* skyboxCtx, u8 primR, u8 primG, u8 primB, u8 envR, u8 envG, u8 envB);
void SkyboxDraw_Draw(SkyboxContext* skyboxCtx, GraphicsContext* gfxCtx, s16 skyboxId, s16 blend, f32 x, f32 y, f32 z);
void SkyboxDraw_Update(SkyboxContext* skyboxCtx);
// void func_80147520(void);
void func_80147564(PlayState* play);
s32 Message_ShouldAdvance(PlayState* play);
+3 -78
View File
@@ -48,6 +48,7 @@
#include "z64scene.h"
#include "z64schedule.h"
#include "z64skin.h"
#include "z64skybox.h"
#include "z64subs.h"
#include "z64transition.h"
#include "z64view.h"
@@ -276,8 +277,6 @@ typedef struct {
/* 0x10 */ OSTime resetTime;
} NmiBuff; // size >= 0x18
typedef void(*osCreateThread_func)(void*);
typedef enum {
SLOWLY_CALLBACK_NO_ARGS,
SLOWLY_CALLBACK_ONE_ARG,
@@ -306,36 +305,6 @@ typedef struct {
/* 0x14 */ OSMesgQueue unk14;
} s80185D40; // size = 0x2C
typedef struct {
/* 0x00 */ u32 unk0;
/* 0x04 */ u8 unk4;
/* 0x05 */ u8 unk5;
/* 0x06 */ u8 unk6;
/* 0x07 */ UNK_TYPE1 pad7[0x2];
/* 0x09 */ u8 unk9;
/* 0x0A */ UNK_TYPE1 padA[0x2];
/* 0x0C */ u32 unkC;
/* 0x10 */ u16 unk10;
/* 0x12 */ u16 unk12;
/* 0x14 */ u16 unk14;
/* 0x16 */ UNK_TYPE1 pad16[0x2];
/* 0x18 */ u32 unk18;
/* 0x1C */ u32 unk1C;
/* 0x20 */ u32 unk20;
/* 0x24 */ u32 unk24;
/* 0x28 */ u32 unk28;
/* 0x2C */ u32 unk2C;
/* 0x30 */ u32 unk30;
/* 0x34 */ u32 unk34;
} s8018CFAC; // size = 0x38
typedef struct {
/* 0x00 */ Vec3f unk0;
/* 0x0C */ Vec3f unkC;
/* 0x18 */ s16 unk18;
/* 0x1A */ s16 unk1A;
} s80874650; // size = 0x1C
typedef union {
F3DVertexColor color;
F3DVertexNormal normal;
@@ -542,36 +511,6 @@ typedef struct {
/* 0xFA */ u8 unk_FA[4];
} EnvironmentContext; // size = 0x100
typedef struct {
/* 0x000 */ View view;
/* 0x168 */ void* staticSegments[4];
/* 0x178 */ void* paletteStaticSegment;
/* 0x17C */ Gfx (*dListBuf)[150];
/* 0x180 */ Gfx* roomDL;
/* 0x184 */ Vtx* roomVtx;
/* 0x188 */ DmaRequest unk188;
/* 0x1A8 */ DmaRequest unk1A8;
/* 0x1C8 */ DmaRequest unk1C8;
/* 0x1E8 */ OSMesgQueue loadQueue;
/* 0x200 */ OSMesg loadMsg;
/* 0x204 */ s16 skyboxShouldDraw;
/* 0x208 */ f32 rotX;
/* 0x20C */ f32 rotY;
/* 0x210 */ f32 rotZ;
/* 0x214 */ Vec3f eye;
/* 0x220 */ s16 angle;
/* 0x222 */ u8 primR;
/* 0x223 */ u8 primG;
/* 0x224 */ u8 primB;
/* 0x225 */ u8 envR;
/* 0x226 */ u8 envG;
/* 0x227 */ u8 envB;
} SkyboxContext; // size = 0x228
typedef enum {
/* 0x05 */ SKYBOX_CUTSCENE_MAP = 5
} SkyboxId;
typedef struct ListAlloc {
/* 0x0 */ struct ListAlloc* prev;
/* 0x4 */ struct ListAlloc* next;
@@ -698,13 +637,7 @@ typedef struct GameState {
/* 0xA3 */ u8 unk_A3;
} GameState; // size = 0xA4
typedef struct {
/* 0x00 */ u32 resetting;
/* 0x04 */ u32 resetCount;
/* 0x08 */ OSTime duration;
/* 0x10 */ OSTime resetTime;
} PreNmiBuff; // size = 0x18 (actually osAppNmiBuffer is 0x40 bytes large but the rest is unused)
struct PlayState;
typedef s32 (*ColChkResetFunc)(struct PlayState*, Collider*);
typedef void (*ColChkBloodFunc)(struct PlayState*, Collider*, Vec3f*);
@@ -906,7 +839,7 @@ typedef struct PlayState {
/* 0x18868 */ void* naviQuestHints; // leftover from OoT, system which processes this is removed
/* 0x1886C */ AnimatedMaterial* sceneMaterialAnims;
/* 0x18870 */ void* specialEffects;
/* 0x18874 */ u8 skyboxId;
/* 0x18874 */ u8 skyboxId; // @see SkyboxId enum
/* 0x18875 */ s8 transitionTrigger; // "fade_direction"
/* 0x18876 */ s16 worldCoverAlpha;
/* 0x18878 */ s16 bgCoverAlpha;
@@ -969,14 +902,6 @@ typedef struct {
/* 0x10 */ Color_RGBA8_u32 envColor;
} Struct_80140E80; // size = 0x14
typedef struct {
/* 0x00 */ s32 unk0;
/* 0x04 */ s32 unk4;
/* 0x08 */ s32 unk8;
/* 0x0C */ s32 unkC;
/* 0x10 */ s32 unk10;
} struct_801C5F44; // size = 0x14
// From OoT's struct_80034A14_arg1
typedef struct {
/* 0x00 */ s16 unk_00;
+67
View File
@@ -0,0 +1,67 @@
#ifndef Z64_SKYBOX_H
#define Z64_SKYBOX_H
#include "PR/ultratypes.h"
#include "PR/gbi.h"
#include "z64dma.h"
#include "z64math.h"
#include "z64view.h"
struct GraphicsContext;
struct GameState;
struct PlayState;
typedef enum SkyboxId {
/* 0 */ SKYBOX_NONE,
/* 1 */ SKYBOX_NORMAL_SKY,
/* 2 */ SKYBOX_2,
/* 3 */ SKYBOX_3,
/* 5 */ SKYBOX_CUTSCENE_MAP = 5
} SkyboxId;
typedef struct SkyboxContext {
/* 0x000 */ View view;
/* 0x168 */ void* staticSegments[4];
/* 0x178 */ void* paletteStaticSegment;
/* 0x17C */ Gfx (*dListBuf)[150];
/* 0x180 */ Gfx* roomDL;
/* 0x184 */ Vtx* roomVtx;
/* 0x188 */ DmaRequest unk188;
/* 0x1A8 */ DmaRequest unk1A8;
/* 0x1C8 */ DmaRequest unk1C8;
/* 0x1E8 */ OSMesgQueue loadQueue;
/* 0x200 */ OSMesg loadMsg;
/* 0x204 */ s16 skyboxShouldDraw;
/* 0x208 */ f32 rotX;
/* 0x20C */ f32 rotY;
/* 0x210 */ f32 rotZ;
/* 0x214 */ Vec3f eye;
/* 0x220 */ s16 angle;
/* 0x222 */ u8 primR;
/* 0x223 */ u8 primG;
/* 0x224 */ u8 primB;
/* 0x225 */ u8 envR;
/* 0x226 */ u8 envG;
/* 0x227 */ u8 envB;
} SkyboxContext; // size = 0x228
typedef struct struct_801C5F44 {
/* 0x00 */ s32 unk0;
/* 0x04 */ s32 unk4;
/* 0x08 */ s32 unk8;
/* 0x0C */ s32 unkC;
/* 0x10 */ s32 unk10;
} struct_801C5F44; // size = 0x14
s32 func_80142440(SkyboxContext* skyboxCtx, Vtx* roomVtx, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6, s32 arg7, s32 arg8);
void func_80143148(SkyboxContext* skyboxCtx, s32 arg1);
void Skybox_Setup(struct GameState* gameState, SkyboxContext* skyboxCtx, s16 skyboxId);
void func_80143324(struct PlayState* play, SkyboxContext* skyboxCtx, s16 skyboxId);
void Skybox_Init(struct GameState* gameState, SkyboxContext* skyboxCtx, s16 skyboxId);
Mtx* Skybox_UpdateMatrix(SkyboxContext* skyboxCtx, f32 x, f32 y, f32 z);
void Skybox_SetColors(SkyboxContext* skyboxCtx, u8 primR, u8 primG, u8 primB, u8 envR, u8 envG, u8 envB);
void Skybox_Draw(SkyboxContext* skyboxCtx, struct GraphicsContext* gfxCtx, s16 skyboxId, s16 blend, f32 x, f32 y, f32 z);
void Skybox_Update(SkyboxContext* skyboxCtx);
#endif