From 98aef8988adbcb5960e8001e70141d0d1a9034bd Mon Sep 17 00:00:00 2001 From: Anghelo Carvajal Date: Thu, 29 Apr 2021 14:39:46 -0400 Subject: [PATCH] `assert` macro OK (#755) * create assert macro and replace a bunch of __assert Signed-off-by: angie * Another bunch of assert Signed-off-by: angie * more assert Signed-off-by: angie * assert(false) Signed-off-by: angie * last assert used in matching code Signed-off-by: angie * the non-matchings Signed-off-by: angie * typo Signed-off-by: angie * format Signed-off-by: angie * change macro to uppercase Signed-off-by: angie * Apply suggestions from code review Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com> * Change ASSERT(false) to ASSERT(0) Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com> --- include/macros.h | 8 ++++ src/boot/z_std_dma.c | 14 ++---- src/code/sched.c | 31 +++++-------- src/code/sys_matrix.c | 4 +- src/code/z_actor.c | 34 ++++---------- src/code/z_bgcheck.c | 43 +++++++++--------- src/code/z_collision_check.c | 45 ++++++------------- src/code/z_construct.c | 18 ++------ src/code/z_eff_blure.c | 5 +-- src/code/z_effect_soft_sprite.c | 8 +--- src/code/z_elf_message.c | 4 +- src/code/z_fcurve_data_skelanime.c | 4 +- src/code/z_horse.c | 39 +++++----------- src/code/z_jpeg.c | 7 ++- src/code/z_map_exp.c | 4 +- src/code/z_play.c | 9 ++-- src/code/z_rcp.c | 10 +---- src/code/z_room.c | 13 ++---- src/code/z_scene.c | 18 +++----- src/code/z_skelanime.c | 12 ++--- src/code/z_skin_awb.c | 13 ++---- src/code/z_sram.c | 5 +-- src/code/z_view.c | 16 ++----- src/code/z_vismono.c | 9 +--- .../ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.c | 2 +- src/overlays/actors/ovl_Demo_6K/z_demo_6k.c | 4 +- .../actors/ovl_Demo_Effect/z_demo_effect.c | 6 +-- .../actors/ovl_Demo_Kankyo/z_demo_kankyo.c | 2 +- .../actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.c | 5 +-- src/overlays/actors/ovl_En_Box/z_en_box.c | 12 ++--- src/overlays/actors/ovl_En_Elf/z_en_elf.c | 4 +- src/overlays/actors/ovl_En_Fr/z_en_fr.c | 4 +- src/overlays/actors/ovl_En_Ge2/z_en_ge2.c | 2 +- src/overlays/actors/ovl_En_GirlA/z_en_girla.c | 4 +- src/overlays/actors/ovl_En_Gm/z_en_gm.c | 2 +- src/overlays/actors/ovl_En_Guest/z_en_guest.c | 2 +- src/overlays/actors/ovl_En_Owl/z_en_owl.c | 2 +- src/overlays/actors/ovl_En_Rr/z_en_rr.c | 2 +- src/overlays/actors/ovl_En_Sth/z_en_sth.c | 2 +- src/overlays/actors/ovl_En_Tr/z_en_tr.c | 2 +- .../actors/ovl_En_Viewer/z_en_viewer.c | 8 +--- .../ovl_Item_Etcetera/z_item_etcetera.c | 2 +- .../actors/ovl_player_actor/z_player.c | 5 +-- src/overlays/gamestates/ovl_title/z_title.c | 4 +- 44 files changed, 148 insertions(+), 301 deletions(-) diff --git a/include/macros.h b/include/macros.h index b4af321020..c75b6122bb 100644 --- a/include/macros.h +++ b/include/macros.h @@ -129,4 +129,12 @@ extern GraphicsContext* __gfxCtx; #define VTX_T(x,y,z,s,t,cr,cg,cb,a) { { x, y, z }, 0, { s, t }, { cr, cg, cb, a } } +#ifdef NDEBUG +#define ASSERT(cond, msg, file, line) ((void)0) +#elif defined(REAL_ASSERT_MACRO) +#define ASSERT(cond, msg, file, line) ((cond) ? ((void)0) : __assert(#cond, __FILE__, __LINE__)) +#else +#define ASSERT(cond, msg, file, line) ((cond) ? ((void)0) : __assert(msg, file, line)) +#endif + #endif diff --git a/src/boot/z_std_dma.c b/src/boot/z_std_dma.c index d03ac8d7aa..2235cf6cce 100644 --- a/src/boot/z_std_dma.c +++ b/src/boot/z_std_dma.c @@ -1651,17 +1651,9 @@ DmaMgr_DMARomToRam_end: s32 DmaMgr_DmaCallback0(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction) { s32 ret; - if (pihandle != gCartHandle) { - __assert("pihandle == carthandle", "../z_std_dma.c", 530); - } - - if (direction != OS_READ) { - __assert("direction == OS_READ", "../z_std_dma.c", 531); - } - - if (mb == NULL) { - __assert("mb != NULL", "../z_std_dma.c", 532); - } + ASSERT(pihandle == gCartHandle, "pihandle == carthandle", "../z_std_dma.c", 530); + ASSERT(direction == OS_READ, "direction == OS_READ", "../z_std_dma.c", 531); + ASSERT(mb != NULL, "mb != NULL", "../z_std_dma.c", 532); if (D_80009460 == 10) { osSyncPrintf("%10lld サウンドDMA %08x %08x %08x (%d)\n", OS_CYCLES_TO_USEC(osGetTime()), mb->dramAddr, diff --git a/src/code/sched.c b/src/code/sched.c index 9375b965bf..a28e78a2f7 100644 --- a/src/code/sched.c +++ b/src/code/sched.c @@ -100,10 +100,9 @@ void Sched_HandleStart(SchedContext* sc) { void Sched_QueueTask(SchedContext* sc, OSScTask* task) { s32 type = task->list.t.type; - if (!((type == M_AUDTASK) || (type == M_GFXTASK) || (type == M_NJPEGTASK) || (type == M_NULTASK))) { - __assert("(type == M_AUDTASK) || (type == M_GFXTASK) || (type == M_NJPEGTASK) || (type == M_NULTASK)", - "../sched.c", 463); - } + ASSERT((type == M_AUDTASK) || (type == M_GFXTASK) || (type == M_NJPEGTASK) || (type == M_NULTASK), + "(type == M_AUDTASK) || (type == M_GFXTASK) || (type == M_NJPEGTASK) || (type == M_NULTASK)", "../sched.c", + 463); if (type == M_AUDTASK) { if (sLogScheduler) { @@ -136,9 +135,7 @@ void Sched_QueueTask(SchedContext* sc, OSScTask* task) { void Sched_Yield(SchedContext* sc) { if (!(sc->curRSPTask->state & OS_SC_YIELD)) { - if (sc->curRSPTask->list.t.type == M_AUDTASK) { - __assert("sc->curRSPTask->list.t.type != M_AUDTASK", "../sched.c", 496); - } + ASSERT(sc->curRSPTask->list.t.type != M_AUDTASK, "sc->curRSPTask->list.t.type != M_AUDTASK", "../sched.c", 496); sc->curRSPTask->state |= OS_SC_YIELD; @@ -157,14 +154,14 @@ OSScTask* func_800C89D4(SchedContext* sc, OSScTask* task) { if (sc->pendingSwapBuf1 != NULL) { if (0) { - __assert("sc->pending_swapbuffer1", "../sched.c", UNK_LINE); + ASSERT(sc->pendingSwapBuf1 != NULL, "sc->pending_swapbuffer1", "../sched.c", UNK_LINE); } return NULL; } if (sc->pendingSwapBuf2 != NULL) { if (0) { - __assert("sc->pending_swapbuffer2", "../sched.c", UNK_LINE); + ASSERT(sc->pendingSwapBuf2 != NULL, "sc->pending_swapbuffer2", "../sched.c", UNK_LINE); } return NULL; } @@ -250,9 +247,7 @@ u32 Sched_IsComplete(SchedContext* sc, OSScTask* task) { } void Sched_RunTask(SchedContext* sc, OSScTask* spTask, OSScTask* dpTask) { - if (sc->curRSPTask != NULL) { - __assert("sc->curRSPTask == NULL", "../sched.c", 663); - } + ASSERT(sc->curRSPTask == NULL, "sc->curRSPTask == NULL", "../sched.c", 663); if (spTask != NULL) { if (spTask->list.t.type == 0) { if (spTask->flags & OS_SC_NEEDS_RSP) { @@ -362,9 +357,7 @@ void Sched_HandleRSPDone(SchedContext* sc) { OSScTask* nextRDP = NULL; s32 state; - if (sc->curRSPTask == NULL) { - __assert("sc->curRSPTask", "../sched.c", 819); - } + ASSERT(sc->curRSPTask != NULL, "sc->curRSPTask", "../sched.c", 819); if (sc->curRSPTask->list.t.type == M_AUDTASK) { gRSPAudioTotalTime += osGetTime() - sRSPAudioStartTime; @@ -413,12 +406,8 @@ void Sched_HandleRDPDone(SchedContext* sc) { s32 state; gRDPTotalTime = osGetTime() - sRDPStartTime; - if (sc->curRDPTask == NULL) { - __assert("sc->curRDPTask", "../sched.c", 878); - } - if (sc->curRDPTask->list.t.type != M_GFXTASK) { - __assert("sc->curRDPTask->list.t.type == M_GFXTASK", "../sched.c", 879); - } + ASSERT(sc->curRDPTask != NULL, "sc->curRDPTask", "../sched.c", 878); + ASSERT(sc->curRDPTask->list.t.type == M_GFXTASK, "sc->curRDPTask->list.t.type == M_GFXTASK", "../sched.c", 879); curTask = sc->curRDPTask; sc->curRDPTask = NULL; curTask->state &= ~OS_SC_DP; diff --git a/src/code/sys_matrix.c b/src/code/sys_matrix.c index ca1a3924f7..6427ccbb96 100644 --- a/src/code/sys_matrix.c +++ b/src/code/sys_matrix.c @@ -31,9 +31,7 @@ void Matrix_Push(void) { void Matrix_Pop(void) { sCurrentMatrix--; - if (sCurrentMatrix < sMatrixStack) { - __assert("Matrix_now >= Matrix_stack", "../sys_matrix.c", 176); - } + ASSERT(sCurrentMatrix >= sMatrixStack, "Matrix_now >= Matrix_stack", "../sys_matrix.c", 176); } void Matrix_Get(MtxF* dest) { diff --git a/src/code/z_actor.c b/src/code/z_actor.c index aec121001d..c3e445f8cc 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -1997,10 +1997,8 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) { player = PLAYER; if (0) { - // This assert is optimized out but it exists due to its presence in rodata - if (gMaxActorId != ACTOR_ID_MAX) { - __assert("MaxProfile == ACTOR_DLF_MAX", "../z_actor.c", UNK_LINE); - } + // This ASSERT is optimized out but it exists due to its presence in rodata + ASSERT(gMaxActorId == ACTOR_ID_MAX, "MaxProfile == ACTOR_DLF_MAX", "../z_actor.c", UNK_LINE); } sp74 = NULL; @@ -2390,9 +2388,8 @@ void func_800315AC(GlobalContext* globalCtx, ActorContext* actorCtx) { if ((actor->flags & 0x80) && ((globalCtx->roomCtx.curRoom.showInvisActors == 0) || (globalCtx->actorCtx.unk_03 != 0) || (actor->room != globalCtx->roomCtx.curRoom.num))) { - if (invisibleActorCounter >= INVISIBLE_ACTOR_MAX) { - __assert("invisible_actor_counter < INVISIBLE_ACTOR_MAX", "../z_actor.c", 6464); - } + ASSERT(invisibleActorCounter < INVISIBLE_ACTOR_MAX, + "invisible_actor_counter < INVISIBLE_ACTOR_MAX", "../z_actor.c", 6464); invisibleActors[invisibleActorCounter] = actor; invisibleActorCounter++; } else { @@ -2632,10 +2629,7 @@ Actor* Actor_Spawn(ActorContext* actorCtx, GlobalContext* globalCtx, s16 actorId u32 overlaySize; overlayEntry = &gActorOverlayTable[actorId]; - - if (actorId >= ACTOR_ID_MAX) { - __assert("profile < ACTOR_DLF_MAX", "../z_actor.c", 6883); - } + ASSERT(actorId < ACTOR_ID_MAX, "profile < ACTOR_DLF_MAX", "../z_actor.c", 6883); name = overlayEntry->name != NULL ? overlayEntry->name : ""; overlaySize = (u32)overlayEntry->vramEnd - (u32)overlayEntry->vramStart; @@ -2666,9 +2660,7 @@ Actor* Actor_Spawn(ActorContext* actorCtx, GlobalContext* globalCtx, s16 actorId } } else { if (overlayEntry->allocType & ALLOCTYPE_ABSOLUTE) { - if (overlaySize > AM_FIELD_SIZE) { - __assert("actor_segsize <= AM_FIELD_SIZE", "../z_actor.c", 6934); - } + ASSERT(overlaySize <= AM_FIELD_SIZE, "actor_segsize <= AM_FIELD_SIZE", "../z_actor.c", 6934); if (actorCtx->absoluteSpace == NULL) { // Translates to: "AMF: ABSOLUTE MAGIC FIELD" @@ -2732,9 +2724,7 @@ Actor* Actor_Spawn(ActorContext* actorCtx, GlobalContext* globalCtx, s16 actorId return NULL; } - if (overlayEntry->nbLoaded >= 255) { - __assert("actor_dlftbl->clients < 255", "../z_actor.c", 7031); - } + ASSERT(overlayEntry->nbLoaded < 255, "actor_dlftbl->clients < 255", "../z_actor.c", 7031); overlayEntry->nbLoaded++; @@ -2873,14 +2863,8 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, GlobalContext* globalC osSyncPrintf("オーバーレイではありません\n"); } } else { - if (overlayEntry->loadedRamAddr == NULL) { - __assert("actor_dlftbl->allocp != NULL", "../z_actor.c", 7251); - } - - if (overlayEntry->nbLoaded <= 0) { - __assert("actor_dlftbl->clients > 0", "../z_actor.c", 7252); - } - + ASSERT(overlayEntry->loadedRamAddr != NULL, "actor_dlftbl->allocp != NULL", "../z_actor.c", 7251); + ASSERT(overlayEntry->nbLoaded > 0, "actor_dlftbl->clients > 0", "../z_actor.c", 7252); overlayEntry->nbLoaded--; Actor_FreeOverlay(overlayEntry); } diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index 1ab7e228a4..e1bdcc61c0 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -85,8 +85,7 @@ void SSNodeList_SetSSListHead(SSNodeList* nodeList, SSList* ssList, s16* polyId) void DynaSSNodeList_SetSSListHead(DynaSSNodeList* nodeList, SSList* ssList, s16* polyId) { u16 newNodeId = DynaSSNodeList_GetNextNodeIdx(nodeList); - (newNodeId != SS_NULL) ? (void)0 : __assert("new_node != SS_NULL", "../z_bgcheck.c", 1776); - + ASSERT(newNodeId != SS_NULL, "new_node != SS_NULL", "../z_bgcheck.c", 1776); SSNode_SetValue(&nodeList->tbl[newNodeId], polyId, ssList->head); ssList->head = newNodeId; } @@ -105,7 +104,7 @@ void DynaSSNodeList_Initialize(GlobalContext* globalCtx, DynaSSNodeList* nodeLis void DynaSSNodeList_Alloc(GlobalContext* globalCtx, DynaSSNodeList* nodeList, s32 max) { nodeList->tbl = THA_AllocEndAlign(&globalCtx->state.tha, max * sizeof(SSNode), -2); - (nodeList->tbl != NULL) ? (void)0 : __assert("psst->tbl != NULL", "../z_bgcheck.c", 1811); + ASSERT(nodeList->tbl != NULL, "psst->tbl != NULL", "../z_bgcheck.c", 1811); nodeList->max = max; nodeList->count = 0; @@ -699,7 +698,7 @@ s32 BgCheck_SphVsStaticWall(StaticLookup* lookup, CollisionContext* colCtx, u16 } } - (!IS_ZERO(normalXZ)) ? (void)0 : __assert("!IS_ZERO(ac_size)", "../z_bgcheck.c", 2854); + ASSERT(!IS_ZERO(normalXZ), "!IS_ZERO(ac_size)", "../z_bgcheck.c", 2854); invNormalXZ = 1.0f / normalXZ; temp_f16 = fabsf(nz) * invNormalXZ; @@ -780,7 +779,7 @@ s32 BgCheck_SphVsStaticWall(StaticLookup* lookup, CollisionContext* colCtx, u16 } } - (!IS_ZERO(normalXZ)) ? (void)0 : __assert("!IS_ZERO(ac_size)", "../z_bgcheck.c", 2964); + ASSERT(!IS_ZERO(normalXZ), "!IS_ZERO(ac_size)", "../z_bgcheck.c", 2964); invNormalXZ = 1.0f / normalXZ; temp_f16 = fabsf(nx) * invNormalXZ; @@ -2407,9 +2406,11 @@ void SSNodeList_Alloc(GlobalContext* globalCtx, SSNodeList* this, s32 tblMax, s3 this->count = 0; this->tbl = THA_AllocEndAlign(&globalCtx->state.tha, tblMax * sizeof(SSNode), -2); - (this->tbl != NULL) ? (void)0 : __assert("this->short_slist_node_tbl != NULL", "../z_bgcheck.c", 5975); + ASSERT(this->tbl != NULL, "this->short_slist_node_tbl != NULL", "../z_bgcheck.c", 5975); + this->polyCheckTbl = GameState_Alloc(&globalCtx->state, numPolys, "../z_bgcheck.c", 5979); - (this->polyCheckTbl != NULL) ? (void)0 : __assert("this->polygon_check != NULL", "../z_bgcheck.c", 5981); + + ASSERT(this->polyCheckTbl != NULL, "this->polygon_check != NULL", "../z_bgcheck.c", 5981); } /** @@ -2417,11 +2418,10 @@ void SSNodeList_Alloc(GlobalContext* globalCtx, SSNodeList* this, s32 tblMax, s3 */ SSNode* SSNodeList_GetNextNode(SSNodeList* this) { SSNode* result = &this->tbl[this->count]; - this->count++; - (this->count < this->max) - ? (void)0 - : __assert("this->short_slist_node_last_index < this->short_slist_node_size", "../z_bgcheck.c", 5998); + this->count++; + ASSERT(this->count < this->max, "this->short_slist_node_last_index < this->short_slist_node_size", "../z_bgcheck.c", + 5998); if (!(this->count < this->max)) { return NULL; } @@ -2434,7 +2434,7 @@ SSNode* SSNodeList_GetNextNode(SSNodeList* this) { u16 SSNodeList_GetNextNodeIdx(SSNodeList* this) { u16 new_index = this->count++; - (new_index < this->max) ? (void)0 : __assert("new_index < this->short_slist_node_size", "../z_bgcheck.c", 6021); + ASSERT(new_index < this->max, "new_index < this->short_slist_node_size", "../z_bgcheck.c", 6021); return new_index; } @@ -2540,7 +2540,7 @@ void DynaPoly_NullPolyList(CollisionPoly** polyList) { */ void DynaPoly_AllocPolyList(GlobalContext* globalCtx, CollisionPoly** polyList, s32 numPolys) { *polyList = THA_AllocEndAlign(&globalCtx->state.tha, numPolys * sizeof(CollisionPoly), -2); - (*polyList != NULL) ? (void)0 : __assert("ptbl->pbuf != NULL", "../z_bgcheck.c", 6247); + ASSERT(*polyList != NULL, "ptbl->pbuf != NULL", "../z_bgcheck.c", 6247); } /** @@ -2555,7 +2555,7 @@ void DynaPoly_NullVtxList(Vec3s** vtxList) { */ void DynaPoly_AllocVtxList(GlobalContext* globalCtx, Vec3s** vtxList, s32 numVtx) { *vtxList = THA_AllocEndAlign(&globalCtx->state.tha, numVtx * sizeof(Vec3s), -2); - (*vtxList != NULL) ? (void)0 : __assert("ptbl->pbuf != NULL", "../z_bgcheck.c", 6277); + ASSERT(*vtxList != NULL, "ptbl->pbuf != NULL", "../z_bgcheck.c", 6277); } /** @@ -2772,13 +2772,10 @@ void DynaPoly_ExpandSRT(GlobalContext* globalCtx, DynaCollisionContext* dyna, s3 *vtxStartIndex + pbgdata->nbVertices, dyna->vtxListMax); } - (dyna->polyListMax >= *polyStartIndex + pbgdata->nbPolygons) - ? (void)0 - : __assert("pdyna_poly_info->poly_num >= *pstart_poly_index + pbgdata->poly_num", "../z_bgcheck.c", 6687); - - (dyna->vtxListMax >= *vtxStartIndex + pbgdata->nbVertices) - ? (void)0 - : __assert("pdyna_poly_info->vert_num >= *pstart_vert_index + pbgdata->vtx_num", "../z_bgcheck.c", 6688); + ASSERT(dyna->polyListMax >= *polyStartIndex + pbgdata->nbPolygons, + "pdyna_poly_info->poly_num >= *pstart_poly_index + pbgdata->poly_num", "../z_bgcheck.c", 6687); + ASSERT(dyna->vtxListMax >= *vtxStartIndex + pbgdata->nbVertices, + "pdyna_poly_info->vert_num >= *pstart_vert_index + pbgdata->vtx_num", "../z_bgcheck.c", 6688); if (!(dyna->bitFlag & DYNAPOLY_INVALIDATE_LOOKUP) && (BgActor_IsTransformUnchanged(&dyna->bgActors[bgId]) == true)) { @@ -3209,7 +3206,7 @@ s32 BgCheck_SphVsDynaWallInBgActor(CollisionContext* colCtx, u16 xpFlags, DynaCo poly = &dyna->polyList[polyId]; CollisionPoly_GetNormalF(poly, &nx, &ny, &nz); normalXZ = sqrtf(SQ(nx) + SQ(nz)); - (!IS_ZERO(normalXZ)) ? (void)0 : __assert("!IS_ZERO(ac_size)", "../z_bgcheck.c", 7382); + ASSERT(!IS_ZERO(normalXZ), "!IS_ZERO(ac_size)", "../z_bgcheck.c", 7382); planeDist = Math3D_DistPlaneToPos(nx, ny, nz, poly->dist, &resultPos); if (radius < fabsf(planeDist) || COLPOLY_VIA_FLAG_TEST(poly->flags_vIA, xpFlags)) { @@ -3282,7 +3279,7 @@ s32 BgCheck_SphVsDynaWallInBgActor(CollisionContext* colCtx, u16 xpFlags, DynaCo poly = &dyna->polyList[polyId]; CollisionPoly_GetNormalF(poly, &nx, &ny, &nz); normalXZ = sqrtf(SQ(nx) + SQ(nz)); - (!IS_ZERO(normalXZ)) ? (void)0 : __assert("!IS_ZERO(ac_size)", "../z_bgcheck.c", 7489); + ASSERT(!IS_ZERO(normalXZ), "!IS_ZERO(ac_size)", "../z_bgcheck.c", 7489); planeDist = Math3D_DistPlaneToPos(nx, ny, nz, poly->dist, &resultPos); if (radius < fabsf(planeDist) || COLPOLY_VIA_FLAG_TEST(poly->flags_vIA, xpFlags)) { diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c index 4bc7b5919b..1790f6864d 100644 --- a/src/code/z_collision_check.c +++ b/src/code/z_collision_check.c @@ -70,9 +70,7 @@ void Collider_DrawPoly(GraphicsContext* gfxCtx, Vec3f* vA, Vec3f* vB, Vec3f* vC, gDPPipeSync(POLY_OPA_DISP++); vtxTbl = Graph_Alloc(gfxCtx, 3 * sizeof(Vtx)); - if (vtxTbl == NULL) { - __assert("vtx_tbl != NULL", "../z_collision_check.c", 726); - } + ASSERT(vtxTbl != NULL, "vtx_tbl != NULL", "../z_collision_check.c", 726); vtxTbl[0].n.ob[0] = vA->x; vtxTbl[0].n.ob[1] = vA->y; @@ -457,10 +455,8 @@ s32 Collider_SetJntSph(GlobalContext* globalCtx, ColliderJntSph* dest, Actor* ac Collider_SetBase(globalCtx, &dest->base, actor, &src->base); dest->count = src->count; dest->elements = elements; + ASSERT(dest->elements != NULL, "pclobj_jntsph->elem_tbl != NULL", "../z_collision_check.c", 1603); - if (dest->elements == NULL) { - __assert("pclobj_jntsph->elem_tbl != NULL", "../z_collision_check.c", 1603); - } for (destElem = dest->elements, srcElem = src->elements; destElem < dest->elements + dest->count; destElem++, srcElem++) { Collider_InitJntSphElement(globalCtx, destElem); @@ -798,10 +794,7 @@ s32 Collider_SetTris(GlobalContext* globalCtx, ColliderTris* dest, Actor* actor, Collider_SetBase(globalCtx, &dest->base, actor, &src->base); dest->count = src->count; dest->elements = elements; - - if (dest->elements == NULL) { - __assert("pclobj_tris->elem_tbl != NULL", "../z_collision_check.c", 2258); - } + ASSERT(dest->elements != NULL, "pclobj_tris->elem_tbl != NULL", "../z_collision_check.c", 2258); for (destElem = dest->elements, srcElem = src->elements; destElem < dest->elements + dest->count; destElem++, srcElem++) { @@ -1192,9 +1185,7 @@ s32 CollisionCheck_SetAT(GlobalContext* globalCtx, CollisionCheckContext* colChk if (FrameAdvance_IsEnabled(globalCtx) == true) { return -1; } - if (!(collider->shape <= COLSHAPE_QUAD)) { - __assert("pcl_obj->data_type <= CL_DATA_LBL_SWRD", "../z_collision_check.c", 2997); - } + ASSERT(collider->shape <= COLSHAPE_QUAD, "pcl_obj->data_type <= CL_DATA_LBL_SWRD", "../z_collision_check.c", 2997); sATResetFuncs[collider->shape](globalCtx, collider); if (collider->actor != NULL && collider->actor->update == NULL) { return -1; @@ -1219,10 +1210,7 @@ s32 CollisionCheck_SetAT(GlobalContext* globalCtx, CollisionCheckContext* colChk */ s32 CollisionCheck_SetAT_SAC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider, s32 index) { - - if (!(collider->shape <= COLSHAPE_QUAD)) { - __assert("pcl_obj->data_type <= CL_DATA_LBL_SWRD", "../z_collision_check.c", 3037); - } + ASSERT(collider->shape <= COLSHAPE_QUAD, "pcl_obj->data_type <= CL_DATA_LBL_SWRD", "../z_collision_check.c", 3037); if (FrameAdvance_IsEnabled(globalCtx) == true) { return -1; } @@ -1266,9 +1254,7 @@ s32 CollisionCheck_SetAC(GlobalContext* globalCtx, CollisionCheckContext* colChk if (FrameAdvance_IsEnabled(globalCtx) == true) { return -1; } - if (!(collider->shape <= COLSHAPE_QUAD)) { - __assert("pcl_obj->data_type <= CL_DATA_LBL_SWRD", "../z_collision_check.c", 3114); - } + ASSERT(collider->shape <= COLSHAPE_QUAD, "pcl_obj->data_type <= CL_DATA_LBL_SWRD", "../z_collision_check.c", 3114); sACResetFuncs[collider->shape](globalCtx, collider); if (collider->actor != NULL && collider->actor->update == NULL) { return -1; @@ -1293,9 +1279,7 @@ s32 CollisionCheck_SetAC(GlobalContext* globalCtx, CollisionCheckContext* colChk */ s32 CollisionCheck_SetAC_SAC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Collider* collider, s32 index) { - if (!(collider->shape <= COLSHAPE_QUAD)) { - __assert("pcl_obj->data_type <= CL_DATA_LBL_SWRD", "../z_collision_check.c", 3153); - } + ASSERT(collider->shape <= COLSHAPE_QUAD, "pcl_obj->data_type <= CL_DATA_LBL_SWRD", "../z_collision_check.c", 3153); if (FrameAdvance_IsEnabled(globalCtx) == true) { return -1; } @@ -1339,9 +1323,9 @@ s32 CollisionCheck_SetOC(GlobalContext* globalCtx, CollisionCheckContext* colChk if (FrameAdvance_IsEnabled(globalCtx) == true) { return -1; } - if (!(collider->shape <= COLSHAPE_QUAD)) { - __assert("pcl_obj->data_type <= CL_DATA_LBL_SWRD", "../z_collision_check.c", 3229); - } + + ASSERT(collider->shape <= COLSHAPE_QUAD, "pcl_obj->data_type <= CL_DATA_LBL_SWRD", "../z_collision_check.c", 3229); + sOCResetFuncs[collider->shape](globalCtx, collider); if (collider->actor != NULL && collider->actor->update == NULL) { return -1; @@ -1369,9 +1353,7 @@ s32 CollisionCheck_SetOC_SAC(GlobalContext* globalCtx, CollisionCheckContext* co if (FrameAdvance_IsEnabled(globalCtx) == true) { return -1; } - if (!(collider->shape <= COLSHAPE_QUAD)) { - __assert("pcl_obj->data_type <= CL_DATA_LBL_SWRD", "../z_collision_check.c", 3274); - } + ASSERT(collider->shape <= COLSHAPE_QUAD, "pcl_obj->data_type <= CL_DATA_LBL_SWRD", "../z_collision_check.c", 3274); sOCResetFuncs[collider->shape](globalCtx, collider); if (collider->actor != NULL && collider->actor->update == NULL) { return -1; @@ -3009,9 +2991,8 @@ void CollisionCheck_ApplyDamage(GlobalContext* globalCtx, CollisionCheckContext* if (!(info->bumperFlags & BUMP_HIT) || info->bumperFlags & BUMP_NO_DAMAGE) { return; } - if (info->acHitInfo == NULL) { - __assert("pclobj_elem->ac_hit_elem != NULL", "../z_collision_check.c", 6493); - } + + ASSERT(info->acHitInfo != NULL, "pclobj_elem->ac_hit_elem != NULL", "../z_collision_check.c", 6493); tbl = collider->actor->colChkInfo.damageTable; if (tbl == NULL) { damage = (f32)info->acHitInfo->toucher.damage - info->bumper.defense; diff --git a/src/code/z_construct.c b/src/code/z_construct.c index d4fdd05ff6..7191a5ab41 100644 --- a/src/code/z_construct.c +++ b/src/code/z_construct.c @@ -36,10 +36,7 @@ void func_801109B0(GlobalContext* globalCtx) { osSyncPrintf("parameter->parameterSegment=%x\n", interfaceCtx->parameterSegment); - if (interfaceCtx->parameterSegment == NULL) { - __assert("parameter->parameterSegment != NULL", "../z_construct.c", 161); - } - + ASSERT(interfaceCtx->parameterSegment != NULL, "parameter->parameterSegment != NULL", "../z_construct.c", 161); DmaMgr_SendRequest1(interfaceCtx->parameterSegment, (u32)_parameter_staticSegmentRomStart, parameterSize, "../z_construct.c", 162); @@ -49,9 +46,7 @@ void func_801109B0(GlobalContext* globalCtx) { osSyncPrintf("DOアクション テクスチャ初期=%x\n", 0x480); osSyncPrintf("parameter->do_actionSegment=%x\n", interfaceCtx->do_actionSegment); - if (interfaceCtx->do_actionSegment == NULL) { - __assert("parameter->do_actionSegment != NULL", "../z_construct.c", 169); - } + ASSERT(interfaceCtx->do_actionSegment != NULL, "parameter->do_actionSegment != NULL", "../z_construct.c", 169); if (gSaveContext.language == 0) { do_actionOffset = 0; @@ -81,9 +76,7 @@ void func_801109B0(GlobalContext* globalCtx) { osSyncPrintf("アイコンアイテム テクスチャ初期=%x\n", 0x4000); osSyncPrintf("parameter->icon_itemSegment=%x\n", interfaceCtx->icon_itemSegment); - if (interfaceCtx->icon_itemSegment == NULL) { - __assert("parameter->icon_itemSegment != NULL", "../z_construct.c", 193); - } + ASSERT(interfaceCtx->icon_itemSegment != NULL, "parameter->icon_itemSegment != NULL", "../z_construct.c", 193); osSyncPrintf("Register_Item[%x, %x, %x, %x]\n", gSaveContext.equips.buttonItems[0], gSaveContext.equips.buttonItems[1], gSaveContext.equips.buttonItems[2], @@ -194,10 +187,7 @@ void func_80110F68(GlobalContext* globalCtx) { // Translates to: "Textbox game_alloc=%x" osSyncPrintf("吹き出しgame_alloc=%x\n", 0x2200); - - if (msgCtx->textboxSegment == NULL) { - __assert("message->fukidashiSegment != NULL", "../z_construct.c", 352); - } + ASSERT(msgCtx->textboxSegment != NULL, "message->fukidashiSegment != NULL", "../z_construct.c", 352); Font_LoadOrderedFont(&globalCtx->msgCtx.font); diff --git a/src/code/z_eff_blure.c b/src/code/z_eff_blure.c index 423fdbaf25..734f44bdbc 100644 --- a/src/code/z_eff_blure.c +++ b/src/code/z_eff_blure.c @@ -542,7 +542,7 @@ void EffectBlure_DrawElemHermiteInterpolation(EffectBlure* this, EffectBlureElem Vec3f sp118; Vec3f sp10C; - (index - 1 >= 0) ? (void)0 : __assert("index - 1 >= 0", "../z_eff_blure.c", 1005); + ASSERT(index - 1 >= 0, "index - 1 >= 0", "../z_eff_blure.c", 1005); ratio = (f32)(elem - 1)->timer / (f32)this->elemDuration; EffectBlure_GetComputedValues(this, index - 1, ratio, &sp1EC, &sp1E4, &sp1DC, &sp1D8); @@ -562,8 +562,7 @@ void EffectBlure_DrawElemHermiteInterpolation(EffectBlure* this, EffectBlureElem Vec3f sp100; Vec3f spF4; - (index + 2 < this->numElements) ? (void)0 - : __assert("index + 2 < this2->now_edge_num", "../z_eff_blure.c", 1032); + ASSERT(index + 2 < this->numElements, "index + 2 < this2->now_edge_num", "../z_eff_blure.c", 1032); ratio = (f32)(elem + 2)->timer / (f32)this->elemDuration; EffectBlure_GetComputedValues(this, index + 2, ratio, &sp1EC, &sp1E4, &sp1DC, &sp1D8); diff --git a/src/code/z_effect_soft_sprite.c b/src/code/z_effect_soft_sprite.c index 7183152f9c..22e0065ba8 100644 --- a/src/code/z_effect_soft_sprite.c +++ b/src/code/z_effect_soft_sprite.c @@ -16,9 +16,7 @@ void EffectSs_InitInfo(GlobalContext* globalCtx, s32 tableSize) { sEffectSsInfo.table = GameState_Alloc(&globalCtx->state, tableSize * sizeof(EffectSs), "../z_effect_soft_sprite.c", 289); - if (sEffectSsInfo.table == NULL) { - __assert("EffectSS2Info.data_table != NULL", "../z_effect_soft_sprite.c", 290); - } + ASSERT(sEffectSsInfo.table != NULL, "EffectSS2Info.data_table != NULL", "../z_effect_soft_sprite.c", 290); sEffectSsInfo.searchStartIndex = 0; sEffectSsInfo.tableSize = tableSize; @@ -175,9 +173,7 @@ void EffectSs_Spawn(GlobalContext* globalCtx, s32 type, s32 priority, void* init overlayEntry = &gEffectSsOverlayTable[type]; - if (type >= EFFECT_SS_TYPE_MAX) { - __assert("type < EFFECT_SS2_TYPE_LAST_LABEL", "../z_effect_soft_sprite.c", 556); - } + ASSERT(type < EFFECT_SS_TYPE_MAX, "type < EFFECT_SS2_TYPE_LAST_LABEL", "../z_effect_soft_sprite.c", 556); if (EffectSs_FindSlot(priority, &index) != 0) { // Abort because we couldn't find a suitable slot to add this effect in diff --git a/src/code/z_elf_message.c b/src/code/z_elf_message.c index 90a27368ef..481732170e 100644 --- a/src/code/z_elf_message.c +++ b/src/code/z_elf_message.c @@ -47,7 +47,7 @@ u32 ElfMessage_CheckCondition(ElfMessage* msg) { // "Unplanned conditions" LOG_STRING("企画外 条件", "../z_elf_message.c", 156); - __assert("0", "../z_elf_message.c", 157); + ASSERT(0, "0", "../z_elf_message.c", 157); return false; } @@ -131,7 +131,7 @@ u16 ElfMessage_GetTextFromMsgs(ElfMessage* msg) { default: // "Unplanned conditions" LOG_STRING("企画外 条件", "../z_elf_message.c", 281); - __assert("0", "../z_elf_message.c", 282); + ASSERT(0, "0", "../z_elf_message.c", 282); } msg++; } diff --git a/src/code/z_fcurve_data_skelanime.c b/src/code/z_fcurve_data_skelanime.c index 243c66c6b9..fb8ed97bd6 100644 --- a/src/code/z_fcurve_data_skelanime.c +++ b/src/code/z_fcurve_data_skelanime.c @@ -21,9 +21,7 @@ s32 SkelCurve_Init(GlobalContext* globalCtx, SkelAnimeCurve* skelCurve, SkelCurv skelCurve->transforms = ZeldaArena_MallocDebug(sizeof(*skelCurve->transforms) * skelCurve->limbCount, "../z_fcurve_data_skelanime.c", 125); - if (skelCurve->transforms == NULL) { - __assert("this->now_joint != NULL", "../z_fcurve_data_skelanime.c", 127); - } + ASSERT(skelCurve->transforms != NULL, "this->now_joint != NULL", "../z_fcurve_data_skelanime.c", 127); do { skelCurve->animCurFrame = 0.0f; } while (0); diff --git a/src/code/z_horse.c b/src/code/z_horse.c index 73c70a285c..12f69871cb 100644 --- a/src/code/z_horse.c +++ b/src/code/z_horse.c @@ -51,9 +51,8 @@ void func_8006D0EC(GlobalContext* globalCtx, Player* player) { player->rideActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, player->actor.world.pos.x, player->actor.world.pos.y, player->actor.world.pos.z, player->actor.shape.rot.x, player->actor.shape.rot.y, player->actor.shape.rot.z, 9); - if (player->rideActor == NULL) { - __assert("player->ride.actor != NULL", "../z_horse.c", 343); - } + + ASSERT(player->rideActor != NULL, "player->ride.actor != NULL", "../z_horse.c", 343); Actor_MountHorse(globalCtx, player, player->rideActor); func_8002DE74(globalCtx, player); @@ -71,9 +70,7 @@ void func_8006D0EC(GlobalContext* globalCtx, Player* player) { } else if ((gSaveContext.entranceIndex == 1230) && (gSaveContext.eventChkInf[1] & 0x100)) { Actor* horseActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, -25.0f, 0.0f, -1600.0f, 0, -0x4000, 0, 1); - if (horseActor == NULL) { - __assert("horse_actor != NULL", "../z_horse.c", 389); - } + ASSERT(horseActor != NULL, "horse_actor != NULL", "../z_horse.c", 389); } else if ((globalCtx->sceneNum == gSaveContext.horseData.scene) && (Flags_GetEventChkInf(0x18) != 0 || DREG(1) != 0)) { // Translates to: "SET BY EXISTENCE OF HORSE %d %d %d" @@ -84,10 +81,7 @@ void func_8006D0EC(GlobalContext* globalCtx, Player* player) { Actor* horseActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, gSaveContext.horseData.pos.x, gSaveContext.horseData.pos.y, gSaveContext.horseData.pos.z, 0, gSaveContext.horseData.angle, 0, 1); - if (horseActor == NULL) { - __assert("horse_actor != NULL", "../z_horse.c", 414); - } - + ASSERT(horseActor != NULL, "horse_actor != NULL", "../z_horse.c", 414); if (globalCtx->sceneNum == SCENE_SPOT12) { horseActor->room = -1; } @@ -101,9 +95,7 @@ void func_8006D0EC(GlobalContext* globalCtx, Player* player) { } else if ((globalCtx->sceneNum == SCENE_SPOT20) && !Flags_GetEventChkInf(0x18) && (DREG(1) == 0)) { Actor* horseActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, 0.0f, 0.0f, -500.0f, 0, 0, 0, 1); - if (horseActor == NULL) { - __assert("horse_actor != NULL", "../z_horse.c", 443); - } + ASSERT(horseActor != NULL, "horse_actor != NULL", "../z_horse.c", 443); } else if (Flags_GetEventChkInf(0x18) || (DREG(1) != 0)) { for (i = 0; i < ARRAY_COUNT(horseSpawns); i++) { HorseSpawn* horseSpawn = &horseSpawns[i]; @@ -111,10 +103,7 @@ void func_8006D0EC(GlobalContext* globalCtx, Player* player) { Actor* horseActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, horseSpawn->pos.x, horseSpawn->pos.y, horseSpawn->pos.z, 0, horseSpawn->angle, 0, horseSpawn->type); - if (horseActor == NULL) { - __assert("horse_actor != NULL", "../z_horse.c", 466); - } - + ASSERT(horseActor != NULL, "horse_actor != NULL", "../z_horse.c", 466); if (globalCtx->sceneNum == SCENE_SPOT12) { horseActor->room = -1; } @@ -164,9 +153,7 @@ void func_8006D684(GlobalContext* globalCtx, Player* player) { player->rideActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, spawnPos.x, spawnPos.y, spawnPos.z, 0, player->actor.world.rot.y, 0, 7); - if (player->rideActor == NULL) { - __assert("player->ride.actor != NULL", "../z_horse.c", 561); - } + ASSERT(player->rideActor != NULL, "player->ride.actor != NULL", "../z_horse.c", 561); Actor_MountHorse(globalCtx, player, player->rideActor); func_8002DE74(globalCtx, player); @@ -175,9 +162,7 @@ void func_8006D684(GlobalContext* globalCtx, Player* player) { (Flags_GetEventChkInf(0x18) == 0) && (DREG(1) == 0)) { player->rideActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, 894.0f, 0.0f, -2084.0f, 0, -0x7FFF, 0, 5); - if (player->rideActor == NULL) { - __assert("player->ride.actor != NULL", "../z_horse.c", 582); - } + ASSERT(player->rideActor != NULL, "player->ride.actor != NULL", "../z_horse.c", 582); Actor_MountHorse(globalCtx, player, player->rideActor); func_8002DE74(globalCtx, player); @@ -207,9 +192,7 @@ void func_8006D684(GlobalContext* globalCtx, Player* player) { player->rideActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, D_8011F9B8[i].pos.x, D_8011F9B8[i].pos.y, D_8011F9B8[i].pos.z, 0, player->actor.world.rot.y, 0, D_8011F9B8[i].type); - if (player->rideActor == NULL) { - __assert("player->ride.actor != NULL", "../z_horse.c", 628); - } + ASSERT(player->rideActor != NULL, "player->ride.actor != NULL", "../z_horse.c", 628); Actor_MountHorse(globalCtx, player, player->rideActor); func_8002DE74(globalCtx, player); @@ -224,9 +207,7 @@ void func_8006D684(GlobalContext* globalCtx, Player* player) { player->rideActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, D_8011F9B8[i].pos.x, D_8011F9B8[i].pos.y, D_8011F9B8[i].pos.z, 0, D_8011F9B8[i].angle, 0, D_8011F9B8[i].type | temp); - if (player->rideActor == NULL) { - __assert("player->ride.actor != NULL", "../z_horse.c", 667); - } + ASSERT(player->rideActor != NULL, "player->ride.actor != NULL", "../z_horse.c", 667); player->actor.world.pos.x = D_8011F9B8[i].pos.x; player->actor.world.pos.y = D_8011F9B8[i].pos.y; diff --git a/src/code/z_jpeg.c b/src/code/z_jpeg.c index 9bea32d454..7751514878 100644 --- a/src/code/z_jpeg.c +++ b/src/code/z_jpeg.c @@ -218,10 +218,9 @@ s32 Jpeg_Decode(void* data, u16* zbuffer, JpegWork* workBuff, u32 workSize) { OSTime time2; time = osGetTime(); - if (workSize < - sizeof(JpegWork)) { // (?) I guess MB_SIZE=0x180, PROC_OF_MBS=5 which means unk_6C0 is not a part of JpegWork - __assert("worksize >= sizeof(JPEGWork) + MB_SIZE * (PROC_OF_MBS - 1)", "../z_jpeg.c", 527); - } + // (?) I guess MB_SIZE=0x180, PROC_OF_MBS=5 which means unk_6C0 is not a part of JpegWork + ASSERT(workSize >= sizeof(JpegWork), "worksize >= sizeof(JPEGWork) + MB_SIZE * (PROC_OF_MBS - 1)", "../z_jpeg.c", + 527); osCreateMesgQueue(&ctx.mq, &ctx.msg, 1); MsgEvent_SendNullTask(); diff --git a/src/code/z_map_exp.c b/src/code/z_map_exp.c index 93fbdbd238..d50e093e5f 100644 --- a/src/code/z_map_exp.c +++ b/src/code/z_map_exp.c @@ -235,9 +235,7 @@ void Map_Init(GlobalContext* globalCtx) { // Translates to "MAP TEXTURE INITIALIZATION scene_data_ID=%d mapSegment=%x" osSyncPrintf("\n\n\nMAP テクスチャ初期化 scene_data_ID=%d\nmapSegment=%x\n\n", globalCtx->sceneNum, interfaceCtx->mapSegment, globalCtx); - if (interfaceCtx->mapSegment == NULL) { - __assert("parameter->mapSegment != NULL", "../z_map_exp.c", 459); - } + ASSERT(interfaceCtx->mapSegment != NULL, "parameter->mapSegment != NULL", "../z_map_exp.c", 459); switch (globalCtx->sceneNum) { case SCENE_SPOT00: diff --git a/src/code/z_play.c b/src/code/z_play.c index 23ed6257b3..b9545f4dfd 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -18,9 +18,7 @@ void func_800BC450(GlobalContext* globalCtx) { } void func_800BC490(GlobalContext* globalCtx, s16 point) { - if (!(point == 1 || point == 2)) { - __assert("point == 1 || point == 2", "../z_play.c", 2160); - } + ASSERT(point == 1 || point == 2, "point == 1 || point == 2", "../z_play.c", 2160); globalCtx->unk_1242B = point; @@ -1469,9 +1467,8 @@ void Gameplay_SpawnScene(GlobalContext* globalCtx, s32 sceneNum, s32 spawn) { globalCtx->sceneSegment = Gameplay_LoadFile(globalCtx, &scene->sceneFile); scene->unk_13 = 0; - if (globalCtx->sceneSegment == NULL) { - __assert("this->sceneSegment != NULL", "../z_play.c", 4960); - } + ASSERT(globalCtx->sceneSegment != NULL, "this->sceneSegment != NULL", "../z_play.c", 4960); + gSegments[2] = VIRTUAL_TO_PHYSICAL(globalCtx->sceneSegment); Gameplay_InitScene(globalCtx, spawn); diff --git a/src/code/z_rcp.c b/src/code/z_rcp.c index 6b0c7f82fc..c7385c0f01 100644 --- a/src/code/z_rcp.c +++ b/src/code/z_rcp.c @@ -777,10 +777,7 @@ Gfx* Gfx_SetFog(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 n, s32 f) { if (f == n) { f++; } - - if (n == f) { - __assert("n != f", "../z_rcp.c", 1155); - } + ASSERT(n != f, "n != f", "../z_rcp.c", 1155); gDPSetFogColor(gfx++, r, g, b, a); @@ -801,10 +798,7 @@ Gfx* Gfx_SetFogWithSync(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 n, s32 f) { if (f == n) { f++; } - - if (n == f) { - __assert("n != f", "../z_rcp.c", 1187); - } + ASSERT(n != f, "n != f", "../z_rcp.c", 1187); gDPPipeSync(gfx++); gDPSetFogColor(gfx++, r, g, b, a); diff --git a/src/code/z_room.c b/src/code/z_room.c index 6d0d6c4b62..2c8f0106d6 100644 --- a/src/code/z_room.c +++ b/src/code/z_room.c @@ -121,9 +121,7 @@ void func_80095D04(GlobalContext* globalCtx, Room* room, u32 flags) { polygonDlist = SEGMENTED_TO_VIRTUAL(polygon2->start); spA4 = spB8; - if (polygon2->num > SHAPE_SORT_MAX) { - __assert("polygon2->num <= SHAPE_SORT_MAX", "../z_room.c", 317); - } + ASSERT(polygon2->num <= SHAPE_SORT_MAX, "polygon2->num <= SHAPE_SORT_MAX", "../z_room.c", 317); sp78 = polygonDlist; for (sp9C = 0; sp9C < polygon2->num; sp9C++, polygonDlist++) { @@ -565,9 +563,7 @@ s32 func_8009728C(GlobalContext* globalCtx, RoomContext* roomCtx, s32 roomNum) { roomCtx->curRoom.segment = NULL; roomCtx->status = 1; - if (roomNum >= globalCtx->nbRooms) { - __assert("read_room_ID < game_play->room_rom_address.num", "../z_room.c", 1009); - } + ASSERT(roomNum < globalCtx->nbRooms, "read_room_ID < game_play->room_rom_address.num", "../z_room.c", 1009); size = globalCtx->roomList[roomNum].vromEnd - globalCtx->roomList[roomNum].vromStart; roomCtx->unk_34 = (void*)ALIGN16((s32)roomCtx->bufPtrs[roomCtx->unk_30] - ((size + 8) * roomCtx->unk_30 + 7)); @@ -608,9 +604,8 @@ s32 func_800973FC(GlobalContext* globalCtx, RoomContext* roomCtx) { void Room_Draw(GlobalContext* globalCtx, Room* room, u32 flags) { if (room->segment != NULL) { gSegments[3] = VIRTUAL_TO_PHYSICAL(room->segment); - if (room->mesh->polygon.type >= ARRAY_COUNTU(sRoomDrawHandlers)) { - __assert("this->ground_shape->polygon.type < number(Room_Draw_Proc)", "../z_room.c", 1125); - } + ASSERT(room->mesh->polygon.type < ARRAY_COUNTU(sRoomDrawHandlers), + "this->ground_shape->polygon.type < number(Room_Draw_Proc)", "../z_room.c", 1125); sRoomDrawHandlers[room->mesh->polygon.type](globalCtx, room, flags); } } diff --git a/src/code/z_scene.c b/src/code/z_scene.c index 0903ef29ac..894b2fee81 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -14,11 +14,10 @@ s32 Object_Spawn(ObjectContext* objectCtx, s16 objectId) { osSyncPrintf("num=%d adrs=%x end=%x\n", objectCtx->num, (s32)objectCtx->status[objectCtx->num].segment + size, objectCtx->spaceEnd); - if (!((objectCtx->num < OBJECT_EXCHANGE_BANK_MAX) && - (((s32)objectCtx->status[objectCtx->num].segment + size) < (u32)objectCtx->spaceEnd))) { - __assert("this->num < OBJECT_EXCHANGE_BANK_MAX && (this->status[this->num].Segment + size) < this->endSegment", - "../z_scene.c", 142); - } + ASSERT(((objectCtx->num < OBJECT_EXCHANGE_BANK_MAX) && + (((s32)objectCtx->status[objectCtx->num].segment + size) < (u32)objectCtx->spaceEnd)), + "this->num < OBJECT_EXCHANGE_BANK_MAX && (this->status[this->num].Segment + size) < this->endSegment", + "../z_scene.c", 142); DmaMgr_SendRequest1(objectCtx->status[objectCtx->num].segment, gObjectTable[objectId].vromStart, size, "../z_scene.c", 145); @@ -151,9 +150,7 @@ void* func_800982FC(ObjectContext* objectCtx, s32 bankIndex, s16 objectId) { nextPtr = (void*)ALIGN16((s32)status->segment + size); if (1) {} // Necessary to match - if (nextPtr >= objectCtx->spaceEnd) { - __assert("nextptr < this->endSegment", "../z_scene.c", 381); - } + ASSERT(nextPtr < objectCtx->spaceEnd, "nextptr < this->endSegment", "../z_scene.c", 381); // Translates to: "OBJECT EXCHANGE FREE SIZE=%08x" osSyncPrintf("オブジェクト入れ替え空きサイズ=%08x\n", (s32)objectCtx->spaceEnd - (s32)nextPtr); @@ -294,9 +291,8 @@ void func_8009899C(GlobalContext* globalCtx, SceneCmd* cmd) { status++; } - if (cmd->objectList.num > OBJECT_EXCHANGE_BANK_MAX) { - __assert("scene_info->object_bank.num <= OBJECT_EXCHANGE_BANK_MAX", "../z_scene.c", 705); - } + ASSERT(cmd->objectList.num <= OBJECT_EXCHANGE_BANK_MAX, "scene_info->object_bank.num <= OBJECT_EXCHANGE_BANK_MAX", + "../z_scene.c", 705); if (1) {} diff --git a/src/code/z_skelanime.c b/src/code/z_skelanime.c index e06f291903..3365b384e2 100644 --- a/src/code/z_skelanime.c +++ b/src/code/z_skelanime.c @@ -1109,9 +1109,7 @@ void SkelAnime_InitLink(GlobalContext* globalCtx, SkelAnime* skelAnime, FlexSkel skelAnime->jointTable = ZeldaArena_MallocDebug(allocSize, "../z_skelanime.c", 2364); skelAnime->morphTable = ZeldaArena_MallocDebug(allocSize, "../z_skelanime.c", 2365); } else { - if (limbBufCount != limbCount) { - __assert("joint_buff_num == joint_num", "../z_skelanime.c", 2369); - } + ASSERT(limbBufCount == limbCount, "joint_buff_num == joint_num", "../z_skelanime.c", 2369); skelAnime->jointTable = (Vec3s*)ALIGN16((u32)jointTable); skelAnime->morphTable = (Vec3s*)ALIGN16((u32)morphTable); @@ -1432,9 +1430,7 @@ s32 SkelAnime_Init(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHeade skelAnime->morphTable = ZeldaArena_MallocDebug(skelAnime->limbCount * sizeof(*skelAnime->morphTable), "../z_skelanime.c", 2969); } else { - if (limbCount != skelAnime->limbCount) { - __assert("joint_buff_num == this->joint_num", "../z_skelanime.c", 2973); - } + ASSERT(limbCount == skelAnime->limbCount, "joint_buff_num == this->joint_num", "../z_skelanime.c", 2973); skelAnime->jointTable = jointTable; skelAnime->morphTable = morphTable; } @@ -1468,9 +1464,7 @@ s32 SkelAnime_InitFlex(GlobalContext* globalCtx, SkelAnime* skelAnime, FlexSkele skelAnime->morphTable = ZeldaArena_MallocDebug(skelAnime->limbCount * sizeof(*skelAnime->morphTable), "../z_skelanime.c", 3048); } else { - if (limbCount != skelAnime->limbCount) { - __assert("joint_buff_num == this->joint_num", "../z_skelanime.c", 3052); - } + ASSERT(limbCount == skelAnime->limbCount, "joint_buff_num == this->joint_num", "../z_skelanime.c", 3052); skelAnime->jointTable = jointTable; skelAnime->morphTable = morphTable; } diff --git a/src/code/z_skin_awb.c b/src/code/z_skin_awb.c index 121556b8b7..e5e43787a2 100644 --- a/src/code/z_skin_awb.c +++ b/src/code/z_skin_awb.c @@ -40,9 +40,8 @@ void func_800A663C(GlobalContext* globalCtx, PSkinAwb* skin, SkeletonHeader* ske skeleton = SEGMENTED_TO_VIRTUAL(skin->skeletonHeader->segment); limbCount = skin->skeletonHeader->limbCount; skin->avbTbl = ZeldaArena_MallocDebug(limbCount * sizeof(SkinAvb), "../z_skin_awb.c", 212); - if (skin->avbTbl == NULL) { - __assert("pskin_awb->avb_tbl != NULL", "../z_skin_awb.c", 214); - } + + ASSERT(skin->avbTbl != NULL, "pskin_awb->avb_tbl != NULL", "../z_skin_awb.c", 214); for (i = 0; i < limbCount; i++) { SkinAvb* avbEntry = &skin->avbTbl[i]; SkinLimb* limb = SEGMENTED_TO_VIRTUAL(skeleton[i]); @@ -57,13 +56,9 @@ void func_800A663C(GlobalContext* globalCtx, PSkinAwb* skin, SkeletonHeader* ske avbEntry->unk_0 = 0; avbEntry->buf[0] = ZeldaArena_MallocDebug(temp_s1->unk_0 * sizeof(Vtx), "../z_skin_awb.c", 235); - if (avbEntry->buf[0] == 0) { - __assert("psavb->buf[0] != NULL", "../z_skin_awb.c", 237); - } + ASSERT(avbEntry->buf[0] != NULL, "psavb->buf[0] != NULL", "../z_skin_awb.c", 237); avbEntry->buf[1] = ZeldaArena_MallocDebug(temp_s1->unk_0 * sizeof(Vtx), "../z_skin_awb.c", 240); - if (avbEntry->buf[1] == 0) { - __assert("psavb->buf[1] != NULL", "../z_skin_awb.c", 242); - } + ASSERT(avbEntry->buf[1] != NULL, "psavb->buf[1] != NULL", "../z_skin_awb.c", 242); func_800A6460(globalCtx, skin, i); } if (1) {} diff --git a/src/code/z_sram.c b/src/code/z_sram.c index 51caa2607f..a3134526b2 100644 --- a/src/code/z_sram.c +++ b/src/code/z_sram.c @@ -890,10 +890,7 @@ void Sram_InitSram(GameState* gameState, SramContext* sramCtx) { void Sram_Alloc(GameState* gameState, SramContext* sramCtx) { sramCtx->readBuff = GameState_Alloc(gameState, SRAM_SIZE, "../z_sram.c", 1294); - - if (!(sramCtx->readBuff != NULL)) { - __assert("sram->read_buff != NULL", "../z_sram.c", 1295); - } + ASSERT(sramCtx->readBuff != NULL, "sram->read_buff != NULL", "../z_sram.c", 1295); } void Sram_Init(GlobalContext* globalCtx, SramContext* sramCtx) { diff --git a/src/code/z_view.c b/src/code/z_view.c index 974191ac26..56ee4776a8 100644 --- a/src/code/z_view.c +++ b/src/code/z_view.c @@ -157,18 +157,10 @@ void func_800AA550(View* view) { lrx = view->viewport.rightX - varX; lry = view->viewport.bottomY - varY; - if (ulx < 0) { - __assert("ulx >= 0", "../z_view.c", 454); - } - if (uly < 0) { - __assert("uly >= 0", "../z_view.c", 455); - } - if (lrx > SCREEN_WIDTH) { - __assert("lrx <= SCREEN_WD", "../z_view.c", 456); - } - if (lry > SCREEN_HEIGHT) { - __assert("lry <= SCREEN_HT", "../z_view.c", 457); - } + ASSERT(ulx >= 0, "ulx >= 0", "../z_view.c", 454); + ASSERT(uly >= 0, "uly >= 0", "../z_view.c", 455); + ASSERT(lrx <= SCREEN_WIDTH, "lrx <= SCREEN_WD", "../z_view.c", 456); + ASSERT(lry <= SCREEN_HEIGHT, "lry <= SCREEN_HT", "../z_view.c", 457); OPEN_DISPS(gfxCtx, "../z_view.c", 459); diff --git a/src/code/z_vismono.c b/src/code/z_vismono.c index 0fb6177021..5a8f2d8c3b 100644 --- a/src/code/z_vismono.c +++ b/src/code/z_vismono.c @@ -95,10 +95,7 @@ void VisMono_Draw(VisMono* this, Gfx** gfxp) { LOG_ADDRESS("mono_dl + (1+3+1+1+80*(7+2+2+3)+1)", monoDL + DLSIZE, "../z_vismono.c", 259); LOG_ADDRESS("(1+3+1+1+80*(7+2+2+3)+1)", DLSIZE, "../z_vismono.c", 260); } - - if (!(glistpEnd <= monoDL + DLSIZE)) { - __assert("glistp_end <= mono_dl + DLSIZE", "../z_vismono.c", 262); - } + ASSERT(glistpEnd <= monoDL + DLSIZE, "glistp_end <= mono_dl + DLSIZE", "../z_vismono.c", 262); } gDPPipeSync(gfx++); @@ -128,8 +125,6 @@ void VisMono_DrawOld(VisMono* this) { if (!this->monoDl) { this->monoDl = SystemArena_MallocDebug(DLSIZE * sizeof(Gfx), "../z_vismono.c", 289); glistpEnd = VisMono_DrawTexture(this, this->monoDl); - if (!(glistpEnd <= this->monoDl + DLSIZE)) { - __assert("glistp_end <= this->mono_dl + DLSIZE", "../z_vismono.c", 292); - } + ASSERT(glistpEnd <= this->monoDl + DLSIZE, "glistp_end <= this->mono_dl + DLSIZE", "../z_vismono.c", 292); } } diff --git a/src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.c b/src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.c index 0e90be3e5c..82dab010f5 100644 --- a/src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.c +++ b/src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.c @@ -65,7 +65,7 @@ void BgGndIceblock_Init(Actor* thisx, GlobalContext* globalCtx) { sBlockPositions[1] = 14; } else { LOG_FLOAT("thisx->world.position.x", this->dyna.actor.world.pos.x, "../z_bg_gnd_iceblock.c", 138); - __assert("0", "../z_bg_gnd_iceblock.c", 139); + ASSERT(0, "0", "../z_bg_gnd_iceblock.c", 139); } } diff --git a/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c b/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c index eff97d4a84..750a4381c5 100644 --- a/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c +++ b/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c @@ -89,7 +89,7 @@ void Demo6K_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("bank_ID = %d\n", objBankIndex); if (objBankIndex < 0) { - __assert("0", "../z_demo_6k.c", 334); + ASSERT(0, "0", "../z_demo_6k.c", 334); } else { this->objBankIndex = objBankIndex; } @@ -176,7 +176,7 @@ void Demo6K_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_293 = params - 14; break; default: - __assert("0", "../z_demo_6k.c", 435); + ASSERT(0, "0", "../z_demo_6k.c", 435); break; } diff --git a/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c b/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c index 3547a5a7fe..9c06e52f18 100644 --- a/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c +++ b/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c @@ -196,7 +196,7 @@ void DemoEffect_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf(VT_FGCOL(CYAN) " bank_ID = %d\n" VT_RST, objectIndex); if (objectIndex < 0) { - __assert("0", "../z_demo_effect.c", 723); + ASSERT(0, "0", "../z_demo_effect.c", 723); } else { this->initObjectBankIndex = objectIndex; } @@ -506,7 +506,7 @@ void DemoEffect_Init(Actor* thisx, GlobalContext* globalCtx) { break; default: - __assert("0", "../z_demo_effect.c", 1062); + ASSERT(0, "0", "../z_demo_effect.c", 1062); break; } @@ -683,7 +683,7 @@ void DemoEffect_InitTimeWarp(DemoEffect* this, GlobalContext* globalCtx) { s32 effectType = (this->actor.params & 0x00FF); if (!SkelCurve_Init(globalCtx, &this->skelCurve, &gTimeWarpSkel, &gTimeWarpAnim)) { - __assert("0", "../z_demo_effect.c", 1283); + ASSERT(0, "0", "../z_demo_effect.c", 1283); } if (effectType == DEMO_EFFECT_TIMEWARP_TIMEBLOCK_LARGE || effectType == DEMO_EFFECT_TIMEWARP_TIMEBLOCK_SMALL) { diff --git a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c index 5c256debce..6e375cb955 100644 --- a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c +++ b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c @@ -193,7 +193,7 @@ void DemoKankyo_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("bank_ID = %d\n", objBankIndex); if (objBankIndex < 0) { - __assert("0", "../z_demo_kankyo.c", 521); + ASSERT(0, "0", "../z_demo_kankyo.c", 521); } else { this->objBankIndex = objBankIndex; } diff --git a/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.c b/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.c index 98383b1123..11b985164f 100644 --- a/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.c +++ b/src/overlays/actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.c @@ -55,10 +55,7 @@ void DemoTreLgt_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("Demo_Tre_Lgt_Actor_ct();コンストラクト失敗\n"); } - // This assert is optimized out but it exists due to its presence in rodata - if (0) { - __assert("1", "../z_demo_tre_lgt.c", UNK_LINE); - } + ASSERT(true, "1", "../z_demo_tre_lgt.c", UNK_LINE); this->unk_170 = 255; this->unk_174 = 255; diff --git a/src/overlays/actors/ovl_En_Box/z_en_box.c b/src/overlays/actors/ovl_En_Box/z_en_box.c index db9c30173f..e4ab6667ed 100644 --- a/src/overlays/actors/ovl_En_Box/z_en_box.c +++ b/src/overlays/actors/ovl_En_Box/z_en_box.c @@ -578,9 +578,7 @@ Gfx* EnBox_EmptyDList(GraphicsContext* gfxCtx) { Gfx* dList; dList = Graph_Alloc(gfxCtx, sizeof(Gfx)); - if (dList == NULL) { - __assert("gfxp != NULL", "../z_en_box.c", 1528); - } + ASSERT(dList != NULL, "gfxp != NULL", "../z_en_box.c", 1528); dListHead = dList; gSPEndDisplayList(dListHead++); @@ -594,9 +592,7 @@ Gfx* func_809CA4A0(GraphicsContext* gfxCtx) { Gfx* dListHead; dListHead = Graph_Alloc(gfxCtx, 2 * sizeof(Gfx)); - if (dListHead == NULL) { - __assert("gfxp != NULL", "../z_en_box.c", 1546); - } + ASSERT(dListHead != NULL, "gfxp != NULL", "../z_en_box.c", 1546); dList = dListHead; gDPSetRenderMode(dListHead++, @@ -614,9 +610,7 @@ Gfx* func_809CA518(GraphicsContext* gfxCtx) { Gfx* dListHead; dListHead = Graph_Alloc(gfxCtx, 2 * sizeof(Gfx)); - if (dListHead == NULL) { - __assert("gfxp != NULL", "../z_en_box.c", 1564); - } + ASSERT(dListHead != NULL, "gfxp != NULL", "../z_en_box.c", 1564); dList = dListHead; gDPSetRenderMode(dListHead++, diff --git a/src/overlays/actors/ovl_En_Elf/z_en_elf.c b/src/overlays/actors/ovl_En_Elf/z_en_elf.c index 3c1901a8af..f61b43de57 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -405,7 +405,7 @@ void EnElf_Init(Actor* thisx, GlobalContext* globalCtx) { } break; default: - __assert("0", "../z_en_elf.c", 1103); + ASSERT(0, "0", "../z_en_elf.c", 1103); break; } @@ -798,7 +798,7 @@ void func_80A03AB0(EnElf* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); if (this->func_2C8 == NULL) { - __assert("0", "../z_en_elf.c", 1725); + ASSERT(0, "0", "../z_en_elf.c", 1725); } this->func_2C8(this, globalCtx); 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 cce12fb7d3..d9035b00cb 100644 --- a/src/overlays/actors/ovl_En_Fr/z_en_fr.c +++ b/src/overlays/actors/ovl_En_Fr/z_en_fr.c @@ -244,7 +244,7 @@ void EnFr_Init(Actor* thisx, GlobalContext* globalCtx) { // Translation: The argument is wrong!! osSyncPrintf("%s[%d] : 引数が間違っている!!(%d)\n", "../z_en_fr.c", 370, this->actor.params); osSyncPrintf(VT_RST); - __assert("0", "../z_en_fr.c", 372); + ASSERT(0, "0", "../z_en_fr.c", 372); } this->objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_GAMEPLAY_FIELD_KEEP); @@ -254,7 +254,7 @@ void EnFr_Init(Actor* thisx, GlobalContext* globalCtx) { // Translation: There is no bank!! osSyncPrintf("%s[%d] : バンクが無いよ!!\n", "../z_en_fr.c", 380); osSyncPrintf(VT_RST); - __assert("0", "../z_en_fr.c", 382); + ASSERT(0, "0", "../z_en_fr.c", 382); } } } diff --git a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c index 9825e3394e..e627f28f2f 100644 --- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c +++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c @@ -157,7 +157,7 @@ void EnGe2_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.targetMode = 6; break; default: - __assert("0", "../z_en_ge2.c", 418); + ASSERT(0, "0", "../z_en_ge2.c", 418); } this->stateFlags = 0; diff --git a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c index cf00932841..b14e25c93e 100644 --- a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c +++ b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c @@ -291,7 +291,7 @@ void func_80A3A8D0(EnGirlA* this, GlobalContext* globalCtx) { osSyncPrintf(VT_COL(RED, WHITE)); osSyncPrintf("引数がおかしいよ(arg_data=%d)!!\n", this->actor.params); osSyncPrintf(VT_RST); - __assert("0", "../z_en_girlA.c", 1421); + ASSERT(0, "0", "../z_en_girlA.c", 1421); return; } @@ -302,7 +302,7 @@ void func_80A3A8D0(EnGirlA* this, GlobalContext* globalCtx) { osSyncPrintf(VT_COL(RED, WHITE)); osSyncPrintf("バンクが無いよ!!(%s)\n", D_80A3C590[params]); osSyncPrintf(VT_RST); - __assert("0", "../z_en_girlA.c", 1434); + ASSERT(0, "0", "../z_en_girlA.c", 1434); return; } diff --git a/src/overlays/actors/ovl_En_Gm/z_en_gm.c b/src/overlays/actors/ovl_En_Gm/z_en_gm.c index 161f3b2f41..a5e36179b7 100644 --- a/src/overlays/actors/ovl_En_Gm/z_en_gm.c +++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.c @@ -81,7 +81,7 @@ void EnGm_Init(Actor* thisx, GlobalContext* globalCtx) { // "There is no model bank! !! (Medi Goron)" osSyncPrintf("モデル バンクが無いよ!!(中ゴロン)\n"); osSyncPrintf(VT_RST); - __assert("0", "../z_en_gm.c", 145); + ASSERT(0, "0", "../z_en_gm.c", 145); } this->updateFunc = func_80A3D838; diff --git a/src/overlays/actors/ovl_En_Guest/z_en_guest.c b/src/overlays/actors/ovl_En_Guest/z_en_guest.c index 0441867574..aa80f70da8 100644 --- a/src/overlays/actors/ovl_En_Guest/z_en_guest.c +++ b/src/overlays/actors/ovl_En_Guest/z_en_guest.c @@ -71,7 +71,7 @@ void EnGuest_Init(Actor* thisx, GlobalContext* globalCtx) { // No such bank!! osSyncPrintf("%s[%d] : バンクが無いよ!!\n", "../z_en_guest.c", 129); osSyncPrintf(VT_RST); - __assert("0", "../z_en_guest.c", 132); + ASSERT(0, "0", "../z_en_guest.c", 132); } } } diff --git a/src/overlays/actors/ovl_En_Owl/z_en_owl.c b/src/overlays/actors/ovl_En_Owl/z_en_owl.c index e1b3a119ac..ac6b68e366 100644 --- a/src/overlays/actors/ovl_En_Owl/z_en_owl.c +++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.c @@ -954,7 +954,7 @@ void func_80ACC00C(EnOwl* this, GlobalContext* globalCtx) { this->actor.draw = NULL; break; default: - __assert("0", "../z_en_owl.c", 1693); + ASSERT(0, "0", "../z_en_owl.c", 1693); break; } diff --git a/src/overlays/actors/ovl_En_Rr/z_en_rr.c b/src/overlays/actors/ovl_En_Rr/z_en_rr.c index acf99bd3e4..b28ae4369f 100644 --- a/src/overlays/actors/ovl_En_Rr/z_en_rr.c +++ b/src/overlays/actors/ovl_En_Rr/z_en_rr.c @@ -790,7 +790,7 @@ void EnRr_Update(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc(this, globalCtx); if (this->hasPlayer == 0x3F80) { // checks if 1.0f has been stored to hasPlayer's address - __assert("0", "../z_en_rr.c", 1355); + ASSERT(0, "0", "../z_en_rr.c", 1355); } Math_StepToF(&this->actor.speedXZ, 0.0f, 0.1f); diff --git a/src/overlays/actors/ovl_En_Sth/z_en_sth.c b/src/overlays/actors/ovl_En_Sth/z_en_sth.c index b6ecdbfe69..396d18e8ab 100644 --- a/src/overlays/actors/ovl_En_Sth/z_en_sth.c +++ b/src/overlays/actors/ovl_En_Sth/z_en_sth.c @@ -123,7 +123,7 @@ void EnSth_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("bank_ID = %d\n", objectBankIdx); if (objectBankIdx < 0) { - __assert("0", "../z_en_sth.c", 1564); + ASSERT(0, "0", "../z_en_sth.c", 1564); } this->objectBankIdx = objectBankIdx; this->drawFunc = EnSth_Draw; diff --git a/src/overlays/actors/ovl_En_Tr/z_en_tr.c b/src/overlays/actors/ovl_En_Tr/z_en_tr.c index b2d0553a54..42411f641b 100644 --- a/src/overlays/actors/ovl_En_Tr/z_en_tr.c +++ b/src/overlays/actors/ovl_En_Tr/z_en_tr.c @@ -122,7 +122,7 @@ void EnTr_Init(Actor* thisx, GlobalContext* globalCtx) { break; default: - __assert("0", "../z_en_tr.c", 277); + ASSERT(0, "0", "../z_en_tr.c", 277); break; } } diff --git a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c index fa93dfbcf7..61a51033fb 100644 --- a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c +++ b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c @@ -200,14 +200,10 @@ void func_80B2A570(EnViewer* this, GlobalContext* globalCtx) { struct_80B2CEE8* unkStruct = &D_80B2CEE8[this->actor.params >> 8]; s32 objIndex = Object_GetIndex(&globalCtx->objectCtx, unkStruct->objId1); - if (objIndex < 0) { - __assert("bank_ID >= 0", "../z_en_viewer.c", 576); - } + ASSERT(objIndex >= 0, "bank_ID >= 0", "../z_en_viewer.c", 576); this->animObjBankIndex = Object_GetIndex(&globalCtx->objectCtx, unkStruct->objId2); - if (this->animObjBankIndex < 0) { - __assert("this->anime_bank_ID >= 0", "../z_en_viewer.c", 579); - } + ASSERT(this->animObjBankIndex >= 0, "this->anime_bank_ID >= 0", "../z_en_viewer.c", 579); if (!Object_IsLoaded(&globalCtx->objectCtx, objIndex) || !Object_IsLoaded(&globalCtx->objectCtx, this->animObjBankIndex)) { diff --git a/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c b/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c index c28f166ca0..0eda44cb07 100644 --- a/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c +++ b/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c @@ -69,7 +69,7 @@ void ItemEtcetera_Init(Actor* thisx, GlobalContext* globalCtx) { objBankIndex = Object_GetIndex(&globalCtx->objectCtx, sObjectIds[type]); osSyncPrintf("bank_ID = %d\n", objBankIndex); if (objBankIndex < 0) { - __assert("0", "../z_item_etcetera.c", 241); + ASSERT(0, "0", "../z_item_etcetera.c", 241); } else { this->objBankIndex = objBankIndex; } diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 74cca99cee..53ec5309a6 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -4639,10 +4639,7 @@ void func_8083AE40(Player* this, s16 objectId) { size = gObjectTable[objectId].vromEnd - gObjectTable[objectId].vromStart; LOG_HEX("size", size, "../z_player.c", 9090); - - if (size > 1024 * 8) { - __assert("size <= 1024 * 8", "../z_player.c", 9091); - } + ASSERT(size <= 1024 * 8, "size <= 1024 * 8", "../z_player.c", 9091); if (gObjectTable[objectId].vromEnd) {} diff --git a/src/overlays/gamestates/ovl_title/z_title.c b/src/overlays/gamestates/ovl_title/z_title.c index 486fe3b362..c6a367be5c 100644 --- a/src/overlays/gamestates/ovl_title/z_title.c +++ b/src/overlays/gamestates/ovl_title/z_title.c @@ -165,9 +165,7 @@ void Title_Init(GameState* thisx) { this->staticSegment = GameState_Alloc(&this->state, size, "../z_title.c", 611); osSyncPrintf("z_title.c\n"); - if (this->staticSegment == NULL) { - __assert("this->staticSegment != NULL", "../z_title.c", 614); - } + ASSERT(this->staticSegment != NULL, "this->staticSegment != NULL", "../z_title.c", 614); DmaMgr_SendRequest1(this->staticSegment, (u32)_nintendo_rogo_staticSegmentRomStart, size, "../z_title.c", 615); R_UPDATE_RATE = 1; Matrix_Init(&this->state);