mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-06 14:20:11 +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
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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++,
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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) {}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue