2020-08-04 08:49:11 +02:00
|
|
|
#include "common.h"
|
|
|
|
|
2020-09-11 22:29:52 +02:00
|
|
|
void poll_rumble(void) {
|
|
|
|
// TODO: replace with defines
|
|
|
|
nuContRmbCheck(0);
|
|
|
|
nuContRmbModeSet(0, 2);
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(s32, "code_42e0_len_1f60", start_rumble);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(s32, "code_42e0_len_1f60", func_80028F8C);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(s32, "code_42e0_len_1f60", func_80028FE0);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-11 22:29:52 +02:00
|
|
|
f32 length2D(f32 x, f32 y) {
|
|
|
|
return sqrtf(SQ(x) + SQ(y));
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(HeapNode*, "code_42e0_len_1f60", _heap_create, void* addr, s32 size);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(s32, "code_42e0_len_1f60", _heap_malloc);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(s32, "code_42e0_len_1f60", _heap_malloc_tail);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(s32, "code_42e0_len_1f60", _heap_free);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(s32, "code_42e0_len_1f60", _heap_realloc);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-26 03:51:54 +02:00
|
|
|
INCLUDE_ASM(s32, "code_42e0_len_1f60", cosine);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-11 22:29:52 +02:00
|
|
|
s32 sign(s32 val) {
|
2020-09-14 01:03:22 +02:00
|
|
|
s32 sign = -1;
|
2020-09-11 22:29:52 +02:00
|
|
|
|
|
|
|
if (val >= 0) {
|
2020-09-14 01:03:22 +02:00
|
|
|
sign = val > 0;
|
2020-09-11 22:29:52 +02:00
|
|
|
}
|
2020-09-14 01:03:22 +02:00
|
|
|
return sign;
|
2020-09-11 22:29:52 +02:00
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(s32, "code_42e0_len_1f60", int_to_string);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-11 22:29:52 +02:00
|
|
|
void mem_clear(s8* data, s32 numBytes) {
|
|
|
|
while (numBytes > 0) {
|
|
|
|
*data = 0;
|
|
|
|
data++;
|
|
|
|
numBytes--;
|
|
|
|
}
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(s32, "code_42e0_len_1f60", transform_point);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-11 22:29:52 +02:00
|
|
|
void copy_matrix(Matrix4f* src, Matrix4f* dest) {
|
|
|
|
bcopy(src, dest, sizeof(Matrix4f));
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(s32, "code_42e0_len_1f60", dma_copy);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(s32, "code_42e0_len_1f60", func_800297D4);
|
2020-09-24 05:16:13 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(s32, "code_42e0_len_1f60", func_80029860);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-11 22:29:52 +02:00
|
|
|
s32 _advance_rng(void) {
|
2020-09-14 01:03:22 +02:00
|
|
|
s32* rngVal = &gRandSeed;
|
2020-09-11 22:29:52 +02:00
|
|
|
|
2020-10-04 22:11:49 +02:00
|
|
|
GAME_STATUS->nextRNG = *rngVal = (*rngVal * 0x5D588B65) + 1;
|
2020-09-11 22:29:52 +02:00
|
|
|
|
|
|
|
return *rngVal;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(s32, "code_42e0_len_1f60", func_80029934);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(s32, "code_42e0_len_1f60", func_80029994);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(s32, "code_42e0_len_1f60", rand_int, s32 arg0);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-11 22:29:52 +02:00
|
|
|
f32 signF(f32 val) {
|
2020-09-14 01:03:22 +02:00
|
|
|
f32 sign;
|
2020-09-11 22:29:52 +02:00
|
|
|
|
|
|
|
if (!(val > 0.0f)) {
|
2020-09-14 01:03:22 +02:00
|
|
|
sign = -1.0f;
|
2020-09-11 22:29:52 +02:00
|
|
|
if (!(val < 0.0f)) {
|
2020-09-14 01:03:22 +02:00
|
|
|
sign = 0.0f;
|
2020-09-11 22:29:52 +02:00
|
|
|
}
|
|
|
|
} else {
|
2020-09-14 01:03:22 +02:00
|
|
|
sign = 1.0f;
|
2020-09-11 22:29:52 +02:00
|
|
|
}
|
|
|
|
|
2020-09-14 01:03:22 +02:00
|
|
|
return sign;
|
2020-09-11 22:29:52 +02:00
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-13 03:28:01 +02:00
|
|
|
INCLUDE_ASM(s16, "code_42e0_len_1f60", round, f32 arg0);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(f32, "code_42e0_len_1f60", clamp_angle, f32 theta);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-11 22:29:52 +02:00
|
|
|
f32 get_clamped_angle_diff(f32 a, f32 b) {
|
|
|
|
if (fabsf(b - a) >= 180.0f) {
|
|
|
|
if (b < a) {
|
|
|
|
b += 360.0f;
|
|
|
|
} else {
|
|
|
|
b -= 360.0f;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return b - a;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(f32, "code_42e0_len_1f60", atan2, f32 startX, f32 startZ, f32 endX, f32 endZ);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-11 22:29:52 +02:00
|
|
|
f32 get_player_normal_yaw(void) {
|
2020-10-04 22:11:49 +02:00
|
|
|
return atan2(0, 0, GAME_STATUS->playerTraceNormal.x, GAME_STATUS->playerTraceNormal.z);
|
2020-09-11 22:29:52 +02:00
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(s32, "code_42e0_len_1f60", get_player_normal_pitch);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-11 22:29:52 +02:00
|
|
|
f32 dist2D(f32 ax, f32 ay, f32 bx, f32 by) {
|
|
|
|
f32 xDiff = bx - ax;
|
|
|
|
f32 yDiff = by - ay;
|
|
|
|
|
|
|
|
return sqrtf(SQ(xDiff) + SQ(yDiff));
|
|
|
|
}
|
|
|
|
|
|
|
|
f32 dist3D(f32 ax, f32 ay, f32 az, f32 bx, f32 by, f32 bz) {
|
|
|
|
f32 xDiff = bx - ax;
|
|
|
|
f32 yDiff = by - ay;
|
|
|
|
f32 zDiff = bz - az;
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-11 22:29:52 +02:00
|
|
|
return sqrtf(SQ(xDiff) + SQ(yDiff) + SQ(zDiff));
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(void, "code_42e0_len_1f60", add_vec2D_polar, f32* x, f32* y, f32 r, f32 theta);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(s32, "code_42e0_len_1f60", _wrap_trig_lookup_value);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(s32, "code_42e0_len_1f60", sin_cos_rad);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(s32, "code_42e0_len_1f60", sin_rad);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(s32, "code_42e0_len_1f60", cos_rad);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(s32, "code_42e0_len_1f60", sin_cos_deg);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(f32, "code_42e0_len_1f60", sin_deg, f32 x);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(f32, "code_42e0_len_1f60", cos_deg, f32 x);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(f32, "code_42e0_len_1f60", update_lerp, Easing easing, f32 start, f32 end, s32 elapsed, s32 duration);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(s32, "code_42e0_len_1f60", func_8002A904);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(s32, "code_42e0_len_1f60", func_8002AAC4);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(s32, "code_42e0_len_1f60", func_8002AB5C);
|