1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-12-27 07:07:09 +00:00

[headers] Create one_point_cutscene.h, z64olib.h and move stuff to z64{object,player,scene}.h (#2250)

* [headers] Create `one_point_cutscene.h`, `z64olib.h` and move stuff to `z64{object,player,scene}.h`

* bss

* sSceneCmdHandlers

* bss

* bss
This commit is contained in:
Dragorn421 2024-10-01 19:14:54 +02:00 committed by GitHub
parent 47c6c36dc3
commit ed77e143b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 104 additions and 75 deletions

View file

@ -98,24 +98,6 @@ void PreNmiBuff_Init(PreNmiBuff* this);
void PreNmiBuff_SetReset(PreNmiBuff* this);
u32 PreNmiBuff_IsResetting(PreNmiBuff* this);
void Sched_FlushTaskQueue(void);
f32 OLib_Vec3fDist(Vec3f* a, Vec3f* b);
f32 OLib_Vec3fDistXZ(Vec3f* a, Vec3f* b);
f32 OLib_ClampMinDist(f32 val, f32 min);
f32 OLib_ClampMaxDist(f32 val, f32 max);
Vec3f OLib_Vec3fDistNormalize(Vec3f* a, Vec3f* b);
Vec3f OLib_VecGeoToVec3f(VecGeo* geo);
VecSph OLib_Vec3fToVecSph(Vec3f* vec);
VecGeo OLib_Vec3fToVecGeo(Vec3f* vec);
VecGeo OLib_Vec3fDiffToVecGeo(Vec3f* a, Vec3f* b);
Vec3f OLib_Vec3fDiffRad(Vec3f* a, Vec3f* b);
s16 OnePointCutscene_Init(PlayState* play, s16 csId, s16 timer, Actor* actor, s16 parentCamId);
s16 OnePointCutscene_EndCutscene(PlayState* play, s16 subCamId);
s32 OnePointCutscene_Attention(PlayState* play, Actor* actor);
s32 OnePointCutscene_AttentionSetSfx(PlayState* play, Actor* actor, s32 sfxId);
void OnePointCutscene_EnableAttention(void);
void OnePointCutscene_DisableAttention(void);
s32 OnePointCutscene_CheckForCategory(PlayState* play, s32 actorCategory);
void OnePointCutscene_Noop(PlayState* play, s32 arg1);
Path* Path_GetByIndex(PlayState* play, s16 index, s16 max);
f32 Path_OrientAndGetDistSq(Actor* actor, Path* path, s16 waypoint, s16* yaw);
@ -135,16 +117,6 @@ void Room_FinishRoomChange(PlayState* play, RoomContext* roomCtx);
void Sample_Destroy(GameState* thisx);
void Sample_Init(GameState* thisx);
void Object_InitContext(PlayState* play, ObjectContext* objectCtx);
void Object_UpdateEntries(ObjectContext* objectCtx);
s32 Object_GetSlot(ObjectContext* objectCtx, s16 objectId);
s32 Object_IsLoaded(ObjectContext* objectCtx, s32 slot);
void func_800981B8(ObjectContext* objectCtx);
s32 Scene_ExecuteCommands(PlayState* play, SceneCmd* sceneCmd);
void Scene_ResetTransitionActorList(GameState* state, TransitionActorList* transitionActors);
void Scene_SetTransitionForNextEntrance(PlayState* play);
void Scene_Draw(PlayState* play);
void Skin_UpdateVertices(MtxF* mtx, SkinVertex* skinVertices, SkinLimbModif* modifEntry, Vtx* vtxBuf, Vec3f* pos);
void Skin_DrawAnimatedLimb(GraphicsContext* gfxCtx, Skin* skin, s32 limbIndex, s32 arg3, s32 drawFlags);
void Skin_DrawLimb(GraphicsContext* gfxCtx, Skin* skin, s32 limbIndex, Gfx* dlistOverride, s32 drawFlags);

View file

@ -0,0 +1,18 @@
#ifndef ONE_POINT_CUTSCENE_H
#define ONE_POINT_CUTSCENE_H
#include "ultra64.h"
struct Actor;
struct PlayState;
s16 OnePointCutscene_Init(struct PlayState* play, s16 csId, s16 timer, struct Actor* actor, s16 parentCamId);
s16 OnePointCutscene_EndCutscene(struct PlayState* play, s16 subCamId);
s32 OnePointCutscene_Attention(struct PlayState* play, struct Actor* actor);
s32 OnePointCutscene_AttentionSetSfx(struct PlayState* play, struct Actor* actor, s32 sfxId);
void OnePointCutscene_EnableAttention(void);
void OnePointCutscene_DisableAttention(void);
s32 OnePointCutscene_CheckForCategory(struct PlayState* play, s32 actorCategory);
void OnePointCutscene_Noop(struct PlayState* play, s32 arg1);
#endif

View file

@ -64,22 +64,9 @@ extern s32 gZeldaArenaLogSeverity;
extern MapData gMapDataTable;
extern s16 gSpoilingItems[3];
extern s16 gSpoilingItemReverts[3];
extern FlexSkeletonHeader* gPlayerSkelHeaders[2];
extern u8 gPlayerModelTypes[PLAYER_MODELGROUP_MAX][PLAYER_MODELGROUPENTRY_MAX];
extern Gfx* gPlayerLeftHandBgsDLs[];
extern Gfx* gPlayerLeftHandOpenDLs[];
extern Gfx* gPlayerLeftHandClosedDLs[];
extern Gfx* gPlayerLeftHandBoomerangDLs[];
extern Gfx gCullBackDList[];
extern Gfx gCullFrontDList[];
extern Gfx gEmptyDL[];
extern SceneCmdHandlerFunc gSceneCmdHandlers[SCENE_CMD_ID_MAX];
extern s16 gLinkObjectIds[2];
extern u32 gObjectTableSize;
extern RomFile gObjectTable[OBJECT_ID_MAX];
extern EntranceInfo gEntranceTable[ENTR_MAX];
extern SceneTableEntry gSceneTable[SCENE_ID_MAX];
extern u16 gSramSlotOffsets[];
// 4 16-colors palettes
extern u64 gMojiFontTLUTs[4][4]; // original name: "moji_tlut"

View file

@ -32,6 +32,8 @@
#include "z64math.h"
#include "z64map_mark.h"
#include "z64message.h"
#include "z64olib.h"
#include "one_point_cutscene.h"
#include "z64pause.h"
#include "z64play.h"
#include "z64skin.h"
@ -286,26 +288,6 @@ typedef struct FileSelectState {
/* 0x1CAD6 */ s16 unk_1CAD6[5];
} FileSelectState; // size = 0x1CAE0
// Macros for `EntranceInfo.field`
#define ENTRANCE_INFO_CONTINUE_BGM_FLAG (1 << 15)
#define ENTRANCE_INFO_DISPLAY_TITLE_CARD_FLAG (1 << 14)
#define ENTRANCE_INFO_END_TRANS_TYPE_MASK 0x3F80
#define ENTRANCE_INFO_END_TRANS_TYPE_SHIFT 7
#define ENTRANCE_INFO_END_TRANS_TYPE(field) \
(((field) >> ENTRANCE_INFO_END_TRANS_TYPE_SHIFT) \
& (ENTRANCE_INFO_END_TRANS_TYPE_MASK >> ENTRANCE_INFO_END_TRANS_TYPE_SHIFT))
#define ENTRANCE_INFO_START_TRANS_TYPE_MASK 0x7F
#define ENTRANCE_INFO_START_TRANS_TYPE_SHIFT 0
#define ENTRANCE_INFO_START_TRANS_TYPE(field) \
(((field) >> ENTRANCE_INFO_START_TRANS_TYPE_SHIFT) \
& (ENTRANCE_INFO_START_TRANS_TYPE_MASK >> ENTRANCE_INFO_START_TRANS_TYPE_SHIFT))
typedef struct EntranceInfo {
/* 0x00 */ s8 sceneId;
/* 0x01 */ s8 spawn;
/* 0x02 */ u16 field;
} EntranceInfo; // size = 0x4
typedef struct GameStateOverlay {
/* 0x00 */ void* loadedRamAddr;
/* 0x04 */ RomFile file; // if applicable

View file

@ -4,6 +4,8 @@
#include "ultra64.h"
#include "z64dma.h"
struct PlayState;
typedef struct ObjectEntry {
/* 0x00 */ s16 id;
/* 0x04 */ void* segment;
@ -35,4 +37,13 @@ typedef enum ObjectId {
#undef DEFINE_OBJECT_EMPTY
#undef DEFINE_OBJECT_UNSET
void Object_InitContext(struct PlayState* play, ObjectContext* objectCtx);
void Object_UpdateEntries(ObjectContext* objectCtx);
s32 Object_GetSlot(ObjectContext* objectCtx, s16 objectId);
s32 Object_IsLoaded(ObjectContext* objectCtx, s32 slot);
void func_800981B8(ObjectContext* objectCtx);
extern u32 gObjectTableSize;
extern RomFile gObjectTable[OBJECT_ID_MAX];
#endif

17
include/z64olib.h Normal file
View file

@ -0,0 +1,17 @@
#ifndef Z64OLIB_H
#define Z64OLIB_H
#include "z64math.h"
f32 OLib_Vec3fDist(Vec3f* a, Vec3f* b);
f32 OLib_Vec3fDistXZ(Vec3f* a, Vec3f* b);
f32 OLib_ClampMinDist(f32 val, f32 min);
f32 OLib_ClampMaxDist(f32 val, f32 max);
Vec3f OLib_Vec3fDistNormalize(Vec3f* a, Vec3f* b);
Vec3f OLib_VecGeoToVec3f(VecGeo* geo);
VecSph OLib_Vec3fToVecSph(Vec3f* vec);
VecGeo OLib_Vec3fToVecGeo(Vec3f* vec);
VecGeo OLib_Vec3fDiffToVecGeo(Vec3f* a, Vec3f* b);
Vec3f OLib_Vec3fDiffRad(Vec3f* a, Vec3f* b);
#endif

View file

@ -930,7 +930,7 @@ typedef struct Player {
/* 0x0A88 */ Vec3f unk_A88; // previous body part 0 position
} Player; // size = 0xA94
// z_player_lib public functions
// z_player_lib.c
void Player_SetBootData(struct PlayState* play, Player* this);
int Player_InBlockingCsMode(struct PlayState* play, Player* this);
int Player_InCsMode(struct PlayState* play);
@ -984,4 +984,17 @@ u32 Player_InitPauseDrawData(struct PlayState* play, u8* segment, SkelAnime* ske
void Player_DrawPause(struct PlayState* play, u8* segment, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot, f32 scale,
s32 sword, s32 tunic, s32 shield, s32 boots);
// z_player_lib.c
extern FlexSkeletonHeader* gPlayerSkelHeaders[2];
extern u8 gPlayerModelTypes[PLAYER_MODELGROUP_MAX][PLAYER_MODELGROUPENTRY_MAX];
extern Gfx* gPlayerLeftHandBgsDLs[];
extern Gfx* gPlayerLeftHandOpenDLs[];
extern Gfx* gPlayerLeftHandClosedDLs[];
extern Gfx* gPlayerLeftHandBoomerangDLs[];
extern Gfx gCullBackDList[];
extern Gfx gCullFrontDList[];
// object_table.c
extern s16 gLinkObjectIds[2];
#endif

View file

@ -11,6 +11,7 @@
#include "command_macros_base.h"
struct GameState;
struct PlayState;
typedef struct SceneTableEntry {
@ -432,6 +433,26 @@ typedef enum SceneID {
// Deleted scene
#define SCENE_UNUSED_6E 0x6E
// Macros for `EntranceInfo.field`
#define ENTRANCE_INFO_CONTINUE_BGM_FLAG (1 << 15)
#define ENTRANCE_INFO_DISPLAY_TITLE_CARD_FLAG (1 << 14)
#define ENTRANCE_INFO_END_TRANS_TYPE_MASK 0x3F80
#define ENTRANCE_INFO_END_TRANS_TYPE_SHIFT 7
#define ENTRANCE_INFO_END_TRANS_TYPE(field) \
(((field) >> ENTRANCE_INFO_END_TRANS_TYPE_SHIFT) \
& (ENTRANCE_INFO_END_TRANS_TYPE_MASK >> ENTRANCE_INFO_END_TRANS_TYPE_SHIFT))
#define ENTRANCE_INFO_START_TRANS_TYPE_MASK 0x7F
#define ENTRANCE_INFO_START_TRANS_TYPE_SHIFT 0
#define ENTRANCE_INFO_START_TRANS_TYPE(field) \
(((field) >> ENTRANCE_INFO_START_TRANS_TYPE_SHIFT) \
& (ENTRANCE_INFO_START_TRANS_TYPE_MASK >> ENTRANCE_INFO_START_TRANS_TYPE_SHIFT))
typedef struct EntranceInfo {
/* 0x00 */ s8 sceneId;
/* 0x01 */ s8 spawn;
/* 0x02 */ u16 field;
} EntranceInfo; // size = 0x4
// Entrance Index Enum
#define DEFINE_ENTRANCE(enum, _1, _2, _3, _4, _5, _6) enum,
@ -639,5 +660,12 @@ typedef enum SceneCommandTypeID {
#define SCENE_CMD_MISC_SETTINGS(sceneCamType, worldMapLocation) \
{ SCENE_CMD_ID_MISC_SETTINGS, sceneCamType, CMD_W(worldMapLocation) }
s32 Scene_ExecuteCommands(struct PlayState* play, SceneCmd* sceneCmd);
void Scene_ResetTransitionActorList(struct GameState* state, TransitionActorList* transitionActors);
void Scene_SetTransitionForNextEntrance(struct PlayState* play);
void Scene_Draw(struct PlayState* play);
extern EntranceInfo gEntranceTable[ENTR_MAX];
extern SceneTableEntry gSceneTable[SCENE_ID_MAX];
#endif

View file

@ -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:96 pal-1.0:94 pal-1.1:94"
"ntsc-1.2:94 pal-1.0:92 pal-1.1:92"
StackEntry sDmaMgrStackInfo;
OSMesgQueue sDmaMgrMsgQueue;

View file

@ -42,7 +42,7 @@
*/
#if PLATFORM_GC
#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-eu-mq-dbg:192 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192" \
#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-eu-mq-dbg:176 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192" \
"gc-us-mq:192"
#include "global.h"

View file

@ -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:155 pal-1.0:153 pal-1.1:153"
"ntsc-1.2:154 pal-1.0:152 pal-1.1:152"
extern u8 _buffersSegmentEnd[];

View file

@ -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:97 pal-1.0:95 pal-1.1:95"
"ntsc-1.2:96 pal-1.0:94 pal-1.1:94"
s32 Camera_KeepOn4(Camera* camera) {
static Vec3f D_8015BD50;

View file

@ -12,8 +12,8 @@ typedef struct InputCombo {
/* 0x2 */ u16 press;
} InputCombo; // size = 0x4
#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:128 pal-1.0:128 pal-1.1:128"
#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:192 pal-1.0:192 pal-1.1:192"
RegEditor* gRegEditor;

View file

@ -1,5 +1,5 @@
#pragma increment_block_number "gc-eu:248 gc-eu-mq:248 gc-jp:240 gc-jp-ce:240 gc-jp-mq:240 gc-us:240 gc-us-mq:240" \
"ntsc-1.2:0 pal-1.0:0 pal-1.1:0"
"ntsc-1.2:0 pal-1.0:252 pal-1.1:252"
#include "global.h"
#include "ultra64.h"

View file

@ -10,7 +10,7 @@
#include "z64frame_advance.h"
#pragma increment_block_number "gc-eu:8 gc-eu-mq:8 gc-jp:8 gc-jp-ce:8 gc-jp-mq:8 gc-us:8 gc-us-mq:8"
#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"
TransitionTile gTransitionTile;
s32 gTransitionTileState;

View file

@ -2,6 +2,7 @@
#include "terminal.h"
#include "versions.h"
SceneCmdHandlerFunc sSceneCmdHandlers[SCENE_CMD_ID_MAX];
RomFile sNaviQuestHintFiles[];
/**
@ -191,8 +192,8 @@ s32 Scene_ExecuteCommands(PlayState* play, SceneCmd* sceneCmd) {
break;
}
if (cmdCode < ARRAY_COUNT(gSceneCmdHandlers)) {
gSceneCmdHandlers[cmdCode](play, sceneCmd);
if (cmdCode < ARRAY_COUNT(sSceneCmdHandlers)) {
sSceneCmdHandlers[cmdCode](play, sceneCmd);
} else {
PRINTF(VT_FGCOL(RED));
PRINTF(T("code の値が異常です\n", "code variable is abnormal\n"));
@ -515,7 +516,7 @@ void Scene_SetTransitionForNextEntrance(PlayState* play) {
play->transitionType = ENTRANCE_INFO_START_TRANS_TYPE(gEntranceTable[entranceIndex].field);
}
SceneCmdHandlerFunc gSceneCmdHandlers[SCENE_CMD_ID_MAX] = {
SceneCmdHandlerFunc sSceneCmdHandlers[SCENE_CMD_ID_MAX] = {
Scene_CommandPlayerEntryList, // SCENE_CMD_ID_SPAWN_LIST
Scene_CommandActorEntryList, // SCENE_CMD_ID_ACTOR_LIST
Scene_CommandUnused2, // SCENE_CMD_ID_UNUSED_2

View file

@ -35,7 +35,7 @@
#include "cic6105.h"
#endif
#pragma increment_block_number "gc-eu:199 gc-eu-mq:199 gc-jp:199 gc-jp-ce:199 gc-jp-mq:199 gc-us:199 gc-us-mq:199" \
#pragma increment_block_number "gc-eu:183 gc-eu-mq:183 gc-jp:183 gc-jp-ce:183 gc-jp-mq:183 gc-us:183 gc-us-mq:183" \
"ntsc-1.2:128 pal-1.0:128 pal-1.1:128"
#define FLAGS ACTOR_FLAG_4