mirror of
https://github.com/zeldaret/oot
synced 2026-08-17 13:29:51 -04:00
Doc room drawing (#1283)
* (wip) some doc on room draw2
* doc room_draw2
* do what can be done for `func_80095AA0`
* wip
* more cleanup around Room_DrawBackground2D
* format"
* commit to naming things
* move forward declarations of draw handlers to draw handlers array
* two z_room regs
* `R_MESH2_` -> `R_ROOM_CULL_`
* offset -> quakeOffset
* kb -> kB
* Improve cull mesh type doc
* `Sphere16` MeshHeaderCullEntry.bounds
* Revert "`Sphere16` MeshHeaderCullEntry.bounds" (ZAPD...)
This reverts commit cbe55e8090.
* Mesh header type: "cull" -> "cullable"
* Reword some Cullable doc
Co-authored-by: EllipticEllipsis <elliptic.ellipsis@gmail.com>
* `boundsSphere*` for now for the can't-be-`Sphere16 bounds`
* Improve the PrerenderMulti bgCamInfo usage situation
* Comment on `overrideBgCamIndex`
* "are left" -> "remain"
* enum and defines for room draw debug regs
* drawBg -> drawBackground
* "mesh header all" -> "mesh header normal" 🤷
* array_count back to define
* Name some temps a lot less specifically
* "mesh header" -> "room shape"
* "Room shape prerender" -> "Room shape image"
* `ROOM_SHAPE_IMAGE_FORMAT_` -> `ROOM_SHAPE_IMAGE_AMOUNT_`
* `RoomShapeImageMultiBackgroundEntry` -> `RoomShapeImageMultiBgEntry`
* Remove references to "header" (old "mesh header" name)
* Axe variable names
Co-authored-by: EllipticEllipsis <elliptic.ellipsis@gmail.com>
This commit is contained in:
+3
-3
@@ -1132,9 +1132,9 @@ Gfx* Gfx_TwoTexScrollEnvColor(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y1
|
||||
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* arg2, UNK_TYPE arg3);
|
||||
void func_8009638C(Gfx** displayList, void* source, void* tlut, u16 width, u16 height, u8 fmt, u8 siz, u16 mode0,
|
||||
u16 tlutCount, f32 frameX, f32 frameY);
|
||||
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);
|
||||
void func_80096FD4(PlayState* play, Room* room);
|
||||
u32 func_80096FE8(PlayState* play, RoomContext* roomCtx);
|
||||
s32 func_8009728C(PlayState* play, RoomContext* roomCtx, s32 roomNum);
|
||||
|
||||
@@ -48,6 +48,8 @@
|
||||
#define R_ENV_TIME_SPEED_OLD REG(15) // Most likely used during development. Unused in the final game.
|
||||
#define R_RUN_SPEED_LIMIT REG(45)
|
||||
#define R_ENABLE_ARENA_DBG SREG(0)
|
||||
#define R_ROOM_IMAGE_NODRAW_FLAGS SREG(25)
|
||||
#define R_ROOM_BG2D_FORCE_SCALEBG SREG(26)
|
||||
#define R_UPDATE_RATE SREG(30)
|
||||
#define R_ENABLE_AUDIO_DBG SREG(36)
|
||||
#define R_FB_FILTER_TYPE SREG(80)
|
||||
@@ -131,6 +133,10 @@
|
||||
#define R_TEXTBOX_TEXHEIGHT_TARGET XREG(77)
|
||||
#define R_ENV_LIGHT1_DIR(i) cREG(3 + (i))
|
||||
#define R_ENV_LIGHT2_DIR(i) cREG(6 + (i))
|
||||
#define R_ROOM_CULL_DEBUG_MODE iREG(86)
|
||||
#define R_ROOM_CULL_NUM_ENTRIES iREG(87)
|
||||
#define R_ROOM_CULL_USED_ENTRIES iREG(88)
|
||||
#define R_ROOM_CULL_DEBUG_TARGET iREG(89)
|
||||
#define R_B_LABEL_DD WREG(0)
|
||||
#define R_OW_MINIMAP_X WREG(29)
|
||||
#define R_OW_MINIMAP_Y WREG(30)
|
||||
|
||||
+1
-1
@@ -872,7 +872,7 @@ typedef struct {
|
||||
/* 0x03 */ u8 behaviorType1;
|
||||
/* 0x04 */ s8 echo;
|
||||
/* 0x05 */ u8 lensMode;
|
||||
/* 0x08 */ MeshHeader* meshHeader; // original name: "ground_shape"
|
||||
/* 0x08 */ RoomShape* roomShape; // original name: "ground_shape"
|
||||
/* 0x0C */ void* segment;
|
||||
/* 0x10 */ char unk_10[0x4];
|
||||
} Room; // size = 0x14
|
||||
|
||||
@@ -64,7 +64,7 @@ typedef struct {
|
||||
/* 0x06 */ Vec3s rot;
|
||||
/* 0x0C */ s16 fov;
|
||||
/* 0x0E */ union {
|
||||
s16 jfifId;
|
||||
s16 roomImageOverrideBgCamIndex;
|
||||
s16 timer;
|
||||
s16 flags;
|
||||
};
|
||||
|
||||
+1
-1
@@ -813,7 +813,7 @@ typedef struct {
|
||||
/* 0x0 */ Vec3s rot;
|
||||
/* 0x6 */ s16 fov;
|
||||
/* 0x8 */ s16 updDirTimer;
|
||||
/* 0xA */ s16 jfifId;
|
||||
/* 0xA */ s16 roomImageOverrideBgCamIndex;
|
||||
} Fixed3ReadWriteData; // size = 0xC
|
||||
|
||||
typedef struct {
|
||||
|
||||
+59
-51
@@ -58,44 +58,44 @@ typedef struct {
|
||||
/* 0x04 */ Vec3s* points; // Segment Address to the array of points
|
||||
} Path; // size = 0x8
|
||||
|
||||
// Mesh headers
|
||||
// Room shapes
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ MESH_HEADER_TYPE_0,
|
||||
/* 1 */ MESH_HEADER_TYPE_1,
|
||||
/* 2 */ MESH_HEADER_TYPE_2,
|
||||
/* 3 */ MESH_HEADER_TYPE_MAX
|
||||
} MeshHeaderType;
|
||||
/* 0 */ ROOM_SHAPE_TYPE_NORMAL,
|
||||
/* 1 */ ROOM_SHAPE_TYPE_IMAGE,
|
||||
/* 2 */ ROOM_SHAPE_TYPE_CULLABLE,
|
||||
/* 3 */ ROOM_SHAPE_TYPE_MAX
|
||||
} RoomShapeType;
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u8 type;
|
||||
} MeshHeaderBase; // size = 0x01
|
||||
} RoomShapeBase; // size = 0x01
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ Gfx* opa;
|
||||
/* 0x04 */ Gfx* xlu;
|
||||
} MeshHeader01Entry; // size = 0x08
|
||||
} RoomShapeDListsEntry; // size = 0x08
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ MeshHeaderBase base;
|
||||
/* 0x00 */ RoomShapeBase base;
|
||||
/* 0x01 */ u8 numEntries;
|
||||
/* 0x04 */ MeshHeader01Entry* entries;
|
||||
/* 0x08 */ MeshHeader01Entry* entriesEnd;
|
||||
} MeshHeader0; // size = 0x0C
|
||||
/* 0x04 */ RoomShapeDListsEntry* entries;
|
||||
/* 0x08 */ RoomShapeDListsEntry* entriesEnd;
|
||||
} RoomShapeNormal; // size = 0x0C
|
||||
|
||||
typedef enum {
|
||||
/* 1 */ MESH_HEADER1_FORMAT_SINGLE = 1,
|
||||
/* 2 */ MESH_HEADER1_FORMAT_MULTI
|
||||
} MeshHeader1Format;
|
||||
/* 1 */ ROOM_SHAPE_IMAGE_AMOUNT_SINGLE = 1,
|
||||
/* 2 */ ROOM_SHAPE_IMAGE_AMOUNT_MULTI
|
||||
} RoomShapeImageAmountType;
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ MeshHeaderBase base;
|
||||
/* 0x01 */ u8 format; // MeshHeader1Format
|
||||
/* 0x04 */ MeshHeader01Entry* entry;
|
||||
} MeshHeader1Base; // size = 0x08
|
||||
/* 0x00 */ RoomShapeBase base;
|
||||
/* 0x01 */ u8 amountType; // RoomShapeImageAmountType
|
||||
/* 0x04 */ RoomShapeDListsEntry* entry;
|
||||
} RoomShapeImageBase; // size = 0x08
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ MeshHeader1Base base;
|
||||
/* 0x00 */ RoomShapeImageBase base;
|
||||
/* 0x08 */ void* source;
|
||||
/* 0x0C */ u32 unk_0C;
|
||||
/* 0x10 */ void* tlut;
|
||||
@@ -103,13 +103,13 @@ typedef struct {
|
||||
/* 0x16 */ u16 height;
|
||||
/* 0x18 */ u8 fmt;
|
||||
/* 0x19 */ u8 siz;
|
||||
/* 0x1A */ u16 mode0;
|
||||
/* 0x1A */ u16 tlutMode;
|
||||
/* 0x1C */ u16 tlutCount;
|
||||
} MeshHeader1Single; // size = 0x20
|
||||
} RoomShapeImageSingle; // size = 0x20
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u16 unk_00;
|
||||
/* 0x02 */ u8 id;
|
||||
/* 0x02 */ u8 bgCamIndex; // for which bg cam index is this entry for
|
||||
/* 0x04 */ void* source;
|
||||
/* 0x08 */ u32 unk_0C;
|
||||
/* 0x0C */ void* tlut;
|
||||
@@ -117,44 +117,52 @@ typedef struct {
|
||||
/* 0x12 */ u16 height;
|
||||
/* 0x14 */ u8 fmt;
|
||||
/* 0x15 */ u8 siz;
|
||||
/* 0x16 */ u16 mode0;
|
||||
/* 0x16 */ u16 tlutMode;
|
||||
/* 0x18 */ u16 tlutCount;
|
||||
} BgImage; // size = 0x1C
|
||||
} RoomShapeImageMultiBgEntry; // size = 0x1C
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ MeshHeader1Base base;
|
||||
/* 0x08 */ u8 count;
|
||||
/* 0x0C */ BgImage* list;
|
||||
} MeshHeader1Multi; // size = 0x10
|
||||
/* 0x00 */ RoomShapeImageBase base;
|
||||
/* 0x08 */ u8 numBackgrounds;
|
||||
/* 0x0C */ RoomShapeImageMultiBgEntry* backgrounds;
|
||||
} RoomShapeImageMulti; // size = 0x10
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ Vec3s pos;
|
||||
/* 0x06 */ s16 unk_06;
|
||||
/* 0x00 */ Vec3s boundsSphereCenter;
|
||||
/* 0x06 */ s16 boundsSphereRadius;
|
||||
/* 0x08 */ Gfx* opa;
|
||||
/* 0x0C */ Gfx* xlu;
|
||||
} MeshHeader2Entry; // size = 0x10
|
||||
} RoomShapeCullableEntry; // size = 0x10
|
||||
|
||||
#define ROOM_SHAPE_CULLABLE_MAX_ENTRIES 64
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ MeshHeaderBase base;
|
||||
/* 0x00 */ RoomShapeBase base;
|
||||
/* 0x01 */ u8 numEntries;
|
||||
/* 0x04 */ MeshHeader2Entry* entries;
|
||||
/* 0x08 */ MeshHeader2Entry* entriesEnd;
|
||||
} MeshHeader2; // size = 0x0C
|
||||
/* 0x04 */ RoomShapeCullableEntry* entries;
|
||||
/* 0x08 */ RoomShapeCullableEntry* entriesEnd;
|
||||
} RoomShapeCullable; // size = 0x0C
|
||||
|
||||
typedef union {
|
||||
MeshHeaderBase base;
|
||||
MeshHeader0 meshHeader0;
|
||||
MeshHeader1Base meshHeader1Base;
|
||||
MeshHeader1Single meshHeader1Single;
|
||||
MeshHeader1Multi meshHeader1Multi;
|
||||
MeshHeader2 meshHeader2;
|
||||
} MeshHeader; // "Ground Shape"
|
||||
RoomShapeBase base;
|
||||
RoomShapeNormal normal;
|
||||
union {
|
||||
RoomShapeImageBase base;
|
||||
RoomShapeImageSingle single;
|
||||
RoomShapeImageMulti multi;
|
||||
} image;
|
||||
RoomShapeCullable cullable;
|
||||
} RoomShape; // "Ground Shape"
|
||||
|
||||
// TODO update ZAPD
|
||||
typedef MeshHeader01Entry PolygonDlist;
|
||||
typedef MeshHeader0 PolygonType0;
|
||||
typedef MeshHeader2Entry PolygonDlist2;
|
||||
typedef MeshHeader2 PolygonType2;
|
||||
typedef RoomShapeDListsEntry PolygonDlist;
|
||||
typedef RoomShapeNormal PolygonType0;
|
||||
typedef RoomShapeImageSingle MeshHeader1Single;
|
||||
typedef RoomShapeImageMultiBgEntry BgImage;
|
||||
typedef RoomShapeImageMulti MeshHeader1Multi;
|
||||
typedef RoomShapeCullableEntry PolygonDlist2;
|
||||
typedef RoomShapeCullable PolygonType2;
|
||||
#define SCENE_CMD_MESH SCENE_CMD_ROOM_SHAPE
|
||||
|
||||
#define ROOM_DRAW_OPA (1 << 0)
|
||||
#define ROOM_DRAW_XLU (1 << 1)
|
||||
@@ -228,7 +236,7 @@ typedef struct {
|
||||
typedef struct {
|
||||
/* 0x00 */ u8 code;
|
||||
/* 0x01 */ u8 data1;
|
||||
/* 0x04 */ MeshHeaderBase* data;
|
||||
/* 0x04 */ RoomShapeBase* data;
|
||||
} SCmdMesh;
|
||||
|
||||
typedef struct {
|
||||
@@ -474,7 +482,7 @@ typedef enum {
|
||||
/* 0x07 */ SCENE_CMD_ID_SPECIAL_FILES,
|
||||
/* 0x08 */ SCENE_CMD_ID_ROOM_BEHAVIOR,
|
||||
/* 0x09 */ SCENE_CMD_ID_UNDEFINED_9,
|
||||
/* 0x0A */ SCENE_CMD_ID_MESH_HEADER,
|
||||
/* 0x0A */ SCENE_CMD_ID_ROOM_SHAPE,
|
||||
/* 0x0B */ SCENE_CMD_ID_OBJECT_LIST,
|
||||
/* 0x0C */ SCENE_CMD_ID_LIGHT_LIST,
|
||||
/* 0x0D */ SCENE_CMD_ID_PATH_LIST,
|
||||
@@ -524,8 +532,8 @@ typedef enum {
|
||||
#define SCENE_CMD_UNK_09() \
|
||||
{ SCENE_CMD_ID_UNDEFINED_9, 0, CMD_W(0) }
|
||||
|
||||
#define SCENE_CMD_MESH(meshHeader) \
|
||||
{ SCENE_CMD_ID_MESH_HEADER, 0, CMD_PTR(meshHeader) }
|
||||
#define SCENE_CMD_ROOM_SHAPE(roomShape) \
|
||||
{ SCENE_CMD_ID_ROOM_SHAPE, 0, CMD_PTR(roomShape) }
|
||||
|
||||
#define SCENE_CMD_OBJECT_LIST(numObjects, objectList) \
|
||||
{ SCENE_CMD_ID_OBJECT_LIST, numObjects, CMD_PTR(objectList) }
|
||||
|
||||
Reference in New Issue
Block a user