From f26e77ba4088f20e72e13409f9ad535039abd291 Mon Sep 17 00:00:00 2001 From: Derek Hensley Date: Mon, 3 Jun 2024 11:33:03 -0700 Subject: [PATCH] More General Cleanup (#1638) * LINKER_FILES in makefile * COLPOLY_GET_NORMAL * math header * libc * M_PI for cosf and sinf files * MAXFLOAT * Revert "MAXFLOAT" This reverts commit 96b75ffaa89b1a4ca1c08278b28bc3c70224701a. * Remove SHT_MINV * SHRT_MAX * Add M_PI * Angle macros * f suffix * Format --- Makefile | 8 +-- docs/tutorial/vscode.md | 1 + include/PR/controller_voice.h | 2 +- include/PR/os_cache.h | 2 +- include/PR/os_convert.h | 2 +- include/PR/os_internal_si.h | 2 +- include/PR/os_libc.h | 2 +- include/PR/os_pi.h | 4 +- include/PR/piint.h | 2 +- include/PR/xstdio.h | 2 +- include/audio/heap.h | 2 +- include/audio/load.h | 4 +- include/buffers.h | 2 +- include/fault.h | 4 +- include/ichain.h | 2 +- include/libc/math.h | 13 ++--- include/libc/stdlib.h | 2 +- include/libc/string.h | 2 +- include/libc64/os_malloc.h | 2 +- include/loadfragment.h | 4 +- include/macros.h | 2 +- include/padmgr.h | 2 +- include/romfile.h | 2 +- include/segment_symbols.h | 2 +- include/sys_cmpdma.h | 2 +- include/system_heap.h | 2 +- include/tha.h | 4 +- include/z64.h | 12 ++--- include/z64actor_dlftbls.h | 2 +- include/z64audio.h | 2 +- include/z64bgcheck.h | 4 +- include/z64effect.h | 2 +- include/z64font.h | 2 +- include/z64game.h | 4 +- include/z64math.h | 18 +++---- include/z64message.h | 2 +- include/z64object.h | 2 +- include/z64transition.h | 2 +- src/audio/voice_internal.c | 4 +- src/boot/O2/stackcheck.c | 4 +- src/boot/irqmgr.c | 2 +- src/boot/libc/memmove.c | 2 +- src/boot/libc/memset.c | 2 +- src/boot/libc/strcmp.c | 2 +- src/boot/libc/strcpy.c | 2 +- src/boot/libc64/__osMalloc.c | 6 +-- src/boot/libc64/math64.c | 26 +++++----- src/boot/libc64/sprintf.c | 2 +- src/boot/libm/fmodf.c | 2 +- src/boot/viconfig.c | 2 +- src/code/PreRender.c | 4 +- src/code/cutscene_camera.c | 2 +- src/code/jpegdecoder.c | 2 +- src/code/jpegutils.c | 2 +- src/code/sys_cfb.c | 2 +- src/code/sys_math.c | 4 +- src/code/sys_matrix.c | 4 +- src/code/z_actor.c | 18 +++---- src/code/z_camera.c | 18 +++---- src/code/z_common_data.c | 2 +- src/code/z_eff_blure.c | 2 +- src/code/z_eventmgr.c | 4 +- src/code/z_fbdemo_fade.c | 2 +- src/code/z_fcurve_data_skelanime.c | 2 +- src/code/z_jpeg.c | 2 +- src/code/z_kankyo.c | 2 +- src/code/z_lib.c | 4 +- src/code/z_pause.c | 2 +- src/code/z_player_lib.c | 4 +- src/code/z_quake.c | 2 +- src/code/z_skin.c | 2 +- src/code/z_viszbuf.c | 2 +- src/libultra/gu/cosf.c | 4 +- src/libultra/gu/position.c | 4 +- src/libultra/gu/rotate.c | 4 +- src/libultra/gu/sinf.c | 4 +- src/libultra/gu/sins.c | 2 +- src/libultra/io/cartrominit.c | 2 +- src/libultra/io/controller.c | 2 +- src/libultra/io/devmgr.c | 2 +- src/libultra/io/pfsfilestate.c | 2 +- src/libultra/io/si.c | 2 +- src/libultra/io/sp.c | 2 +- src/libultra/io/vimgr.c | 2 +- src/libultra/libc/ldiv.c | 2 +- src/libultra/libc/string.c | 4 +- src/libultra/libc/xldtob.c | 4 +- src/libultra/libc/xlitob.c | 4 +- src/libultra/libc/xprintf.c | 2 +- src/libultra/os/initialize.c | 2 +- src/libultra/os/seteventmesg.c | 2 +- src/libultra/os/timerintr.c | 2 +- src/libultra/os/virtualtophysical.c | 2 +- src/libultra/voice/voicecrc.c | 2 +- .../actors/ovl_Bg_F40_Flift/z_bg_f40_flift.c | 7 ++- .../ovl_Bg_F40_Swlift/z_bg_f40_swlift.c | 2 +- .../actors/ovl_Bg_Icefloe/z_bg_icefloe.c | 2 +- src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.c | 4 +- .../actors/ovl_Bg_Spdweb/z_bg_spdweb.c | 2 +- src/overlays/actors/ovl_Boss_01/z_boss_01.c | 16 +++--- src/overlays/actors/ovl_Boss_02/z_boss_02.c | 14 +++--- src/overlays/actors/ovl_Boss_03/z_boss_03.c | 20 ++++---- src/overlays/actors/ovl_Boss_06/z_boss_06.c | 8 +-- .../actors/ovl_Boss_Hakugin/z_boss_hakugin.c | 12 ++--- .../actors/ovl_Demo_Kankyo/z_demo_kankyo.c | 4 +- src/overlays/actors/ovl_Dm_Hina/z_dm_hina.c | 2 +- .../actors/ovl_Door_Shutter/z_door_shutter.c | 4 +- .../actors/ovl_En_Bigokuta/z_en_bigokuta.c | 4 +- src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c | 4 +- .../actors/ovl_En_Bigslime/z_en_bigslime.c | 30 +++++------ src/overlays/actors/ovl_En_Bom/z_en_bom.c | 4 +- .../actors/ovl_En_Clear_Tag/z_en_clear_tag.c | 20 ++++---- src/overlays/actors/ovl_En_Crow/z_en_crow.c | 4 +- .../actors/ovl_En_Dekubaba/z_en_dekubaba.c | 4 +- .../actors/ovl_En_Dinofos/z_en_dinofos.c | 6 +-- src/overlays/actors/ovl_En_Door/z_en_door.c | 2 +- src/overlays/actors/ovl_En_Egol/z_en_egol.c | 4 +- .../actors/ovl_En_Fishing/z_en_fishing.c | 50 +++++++++---------- .../actors/ovl_En_Floormas/z_en_floormas.c | 4 +- src/overlays/actors/ovl_En_Gs/z_en_gs.c | 4 +- .../actors/ovl_En_Hakurock/z_en_hakurock.c | 2 +- src/overlays/actors/ovl_En_Holl/z_en_holl.c | 2 +- src/overlays/actors/ovl_En_Ik/z_en_ik.c | 4 +- .../actors/ovl_En_Kanban/z_en_kanban.c | 18 +++---- src/overlays/actors/ovl_En_Light/z_en_light.c | 2 +- .../actors/ovl_En_Minislime/z_en_minislime.c | 20 ++++---- src/overlays/actors/ovl_En_Mkk/z_en_mkk.c | 18 +++---- src/overlays/actors/ovl_En_Niw/z_en_niw.c | 2 +- .../actors/ovl_En_Pametfrog/z_en_pametfrog.c | 8 +-- src/overlays/actors/ovl_En_Rat/z_en_rat.c | 8 +-- src/overlays/actors/ovl_En_Slime/z_en_slime.c | 30 +++++------ .../actors/ovl_En_Snowman/z_en_snowman.c | 6 +-- .../ovl_En_Syateki_Crow/z_en_syateki_crow.c | 4 +- .../ovl_En_Syateki_Okuta/z_en_syateki_okuta.c | 4 +- .../actors/ovl_En_Tanron3/z_en_tanron3.c | 6 +-- .../ovl_En_Water_Effect/z_en_water_effect.c | 8 +-- .../actors/ovl_En_Wdhand/z_en_wdhand.c | 10 ++-- src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c | 6 +-- src/overlays/actors/ovl_Obj_Mine/z_obj_mine.c | 2 +- .../ovl_Obj_Spidertent/z_obj_spidertent.c | 2 +- .../actors/ovl_Oceff_Spot/z_oceff_spot.c | 2 +- .../ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.c | 2 +- .../ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c | 2 +- src/overlays/gamestates/ovl_select/z_select.c | 2 +- 144 files changed, 372 insertions(+), 369 deletions(-) diff --git a/Makefile b/Makefile index 5285f40517..a426e18bce 100644 --- a/Makefile +++ b/Makefile @@ -114,7 +114,7 @@ NM := $(MIPS_BINUTILS_PREFIX)nm OBJCOPY := $(MIPS_BINUTILS_PREFIX)objcopy OBJDUMP := $(MIPS_BINUTILS_PREFIX)objdump -IINC := -Iinclude -Isrc -Iassets -I$(BUILD_DIR) -I. +IINC := -Iinclude -Iinclude/libc -Isrc -Iassets -I$(BUILD_DIR) -I. ifeq ($(KEEP_MDEBUG),0) RM_MDEBUG = $(OBJCOPY) --remove-section .mdebug $@ @@ -241,6 +241,8 @@ OVL_RELOC_FILES := $(shell $(CPP) $(CPPFLAGS) $(SPEC) | $(SPEC_REPLACE_VARS) | g SCHEDULE_INC_FILES := $(foreach f,$(SCHEDULE_FILES:.schl=.schl.inc),$(BUILD_DIR)/$f) +LD_FILES := $(foreach f,$(shell find linker_scripts/*.ld),$(BUILD_DIR)/$f) + # Automatic dependency files # (Only asm_processor dependencies and reloc dependencies are handled for now) DEP_FILES := $(O_FILES:.o=.asmproc.d) $(OVL_RELOC_FILES:.o=.d) @@ -326,8 +328,8 @@ $(ROMC): $(ROM) $(ELF) $(BUILD_DIR)/dmadata/compress_ranges.txt $(PYTHON) tools/buildtools/compress.py --in $(ROM) --out $@ --dma-start `tools/buildtools/dmadata_start.sh $(NM) $(ELF)` --compress `cat $(BUILD_DIR)/dmadata/compress_ranges.txt` --threads $(N_THREADS) $(PYTHON) -m ipl3checksum sum --cic 6105 --update $@ -$(ELF): $(TEXTURE_FILES_OUT) $(ASSET_FILES_OUT) $(O_FILES) $(OVL_RELOC_FILES) $(LDSCRIPT) $(BUILD_DIR)/linker_scripts/undefined_syms.ld $(BUILD_DIR)/linker_scripts/extra.ld - $(LD) -T $(LDSCRIPT) -T $(BUILD_DIR)/linker_scripts/undefined_syms.ld -T $(BUILD_DIR)/linker_scripts/extra.ld --no-check-sections --accept-unknown-input-arch --emit-relocs -Map $(MAP) -o $@ +$(ELF): $(TEXTURE_FILES_OUT) $(ASSET_FILES_OUT) $(O_FILES) $(OVL_RELOC_FILES) $(LDSCRIPT) $(LD_FILES) + $(LD) -T $(LDSCRIPT) -T $(LD_FILES) --no-check-sections --accept-unknown-input-arch --emit-relocs -Map $(MAP) -o $@ ## Order-only prerequisites # These ensure e.g. the O_FILES are built before the OVL_RELOC_FILES. diff --git a/docs/tutorial/vscode.md b/docs/tutorial/vscode.md index 473af8a615..63b035ed63 100644 --- a/docs/tutorial/vscode.md +++ b/docs/tutorial/vscode.md @@ -47,6 +47,7 @@ You can create a `.vscode/c_cpp_properties.json` file with `C/C++: Edit Configur "intelliSenseMode": "${default}", // Shouldn't matter "includePath": [ // Matches makefile's includes "include", + "include/libc", "src", "assets", "build/n64-us/", diff --git a/include/PR/controller_voice.h b/include/PR/controller_voice.h index 022e69c031..84a2d33ba1 100644 --- a/include/PR/controller_voice.h +++ b/include/PR/controller_voice.h @@ -4,7 +4,7 @@ #include "ultratypes.h" #include "os_voice.h" #include "os_message.h" -#include "libc/stddef.h" +#include "stddef.h" typedef struct { /* 0x0 */ u8 dummy; diff --git a/include/PR/os_cache.h b/include/PR/os_cache.h index 8a920c728a..a5ecab6edc 100644 --- a/include/PR/os_cache.h +++ b/include/PR/os_cache.h @@ -2,7 +2,7 @@ #define PR_OS_CACHE_H #include "ultratypes.h" -#include "libc/stddef.h" +#include "stddef.h" void osInvalDCache(void* vaddr, size_t nbytes); void osInvalICache(void* vaddr, size_t nbytes); diff --git a/include/PR/os_convert.h b/include/PR/os_convert.h index e9d1f68a8c..decb7cfbf7 100644 --- a/include/PR/os_convert.h +++ b/include/PR/os_convert.h @@ -1,7 +1,7 @@ #ifndef PR_CONVERT_H #define PR_CONVERT_H -#include "libc/stdint.h" +#include "stdint.h" #define OS_CLOCK_RATE 62500000LL #define OS_CPU_COUNTER (OS_CLOCK_RATE*3/4) diff --git a/include/PR/os_internal_si.h b/include/PR/os_internal_si.h index e1d88accac..c2a227336d 100644 --- a/include/PR/os_internal_si.h +++ b/include/PR/os_internal_si.h @@ -2,7 +2,7 @@ #define PR_OS_INTERNAL_SI_H #include "ultratypes.h" -#include "libc/stdint.h" +#include "stdint.h" s32 __osSiRawWriteIo(uintptr_t devAddr, u32 data); diff --git a/include/PR/os_libc.h b/include/PR/os_libc.h index d53d871bbb..dfbf6cd43c 100644 --- a/include/PR/os_libc.h +++ b/include/PR/os_libc.h @@ -1,7 +1,7 @@ #ifndef PR_OS_LIBC_H #define PR_OS_LIBC_H -#include "libc/stdarg.h" +#include "stdarg.h" void bcopy(void* __src, void* __dest, int __n); diff --git a/include/PR/os_pi.h b/include/PR/os_pi.h index 7959ac7b3b..42a45d2440 100644 --- a/include/PR/os_pi.h +++ b/include/PR/os_pi.h @@ -3,8 +3,8 @@ #include "ultratypes.h" #include "os_message.h" -#include "libc/stddef.h" -#include "libc/stdint.h" +#include "stddef.h" +#include "stdint.h" typedef struct { diff --git a/include/PR/piint.h b/include/PR/piint.h index 8517f9d63b..c599de7902 100644 --- a/include/PR/piint.h +++ b/include/PR/piint.h @@ -3,7 +3,7 @@ #include "ultratypes.h" #include "os_pi.h" -#include "libc/stdint.h" +#include "stdint.h" #define LEO_BASE_REG 0x05000000 diff --git a/include/PR/xstdio.h b/include/PR/xstdio.h index 76972871d2..34d02ddeb1 100644 --- a/include/PR/xstdio.h +++ b/include/PR/xstdio.h @@ -2,7 +2,7 @@ #define PR_XSTDIO_H #include "ultratypes.h" -#include "libc/stdarg.h" +#include "stdarg.h" typedef struct { /* 0x0 */ union { diff --git a/include/audio/heap.h b/include/audio/heap.h index 2c4147dbc6..e23788231c 100644 --- a/include/audio/heap.h +++ b/include/audio/heap.h @@ -2,7 +2,7 @@ #define AUDIO_HEAP_H #include "PR/ultratypes.h" -#include "libc/stddef.h" +#include "stddef.h" #include "unk.h" typedef struct AudioHeapInitSizes { diff --git a/include/audio/load.h b/include/audio/load.h index 2952dee010..5f56757ba3 100644 --- a/include/audio/load.h +++ b/include/audio/load.h @@ -5,8 +5,8 @@ #include "PR/os.h" #include "PR/os_message.h" #include "PR/ultratypes.h" -#include "libc/stddef.h" -#include "libc/stdint.h" +#include "stddef.h" +#include "stdint.h" #include "unk.h" typedef s32 (*DmaHandler)(OSPiHandle* handle, OSIoMesg* mb, s32 direction); diff --git a/include/buffers.h b/include/buffers.h index ed8b2152cb..4159173a9e 100644 --- a/include/buffers.h +++ b/include/buffers.h @@ -1,7 +1,7 @@ #ifndef BUFFERS_H #define BUFFERS_H -#include "libc/assert.h" +#include "assert.h" #include "gfx.h" #include "macros.h" #include "stack.h" diff --git a/include/fault.h b/include/fault.h index 2dd4fdaa40..d0ce18b23f 100644 --- a/include/fault.h +++ b/include/fault.h @@ -3,8 +3,8 @@ #include "ultra64.h" -#include "libc/stdarg.h" -#include "libc/stdint.h" +#include "stdarg.h" +#include "stdint.h" #include "PR/controller.h" #include "padmgr.h" diff --git a/include/ichain.h b/include/ichain.h index 591bd8f577..1c7e8f26b1 100644 --- a/include/ichain.h +++ b/include/ichain.h @@ -1,7 +1,7 @@ #ifndef ICHAIN_H #define ICHAIN_H -#include "libc/stddef.h" +#include "stddef.h" typedef struct InitChainEntry { u32 cont: 1; diff --git a/include/libc/math.h b/include/libc/math.h index 25d9e5a937..1060e98eab 100644 --- a/include/libc/math.h +++ b/include/libc/math.h @@ -1,12 +1,13 @@ #ifndef LIBC_MATH_H #define LIBC_MATH_H -#define M_PI 3.14159265358979323846f -#define M_SQRT2 1.41421356237309504880f -#define M_SQRT1_2 0.70710678118654752440f /* 1/sqrt(2) */ -#define FLT_MAX 340282346638528859811704183484516925440.0f -#define SHT_MAX 32767.0f -#define SHT_MINV (1.0f / SHT_MAX) +#define M_PI 3.14159265358979323846 +#define M_PIf 3.14159265358979323846f +#define M_SQRT2f 1.41421356237309504880f +#define M_SQRT1_2f 0.70710678118654752440f /* 1/sqrt(2) */ + +#define FLT_MAX 3.40282347e+38f +#define SHRT_MAX 32767.0f float fabsf(float f); #pragma intrinsic(fabsf) diff --git a/include/libc/stdlib.h b/include/libc/stdlib.h index ec15b4f6c4..08d313f458 100644 --- a/include/libc/stdlib.h +++ b/include/libc/stdlib.h @@ -1,7 +1,7 @@ #ifndef LIBC_STDLIB_H #define LIBC_STDLIB_H -#include "libc/stddef.h" +#include "stddef.h" typedef struct { /* 0x0 */ int quot; diff --git a/include/libc/string.h b/include/libc/string.h index 4fb99e71ee..8c6139f3cc 100644 --- a/include/libc/string.h +++ b/include/libc/string.h @@ -1,7 +1,7 @@ #ifndef LIBC_STRING_H #define LIBC_STRING_H -#include "libc/stddef.h" +#include "stddef.h" const char* strchr(const char* s, int c); size_t strlen(const char* s); diff --git a/include/libc64/os_malloc.h b/include/libc64/os_malloc.h index 01711bd7fe..3bbb5c2739 100644 --- a/include/libc64/os_malloc.h +++ b/include/libc64/os_malloc.h @@ -2,7 +2,7 @@ #define LIBC64_OS_MALLOC_H #include "ultra64.h" -#include "libc/stddef.h" +#include "stddef.h" typedef struct ArenaNode { /* 0x0 */ s16 magic; // Should always be 0x7373 diff --git a/include/loadfragment.h b/include/loadfragment.h index 6e3f083f96..642db25d66 100644 --- a/include/loadfragment.h +++ b/include/loadfragment.h @@ -2,8 +2,8 @@ #define LOADFRAGMENT_H #include "PR/ultratypes.h" -#include "libc/stdint.h" -#include "libc/stddef.h" +#include "stdint.h" +#include "stddef.h" extern s32 gOverlayLogSeverity; diff --git a/include/macros.h b/include/macros.h index 1038838e49..da5063bcdb 100644 --- a/include/macros.h +++ b/include/macros.h @@ -1,7 +1,7 @@ #ifndef MACROS_H #define MACROS_H -#include "libc/stdint.h" +#include "stdint.h" #include "PR/os_convert.h" #define SCREEN_WIDTH 320 diff --git a/include/padmgr.h b/include/padmgr.h index 59157dd814..68a7a59aa8 100644 --- a/include/padmgr.h +++ b/include/padmgr.h @@ -1,7 +1,7 @@ #ifndef PADMGR_H #define PADMGR_H -#include "libc/stdbool.h" +#include "stdbool.h" #include "ultra64.h" #include "irqmgr.h" #include "padutils.h" diff --git a/include/romfile.h b/include/romfile.h index 0ae0fcc68c..7d3ad161f8 100644 --- a/include/romfile.h +++ b/include/romfile.h @@ -2,7 +2,7 @@ #define ROMFILE_H #include "ultra64.h" -#include "libc/stdint.h" +#include "stdint.h" typedef struct { /* 0x00 */ uintptr_t vromStart; diff --git a/include/segment_symbols.h b/include/segment_symbols.h index 2c53511b97..c0130dd488 100644 --- a/include/segment_symbols.h +++ b/include/segment_symbols.h @@ -1,7 +1,7 @@ #ifndef SEGMENT_SYMBOLS_H #define SEGMENT_SYMBOLS_H -#include "libc/stddef.h" +#include "stddef.h" #include "PR/ultratypes.h" #include "romfile.h" diff --git a/include/sys_cmpdma.h b/include/sys_cmpdma.h index 8bacf7149a..23a9140148 100644 --- a/include/sys_cmpdma.h +++ b/include/sys_cmpdma.h @@ -2,7 +2,7 @@ #define SYS_CPMDMA_H #include "PR/ultratypes.h" -#include "libc/stdint.h" +#include "stdint.h" void CmpDma_LoadFile(uintptr_t segmentVrom, s32 id, void* dst, size_t size); void CmpDma_LoadAllFiles(uintptr_t segmentVrom, void* dst, size_t size); diff --git a/include/system_heap.h b/include/system_heap.h index e0864cca6c..df572b82bc 100644 --- a/include/system_heap.h +++ b/include/system_heap.h @@ -1,7 +1,7 @@ #ifndef SYSTEM_HEAP_H #define SYSTEM_HEAP_H -#include "libc/stddef.h" +#include "stddef.h" #include "PR/ultratypes.h" void* SystemHeap_Malloc(size_t size); diff --git a/include/tha.h b/include/tha.h index 9bf3c85729..93ad4664a9 100644 --- a/include/tha.h +++ b/include/tha.h @@ -2,8 +2,8 @@ #define THA_H #include "ultra64.h" -#include "libc/stdint.h" -#include "libc/stddef.h" +#include "stdint.h" +#include "stddef.h" typedef struct TwoHeadArena { /* 0x0 */ size_t size; diff --git a/include/z64.h b/include/z64.h index f046e61da5..dab2bc7b32 100644 --- a/include/z64.h +++ b/include/z64.h @@ -3,12 +3,12 @@ #include "ultra64.h" -#include "libc/math.h" -#include "libc/stdarg.h" -#include "libc/stdbool.h" -#include "libc/stddef.h" -#include "libc/stdint.h" -#include "libc/stdlib.h" +#include "math.h" +#include "stdarg.h" +#include "stdbool.h" +#include "stddef.h" +#include "stdint.h" +#include "stdlib.h" #include "libc64/qrand.h" diff --git a/include/z64actor_dlftbls.h b/include/z64actor_dlftbls.h index 942732576e..ba16fd8036 100644 --- a/include/z64actor_dlftbls.h +++ b/include/z64actor_dlftbls.h @@ -2,7 +2,7 @@ #define Z64ACTOR_DLFTBLS_H #include "PR/ultratypes.h" -#include "libc/stdint.h" +#include "stdint.h" #include "segment_symbols.h" // This value is hardcoded to be the size of ovl_Arrow_Fire which currently is the biggest actor that uses the AM_FIELD. diff --git a/include/z64audio.h b/include/z64audio.h index d7bbb53df7..41ae767751 100644 --- a/include/z64audio.h +++ b/include/z64audio.h @@ -4,7 +4,7 @@ #include "PR/ultratypes.h" #include "PR/os_voice.h" #include "audiothread_cmd.h" -#include "libc/stddef.h" +#include "stddef.h" #include "unk.h" #include "audio/heap.h" diff --git a/include/z64bgcheck.h b/include/z64bgcheck.h index 10258e0cdf..3c69ae162c 100644 --- a/include/z64bgcheck.h +++ b/include/z64bgcheck.h @@ -11,8 +11,8 @@ struct DynaPolyActor; #define SS_NULL 0xFFFF -#define COLPOLY_NORMAL_FRAC (1.0f / SHT_MAX) -#define COLPOLY_SNORMAL(x) ((s16)((x) * SHT_MAX)) +#define COLPOLY_NORMAL_FRAC (1.0f / SHRT_MAX) +#define COLPOLY_SNORMAL(x) ((s16)((x) * SHRT_MAX)) #define COLPOLY_GET_NORMAL(n) ((n)*COLPOLY_NORMAL_FRAC) #define COLPOLY_VIA_FLAG_TEST(vIA, flags) ((vIA) & (((flags)&7) << 13)) #define COLPOLY_VTX_INDEX(vI) ((vI)&0x1FFF) diff --git a/include/z64effect.h b/include/z64effect.h index 46027ab1f2..d451b050b6 100644 --- a/include/z64effect.h +++ b/include/z64effect.h @@ -2,7 +2,7 @@ #define Z64EFFECT_H #include "PR/ultratypes.h" -#include "libc/stdint.h" +#include "stdint.h" #include "color.h" #include "z64light.h" #include "z64math.h" diff --git a/include/z64font.h b/include/z64font.h index 9d0540048f..481c69d578 100644 --- a/include/z64font.h +++ b/include/z64font.h @@ -2,7 +2,7 @@ #define Z64FONT_H #include "PR/ultratypes.h" -#include "libc/stdint.h" +#include "stdint.h" struct PlayState; diff --git a/include/z64game.h b/include/z64game.h index 42105de759..c581ec1aca 100644 --- a/include/z64game.h +++ b/include/z64game.h @@ -3,8 +3,8 @@ #include "ultra64.h" -#include "libc/stdbool.h" -#include "libc/stdint.h" +#include "stdbool.h" +#include "stdint.h" #include "gamealloc.h" #include "padmgr.h" #include "padutils.h" diff --git a/include/z64math.h b/include/z64math.h index 9e210787d9..020e11a6d7 100644 --- a/include/z64math.h +++ b/include/z64math.h @@ -2,7 +2,7 @@ #define Z64MATH_H #include "ultra64.h" -#include "libc/math.h" +#include "math.h" #include "libc64/math64.h" @@ -168,21 +168,21 @@ typedef union { #define TRUNCF_BINANG(f) (s16)(s32)(f) // Angle conversion macros -#define DEG_TO_RAD(degrees) ((degrees) * (M_PI / 180.0f)) +#define DEG_TO_RAD(degrees) ((degrees) * (M_PIf / 180.0f)) #define DEG_TO_BINANG(degrees) TRUNCF_BINANG((degrees) * (0x8000 / 180.0f)) #define DEG_TO_BINANG_ALT(degrees) TRUNCF_BINANG(((degrees) / 180.0f) * 0x8000) #define DEG_TO_BINANG_ALT2(degrees) TRUNCF_BINANG(((degrees) * 0x10000) / 360.0f) #define DEG_TO_BINANG_ALT3(degrees) ((degrees) * (0x8000 / 180.0f)) -#define RAD_TO_DEG(radians) ((radians) * (180.0f / M_PI)) -#define RAD_TO_BINANG(radians) TRUNCF_BINANG((radians) * (0x8000 / M_PI)) -#define RAD_TO_BINANG_ALT(radians) TRUNCF_BINANG(((radians) / M_PI) * 0x8000) -#define RAD_TO_BINANG_ALT2(radians) TRUNCF_BINANG(((radians) * 0x8000) / M_PI) +#define RAD_TO_DEG(radians) ((radians) * (180.0f / M_PIf)) +#define RAD_TO_BINANG(radians) TRUNCF_BINANG((radians) * (0x8000 / M_PIf)) +#define RAD_TO_BINANG_ALT(radians) TRUNCF_BINANG(((radians) / M_PIf) * 0x8000) +#define RAD_TO_BINANG_ALT2(radians) TRUNCF_BINANG(((radians) * 0x8000) / M_PIf) #define BINANG_TO_DEG(binang) ((f32)(binang) * (180.0f / 0x8000)) -#define BINANG_TO_RAD(binang) ((f32)(binang) * (M_PI / 0x8000)) -#define BINANG_TO_RAD_ALT(binang) (((f32)(binang) / 0x8000) * M_PI) -#define BINANG_TO_RAD_ALT2(binang) (((f32)(binang) * M_PI) / 0x8000) +#define BINANG_TO_RAD(binang) ((f32)(binang) * (M_PIf / 0x8000)) +#define BINANG_TO_RAD_ALT(binang) (((f32)(binang) / 0x8000) * M_PIf) +#define BINANG_TO_RAD_ALT2(binang) (((f32)(binang) * M_PIf) / 0x8000) // Angle arithmetic macros #define BINANG_ROT180(angle) ((s16)(angle + 0x8000)) diff --git a/include/z64message.h b/include/z64message.h index 25bb5242c4..76494b8551 100644 --- a/include/z64message.h +++ b/include/z64message.h @@ -2,7 +2,7 @@ #define Z64MESSAGE_H #include "PR/ultratypes.h" -#include "libc/stdbool.h" +#include "stdbool.h" #include "z64bombers_notebook.h" #include "z64font.h" diff --git a/include/z64object.h b/include/z64object.h index 0de62d789f..32f57f9564 100644 --- a/include/z64object.h +++ b/include/z64object.h @@ -1,7 +1,7 @@ #ifndef Z64OBJECT_H #define Z64OBJECT_H -#include "libc/stdint.h" +#include "stdint.h" #define DEFINE_OBJECT(_name, enumValue) enumValue, #define DEFINE_OBJECT_UNSET(enumValue) enumValue, diff --git a/include/z64transition.h b/include/z64transition.h index 45e92255aa..c280e864fa 100644 --- a/include/z64transition.h +++ b/include/z64transition.h @@ -3,7 +3,7 @@ #include "ultra64.h" -#include "libc/stdint.h" +#include "stdint.h" #include "unk.h" #include "romfile.h" diff --git a/src/audio/voice_internal.c b/src/audio/voice_internal.c index 348d2c215d..3bef9b2f7d 100644 --- a/src/audio/voice_internal.c +++ b/src/audio/voice_internal.c @@ -1,6 +1,6 @@ #include "z64voice.h" -#include "libc/stdbool.h" -#include "libc/string.h" +#include "stdbool.h" +#include "string.h" #include "padmgr.h" // internal voice functions diff --git a/src/boot/O2/stackcheck.c b/src/boot/O2/stackcheck.c index edd1e3a30e..d08dbfcb5f 100644 --- a/src/boot/O2/stackcheck.c +++ b/src/boot/O2/stackcheck.c @@ -1,6 +1,6 @@ #include "stackcheck.h" -#include "libc/stdbool.h" -#include "libc/stdint.h" +#include "stdbool.h" +#include "stdint.h" StackEntry* sStackInfoListStart = NULL; StackEntry* sStackInfoListEnd = NULL; diff --git a/src/boot/irqmgr.c b/src/boot/irqmgr.c index a3daeff11f..7311414a67 100644 --- a/src/boot/irqmgr.c +++ b/src/boot/irqmgr.c @@ -34,7 +34,7 @@ */ #include "irqmgr.h" -#include "libc/stdbool.h" +#include "stdbool.h" #include "macros.h" #include "scheduler.h" diff --git a/src/boot/libc/memmove.c b/src/boot/libc/memmove.c index 720de0facf..21c7256454 100644 --- a/src/boot/libc/memmove.c +++ b/src/boot/libc/memmove.c @@ -1,4 +1,4 @@ -#include "libc/string.h" +#include "string.h" void* memmove(void* dst, const void* src, size_t size) { unsigned char* _dst = dst; diff --git a/src/boot/libc/memset.c b/src/boot/libc/memset.c index 7e0b1c0ed1..ee8a1d17e0 100644 --- a/src/boot/libc/memset.c +++ b/src/boot/libc/memset.c @@ -1,4 +1,4 @@ -#include "libc/string.h" +#include "string.h" void* memset(void* ptr, int val, size_t size) { unsigned char* dst = ptr; diff --git a/src/boot/libc/strcmp.c b/src/boot/libc/strcmp.c index d65e4411f7..7df0ef5b28 100644 --- a/src/boot/libc/strcmp.c +++ b/src/boot/libc/strcmp.c @@ -1,4 +1,4 @@ -#include "libc/string.h" +#include "string.h" int strcmp(const char* str1, const char* str2) { unsigned char c1; diff --git a/src/boot/libc/strcpy.c b/src/boot/libc/strcpy.c index 8166a47e0e..db961df98c 100644 --- a/src/boot/libc/strcpy.c +++ b/src/boot/libc/strcpy.c @@ -1,4 +1,4 @@ -#include "libc/string.h" +#include "string.h" char* strcpy(char* dst, const char* src) { char* _dst = dst; diff --git a/src/boot/libc64/__osMalloc.c b/src/boot/libc64/__osMalloc.c index 5540089975..3272603e13 100644 --- a/src/boot/libc64/__osMalloc.c +++ b/src/boot/libc64/__osMalloc.c @@ -1,9 +1,9 @@ #include "libc64/os_malloc.h" #include "alignment.h" -#include "libc/stdbool.h" -#include "libc/stdint.h" -#include "libc/string.h" +#include "stdbool.h" +#include "stdint.h" +#include "string.h" #include "macros.h" #define FILL_ALLOCBLOCK (1 << 0) diff --git a/src/boot/libc64/math64.c b/src/boot/libc64/math64.c index 48cc5e025d..e15a741af5 100644 --- a/src/boot/libc64/math64.c +++ b/src/boot/libc64/math64.c @@ -6,8 +6,8 @@ #include "libc64/math64.h" #include "libc64/fixed_point.h" -#include "libc/stdbool.h" -#include "libc/math.h" +#include "stdbool.h" +#include "math.h" s32 gUseAtanContFrac; @@ -91,14 +91,14 @@ f32 Math_FAtanTaylorF(f32 x) { return qNaN0x10000; } - if (t <= M_SQRT2 - 1.0f) { + if (t <= M_SQRT2f - 1.0f) { return Math_FAtanTaylorQF(x); } - if (t >= M_SQRT2 + 1.0f) { - q = M_PI / 2 - Math_FAtanTaylorQF(1.0f / t); + if (t >= M_SQRT2f + 1.0f) { + q = M_PIf / 2 - Math_FAtanTaylorQF(1.0f / t); } else { // in the interval (\sqrt{2} - 1, \sqrt{2} + 1) - q = M_PI / 4 - Math_FAtanTaylorQF((1.0f - t) / (1.0f + t)); + q = M_PIf / 4 - Math_FAtanTaylorQF((1.0f - t) / (1.0f + t)); } if (x > 0.0f) { @@ -145,9 +145,9 @@ f32 Math_FAtanContFracF(f32 x) { if (sector == 0) { return conv; } else if (sector > 0) { - return M_PI / 2 - conv; + return M_PIf / 2 - conv; } else { - return -M_PI / 2 - conv; + return -M_PIf / 2 - conv; } } @@ -171,18 +171,18 @@ f32 Math_FAtan2F(f32 y, f32 x) { if (y == 0.0f) { return 0.0f; } else if (y > 0.0f) { - return M_PI / 2; + return M_PIf / 2; } else if (y < 0.0f) { - return -M_PI / 2; + return -M_PIf / 2; } else { return qNaN0x10000; } } else if (x >= 0.0f) { return Math_FAtanF(y / x); } else if (y < 0.0f) { - return Math_FAtanF(y / x) - M_PI; + return Math_FAtanF(y / x) - M_PIf; } else { - return M_PI - Math_FAtanF(-(y / x)); + return M_PIf - Math_FAtanF(-(y / x)); } } @@ -191,5 +191,5 @@ f32 Math_FAsinF(f32 x) { } f32 Math_FAcosF(f32 x) { - return M_PI / 2 - Math_FAsinF(x); + return M_PIf / 2 - Math_FAsinF(x); } diff --git a/src/boot/libc64/sprintf.c b/src/boot/libc64/sprintf.c index 07bee8064d..58f2484142 100644 --- a/src/boot/libc64/sprintf.c +++ b/src/boot/libc64/sprintf.c @@ -1,6 +1,6 @@ #include "libc64/sprintf.h" -#include "libc/string.h" +#include "string.h" void* proutPrintf(void* dst, const char* fmt, size_t size) { return (void*)((uintptr_t)memcpy(dst, fmt, size) + size); diff --git a/src/boot/libm/fmodf.c b/src/boot/libm/fmodf.c index 0c2df736dd..d91be7e408 100644 --- a/src/boot/libm/fmodf.c +++ b/src/boot/libm/fmodf.c @@ -1,4 +1,4 @@ -#include "libc/math.h" +#include "math.h" float fmodf(float dividend, float divisor) { int quotient; diff --git a/src/boot/viconfig.c b/src/boot/viconfig.c index cfbc04e861..3d504e0a5d 100644 --- a/src/boot/viconfig.c +++ b/src/boot/viconfig.c @@ -1,6 +1,6 @@ #include "viconfig.h" -#include "libc/stdbool.h" +#include "stdbool.h" #include "idle.h" void ViConfig_UpdateVi(u32 black) { diff --git a/src/code/PreRender.c b/src/code/PreRender.c index fa8805b41f..52a914a075 100644 --- a/src/code/PreRender.c +++ b/src/code/PreRender.c @@ -7,8 +7,8 @@ */ #include "z64prerender.h" -#include "libc/alloca.h" -#include "libc/stdbool.h" +#include "alloca.h" +#include "stdbool.h" #include "PR/gs2dex.h" #include "global.h" diff --git a/src/code/cutscene_camera.c b/src/code/cutscene_camera.c index f225651feb..6eb782787f 100644 --- a/src/code/cutscene_camera.c +++ b/src/code/cutscene_camera.c @@ -1,6 +1,6 @@ #include "prevent_bss_reordering.h" #include "global.h" -#include "libc/string.h" +#include "string.h" CutsceneCamera* sCurCsCamera; diff --git a/src/code/jpegdecoder.c b/src/code/jpegdecoder.c index e6998adc99..01d0976414 100644 --- a/src/code/jpegdecoder.c +++ b/src/code/jpegdecoder.c @@ -1,5 +1,5 @@ #include "z64jpeg.h" -#include "libc/stdbool.h" +#include "stdbool.h" #include "macros.h" u8* sJpegBitStreamPtr; diff --git a/src/code/jpegutils.c b/src/code/jpegutils.c index fbf6c69c27..a24f86a89b 100644 --- a/src/code/jpegutils.c +++ b/src/code/jpegutils.c @@ -1,5 +1,5 @@ #include "z64jpeg.h" -#include "libc/stdbool.h" +#include "stdbool.h" #include "macros.h" void JpegUtils_ProcessQuantizationTable(u8* dqt, JpegQuantizationTable* qt, u8 count) { diff --git a/src/code/sys_cfb.c b/src/code/sys_cfb.c index a16a6b5c1d..974e6cdf7b 100644 --- a/src/code/sys_cfb.c +++ b/src/code/sys_cfb.c @@ -34,7 +34,7 @@ s16 gCfbUpperAdjust; u8 gSysCfbHiResEnabled; #include "sys_cfb.h" -#include "libc/stdbool.h" +#include "stdbool.h" #include "buffers.h" #include "libc64/malloc.h" #include "z64vimode.h" diff --git a/src/code/sys_math.c b/src/code/sys_math.c index 99d13c3322..9649218b14 100644 --- a/src/code/sys_math.c +++ b/src/code/sys_math.c @@ -71,7 +71,7 @@ f32 Math_PowF(f32 base, s32 exp) { * @remark original name: "sinf_table" */ f32 Math_SinF(f32 rad) { - return sins(RAD_TO_BINANG(rad)) * SHT_MINV; + return sins(RAD_TO_BINANG(rad)) * (1.0f / SHRT_MAX); } /** @@ -80,7 +80,7 @@ f32 Math_SinF(f32 rad) { * @remark original name: "cosf_table" */ f32 Math_CosF(f32 rad) { - return coss(RAD_TO_BINANG(rad)) * SHT_MINV; + return coss(RAD_TO_BINANG(rad)) * (1.0f / SHRT_MAX); } /** diff --git a/src/code/sys_matrix.c b/src/code/sys_matrix.c index 66db1a35c7..42ae4277b3 100644 --- a/src/code/sys_matrix.c +++ b/src/code/sys_matrix.c @@ -448,8 +448,8 @@ void Matrix_RotateXFApply(f32 x) { if (x != 0.0f) { cmf = sCurrentMatrix; - sin = sins(RAD_TO_BINANG(x)) * SHT_MINV; - cos = coss(RAD_TO_BINANG(x)) * SHT_MINV; + sin = sins(RAD_TO_BINANG(x)) * (1.0f / SHRT_MAX); + cos = coss(RAD_TO_BINANG(x)) * (1.0f / SHRT_MAX); tempY = cmf->xy; tempZ = cmf->xz; diff --git a/src/code/z_actor.c b/src/code/z_actor.c index d8a4a80726..8f08b3f318 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -4064,7 +4064,7 @@ void Actor_DrawDoorLock(PlayState* play, s32 frame, s32 type) { if ((i % 2) != 0) { rotZStep = 2.0f * entry->chainAngle; } else { - rotZStep = M_PI - (2.0f * entry->chainAngle); + rotZStep = M_PIf - (2.0f * entry->chainAngle); } chainRotZ += rotZStep; @@ -4902,11 +4902,11 @@ void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f bodyPartsPos[] Matrix_Scale(frozenScale, frozenScale, frozenScale, MTXMODE_APPLY); if (bodyPartIndex & 1) { - Matrix_RotateYF(M_PI, MTXMODE_APPLY); + Matrix_RotateYF(M_PIf, MTXMODE_APPLY); } if (bodyPartIndex & 2) { - Matrix_RotateZF(M_PI, MTXMODE_APPLY); + Matrix_RotateZF(M_PIf, MTXMODE_APPLY); } gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), @@ -4984,7 +4984,7 @@ void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f bodyPartsPos[] Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, ((bodyPartIndex * 10 + gameplayFrames) * -20) & 0x1FF, 32, 128)); - Matrix_RotateYF(M_PI, MTXMODE_APPLY); + Matrix_RotateYF(M_PIf, MTXMODE_APPLY); currentMatrix->mf[3][0] = bodyPartsPos->x; currentMatrix->mf[3][1] = bodyPartsPos->y; currentMatrix->mf[3][2] = bodyPartsPos->z; @@ -5026,7 +5026,7 @@ void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f bodyPartsPos[] // Apply and draw a light orb over each body part of frozen actor for (bodyPartIndex = 0; bodyPartIndex < bodyPartsCount; bodyPartIndex++, bodyPartsPos++) { - Matrix_RotateZF(Rand_CenteredFloat(2 * M_PI), MTXMODE_APPLY); + Matrix_RotateZF(Rand_CenteredFloat(2 * M_PIf), MTXMODE_APPLY); currentMatrix->mf[3][0] = bodyPartsPos->x; currentMatrix->mf[3][1] = bodyPartsPos->y; currentMatrix->mf[3][2] = bodyPartsPos->z; @@ -5065,8 +5065,8 @@ void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f bodyPartsPos[] // Every body part draws two electric sparks at random orientations for (bodyPartIndex = 0; bodyPartIndex < bodyPartsCount; bodyPartIndex++, bodyPartsPos++) { // first electric spark - Matrix_RotateXFApply(Rand_ZeroFloat(2 * M_PI)); - Matrix_RotateZF(Rand_ZeroFloat(2 * M_PI), MTXMODE_APPLY); + Matrix_RotateXFApply(Rand_ZeroFloat(2 * M_PIf)); + Matrix_RotateZF(Rand_ZeroFloat(2 * M_PIf), MTXMODE_APPLY); currentMatrix->mf[3][0] = Rand_CenteredFloat((f32)sREG(24) + 30.0f) + bodyPartsPos->x; currentMatrix->mf[3][1] = Rand_CenteredFloat((f32)sREG(24) + 30.0f) + bodyPartsPos->y; currentMatrix->mf[3][2] = Rand_CenteredFloat((f32)sREG(24) + 30.0f) + bodyPartsPos->z; @@ -5077,8 +5077,8 @@ void Actor_DrawDamageEffects(PlayState* play, Actor* actor, Vec3f bodyPartsPos[] gSPDisplayList(POLY_XLU_DISP++, gElectricSparkModelDL); // second electric spark - Matrix_RotateXFApply(Rand_ZeroFloat(2 * M_PI)); - Matrix_RotateZF(Rand_ZeroFloat(2 * M_PI), MTXMODE_APPLY); + Matrix_RotateXFApply(Rand_ZeroFloat(2 * M_PIf)); + Matrix_RotateZF(Rand_ZeroFloat(2 * M_PIf), MTXMODE_APPLY); currentMatrix->mf[3][0] = Rand_CenteredFloat((f32)sREG(24) + 30.0f) + bodyPartsPos->x; currentMatrix->mf[3][1] = Rand_CenteredFloat((f32)sREG(24) + 30.0f) + bodyPartsPos->y; currentMatrix->mf[3][2] = Rand_CenteredFloat((f32)sREG(24) + 30.0f) + bodyPartsPos->z; diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 609e035b14..ad2170d5f7 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -45,7 +45,7 @@ #include "prevent_bss_reordering.h" #include "global.h" -#include "libc/string.h" +#include "string.h" #include "z64malloc.h" #include "z64quake.h" #include "z64shrink_window.h" @@ -1536,10 +1536,10 @@ s32 Camera_CalcAtForFriendlyLockOn(Camera* camera, VecGeo* eyeAtDir, Vec3f* targ deltaY = focalActorPosRot->pos.y - *yPosOffset; temp_f0_6 = Math_FAtan2F(deltaY, OLib_Vec3fDistXZ(at, &camera->eye)); - if (temp_f0_6 > 0.34906584f) { // (M_PI / 9) - phi_f16 = 1.0f - Math_SinF(temp_f0_6 - 0.34906584f); - } else if (temp_f0_6 < -0.17453292f) { // (M_PI / 18) - phi_f16 = 1.0f - Math_SinF(-0.17453292f - temp_f0_6); + if (temp_f0_6 > (f32)(M_PI / 9)) { + phi_f16 = 1.0f - Math_SinF(temp_f0_6 - (f32)(M_PI / 9)); + } else if (temp_f0_6 < -(f32)(M_PI / 18)) { + phi_f16 = 1.0f - Math_SinF(-(f32)(M_PI / 18) - temp_f0_6); } else { phi_f16 = 1.0f; } @@ -1616,10 +1616,10 @@ s32 Camera_CalcAtForEnemyLockOn(Camera* camera, VecGeo* arg1, Vec3f* arg2, f32 y focalActorAtOffsetTarget.y -= deltaY; } else { - if (temp_f0_3 > 0.34906584f) { // (M_PI / 9) - temp = 1.0f - Math_SinF(temp_f0_3 - 0.34906584f); - } else if (temp_f0_3 < -0.17453292f) { // (M_PI / 18) - temp = 1.0f - Math_SinF(-0.17453292f - temp_f0_3); + if (temp_f0_3 > (f32)(M_PI / 9)) { + temp = 1.0f - Math_SinF(temp_f0_3 - (f32)(M_PI / 9)); + } else if (temp_f0_3 < -(f32)(M_PI / 18)) { + temp = 1.0f - Math_SinF(-(f32)(M_PI / 18) - temp_f0_3); } else { temp = 1.0f; } diff --git a/src/code/z_common_data.c b/src/code/z_common_data.c index e6d291831b..bbbc420f41 100644 --- a/src/code/z_common_data.c +++ b/src/code/z_common_data.c @@ -2,7 +2,7 @@ #include "alignment.h" #include "sequence.h" -#include "libc/stdbool.h" +#include "stdbool.h" #include "z64environment.h" #include "z64transition.h" diff --git a/src/code/z_eff_blure.c b/src/code/z_eff_blure.c index 6ac53632fa..22dab64328 100644 --- a/src/code/z_eff_blure.c +++ b/src/code/z_eff_blure.c @@ -1,6 +1,6 @@ #include "z64eff_blure.h" -#include "libc/stdbool.h" +#include "stdbool.h" #include "gfx.h" #include "macros.h" #include "sys_matrix.h" diff --git a/src/code/z_eventmgr.c b/src/code/z_eventmgr.c index 5bad9f1a14..35e2f1fef3 100644 --- a/src/code/z_eventmgr.c +++ b/src/code/z_eventmgr.c @@ -6,7 +6,7 @@ #include "global.h" #include "z64shrink_window.h" -#include "libc/string.h" +#include "string.h" CutsceneEntry sGlobalCutsceneList[] = { // CS_ID_GLOBAL_78 @@ -173,7 +173,7 @@ s16 CutsceneManager_MarkNextCutscenes(void) { s32 j; s32 count = 0; s16 csIdMax = CS_ID_NONE; - s16 priorityMax = SHT_MAX; // lower number means higher priority + s16 priorityMax = SHRT_MAX; // lower number means higher priority s16 csId; s16 priority; diff --git a/src/code/z_fbdemo_fade.c b/src/code/z_fbdemo_fade.c index f1e535594b..64502a68e8 100644 --- a/src/code/z_fbdemo_fade.c +++ b/src/code/z_fbdemo_fade.c @@ -1,6 +1,6 @@ #include "z64transition.h" -#include "libc/stdbool.h" +#include "stdbool.h" #include "gfx.h" #include "regs.h" #include "z64math.h" diff --git a/src/code/z_fcurve_data_skelanime.c b/src/code/z_fcurve_data_skelanime.c index 6569d95d76..2cc9532465 100644 --- a/src/code/z_fcurve_data_skelanime.c +++ b/src/code/z_fcurve_data_skelanime.c @@ -27,7 +27,7 @@ #include "z64curve.h" -#include "libc/stdbool.h" +#include "stdbool.h" #include "z64actor.h" #include "z64animation.h" #include "z64curve.h" diff --git a/src/code/z_jpeg.c b/src/code/z_jpeg.c index cc2f24ee01..00cbe135a1 100644 --- a/src/code/z_jpeg.c +++ b/src/code/z_jpeg.c @@ -1,6 +1,6 @@ #include "z64jpeg.h" -#include "libc/stdbool.h" +#include "stdbool.h" #include "main.h" #include "sys_ucode.h" #include "macros.h" diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index 5f9757296b..ae2487eccf 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -62,7 +62,7 @@ Gfx* sSkyboxStarsDList; #include "z64environment.h" #include "global.h" -#include "libc/string.h" +#include "string.h" #include "sys_cfb.h" #include "objects/gameplay_keep/gameplay_keep.h" diff --git a/src/code/z_lib.c b/src/code/z_lib.c index 00bb37bc8d..648f56cff0 100644 --- a/src/code/z_lib.c +++ b/src/code/z_lib.c @@ -32,11 +32,11 @@ void* Lib_MemSet(void* buffer, s32 value, size_t size) { } f32 Math_CosS(s16 angle) { - return coss(angle) * SHT_MINV; + return coss(angle) * (1.0f / SHRT_MAX); } f32 Math_SinS(s16 angle) { - return sins(angle) * SHT_MINV; + return sins(angle) * (1.0f / SHRT_MAX); } s32 Math_StepToIImpl(s32 start, s32 target, s32 step) { diff --git a/src/code/z_pause.c b/src/code/z_pause.c index b16cc62c13..a1bcf8d92c 100644 --- a/src/code/z_pause.c +++ b/src/code/z_pause.c @@ -20,7 +20,7 @@ */ #include "z64frameadvance.h" -#include "libc/stdbool.h" +#include "stdbool.h" #include "padutils.h" #include "macros.h" diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index bfe41894e5..f08a1f4b57 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -1812,9 +1812,9 @@ void Player_AdjustSingleLeg(PlayState* play, Player* player, SkelAnime* skelAnim temp_f20 = (temp_f20 < 0.0f) ? 0.0f : sqrtf(temp_f20); sp48 = Math_FAtan2F(temp_f20, sp58); - phi_t1 = (M_PI - (Math_FAtan2F(sp54, temp_f20) + ((M_PI / 2.0f) - sp48))) * (0x8000 / M_PI); + phi_t1 = RAD_TO_BINANG(M_PIf - (Math_FAtan2F(sp54, temp_f20) + ((M_PIf / 2) - sp48))); phi_t1 = -skelAnime->jointTable[shinLimbIndex].z + phi_t1; - temp_f8 = (sp48 - sp4C) * (0x8000 / M_PI); + temp_f8 = RAD_TO_BINANG(sp48 - sp4C); if ((s16)(ABS_ALT(skelAnime->jointTable[shinLimbIndex].x) + ABS_ALT(skelAnime->jointTable[shinLimbIndex].y)) < 0) { diff --git a/src/code/z_quake.c b/src/code/z_quake.c index 9c42e1f379..37b51df700 100644 --- a/src/code/z_quake.c +++ b/src/code/z_quake.c @@ -1,6 +1,6 @@ #include "z64quake.h" -#include "libc/string.h" +#include "string.h" #include "global.h" #include "z64view.h" diff --git a/src/code/z_skin.c b/src/code/z_skin.c index cbf85860b2..5ced3edeac 100644 --- a/src/code/z_skin.c +++ b/src/code/z_skin.c @@ -1,6 +1,6 @@ #include "z64skin.h" -#include "libc/stdbool.h" +#include "stdbool.h" #include "global.h" #include "gfx.h" diff --git a/src/code/z_viszbuf.c b/src/code/z_viszbuf.c index 86fb644749..e6ab69bdf9 100644 --- a/src/code/z_viszbuf.c +++ b/src/code/z_viszbuf.c @@ -34,7 +34,7 @@ #include "z64vis.h" #include "global.h" #include "sys_cfb.h" -#include "libc/stdbool.h" +#include "stdbool.h" // Height of the fragments the z-buffer is split into. // It is the maximum amount of lines such that all rgba16 SCREEN_WIDTH-long lines fit into TMEM. diff --git a/src/libultra/gu/cosf.c b/src/libultra/gu/cosf.c index 8f9eafe651..6fc6ef24e5 100644 --- a/src/libultra/gu/cosf.c +++ b/src/libultra/gu/cosf.c @@ -1,5 +1,5 @@ #include "ultra64.h" -#include "libc/math.h" +#include "math.h" #include "macros.h" #pragma weak cosf = __cosf @@ -14,7 +14,7 @@ static const du P[] = { { 0.000002605780637968037 }, }; -static const du rpi = { 1 / 3.14159265358979323846 }; // 1/M_PI, "reciprocal of pi" +static const du rpi = { 1 / M_PI }; // "reciprocal of pi" // pihi + pilo is the closest double to pi, this representation allows more precise calculations since pi itself is not // an exact float diff --git a/src/libultra/gu/position.c b/src/libultra/gu/position.c index 17852abc02..43072b5a63 100644 --- a/src/libultra/gu/position.c +++ b/src/libultra/gu/position.c @@ -1,12 +1,12 @@ #include "ultra64.h" -#include "libc/math.h" +#include "math.h" /** * guPositionF * Creates a rotation/parallel translation modelling matrix (floating point) */ void guPositionF(f32 mf[4][4], f32 rot, f32 pitch, f32 yaw, f32 scale, f32 x, f32 y, f32 z) { - static f32 D_80134D00 = M_PI / 180.0f; + static f32 D_80134D00 = M_PIf / 180.0f; f32 sinr; f32 sinp; f32 sinh; diff --git a/src/libultra/gu/rotate.c b/src/libultra/gu/rotate.c index b51c35fef6..7ab9185f02 100644 --- a/src/libultra/gu/rotate.c +++ b/src/libultra/gu/rotate.c @@ -1,8 +1,8 @@ #include "ultra64.h" -#include "libc/math.h" +#include "math.h" void guRotateF(float m[4][4], float a, float x, float y, float z) { - static float dtor = M_PI / 180.0f; + static float dtor = M_PIf / 180.0f; float sine; float cosine; float ab; diff --git a/src/libultra/gu/sinf.c b/src/libultra/gu/sinf.c index d067d5ea74..4602940249 100644 --- a/src/libultra/gu/sinf.c +++ b/src/libultra/gu/sinf.c @@ -1,5 +1,5 @@ #include "ultra64.h" -#include "libc/math.h" +#include "math.h" #include "macros.h" #pragma weak sinf = __sinf @@ -14,7 +14,7 @@ static const du P[] = { { 0.000002605780637968037 }, }; -static const du rpi = { 1 / 3.14159265358979323846 }; // 1/M_PI, "reciprocal of pi" +static const du rpi = { 1 / M_PI }; // "reciprocal of pi" // pihi + pilo is the closest double to pi, this representation allows more precise calculations since pi itself is not // an exact float diff --git a/src/libultra/gu/sins.c b/src/libultra/gu/sins.c index 247bb36890..4fbafbb188 100644 --- a/src/libultra/gu/sins.c +++ b/src/libultra/gu/sins.c @@ -1,5 +1,5 @@ #include "ultra64.h" -#include "libc/math.h" +#include "math.h" static s16 sintable[0x400] = { 0x0000, 0x0032, 0x0064, 0x0096, 0x00C9, 0x00FB, 0x012D, 0x0160, 0x0192, 0x01C4, 0x01F7, 0x0229, 0x025B, 0x028E, diff --git a/src/libultra/io/cartrominit.c b/src/libultra/io/cartrominit.c index eeca4b339e..2d2b6b56b7 100644 --- a/src/libultra/io/cartrominit.c +++ b/src/libultra/io/cartrominit.c @@ -1,5 +1,5 @@ #include "ultra64.h" -#include "libc/stdbool.h" +#include "stdbool.h" #include "alignment.h" OSPiHandle __CartRomHandle ALIGNED(8); diff --git a/src/libultra/io/controller.c b/src/libultra/io/controller.c index ca57673cd4..2b6ad5fd13 100644 --- a/src/libultra/io/controller.c +++ b/src/libultra/io/controller.c @@ -1,6 +1,6 @@ #include "ultra64.h" #include "PR/controller.h" -#include "libc/stdbool.h" +#include "stdbool.h" #include "alignment.h" #include "macros.h" diff --git a/src/libultra/io/devmgr.c b/src/libultra/io/devmgr.c index 168ca9b8df..b1117c59fd 100644 --- a/src/libultra/io/devmgr.c +++ b/src/libultra/io/devmgr.c @@ -1,5 +1,5 @@ #include "ultra64.h" -#include "libc/stdbool.h" +#include "stdbool.h" void __osDevMgrMain(void* arg) { OSIoMesg* ioMesg; diff --git a/src/libultra/io/pfsfilestate.c b/src/libultra/io/pfsfilestate.c index a39d55c02c..f62c2e71d7 100644 --- a/src/libultra/io/pfsfilestate.c +++ b/src/libultra/io/pfsfilestate.c @@ -1,6 +1,6 @@ #include "ultra64.h" #include "PR/controller.h" -#include "libc/stdbool.h" +#include "stdbool.h" s32 osPfsFileState(OSPfs* pfs, s32 fileNo, OSPfsState* state) { s32 ret; diff --git a/src/libultra/io/si.c b/src/libultra/io/si.c index f1511c0d6f..4f9dff1543 100644 --- a/src/libultra/io/si.c +++ b/src/libultra/io/si.c @@ -1,5 +1,5 @@ #include "ultra64.h" -#include "libc/stdbool.h" +#include "stdbool.h" s32 __osSiDeviceBusy() { register u32 status = IO_READ(SI_STATUS_REG); diff --git a/src/libultra/io/sp.c b/src/libultra/io/sp.c index e1d95eeb88..1808795a2f 100644 --- a/src/libultra/io/sp.c +++ b/src/libultra/io/sp.c @@ -1,5 +1,5 @@ #include "ultra64.h" -#include "libc/stdbool.h" +#include "stdbool.h" s32 __osSpDeviceBusy(void) { register u32 status = IO_READ(SP_STATUS_REG); diff --git a/src/libultra/io/vimgr.c b/src/libultra/io/vimgr.c index 485bdf5973..ca07e76ebd 100644 --- a/src/libultra/io/vimgr.c +++ b/src/libultra/io/vimgr.c @@ -2,7 +2,7 @@ #include "PR/osint.h" #include "stack.h" #include "PR/osint.h" -#include "libc/stdbool.h" +#include "stdbool.h" #include "macros.h" #include "alignment.h" diff --git a/src/libultra/libc/ldiv.c b/src/libultra/libc/ldiv.c index 66b144da48..e56b439b8b 100644 --- a/src/libultra/libc/ldiv.c +++ b/src/libultra/libc/ldiv.c @@ -1,5 +1,5 @@ #include "ultra64.h" -#include "libc/stdlib.h" +#include "stdlib.h" ldiv_t ldiv(long numer, long denom) { ldiv_t val; diff --git a/src/libultra/libc/string.c b/src/libultra/libc/string.c index b4bdf84aee..93dbcfd468 100644 --- a/src/libultra/libc/string.c +++ b/src/libultra/libc/string.c @@ -1,6 +1,6 @@ #include "ultra64.h" -#include "libc/stdlib.h" -#include "libc/string.h" +#include "stdlib.h" +#include "string.h" const char* strchr(const char* s, int c) { const unsigned char ch = c; diff --git a/src/libultra/libc/xldtob.c b/src/libultra/libc/xldtob.c index df9c30a28e..5aea80a086 100644 --- a/src/libultra/libc/xldtob.c +++ b/src/libultra/libc/xldtob.c @@ -1,6 +1,6 @@ #include "ultra64.h" -#include "libc/stdlib.h" -#include "libc/string.h" +#include "stdlib.h" +#include "string.h" #define BUFF_LEN 0x20 diff --git a/src/libultra/libc/xlitob.c b/src/libultra/libc/xlitob.c index 40596271a9..5923ae45ae 100644 --- a/src/libultra/libc/xlitob.c +++ b/src/libultra/libc/xlitob.c @@ -1,6 +1,6 @@ #include "ultra64.h" -#include "libc/stdlib.h" -#include "libc/string.h" +#include "stdlib.h" +#include "string.h" #define BUFF_LEN 0x18 diff --git a/src/libultra/libc/xprintf.c b/src/libultra/libc/xprintf.c index b644516f4c..653a64178c 100644 --- a/src/libultra/libc/xprintf.c +++ b/src/libultra/libc/xprintf.c @@ -1,5 +1,5 @@ #include "ultra64.h" -#include "libc/string.h" +#include "string.h" #define ATOI(i, a) \ for (i = 0; (*a >= '0') && (*a <= '9'); a++) \ diff --git a/src/libultra/os/initialize.c b/src/libultra/os/initialize.c index a39aa91c02..7192831e33 100644 --- a/src/libultra/os/initialize.c +++ b/src/libultra/os/initialize.c @@ -1,5 +1,5 @@ #include "ultra64.h" -#include "libc/stdbool.h" +#include "stdbool.h" #define COLD_RESET 0 diff --git a/src/libultra/os/seteventmesg.c b/src/libultra/os/seteventmesg.c index 6f4fb0f97f..2ca53b6ec2 100644 --- a/src/libultra/os/seteventmesg.c +++ b/src/libultra/os/seteventmesg.c @@ -1,6 +1,6 @@ #include "ultra64.h" #include "PR/osint.h" -#include "libc/stdbool.h" +#include "stdbool.h" #include "alignment.h" u32 __osPreNMI = false; diff --git a/src/libultra/os/timerintr.c b/src/libultra/os/timerintr.c index ae30b5cf7b..45b768d2a1 100644 --- a/src/libultra/os/timerintr.c +++ b/src/libultra/os/timerintr.c @@ -1,5 +1,5 @@ #include "ultra64.h" -#include "libc/stdbool.h" +#include "stdbool.h" OSTimer __osBaseTimer; OSTime __osCurrentTime; diff --git a/src/libultra/os/virtualtophysical.c b/src/libultra/os/virtualtophysical.c index 864f54eb86..7567d2ef38 100644 --- a/src/libultra/os/virtualtophysical.c +++ b/src/libultra/os/virtualtophysical.c @@ -1,5 +1,5 @@ #include "ultra64.h" -#include "libc/stdint.h" +#include "stdint.h" uintptr_t osVirtualToPhysical(void* addr) { if (IS_KSEG0(addr)) { diff --git a/src/libultra/voice/voicecrc.c b/src/libultra/voice/voicecrc.c index 58e405fbdb..5b17a8671c 100644 --- a/src/libultra/voice/voicecrc.c +++ b/src/libultra/voice/voicecrc.c @@ -6,7 +6,7 @@ */ #include "ultra64.h" -#include "libc/stddef.h" +#include "stddef.h" #define VOICE_CRC_LENGTH 8 #define VOICE_CRC_GENERATOR 0x85 diff --git a/src/overlays/actors/ovl_Bg_F40_Flift/z_bg_f40_flift.c b/src/overlays/actors/ovl_Bg_F40_Flift/z_bg_f40_flift.c index 736a72a9ca..aeeb63cc20 100644 --- a/src/overlays/actors/ovl_Bg_F40_Flift/z_bg_f40_flift.c +++ b/src/overlays/actors/ovl_Bg_F40_Flift/z_bg_f40_flift.c @@ -64,11 +64,10 @@ void func_808D75F0(BgF40Flift* this, PlayState* play) { } this->timer--; if (this->dyna.actor.params == 1) { - this->dyna.actor.world.pos.y = - (Math_SinF(this->timer * (M_PI / 24.0f)) * 5.0f) + this->dyna.actor.home.pos.y; + this->dyna.actor.world.pos.y = (Math_SinF(this->timer * (M_PIf / 24)) * 5.0f) + this->dyna.actor.home.pos.y; } else { this->dyna.actor.world.pos.y = - (Math_SinF(this->timer * (M_PI / 24.0f)) * 5.0f) + (926.8f + this->dyna.actor.home.pos.y); + (Math_SinF(this->timer * (M_PIf / 24)) * 5.0f) + (926.8f + this->dyna.actor.home.pos.y); } } } @@ -77,7 +76,7 @@ void func_808D7714(BgF40Flift* this, PlayState* play) { if (this->timer != 0) { this->timer--; this->dyna.actor.world.pos.y = - (((Math_CosF(this->timer * (M_PI / 96.0f)) * this->dyna.actor.params) + 1.0f) * 463.4f) + + (((Math_CosF(this->timer * (M_PIf / 96)) * this->dyna.actor.params) + 1.0f) * 463.4f) + this->dyna.actor.home.pos.y; } else { this->dyna.actor.params = -this->dyna.actor.params; diff --git a/src/overlays/actors/ovl_Bg_F40_Swlift/z_bg_f40_swlift.c b/src/overlays/actors/ovl_Bg_F40_Swlift/z_bg_f40_swlift.c index 6a68e92995..e018fee7f4 100644 --- a/src/overlays/actors/ovl_Bg_F40_Swlift/z_bg_f40_swlift.c +++ b/src/overlays/actors/ovl_Bg_F40_Swlift/z_bg_f40_swlift.c @@ -105,7 +105,7 @@ void BgF40Swlift_Update(Actor* thisx, PlayState* play2) { } this->timer--; this->dyna.actor.world.pos.y = - sHeights[this->dyna.actor.params] + (Math_SinF(this->timer * (M_PI / 24.0f)) * 5.0f); + sHeights[this->dyna.actor.params] + (Math_SinF(this->timer * (M_PIf / 24)) * 5.0f); } } diff --git a/src/overlays/actors/ovl_Bg_Icefloe/z_bg_icefloe.c b/src/overlays/actors/ovl_Bg_Icefloe/z_bg_icefloe.c index cb5251de61..878ffd974c 100644 --- a/src/overlays/actors/ovl_Bg_Icefloe/z_bg_icefloe.c +++ b/src/overlays/actors/ovl_Bg_Icefloe/z_bg_icefloe.c @@ -127,7 +127,7 @@ void func_80AC4C34(BgIcefloe* this, PlayState* play) { func_80AC4CF0(this); } else { this->dyna.actor.world.pos.y = - (Math_SinF(this->timer * (M_PI / 30.0f)) * 3.0f) + (this->dyna.actor.home.pos.y + 10.0f); + (Math_SinF(this->timer * (M_PIf / 30)) * 3.0f) + (this->dyna.actor.home.pos.y + 10.0f); } } diff --git a/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.c b/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.c index 0d23d6bec0..5d6f5b291b 100644 --- a/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.c +++ b/src/overlays/actors/ovl_Bg_Lotus/z_bg_lotus.c @@ -55,7 +55,7 @@ void func_80AD6830(BgLotus* this) { f32 temp_fv1; if (this->dyna.actor.params == 0) { - temp_fv1 = Math_SinF(this->unk166 * (M_PI / 4)) * ((0.014f * (this->unk166 / (80.0f * 0.1f))) + 0.01f); + temp_fv1 = Math_SinF(this->unk166 * (M_PIf / 4)) * ((0.014f * (this->unk166 / (80.0f * 0.1f))) + 0.01f); this->dyna.actor.scale.x = (1.0f + temp_fv1) * 0.1f; this->dyna.actor.scale.z = (1.0f - temp_fv1) * 0.1f; } @@ -65,7 +65,7 @@ void func_80AD68DC(BgLotus* this, PlayState* play) { f32 sp34; this->unk168--; - sp34 = Math_SinF(this->unk168 * (M_PI / 48)) * 6.0f; + sp34 = Math_SinF(this->unk168 * (M_PIf / 48)) * 6.0f; if (this->dyna.actor.params == 0) { this->dyna.actor.world.pos.x = (Math_SinS(this->dyna.actor.world.rot.y) * sp34) + this->dyna.actor.home.pos.x; diff --git a/src/overlays/actors/ovl_Bg_Spdweb/z_bg_spdweb.c b/src/overlays/actors/ovl_Bg_Spdweb/z_bg_spdweb.c index b88a2b060c..44735fa67a 100644 --- a/src/overlays/actors/ovl_Bg_Spdweb/z_bg_spdweb.c +++ b/src/overlays/actors/ovl_Bg_Spdweb/z_bg_spdweb.c @@ -324,7 +324,7 @@ void func_809CE4C8(BgSpdweb* this, PlayState* play) { } this->dyna.actor.world.pos.y = - (Math_SinF(this->unk_162 * (M_PI / 6)) * this->unk_164) + this->dyna.actor.home.pos.y; + (Math_SinF(this->unk_162 * (M_PIf / 6)) * this->unk_164) + this->dyna.actor.home.pos.y; Math_ApproachZeroF(&this->unk_164, 1.0f, 0.8f); if (this->unk_162 == 4) { diff --git a/src/overlays/actors/ovl_Boss_01/z_boss_01.c b/src/overlays/actors/ovl_Boss_01/z_boss_01.c index 89b6d22509..d6de138da9 100644 --- a/src/overlays/actors/ovl_Boss_01/z_boss_01.c +++ b/src/overlays/actors/ovl_Boss_01/z_boss_01.c @@ -205,7 +205,7 @@ static Vec3f sFallingBlockSfxPos = { 0.0f, 1000.0f, 0.0f }; /** * Odolwa's sword trail is a circular arc, and this variable is used to determine the angular range of this arc (and * thus the total size of the trail). The trail consists of 10 segments in an arc, and the angle of each of those - * segments is M_PI / sSwordTrailAngularRangeDivisor; in other words, as this variable decreases, Odolwa's sword trail + * segments is M_PIf / sSwordTrailAngularRangeDivisor; in other words, as this variable decreases, Odolwa's sword trail * covers a larger angular range, and as it increaes, the sword trail covers a smaller angular range. */ static f32 sSwordTrailAngularRangeDivisor = 10.0f; @@ -1723,7 +1723,7 @@ void Boss01_VerticalSlash(Boss01* this, PlayState* play) { sOdolwaSwordTrailPosY = 90.0f; sOdolwaSwordTrailPosZ = -70.0f; sOdolwaSwordTrailRotX = 0.4712388f; - sOdolwaSwordTrailRotY = M_PI; + sOdolwaSwordTrailRotY = M_PIf; sOdolwaSwordTrailRotZ = 1.7278761f; if (Animation_OnFrame(&this->skelAnime, 12.0f)) { @@ -2614,13 +2614,13 @@ void Boss01_DrawSwordTrail(Boss01* this, PlayState* play) { vtx = Lib_SegmentedToVirtual(&gOdolwaSwordTrailVtx); for (i = 0; i < ARRAY_COUNT(sSwordTrailOuterVertexIndices); i++) { - vtx[sSwordTrailOuterVertexIndices[i]].v.ob[0] = cosf((i * M_PI) / sSwordTrailAngularRangeDivisor) * 200.0f; + vtx[sSwordTrailOuterVertexIndices[i]].v.ob[0] = cosf((i * M_PIf) / sSwordTrailAngularRangeDivisor) * 200.0f; vtx[sSwordTrailOuterVertexIndices[i]].v.ob[1] = 0; - vtx[sSwordTrailOuterVertexIndices[i]].v.ob[2] = sinf((i * M_PI) / sSwordTrailAngularRangeDivisor) * 200.0f; + vtx[sSwordTrailOuterVertexIndices[i]].v.ob[2] = sinf((i * M_PIf) / sSwordTrailAngularRangeDivisor) * 200.0f; - vtx[sSwordTrailInnerVertexIndices[i]].v.ob[0] = cosf((i * M_PI) / sSwordTrailAngularRangeDivisor) * 100.0f; + vtx[sSwordTrailInnerVertexIndices[i]].v.ob[0] = cosf((i * M_PIf) / sSwordTrailAngularRangeDivisor) * 100.0f; vtx[sSwordTrailInnerVertexIndices[i]].v.ob[1] = 0; - vtx[sSwordTrailInnerVertexIndices[i]].v.ob[2] = sinf((i * M_PI) / sSwordTrailAngularRangeDivisor) * 100.0f; + vtx[sSwordTrailInnerVertexIndices[i]].v.ob[2] = sinf((i * M_PIf) / sSwordTrailAngularRangeDivisor) * 100.0f; } gSPSegment( @@ -3571,11 +3571,11 @@ void Boss01_DrawEffects(PlayState* play) { Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, 0, 32, 64, 1, 0, ((effect->timer + (i * 10)) * -20) & 0x1FF, 32, 128)); - Matrix_RotateYF(i * (M_PI / 16.0f), MTXMODE_APPLY); + Matrix_RotateYF(i * (M_PIf / 16), MTXMODE_APPLY); Matrix_Translate(0.0f, 0.0f, KREG(49) + 200.0f, MTXMODE_APPLY); Matrix_ReplaceRotation(&play->billboardMtxF); if (Boss01_RandZeroOne() < 0.5f) { - Matrix_RotateYF(M_PI, MTXMODE_APPLY); + Matrix_RotateYF(M_PIf, MTXMODE_APPLY); } Matrix_Scale(KREG(48) * 0.0001f + 0.018f, diff --git a/src/overlays/actors/ovl_Boss_02/z_boss_02.c b/src/overlays/actors/ovl_Boss_02/z_boss_02.c index 2e281b362a..43a7a3ff1d 100644 --- a/src/overlays/actors/ovl_Boss_02/z_boss_02.c +++ b/src/overlays/actors/ovl_Boss_02/z_boss_02.c @@ -1030,7 +1030,7 @@ void func_809DAB78(Boss02* this, PlayState* play) { Math_Vec3f_Copy(&this->unk_01BC[i], &this->actor.world.pos); this->unk_0B1C[i].y += this->unk_0164; - Math_ApproachF(&this->unk_0B1C[i].x, -(M_PI / 2), 0.1f, 0.07f); + Math_ApproachF(&this->unk_0B1C[i].x, -(M_PIf / 2), 0.1f, 0.07f); Actor_MoveWithGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 150.0f, 100.0f, UPDBGCHECKINFO_FLAG_4); @@ -1057,13 +1057,13 @@ void func_809DAB78(Boss02* this, PlayState* play) { case 23: i = (this->unk_014E + 196) % ARRAY_COUNT(this->unk_01BC); Math_Vec3f_Copy(&this->unk_01BC[i], &this->actor.world.pos); - Math_ApproachF(&this->unk_0B1C[i].x, -(M_PI / 2), 0.05f, 0.07f); + Math_ApproachF(&this->unk_0B1C[i].x, -(M_PIf / 2), 0.05f, 0.07f); if (this->unk_0146[0] & 1) { - sp9C = Rand_ZeroFloat(M_PI); + sp9C = Rand_ZeroFloat(M_PIf); for (i = 0; i < 15; i++) { - Matrix_RotateYF(((2.0f * (i * M_PI)) / 15.0f) + sp9C, MTXMODE_NEW); + Matrix_RotateYF(((2.0f * (i * M_PIf)) / 15.0f) + sp9C, MTXMODE_NEW); Matrix_MultVecZ((10 - this->unk_0146[0]) * (sGiantModeScaleFactor * 300.0f) * 0.1f, &sp90); spD0.x = this->unk_0170.x + sp90.x; spD0.y = this->unk_0170.y + (1000.0f * sGiantModeScaleFactor); @@ -1404,7 +1404,7 @@ void Boss02_Twinmold_Draw(Actor* thisx, PlayState* play2) { sp98 = 3100.0f; } - sp9C = this->unk_0152 * (M_PI / 4) * (1.0f / 15); + sp9C = this->unk_0152 * (M_PIf / 4) * (1.0f / 15); if (this->unk_0144 < 20) { spAC = Math_SinS(this->unk_014C * 0x2200) * sp9C * 0.5f; spA8 = Math_CosS(this->unk_014C * 0x3200) * sp9C; @@ -1450,8 +1450,8 @@ void Boss02_Twinmold_Draw(Actor* thisx, PlayState* play2) { Matrix_RotateXFApply(spA4 - this->unk_0B1C[phi_v0].x); Matrix_RotateZF(this->unk_0B1C[phi_v0].z, MTXMODE_APPLY); Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); - Matrix_RotateYF(M_PI / 2, MTXMODE_APPLY); - Matrix_RotateXFApply(-(M_PI / 2)); + Matrix_RotateYF(M_PIf / 2, MTXMODE_APPLY); + Matrix_RotateXFApply(-(M_PIf / 2)); Matrix_ToMtx(mtx); gSPMatrix(POLY_OPA_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_Boss_03/z_boss_03.c b/src/overlays/actors/ovl_Boss_03/z_boss_03.c index b5713d965f..0d79182ba4 100644 --- a/src/overlays/actors/ovl_Boss_03/z_boss_03.c +++ b/src/overlays/actors/ovl_Boss_03/z_boss_03.c @@ -161,7 +161,7 @@ void Boss03_SpawnEffectDroplet(PlayState* play, Vec3f* pos) { eff->accel.y = -2.0f; eff->unk_34.x = 0.1f; eff->unk_34.y = 0.0f; - eff->unk_34.z = Rand_ZeroFloat(2 * M_PI); + eff->unk_34.z = Rand_ZeroFloat(2 * M_PIf); eff->unk_02 = Rand_ZeroFloat(100.0f); eff->velocity.x = Rand_CenteredFloat(25.0f); eff->velocity.z = Rand_CenteredFloat(25.0f); @@ -187,7 +187,7 @@ void Boss03_SpawnEffectSplash(PlayState* play, Vec3f* pos, Vec3f* velocity) { temp_f2 = Rand_ZeroFloat(0.02f) + 0.02f; eff->unk_34.y = temp_f2; eff->unk_34.x = temp_f2; - eff->unk_34.z = Rand_ZeroFloat(2 * M_PI); + eff->unk_34.z = Rand_ZeroFloat(2 * M_PIf); eff->unk_02 = Rand_ZeroFloat(100.0f); return; } @@ -489,7 +489,7 @@ void Boss03_Init(Actor* thisx, PlayState* play2) { f32 rand; rand = Boss03_RandZeroOne(); - Matrix_RotateYF((rand * M_PI * 0.2f) + ((2.0f * M_PI / 5.0f) * i), MTXMODE_NEW); + Matrix_RotateYF((rand * M_PIf * 0.2f) + ((2 * M_PIf / 5) * i), MTXMODE_NEW); rand = Boss03_RandZeroOne(); Matrix_MultVecZ((rand * 800.0f) + 400.0f, &sp70); @@ -584,7 +584,7 @@ void func_809E34B8(Boss03* this, PlayState* play) { Math_ApproachS(&this->unk_274, this->unk_276, 1, 0x100); Math_ApproachF(&this->actor.speed, this->unk_278, 1.0f, this->unk_27C); - Math_ApproachF(&this->unk_260, sinf(this->skelAnime.curFrame * (M_PI / 5.0f)) * 10.0f * 0.01f, 0.5f, 1.0f); + Math_ApproachF(&this->unk_260, sinf(this->skelAnime.curFrame * (M_PIf / 5)) * 10.0f * 0.01f, 0.5f, 1.0f); if ((this->workTimer[WORK_TIMER_UNK2_A] == 0) && (this->actor.bgCheckFlags & BGCHECKFLAG_WALL)) { Matrix_MultVecZ(-500.0f, &this->unk_268); @@ -672,7 +672,7 @@ void Boss03_ChasePlayer(Boss03* this, PlayState* play) { Math_ApproachS(&this->unk_274, this->unk_276, 1, 0x100); Math_ApproachF(&this->actor.speed, this->unk_278, 1.0f, this->unk_27C); - Math_ApproachF(&this->unk_260, sinf(this->skelAnime.curFrame * (M_PI / 5.0f)) * 10.0f * 0.01f, 0.5f, 1.0f); + Math_ApproachF(&this->unk_260, sinf(this->skelAnime.curFrame * (M_PIf / 5)) * 10.0f * 0.01f, 0.5f, 1.0f); Actor_MoveWithoutGravityReverse(&this->actor); Math_ApproachS(&this->actor.shape.rot.x, this->actor.world.rot.x, 2, this->unk_274 * 2); @@ -769,7 +769,7 @@ void Boss03_CatchPlayer(Boss03* this, PlayState* play) { 5, 0x100); Math_ApproachS(&this->unk_274, this->unk_276, 1, 0x100); Math_ApproachF(&this->actor.speed, this->unk_278, 1.0f, this->unk_27C); - Math_ApproachF(&this->unk_260, sinf(this->skelAnime.curFrame * (M_PI / 5.0f)) * 10.0f * 0.01f, 0.5f, 1.0f); + Math_ApproachF(&this->unk_260, sinf(this->skelAnime.curFrame * (M_PIf / 5)) * 10.0f * 0.01f, 0.5f, 1.0f); Actor_MoveWithoutGravityReverse(&this->actor); Math_ApproachS(&this->actor.shape.rot.x, this->actor.world.rot.x, 2, this->unk_274 * 2); Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 2, this->unk_274 * 2); @@ -873,7 +873,7 @@ void Boss03_ChewPlayer(Boss03* this, PlayState* play) { -0.5f, 5, 0x100); Math_ApproachS(&this->unk_274, this->unk_276, 1, 0x100); - Math_ApproachF(&this->unk_260, sinf(this->skelAnime.curFrame * (M_PI / 5.0f)) * 10.0f * 0.01f, 0.5f, 1.0f); + Math_ApproachF(&this->unk_260, sinf(this->skelAnime.curFrame * (M_PIf / 5)) * 10.0f * 0.01f, 0.5f, 1.0f); switch (this->unk_242) { case 0: @@ -1037,7 +1037,7 @@ void Boss03_Charge(Boss03* this, PlayState* play) { this->actor.shape.rot = this->actor.world.rot; Math_ApproachF(&this->actor.speed, 25.0f, 1.0f, 3.0f); - Math_ApproachF(&this->unk_260, sinf(this->skelAnime.curFrame * (M_PI / 5.0f)) * 10.0f * 0.01f, 0.5f, 1.0f); + Math_ApproachF(&this->unk_260, sinf(this->skelAnime.curFrame * (M_PIf / 5)) * 10.0f * 0.01f, 0.5f, 1.0f); Actor_MoveWithoutGravityReverse(&this->actor); if (this->actor.speed >= 20.0f) { @@ -2140,7 +2140,7 @@ void Boss03_Update(Actor* thisx, PlayState* play2) { i++; } - yRot += ((2.0f * M_PI) / 50.0f); + yRot += ((2.0f * M_PIf) / 50.0f); if (j >= 50) { break; } @@ -2360,7 +2360,7 @@ void Boss03_UpdateEffects(PlayState* play) { eff->alphaDelta = Rand_ZeroFloat(4.0f) + 5.0f; for (j = 0; j < 4; j++) { - Matrix_RotateYF((2.0f * (j * M_PI)) / 6.0f, MTXMODE_NEW); + Matrix_RotateYF((2.0f * (j * M_PIf)) / 6.0f, MTXMODE_NEW); sp94.x = 0.0f; sp94.y = Rand_ZeroFloat(4.0f) + 2.0f; sp94.z = Rand_ZeroFloat(1.5f) + 1.5f; diff --git a/src/overlays/actors/ovl_Boss_06/z_boss_06.c b/src/overlays/actors/ovl_Boss_06/z_boss_06.c index 8065b220cd..17f14096a2 100644 --- a/src/overlays/actors/ovl_Boss_06/z_boss_06.c +++ b/src/overlays/actors/ovl_Boss_06/z_boss_06.c @@ -465,10 +465,10 @@ void Boss06_Update(Actor* thisx, PlayState* play) { temp_f22 = (((sinf(phi_f24) * this->unk_1D4) + 1.0f) * ((sinf(phi_f26) * this->unk_1D0) + this->unk_1D0)) + this->unk_1CC; - phi_f26 += (M_PI / 64); + phi_f26 += (M_PIf / 64); phi_f24 += 0.030679617f; - Matrix_RotateZF(i * (M_PI / 512), MTXMODE_NEW); + Matrix_RotateZF(i * (M_PIf / 512), MTXMODE_NEW); Matrix_MultVecY(temp_f22, &sp7C); sp7C.x += 32.0f + this->unk_1BC; @@ -612,10 +612,10 @@ void Boss06_Draw(Actor* thisx, PlayState* play2) { Matrix_Translate((D_809F4370[i].x - 32.0f) * -2.4f, (D_809F4370[i].y - 32.0f) * -2.4f, 0.0f, MTXMODE_APPLY); - Matrix_RotateZF(i * (M_PI / 64), MTXMODE_APPLY); + Matrix_RotateZF(i * (M_PIf / 64), MTXMODE_APPLY); if (func_809F2140() < 0.5f) { - Matrix_RotateYF(M_PI, MTXMODE_APPLY); + Matrix_RotateYF(M_PIf, MTXMODE_APPLY); } Matrix_Scale(-0.02f / 10.0f, -this->unk_1D8, 1.0f, MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c index 76bcfb1103..d82cdbf1c9 100644 --- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c +++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c @@ -684,7 +684,7 @@ void BossHakugin_StepVector(Vec3f* norm, Vec3f* targetNorm, f32 angleStep) { maxAngle = 0.0f; } else { // Either the dot product is exactly -1.0f, or a non-unit vector was passed into this function. - maxAngle = M_PI; + maxAngle = M_PIf; } angleStep = CLAMP_MAX(angleStep, maxAngle); @@ -2390,7 +2390,7 @@ void BossHakugin_DeathCutsceneRun(BossHakugin* this, PlayState* play) { Math_SmoothStepToS(&this->actor.home.rot.y, this->baseRotY, 5, 0x800, 0x100); this->timer--; this->actor.shape.rot.y = - (s32)(Math_SinF(this->timer * (M_PI / 18.0f)) * this->runOffsetRot) + this->actor.home.rot.y; + (s32)(Math_SinF(this->timer * (M_PIf / 18.0f)) * this->runOffsetRot) + this->actor.home.rot.y; if (this->timer == 0) { if (this->runOffsetRot > 0) { @@ -2403,10 +2403,10 @@ void BossHakugin_DeathCutsceneRun(BossHakugin* this, PlayState* play) { this->deathCutsceneRandomHeadRot = Rand_ZeroFloat(6144.0f); } - this->headRot.z = (8192.0f * Math_SinS(this->deathCutsceneRandomHeadRot)) * Math_SinF(this->timer * (M_PI / 9)); - this->headRot.y = (8192.0f * Math_CosS(this->deathCutsceneRandomHeadRot)) * Math_SinF(this->timer * (M_PI / 9)); + this->headRot.z = (8192.0f * Math_SinS(this->deathCutsceneRandomHeadRot)) * Math_SinF(this->timer * (M_PIf / 9)); + this->headRot.y = (8192.0f * Math_CosS(this->deathCutsceneRandomHeadRot)) * Math_SinF(this->timer * (M_PIf / 9)); - this->actor.shape.rot.z = Math_SinF(this->timer * (M_PI / 18)) * -(this->runOffsetRot * 0.3f); + this->actor.shape.rot.z = Math_SinF(this->timer * (M_PIf / 18)) * -(this->runOffsetRot * 0.3f); this->actor.world.rot.y = this->actor.shape.rot.y; subCamAt.x = (Math_SinS(this->actor.shape.rot.y) * 100.0f) + this->actor.world.pos.x; @@ -2910,7 +2910,7 @@ void BossHakugin_UpdateElectricBalls(BossHakugin* this, PlayState* play) { } else if (this->electricBallState == GOHT_ELECTRIC_BALL_STATE_FLY_TOWARDS_PLAYER) { angleStep = BINANG_TO_RAD(Math3D_Vec3fDistSq(firstBallPos, &player->actor.world.pos) * (1.0f / SQ(120.0f)) * 32.0f); - angleStep = CLAMP_MAX(angleStep, M_PI / 4.0f); + angleStep = CLAMP_MAX(angleStep, M_PIf / 4.0f); Math_Vec3f_Diff(&player->actor.world.pos, firstBallPos, &targetRot); diff --git a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c index 173a3349f3..f83cdfa088 100644 --- a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c +++ b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c @@ -97,7 +97,7 @@ void DemoKakyo_LostWoodsSparkleActionFunc(DemoKankyo* this, PlayState* play) { this->effects[i].scale = 0.1f; // speedClock is angles in radians, - // should have used Rand_ZeroOne() * 2 * M_PI + // should have used Rand_ZeroOne() * 2 * M_PIf // however, due to properties of sine waves, this is effectively still random this->effects[i].speedClock.x = Rand_ZeroOne() * 360.0f; this->effects[i].speedClock.y = Rand_ZeroOne() * 360.0f; @@ -335,7 +335,7 @@ void DemoKakyo_MoonSparklesActionFunc(DemoKankyo* this, PlayState* play) { this->effects[i].scale = 0.2f; // speedClock is angles in radians, - // should have used Rand_ZeroOne() * 2 * M_PI + // should have used Rand_ZeroOne() * 2 * M_PIf // however, due to properties of sine waves, this is effectively still random this->effects[i].speedClock.x = Rand_ZeroOne() * 360.0f; this->effects[i].speedClock.y = Rand_ZeroOne() * 360.0f; diff --git a/src/overlays/actors/ovl_Dm_Hina/z_dm_hina.c b/src/overlays/actors/ovl_Dm_Hina/z_dm_hina.c index 15980f11cc..91b1e1d826 100644 --- a/src/overlays/actors/ovl_Dm_Hina/z_dm_hina.c +++ b/src/overlays/actors/ovl_Dm_Hina/z_dm_hina.c @@ -150,7 +150,7 @@ void func_80A1F9AC(DmHina* this, PlayState* play) { this->actor.world.pos.z, MTXMODE_NEW); Matrix_ReplaceRotation(&play->billboardMtxF); Matrix_Scale(this->unk14C * 20.0f, this->unk14C * 20.0f, this->unk14C * 20.0f, MTXMODE_APPLY); - Matrix_RotateZF(Rand_ZeroFloat(2 * M_PI), MTXMODE_APPLY); + Matrix_RotateZF(Rand_ZeroFloat(2 * M_PIf), MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gLightOrbModelDL); diff --git a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c index 536f1f36e2..4cf3b0bae5 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c @@ -708,10 +708,10 @@ void DoorShutter_Draw(Actor* thisx, PlayState* play) { Math_Vec3f_Yaw(&play->view.eye, &this->slidingDoor.dyna.actor.world.pos); if (ABS_ALT(yaw) < 0x4000) { - Matrix_RotateYF(M_PI, MTXMODE_APPLY); + Matrix_RotateYF(M_PIf, MTXMODE_APPLY); } } else if (this->slidingDoor.dyna.actor.room == transitionEntry->sides[0].room) { - Matrix_RotateYF(M_PI, MTXMODE_APPLY); + Matrix_RotateYF(M_PIf, MTXMODE_APPLY); } } else if (this->doorType == 5) { gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_808A22DC[this->slidingDoor.unk_15E])); diff --git a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c index c3c0abf4a8..c130d5c6ae 100644 --- a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c +++ b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c @@ -604,7 +604,7 @@ s32 EnBigokuta_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec MTXMODE_APPLY); } } else if (this->actionFunc == EnBigokuta_SuckInPlayer) { - f32 sin = Math_SinF(this->timer * (M_PI / 3.0f)) * 0.5f; + f32 sin = Math_SinF(this->timer * (M_PIf / 3)) * 0.5f; Matrix_Scale(((this->timer * (2 / 90.0f)) * (0.5f + sin)) + 1.0f, ((this->timer * (2 / 90.0f)) * (0.5f - sin)) + 1.0f, 1.0f - ((this->timer * 0.3f) / 9.0f), @@ -613,7 +613,7 @@ s32 EnBigokuta_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec if (this->timer == 0) { Matrix_Scale(0.9f, 0.9f, 1.15f, MTXMODE_APPLY); } else if (this->timer > 0) { - f32 sin = Math_SinF(this->timer * (M_PI / 3.0f)) * 0.5f; + f32 sin = Math_SinF(this->timer * (M_PIf / 3)) * 0.5f; Matrix_Scale(((0.5f + sin) * 0.2f) + 1.0f, ((0.5f - sin) * 0.2f) + 1.0f, 0.7f, MTXMODE_APPLY); } else { diff --git a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c index 5c33e6eb1a..14032e5920 100644 --- a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c +++ b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c @@ -562,7 +562,7 @@ void EnBigpo_IdleFlying(EnBigpo* this, PlayState* play) { // flight position calculations this->hoverHeightCycleTimer = (this->hoverHeightCycleTimer == 0) ? 40 : (this->hoverHeightCycleTimer - 1); Math_StepToF(&this->savedHeight, player->actor.world.pos.y + 100.0f, 1.5f); - this->actor.world.pos.y = (Math_SinF(this->hoverHeightCycleTimer * (M_PI / 20)) * 10.0f) + this->savedHeight; + this->actor.world.pos.y = (Math_SinF(this->hoverHeightCycleTimer * (M_PIf / 20)) * 10.0f) + this->savedHeight; Math_StepToF(&this->actor.speed, 3.0f, 0.2f); Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_PO_FLY - SFX_FLAG); if (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) > 300.0f) { @@ -834,7 +834,7 @@ void EnBigpo_ScoopSoulIdle(EnBigpo* this, PlayState* play) { EnBigpo_SetupScoopSoulLeaving(this); } else { Actor_OfferGetItem(&this->actor, play, GI_MAX, 35.0f, 60.0f); - this->actor.world.pos.y = (Math_SinF(this->idleTimer * (M_PI / 20)) * 5.0f) + this->savedHeight; + this->actor.world.pos.y = (Math_SinF(this->idleTimer * (M_PIf / 20)) * 5.0f) + this->savedHeight; } } diff --git a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c index ab42afa14c..2fe58764f9 100644 --- a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c +++ b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c @@ -658,7 +658,7 @@ void EnBigslime_AddWavySurface(EnBigslime* this) { randFloat = (Rand_ZeroOne() * 40.0f) + 50.0f; } - this->vtxSurfacePerturbation[i] = Math_SinF((randInt + i) * (M_PI / 3)) * randFloat * 0.001f; + this->vtxSurfacePerturbation[i] = Math_SinF((randInt + i) * (M_PIf / 3)) * randFloat * 0.001f; } } @@ -674,7 +674,7 @@ void EnBigslime_UpdateWavySurface(EnBigslime* this) { } this->wavySurfaceTimer--; - vtxSurfaceWave = Math_SinF(this->wavySurfaceTimer * (M_PI / 12)); + vtxSurfaceWave = Math_SinF(this->wavySurfaceTimer * (M_PIf / 12)); for (i = 0; i < BIGSLIME_NUM_VTX; i++) { staticVtx = &sBigslimeStaticVtx[i]; dynamicVtx = &sBigslimeDynamicVtx[this->dynamicVtxState][i]; @@ -1170,7 +1170,7 @@ void EnBigslime_SetTargetVtxToWideCone(EnBigslime* this) { s32 j; for (i = 0; i < BIGSLIME_NUM_RING_FACES / 2; i++) { - vtxY = (((Math_CosF(i * (M_PI / 6)) + 1.0f) * 0.925f) + -0.85f) * BIGSLIME_RADIUS_F; + vtxY = (((Math_CosF(i * (M_PIf / 6)) + 1.0f) * 0.925f) + -0.85f) * BIGSLIME_RADIUS_F; for (j = sVtxRingStartIndex[i]; j < sVtxRingStartIndex[i + 1]; j++) { staticVtx = &sBigslimeStaticVtx[j]; targetVtx = &sBigslimeTargetVtx[j]; @@ -1189,7 +1189,7 @@ void EnBigslime_SetTargetVtxToWideCone(EnBigslime* this) { } for (; i < BIGSLIME_NUM_RING_VTX; i++) { - vtxY = ((Math_CosF((i - BIGSLIME_NUM_RING_FACES / 2) * (M_PI / 16)) * 0.05f) + -1.0f) * BIGSLIME_RADIUS_F; + vtxY = ((Math_CosF((i - BIGSLIME_NUM_RING_FACES / 2) * (M_PIf / 16)) * 0.05f) + -1.0f) * BIGSLIME_RADIUS_F; for (j = sVtxRingStartIndex[i]; j < sVtxRingStartIndex[i + 1]; j++) { staticVtx = &sBigslimeStaticVtx[j]; targetVtx = &sBigslimeTargetVtx[j]; @@ -1302,7 +1302,7 @@ void EnBigslime_SetTargetVtxToThinCone(EnBigslime* this) { sBigslimeTargetVtx[0].n.ob[2] = 0; for (i = 1; i < BIGSLIME_NUM_RING_FACES / 2; i++) { - upperSphereCos = (((Math_CosF((i - 1) * (M_PI / 5)) + 1.0f) * 0.925f) + -0.85f) * BIGSLIME_RADIUS_F; + upperSphereCos = (((Math_CosF((i - 1) * (M_PIf / 5)) + 1.0f) * 0.925f) + -0.85f) * BIGSLIME_RADIUS_F; for (j = sVtxRingStartIndex[i]; j < sVtxRingStartIndex[i + 1]; j++) { staticVtx = &sBigslimeStaticVtx[j]; targetVtx = &sBigslimeTargetVtx[j]; @@ -1319,7 +1319,7 @@ void EnBigslime_SetTargetVtxToThinCone(EnBigslime* this) { } for (; i < BIGSLIME_NUM_RING_FACES; i++) { - lowerSphereCos = Math_CosF((i - BIGSLIME_NUM_RING_FACES / 2) * (M_PI / BIGSLIME_NUM_RING_FACES)); + lowerSphereCos = Math_CosF((i - BIGSLIME_NUM_RING_FACES / 2) * (M_PIf / BIGSLIME_NUM_RING_FACES)); for (j = sVtxRingStartIndex[i]; j < sVtxRingStartIndex[i + 1]; j++) { staticVtx = &sBigslimeStaticVtx[j]; targetVtx = &sBigslimeTargetVtx[j]; @@ -1362,7 +1362,7 @@ void EnBigslime_SetTargetVtxToInverseCone(EnBigslime* this) { sBigslimeTargetVtx[0].n.ob[2] = 0; for (i = 1; i < BIGSLIME_NUM_RING_FACES / 2; i++) { - upperSphereCos = Math_CosF((i - 1) * (M_PI / 10)); + upperSphereCos = Math_CosF((i - 1) * (M_PIf / 10)); for (j = sVtxRingStartIndex[i]; j < sVtxRingStartIndex[i + 1]; j++) { staticVtx = &sBigslimeStaticVtx[j]; targetVtx = &sBigslimeTargetVtx[j]; @@ -1375,7 +1375,7 @@ void EnBigslime_SetTargetVtxToInverseCone(EnBigslime* this) { for (; i < BIGSLIME_NUM_RING_FACES; i++) { lowerSphereCos = - (((Math_CosF((i - BIGSLIME_NUM_RING_FACES / 2) * (M_PI / 5)) + 1) * 0.925f) + -1.0f) * BIGSLIME_RADIUS_F; + (((Math_CosF((i - BIGSLIME_NUM_RING_FACES / 2) * (M_PIf / 5)) + 1) * 0.925f) + -1.0f) * BIGSLIME_RADIUS_F; for (j = sVtxRingStartIndex[i]; j < sVtxRingStartIndex[i + 1]; j++) { staticVtx = &sBigslimeStaticVtx[j]; targetVtx = &sBigslimeTargetVtx[j]; @@ -1646,7 +1646,7 @@ void EnBigslime_AttackPlayerInBigslime(EnBigslime* this, PlayState* play) { * This unit vector has the following spherical coordinates: * - radius = 1 * - yaw (azimuthal angle) = this->actor.world.rot.y - * - pitch (polar/zenith angle) = M_PI / 4 + * - pitch (polar/zenith angle) = M_PIf / 4 * * This unit normal vector is converted into x-y-z coordinates and dot-producted with * the model coordinates of each individual vertex. The surface perturbation is then @@ -1657,15 +1657,15 @@ void EnBigslime_AttackPlayerInBigslime(EnBigslime* this, PlayState* play) { void EnBigslime_SetupWindupThrowPlayer(EnBigslime* this) { Vtx* dynamicVtx; f32 dotXYZ; - f32 unitVecX = Math_SinS(this->actor.world.rot.y) * M_SQRT1_2; - f32 unitVecZ = Math_CosS(this->actor.world.rot.y) * M_SQRT1_2; + f32 unitVecX = Math_SinS(this->actor.world.rot.y) * M_SQRT1_2f; + f32 unitVecZ = Math_CosS(this->actor.world.rot.y) * M_SQRT1_2f; s32 i; for (i = 0; i < BIGSLIME_NUM_VTX; i++) { dynamicVtx = &sBigslimeDynamicVtx[this->dynamicVtxState][i]; // vector dot product between each dynamicVtx and the unit normal vector describing player's thrown direction - dotXYZ = (dynamicVtx->n.ob[0] * unitVecX + dynamicVtx->n.ob[1] * M_SQRT1_2 + dynamicVtx->n.ob[2] * unitVecZ) * + dotXYZ = (dynamicVtx->n.ob[0] * unitVecX + dynamicVtx->n.ob[1] * M_SQRT1_2f + dynamicVtx->n.ob[2] * unitVecZ) * 0.001f; if (dotXYZ < 0.01f) { this->vtxSurfacePerturbation[i] = 0.0f; @@ -1693,7 +1693,7 @@ void EnBigslime_WindupThrowPlayer(EnBigslime* this, PlayState* play) { EnBigslime_UpdateCameraGrabPlayer(this, play); if (this->windupPunchTimer > 0) { invWindupPunchTimer = 1.0f / this->windupPunchTimer; - scale = Math_CosF(this->windupPunchTimer * (M_PI / 27)) + 1.0f; + scale = Math_CosF(this->windupPunchTimer * (M_PIf / 27)) + 1.0f; player->actor.world.pos.y = this->actor.world.pos.y + (this->actor.scale.y * -500.0f); // Linearly interpolate gekkoRot.y --> this->actor.world.rot.y @@ -1706,7 +1706,7 @@ void EnBigslime_WindupThrowPlayer(EnBigslime* this, PlayState* play) { EnBigslime_GekkoSfxInsideBigslime(this, NA_SE_EN_FROG_PUNCH1); } - scale = 0.5f - Math_CosF(-this->windupPunchTimer * (M_PI / 5)) * 0.5f; + scale = 0.5f - Math_CosF(-this->windupPunchTimer * (M_PIf / 5)) * 0.5f; if (this->windupPunchTimer == -5) { if (player->stateFlags2 & PLAYER_STATE2_80) { player->actor.parent = NULL; @@ -2467,7 +2467,7 @@ void EnBigslime_FrogSpawn(EnBigslime* this, PlayState* play) { // Zoom the camera in and out at the newly spawned red frog subCamZoom = - Math_SinF(this->spawnFrogTimer * (M_PI / 5)) * ((0.04f * (this->spawnFrogTimer * 0.1f)) + 0.02f) + 1.0f; + Math_SinF(this->spawnFrogTimer * (M_PIf / 5)) * ((0.04f * (this->spawnFrogTimer * 0.1f)) + 0.02f) + 1.0f; subCamEye.x = subCam->at.x + (this->subCamDistToFrog.x * subCamZoom); subCamEye.z = subCam->at.z + (this->subCamDistToFrog.z * subCamZoom); subCamEye.y = subCam->at.y + (this->subCamDistToFrog.y * subCamZoom); diff --git a/src/overlays/actors/ovl_En_Bom/z_en_bom.c b/src/overlays/actors/ovl_En_Bom/z_en_bom.c index 7efbb41186..87ddad48fe 100644 --- a/src/overlays/actors/ovl_En_Bom/z_en_bom.c +++ b/src/overlays/actors/ovl_En_Bom/z_en_bom.c @@ -386,10 +386,10 @@ void EnBom_Explode(EnBom* this, PlayState* play) { } if ((this->timer & 1) == 0) { - spCC = Rand_ZeroFloat(M_PI); + spCC = Rand_ZeroFloat(M_PIf); for (i = 0; i < 15; i++) { - Matrix_RotateYF(((2.0f * (i * M_PI)) / 15.0f) + spCC, MTXMODE_NEW); + Matrix_RotateYF(((2.0f * (i * M_PIf)) / 15.0f) + spCC, MTXMODE_NEW); Matrix_MultVecZ((10 - this->timer) * 300.0f * 0.1f, &spC0); spB4.x = this->actor.world.pos.x + spC0.x; spB4.y = this->actor.world.pos.y + 500.0f; diff --git a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c index 15bf3a10c0..89a54d5946 100644 --- a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c +++ b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c @@ -131,8 +131,8 @@ void EnClearTag_CreateDebrisEffect(EnClearTag* this, Vec3f* pos, Vec3f* velocity effect->scale = scale; // Set the debris effects to spawn in a circle. - effect->rotationY = Rand_ZeroFloat(M_PI * 2); - effect->rotationX = Rand_ZeroFloat(M_PI * 2); + effect->rotationY = Rand_ZeroFloat(M_PIf * 2); + effect->rotationX = Rand_ZeroFloat(M_PIf * 2); effect->effectsTimer = effect->bounces = 0; @@ -439,8 +439,8 @@ void EnClearTag_Init(Actor* thisx, PlayState* play) { for (i = 0; i < 54; i++) { lightRayMaxScale = sLightRayMaxScale[thisx->params] + Rand_ZeroFloat(sLightRayMaxScale[thisx->params]); - Matrix_RotateYF(Rand_ZeroFloat(M_PI * 2), MTXMODE_NEW); - Matrix_RotateXFApply(Rand_ZeroFloat(M_PI * 2)); + Matrix_RotateYF(Rand_ZeroFloat(M_PIf * 2), MTXMODE_NEW); + Matrix_RotateXFApply(Rand_ZeroFloat(M_PIf * 2)); Matrix_MultVecZ(lightRayMaxScale, &velocity); accel.x = velocity.x * -0.03f; accel.y = velocity.y * -0.03f; @@ -512,8 +512,8 @@ void EnClearTag_Init(Actor* thisx, PlayState* play) { pos = this->actor.world.pos; for (i = 0; i < 44; i++) { lightRayMaxScale = sLightRayMaxScale[thisx->params] + Rand_ZeroFloat(sLightRayMaxScale[thisx->params]); - Matrix_RotateYF(Rand_ZeroFloat(2 * M_PI), MTXMODE_NEW); - Matrix_RotateXFApply(Rand_ZeroFloat(2 * M_PI)); + Matrix_RotateYF(Rand_ZeroFloat(2 * M_PIf), MTXMODE_NEW); + Matrix_RotateXFApply(Rand_ZeroFloat(2 * M_PIf)); Matrix_MultVecZ(lightRayMaxScale, &velocity); accel.x = velocity.x * -0.03f; accel.y = velocity.y * -0.03f; @@ -750,7 +750,7 @@ void EnClearTag_UpdateEffects(EnClearTag* this, PlayState* play) { } } else if (effect->type == CLEAR_TAG_EFFECT_LIGHT_RAYS) { // Rotate the light ray effect. - effect->rotationZ += Rand_ZeroFloat(M_PI / 2) + (M_PI / 2); + effect->rotationZ += Rand_ZeroFloat(M_PIf / 2) + (M_PIf / 2); // Fade the light ray effects. effect->lightRayAlpha -= effect->lightRayAlphaDecrementSpeed; @@ -968,7 +968,7 @@ void EnClearTag_DrawEffects(Actor* thisx, PlayState* play) { Matrix_RotateXFApply(effect->rotationX); Matrix_RotateZF(effect->rotationZ, MTXMODE_APPLY); Matrix_Scale(effect->scale * 0.5f, effect->scale * 0.5f, effect->maxScale * effect->scale, MTXMODE_APPLY); - Matrix_RotateXFApply(M_PI / 2); + Matrix_RotateXFApply(M_PIf / 2); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gClearTagLightRayEffectDL); } @@ -988,7 +988,7 @@ void EnClearTag_DrawEffects(Actor* thisx, PlayState* play) { // Apply material 16 times along a circle to give the appearance of a splash for (j = 0; j < 16; j++) { - Matrix_RotateYF(2.0f * (j * M_PI) * (1.0f / 16.0f), MTXMODE_NEW); + Matrix_RotateYF(2.0f * (j * M_PIf) * (1.0f / 16.0f), MTXMODE_NEW); Matrix_MultVecZ(effect->maxScale, &vec); /** * Get the water surface at point (`x`, `ySurface`, `z`). `ySurface` doubles as position y input @@ -1001,7 +1001,7 @@ void EnClearTag_DrawEffects(Actor* thisx, PlayState* play) { if ((effect->pos.y - ySurface) < 200.0f) { // Draw the splash effect. Matrix_Translate(effect->pos.x + vec.x, ySurface, effect->pos.z + vec.z, MTXMODE_NEW); - Matrix_RotateYF(2.0f * (j * M_PI) * (1.0f / 16.0f), MTXMODE_APPLY); + Matrix_RotateYF(2.0f * (j * M_PIf) * (1.0f / 16.0f), MTXMODE_APPLY); Matrix_RotateXFApply(effect->rotationX); Matrix_Scale(effect->scale, effect->scale, effect->scale, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_En_Crow/z_en_crow.c b/src/overlays/actors/ovl_En_Crow/z_en_crow.c index 6c61680cd3..17cc554b02 100644 --- a/src/overlays/actors/ovl_En_Crow/z_en_crow.c +++ b/src/overlays/actors/ovl_En_Crow/z_en_crow.c @@ -549,9 +549,9 @@ s32 EnCrow_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* if (this->actor.colChkInfo.health != 0) { if (limbIndex == OBJECT_CROW_LIMB_UPPER_TAIL) { - rot->y += TRUNCF_BINANG(0xC00 * Math_SinF(this->skelAnime.curFrame * (M_PI / 4))); + rot->y += TRUNCF_BINANG(0xC00 * Math_SinF(this->skelAnime.curFrame * (M_PIf / 4))); } else if (limbIndex == OBJECT_CROW_LIMB_TAIL) { - rot->y += TRUNCF_BINANG(0x1400 * Math_SinF((this->skelAnime.curFrame + 2.5f) * (M_PI / 4))); + rot->y += TRUNCF_BINANG(0x1400 * Math_SinF((this->skelAnime.curFrame + 2.5f) * (M_PIf / 4))); } } return false; diff --git a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c index 41ef4302ec..ec2bafa5f2 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c @@ -385,7 +385,7 @@ void EnDekubaba_Grow(EnDekubaba* this, PlayState* play) { this->size * 0.01f * (0.5f + (15 - this->timer) * 0.5f / 15.0f); Math_ScaledStepToS(&this->actor.shape.rot.x, 0x1800, 0x800); - headDistVertical = Math_SinF(CLAMP_MAX((15 - this->timer) * (1.0f / 15), 0.7f) * M_PI) * 32.0f + 14.0f; + headDistVertical = Math_SinF(CLAMP_MAX((15 - this->timer) * (1.0f / 15), 0.7f) * M_PIf) * 32.0f + 14.0f; if (this->actor.shape.rot.x < -0x38E3) { headDistHorizontal = 0.0f; @@ -469,7 +469,7 @@ void EnDekubaba_Retract(EnDekubaba* this, PlayState* play) { this->size * 0.01f * (0.5f + this->timer * (1.0f / 30)); Math_ScaledStepToS(&this->actor.shape.rot.x, -0x4000, 0x300); - headDistVertical = (Math_SinF(CLAMP_MAX(this->timer * 0.033f, 0.7f) * M_PI) * 32.0f) + 14.0f; + headDistVertical = (Math_SinF(CLAMP_MAX(this->timer * 0.033f, 0.7f) * M_PIf) * 32.0f) + 14.0f; if (this->actor.shape.rot.x < -0x38E3) { headDistHorizontal = 0.0f; diff --git a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c index 7f7ff014f4..07ca0ebbef 100644 --- a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c +++ b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c @@ -1109,7 +1109,7 @@ void func_8089CBEC(EnDinofos* this, PlayState* play) { for (i = 6; i < end; i++) { dim = &this->colliderJntSph.elements[i].dim; - temp_s3 = (s32)(Math_CosF((this->unk_290 + ((i - 5) << 1)) * (M_PI / 20)) * 0x2C00) + this->actor.shape.rot.y; + temp_s3 = (s32)(Math_CosF((this->unk_290 + ((i - 5) << 1)) * (M_PIf / 20)) * 0x2C00) + this->actor.shape.rot.y; dim->worldSphere.center.x = (s32)this->bodyPartsPos[DINOFOS_BODYPART_JAW].x + (s32)(Math_SinS(temp_s3) * dim->modelSphere.center.z); @@ -1245,9 +1245,9 @@ void func_8089D42C(EnDinofos* this, PlayState* play) { if ((this->actionFunc == func_8089B834) && (this->unk_290 != 0)) { Math_ScaledStepToS(&this->unk_28E, Math_SinS(this->unk_290 * 1400) * 0x2C00, 0x300); } else if (this->actionFunc == func_8089CA74) { - Math_ScaledStepToS(&this->unk_28E, Math_CosF(M_PI) * 0x2C00, 0x2C00 / 20); + Math_ScaledStepToS(&this->unk_28E, Math_CosF(M_PIf) * 0x2C00, 0x2C00 / 20); } else if (this->actionFunc == func_8089CBEC) { - this->unk_28E = Math_CosF(this->unk_290 * (M_PI / 20)) * 0x2C00; + this->unk_28E = Math_CosF(this->unk_290 * (M_PIf / 20)) * 0x2C00; } else if (!Play_InCsMode(play)) { temp_v0_2 = this->unk_28E + this->actor.shape.rot.y; temp_v0_2 = BINANG_SUB(this->actor.yawTowardsPlayer, temp_v0_2); diff --git a/src/overlays/actors/ovl_En_Door/z_en_door.c b/src/overlays/actors/ovl_En_Door/z_en_door.c index b395d6e59e..33e922133d 100644 --- a/src/overlays/actors/ovl_En_Door/z_en_door.c +++ b/src/overlays/actors/ovl_En_Door/z_en_door.c @@ -6,7 +6,7 @@ #include "z_en_door.h" -#include "libc/assert.h" +#include "assert.h" #include "objects/object_kinsta2_obj/object_kinsta2_obj.h" #include "objects/object_dor01/object_dor01.h" diff --git a/src/overlays/actors/ovl_En_Egol/z_en_egol.c b/src/overlays/actors/ovl_En_Egol/z_en_egol.c index d912cdfa6c..91ecfafb4c 100644 --- a/src/overlays/actors/ovl_En_Egol/z_en_egol.c +++ b/src/overlays/actors/ovl_En_Egol/z_en_egol.c @@ -788,8 +788,8 @@ void EnEgol_Laser(EnEgol* this, PlayState* play) { /*! @bug The following is supposed to calculate the rotation from vertical to the collision poly normal. * However, the calculation is performed incorrectly. The correct calculation is - * rotToNorm.x = Math_FAtan2F(nz, ny) * 0x8000 / M_PI; - * rotToNorm.z = Math_FAtan2F(-nx, sqrtf(1.0f - SQ(nx))) * 0x8000 / M_PI; + * rotToNorm.x = RAD_TO_BINANG(Math_FAtan2F(nz, ny)); + * rotToNorm.z = RAD_TO_BINANG(Math_FAtan2F(-nx, sqrtf(1.0f - SQ(nx)))); */ rotToNorm.x = RAD_TO_BINANG_ALT2(-Math_FAtan2F(-nz * ny, 1.0f)); rotToNorm.z = RAD_TO_BINANG_ALT2(Math_FAtan2F(-nx * ny, 1.0f)); diff --git a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c index 06bada7026..48f85871c4 100644 --- a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c +++ b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c @@ -750,7 +750,7 @@ void EnFishing_InitPondProps(EnFishing* this, PlayState* play) { if (prop->type == FS_PROP_REED) { prop->scale = (EnFishing_RandZeroOne() * 0.25f) + 0.75f; - prop->reedAngle = Rand_ZeroFloat(2 * M_PI); + prop->reedAngle = Rand_ZeroFloat(2 * M_PIf); if (sLinkAge == 1) { prop->scale *= 0.6f; } @@ -763,7 +763,7 @@ void EnFishing_InitPondProps(EnFishing* this, PlayState* play) { EnFishing_SetColliderElement(i, &sFishingMain->collider, &colliderPos, prop->scale * 3.5f); } else if (prop->type == FS_PROP_LILY_PAD) { prop->scale = (EnFishing_RandZeroOne() * 0.3f) + 0.5f; - prop->rotY = Rand_ZeroFloat(2 * M_PI); + prop->rotY = Rand_ZeroFloat(2 * M_PIf); if (sLinkAge == 1) { if ((i % 4) != 0) { prop->scale *= 0.6f; @@ -773,7 +773,7 @@ void EnFishing_InitPondProps(EnFishing* this, PlayState* play) { } } else { prop->scale = (EnFishing_RandZeroOne() * 0.1f) + 0.3f; - prop->rotY = Rand_ZeroFloat(2 * M_PI); + prop->rotY = Rand_ZeroFloat(2 * M_PIf); prop->drawDistance = 1000.0f; EnFishing_SetColliderElement(i, &sFishingMain->collider, &prop->pos, prop->scale); } @@ -1309,7 +1309,7 @@ void EnFishing_DrawEffects(FishingEffect* effect, PlayState* play) { if (Rand_ZeroOne() < 0.5f) { rotY = 0.0f; } else { - rotY = M_PI; + rotY = M_PIf; } Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); @@ -1332,7 +1332,7 @@ void EnFishing_DrawEffects(FishingEffect* effect, PlayState* play) { Matrix_RotateZF(BINANG_TO_RAD_ALT2(sEffOwnerHatRot.z), MTXMODE_APPLY); Matrix_Scale(effect->unk_30, effect->unk_30, effect->unk_30, MTXMODE_APPLY); Matrix_Translate(-1250.0f, 0.0f, 0.0f, MTXMODE_APPLY); - Matrix_RotateXFApply(M_PI / 2); + Matrix_RotateXFApply(M_PIf / 2); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFishingOwnerHatDL); @@ -1584,12 +1584,12 @@ void EnFishing_DrawLureHook(PlayState* play, Vec3f* pos, Vec3f* refPos, u8 hookI Matrix_RotateYF(sLureHookRotY[hookIndex], MTXMODE_APPLY); Matrix_RotateXFApply(rx); Matrix_Scale(0.0039999997f, 0.0039999997f, 0.005f, MTXMODE_APPLY); - Matrix_RotateYF(M_PI, MTXMODE_APPLY); + Matrix_RotateYF(M_PIf, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFishingLureHookDL); - Matrix_RotateZF(M_PI / 2, MTXMODE_APPLY); + Matrix_RotateZF(M_PIf / 2, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFishingLureHookDL); @@ -1618,7 +1618,7 @@ void EnFishing_DrawLureHook(PlayState* play, Vec3f* pos, Vec3f* refPos, u8 hookI Matrix_Pop(); Matrix_Translate(-1250.0f, 0.0f, 0.0f, MTXMODE_APPLY); - Matrix_RotateXFApply(M_PI / 2); + Matrix_RotateXFApply(M_PIf / 2); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFishingOwnerHatDL); @@ -1784,7 +1784,7 @@ void EnFishing_DrawLureAndLine(PlayState* play, Vec3f* linePos, Vec3f* lineRot) } } else if (D_8090CD14 == 0) { sLurePos = sReelLinePos[LINE_SEG_COUNT - 1]; - sLureRot.x = sReelLineRot[LINE_SEG_COUNT - 2].x + M_PI; + sLureRot.x = sReelLineRot[LINE_SEG_COUNT - 2].x + M_PIf; if ((player->actor.speed == 0.0f) && (D_80917200 == 0)) { Math_ApproachF(&sLureRot.y, sReelLineRot[LINE_SEG_COUNT - 2].y, 0.1f, 0.2f); @@ -1799,8 +1799,8 @@ void EnFishing_DrawLureAndLine(PlayState* play, Vec3f* linePos, Vec3f* lineRot) Matrix_RotateXFApply(sLureRot.x); Matrix_Scale(0.0039999997f, 0.0039999997f, 0.0039999997f, MTXMODE_APPLY); Matrix_Translate(0.0f, 0.0f, D_80917258, MTXMODE_APPLY); - Matrix_RotateZF(M_PI / 2, MTXMODE_APPLY); - Matrix_RotateYF(M_PI / 2, MTXMODE_APPLY); + Matrix_RotateZF(M_PIf / 2, MTXMODE_APPLY); + Matrix_RotateYF(M_PIf / 2, MTXMODE_APPLY); Gfx_SetupDL25_Opa(play->state.gfxCtx); @@ -2008,7 +2008,7 @@ void EnFishing_DrawRod(PlayState* play) { Matrix_RotateXFApply(-0.6283185f); Matrix_RotateZF((player->unk_B08 * 0.5f) + 0.4712389f, MTXMODE_APPLY); - Matrix_RotateXFApply((D_8090CD40 + 20.0f) * 0.01f * M_PI); + Matrix_RotateXFApply((D_8090CD40 + 20.0f) * 0.01f * M_PIf); Matrix_Scale(0.70000005f, 0.70000005f, 0.70000005f, MTXMODE_APPLY); spC0 = (D_8090CD3C * (((player->unk_B0C - 1.0f) * -0.25f) + 0.5f)) + (D_8090CD2C + D_8090CD38); @@ -2160,7 +2160,7 @@ void EnFishing_UpdateLure(EnFishing* this, PlayState* play) { Message_CloseTextbox(play); } } else { - sLureRot.x = sReelLineRot[LINE_SEG_COUNT - 2].x + M_PI; + sLureRot.x = sReelLineRot[LINE_SEG_COUNT - 2].x + M_PIf; sLureRot.y = sReelLineRot[LINE_SEG_COUNT - 2].y; if (D_80917204 == 18) { @@ -2208,11 +2208,11 @@ void EnFishing_UpdateLure(EnFishing* this, PlayState* play) { spD0 = sLurePos.z - sRodTipPos.z; if (D_80917202 != 0) { - sLureRot.x = sReelLineRot[LINE_SEG_COUNT - 2].x + M_PI; + sLureRot.x = sReelLineRot[LINE_SEG_COUNT - 2].x + M_PIf; sLureRot.y = sReelLineRot[LINE_SEG_COUNT - 2].y; } else { sLureRot.x = 0.0f; - sLureRot.y = Math_Atan2F_XY(spD0, spD8) + M_PI; + sLureRot.y = Math_Atan2F_XY(spD0, spD8) + M_PIf; } phi_f16 = sqrtf(SQ(spD8) + SQ(spD4) + SQ(spD0)); @@ -2418,7 +2418,7 @@ void EnFishing_UpdateLure(EnFishing* this, PlayState* play) { s8 requiredScopeTemp; spDC = 0x500; - D_809101B0 = sReelLineRot[LINE_SEG_COUNT - 2].y + M_PI; + D_809101B0 = sReelLineRot[LINE_SEG_COUNT - 2].y + M_PIf; sLureRot.x = 0.0f; D_8091725C = 0.5f; if (D_80917206 == 2) { @@ -2429,8 +2429,8 @@ void EnFishing_UpdateLure(EnFishing* this, PlayState* play) { } } else { if (D_809101C0 > 150.0f) { - sLureRot.x = sReelLineRot[LINE_SEG_COUNT - 2].x + M_PI; - D_809101B0 = sReelLineRot[LINE_SEG_COUNT - 2].y + M_PI; + sLureRot.x = sReelLineRot[LINE_SEG_COUNT - 2].x + M_PIf; + D_809101B0 = sReelLineRot[LINE_SEG_COUNT - 2].y + M_PIf; D_809101C0 += 2.0f; } } @@ -2439,7 +2439,7 @@ void EnFishing_UpdateLure(EnFishing* this, PlayState* play) { if (sLurePos.y <= spE4) { sLurePos.y = spE4; spDC = 0x500; - D_809101B0 = sReelLineRot[LINE_SEG_COUNT - 2].y + M_PI; + D_809101B0 = sReelLineRot[LINE_SEG_COUNT - 2].y + M_PIf; sLureRot.x = 0.0f; if (CHECK_BTN_ALL(input->press.button, BTN_B)) { D_809101C0 += 6.0f; @@ -2447,8 +2447,8 @@ void EnFishing_UpdateLure(EnFishing* this, PlayState* play) { } } else { if (D_809101C0 > 150.0f) { - sLureRot.x = sReelLineRot[LINE_SEG_COUNT - 2].x + M_PI; - D_809101B0 = sReelLineRot[LINE_SEG_COUNT - 2].y + M_PI; + sLureRot.x = sReelLineRot[LINE_SEG_COUNT - 2].x + M_PIf; + D_809101B0 = sReelLineRot[LINE_SEG_COUNT - 2].y + M_PIf; D_809101C0 += 2.0f; } } @@ -3601,7 +3601,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { for (spA2 = 0; spA2 < 100; spA2++) { - Matrix_RotateYF(Rand_CenteredFloat(0.75f * M_PI) + + Matrix_RotateYF(Rand_CenteredFloat(0.75f * M_PIf) + BINANG_TO_RAD_ALT(this->actor.yawTowardsPlayer + 0x8000), MTXMODE_NEW); Matrix_MultVec3f(&sp10C, &sp100); @@ -4241,7 +4241,7 @@ void EnFishing_DrawFish(Actor* thisx, PlayState* play) { Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); if (this->unk_148 == 0) { - Matrix_RotateYF(BINANG_TO_RAD(this->unk_164) - (M_PI / 2), MTXMODE_APPLY); + Matrix_RotateYF(BINANG_TO_RAD(this->unk_164) - (M_PIf / 2), MTXMODE_APPLY); Matrix_Translate(0.0f, 0.0f, this->unk_164 * 10.0f * 0.01f, MTXMODE_APPLY); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, @@ -4250,7 +4250,7 @@ void EnFishing_DrawFish(Actor* thisx, PlayState* play) { Matrix_Translate(0.0f, 0.0f, 3000.0f, MTXMODE_APPLY); Matrix_RotateYF(BINANG_TO_RAD(this->unk_164), MTXMODE_APPLY); Matrix_Translate(0.0f, 0.0f, -3000.0f, MTXMODE_APPLY); - Matrix_RotateYF(-(M_PI / 2), MTXMODE_APPLY); + Matrix_RotateYF(-(M_PIf / 2), MTXMODE_APPLY); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnFishing_LoachOverrideLimbDraw, EnFishing_LoachPostLimbDraw, &this->actor); @@ -5581,7 +5581,7 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { rot.x = 1.6707964f; rot.y = 1.0f; - rot.z = (Camera_GetInputDirYaw(mainCam) * -(M_PI / 0x8000)) + rot.y; + rot.z = (Camera_GetInputDirYaw(mainCam) * BINANG_TO_RAD(-1)) + rot.y; for (i = 0; i < (u8)D_8090CCD0; i++) { pos.x = Rand_CenteredFloat(700.0f) + play->view.eye.x; diff --git a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c index de673afcfa..b32e2ffde6 100644 --- a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c +++ b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c @@ -1198,8 +1198,8 @@ void EnFloormas_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* } else if (limbIndex == WALLMASTER_LIMB_HAND) { Matrix_Push(); Matrix_Translate(1600.0f, -700.0f, -1700.0f, MTXMODE_APPLY); - Matrix_RotateYF(M_PI / 3, MTXMODE_APPLY); - Matrix_RotateZF(M_PI / 12, MTXMODE_APPLY); + Matrix_RotateYF(M_PIf / 3, MTXMODE_APPLY); + Matrix_RotateZF(M_PIf / 12, MTXMODE_APPLY); Matrix_Scale(2.0f, 2.0f, 2.0f, MTXMODE_APPLY); gSPMatrix((*gfx)++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_En_Gs/z_en_gs.c b/src/overlays/actors/ovl_En_Gs/z_en_gs.c index 0f69932bfd..e7919e45ce 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.c +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.c @@ -699,8 +699,8 @@ s32 func_80998F9C(EnGs* this, PlayState* play) { this->unk_1B0[0].x = this->unk_1E4 + 1.0f; this->unk_1B0[0].y = this->unk_1DC + 1.0f; if (sp48 == 0.0f) { - this->unk_1DC = 2.0f * M_PI / 9.0000002; - this->unk_1E0 = M_PI / 9.0000002; + this->unk_1DC = 2.0f * (f32)(M_PI / 9); + this->unk_1E0 = (f32)(M_PI / 9); this->unk_19D = 4; } } diff --git a/src/overlays/actors/ovl_En_Hakurock/z_en_hakurock.c b/src/overlays/actors/ovl_En_Hakurock/z_en_hakurock.c index b98970e2a7..8489f897d6 100644 --- a/src/overlays/actors/ovl_En_Hakurock/z_en_hakurock.c +++ b/src/overlays/actors/ovl_En_Hakurock/z_en_hakurock.c @@ -325,7 +325,7 @@ void EnHakurock_Stalactite_StuckInGround(EnHakurock* this, PlayState* play) { if (this->timer > 0) { this->timer--; if ((this->timer % 2) == 0) { - this->actor.world.pos.y = (Math_SinF(this->timer * (M_PI / 20)) * 4.0f) + this->actor.floorHeight; + this->actor.world.pos.y = (Math_SinF(this->timer * (M_PIf / 20)) * 4.0f) + this->actor.floorHeight; } else { this->actor.world.pos.y = this->actor.floorHeight; } diff --git a/src/overlays/actors/ovl_En_Holl/z_en_holl.c b/src/overlays/actors/ovl_En_Holl/z_en_holl.c index 619c3ce6e3..f5d55a5e3c 100644 --- a/src/overlays/actors/ovl_En_Holl/z_en_holl.c +++ b/src/overlays/actors/ovl_En_Holl/z_en_holl.c @@ -334,7 +334,7 @@ void EnHoll_Draw(Actor* thisx, PlayState* play) { } gfx = Gfx_SetupDL(gfx, setupDListIndex); if (this->playerSide == EN_HOLL_BEHIND) { - Matrix_RotateYF(M_PI, MTXMODE_APPLY); + Matrix_RotateYF(M_PIf, MTXMODE_APPLY); } gSPMatrix(gfx++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(gfx++, 0, 0, 0, 0, 0, this->alpha); diff --git a/src/overlays/actors/ovl_En_Ik/z_en_ik.c b/src/overlays/actors/ovl_En_Ik/z_en_ik.c index 6c157f013c..a4004ba7c3 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -499,7 +499,7 @@ void EnIk_VerticalAttack(EnIk* this, PlayState* play) { if ((this->skelAnime.curFrame > 13.0f) && (this->skelAnime.curFrame < 23.0f)) { this->colliderQuad.base.atFlags |= AT_ON; if (this->drawArmorFlags != 0) { - this->actor.speed = Math_SinF((this->skelAnime.curFrame - 13.0f) * (M_PI / 20)) * 10.0f; + this->actor.speed = Math_SinF((this->skelAnime.curFrame - 13.0f) * (M_PIf / 20)) * 10.0f; } } else { this->colliderQuad.base.atFlags &= ~AT_ON; @@ -562,7 +562,7 @@ void EnIk_HorizontalDoubleAttack(EnIk* this, PlayState* play) { } else { phi_f2 = this->skelAnime.curFrame - 1.0f; } - this->actor.speed = Math_SinF((M_PI / 8) * phi_f2) * 4.5f; + this->actor.speed = Math_SinF((M_PIf / 8) * phi_f2) * 4.5f; } this->colliderQuad.base.atFlags |= AT_ON; } else { diff --git a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c index e4f43bad40..7dcac46ecf 100644 --- a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c +++ b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c @@ -908,14 +908,14 @@ static Gfx* sDisplayLists[] = { #include "z_en_kanban_gfx.c" static f32 sCutAngles[] = { - /* CUT_POST */ 0.50f * M_PI, - /* CUT_VERT_L */ 0.00f * M_PI, - /* CUT_HORIZ */ 0.50f * M_PI, - /* CUT_DIAG_L */ 0.66f * M_PI, - /* CUT_DIAG_R */ 0.34f * M_PI, - /* CUT_VERT_R */ 0.00f * M_PI, - /* */ 0.00f * M_PI, - /* */ 0.00f * M_PI, + /* CUT_POST */ 0.50f * M_PIf, + /* CUT_VERT_L */ 0.00f * M_PIf, + /* CUT_HORIZ */ 0.50f * M_PIf, + /* CUT_DIAG_L */ 0.66f * M_PIf, + /* CUT_DIAG_R */ 0.34f * M_PIf, + /* CUT_VERT_R */ 0.00f * M_PIf, + /* */ 0.00f * M_PIf, + /* */ 0.00f * M_PIf, }; #include "overlays/ovl_En_Kanban/ovl_En_Kanban.c" @@ -1025,7 +1025,7 @@ void EnKanban_Draw(Actor* thisx, PlayState* play) { Matrix_Scale(this->actor.scale.x, 0.0f, this->actor.scale.z, MTXMODE_APPLY); if (this->actionState == ENKANBAN_SIGN) { - Matrix_RotateXFApply(-M_PI / 5); + Matrix_RotateXFApply(-M_PIf / 5); } Matrix_RotateYS(this->actor.shape.rot.y, MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_En_Light/z_en_light.c b/src/overlays/actors/ovl_En_Light/z_en_light.c index b4d7ccdbdb..b6d9a5d530 100644 --- a/src/overlays/actors/ovl_En_Light/z_en_light.c +++ b/src/overlays/actors/ovl_En_Light/z_en_light.c @@ -189,7 +189,7 @@ void EnLight_Draw(Actor* thisx, PlayState* play) { Matrix_RotateYS(BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) - this->actor.shape.rot.y), MTXMODE_APPLY); if (ENLIGHT_GET_1(&this->actor)) { - Matrix_RotateYF(M_PI, MTXMODE_APPLY); + Matrix_RotateYF(M_PIf, MTXMODE_APPLY); } Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c b/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c index b83a375513..f0f32ceccd 100644 --- a/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c +++ b/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c @@ -396,8 +396,8 @@ void EnMinislime_GrowAndShrink(EnMinislime* this, PlayState* play) { this->growShrinkTimer--; scaleFactor = (this->growShrinkTimer / 6) + 1.0f; this->actor.scale.z = this->actor.scale.x = - ((Math_CosF(this->growShrinkTimer * (M_PI / 3)) * (scaleFactor * (2.0f / 30.0f))) + 1.5f) * 0.1f; - this->actor.scale.y = ((Math_SinF(this->growShrinkTimer * (M_PI / 3)) * (scaleFactor * 0.05f)) + 0.75f) * 0.1f; + ((Math_CosF(this->growShrinkTimer * (M_PIf / 3)) * (scaleFactor * (2.0f / 30.0f))) + 1.5f) * 0.1f; + this->actor.scale.y = ((Math_SinF(this->growShrinkTimer * (M_PIf / 3)) * (scaleFactor * 0.05f)) + 0.75f) * 0.1f; if (this->actor.params == MINISLIME_SETUP_GEKKO_THROW) { EnMinislime_SetupMoveToGekko(this); } else if ((this->actor.xzDistToPlayer < 150.0f) && (this->growShrinkTimer < 38)) { @@ -419,11 +419,11 @@ void EnMinislime_Idle(EnMinislime* this, PlayState* play) { f32 speedXZ; this->idleTimer--; - speedXZ = Math_SinF(this->idleTimer * (M_PI / 10)); + speedXZ = Math_SinF(this->idleTimer * (M_PIf / 10)); this->actor.speed = speedXZ * 1.5f; this->actor.speed = CLAMP_MIN(this->actor.speed, 0.0f); Math_StepToF(&this->actor.scale.x, ((0.14f * speedXZ) + 1.5f) * 0.1f, 0.010000001f); - Math_StepToF(&this->actor.scale.y, ((Math_CosF(this->idleTimer * (M_PI / 10)) * 0.07f) + 0.75f) * 0.1f, + Math_StepToF(&this->actor.scale.y, ((Math_CosF(this->idleTimer * (M_PIf / 10)) * 0.07f) + 0.75f) * 0.1f, 0.010000001f); Math_StepToF(&this->actor.scale.z, 0.3f - this->actor.scale.x, 0.010000001f); if (this->idleTimer == 0) { @@ -531,13 +531,13 @@ void EnMinislime_Knockback(EnMinislime* this, PlayState* play) { this->knockbackTimer--; Math_StepToF(&this->actor.speed, 0.0f, 1.0f); sqrtFrozenTimer = sqrtf(this->knockbackTimer); - this->actor.scale.x = ((Math_CosF(this->knockbackTimer * (M_PI / 3)) * (0.05f * sqrtFrozenTimer)) + 1.0f) * 0.15f; + this->actor.scale.x = ((Math_CosF(this->knockbackTimer * (M_PIf / 3)) * (0.05f * sqrtFrozenTimer)) + 1.0f) * 0.15f; this->actor.scale.z = this->actor.scale.x; if (this->knockbackTimer == 15) { this->collider.base.acFlags |= AC_ON; } - this->actor.scale.y = ((Math_SinF(this->knockbackTimer * (M_PI / 3)) * (0.05f * sqrtFrozenTimer)) + 1.0f) * 0.075f; + this->actor.scale.y = ((Math_SinF(this->knockbackTimer * (M_PIf / 3)) * (0.05f * sqrtFrozenTimer)) + 1.0f) * 0.075f; if (this->actor.params == MINISLIME_SETUP_GEKKO_THROW) { EnMinislime_SetupMoveToGekko(this); } else if (this->knockbackTimer == 0) { @@ -569,9 +569,9 @@ void EnMinislime_DefeatIdle(EnMinislime* this, PlayState* play) { f32 xzScale; this->idleTimer--; - xzScale = Math_SinF(this->idleTimer * (M_PI / 10)); + xzScale = Math_SinF(this->idleTimer * (M_PIf / 10)); Math_StepToF(&this->actor.scale.x, ((0.14f * xzScale) + 1.5f) * 0.1f, 0.010000001f); - Math_StepToF(&this->actor.scale.y, ((0.07f * Math_CosF(this->idleTimer * (M_PI / 10))) + 0.75f) * 0.1f, + Math_StepToF(&this->actor.scale.y, ((0.07f * Math_CosF(this->idleTimer * (M_PIf / 10))) + 0.75f) * 0.1f, 0.010000001f); Math_StepToF(&this->actor.scale.z, 0.3f - this->actor.scale.x, 0.010000001f); if (this->idleTimer == 0) { @@ -665,9 +665,9 @@ void EnMinislime_GekkoThrow(EnMinislime* this, PlayState* play) { f32 xzScale; this->throwTimer--; - xzScale = Math_SinF(this->throwTimer * (M_PI / 5)); + xzScale = Math_SinF(this->throwTimer * (M_PIf / 5)); this->actor.scale.x = ((0.3f * xzScale) + 1.5f) * 0.1f; - this->actor.scale.y = ((Math_CosF(this->throwTimer * (M_PI / 5)) * 0.2f) + 0.75f) * 0.1f; + this->actor.scale.y = ((Math_CosF(this->throwTimer * (M_PIf / 5)) * 0.2f) + 0.75f) * 0.1f; this->actor.scale.z = 0.3f - this->actor.scale.x; if (this->throwTimer == 0) { this->throwTimer = 10; diff --git a/src/overlays/actors/ovl_En_Mkk/z_en_mkk.c b/src/overlays/actors/ovl_En_Mkk/z_en_mkk.c index 5ee4aee066..b0f0c063ee 100644 --- a/src/overlays/actors/ovl_En_Mkk/z_en_mkk.c +++ b/src/overlays/actors/ovl_En_Mkk/z_en_mkk.c @@ -274,7 +274,7 @@ void func_80A4E2E8(EnMkk* this, PlayState* play) { Math_ScaledStepToS(&this->unk_150, this->actor.yawTowardsPlayer, 0x400); } this->actor.shape.rot.y = - (s32)(Math_SinF(this->unk_14E * ((2 * M_PI) / 15)) * (614.4f * this->actor.speed)) + this->unk_150; + (s32)(Math_SinF(this->unk_14E * ((2 * M_PIf) / 15)) * (614.4f * this->actor.speed)) + this->unk_150; Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_KUROSUKE_MOVE - SFX_FLAG); if (sp20) { this->unk_14B &= ~2; @@ -378,17 +378,17 @@ void func_80A4E84C(EnMkk* this) { this->unk_160.y = this->unk_154.y; this->unk_154.y = this->actor.world.pos.y; this->unk_154.x = this->actor.world.pos.x - - 10.0f * Math_SinS(this->actor.shape.rot.y + - (s32)(1228.8f * this->actor.speed * Math_SinF(this->unk_14E * (M_PI / 5)))); + 10.0f * Math_SinS(this->actor.shape.rot.y + (s32)(1228.8f * this->actor.speed * + Math_SinF(this->unk_14E * (M_PIf / 5)))); this->unk_154.z = this->actor.world.pos.z - - 10.0f * Math_CosS(this->actor.shape.rot.y + - (s32)(1228.8f * this->actor.speed * Math_SinF(this->unk_14E * (M_PI / 5)))); + 10.0f * Math_CosS(this->actor.shape.rot.y + (s32)(1228.8f * this->actor.speed * + Math_SinF(this->unk_14E * (M_PIf / 5)))); this->unk_160.x = this->unk_154.x - - 12.0f * Math_SinS(this->actor.shape.rot.y - - (s32)(1228.8f * this->actor.speed * Math_SinF(this->unk_14E * (M_PI / 5)))); + 12.0f * Math_SinS(this->actor.shape.rot.y - (s32)(1228.8f * this->actor.speed * + Math_SinF(this->unk_14E * (M_PIf / 5)))); this->unk_160.z = this->unk_154.z - - 12.0f * Math_CosS(this->actor.shape.rot.y - - (s32)(1228.8f * this->actor.speed * Math_SinF(this->unk_14E * (M_PI / 5)))); + 12.0f * Math_CosS(this->actor.shape.rot.y - (s32)(1228.8f * this->actor.speed * + Math_SinF(this->unk_14E * (M_PIf / 5)))); } } diff --git a/src/overlays/actors/ovl_En_Niw/z_en_niw.c b/src/overlays/actors/ovl_En_Niw/z_en_niw.c index 970840eaac..0e8ff10e56 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.c +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.c @@ -976,7 +976,7 @@ void EnNiw_UpdateFeather(EnNiw* this, PlayState* play) { feather->velocity.y = -0.5f; } - feather->zRot = Math_SinS(feather->zRotStart * 0xBB8) * M_PI * 0.2f; + feather->zRot = Math_SinS(feather->zRotStart * 0xBB8) * M_PIf * 0.2f; if (feather->life < feather->timer) { feather->isEnabled = false; diff --git a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c index c6ce59b10e..2d7ba42782 100644 --- a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c +++ b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c @@ -524,7 +524,7 @@ void EnPametfrog_FallOffSnapper(EnPametfrog* this, PlayState* play) { this->timer--; } - sin = Math_SinF(this->timer * (M_PI / 3)) * ((0.02f * (this->timer * (1.0f / 6.0f))) + 0.005f) + 1.0f; + sin = Math_SinF(this->timer * (M_PIf / 3)) * ((0.02f * (this->timer * (1.0f / 6.0f))) + 0.005f) + 1.0f; EnPametfrog_ShakeCamera(this, play, 300.0f * sin, 100.0f * sin); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { EnPametfrog_StopCutscene(this, play); @@ -663,10 +663,10 @@ void EnPametfrog_SetupWallPause(EnPametfrog* this) { this->actor.speed = 0.0f; this->skelAnime.playSpeed = 1.5f; if (this->timer != 0) { - this->wallRotation = this->unk_2E8.y > 0.0f ? (M_PI / 30) : (-M_PI / 30); + this->wallRotation = this->unk_2E8.y > 0.0f ? (M_PIf / 30) : (-M_PIf / 30); } else { randFloat = Rand_ZeroFloat(0x2000); - this->wallRotation = ((Rand_ZeroOne() < 0.5f) ? -1 : 1) * (0x1000 + randFloat) * (M_PI / (15 * 0x8000)); + this->wallRotation = ((Rand_ZeroOne() < 0.5f) ? -1 : 1) * (0x1000 + randFloat) * (M_PIf / (15 * 0x8000)); } this->timer = 15; Actor_PlaySfx(&this->actor, NA_SE_EN_FROG_RUNAWAY2); @@ -982,7 +982,7 @@ void EnPametfrog_SpawnFrog(EnPametfrog* this, PlayState* play) { f32 magShake; this->timer--; - magShake = (Math_SinF(this->timer * (M_PI / 5)) * ((0.04f * (this->timer * 0.1f)) + 0.02f)) + 1.0f; + magShake = (Math_SinF(this->timer * (M_PIf / 5)) * ((0.04f * (this->timer * 0.1f)) + 0.02f)) + 1.0f; EnPametfrog_ShakeCamera(this, play, 75.0f * magShake, 10.0f * magShake); if (this->timer == 0) { EnPametfrog_StopCutscene(this, play); diff --git a/src/overlays/actors/ovl_En_Rat/z_en_rat.c b/src/overlays/actors/ovl_En_Rat/z_en_rat.c index 8b7f3230ab..e73ade856e 100644 --- a/src/overlays/actors/ovl_En_Rat/z_en_rat.c +++ b/src/overlays/actors/ovl_En_Rat/z_en_rat.c @@ -948,14 +948,14 @@ void EnRat_PostLimbDraw(PlayState* play2, s32 limbIndex, Gfx** dList, Vec3s* rot gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gBombCapDL); if (EN_RAT_GET_TYPE(&this->actor) == EN_RAT_TYPE_DUNGEON) { - redModifier = fabsf(Math_CosF(this->timer * (M_PI / 30.f))); + redModifier = fabsf(Math_CosF(this->timer * (M_PIf / 30))); } else { if (this->timer >= 120) { - redModifier = fabsf(Math_CosF((this->timer % 30) * (M_PI / 30.0f))); + redModifier = fabsf(Math_CosF((this->timer % 30) * (M_PIf / 30))); } else if (this->timer >= 30) { - redModifier = fabsf(Math_CosF((this->timer % 6) * (M_PI / 6.0f))); + redModifier = fabsf(Math_CosF((this->timer % 6) * (M_PIf / 6))); } else { - redModifier = fabsf(Math_CosF((this->timer % 3) * (M_PI / 3.0f))); + redModifier = fabsf(Math_CosF((this->timer % 3) * (M_PIf / 3))); } } diff --git a/src/overlays/actors/ovl_En_Slime/z_en_slime.c b/src/overlays/actors/ovl_En_Slime/z_en_slime.c index 483ae6db3e..b744626b1a 100644 --- a/src/overlays/actors/ovl_En_Slime/z_en_slime.c +++ b/src/overlays/actors/ovl_En_Slime/z_en_slime.c @@ -310,11 +310,11 @@ void EnSlime_Idle(EnSlime* this, PlayState* play) { timerFactor = sqrtf(this->timer) * 0.2f; EnSlime_Blink(this); - scale = ((Math_SinF(this->timer * (2.0f * M_PI / 5.0f)) * (0.13f * timerFactor)) + 1.0f) * 0.01f; + scale = ((Math_SinF(this->timer * (2 * M_PIf / 5)) * (0.13f * timerFactor)) + 1.0f) * 0.01f; this->actor.scale.x = scale; this->actor.scale.z = scale; if (this->timer < 24) { - this->actor.scale.y = ((Math_CosF(this->timer * (2.0f * M_PI / 5.0f)) * (0.05f * timerFactor)) + 1.0f) * 0.01f; + this->actor.scale.y = ((Math_CosF(this->timer * (2 * M_PIf / 5)) * (0.05f * timerFactor)) + 1.0f) * 0.01f; } this->actor.shape.rot.x = Rand_CenteredFloat(0x200) * timerFactor; @@ -372,7 +372,7 @@ void EnSlime_MoveInDirection(EnSlime* this, PlayState* play) { } // Update actor scale, xz speed, and rotation to provide amorphous effect - sinFactor = fabsf(Math_SinF(this->timer * (M_PI / 24))); + sinFactor = fabsf(Math_SinF(this->timer * (M_PIf / 24))); Math_StepToF(&this->actor.scale.z, ((0.15f * sinFactor) + 1.0f) * 0.01f, 0.0002f); Math_StepToF(&this->actor.scale.x, (1.0f - (0.2f * sinFactor)) * 0.01f, 0.0002f); Math_StepToF(&this->actor.scale.y, (1.0f - (0.1f * sinFactor)) * 0.01f, 0.0002f); @@ -425,7 +425,7 @@ void EnSlime_MoveToHome(EnSlime* this, PlayState* play) { this->idleRotY = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); } - timerFactor = fabsf(Math_SinF(this->timer * (M_PI / 24))); + timerFactor = fabsf(Math_SinF(this->timer * (M_PIf / 24))); Math_StepToF(&this->actor.scale.z, ((0.15f * timerFactor) + 1.0f) * 0.01f, 0.0002f); Math_StepToF(&this->actor.scale.x, (1.0f - (0.2f * timerFactor)) * 0.01f, 0.0002f); Math_StepToF(&this->actor.scale.y, (1.0f - (0.1f * timerFactor)) * 0.01f, 0.0002f); @@ -549,11 +549,11 @@ void EnSlime_Land(EnSlime* this, PlayState* play) { this->timer--; scaleY = ((this->timer / 5) + 1) * 1.6f; rotXZ = sqrtf(this->timer) * 0.2f; - scaleXZ = ((Math_CosF(this->timer * (2.0f * M_PI / 5.0f)) * (0.05f * scaleY)) + 1.0f) * 0.01f; + scaleXZ = ((Math_CosF(this->timer * (2 * M_PIf / 5)) * (0.05f * scaleY)) + 1.0f) * 0.01f; this->actor.scale.x = scaleXZ; this->actor.scale.z = scaleXZ; if (this->timer < 15) { - this->actor.scale.y = (1.0f - (Math_SinF(this->timer * (2.0f * M_PI / 5.0f)) * (0.04f * scaleY))) * 0.01f; + this->actor.scale.y = (1.0f - (Math_SinF(this->timer * (2 * M_PIf / 5)) * (0.04f * scaleY))) * 0.01f; } this->actor.shape.rot.x = Rand_CenteredFloat(0x200) * rotXZ; this->actor.shape.rot.z = Rand_CenteredFloat(0x200) * rotXZ; @@ -605,14 +605,14 @@ void EnSlime_ReactToBluntHit(EnSlime* this, PlayState* play) { Math_StepToF(&this->actor.speed, 0.0f, 1.0f); timerFactor = sqrtf(this->timer); if (this->timer < 30) { - scale = ((Math_CosF(this->timer * (2.0f * M_PI / 5.0f)) * (0.08f * timerFactor)) + 1.0f) * 0.01f; + scale = ((Math_CosF(this->timer * (2 * M_PIf / 5)) * (0.08f * timerFactor)) + 1.0f) * 0.01f; this->actor.scale.x = scale; this->actor.scale.z = scale; } if (this->timer == 15) { this->collider.base.acFlags |= AC_ON; } - this->actor.scale.y = ((Math_SinF((f32)this->timer * (2.0f * M_PI / 5.0f)) * (0.07f * timerFactor)) + 1.0f) * 0.01f; + this->actor.scale.y = ((Math_SinF((f32)this->timer * (2 * M_PIf / 5)) * (0.07f * timerFactor)) + 1.0f) * 0.01f; this->actor.shape.rot.x = Rand_CenteredFloat(0x200) * timerFactor; this->actor.shape.rot.z = Rand_CenteredFloat(0x200) * timerFactor; @@ -652,8 +652,8 @@ void EnSlime_SetupDamaged(EnSlime* this, PlayState* play, s32 arg2) { this->eyeTexIndex = EN_SLIME_EYETEX_OPEN; Actor_SetScale(&this->actor, 0.01f); - this->wobbleRot.x = Rand_ZeroOne() * (M_PI * 2.0f); - this->wobbleRot.z = Rand_ZeroOne() * (M_PI * 2.0f); + this->wobbleRot.x = Rand_ZeroOne() * (M_PIf * 2); + this->wobbleRot.z = Rand_ZeroOne() * (M_PIf * 2); ySin = Math_SinS(this->actor.world.rot.y) * 10.0f; yCos = Math_CosS(this->actor.world.rot.y) * 10.0f; effectPos.x = this->actor.world.pos.x + ySin; @@ -691,8 +691,8 @@ void EnSlime_Damaged(EnSlime* this, PlayState* play) { this->timer--; Math_StepToF(&this->actor.speed, 0.0f, 1.0f); if ((this->timer % 5) == 0) { - this->wobbleRot.x = Rand_ZeroOne() * (M_PI * 2.0f); - this->wobbleRot.z = Rand_ZeroOne() * (M_PI * 2.0f); + this->wobbleRot.x = Rand_ZeroOne() * (M_PIf * 2); + this->wobbleRot.z = Rand_ZeroOne() * (M_PIf * 2); } if (this->timer == 0) { if (this->actor.colChkInfo.health != 0) { @@ -1186,9 +1186,9 @@ void EnSlime_Draw(Actor* thisx, PlayState* play) { } if (this->actionFunc == EnSlime_Damaged) { - wobbleScale.x = 1.0f - (Math_SinF((f32)this->timer * (M_PI / 2.0f)) * 0.3f); - wobbleScale.y = (Math_SinF((f32)this->timer * (M_PI / 2.0f)) * 0.3f) + 1.0f; - wobbleScale.z = 1.0f - (Math_CosF((f32)this->timer * (M_PI / 2.0f)) * 0.3f); + wobbleScale.x = 1.0f - (Math_SinF((f32)this->timer * (M_PIf / 2)) * 0.3f); + wobbleScale.y = (Math_SinF((f32)this->timer * (M_PIf / 2)) * 0.3f) + 1.0f; + wobbleScale.z = 1.0f - (Math_CosF((f32)this->timer * (M_PIf / 2)) * 0.3f); Matrix_RotateXFApply(this->wobbleRot.x); Matrix_RotateZF(this->wobbleRot.z, MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_En_Snowman/z_en_snowman.c b/src/overlays/actors/ovl_En_Snowman/z_en_snowman.c index 0324d7a47e..4e8f4443b4 100644 --- a/src/overlays/actors/ovl_En_Snowman/z_en_snowman.c +++ b/src/overlays/actors/ovl_En_Snowman/z_en_snowman.c @@ -1044,11 +1044,11 @@ void EnSnowman_Update(Actor* thisx, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, wallCheckRadius, 0.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10); - if ((this->actor.floorPoly != NULL) && ((this->actor.floorPoly->normal.y * SHT_MINV) < 0.7f)) { + if ((this->actor.floorPoly != NULL) && (COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.y) < 0.7f)) { Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.prevPos); if (!this->turningOnSteepSlope) { - this->snowPileTargetRotY = Math_Atan2S_XY(this->actor.floorPoly->normal.z * SHT_MINV, - this->actor.floorPoly->normal.x * SHT_MINV); + this->snowPileTargetRotY = Math_Atan2S_XY(COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.z), + COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.x)); this->turningOnSteepSlope = true; } } else { diff --git a/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.c b/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.c index 80008f37c6..9f80967c2d 100644 --- a/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.c +++ b/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.c @@ -292,9 +292,9 @@ s32 EnSyatekiCrow_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, EnSyatekiCrow* this = THIS; if (limbIndex == OBJECT_CROW_LIMB_UPPER_TAIL) { - rot->y += TRUNCF_BINANG(0xC00 * Math_SinF(this->skelAnime.curFrame * (M_PI / 4))); + rot->y += TRUNCF_BINANG(0xC00 * Math_SinF(this->skelAnime.curFrame * (M_PIf / 4))); } else if (limbIndex == OBJECT_CROW_LIMB_TAIL) { - rot->y += TRUNCF_BINANG(0x1400 * Math_SinF((this->skelAnime.curFrame + 2.5f) * (M_PI / 4))); + rot->y += TRUNCF_BINANG(0x1400 * Math_SinF((this->skelAnime.curFrame + 2.5f) * (M_PIf / 4))); } return false; diff --git a/src/overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.c b/src/overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.c index e875a88480..f4f8f3ffa0 100644 --- a/src/overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.c +++ b/src/overlays/actors/ovl_En_Syateki_Okuta/z_en_syateki_okuta.c @@ -469,7 +469,7 @@ void EnSyatekiOkuta_UpdateHeadScale(EnSyatekiOkuta* this) { } } else if (this->actionFunc == EnSyatekiOkuta_Float) { this->headScale.x = this->headScale.z = 1.0f; - this->headScale.y = (Math_SinF((M_PI / 16) * curFrame) * 0.2f) + 1.0f; + this->headScale.y = (Math_SinF((M_PIf / 16) * curFrame) * 0.2f) + 1.0f; } else if (this->actionFunc == EnSyatekiOkuta_Hide) { if (curFrame < 3.0f) { this->headScale.y = 1.0f; @@ -509,7 +509,7 @@ s32 EnSyatekiOkuta_GetSnoutScale(EnSyatekiOkuta* this, f32 curFrame, Vec3f* scal if (this->actionFunc == EnSyatekiOkuta_Appear) { scale->y = 1.0f; scale->z = 1.0f; - scale->x = (Math_SinF((M_PI / 16) * curFrame) * 0.4f) + 1.0f; + scale->x = (Math_SinF((M_PIf / 16) * curFrame) * 0.4f) + 1.0f; } else if (this->actionFunc == EnSyatekiOkuta_Die) { if ((curFrame >= 35.0f) || (curFrame < 25.0f)) { return false; diff --git a/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c b/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c index 9219d16a15..fe5d4aa081 100644 --- a/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c +++ b/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c @@ -98,7 +98,7 @@ void EnTanron3_CreateEffect(PlayState* play, Vec3f* effectPos) { effectPtr->accel.y = -2.0f; effectPtr->unk_34.x = 0.1f; effectPtr->unk_34.y = 0.0f; - effectPtr->unk_34.z = Rand_ZeroFloat(2 * M_PI); + effectPtr->unk_34.z = Rand_ZeroFloat(2 * M_PIf); effectPtr->unk_02 = Rand_ZeroFloat(100.0f); effectPtr->velocity.x = Rand_CenteredFloat(25.0f); effectPtr->velocity.z = Rand_CenteredFloat(25.0f); @@ -135,8 +135,8 @@ void EnTanron3_SpawnBubbles(EnTanron3* this, PlayState* play) { Vec3f acceleration; for (i = 0; i < 20; i++) { - Matrix_RotateYF(Rand_ZeroFloat(2 * M_PI), MTXMODE_NEW); - Matrix_RotateXFApply(Rand_ZeroFloat(2 * M_PI)); + Matrix_RotateYF(Rand_ZeroFloat(2 * M_PIf), MTXMODE_NEW); + Matrix_RotateXFApply(Rand_ZeroFloat(2 * M_PIf)); Matrix_MultVecZ(Rand_ZeroFloat(3.0f) + 2.0f, &velocity); acceleration.x = velocity.x * -0.05f; acceleration.y = velocity.y * -0.05f; diff --git a/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c b/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c index a75e4ef210..2f15d08404 100644 --- a/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c +++ b/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c @@ -57,7 +57,7 @@ void func_80A587A0(EnWaterEffect* this, Vec3f* arg1, u8 arg2) { ptr->unk_1C = sZeroVec; ptr->unk_2C.x = 0.1f; ptr->unk_2C.y = 0.0f; - ptr->unk_2C.z = Rand_ZeroFloat(M_PI * 2); + ptr->unk_2C.z = Rand_ZeroFloat(M_PIf * 2); ptr->unk_01 = Rand_ZeroFloat(100.0f); ptr->unk_2A = arg2; break; @@ -78,7 +78,7 @@ void func_80A58908(EnWaterEffect* this, Vec3f* arg1, Vec3f* arg2, u8 arg3) { ptr->unk_1C = sp2C; ptr->unk_2C.y = Rand_ZeroFloat(0.02f) + 0.02f; ptr->unk_2C.x = ptr->unk_2C.y; - ptr->unk_2C.z = Rand_ZeroFloat(M_PI * 2); + ptr->unk_2C.z = Rand_ZeroFloat(M_PIf * 2); ptr->unk_01 = Rand_ZeroFloat(100.0f); ptr->unk_2A = arg3; break; @@ -236,7 +236,7 @@ void EnWaterEffect_Update(Actor* thisx, PlayState* play2) { } for (j = 0; j < 12; j++) { - Matrix_RotateYF((2.0f * (j * M_PI)) / 5.5f, MTXMODE_NEW); + Matrix_RotateYF((2.0f * (j * M_PIf)) / 5.5f, MTXMODE_NEW); Matrix_MultVecZ(Rand_ZeroFloat(1.5f) + 1.5f, &spA4); spA4.y = Rand_ZeroFloat(4.0f) + 2.0f; func_80A58908(this, &ptr->unk_04, &spA4, ptr->unk_2A); @@ -552,7 +552,7 @@ void func_80A5A184(Actor* thisx, PlayState* play2) { Matrix_Scale(ptr->unk_2C.x, ptr->unk_2C.y, 1.0f, MTXMODE_APPLY); if ((i & 1) != 0) { - Matrix_RotateYF(M_PI, MTXMODE_APPLY); + Matrix_RotateYF(M_PIf, MTXMODE_APPLY); } gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_En_Wdhand/z_en_wdhand.c b/src/overlays/actors/ovl_En_Wdhand/z_en_wdhand.c index fe39b96c56..f95bc9391b 100644 --- a/src/overlays/actors/ovl_En_Wdhand/z_en_wdhand.c +++ b/src/overlays/actors/ovl_En_Wdhand/z_en_wdhand.c @@ -301,7 +301,7 @@ void EnWdhand_Vec3fToVec3s(Vec3s* dst, Vec3f* src) { } s16 EnWdhand_GetLimbXRotation(EnWdhand* this, s32 limbIndex) { - return this->limbRotations[limbIndex].z * Math_SinF((this->timer - limbIndex * 20) * (M_PI / 40)); + return this->limbRotations[limbIndex].z * Math_SinF((this->timer - limbIndex * 20) * (M_PIf / 40)); } void EnWdhand_SetupIdle(EnWdhand* this) { @@ -510,9 +510,9 @@ void EnWdhand_GrabbedPlayer(EnWdhand* this, PlayState* play) { for (i = 0; i < ARRAY_COUNT(this->limbRotations); i++) { if (this->timer < 76) { - this->limbRotations[i].x = this->limbRotations[i].z * Math_SinF(t * (M_PI / 8)); + this->limbRotations[i].x = this->limbRotations[i].z * Math_SinF(t * (M_PIf / 8)); } else { - Math_ScaledStepToS(&this->limbRotations[i].x, this->limbRotations[i].z * Math_SinF(t * (M_PI / 8)), 0x400); + Math_ScaledStepToS(&this->limbRotations[i].x, this->limbRotations[i].z * Math_SinF(t * (M_PIf / 8)), 0x400); } if (t % 16 == 0) { if (t == 16) { @@ -682,10 +682,10 @@ void EnWdhand_Die(EnWdhand* this, PlayState* play) { t = this->timer; for (i = 0; i < limbIndex; i++) { if (this->timer > 0) { - Math_ScaledStepToS(&this->limbRotations[i].x, this->limbRotations[i].z * Math_SinF(t * (2 * M_PI / 7)), + Math_ScaledStepToS(&this->limbRotations[i].x, this->limbRotations[i].z * Math_SinF(t * (2 * M_PIf / 7)), 0x200); } else if (Rand_ZeroOne() < 0.65f) { - this->limbRotations[i].x = this->limbRotations[i].z * Math_SinF(t * (2 * M_PI / 7)); + this->limbRotations[i].x = this->limbRotations[i].z * Math_SinF(t * (2 * M_PIf / 7)); } if (t % 7 == 0) { if (i != 0) { diff --git a/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c b/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c index 5878f85af6..1d95de83ec 100644 --- a/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c +++ b/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c @@ -121,16 +121,16 @@ u32 func_80BB9A1C(ObjChan* this, f32 arg1) { f32 sp20; sp20 = Math_SinS(this->unk1D4) * this->unk1D0; - temp_f6 = (Math_CosS(this->unk1D4) * (400 * M_PI / 0x8000) * this->unk1D0) + arg1; + temp_f6 = (Math_CosS(this->unk1D4) * BINANG_TO_RAD_ALT2(400) * this->unk1D0) + arg1; if (temp_f6 != 0.0f) { - this->unk1D4 = RAD_TO_BINANG(Math_FAtan2F(sp20 * (400 * M_PI / 0x8000), temp_f6)); + this->unk1D4 = RAD_TO_BINANG(Math_FAtan2F(sp20 * BINANG_TO_RAD_ALT2(400), temp_f6)); } else if (sp20 >= 0.0f) { this->unk1D4 = 0x4000; } else { this->unk1D4 = -0x4000; } if (Math_CosS(this->unk1D4) != 0.0f) { - this->unk1D0 = (temp_f6 / (Math_CosS(this->unk1D4) * (400 * M_PI / 0x8000))); + this->unk1D0 = (temp_f6 / (Math_CosS(this->unk1D4) * BINANG_TO_RAD_ALT2(400))); } else { this->unk1D0 = sp20; } diff --git a/src/overlays/actors/ovl_Obj_Mine/z_obj_mine.c b/src/overlays/actors/ovl_Obj_Mine/z_obj_mine.c index 53733412a1..cd10516b98 100644 --- a/src/overlays/actors/ovl_Obj_Mine/z_obj_mine.c +++ b/src/overlays/actors/ovl_Obj_Mine/z_obj_mine.c @@ -624,7 +624,7 @@ void ObjMine_Water_UpdateLinks(ObjMine* this) { if (ObjMine_GetUnitVec3fNorm(&tempVec, &diffDir, &diffNorm, &invNorm) && (diffNorm > LINK_SIZE / 3.0f)) { Math_Vec3f_Copy(&newBasis.y, &waterLink->basis.y); - ObjMine_StepUntilParallel(&newBasis.y, &diffDir, M_PI / 30); + ObjMine_StepUntilParallel(&newBasis.y, &diffDir, M_PIf / 30); tempBasisX = (prevBasisX == NULL) ? &sStandardBasis.x : prevBasisX; diff --git a/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.c b/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.c index 8db086b80d..2ca3cde2c1 100644 --- a/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.c +++ b/src/overlays/actors/ovl_Obj_Spidertent/z_obj_spidertent.c @@ -474,7 +474,7 @@ void func_80B300F4(ObjSpidertent* thisx, PlayState* play, TriNorm* triNorm, Vec3 if (func_80B2FB10(&sp88, &spA0)) { phi_f22 = 0.0f; - temp_f24 = (2 * M_PI) / sp80->unk_0F; + temp_f24 = (2 * M_PIf) / sp80->unk_0F; for (i = 0; i < sp80->unk_0F; i++) { temp_f2 = (Rand_ZeroOne() * temp_f24) + phi_f22; diff --git a/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c b/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c index 812c28b65d..e3944c12fb 100644 --- a/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c +++ b/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c @@ -115,7 +115,7 @@ void OceffSpot_Update(Actor* thisx, PlayState* play) { f32 temp; OceffSpot* this = THIS; - temp = (1.0f - cosf(this->unk16C * M_PI)) * 0.5f; + temp = (1.0f - cosf(this->unk16C * M_PIf)) * 0.5f; this->actionFunc(this, play); switch (GET_PLAYER_FORM) { diff --git a/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.c b/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.c index b40513e21a..10aabf1506 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.c +++ b/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.c @@ -98,7 +98,7 @@ void EffectSsDeadDs_Draw(PlayState* play, u32 index, EffectSs* this) { Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); Matrix_RotateZYX(this->rRoll, this->rPitch, this->rYaw, MTXMODE_APPLY); - Matrix_RotateXFApply(1.57f); // (M_PI / 2) + Matrix_RotateXFApply(1.57f); // (M_PIf / 2) Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetCombineLERP(POLY_XLU_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, diff --git a/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c b/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c index 8c4fc5877c..7b44feee8c 100644 --- a/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c +++ b/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c @@ -72,7 +72,7 @@ void EffectSsKFire_Draw(PlayState* play, u32 index, EffectSs* this) { Matrix_ReplaceRotation(&play->billboardMtxF); if ((index % 2) != 0) { - Matrix_RotateYF(M_PI, MTXMODE_APPLY); + Matrix_RotateYF(M_PIf, MTXMODE_APPLY); } gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c index 63dd55164c..bd00e305c5 100644 --- a/src/overlays/gamestates/ovl_select/z_select.c +++ b/src/overlays/gamestates/ovl_select/z_select.c @@ -7,7 +7,7 @@ #include "z_select.h" #include "z64shrink_window.h" #include "z64view.h" -#include "libc/alloca.h" +#include "alloca.h" #include "overlays/gamestates/ovl_title/z_title.h" void MapSelect_LoadConsoleLogo(MapSelectState* this, u32 entrance, s32 spawn) {