summaryrefslogtreecommitdiff
path: root/src/code
diff options
context:
space:
mode:
authorDerek Hensley <hensley.derek58@gmail.com>2023-04-23 18:02:30 -0700
committerGitHub <noreply@github.com>2023-04-24 11:02:30 +1000
commitfc3da8451ac4270bbe2f63102010d6726c562240 (patch)
tree89fa3688bdd06a674cf1c7df540dd29d85d0684c /src/code
parent539950bdc245e6a27004fcf88a7856b87751025d (diff)
Match Room_DrawCullable (#1232)
* Match Room_DrawCullable * format * Update src/code/z_room.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> --------- Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>
Diffstat (limited to 'src/code')
-rw-r--r--src/code/z_room.c38
1 files changed, 11 insertions, 27 deletions
diff --git a/src/code/z_room.c b/src/code/z_room.c
index 369b2b0e5..22db1035f 100644
--- a/src/code/z_room.c
+++ b/src/code/z_room.c
@@ -59,40 +59,28 @@ typedef struct RoomShapeCullableEntryLinked {
/* 0x0C */ struct RoomShapeCullableEntryLinked* next;
} RoomShapeCullableEntryLinked; // size = 0x10
-// TODO: 127 is an arbitrarily chosen number to make the stack sorta work
-#define ROOM_SHAPE_CULLABLE_MAX_ENTRIES 127
+#define ROOM_SHAPE_CULLABLE_MAX_ENTRIES 128
-#ifdef NON_MATCHING
-// Small regalloc, likely related to temp usage and scoping
void Room_DrawCullable(PlayState* play, Room* room, u32 flags) {
RoomShapeCullable* roomShape;
RoomShapeCullableEntry* roomShapeCullableEntry;
- RoomShapeCullableEntry* roomShapeCullableEntries;
- RoomShapeCullableEntry* roomShapeCullableEntryIter;
- Gfx* displayList;
- f32 entryBoundsNearZ;
RoomShapeCullableEntryLinked linkedEntriesBuffer[ROOM_SHAPE_CULLABLE_MAX_ENTRIES];
RoomShapeCullableEntryLinked* head = NULL;
RoomShapeCullableEntryLinked* tail = NULL;
- s32 var_a1;
RoomShapeCullableEntryLinked* iter;
+ Gfx* displayList;
RoomShapeCullableEntryLinked* insert;
- f32 var_fv1;
+ f32 entryBoundsNearZ;
s32 i;
Vec3f pos;
Vec3f projectedPos;
- s32 pad2;
+ RoomShapeCullableEntry* roomShapeCullableEntries;
OPEN_DISPS(play->state.gfxCtx);
if (flags & ROOM_DRAW_OPA) {
func_800BCBF4(&sZeroVec, play);
- //! TODO: Fake
- if (1) {}
- if (1) {}
- if (1) {}
-
gSPSegment(POLY_OPA_DISP++, 0x03, room->segment);
if (play->roomCtx.unk74 != NULL) {
gSPSegment(POLY_OPA_DISP++, 0x06, play->roomCtx.unk74);
@@ -159,8 +147,9 @@ void Room_DrawCullable(PlayState* play, Room* room, u32 flags) {
}
}
} else {
- f32 var_fa1 = 1.0f / play->projectionMtxFDiagonal.z; // sp54
- s32 pad5;
+ f32 var_fa1 = 1.0f / play->projectionMtxFDiagonal.z;
+ f32 var_fv1;
+ s32 var_a1;
// Pick and sort entries by depth
for (i = 0; i < roomShape->numEntries; i++, roomShapeCullableEntry++) {
@@ -237,8 +226,7 @@ void Room_DrawCullable(PlayState* play, Room* room, u32 flags) {
if (flags & ROOM_DRAW_OPA) {
for (; head != NULL; head = head->next, i++) {
- s32 pad3;
- RoomShapeCullableEntry* roomShapeCullableEntry;
+ s32 pad;
roomShapeCullableEntry = head->entry;
@@ -265,17 +253,17 @@ void Room_DrawCullable(PlayState* play, Room* room, u32 flags) {
}
if (flags & ROOM_DRAW_XLU) {
- for (; head != NULL; head = head->prev) {
+ for (; tail != NULL; tail = tail->prev) {
f32 temp_fv0;
f32 temp_fv1;
- roomShapeCullableEntry = head->entry;
+ roomShapeCullableEntry = tail->entry;
displayList = roomShapeCullableEntry->xlu;
if (displayList != NULL) {
if (roomShapeCullableEntry->boundsSphereRadius & 1) {
- temp_fv0 = head->boundsNearZ - (f32)(iREG(93) + 0xBB8);
+ temp_fv0 = tail->boundsNearZ - (f32)(iREG(93) + 0xBB8);
temp_fv1 = iREG(94) + 0x7D0;
if (temp_fv0 < temp_fv1) {
@@ -299,10 +287,6 @@ void Room_DrawCullable(PlayState* play, Room* room, u32 flags) {
CLOSE_DISPS(play->state.gfxCtx);
}
-#else
-void Room_DrawCullable(PlayState* play, Room* room, u32 flags);
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_room/Room_DrawCullable.s")
-#endif
#define ROOM_IMAGE_NODRAW_BACKGROUND (1 << 0)
#define ROOM_IMAGE_NODRAW_OPA (1 << 1)