mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-06 07:56:32 +00:00
assert
macro OK (#755)
* create assert macro and replace a bunch of __assert Signed-off-by: angie <angheloalf95@gmail.com> * Another bunch of assert Signed-off-by: angie <angheloalf95@gmail.com> * more assert Signed-off-by: angie <angheloalf95@gmail.com> * assert(false) Signed-off-by: angie <angheloalf95@gmail.com> * last assert used in matching code Signed-off-by: angie <angheloalf95@gmail.com> * the non-matchings Signed-off-by: angie <angheloalf95@gmail.com> * typo Signed-off-by: angie <angheloalf95@gmail.com> * format Signed-off-by: angie <angheloalf95@gmail.com> * change macro to uppercase Signed-off-by: angie <angheloalf95@gmail.com> * 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>
This commit is contained in:
parent
0b8252cfe9
commit
98aef8988a
44 changed files with 148 additions and 301 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue