add callnative bs func, convert metal burst dmg calc

This commit is contained in:
ghoulslash 2022-11-28 10:34:27 -05:00
parent 1037613b0e
commit b869b836cc
2 changed files with 21 additions and 9 deletions

View File

@ -1299,13 +1299,18 @@
.byte 0xfe .byte 0xfe
.4byte \ptr .4byte \ptr
.endm .endm
.macro metalburstdamagecalculator ptr:req .macro callnative func:req
.byte 0xff .byte 0xff
.4byte \ptr .4byte \func
.endm .endm
@ various command changed to more readable macros @ various command changed to more readable macros
.macro metalburstdamagecalculator ptr:req
callnative BS_CalcMetalBurstDmg
.4byte \ptr
.endm
.macro cancelmultiturnmoves battler:req .macro cancelmultiturnmoves battler:req
various \battler, VARIOUS_CANCEL_MULTI_TURN_MOVES various \battler, VARIOUS_CANCEL_MULTI_TURN_MOVES
.endm .endm

View File

@ -574,7 +574,7 @@ static void Cmd_averagestats(void);
static void Cmd_jumpifoppositegenders(void); static void Cmd_jumpifoppositegenders(void);
static void Cmd_unused(void); static void Cmd_unused(void);
static void Cmd_tryworryseed(void); static void Cmd_tryworryseed(void);
static void Cmd_metalburstdamagecalculator(void); static void Cmd_callnative(void);
void (* const gBattleScriptingCommandsTable[])(void) = void (* const gBattleScriptingCommandsTable[])(void) =
{ {
@ -833,7 +833,7 @@ void (* const gBattleScriptingCommandsTable[])(void) =
Cmd_jumpifoppositegenders, //0xFC Cmd_jumpifoppositegenders, //0xFC
Cmd_unused, //0xFD Cmd_unused, //0xFD
Cmd_tryworryseed, //0xFE Cmd_tryworryseed, //0xFE
Cmd_metalburstdamagecalculator, //0xFF Cmd_callnative, //0xFF
}; };
const struct StatFractions gAccuracyStageRatios[] = const struct StatFractions gAccuracyStageRatios[] =
@ -14743,7 +14743,14 @@ static void Cmd_tryworryseed(void)
} }
} }
static void Cmd_metalburstdamagecalculator(void) static void Cmd_callnative(void)
{
void (*func)() = (void *)T1_READ_PTR(gBattlescriptCurrInstr + 1);
func();
}
// Callnative Funcs
void BS_CalcMetalBurstDmg(void)
{ {
u8 sideAttacker = GetBattlerSide(gBattlerAttacker); u8 sideAttacker = GetBattlerSide(gBattlerAttacker);
u8 sideTarget = 0; u8 sideTarget = 0;
@ -14759,7 +14766,7 @@ static void Cmd_metalburstdamagecalculator(void)
else else
gBattlerTarget = gProtectStructs[gBattlerAttacker].physicalBattlerId; gBattlerTarget = gProtectStructs[gBattlerAttacker].physicalBattlerId;
gBattlescriptCurrInstr += 5; gBattlescriptCurrInstr += 9;
} }
else if (gProtectStructs[gBattlerAttacker].specialDmg else if (gProtectStructs[gBattlerAttacker].specialDmg
&& sideAttacker != (sideTarget = GetBattlerSide(gProtectStructs[gBattlerAttacker].specialBattlerId)) && sideAttacker != (sideTarget = GetBattlerSide(gProtectStructs[gBattlerAttacker].specialBattlerId))
@ -14772,12 +14779,12 @@ static void Cmd_metalburstdamagecalculator(void)
else else
gBattlerTarget = gProtectStructs[gBattlerAttacker].specialBattlerId; gBattlerTarget = gProtectStructs[gBattlerAttacker].specialBattlerId;
gBattlescriptCurrInstr += 5; gBattlescriptCurrInstr += 9;
} }
else else
{ {
gSpecialStatuses[gBattlerAttacker].ppNotAffectedByPressure = TRUE; gSpecialStatuses[gBattlerAttacker].ppNotAffectedByPressure = TRUE;
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 5);
} }
} }