From fbf797f1e26a163c75ff0785b5cf74598b43d516 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Fri, 27 Sep 2024 20:51:00 +0200 Subject: [PATCH] [headers] Create `gfxalloc.h`, `map.h`, move protos to `gfx.h`, `z64{player,view}.h` (#2233) * [headers] Create gfxalloc.h, map.h, move protos to z64{actor,player,view}.h * oops * bss * comment on player_lib protos & format * format map.h * Move SCREEN_{WIDTH,HEIGHT} and SET_FULLSCREEN_VIEWPORT to z64view.h * bss * revert move screen_width/height * bss --- include/functions.h | 105 +------------------- include/gfx.h | 15 +++ include/gfxalloc.h | 10 ++ include/macros.h | 11 -- include/map.h | 79 +++++++++++++++ include/z64.h | 64 +----------- include/z64actor.h | 2 + include/z64player.h | 54 ++++++++++ include/z64view.h | 40 ++++++++ src/boot/z_std_dma.c | 2 +- src/code/main.c | 2 +- src/code/z_camera.c | 2 +- src/code/z_collision_check.c | 2 +- src/code/z_en_item00.c | 4 +- src/code/z_kaleido_scope_call.c | 3 +- src/overlays/actors/ovl_Fishing/z_fishing.c | 2 +- 16 files changed, 212 insertions(+), 185 deletions(-) create mode 100644 include/gfxalloc.h create mode 100644 include/map.h diff --git a/include/functions.h b/include/functions.h index 7b437bfdb7..d50f966a2d 100644 --- a/include/functions.h +++ b/include/functions.h @@ -307,86 +307,13 @@ void OnePointCutscene_EnableAttention(void); void OnePointCutscene_DisableAttention(void); s32 OnePointCutscene_CheckForCategory(PlayState* play, s32 actorCategory); void OnePointCutscene_Noop(PlayState* play, s32 arg1); -void Map_SavePlayerInitialInfo(PlayState* play); -void Map_SetFloorPalettesData(PlayState* play, s16 floor); -void Map_InitData(PlayState* play, s16 room); -void Map_InitRoomData(PlayState* play, s16 room); -void Map_Destroy(PlayState* play); -void Map_Init(PlayState* play); -void Minimap_Draw(PlayState* play); -void Map_Update(PlayState* play); Path* Path_GetByIndex(PlayState* play, s16 index, s16 max); f32 Path_OrientAndGetDistSq(Actor* actor, Path* path, s16 waypoint, s16* yaw); void Path_CopyLastPoint(Path* path, Vec3f* dest); -void Player_SetBootData(PlayState* play, Player* this); -int Player_InBlockingCsMode(PlayState* play, Player* this); -int Player_InCsMode(PlayState* play); -s32 Player_CheckHostileLockOn(Player* this); -int Player_IsChildWithHylianShield(Player* this); -s32 Player_ActionToModelGroup(Player* this, s32 itemAction); -void Player_SetModelsForHoldingShield(Player* this); -void Player_SetModels(Player* this, s32 modelGroup); -void Player_SetModelGroup(Player* this, s32 modelGroup); -void func_8008EC70(Player* this); -void Player_SetEquipmentData(PlayState* play, Player* this); -void Player_UpdateBottleHeld(PlayState* play, Player* this, s32 item, s32 itemAction); -void Player_ReleaseLockOn(Player* this); -void Player_ClearZTargeting(Player* this); -void Player_SetAutoLockOnActor(PlayState* play, Actor* actor); -s32 func_8008EF44(PlayState* play, s32 ammo); -int Player_IsBurningStickInRange(PlayState* play, Vec3f* pos, f32 xzRange, f32 yRange); -s32 Player_GetStrength(void); -u8 Player_GetMask(PlayState* play); -Player* Player_UnsetMask(PlayState* play); -s32 Player_HasMirrorShieldEquipped(PlayState* play); -int Player_HasMirrorShieldSetToDraw(PlayState* play); -s32 Player_ActionToMagicSpell(Player* this, s32 itemAction); -int Player_HoldsHookshot(Player* this); -int func_8008F128(Player* this); -s32 Player_ActionToMeleeWeapon(s32 itemAction); -s32 Player_GetMeleeWeaponHeld(Player* this); -s32 Player_HoldsTwoHandedWeapon(Player* this); -int Player_HoldsBrokenKnife(Player* this); -s32 Player_ActionToBottle(Player* this, s32 itemAction); -s32 Player_GetBottleHeld(Player* this); -s32 Player_ActionToExplosive(Player* this, s32 itemAction); -s32 Player_GetExplosiveHeld(Player* this); -s32 func_8008F2BC(Player* this, s32 itemAction); -s32 Player_GetEnvironmentalHazard(PlayState* play); -void Player_DrawImpl(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, s32 lod, s32 tunic, - s32 boots, s32 face, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, - void* data); -s32 Player_OverrideLimbDrawGameplayCommon(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx); -s32 Player_OverrideLimbDrawGameplayDefault(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx); -s32 Player_OverrideLimbDrawGameplayFirstPerson(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx); -s32 Player_OverrideLimbDrawGameplayCrawling(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, - void* thisx); -u8 func_80090480(PlayState* play, ColliderQuad* collider, WeaponInfo* weaponInfo, Vec3f* newTip, Vec3f* newBase); -void Player_DrawGetItem(PlayState* play, Player* this); -void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx); -u32 Player_InitPauseDrawData(PlayState* play, u8* segment, SkelAnime* skelAnime); -void Player_DrawPause(PlayState* play, u8* segment, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot, f32 scale, - s32 sword, s32 tunic, s32 shield, s32 boots); 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_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); -Gfx* Gfx_TwoTexScroll(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y1, s32 width1, s32 height1, s32 tile2, u32 x2, - u32 y2, s32 width2, s32 height2); -Gfx* Gfx_TwoTexScrollEnvColor(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y1, s32 width1, s32 height1, s32 tile2, - u32 x2, u32 y2, s32 width2, s32 height2, s32 r, s32 g, s32 b, s32 a); -Gfx* Gfx_EnvColor(GraphicsContext* gfxCtx, s32 r, s32 g, s32 b, s32 a); -void Gfx_SetupFrame(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b); -void func_80095974(GraphicsContext* gfxCtx); void func_80095AA0(PlayState* play, Room* room, Input* input, s32 arg3); void Room_DrawBackground2D(Gfx** gfxP, void* tex, void* tlut, u16 width, u16 height, u8 fmt, u8 siz, u16 tlutMode, u16 tlutCount, f32 offsetX, f32 offsetY); @@ -440,34 +367,7 @@ void SsSram_Init(s32 addr, u8 handleType, u8 handleDomain, u8 handleLatency, u8 u8 handlePulse, u32 handleSpeed); void SsSram_Dma(void* dramAddr, size_t size, s32 direction); void SsSram_ReadWrite(s32 addr, void* dramAddr, size_t size, s32 direction); -View* View_New(GraphicsContext* gfxCtx); -void View_Free(View* view); -void View_Init(View*, GraphicsContext*); -void View_LookAt(View* view, Vec3f* eye, Vec3f* at, Vec3f* up); -void View_LookAtUnsafe(View* view, Vec3f* eye, Vec3f* at, Vec3f* up); -void View_SetScale(View* view, f32 scale); -void View_GetScale(View* view, f32* scale); -void View_SetPerspective(View* view, f32 fovy, f32 zNear, f32 zFar); -void View_GetPerspective(View* view, f32* fovy, f32* zNear, f32* zFar); -void View_SetOrtho(View* view, f32 fovy, f32 zNear, f32 zFar); -void View_GetOrtho(View* view, f32* fovy, f32* zNear, f32* zFar); -void View_SetViewport(View* view, Viewport* viewport); -void View_GetViewport(View* view, Viewport* viewport); -void View_SetDistortionOrientation(View* view, f32 rotX, f32 rotY, f32 rotZ); -void View_SetDistortionScale(View* view, f32 scaleX, f32 scaleY, f32 scaleZ); -s32 View_SetDistortionSpeed(View* view, f32 speed); -void View_InitDistortion(View* view); -void View_ClearDistortion(View* view); -void View_SetDistortion(View* view, Vec3f orientation, Vec3f scale, f32 speed); -s32 View_StepDistortion(View* view, Mtx* projectionMtx); -s32 View_Apply(View* view, s32 mask); -s32 View_ApplyOrthoToOverlay(View* view); -s32 View_ApplyPerspectiveToOverlay(View* view); -s32 View_UpdateViewingMatrix(View* view); -s32 View_ApplyTo(View* view, s32 mask, Gfx** gfxP); -#if OOT_DEBUG -s32 View_ErrorCheckEyePosition(f32 eyeX, f32 eyeY, f32 eyeZ); -#endif + void ViMode_LogPrint(OSViMode* osViMode); void ViMode_Configure(ViMode* viMode, s32 type, s32 tvType, s32 loRes, s32 antialiasOff, s32 modeN, s32 fb16Bit, s32 width, s32 height, s32 leftAdjust, s32 rightAdjust, s32 upperAdjust, s32 lowerAdjust); @@ -566,9 +466,6 @@ void Graph_TaskSet00(GraphicsContext* gfxCtx); void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState); void Graph_ThreadEntry(void*); -Gfx* Gfx_Open(Gfx* gfx); -Gfx* Gfx_Close(Gfx* gfx, Gfx* dst); -void* Gfx_Alloc(Gfx** gfxP, u32 size); ListAlloc* ListAlloc_Init(ListAlloc* this); void* ListAlloc_Alloc(ListAlloc* this, u32 size); void ListAlloc_Free(ListAlloc* this, void* data); diff --git a/include/gfx.h b/include/gfx.h index c50f6c1337..edc6217a3d 100644 --- a/include/gfx.h +++ b/include/gfx.h @@ -51,6 +51,21 @@ typedef struct GraphicsContext { /* 0x02FC */ char unk_2FC[0x04]; } GraphicsContext; // size = 0x300 +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_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); +Gfx* Gfx_TwoTexScroll(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y1, s32 width1, s32 height1, s32 tile2, u32 x2, + u32 y2, s32 width2, s32 height2); +Gfx* Gfx_TwoTexScrollEnvColor(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y1, s32 width1, s32 height1, s32 tile2, + u32 x2, u32 y2, s32 width2, s32 height2, s32 r, s32 g, s32 b, s32 a); +Gfx* Gfx_EnvColor(GraphicsContext* gfxCtx, s32 r, s32 g, s32 b, s32 a); +void Gfx_SetupFrame(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b); +void func_80095974(GraphicsContext* gfxCtx); + void* Graph_Alloc(GraphicsContext* gfxCtx, size_t size); void* Graph_Alloc2(GraphicsContext* gfxCtx, size_t size); diff --git a/include/gfxalloc.h b/include/gfxalloc.h new file mode 100644 index 0000000000..158a2a9f58 --- /dev/null +++ b/include/gfxalloc.h @@ -0,0 +1,10 @@ +#ifndef GFXALLOC_H +#define GFXALLOC_H + +#include "ultra64.h" + +Gfx* Gfx_Open(Gfx* gfx); +Gfx* Gfx_Close(Gfx* gfx, Gfx* dst); +void* Gfx_Alloc(Gfx** gfxP, u32 size); + +#endif diff --git a/include/macros.h b/include/macros.h index 609a902b10..c2df878459 100644 --- a/include/macros.h +++ b/include/macros.h @@ -82,17 +82,6 @@ (state)->size = sizeof(newStruct); \ } while (0) -#define SET_FULLSCREEN_VIEWPORT(view) \ - { \ - Viewport viewport; \ - viewport.bottomY = SCREEN_HEIGHT; \ - viewport.rightX = SCREEN_WIDTH; \ - viewport.topY = 0; \ - viewport.leftX = 0; \ - View_SetViewport(view, &viewport); \ - } \ - (void)0 - #if OOT_DEBUG #define DMA_REQUEST_SYNC(ram, vrom, size, file, line) DmaMgr_RequestSyncDebug(ram, vrom, size, file, line) diff --git a/include/map.h b/include/map.h new file mode 100644 index 0000000000..23d3eb3c88 --- /dev/null +++ b/include/map.h @@ -0,0 +1,79 @@ +#ifndef MAP_H +#define MAP_H + +#include "ultra64.h" + +struct PlayState; + +typedef enum FloorID { + /* 1 */ F_8F = 1, + /* 2 */ F_7F, + /* 3 */ F_6F, + /* 4 */ F_5F, + /* 5 */ F_4F, + /* 6 */ F_3F, + /* 7 */ F_2F, + /* 8 */ F_1F, + /* 9 */ F_B1, + /* 10 */ F_B2, + /* 11 */ F_B3, + /* 12 */ F_B4, + /* 13 */ F_B5, + /* 14 */ F_B6, + /* 15 */ F_B7, + /* 16 */ F_B8 +} FloorID; + +// All arrays pointed in this struct are indexed by "map indices" +// In dungeons, the map index corresponds to the dungeon index (which also indexes keys, items, etc) +// In overworld areas, the map index corresponds to the overworld area index (spot 00, 01, etc) +typedef struct MapData { + /* 0x00 */ s16 (*floorTexIndexOffset)[8]; // dungeon texture index offset by floor + /* 0x04 */ s16* bossFloor; // floor the boss is on + /* 0x08 */ s16 (*roomPalette)[32]; // map palette by room + /* 0x0C */ s16* maxPaletteCount; // max number of palettes in a same floor + /* 0x10 */ s16 (*paletteRoom)[8][14]; // room by palette by floor + /* 0x14 */ s16 (*roomCompassOffsetX)[44]; // dungeon compass icon X offset by room + /* 0x18 */ s16 (*roomCompassOffsetY)[44]; // dungeon compass icon Y offset by room + /* 0x1C */ u8* dgnMinimapCount; // number of room minimaps + /* 0x20 */ u16* dgnMinimapTexIndexOffset; // dungeon minimap texture index offset + /* 0x24 */ u16* owMinimapTexSize; + /* 0x28 */ u16* owMinimapTexOffset; + /* 0x2C */ s16* owMinimapPosX; + /* 0x30 */ s16* owMinimapPosY; + /* 0x34 */ s16 (*owCompassInfo)[4]; // [X scale, Y scale, X offset, Y offset] + /* 0x38 */ s16* dgnTexIndexBase; // dungeon texture index base + /* 0x3C */ s16 (*dgnCompassInfo)[4]; // [X scale, Y scale, X offset, Y offset] + /* 0x40 */ s16* owMinimapWidth; + /* 0x44 */ s16* owMinimapHeight; + /* 0x48 */ s16* owEntranceIconPosX; // "dungeon entrance" icon X pos + /* 0x4C */ s16* owEntranceIconPosY; // "dungeon entrance" icon Y pos + /* 0x50 */ u16* owEntranceFlag; // flag in inf_table[26] based on which entrance icons are shown (0xFFFF = always shown) + /* 0x54 */ f32 (*floorCoordY)[8]; // Y coordinate of each floor + /* 0x58 */ u16* switchEntryCount; // number of "room switch" entries, which correspond to the next 3 arrays + /* 0x5C */ u8 (*switchFromRoom)[51]; // room to come from + /* 0x60 */ u8 (*switchFromFloor)[51]; // floor to come from + /* 0x64 */ u8 (*switchToRoom)[51]; // room to go to + /* 0x68 */ u8 (*floorID)[8]; + /* 0x6C */ s16* skullFloorIconY; // dungeon big skull icon Y pos +} MapData; // size = 0x70 + +// TODO get these properties from the textures themselves +#define MAP_I_TEX_WIDTH 96 +#define MAP_I_TEX_HEIGHT 85 +#define MAP_I_TEX_SIZE ((MAP_I_TEX_WIDTH * MAP_I_TEX_HEIGHT) / 2) // 96x85 I4 texture + +#define MAP_48x85_TEX_WIDTH 48 +#define MAP_48x85_TEX_HEIGHT 85 +#define MAP_48x85_TEX_SIZE ((MAP_48x85_TEX_WIDTH * MAP_48x85_TEX_HEIGHT) / 2) // 48x85 CI4 texture + +void Map_SavePlayerInitialInfo(struct PlayState* play); +void Map_SetFloorPalettesData(struct PlayState* play, s16 floor); +void Map_InitData(struct PlayState* play, s16 room); +void Map_InitRoomData(struct PlayState* play, s16 room); +void Map_Destroy(struct PlayState* play); +void Map_Init(struct PlayState* play); +void Minimap_Draw(struct PlayState* play); +void Map_Update(struct PlayState* play); + +#endif diff --git a/include/z64.h b/include/z64.h index 0271864e90..27efb344c6 100644 --- a/include/z64.h +++ b/include/z64.h @@ -59,12 +59,14 @@ #include "padmgr.h" #include "sched.h" #include "rumble.h" +#include "map.h" #include "mempak.h" #include "tha.h" #include "thga.h" #include "speedmeter.h" #include "gfx.h" #include "gfx_setupdl.h" +#include "gfxalloc.h" #include "jpeg.h" #include "prerender.h" #include "rand.h" @@ -323,68 +325,6 @@ typedef struct PreNMIState { /* 0xA8 */ UNK_TYPE4 unk_A8; } PreNMIState; // size = 0xAC -typedef enum FloorID { - /* 1 */ F_8F = 1, - /* 2 */ F_7F, - /* 3 */ F_6F, - /* 4 */ F_5F, - /* 5 */ F_4F, - /* 6 */ F_3F, - /* 7 */ F_2F, - /* 8 */ F_1F, - /* 9 */ F_B1, - /* 10 */ F_B2, - /* 11 */ F_B3, - /* 12 */ F_B4, - /* 13 */ F_B5, - /* 14 */ F_B6, - /* 15 */ F_B7, - /* 16 */ F_B8 -} FloorID; - -// All arrays pointed in this struct are indexed by "map indices" -// In dungeons, the map index corresponds to the dungeon index (which also indexes keys, items, etc) -// In overworld areas, the map index corresponds to the overworld area index (spot 00, 01, etc) -typedef struct MapData { - /* 0x00 */ s16 (*floorTexIndexOffset)[8]; // dungeon texture index offset by floor - /* 0x04 */ s16* bossFloor; // floor the boss is on - /* 0x08 */ s16 (*roomPalette)[32]; // map palette by room - /* 0x0C */ s16* maxPaletteCount; // max number of palettes in a same floor - /* 0x10 */ s16 (*paletteRoom)[8][14]; // room by palette by floor - /* 0x14 */ s16 (*roomCompassOffsetX)[44]; // dungeon compass icon X offset by room - /* 0x18 */ s16 (*roomCompassOffsetY)[44]; // dungeon compass icon Y offset by room - /* 0x1C */ u8* dgnMinimapCount; // number of room minimaps - /* 0x20 */ u16* dgnMinimapTexIndexOffset; // dungeon minimap texture index offset - /* 0x24 */ u16* owMinimapTexSize; - /* 0x28 */ u16* owMinimapTexOffset; - /* 0x2C */ s16* owMinimapPosX; - /* 0x30 */ s16* owMinimapPosY; - /* 0x34 */ s16 (*owCompassInfo)[4]; // [X scale, Y scale, X offset, Y offset] - /* 0x38 */ s16* dgnTexIndexBase; // dungeon texture index base - /* 0x3C */ s16 (*dgnCompassInfo)[4]; // [X scale, Y scale, X offset, Y offset] - /* 0x40 */ s16* owMinimapWidth; - /* 0x44 */ s16* owMinimapHeight; - /* 0x48 */ s16* owEntranceIconPosX; // "dungeon entrance" icon X pos - /* 0x4C */ s16* owEntranceIconPosY; // "dungeon entrance" icon Y pos - /* 0x50 */ u16* owEntranceFlag; // flag in inf_table[26] based on which entrance icons are shown (0xFFFF = always shown) - /* 0x54 */ f32 (*floorCoordY)[8]; // Y coordinate of each floor - /* 0x58 */ u16* switchEntryCount; // number of "room switch" entries, which correspond to the next 3 arrays - /* 0x5C */ u8 (*switchFromRoom)[51]; // room to come from - /* 0x60 */ u8 (*switchFromFloor)[51]; // floor to come from - /* 0x64 */ u8 (*switchToRoom)[51]; // room to go to - /* 0x68 */ u8 (*floorID)[8]; - /* 0x6C */ s16* skullFloorIconY; // dungeon big skull icon Y pos -} MapData; // size = 0x70 - -// TODO get these properties from the textures themselves -#define MAP_I_TEX_WIDTH 96 -#define MAP_I_TEX_HEIGHT 85 -#define MAP_I_TEX_SIZE ((MAP_I_TEX_WIDTH * MAP_I_TEX_HEIGHT) / 2) // 96x85 I4 texture - -#define MAP_48x85_TEX_WIDTH 48 -#define MAP_48x85_TEX_HEIGHT 85 -#define MAP_48x85_TEX_SIZE ((MAP_48x85_TEX_WIDTH * MAP_48x85_TEX_HEIGHT) / 2) // 48x85 CI4 texture - typedef struct DebugDispObject { /* 0x00 */ Vec3f pos; /* 0x0C */ Vec3s rot; diff --git a/include/z64actor.h b/include/z64actor.h index c83316af7c..e05a9d6188 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -908,8 +908,10 @@ void func_80034CC4(struct PlayState* play, SkelAnime* skelAnime, OverrideLimbDra s16 func_80034DD4(Actor* actor, struct PlayState* play, s16 arg2, f32 arg3); void func_80034F54(struct PlayState* play, s16* arg1, s16* arg2, s32 arg3); void Actor_Noop(Actor* actor, struct PlayState* play); + void Gfx_DrawDListOpa(struct PlayState* play, Gfx* dlist); void Gfx_DrawDListXlu(struct PlayState* play, Gfx* dlist); + Actor* Actor_FindNearby(struct PlayState* play, Actor* refActor, s16 actorId, u8 actorCategory, f32 range); s32 func_800354B4(struct PlayState* play, Actor* actor, f32 range, s16 arg3, s16 arg4, s16 arg5); void func_8003555C(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel); diff --git a/include/z64player.h b/include/z64player.h index 79c38271c0..2441941d29 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -930,4 +930,58 @@ typedef struct Player { /* 0x0A88 */ Vec3f unk_A88; // previous body part 0 position } Player; // size = 0xA94 +// z_player_lib public functions +void Player_SetBootData(struct PlayState* play, Player* this); +int Player_InBlockingCsMode(struct PlayState* play, Player* this); +int Player_InCsMode(struct PlayState* play); +s32 Player_CheckHostileLockOn(Player* this); +int Player_IsChildWithHylianShield(Player* this); +s32 Player_ActionToModelGroup(Player* this, s32 itemAction); +void Player_SetModelsForHoldingShield(Player* this); +void Player_SetModels(Player* this, s32 modelGroup); +void Player_SetModelGroup(Player* this, s32 modelGroup); +void func_8008EC70(Player* this); +void Player_SetEquipmentData(struct PlayState* play, Player* this); +void Player_UpdateBottleHeld(struct PlayState* play, Player* this, s32 item, s32 itemAction); +void Player_ReleaseLockOn(Player* this); +void Player_ClearZTargeting(Player* this); +void Player_SetAutoLockOnActor(struct PlayState* play, Actor* actor); +s32 func_8008EF44(struct PlayState* play, s32 ammo); +int Player_IsBurningStickInRange(struct PlayState* play, Vec3f* pos, f32 xzRange, f32 yRange); +s32 Player_GetStrength(void); +u8 Player_GetMask(struct PlayState* play); +Player* Player_UnsetMask(struct PlayState* play); +s32 Player_HasMirrorShieldEquipped(struct PlayState* play); +int Player_HasMirrorShieldSetToDraw(struct PlayState* play); +s32 Player_ActionToMagicSpell(Player* this, s32 itemAction); +int Player_HoldsHookshot(Player* this); +int func_8008F128(Player* this); +s32 Player_ActionToMeleeWeapon(s32 itemAction); +s32 Player_GetMeleeWeaponHeld(Player* this); +s32 Player_HoldsTwoHandedWeapon(Player* this); +int Player_HoldsBrokenKnife(Player* this); +s32 Player_ActionToBottle(Player* this, s32 itemAction); +s32 Player_GetBottleHeld(Player* this); +s32 Player_ActionToExplosive(Player* this, s32 itemAction); +s32 Player_GetExplosiveHeld(Player* this); +s32 func_8008F2BC(Player* this, s32 itemAction); +s32 Player_GetEnvironmentalHazard(struct PlayState* play); +void Player_DrawImpl(struct PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, s32 lod, s32 tunic, + s32 boots, s32 face, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, + void* data); +s32 Player_OverrideLimbDrawGameplayCommon(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, + void* thisx); +s32 Player_OverrideLimbDrawGameplayDefault(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, + void* thisx); +s32 Player_OverrideLimbDrawGameplayFirstPerson(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, + Vec3s* rot, void* thisx); +s32 Player_OverrideLimbDrawGameplayCrawling(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, + void* thisx); +u8 func_80090480(struct PlayState* play, ColliderQuad* collider, WeaponInfo* weaponInfo, Vec3f* newTip, Vec3f* newBase); +void Player_DrawGetItem(struct PlayState* play, Player* this); +void Player_PostLimbDrawGameplay(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx); +u32 Player_InitPauseDrawData(struct PlayState* play, u8* segment, SkelAnime* skelAnime); +void Player_DrawPause(struct PlayState* play, u8* segment, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot, f32 scale, + s32 sword, s32 tunic, s32 shield, s32 boots); + #endif diff --git a/include/z64view.h b/include/z64view.h index 935b6f79a0..d8de114224 100644 --- a/include/z64view.h +++ b/include/z64view.h @@ -12,6 +12,17 @@ typedef struct Viewport { /* 0xC */ s32 rightX; // lrx (lower right x) } Viewport; // size = 0x10 +#define SET_FULLSCREEN_VIEWPORT(view) \ + { \ + Viewport viewport; \ + viewport.bottomY = SCREEN_HEIGHT; \ + viewport.rightX = SCREEN_WIDTH; \ + viewport.topY = 0; \ + viewport.leftX = 0; \ + View_SetViewport(view, &viewport); \ + } \ + (void)0 + typedef struct View { /* 0x000 */ s32 magic; // string literal "VIEW" / 0x56494557 /* 0x004 */ struct GraphicsContext* gfxCtx; @@ -55,4 +66,33 @@ typedef struct View { #define VIEW_ERROR_CHECK_EYE_POS(x, y, z) (void)0 #endif +View* View_New(struct GraphicsContext* gfxCtx); +void View_Free(View* view); +void View_Init(View*, struct GraphicsContext*); +void View_LookAt(View* view, Vec3f* eye, Vec3f* at, Vec3f* up); +void View_LookAtUnsafe(View* view, Vec3f* eye, Vec3f* at, Vec3f* up); +void View_SetScale(View* view, f32 scale); +void View_GetScale(View* view, f32* scale); +void View_SetPerspective(View* view, f32 fovy, f32 zNear, f32 zFar); +void View_GetPerspective(View* view, f32* fovy, f32* zNear, f32* zFar); +void View_SetOrtho(View* view, f32 fovy, f32 zNear, f32 zFar); +void View_GetOrtho(View* view, f32* fovy, f32* zNear, f32* zFar); +void View_SetViewport(View* view, Viewport* viewport); +void View_GetViewport(View* view, Viewport* viewport); +void View_SetDistortionOrientation(View* view, f32 rotX, f32 rotY, f32 rotZ); +void View_SetDistortionScale(View* view, f32 scaleX, f32 scaleY, f32 scaleZ); +s32 View_SetDistortionSpeed(View* view, f32 speed); +void View_InitDistortion(View* view); +void View_ClearDistortion(View* view); +void View_SetDistortion(View* view, Vec3f orientation, Vec3f scale, f32 speed); +s32 View_StepDistortion(View* view, Mtx* projectionMtx); +s32 View_Apply(View* view, s32 mask); +s32 View_ApplyOrthoToOverlay(View* view); +s32 View_ApplyPerspectiveToOverlay(View* view); +s32 View_UpdateViewingMatrix(View* view); +s32 View_ApplyTo(View* view, s32 mask, Gfx** gfxP); +#if OOT_DEBUG +s32 View_ErrorCheckEyePosition(f32 eyeX, f32 eyeY, f32 eyeZ); +#endif + #endif diff --git a/src/boot/z_std_dma.c b/src/boot/z_std_dma.c index 9e533b4262..30d1c7da1b 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:98" + "ntsc-1.2:96" StackEntry sDmaMgrStackInfo; OSMesgQueue sDmaMgrMsgQueue; diff --git a/src/code/main.c b/src/code/main.c index 85c629a898..aed8a5ceab 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:160 gc-eu-mq:160 gc-jp:160 gc-jp-ce:160 gc-jp-mq:160 gc-us:160 gc-us-mq:160" \ - "ntsc-1.2:158" + "ntsc-1.2:156" extern u8 _buffersSegmentEnd[]; diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 3309732164..39b121db23 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:100" + "ntsc-1.2:98" s32 Camera_KeepOn4(Camera* camera) { static Vec3f D_8015BD50; diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c index 9e93ce2cd1..61079c879f 100644 --- a/src/code/z_collision_check.c +++ b/src/code/z_collision_check.c @@ -5,7 +5,7 @@ #include "overlays/effects/ovl_Effect_Ss_HitMark/z_eff_ss_hitmark.h" -#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.2:216" +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.2:208" typedef s32 (*ColChkResetFunc)(PlayState*, Collider*); typedef void (*ColChkApplyFunc)(PlayState*, CollisionCheckContext*, Collider*); diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c index 7321759254..5bafa3b987 100644 --- a/src/code/z_en_item00.c +++ b/src/code/z_en_item00.c @@ -3,8 +3,8 @@ #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "overlays/effects/ovl_Effect_Ss_Dead_Sound/z_eff_ss_dead_sound.h" -#pragma increment_block_number \ - "gc-eu:0 gc-eu-mq:0 gc-eu-mq-dbg:0 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-eu-mq-dbg:0 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128" \ + "gc-us-mq:128 ntsc-1.2:128" #define FLAGS 0 diff --git a/src/code/z_kaleido_scope_call.c b/src/code/z_kaleido_scope_call.c index 6be6d15f58..985b6c3b70 100644 --- a/src/code/z_kaleido_scope_call.c +++ b/src/code/z_kaleido_scope_call.c @@ -1,4 +1,5 @@ -#pragma increment_block_number "gc-eu:224 gc-eu-mq:224 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.2:0" +#pragma increment_block_number "gc-eu:224 gc-eu-mq:224 gc-jp:224 gc-jp-ce:224 gc-jp-mq:224 gc-us:224 gc-us-mq:224" \ + "ntsc-1.2:0" #include "global.h" #include "terminal.h" diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c index 8f4b37817d..5fbb2779cd 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:121 gc-eu-mq:121 gc-jp:123 gc-jp-ce:123 gc-jp-mq:123 gc-us:123 gc-us-mq:123" +#pragma increment_block_number "gc-eu:119 gc-eu-mq:119 gc-jp:121 gc-jp-ce:121 gc-jp-mq:121 gc-us:121 gc-us-mq:121" #define FLAGS ACTOR_FLAG_4