Fix KMC_ASM configure flag (#608)

Co-authored-by: Ethan Roseman <ethteck@gmail.com>
This commit is contained in:
Alex Bates 2022-01-07 15:02:56 +00:00 committed by GitHub
parent 03c60ee7c5
commit 2f86b35b63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 100 additions and 96 deletions

View File

@ -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) {

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,4 +1,5 @@
#include "common.h"
#include "include_asm_libultra.h"
#include <PR/osint.h>
#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

View File

@ -1,4 +1,5 @@
#include "common.h"
#include "include_asm_libultra.h"
#include <PR/osint.h>
#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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,4 +1,5 @@
#include "common.h"
#include "include_asm_libultra.h"
#include <PR/osint.h>
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

View File

@ -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

View File

@ -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

View File

@ -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;