src/core1/ml.c: more consistent function names

This commit is contained in:
mariob92
2024-10-17 16:45:16 +02:00
parent bc6680d618
commit e19c5f75d0
78 changed files with 216 additions and 248 deletions

View File

@@ -1,14 +1,14 @@
#ifndef BANJO_KAZOOIE_CORE1_ML_H
#define BANJO_KAZOOIE_CORE1_ML_H
f32 func_80255D70(f32 x);
void func_80255E58(f32 vec1[3], f32 vec2[3], f32 vec3[3], f32 vec4[3]);
f32 func_80255F14(f32 vec1[3], f32 vec2[3]);
void ml_crossProduct_vec3f(f32 dst[3], f32 vec1[3], f32 vec2[3]);
void ml_interpolate_vec3f(f32 dst[3], f32 vec1[3], f32 vec2[3], f32 scale);
f32 ml_dotProduct_vec3f(f32 vec1[3], f32 vec2[3]);
f32 ml_distance_vec3f(f32 vec1[3], f32 vec2[3]);
f32 func_802560D0(f32 arg0[3], f32 arg1[3], f32 arg2[3]);
f32 ml_acosf_deg(f32 x);
void ml_vec3f_sub_and_rotate(f32 vec1[3], f32 rotation[3], f32 vec2[3], f32 dst[3]);
f32 ml_vec3f_cos_between(f32 vec1[3], f32 vec2[3]);
void ml_vec3f_cross_product(f32 dst[3], f32 vec1[3], f32 vec2[3]);
void ml_vec3f_interpolate_fast(f32 dst[3], f32 start[3], f32 end[3], f32 t);
f32 ml_vec3f_dot_product(f32 vec1[3], f32 vec2[3]);
f32 ml_vec3f_distance(f32 vec1[3], f32 vec2[3]);
f32 ml_func_802560D0(f32 arg0[3], f32 arg1[3], f32 arg2[3]);
f32 ml_distanceSquared_vec3f(f32 vec1[3], f32 vec2[3]);
void func_802562DC(f32 vec1[3], f32 vec2[3], f32 vec3[3]);
f32 ml_vec3f_length_unused(f32 vec[3]);
@@ -64,14 +64,14 @@ int func_80257F18(f32 src[3], f32 target[3], f32 *yaw);
int func_8025801C(f32 target[3], f32 *yaw);
int func_80258108(f32 vec[3], f32 *arg1, f32 *arg2);
int func_80258210(f32 x, f32 y, f32 *dst);
int ml_isZero_vec3f(f32 vec[3]);
bool ml_isZero_vec3f(f32 vec[3]);
bool ml_isNonzero_vec3f(f32 vec[3]);
int func_802583D8(f32 vec[3]);
int func_80258424(f32 vec[3], f32 minX, f32 minY, f32 minZ, f32 maxX, f32 maxY, f32 maxZ);
int func_802584FC(f32 vec[3], f32 min[3], f32 max[3]);
int func_802585E0(s32 vec[3], s32 minX, s32 minY, s32 minZ, s32 maxX, s32 maxY, s32 maxZ);
bool ml_vec3f_not_on_vertical_axis(f32 vec[3]);
bool ml_vec3f_inside_box_f(f32 vec[3], f32 minX, f32 minY, f32 minZ, f32 maxX, f32 maxY, f32 maxZ);
bool ml_vec3f_inside_box_vec3f(f32 vec[3], f32 min[3], f32 max[3]);
bool ml_vec3w_inside_box_w(s32 vec[3], s32 minX, s32 minY, s32 minZ, s32 maxX, s32 maxY, s32 maxZ);
f32 ml_vec3f_horizontal_distance_zero_likely(f32 vec1[3], f32 vec2[3]);
f32 func_802586B0(f32 vec1[3], f32 vec2[3]);
f32 ml_vec3f_horizontal_distance_squared_zero_likely(f32 vec1[3], f32 vec2[3]);
f32 ml_vec3f_length(f32 vec1[3], f32 vec2[3]);
f32 ml_vec3f_length_sq(f32 vec1[3], f32 vec2[3]);
f32 ml_sin_deg(f32 angle_deg);
@@ -110,13 +110,13 @@ bool ml_vec3f_point_within_horizontal_distance(f32 vec[3], f32 x, f32 z, f32 dis
bool ml_vec3f_within_horizontal_distance(f32 vec1[3], f32 vec2[3], f32 distance);
bool ml_vec3w_within_horizontal_distance(s32 vec1[3], s32 vec2[3], s32 distance);
bool ml_vec3f_within_distance(f32 vec1[3], f32 vec2[3], f32 distance);
bool func_80259400(f32 a0);
void func_80259430(f32 *val);
bool ml_stub_80259400(f32 x);
void ml_sub_delta_time(f32 *x);
void func_8025947C(f32 a0[3], f32 a1[3], f32 a2[3], f32 a3[3]);
f32 func_80259554(f32 dst[3], f32 vec1[3], f32 vec2[3], f32 vec3[3]);
void func_802596AC(f32 a0[3], f32 a1[3], f32 a2[3], f32 a3[3]);
s32 func_8025975C(f32 a0);
bool func_80259808(f32 a0);
void func_8025982C(f32 dst[3], f32 arg1[3], f32 arg2[3], f32 arg3);
s32 ml_getViewportYawWithOffset(f32 x);
bool ml_isViewportYawWithOffsetNormalized(f32 x);
void ml_vec3f_interpolate(f32 dst[3], f32 start[3], f32 end[3], f32 t);
#endif

View File

@@ -321,7 +321,7 @@ void chTiptup_update(Actor *this){
}
}
else{
if(ml_distance_vec3f(this->position, player_position) < 300.0f && player_getTransformation() == TRANSFORM_1_BANJO && !jiggyscore_isSpawned(JIGGY_27_BGS_TIPTUP)){
if(ml_vec3f_distance(this->position, player_position) < 300.0f && player_getTransformation() == TRANSFORM_1_BANJO && !jiggyscore_isSpawned(JIGGY_27_BGS_TIPTUP)){
chTiptup_setState(this, 2);
}
}
@@ -335,12 +335,12 @@ void chTiptup_update(Actor *this){
}
} //L80389370
else{
if(ml_distance_vec3f(this->position, player_position) >= 300.0f)
if(ml_vec3f_distance(this->position, player_position) >= 300.0f)
chTiptup_setState(this, 1);
}
}//L803893A0
if(this->state == 6){
if(ml_distance_vec3f(this->position, player_position) < 300.0f && !unqPtr->unk8){
if(ml_vec3f_distance(this->position, player_position) < 300.0f && !unqPtr->unk8){
unqPtr->unk8 = 1;
gcdialog_showText(0xc7d, 4, 0, 0, 0, 0);
}

View File

@@ -372,7 +372,7 @@ void chflibbit_update(Actor *this){
sp84[0] = (f32)local->unkE[0];
sp84[1] = (f32)local->unkE[1];
sp84[2] = (f32)local->unkE[2];
if(ml_distance_vec3f(this->position, sp84) < 30.0f){
if(ml_vec3f_distance(this->position, sp84) < 30.0f){
func_80386AEC(this, 1);
}
else{

View File

@@ -260,7 +260,7 @@ bool func_8038C2A8(ActorMarker *marker) {
local = (ActorLocal_MrVile *)&this->local;
player_getPosition(player_position);
if (this->state == 6) {
return ml_distance_vec3f(this->position, player_position) < 150.0f;
return ml_vec3f_distance(this->position, player_position) < 150.0f;
}
return local->unk0 == 1;
}
@@ -351,7 +351,7 @@ void chvile_update(Actor *this) {
local->game_marker = actorArray_findClosestActorFromActorId(this->position, 0x138, -1, &sp90)->marker;
}
player_getPosition(player_position);
sp90 = ml_distance_vec3f(this->position, player_position);
sp90 = ml_vec3f_distance(this->position, player_position);
if (sp90 <= 300.0f) {
local->unk0 = (local->unk0 == 0) ? 1 : 2;
} else if (sp90 > 300.0f) {
@@ -411,7 +411,7 @@ void chvile_update(Actor *this) {
if (this->state == 4) {
player_getPosition(local->target_position);
local->unk10 = 500.0f;
if ((local->unkC == 102) && (ml_distance_vec3f(this->position, local->target_position) < 200.0f)) {
if ((local->unkC == 102) && (ml_vec3f_distance(this->position, local->target_position) < 200.0f)) {
BGS_func_8038BBA0(this, 103);
}
if ((local->unkC == 103) && (skeletalAnim_getLoopCount(this->unk148) >= 2)) {
@@ -420,7 +420,7 @@ void chvile_update(Actor *this) {
}
if (this->state == 5) {
local->unk10 = 200.0f;
if (ml_distance_vec3f(this->position, local->target_position) < 100.0f) {
if (ml_vec3f_distance(this->position, local->target_position) < 100.0f) {
local->target_position[0] = randf2(-500.0f, 500.0f);
local->target_position[1] = 0.0f;
local->target_position[2] = randf2(-500.0f, 500.0f);
@@ -428,12 +428,12 @@ void chvile_update(Actor *this) {
}
if ((this->state == 6)){
local->unk10 = 400.0f;
if((ml_distance_vec3f(this->position, local->target_position) < 100.0f) || (ml_distance_vec3f(player_position, local->target_position) < 300.0f)) {
if((ml_vec3f_distance(this->position, local->target_position) < 100.0f) || (ml_vec3f_distance(player_position, local->target_position) < 300.0f)) {
for(i = 0; i < 10; i++){
random_position[0] = randf2(-500.0f, 500.0f);
random_position[1] = 0.0f;
random_position[2] = randf2(-500.0f, 500.0f);
if ((i == 0) || (ml_distance_vec3f(player_position, random_position) > ml_distance_vec3f(player_position, local->target_position))) {
if ((i == 0) || (ml_vec3f_distance(player_position, random_position) > ml_vec3f_distance(player_position, local->target_position))) {
local->target_position[0] = random_position[0];
local->target_position[1] = random_position[1];
local->target_position[2] = random_position[2];

View File

@@ -140,7 +140,7 @@ void func_8038F6A4(Actor *this)
player_getPosition(sp48);
if (!this->has_met_before)
{
if ((((ml_distance_vec3f(local->unk18, sp48) < 250.0f) && (ml_distance_vec3f(local->unk18, sp48) > 80.0f)) && (!func_8028ECAC())) && (player_getTransformation() == TRANSFORM_1_BANJO))
if ((((ml_vec3f_distance(local->unk18, sp48) < 250.0f) && (ml_vec3f_distance(local->unk18, sp48) > 80.0f)) && (!func_8028ECAC())) && (player_getTransformation() == TRANSFORM_1_BANJO))
{
gcdialog_showText(0xC7E, 0, 0, 0, 0, 0);
this->has_met_before = TRUE;

View File

@@ -423,7 +423,7 @@ void BGS_func_8038E034(Actor *this) {
sp7C[0] = (f32) local->unk10[0];
sp7C[1] = (f32) local->unk10[1];
sp7C[2] = (f32) local->unk10[2];
if (ml_distance_vec3f(this->position, sp7C) < 30.0f) {
if (ml_vec3f_distance(this->position, sp7C) < 30.0f) {
func_8038D9D0(this, 1);
} else {
func_8038D9D0(this, 5);

View File

@@ -169,7 +169,7 @@ void BGS_func_80389850(Actor *this, s32 arg1) {
sp7C[2] = 0.0f;
sp7C[1] = sp94[1];
sp7C[0] = 0.0f;
if(ml_distance_vec3f(sp94, sp7C) <= 1000.0f){
if(ml_vec3f_distance(sp94, sp7C) <= 1000.0f){
break;
}
}
@@ -428,7 +428,7 @@ void chvilegame_player_consume_piece(Actor *this) {
if ((end != begin) && BGS_func_80389810(sp44)){
sp44[1] = 0.0f;
for(i_ptr = begin; i_ptr < end; i_ptr++){
if ((ml_distance_vec3f(i_ptr->position, sp44) < 65.25) && chyumblie_is_edible(i_ptr->marker)) {
if ((ml_vec3f_distance(i_ptr->position, sp44) < 65.25) && chyumblie_is_edible(i_ptr->marker)) {
is_correct_type = ((local->current_type != YUMBLIE) && (i_ptr->type != YUMBLIE)) || (((local->current_type == YUMBLIE) && i_ptr->type == YUMBLIE));
if (is_correct_type) {
local->player_score++;
@@ -466,7 +466,7 @@ bool chvilegame_cpu_consume_piece(ActorMarker *marker, f32 position[3]) {
begin = vector_getBegin(local->game_pieces);
end = vector_getEnd(local->game_pieces);
for(i_ptr = begin; i_ptr < end; i_ptr++){
if ((ml_distance_vec3f(i_ptr->position, position) < 50.0f) && func_8038B684(i_ptr->marker)) {
if ((ml_vec3f_distance(i_ptr->position, position) < 50.0f) && func_8038B684(i_ptr->marker)) {
local->vile_score++;
timedFunc_set_1(0.0f, (GenFunction_1)func_802FDCB8, ITEM_1B_VILE_VILE_SCORE);
timedFunc_set_1(0.5f, (GenFunction_1)func_802FDCB8, ITEM_1B_VILE_VILE_SCORE);
@@ -545,12 +545,12 @@ bool chvilegame_find_closest_piece(ActorMarker *marker, f32 position[0], f32 yaw
piece_direction[0] = i_ptr->position[0] - position[0];
piece_direction[1] = i_ptr->position[1] - position[1];
piece_direction[2] = i_ptr->position[2] - position[2];
distance = ml_distance_vec3f(i_ptr->position, position);
distance = ml_vec3f_distance(i_ptr->position, position);
angle_diff = func_80256AB4(target_direction[0], target_direction[2], piece_direction[0], piece_direction[2]);
if( (distance > 300.0f)
|| ((-0.8 < angle_diff) && (angle_diff < 0.8) && ((piece_direction[0]*target_direction[0] + piece_direction[1]*target_direction[1] + piece_direction[2]*target_direction[2]) >= 0.0f))
) {
if ((closest_piece == NULL) || (distance < ml_distance_vec3f(position, closest_piece->position))){
if ((closest_piece == NULL) || (distance < ml_vec3f_distance(position, closest_piece->position))){
closest_piece = i_ptr;
}
}

View File

@@ -330,7 +330,7 @@ void CC_func_80388F4C(void){
CC_func_80387D4C();
if(D_80389FA0.unk21 != 0 && func_80334904() == 2){
player_getPosition(sp6C);
D_80389FA0.unk20 = (ml_distance_vec3f(sp6C, D_80389FA0.unkC) < 200.0f);
D_80389FA0.unk20 = (ml_vec3f_distance(sp6C, D_80389FA0.unkC) < 200.0f);
D_80389FA0.unk38 += sp68;
sp64 = skeletalAnim_getProgress(D_80389FA0.unk0);
@@ -380,7 +380,7 @@ void CC_func_80388F4C(void){
if(D_80389FA0.unk21 == 3){
func_8034A174(D_80389FA0.unk34, 6, sp48);
if(ml_distance_vec3f(sp48, sp6C) <= 130.0f && sp6C[1] - sp48[1] < 50.0f){
if(ml_vec3f_distance(sp48, sp6C) <= 130.0f && sp6C[1] - sp48[1] < 50.0f){
func_8031D04C(MAP_21_CC_WITCH_SWITCH_ROOM, 1);
}
}//L80389260

View File

@@ -136,7 +136,7 @@ void func_803870F8(Actor *this){
sp3C[0] = this->position_x;
sp3C[1] = this->position_y + 100;
sp3C[2] = this->position_z;
if(ml_distance_vec3f(&sp3C, &sp70) < 120.0f){
if(ml_vec3f_distance(&sp3C, &sp70) < 120.0f){
func_8031D04C(MAP_22_CC_INSIDE_CLANKER, (local->unk0 == 1)? 7 : 6);
}
}//L80387500

View File

@@ -45,7 +45,7 @@ void func_803878A0(Actor *this, s32 next_state) {
local->unkC[0] = randf2(-500.0f, 500.0f);
local->unkC[1] = randf2(400.0f, 900.0f);
local->unkC[2] = randf2(-400.0f, 700.0f);
if(ml_distance_vec3f(this->position, local->unkC) > 800.0f)
if(ml_vec3f_distance(this->position, local->unkC) > 800.0f)
break;
}
local->unk8 = randf2(500.0f, 1000.0f);
@@ -90,7 +90,7 @@ void CCW_func_80387A40(Actor *this) {
sp5C[0] = local->unkC[0] - this->position[0];
sp5C[1] = local->unkC[1] - this->position[1];
sp5C[2] = local->unkC[2] - this->position[2];
if (ml_distance_vec3f(this->position, local->unkC) < 500.0f) {
if (ml_vec3f_distance(this->position, local->unkC) < 500.0f) {
ml_vec3f_set_length(sp5C, local->unk8 * 8.0f);
} else {
ml_vec3f_set_length(sp5C, local->unk8 * 2);
@@ -106,7 +106,7 @@ void CCW_func_80387A40(Actor *this) {
}
func_80258A4C(this->position, this->yaw - 90.0f, local->unkC, &sp58, &sp54, &sp50);
this->yaw += 140.0f * sp50 * sp68;
if (ml_distance_vec3f(this->position, local->unkC) < 100.0f) {
if (ml_vec3f_distance(this->position, local->unkC) < 100.0f) {
func_803878A0(this, 1);
}
}

View File

@@ -183,10 +183,10 @@ void func_8038687C(Actor *this) {
sp4C[1] = -100.0f;
sp4C[2] = randf2(-500.0f, 900.0f);
if(ml_distance_vec3f(this->position, sp4C) < 400.0f)
if(ml_vec3f_distance(this->position, sp4C) < 400.0f)
continue;
tmp = ml_distance_vec3f(sp5C, sp4C);
tmp = ml_vec3f_distance(sp5C, sp4C);
phi_v0 = (phi_s0 < 0xA) ? 500 : 200;
if(tmp < (f32) phi_v0)
continue;
@@ -207,7 +207,7 @@ void func_8038687C(Actor *this) {
func_803865F4(this, 3);
} else if ((local->unk0 != NULL) && (map_get() == MAP_5A_CCW_SUMMER_ZUBBA_HIVE)) {
player_getPosition(sp40);
if ((ml_distance_vec3f(this->position, sp40) < 300.0f) && (player_getTransformation() == TRANSFORM_1_BANJO)) {
if ((ml_vec3f_distance(this->position, sp40) < 300.0f) && (player_getTransformation() == TRANSFORM_1_BANJO)) {
func_803865F4(this, 2);
}
}

View File

@@ -161,7 +161,7 @@ void chGobiCCW_update(Actor *this) {
if(this->state == 1){
if (!this->has_met_before) {
player_getPosition(sp48);
if (ml_distance_vec3f(this->position, sp48) < 600.0f) {
if (ml_vec3f_distance(this->position, sp48) < 600.0f) {
if (local->unk0->unk2 != 0) {
gcdialog_showText((s32) local->unk0->unk2, 4, NULL, NULL, NULL, NULL);
}

View File

@@ -271,7 +271,7 @@ void CCW_func_80389BFC(Actor *this) {
}
if ((local->unk0->map_id != MAP_43_CCW_SPRING) && ((this->position[0] + 500.0f) < sp4C[0])) {
player_setCarryObjectPoseInCylinder(this->position, 1110.0f, 200.0f, ACTOR_2A2_CATERPILLAR, &this);
if ((local->unk0->unkE != 0) && (carriedObj_getActorId() == ACTOR_2A2_CATERPILLAR) && (ml_distance_vec3f(this->position, sp4C) < 1010.0f) && (player_throwCarriedObject() != 0)) {
if ((local->unk0->unkE != 0) && (carriedObj_getActorId() == ACTOR_2A2_CATERPILLAR) && (ml_vec3f_distance(this->position, sp4C) < 1010.0f) && (player_throwCarriedObject() != 0)) {
player_setThrowTargetPosition(D_8038FDE0);
if ((local->unk0->map_id == MAP_44_CCW_SUMMER) && (local->unk4 == 0)) {
gcdialog_showText(0xCD8, 4, NULL, NULL, NULL, NULL);

View File

@@ -111,13 +111,13 @@ void chcaterpillar_update(Actor *this){
if(this->state == 1){
skeletalAnim_getProgressRange(this->unk148, &sp64, &sp60);
player_getPosition(sp74);
if(ml_distance_vec3f(this->position, local->unk0) < 10.0f){
if(ml_vec3f_distance(this->position, local->unk0) < 10.0f){
for(i = 0; i < 10; i++){
local->unk0[0] = randf2(-300.0f, 300.0f) + this->position_x;
local->unk0[1] = this->position_y;
local->unk0[2] = randf2(-300.0f, 300.0f) + this->position_z;
if( !(ml_distance_vec3f(local->unk0, this->position) < 50.0f) && func_80329210(this, local->unk0))
if( !(ml_vec3f_distance(local->unk0, this->position) < 50.0f) && func_80329210(this, local->unk0))
break;
}//L8038A544
if(i == 10){
@@ -150,7 +150,7 @@ void chcaterpillar_update(Actor *this){
}
}//L8038A714
if(ml_distance_vec3f(this->position, sp74) < 50.0f){
if(ml_vec3f_distance(this->position, sp74) < 50.0f){
func_8028F030(ACTOR_2A2_CATERPILLAR);
if(!volatileFlag_get(VOLATILE_FLAG_B2)){
gcdialog_showText(ASSET_CC7_TEXT_UNKNOWN, 4, NULL, NULL, NULL, NULL);
@@ -177,7 +177,7 @@ void chcaterpillar_update(Actor *this){
local->unk24 += 3.3333333333333335*sp84;
local->unk24 = (1.0 < local->unk24) ? 1.0 : local->unk24;
ml_interpolate_vec3f(this->position, local->unkC, local->unk18, local->unk24);
ml_vec3f_interpolate_fast(this->position, local->unkC, local->unk18, local->unk24);
this->position[1] += 50.0f*sinf(local->unk24*3.141592654);
if(1.0 == local->unk24){

View File

@@ -101,7 +101,7 @@ void func_8038AA8C(Actor *this) {
}
player_getPosition(sp54);
if (ml_distance_vec3f(this->position, sp54) < 850.0f) {
if (ml_vec3f_distance(this->position, sp54) < 850.0f) {
func_8038A950(this, 2);
}
}

View File

@@ -133,7 +133,7 @@ void chnabnut_update(Actor *this) {
if (this->state == NABNUT_STATE_1_SAD) {
player_getPosition(sp30);
if (!this->has_met_before && (ml_distance_vec3f(this->position, sp30) < 400.0f)) {
if (!this->has_met_before && (ml_vec3f_distance(this->position, sp30) < 400.0f)) {
this->has_met_before = TRUE;
gcdialog_showText(0xCCA, 0xE, this->position, NULL, NULL, NULL);
}
@@ -143,7 +143,7 @@ void chnabnut_update(Actor *this) {
}
if (this->has_met_before && !func_803114B0()) {
player_setCarryObjectPoseInCylinder(this->position, 500.0f, 200.0f, ACTOR_2A9_ACORN, &this);
if ((carriedObj_getActorId() == ACTOR_2A9_ACORN) && (ml_distance_vec3f(this->position, sp30) < 300.0f) && player_throwCarriedObject()) {
if ((carriedObj_getActorId() == ACTOR_2A9_ACORN) && (ml_vec3f_distance(this->position, sp30) < 300.0f) && player_throwCarriedObject()) {
player_setThrowTargetPosition(D_8038F350);
local->returned_acorn_count++;
if (local->returned_acorn_count == 6) {

View File

@@ -114,7 +114,7 @@ void func_8038C41C(Actor *this) {
if ((this->marker->id == 0x1CB) && (this->state == 2)) {
player_getPosition(sp2C);
if (!this->has_met_before && (ml_distance_vec3f(this->position, sp2C) < 400.0f)) {
if (!this->has_met_before && (ml_vec3f_distance(this->position, sp2C) < 400.0f)) {
this->has_met_before = TRUE;
gcdialog_showText(0xCCD, 0, NULL, NULL, NULL, NULL);
}

View File

@@ -73,7 +73,7 @@ void func_8038C7A8(Actor *this) {
if (this->state == 1) {
player_getPosition(sp38);
if (ml_distance_vec3f(this->position, sp38) < 50.0f) {
if (ml_vec3f_distance(this->position, sp38) < 50.0f) {
func_8028F030(0x2A9);
FUNC_8030E8B4(SFX_C5_TWINKLY_POP, 1.0f, 25000, this->position, 500, 2500);
CCW_func_8038C6A0(this, 5);
@@ -91,7 +91,7 @@ void func_8038C7A8(Actor *this) {
if (this->state == 3) {
local->unk18 += 3.3333333333333333 * sp44;
local->unk18 = (local->unk18 > 1.0) ? 1.0 : local->unk18;
ml_interpolate_vec3f(this->position, local->unk0, local->unkC, local->unk18);
ml_vec3f_interpolate_fast(this->position, local->unk0, local->unkC, local->unk18);
this->position[1] += 50.0f * sinf(local->unk18 * BAD_PI);
if (local->unk18 == 1.0) {
CCW_func_8038C6A0(this, 4);

View File

@@ -118,7 +118,7 @@ void func_8038CC4C(Actor *this) {
}
if (!this->has_met_before) {
player_getPosition(sp38);
if (ml_distance_vec3f(this->position, sp38) < 900.0f) {
if (ml_vec3f_distance(this->position, sp38) < 900.0f) {
if (local->unk0->map_id != MAP_46_CCW_WINTER || func_8028F2FC()) {
gcdialog_showText(local->unk0->unk4, 4, NULL, NULL, NULL, NULL);
this->has_met_before = TRUE;

View File

@@ -116,7 +116,7 @@ void func_8038CFB4(Actor *this) {
if (this->state == 1) {
if (!this->has_met_before) {
player_getPosition(sp60);
if (ml_distance_vec3f(this->position, sp60) < 900.0f) {
if (ml_vec3f_distance(this->position, sp60) < 900.0f) {
gcdialog_showText(0xCCF, 4, NULL, NULL, NULL, NULL);
this->has_met_before = TRUE;
}

View File

@@ -69,7 +69,7 @@ void func_8038D368(Actor *this) {
if(!this->has_met_before){
player_getPosition(plyr_pos);
if (ml_distance_vec3f(this->position, plyr_pos) < 600.0f) {
if (ml_vec3f_distance(this->position, plyr_pos) < 600.0f) {
if (!jiggyscore_isCollected(JIGGY_4B_CCW_GNAWTY)) {
gcdialog_showText(local->unk0->unk2, 4, NULL, NULL, NULL, NULL);
} else {

View File

@@ -140,7 +140,7 @@ bool func_8038F5D4(Actor *this, f32 arg1[3], f32 arg2, f32 arg3, s32 arg4){
}
this->actor_specific_1_f = (1.0f- sp24)*arg2;
func_80329054(this, 2);
if(ml_distance_vec3f(this->position, arg1) <= arg4)
if(ml_vec3f_distance(this->position, arg1) <= arg4)
return TRUE;
return FALSE;

View File

@@ -72,7 +72,7 @@ void func_8038D47C(Actor *this){
if(!mapSpecificFlags_get(0x14)){
player_getPosition(sp3C);
if(func_8028ECAC() == 0){
if( ml_distance_vec3f(sp3C, this->unk1C) < 100.0f || ml_distance_vec3f(sp3C, this->velocity) < 100.0f){
if( ml_vec3f_distance(sp3C, this->unk1C) < 100.0f || ml_vec3f_distance(sp3C, this->velocity) < 100.0f){
if(gcdialog_showText(ASSET_A7B_TEXT_JINXY_MEET, 0, NULL, NULL, NULL, NULL)){
mapSpecificFlags_set(0x14, 1);
}

View File

@@ -210,7 +210,7 @@ void chChompa_update(Actor *this) {
}//L803880B4
player_getPosition(plyr_position);
plyr_dist = ml_distance_vec3f(this->position, plyr_position);
plyr_dist = ml_vec3f_distance(this->position, plyr_position);
if (this->state == CHOMPA_STATE_4_BITING) {
actor_collisionOn(this);

View File

@@ -385,7 +385,7 @@ void organMinigame_update(void){
if(func_8038769C(D_8038C4F0.motzhand_marker)){
player_getPosition(plyr_pos);
motzhand_2 = marker_getActor(D_8038C4F0.motzhand_marker);
if( ml_distance_vec3f(motzhand_2->position, plyr_pos) < 400.0f
if( ml_vec3f_distance(motzhand_2->position, plyr_pos) < 400.0f
&& motzhand_2->position_y - 50.0f <= plyr_pos[1]
){
organMinigame_setState(2);

View File

@@ -119,7 +119,7 @@ void func_803890BC(Actor *this){
local->unk1C += 0.25 * sp38;
if(1.0f < local->unk1C)
local->unk1C = 1.0f;
ml_interpolate_vec3f(sp2C, local->unk4, local->unk10, local->unk1C);
ml_vec3f_interpolate_fast(sp2C, local->unk4, local->unk10, local->unk1C);
this->pitch = sp2C[0];
this->yaw = sp2C[1];
this->roll = sp2C[2];

View File

@@ -275,7 +275,7 @@ void func_8038F430(ActorMarker *marker, s32 arg1){
if(actor->state < 3){
player_getPosition(&sp18);
if(ml_distance_vec3f(&actor->position, &sp18) < 300.0f)
if(ml_vec3f_distance(&actor->position, &sp18) < 300.0f)
func_8028F55C(5, actor->marker);
func_8038F190(actor, 3);
}//L8038F4A4
@@ -352,7 +352,7 @@ void func_8038F618(Actor *this){
}
func_8038E92C(this);
if(this->state == 1){
if(sp78 && ml_distance_vec3f(&this->position, &sp7C) < 500.0f){
if(sp78 && ml_vec3f_distance(&this->position, &sp7C) < 500.0f){
func_8038F190(this, 2);
}
}//L8038F7A0
@@ -371,7 +371,7 @@ void func_8038F618(Actor *this){
skeletalAnim_getProgressRange(this->unk148, &sp6C, &sp68);
if(0.1 <= sp68 && sp68 <= 0.6)
ml_interpolate_vec3f(this->position, &local->unk14, &local->unk20, (sp68 - 0.1) /0.5 );
ml_vec3f_interpolate_fast(this->position, &local->unk14, &local->unk20, (sp68 - 0.1) /0.5 );
if(sp6C < 0.6 && 0.6 <= sp68)
func_8030E878(SFX_6C_LOCKUP_CLOSING, 1.1 + randf2(-0.05f, 0.05f), 20000, this->position, 500.0f, 1000.0f);
@@ -386,7 +386,7 @@ void func_8038F618(Actor *this){
this->yaw += (sp44*400.0f)*sp70;
if(skeletalAnim_getLoopCount(this->unk148) > 0){
if(ml_distance_vec3f(&this->position, &local->unk8) < 10.0f){
if(ml_vec3f_distance(&this->position, &local->unk8) < 10.0f){
func_8038F190(this, 1);
}else{
func_8038F190(this, 2);

View File

@@ -546,7 +546,7 @@ void func_8038D8BC(Actor *this){
}
}
else{//L8038DAA8
if(ml_distance_vec3f(this->position, player_position) < 1200.0f){
if(ml_vec3f_distance(this->position, player_position) < 1200.0f){
RBB_func_8038CC9C(this, 2);
}
}
@@ -582,7 +582,7 @@ void func_8038D8BC(Actor *this){
skeletalAnim_getProgressRange(this->unk148, &sp54, &sp50);
if(0.1 <= sp50 && sp50 <= 0.6){
sp4C = (sp50 - 0.1)/0.5;
ml_interpolate_vec3f(this->position, local->unk8, local->unk14, sp4C);
ml_vec3f_interpolate_fast(this->position, local->unk8, local->unk14, sp4C);
this->yaw = local->unk24 + sp4C*(local->unk28 - local->unk24);
}
@@ -600,7 +600,7 @@ void func_8038D8BC(Actor *this){
tmp_f2 = tmp_f2/0.3;
else
tmp_f2 = 1.0f;
ml_interpolate_vec3f(this->position, local->unk8, local->unk14, tmp_f2);
ml_vec3f_interpolate_fast(this->position, local->unk8, local->unk14, tmp_f2);
}
}//L8038DE10

View File

@@ -101,7 +101,7 @@ void func_80387488(ActorMarker *marker){
player_getPosition(&sp1C);
if(-50.0f < sp1C[1] && sp1C[1] < 600.0f){
sp1C[1] = 0;
if(ml_distance_vec3f(&sp1C, &D_80390264) < 500.0f){
if(ml_vec3f_distance(&sp1C, &D_80390264) < 500.0f){
timedFunc_set_1(1.0f, (GenFunction_1) func_80387488, (s32)actor->marker);
return;
}

View File

@@ -495,7 +495,7 @@ void chSmBottles_update(Actor *this) {
(this->unkF4_8 == 8 && !mapSpecificFlags_get(SM_SPECIFIC_FLAG_2)) ||
(this->unkF4_8 == 8 && mapSpecificFlags_get(SM_SPECIFIC_FLAG_3_ALL_SM_ABILITIES_LEARNED) && !mapSpecificFlags_get(SM_SPECIFIC_FLAG_F))
) {//L80389C50
if (((ml_distance_vec3f(plyr_pos, this->unk1C) < this->actor_specific_1_f) && func_8028F20C()) ||
if (((ml_vec3f_distance(plyr_pos, this->unk1C) < this->actor_specific_1_f) && func_8028F20C()) ||
mapSpecificFlags_get(SM_SPECIFIC_FLAG_10)
) {//L80389C8C
if (func_80329530(this, 0x96)) {

View File

@@ -475,7 +475,7 @@ void chVegetablesUpdate(Actor *this) {
ml_vec3f_set_length(this->velocity, 50.0f);
}
if (ml_distance_vec3f(this->position, this->unk1C) < 20.0f) {
if (ml_vec3f_distance(this->position, this->unk1C) < 20.0f) {
func_80387E64(this);
}

View File

@@ -40,7 +40,7 @@ void func_8038A8F8(Actor *this){
this->volatile_initialized = TRUE;
}//L8038A968
player_getPosition(this->velocity);
sp2C = ml_distance_vec3f(this->velocity, this->position);
sp2C = ml_vec3f_distance(this->velocity, this->position);
if(sp2C < (f32) this->unkF4_8)
func_80388D48();
@@ -48,7 +48,7 @@ void func_8038A8F8(Actor *this){
if( !mapSpecificFlags_get(SM_SPECIFIC_FLAG_2)
|| (mapSpecificFlags_get(SM_SPECIFIC_FLAG_3_ALL_SM_ABILITIES_LEARNED) && !mapSpecificFlags_get(SM_SPECIFIC_FLAG_F))
){ //L8038AA54
this->yaw_ideal = ml_distance_vec3f(this->velocity, this->unk1C) / 150.0;
this->yaw_ideal = ml_vec3f_distance(this->velocity, this->unk1C) / 150.0;
func_8028F3D8(this->unk1C, this->yaw_ideal, func_8038A8C0, this->marker);
mapSpecificFlags_set(SM_SPECIFIC_FLAG_10, TRUE);
}

View File

@@ -121,7 +121,7 @@ void func_802450DC(f32 arg0[3], f32 arg1[3], f32 arg2[3], f32 arg3[3], f32 arg4[
ml_vec3f_diff_copy(sp3C, arg1, arg0);
ml_vec3f_diff_copy(sp30, arg3, arg2);
ml_vec3f_diff_copy(sp24, sp3C, sp30);
phi_f12 = -ml_dotProduct_vec3f(arg4, sp24);
phi_f12 = -ml_vec3f_dot_product(arg4, sp24);
phi_f12 = MAX(5.0f, phi_f12);
arg1[0] += phi_f12 * arg4[0];
arg1[1] += phi_f12 * arg4[1];
@@ -144,13 +144,13 @@ void func_802451A4(f32 arg0[3], f32 arg1[3], f32 arg2[3], f32 arg3[3], f32 arg4[
ml_vec3f_diff_copy(sp54, sp6C, sp60);
ml_vec3f_normalize_copy(sp3C, sp54);
ml_vec3f_yaw_rotate_copy(sp30, sp3C, 90.0f);
sp28 = ml_dotProduct_vec3f(arg4, sp3C);
sp28 = ml_vec3f_dot_product(arg4, sp3C);
if (arg5 != 0) {
D_8027EF30 = ml_dotProduct_vec3f(arg4, sp30);
D_8027EF30 = ml_vec3f_dot_product(arg4, sp30);
}
phi_v0 = (D_8027EF30 < 0.0f) ? -1 : 1;
ml_vec3f_yaw_rotate_copy(sp48, arg4,(phi_v0 * sp28) * 45.0);
phi_f12 = -ml_dotProduct_vec3f(sp48, sp54);
phi_f12 = -ml_vec3f_dot_product(sp48, sp54);
phi_f12 = MAX(5.0f, phi_f12);
arg1[0] += phi_f12 * sp48[0];
arg1[1] += phi_f12 * sp48[1];
@@ -279,7 +279,7 @@ void func_8024560C(f32 arg0[3], struct0 *arg1, UNK_TYPE(s32) arg2, u8 *arg3, f32
}
BKCollisionTri *func_8024575C(f32 arg0[3], f32 arg1[3], f32 arg2, f32 arg3[3], s32 arg4, u32 arg5){
if(arg2 < ml_distance_vec3f(arg0, arg1)){
if(arg2 < ml_vec3f_distance(arg0, arg1)){
return NULL;
}
return func_80320C94(arg0, arg1, arg2, arg3, arg4, arg5);

View File

@@ -48,7 +48,7 @@ f32 core1_ce60_getPlayerDistance(f32 x, f32 z) {
}
bool core1_ce60_isPlayerInsideBoundingBox(s32 box_idx) {
return func_802585E0(sPlayerPosition,
return ml_vec3w_inside_box_w(sPlayerPosition,
sBoundingBoxes[box_idx].x_min, sBoundingBoxes[box_idx].y_min, sBoundingBoxes[box_idx].z_min,
sBoundingBoxes[box_idx].x_max, sBoundingBoxes[box_idx].y_max, sBoundingBoxes[box_idx].z_max
);

View File

@@ -4,9 +4,6 @@
#include "variables.h"
#include "version.h"
/* .data*/
#if VERSION == VERSION_USA_1_0
u32 D_80276CB0 = 0xD22FFFD8; //WHAT IS THIS?
u32 D_80276CB4 = 0xDEFEF692; //WHAT IS THIS?
@@ -14,9 +11,11 @@ u32 D_80276CB4 = 0xDEFEF692; //WHAT IS THIS?
u32 D_80276CB0 = 0x90FA97CB; //WHAT IS THIS?
u32 D_80276CB4 = 0x8D96D002; //WHAT IS THIS?
#endif
u16 *D_80276CB8 = NULL; //! ml_acosPrecValTblPtr
//! Might not be 90, but 91 or 92? Initial lowerIdx is OOB if 90
f32 ml_acosValTbl[90] = { //D_80276CBC
f32 sLookupTableAcosDegrees[90] = {
1.0000000000, 0.9998480080, 0.9993910190, 0.9986299870, 0.9975640180,
0.9961950180, 0.9945219760, 0.9925460220, 0.9902679920, 0.9876880050,
0.9848080280, 0.9816269870, 0.9781479840, 0.9743700030, 0.9702960250,
@@ -40,35 +39,24 @@ f32 ml_acosValTbl[90] = { //D_80276CBC
#define _SQ2(x, y) ((x) * (x) + (y) * (y))
#define _SQ3(x, y, z) (((x) * (x)) + ((y) * (y)) + ((z) * (z)))
/* .code */
f32 func_80255D70(f32 x)
{
f32 ml_acosf_deg(f32 x) {
s32 sign;
s32 upperIdx;
s32 lowerIdx;
f32 res;
f32 *table = sLookupTableAcosDegrees;
f32 *table = &ml_acosValTbl[0];
if (x < 0)
{
// Invert the result
if (x < 0) {
sign = -1;
// Precomputed values are all positive
x = -x;
}
else
{
} else {
sign = 1;
}
upperIdx = 0;
lowerIdx = 90 + 1;
lowerIdx = 91;
while (TRUE)
{
while (TRUE) {
s32 idx = (upperIdx + lowerIdx) / 2;
if (x > table[idx])
@@ -77,8 +65,7 @@ f32 func_80255D70(f32 x)
upperIdx = idx;
if (upperIdx + 1 == lowerIdx)
// Found the 1 degree range containing the result
break;
break; // Found the 1 degree range containing the result
}
// Check for trivial result
@@ -91,19 +78,17 @@ f32 func_80255D70(f32 x)
return sign > 0 ? res : 180 - res;
}
void func_80255E58(f32 vec1[3], f32 vec2[3], f32 vec3[3], f32 vec4[3])
{
void ml_vec3f_sub_and_rotate(f32 vec1[3], f32 rotation[3], f32 vec2[3], f32 dst[3]) {
f32 tmp[3];
TUPLE_DIFF_COPY(tmp, vec3, vec1)
TUPLE_DIFF_COPY(tmp, vec2, vec1)
ml_vec3f_yaw_rotate_copy(tmp, tmp, -vec2[1]);
ml_vec3f_pitch_rotate_copy( tmp, tmp, -vec2[0]);
ml_vec3f_roll_rotate_copy(vec4, tmp, -vec2[2]);
ml_vec3f_yaw_rotate_copy(tmp, tmp, -rotation[1]);
ml_vec3f_pitch_rotate_copy( tmp, tmp, -rotation[0]);
ml_vec3f_roll_rotate_copy(dst, tmp, -rotation[2]);
}
f32 func_80255F14(f32 vec1[3], f32 vec2[3])
{
f32 ml_vec3f_cos_between(f32 vec1[3], f32 vec2[3]) {
f32 tmp1[3];
f32 tmp2[3];
@@ -113,32 +98,27 @@ f32 func_80255F14(f32 vec1[3], f32 vec2[3])
return TUPLE_DOT_PRODUCT(tmp1, tmp2);
}
//ml_vec3f_cross_product
void ml_crossProduct_vec3f(f32 dst[3], f32 vec1[3], f32 vec2[3])
{
void ml_vec3f_cross_product(f32 dst[3], f32 vec1[3], f32 vec2[3]) {
TUPLE_CROSS_PRODUCT(dst, vec1, vec2)
}
void ml_interpolate_vec3f(f32 dst[3], f32 vec1[3], f32 vec2[3], f32 scale)
{
dst[0] = vec1[0] + (vec2[0] - vec1[0]) * scale;
dst[1] = vec1[1] + (vec2[1] - vec1[1]) * scale;
dst[2] = vec1[2] + (vec2[2] - vec1[2]) * scale;
void ml_vec3f_interpolate_fast(f32 dst[3], f32 start[3], f32 end[3], f32 t) {
dst[0] = start[0] + (end[0] - start[0]) * t;
dst[1] = start[1] + (end[1] - start[1]) * t;
dst[2] = start[2] + (end[2] - start[2]) * t;
}
f32 ml_dotProduct_vec3f(f32 vec1[3], f32 vec2[3])
{
f32 ml_vec3f_dot_product(f32 vec1[3], f32 vec2[3]) {
return TUPLE_DOT_PRODUCT(vec1, vec2);
}
f32 ml_distance_vec3f(f32 vec1[3], f32 vec2[3])
{
f32 ml_vec3f_distance(f32 vec1[3], f32 vec2[3]) {
f32 diff[3];
TUPLE_DIFF_COPY(diff, vec1, vec2)
return LENGTH_VEC3F(diff);
}
f32 func_802560D0(f32 arg0[3], f32 arg1[3], f32 arg2[3]) {
f32 ml_func_802560D0(f32 arg0[3], f32 arg1[3], f32 arg2[3]) {
f32 sp4C[3];
f32 pad48;
f32 sp3C[3];
@@ -153,7 +133,7 @@ f32 func_802560D0(f32 arg0[3], f32 arg1[3], f32 arg2[3]) {
sp20 = LENGTH_VEC3F(sp24);
if (sp20 < 0.01) {
return ml_distance_vec3f(arg0, arg2);
return ml_vec3f_distance(arg0, arg2);
}
TUPLE_DIFF_COPY(sp3C, arg2, arg0)
@@ -168,7 +148,7 @@ f32 func_802560D0(f32 arg0[3], f32 arg1[3], f32 arg2[3]) {
sp4C[0] = arg0[0] + (sp24[0] * sp30);
sp4C[1] = arg0[1] + (sp24[1] * sp30);
sp4C[2] = arg0[2] + (sp24[2] * sp30);
return ml_distance_vec3f(sp4C, arg2);
return ml_vec3f_distance(sp4C, arg2);
}
f32 ml_distanceSquared_vec3f(f32 vec1[3], f32 vec2[3])
@@ -647,7 +627,7 @@ void func_802578A4(f32 dst[3], f32 vec1[3], f32 vec2[3])
ml_vec3f_diff_copy(tmp1, &vec2[3], vec2);
ml_vec3f_diff_copy(tmp2, &vec2[6], vec2);
ml_crossProduct_vec3f(tmp3, tmp1, tmp2);
ml_vec3f_cross_product(tmp3, tmp1, tmp2);
ml_vec3f_normalize(tmp3);
func_80257918(dst, vec1, vec2, tmp3);
}
@@ -763,7 +743,7 @@ void func_80257DB0(f32 arg0[3], f32 arg1[3], f32 arg2[3])
f32 tmp[3];
ml_vec3f_scale_copy(arg0, arg1, -1);
dot_product = ml_dotProduct_vec3f(arg0, arg2);
dot_product = ml_vec3f_dot_product(arg0, arg2);
ml_vec3f_scale_copy(tmp, arg2, 2 * dot_product);
ml_vec3f_diff_copy(arg0, tmp, arg0);
}
@@ -896,7 +876,7 @@ int func_80258210(f32 x, f32 y, f32 *dst)
return TRUE;
}
int ml_isZero_vec3f(f32 vec[3])
bool ml_isZero_vec3f(f32 vec[3])
{
return !(vec[0] != 0 || vec[1] != 0 || vec[2] != 0);
}
@@ -906,31 +886,26 @@ bool ml_isNonzero_vec3f(f32 vec[3])
return vec[0] != 0 || vec[1] != 0 || vec[2] != 0;
}
//ml_vec3f_not_on_vertical_axis
int func_802583D8(f32 vec[3])
bool ml_vec3f_not_on_vertical_axis(f32 vec[3])
{
return vec[0] != 0 && vec[2] != 0;
}
//ml_vec3f_inside_box_f
int func_80258424(f32 vec[3], f32 minX, f32 minY, f32 minZ, f32 maxX, f32 maxY, f32 maxZ)
bool ml_vec3f_inside_box_f(f32 vec[3], f32 minX, f32 minY, f32 minZ, f32 maxX, f32 maxY, f32 maxZ)
{
return vec[0] > minX && vec[0] < maxX
&& vec[1] > minY && vec[1] < maxY
&& vec[2] > minZ && vec[2] < maxZ;
}
//ml_vec3f_inside_box_vec3f
int func_802584FC(f32 vec[3], f32 min[3], f32 max[3])
bool ml_vec3f_inside_box_vec3f(f32 vec[3], f32 min[3], f32 max[3])
{
return vec[0] > min[0] && vec[0] < max[0]
&& vec[1] > min[1] && vec[1] < max[1]
&& vec[2] > min[2] && vec[2] < max[2];
}
//ml_vec3w_inside_box_w
int func_802585E0(s32 vec[3], s32 minX, s32 minY, s32 minZ, s32 maxX, s32 maxY, s32 maxZ)
{
bool ml_vec3w_inside_box_w(s32 vec[3], s32 minX, s32 minY, s32 minZ, s32 maxX, s32 maxY, s32 maxZ) {
return vec[0] > minX && vec[0] < maxX
&& vec[1] > minY && vec[1] < maxY
&& vec[2] > minZ && vec[2] < maxZ;
@@ -947,8 +922,7 @@ f32 ml_vec3f_horizontal_distance_zero_likely(f32 vec1[3], f32 vec2[3]) {
return 0;
}
//ml_vec3f_horizontal_distance_squared_zero_likely
f32 func_802586B0(f32 vec1[3], f32 vec2[3])
f32 ml_vec3f_horizontal_distance_squared_zero_likely(f32 vec1[3], f32 vec2[3])
{
f32 dX = vec1[0] - vec2[0];
f32 dZ = vec1[2] - vec2[2];
@@ -1277,20 +1251,16 @@ bool ml_vec3f_within_distance(f32 vec1[3], f32 vec2[3], f32 distance)
return LENGTH_SQ_VEC3F(t) <= distance * distance;
}
bool func_80259400(f32 a0)
{
bool ml_stub_80259400(f32 x) {
// wtf?
return *(u32 *)&a0 == 0x80 || *(u32 *)&a0 == 0x2A8800;
return *(u32 *)&x == 0x80 || *(u32 *)&x == 0x2A8800;
}
void func_80259430(f32 *val)
{
*val -= time_getDelta();
void ml_sub_delta_time(f32 *x) {
*x -= time_getDelta();
if (*val < 0)
*val = 0;
return;
if (*x < 0)
*x = 0;
}
void func_8025947C(f32 a0[3], f32 a1[3], f32 a2[3], f32 a3[3])
@@ -1388,9 +1358,8 @@ void func_802596AC(f32 a0[3], f32 a1[3], f32 a2[3], f32 a3[3])
}
s32 func_8025975C(f32 a0)
{
f32 val = (s32)(viewport_getYaw() - a0);
s32 ml_getViewportYawWithOffset(f32 x) {
f32 val = (s32)(viewport_getYaw() - x);
while (val < 0)
val += 360;
@@ -1401,14 +1370,13 @@ s32 func_8025975C(f32 a0)
return val;
}
bool func_80259808(f32 a0)
{
return func_8025975C(a0) < 0xB4;
bool ml_isViewportYawWithOffsetNormalized(f32 x) {
return ml_getViewportYawWithOffset(x) < 180;
}
void func_8025982C(f32 dst[3], f32 arg1[3], f32 arg2[3], f32 arg3){
void ml_vec3f_interpolate(f32 dst[3], f32 start[3], f32 end[3], f32 t) {
int i;
for(i=0; i< 3; i++){
dst[i] = arg1[i] + (arg2[i]-arg1[i])*arg3;
for (i = 0; i < 3; i++) {
dst[i] = start[i] + (end[i] - start[i]) * t;
}
}

View File

@@ -35,7 +35,7 @@ void viewport_moveAlongZAxis(f32 offset) {
}
f32 viewport_getDistance(f32 arg0[3]) {
ml_distance_vec3f(arg0, sViewportPosition);
ml_vec3f_distance(arg0, sViewportPosition);
}
void viewport_getLookVector(f32 arg0[3]) {
@@ -363,7 +363,7 @@ bool viewport_func_8024DB50(f32 pos[3], f32 distance) {
delta[2] = pos[2] - sViewportPosition[2];
for(i = 0; i < 4; i++) {
if(distance <= ml_dotProduct_vec3f(delta, sViewportFrustumPlanes[i])) {
if(distance <= ml_vec3f_dot_product(delta, sViewportFrustumPlanes[i])) {
return FALSE;
}
}

View File

@@ -91,7 +91,7 @@ void baflap_update(void) {
if (s_active != 0) {
//update timers
for(i = 0; i < 5; i++){
func_80259430(&s_flap_list[i]);
ml_sub_delta_time(&s_flap_list[i]);
}
if (s_flap_max_timer != 0.0f) {
temp_f0 = s_flap_max_timer;

View File

@@ -57,7 +57,7 @@ void __baphysics_update_normal(void){
if(func_80294548()){
func_80294480(sp54);
ml_vec3f_normalize_copy(sp48, sp60);
sp44 = ml_dotProduct_vec3f(sp48, sp54);
sp44 = ml_vec3f_dot_product(sp48, sp54);
sp40 = get_slope_timer();
if(sp44 != 0.0f){
if(sp44 < 0){

View File

@@ -76,7 +76,7 @@ void func_802B7F28(void) {
if (900.0 < sp20[0] * sp20[0] + sp20[1] * sp20[1] + sp20[2] * sp20[2]) {
ml_vec3f_normalize(sp20);
func_80294480(sp2C);
if ( ml_dotProduct_vec3f(sp20, sp2C) < -0.2) {
if ( ml_vec3f_dot_product(sp20, sp2C) < -0.2) {
sp3C += D_8037D5C0 * 350.0;
}
}

View File

@@ -358,7 +358,7 @@ Actor *func_802C6E84(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){
break;
case 4://L802C6F50
if((globalTimer_getTime() & 1) == 1){
if(func_80259808(actor->yaw)){
if(ml_isViewportYawWithOffsetNormalized(actor->yaw)){
func_802C6E3C(0xb, sp34);
func_802C6E3C(0xa, sp34);
}

View File

@@ -326,8 +326,8 @@ void chBottlesBonus_func_802DD8AC(BoneTransformList *arg0, s32 arg1) {
switch(chBottlesBonusCursor_func_802E0538(i)){
case 1://L802DDBB4
chBottlesBonus_func_802DD484(spD8, spD4, 1.0f, 0.2);
func_8025982C(D_8037DEBC[i].unk0, D_8037DEB8[i].unk0, chBottlesBonus_func_802DD60C(i), chBottlesBonus_func_802DD804(D_8037DEC8[i] / 0.2));
func_8025982C(D_8037DEBC[i].unk1C, D_8037DEB8[i].unk1C, D_8037DEC4[i].unk1C, chBottlesBonus_func_802DD804(D_8037DEC8[i]/ 0.2));
ml_vec3f_interpolate(D_8037DEBC[i].unk0, D_8037DEB8[i].unk0, chBottlesBonus_func_802DD60C(i), chBottlesBonus_func_802DD804(D_8037DEC8[i] / 0.2));
ml_vec3f_interpolate(D_8037DEBC[i].unk1C, D_8037DEB8[i].unk1C, D_8037DEC4[i].unk1C, chBottlesBonus_func_802DD804(D_8037DEC8[i]/ 0.2));
func_80345D30(spAC, chBottlesBonusCursor_func_802E068C(i), D_8037DEB8[i].unkC);
func_803458E4(spBC, D_8037DEB8[i].unkC, spAC, chBottlesBonus_func_802DD804(D_8037DEC8[i] / 0.4));
@@ -345,7 +345,7 @@ void chBottlesBonus_func_802DD8AC(BoneTransformList *arg0, s32 arg1) {
break;
case 2://L802DDD9C
chBottlesBonus_func_802DD484(spD8, spD4, 1.0f, 0.2);
func_8025982C(D_8037DEBC[i].unk0, D_8037DEC4[chBottlesBonusCursor_func_802E0588(i)].unk0, chBottlesBonus_func_802DD60C(i), chBottlesBonus_func_802DD804(D_8037DEC8[i] / 0.2));
ml_vec3f_interpolate(D_8037DEBC[i].unk0, D_8037DEC4[chBottlesBonusCursor_func_802E0588(i)].unk0, chBottlesBonus_func_802DD60C(i), chBottlesBonus_func_802DD804(D_8037DEC8[i] / 0.2));
func_80345D30(sp9C, chBottlesBonusCursor_func_802E068C(i), D_8037DEB8[i].unkC);
func_80345D30(sp8C, chBottlesBonusCursor_func_802E0664(i), D_8037DEB8[i].unkC);
func_803458E4(D_8037DEBC[i].unkC, sp9C, sp8C, chBottlesBonus_func_802DD804(D_8037DF18[i] / 0.2));
@@ -362,15 +362,15 @@ void chBottlesBonus_func_802DD8AC(BoneTransformList *arg0, s32 arg1) {
case 3://L802DDF48
chBottlesBonusCursor_func_802DF460(40 + i, chBottlesBonusMarker, D_8037DEC4[chBottlesBonusCursor_func_802E0588(i)].unk0);
func_8025982C(D_8037DEBC[i].unk0, D_8037DEC0[i].unk0, D_8037DEC4[chBottlesBonusCursor_func_802E0588(i)].unk0, chBottlesBonus_func_802DD804(D_8037DEC8[i] / 0.4));
func_8025982C(D_8037DEBC[i].unk1C, D_8037DEC0[i].unk1C, D_8037DEC4[chBottlesBonusCursor_func_802E0588(i)].unk1C, chBottlesBonus_func_802DD804(D_8037DEC8[i] / 0.4));
ml_vec3f_interpolate(D_8037DEBC[i].unk0, D_8037DEC0[i].unk0, D_8037DEC4[chBottlesBonusCursor_func_802E0588(i)].unk0, chBottlesBonus_func_802DD804(D_8037DEC8[i] / 0.4));
ml_vec3f_interpolate(D_8037DEBC[i].unk1C, D_8037DEC0[i].unk1C, D_8037DEC4[chBottlesBonusCursor_func_802E0588(i)].unk1C, chBottlesBonus_func_802DD804(D_8037DEC8[i] / 0.4));
func_80345D30(sp7C, chBottlesBonusCursor_func_802E0664(i), D_8037DEB8[i].unkC);
func_803458E4(D_8037DEBC[i].unkC, D_8037DEC0[i].unkC, sp7C, chBottlesBonus_func_802DD804(D_8037DF18[i] / 0.2));
break;
case 0://L802DE084
func_8025982C(D_8037DEBC[i].unk0, D_8037DEC0[i].unk0, D_8037DEB8[i].unk0, chBottlesBonus_func_802DD804(D_8037DEC8[i] / 0.4));
func_8025982C(D_8037DEBC[i].unk1C, D_8037DEC0[i].unk1C, D_8037DEB8[i].unk1C, chBottlesBonus_func_802DD804(D_8037DEC8[i] / 0.4));
ml_vec3f_interpolate(D_8037DEBC[i].unk0, D_8037DEC0[i].unk0, D_8037DEB8[i].unk0, chBottlesBonus_func_802DD804(D_8037DEC8[i] / 0.4));
ml_vec3f_interpolate(D_8037DEBC[i].unk1C, D_8037DEC0[i].unk1C, D_8037DEB8[i].unk1C, chBottlesBonus_func_802DD804(D_8037DEC8[i] / 0.4));
func_803458E4(D_8037DEBC[i].unkC, D_8037DEC0[i].unkC, D_8037DEB8[i].unkC, chBottlesBonus_func_802DD804(D_8037DEC8[i] / 0.4));
break;
}

View File

@@ -37,7 +37,7 @@ void func_803567EC(Actor *this){
}
player_getPosition(plyr_pos);
plyr_dist = ml_distance_vec3f(plyr_pos, this->position);
plyr_dist = ml_vec3f_distance(plyr_pos, this->position);
if(this->state == 1){
if(plyr_dist < 700.0f)
func_80356770(this, 2);

View File

@@ -148,7 +148,7 @@ void func_8035765C(Actor *this){
}//L803576EC
player_getPosition(sp5C);
sp58 = ml_distance_vec3f(this->position, sp5C);
sp58 = ml_vec3f_distance(this->position, sp5C);
if(this->state == 1){
if(sp58 < this->scale*800.0f){
func_80357264(this, 2);

View File

@@ -96,7 +96,7 @@ void func_80356CCC(Actor *this){
func_803569F0(this, (this->state < 5)? 1 : 6);
}//L80356D48
player_getPosition(sp5C);
sp58 = ml_distance_vec3f(this->position, sp5C);
sp58 = ml_vec3f_distance(this->position, sp5C);
if( this->state == 1){
if( sp58 < this->scale*400.0f
&& (map_get() != MAP_3C_RBB_KITCHEN || this->position_z < sp5C[2])

View File

@@ -146,7 +146,7 @@ void func_8035C080(Actor *this, s32 next_state){
}
}
else if(next_state == 3){//L8035C4C0
if(ml_distance_vec3f(local->unk28, this->position) < 10.0f){
if(ml_vec3f_distance(local->unk28, this->position) < 10.0f){
func_8035C080(this, 1);
return;
}
@@ -293,11 +293,11 @@ void func_8035C8F4(Actor *this){
local->unk0 += 1.9047619047619049*sp34;
if(1.0f <= local->unk0)
local->unk0 = 1.0f;
ml_interpolate_vec3f(this->position, local->unk10, local->unk1C, local->unk0);
ml_vec3f_interpolate_fast(this->position, local->unk10, local->unk1C, local->unk0);
this->position_y += 100.0f*sinf(local->unk0*3.141592654);
this->yaw = local->unk0*(local->unk34[2] - local->unk34[1]) + local->unk34[1];
if(skeletalAnim_getLoopCount(this->unk148) > 0){
if(ml_distance_vec3f(this->position, local->unk28) < 10.0f){
if(ml_vec3f_distance(this->position, local->unk28) < 10.0f){
func_8035C080(this, 1);
}
else if(local->unkC > 0){//L8035CB8C

View File

@@ -387,7 +387,7 @@ void chmole_update(Actor *this){
&& (func_8028ECAC() == 0 || func_8028ECAC() == BSGROUP_8_TROT)
){
player_getPosition(sp34);
if (ml_distance_vec3f(sp34, this->velocity) < this->actor_specific_1_f) {
if (ml_vec3f_distance(sp34, this->velocity) < this->actor_specific_1_f) {
chmole_startingDialog(this);
}
}

View File

@@ -84,7 +84,7 @@ void func_802D07C8(Actor *this){
func_802D05A0(this, 1);
}
player_getPosition(sp2C);
sp28 = ml_distance_vec3f(sp2C, this->position);
sp28 = ml_vec3f_distance(sp2C, this->position);
if( this->state == 1){
if(sp28 < D_80367340[(s32)this->yaw].unk6*this->scale){
func_802D05A0(this, 2);

View File

@@ -105,7 +105,7 @@ void chwhipcrack_update(Actor *this){
__chwhipcrack_setState(this, 1);
}
player_getPosition(plyr_pos);
plyr_dist = ml_distance_vec3f(plyr_pos, this->position);
plyr_dist = ml_vec3f_distance(plyr_pos, this->position);
if(this->state == 1){
if(plyr_dist < 700.0f){
__chwhipcrack_setState(this, 2);

View File

@@ -188,7 +188,7 @@ bool func_8029D66C(void){
case MAP_31_RBB_RUSTY_BUCKET_BAY:
player_getPosition(sp2C);
return player_inWater() && func_80258424(sp2C, -9000.0f, -3000.0f, -3850.0f, -6820.0f, -700.0f, -1620.0f);
return player_inWater() && ml_vec3f_inside_box_f(sp2C, -9000.0f, -3000.0f, -3850.0f, -6820.0f, -700.0f, -1620.0f);
break;
case MAP_27_FP_FREEZEEZY_PEAK:

View File

@@ -217,7 +217,7 @@ f32 func_802BBEA4(f32 arg0[3], f32 arg1[3], f32 arg2, s32 arg3, s32 arg4) {
ml_vec3f_copy(sp4C, sp58[D_8037D8D0.unk30]);
sp38 = func_80320B98(arg0, sp4C, sp3C, arg4);
if (sp38 != NULL) {
phi_f2 = ml_distance_vec3f(arg0, sp4C);
phi_f2 = ml_vec3f_distance(arg0, sp4C);
D_8037D8D0.unk0[D_8037D8D0.unk30] = sp38->flags;
} else {
phi_f2 = arg2;

View File

@@ -47,7 +47,7 @@ bool func_802CC2A0(Actor *this) {
if (!this->marker->unk14_21) {
return TRUE;
}
ml_interpolate_vec3f(sp20, local->unk8, local->unk18, func_802575BC(local->unk4 + 0.05));
ml_vec3f_interpolate_fast(sp20, local->unk8, local->unk18, func_802575BC(local->unk4 + 0.05));
sp20[1] += 60.0f;
return func_80320DB0(sp20, 50.0f, sp2C, 0) == 0;
}
@@ -349,7 +349,7 @@ void func_802CCC5C(Actor *this) {
spB0 = (spB0 < spAC) ? spAC : MIN(spA8 , spB0);
}
sfxsource_playSfxAtVolume(local->unk0, spB0);
phi_f12 = 1.0f - ml_distance_vec3f(spC4, this->position) / 2000.0f;
phi_f12 = 1.0f - ml_vec3f_distance(spC4, this->position) / 2000.0f;
if(0.0f > phi_f12){
phi_f12 = 0.0f;
}
@@ -409,7 +409,7 @@ void func_802CCC5C(Actor *this) {
local->unk4 = 1.0f;
}
sp9C = func_802575BC(local->unk4);
ml_interpolate_vec3f(this->position, local->unk8, local->unk18, sp9C);
ml_vec3f_interpolate_fast(this->position, local->unk8, local->unk18, sp9C);
this->yaw = local->unk14 + (sp9C * (local->unk24 - local->unk14));
if ((skeletalAnim_getAnimId(this->unk148) == 0x10E) && (skeletalAnim_getLoopCount(this->unk148) > 0)) {
skeletalAnim_set(this->unk148, 0x10F, 0.1f, 0.45f);
@@ -453,7 +453,7 @@ void func_802CCC5C(Actor *this) {
sp68[1] = this->position[1];
sp68[2] = this->position[2];
sp68[0] = 0.0f;
if (ml_distance_vec3f(sp8C, sp68) < 800.0f) {
if (ml_vec3f_distance(sp8C, sp68) < 800.0f) {
spBC = 3;
}
}

View File

@@ -121,7 +121,7 @@ void func_802CEDE4(f32 target_position[3], f32 p_ctrl[3], f32 distance, f32 *arg
p_ctrl[1] = randf2(-distance, distance);
p_ctrl[2] = randf2(-distance, distance);
phi_s1++;
}while(phi_s1 < 10 && ml_distance_vec3f(target_position, p_ctrl) < distance);
}while(phi_s1 < 10 && ml_vec3f_distance(target_position, p_ctrl) < distance);
*arg3 = randf2(arg4, arg5);
}
@@ -236,7 +236,7 @@ void chBeeSwarm_802CF434(Actor *this) {
local = (ActorLocal_core2_47BD0 *) &this->local;
for(phi_s2 = 0, phi_s0 = local->unk8; phi_s2 < local->unk0; phi_s2++){
chBeeSwarm_802CF1C8(phi_s0->unk18, phi_s0->unk0, phi_s0->unkC, phi_s0->unk24[2], 150.0f, phi_s0->unk24, &sp58);
if (ml_distance_vec3f(phi_s0->unk0, phi_s0->unk18) < 50.0f) {
if (ml_vec3f_distance(phi_s0->unk0, phi_s0->unk18) < 50.0f) {
func_802CEEA4(this, phi_s0);
}
phi_s0++;
@@ -454,12 +454,12 @@ void chBeeSwarm_update(Actor *this) {
if (chBeeSwarm_802CF5E4(this)) {
subaddie_set_state(this, 2U);
}
if (ml_distance_vec3f(this->position, this->unk1C) < 50.0f) {
if (ml_vec3f_distance(this->position, this->unk1C) < 50.0f) {
func_802CEF54(this, local->unkC, 100.0f);
}
break;
case 2:
if (ml_distance_vec3f(this->position, this->unk1C) < 50.0f) {
if (ml_vec3f_distance(this->position, this->unk1C) < 50.0f) {
func_802CEF54(this, local->unkC, 100.0f);
}
chBeeSwarm_802CF518(this);
@@ -470,7 +470,7 @@ void chBeeSwarm_update(Actor *this) {
this->unk1C[2] = spB4[2];
this->unk1C[1] += 50.0f;
this->actor_specific_1_f = 400.0f;
if (ml_distance_vec3f(this->position, this->unk1C) < 100.0f) {
if (ml_vec3f_distance(this->position, this->unk1C) < 100.0f) {
func_802CEF54(this, spB4, 50.0f);
subaddie_set_state(this, 4);
}
@@ -495,22 +495,22 @@ void chBeeSwarm_update(Actor *this) {
if (local->unk0 == 0) {
marker_despawn(this->marker);
}
if (ml_distance_vec3f(this->position, this->unk1C) < 50.0f) {
if (ml_vec3f_distance(this->position, this->unk1C) < 50.0f) {
func_802CEF54(this, (s32 *) spB4, 50.0f);
}
if (ml_distance_vec3f(this->position, spB4) > 100.0f) {
if (ml_vec3f_distance(this->position, spB4) > 100.0f) {
subaddie_set_state(this, 3);
}
chBeeSwarm_802CF57C(this);
break;
case 5:
if (ml_distance_vec3f(this->position, this->unk1C) < 50.0f) {
if (ml_vec3f_distance(this->position, this->unk1C) < 50.0f) {
subaddie_set_state(this, 2);
}
chBeeSwarm_802CF518(this);
break;
case 6:
if (ml_distance_vec3f(this->position, this->unk1C) < 50.0f) {
if (ml_vec3f_distance(this->position, this->unk1C) < 50.0f) {
subaddie_set_state(this, local->unk6);
}
break;

View File

@@ -206,21 +206,21 @@ bool func_802E74A0(f32 arg0[3], f32 arg1, f32 arg2[3], f32 arg3[3]) {
f32 sp24[3];
f32 sp20;
if (arg1 <= func_802560D0(arg2, arg3, arg0)) {
if (arg1 <= ml_func_802560D0(arg2, arg3, arg0)) {
return FALSE;
}
sp24[0] = (arg2[0] + arg3[0]) / 2;
sp24[1] = (arg2[1] + arg3[1]) / 2;
sp24[2] = (arg2[2] + arg3[2]) / 2;
sp20 = ml_distance_vec3f(sp24, arg0);
if ((ml_distance_vec3f(sp24, arg2) + arg1) <= sp20) {
sp20 = ml_vec3f_distance(sp24, arg0);
if ((ml_vec3f_distance(sp24, arg2) + arg1) <= sp20) {
return FALSE;
}
return TRUE;
}
bool func_802E7588(f32 arg0[3], f32 arg1, f32 arg2[3], f32 arg3) {
return (ml_distance_vec3f(arg0, arg2) < (arg1 + arg3));
return (ml_vec3f_distance(arg0, arg2) < (arg1 + arg3));
}
void calculateBoundsAndDirection(f32 startPoint[3], f32 endPoint[3], s32 minBounds[3], s32 maxBounds[3], f32 directionVector[3]) {
@@ -744,7 +744,7 @@ s32 func_802E9118(BKCollisionList * collision_list, BKVertexList *vtx_list, f32
s32 sp3C;
s32 i;
if (((f32)vtx_list->global_norm * arg4) <= (ml_distance_vec3f(arg6, arg2) - arg7)) {
if (((f32)vtx_list->global_norm * arg4) <= (ml_vec3f_distance(arg6, arg2) - arg7)) {
return 0;
}
mlMtxIdent();
@@ -981,7 +981,7 @@ s32 func_802E9DD8(BKCollisionList *collisionList, BKVertexList *vtxList, f32 pos
s32 i;
// check if (sphere around vtx's) <= ((distance between origins) - (radius of B))
if ((vtxList->global_norm * scaleA) <= (ml_distance_vec3f(posB, posA) - radB)) {
if ((vtxList->global_norm * scaleA) <= (ml_vec3f_distance(posB, posA) - radB)) {
return 0;
}
mlMtxIdent();

View File

@@ -348,7 +348,7 @@ s32 func_802EB8A0(BKModelUnk14List *arg0, f32 *position, f32 *rotation, f32 scal
sp44[1] = sp5C[1] - sp68[1];
sp44[2] = sp5C[2] - sp68[2];
temp_f0 = gu_sqrtf(sp44[0]*sp44[0] + sp44[1]*sp44[1] + sp44[2]*sp44[2]);
if ((arg7 + temp_f0 >= ml_distance_vec3f(sp68, sp74))) {
if ((arg7 + temp_f0 >= ml_vec3f_distance(sp68, sp74))) {
return (s32) i_ptr->unk8;
}
}
@@ -530,7 +530,7 @@ s32 func_802EC238(BKModelUnk14List *arg0, f32 arg1[3], f32 rotation[3], f32 scal
sp40[1] = i_ptr->unk2[1];
sp40[2] = i_ptr->unk2[2];
scale = i_ptr->unk0;
if (ml_distance_vec3f(sp40, sp54) < scale)
if (ml_vec3f_distance(sp40, sp54) < scale)
return i_ptr->unk8;
if (!i_ptr->unk0){ }
}

View File

@@ -166,7 +166,7 @@ void func_802F83AC(struct3s *arg0) {
arg0->unk1C++;
if (arg0->unk1C < vector_size(arg0->unk20)) {
temp_v0 = (struct4s *)vector_at(arg0->unk20, arg0->unk1C);
if (1210.0 < ml_distance_vec3f(temp_v0->unk0, sp3C)) {
if (1210.0 < ml_vec3f_distance(temp_v0->unk0, sp3C)) {
vector_remove(arg0->unk20, arg0->unk1C);
}
} else {

View File

@@ -168,7 +168,7 @@ void func_802F8CD0(struct6s * this){
this->unk18++;
if((s32)this->unk18 < vector_size(this->unk1C)){
iPtr = vector_at(this->unk1C, this->unk18);
if(1320.0 < ml_distance_vec3f(iPtr->unk4, plyr_pos)){
if(1320.0 < ml_vec3f_distance(iPtr->unk4, plyr_pos)){
vector_remove(this->unk1C, this->unk18);
}
}

View File

@@ -143,7 +143,7 @@ void func_802F919C(void) {
D_8036928C++;
if (D_8036928C < D_80369284) {
sp5C = &D_80369280[0].unk1C[D_8036928C];
if (ml_distance_vec3f((*sp5C).unk0, D_80381040) > 1300.0f) {
if (ml_vec3f_distance((*sp5C).unk0, D_80381040) > 1300.0f) {
func_802F9134(D_8036928C);
}
} else {

View File

@@ -1166,7 +1166,7 @@ bool func_80305248(f32 arg0[3], s32 arg1, s32 arg2){
}
bool func_8030526C(f32 arg0[3], s32 arg1, s32 arg2){
return func_8030515C(arg0, arg1, arg2, func_802586B0);
return func_8030515C(arg0, arg1, arg2, ml_vec3f_horizontal_distance_squared_zero_likely);
}
bool func_80305290(bool (* arg0)(NodeProp *), bool (* arg1)(Prop *)){

View File

@@ -535,7 +535,7 @@ void func_8030DB04(u8 indx, s32 arg1, f32 arg2[3], f32 min_dist, f32 max_dist){
f32 dist;
f32 temp_f2;
__sfx_getPlayerPositionIfPresent(sp24);
dist = ml_distance_vec3f(arg2, sp24);
dist = ml_vec3f_distance(arg2, sp24);
if(max_dist <= dist)
temp_f2 = 0.0f;
else{
@@ -903,7 +903,7 @@ void sfx_play(enum sfx_e uid, f32 volume, u32 sampleRate, f32 position[3], f32 m
f32 player_position[3];
__sfx_getPlayerPositionIfPresent(player_position);
if( !(maxFadeDistance <= ml_distance_vec3f(player_position, position))
if( !(maxFadeDistance <= ml_vec3f_distance(player_position, position))
&& levelSpecificFlags_validateCRC2()
&& dummy_func_80320240()
){

View File

@@ -212,7 +212,7 @@ void func_8031CE70(f32 *arg0, enum map_e arg1, s32 arg2) {
if (phi_s0->unk8 == 0x186) {
phi_f2 = 1000.0f;
}
if (ml_distance_vec3f(arg0, sp38) < phi_f2) {
if (ml_vec3f_distance(arg0, sp38) < phi_f2) {
if (phi_s0->unk8 == 0x184) {
ncDynamicCamera_setUpdateEnabled(0);
func_8031CB50(arg1, arg2, 1);

View File

@@ -209,7 +209,7 @@ bool func_8032BD88(Actor *arg0, f32 arg1[3], s32 arg2, s32 arg3) {
arg0->position[0] = var_fp->unk0[0];
arg0->position[1] = var_fp->unk0[1];
arg0->position[2] = var_fp->unk0[2];
if ((temp_f20 != 0.0f) && ((ml_dotProduct_vec3f(var_fp->unk1C, sp284) / temp_f20) < 0.93969262)) {
if ((temp_f20 != 0.0f) && ((ml_vec3f_dot_product(var_fp->unk1C, sp284) / temp_f20) < 0.93969262)) {
var_fp = NULL;
}
}

View File

@@ -44,7 +44,7 @@ extern void func_803334B0(f32 position[3], f32 rotation[3], f32 scale, f32 arg3[
D_80383570.unk44 = D_80383570.unk4;
iPtr = start_ptr;
for(; iPtr < end_ptr && D_80383570.unk44 < D_80383570.unk48; iPtr++){
if(iPtr->unk34 && ml_distance_vec3f(position, iPtr->unk0) < iPtr->unk1C + arg4){
if(iPtr->unk34 && ml_vec3f_distance(position, iPtr->unk0) < iPtr->unk1C + arg4){
mlMtx_apply_vec3f(iPtr->unkC, iPtr->unk0);
iPtr->unk20 = iPtr->unk18/scale;
iPtr->unk24 = iPtr->unk1C/scale;
@@ -157,7 +157,7 @@ s32 func_803339A4(f32 arg0[3]){
for(iPtr = beginPtr; iPtr < endPtr; iPtr++){
if(iPtr->unk34){
if(tmp_s0 == NULL || ml_distance_vec3f(arg0, iPtr->unk0) < ml_distance_vec3f(arg0, tmp_s0->unk0)){
if(tmp_s0 == NULL || ml_vec3f_distance(arg0, iPtr->unk0) < ml_vec3f_distance(arg0, tmp_s0->unk0)){
tmp_s0 = iPtr;
}
}
@@ -249,7 +249,7 @@ void func_80333D48(BKVertexList *arg0, f32 position[3], f32 rotation[3], f32 sca
for(struct_ptr_ptr = &D_80383570.unk4[0]; struct_ptr_ptr < D_80383570.unk44;struct_ptr_ptr++){
struct_ptr = *struct_ptr_ptr;
temp_f0 = ml_distance_vec3f(struct_ptr->unkC, sp74);
temp_f0 = ml_vec3f_distance(struct_ptr->unkC, sp74);
if (!(struct_ptr->unk24 <= temp_f0)) {
if (temp_f0 <= struct_ptr->unk20) {
sp68[0] = sp68[0] + struct_ptr->unk28[0];

View File

@@ -20,7 +20,7 @@ bool func_80340020(Struct83s *self, f32 position[3], f32 arg2[3], f32 arg3, f32
}
self->unk1A = FALSE;
if (0.1 < ml_distance_vec3f(arg6, self->unk8)) {
if (0.1 < ml_vec3f_distance(arg6, self->unk8)) {
return FALSE;
}
for(i = 0; i < 3; i++){

View File

@@ -97,7 +97,7 @@ void func_80345650(f32 arg0[4], f32 arg1[4], f32 arg2[4], f32 arg3) {
temp_f12 = (arg1[0]*arg2[0]) + (arg1[1]*arg2[1]) + (arg1[2]*arg2[2]) + (arg1[3]*arg2[3]);
if (0.00001 < (1.0 + temp_f12)) {
if (0.00001 < (1.0 - temp_f12)) {
sp3C = (BAD_PI/180.0) * func_80255D70(temp_f12);
sp3C = (BAD_PI/180.0) * ml_acosf_deg(temp_f12);
sp40 = sinf(sp3C);
if (0.0f != sp40) {
sp48 = sinf((1.0 - arg3) * sp3C) / sp40;

View File

@@ -296,7 +296,7 @@ void func_80293F0C(void){
f32 sp2C[3];
_player_getPosition(sp44);
if(map_get() == MAP_34_RBB_ENGINE_ROOM && func_80258424(sp44, -900.0f, -940.0f, 200.0f, 900.0f, 940.0f, 800.0f)){
if(map_get() == MAP_34_RBB_ENGINE_ROOM && ml_vec3f_inside_box_f(sp44, -900.0f, -940.0f, 200.0f, 900.0f, 940.0f, 800.0f)){
func_8031C5FC(D_8037C200, 150.0f);
} else{
func_8031C608(D_8037C200);
@@ -428,7 +428,7 @@ void func_80294480(f32 arg0[3]){
f32 func_802944A8(void){
f32 sp1C[3];
func_80294480(sp1C);
return func_80255D70(sp1C[1]);
return ml_acosf_deg(sp1C[1]);
}
void func_802944D0(f32 dst[3]){

View File

@@ -30,7 +30,7 @@ void func_8034D554(s32 *mesh_id, BKVtxRef *src, Vtx *dst, Struct6Ds *arg3){
temp_f0 = arg3->unk44 / arg3->unk48;
temp_f0 = temp_f0 * temp_f0 * temp_f0 * temp_f0;
ml_interpolate_vec3f(sp18, arg3->unk2C, arg3->unk38, temp_f0);
ml_vec3f_interpolate_fast(sp18, arg3->unk2C, arg3->unk38, temp_f0);
dst->v.ob[0] = (s16)(src->v.v.ob[0] + sp18[0]);
dst->v.ob[1] = (s16)(src->v.v.ob[1] + sp18[1]);
dst->v.ob[2] = (s16)(src->v.v.ob[2] + sp18[2]);
@@ -41,7 +41,7 @@ void func_8034D634(s32 *mesh_id, BKVtxRef *src, Vtx *dst, Struct6Ds *arg3){
f32 sp18[3];
temp_f0 = arg3->unk44 / arg3->unk48;
ml_interpolate_vec3f(sp18, arg3->unk2C, arg3->unk38, temp_f0);
ml_vec3f_interpolate_fast(sp18, arg3->unk2C, arg3->unk38, temp_f0);
dst->v.ob[0] = (s16)(src->v.v.ob[0] + sp18[0]);
dst->v.ob[1] = (s16)(src->v.v.ob[1] + sp18[1]);
dst->v.ob[2] = (s16)(src->v.v.ob[2] + sp18[2]);

View File

@@ -225,7 +225,7 @@ void func_80350250(void) {
if ((D_80386150.unk0 != NULL) && (func_80334904() == 2)) {
player_getPosition(sp7C);
for(var_s0 = D_80386150.unk8; var_s0 < D_80386150.unkC; var_s0++) {
var_s0->unk4 = (ml_distance_vec3f(var_s0->unkC, sp7C) < 2000.0f);
var_s0->unk4 = (ml_vec3f_distance(var_s0->unkC, sp7C) < 2000.0f);
if (var_s0->unk4) {
if (var_s0->unk8 > 0) {
var_s0->unk28 -= temp_f22;

View File

@@ -43,7 +43,7 @@ bool func_80357C30(Actor *this) {
if (!this->marker->unk14_21) {
return TRUE;
}
ml_interpolate_vec3f(sp20, local->unk8, local->unk18, func_802575BC(local->unk4 + 0.05));
ml_vec3f_interpolate_fast(sp20, local->unk8, local->unk18, func_802575BC(local->unk4 + 0.05));
sp20[1] += 60.0f;
return !func_80320DB0(sp20, 50.0f, sp2C, 0);
}
@@ -334,7 +334,7 @@ void func_80358684(Actor *this) {
: sp84;
}
sfxsource_playSfxAtVolume(local->sfxsourceIdx, sp84);
sp78 = 1.0f - ml_distance_vec3f(sp94, this->position) / 2000.0f;
sp78 = 1.0f - ml_vec3f_distance(sp94, this->position) / 2000.0f;
sp78 = (0.0f > sp78) ? 0 : sp78;
if (sp78 > 0.0f) {
sfxsource_setSampleRate(local->sfxsourceIdx, (s32) (sp78 * 10000.0f));
@@ -390,7 +390,7 @@ void func_80358684(Actor *this) {
local->unk4 = 1.0f;
}
sp70 = func_802575BC(local->unk4);
ml_interpolate_vec3f(this->position, local->unk8, local->unk18, sp70);
ml_vec3f_interpolate_fast(this->position, local->unk8, local->unk18, sp70);
this->yaw = local->unk14 + (sp70 * (local->unk24 - local->unk14));
if ((skeletalAnim_getAnimId(this->unk148) == 0x23B) && (skeletalAnim_getLoopCount(this->unk148) > 0)) {
skeletalAnim_set(this->unk148, 0x23C, 0.1f, 0.45f);
@@ -416,7 +416,7 @@ void func_80358684(Actor *this) {
sp54[1] = this->position[1];
sp54[2] = this->position[2];
sp54[0] = 0.0f;
if (ml_distance_vec3f(sp60, sp54) < 800.0f) {
if (ml_vec3f_distance(sp60, sp54) < 800.0f) {
next_state = 3;
}
}

View File

@@ -97,7 +97,7 @@ void func_8036158C(Actor *this){
if(this->state == 1){
player_getPosition(sp24);
actor_collisionOff(this);
if( ml_distance_vec3f(this->position, sp24) < 1000.0f
if( ml_vec3f_distance(this->position, sp24) < 1000.0f
&& viewport_isPointOutsideFrustum_3f(this->position_x, this->position_y, this->position_z)
&& ml_timer_update(&local->unk4, sp30)
){

View File

@@ -33,7 +33,7 @@ void func_80295DD0(void){
void func_80295E74(void){
f32 sp1C[3];
_player_getPosition(sp1C);
if(!func_802584FC(sp1C, D_8037C3C0.unkC, D_8037C3C0.unk0)){
if(!ml_vec3f_inside_box_vec3f(sp1C, D_8037C3C0.unkC, D_8037C3C0.unk0)){
if(D_8037C3C0.unk18 == 0){
D_8037C3C0.unk18 = 1;
func_8029B6F0();

View File

@@ -100,7 +100,7 @@ f32 func_802C1030(struct56s *arg0, f32 arg1[3], f32 arg2[3]) {
ml_vec3f_set_length_copy(sp30, sp30, 400.0f);
ml_vec3f_add(sp3C, sp30, sp48);
func_80259554(sp54, sp48, sp3C, arg1);
return ml_distance_vec3f(sp54, arg2);
return ml_vec3f_distance(sp54, arg2);
}
else{
func_80323240(arg0, sp2C, sp54);
@@ -139,8 +139,8 @@ s32 func_802C11C8(f32 arg0[3]) {
sp3C = func_80323F74(sp2C, D_8037DBE0.unk8, -1000.0f);
func_80323240(sp2C, sp40, sp64);
func_80323240(sp2C, sp3C, sp58);
sp48 = ml_distance_vec3f(sp4C, sp64);
sp44 = ml_distance_vec3f(sp4C, sp58);
sp48 = ml_vec3f_distance(sp4C, sp64);
sp44 = ml_vec3f_distance(sp4C, sp58);
sp38 = 0.0f;
sp38 = 0.0f;
if (mlAbsF(sp48 - sp44) > 3.0f) {

View File

@@ -872,7 +872,7 @@ void func_802BE384(f32 arg0[3], f32 arg1[3], f32 arg2[3], f32 arg3[3], f32 arg4[
sp1C[0] = sp34[0] - sp28[0];
sp1C[1] = sp34[1] - sp28[1];
sp1C[2] = sp34[2] - sp28[2];
dp = -ml_dotProduct_vec3f(arg4, sp1C);
dp = -ml_vec3f_dot_product(arg4, sp1C);
arg3[0] += dp*arg4[0];
arg3[1] += dp*arg4[1];
arg3[2] += dp*arg4[2];

View File

@@ -21,13 +21,13 @@ struct{
/* .code */
bool __ncFirstPersonCamera_fullyZoomedIn(void) {
return (ml_distance_vec3f(D_8037DC60.position, D_8037DC60.zoomed_in_position) < 40.0f);
return (ml_vec3f_distance(D_8037DC60.position, D_8037DC60.zoomed_in_position) < 40.0f);
}
void __ncFirstPersonCamera_getPositionAndRotation_entering(f32 arg0[3], f32 arg1[3]) {
s32 i;
func_80259430(&D_8037DC60.transistion_timer);
ml_sub_delta_time(&D_8037DC60.transistion_timer);
for( i = 0; i<3; i++){
D_8037DC60.position[i] = func_80257CF8(D_8037DC60.transistion_timer, 1.0f, 0.0f, D_8037DC60.zoomed_out_position[i], D_8037DC60.zoomed_in_position[i]);
D_8037DC60.rotation[i] = mlNormalizeAngle(D_8037DC60.zoomed_out_rotation[i] + func_80257CF8(D_8037DC60.transistion_timer, 0.5f, 0.0f, 0.0f, mlDiffDegF(D_8037DC60.zoomed_in_rotation[i], D_8037DC60.zoomed_out_rotation[i])));
@@ -46,7 +46,7 @@ void __ncFirstPersonCamera_getPositionAndRotation_entering(f32 arg0[3], f32 arg1
void __ncFirstPersonCamera_getPositionAndRotation_exiting(f32 arg0[3], f32 arg1[3]) {
s32 i;
func_80259430(&D_8037DC60.transistion_timer);
ml_sub_delta_time(&D_8037DC60.transistion_timer);
for( i = 0; i<3; i++){
D_8037DC60.position[i] = func_80257CF8(D_8037DC60.transistion_timer, 1.0f, 0.0f, D_8037DC60.zoomed_in_position[i], arg0[i]);
D_8037DC60.rotation[i] = mlNormalizeAngle(D_8037DC60.zoomed_in_rotation[i] + func_80257CF8(D_8037DC60.transistion_timer, 1.0f, 0.5f, 0.0f, mlDiffDegF(arg1[i], D_8037DC60.zoomed_in_rotation[i])));

View File

@@ -498,7 +498,7 @@ bool chfinalboss_func_80387470(Actor *this, f32 arg1[3], f32 v_max, f32 arg3, f3
diff[2] = arg1[2] - this->position[2];
if (arg5 != 0.00f) {
if (ml_distance_vec3f(this->position, arg1) < arg5) {
if (ml_vec3f_distance(this->position, arg1) < arg5) {
ml_vec3f_set_length(diff, arg3 * 4.00f);
} else {
ml_vec3f_set_length(diff, arg3 * 1.00f);
@@ -527,7 +527,7 @@ bool chfinalboss_func_80387470(Actor *this, f32 arg1[3], f32 v_max, f32 arg3, f3
this->yaw += (arg4 * temp.pos_x * dt);
if (ml_distance_vec3f(this->position, arg1) < arg6) {
if (ml_vec3f_distance(this->position, arg1) < arg6) {
return TRUE;
}
return FALSE;
@@ -913,7 +913,7 @@ void chfinalboss_phase1_update(ActorMarker *marker) {
case 3:
chfinalboss_func_80386600(this->marker, 0);
chfinalboss_spawnBroomstickGlowParticles(this);
sp50 = ml_map_f(ml_distance_vec3f(this->position, this->unk1C), 300.0f, 1000.0f, 100.0f, 1000.0f);
sp50 = ml_map_f(ml_vec3f_distance(this->position, this->unk1C), 300.0f, 1000.0f, 100.0f, 1000.0f);
chfinalboss_func_80387ACC(this, 60.0f * sp54);
if (chfinalboss_func_80387470(this, this->unk1C, sp50, 1800.0f, 200.0f, 500.0f, 300.0f)) {
chfinalboss_phase1_setState(this, 4);
@@ -1115,7 +1115,7 @@ void chfinalboss_phase2_update(ActorMarker *marker) {
case 14:
chfinalboss_spawnBroomstickGlowParticles(this);
chfinalboss_func_80387ACC(this, 30.0f * sp4C);
if (chfinalboss_func_80387470(this, this->unk1C, ml_map_f(ml_distance_vec3f(this->position, this->unk1C), 70.0f, 1000.0f, 100.0f, D_80391758[sp48]), D_80391758[sp48] * 2, 160.0f, 500.0f, 70.0f)) {
if (chfinalboss_func_80387470(this, this->unk1C, ml_map_f(ml_vec3f_distance(this->position, this->unk1C), 70.0f, 1000.0f, 100.0f, D_80391758[sp48]), D_80391758[sp48] * 2, 160.0f, 500.0f, 70.0f)) {
local->unkA = 1;
chfinalboss_phase2_setState(this, 0xF);
}

View File

@@ -683,7 +683,7 @@ void func_80387730(Actor *this) {
}
if (!fileProgressFlag_get(this->unkF4_8 + FILEPROG_39_CCW_OPEN) && ability_isUnlocked(ABILITY_13_1ST_NOTEDOOR)) {
player_getPosition(spAC);
if ((ml_distance_vec3f(spAC, this->position) < 500.0f) && (func_803114C4() != 0xF64)) {
if ((ml_vec3f_distance(spAC, this->position) < 500.0f) && (func_803114C4() != 0xF64)) {
func_802FACA4(0xC);
}
if (itemscore_noteScores_getTotal() >= D_8039347C[this->unkF4_8 - 1]) {
@@ -699,7 +699,7 @@ void func_80387730(Actor *this) {
phi_f20 = 290.0f;
}
sp9C[1] = this->position[1];
if ((ml_distance_vec3f(spAC, sp9C) < phi_f20) || (this->alpha_124_19 != 0xFF)) {
if ((ml_vec3f_distance(spAC, sp9C) < phi_f20) || (this->alpha_124_19 != 0xFF)) {
if (this->alpha_124_19 == 0xFF) {
func_80324CFC(0.0f, COMUSIC_43_ENTER_LEVEL_GLITTER, 32700);
func_80324D2C(2.4f, COMUSIC_43_ENTER_LEVEL_GLITTER);
@@ -740,7 +740,7 @@ void func_80387730(Actor *this) {
}
}
}
} else if ((this->unkF4_8 >= 2) && (ml_distance_vec3f(spAC, this->position) < 290.0f)) {
} else if ((this->unkF4_8 >= 2) && (ml_vec3f_distance(spAC, this->position) < 290.0f)) {
volatileFlag_setAndTriggerDialog_0(VOLATILE_FLAG_B0_NOT_ENOUGH_NOTES);
}
}

View File

@@ -202,7 +202,7 @@ void func_8038EFD8(Actor *this) {
sp24[1] = this->position[1];
sp24[2] = this->position[2];
sp24[1] += 50.0f;
func_8028F3D8(sp24, ml_distance_vec3f(sp30, sp24) / 150.0, func_8038EF58, this->marker);
func_8028F3D8(sp24, ml_vec3f_distance(sp30, sp24) / 150.0, func_8038EF58, this->marker);
}
void func_8038F078(ActorMarker *marker, enum asset_e text_id, s32 arg2){

View File

@@ -111,7 +111,7 @@ void func_80390E28(Actor *this) {
}
this->unk10_12 = 0;
for(i = 0; (i < D_80395460) && (this->unk10_12 < 4); i++){
temp_f0 = ml_distance_vec3f(this->position, D_80395370[i]);
temp_f0 = ml_vec3f_distance(this->position, D_80395370[i]);
if ((temp_f0 > 400.0f) && (temp_f0 < 1200.0f)) {
local->unk0[this->unk10_12][0] = D_80395370[i][0];
local->unk0[this->unk10_12][1] = D_80395370[i][1];

View File

@@ -45,7 +45,7 @@ void func_80392B6C(Actor *this) {
}
}
if (mapSpecificFlags_get(7) != 0) {
sp28 = ml_distance_vec3f(this->position, this->unk1C) / 350.0;
sp28 = ml_vec3f_distance(this->position, this->unk1C) / 350.0;
comusic_playTrack(COMUSIC_A9_TOOTY);
mapSpecificFlags_set(7, 0);
mapSpecificFlags_set(9, 1);