diff --git a/src/190B20.c b/src/190B20.c index d4219d8210..a3142cf5d7 100644 --- a/src/190B20.c +++ b/src/190B20.c @@ -1388,42 +1388,42 @@ void btl_init_menu_hammer(void) { hasAnyBadgeMoves = FALSE; for (i = 0; i < battleStatus->submenuMoveCount; i++) { - move = &gMoveTable[battleStatus->submenuMoves[i]]; + move = &gMoveTable[battleStatus->submenuMoves[i]]; - // Calculate FP cost - fpCost = move->costFP; - if (fpCost != 0) { - fpCost -= player_team_is_ability_active(player, ABILITY_FLOWER_SAVER); - fpCost -= player_team_is_ability_active(player, ABILITY_FLOWER_FANATIC) * 2; - if (fpCost < 1) { - fpCost = 1; - } + // Calculate FP cost + fpCost = move->costFP; + if (fpCost != 0) { + fpCost -= player_team_is_ability_active(player, ABILITY_FLOWER_SAVER); + fpCost -= player_team_is_ability_active(player, ABILITY_FLOWER_FANATIC) * 2; + if (fpCost < 1) { + fpCost = 1; } + } - // See if there are any targets for this move - battleStatus->moveCategory = 1; - battleStatus->selectedItemID = playerData->hammerLevel; - battleStatus->currentTargetListFlags = move->flags; - player_create_target_list(player); + // See if there are any targets for this move + battleStatus->moveCategory = 1; + battleStatus->selectedItemID = playerData->hammerLevel; + battleStatus->currentTargetListFlags = move->flags; + player_create_target_list(player); - // If there are targets, enable the move - if (player->targetListLength != 0) { - hasAnyBadgeMoves = TRUE; - battleStatus->submenuStatus[i] = 1; - } + // If there are targets, enable the move + if (player->targetListLength != 0) { + hasAnyBadgeMoves = TRUE; + battleStatus->submenuStatus[i] = 1; + } - // If you don't have enough FP, disable the move - if (playerData->curFP < fpCost) { - battleStatus->submenuStatus[i] = 0; - } + // If you don't have enough FP, disable the move + if (playerData->curFP < fpCost) { + battleStatus->submenuStatus[i] = 0; + } - // If there are no targets available, disable the move - if (player->targetListLength == 0) { - battleStatus->submenuStatus[i] = BATTLE_SUBMENU_STATUS_NO_TARGETS_2; - } - if (gBattleStatus.flags2 & BS_FLAGS2_NO_TARGET_AVAILABLE) { - battleStatus->submenuStatus[moveCount] = BATTLE_SUBMENU_STATUS_NO_TARGETS; - } + // If there are no targets available, disable the move + if (player->targetListLength == 0) { + battleStatus->submenuStatus[i] = BATTLE_SUBMENU_STATUS_NO_TARGETS_2; + } + if (gBattleStatus.flags2 & BS_FLAGS2_NO_TARGET_AVAILABLE) { + battleStatus->submenuStatus[moveCount] = BATTLE_SUBMENU_STATUS_NO_TARGETS; + } } if (!hasAnyBadgeMoves) { @@ -1478,38 +1478,37 @@ void btl_init_menu_partner(void) { hasAnyBadgeMoves = FALSE; for (i = 0; i < battleStatus->submenuMoveCount; i++){ - StaticMove* move = &gMoveTable[battleStatus->submenuMoves[i]]; + StaticMove* move = &gMoveTable[battleStatus->submenuMoves[i]]; - fpCost = move->costFP; - if (fpCost != 0) { - fpCost -= player_team_is_ability_active(player, ABILITY_FLOWER_SAVER); - fpCost -= player_team_is_ability_active(player, ABILITY_FLOWER_FANATIC) * 2; - if (fpCost < 1) { - fpCost = 1; - } + fpCost = move->costFP; + if (fpCost != 0) { + fpCost -= player_team_is_ability_active(player, ABILITY_FLOWER_SAVER); + fpCost -= player_team_is_ability_active(player, ABILITY_FLOWER_FANATIC) * 2; + if (fpCost < 1) { + fpCost = 1; } + } - battleStatus->moveCategory = 5; - battleStatus->selectedItemID = partner->staticActorData->level; - battleStatus->currentTargetListFlags = move->flags; - player_create_target_list(partner); + battleStatus->moveCategory = 5; + battleStatus->selectedItemID = partner->staticActorData->level; + battleStatus->currentTargetListFlags = move->flags; + player_create_target_list(partner); - if (partner->targetListLength != 0){ - hasAnyBadgeMoves = TRUE; - battleStatus->submenuStatus[i] = BATTLE_SUBMENU_STATUS_ENABLED; - } + if (partner->targetListLength != 0){ + hasAnyBadgeMoves = TRUE; + battleStatus->submenuStatus[i] = BATTLE_SUBMENU_STATUS_ENABLED; + } - if (partner->targetListLength == 0) { - battleStatus->submenuStatus[i] = BATTLE_SUBMENU_STATUS_NO_TARGETS_2; - } - - if (playerData->curFP < fpCost) { - battleStatus->submenuStatus[i] = BATTLE_SUBMENU_STATUS_NOT_ENOUGH_FP; - } - if (gBattleStatus.flags2 & BS_FLAGS2_NO_TARGET_AVAILABLE) { - battleStatus->submenuStatus[i] = BATTLE_SUBMENU_STATUS_NO_TARGETS; - } + if (partner->targetListLength == 0) { + battleStatus->submenuStatus[i] = BATTLE_SUBMENU_STATUS_NO_TARGETS_2; + } + if (playerData->curFP < fpCost) { + battleStatus->submenuStatus[i] = BATTLE_SUBMENU_STATUS_NOT_ENOUGH_FP; + } + if (gBattleStatus.flags2 & BS_FLAGS2_NO_TARGET_AVAILABLE) { + battleStatus->submenuStatus[i] = BATTLE_SUBMENU_STATUS_NO_TARGETS; + } } if (!hasAnyBadgeMoves) { diff --git a/src/os/coss.c b/src/os/coss.c index d939fcf22f..9bc74e462e 100644 --- a/src/os/coss.c +++ b/src/os/coss.c @@ -1,9 +1,10 @@ #include "common.h" +#include "include_asm_libultra.h" #ifndef KMC_ASM s16 coss(u16 angle) { return sins(angle + 0x4000); } #else -INCLUDE_ASM_LIBULTRA(s16, "coss", coss, u16 angle); +INCLUDE_ASM_LIBULTRA("coss", coss); #endif diff --git a/src/os/guFrustum.c b/src/os/guFrustum.c index 315f9aa9ea..47079a57a8 100644 --- a/src/os/guFrustum.c +++ b/src/os/guFrustum.c @@ -1,4 +1,5 @@ #include "common.h" +#include "include_asm_libultra.h" #ifndef KMC_ASM void guFrustumF(Matrix4f mf, f32 l, f32 r, f32 b, f32 t, f32 n, f32 f, f32 scale) { @@ -22,8 +23,7 @@ void guFrustumF(Matrix4f mf, f32 l, f32 r, f32 b, f32 t, f32 n, f32 f, f32 scale } } #else -INCLUDE_ASM_LIBULTRA(void, "guFrustum", guFrustumF, Matrix4f mf, f32 l, f32 r, f32 b, f32 t, f32 n, - f32 f, f32 scale); +INCLUDE_ASM_LIBULTRA("guFrustum", guFrustumF); #endif #ifndef KMC_ASM @@ -35,7 +35,6 @@ void guFrustum(Mtx* m, f32 l, f32 r, f32 b, f32 t, f32 n, f32 f, f32 scale) { guMtxF2L(mf, m); } #else -INCLUDE_ASM_LIBULTRA(void, "guFrustum", guFrustum, Mtx* m, f32 l, f32 r, f32 b, f32 t, f32 n, f32 f, - f32 scale); +INCLUDE_ASM_LIBULTRA("guFrustum", guFrustum); #endif diff --git a/src/os/guLookAt.c b/src/os/guLookAt.c index e052bbfd36..4ea080790f 100644 --- a/src/os/guLookAt.c +++ b/src/os/guLookAt.c @@ -1,4 +1,5 @@ #include "common.h" +#include "include_asm_libultra.h" #ifndef KMC_ASM void guLookAtF(Matrix4f mf, f32 xEye, f32 yEye, f32 zEye, f32 xAt, f32 yAt, f32 zAt, @@ -56,8 +57,7 @@ void guLookAtF(Matrix4f mf, f32 xEye, f32 yEye, f32 zEye, f32 xAt, f32 yAt, f32 mf[3][3] = 1; } #else -INCLUDE_ASM_LIBULTRA(void, "guLookAt", guLookAtF, f32 mf[4][4], f32 xEye, f32 yEye, f32 zEye, f32 xAt, - f32 yAt, f32 zAt, f32 xUp, f32 yUp, f32 zUp); +INCLUDE_ASM_LIBULTRA("guLookAt", guLookAtF); #endif #ifndef KMC_ASM @@ -70,6 +70,5 @@ void guLookAt (Mtx *m, f32 xEye, f32 yEye, f32 zEye, f32 xAt, f32 yAt, f32 zAt, guMtxF2L(mf, m); } #else -INCLUDE_ASM_LIBULTRA(void, "guLookAt", guLookAt, Mtx* m, f32 xEye, f32 yEye, f32 zEye, f32 xAt, f32 yAt, - f32 zAt, f32 xUp, f32 yUp, f32 zUp); +INCLUDE_ASM_LIBULTRA("guLookAt", guLookAt); #endif diff --git a/src/os/lookathil.c b/src/os/lookathil.c index f030869dc3..8dc47cb3c1 100644 --- a/src/os/lookathil.c +++ b/src/os/lookathil.c @@ -1,4 +1,5 @@ #include "common.h" +#include "include_asm_libultra.h" #ifndef KMC_ASM void guLookAtHiliteF(Matrix4f mf, LookAt *l, Hilite *h, @@ -59,7 +60,7 @@ void guLookAtHiliteF(Matrix4f mf, LookAt *l, Hilite *h, xHilite *= len; yHilite *= len; zHilite *= len; - + h->h.x1 = twidth * 4 + (xHilite * xRight + yHilite * yRight + zHilite * zRight) * twidth * 2; h->h.y1 = theight * 4 + (xHilite * xUp + yHilite * yUp + zHilite * zUp) * theight * 2; @@ -136,10 +137,7 @@ void guLookAtHiliteF(Matrix4f mf, LookAt *l, Hilite *h, mf[3][3] = 1; } #else -INCLUDE_ASM_LIBULTRA(void, "lookathil", guLookAtHiliteF, Matrix4f mf, LookAt* l, Hilite* h, f32 xEye, - f32 yEye, - f32 zEye, f32 xAt, f32 yAt, f32 zAt, f32 xUp, f32 yUp, f32 zUp, f32 xl1, f32 yl1, - f32 zl1, f32 xl2, f32 yl2, f32 zl2, s32 twidth, s32 theight); +INCLUDE_ASM_LIBULTRA("lookathil", guLookAtHiliteF); #endif #ifndef KMC_ASM @@ -159,7 +157,5 @@ void guLookAtHilite (Mtx *m, LookAt *l, Hilite *h, guMtxF2L(mf, m); } #else -INCLUDE_ASM_LIBULTRA(void, "lookathil", guLookAtHilite, Mtx* m, LookAt* l, Hilite* h, f32 xEye, f32 yEye, - f32 zEye, f32 xAt, f32 yAt, f32 zAt, f32 xUp, f32 yUp, f32 zUp, f32 xl1, f32 yl1, - f32 zl1, f32 xl2, f32 yl2, f32 zl2, s32 twidth, s32 theight); - #endif +INCLUDE_ASM_LIBULTRA("lookathil", guLookAtHilite); +#endif diff --git a/src/os/lookatref.c b/src/os/lookatref.c index 4485a5a88e..829ca28efe 100644 --- a/src/os/lookatref.c +++ b/src/os/lookatref.c @@ -1,4 +1,5 @@ #include "common.h" +#include "include_asm_libultra.h" #ifndef KMC_ASM void guLookAtReflectF(Matrix4f mf, LookAt *l, @@ -82,8 +83,7 @@ void guLookAtReflectF(Matrix4f mf, LookAt *l, mf[3][3] = 1; } #else -INCLUDE_ASM_LIBULTRA(void, "lookatref", guLookAtReflectF, f32 mf[4][4], LookAt* l, f32 xEye, f32 yEye, - f32 zEye, f32 xAt, f32 yAt, f32 zAt, f32 xUp, f32 yUp, f32 zUp); +INCLUDE_ASM_LIBULTRA("lookatref", guLookAtReflectF); #endif #ifndef KMC_ASM @@ -97,6 +97,5 @@ void guLookAtReflect(Mtx *m, LookAt *l, f32 xEye, f32 yEye, f32 zEye, guMtxF2L(mf, m); } #else -INCLUDE_ASM_LIBULTRA(void, "lookatref", guLookAtReflect, Mtx* m, LookAt* l, f32 xEye, f32 yEye, f32 zEye, - f32 xAt, f32 yAt, f32 zAt, f32 xUp, f32 yUp, f32 zUp); +INCLUDE_ASM_LIBULTRA("lookatref", guLookAtReflect); #endif diff --git a/src/os/osJamMesg.c b/src/os/osJamMesg.c index 6595409eef..24d5d0de8e 100644 --- a/src/os/osJamMesg.c +++ b/src/os/osJamMesg.c @@ -1,4 +1,5 @@ #include "common.h" +#include "include_asm_libultra.h" #include #ifndef KMC_ASM @@ -25,5 +26,5 @@ s32 osJamMesg(OSMesgQueue *mq, OSMesg msg, s32 flag) { return 0; } #else -INCLUDE_ASM_LIBULTRA(s32, "osJamMesg", osJamMesg, OSMesgQueue *mq, OSMesg msg, s32 flag); +INCLUDE_ASM_LIBULTRA("osJamMesg", osJamMesg); #endif diff --git a/src/os/osRecvMesg.c b/src/os/osRecvMesg.c index d10174b6d2..cf8bd5cda0 100644 --- a/src/os/osRecvMesg.c +++ b/src/os/osRecvMesg.c @@ -1,4 +1,5 @@ #include "common.h" +#include "include_asm_libultra.h" #include #ifndef KMC_ASM @@ -27,6 +28,6 @@ s32 osRecvMesg(OSMesgQueue *mq, OSMesg *msg, s32 flags) { return 0; } #else -INCLUDE_ASM_LIBULTRA(s32, "osRecvMesg", osRecvMesg, OSMesgQueue* queue, OSMesg* mesg, s32 unk); +INCLUDE_ASM_LIBULTRA("osRecvMesg", osRecvMesg); #endif diff --git a/src/os/osVirtualToPhysical.c b/src/os/osVirtualToPhysical.c index 23472fb12a..d9e2f4148f 100644 --- a/src/os/osVirtualToPhysical.c +++ b/src/os/osVirtualToPhysical.c @@ -1,4 +1,5 @@ #include "common.h" +#include "include_asm_libultra.h" #ifndef KMC_ASM u32 osVirtualToPhysical(void *addr) { @@ -11,5 +12,5 @@ u32 osVirtualToPhysical(void *addr) { } } #else -INCLUDE_ASM_LIBULTRA(u32, "osVirtualToPhysical", osVirtualToPhysical, void* virt); +INCLUDE_ASM_LIBULTRA("osVirtualToPhysical", osVirtualToPhysical); #endif diff --git a/src/os/perspective.c b/src/os/perspective.c index c370184574..3538daabe9 100644 --- a/src/os/perspective.c +++ b/src/os/perspective.c @@ -1,4 +1,5 @@ #include "common.h" +#include "include_asm_libultra.h" #ifndef KMC_ASM void guPerspectiveF(Matrix4f mf, u16 *perspNorm, f32 fovy, f32 aspect, f32 near, f32 far, f32 scale) { @@ -35,8 +36,7 @@ void guPerspectiveF(Matrix4f mf, u16 *perspNorm, f32 fovy, f32 aspect, f32 near, } } #else -INCLUDE_ASM_LIBULTRA(void, "perspective", guPerspectiveF, Matrix4f mf, u16* perspNorm, f32 fovy, f32 aspect, - f32 near, f32 far, f32 scale); +INCLUDE_ASM_LIBULTRA("perspective", guPerspectiveF); #endif #ifndef KMC_ASM @@ -48,6 +48,5 @@ void guPerspective(Mtx *m, u16 *perspNorm, f32 fovy, f32 aspect, f32 near, f32 f guMtxF2L(mf, m); } #else -INCLUDE_ASM_LIBULTRA(void, "perspective", guPerspective, Mtx* m, u16* perspNorm, f32 fovy, f32 aspect, - f32 near, f32 far, f32 scale); +INCLUDE_ASM_LIBULTRA("perspective", guPerspective); #endif diff --git a/src/os/position.c b/src/os/position.c index 7d48f5ce0a..b78720a757 100644 --- a/src/os/position.c +++ b/src/os/position.c @@ -1,4 +1,5 @@ #include "common.h" +#include "include_asm_libultra.h" #ifndef KMC_ASM void guPositionF(Matrix4f mf, f32 r, f32 p, f32 h, f32 s, f32 x, f32 y, f32 z) { @@ -37,8 +38,8 @@ void guPositionF(Matrix4f mf, f32 r, f32 p, f32 h, f32 s, f32 x, f32 y, f32 z) { mf[3][3] = 1.0; } #else -INCLUDE_ASM_LIBULTRA(void, "3f310_len_3c0", guPositionF, f32 mf[4][4], f32 r, f32 p, f32 h, f32 s, f32 x, - f32 y, f32 z); +static f32 dtor = 3.1415926 / 180.0; +INCLUDE_ASM_LIBULTRA("position", guPositionF); #endif #ifndef KMC_ASM @@ -51,6 +52,5 @@ void guPosition(Mtx* m, f32 r, f32 p, f32 h, f32 s, guMtxF2L(mf, m); } #else -INCLUDE_ASM_LIBULTRA(void, "3f310_len_3c0", guPosition, Mtx* m, f32 r, f32 p, f32 h, f32 s, f32 x, f32 y, - f32 z); +INCLUDE_ASM_LIBULTRA("position", guPosition); #endif diff --git a/src/os/rotateRPY.c b/src/os/rotateRPY.c index d139906206..e0a0e37a17 100644 --- a/src/os/rotateRPY.c +++ b/src/os/rotateRPY.c @@ -1,4 +1,5 @@ #include "common.h" +#include "include_asm_libultra.h" #ifndef KMC_ASM void guRotateRPYF(Matrix4f mf, f32 r, f32 p, f32 h) { @@ -31,7 +32,8 @@ void guRotateRPYF(Matrix4f mf, f32 r, f32 p, f32 h) { mf[2][2] = cosr * cosp; } #else -INCLUDE_ASM_LIBULTRA(void, "3f6d0_len_320", guRotateRPYF, f32 mf[4][4], f32 x, f32 y, f32 z); +static f32 dtor = 3.1415926 / 180.0; +INCLUDE_ASM_LIBULTRA("rotateRPY", guRotateRPYF); #endif #ifndef KMC_ASM @@ -43,5 +45,5 @@ void guRotateRPY(Mtx *m, f32 r, f32 p, f32 h) { guMtxF2L(mf, m); } #else -INCLUDE_ASM_LIBULTRA(void, "3f6d0_len_320", guRotateRPY, Mtx *m, f32 r, f32 p, f32 y); +INCLUDE_ASM_LIBULTRA("rotateRPY", guRotateRPY); #endif diff --git a/src/os/sendmesg.c b/src/os/sendmesg.c index 7dcb35322c..200a16ef2b 100644 --- a/src/os/sendmesg.c +++ b/src/os/sendmesg.c @@ -1,4 +1,5 @@ #include "common.h" +#include "include_asm_libultra.h" #include u32 __osPreNMI = 0; @@ -33,5 +34,5 @@ s32 osSendMesg(OSMesgQueue *mq, OSMesg msg, s32 flags) return 0; } #else -INCLUDE_ASM_LIBULTRA(s32, "40c20_len_1f0", osSendMesg, OSMesgQueue* queue, OSMesg mesg, s32 unk); +INCLUDE_ASM_LIBULTRA("sendmesg", osSendMesg); #endif diff --git a/src/os/sins.c b/src/os/sins.c index c1dd467285..206a61bcb6 100644 --- a/src/os/sins.c +++ b/src/os/sins.c @@ -1,4 +1,5 @@ #include "common.h" +#include "include_asm_libultra.h" #include "sintable.inc.c" @@ -23,5 +24,5 @@ s16 sins(u16 x) { } } #else -INCLUDE_ASM_LIBULTRA(s16, "os/sins", sins, u16 angle); +INCLUDE_ASM_LIBULTRA("sins", sins); #endif diff --git a/src/os/string.c b/src/os/string.c index 82faab393f..b5102a7c16 100644 --- a/src/os/string.c +++ b/src/os/string.c @@ -1,4 +1,5 @@ #include "common.h" +#include "include_asm_libultra.h" #ifndef KMC_ASM char* strchr(const char* s, int c) { @@ -11,7 +12,7 @@ char* strchr(const char* s, int c) { return (char *)s; } #else -INCLUDE_ASM_LIBULTRA(s32, "3fa50_len_f60", strchr); +INCLUDE_ASM_LIBULTRA("string", strchr); #endif #ifndef KMC_ASM @@ -23,7 +24,7 @@ size_t strlen(const char* s) { return sc - s; } #else -INCLUDE_ASM_LIBULTRA(s32, "3fa50_len_f60", strlen); +INCLUDE_ASM_LIBULTRA("string", strlen); #endif #ifndef KMC_ASM @@ -37,5 +38,5 @@ void* memcpy(void* s1, const void* s2, size_t n) { return (void*)s1; } #else -INCLUDE_ASM_LIBULTRA(s32, "3fa50_len_f60", memcpy); +INCLUDE_ASM_LIBULTRA("string", memcpy); #endif diff --git a/ver/us/undefined_syms.txt b/ver/us/undefined_syms.txt index 1f705828c2..e7ef617581 100644 --- a/ver/us/undefined_syms.txt +++ b/ver/us/undefined_syms.txt @@ -67,6 +67,10 @@ D_7012BC11 = 0x7012BC11; D_80026AC7 = 0x80026AC7; D_8004AA85 = 0x8004AA85; +// KMC_ASM statics +dtor = 0x80093DC0; +D_80093DD0 = 0x80093DD0; + gBackgroundImage = 0x80200000; func_80242040_8B20B0 = 0x80242040; spiked_goomba = 0x8021B0AC;