From 8197823abbe1d9bfdde9cc7d7698c9269a4c99a0 Mon Sep 17 00:00:00 2001 From: cadmic Date: Mon, 5 Feb 2024 11:16:24 -0800 Subject: [PATCH] Add macro for DebugDisplay_AddObject --- include/macros.h | 39 +++++++++++++------ .../ovl_En_Anubice_Tag/z_en_anubice_tag.c | 10 ++--- .../actors/ovl_En_Changer/z_en_changer.c | 10 ++--- .../actors/ovl_En_Fire_Rock/z_en_fire_rock.c | 10 ++--- src/overlays/actors/ovl_En_Fr/z_en_fr.c | 11 ++---- .../z_en_okarina_effect.c | 11 ++---- src/overlays/actors/ovl_En_Skj/z_en_skj.c | 20 +++------- .../ovl_En_Syateki_Itm/z_en_syateki_itm.c | 10 ++--- .../actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c | 11 ++---- .../ovl_En_Weather_Tag/z_en_weather_tag.c | 11 ++---- .../ovl_En_Wonder_Item/z_en_wonder_item.c | 20 +++------- .../ovl_En_Yabusame_Mark/z_en_yabusame_mark.c | 10 ++--- 12 files changed, 67 insertions(+), 106 deletions(-) diff --git a/include/macros.h b/include/macros.h index b0a35844f4..30a85b0a17 100644 --- a/include/macros.h +++ b/include/macros.h @@ -187,6 +187,22 @@ extern struct GraphicsContext* __gfxCtx; } \ (void)0 +#else + +#define OPEN_DISPS(gfxCtx, file, line) \ + { \ + GraphicsContext* __gfxCtx = gfxCtx; \ + s32 __dispPad + +#define CLOSE_DISPS(gfxCtx, file, line) \ + (void)0; \ + } \ + (void)0 + +#endif + +#if OOT_DEBUG + #define GRAPH_ALLOC(gfxCtx, size) Graph_Alloc(gfxCtx, size) #define MATRIX_TO_MTX(gfxCtx, file, line) Matrix_ToMtx(gfxCtx, file, line) #define MATRIX_NEW(gfxCtx, file, line) Matrix_NewMtx(gfxCtx, file, line) @@ -210,16 +226,6 @@ extern struct GraphicsContext* __gfxCtx; #else -#define OPEN_DISPS(gfxCtx, file, line) \ - { \ - GraphicsContext* __gfxCtx = gfxCtx; \ - s32 __dispPad - -#define CLOSE_DISPS(gfxCtx, file, line) \ - (void)0; \ - } \ - (void)0 - #define GRAPH_ALLOC(gfxCtx, size) ((void*)((gfxCtx)->polyOpa.d = (Gfx*)((u8*)(gfxCtx)->polyOpa.d - ALIGN16(size)))) #define MATRIX_TO_MTX(gfxCtx, file, line) Matrix_ToMtx(gfxCtx) #define MATRIX_NEW(gfxCtx, file, line) Matrix_NewMtx(gfxCtx) @@ -241,7 +247,18 @@ extern struct GraphicsContext* __gfxCtx; #define HUNGUP_AND_CRASH(file, line) LogUtils_HungupThread(file, line) #define GAME_ALLOC_MALLOC(alloc, size, file, line) GameAlloc_Malloc(alloc, size) -#endif /* OOT_DEBUG */ +#endif + +#if OOT_DEBUG +#define DEBUG_DISPLAY_ADD_OBJECT(posX, posY, posZ, rotX, rotY, rotZ, scaleX, scaleY, scaleZ, \ + red, green, blue, alpha, type, gfxCtx) \ + if (BREG(0) != 0) \ + DebugDisplay_AddObject(posX, posY, posZ, rotX, rotY, rotZ, scaleX, scaleY, scaleZ, \ + red, green, blue, alpha, type, gfxCtx) +#else +#define DEBUG_DISPLAY_ADD_OBJECT(posX, posY, posZ, rotX, rotY, rotZ, scaleX, scaleY, scaleZ, \ + red, green, blue, alpha, type, gfxCtx) (void)0 +#endif /** * `x` vertex x diff --git a/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.c b/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.c index 9d474e5b45..7ae55a8d32 100644 --- a/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.c +++ b/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.c @@ -99,11 +99,7 @@ void EnAnubiceTag_Update(Actor* thisx, PlayState* play) { void EnAnubiceTag_Draw(Actor* thisx, PlayState* play) { EnAnubiceTag* this = (EnAnubiceTag*)thisx; -#if OOT_DEBUG - if (BREG(0) != 0) { - DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, - this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, - 1.0f, 255, 0, 0, 255, 4, play->state.gfxCtx); - } -#endif + DEBUG_DISPLAY_ADD_OBJECT(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, + this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, + 1.0f, 255, 0, 0, 255, 4, play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Changer/z_en_changer.c b/src/overlays/actors/ovl_En_Changer/z_en_changer.c index 00be06b7cb..fe46fd7506 100644 --- a/src/overlays/actors/ovl_En_Changer/z_en_changer.c +++ b/src/overlays/actors/ovl_En_Changer/z_en_changer.c @@ -282,11 +282,7 @@ void EnChanger_Update(Actor* thisx, PlayState* play) { this->timer--; } -#if OOT_DEBUG - if (BREG(0) != 0) { - DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, - this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, - 1.0f, 255, 0, 255, 255, 4, play->state.gfxCtx); - } -#endif + DEBUG_DISPLAY_ADD_OBJECT(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, + this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, + 1.0f, 255, 0, 255, 255, 4, play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c b/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c index 762cd128fd..64fd89af58 100644 --- a/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c +++ b/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c @@ -284,13 +284,9 @@ void FireRock_WaitSpawnRocksFromCeiling(EnFireRock* this, PlayState* play) { this->playerNearby = 0; } -#if OOT_DEBUG - if (BREG(0) != 0) { - DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, - this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, - 1.0f, 0, 255, 0, 255, 4, play->state.gfxCtx); - } -#endif + DEBUG_DISPLAY_ADD_OBJECT(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, + this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, + 1.0f, 0, 255, 0, 255, 4, play->state.gfxCtx); } void FireRock_WaitOnFloor(EnFireRock* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Fr/z_en_fr.c b/src/overlays/actors/ovl_En_Fr/z_en_fr.c index b55fc5cd62..5e2ef3466f 100644 --- a/src/overlays/actors/ovl_En_Fr/z_en_fr.c +++ b/src/overlays/actors/ovl_En_Fr/z_en_fr.c @@ -1029,14 +1029,9 @@ void EnFr_SetIdle(EnFr* this, PlayState* play) { void EnFr_UpdateIdle(Actor* thisx, PlayState* play) { EnFr* this = (EnFr*)thisx; -#if OOT_DEBUG - if (BREG(0) != 0) { - DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, - this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, - 1.0f, 255, 0, 0, 255, 4, play->state.gfxCtx); - } -#endif - + DEBUG_DISPLAY_ADD_OBJECT(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, + this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, + 1.0f, 255, 0, 0, 255, 4, play->state.gfxCtx); this->jumpCounter++; this->actionFunc(this, play); } diff --git a/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c b/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c index 6af074b0cf..399da31e05 100644 --- a/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c +++ b/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c @@ -115,12 +115,7 @@ void EnOkarinaEffect_Update(Actor* thisx, PlayState* play) { EnOkarinaEffect* this = (EnOkarinaEffect*)thisx; this->actionFunc(this, play); - -#if OOT_DEBUG - if (BREG(0) != 0) { - DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, - this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, - 1.0f, 0xFF, 0, 0xFF, 0xFF, 4, play->state.gfxCtx); - } -#endif + DEBUG_DISPLAY_ADD_OBJECT(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, + this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, + 1.0f, 0xFF, 0, 0xFF, 0xFF, 4, play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Skj/z_en_skj.c b/src/overlays/actors/ovl_En_Skj/z_en_skj.c index 110a75e994..601a906a13 100644 --- a/src/overlays/actors/ovl_En_Skj/z_en_skj.c +++ b/src/overlays/actors/ovl_En_Skj/z_en_skj.c @@ -1348,13 +1348,9 @@ void EnSkj_SariasSongShortStumpUpdate(Actor* thisx, PlayState* play) { D_80B01EA0 = Actor_TalkOfferAccepted(&this->actor, play); -#if OOT_DEBUG - if (BREG(0) != 0) { - DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, - this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, - 1.0f, 255, 0, 0, 255, 4, play->state.gfxCtx); - } -#endif + DEBUG_DISPLAY_ADD_OBJECT(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, + this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, + 1.0f, 255, 0, 0, 255, 4, play->state.gfxCtx); } void EnSkj_TurnPlayer(EnSkj* this, Player* player) { @@ -1591,13 +1587,9 @@ void EnSkj_OcarinaMinigameShortStumpUpdate(Actor* thisx, PlayState* play) { this->actor.focus.pos.y = -90.0f; this->actor.focus.pos.z = 450.0f; -#if OOT_DEBUG - if (BREG(0) != 0) { - DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, - this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, - 1.0f, 255, 0, 0, 255, 4, play->state.gfxCtx); - } -#endif + DEBUG_DISPLAY_ADD_OBJECT(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, + this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, + 1.0f, 255, 0, 0, 255, 4, play->state.gfxCtx); this->actionFunc(this, play); diff --git a/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c b/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c index 96d928541b..a9c293729f 100644 --- a/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c +++ b/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c @@ -343,11 +343,7 @@ void EnSyatekiItm_Update(Actor* thisx, PlayState* play) { this->unkTimer--; } -#if OOT_DEBUG - if (BREG(0) != 0) { - DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, - this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, - 1.0f, 255, 0, 0, 255, 4, play->state.gfxCtx); - } -#endif + DEBUG_DISPLAY_ADD_OBJECT(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, + this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, + 1.0f, 255, 0, 0, 255, 4, play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c b/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c index 4797458825..d00fe4fe9c 100644 --- a/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c +++ b/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c @@ -146,12 +146,7 @@ void EnWallTubo_Update(Actor* thisx, PlayState* play) { } this->actionFunc(this, play); - -#if OOT_DEBUG - if (BREG(0) != 0) { - DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, - this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, - 1.0f, 0, 0, 255, 255, 4, play->state.gfxCtx); - } -#endif + DEBUG_DISPLAY_ADD_OBJECT(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, + this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, + 1.0f, 0, 0, 255, 255, 4, play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c index 76e4a91c41..7d2e60c438 100644 --- a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c +++ b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c @@ -326,12 +326,7 @@ void EnWeatherTag_Update(Actor* thisx, PlayState* play) { EnWeatherTag* this = (EnWeatherTag*)thisx; this->actionFunc(this, play); - -#if OOT_DEBUG - if (BREG(0) != 0) { - DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, - this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, - 1.0f, 255, 0, 255, 255, 4, play->state.gfxCtx); - } -#endif + DEBUG_DISPLAY_ADD_OBJECT(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, + this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, + 1.0f, 255, 0, 255, 255, 4, play->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.c b/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.c index bf64b20964..030c9b50f1 100644 --- a/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.c +++ b/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.c @@ -226,13 +226,9 @@ void EnWonderItem_MultitagFree(EnWonderItem* this, PlayState* play) { return; } -#if OOT_DEBUG - if (BREG(0) != 0) { - DebugDisplay_AddObject(sTagPointsFree[i].x, sTagPointsFree[i].y, sTagPointsFree[i].z, - this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, - 1.0f, 1.0f, 0, 255, 0, 255, 4, play->state.gfxCtx); - } -#endif + DEBUG_DISPLAY_ADD_OBJECT(sTagPointsFree[i].x, sTagPointsFree[i].y, sTagPointsFree[i].z, + this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, + 1.0f, 1.0f, 0, 255, 0, 255, 4, play->state.gfxCtx); } } if (this->timer == 1) { @@ -303,13 +299,9 @@ void EnWonderItem_MultitagOrdered(EnWonderItem* this, PlayState* play) { } } -#if OOT_DEBUG - if (BREG(0) != 0) { - DebugDisplay_AddObject(sTagPointsOrdered[i].x, sTagPointsOrdered[i].y, sTagPointsOrdered[i].z, - this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, - 1.0f, 1.0f, 0, 0, 255, 255, 4, play->state.gfxCtx); - } -#endif + DEBUG_DISPLAY_ADD_OBJECT(sTagPointsOrdered[i].x, sTagPointsOrdered[i].y, sTagPointsOrdered[i].z, + this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, + 1.0f, 1.0f, 0, 0, 255, 255, 4, play->state.gfxCtx); } } if (this->timer == 1) { diff --git a/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.c b/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.c index 018fcd5d52..c6785ad563 100644 --- a/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.c +++ b/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.c @@ -215,11 +215,7 @@ void EnYabusameMark_Update(Actor* thisx, PlayState* play) { Collider_SetQuadVertices(&this->collider, &this->vertexA, &this->vertexB, &this->vertexC, &this->vertexD); CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); -#if OOT_DEBUG - if (BREG(0) != 0) { - DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, - this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, - 1.0f, 0, 0xFF, 0, 0xFF, 4, play->state.gfxCtx); - } -#endif + DEBUG_DISPLAY_ADD_OBJECT(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, + this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, + 1.0f, 0, 0xFF, 0, 0xFF, 4, play->state.gfxCtx); }