diff options
-rw-r--r-- | battle/effect_commands.asm | 18 | ||||
-rw-r--r-- | gfx/pics/animation.asm | 127 | ||||
-rw-r--r-- | macros.asm | 13 | ||||
-rw-r--r-- | macros/enum.asm | 31 | ||||
-rw-r--r-- | macros/move_effect.asm | 894 |
5 files changed, 301 insertions, 782 deletions
diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm index f23ea0900..96331f9eb 100644 --- a/battle/effect_commands.asm +++ b/battle/effect_commands.asm @@ -90,8 +90,8 @@ DoMove: ; 3402c ld [BattleScriptBufferLoc + 1], a pop af -; $fe is used to terminate branches without ending the read cycle. - cp $fe +; endturn_command (-2) is used to terminate branches without ending the read cycle. + cp endturn_command ret nc ; The rest of the commands (01-af) are read from BattleCommandPointers. @@ -3918,7 +3918,7 @@ BattleCommanda1: ; 35461 Function355b0: ; 355b0 - ld b, $12 ; buildopponentrage + ld b, buildopponentrage_command jp SkipToBattleCommand ; 355b5 @@ -6977,7 +6977,7 @@ BattleCommand21: ; 36671 ld a, BIDE ld [hl], a - ld b, $22 ; unleashenergy + ld b, unleashenergy_command jp SkipToBattleCommand .asm_366dc @@ -7051,7 +7051,7 @@ BattleCommand3e: ; 3671a inc de ld [de], a .asm_3674c - ld b, $3d ; rampage + ld b, rampage_command jp SkipToBattleCommand ; 36751 @@ -7707,7 +7707,7 @@ BattleCommand3a: ; 36b3a res SUBSTATUS_CHARGED, [hl] res SUBSTATUS_UNDERGROUND, [hl] res SUBSTATUS_FLYING, [hl] - ld b, $39 ; charge + ld b, charge_command jp SkipToBattleCommand ; 36b4d @@ -7787,7 +7787,7 @@ BattleCommand39: ; 36b4d ld a, BATTLE_VARS_MOVE_EFFECT call GetBattleVar cp EFFECT_SKULL_BASH - ld b, $fe ; endturn + ld b, endturn_command jp z, SkipToBattleCommand jp EndMoveEffect @@ -10294,7 +10294,7 @@ BattleCommand9e: ; 37d02 ld a, [Weather] cp WEATHER_SUN ret nz - ld b, $39 ; charge + ld b, charge_command jp SkipToBattleCommand ; 37d0d @@ -10323,7 +10323,7 @@ BattleCommand9b: ; 37d0d ld [CurDamage], a ld a, [de] ld [CurDamage + 1], a - ld b, $9c ; futuresight + ld b, futuresight_command jp SkipToBattleCommand ; 37d34 diff --git a/gfx/pics/animation.asm b/gfx/pics/animation.asm index 775eeb075..8e646da93 100644 --- a/gfx/pics/animation.asm +++ b/gfx/pics/animation.asm @@ -54,26 +54,42 @@ Functiond003a: ; d003a ; d0042 -Unknown_d0042: ; d0042 - dw Unknown_d0054 - dw Unknown_d0058 - dw Unknown_d005c - dw Unknown_d0064 - dw Unknown_d006e - dw Unknown_d0076 - dw Unknown_d0080 - dw Unknown_d0088 - dw Unknown_d008b - -Unknown_d0054: db 11, 5, 7, 0 -Unknown_d0058: db 11, 4, 7, 0 -Unknown_d005c: db 10, 4, 7, 2, 3, 6, 7, 0 -Unknown_d0064: db 6, 8, 6, 7, 2, 3, 9, 4, 7, 0 -Unknown_d006e: db 6, 7, 2, 3,10, 4, 7, 0 -Unknown_d0076: db 6, 7,10, 4, 7, 2, 3, 6, 7, 0 -Unknown_d0080: db 10, 4, 7, 2, 3, 6, 7, 0 -Unknown_d0088: db 4, 7, 0 -Unknown_d008b: db 6, 7, 0 +POKEANIM: MACRO + rept _NARG + +; Workaround for a bug where macro args can't come after the start of a symbol +if !def(\1_POKEANIM) +\1_POKEANIM equs "PokeAnim_\1_" +endc + + db (\1_POKEANIM - PokeAnim_SetupCommands) / 2 + shift + endr + + db (PokeAnim_Finish_ - PokeAnim_SetupCommands) / 2 +ENDM + + +PokeAnims: ; d0042 + dw .Slow + dw .Normal + dw .Menu + dw .Trade + dw .Evolve + dw .Hatch + dw .Unused ; same as .Menu + dw .Egg1 + dw .Egg2 + +.Slow: POKEANIM Cry3, Setup2, Play +.Normal: POKEANIM Cry3, Setup, Play +.Menu: POKEANIM Cry2, Setup, Play, SetWait, Wait, Extra, Play +.Trade: POKEANIM Extra, Play2, Extra, Play, SetWait, Wait, Cry, Setup, Play +.Evolve: POKEANIM Extra, Play, SetWait, Wait, Cry2, Setup, Play +.Hatch: POKEANIM Extra, Play, Cry2, Setup, Play, SetWait, Wait, Extra, Play +.Unused: POKEANIM Cry2, Setup, Play, SetWait, Wait, Extra, Play +.Egg1: POKEANIM Setup, Play +.Egg2: POKEANIM Extra, Play Functiond008e: ; d008e @@ -93,7 +109,7 @@ Functiond00a3: ; d00a3 push hl ld c, e ld b, 0 - ld hl, Unknown_d0042 + ld hl, PokeAnims add hl, bc add hl, bc ld a, [hli] @@ -118,7 +134,7 @@ Functiond00b4: ; d00b4 ld l, a add hl, bc ld a, [hl] - ld hl, Jumptable_d00da + ld hl, PokeAnim_SetupCommands rst JumpTable ld a, [w2_d168] ld c, a @@ -131,29 +147,32 @@ Functiond00b4: ; d00b4 ret ; d00da -Jumptable_d00da: ; d00da - dw Functiond0171 - dw Functiond0166 - dw Functiond00f2 - dw Functiond00fe - dw Functiond010b - dw Functiond011d - dw Functiond012f - dw Functiond0141 - dw Functiond0155 - dw Functiond017a - dw Functiond0188 - dw Functiond0196 +PokeAnim_SetupCommands: ; d00da +setup_command: macro +\1_: dw \1 +endm + setup_command PokeAnim_Finish + setup_command PokeAnim_Nop + setup_command PokeAnim_SetWait + setup_command PokeAnim_Wait + setup_command PokeAnim_Setup + setup_command PokeAnim_Setup2 + setup_command PokeAnim_Extra + setup_command PokeAnim_Play + setup_command PokeAnim_Play2 + setup_command PokeAnim_Cry + setup_command PokeAnim_Cry2 + setup_command PokeAnim_Cry3 ; d00f2 -Functiond00f2: ; d00f2 +PokeAnim_SetWait: ; d00f2 ld a, $12 ld [w2_d181], a ld a, [w2_d168] inc a ld [w2_d168], a -Functiond00fe: ; d00fe +PokeAnim_Wait: ; d00fe ld hl, w2_d181 dec [hl] ret nz @@ -163,7 +182,7 @@ Functiond00fe: ; d00fe ret ; d010b -Functiond010b: ; d010b +PokeAnim_Setup: ; d010b ld c, $0 ld b, $0 call Functiond0228 @@ -174,7 +193,7 @@ Functiond010b: ; d010b ret ; d011d -Functiond011d: ; d011d +PokeAnim_Setup2: ; d011d ld c, $0 ld b, $4 call Functiond0228 @@ -185,7 +204,7 @@ Functiond011d: ; d011d ret ; d012f -Functiond012f: ; d012f +PokeAnim_Extra: ; d012f ld c, $1 ld b, $0 call Functiond0228 @@ -196,7 +215,7 @@ Functiond012f: ; d012f ret ; d0141 -Functiond0141: ; d0141 +PokeAnim_Play: ; d0141 call Functiond0250 ld a, [w2_d17e] bit 7, a @@ -208,7 +227,7 @@ Functiond0141: ; d0141 ret ; d0155 -Functiond0155: ; d0155 +PokeAnim_Play2: ; d0155 call Functiond0250 ld a, [w2_d17e] bit 7, a @@ -219,7 +238,7 @@ Functiond0155: ; d0155 ret ; d0166 -Functiond0166: ; d0166 +PokeAnim_Nop: ; d0166 call Functiond01a9 ld a, [w2_d168] inc a @@ -227,14 +246,14 @@ Functiond0166: ; d0166 ret ; d0171 -Functiond0171: ; d0171 +PokeAnim_Finish: ; d0171 call Functiond01a9 ld hl, w2_d168 set 7, [hl] ret ; d017a -Functiond017a: ; d017a +PokeAnim_Cry: ; d017a ld a, [w2_d16b] call _PlayCry ld a, [w2_d168] @@ -243,7 +262,7 @@ Functiond017a: ; d017a ret ; d0188 -Functiond0188: ; d0188 +PokeAnim_Cry2: ; d0188 ld a, [w2_d16b] call PlayCry2 ld a, [w2_d168] @@ -252,7 +271,7 @@ Functiond0188: ; d0188 ret ; d0196 -Functiond0196: ; d0196 +PokeAnim_Cry3: ; d0196 ld a, $f ld [CryTracks], a ld a, [w2_d16b] @@ -346,7 +365,7 @@ Functiond0228: ; d0228 call ByteFill pop bc ld a, b - ld [w2_d172 + 1], a + ld [w2_d173], a ld a, c ld [w2_d172], a call Functiond055c @@ -378,11 +397,11 @@ Functiond0261: ; d0261 call Functiond02f8 ld a, [w2_d182] cp $ff - jr z, Functiond02a8 + jr z, PokeAnim_End cp $fe - jr z, Functiond028e + jr z, PokeAnim_SetRepeat cp $fd - jr z, Functiond0296 + jr z, PokeAnim_DoRepeat call Functiond02c8 ld a, [w2_d183] call Functiond02ae @@ -398,13 +417,13 @@ Functiond0282: ; d0282 ret ; d028e -Functiond028e: ; d028e +PokeAnim_SetRepeat: ; d028e ld a, [w2_d183] ld [w2_d17f], a jr Functiond0253 ; d0296 -Functiond0296: ; d0296 +PokeAnim_DoRepeat: ; d0296 ld a, [w2_d17f] and a ret z @@ -416,7 +435,7 @@ Functiond0296: ; d0296 jr Functiond0253 ; d02a8 -Functiond02a8: ; d02a8 +PokeAnim_End: ; d02a8 ld hl, w2_d17e set 7, [hl] ret diff --git a/macros.asm b/macros.asm index 79f6df03f..739df1bd4 100644 --- a/macros.asm +++ b/macros.asm @@ -1,3 +1,5 @@ +INCLUDE "macros/enum.asm" + INCLUDE "macros/event.asm" INCLUDE "macros/sound.asm" INCLUDE "macros/text.asm" @@ -113,17 +115,6 @@ endanim: MACRO ENDM -; Constant enumeration - -const_def: MACRO -const_value SET 0 -ENDM - -const: MACRO -\1 EQU const_value -const_value SET const_value + 1 -ENDM - sine_wave: MACRO ; \1: amplitude diff --git a/macros/enum.asm b/macros/enum.asm new file mode 100644 index 000000000..0a72d49d8 --- /dev/null +++ b/macros/enum.asm @@ -0,0 +1,31 @@ +; Enumerate variables + +enum_start: macro +if _NARG >= 1 +__enum__ = \1 +else +__enum__ = 0 +endc +if _NARG >= 2 +__enumdir__ = \2 +else +__enumdir__ = +1 +endc +endm + +enum: macro +\1 = __enum__ +__enum__ = __enum__ + __enumdir__ +endm + + +; Enumerate constants + +const_def: MACRO +const_value = 0 +ENDM + +const: MACRO +\1 EQU const_value +const_value = const_value + 1 +ENDM diff --git a/macros/move_effect.asm b/macros/move_effect.asm index 66e419db2..6cca15b2d 100644 --- a/macros/move_effect.asm +++ b/macros/move_effect.asm @@ -1,708 +1,186 @@ -checkturn: macro - db $01 - endm - -checkobedience: macro - db $02 - endm - -usedmovetext: macro - db $03 - endm - -doturn: macro - db $04 - endm - -critical: macro - db $05 - endm - -damagestats: macro - db $06 - endm - -stab: macro - db $07 - endm - -damagevariation: macro - db $08 - endm - -checkhit: macro - db $09 - endm - -effect0x0a: macro - db $0a - endm - -effect0x0b: macro - db $0b - endm - -effect0x0c: macro - db $0c - endm - -resulttext: macro - db $0d - endm - -checkfaint: macro - db $0e - endm - -criticaltext: macro - db $0f - endm - -supereffectivetext: macro - db $10 - endm - -checkdestinybond: macro - db $11 - endm - -buildopponentrage: macro - db $12 - endm - -poisontarget: macro - db $13 - endm - -sleeptarget: macro - db $14 - endm - -draintarget: macro - db $15 - endm - -eatdream: macro - db $16 - endm - -burntarget: macro - db $17 - endm - -freezetarget: macro - db $18 - endm - -paralyzetarget: macro - db $19 - endm - -selfdestruct: macro - db $1a - endm - -mirrormove: macro - db $1b - endm - -statup: macro - db $1c - endm - -statdown: macro - db $1d - endm - -payday: macro - db $1e - endm - -conversion: macro - db $1f - endm - -resetstats: macro - db $20 - endm - -storeenergy: macro - db $21 - endm - -unleashenergy: macro - db $22 - endm - -forceswitch: macro - db $23 - endm - -endloop: macro - db $24 - endm - -flinchtarget: macro - db $25 - endm - -ohko: macro - db $26 - endm - -recoil: macro - db $27 - endm - -mist: macro - db $28 - endm - -focusenergy: macro - db $29 - endm - -confuse: macro - db $2a - endm - -confusetarget: macro - db $2b - endm - -heal: macro - db $2c - endm - -transform: macro - db $2d - endm - -screen: macro - db $2e - endm - -poison: macro - db $2f - endm - -paralyze: macro - db $30 - endm - -substitute: macro - db $31 - endm - -rechargenextturn: macro - db $32 - endm - -mimic: macro - db $33 - endm - -metronome: macro - db $34 - endm - -leechseed: macro - db $35 - endm - -splash: macro - db $36 - endm - -disable: macro - db $37 - endm - -cleartext: macro - db $38 - endm - -charge: macro - db $39 - endm - -checkcharge: macro - db $3a - endm - -traptarget: macro - db $3b - endm - -effect0x3c: macro - db $3c - endm - -rampage: macro - db $3d - endm - -checkrampage: macro - db $3e - endm - -constantdamage: macro - db $3f - endm - -counter: macro - db $40 - endm - -encore: macro - db $41 - endm - -painsplit: macro - db $42 - endm - -snore: macro - db $43 - endm - -conversion2: macro - db $44 - endm - -lockon: macro - db $45 - endm - -sketch: macro - db $46 - endm - -defrostopponent: macro - db $47 - endm - -sleeptalk: macro - db $48 - endm - -destinybond: macro - db $49 - endm - -spite: macro - db $4a - endm - -falseswipe: macro - db $4b - endm - -healbell: macro - db $4c - endm - -kingsrock: macro - db $4d - endm - -triplekick: macro - db $4e - endm - -kickcounter: macro - db $4f - endm - -thief: macro - db $50 - endm - -arenatrap: macro - db $51 - endm - -nightmare: macro - db $52 - endm - -defrost: macro - db $53 - endm - -curse: macro - db $54 - endm - -protect: macro - db $55 - endm - -spikes: macro - db $56 - endm - -foresight: macro - db $57 - endm - -perishsong: macro - db $58 - endm - -startsandstorm: macro - db $59 - endm - -endure: macro - db $5a - endm - -checkcurl: macro - db $5b - endm - -rolloutpower: macro - db $5c - endm - -effect0x5d: macro - db $5d - endm - -furycutter: macro - db $5e - endm - -attract: macro - db $5f - endm - -happinesspower: macro - db $60 - endm - -present: macro - db $61 - endm - -damagecalc: macro - db $62 - endm - -frustrationpower: macro - db $63 - endm - -safeguard: macro - db $64 - endm - -checksafeguard: macro - db $65 - endm - -getmagnitude: macro - db $66 - endm - -batonpass: macro - db $67 - endm - -pursuit: macro - db $68 - endm - -clearhazards: macro - db $69 - endm - -healmorn: macro - db $6a - endm - -healday: macro - db $6b - endm - -healnite: macro - db $6c - endm - -hiddenpower: macro - db $6d - endm - -startrain: macro - db $6e - endm - -startsun: macro - db $6f - endm - -attackup: macro - db $70 - endm - -defenseup: macro - db $71 - endm - -speedup: macro - db $72 - endm - -specialattackup: macro - db $73 - endm - -specialdefenseup: macro - db $74 - endm - -accuracyup: macro - db $75 - endm - -evasionup: macro - db $76 - endm - -attackup2: macro - db $77 - endm - -defenseup2: macro - db $78 - endm - -speedup2: macro - db $79 - endm - -specialattackup2: macro - db $7a - endm - -specialdefenseup2: macro - db $7b - endm - -accuracyup2: macro - db $7c - endm - -evasionup2: macro - db $7d - endm - -attackdown: macro - db $7e - endm - -defensedown: macro - db $7f - endm - -speeddown: macro - db $80 - endm - -specialattackdown: macro - db $81 - endm - -specialdefensedown: macro - db $82 - endm - -accuracydown: macro - db $83 - endm - -evasiondown: macro - db $84 - endm - -attackdown2: macro - db $85 - endm - -defensedown2: macro - db $86 - endm - -speeddown2: macro - db $87 - endm - -specialattackdown2: macro - db $88 - endm - -specialdefensedown2: macro - db $89 - endm - -accuracydown2: macro - db $8a - endm - -evasiondown2: macro - db $8b - endm - -statmessageuser: macro - db $8c - endm - -statmessagetarget: macro - db $8d - endm - -statupfailtext: macro - db $8e - endm - -statdownfailtext: macro - db $8f - endm - -effectchance: macro - db $90 - endm - -effect0x91: macro - db $91 - endm - -effect0x92: macro - db $92 - endm - -switchturn: macro - db $93 - endm - -fakeout: macro - db $94 - endm - -bellydrum: macro - db $95 - endm - -psychup: macro - db $96 - endm - -rage: macro - db $97 - endm - -doubleflyingdamage: macro - db $98 - endm - -doubleundergrounddamage: macro - db $99 - endm - -mirrorcoat: macro - db $9a - endm - -checkfuturesight: macro - db $9b - endm - -futuresight: macro - db $9c - endm - -doubleminimizedamage: macro - db $9d - endm - -skipsuncharge: macro - db $9e - endm - -thunderaccuracy: macro - db $9f - endm - -teleport: macro - db $a0 - endm - -beatup: macro - db $a1 - endm - -ragedamage: macro - db $a2 - endm - -effect0xa3: macro - db $a3 - endm - -allstatsup: macro - db $a4 - endm - -effect0xa5: macro - db $a5 - endm - -effect0xa6: macro - db $a6 - endm - -effect0xa7: macro - db $a7 - endm - -effect0xa8: macro - db $a8 - endm - -clearmissdamage: macro - db $a9 - endm - -movedelay: macro - db $aa - endm - -hittarget: macro - db $ab - endm - -tristatuschance: macro - db $ac - endm - -supereffectivelooptext: macro - db $ad - endm - -startloop: macro - db $ae - endm - -curl: macro - db $af - endm - -endturn: macro - db $fe - endm - -endmove: macro - db $ff - endm - +command: macro + enum \1_command +\1 equs "db \1_command" +endm + + enum_start 1 + + command checkturn + command checkobedience + command usedmovetext + command doturn + command critical + command damagestats + command stab + command damagevariation + command checkhit + command effect0x0a + command effect0x0b + command effect0x0c + command resulttext + command checkfaint + command criticaltext + command supereffectivetext + command checkdestinybond + command buildopponentrage + command poisontarget + command sleeptarget + command draintarget + command eatdream + command burntarget + command freezetarget + command paralyzetarget + command selfdestruct + command mirrormove + command statup + command statdown + command payday + command conversion + command resetstats + command storeenergy + command unleashenergy + command forceswitch + command endloop + command flinchtarget + command ohko + command recoil + command mist + command focusenergy + command confuse + command confusetarget + command heal + command transform + command screen + command poison + command paralyze + command substitute + command rechargenextturn + command mimic + command metronome + command leechseed + command splash + command disable + command cleartext + command charge + command checkcharge + command traptarget + command effect0x3c + command rampage + command checkrampage + command constantdamage + command counter + command encore + command painsplit + command snore + command conversion2 + command lockon + command sketch + command defrostopponent + command sleeptalk + command destinybond + command spite + command falseswipe + command healbell + command kingsrock + command triplekick + command kickcounter + command thief + command arenatrap + command nightmare + command defrost + command curse + command protect + command spikes + command foresight + command perishsong + command startsandstorm + command endure + command checkcurl + command rolloutpower + command effect0x5d + command furycutter + command attract + command happinesspower + command present + command damagecalc + command frustrationpower + command safeguard + command checksafeguard + command getmagnitude + command batonpass + command pursuit + command clearhazards + command healmorn + command healday + command healnite + command hiddenpower + command startrain + command startsun + command attackup + command defenseup + command speedup + command specialattackup + command specialdefenseup + command accuracyup + command evasionup + command attackup2 + command defenseup2 + command speedup2 + command specialattackup2 + command specialdefenseup2 + command accuracyup2 + command evasionup2 + command attackdown + command defensedown + command speeddown + command specialattackdown + command specialdefensedown + command accuracydown + command evasiondown + command attackdown2 + command defensedown2 + command speeddown2 + command specialattackdown2 + command specialdefensedown2 + command accuracydown2 + command evasiondown2 + command statmessageuser + command statmessagetarget + command statupfailtext + command statdownfailtext + command effectchance + command effect0x91 + command effect0x92 + command switchturn + command fakeout + command bellydrum + command psychup + command rage + command doubleflyingdamage + command doubleundergrounddamage + command mirrorcoat + command checkfuturesight + command futuresight + command doubleminimizedamage + command skipsuncharge + command thunderaccuracy + command teleport + command beatup + command ragedamage + command effect0xa3 + command allstatsup + command effect0xa5 + command effect0xa6 + command effect0xa7 + command effect0xa8 + command clearmissdamage + command movedelay + command hittarget + command tristatuschance + command supereffectivelooptext + command startloop + command curl + + enum_start -1, -1 + command endmove + command endturn |