From 4bdb7280a75c0fe9f0c67795490c181d1f9901ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Fa=C3=9Fbender?= <31699028+Brotenko@users.noreply.github.com> Date: Wed, 25 Aug 2021 21:29:59 +0200 Subject: [PATCH] Create dead.h and update dead code units (#394) * create dead.h and resolve #350 * Update variables.h * Update dead.h --- include/dead.h | 22 +++++++++++++++++++ include/enums.h | 1 - include/functions.h | 12 ---------- include/variables.h | 5 ----- src/EA0900.c | 1 + src/EA0C10.c | 1 + src/EA36E0.c | 1 + src/EA6FD0.c | 3 ++- src/EA7010.c | 1 + src/EA7320.c | 3 ++- src/EA8AE0.c | 1 + src/EB0E60.c | 1 + src/EB1170.c | 1 + src/EB5130.c | 1 + src/EB5470.c | 1 + src/EB7230.c | 1 + src/EB7540.c | 1 + src/EB8E50.c | 1 + src/EB8E90.c | 1 + src/EB9D90.c | 1 + src/EC2200.c | 1 + src/EC2240.c | 1 + src/EC2610.c | 1 + src/EC71B0.c | 1 + src/EC7590.c | 1 + src/EC9D00.c | 1 + src/ECAA40.c | 1 + src/ECAA80.c | 1 + src/ECB930.c | 1 + src/ECBB70.c | 1 + src/ECFFF0.c | 1 + src/ED0030.c | 1 + src/ED00D0.c | 1 + src/ED0310.c | 1 + src/ED4220.c | 1 + src/ED4260.c | 1 + src/ED42A0.c | 1 + src/ED46D0.c | 1 + src/ED5540.c | 1 + src/ED8E20.c | 1 + src/EDBFE0.c | 1 + src/EDC020.c | 1 + src/EDE9C0.c | 1 + src/EDEA00.c | 1 + src/EE2040.c | 1 + src/EE65B0.c | 1 + src/EE70C0.c | 1 + src/EE8940.c | 1 + src/EED100.c | 1 + src/EED140.c | 1 + src/EED1E0.c | 1 + src/EEDF50.c | 1 + src/EEFAA0.c | 1 + src/EF2610.c | 1 + src/EF2650.c | 3 ++- src/EF2680.c | 1 + src/EF7A80.c | 1 + src/EF7FB0.c | 1 + src/EF8010.c | 1 + src/EFEB00.c | 1 + src/common/DeadUnkFloatFunc.inc.c | 16 +++++++------- src/common/DeadUnkFloatFuncAbs.inc.c | 16 +++++++------- src/world/common/DeadFoliage.inc.c | 16 +++++++------- src/world/common/DeadGetItemName.inc.c | 4 ++-- src/world/common/DeadUnkNpcAIFunc1.inc.c | 6 ++--- src/world/common/DeadUnkNpcAIFunc14.inc.c | 4 ++-- src/world/common/DeadUnkPartnerPosFuncs.inc.c | 5 +++-- src/world/common/DeadUnkTexturePanFunc.inc.c | 9 ++++---- src/world/common/DeadUnkTexturePanFunc2.inc.c | 8 +++---- 69 files changed, 124 insertions(+), 62 deletions(-) create mode 100644 include/dead.h diff --git a/include/dead.h b/include/dead.h new file mode 100644 index 0000000000..8da782ae1c --- /dev/null +++ b/include/dead.h @@ -0,0 +1,22 @@ +#ifndef _DEAD_H_ +#define _DEAD_H_ + +#define gCameras dead_gCameras +#define get_variable dead_get_variable +#define set_variable dead_set_variable +#define get_float_variable dead_get_float_variable +#define cos_rad dead_cos_rad +#define set_float_variable dead_set_float_variable +#define playFX_11 dead_playFX_11 +#define gPlayerStatusPtr dead_gPlayerStatusPtr +#define set_main_pan_u dead_set_main_pan_u +#define set_main_pan_v dead_set_main_pan_v +#define set_aux_pan_u dead_set_aux_pan_u +#define set_aux_pan_v dead_set_aux_pan_v +#define get_npc_unsafe dead_get_npc_unsafe +#define atan2 dead_atan2 +#define clamp_angle dead_clamp_angle +#define rand_int dead_rand_int +#define gItemTable dead_gItemTable + +#endif diff --git a/include/enums.h b/include/enums.h index 56f6c35305..3e1545442f 100644 --- a/include/enums.h +++ b/include/enums.h @@ -630,7 +630,6 @@ enum Cams { }; #define LOOKUP_ITEM(itemID) gItemTable[itemID & ~0xF0000] -#define DEAD_LOOKUP_ITEM(itemID) dead_gItemTable[itemID & ~0xF0000] // Dead gItemTable typedef s16 ItemID; enum ItemIDs { diff --git a/include/functions.h b/include/functions.h index 42e45b3047..88fa0ebfab 100644 --- a/include/functions.h +++ b/include/functions.h @@ -418,22 +418,10 @@ void set_curtain_fade_goal(f32 fade); void set_curtain_fade(f32 fade); // Dead functions: -Npc* dead_get_npc_unsafe(NpcID npcId); // get_npc_safe Npc* func_8003E534(NpcID npcId); // get_npc_safe void func_80077BD0(s32, s32, s32, s32, s32, s32); - -void dead_playFX_11(s32, f32, f32, f32, f32); -s32 dead_get_variable(Evt* script, Bytecode var); -f32 dead_get_float_variable(Evt* script, Bytecode var); -s32 dead_set_variable(Evt* script, Bytecode var, s32 value); -f32 dead_set_float_variable(Evt* script, Bytecode var, f32 value); -f32 dead_clamp_angle(f32 theta); -s32 dead_rand_int(s32); void func_8006CAC0(float mf[4][4], float x, float y, float z); -f32 dead_cos_rad(f32 x); -f32 dead_atan2(f32 startX, f32 startZ, f32 endX, f32 endZ); - s32 create_generic_entity_world(void (*updateFunc)(void), void (*drawFunc)(void)); EntityModel* get_entity_model(s32 idx); f32 phys_get_spin_history(s32 lag, s32* x, s32* y, s32* z); diff --git a/include/variables.h b/include/variables.h index 936908f075..9b7cd4a7d0 100644 --- a/include/variables.h +++ b/include/variables.h @@ -393,11 +393,6 @@ extern s32 D_8038F800; extern s32 D_803B5000; extern s32 D_803DA800; -// Dead code -extern PlayerStatus* dead_gPlayerStatusPtr; -extern StaticItem dead_gItemTable[364]; -extern Camera dead_gCameras[4]; - extern s32 D_80108A64; extern s32 bMarioIdleAnims[]; extern s32 bMarioDefendAnims[]; diff --git a/src/EA0900.c b/src/EA0900.c index 60701b99af..28b39318d4 100644 --- a/src/EA0900.c +++ b/src/EA0900.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" #define NAMESPACE EA0900 diff --git a/src/EA0C10.c b/src/EA0C10.c index 90e4828dbd..60c024dc5c 100644 --- a/src/EA0C10.c +++ b/src/EA0C10.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" #define NAMESPACE EA0C10 diff --git a/src/EA36E0.c b/src/EA36E0.c index 74f6baba6f..4990f0ecfc 100644 --- a/src/EA36E0.c +++ b/src/EA36E0.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" INCLUDE_ASM(s32, "EA36E0", func_80242DE0_EA36E0); diff --git a/src/EA6FD0.c b/src/EA6FD0.c index 5443506dcf..6a50a25265 100644 --- a/src/EA6FD0.c +++ b/src/EA6FD0.c @@ -1,7 +1,8 @@ +#include "dead.h" #include "common.h" s32 func_80240000_EA6FD0(void) { - s32 temp = dead_get_variable(NULL, SI_STORY_PROGRESS); + s32 temp = get_variable(NULL, SI_STORY_PROGRESS); if (temp <= 0x26) { return 0x19010F; diff --git a/src/EA7010.c b/src/EA7010.c index 5ea4d6af02..852f6d67e5 100644 --- a/src/EA7010.c +++ b/src/EA7010.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" #define NAMESPACE EA7010 diff --git a/src/EA7320.c b/src/EA7320.c index 936545f293..42e00b0d6c 100644 --- a/src/EA7320.c +++ b/src/EA7320.c @@ -1,9 +1,10 @@ +#include "dead.h" #include "common.h" #define NAMESPACE EA7320 ApiStatus func_80240350_EA7320(Evt* script, s32 isInitialCall) { - Camera* camera = &dead_gCameras[0]; + Camera* camera = &gCameras[0]; camera->flags |= 0x1000; return ApiStatus_DONE2; diff --git a/src/EA8AE0.c b/src/EA8AE0.c index d25b0b824e..3743a19bc1 100644 --- a/src/EA8AE0.c +++ b/src/EA8AE0.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" #define NAMESPACE EA8AE0 diff --git a/src/EB0E60.c b/src/EB0E60.c index 5d2c74f32b..5ec08693ec 100644 --- a/src/EB0E60.c +++ b/src/EB0E60.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" #define NAMESPACE EB0E60 diff --git a/src/EB1170.c b/src/EB1170.c index 9cf54c8afd..b5bb066ae7 100644 --- a/src/EB1170.c +++ b/src/EB1170.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" #define NAMESPACE EB1170 diff --git a/src/EB5130.c b/src/EB5130.c index 52770ff29c..b3cf8518d9 100644 --- a/src/EB5130.c +++ b/src/EB5130.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" #define NAMESPACE EB5130 diff --git a/src/EB5470.c b/src/EB5470.c index 15053061d9..b5e14e4a18 100644 --- a/src/EB5470.c +++ b/src/EB5470.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" INCLUDE_ASM(s32, "EB5470", func_80240340_EB5470); diff --git a/src/EB7230.c b/src/EB7230.c index 0720fd2ba3..2fa6bdce78 100644 --- a/src/EB7230.c +++ b/src/EB7230.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" #define NAMESPACE EB7230 diff --git a/src/EB7540.c b/src/EB7540.c index 5479929816..05c529ba4f 100644 --- a/src/EB7540.c +++ b/src/EB7540.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" INCLUDE_ASM(s32, "EB7540", func_80240310_EB7540); diff --git a/src/EB8E50.c b/src/EB8E50.c index 789c17438a..2f74eeb41a 100644 --- a/src/EB8E50.c +++ b/src/EB8E50.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" const char ascii_EC2000[] = "mac_01"; diff --git a/src/EB8E90.c b/src/EB8E90.c index 42164ccff8..83a7931fbf 100644 --- a/src/EB8E90.c +++ b/src/EB8E90.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" #define NAMESPACE EB8E90 diff --git a/src/EB9D90.c b/src/EB9D90.c index 276e299e99..c3d7610483 100644 --- a/src/EB9D90.c +++ b/src/EB9D90.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" static char* N(exit_str_0) = "flo_07"; diff --git a/src/EC2200.c b/src/EC2200.c index 33113e55ee..32dff8b4ab 100644 --- a/src/EC2200.c +++ b/src/EC2200.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" #define NAMESPACE EC2200 diff --git a/src/EC2240.c b/src/EC2240.c index fafe402134..872b28975a 100644 --- a/src/EC2240.c +++ b/src/EC2240.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" #define NAMESPACE EC2240 diff --git a/src/EC2610.c b/src/EC2610.c index 50190ddf58..0083de50e1 100644 --- a/src/EC2610.c +++ b/src/EC2610.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" #define NAMESPACE EC2610 diff --git a/src/EC71B0.c b/src/EC71B0.c index 345f42333b..7e1021f7b0 100644 --- a/src/EC71B0.c +++ b/src/EC71B0.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" #define NAMESPACE EC71B0 diff --git a/src/EC7590.c b/src/EC7590.c index 8022c7a1bf..6f92d36ad8 100644 --- a/src/EC7590.c +++ b/src/EC7590.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" #define NAMESPACE EC7590 diff --git a/src/EC9D00.c b/src/EC9D00.c index 4b02ac7ba4..0e2f936dcc 100644 --- a/src/EC9D00.c +++ b/src/EC9D00.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" #define NAMESPACE EC9D00 diff --git a/src/ECAA40.c b/src/ECAA40.c index dcb1e90996..138bc712d1 100644 --- a/src/ECAA40.c +++ b/src/ECAA40.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" #define NAMESPACE ECAA40 diff --git a/src/ECAA80.c b/src/ECAA80.c index 4beb2153b8..b70c58ff8a 100644 --- a/src/ECAA80.c +++ b/src/ECAA80.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" INCLUDE_ASM(s32, "ECAA80", func_80240D80_ECAA80); diff --git a/src/ECB930.c b/src/ECB930.c index 377f7bd6f6..54b5c668e7 100644 --- a/src/ECB930.c +++ b/src/ECB930.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" #define NAMESPACE ECB930 diff --git a/src/ECBB70.c b/src/ECBB70.c index 801890bb2b..7a00471e22 100644 --- a/src/ECBB70.c +++ b/src/ECBB70.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" INCLUDE_ASM(s32, "ECBB70", func_80241E70_ECBB70); diff --git a/src/ECFFF0.c b/src/ECFFF0.c index c811e194c8..dfe137ae3b 100644 --- a/src/ECFFF0.c +++ b/src/ECFFF0.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" #define NAMESPACE ECFFF0 diff --git a/src/ED0030.c b/src/ED0030.c index 4778580efa..64f8815baf 100644 --- a/src/ED0030.c +++ b/src/ED0030.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" INCLUDE_ASM(s32, "ED0030", func_80240040_ED0030); diff --git a/src/ED00D0.c b/src/ED00D0.c index 656d7bb8ec..f601168954 100644 --- a/src/ED00D0.c +++ b/src/ED00D0.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" #define NAMESPACE ED00D0 diff --git a/src/ED0310.c b/src/ED0310.c index db4047219d..f64e2a7f1a 100644 --- a/src/ED0310.c +++ b/src/ED0310.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" #define NAMESPACE ED0310 diff --git a/src/ED4220.c b/src/ED4220.c index 13af97594c..a3c5ad3b97 100644 --- a/src/ED4220.c +++ b/src/ED4220.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" INCLUDE_ASM(s32, "ED4220", func_80240000_ED4220); diff --git a/src/ED4260.c b/src/ED4260.c index 7bacf87e9a..1885564946 100644 --- a/src/ED4260.c +++ b/src/ED4260.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" #define NAMESPACE ED4260 diff --git a/src/ED42A0.c b/src/ED42A0.c index 2a958500ad..4201933370 100644 --- a/src/ED42A0.c +++ b/src/ED42A0.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" #define NAMESPACE ED42A0 diff --git a/src/ED46D0.c b/src/ED46D0.c index dd9aad7281..821bc6898f 100644 --- a/src/ED46D0.c +++ b/src/ED46D0.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" INCLUDE_ASM(s32, "ED46D0", func_802404B0_ED46D0); diff --git a/src/ED5540.c b/src/ED5540.c index 5aeed5dcbf..fff68d8682 100644 --- a/src/ED5540.c +++ b/src/ED5540.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" #define NAMESPACE ED5540 diff --git a/src/ED8E20.c b/src/ED8E20.c index 16e018f632..2dbb5af8bc 100644 --- a/src/ED8E20.c +++ b/src/ED8E20.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" INCLUDE_ASM(s32, "ED8E20", func_80240000_ED8E20); diff --git a/src/EDBFE0.c b/src/EDBFE0.c index 48a6663949..af26a400e6 100644 --- a/src/EDBFE0.c +++ b/src/EDBFE0.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" INCLUDE_ASM(s32, "EDBFE0", func_80240000_EDBFE0); diff --git a/src/EDC020.c b/src/EDC020.c index c9ce5cb4b1..c9405c2b8d 100644 --- a/src/EDC020.c +++ b/src/EDC020.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" #define NAMESPACE EDC020 diff --git a/src/EDE9C0.c b/src/EDE9C0.c index d9ed8b66d9..6c6ae8aae0 100644 --- a/src/EDE9C0.c +++ b/src/EDE9C0.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" INCLUDE_ASM(s32, "EDE9C0", func_80240000_EDE9C0); diff --git a/src/EDEA00.c b/src/EDEA00.c index cca1d874ed..468ef14c50 100644 --- a/src/EDEA00.c +++ b/src/EDEA00.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" #define NAMESPACE EDEA00 diff --git a/src/EE2040.c b/src/EE2040.c index 4ff9ea96dd..5833531fed 100644 --- a/src/EE2040.c +++ b/src/EE2040.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" INCLUDE_ASM(s32, "EE2040", func_80243680_EE2040); diff --git a/src/EE65B0.c b/src/EE65B0.c index b1eea3131f..d65bb44225 100644 --- a/src/EE65B0.c +++ b/src/EE65B0.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" #define NAMESPACE EE65B0 diff --git a/src/EE70C0.c b/src/EE70C0.c index ecba4d01ca..4191a371fe 100644 --- a/src/EE70C0.c +++ b/src/EE70C0.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" #define NAMESPACE EE70C0 diff --git a/src/EE8940.c b/src/EE8940.c index 73c79c2743..7cccb5adca 100644 --- a/src/EE8940.c +++ b/src/EE8940.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" INCLUDE_ASM(s32, "EE8940", func_80242390_EE8940); diff --git a/src/EED100.c b/src/EED100.c index 48bbb27cc5..9a853104b7 100644 --- a/src/EED100.c +++ b/src/EED100.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" #define NAMESPACE EED100 diff --git a/src/EED140.c b/src/EED140.c index 1eb4a256e0..96117ce112 100644 --- a/src/EED140.c +++ b/src/EED140.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" INCLUDE_ASM(s32, "EED140", func_80240040_EED140); diff --git a/src/EED1E0.c b/src/EED1E0.c index 219e729feb..31971de1b1 100644 --- a/src/EED1E0.c +++ b/src/EED1E0.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" #define NAMESPACE EED1E0 diff --git a/src/EEDF50.c b/src/EEDF50.c index 08bf6e3aef..25ba92e1f5 100644 --- a/src/EEDF50.c +++ b/src/EEDF50.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" #define NAMESPACE EEDF50 diff --git a/src/EEFAA0.c b/src/EEFAA0.c index bbf1cf9198..c1275aaca7 100644 --- a/src/EEFAA0.c +++ b/src/EEFAA0.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" INCLUDE_ASM(s32, "EEFAA0", func_802429A0_EEFAA0); diff --git a/src/EF2610.c b/src/EF2610.c index 5c6f9588d3..4a1bd8d37b 100644 --- a/src/EF2610.c +++ b/src/EF2610.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" #define NAMESPACE EF2610 diff --git a/src/EF2650.c b/src/EF2650.c index b5edd95b6e..9599bf39c4 100644 --- a/src/EF2650.c +++ b/src/EF2650.c @@ -1,8 +1,9 @@ +#include "dead.h" #include "common.h" extern s16 D_80169B16; ApiStatus func_80240040_EF2650(Evt* script, s32 isInitialCall) { - dead_set_variable(script, *script->ptrReadPos, D_80169B16); + set_variable(script, *script->ptrReadPos, D_80169B16); return ApiStatus_DONE2; } diff --git a/src/EF2680.c b/src/EF2680.c index 6b420ffe3b..a0ffa75b7c 100644 --- a/src/EF2680.c +++ b/src/EF2680.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" #define NAMESPACE EF2680 diff --git a/src/EF7A80.c b/src/EF7A80.c index 9a66765a39..13f352984d 100644 --- a/src/EF7A80.c +++ b/src/EF7A80.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" #define NAMESPACE EF7A80 diff --git a/src/EF7FB0.c b/src/EF7FB0.c index a499c6af48..bcb7732ad3 100644 --- a/src/EF7FB0.c +++ b/src/EF7FB0.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" INCLUDE_ASM(s32, "EF7FB0", func_80240530_EF7FB0); diff --git a/src/EF8010.c b/src/EF8010.c index 18e7aaef55..6c7c54fa5d 100644 --- a/src/EF8010.c +++ b/src/EF8010.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" #define NAMESPACE EF8010 diff --git a/src/EFEB00.c b/src/EFEB00.c index a34a79c45d..276d29e638 100644 --- a/src/EFEB00.c +++ b/src/EFEB00.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" #define NAMESPACE EFEB00 diff --git a/src/common/DeadUnkFloatFunc.inc.c b/src/common/DeadUnkFloatFunc.inc.c index 9e83ad90f6..18d07bb7a3 100644 --- a/src/common/DeadUnkFloatFunc.inc.c +++ b/src/common/DeadUnkFloatFunc.inc.c @@ -4,21 +4,21 @@ ApiStatus N(DeadUnkFloatFunc)(Evt* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; s32 a1 = *args++; - s32 var0 = dead_get_variable(script, a1); + s32 var0 = get_variable(script, a1); s32 a2 = *args++; - f32 var1 = dead_get_float_variable(script, *args++); - f32 var2 = dead_get_float_variable(script, *args++); - s32 var3 = dead_get_variable(script, *args++); - s32 var4 = dead_get_variable(script, *args++); - f32 temp = (dead_get_float_variable(script, *args++) / 180.0f) * PI; + f32 var1 = get_float_variable(script, *args++); + f32 var2 = get_float_variable(script, *args++); + s32 var3 = get_variable(script, *args++); + s32 var4 = get_variable(script, *args++); + f32 temp = (get_float_variable(script, *args++) / 180.0f) * PI; f32 diff = (var2 - var1) / 2; if (var4 != 0 && var3 < var0) { var0 = var3; - dead_set_variable(script, a1, var3); + set_variable(script, a1, var3); } - dead_set_float_variable(script, a2, (var1 + diff) - (diff * dead_cos_rad(((var0 * PI) / var3) + temp))); + set_float_variable(script, a2, (var1 + diff) - (diff * cos_rad(((var0 * PI) / var3) + temp))); return ApiStatus_DONE2; } diff --git a/src/common/DeadUnkFloatFuncAbs.inc.c b/src/common/DeadUnkFloatFuncAbs.inc.c index 497aa70117..0f104239b0 100644 --- a/src/common/DeadUnkFloatFuncAbs.inc.c +++ b/src/common/DeadUnkFloatFuncAbs.inc.c @@ -5,21 +5,21 @@ ApiStatus N(DeadUnkFloatFuncAbs)(Evt* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; s32 a1 = *args++; - s32 var0 = dead_get_variable(script, a1); + s32 var0 = get_variable(script, a1); s32 a2 = *args++; - f32 var1 = dead_get_float_variable(script, *args++); - f32 var2 = dead_get_float_variable(script, *args++); - s32 var3 = dead_get_variable(script, *args++); - s32 var4 = dead_get_variable(script, *args++); - f32 temp = (dead_get_float_variable(script, *args++) / 180.0f) * PI; + f32 var1 = get_float_variable(script, *args++); + f32 var2 = get_float_variable(script, *args++); + s32 var3 = get_variable(script, *args++); + s32 var4 = get_variable(script, *args++); + f32 temp = (get_float_variable(script, *args++) / 180.0f) * PI; f32 diff = fabsf(var2 - var1) / 2; if (var4 != 0 && var3 < var0) { var0 = var3; - dead_set_variable(script, a1, var3); + set_variable(script, a1, var3); } - dead_set_float_variable(script, a2, (var1 + diff) - (diff * dead_cos_rad(((var0 * PI) / var3) + temp))); + set_float_variable(script, a2, (var1 + diff) - (diff * cos_rad(((var0 * PI) / var3) + temp))); return ApiStatus_DONE2; } diff --git a/src/world/common/DeadFoliage.inc.c b/src/world/common/DeadFoliage.inc.c index 47dafc8b2d..f503f6b034 100644 --- a/src/world/common/DeadFoliage.inc.c +++ b/src/world/common/DeadFoliage.inc.c @@ -1,7 +1,7 @@ #include "common.h" #include "map.h" -void N(dead_foliage_setup_shear_mtx)(Matrix4f mtx, f32 scale, f32 xAmount, f32 zAmount) { +void N(foliage_setup_shear_mtx)(Matrix4f mtx, f32 scale, f32 xAmount, f32 zAmount) { osGetCause(mtx); mtx[1][0] = scale * xAmount; mtx[1][1] = 1.0f; @@ -10,17 +10,17 @@ void N(dead_foliage_setup_shear_mtx)(Matrix4f mtx, f32 scale, f32 xAmount, f32 z ApiStatus N(DeadTransformFoliage)(Evt* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; - s32 modelListIndex = func_80125270(dead_get_variable(script, *args++)); - f32 scale = dead_get_float_variable(script, *args++); - f32 dx = dead_get_float_variable(script, *args++); - f32 dy = dead_get_float_variable(script, *args++); - f32 dz = dead_get_float_variable(script, *args++); + s32 modelListIndex = func_80125270(get_variable(script, *args++)); + f32 scale = get_float_variable(script, *args++); + f32 dx = get_float_variable(script, *args++); + f32 dy = get_float_variable(script, *args++); + f32 dz = get_float_variable(script, *args++); Model* model = func_80124F44(modelListIndex); Matrix4f mtx; if (!(model->flags & 0x400)) { func_8006CAC0(model->transformMatrix, 0.0f, dy, 0.0f); - N(dead_foliage_setup_shear_mtx)(mtx, scale, dx, dz); + N(foliage_setup_shear_mtx)(mtx, scale, dx, dz); osSiRawReadIo(mtx, model->transformMatrix, model->transformMatrix); func_8006CAC0(mtx, 0.0f, -dy, 0.0f); osSiRawReadIo(mtx, model->transformMatrix, model->transformMatrix); @@ -28,7 +28,7 @@ ApiStatus N(DeadTransformFoliage)(Evt* script, s32 isInitialCall) { } else { func_8006CAC0(mtx, 0.0f, dy, 0.0f); osSiRawReadIo(mtx, model->transformMatrix, model->transformMatrix); - N(dead_foliage_setup_shear_mtx)(mtx, scale, dx, dz); + N(foliage_setup_shear_mtx)(mtx, scale, dx, dz); osSiRawReadIo(mtx, model->transformMatrix, model->transformMatrix); func_8006CAC0(mtx, 0.0f, -dy, 0.0f); osSiRawReadIo(mtx, model->transformMatrix, model->transformMatrix); diff --git a/src/world/common/DeadGetItemName.inc.c b/src/world/common/DeadGetItemName.inc.c index 2b6530fc55..6530a6b63d 100644 --- a/src/world/common/DeadGetItemName.inc.c +++ b/src/world/common/DeadGetItemName.inc.c @@ -3,8 +3,8 @@ ApiStatus N(DeadGetItemName)(Evt* script, s32 isInitialCall) { Bytecode args = *script->ptrReadPos; - s32 itemID = dead_get_variable(script, args); + s32 itemID = get_variable(script, args); - dead_set_variable(script, args, DEAD_LOOKUP_ITEM(itemID).nameString); + set_variable(script, args, LOOKUP_ITEM(itemID).nameString); return ApiStatus_DONE2; } diff --git a/src/world/common/DeadUnkNpcAIFunc1.inc.c b/src/world/common/DeadUnkNpcAIFunc1.inc.c index 9484bbcb7f..44d5c013e3 100644 --- a/src/world/common/DeadUnkNpcAIFunc1.inc.c +++ b/src/world/common/DeadUnkNpcAIFunc1.inc.c @@ -3,10 +3,10 @@ void N(DeadUnkNpcAIFunc1)(Evt* script, NpcAISettings* aiSettings, EnemyTerritoryThing* territory) { Enemy* enemy = script->owner1.enemy; - Npc* npc = dead_get_npc_unsafe(enemy->npcID); + Npc* npc = get_npc_unsafe(enemy->npcID); - npc->duration = (aiSettings->waitTime / 2) + dead_rand_int((aiSettings->waitTime / 2) + 1); - npc->yaw = dead_clamp_angle(npc->yaw + dead_rand_int(180) - 90.0f); + npc->duration = (aiSettings->waitTime / 2) + rand_int((aiSettings->waitTime / 2) + 1); + npc->yaw = clamp_angle(npc->yaw + rand_int(180) - 90.0f); npc->currentAnim.w = *enemy->animList; script->functionTemp[0] = 3; } diff --git a/src/world/common/DeadUnkNpcAIFunc14.inc.c b/src/world/common/DeadUnkNpcAIFunc14.inc.c index e4c067ba17..d5de691778 100644 --- a/src/world/common/DeadUnkNpcAIFunc14.inc.c +++ b/src/world/common/DeadUnkNpcAIFunc14.inc.c @@ -3,7 +3,7 @@ void N(DeadUnkNpcAIFunc14)(Evt* script, NpcAISettings* aiSettings) { Enemy* enemy = script->owner1.enemy; - Npc* npc = dead_get_npc_unsafe(enemy->npcID); + Npc* npc = get_npc_unsafe(enemy->npcID); f32 vt5 = enemy->varTable[5]; f32 jumpVelocity = vt5 / 100.0; f32 vt6 = enemy->varTable[6]; @@ -13,7 +13,7 @@ void N(DeadUnkNpcAIFunc14)(Evt* script, NpcAISettings* aiSettings) { npc->jumpVelocity = jumpVelocity; npc->jumpScale = jumpScale; npc->moveSpeed = aiSettings->chaseSpeed; - npc->yaw = dead_atan2(npc->pos.x, npc->pos.z, dead_gPlayerStatusPtr->position.x, dead_gPlayerStatusPtr->position.z); + npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); enemy->varTable[2] = 0; diff --git a/src/world/common/DeadUnkPartnerPosFuncs.inc.c b/src/world/common/DeadUnkPartnerPosFuncs.inc.c index 394eedc8ab..ecf57997fd 100644 --- a/src/world/common/DeadUnkPartnerPosFuncs.inc.c +++ b/src/world/common/DeadUnkPartnerPosFuncs.inc.c @@ -1,15 +1,16 @@ #include "common.h" +#include "effects.h" ApiStatus N(DeadUnkPartnerPosFunc)(Evt* script, s32 isInitialCall) { Npc* partner = func_8003E534(NPC_PARTNER); - dead_playFX_11(2, partner->pos.x, partner->pos.y + 30.0f, partner->pos.z, 30.0f); + playFX_11(2, partner->pos.x, partner->pos.y + 30.0f, partner->pos.z, 30.0f); return ApiStatus_DONE2; } ApiStatus N(DeadUnkPartnerPosFunc2)(Evt* script, s32 isInitialCall) { Npc* partner = func_8003E534(NPC_PARTNER); - dead_playFX_11(4, partner->pos.x, partner->pos.y + 30.0f, partner->pos.z, 30.0f); + playFX_11(4, partner->pos.x, partner->pos.y + 30.0f, partner->pos.z, 30.0f); return ApiStatus_DONE2; } diff --git a/src/world/common/DeadUnkTexturePanFunc.inc.c b/src/world/common/DeadUnkTexturePanFunc.inc.c index bfe8cb4a71..c0149704a8 100644 --- a/src/world/common/DeadUnkTexturePanFunc.inc.c +++ b/src/world/common/DeadUnkTexturePanFunc.inc.c @@ -1,3 +1,4 @@ +#include "dead.h" #include "common.h" #include "map.h" @@ -30,9 +31,9 @@ ApiStatus N(DeadUnkTexturePanFunc)(Evt* script, s32 isInitialCall) { script->varTable[12] -= 0x20000; } - dead_set_main_pan_u(script->varTable[0], script->varTable[9]); - dead_set_main_pan_v(script->varTable[0], script->varTable[10]); - dead_set_aux_pan_u(script->varTable[0], script->varTable[11]); - dead_set_aux_pan_v(script->varTable[0], script->varTable[12]); + set_main_pan_u(script->varTable[0], script->varTable[9]); + set_main_pan_v(script->varTable[0], script->varTable[10]); + set_aux_pan_u(script->varTable[0], script->varTable[11]); + set_aux_pan_v(script->varTable[0], script->varTable[12]); return ApiStatus_BLOCK; } diff --git a/src/world/common/DeadUnkTexturePanFunc2.inc.c b/src/world/common/DeadUnkTexturePanFunc2.inc.c index 77d7943712..08985071b5 100644 --- a/src/world/common/DeadUnkTexturePanFunc2.inc.c +++ b/src/world/common/DeadUnkTexturePanFunc2.inc.c @@ -45,10 +45,10 @@ ApiStatus N(DeadUnkTexturePanFunc2)(Evt* script, s32 isInitialCall) { } } - dead_set_main_pan_u(script->varTable[0], script->varTable[9]); - dead_set_main_pan_v(script->varTable[0], script->varTable[10]); - dead_set_aux_pan_u(script->varTable[0], script->varTable[11]); - dead_set_aux_pan_v(script->varTable[0], script->varTable[12]); + set_main_pan_u(script->varTable[0], script->varTable[9]); + set_main_pan_v(script->varTable[0], script->varTable[10]); + set_aux_pan_u(script->varTable[0], script->varTable[11]); + set_aux_pan_v(script->varTable[0], script->varTable[12]); script->functionTemp[0]++; script->functionTemp[1]++;