make various macros

This commit is contained in:
DizzyEggg 2017-11-26 21:04:00 +01:00
parent d48392e677
commit 77a6c30bd4
3 changed files with 183 additions and 74 deletions

View File

@ -1214,6 +1214,115 @@
.byte \param0 .byte \param0
.endm .endm
@ various command changed to more readable macros
.macro cancelmultiturnmoves bank
various \bank, VARIOUS_CANCEL_MULTI_TURN_MOVES
.endm
.macro setmagiccoattarget bank
various \bank, VARIOUS_SET_MAGIC_COAT_TARGET
.endm
.macro getifcantrunfrombattle bank
various \bank, VARIOUS_IS_RUNNING_IMPOSSIBLE
.endm
.macro getmovetarget bank
various \bank, VARIOUS_GET_MOVE_TARGET
.endm
.macro various4 bank
various \bank, 4
.endm
.macro resetintrimidatetracebits bank
various \bank, VARIOUS_RESET_INTIMIDATE_TRACE_BITS
.endm
.macro updatechoicemoveonlvlup bank
various \bank, VARIOUS_UPDATE_CHOICE_MOVE_ON_LVL_UP
.endm
.macro various7 bank
various \bank, 7
.endm
.macro various8 bank
various \bank, 8
.endm
.macro various9 bank
various \bank, 9
.endm
.macro various10 bank
various \bank, 10
.endm
.macro various11 bank
various \bank, 11
.endm
.macro various12 bank
various \bank, 12
.endm
.macro forfeityesnobox bank
various \bank, VARIOUS_EMIT_YESNOBOX
.endm
.macro various14 bank
various \bank, 14
.endm
.macro various15 bank
various \bank, 15
.endm
.macro various16 bank
various \bank, 16
.endm
.macro various17 bank
various \bank, 17
.endm
.macro waitcry bank
various \bank, VARIOUS_WAIT_CRY
.endm
.macro returnopponentmon1toball bank
various \bank, VARIOUS_RETURN_OPPONENT_MON1
.endm
.macro returnopponentmon2toball bank
various \bank, VARIOUS_RETURN_OPPONENT_MON2
.endm
.macro various21 bank
various \bank, 21
.endm
.macro various22 bank
various \bank, 22
.endm
.macro various23 bank
various \bank, 23
.endm
.macro various24 bank
various \bank, 24
.endm
.macro setoutcomeonteleport bank
various \bank, VARIOUS_SET_TELEPORT_OUTCOME
.endm
.macro playtrainerdefeatbgm bank
various \bank, VARIOUS_PLAY_TRAINER_DEFEATED_MUSIC
.endm
@ helpful macros @ helpful macros
.macro setstatchanger stat, stages, down .macro setstatchanger stat, stages, down
setbyte sSTATCHANGER \stat | \stages << 4 | \down << 7 setbyte sSTATCHANGER \stat | \stages << 4 | \down << 7

View File

