Fix JUT_ASSERT and several other macros (#2711)

* Fix JUT_ASSERT to be a nested define

* Switch names that appear in asserts to be constants instead of defines

* Replace `0` in asserts with `NULL` or `FALSE`

* Fix fpclassify

* Fix ARRAY_SIZE

* Use G_CM3D_F_INF

* More fixes for fpclassify

* Remove FLOAT_LABEL

* Remove incorrect FLAG_ON macro

* Remove UNK_BSS macro

* Silence clangd unused header warning for PCH
This commit is contained in:
LagoLunatic
2025-09-28 16:11:07 -04:00
committed by GitHub
parent 737250d7f5
commit 6ec6fce8cb
1008 changed files with 3172 additions and 3237 deletions
+11 -11
View File
@@ -3,7 +3,7 @@
// Translation Unit: a/npc/d_a_npc_cd2
//
#include "d/dolzel.h"
#include "d/dolzel.h" // IWYU pragma: keep
#include "d/actor/d_a_npc_cd2.h"
#include "d/actor/d_a_player.h"
@@ -259,7 +259,7 @@ static Vec const a_transScaleTbl[30] = {
/* 80157D00-80157F28 152640 0228+00 0/0 0/0 4/4 .text NpcCreate__10daNpcCd2_cFi */
int daNpcCd2_c::NpcCreate(int param_1) {
J3DModelData* a_mdlData_p = getNpcMdlDataP(param_1);
JUT_ASSERT(590, 0 != a_mdlData_p);
JUT_ASSERT(590, NULL != a_mdlData_p);
J3DAnmTexPattern* anmTex = getTexAnmP(param_1);
int uVar5;
if (anmTex != NULL) {
@@ -280,7 +280,7 @@ int daNpcCd2_c::NpcCreate(int param_1) {
mCitizen.setMdlType(param_1, false, mIsDarkWorld != 0 ? 1 : 0);
if (anmTex != NULL) {
mpBtpAnm = new mDoExt_btpAnm();
JUT_ASSERT(622, 0 != mpBtpAnm);
JUT_ASSERT(622, NULL != mpBtpAnm);
if (mpBtpAnm == NULL || !mpBtpAnm->init(a_mdlData_p, anmTex, 1, 2, 1.0f, 0, -1)) {
return 0;
}
@@ -1952,7 +1952,7 @@ bool PathTrace_c::setPath(int param_1, int param_2, int param_3, cXyz* param_4,
field_0x20 = 0;
if (param_5) {
f32 minDist = 1000000000.0f;
f32 minDist = G_CM3D_F_INF;
field_0x20 = 0;
for (int i = 0; i < mPath->m_num; i++) {
dPnt* pnt = dPath_GetPnt(mPath, i);
@@ -2006,9 +2006,9 @@ void PathTrace_c::getTargetPoint(Vec* targetPoint) {
/* 80159ECC-80159F98 15480C 00CC+00 1/1 0/0 0/0 .text setAvoidPoint__11PathTrace_cFv */
void PathTrace_c::setAvoidPoint() {
JUT_ASSERT(1602, mPath != 0);
JUT_ASSERT(1603, mMyself != 0);
JUT_ASSERT(1604, mObstacle != 0);
JUT_ASSERT(1602, mPath != NULL);
JUT_ASSERT(1603, mMyself != NULL);
JUT_ASSERT(1604, mObstacle != NULL);
cXyz& selfPos = fopAcM_GetPosition(mMyself);
s16 obstacleAngle = cLib_targetAngleY(&selfPos, &fopAcM_GetPosition(mObstacle));
s16 diff = (s16)obstacleAngle - cLib_targetAngleY(&selfPos, &dPath_GetPnt(mPath, field_0x20)->m_position);
@@ -2044,7 +2044,7 @@ void PathTrace_c::setNextPoint() {
dPnt* pnt2 = dPath_GetPnt(mPath, field_0x20);
cXyz acStack_28(pnt1->m_position);
field_0x18 = acStack_28.abs(pnt2->m_position);
mNextPoint = 1000000000.0f;
mNextPoint = G_CM3D_F_INF;
}
/* 8015A264-8015A294 154BA4 0030+00 1/1 0/0 0/0 .text incIndex__11PathTrace_cFi */
@@ -2105,14 +2105,14 @@ fopAc_ac_c* PathTrace_c::checkObstacle(fopAc_ac_c* param_0) {
* checkObstacleSub__11PathTrace_cFP10fopAc_ac_c */
void PathTrace_c::checkObstacleSub(fopAc_ac_c* pObstacle) {
if (mMyself != pObstacle) {
JUT_ASSERT(1816, mPath != 0);
JUT_ASSERT(1816, mPath != NULL);
cXyz& newObstaclePos = fopAcM_GetPosition(pObstacle);
dPnt* pnt = dPath_GetPnt(mPath, field_0x20);
f32 local_38;
f32 local_3c;
f32 local_40;
local_38 = 1000000000.0f;
JUT_ASSERT(1822, mMyself != 0);
local_38 = G_CM3D_F_INF;
JUT_ASSERT(1822, mMyself != NULL);
cXyz& selfPos = fopAcM_GetPosition(mMyself);
if (mObstacle != NULL) {
f32 distCurObstacle = selfPos.abs2(fopAcM_GetPosition(mObstacle));