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
.4byte \ptr
.endm
.macro metalburstdamagecalculator ptr:req
.macro callnative func:req
.byte 0xff
.4byte \ptr
.4byte \func
.endm
@ various command changed to more readable macros
.macro metalburstdamagecalculator ptr:req
callnative BS_CalcMetalBurstDmg
.4byte \ptr
.endm
.macro cancelmultiturnmoves battler:req
various \battler, VARIOUS_CANCEL_MULTI_TURN_MOVES
.endm

View File

@ -574,7 +574,7 @@ static void Cmd_averagestats(void);
static void Cmd_jumpifoppositegenders(void);
static void Cmd_unused(void);
static void Cmd_tryworryseed(void);
static void Cmd_metalburstdamagecalculator(void);
static void Cmd_callnative(void);
void (* const gBattleScriptingCommandsTable[])(void) =
{
@ -833,7 +833,7 @@ void (* const gBattleScriptingCommandsTable[])(void) =
Cmd_jumpifoppositegenders, //0xFC
Cmd_unused, //0xFD
Cmd_tryworryseed, //0xFE
Cmd_metalburstdamagecalculator, //0xFF
Cmd_callnative, //0xFF
};
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 sideTarget = 0;
@ -14759,7 +14766,7 @@ static void Cmd_metalburstdamagecalculator(void)
else
gBattlerTarget = gProtectStructs[gBattlerAttacker].physicalBattlerId;
gBattlescriptCurrInstr += 5;
gBattlescriptCurrInstr += 9;
}
else if (gProtectStructs[gBattlerAttacker].specialDmg
&& sideAttacker != (sideTarget = GetBattlerSide(gProtectStructs[gBattlerAttacker].specialBattlerId))
@ -14772,12 +14779,12 @@ static void Cmd_metalburstdamagecalculator(void)
else
gBattlerTarget = gProtectStructs[gBattlerAttacker].specialBattlerId;
gBattlescriptCurrInstr += 5;
gBattlescriptCurrInstr += 9;
}
else
{
gSpecialStatuses[gBattlerAttacker].ppNotAffectedByPressure = TRUE;
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 5);
}
}