@ -311,7 +311,7 @@ BattleScript_EffectSleep::
goto BattleScript_MoveEnd goto BattleScript_MoveEnd
BattleScript_AlreadyAsleep:: BattleScript_AlreadyAsleep::
various ATTACKER, 0x17 various23 ATTACKER
pause 0x20 pause 0x20
printstring STRINGID_PKMNALREADYASLEEP printstring STRINGID_PKMNALREADYASLEEP
waitmessage 0x40 waitmessage 0x40
@ -724,7 +724,7 @@ BattleScript_EffectToxic::
goto BattleScript_MoveEnd goto BattleScript_MoveEnd
BattleScript_AlreadyPoisoned:: BattleScript_AlreadyPoisoned::
various ATTACKER, 0x17 various23 ATTACKER
pause 0x40 pause 0x40
printstring STRINGID_PKMNALREADYPOISONED printstring STRINGID_PKMNALREADYPOISONED
waitmessage 0x40 waitmessage 0x40
@ -772,7 +772,7 @@ BattleScript_RestCantSleep::
goto BattleScript_MoveEnd goto BattleScript_MoveEnd
BattleScript_RestIsAlreadyAsleep:: BattleScript_RestIsAlreadyAsleep::
various ATTACKER, 0x17 various23 ATTACKER
pause 0x20 pause 0x20
printstring STRINGID_PKMNALREADYASLEEP2 printstring STRINGID_PKMNALREADYASLEEP2
waitmessage 0x40 waitmessage 0x40
@ -938,7 +938,7 @@ BattleScript_EffectConfuse::
goto BattleScript_MoveEnd goto BattleScript_MoveEnd
BattleScript_AlreadyConfused:: BattleScript_AlreadyConfused::
various ATTACKER, 0x17 various23 ATTACKER
pause 0x20 pause 0x20
printstring STRINGID_PKMNALREADYCONFUSED printstring STRINGID_PKMNALREADYCONFUSED
waitmessage 0x40 waitmessage 0x40
@ -1045,7 +1045,7 @@ BattleScript_EffectParalyze::
goto BattleScript_MoveEnd goto BattleScript_MoveEnd
BattleScript_AlreadyParalyzed:: BattleScript_AlreadyParalyzed::
various ATTACKER, 0x17 various23 ATTACKER
pause 0x20 pause 0x20
printstring STRINGID_PKMNISALREADYPARALYZED printstring STRINGID_PKMNISALREADYPARALYZED
waitmessage 0x40 waitmessage 0x40
@ -1122,7 +1122,7 @@ BattleScript_SubstituteString::
waitmessage 0x40 waitmessage 0x40
goto BattleScript_MoveEnd goto BattleScript_MoveEnd
BattleScript_AlreadyHasSubstitute:: BattleScript_AlreadyHasSubstitute::
various ATTACKER, 0x17 various23 ATTACKER
pause 0x20 pause 0x20
printstring STRINGID_PKMNHASSUBSTITUTE printstring STRINGID_PKMNHASSUBSTITUTE
waitmessage 0x40 waitmessage 0x40
@ -1532,7 +1532,7 @@ BattleScript_CurseEnd::
goto BattleScript_MoveEnd goto BattleScript_MoveEnd
BattleScript_GhostCurse:: BattleScript_GhostCurse::
jumpifbytenotequal gBankAttacker, gBankTarget, BattleScript_DoGhostCurse jumpifbytenotequal gBankAttacker, gBankTarget, BattleScript_DoGhostCurse
various ATTACKER, VARIOUS_GET_MOVE_TARGET getmovetarget ATTACKER
BattleScript_DoGhostCurse:: BattleScript_DoGhostCurse::
attackcanceler attackcanceler
attackstring attackstring
@ -1951,14 +1951,14 @@ BattleScript_EffectTeleport::
attackstring attackstring
ppreduce ppreduce
jumpifword COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_TRAINER, BattleScript_ButItFailed jumpifword COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_TRAINER, BattleScript_ButItFailed
various ATTACKER, VARIOUS_IS_RUNNING_IMPOSSIBLE getifcantrunfrombattle ATTACKER
jumpifbyte EQUAL, gBattleCommunication, 0x1, BattleScript_ButItFailed jumpifbyte EQUAL, gBattleCommunication, 0x1, BattleScript_ButItFailed
jumpifbyte EQUAL, gBattleCommunication, 0x2, BattleScript_82DA382 jumpifbyte EQUAL, gBattleCommunication, 0x2, BattleScript_82DA382
attackanimation attackanimation
waitanimation waitanimation
printstring STRINGID_PKMNFLEDFROMBATTLE printstring STRINGID_PKMNFLEDFROMBATTLE
waitmessage 0x40 waitmessage 0x40
various ATTACKER, VARIOUS_SET_TELEPORT_OUTCOME setoutcomeonteleport ATTACKER
goto BattleScript_MoveEnd goto BattleScript_MoveEnd
BattleScript_EffectBeatUp:: BattleScript_EffectBeatUp::
@ -2220,7 +2220,7 @@ BattleScript_WaterVeilPrevents::
goto BattleScript_MoveEnd goto BattleScript_MoveEnd
BattleScript_AlreadyBurned:: BattleScript_AlreadyBurned::
various ATTACKER, 0x17 various23 ATTACKER
pause 0x20 pause 0x20
printstring STRINGID_PKMNALREADYHASBURN printstring STRINGID_PKMNALREADYHASBURN
waitmessage 0x40 waitmessage 0x40
@ -2638,7 +2638,7 @@ BattleScript_82DA501::
goto BattleScript_82DA4C7 goto BattleScript_82DA4C7
BattleScript_82DA50F:: BattleScript_82DA50F::
various ATTACKER, 0x17 various23 ATTACKER
pause 0x20 pause 0x20
printstring STRINGID_PKMNALREADYCONFUSED printstring STRINGID_PKMNALREADYCONFUSED
waitmessage 0x40 waitmessage 0x40
@ -2882,7 +2882,7 @@ BattleScript_82DA816::
switchhandleorder ATTACKER, 0x2 switchhandleorder ATTACKER, 0x2
jumpifbyte EQUAL, gBattleCommunication, 0x6, BattleScript_82DA8D0 jumpifbyte EQUAL, gBattleCommunication, 0x6, BattleScript_82DA8D0
atknameinbuff1 atknameinbuff1
various ATTACKER, VARIOUS_RESET_INTIMIDATE_TRACE_BITS resetintrimidatetracebits ATTACKER
hpthresholds2 ATTACKER hpthresholds2 ATTACKER
printstring STRINGID_RETURNMON printstring STRINGID_RETURNMON
switchoutabilities ATTACKER switchoutabilities ATTACKER
@ -2908,7 +2908,7 @@ BattleScript_82DA8D0::
atk62 GBANK_1 atk62 GBANK_1
switchinanim GBANK_1, 0x0 switchinanim GBANK_1, 0x0
waitstate waitstate
various ATTACKER, 0x7 various7 ATTACKER
switchineffects GBANK_1 switchineffects GBANK_1
jumpifword COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_DOUBLE, BattleScript_82DA8F5 jumpifword COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_DOUBLE, BattleScript_82DA8F5
cancelallactions cancelallactions
@ -2978,9 +2978,9 @@ BattleScript_CheckDomeDrew::
jumpifbyte EQUAL, gBattleOutcome, DREW, BattleScript_LocalBattleLostEnd_ jumpifbyte EQUAL, gBattleOutcome, DREW, BattleScript_LocalBattleLostEnd_
BattleScript_LocalBattleLostPrintTrainersWinText:: BattleScript_LocalBattleLostPrintTrainersWinText::
jumpifword NO_COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_TRAINER, BattleScript_LocalBattleLostPrintWhiteOut jumpifword NO_COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_TRAINER, BattleScript_LocalBattleLostPrintWhiteOut
various ATTACKER, VARIOUS_RETURN_OPPONENT_MON1 returnopponentmon1toball ATTACKER
waitstate waitstate
various ATTACKER, VARIOUS_RETURN_OPPONENT_MON2 returnopponentmon2toball ATTACKER
waitstate waitstate
trainerslidein ATTACKER trainerslidein ATTACKER
waitstate waitstate
@ -2997,9 +2997,9 @@ BattleScript_LocalBattleLostEnd_::
end2 end2
BattleScript_82DAA0B:: BattleScript_82DAA0B::
various ATTACKER, VARIOUS_RETURN_OPPONENT_MON1 returnopponentmon1toball ATTACKER
waitstate waitstate
various ATTACKER, VARIOUS_RETURN_OPPONENT_MON2 returnopponentmon2toball ATTACKER
waitstate waitstate
trainerslidein ATTACKER trainerslidein ATTACKER
waitstate waitstate
@ -3026,7 +3026,7 @@ BattleScript_LinkBattleWonOrLostWaitEnd::
end2 end2
BattleScript_82DAA5C:: BattleScript_82DAA5C::
various ATTACKER, VARIOUS_PLAY_TRAINER_DEFEATED_MUSIC playtrainerdefeatbgm ATTACKER
printstring STRINGID_BATTLEEND printstring STRINGID_BATTLEEND
waitmessage 0x40 waitmessage 0x40
trainerslidein ATTACKER trainerslidein ATTACKER
@ -3164,7 +3164,7 @@ BattleScript_82DAB77::
tryfaintmon TARGET, FALSE, NULL tryfaintmon TARGET, FALSE, NULL
setbyte sMOVEEND_STATE, 0x3 setbyte sMOVEEND_STATE, 0x3
moveend 0x2, 0x6 moveend 0x2, 0x6
various TARGET, 0x4 various4 TARGET
jumpifbyte EQUAL, gBattleCommunication, 0x0, BattleScript_82DABB8 jumpifbyte EQUAL, gBattleCommunication, 0x0, BattleScript_82DABB8
setbyte sGIVEEXP_STATE, 0x0 setbyte sGIVEEXP_STATE, 0x0
getexp TARGET getexp TARGET
@ -3207,7 +3207,7 @@ BattleScript_LearnedNewMove::
fanfare BGM_FANFA1 fanfare BGM_FANFA1
printstring STRINGID_PKMNLEARNEDMOVE printstring STRINGID_PKMNLEARNEDMOVE
waitmessage 0x40 waitmessage 0x40
various ATTACKER, VARIOUS_UPDATE_CHOICE_MOVE_ON_LVL_UP updatechoicemoveonlvlup ATTACKER
goto BattleScript_TryLearnMoveLoop goto BattleScript_TryLearnMoveLoop
BattleScript_LearnMoveReturn:: BattleScript_LearnMoveReturn::
return return
@ -3352,7 +3352,7 @@ BattleScript_82DADD8::
returntoball TARGET returntoball TARGET
waitstate waitstate
jumpifword COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_TRAINER, BattleScript_82DADF1 jumpifword COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_TRAINER, BattleScript_82DADF1
various ATTACKER, VARIOUS_SET_TELEPORT_OUTCOME setoutcomeonteleport ATTACKER
finishaction finishaction
BattleScript_82DADF1:: BattleScript_82DADF1::
@ -3700,7 +3700,7 @@ BattleScript_MagicCoatBounce::
printstring STRINGID_PKMNMOVEBOUNCED printstring STRINGID_PKMNMOVEBOUNCED
waitmessage 0x40 waitmessage 0x40
orword gHitMarker, HITMARKER_ATTACKSTRING_PRINTED | HITMARKER_NO_PPDEDUCT | HITMARKER_x800000 orword gHitMarker, HITMARKER_ATTACKSTRING_PRINTED | HITMARKER_NO_PPDEDUCT | HITMARKER_x800000
various ATTACKER, VARIOUS_SET_MAGIC_COAT_TARGET setmagiccoattarget ATTACKER
return return
BattleScript_SnatchedMove:: BattleScript_SnatchedMove::
@ -3803,7 +3803,7 @@ BattleScript_MoveUsedIsParalyzed::
printstring STRINGID_PKMNISPARALYZED printstring STRINGID_PKMNISPARALYZED
waitmessage 0x40 waitmessage 0x40
statusanimation ATTACKER statusanimation ATTACKER
various ATTACKER, VARIOUS_CANCEL_MULTI_TURN_MOVES cancelmultiturnmoves ATTACKER
goto BattleScript_MoveEnd goto BattleScript_MoveEnd
BattleScript_MoveUsedFlinched:: BattleScript_MoveUsedFlinched::
@ -3828,7 +3828,7 @@ BattleScript_MoveUsedIsConfused::
status2animation ATTACKER, STATUS2_CONFUSION status2animation ATTACKER, STATUS2_CONFUSION
jumpifbyte EQUAL, cMULTISTRING_CHOOSER, 0x0, BattleScript_82DB2FF jumpifbyte EQUAL, cMULTISTRING_CHOOSER, 0x0, BattleScript_82DB2FF
BattleScript_82DB2D4:: BattleScript_82DB2D4::
various ATTACKER, VARIOUS_CANCEL_MULTI_TURN_MOVES cancelmultiturnmoves ATTACKER
adjustnormaldamage2 adjustnormaldamage2
printstring STRINGID_ITHURTCONFUSION printstring STRINGID_ITHURTCONFUSION
waitmessage 0x40 waitmessage 0x40
@ -4263,7 +4263,7 @@ BattleScript_IgnoresAndUsesRandomMove::
BattleScript_MoveUsedLoafingAround:: BattleScript_MoveUsedLoafingAround::
jumpifbyte NOT_EQUAL, cMULTISTRING_CHOOSER, 0x4, BattleScript_82DB6C7 jumpifbyte NOT_EQUAL, cMULTISTRING_CHOOSER, 0x4, BattleScript_82DB6C7
setbyte gBattleCommunication, 0x0 setbyte gBattleCommunication, 0x0
various ATTACKER, 0x18 various24 ATTACKER
setbyte cMULTISTRING_CHOOSER, 0x4 setbyte cMULTISTRING_CHOOSER, 0x4
BattleScript_82DB6C7:: BattleScript_82DB6C7::
printfromtable gInobedientStringIds printfromtable gInobedientStringIds
@ -4466,7 +4466,7 @@ BattleScript_82DB87D::
BattleScript_82DB881:: BattleScript_82DB881::
setbyte gBattleCommunication + 1, 0x0 setbyte gBattleCommunication + 1, 0x0
BattleScript_82DB887:: BattleScript_82DB887::
various ATTACKER, 0x8 various8 ATTACKER
jumpifbyte NOT_EQUAL, gBattleCommunication, 0x1, BattleScript_82DB89D jumpifbyte NOT_EQUAL, gBattleCommunication, 0x1, BattleScript_82DB89D
printfromtable gStringIds_85CCF0A printfromtable gStringIds_85CCF0A
waitmessage 0x40 waitmessage 0x40
@ -4478,26 +4478,26 @@ BattleScript_82DB89D::
end2 end2
BattleScript_82DB8BE:: BattleScript_82DB8BE::
various ATTACKER, VARIOUS_WAIT_CRY waitcry ATTACKER
various ATTACKER, 0x15 various21 ATTACKER
playse 0x109 playse 0x109
pause 0x8 pause 0x8
playse 0x109 playse 0x109
various ATTACKER, 0xE various14 ATTACKER
various 8, 0x10 various16 8
various 8, 0x11 various17 8
pause 0x40 pause 0x40
various ATTACKER, 0xF various15 ATTACKER
various ATTACKER, 0x16 various22 ATTACKER
end2 end2
BattleScript_82DB8E0:: BattleScript_82DB8E0::
playse SE_PINPON playse SE_PINPON
various ATTACKER, 0xE various14 ATTACKER
various TARGET, 0x10 various16 TARGET
various TARGET, 0x11 various17 TARGET
pause 0x40 pause 0x40
various ATTACKER, 0xF various15 ATTACKER
end2 end2
BattleScript_82DB8F3:: BattleScript_82DB8F3::
@ -4505,78 +4505,78 @@ BattleScript_82DB8F3::
waitstate waitstate
makevisible OPPONENT1 makevisible OPPONENT1
waitstate waitstate
various ATTACKER, 0x15 various21 ATTACKER
playse 0x109 playse 0x109
pause 0x8 pause 0x8
playse 0x109 playse 0x109
pause 0x40 pause 0x40
various ATTACKER, 0xE various14 ATTACKER
various ATTACKER, 0x10 various16 ATTACKER
various ATTACKER, 0x11 various17 ATTACKER
pause 0x40 pause 0x40
setbyte gBattleCommunication, 0x0 setbyte gBattleCommunication, 0x0
various ATTACKER, 0x9 various9 ATTACKER
pause 0x40 pause 0x40
various ATTACKER, 0x9 various9 ATTACKER
various EFFECT_BANK, 0x10 various16 EFFECT_BANK
various EFFECT_BANK, 0x11 various17 EFFECT_BANK
various ATTACKER, 0x9 various9 ATTACKER
various GBANK_1, 0x10 various16 GBANK_1
various GBANK_1, 0x11 various17 GBANK_1
various ATTACKER, 0x9 various9 ATTACKER
various 4, 0x10 various16 0x4
various 4, 0x11 various17 0x4
various ATTACKER, 0x9 various9 ATTACKER
jumpifbyte EQUAL, gBattleCommunication + 1, 0x3, BattleScript_82DB973 jumpifbyte EQUAL, gBattleCommunication + 1, 0x3, BattleScript_82DB973
jumpifbyte EQUAL, gBattleCommunication + 1, 0x4, BattleScript_82DB992 jumpifbyte EQUAL, gBattleCommunication + 1, 0x4, BattleScript_82DB992
various 5, 0x10 various16 0x5
various 5, 0x11 various17 0x5
various ATTACKER, 0x9 various9 ATTACKER
various ATTACKER, 0xF various15 ATTACKER
printstring STRINGID_DEFEATEDOPPONENTBYREFEREE printstring STRINGID_DEFEATEDOPPONENTBYREFEREE
waitmessage 0x40 waitmessage 0x40
playfaintcry OPPONENT1 playfaintcry OPPONENT1
various ATTACKER, VARIOUS_WAIT_CRY waitcry ATTACKER
dofaintanimation OPPONENT1 dofaintanimation OPPONENT1
cleareffectsonfaint OPPONENT1 cleareffectsonfaint OPPONENT1
various ATTACKER, 0xA various10 ATTACKER
end2 end2
BattleScript_82DB973:: BattleScript_82DB973::
various 6, 0x10 various16 0x6
various 6, 0x11 various17 0x6
various ATTACKER, 0x9 various9 ATTACKER
various ATTACKER, 0xF various15 ATTACKER
printstring STRINGID_LOSTTOOPPONENTBYREFEREE printstring STRINGID_LOSTTOOPPONENTBYREFEREE
waitmessage 0x40 waitmessage 0x40
playfaintcry 11 playfaintcry 11
various ATTACKER, VARIOUS_WAIT_CRY waitcry ATTACKER
dofaintanimation 11 dofaintanimation 11
cleareffectsonfaint 11 cleareffectsonfaint 11
various ATTACKER, 0xB various11 ATTACKER
end2 end2
BattleScript_82DB992:: BattleScript_82DB992::
various BANK0, 0x10 various16 BANK0
various BANK0, 0x11 various17 BANK0
various ATTACKER, 0x9 various9 ATTACKER
various ATTACKER, 0xF various15 ATTACKER
printstring STRINGID_TIEDOPPONENTBYREFEREE printstring STRINGID_TIEDOPPONENTBYREFEREE
waitmessage 0x40 waitmessage 0x40
playfaintcry 11 playfaintcry 11
various ATTACKER, VARIOUS_WAIT_CRY waitcry ATTACKER
dofaintanimation 11 dofaintanimation 11
cleareffectsonfaint 11 cleareffectsonfaint 11
playfaintcry OPPONENT1 playfaintcry OPPONENT1
various ATTACKER, VARIOUS_WAIT_CRY waitcry ATTACKER
dofaintanimation OPPONENT1 dofaintanimation OPPONENT1
cleareffectsonfaint OPPONENT1 cleareffectsonfaint OPPONENT1
various ATTACKER, 0xC various12 ATTACKER
end2 end2
BattleScript_AskIfWantsToForfeitMatch:: BattleScript_AskIfWantsToForfeitMatch::
printselectionstring STRINGID_QUESTIONFORFEITMATCH printselectionstring STRINGID_QUESTIONFORFEITMATCH
various ATTACKER, VARIOUS_EMIT_YESNOBOX forfeityesnobox ATTACKER
endselectionscript endselectionscript
BattleScript_82DB9C1:: BattleScript_82DB9C1::

View File

@ -5992,8 +5992,8 @@ static void atk58_returntoball(void)
static void atk59_handlelearnnewmove(void) static void atk59_handlelearnnewmove(void)
{ {
const u8* jumpPtr1 = BSScriptReadPtr(gBattlescriptCurrInstr + 1); const u8 *jumpPtr1 = BSScriptReadPtr(gBattlescriptCurrInstr + 1);
const u8* jumpPtr2 = BSScriptReadPtr(gBattlescriptCurrInstr + 5); const u8 *jumpPtr2 = BSScriptReadPtr(gBattlescriptCurrInstr + 5);
u16 ret = MonTryLearningNewMove(&gPlayerParty[gBattleStruct->expGetterId], gBattlescriptCurrInstr[9]); u16 ret = MonTryLearningNewMove(&gPlayerParty[gBattleStruct->expGetterId], gBattlescriptCurrInstr[9]);
while (ret == 0xFFFE) while (ret == 0xFFFE)