1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-10-20 13:40:02 +00:00

Doc pass on scene & room headers (#1240)

* Doc pass on scene & room headers

* Remove comments on room draw handlers

* `struct ActorEntry` -> `ActorEntry`
This commit is contained in:
Dragorn421 2022-06-09 12:02:18 -07:00 committed by GitHub
commit 73ba138f54
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 296 additions and 340 deletions

View file

@ -840,80 +840,6 @@ typedef struct {
/* 0x000C */ ObjectStatus status[OBJECT_EXCHANGE_BANK_MAX];
} ObjectContext; // size = 0x518
typedef struct {
/* 0x00 */ Gfx* opa;
/* 0x04 */ Gfx* xlu;
} PolygonDlist; // size = 0x8
typedef struct {
/* 0x00 */ u8 type;
} PolygonBase;
typedef struct {
/* 0x00 */ PolygonBase base;
/* 0x01 */ u8 num; // number of dlist entries
/* 0x04 */ void* start;
/* 0x08 */ void* end;
} PolygonType0; // size = 0xC
typedef struct {
/* 0x00 */ u16 unk_00;
/* 0x02 */ u8 id;
/* 0x04 */ u32 source;
/* 0x08 */ u32 unk_0C;
/* 0x0C */ u32 tlut;
/* 0x10 */ u16 width;
/* 0x12 */ u16 height;
/* 0x14 */ u8 fmt;
/* 0x15 */ u8 siz;
/* 0x16 */ u16 mode0;
/* 0x18 */ u16 tlutCount;
} BgImage; // size = 0x1C
typedef struct {
/* 0x00 */ PolygonBase base;
/* 0x01 */ u8 format; // 1 = single, 2 = multi
/* 0x04 */ Gfx* dlist;
union {
struct {
/* 0x08 */ void* source;
/* 0x0C */ u32 unk_0C;
/* 0x10 */ void* tlut;
/* 0x14 */ u16 width;
/* 0x16 */ u16 height;
/* 0x18 */ u8 fmt;
/* 0x19 */ u8 siz;
/* 0x1A */ u16 mode0;
/* 0x1C */ u16 tlutCount;
} single;
struct {
/* 0x08 */ u8 count;
/* 0x0C */ BgImage* list;
} multi;
};
} PolygonType1;
typedef struct {
/* 0x00 */ Vec3s pos;
/* 0x06 */ s16 unk_06;
/* 0x08 */ Gfx* opa;
/* 0x0C */ Gfx* xlu;
} PolygonDlist2; // size = 0x8
typedef struct {
/* 0x00 */ PolygonBase base;
/* 0x01 */ u8 num; // number of dlist entries
/* 0x04 */ void* start;
/* 0x08 */ void* end;
} PolygonType2; // size = 0xC
typedef union {
PolygonBase base;
PolygonType0 polygon0;
PolygonType1 polygon1;
PolygonType2 polygon2;
} MeshHeader; // "Ground Shape"
typedef enum {
/* 0 */ LENS_MODE_HIDE_ACTORS, // lens actors are visible by default, and hidden by using lens (for example, fake walls)
/* 1 */ LENS_MODE_SHOW_ACTORS // lens actors are invisible by default, and shown by using lens (for example, invisible enemies)
@ -1097,29 +1023,6 @@ typedef struct {
/* 0x24C */ s32 (*isDone)(void* transition);
} TransitionContext; // size = 0x250
typedef struct {
/* 0x00 */ s16 id;
/* 0x02 */ Vec3s pos;
/* 0x08 */ Vec3s rot;
/* 0x0E */ s16 params;
} ActorEntry; // size = 0x10
typedef struct {
struct {
s8 room; // Room to switch to
s8 effects; // How the camera reacts during the transition
} /* 0x00 */ sides[2]; // 0 = front, 1 = back
/* 0x04 */ s16 id;
/* 0x06 */ Vec3s pos;
/* 0x0C */ s16 rotY;
/* 0x0E */ s16 params;
} TransitionActorEntry; // size = 0x10
typedef struct {
/* 0x00 */ u8 spawn;
/* 0x01 */ u8 room;
} EntranceEntry;
typedef struct {
/* 0x00 */ u8* readBuff;
} SramContext; // size = 0x4

View file

@ -1,6 +1,8 @@
#ifndef Z64SCENE_H
#define Z64SCENE_H
#include "z64.h"
#include "command_macros_base.h"
typedef struct {
@ -17,6 +19,148 @@ typedef struct {
/* 0x13 */ u8 unk_13;
} SceneTableEntry; // size = 0x14
typedef struct {
/* 0x00 */ s16 id;
/* 0x02 */ Vec3s pos;
/* 0x08 */ Vec3s rot;
/* 0x0E */ s16 params;
} ActorEntry; // size = 0x10
typedef struct {
struct {
s8 room; // Room to switch to
s8 effects; // How the camera reacts during the transition
} /* 0x00 */ sides[2]; // 0 = front, 1 = back
/* 0x04 */ s16 id;
/* 0x06 */ Vec3s pos;
/* 0x0C */ s16 rotY;
/* 0x0E */ s16 params;
} TransitionActorEntry; // size = 0x10
typedef struct {
/* 0x00 */ u8 spawn;
/* 0x01 */ u8 room;
} EntranceEntry;
typedef struct {
/* 0x00 */ u8 ambientColor[3];
/* 0x03 */ s8 diffuseDir1[3];
/* 0x06 */ u8 diffuseColor1[3];
/* 0x09 */ s8 diffuseDir2[3];
/* 0x0C */ u8 diffuseColor2[3];
/* 0x0F */ u8 fogColor[3];
/* 0x12 */ u16 fogNear;
/* 0x14 */ u16 fogFar;
} LightSettings; // size = 0x16
typedef struct {
/* 0x00 */ u8 count; // number of points in the path
/* 0x04 */ Vec3s* points; // Segment Address to the array of points
} Path; // size = 0x8
// Mesh headers
typedef enum {
/* 0 */ MESH_HEADER_TYPE_0,
/* 1 */ MESH_HEADER_TYPE_1,
/* 2 */ MESH_HEADER_TYPE_2,
/* 3 */ MESH_HEADER_TYPE_MAX
} MeshHeaderType;
typedef struct {
/* 0x00 */ u8 type;
} MeshHeaderBase; // size = 0x01
typedef struct {
/* 0x00 */ Gfx* opa;
/* 0x04 */ Gfx* xlu;
} MeshHeader01Entry; // size = 0x08
typedef struct {
/* 0x00 */ MeshHeaderBase base;
/* 0x01 */ u8 numEntries;
/* 0x04 */ MeshHeader01Entry* entries;
/* 0x08 */ MeshHeader01Entry* entriesEnd;
} MeshHeader0; // size = 0x0C
typedef enum {
/* 1 */ MESH_HEADER1_FORMAT_SINGLE = 1,
/* 2 */ MESH_HEADER1_FORMAT_MULTI
} MeshHeader1Format;
typedef struct {
/* 0x00 */ MeshHeaderBase base;
/* 0x01 */ u8 format; // MeshHeader1Format
/* 0x04 */ MeshHeader01Entry* entry;
} MeshHeader1Base; // size = 0x08
typedef struct {
/* 0x00 */ MeshHeader1Base base;
/* 0x08 */ void* source;
/* 0x0C */ u32 unk_0C;
/* 0x10 */ void* tlut;
/* 0x14 */ u16 width;
/* 0x16 */ u16 height;
/* 0x18 */ u8 fmt;
/* 0x19 */ u8 siz;
/* 0x1A */ u16 mode0;
/* 0x1C */ u16 tlutCount;
} MeshHeader1Single; // size = 0x20
typedef struct {
/* 0x00 */ u16 unk_00;
/* 0x02 */ u8 id;
/* 0x04 */ u32 source;
/* 0x08 */ u32 unk_0C;
/* 0x0C */ u32 tlut;
/* 0x10 */ u16 width;
/* 0x12 */ u16 height;
/* 0x14 */ u8 fmt;
/* 0x15 */ u8 siz;
/* 0x16 */ u16 mode0;
/* 0x18 */ u16 tlutCount;
} BgImage; // size = 0x1C
typedef struct {
/* 0x00 */ MeshHeader1Base base;
/* 0x08 */ u8 count;
/* 0x0C */ BgImage* list;
} MeshHeader1Multi; // size = 0x10
typedef struct {
/* 0x00 */ Vec3s pos;
/* 0x06 */ s16 unk_06;
/* 0x08 */ Gfx* opa;
/* 0x0C */ Gfx* xlu;
} MeshHeader2Entry; // size = 0x10
typedef struct {
/* 0x00 */ MeshHeaderBase base;
/* 0x01 */ u8 numEntries;
/* 0x04 */ MeshHeader2Entry* entries;
/* 0x08 */ MeshHeader2Entry* entriesEnd;
} MeshHeader2; // size = 0x0C
typedef union {
MeshHeaderBase base;
MeshHeader0 meshHeader0;
MeshHeader1Base meshHeader1Base;
MeshHeader1Single meshHeader1Single;
MeshHeader1Multi meshHeader1Multi;
MeshHeader2 meshHeader2;
} MeshHeader; // "Ground Shape"
// TODO update ZAPD
typedef MeshHeader01Entry PolygonDlist;
typedef MeshHeader0 PolygonType0;
typedef MeshHeader2Entry PolygonDlist2;
typedef MeshHeader2 PolygonType2;
#define ROOM_DRAW_OPA (1 << 0)
#define ROOM_DRAW_XLU (1 << 1)
// Scene commands
typedef struct {
/* 0x00 */ u8 code;
/* 0x01 */ u8 data1;
@ -25,14 +169,14 @@ typedef struct {
typedef struct {
/* 0x00 */ u8 code;
/* 0x01 */ u8 data1;
/* 0x04 */ void* segment;
/* 0x01 */ u8 length;
/* 0x04 */ ActorEntry* data;
} SCmdSpawnList;
typedef struct {
/* 0x00 */ u8 code;
/* 0x01 */ u8 num;
/* 0x04 */ void* segment;
/* 0x01 */ u8 length;
/* 0x04 */ ActorEntry* data;
} SCmdActorList;
typedef struct {
@ -44,13 +188,13 @@ typedef struct {
typedef struct {
/* 0x00 */ u8 code;
/* 0x01 */ u8 data1;
/* 0x04 */ void* segment;
/* 0x04 */ CollisionHeader* data;
} SCmdColHeader;
typedef struct {
/* 0x00 */ u8 code;
/* 0x01 */ u8 num;
/* 0x04 */ void* segment;
/* 0x01 */ u8 length;
/* 0x04 */ RomFile* data;
} SCmdRoomList;
typedef struct {
@ -66,7 +210,7 @@ typedef struct {
typedef struct {
/* 0x00 */ u8 code;
/* 0x01 */ u8 data1;
/* 0x04 */ void* segment;
/* 0x04 */ EntranceEntry* data;
} SCmdEntranceList;
typedef struct {
@ -84,37 +228,37 @@ typedef struct {
typedef struct {
/* 0x00 */ u8 code;
/* 0x01 */ u8 data1;
/* 0x04 */ void* segment;
/* 0x04 */ MeshHeaderBase* data;
} SCmdMesh;
typedef struct {
/* 0x00 */ u8 code;
/* 0x01 */ u8 num;
/* 0x04 */ void* segment;
/* 0x01 */ u8 length;
/* 0x04 */ s16* data;
} SCmdObjectList;
typedef struct {
/* 0x00 */ u8 code;
/* 0x01 */ u8 num;
/* 0x04 */ void* segment;
/* 0x01 */ u8 length;
/* 0x04 */ LightInfo* data;
} SCmdLightList;
typedef struct {
/* 0x00 */ u8 code;
/* 0x01 */ u8 data1;
/* 0x04 */ void* segment;
/* 0x04 */ Path* data;
} SCmdPathList;
typedef struct {
/* 0x00 */ u8 code;
/* 0x01 */ u8 num;
/* 0x04 */ void* segment;
/* 0x01 */ u8 length;
/* 0x04 */ TransitionActorEntry* data;
} SCmdTransiActorList;
typedef struct {
/* 0x00 */ u8 code;
/* 0x01 */ u8 num;
/* 0x04 */ void* segment;
/* 0x01 */ u8 length;
/* 0x04 */ EnvLightSettings* data;
} SCmdLightSettingList;
typedef struct {
@ -123,7 +267,7 @@ typedef struct {
/* 0x02 */ char pad[2];
/* 0x04 */ u8 hour;
/* 0x05 */ u8 min;
/* 0x06 */ u8 unk_06;
/* 0x06 */ u8 timeSpeed;
} SCmdTimeSettings;
typedef struct {
@ -131,16 +275,16 @@ typedef struct {
/* 0x01 */ u8 data1;
/* 0x02 */ char pad[2];
/* 0x04 */ u8 skyboxId;
/* 0x05 */ u8 unk_05;
/* 0x06 */ u8 unk_06;
/* 0x05 */ u8 skyboxConfig;
/* 0x06 */ u8 envLightMode;
} SCmdSkyboxSettings;
typedef struct {
/* 0x00 */ u8 code;
/* 0x01 */ u8 data1;
/* 0x02 */ char pad[2];
/* 0x04 */ u8 unk_04;
/* 0x05 */ u8 unk_05;
/* 0x04 */ u8 skyboxDisabled;
/* 0x05 */ u8 sunMoonDisabled;
} SCmdSkyboxDisables;
typedef struct {
@ -152,7 +296,7 @@ typedef struct {
typedef struct {
/* 0x00 */ u8 code;
/* 0x01 */ u8 data1;
/* 0x04 */ void* segment;
/* 0x04 */ s16* data;
} SCmdExitList;
typedef struct {
@ -173,13 +317,13 @@ typedef struct {
typedef struct {
/* 0x00 */ u8 code;
/* 0x01 */ u8 data1;
/* 0x04 */ void* segment;
/* 0x04 */ void* data;
} SCmdCutsceneData;
typedef struct {
/* 0x00 */ u8 code;
/* 0x01 */ u8 data1;
/* 0x04 */ void* segment;
/* 0x04 */ void* data;
} SCmdAltHeaders;
typedef struct {
@ -188,91 +332,6 @@ typedef struct {
/* 0x04 */ u32 area;
} SCmdMiscSettings;
typedef struct {
u8 headerType;
} MeshHeaderBase;
typedef struct {
MeshHeaderBase base;
u8 numEntries;
Gfx* dListStart;
Gfx* dListEnd;
} MeshHeader0;
typedef struct {
Gfx* opaqueDList;
Gfx* translucentDList;
} MeshEntry0;
typedef struct {
MeshHeaderBase base;
u8 format;
u32 entryRecord;
} MeshHeader1Base;
typedef struct {
MeshHeader1Base base;
void* imagePtr; // 0x08
u32 unknown; // 0x0C
u32 unknown2; // 0x10
u16 bgWidth; // 0x14
u16 bgHeight; // 0x16
u8 imageFormat; // 0x18
u8 imageSize; // 0x19
u16 imagePal; // 0x1A
u16 imageFlip; // 0x1C
} MeshHeader1Single;
typedef struct {
MeshHeader1Base base;
u8 bgCnt;
void* bgRecordPtr;
} MeshHeader1Multi;
typedef struct {
u16 unknown; // 0x00
s8 bgID; // 0x02
void* imagePtr; // 0x04
u32 unknown2; // 0x08
u32 unknown3; // 0x0C
u16 bgWidth; // 0x10
u16 bgHeight; // 0x12
u8 imageFmt; // 0x14
u8 imageSize; // 0x15
u16 imagePal; // 0x16
u16 imageFlip; // 0x18
} BackgroundRecord;
typedef struct {
s16 playerXMax, playerZMax;
s16 playerXMin, playerZMin;
Gfx* opaqueDList;
Gfx* translucentDList;
} MeshEntry2;
typedef struct {
MeshHeaderBase base;
u8 numEntries;
Gfx* dListStart;
Gfx* dListEnd;
} MeshHeader2;
typedef struct {
/* 0x00 */ u8 ambientColor[3];
/* 0x03 */ s8 diffuseDir1[3];
/* 0x06 */ u8 diffuseColor1[3];
/* 0x09 */ s8 diffuseDir2[3];
/* 0x0C */ u8 diffuseColor2[3];
/* 0x0F */ u8 fogColor[3];
/* 0x12 */ u16 fogNear;
/* 0x14 */ u16 fogFar;
} LightSettings; // size = 0x16
typedef struct {
/* 0x00 */ u8 count; // number of points in the path
/* 0x04 */ Vec3s* points; // Segment Address to the array of points
} Path; // size = 0x8
typedef union {
SCmdBase base;
SCmdSpawnList spawnList;
@ -475,11 +534,11 @@ typedef enum {
#define SCENE_CMD_ENV_LIGHT_SETTINGS(numLightSettings, lightSettingsList) \
{ SCENE_CMD_ID_LIGHT_SETTINGS_LIST, numLightSettings, CMD_PTR(lightSettingsList) }
#define SCENE_CMD_TIME_SETTINGS(hour, min, speed) \
{ SCENE_CMD_ID_TIME_SETTINGS, 0, CMD_BBBB(hour, min, speed, 0) }
#define SCENE_CMD_TIME_SETTINGS(hour, min, timeSpeed) \
{ SCENE_CMD_ID_TIME_SETTINGS, 0, CMD_BBBB(hour, min, timeSpeed, 0) }
#define SCENE_CMD_SKYBOX_SETTINGS(skyboxId, weather, isIndoors) \
{ SCENE_CMD_ID_SKYBOX_SETTINGS, 0, CMD_BBBB(skyboxId, weather, isIndoors, 0) }
#define SCENE_CMD_SKYBOX_SETTINGS(skyboxId, skyboxConfig, envLightMode) \
{ SCENE_CMD_ID_SKYBOX_SETTINGS, 0, CMD_BBBB(skyboxId, skyboxConfig, envLightMode, 0) }
#define SCENE_CMD_SKYBOX_DISABLES(disableSky, disableSunMoon) \
{ SCENE_CMD_ID_SKYBOX_DISABLES, 0, CMD_BBBB(disableSky, disableSunMoon, 0, 0) }