Skip to content

Commit

Permalink
Merge pull request HarbourMasters#4539 from garrettjoecox/let-it-snow
Browse files Browse the repository at this point in the history
Update let-it-snow with develop and fix ornament messages
  • Loading branch information
garrettjoecox authored Nov 12, 2024
2 parents 5c98cda + 2ee5e5c commit ed9692c
Show file tree
Hide file tree
Showing 250 changed files with 4,132 additions and 2,666 deletions.
12 changes: 12 additions & 0 deletions soh/include/attributes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#ifndef ATTRIBUTES_H
#define ATTRIBUTES_H

#if !defined(__GNUC__) && !defined(__attribute__)
#define __attribute__(x)
#endif

#define UNUSED __attribute__((unused))
#define FALLTHROUGH __attribute__((fallthrough))
#define NORETURN __attribute__((noreturn))

#endif
32 changes: 10 additions & 22 deletions soh/include/functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -980,9 +980,9 @@ f32 Math_SmoothStepToDegF(f32* pValue, f32 target, f32 fraction, f32 step, f32 m
s16 Math_SmoothStepToS(s16* pValue, s16 target, s16 scale, s16 step, s16 minStep);
void Math_ApproachS(s16* pValue, s16 target, s16 scale, s16 step);
void Color_RGBA8_Copy(Color_RGBA8* dst, Color_RGBA8* src);
void func_80078884(u16 sfxId);
void func_800788CC(u16 sfxId);
void func_80078914(Vec3f* arg0, u16 sfxId);
void Sfx_PlaySfxCentered(u16 sfxId);
void Sfx_PlaySfxCentered2(u16 sfxId);
void Sfx_PlaySfxAtPos(Vec3f* arg0, u16 sfxId);
s16 getHealthMeterXOffset();
s16 getHealthMeterYOffset();
void HealthMeter_Init(PlayState* play);
Expand Down Expand Up @@ -1419,18 +1419,6 @@ void ViMode_Init(ViMode* viMode);
void ViMode_Destroy(ViMode* viMode);
void ViMode_ConfigureFeatures(ViMode* viMode, s32 viFeatures);
void ViMode_Update(ViMode* viMode, Input* input);
void func_800ACE70(struct_801664F0* this);
void func_800ACE90(struct_801664F0* this);
void func_800ACE98(struct_801664F0* this, Gfx** gfxp);
void VisMono_Init(VisMono* this);
void VisMono_Destroy(VisMono* this);
void VisMono_UpdateTexture(VisMono* this, u16* tex);
Gfx* VisMono_DrawTexture(VisMono* this, Gfx* gfx);
void VisMono_Draw(VisMono* this, Gfx** gfxp);
void VisMono_DrawOld(VisMono* this);
void func_800AD920(struct_80166500* this);
void func_800AD950(struct_80166500* this);
void func_800AD958(struct_80166500* this, Gfx** gfxp);
void Skybox_Init(GameState* state, SkyboxContext* skyboxCtx, s16 skyboxId);
Mtx* SkyboxDraw_UpdateMatrix(SkyboxContext* skyboxCtx, f32 x, f32 y, f32 z);
void SkyboxDraw_Draw(SkyboxContext* skyboxCtx, GraphicsContext* gfxCtx, s16 skyboxId, s16 blend, f32 x, f32 y, f32 z);
Expand Down Expand Up @@ -1536,9 +1524,9 @@ void KaleidoScopeCall_Init(PlayState* play);
void KaleidoScopeCall_Destroy(PlayState* play);
void KaleidoScopeCall_Update(PlayState* play);
void KaleidoScopeCall_Draw(PlayState* play);
void func_800BC490(PlayState* play, s16 point);
s32 func_800BC56C(PlayState* play, s16 arg1);
void func_800BC590(PlayState* play);
void Play_SetViewpoint(PlayState* play, s16 viewpoint);
s32 Play_CheckViewpoint(PlayState* play, s16 viewpoint);
void Play_SetShopBrowsingViewpoint(PlayState* play);
void Gameplay_SetupTransition(PlayState* play, s32 arg1);
Gfx* Play_SetFog(PlayState* play, Gfx* gfx);
void Play_Destroy(GameState* thisx);
Expand All @@ -1552,7 +1540,7 @@ u8 CheckLACSRewardCount();
s32 Play_InCsMode(PlayState* play);
f32 func_800BFCB8(PlayState* play, MtxF* mf, Vec3f* vec);
void* Play_LoadFile(PlayState* play, RomFile* file);
void Play_SpawnScene(PlayState* play, s32 sceneNum, s32 spawn);
void Play_SpawnScene(PlayState* play, s32 sceneId, s32 spawn);
void func_800C016C(PlayState* play, Vec3f* src, Vec3f* dest);
s16 Play_CreateSubCamera(PlayState* play);
s16 Play_GetActiveCamId(PlayState* play);
Expand Down Expand Up @@ -2279,7 +2267,7 @@ void __osMallocInit(Arena* arena, void* start, size_t size);
void __osMallocAddBlock(Arena* arena, void* start, ptrdiff_t size);
void ArenaImpl_RemoveAllBlocks(Arena* arena);
void __osMallocCleanup(Arena* arena);
u8 __osMallocIsInitalized(Arena* arena);
s32 __osMallocIsInitialized(Arena* arena);
void __osMalloc_FreeBlockTest(Arena* arena, ArenaNode* node);
void* __osMalloc_NoLockDebug(Arena* arena, size_t size, const char* file, s32 line);
void* __osMallocDebug(Arena* arena, size_t size, const char* file, s32 line);
Expand All @@ -2296,7 +2284,7 @@ void* __osReallocDebug(Arena* arena, void* ptr, size_t newSize, const char* file
void ArenaImpl_GetSizes(Arena* arena, u32* outMaxFree, u32* outFree, u32* outAlloc);
void __osDisplayArena(Arena* arena);
void ArenaImpl_FaultClient(Arena* arena);
u32 __osCheckArena(Arena* arena);
s32 __osCheckArena(Arena* arena);
u8 func_800FF334(Arena* arena);
s32 PrintUtils_VPrintf(PrintCallback* pfn, const char* fmt, va_list args);
s32 PrintUtils_Printf(PrintCallback* pfn, const char* fmt, ...);
Expand Down Expand Up @@ -2420,7 +2408,7 @@ OSThread* __osGetCurrFaultedThread(void);
u32* osViGetCurrentFramebuffer(void);
s32 __osSpSetPc(void* pc);
f32 absf(f32);
void* func_801068B0(void* dst, void* src, size_t size);
void* oot_memmove(void* dest, const void* src, size_t len);
void Message_UpdateOcarinaGame(PlayState* play);
u8 Message_ShouldAdvance(PlayState* play);
u8 Message_ShouldAdvanceSilent(PlayState* play);
Expand Down
9 changes: 9 additions & 0 deletions soh/include/gfx.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#ifndef GFX_H
#define GFX_H

// Texture memory size, 4 KiB
#define TMEM_SIZE 0x1000

// Upstream TODO: Rest of this file

#endif
4 changes: 4 additions & 0 deletions soh/include/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,10 @@ extern GraphicsContext* __gfxCtx;
#define BGCHECK_POS_ERROR_CHECK(vec3f) BgCheck_PosErrorCheck(vec3f, __FILE__, __LINE__)

#define SEG_ADDR(seg, addr) (addr | (seg << 24) | 1)

// Upstream TODO: Bring back decomp file/line macro use in src (but ignore the args for our needs)
#define SYSTEM_ARENA_MALLOC(size, file, line) SystemArena_MallocDebug(size, __FILE__, __LINE__)
#define SYSTEM_ARENA_FREE(ptr, file, line) SystemArena_FreeDebug(ptr, __FILE__, __LINE__)
// #endregion

#define DPAD_ITEM(button) ((gSaveContext.buttonStatus[(button) + 5] != BTN_DISABLED) \
Expand Down
10 changes: 5 additions & 5 deletions soh/include/variables.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ extern "C"
extern KaleidoMgrOverlay gKaleidoMgrOverlayTable[KALEIDO_OVL_MAX];
extern KaleidoMgrOverlay* gKaleidoMgrCurOvl;
extern u8 gBossMarkState;
extern void* D_8012D1F0;
extern void* gDebugCutsceneScript;
extern s32 gScreenWidth;
extern s32 gScreenHeight;
extern Mtx gMtxClear;
Expand Down Expand Up @@ -158,9 +158,9 @@ extern "C"
extern char D_80133398[];
extern SoundBankEntry* gSoundBanks[7];
extern u8 gSfxChannelLayout;
extern Vec3f D_801333D4;
extern f32 D_801333E0;
extern s8 D_801333E8;
extern Vec3f gSfxDefaultPos;
extern f32 gSfxDefaultFreqAndVolScale;
extern s8 gSfxDefaultReverb;
extern u8 D_801333F0;
extern u8 gAudioSfxSwapOff;
extern u8 D_80133408;
Expand Down Expand Up @@ -203,7 +203,7 @@ extern "C"
extern f32 gBossMarkScale;
extern PauseMapMarksData* gLoadedPauseMarkDataTable;
extern s32 gTrnsnUnkState;
extern Color_RGBA8_u32 D_801614B0;
extern Color_RGBA8_u32 gVisMonoColor;
extern PreNmiBuff* gAppNmiBufferPtr;
extern SchedContext gSchedContext;
extern PadMgr gPadMgr;
Expand Down
42 changes: 10 additions & 32 deletions soh/include/z64.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <libultraship/libultra.h>
#include "unk.h" // this used to get pulled in via ultra64.h
#include "attributes.h"
#include "z64save.h"
#include "z64light.h"
#include "z64bgcheck.h"
Expand All @@ -24,12 +25,14 @@
#include "z64skin.h"
#include "z64transition.h"
#include "z64interface.h"
#include "z64vis.h"
#include "alignment.h"
#include "sequence.h"
#include "sfx.h"
#include <libultraship/color.h>
#include "ichain.h"
#include "regs.h"
#include "gfx.h"

#if defined(__LP64__)
#define _SOH64
Expand Down Expand Up @@ -2035,13 +2038,13 @@ typedef struct ArenaNode {
/* 0x04 */ size_t size;
/* 0x08 */ struct ArenaNode* next;
/* 0x0C */ struct ArenaNode* prev;
///* 0x10 */ const char* filename;
///* 0x14 */ s32 line;
///* 0x18 */ OSId threadId;
///* 0x1C */ Arena* arena;
///* 0x20 */ OSTime time;
///* 0x28 */ u8 unk_28[0x30-0x28]; // probably padding
} ArenaNode; // size = 0x10
// /* 0x10 */ const char* filename;
// /* 0x14 */ s32 line;
// /* 0x18 */ OSId threadId;
// /* 0x1C */ Arena* arena;
// /* 0x20 */ OSTime time;
// /* 0x28 */ u8 unk_28[0x30-0x28]; // probably padding
} ArenaNode; // size = 0x30

typedef struct OverlayRelocationSection {
/* 0x00 */ u32 textSize;
Expand Down Expand Up @@ -2224,31 +2227,6 @@ typedef struct {
/* 0x0084 */ u32 unk_84;
} ViMode;

// Vis...
typedef struct {
/* 0x00 */ u32 type;
/* 0x04 */ u32 setScissor;
/* 0x08 */ Color_RGBA8_u32 color;
/* 0x0C */ Color_RGBA8_u32 envColor;
} struct_801664F0; // size = 0x10

typedef struct {
/* 0x00 */ u32 unk_00;
/* 0x04 */ u32 setScissor;
/* 0x08 */ Color_RGBA8_u32 primColor;
/* 0x0C */ Color_RGBA8_u32 envColor;
/* 0x10 */ u16* tlut;
/* 0x14 */ Gfx* monoDl;
} VisMono; // size = 0x18

// Vis...
typedef struct {
/* 0x00 */ u32 useRgba;
/* 0x04 */ u32 setScissor;
/* 0x08 */ Color_RGBA8_u32 primColor;
/* 0x08 */ Color_RGBA8_u32 envColor;
} struct_80166500; // size = 0x10

typedef struct {
/* 0x000 */ u8 rumbleEnable[4];
/* 0x004 */ u8 unk_04[0x40];
Expand Down
2 changes: 1 addition & 1 deletion soh/include/z64save.h
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ typedef enum {
/* 4 */ SCENE_LAYER_CUTSCENE_FIRST
} SceneLayer;

#define IS_CUTSCENE_LAYER (gSaveContext.sceneLayer >= SCENE_LAYER_CUTSCENE_FIRST)
#define IS_CUTSCENE_LAYER (gSaveContext.sceneSetupIndex >= SCENE_LAYER_CUTSCENE_FIRST)

typedef enum {
/* 0 */ LINK_AGE_ADULT,
Expand Down
101 changes: 101 additions & 0 deletions soh/include/z64vis.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
#ifndef Z64_VIS_H
#define Z64_VIS_H

// #include "ultra64.h"
// #include "color.h"
#include <libultraship/libultra.h>


#ifdef __cplusplus
#define this thisx
extern "C"
{
#endif

typedef enum FramebufferFilterType {
/* 0 */ FB_FILTER_NONE,
/* 1 */ FB_FILTER_CVG_RGB,
/* 2 */ FB_FILTER_CVG_RGB_UNIFORM,
/* 3 */ FB_FILTER_CVG_ONLY,
/* 4 */ FB_FILTER_CVG_RGB_FOG, // Not recommended, easily overflows blender
/* 5 */ FB_FILTER_ZBUF_IA,
/* 6 */ FB_FILTER_ZBUF_RGBA,
/* 7 */ FB_FILTER_MONO
} FramebufferFilterType;

typedef enum VisScissorType {
/* 0 */ VIS_NO_SETSCISSOR,
/* 1 */ VIS_SETSCISSOR
} VisScissorType;

typedef struct Vis {
/* 0x00 */ u32 type;
/* 0x04 */ u32 scissorType;
/* 0x08 */ Color_RGBA8_u32 primColor;
/* 0x0C */ Color_RGBA8_u32 envColor;
} Vis; // size = 0x10



/* Cvg: Coverage */

#define FB_FILTER_TO_CVG_TYPE(filter) (filter)

typedef enum VisCvgType {
/* 0 */ VIS_CVG_TYPE_NONE = FB_FILTER_TO_CVG_TYPE(FB_FILTER_NONE),
/* 1 */ VIS_CVG_TYPE_CVG_RGB = FB_FILTER_TO_CVG_TYPE(FB_FILTER_CVG_RGB),
/* 2 */ VIS_CVG_TYPE_CVG_RGB_UNIFORM = FB_FILTER_TO_CVG_TYPE(FB_FILTER_CVG_RGB_UNIFORM),
/* 3 */ VIS_CVG_TYPE_CVG_ONLY = FB_FILTER_TO_CVG_TYPE(FB_FILTER_CVG_ONLY),
/* 4 */ VIS_CVG_TYPE_CVG_RGB_FOG = FB_FILTER_TO_CVG_TYPE(FB_FILTER_CVG_RGB_FOG)
} VisCvgType;

typedef struct VisCvg {
/* 0x00 */ Vis vis;
} VisCvg; // size = 0x10

void VisCvg_Init(VisCvg* this);
void VisCvg_Destroy(VisCvg* this);
void VisCvg_Draw(VisCvg* this, Gfx** gfxP);



/* Mono: Desaturation */

// Only one type

typedef struct VisMono {
/* 0x00 */ Vis vis;
/* 0x10 */ u16* tlut;
/* 0x14 */ Gfx* dList;
} VisMono; // size = 0x18

void VisMono_Init(VisMono* this);
void VisMono_Destroy(VisMono* this);
void VisMono_Draw(VisMono* this, Gfx** gfxP);



/* ZBuf: Z-Buffer */

#define FB_FILTER_TO_ZBUF_TYPE(filter) ((filter) - FB_FILTER_ZBUF_IA)

typedef enum VisZBufType {
/* 0 */ VIS_ZBUF_TYPE_IA = FB_FILTER_TO_ZBUF_TYPE(FB_FILTER_ZBUF_IA),
/* 1 */ VIS_ZBUF_TYPE_RGBA = FB_FILTER_TO_ZBUF_TYPE(FB_FILTER_ZBUF_RGBA)
} VisZBufType;

typedef struct VisZBuf {
/* 0x00 */ Vis vis;
} VisZBuf; // size = 0x10

void VisZBuf_Init(VisZBuf* this);
void VisZBuf_Destroy(VisZBuf* this);
void VisZBuf_Draw(VisZBuf* this, Gfx** gfxP);


#ifdef __cplusplus
#undef this
}
#endif

#endif
Loading

0 comments on commit ed9692c

Please sign in to comment.