This commit is contained in:
Derek Hensley 2024-05-21 18:21:17 -07:00
parent 67a30021b3
commit 96b75ffaa8
17 changed files with 27 additions and 27 deletions

View File

@ -5,7 +5,7 @@
#define F_SQRT2 1.41421356237309504880f
#define F_SQRT1_2 0.70710678118654752440f /* 1/sqrt(2) */
#define FLT_MAX 3.40282347e+38f
#define MAXFLOAT 3.40282347e+38f
#define SHT_MAX 32767.0f
#define SHT_MINV (1.0f / SHT_MAX)

View File

@ -1114,7 +1114,7 @@ void Actor_Init(Actor* actor, PlayState* play) {
actor->targetMode = TARGET_MODE_3;
actor->terminalVelocity = -20.0f;
actor->xyzDistToPlayerSq = FLT_MAX;
actor->xyzDistToPlayerSq = MAXFLOAT;
actor->uncullZoneForward = 1000.0f;
actor->uncullZoneScale = 350.0f;
actor->uncullZoneDownward = 700.0f;
@ -1856,7 +1856,7 @@ f32 Target_GetAdjustedDistSq(Actor* actor, Player* player, s16 playerShapeYaw) {
if (player->lockOnActor != NULL) {
if ((yawDiff > 0x4000) || (actor->flags & ACTOR_FLAG_CANT_LOCK_ON)) {
return FLT_MAX;
return MAXFLOAT;
}
// Linear scaling, yaw being 90 degree means it will return the original distance, 0 degree will adjust to 60%
@ -1867,7 +1867,7 @@ f32 Target_GetAdjustedDistSq(Actor* actor, Player* player, s16 playerShapeYaw) {
}
if (yawDiff > (0x10000 / 6)) {
return FLT_MAX;
return MAXFLOAT;
}
return actor->xyzDistToPlayerSq;
}
@ -1915,7 +1915,7 @@ s32 Target_OutsideLeashRange(Actor* actor, Player* player, s32 ignoreLeash) {
yawDiff = ABS_ALT(BINANG_SUB(BINANG_SUB(actor->yawTowardsPlayer, 0x8000), player->actor.shape.rot.y));
if ((player->lockOnActor == NULL) && (yawDiff > (0x10000 / 6))) {
distSq = FLT_MAX;
distSq = MAXFLOAT;
} else {
distSq = actor->xyzDistToPlayerSq;
}
@ -3640,7 +3640,7 @@ void Target_GetTargetActor(PlayState* play, ActorContext* actorCtx, Actor** targ
s32 i;
sTargetableNearestActor = sTargetablePrioritizedActor = D_801ED8C0 = D_801ED8C4 = NULL;
sTargetableNearestActorDistSq = D_801ED8D0 = sBgmEnemyDistSq = FLT_MAX;
sTargetableNearestActorDistSq = D_801ED8D0 = sBgmEnemyDistSq = MAXFLOAT;
sTargetablePrioritizedPriority = D_801ED8D8 = INT32_MAX;
actorCtx->targetCtx.bgmEnemy = NULL;

View File

@ -180,7 +180,7 @@ void Room_DrawCullable(PlayState* play, Room* room, u32 flags) {
insert->entry = roomShapeCullableEntry;
if (roomShapeCullableEntry->boundsSphereRadius < 0) {
insert->boundsNearZ = FLT_MAX;
insert->boundsNearZ = MAXFLOAT;
} else {
insert->boundsNearZ = entryBoundsNearZ;
}

View File

@ -57,7 +57,7 @@ f32 func_80ACAB10(PlayState* play, Actor* actor, f32 arg2, f32 arg3, f32 arg4) {
Actor_OffsetOfPointInActorCoords(actor, &offset, &point);
if ((arg3 < fabsf(offset.x)) || (arg4 < fabsf(offset.y))) {
return FLT_MAX;
return MAXFLOAT;
} else {
return offset.z;
}

View File

@ -283,7 +283,7 @@ f32 func_808A0D90(PlayState* play, DoorShutter* this, f32 arg2, f32 arg3, f32 ar
Actor_OffsetOfPointInActorCoords(&this->slidingDoor.dyna.actor, &sp1C, &sp28);
if ((arg3 < fabsf(sp1C.x)) || (arg4 < fabsf(sp1C.y))) {
return FLT_MAX;
return MAXFLOAT;
}
return sp1C.z;
}

View File

@ -176,7 +176,7 @@ f32 func_809A2E08(PlayState* play, DoorSpiral* this, f32 arg2, f32 arg3, f32 arg
Actor_OffsetOfPointInActorCoords(&this->actor, &offset, &point);
if ((arg3 < fabsf(offset.x)) || (arg4 < fabsf(offset.y))) {
return FLT_MAX;
return MAXFLOAT;
} else {
return offset.z;
}

View File

@ -145,7 +145,7 @@ void func_8091D904(EnFish* this) {
Actor* func_8091D944(EnFish* this, PlayState* play) {
f32 distSq;
Actor* retActor = NULL;
f32 minDistSq = FLT_MAX;
f32 minDistSq = MAXFLOAT;
Actor* actorIter = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].first;
while (actorIter != NULL) {

View File

@ -706,7 +706,7 @@ s32 EnInvadepoh_Dog_FindClosestPointToTarget(EnInvadepoh* this, Vec3f* target) {
s32 endPoint = this->endPoint;
Vec3s* pathPoint;
Vec3f pointPos;
f32 minDistSqToTarget = FLT_MAX;
f32 minDistSqToTarget = MAXFLOAT;
f32 distSqToTarget;
s32 closestPoint = 0;
@ -1312,7 +1312,7 @@ s32 EnInvadepoh_LensFlareCheck(PlayState* play, Vec3f* pos) {
*/
void EnInvadepoh_InvasionHandler_SetClosestAlienThreat(EnInvadepoh* this) {
s32 i;
f32 minDistSqToBarn = FLT_MAX;
f32 minDistSqToBarn = MAXFLOAT;
s32 closestAlienIndex = -1;
for (i = 0; i < this->alienCount; i++) {

View File

@ -119,7 +119,7 @@ void func_80B5B2E0(PlayState* play, Vec3f* pos, s16 pathIndex, Vec3f* vec, s32*
f32 dist;
Vec3f sp58;
Vec3f sp4C;
f32 minDist = FLT_MAX;
f32 minDist = MAXFLOAT;
for (i = 0; i < path->count; i++) {
Math_Vec3s_ToVec3f(&sp58, &((Vec3s*)Lib_SegmentedToVirtual(path->points))[i]);

View File

@ -921,7 +921,7 @@ void func_80AEE374(EnTk* this, PlayState* play) {
EnTkStruct sp30;
sp30.unk_00 = NULL;
sp30.unk_04 = FLT_MAX;
sp30.unk_04 = MAXFLOAT;
SubS_FindActorCustom(play, &this->actor, NULL, ACTORCAT_NPC, ACTOR_EN_TK, &sp30, func_80AEE300);
if (sp30.unk_00 == 0) {

View File

@ -441,7 +441,7 @@ s32 func_80A24118(ObjIceblock* this, PlayState* play, f32 arg2, Vec3f* arg3) {
temp_f24 = temp_f20 * spF0;
temp_f26 = temp_f20 * spEC;
ret = false;
phi_f20 = FLT_MAX;
phi_f20 = MAXFLOAT;
for (i = 0; i < ARRAY_COUNT(D_80A26EE0); i++) {
spC4.x = (D_80A26EE0[i].unk_00 * this->dyna.actor.scale.x) + D_80A26F08[i].unk_00;
@ -518,7 +518,7 @@ s32 func_80A243E0(ObjIceblock* this, PlayState* play, Vec3f* arg0) {
ret = false;
temp_f28 = temp_f12 * sp100;
temp_f30 = temp_f12 * spFC;
phi_f22 = FLT_MAX;
phi_f22 = MAXFLOAT;
for (i = 0; i < ARRAY_COUNT(D_80A26F30); i++) {
spD4.x = (D_80A26F30[i] * this->dyna.actor.scale.x) + D_80A26F38[i];

View File

@ -240,7 +240,7 @@ s32 func_80A216D4(ObjSkateblock* this, PlayState* play, f32 arg2, Vec3f* arg3) {
temp_f26 = temp_f2 * spE4;
ret = false;
temp_f20 = FLT_MAX;
temp_f20 = MAXFLOAT;
for (i = 0; i < ARRAY_COUNT(D_80A22A6C); i++) {
spBC.x = (D_80A22A6C[i].x * this->dyna.actor.scale.x) + D_80A22A94[i].x;
@ -313,7 +313,7 @@ s32 func_80A21990(ObjSkateblock* this, PlayState* play, Vec3f* arg2) {
temp_f30 = -temp_f12 * temp_f26;
ret = false;
phi_f22 = FLT_MAX;
phi_f22 = MAXFLOAT;
for (i = 0; i < ARRAY_COUNT(D_80A22ABC); i++) {
spD4.x = (D_80A22ABC[i] * this->dyna.actor.scale.x) + D_80A22AC4[i];

View File

@ -630,7 +630,7 @@ void func_80B30808(ObjSpidertent* this, PlayState* play) {
this->collider.base.acFlags &= ~AC_HIT;
phi_s1 = 0;
phi_s4 = -1;
phi_f20 = FLT_MAX;
phi_f20 = MAXFLOAT;
for (i = 0; i < ARRAY_COUNT(this->colliderElements); i++) {
ptr = &this->collider.elements[i];

View File

@ -296,7 +296,7 @@ s32 func_80A1E074(ObjSpinyroll* this, PlayState* play, Vec3f* arg2, s32 arg3) {
spC8.y = this->dyna.actor.world.pos.y + 10.0f;
spBC.y = spC8.y;
sp98 = false;
temp_f20 = FLT_MAX;
temp_f20 = MAXFLOAT;
ptr->unk_F0 = NULL;
for (i = 0; i < ARRAY_COUNT(this->unk_3A4.unk_00); i++) {
@ -383,7 +383,7 @@ s32 func_80A1E3D8(ObjSpinyroll* this, PlayState* play, f32* arg2, s32 arg3) {
sp84 = false;
sp94.y = this->dyna.actor.world.pos.y + 24.0f;
phi_f22 = FLT_MAX;
phi_f22 = MAXFLOAT;
spC8->unk_F0 = NULL;
for (i = 0, temp = D_80A1F1FC; i < ARRAY_COUNT(this->unk_3A4.unk_00); i++, temp++) {

View File

@ -170,7 +170,7 @@ s32 func_80A3C8D8(ObjVspinyroll* this, PlayState* play, Vec3f* arg2, s32 arg3) {
Vec3f spC0;
Vec3f spB4;
Vec3f spA8;
f32 temp_f20 = FLT_MAX;
f32 temp_f20 = MAXFLOAT;
f32 temp_f0;
s32 sp9C;

View File

@ -12252,11 +12252,11 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) {
} else {
this->talkActor = NULL;
this->exchangeItemAction = PLAYER_IA_NONE;
this->talkActorDistance = FLT_MAX;
this->talkActorDistance = MAXFLOAT;
}
if (!(this->actor.flags & ACTOR_FLAG_20000000) && (this->unk_AA5 != PLAYER_UNKAA5_5)) {
this->unk_A90 = NULL;
this->unk_A94 = FLT_MAX;
this->unk_A94 = MAXFLOAT;
}
if (!(this->stateFlags1 & PLAYER_STATE1_800)) {
this->interactRangeActor = NULL;
@ -12268,7 +12268,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) {
this->tatlTextId = 0;
this->unk_B2B = -1;
this->closestSecretDistSq = FLT_MAX;
this->closestSecretDistSq = MAXFLOAT;
this->doorType = PLAYER_DOORTYPE_NONE;
this->unk_B75 = 0;
this->unk_A78 = NULL;

View File

@ -448,7 +448,7 @@ def format_f32(f_wd):
if f_wd in [0xB8E4AECD, 0xB8E4C3AA, 0x38D1B718]:
return f".word 0x{f_wd:08X}"
if f_wd == 0x7F7FFFFF: # FLT_MAX
if f_wd == 0x7F7FFFFF: # MAXFLOAT
return ".float 3.4028235e+38"
f = as_float(struct.pack(">I", f_wd))