diff options
author | GriffinR <griffin.g.richards@gmail.com> | 2021-10-13 16:39:21 -0400 |
---|---|---|
committer | GriffinR <griffin.g.richards@gmail.com> | 2021-10-13 17:44:04 -0400 |
commit | def6cc8158c09f3458866f1fa5983e58022c4101 (patch) | |
tree | e37c8d4dd3add48cf6c3ea638b147b3cd27a126d | |
parent | fc15b0d5f0b9c6d004ca4c30c79557606a4b0eeb (diff) |
Label battle script macro arguments
-rw-r--r-- | asm/macros/battle_script.inc | 437 | ||||
-rw-r--r-- | data/battle_scripts_1.s | 132 | ||||
-rw-r--r-- | include/battle.h | 20 | ||||
-rw-r--r-- | include/battle_script_commands.h | 1 | ||||
-rw-r--r-- | include/constants/battle_script_commands.h | 75 | ||||
-rw-r--r-- | src/battle_script_commands.c | 104 |
6 files changed, 386 insertions, 383 deletions
diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 4b9e0bfdf..73b3beca0 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -3,10 +3,10 @@ .byte 0x0 .endm - .macro accuracycheck param0:req, param1:req + .macro accuracycheck failPtr:req, move:req .byte 0x1 - .4byte \param0 - .2byte \param1 + .4byte \failPtr + .2byte \move .endm .macro attackstring @@ -77,9 +77,9 @@ .2byte \id .endm - .macro waitmessage param0:req + .macro waitmessage time:req .byte 0x12 - .2byte \param0 + .2byte \time .endm .macro printfromtable ptr:req @@ -109,10 +109,17 @@ .byte \battler .endm - .macro tryfaintmon battler:req, param1:req, ptr:req + .macro tryfaintmon battler:req .byte 0x19 .byte \battler - .byte \param1 + .byte FALSE + .4byte NULL + .endm + + .macro tryfaintmon_spikes battler:req, ptr:req + .byte 0x19 + .byte \battler + .byte TRUE .4byte \ptr .endm @@ -140,9 +147,9 @@ .4byte \ptr .endm - .macro jumpifability param0:req, ability:req, ptr:req + .macro jumpifability battler:req, ability:req, ptr:req .byte 0x1e - .byte \param0 + .byte \battler .byte \ability .4byte \ptr .endm @@ -163,11 +170,11 @@ .4byte \ptr .endm - .macro jumpifstatus3condition battler:req, status3:req, param2:req, ptr:req + .macro jumpifstatus3condition battler:req, status3:req, condition:req, ptr:req .byte 0x21 .byte \battler .4byte \status3 - .byte \param2 + .byte \condition .4byte \ptr .endm @@ -207,118 +214,118 @@ .4byte \ptr .endm - .macro jumpifbyte ifflag:req, param1:req, param2:req, param3:req + .macro jumpifbyte ifflag:req, val:req, byte:req, ptr:req .byte 0x29 .byte \ifflag - .4byte \param1 - .byte \param2 - .4byte \param3 + .4byte \val + .byte \byte + .4byte \ptr .endm - .macro jumpifhalfword ifflag:req, param1:req, param2:req, param3:req + .macro jumpifhalfword ifflag:req, val:req, hword:req, ptr:req .byte 0x2a .byte \ifflag - .4byte \param1 - .2byte \param2 - .4byte \param3 + .4byte \val + .2byte \hword + .4byte \ptr .endm - .macro jumpifword ifflag:req, param1:req, param2:req, param3:req + .macro jumpifword ifflag:req, val:req, word:req, ptr:req .byte 0x2b .byte \ifflag - .4byte \param1 - .4byte \param2 - .4byte \param3 + .4byte \val + .4byte \word + .4byte \ptr .endm - .macro jumpifarrayequal param0:req, param1:req, param2:req, param3:req + .macro jumpifarrayequal val1:req, val2:req, size:req, ptr:req .byte 0x2c - .4byte \param0 - .4byte \param1 - .byte \param2 - .4byte \param3 + .4byte \val1 + .4byte \val2 + .byte \size + .4byte \ptr .endm - .macro jumpifarraynotequal param0:req, param1:req, param2:req, param3:req + .macro jumpifarraynotequal val1:req, val2:req, size:req, ptr:req .byte 0x2d - .4byte \param0 - .4byte \param1 - .byte \param2 - .4byte \param3 + .4byte \val1 + .4byte \val2 + .byte \size + .4byte \ptr .endm - .macro setbyte ptr:req, param1:req + .macro setbyte ptr:req, byte:req .byte 0x2e .4byte \ptr - .byte \param1 + .byte \byte .endm - .macro addbyte ptr:req, param1:req + .macro addbyte ptr:req, byte:req .byte 0x2f .4byte \ptr - .byte \param1 + .byte \byte .endm - .macro subbyte ptr:req, param1:req + .macro subbyte ptr:req, byte:req .byte 0x30 .4byte \ptr - .byte \param1 + .byte \byte .endm - .macro copyarray param0:req, param1:req, param2:req + .macro copyarray dest:req, src:req, size:req .byte 0x31 - .4byte \param0 - .4byte \param1 - .byte \param2 + .4byte \dest + .4byte \src + .byte \size .endm - .macro copyarraywithindex param0:req, param1:req, param2:req, param3:req + .macro copyarraywithindex dest:req, src:req, index:req, size:req .byte 0x32 - .4byte \param0 - .4byte \param1 - .4byte \param2 - .byte \param3 + .4byte \dest + .4byte \src + .4byte \index + .byte \size .endm - .macro orbyte ptr:req, param1:req + .macro orbyte ptr:req, byte:req .byte 0x33 .4byte \ptr - .byte \param1 + .byte \byte .endm - .macro orhalfword ptr:req, param1:req + .macro orhalfword ptr:req, hword:req .byte 0x34 .4byte \ptr - .2byte \param1 + .2byte \hword .endm - .macro orword ptr:req, param1:req + .macro orword ptr:req, word:req .byte 0x35 .4byte \ptr - .4byte \param1 + .4byte \word .endm - .macro bicbyte ptr:req, param1:req + .macro bicbyte ptr:req, byte:req .byte 0x36 .4byte \ptr - .byte \param1 + .byte \byte .endm - .macro bichalfword ptr:req, param1:req + .macro bichalfword ptr:req, hword:req .byte 0x37 .4byte \ptr - .2byte \param1 + .2byte \hword .endm - .macro bicword ptr:req, param1:req + .macro bicword ptr:req, word:req .byte 0x38 .4byte \ptr - .4byte \param1 + .4byte \word .endm - .macro pause param0:req + .macro pause time:req .byte 0x39 - .2byte \param0 + .2byte \time .endm .macro waitstate @@ -373,18 +380,18 @@ .byte 0x44 .endm - .macro playanimation battler:req, param1:req, param2:req + .macro playanimation battler:req, animType:req, arg=NULL .byte 0x45 .byte \battler - .byte \param1 - .4byte \param2 + .byte \animType + .4byte \arg .endm - .macro playanimation2 battler:req, param1:req, param2:req + .macro playanimation_var battler:req, animType:req, arg=NULL .byte 0x46 .byte \battler - .4byte \param1 - .4byte \param2 + .4byte \animType + .4byte \arg .endm .macro setgraphicalstatchangevalues @@ -398,10 +405,10 @@ .byte \statchange .endm - .macro moveend param0:req, param1:req + .macro moveend endMode:req, endState:req .byte 0x49 - .byte \param0 - .byte \param1 + .byte \endMode + .byte \endState .endm @ Help macros for 5 uses of moveend command @@ -466,16 +473,16 @@ .4byte \ptr .endm - .macro openpartyscreen param0:req, param1:req + .macro openpartyscreen battler:req, ptr:req .byte 0x50 - .byte \param0 - .4byte \param1 + .byte \battler + .4byte \ptr .endm - .macro switchhandleorder battler:req, param1:req + .macro switchhandleorder battler:req, state:req .byte 0x51 .byte \battler - .byte \param1 + .byte \state .endm .macro switchineffects battler:req @@ -488,14 +495,14 @@ .byte \battler .endm - .macro playse param0:req + .macro playse song:req .byte 0x54 - .2byte \param0 + .2byte \song .endm - .macro fanfare param0:req + .macro fanfare song:req .byte 0x55 - .2byte \param0 + .2byte \song .endm .macro playfaintcry battler:req @@ -512,21 +519,21 @@ .byte \battler .endm - .macro handlelearnnewmove param0:req, param1:req, param2:req + .macro handlelearnnewmove learnedMovePtr:req, nothingToLearnPtr:req, isFirstMove:req .byte 0x59 - .4byte \param0 - .4byte \param1 - .byte \param2 + .4byte \learnedMovePtr + .4byte \nothingToLearnPtr + .byte \isFirstMove .endm - .macro yesnoboxlearnmove param0:req + .macro yesnoboxlearnmove forgotMovePtr:req .byte 0x5a - .4byte \param0 + .4byte \forgotMovePtr .endm - .macro yesnoboxstoplearningmove param0:req + .macro yesnoboxstoplearningmove noPtr:req .byte 0x5b - .4byte \param0 + .4byte \noPtr .endm .macro hitanimation battler:req @@ -547,9 +554,9 @@ .byte 0x5f .endm - .macro incrementgamestat param0:req + .macro incrementgamestat stat:req .byte 0x60 - .byte \param0 + .byte \stat .endm .macro drawpartystatussummary battler:req @@ -562,9 +569,9 @@ .byte \battler .endm - .macro jumptocalledmove param0:req + .macro jumptocalledmove notChosenMove:req .byte 0x63 - .byte \param0 + .byte \notChosenMove .endm .macro statusanimation battler:req @@ -578,11 +585,11 @@ .4byte \status2 .endm - .macro chosenstatusanimation battler:req, param1:req, param2:req + .macro chosenstatusanimation battler:req, isStatus2:req, status:req .byte 0x66 .byte \battler - .byte \param1 - .4byte \param2 + .byte \isStatus2 + .4byte \status .endm .macro yesnobox @@ -651,10 +658,10 @@ .byte 0x75 .endm - .macro various battler:req, param1:req + .macro various battler:req, id:req .byte 0x76 .byte \battler - .byte \param1 + .byte \id .endm .macro setprotectlike @@ -674,9 +681,9 @@ .4byte \ptr .endm - .macro tryhealhalfhealth param0:req, battler:req + .macro tryhealhalfhealth ptr:req, battler:req .byte 0x7b - .4byte \param0 + .4byte \ptr .byte \battler .endm @@ -696,14 +703,14 @@ .byte 0x7f .endm - .macro manipulatedamage param0:req + .macro manipulatedamage mode:req .byte 0x80 - .byte \param0 + .byte \mode .endm - .macro trysetrest param0:req + .macro trysetrest ptr:req .byte 0x81 - .4byte \param0 + .4byte \ptr .endm .macro jumpifnotfirstturn ptr:req @@ -715,23 +722,23 @@ .byte 0x83 .endm - .macro jumpifcantmakeasleep param0:req + .macro jumpifcantmakeasleep ptr:req .byte 0x84 - .4byte \param0 + .4byte \ptr .endm .macro stockpile .byte 0x85 .endm - .macro stockpiletobasedamage param0:req + .macro stockpiletobasedamage ptr:req .byte 0x86 - .4byte \param0 + .4byte \ptr .endm - .macro stockpiletohpheal param0:req + .macro stockpiletohpheal ptr:req .byte 0x87 - .4byte \param0 + .4byte \ptr .endm .macro negativedamage @@ -756,23 +763,23 @@ .byte 0x8c .endm - .macro setmultihitcounter param0:req + .macro setmultihitcounter val:req .byte 0x8d - .byte \param0 + .byte \val .endm .macro initmultihitstring .byte 0x8e .endm - .macro forcerandomswitch param0:req + .macro forcerandomswitch ptr:req .byte 0x8f - .4byte \param0 + .4byte \ptr .endm - .macro tryconversiontypechange param0:req + .macro tryconversiontypechange ptr:req .byte 0x90 - .4byte \param0 + .4byte \ptr .endm .macro givepaydaymoney @@ -783,9 +790,9 @@ .byte 0x92 .endm - .macro tryKO param0:req + .macro tryKO ptr:req .byte 0x93 - .4byte \param0 + .4byte \ptr .endm .macro damagetohalftargethp @@ -800,9 +807,9 @@ .byte 0x96 .endm - .macro tryinfatuating param0:req + .macro tryinfatuating ptr:req .byte 0x97 - .4byte \param0 + .4byte \ptr .endm .macro updatestatusicon battler:req @@ -826,9 +833,9 @@ .byte 0x9c .endm - .macro mimicattackcopy param0:req + .macro mimicattackcopy ptr:req .byte 0x9d - .4byte \param0 + .4byte \ptr .endm .macro metronome @@ -843,48 +850,48 @@ .byte 0xa0 .endm - .macro counterdamagecalculator param0:req + .macro counterdamagecalculator ptr:req .byte 0xa1 - .4byte \param0 + .4byte \ptr .endm - .macro mirrorcoatdamagecalculator param0:req + .macro mirrorcoatdamagecalculator ptr:req .byte 0xa2 - .4byte \param0 + .4byte \ptr .endm - .macro disablelastusedattack param0:req + .macro disablelastusedattack ptr:req .byte 0xa3 - .4byte \param0 + .4byte \ptr .endm - .macro trysetencore param0:req + .macro trysetencore ptr:req .byte 0xa4 - .4byte \param0 + .4byte \ptr .endm - .macro painsplitdmgcalc param0:req + .macro painsplitdmgcalc ptr:req .byte 0xa5 - .4byte \param0 + .4byte \ptr .endm - .macro settypetorandomresistance param0:req + .macro settypetorandomresistance ptr:req .byte 0xa6 - .4byte \param0 + .4byte \ptr .endm .macro setalwayshitflag .byte 0xa7 .endm - .macro copymovepermanently param0:req + .macro copymovepermanently ptr:req .byte 0xa8 - .4byte \param0 + .4byte \ptr .endm - .macro trychoosesleeptalkmove param0:req + .macro trychoosesleeptalkmove ptr:req .byte 0xa9 - .4byte \param0 + .4byte \ptr .endm .macro setdestinybond @@ -899,32 +906,32 @@ .byte 0xac .endm - .macro tryspiteppreduce param0:req + .macro tryspiteppreduce ptr:req .byte 0xad - .4byte \param0 + .4byte \ptr .endm .macro healpartystatus .byte 0xae .endm - .macro cursetarget param0:req + .macro cursetarget ptr:req .byte 0xaf - .4byte \param0 + .4byte \ptr .endm - .macro trysetspikes param0:req + .macro trysetspikes ptr:req .byte 0xb0 - .4byte \param0 + .4byte \ptr .endm .macro setforesight .byte 0xb1 .endm - .macro trysetperishsong param0:req + .macro trysetperishsong ptr:req .byte 0xb2 - .4byte \param0 + .4byte \ptr .endm .macro rolloutdamagecalculation @@ -957,23 +964,23 @@ .byte 0xb9 .endm - .macro jumpifnopursuitswitchdmg param0:req + .macro jumpifnopursuitswitchdmg ptr:req .byte 0xba - .4byte \param0 + .4byte \ptr .endm .macro setsunny .byte 0xbb .endm - .macro maxattackhalvehp param0:req + .macro maxattackhalvehp ptr:req .byte 0xbc - .4byte \param0 + .4byte \ptr .endm - .macro copyfoestats param0:req + .macro copyfoestats ptr:req .byte 0xbd - .4byte \param0 + .4byte \ptr .endm .macro rapidspinfree @@ -984,9 +991,9 @@ .byte 0xbf .endm - .macro recoverbasedonsunlight param0:req + .macro recoverbasedonsunlight ptr:req .byte 0xc0 - .4byte \param0 + .4byte \ptr .endm .macro hiddenpowercalc @@ -997,15 +1004,15 @@ .byte 0xc2 .endm - .macro trysetfutureattack param0:req + .macro trysetfutureattack ptr:req .byte 0xc3 - .4byte \param0 + .4byte \ptr .endm - .macro trydobeatup param0:req, param1:req + .macro trydobeatup endPtr:req, failPtr:req .byte 0xc4 - .4byte \param0 - .4byte \param1 + .4byte \endPtr + .4byte \failPtr .endm .macro setsemiinvulnerablebit @@ -1041,107 +1048,107 @@ .byte 0xcc .endm - .macro cureifburnedparalysedorpoisoned param0:req + .macro cureifburnedparalysedorpoisoned ptr:req .byte 0xcd - .4byte \param0 + .4byte \ptr .endm - .macro settorment param0:req + .macro settorment ptr:req .byte 0xce - .4byte \param0 + .4byte \ptr .endm - .macro jumpifnodamage param0:req + .macro jumpifnodamage ptr:req .byte 0xcf - .4byte \param0 + .4byte \ptr .endm - .macro settaunt param0:req + .macro settaunt ptr:req .byte 0xd0 - .4byte \param0 + .4byte \ptr .endm - .macro trysethelpinghand param0:req + .macro trysethelpinghand ptr:req .byte 0xd1 - .4byte \param0 + .4byte \ptr .endm - .macro tryswapitems param0:req + .macro tryswapitems ptr:req .byte 0xd2 - .4byte \param0 + .4byte \ptr .endm - .macro trycopyability param0:req + .macro trycopyability ptr:req .byte 0xd3 - .4byte \param0 + .4byte \ptr .endm - .macro trywish param0:req, param1:req + .macro trywish turnNumber:req, ptr:req .byte 0xd4 - .byte \param0 - .4byte \param1 + .byte \turnNumber + .4byte \ptr .endm - .macro trysetroots param0:req + .macro trysetroots ptr:req .byte 0xd5 - .4byte \param0 + .4byte \ptr .endm .macro doubledamagedealtifdamaged .byte 0xd6 .endm - .macro setyawn param0:req + .macro setyawn ptr:req .byte 0xd7 - .4byte \param0 + .4byte \ptr .endm - .macro setdamagetohealthdifference param0:req + .macro setdamagetohealthdifference ptr:req .byte 0xd8 - .4byte \param0 + .4byte \ptr .endm .macro scaledamagebyhealthratio .byte 0xd9 .endm - .macro tryswapabilities param0:req + .macro tryswapabilities ptr:req .byte 0xda - .4byte \param0 + .4byte \ptr .endm - .macro tryimprison param0:req + .macro tryimprison ptr:req .byte 0xdb - .4byte \param0 + .4byte \ptr .endm - .macro trysetgrudge param0:req + .macro trysetgrudge ptr:req .byte 0xdc - .4byte \param0 + .4byte \ptr .endm .macro weightdamagecalculation .byte 0xdd .endm - .macro assistattackselect param0:req + .macro assistattackselect ptr:req .byte 0xde - .4byte \param0 + .4byte \ptr .endm - .macro trysetmagiccoat param0:req + .macro trysetmagiccoat ptr:req .byte 0xdf - .4byte \param0 + .4byte \ptr .endm - .macro trysetsnatch param0:req + .macro trysetsnatch ptr:req .byte 0xe0 - .4byte \param0 + .4byte \ptr .endm - .macro trygetintimidatetarget param0:req + .macro trygetintimidatetarget ptr:req .byte 0xe1 - .4byte \param0 + .4byte \ptr .endm .macro switchoutabilities battler:req @@ -1149,10 +1156,10 @@ .byte \battler .endm - .macro jumpifhasnohp battler:req, param1:req + .macro jumpifhasnohp battler:req, ptr:req .byte 0xe3 .byte \battler - .4byte \param1 + .4byte \ptr .endm .macro getsecretpowereffect @@ -1171,28 +1178,28 @@ .byte 0xe7 .endm - .macro settypebasedhalvers param0:req + .macro settypebasedhalvers ptr:req .byte 0xe8 - .4byte \param0 + .4byte \ptr .endm .macro setweatherballtype .byte 0xe9 .endm - .macro tryrecycleitem param0:req + .macro tryrecycleitem ptr:req .byte 0xea - .4byte \param0 + .4byte \ptr .endm - .macro settypetoterrain param0:req + .macro settypetoterrain ptr:req .byte 0xeb - .4byte \param0 + .4byte \ptr .endm - .macro pursuitrelated param0:req + .macro pursuitdoubles ptr:req .byte 0xec - .4byte \param0 + .4byte \ptr .endm .macro snatchsetbattlers @@ -1211,18 +1218,18 @@ .byte 0xf0 .endm - .macro trysetcaughtmondexflags param0:req + .macro trysetcaughtmondexflags ptr:req .byte 0xf1 - .4byte \param0 + .4byte \ptr .endm .macro displaydexinfo .byte 0xf2 .endm - .macro trygivecaughtmonnick param0:req + .macro trygivecaughtmonnick ptr:req .byte 0xf3 - .4byte \param0 + .4byte \ptr .endm .macro subattackerhpbydmg @@ -1241,9 +1248,9 @@ .byte 0xf7 .endm - .macro trainerslideout param0:req + .macro trainerslideout position:req .byte 0xf8 - .byte \param0 + .byte \position .endm @ various command changed to more readable macros @@ -1357,11 +1364,11 @@ @ helpful macros .macro setstatchanger stat:req, stages:req, down:req - setbyte sSTATCHANGER \stat | \stages << 4 | \down << 7 + setbyte sSTATCHANGER, \stat | \stages << 4 | \down << 7 .endm .macro setmoveeffect effect:req - setbyte cEFFECT_CHOOSER \effect + setbyte cEFFECT_CHOOSER, \effect .endm .macro chosenstatus1animation battler:req, status:req @@ -1413,11 +1420,11 @@ .endm .macro jumpifstatus3 battler:req, status:req, jumpptr:req - jumpifstatus3condition \battler, \status, 0x0, \jumpptr + jumpifstatus3condition \battler, \status, FALSE, \jumpptr .endm .macro jumpifnostatus3 battler:req, status:req, jumpptr:req - jumpifstatus3condition \battler, \status, 0x1, \jumpptr + jumpifstatus3condition \battler, \status, TRUE, \jumpptr .endm .macro jumpifmovehadnoeffect jumpptr:req diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 5a48e0b3c..eecb3d08d 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -262,7 +262,7 @@ BattleScript_HitFromAtkAnimation:: resultmessage waitmessage B_WAIT_TIME_LONG seteffectwithchance - tryfaintmon BS_TARGET, FALSE, NULL + tryfaintmon BS_TARGET BattleScript_MoveEnd:: moveendall end @@ -354,8 +354,8 @@ BattleScript_AbsorbUpdateHp:: printfromtable gAbsorbDrainStringIds waitmessage B_WAIT_TIME_LONG BattleScript_AbsorbTryFainting:: - tryfaintmon BS_ATTACKER, FALSE, NULL - tryfaintmon BS_TARGET, FALSE, NULL + tryfaintmon BS_ATTACKER + tryfaintmon BS_TARGET goto BattleScript_MoveEnd BattleScript_EffectBurnHit:: @@ -399,10 +399,10 @@ BattleScript_ExplosionLoop: waitmessage B_WAIT_TIME_LONG resultmessage waitmessage B_WAIT_TIME_LONG - tryfaintmon BS_TARGET, FALSE, NULL + tryfaintmon BS_TARGET moveendto MOVEEND_NEXT_TARGET jumpifnexttargetvalid BattleScript_ExplosionLoop - tryfaintmon BS_ATTACKER, FALSE, NULL + tryfaintmon BS_ATTACKER end BattleScript_ExplosionMissed: effectivenesssound @@ -410,7 +410,7 @@ BattleScript_ExplosionMissed: waitmessage B_WAIT_TIME_LONG moveendto MOVEEND_NEXT_TARGET jumpifnexttargetvalid BattleScript_ExplosionLoop - tryfaintmon BS_ATTACKER, FALSE, NULL + tryfaintmon BS_ATTACKER end BattleScript_PreserveMissedBitDoMoveAnim: @@ -456,7 +456,7 @@ BattleScript_DreamEaterWorked: printstring STRINGID_PKMNDREAMEATEN waitmessage B_WAIT_TIME_LONG BattleScript_DreamEaterTryFaintEnd: - tryfaintmon BS_TARGET, FALSE, NULL + tryfaintmon BS_TARGET goto BattleScript_MoveEnd BattleScript_EffectMirrorMove:: @@ -647,7 +647,7 @@ BattleScript_MultiHitPrintStrings:: waitmessage B_WAIT_TIME_LONG BattleScript_MultiHitEnd:: seteffectwithchance - tryfaintmon BS_TARGET, FALSE, NULL + tryfaintmon BS_TARGET moveendcase MOVEEND_SYNCHRONIZE_TARGET moveendfrom MOVEEND_IMMUNITY_ABILITIES end @@ -865,7 +865,7 @@ BattleScript_MoveMissedDoDamage:: orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE healthbarupdate BS_ATTACKER datahpupdate BS_ATTACKER - tryfaintmon BS_ATTACKER, FALSE, NULL + tryfaintmon BS_ATTACKER orbyte gMoveResultFlags, MOVE_RESULT_MISSED goto BattleScript_MoveEnd @@ -1431,7 +1431,7 @@ BattleScript_TripleKickPrintStrings:: waitmessage B_WAIT_TIME_LONG BattleScript_TripleKickEnd:: seteffectwithchance - tryfaintmon BS_TARGET, FALSE, NULL + tryfaintmon BS_TARGET moveendfrom MOVEEND_UPDATE_LAST_MOVES end @@ -1524,7 +1524,7 @@ BattleScript_DoGhostCurse:: datahpupdate BS_ATTACKER printstring STRINGID_PKMNLAIDCURSE waitmessage B_WAIT_TIME_LONG - tryfaintmon BS_ATTACKER, FALSE, NULL + tryfaintmon BS_ATTACKER goto BattleScript_MoveEnd BattleScript_EffectProtect:: @@ -1862,7 +1862,7 @@ BattleScript_DoHitAllWithUndergroundBonus:: waitmessage B_WAIT_TIME_LONG printstring STRINGID_EMPTYSTRING3 waitmessage 1 - tryfaintmon BS_TARGET, FALSE, NULL + tryfaintmon BS_TARGET moveendto MOVEEND_NEXT_TARGET jumpifnexttargetvalid BattleScript_HitsAllWithUndergroundBonusLoop end @@ -1962,7 +1962,7 @@ BattleScript_BeatUpAttack:: waitmessage B_WAIT_TIME_LONG resultmessage waitmessage B_WAIT_TIME_LONG - tryfaintmon BS_TARGET, FALSE, NULL + tryfaintmon BS_TARGET moveendto MOVEEND_NEXT_TARGET goto BattleScript_BeatUpLoop BattleScript_BeatUpEnd:: @@ -2227,7 +2227,7 @@ BattleScript_EffectMementoTrySpAtk: printfromtable gStatDownStringIds waitmessage B_WAIT_TIME_LONG BattleScript_EffectMementoTryFaint: - tryfaintmon BS_ATTACKER, FALSE, NULL + tryfaintmon BS_ATTACKER goto BattleScript_MoveEnd BattleScript_EffectMementoPrintNoEffect: printstring STRINGID_BUTNOEFFECT @@ -2243,7 +2243,7 @@ BattleScript_MementoFailEnd: effectivenesssound resultmessage waitmessage B_WAIT_TIME_LONG - tryfaintmon BS_ATTACKER, FALSE, NULL + tryfaintmon BS_ATTACKER goto BattleScript_MoveEnd BattleScript_EffectFacade:: @@ -2442,7 +2442,7 @@ BattleScript_BrickBreakDoHit:: resultmessage waitmessage B_WAIT_TIME_LONG seteffectwithchance - tryfaintmon BS_TARGET, FALSE, NULL + tryfaintmon BS_TARGET goto BattleScript_MoveEnd BattleScript_EffectYawn:: @@ -3045,7 +3045,7 @@ BattleScript_FrontierTrainerBattleWon_End: end2 BattleScript_SmokeBallEscape:: - playanimation BS_ATTACKER, B_ANIM_SMOKEBALL_ESCAPE, NULL + playanimation BS_ATTACKER, B_ANIM_SMOKEBALL_ESCAPE printstring STRINGID_PKMNFLEDUSINGITS waitmessage B_WAIT_TIME_LONG end2 @@ -3136,7 +3136,7 @@ BattleScript_PursuitDmgOnSwitchOut:: waitmessage B_WAIT_TIME_LONG resultmessage waitmessage B_WAIT_TIME_LONG - tryfaintmon BS_TARGET, FALSE, NULL + tryfaintmon BS_TARGET moveendfromto MOVEEND_ON_DAMAGE_ABILITIES, MOVEEND_CHOICE_MOVE getbattlerfainted BS_TARGET jumpifbyte CMP_EQUAL, gBattleCommunication, FALSE, BattleScript_PursuitDmgOnSwitchOutRet @@ -3190,14 +3190,14 @@ BattleScript_RainContinuesOrEnds:: printfromtable gRainContinuesStringIds waitmessage B_WAIT_TIME_LONG jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_RAIN_STOPPED, BattleScript_RainContinuesOrEndsEnd - playanimation BS_ATTACKER, B_ANIM_RAIN_CONTINUES, NULL + playanimation BS_ATTACKER, B_ANIM_RAIN_CONTINUES BattleScript_RainContinuesOrEndsEnd:: end2 BattleScript_DamagingWeatherContinues:: printfromtable gSandStormHailContinuesStringIds waitmessage B_WAIT_TIME_LONG - playanimation2 BS_ATTACKER, sB_ANIM_ARG1, NULL + playanimation_var BS_ATTACKER, sB_ANIM_ARG1 setbyte gBattleCommunication, 0 BattleScript_DamagingWeatherLoop:: copyarraywithindex gBattlerAttacker, gBattlerByTurnOrder, gBattleCommunication, 1 @@ -3210,7 +3210,7 @@ BattleScript_DamagingWeatherLoop:: hitanimation BS_ATTACKER healthbarupdate BS_ATTACKER datahpupdate BS_ATTACKER - tryfaintmon BS_ATTACKER, FALSE, NULL + tryfaintmon BS_ATTACKER checkteamslost BattleScript_DamagingWeatherLoopIncrement BattleScript_DamagingWeatherLoopIncrement:: jumpifbyte CMP_NOT_EQUAL, gBattleOutcome, 0, BattleScript_DamagingWeatherContinuesEnd @@ -3228,7 +3228,7 @@ BattleScript_SandStormHailEnds:: BattleScript_SunlightContinues:: printstring STRINGID_SUNLIGHTSTRONG waitmessage B_WAIT_TIME_LONG - playanimation BS_ATTACKER, B_ANIM_SUN_CONTINUES, NULL + playanimation BS_ATTACKER, B_ANIM_SUN_CONTINUES end2 BattleScript_SunlightFaded:: @@ -3239,7 +3239,7 @@ BattleScript_SunlightFaded:: BattleScript_OverworldWeatherStarts:: printfromtable gWeatherStartsStringIds waitmessage B_WAIT_TIME_LONG - playanimation2 BS_ATTACKER, sB_ANIM_ARG1, NULL + playanimation_var BS_ATTACKER, sB_ANIM_ARG1 end3 BattleScript_SideStatusWoreOff:: @@ -3277,8 +3277,8 @@ BattleScript_LeechSeedTurnPrintAndUpdateHp:: datahpupdate BS_TARGET printfromtable gLeechSeedStringIds waitmessage B_WAIT_TIME_LONG - tryfaintmon BS_ATTACKER, FALSE, NULL - tryfaintmon BS_TARGET, FALSE, NULL + tryfaintmon BS_ATTACKER + tryfaintmon BS_TARGET end2 BattleScript_BideStoringEnergy:: @@ -3307,7 +3307,7 @@ BattleScript_BideAttack:: datahpupdate BS_TARGET resultmessage waitmessage B_WAIT_TIME_LONG - tryfaintmon BS_TARGET, FALSE, NULL + tryfaintmon BS_TARGET goto BattleScript_MoveEnd BattleScript_BideNoEnergyToAttack:: @@ -3379,7 +3379,7 @@ BattleScript_DestinyBondTakesLife:: orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_PASSIVE_DAMAGE healthbarupdate BS_ATTACKER datahpupdate BS_ATTACKER - tryfaintmon BS_ATTACKER, FALSE, NULL + tryfaintmon BS_ATTACKER return BattleScript_SpikesOnAttacker:: @@ -3387,8 +3387,8 @@ BattleScript_SpikesOnAttacker:: healthbarupdate BS_ATTACKER datahpupdate BS_ATTACKER call BattleScript_PrintHurtBySpikes - tryfaintmon BS_ATTACKER, FALSE, NULL - tryfaintmon BS_ATTACKER, TRUE, BattleScript_SpikesOnAttackerFainted + tryfaintmon BS_ATTACKER + tryfaintmon_spikes BS_ATTACKER, BattleScript_SpikesOnAttackerFainted return BattleScript_SpikesOnAttackerFainted:: @@ -3402,8 +3402,8 @@ BattleScript_SpikesOnTarget:: healthbarupdate BS_TARGET datahpupdate BS_TARGET call BattleScript_PrintHurtBySpikes - tryfaintmon BS_TARGET, FALSE, NULL - tryfaintmon BS_TARGET, TRUE, BattleScript_SpikesOnTargetFainted + tryfaintmon BS_TARGET + tryfaintmon_spikes BS_TARGET, BattleScript_SpikesOnTargetFainted return BattleScript_SpikesOnTargetFainted:: @@ -3417,8 +3417,8 @@ BattleScript_SpikesOnFaintedBattler:: healthbarupdate BS_FAINTED datahpupdate BS_FAINTED call BattleScript_PrintHurtBySpikes - tryfaintmon BS_FAINTED, FALSE, NULL - tryfaintmon BS_FAINTED, TRUE, BattleScript_SpikesOnFaintedBattlerFainted + tryfaintmon BS_FAINTED + tryfaintmon_spikes BS_FAINTED, BattleScript_SpikesOnFaintedBattlerFainted return BattleScript_SpikesOnFaintedBattlerFainted:: @@ -3438,7 +3438,7 @@ BattleScript_PerishSongTakesLife:: orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_PASSIVE_DAMAGE healthbarupdate BS_ATTACKER datahpupdate BS_ATTACKER - tryfaintmon BS_ATTACKER, FALSE, NULL + tryfaintmon BS_ATTACKER end2 BattleScript_PerishSongCountGoesDown:: @@ -3513,10 +3513,10 @@ BattleScript_CheckDoomDesireMiss:: BattleScript_FutureAttackAnimate:: adjustnormaldamage2 jumpifbyte CMP_NOT_EQUAL, cMULTISTRING_CHOOSER, B_MSG_FUTURE_SIGHT, BattleScript_FutureHitAnimDoomDesire - playanimation BS_ATTACKER, B_ANIM_FUTURE_SIGHT_HIT, NULL + playanimation BS_ATTACKER, B_ANIM_FUTURE_SIGHT_HIT goto BattleScript_DoFutureAttackHit BattleScript_FutureHitAnimDoomDesire:: - playanimation BS_ATTACKER, B_ANIM_DOOM_DESIRE_HIT, NULL + playanimation BS_ATTACKER, B_ANIM_DOOM_DESIRE_HIT BattleScript_DoFutureAttackHit:: effectivenesssound hitanimation BS_TARGET @@ -3525,7 +3525,7 @@ BattleScript_DoFutureAttackHit:: datahpupdate BS_TARGET resultmessage waitmessage B_WAIT_TIME_LONG - tryfaintmon BS_TARGET, FALSE, NULL + tryfaintmon BS_TARGET checkteamslost BattleScript_FutureAttackEnd BattleScript_FutureAttackEnd:: moveendcase MOVEEND_RAGE @@ -3585,7 +3585,7 @@ BattleScript_SelectingNotAllowedMoveTauntInPalace:: BattleScript_WishComesTrue:: trywish 1, BattleScript_WishButFullHp - playanimation BS_TARGET, B_ANIM_WISH_HEAL, NULL + playanimation BS_TARGET, B_ANIM_WISH_HEAL printstring STRINGID_PKMNWISHCAMETRUE waitmessage B_WAIT_TIME_LONG orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE @@ -3604,7 +3604,7 @@ BattleScript_WishButFullHp:: end2 BattleScript_IngrainTurnHeal:: - playanimation BS_ATTACKER, B_ANIM_INGRAIN_HEAL, NULL + playanimation BS_ATTACKER, B_ANIM_INGRAIN_HEAL printstring STRINGID_PKMNABSORBEDNUTRIENTS waitmessage B_WAIT_TIME_LONG orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE @@ -3638,7 +3638,7 @@ BattleScript_AtkDefDown_End:: return BattleScript_KnockedOff:: - playanimation BS_TARGET, B_ANIM_ITEM_KNOCKOFF, NULL + playanimation BS_TARGET, B_ANIM_ITEM_KNOCKOFF printstring STRINGID_PKMNKNOCKEDOFF waitmessage B_WAIT_TIME_LONG return @@ -3675,7 +3675,7 @@ BattleScript_SnatchedMove:: attackstring ppreduce snatchsetbattlers - playanimation BS_TARGET, B_ANIM_SNATCH_MOVE, NULL + playanimation BS_TARGET, B_ANIM_SNATCH_MOVE printstring STRINGID_PKMNSNATCHEDMOVE waitmessage B_WAIT_TIME_LONG orword gHitMarker, HITMARKER_ATTACKSTRING_PRINTED | HITMARKER_NO_PPDEDUCT | HITMARKER_ALLOW_NO_PP @@ -3706,7 +3706,7 @@ BattleScript_SAtkDown2End:: BattleScript_FocusPunchSetUp:: printstring STRINGID_EMPTYSTRING3 waitmessage 1 - playanimation BS_ATTACKER, B_ANIM_FOCUS_PUNCH_SETUP, NULL + playanimation BS_ATTACKER, B_ANIM_FOCUS_PUNCH_SETUP printstring STRINGID_PKMNTIGHTENINGFOCUS waitmessage B_WAIT_TIME_LONG end2 @@ -3739,7 +3739,7 @@ BattleScript_DoTurnDmg:: orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_PASSIVE_DAMAGE healthbarupdate BS_ATTACKER datahpupdate BS_ATTACKER - tryfaintmon BS_ATTACKER, FALSE, NULL + tryfaintmon BS_ATTACKER checkteamslost BattleScript_DoTurnDmgEnd BattleScript_DoTurnDmgEnd:: end2 @@ -3808,7 +3808,7 @@ BattleScript_DoSelfConfusionDmg:: datahpupdate BS_ATTACKER resultmessage waitmessage B_WAIT_TIME_LONG - tryfaintmon BS_ATTACKER, FALSE, NULL + tryfaintmon BS_ATTACKER goto BattleScript_MoveEnd BattleScript_MoveUsedIsConfusedRet:: return @@ -3941,12 +3941,12 @@ BattleScript_DoRecoil:: datahpupdate BS_ATTACKER printstring STRINGID_PKMNHITWITHRECOIL waitmessage B_WAIT_TIME_LONG - tryfaintmon BS_ATTACKER, FALSE, NULL + tryfaintmon BS_ATTACKER BattleScript_RecoilEnd:: return BattleScript_ItemSteal:: - playanimation BS_TARGET, B_ANIM_ITEM_STEAL, NULL + playanimation BS_TARGET, B_ANIM_ITEM_STEAL printstring STRINGID_PKMNSTOLEITEM waitmessage B_WAIT_TIME_LONG return @@ -3955,7 +3955,7 @@ BattleScript_DrizzleActivates:: pause B_WAIT_TIME_SHORT printstring STRINGID_PKMNMADEITRAIN waitstate - playanimation BS_BATTLER_0, B_ANIM_RAIN_CONTINUES, NULL + playanimation BS_BATTLER_0, B_ANIM_RAIN_CONTINUES call BattleScript_WeatherFormChanges end3 @@ -3983,7 +3983,7 @@ BattleScript_SandstreamActivates:: pause B_WAIT_TIME_SHORT printstring STRINGID_PKMNSXWHIPPEDUPSANDSTORM waitstate - playanimation BS_BATTLER_0, B_ANIM_SANDSTORM_CONTINUES, NULL + playanimation BS_BATTLER_0, B_ANIM_SANDSTORM_CONTINUES call BattleScript_WeatherFormChanges end3 @@ -4048,7 +4048,7 @@ BattleScript_DroughtActivates:: pause B_WAIT_TIME_SHORT printstring STRINGID_PKMNSXINTENSIFIEDSUN waitstate - playanimation BS_BATTLER_0, B_ANIM_SUN_CONTINUES, NULL + playanimation BS_BATTLER_0, B_ANIM_SUN_CONTINUES call BattleScript_WeatherFormChanges end3 @@ -4184,7 +4184,7 @@ BattleScript_RoughSkinActivates:: datahpupdate BS_ATTACKER printstring STRINGID_PKMNHURTSWITH waitmessage B_WAIT_TIME_LONG - tryfaintmon BS_ATTACKER, FALSE, NULL + tryfaintmon BS_ATTACKER return BattleScript_CuteCharmActivates:: @@ -4252,7 +4252,7 @@ BattleScript_IgnoresAndHitsItself:: goto BattleScript_DoSelfConfusionDmg BattleScript_SubstituteFade:: - playanimation BS_TARGET, B_ANIM_SUBSTITUTE_FADE, NULL + playanimation BS_TARGET, B_ANIM_SUBSTITUTE_FADE printstring STRINGID_PKMNSUBSTITUTEFADED return @@ -4261,7 +4261,7 @@ BattleScript_BerryCurePrlzEnd2:: end2 BattleScript_BerryCureParRet:: - playanimation BS_SCRIPTING, B_ANIM_HELD_ITEM_EFFECT, NULL + playanimation BS_SCRIPTING, B_ANIM_HELD_ITEM_EFFECT printstring STRINGID_PKMNSITEMCUREDPARALYSIS waitmessage B_WAIT_TIME_LONG updatestatusicon BS_SCRIPTING @@ -4273,7 +4273,7 @@ BattleScript_BerryCurePsnEnd2:: end2 BattleScript_BerryCurePsnRet:: - playanimation BS_SCRIPTING, B_ANIM_HELD_ITEM_EFFECT, NULL + playanimation BS_SCRIPTING, B_ANIM_HELD_ITEM_EFFECT printstring STRINGID_PKMNSITEMCUREDPOISON waitmessage B_WAIT_TIME_LONG updatestatusicon BS_SCRIPTING @@ -4285,7 +4285,7 @@ BattleScript_BerryCureBrnEnd2:: end2 BattleScript_BerryCureBrnRet:: - playanimation BS_SCRIPTING, B_ANIM_HELD_ITEM_EFFECT, NULL + playanimation BS_SCRIPTING, B_ANIM_HELD_ITEM_EFFECT printstring STRINGID_PKMNSITEMHEALEDBURN waitmessage B_WAIT_TIME_LONG updatestatusicon BS_SCRIPTING @@ -4297,7 +4297,7 @@ BattleScript_BerryCureFrzEnd2:: end2 BattleScript_BerryCureFrzRet:: - playanimation BS_SCRIPTING, B_ANIM_HELD_ITEM_EFFECT, NULL + playanimation BS_SCRIPTING, B_ANIM_HELD_ITEM_EFFECT printstring STRINGID_PKMNSITEMDEFROSTEDIT waitmessage B_WAIT_TIME_LONG updatestatusicon BS_SCRIPTING @@ -4309,7 +4309,7 @@ BattleScript_BerryCureSlpEnd2:: end2 BattleScript_BerryCureSlpRet:: - playanimation BS_SCRIPTING, B_ANIM_HELD_ITEM_EFFECT, NULL + playanimation BS_SCRIPTING, B_ANIM_HELD_ITEM_EFFECT printstring STRINGID_PKMNSITEMWOKEIT waitmessage B_WAIT_TIME_LONG updatestatusicon BS_SCRIPTING @@ -4321,7 +4321,7 @@ BattleScript_BerryCureConfusionEnd2:: end2 BattleScript_BerryCureConfusionRet:: - playanimation BS_SCRIPTING, B_ANIM_HELD_ITEM_EFFECT, NULL + playanimation BS_SCRIPTING, B_ANIM_HELD_ITEM_EFFECT printstring STRINGID_PKMNSITEMSNAPPEDOUT waitmessage B_WAIT_TIME_LONG removeitem BS_SCRIPTING @@ -4332,7 +4332,7 @@ BattleScript_BerryCureChosenStatusEnd2:: end2 BattleScript_BerryCureChosenStatusRet:: - playanimation BS_SCRIPTING, B_ANIM_HELD_ITEM_EFFECT, NULL + playanimation BS_SCRIPTING, B_ANIM_HELD_ITEM_EFFECT printfromtable gBerryEffectStringIds waitmessage B_WAIT_TIME_LONG updatestatusicon BS_SCRIPTING @@ -4344,14 +4344,14 @@ BattleScript_WhiteHerbEnd2:: end2 BattleScript_WhiteHerbRet:: - playanimation BS_SCRIPTING, B_ANIM_HELD_ITEM_EFFECT, NULL + playanimation BS_SCRIPTING, B_ANIM_HELD_ITEM_EFFECT printstring STRINGID_PKMNSITEMRESTOREDSTATUS waitmessage B_WAIT_TIME_LONG removeitem BS_SCRIPTING return BattleScript_ItemHealHP_RemoveItem:: - playanimation BS_ATTACKER, B_ANIM_HELD_ITEM_EFFECT, NULL + playanimation BS_ATTACKER, B_ANIM_HELD_ITEM_EFFECT printstring STRINGID_PKMNSITEMRESTOREDHEALTH waitmessage B_WAIT_TIME_LONG orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE @@ -4361,7 +4361,7 @@ BattleScript_ItemHealHP_RemoveItem:: end2 BattleScript_BerryPPHealEnd2:: - playanimation BS_ATTACKER, B_ANIM_HELD_ITEM_EFFECT, NULL + playanimation BS_ATTACKER, B_ANIM_HELD_ITEM_EFFECT printstring STRINGID_PKMNSITEMRESTOREDPP waitmessage B_WAIT_TIME_LONG removeitem BS_ATTACKER @@ -4372,7 +4372,7 @@ BattleScript_ItemHealHP_End2:: end2 BattleScript_ItemHealHP_Ret:: - playanimation BS_ATTACKER, B_ANIM_HELD_ITEM_EFFECT, NULL + playanimation BS_ATTACKER, B_ANIM_HELD_ITEM_EFFECT printstring STRINGID_PKMNSITEMRESTOREDHPALITTLE waitmessage B_WAIT_TIME_LONG orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE @@ -4385,13 +4385,13 @@ BattleScript_SelectingNotAllowedMoveChoiceItem:: endselectionscript BattleScript_FocusBandActivates:: - playanimation BS_TARGET, B_ANIM_FOCUS_BAND, NULL + playanimation BS_TARGET, B_ANIM_FOCUS_BAND printstring STRINGID_PKMNHUNGONWITHX waitmessage B_WAIT_TIME_LONG return BattleScript_BerryConfuseHealEnd2:: - playanimation BS_ATTACKER, B_ANIM_HELD_ITEM_EFFECT, NULL + playanimation BS_ATTACKER, B_ANIM_HELD_ITEM_EFFECT printstring STRINGID_PKMNSITEMRESTOREDHEALTH waitmessage B_WAIT_TIME_LONG orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE @@ -4405,7 +4405,7 @@ BattleScript_BerryConfuseHealEnd2:: end2 BattleScript_BerryStatRaiseEnd2:: - playanimation BS_ATTACKER, B_ANIM_HELD_ITEM_EFFECT, NULL + playanimation BS_ATTACKER, B_ANIM_HELD_ITEM_EFFECT statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_BerryStatRaiseDoStatUp BattleScript_BerryStatRaiseDoStatUp:: setbyte cMULTISTRING_CHOOSER, B_MSG_STAT_ROSE_ITEM @@ -4414,7 +4414,7 @@ BattleScript_BerryStatRaiseDoStatUp:: end2 BattleScript_BerryFocusEnergyEnd2:: - playanimation BS_ATTACKER, B_ANIM_HELD_ITEM_EFFECT, NULL + playanimation BS_ATTACKER, B_ANIM_HELD_ITEM_EFFECT printstring STRINGID_PKMNUSEDXTOGETPUMPED waitmessage B_WAIT_TIME_LONG removeitem BS_ATTACKER diff --git a/include/battle.h b/include/battle.h index 5a30bc90c..9434b9aa8 100644 --- a/include/battle.h +++ b/include/battle.h @@ -41,19 +41,6 @@ #define B_ACTION_NOTHING_FAINTED 13 // when choosing an action #define B_ACTION_NONE 0xFF -// array entries for battle communication -#define MULTIUSE_STATE 0 -#define CURSOR_POSITION 1 -#define TASK_ID 1 // task Id and cursor position share the same field -#define SPRITES_INIT_STATE1 1 // shares the Id as well -#define SPRITES_INIT_STATE2 2 -#define MOVE_EFFECT_BYTE 3 -#define ACTIONS_CONFIRMED_COUNT 4 -#define MULTISTRING_CHOOSER 5 -#define MISS_TYPE 6 -#define MSG_DISPLAY 7 -#define BATTLE_COMMUNICATION_ENTRIES_COUNT 8 - #define MOVE_TARGET_SELECTED 0 #define MOVE_TARGET_DEPENDS (1 << 0) #define MOVE_TARGET_USER_OR_SELECTED (1 << 1) @@ -487,6 +474,8 @@ struct BattleStruct #define SET_STATCHANGER(statId, stage, goesDown)(gBattleScripting.statChanger = (statId) + (stage << 4) + (goesDown << 7)) +// NOTE: The members of this struct have hard-coded offsets +// in include/constants/battle_script_commands.h struct BattleScripting { s32 painSplitHp; @@ -509,7 +498,7 @@ struct BattleScripting u8 battleStyle; u8 drawlvlupboxState; u8 learnMoveState; - u8 field_20; + u8 pursuitDoublesAttacker; u8 reshowMainState; u8 reshowHelperState; u8 levelUpHP; @@ -518,9 +507,6 @@ struct BattleScripting u8 specialTrainerBattleType; }; -// rom_80A5C6C - - struct BattleSpriteInfo { u16 invisible:1; // 0x1 diff --git a/include/battle_script_commands.h b/include/battle_script_commands.h index 90b6d80e8..cb81ad812 100644 --- a/include/battle_script_commands.h +++ b/include/battle_script_commands.h @@ -2,6 +2,7 @@ #define GUARD_BATTLE_SCRIPT_COMMANDS_H #include "constants/pokemon.h" +#include "constants/battle_script_commands.h" // Arguments for 'flags' in HandleBattleWindow #define WINDOW_CLEAR (1 << 0) diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h index f3e11b4be..83aacf316 100644 --- a/include/constants/battle_script_commands.h +++ b/include/constants/battle_script_commands.h @@ -1,38 +1,51 @@ #ifndef GUARD_CONSTANTS_BATTLE_SCRIPT_COMMANDS_H #define GUARD_CONSTANTS_BATTLE_SCRIPT_COMMANDS_H -// Battle Scripting and BattleCommunication addresses -#define sPAINSPLIT_HP gBattleScripting -#define sBIDE_DMG gBattleScripting + 4 -#define sMULTIHIT_STRING gBattleScripting + 8 -#define sDMG_MULTIPLIER gBattleScripting + 0xE -#define sTWOTURN_STRINGID gBattleScripting + 0xF -#define sB_ANIM_ARG1 gBattleScripting + 0x10 -#define sB_ANIM_ARG2 gBattleScripting + 0x11 -#define sTRIPLE_KICK_POWER gBattleScripting + 0x12 -#define sMOVEEND_STATE gBattleScripting + 0x14 -#define sBATTLER_WITH_ABILITY gBattleScripting + 0x15 -#define sMULTIHIT_EFFECT gBattleScripting + 0x16 -#define sBATTLER gBattleScripting + 0x17 -#define sB_ANIM_TURN gBattleScripting + 0x18 -#define sB_ANIM_TARGETS_HIT gBattleScripting + 0x19 -#define sSTATCHANGER gBattleScripting + 0x1A -#define sSTAT_ANIM_PLAYED gBattleScripting + 0x1B -#define sGIVEEXP_STATE gBattleScripting + 0x1C -#define sBATTLE_STYLE gBattleScripting + 0x1D -#define sLVLBOX_STATE gBattleScripting + 0x1E -#define sLEARNMOVE_STATE gBattleScripting + 0x1F -#define sFIELD_20 gBattleScripting + 0x20 -#define sRESHOW_MAIN_STATE gBattleScripting + 0x21 -#define sRESHOW_HELPER_STATE gBattleScripting + 0x22 -#define sFIELD_23 gBattleScripting + 0x23 -#define sWINDOWS_TYPE gBattleScripting + 0x24 -#define sMULTIPLAYER_ID gBattleScripting + 0x25 -#define sSPECIAL_TRAINER_BATTLE_TYPE gBattleScripting + 0x26 +// The following correspond to the struct members of BattleScripting by adding their offset +#define sPAINSPLIT_HP (gBattleScripting + 0x00) // painSplitHp +#define sBIDE_DMG (gBattleScripting + 0x04) // bideDmg +#define sMULTIHIT_STRING (gBattleScripting + 0x08) // multihitString +#define sDMG_MULTIPLIER (gBattleScripting + 0x0E) // dmgMultiplier +#define sTWOTURN_STRINGID (gBattleScripting + 0x0F) // twoTurnsMoveStringId +#define sB_ANIM_ARG1 (gBattleScripting + 0x10) // animArg1 +#define sB_ANIM_ARG2 (gBattleScripting + 0x11) // animArg2 +#define sTRIPLE_KICK_POWER (gBattleScripting + 0x12) // tripleKickPower +#define sMOVEEND_STATE (gBattleScripting + 0x14) // moveendState +#define sBATTLER_WITH_ABILITY (gBattleScripting + 0x15) // battlerWithAbility +#define sMULTIHIT_EFFECT (gBattleScripting + 0x16) // multihitMoveEffect +#define sBATTLER (gBattleScripting + 0x17) // battler +#define sB_ANIM_TURN (gBattleScripting + 0x18) // animTurn +#define sB_ANIM_TARGETS_HIT (gBattleScripting + 0x19) // animTargetsHit +#define sSTATCHANGER (gBattleScripting + 0x1A) // statChanger +#define sSTAT_ANIM_PLAYED (gBattleScripting + 0x1B) // statAnimPlayed +#define sGIVEEXP_STATE (gBattleScripting + 0x1C) // getexpState +#define sBATTLE_STYLE (gBattleScripting + 0x1D) // battleStyle +#define sLVLBOX_STATE (gBattleScripting + 0x1E) // drawlvlupboxState +#define sLEARNMOVE_STATE (gBattleScripting + 0x1F) // learnMoveState +#define sPURSUIT_DOUBLES_ATTACKER (gBattleScripting + 0x20) // pursuitDoublesAttacker +#define sRESHOW_MAIN_STATE (gBattleScripting + 0x21) // reshowMainState +#define sRESHOW_HELPER_STATE (gBattleScripting + 0x22) // reshowHelperState +#define sLVLUP_HP (gBattleScripting + 0x23) // levelUpHP +#define sWINDOWS_TYPE (gBattleScripting + 0x24) // windowsType +#define sMULTIPLAYER_ID (gBattleScripting + 0x25) // multiplayerId +#define sSPECIAL_TRAINER_BATTLE_TYPE (gBattleScripting + 0x26) // specialTrainerBattleType -#define cEFFECT_CHOOSER gBattleCommunication + 3 -#define cMULTISTRING_CHOOSER gBattleCommunication + 5 -#define cMISS_TYPE gBattleCommunication + 6 +// Array entries for battle communication +#define MULTIUSE_STATE 0 +#define CURSOR_POSITION 1 +#define TASK_ID 1 // task Id and cursor position share the same field +#define SPRITES_INIT_STATE1 1 // shares the Id as well +#define SPRITES_INIT_STATE2 2 +#define MOVE_EFFECT_BYTE 3 +#define ACTIONS_CONFIRMED_COUNT 4 +#define MULTISTRING_CHOOSER 5 +#define MISS_TYPE 6 +#define MSG_DISPLAY 7 +#define BATTLE_COMMUNICATION_ENTRIES_COUNT 8 + +#define cEFFECT_CHOOSER (gBattleCommunication + MOVE_EFFECT_BYTE) +#define cMULTISTRING_CHOOSER (gBattleCommunication + MULTISTRING_CHOOSER) +#define cMISS_TYPE (gBattleCommunication + MISS_TYPE) // Battle Script defines for getting the wanted battler #define BS_TARGET 0 diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 9056aa58d..0ecb17368 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1,25 +1,15 @@ #include "global.h" #include "battle.h" -#include "constants/battle_move_effects.h" -#include "constants/battle_script_commands.h" #include "battle_message.h" #include "battle_anim.h" #include "battle_ai_script_commands.h" #include "battle_scripts.h" -#include "constants/moves.h" -#include "constants/abilities.h" #include "item.h" -#include "constants/items.h" -#include "constants/hold_effects.h" #include "util.h" #include "pokemon.h" #include "random.h" #include "battle_controllers.h" #include "battle_interface.h" -#include "constants/songs.h" -#include "constants/trainers.h" -#include "constants/battle_anim.h" -#include "constants/map_types.h" #include "text.h" #include "sound.h" #include "pokedex.h" @@ -38,7 +28,6 @@ #include "pokemon_storage_system.h" #include "task.h" #include "naming_screen.h" -#include "constants/battle_string_ids.h" #include "battle_setup.h" #include "overworld.h" #include "party_menu.h" @@ -49,9 +38,19 @@ #include "pokemon_summary_screen.h" #include "pokenav.h" #include "menu_specialized.h" -#include "constants/rgb.h" #include "data.h" +#include "constants/abilities.h" +#include "constants/battle_anim.h" +#include "constants/battle_move_effects.h" +#include "constants/battle_string_ids.h" +#include "constants/hold_effects.h" +#include "constants/items.h" +#include "constants/map_types.h" +#include "constants/moves.h" #include "constants/party_menu.h" +#include "constants/rgb.h" +#include "constants/songs.h" +#include "constants/trainers.h" extern const u8* const gBattleScriptsForMoveEffects[]; @@ -147,7 +146,7 @@ static void Cmd_jumpiftype2(void); static void Cmd_jumpifabilitypresent(void); static void Cmd_endselectionscript(void); static void Cmd_playanimation(void); -static void Cmd_playanimation2(void); +static void Cmd_playanimation_var(void); static void Cmd_setgraphicalstatchangevalues(void); static void Cmd_playstatchangeanimation(void); static void Cmd_moveend(void); @@ -313,7 +312,7 @@ static void Cmd_settypebasedhalvers(void); static void Cmd_setweatherballtype(void); static void Cmd_tryrecycleitem(void); static void Cmd_settypetoterrain(void); -static void Cmd_pursuitrelated(void); +static void Cmd_pursuitdoubles(void); static void Cmd_snatchsetbattlers(void); static void Cmd_removelightscreenreflect(void); static void Cmd_handleballthrow(void); @@ -399,7 +398,7 @@ void (* const gBattleScriptingCommandsTable[])(void) = Cmd_jumpifabilitypresent, //0x43 Cmd_endselectionscript, //0x44 Cmd_playanimation, //0x45 - Cmd_playanimation2, //0x46 + Cmd_playanimation_var, //0x46 Cmd_setgraphicalstatchangevalues, //0x47 Cmd_playstatchangeanimation, //0x48 Cmd_moveend, //0x49 @@ -565,7 +564,7 @@ void (* const gBattleScriptingCommandsTable[])(void) = Cmd_setweatherballtype, //0xE9 Cmd_tryrecycleitem, //0xEA Cmd_settypetoterrain, //0xEB - Cmd_pursuitrelated, //0xEC + Cmd_pursuitdoubles, //0xEC Cmd_snatchsetbattlers, //0xED Cmd_removelightscreenreflect, //0xEE Cmd_handleballthrow, //0xEF @@ -1115,7 +1114,7 @@ static void Cmd_accuracycheck(void) s8 buff; u16 calc; - if (move == 0) + if (move == ACC_CURR_MOVE) move = gCurrentMove; GET_MOVE_TYPE(move, type); @@ -3183,23 +3182,23 @@ static void Cmd_jumpifstat(void) static void Cmd_jumpifstatus3condition(void) { - u32 flags; + u32 status; const u8 *jumpPtr; gActiveBattler = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]); - flags = T2_READ_32(gBattlescriptCurrInstr + 2); + status = T2_READ_32(gBattlescriptCurrInstr + 2); jumpPtr = T2_READ_PTR(gBattlescriptCurrInstr + 7); if (gBattlescriptCurrInstr[6]) { - if ((gStatuses3[gActiveBattler] & flags) != 0) + if ((gStatuses3[gActiveBattler] & status) != 0) gBattlescriptCurrInstr += 11; else gBattlescriptCurrInstr = jumpPtr; } else { - if ((gStatuses3[gActiveBattler] & flags) != 0) + if ((gStatuses3[gActiveBattler] & status) != 0) gBattlescriptCurrInstr = jumpPtr; else gBattlescriptCurrInstr += 11; @@ -3514,8 +3513,7 @@ static void Cmd_checkteamslost(void) // In multi battle with Steven, skip his Pokémon for (i = 0; i < MULTI_PARTY_SIZE; i++) { - if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) - && !GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG)) + if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) && !GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG)) HP_count += GetMonData(&gPlayerParty[i], MON_DATA_HP); } } @@ -3523,10 +3521,8 @@ static void Cmd_checkteamslost(void) { for (i = 0; i < PARTY_SIZE; i++) { - if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) - && !GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG) - && (!(gBattleTypeFlags & BATTLE_TYPE_ARENA) - || !(gBattleStruct->arenaLostPlayerMons & gBitTable[i]))) + if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) && !GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG) + && (!(gBattleTypeFlags & BATTLE_TYPE_ARENA) || !(gBattleStruct->arenaLostPlayerMons & gBitTable[i]))) { HP_count += GetMonData(&gPlayerParty[i], MON_DATA_HP); } @@ -3539,10 +3535,8 @@ static void Cmd_checkteamslost(void) // Get total HP for the enemy's party to determine if the player has won for (i = 0; i < PARTY_SIZE; i++) { - if (GetMonData(&gEnemyParty[i], MON_DATA_SPECIES) - && !GetMonData(&gEnemyParty[i], MON_DATA_IS_EGG) - && (!(gBattleTypeFlags & BATTLE_TYPE_ARENA) - || !(gBattleStruct->arenaLostOpponentMons & gBitTable[i]))) + if (GetMonData(&gEnemyParty[i], MON_DATA_SPECIES) && !GetMonData(&gEnemyParty[i], MON_DATA_IS_EGG) + && (!(gBattleTypeFlags & BATTLE_TYPE_ARENA) || !(gBattleStruct->arenaLostOpponentMons & gBitTable[i]))) { HP_count += GetMonData(&gEnemyParty[i], MON_DATA_HP); } @@ -3982,8 +3976,8 @@ static void Cmd_playanimation(void) argumentPtr = T2_READ_PTR(gBattlescriptCurrInstr + 3); if (gBattlescriptCurrInstr[2] == B_ANIM_STATS_CHANGE - || gBattlescriptCurrInstr[2] == B_ANIM_SNATCH_MOVE - || gBattlescriptCurrInstr[2] == B_ANIM_SUBSTITUTE_FADE) + || gBattlescriptCurrInstr[2] == B_ANIM_SNATCH_MOVE + || gBattlescriptCurrInstr[2] == B_ANIM_SUBSTITUTE_FADE) { BtlController_EmitBattleAnimation(BUFFER_A, gBattlescriptCurrInstr[2], *argumentPtr); MarkBattlerForControllerExec(gActiveBattler); @@ -3995,9 +3989,9 @@ static void Cmd_playanimation(void) gBattlescriptCurrInstr = BattleScript_Pausex20; } else if (gBattlescriptCurrInstr[2] == B_ANIM_RAIN_CONTINUES - || gBattlescriptCurrInstr[2] == B_ANIM_SUN_CONTINUES - || gBattlescriptCurrInstr[2] == B_ANIM_SANDSTORM_CONTINUES - || gBattlescriptCurrInstr[2] == B_ANIM_HAIL_CONTINUES) + || gBattlescriptCurrInstr[2] == B_ANIM_SUN_CONTINUES + || gBattlescriptCurrInstr[2] == B_ANIM_SANDSTORM_CONTINUES + || gBattlescriptCurrInstr[2] == B_ANIM_HAIL_CONTINUES) { BtlController_EmitBattleAnimation(BUFFER_A, gBattlescriptCurrInstr[2], *argumentPtr); MarkBattlerForControllerExec(gActiveBattler); @@ -4015,7 +4009,8 @@ static void Cmd_playanimation(void) } } -static void Cmd_playanimation2(void) // animation Id is stored in the first pointer +// Same as playanimation, expect it takes a pointer to some animation id, instead of taking the value directly +static void Cmd_playanimation_var(void) { const u16* argumentPtr; const u8* animationIdPtr; @@ -4025,8 +4020,8 @@ static void Cmd_playanimation2(void) // animation Id is stored in the first poin argumentPtr = T2_READ_PTR(gBattlescriptCurrInstr + 6); if (*animationIdPtr == B_ANIM_STATS_CHANGE - || *animationIdPtr == B_ANIM_SNATCH_MOVE - || *animationIdPtr == B_ANIM_SUBSTITUTE_FADE) + || *animationIdPtr == B_ANIM_SNATCH_MOVE + || *animationIdPtr == B_ANIM_SUBSTITUTE_FADE) { BtlController_EmitBattleAnimation(BUFFER_A, *animationIdPtr, *argumentPtr); MarkBattlerForControllerExec(gActiveBattler); @@ -4037,9 +4032,9 @@ static void Cmd_playanimation2(void) // animation Id is stored in the first poin gBattlescriptCurrInstr += 10; } else if (*animationIdPtr == B_ANIM_RAIN_CONTINUES - || *animationIdPtr == B_ANIM_SUN_CONTINUES - || *animationIdPtr == B_ANIM_SANDSTORM_CONTINUES - || *animationIdPtr == B_ANIM_HAIL_CONTINUES) + || *animationIdPtr == B_ANIM_SUN_CONTINUES + || *animationIdPtr == B_ANIM_SANDSTORM_CONTINUES + || *animationIdPtr == B_ANIM_HAIL_CONTINUES) { BtlController_EmitBattleAnimation(BUFFER_A, *animationIdPtr, *argumentPtr); MarkBattlerForControllerExec(gActiveBattler); @@ -4186,7 +4181,7 @@ static void Cmd_moveend(void) u8 moveType = 0; u8 holdEffectAtk = 0; u16 *choicedMoveAtk = NULL; - u8 arg1, arg2; + u8 endMode, endState; u16 originallyUsedMove; if (gChosenMove == 0xFFFF) @@ -4194,8 +4189,8 @@ static void Cmd_moveend(void) else originallyUsedMove = gChosenMove; - arg1 = gBattlescriptCurrInstr[1]; - arg2 = gBattlescriptCurrInstr[2]; + endMode = gBattlescriptCurrInstr[1]; + endState = gBattlescriptCurrInstr[2]; if (gBattleMons[gBattlerAttacker].item == ITEM_ENIGMA_BERRY) holdEffectAtk = gEnigmaBerries[gBattlerAttacker].holdEffect; @@ -4450,9 +4445,9 @@ static void Cmd_moveend(void) break; } - if (arg1 == 1 && effect == FALSE) + if (endMode == 1 && effect == FALSE) gBattleScripting.moveendState = MOVEEND_COUNT; - if (arg1 == 2 && arg2 == gBattleScripting.moveendState) + if (endMode == 2 && endState == gBattleScripting.moveendState) gBattleScripting.moveendState = MOVEEND_COUNT; } while (gBattleScripting.moveendState != MOVEEND_COUNT && effect == FALSE); @@ -5318,16 +5313,16 @@ static void Cmd_returntoball(void) static void Cmd_handlelearnnewmove(void) { - const u8 *jumpPtr1 = T1_READ_PTR(gBattlescriptCurrInstr + 1); - const u8 *jumpPtr2 = T1_READ_PTR(gBattlescriptCurrInstr + 5); + const u8 *learnedMovePtr = T1_READ_PTR(gBattlescriptCurrInstr + 1); + const u8 *nothingToLearnPtr = T1_READ_PTR(gBattlescriptCurrInstr + 5); u16 learnMove = MonTryLearningNewMove(&gPlayerParty[gBattleStruct->expGetterMonId], gBattlescriptCurrInstr[9]); while (learnMove == MON_ALREADY_KNOWS_MOVE) learnMove = MonTryLearningNewMove(&gPlayerParty[gBattleStruct->expGetterMonId], FALSE); - if (learnMove == 0) + if (learnMove == MOVE_NONE) { - gBattlescriptCurrInstr = jumpPtr2; + gBattlescriptCurrInstr = nothingToLearnPtr; } else if (learnMove == MON_HAS_MAX_MOVES) { @@ -5352,7 +5347,7 @@ static void Cmd_handlelearnnewmove(void) } } - gBattlescriptCurrInstr = jumpPtr1; + gBattlescriptCurrInstr = learnedMovePtr; } } @@ -9718,7 +9713,8 @@ static void Cmd_settypetoterrain(void) } } -static void Cmd_pursuitrelated(void) +// Unused +static void Cmd_pursuitdoubles(void) { gActiveBattler = GetBattlerAtPosition(GetBattlerPosition(gBattlerAttacker) ^ BIT_FLANK); @@ -9731,7 +9727,7 @@ static void Cmd_pursuitrelated(void) gCurrentMove = MOVE_PURSUIT; gBattlescriptCurrInstr += 5; gBattleScripting.animTurn = 1; - gBattleScripting.field_20 = gBattlerAttacker; + gBattleScripting.pursuitDoublesAttacker = gBattlerAttacker; gBattlerAttacker = gActiveBattler; } else |