Use Macro for __FILE__ & __LINE__ when possible (#559)

* First batch some overlay

* Almost all overlay

* effect & gamestate

* kaleido stuffs

* more overlay

* more left over from code folder

* remaining hardcoded line and file

* Open & Close _DISP __FILE__ & __LINE__ clean up

* Some if (1) {} remove

* LOG_xxxx __FILE__ , __LINE__ cleaned

* ASSERT macro __FILE__ __LINE__

* mtx without line/file in functions

* " if (1) {} " & "if (0) {}" and tab/white place

* LogUtils as macro

* GameState_, GameAlloc_, SystemArena_ & ZeldaArena_

* Revert "GameState_, GameAlloc_, SystemArena_ & ZeldaArena_"

This reverts commit 0d85caaf7e.

* Like last commit but as macro

* Fix matrix not using macros

* use function not macro

* DebugArena_* functions
GameAlloc_MallocDebug
BgCheck_PosErrorCheck as macros
removed issues with ; in macro file
This commit is contained in:
Baoulettes 2022-07-06 01:29:34 +02:00 committed by GitHub
parent a9c3c7541e
commit a5df9dddf0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
467 changed files with 3081 additions and 3459 deletions

View file

@ -28,7 +28,7 @@ void func_800BC450(GlobalContext* globalCtx) {
}
void func_800BC490(GlobalContext* globalCtx, s16 point) {
ASSERT(point == 1 || point == 2, "point == 1 || point == 2", "../z_play.c", 2160);
ASSERT(point == 1 || point == 2);
globalCtx->unk_1242B = point;
@ -135,7 +135,7 @@ void func_800BC5E0(GlobalContext* globalCtx, s32 transitionType) {
globalCtx->transitionMode = 16;
break;
default:
Fault_AddHungupAndCrash("../z_play.c", 2290);
Fault_AddHungupAndCrash(__FILE__, __LINE__);
break;
}
}
@ -365,7 +365,7 @@ void Gameplay_Init(GameState* thisx) {
osSyncPrintf("ZELDA ALLOC SIZE=%x\n", THA_GetSize(&globalCtx->state.tha));
zAllocSize = THA_GetSize(&globalCtx->state.tha);
zAlloc = GameState_Alloc(&globalCtx->state, zAllocSize, "../z_play.c", 2918);
zAlloc = GAMESTATE_ALLOC_MC(&globalCtx->state, zAllocSize);
zAllocAligned = (zAlloc + 8) & ~0xF;
ZeldaArena_Init(zAllocAligned, zAllocSize - zAllocAligned + zAlloc);
// "Zelda Heap"
@ -728,7 +728,7 @@ void Gameplay_Update(GlobalContext* globalCtx) {
globalCtx->envCtx.sandstormPrimA = 255;
globalCtx->envCtx.sandstormEnvA = 255;
// "It's here!!!!!!!!!"
LOG_STRING("来た!!!!!!!!!!!!!!!!!!!!!", "../z_play.c", 3471);
LOG_STRING("来た!!!!!!!!!!!!!!!!!!!!!");
globalCtx->transitionMode = 15;
} else {
globalCtx->transitionMode = 12;
@ -773,12 +773,12 @@ void Gameplay_Update(GlobalContext* globalCtx) {
}
if (1 && HREG(63)) {
LOG_NUM("1", 1, "../z_play.c", 3533);
LOG_NUM("1", 1);
}
if (1 && (gTrnsnUnkState != 3)) {
if (1 && HREG(63)) {
LOG_NUM("1", 1, "../z_play.c", 3542);
LOG_NUM("1", 1);
}
if ((gSaveContext.gameMode == 0) && (globalCtx->msgCtx.msgMode == MSGMODE_NONE) &&
@ -787,30 +787,30 @@ void Gameplay_Update(GlobalContext* globalCtx) {
}
if (1 && HREG(63)) {
LOG_NUM("1", 1, "../z_play.c", 3551);
LOG_NUM("1", 1);
}
sp80 = (globalCtx->pauseCtx.state != 0) || (globalCtx->pauseCtx.debugState != 0);
if (1 && HREG(63)) {
LOG_NUM("1", 1, "../z_play.c", 3555);
LOG_NUM("1", 1);
}
AnimationContext_Reset(&globalCtx->animationCtx);
if (1 && HREG(63)) {
LOG_NUM("1", 1, "../z_play.c", 3561);
LOG_NUM("1", 1);
}
Object_UpdateBank(&globalCtx->objectCtx);
if (1 && HREG(63)) {
LOG_NUM("1", 1, "../z_play.c", 3577);
LOG_NUM("1", 1);
}
if ((sp80 == 0) && (IREG(72) == 0)) {
if (1 && HREG(63)) {
LOG_NUM("1", 1, "../z_play.c", 3580);
LOG_NUM("1", 1);
}
globalCtx->gameplayFrames++;
@ -830,37 +830,37 @@ void Gameplay_Update(GlobalContext* globalCtx) {
}
} else {
if (1 && HREG(63)) {
LOG_NUM("1", 1, "../z_play.c", 3606);
LOG_NUM("1", 1);
}
func_800973FC(globalCtx, &globalCtx->roomCtx);
if (1 && HREG(63)) {
LOG_NUM("1", 1, "../z_play.c", 3612);
LOG_NUM("1", 1);
}
CollisionCheck_AT(globalCtx, &globalCtx->colChkCtx);
if (1 && HREG(63)) {
LOG_NUM("1", 1, "../z_play.c", 3618);
LOG_NUM("1", 1);
}
CollisionCheck_OC(globalCtx, &globalCtx->colChkCtx);
if (1 && HREG(63)) {
LOG_NUM("1", 1, "../z_play.c", 3624);
LOG_NUM("1", 1);
}
CollisionCheck_Damage(globalCtx, &globalCtx->colChkCtx);
if (1 && HREG(63)) {
LOG_NUM("1", 1, "../z_play.c", 3631);
LOG_NUM("1", 1);
}
CollisionCheck_ClearContext(globalCtx, &globalCtx->colChkCtx);
if (1 && HREG(63)) {
LOG_NUM("1", 1, "../z_play.c", 3637);
LOG_NUM("1", 1);
}
if (globalCtx->unk_11DE9 == 0) {
@ -868,31 +868,31 @@ void Gameplay_Update(GlobalContext* globalCtx) {
}
if (1 && HREG(63)) {
LOG_NUM("1", 1, "../z_play.c", 3643);
LOG_NUM("1", 1);
}
func_80064558(globalCtx, &globalCtx->csCtx);
if (1 && HREG(63)) {
LOG_NUM("1", 1, "../z_play.c", 3648);
LOG_NUM("1", 1);
}
func_800645A0(globalCtx, &globalCtx->csCtx);
if (1 && HREG(63)) {
LOG_NUM("1", 1, "../z_play.c", 3651);
LOG_NUM("1", 1);
}
Effect_UpdateAll(globalCtx);
if (1 && HREG(63)) {
LOG_NUM("1", 1, "../z_play.c", 3657);
LOG_NUM("1", 1);
}
EffectSs_UpdateAll(globalCtx);
if (1 && HREG(63)) {
LOG_NUM("1", 1, "../z_play.c", 3662);
LOG_NUM("1", 1);
}
}
} else {
@ -900,19 +900,19 @@ void Gameplay_Update(GlobalContext* globalCtx) {
}
if (1 && HREG(63)) {
LOG_NUM("1", 1, "../z_play.c", 3672);
LOG_NUM("1", 1);
}
func_80095AA0(globalCtx, &globalCtx->roomCtx.curRoom, &input[1], 0);
if (1 && HREG(63)) {
LOG_NUM("1", 1, "../z_play.c", 3675);
LOG_NUM("1", 1);
}
func_80095AA0(globalCtx, &globalCtx->roomCtx.prevRoom, &input[1], 1);
if (1 && HREG(63)) {
LOG_NUM("1", 1, "../z_play.c", 3677);
LOG_NUM("1", 1);
}
if (globalCtx->unk_1242B != 0) {
@ -933,65 +933,65 @@ void Gameplay_Update(GlobalContext* globalCtx) {
}
if (1 && HREG(63)) {
LOG_NUM("1", 1, "../z_play.c", 3708);
LOG_NUM("1", 1);
}
SkyboxDraw_Update(&globalCtx->skyboxCtx);
if (1 && HREG(63)) {
LOG_NUM("1", 1, "../z_play.c", 3716);
LOG_NUM("1", 1);
}
if ((globalCtx->pauseCtx.state != 0) || (globalCtx->pauseCtx.debugState != 0)) {
if (1 && HREG(63)) {
LOG_NUM("1", 1, "../z_play.c", 3721);
LOG_NUM("1", 1);
}
KaleidoScopeCall_Update(globalCtx);
} else if (globalCtx->gameOverCtx.state != GAMEOVER_INACTIVE) {
if (1 && HREG(63)) {
LOG_NUM("1", 1, "../z_play.c", 3727);
LOG_NUM("1", 1);
}
GameOver_Update(globalCtx);
} else {
if (1 && HREG(63)) {
LOG_NUM("1", 1, "../z_play.c", 3733);
LOG_NUM("1", 1);
}
Message_Update(globalCtx);
}
if (1 && HREG(63)) {
LOG_NUM("1", 1, "../z_play.c", 3737);
LOG_NUM("1", 1);
}
if (1 && HREG(63)) {
LOG_NUM("1", 1, "../z_play.c", 3742);
LOG_NUM("1", 1);
}
Interface_Update(globalCtx);
if (1 && HREG(63)) {
LOG_NUM("1", 1, "../z_play.c", 3765);
LOG_NUM("1", 1);
}
AnimationContext_Update(globalCtx, &globalCtx->animationCtx);
if (1 && HREG(63)) {
LOG_NUM("1", 1, "../z_play.c", 3771);
LOG_NUM("1", 1);
}
SoundSource_UpdateAll(globalCtx);
if (1 && HREG(63)) {
LOG_NUM("1", 1, "../z_play.c", 3777);
LOG_NUM("1", 1);
}
ShrinkWindow_Update(R_UPDATE_RATE);
if (1 && HREG(63)) {
LOG_NUM("1", 1, "../z_play.c", 3783);
LOG_NUM("1", 1);
}
TransitionFade_Update(&globalCtx->transitionFade, R_UPDATE_RATE);
@ -1001,12 +1001,12 @@ void Gameplay_Update(GlobalContext* globalCtx) {
}
if (1 && HREG(63)) {
LOG_NUM("1", 1, "../z_play.c", 3799);
LOG_NUM("1", 1);
}
skip:
if (1 && HREG(63)) {
LOG_NUM("1", 1, "../z_play.c", 3801);
LOG_NUM("1", 1);
}
if ((sp80 == 0) || (gDbgCamEnabled)) {
@ -1016,13 +1016,13 @@ skip:
globalCtx->nextCamera = globalCtx->activeCamera;
if (1 && HREG(63)) {
LOG_NUM("1", 1, "../z_play.c", 3806);
LOG_NUM("1", 1);
}
for (i = 0; i < NUM_CAMS; i++) {
if ((i != globalCtx->nextCamera) && (globalCtx->cameraPtrs[i] != NULL)) {
if (1 && HREG(63)) {
LOG_NUM("1", 1, "../z_play.c", 3809);
LOG_NUM("1", 1);
}
Camera_Update(globalCtx->cameraPtrs[i]);
@ -1032,12 +1032,12 @@ skip:
Camera_Update(globalCtx->cameraPtrs[globalCtx->nextCamera]);
if (1 && HREG(63)) {
LOG_NUM("1", 1, "../z_play.c", 3814);
LOG_NUM("1", 1);
}
}
if (1 && HREG(63)) {
LOG_NUM("1", 1, "../z_play.c", 3816);
LOG_NUM("1", 1);
}
Environment_Update(globalCtx, &globalCtx->envCtx, &globalCtx->lightCtx, &globalCtx->pauseCtx, &globalCtx->msgCtx,
@ -1065,7 +1065,7 @@ void Gameplay_Draw(GlobalContext* globalCtx) {
Lights* sp228;
Vec3f sp21C;
OPEN_DISPS(gfxCtx, "../z_play.c", 3907);
OPEN_DISPS(gfxCtx);
gSegments[4] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[globalCtx->objectCtx.mainKeepIndex].segment);
gSegments[5] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[globalCtx->objectCtx.subKeepIndex].segment);
@ -1109,7 +1109,7 @@ void Gameplay_Draw(GlobalContext* globalCtx) {
0.0f;
// This transpose is where the viewing matrix is properly converted into a billboard matrix
Matrix_Transpose(&globalCtx->billboardMtxF);
globalCtx->billboardMtx = Matrix_MtxFToMtx(Matrix_CheckFloats(&globalCtx->billboardMtxF, "../z_play.c", 4005),
globalCtx->billboardMtx = Matrix_MtxFToMtx(MATRIX_CHECKFLOATS(&globalCtx->billboardMtxF),
Graph_Alloc(gfxCtx, sizeof(Mtx)));
gSPSegment(POLY_OPA_DISP++, 0x01, globalCtx->billboardMtx);
@ -1341,7 +1341,7 @@ void Gameplay_Draw(GlobalContext* globalCtx) {
POLY_OPA_DISP = gfxP;
}
CLOSE_DISPS(gfxCtx, "../z_play.c", 4508);
CLOSE_DISPS(gfxCtx);
}
void Gameplay_Main(GameState* thisx) {
@ -1352,7 +1352,7 @@ void Gameplay_Main(GameState* thisx) {
DebugDisplay_Init();
if (1 && HREG(63)) {
LOG_NUM("1", 1, "../z_play.c", 4556);
LOG_NUM("1", 1);
}
if ((HREG(80) == 10) && (HREG(94) != 10)) {
@ -1377,7 +1377,7 @@ void Gameplay_Main(GameState* thisx) {
}
if (1 && HREG(63)) {
LOG_NUM("1", 1, "../z_play.c", 4583);
LOG_NUM("1", 1);
}
FrameInterpolation_StartRecord();
@ -1385,7 +1385,7 @@ void Gameplay_Main(GameState* thisx) {
FrameInterpolation_StopRecord();
if (1 && HREG(63)) {
LOG_NUM("1", 1, "../z_play.c", 4587);
LOG_NUM("1", 1);
}
}
@ -1465,8 +1465,8 @@ void* Gameplay_LoadFile(GlobalContext* globalCtx, RomFile* file) {
void* allocp;
size = file->vromEnd - file->vromStart;
allocp = GameState_Alloc(&globalCtx->state, size, "../z_play.c", 4692);
DmaMgr_SendRequest1(allocp, file->vromStart, size, "../z_play.c", 4694);
allocp = GAMESTATE_ALLOC_MC(&globalCtx->state, size);
DmaMgr_SendRequest1(allocp, file->vromStart, size, __FILE__, __LINE__);
return allocp;
}
@ -1647,7 +1647,6 @@ s32 Gameplay_CameraSetAtEyeUp(GlobalContext* globalCtx, s16 camId, Vec3f* at, Ve
s32 Gameplay_CameraSetFov(GlobalContext* globalCtx, s16 camId, f32 fov) {
s32 ret = Camera_SetParam(globalCtx->cameraPtrs[camId], 0x20, &fov) & 1;
if (1) {}
return ret;
}