2021-09-15 23:24:19 +00:00
# ifndef Z64SCENE_H
# define Z64SCENE_H
2020-03-17 04:31:30 +00:00
2024-08-19 08:24:02 +00:00
# include "macros.h"
# include "ultra64.h"
# include "z64bgcheck.h"
# include "z64dma.h"
# include "z64environment.h"
# include "z64light.h"
# include "z64math.h"
2022-06-09 19:02:18 +00:00
2021-05-08 21:16:21 +00:00
# include "command_macros_base.h"
2024-10-01 17:14:54 +00:00
struct GameState ;
2024-08-19 08:24:02 +00:00
struct PlayState ;
2024-08-12 07:07:48 +00:00
typedef struct SceneTableEntry {
2020-04-16 21:36:12 +00:00
/* 0x00 */ RomFile sceneFile ;
/* 0x08 */ RomFile titleFile ;
2020-03-17 04:31:30 +00:00
/* 0x10 */ u8 unk_10 ;
2022-05-31 18:19:46 +00:00
/* 0x11 */ u8 drawConfig ;
2020-03-17 04:31:30 +00:00
/* 0x12 */ u8 unk_12 ;
/* 0x13 */ u8 unk_13 ;
2021-08-15 23:15:58 +00:00
} SceneTableEntry ; // size = 0x14
2020-03-17 04:31:30 +00:00
2024-08-12 07:07:48 +00:00
typedef struct ActorEntry {
2022-06-09 19:02:18 +00:00
/* 0x00 */ s16 id ;
/* 0x02 */ Vec3s pos ;
/* 0x08 */ Vec3s rot ;
/* 0x0E */ s16 params ;
} ActorEntry ; // size = 0x10
2024-08-12 07:07:48 +00:00
typedef struct TransitionActorEntry {
2022-06-09 19:02:18 +00:00
struct {
s8 room ; // Room to switch to
2022-06-17 18:25:42 +00:00
s8 bgCamIndex ; // How the camera reacts during the transition. See `Camera_ChangeDoorCam`
2022-06-09 19:02:18 +00:00
} /* 0x00 */ sides [ 2 ] ; // 0 = front, 1 = back
/* 0x04 */ s16 id ;
/* 0x06 */ Vec3s pos ;
/* 0x0C */ s16 rotY ;
/* 0x0E */ s16 params ;
} TransitionActorEntry ; // size = 0x10
2024-09-05 12:08:21 +00:00
typedef struct TransitionActorList {
/* 0x00 */ u8 count ;
2024-06-25 19:13:31 +00:00
/* 0x04 */ TransitionActorEntry * list ;
2024-09-05 12:08:21 +00:00
} TransitionActorList ; // size = 0x8
2024-06-25 19:13:31 +00:00
2024-08-12 07:07:48 +00:00
typedef struct Spawn {
2022-10-16 22:00:18 +00:00
/* 0x00 */ u8 playerEntryIndex ;
2022-06-09 19:02:18 +00:00
/* 0x01 */ u8 room ;
2022-10-16 22:00:18 +00:00
} Spawn ;
2024-08-12 07:07:48 +00:00
typedef struct Path {
2022-06-09 19:02:18 +00:00
/* 0x00 */ u8 count ; // number of points in the path
/* 0x04 */ Vec3s * points ; // Segment Address to the array of points
} Path ; // size = 0x8
2022-08-31 23:28:51 +00:00
// Room shapes
2022-06-09 19:02:18 +00:00
2024-08-12 07:07:48 +00:00
typedef enum RoomShapeType {
2022-08-31 23:28:51 +00:00
/* 0 */ ROOM_SHAPE_TYPE_NORMAL ,
/* 1 */ ROOM_SHAPE_TYPE_IMAGE ,
/* 2 */ ROOM_SHAPE_TYPE_CULLABLE ,
/* 3 */ ROOM_SHAPE_TYPE_MAX
} RoomShapeType ;
2022-06-09 19:02:18 +00:00
2024-08-12 07:07:48 +00:00
typedef struct RoomShapeBase {
2022-06-09 19:02:18 +00:00
/* 0x00 */ u8 type ;
2022-08-31 23:28:51 +00:00
} RoomShapeBase ; // size = 0x01
2022-06-09 19:02:18 +00:00
2024-08-12 07:07:48 +00:00
typedef struct RoomShapeDListsEntry {
2022-06-09 19:02:18 +00:00
/* 0x00 */ Gfx * opa ;
/* 0x04 */ Gfx * xlu ;
2022-08-31 23:28:51 +00:00
} RoomShapeDListsEntry ; // size = 0x08
2022-06-09 19:02:18 +00:00
2024-08-12 07:07:48 +00:00
typedef struct RoomShapeNormal {
2022-08-31 23:28:51 +00:00
/* 0x00 */ RoomShapeBase base ;
2022-06-09 19:02:18 +00:00
/* 0x01 */ u8 numEntries ;
2022-08-31 23:28:51 +00:00
/* 0x04 */ RoomShapeDListsEntry * entries ;
/* 0x08 */ RoomShapeDListsEntry * entriesEnd ;
} RoomShapeNormal ; // size = 0x0C
2022-06-09 19:02:18 +00:00
2024-08-12 07:07:48 +00:00
typedef enum RoomShapeImageAmountType {
2022-08-31 23:28:51 +00:00
/* 1 */ ROOM_SHAPE_IMAGE_AMOUNT_SINGLE = 1 ,
/* 2 */ ROOM_SHAPE_IMAGE_AMOUNT_MULTI
} RoomShapeImageAmountType ;
2022-06-09 19:02:18 +00:00
2024-08-12 07:07:48 +00:00
typedef struct RoomShapeImageBase {
2022-08-31 23:28:51 +00:00
/* 0x00 */ RoomShapeBase base ;
/* 0x01 */ u8 amountType ; // RoomShapeImageAmountType
/* 0x04 */ RoomShapeDListsEntry * entry ;
} RoomShapeImageBase ; // size = 0x08
2022-06-09 19:02:18 +00:00
2024-08-12 07:07:48 +00:00
typedef struct RoomShapeImageSingle {
2022-08-31 23:28:51 +00:00
/* 0x00 */ RoomShapeImageBase base ;
2022-06-09 19:02:18 +00:00
/* 0x08 */ void * source ;
/* 0x0C */ u32 unk_0C ;
/* 0x10 */ void * tlut ;
/* 0x14 */ u16 width ;
/* 0x16 */ u16 height ;
/* 0x18 */ u8 fmt ;
/* 0x19 */ u8 siz ;
2022-08-31 23:28:51 +00:00
/* 0x1A */ u16 tlutMode ;
2022-06-09 19:02:18 +00:00
/* 0x1C */ u16 tlutCount ;
2022-08-31 23:28:51 +00:00
} RoomShapeImageSingle ; // size = 0x20
2022-06-09 19:02:18 +00:00
2024-08-12 07:07:48 +00:00
typedef struct RoomShapeImageMultiBgEntry {
2022-06-09 19:02:18 +00:00
/* 0x00 */ u16 unk_00 ;
2022-08-31 23:28:51 +00:00
/* 0x02 */ u8 bgCamIndex ; // for which bg cam index is this entry for
2022-06-16 00:15:44 +00:00
/* 0x04 */ void * source ;
2022-06-09 19:02:18 +00:00
/* 0x08 */ u32 unk_0C ;
2022-06-16 00:15:44 +00:00
/* 0x0C */ void * tlut ;
2022-06-09 19:02:18 +00:00
/* 0x10 */ u16 width ;
/* 0x12 */ u16 height ;
/* 0x14 */ u8 fmt ;
/* 0x15 */ u8 siz ;
2022-08-31 23:28:51 +00:00
/* 0x16 */ u16 tlutMode ;
2022-06-09 19:02:18 +00:00
/* 0x18 */ u16 tlutCount ;
2022-08-31 23:28:51 +00:00
} RoomShapeImageMultiBgEntry ; // size = 0x1C
2022-06-09 19:02:18 +00:00
2024-08-12 07:07:48 +00:00
typedef struct RoomShapeImageMulti {
2022-08-31 23:28:51 +00:00
/* 0x00 */ RoomShapeImageBase base ;
/* 0x08 */ u8 numBackgrounds ;
/* 0x0C */ RoomShapeImageMultiBgEntry * backgrounds ;
} RoomShapeImageMulti ; // size = 0x10
2022-06-09 19:02:18 +00:00
2024-08-12 07:07:48 +00:00
typedef struct RoomShapeCullableEntry {
2022-08-31 23:28:51 +00:00
/* 0x00 */ Vec3s boundsSphereCenter ;
/* 0x06 */ s16 boundsSphereRadius ;
2022-06-09 19:02:18 +00:00
/* 0x08 */ Gfx * opa ;
/* 0x0C */ Gfx * xlu ;
2022-08-31 23:28:51 +00:00
} RoomShapeCullableEntry ; // size = 0x10
# define ROOM_SHAPE_CULLABLE_MAX_ENTRIES 64
2022-06-09 19:02:18 +00:00
2024-08-12 07:07:48 +00:00
typedef struct RoomShapeCullable {
2022-08-31 23:28:51 +00:00
/* 0x00 */ RoomShapeBase base ;
2022-06-09 19:02:18 +00:00
/* 0x01 */ u8 numEntries ;
2022-08-31 23:28:51 +00:00
/* 0x04 */ RoomShapeCullableEntry * entries ;
/* 0x08 */ RoomShapeCullableEntry * entriesEnd ;
} RoomShapeCullable ; // size = 0x0C
2022-06-09 19:02:18 +00:00
2024-08-12 07:07:48 +00:00
typedef union RoomShape {
2022-08-31 23:28:51 +00:00
RoomShapeBase base ;
RoomShapeNormal normal ;
union {
RoomShapeImageBase base ;
RoomShapeImageSingle single ;
RoomShapeImageMulti multi ;
} image ;
RoomShapeCullable cullable ;
} RoomShape ; // "Ground Shape"
2022-06-09 19:02:18 +00:00
2024-10-14 19:23:50 +00:00
typedef enum RoomType {
/* 0 */ ROOM_TYPE_NORMAL ,
/* 1 */ ROOM_TYPE_DUNGEON , // Blocks Sun's Song's time advance effect. Not exclusively used by typical dungeon rooms.
/* 2 */ ROOM_TYPE_INDOORS , // Reduces player run speed and blocks player from attacking or jumping.
/* 3 */ ROOM_TYPE_3 , // Unused. Color dithering is turned off when drawing the room and other things.
/* 4 */ ROOM_TYPE_4 , // Unused. Prevents switching to CAM_SET_HORSE when mounting a horse.
/* 5 */ ROOM_TYPE_BOSS // Disables Environment_AdjustLights
} RoomType ;
2024-06-25 19:13:31 +00:00
2024-10-13 02:28:55 +00:00
typedef enum RoomEnvironmentType {
/* 0 */ ROOM_ENV_DEFAULT ,
/* 1 */ ROOM_ENV_COLD ,
/* 2 */ ROOM_ENV_WARM ,
/* 3 */ ROOM_ENV_HOT , // Enables hot room timer for the current room
/* 4 */ ROOM_ENV_UNK_STRETCH_1 ,
/* 5 */ ROOM_ENV_UNK_STRETCH_2 ,
/* 6 */ ROOM_ENV_UNK_STRETCH_3
} RoomEnvironmentType ;
2024-06-25 19:13:31 +00:00
typedef struct Room {
2024-09-05 12:08:21 +00:00
/* 0x00 */ s8 num ; // -1 is invalid room
2024-06-25 19:13:31 +00:00
/* 0x01 */ u8 unk_01 ;
2024-10-13 02:28:55 +00:00
/* 0x02 */ u8 environmentType ;
2024-10-14 19:23:50 +00:00
/* 0x03 */ u8 type ;
2024-06-25 19:13:31 +00:00
/* 0x04 */ s8 echo ;
/* 0x05 */ u8 lensMode ;
/* 0x08 */ RoomShape * roomShape ; // original name: "ground_shape"
/* 0x0C */ void * segment ;
/* 0x10 */ char unk_10 [ 0x4 ] ;
} Room ; // size = 0x14
typedef struct RoomContext {
/* 0x00 */ Room curRoom ;
/* 0x14 */ Room prevRoom ;
2024-09-05 12:08:21 +00:00
/* 0x28 */ void * bufPtrs [ 2 ] ; // Start and end pointers for the room buffer. Can be split into two pages, where page 0 is allocated from the start pointer and page 1 is allocated from the end pointer.
/* 0x30 */ u8 activeBufPage ; // 0 - First page in memory, 1 - Last page in memory
/* 0x31 */ s8 status ; // 0 - Free for new room request, 1 - DmaRequest for a new room is in progress
/* 0x34 */ void * roomRequestAddr ; // Pointer to where the requested room segment will be stored
2024-06-25 19:13:31 +00:00
/* 0x38 */ DmaRequest dmaRequest ;
/* 0x58 */ OSMesgQueue loadQueue ;
/* 0x70 */ OSMesg loadMsg ;
2024-09-05 12:08:21 +00:00
/* 0x74 */ s16 drawParams [ 2 ] ; // context-specific data used by the current scene draw config
2024-06-25 19:13:31 +00:00
} RoomContext ; // size = 0x78
2024-09-05 12:08:21 +00:00
typedef struct RoomList {
/* 0x00 */ u8 count ;
/* 0x04 */ RomFile * romFiles ; // Array of rom addresses for each room in a scene
} RoomList ;
2022-06-09 19:02:18 +00:00
# define ROOM_DRAW_OPA (1 << 0)
# define ROOM_DRAW_XLU (1 << 1)
// Scene commands
2024-08-12 07:07:48 +00:00
typedef struct SCmdBase {
2020-03-17 04:31:30 +00:00
/* 0x00 */ u8 code ;
/* 0x01 */ u8 data1 ;
/* 0x04 */ u32 data2 ;
} SCmdBase ;
2024-08-12 07:07:48 +00:00
typedef struct SCmdPlayerEntryList {
2020-03-17 04:31:30 +00:00
/* 0x00 */ u8 code ;
2022-06-09 19:02:18 +00:00
/* 0x01 */ u8 length ;
/* 0x04 */ ActorEntry * data ;
2022-10-16 22:00:18 +00:00
} SCmdPlayerEntryList ;
2020-03-17 04:31:30 +00:00
2024-08-12 07:07:48 +00:00
typedef struct SCmdActorEntryList {
2020-03-17 04:31:30 +00:00
/* 0x00 */ u8 code ;
2022-06-09 19:02:18 +00:00
/* 0x01 */ u8 length ;
/* 0x04 */ ActorEntry * data ;
2022-10-16 22:00:18 +00:00
} SCmdActorEntryList ;
2020-03-17 04:31:30 +00:00
2024-08-12 07:07:48 +00:00
typedef struct SCmdUnused02 {
2020-03-17 04:31:30 +00:00
/* 0x00 */ u8 code ;
/* 0x01 */ u8 data1 ;
2021-11-09 02:15:37 +00:00
/* 0x04 */ void * segment ;
2021-05-08 21:16:21 +00:00
} SCmdUnused02 ;
2020-03-17 04:31:30 +00:00
2024-08-12 07:07:48 +00:00
typedef struct SCmdColHeader {
2020-03-17 04:31:30 +00:00
/* 0x00 */ u8 code ;
/* 0x01 */ u8 data1 ;
2022-06-09 19:02:18 +00:00
/* 0x04 */ CollisionHeader * data ;
2020-03-17 04:31:30 +00:00
} SCmdColHeader ;
2024-08-12 07:07:48 +00:00
typedef struct SCmdRoomList {
2020-03-17 04:31:30 +00:00
/* 0x00 */ u8 code ;
2022-06-09 19:02:18 +00:00
/* 0x01 */ u8 length ;
/* 0x04 */ RomFile * data ;
2020-03-17 04:31:30 +00:00
} SCmdRoomList ;
2024-08-12 07:07:48 +00:00
typedef struct SCmdWindSettings {
2020-03-17 04:31:30 +00:00
/* 0x00 */ u8 code ;
/* 0x01 */ u8 data1 ;
/* 0x02 */ char pad [ 2 ] ;
2021-09-20 16:51:35 +00:00
/* 0x04 */ u8 x ;
/* 0x05 */ u8 y ;
/* 0x06 */ u8 z ;
2020-03-17 04:31:30 +00:00
/* 0x07 */ u8 unk_07 ;
} SCmdWindSettings ;
2024-08-12 07:07:48 +00:00
typedef struct SCmdSpawnList {
2020-03-17 04:31:30 +00:00
/* 0x00 */ u8 code ;
/* 0x01 */ u8 data1 ;
2022-10-16 22:00:18 +00:00
/* 0x04 */ Spawn * data ;
} SCmdSpawnList ;
2020-03-17 04:31:30 +00:00
2024-08-12 07:07:48 +00:00
typedef struct SCmdSpecialFiles {
2020-03-17 04:31:30 +00:00
/* 0x00 */ u8 code ;
2022-10-15 17:24:13 +00:00
/* 0x01 */ u8 naviQuestHintFileId ;
2020-03-17 04:31:30 +00:00
/* 0x04 */ u32 keepObjectId ;
} SCmdSpecialFiles ;
2024-08-12 07:07:48 +00:00
typedef struct SCmdRoomBehavior {
2020-03-17 04:31:30 +00:00
/* 0x00 */ u8 code ;
/* 0x01 */ u8 gpFlag1 ;
/* 0x04 */ u32 gpFlag2 ;
} SCmdRoomBehavior ;
2024-08-12 07:07:48 +00:00
typedef struct SCmdMesh {
2020-03-17 04:31:30 +00:00
/* 0x00 */ u8 code ;
/* 0x01 */ u8 data1 ;
2022-08-31 23:28:51 +00:00
/* 0x04 */ RoomShapeBase * data ;
2020-03-17 04:31:30 +00:00
} SCmdMesh ;
2024-08-12 07:07:48 +00:00
typedef struct SCmdObjectList {
2020-03-17 04:31:30 +00:00
/* 0x00 */ u8 code ;
2022-06-09 19:02:18 +00:00
/* 0x01 */ u8 length ;
/* 0x04 */ s16 * data ;
2020-03-17 04:31:30 +00:00
} SCmdObjectList ;
2024-08-12 07:07:48 +00:00
typedef struct SCmdLightList {
2020-03-17 04:31:30 +00:00
/* 0x00 */ u8 code ;
2022-06-09 19:02:18 +00:00
/* 0x01 */ u8 length ;
/* 0x04 */ LightInfo * data ;
2020-03-17 04:31:30 +00:00
} SCmdLightList ;
2024-08-12 07:07:48 +00:00
typedef struct SCmdPathList {
2020-03-17 04:31:30 +00:00
/* 0x00 */ u8 code ;
/* 0x01 */ u8 data1 ;
2022-06-09 19:02:18 +00:00
/* 0x04 */ Path * data ;
2020-03-17 04:31:30 +00:00
} SCmdPathList ;
2024-08-12 07:07:48 +00:00
typedef struct SCmdTransiActorList {
2020-03-17 04:31:30 +00:00
/* 0x00 */ u8 code ;
2022-06-09 19:02:18 +00:00
/* 0x01 */ u8 length ;
/* 0x04 */ TransitionActorEntry * data ;
2020-03-17 04:31:30 +00:00
} SCmdTransiActorList ;
2024-08-12 07:07:48 +00:00
typedef struct SCmdLightSettingList {
2020-03-17 04:31:30 +00:00
/* 0x00 */ u8 code ;
2022-06-09 19:02:18 +00:00
/* 0x01 */ u8 length ;
/* 0x04 */ EnvLightSettings * data ;
2020-03-17 04:31:30 +00:00
} SCmdLightSettingList ;
2024-08-12 07:07:48 +00:00
typedef struct SCmdTimeSettings {
2020-03-17 04:31:30 +00:00
/* 0x00 */ u8 code ;
/* 0x01 */ u8 data1 ;
/* 0x02 */ char pad [ 2 ] ;
/* 0x04 */ u8 hour ;
/* 0x05 */ u8 min ;
2022-06-09 19:02:18 +00:00
/* 0x06 */ u8 timeSpeed ;
2020-03-17 04:31:30 +00:00
} SCmdTimeSettings ;
2024-08-12 07:07:48 +00:00
typedef struct SCmdSkyboxSettings {
2020-03-17 04:31:30 +00:00
/* 0x00 */ u8 code ;
/* 0x01 */ u8 data1 ;
/* 0x02 */ char pad [ 2 ] ;
/* 0x04 */ u8 skyboxId ;
2022-06-09 19:02:18 +00:00
/* 0x05 */ u8 skyboxConfig ;
/* 0x06 */ u8 envLightMode ;
2020-03-17 04:31:30 +00:00
} SCmdSkyboxSettings ;
2024-08-12 07:07:48 +00:00
typedef struct SCmdSkyboxDisables {
2020-03-17 04:31:30 +00:00
/* 0x00 */ u8 code ;
/* 0x01 */ u8 data1 ;
/* 0x02 */ char pad [ 2 ] ;
2022-06-09 19:02:18 +00:00
/* 0x04 */ u8 skyboxDisabled ;
/* 0x05 */ u8 sunMoonDisabled ;
2020-03-17 04:31:30 +00:00
} SCmdSkyboxDisables ;
2024-08-12 07:07:48 +00:00
typedef struct SCmdEndMarker {
2020-03-17 04:31:30 +00:00
/* 0x00 */ u8 code ;
/* 0x01 */ u8 data1 ;
/* 0x04 */ u32 data2 ;
} SCmdEndMarker ;
2024-08-12 07:07:48 +00:00
typedef struct SCmdExitList {
2020-03-17 04:31:30 +00:00
/* 0x00 */ u8 code ;
/* 0x01 */ u8 data1 ;
2022-06-09 19:02:18 +00:00
/* 0x04 */ s16 * data ;
2020-03-17 04:31:30 +00:00
} SCmdExitList ;
2024-08-12 07:07:48 +00:00
typedef struct SCmdSoundSettings {
2020-03-17 04:31:30 +00:00
/* 0x00 */ u8 code ;
2021-12-03 14:49:32 +00:00
/* 0x01 */ u8 specId ;
2020-03-17 04:31:30 +00:00
/* 0x02 */ char pad [ 4 ] ;
2021-12-03 14:49:32 +00:00
/* 0x06 */ u8 natureAmbienceId ;
/* 0x07 */ u8 seqId ;
2020-03-17 04:31:30 +00:00
} SCmdSoundSettings ;
2024-08-12 07:07:48 +00:00
typedef struct SCmdEchoSettings {
2020-03-17 04:31:30 +00:00
/* 0x00 */ u8 code ;
/* 0x01 */ u8 data1 ;
/* 0x02 */ char pad [ 5 ] ;
/* 0x07 */ u8 echo ;
} SCmdEchoSettings ;
2024-08-12 07:07:48 +00:00
typedef struct SCmdCutsceneData {
2020-03-17 04:31:30 +00:00
/* 0x00 */ u8 code ;
/* 0x01 */ u8 data1 ;
2022-06-09 19:02:18 +00:00
/* 0x04 */ void * data ;
2020-03-17 04:31:30 +00:00
} SCmdCutsceneData ;
2024-08-12 07:07:48 +00:00
typedef struct SCmdAltHeaders {
2020-03-17 04:31:30 +00:00
/* 0x00 */ u8 code ;
/* 0x01 */ u8 data1 ;
2022-06-09 19:02:18 +00:00
/* 0x04 */ void * data ;
2020-03-17 04:31:30 +00:00
} SCmdAltHeaders ;
2024-08-12 07:07:48 +00:00
typedef struct SCmdMiscSettings {
2020-03-17 04:31:30 +00:00
/* 0x00 */ u8 code ;
2022-06-21 00:31:53 +00:00
/* 0x01 */ u8 sceneCamType ;
2020-03-17 04:31:30 +00:00
/* 0x04 */ u32 area ;
} SCmdMiscSettings ;
2024-08-12 07:07:48 +00:00
typedef union SceneCmd {
2020-03-17 04:31:30 +00:00
SCmdBase base ;
2022-10-16 22:00:18 +00:00
SCmdPlayerEntryList playerEntryList ;
SCmdActorEntryList actorEntryList ;
2021-05-08 21:16:21 +00:00
SCmdUnused02 unused02 ;
2020-03-17 04:31:30 +00:00
SCmdRoomList roomList ;
2022-10-16 22:00:18 +00:00
SCmdSpawnList spawnList ;
2020-03-17 04:31:30 +00:00
SCmdObjectList objectList ;
SCmdLightList lightList ;
SCmdPathList pathList ;
SCmdTransiActorList transiActorList ;
SCmdLightSettingList lightSettingList ;
SCmdExitList exitList ;
SCmdColHeader colHeader ;
SCmdMesh mesh ;
SCmdSpecialFiles specialFiles ;
SCmdCutsceneData cutsceneData ;
SCmdRoomBehavior roomBehavior ;
SCmdWindSettings windSettings ;
SCmdTimeSettings timeSettings ;
SCmdSkyboxSettings skyboxSettings ;
SCmdSkyboxDisables skyboxDisables ;
SCmdEndMarker endMarker ;
SCmdSoundSettings soundSettings ;
SCmdEchoSettings echoSettings ;
SCmdMiscSettings miscSettings ;
SCmdAltHeaders altHeaders ;
} SceneCmd ; // size = 0x8
2024-02-01 08:29:02 +00:00
typedef BAD_RETURN ( s32 ) ( * SceneCmdHandlerFunc ) ( struct PlayState * , SceneCmd * ) ;
2022-02-01 19:36:09 +00:00
# define DEFINE_SCENE(_0, _1, enum, _3, _4, _5) enum,
2024-08-12 07:07:48 +00:00
typedef enum SceneID {
2022-02-01 19:36:09 +00:00
# include "tables/scene_table.h"
2021-01-20 18:15:17 +00:00
/* 0x6E */ SCENE_ID_MAX
2020-03-17 04:31:30 +00:00
} SceneID ;
2022-06-05 16:48:44 +00:00
# undef DEFINE_SCENE
2024-02-03 22:59:19 +00:00
// Fake enum values for scenes that are still referenced in the entrance table
# if !OOT_DEBUG
// Debug-only scenes
# define SCENE_TEST01 0x65
# define SCENE_BESITU 0x66
# define SCENE_DEPTH_TEST 0x67
# define SCENE_SYOTES 0x68
# define SCENE_SYOTES2 0x69
# define SCENE_SUTARU 0x6A
# define SCENE_HAIRAL_NIWA2 0x6B
# define SCENE_SASATEST 0x6C
# define SCENE_TESTROOM 0x6D
# endif
// Deleted scene
# define SCENE_UNUSED_6E 0x6E
2022-04-27 20:00:25 +00:00
2024-10-01 17:14:54 +00:00
// 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
2022-05-09 17:45:53 +00:00
// Entrance Index Enum
# define DEFINE_ENTRANCE(enum, _1, _2, _3, _4, _5, _6) enum,
2024-08-12 07:07:48 +00:00
typedef enum EntranceIndex {
2022-05-09 17:45:53 +00:00
# include "tables/entrance_table.h"
2022-05-15 14:38:31 +00:00
/* 0x614 */ ENTR_MAX
2022-05-09 17:45:53 +00:00
} EntranceIndex ;
2022-06-05 16:48:44 +00:00
# undef DEFINE_ENTRANCE
2022-05-09 17:45:53 +00:00
# define ENTR_LOAD_OPENING -1
2024-08-12 07:07:48 +00:00
typedef enum ReturnEntranceIndex {
2022-12-05 18:37:40 +00:00
/* 0x7FF9 */ ENTR_RETURN_GREAT_FAIRYS_FOUNTAIN_SPELLS = 0x7FF9 ,
/* 0x7FFA */ ENTR_RETURN_SHOOTING_GALLERY ,
2022-05-15 15:26:59 +00:00
/* 0x7FFB */ ENTR_RETURN_2 , // unused
2022-12-05 18:37:40 +00:00
/* 0x7FFC */ ENTR_RETURN_BAZAAR ,
2022-05-15 15:26:59 +00:00
/* 0x7FFD */ ENTR_RETURN_4 , // unused
2022-12-05 18:37:40 +00:00
/* 0x7FFE */ ENTR_RETURN_GREAT_FAIRYS_FOUNTAIN_MAGIC ,
2022-05-15 15:26:59 +00:00
/* 0x7FFF */ ENTR_RETURN_GROTTO // Grottos and normal Fairy Fountain
} ReturnEntranceIndex ;
2024-08-12 07:07:48 +00:00
typedef enum SceneDrawConfig {
2022-05-31 18:19:46 +00:00
/* 0 */ SDC_DEFAULT ,
2022-11-26 21:15:41 +00:00
/* 1 */ SDC_HYRULE_FIELD ,
/* 2 */ SDC_KAKARIKO_VILLAGE ,
/* 3 */ SDC_ZORAS_RIVER ,
/* 4 */ SDC_KOKIRI_FOREST ,
/* 5 */ SDC_LAKE_HYLIA ,
/* 6 */ SDC_ZORAS_DOMAIN ,
/* 7 */ SDC_ZORAS_FOUNTAIN ,
/* 8 */ SDC_GERUDO_VALLEY ,
/* 9 */ SDC_LOST_WOODS ,
/* 10 */ SDC_DESERT_COLOSSUS ,
/* 11 */ SDC_GERUDOS_FORTRESS ,
/* 12 */ SDC_HAUNTED_WASTELAND ,
/* 13 */ SDC_HYRULE_CASTLE ,
/* 14 */ SDC_DEATH_MOUNTAIN_TRAIL ,
/* 15 */ SDC_DEATH_MOUNTAIN_CRATER ,
/* 16 */ SDC_GORON_CITY ,
/* 17 */ SDC_LON_LON_RANCH ,
2022-12-05 18:37:40 +00:00
/* 18 */ SDC_FIRE_TEMPLE ,
2022-11-26 21:15:41 +00:00
/* 19 */ SDC_DEKU_TREE ,
/* 20 */ SDC_DODONGOS_CAVERN ,
2022-12-05 18:37:40 +00:00
/* 21 */ SDC_JABU_JABU ,
2022-11-26 21:15:41 +00:00
/* 22 */ SDC_FOREST_TEMPLE ,
/* 23 */ SDC_WATER_TEMPLE ,
2022-12-05 18:37:40 +00:00
/* 24 */ SDC_SHADOW_TEMPLE_AND_WELL ,
2022-11-26 21:15:41 +00:00
/* 25 */ SDC_SPIRIT_TEMPLE ,
/* 26 */ SDC_INSIDE_GANONS_CASTLE ,
/* 27 */ SDC_GERUDO_TRAINING_GROUND ,
/* 28 */ SDC_DEKU_TREE_BOSS ,
/* 29 */ SDC_WATER_TEMPLE_BOSS ,
/* 30 */ SDC_TEMPLE_OF_TIME ,
/* 31 */ SDC_GROTTOS ,
/* 32 */ SDC_CHAMBER_OF_THE_SAGES ,
2022-12-05 18:37:40 +00:00
/* 33 */ SDC_GREAT_FAIRYS_FOUNTAIN ,
2022-11-26 21:15:41 +00:00
/* 34 */ SDC_SHOOTING_GALLERY ,
2022-12-05 18:37:40 +00:00
/* 35 */ SDC_CASTLE_COURTYARD_GUARDS ,
/* 36 */ SDC_OUTSIDE_GANONS_CASTLE ,
2022-11-26 21:15:41 +00:00
/* 37 */ SDC_ICE_CAVERN ,
/* 38 */ SDC_GANONS_TOWER_COLLAPSE_EXTERIOR ,
2022-12-05 18:37:40 +00:00
/* 39 */ SDC_FAIRYS_FOUNTAIN ,
2022-11-26 21:15:41 +00:00
/* 40 */ SDC_THIEVES_HIDEOUT ,
/* 41 */ SDC_BOMBCHU_BOWLING_ALLEY ,
/* 42 */ SDC_ROYAL_FAMILYS_TOMB ,
/* 43 */ SDC_LAKESIDE_LABORATORY ,
/* 44 */ SDC_LON_LON_BUILDINGS ,
/* 45 */ SDC_MARKET_GUARD_HOUSE ,
/* 46 */ SDC_POTION_SHOP_GRANNY ,
2022-12-05 18:37:40 +00:00
/* 47 */ SDC_CALM_WATER ,
/* 48 */ SDC_GRAVE_EXIT_LIGHT_SHINING ,
2022-05-31 18:19:46 +00:00
/* 49 */ SDC_BESITU ,
2022-11-26 21:15:41 +00:00
/* 50 */ SDC_FISHING_POND ,
/* 51 */ SDC_GANONS_TOWER_COLLAPSE_INTERIOR ,
/* 52 */ SDC_INSIDE_GANONS_CASTLE_COLLAPSE ,
2022-05-31 18:19:46 +00:00
/* 53 */ SDC_MAX
} SceneDrawConfig ;
2024-08-19 08:24:02 +00:00
typedef void ( * SceneDrawConfigFunc ) ( struct PlayState * ) ;
2022-06-21 00:31:53 +00:00
// R_SCENE_CAM_TYPE values
# define SCENE_CAM_TYPE_DEFAULT 0
# define SCENE_CAM_TYPE_FIXED_SHOP_VIEWPOINT 0x10 // Camera exhibits fixed behaviors and viewpoint changing is handled by shops
# define SCENE_CAM_TYPE_FIXED_TOGGLE_VIEWPOINT 0x20 // Camera exhibits fixed behaviors and viewpoint can be toggled with c-up
# define SCENE_CAM_TYPE_FIXED 0x30 // Camera exhibits fixed behaviors (see `Play_CamIsNotFixed` usages for examples)
# define SCENE_CAM_TYPE_FIXED_MARKET 0x40 // Camera exhibits fixed behaviors and delays textboxes by a small amount before they start to appear
2022-07-30 21:28:50 +00:00
# define SCENE_CAM_TYPE_SHOOTING_GALLERY 0x50 // Unreferenced in code, and used only by the main layer of the shooting gallery scene
2022-06-21 00:31:53 +00:00
2022-10-15 17:24:13 +00:00
// navi hints
2024-08-12 07:07:48 +00:00
typedef enum NaviQuestHintFileId {
2022-10-15 17:24:13 +00:00
NAVI_QUEST_HINTS_NONE ,
NAVI_QUEST_HINTS_OVERWORLD ,
NAVI_QUEST_HINTS_DUNGEON
} NaviQuestHintFileId ;
2021-05-08 21:16:21 +00:00
// Scene commands
2024-08-12 07:07:48 +00:00
typedef enum SceneCommandTypeID {
2021-05-08 21:16:21 +00:00
/* 0x00 */ SCENE_CMD_ID_SPAWN_LIST ,
/* 0x01 */ SCENE_CMD_ID_ACTOR_LIST ,
2022-05-21 12:54:51 +00:00
/* 0x02 */ SCENE_CMD_ID_UNUSED_2 ,
/* 0x03 */ SCENE_CMD_ID_COLLISION_HEADER ,
2021-05-08 21:16:21 +00:00
/* 0x04 */ SCENE_CMD_ID_ROOM_LIST ,
/* 0x05 */ SCENE_CMD_ID_WIND_SETTINGS ,
/* 0x06 */ SCENE_CMD_ID_ENTRANCE_LIST ,
/* 0x07 */ SCENE_CMD_ID_SPECIAL_FILES ,
/* 0x08 */ SCENE_CMD_ID_ROOM_BEHAVIOR ,
2022-05-21 12:54:51 +00:00
/* 0x09 */ SCENE_CMD_ID_UNDEFINED_9 ,
2022-08-31 23:28:51 +00:00
/* 0x0A */ SCENE_CMD_ID_ROOM_SHAPE ,
2021-05-08 21:16:21 +00:00
/* 0x0B */ SCENE_CMD_ID_OBJECT_LIST ,
/* 0x0C */ SCENE_CMD_ID_LIGHT_LIST ,
/* 0x0D */ SCENE_CMD_ID_PATH_LIST ,
2022-05-21 12:54:51 +00:00
/* 0x0E */ SCENE_CMD_ID_TRANSITION_ACTOR_LIST ,
/* 0x0F */ SCENE_CMD_ID_LIGHT_SETTINGS_LIST ,
2021-05-08 21:16:21 +00:00
/* 0x10 */ SCENE_CMD_ID_TIME_SETTINGS ,
/* 0x11 */ SCENE_CMD_ID_SKYBOX_SETTINGS ,
/* 0x12 */ SCENE_CMD_ID_SKYBOX_DISABLES ,
/* 0x13 */ SCENE_CMD_ID_EXIT_LIST ,
/* 0x14 */ SCENE_CMD_ID_END ,
/* 0x15 */ SCENE_CMD_ID_SOUND_SETTINGS ,
/* 0x16 */ SCENE_CMD_ID_ECHO_SETTINGS ,
/* 0x17 */ SCENE_CMD_ID_CUTSCENE_DATA ,
/* 0x18 */ SCENE_CMD_ID_ALTERNATE_HEADER_LIST ,
2022-03-16 21:14:56 +00:00
/* 0x19 */ SCENE_CMD_ID_MISC_SETTINGS ,
2022-06-24 23:45:05 +00:00
/* 0x1A */ SCENE_CMD_ID_MAX
2021-05-08 21:16:21 +00:00
} SceneCommandTypeID ;
# define SCENE_CMD_SPAWN_LIST(numSpawns, spawnList) \
{ SCENE_CMD_ID_SPAWN_LIST , numSpawns , CMD_PTR ( spawnList ) }
# define SCENE_CMD_ACTOR_LIST(numActors, actorList) \
{ SCENE_CMD_ID_ACTOR_LIST , numActors , CMD_PTR ( actorList ) }
# define SCENE_CMD_UNUSED_02(unk, data) \
2022-05-21 12:54:51 +00:00
{ SCENE_CMD_ID_UNUSED_2 , unk , CMD_PTR ( data ) }
2021-05-08 21:16:21 +00:00
# define SCENE_CMD_COL_HEADER(colHeader) \
2022-05-21 12:54:51 +00:00
{ SCENE_CMD_ID_COLLISION_HEADER , 0 , CMD_PTR ( colHeader ) }
2021-05-08 21:16:21 +00:00
# define SCENE_CMD_ROOM_LIST(numRooms, roomList) \
{ SCENE_CMD_ID_ROOM_LIST , numRooms , CMD_PTR ( roomList ) }
# define SCENE_CMD_WIND_SETTINGS(xDir, yDir, zDir, strength) \
{ SCENE_CMD_ID_WIND_SETTINGS , 0 , CMD_BBBB ( xDir , yDir , zDir , strength ) }
# define SCENE_CMD_ENTRANCE_LIST(entranceList) \
{ SCENE_CMD_ID_ENTRANCE_LIST , 0 , CMD_PTR ( entranceList ) }
2022-10-15 17:24:13 +00:00
# define SCENE_CMD_SPECIAL_FILES(naviQuestHintFileId, keepObjectId) \
{ SCENE_CMD_ID_SPECIAL_FILES , naviQuestHintFileId , CMD_W ( keepObjectId ) }
2021-05-08 21:16:21 +00:00
2024-10-14 19:23:50 +00:00
# define SCENE_CMD_ROOM_BEHAVIOR(type, environment, showInvisActors, disableWarpSongs) \
{ SCENE_CMD_ID_ROOM_BEHAVIOR , type , \
environment | _SHIFTL ( showInvisActors , 8 , 1 ) | _SHIFTL ( disableWarpSongs , 10 , 1 ) }
2021-05-08 21:16:21 +00:00
2021-05-15 00:11:00 +00:00
# define SCENE_CMD_UNK_09() \
2022-05-21 12:54:51 +00:00
{ SCENE_CMD_ID_UNDEFINED_9 , 0 , CMD_W ( 0 ) }
2021-05-15 00:11:00 +00:00
2022-08-31 23:28:51 +00:00
# define SCENE_CMD_ROOM_SHAPE(roomShape) \
{ SCENE_CMD_ID_ROOM_SHAPE , 0 , CMD_PTR ( roomShape ) }
2021-05-08 21:16:21 +00:00
# define SCENE_CMD_OBJECT_LIST(numObjects, objectList) \
{ SCENE_CMD_ID_OBJECT_LIST , numObjects , CMD_PTR ( objectList ) }
# define SCENE_CMD_LIGHT_LIST(numLights, lightList) \
2022-01-23 23:09:02 +00:00
{ SCENE_CMD_ID_POS_LIGHT_LIST , numLights , CMD_PTR ( lightList ) }
2021-05-08 21:16:21 +00:00
# define SCENE_CMD_PATH_LIST(pathList) \
{ SCENE_CMD_ID_PATH_LIST , 0 , CMD_PTR ( pathList ) }
2021-08-15 23:15:58 +00:00
# define SCENE_CMD_TRANSITION_ACTOR_LIST(numActors, list) \
2022-05-21 12:54:51 +00:00
{ SCENE_CMD_ID_TRANSITION_ACTOR_LIST , numActors , CMD_PTR ( list ) }
2021-05-08 21:16:21 +00:00
# define SCENE_CMD_ENV_LIGHT_SETTINGS(numLightSettings, lightSettingsList) \
2022-05-21 12:54:51 +00:00
{ SCENE_CMD_ID_LIGHT_SETTINGS_LIST , numLightSettings , CMD_PTR ( lightSettingsList ) }
2021-05-08 21:16:21 +00:00
2022-06-09 19:02:18 +00:00
# define SCENE_CMD_TIME_SETTINGS(hour, min, timeSpeed) \
{ SCENE_CMD_ID_TIME_SETTINGS , 0 , CMD_BBBB ( hour , min , timeSpeed , 0 ) }
2021-05-08 21:16:21 +00:00
2022-06-09 19:02:18 +00:00
# define SCENE_CMD_SKYBOX_SETTINGS(skyboxId, skyboxConfig, envLightMode) \
{ SCENE_CMD_ID_SKYBOX_SETTINGS , 0 , CMD_BBBB ( skyboxId , skyboxConfig , envLightMode , 0 ) }
2021-05-08 21:16:21 +00:00
# define SCENE_CMD_SKYBOX_DISABLES(disableSky, disableSunMoon) \
{ SCENE_CMD_ID_SKYBOX_DISABLES , 0 , CMD_BBBB ( disableSky , disableSunMoon , 0 , 0 ) }
# define SCENE_CMD_EXIT_LIST(exitList) \
{ SCENE_CMD_ID_EXIT_LIST , 0 , CMD_PTR ( exitList ) }
# define SCENE_CMD_END() \
{ SCENE_CMD_ID_END , 0 , CMD_W ( 0 ) }
2021-12-03 14:49:32 +00:00
# define SCENE_CMD_SOUND_SETTINGS(specId, natureAmbienceId, seqId) \
{ SCENE_CMD_ID_SOUND_SETTINGS , specId , CMD_BBBB ( 0 , 0 , natureAmbienceId , seqId ) }
2021-05-08 21:16:21 +00:00
# define SCENE_CMD_ECHO_SETTINGS(echo) \
{ SCENE_CMD_ID_ECHO_SETTINGS , 0 , CMD_BBBB ( 0 , 0 , 0 , echo ) }
# define SCENE_CMD_CUTSCENE_DATA(cutsceneData) \
{ SCENE_CMD_ID_CUTSCENE_DATA , 0 , CMD_PTR ( cutsceneData ) }
# define SCENE_CMD_ALTERNATE_HEADER_LIST(alternateHeaderList) \
{ SCENE_CMD_ID_ALTERNATE_HEADER_LIST , 0 , CMD_PTR ( alternateHeaderList ) }
2022-06-21 00:31:53 +00:00
# define SCENE_CMD_MISC_SETTINGS(sceneCamType, worldMapLocation) \
{ SCENE_CMD_ID_MISC_SETTINGS , sceneCamType , CMD_W ( worldMapLocation ) }
2021-05-08 21:16:21 +00:00
2024-10-01 17:14:54 +00:00
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 ] ;
2021-05-08 21:16:21 +00:00
2020-03-17 04:31:30 +00:00
# endif