summaryrefslogtreecommitdiff
path: root/engine/battle
diff options
context:
space:
mode:
Diffstat (limited to 'engine/battle')
-rwxr-xr-xengine/battle/animations.asm65
-rwxr-xr-xengine/battle/bank_e_misc.asm10
-rwxr-xr-xengine/battle/core.asm78
-rw-r--r--engine/battle/moveEffects/transform_effect.asm8
4 files changed, 82 insertions, 79 deletions
diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm
index 3321b738..6c98cc91 100755
--- a/engine/battle/animations.asm
+++ b/engine/battle/animations.asm
@@ -336,14 +336,14 @@ LoadAnimationTileset: ; 781d2 (1e:41d2)
ld d,0
add hl,de
ld a,[hli]
- ld [wd07d],a ; number of tiles
+ ld [wTempTilesetNumTiles],a ; number of tiles
ld a,[hli]
ld e,a
ld a,[hl]
ld d,a ; de = address of tileset
ld hl,vSprites + $310
ld b, BANK(AnimationTileset1) ; ROM bank
- ld a,[wd07d]
+ ld a,[wTempTilesetNumTiles]
ld c,a ; number of tiles
jp CopyVideoData ; load tileset
@@ -835,9 +835,9 @@ DoRockSlideSpecialEffects: ; 78fd9 (1e:4fd9)
; if the subaninmation counter is between 8 and 11, shake the screen horizontally and vertically
.shakeScreen
ld b,1
- predef Func_48125 ; shake horizontally
+ predef PredefShakeScreenHorizontally ; shake horizontally
ld b,1
- predef_jump Func_480ff ; shake vertically
+ predef_jump PredefShakeScreenVertically ; shake vertically
FlashScreenEveryEightFrameBlocks: ; 78ff7 (1e:4ff7)
ld a,[W_SUBANIMCOUNTER]
@@ -1225,14 +1225,14 @@ SetAnimationBGPalette: ; 791fc (1e:51fc)
ld b, $5
AnimationShakeScreenVertically: ; 79209 (1e:5209)
- predef_jump Func_480ff
+ predef_jump PredefShakeScreenVertically
AnimationShakeScreen: ; 7920e (1e:520e)
; Shakes the screen for a while. Used in Earthquake/Fissure/etc. animations.
ld b, $8
AnimationShakeScreenHorizontallyFast: ; 79210 (1e:5210)
- predef_jump Func_48125
+ predef_jump PredefShakeScreenHorizontally
AnimationWaterDropletsEverywhere: ; 79215 (1e:5215)
; Draws water droplets all over the screen and makes them
@@ -1292,12 +1292,12 @@ AnimationSlideMonUp: ; 7927a (1e:527a)
ld c, $7
ld a, [H_WHOSETURN]
and a
- ld hl, wTileMap + $79
- ld de, wTileMap + $65
+ hlCoord 1, 6
+ deCoord 1, 5
ld a, $30
jr z, .asm_79291
- ld hl, wTileMap + $20
- ld de, wTileMap + $c
+ hlCoord 12, 1
+ deCoord 12, 0
ld a, $ff
.asm_79291
ld [wd09f], a
@@ -1345,16 +1345,16 @@ _AnimationSlideMonUp: ; 792bf (1e:52bf)
call CopyData
pop de
pop hl
- ld bc, $0028
+ ld bc, SCREEN_WIDTH * 2
add hl, bc
pop bc
dec b
jr nz, .asm_792c4
ld a, [H_WHOSETURN]
and a
- ld hl, wTileMap + $dd
+ hlCoord 1, 11
jr z, .asm_792e2
- ld hl, wTileMap + $84
+ hlCoord 12, 6
.asm_792e2
ld a, [wd09f]
inc a
@@ -1513,11 +1513,11 @@ AnimationShakeBackAndForth: ; 793b1 (1e:53b1)
; The mon's sprite disappears after this animation.
ld a, [H_WHOSETURN]
and a
- ld hl, wTileMap + $64
- ld de, wTileMap + $66
+ hlCoord 0, 5
+ deCoord 2, 5
jr z, .asm_793c2
- ld hl, wTileMap + $b
- ld de, wTileMap + $d
+ hlCoord 11, 0
+ deCoord 13, 0
.asm_793c2
xor a
@@ -2061,23 +2061,24 @@ CopySlowbroSpriteData: ; 7973f (1e:573f)
ld a, BANK(SlowbroSprite)
jp FarCopyData2
-Func_79747: ; 79747 (1e:5747)
+HideSubstituteShowMonAnim: ; 79747 (1e:5747)
ld a, [H_WHOSETURN]
and a
- ld hl, wccf7
+ ld hl, wPlayerMonMinimized
ld a, [W_PLAYERBATTSTATUS2]
- jr z, .asm_79758
- ld hl, wccf3
+ jr z, .next1
+ ld hl, wEnemyMonMinimized
ld a, [W_ENEMYBATTSTATUS2]
-.asm_79758
+.next1
push hl
- bit 4, a
- jr nz, .asm_79762
+; if the substitute broke, slide it down, else slide it offscreen horizontally
+ bit HasSubstituteUp, a
+ jr nz, .substituteStillUp
call AnimationSlideMonDown
- jr .asm_79765
-.asm_79762
+ jr .next2
+.substituteStillUp
call AnimationSlideMonOut
-.asm_79765
+.next2
pop hl
ld a, [hl]
and a
@@ -2085,7 +2086,7 @@ Func_79747: ; 79747 (1e:5747)
call AnimationFlashMonPic
jp AnimationShowMonPic
-Func_79771: ; 79771 (1e:5771)
+ReshowSubstituteAnim: ; 79771 (1e:5771)
call AnimationSlideMonOut
call AnimationSubstitute
jp AnimationShowMonPic
@@ -2644,16 +2645,16 @@ Unknown_79c50: ; 79c50 (1e:5c50)
AnimationLeavesFalling: ; 79c74 (1e:5c74)
; Makes leaves float down from the top of the screen. This is used
; in Razor Leaf's animation.
- ld a, [$ff48]
+ ld a, [rOBP0]
push af
ld a, [wcc79]
- ld [$ff48], a
+ ld [rOBP0], a
ld d, $37
ld a, $3
ld [W_SUBANIMTRANSFORM], a
call Func_79c97
pop af
- ld [$ff48], a
+ ld [rOBP0], a
ret
AnimationPetalsFalling: ; 79c8a (1e:5c8a)
@@ -2870,7 +2871,7 @@ Func_79de9: ; 79de9 (1e:5de9)
Func_79e0d: ; 79e0d (1e:5e0d)
ld a, h
- ld [$ffbd], a
+ ld [H_AUTOBGTRANSFERDEST + 1], a
ld a, l
ld [H_AUTOBGTRANSFERDEST], a
jp Delay3
diff --git a/engine/battle/bank_e_misc.asm b/engine/battle/bank_e_misc.asm
index 80fa971a..2f3944e9 100755
--- a/engine/battle/bank_e_misc.asm
+++ b/engine/battle/bank_e_misc.asm
@@ -53,29 +53,29 @@ FormatMovesString: ; 39b87 (e:5b87)
; XXX this is called in a few places, but it doesn't appear to do anything useful
InitList: ; 39bd5 (e:5bd5)
- ld a, [wd11b]
- cp $1
+ ld a, [wInitListType]
+ cp INIT_ENEMYOT_LIST
jr nz, .notEnemy
ld hl, wEnemyPartyCount
ld de, wEnemyMonOT
ld a, ENEMYOT_NAME
jr .done
.notEnemy
- cp $4
+ cp INIT_PLAYEROT_LIST
jr nz, .notPlayer
ld hl, wPartyCount
ld de, wPartyMonOT
ld a, PLAYEROT_NAME
jr .done
.notPlayer
- cp $5
+ cp INIT_MON_LIST
jr nz, .notMonster
ld hl, wStringBuffer2 + 11
ld de, MonsterNames
ld a, MONSTER_NAME
jr .done
.notMonster
- cp $2
+ cp INIT_BAG_ITEM_LIST
jr nz, .notBag
ld hl, wNumBagItems
ld de, ItemNames
diff --git a/engine/battle/core.asm b/engine/battle/core.asm
index 52beca1a..1825e61e 100755
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -848,7 +848,7 @@ FaintEnemyPokemon: ; 0x3c567
ld [hl], a
ld [W_ENEMYDISABLEDMOVE], a
ld [wEnemyDisabledMoveNumber], a
- ld [wccf3], a
+ ld [wEnemyMonMinimized], a
ld hl, wPlayerUsedMove
ld [hli], a
ld [hl], a
@@ -1142,8 +1142,8 @@ DoUseNextMonDialogue: ; 3c79b (f:479b)
ld a, TWO_OPTION_MENU
ld [wTextBoxID], a
call DisplayTextBoxID
- ld a, [wd12e]
- cp $2 ; did the player choose NO?
+ ld a, [wMenuExitMethod]
+ cp CHOSE_SECOND_ITEM ; did the player choose NO?
jr z, .tryRunning ; if the player chose NO, try running
and a ; reset carry
ret
@@ -1162,8 +1162,8 @@ UseNextMonText: ; 3c7d3 (f:47d3)
; choose next player mon to send out
; stores whether enemy mon has no HP left in Z flag
ChooseNextMon: ; 3c7d8 (f:47d8)
- ld a, $2
- ld [wd07d], a
+ ld a, BATTLE_PARTY_MENU
+ ld [wPartyMenuTypeOrMessageID], a
call DisplayPartyMenu
.checkIfMonChosen
jr nc, .monChosen
@@ -1376,7 +1376,7 @@ EnemySendOutFirstMon: ; 3c92a (f:492a)
ld [hl],a
ld [W_ENEMYDISABLEDMOVE],a
ld [wEnemyDisabledMoveNumber],a
- ld [wccf3],a
+ ld [wEnemyMonMinimized],a
ld hl,wPlayerUsedMove
ld [hli],a
ld [hl],a
@@ -1462,8 +1462,8 @@ EnemySendOutFirstMon: ; 3c92a (f:492a)
ld a,[wCurrentMenuItem]
and a
jr nz,.next4
- ld a,2
- ld [wd07d],a
+ ld a,BATTLE_PARTY_MENU
+ ld [wPartyMenuTypeOrMessageID],a
call DisplayPartyMenu
.next9
ld a,1
@@ -1826,7 +1826,7 @@ SendOutMon: ; 3cc91 (f:4c91)
ld [hl], a
ld [W_PLAYERDISABLEDMOVE], a
ld [wPlayerDisabledMoveNumber], a
- ld [wccf7], a
+ ld [wPlayerMonMinimized], a
ld b, $1
call GoPAL_SET
ld hl, W_ENEMYBATTSTATUS1
@@ -2296,7 +2296,7 @@ DisplayPlayerBag:
DisplayBagMenu:
xor a
- ld [wcf93], a
+ ld [wPrintItemPrices], a
ld a, ITEMLISTMENU
ld [wListMenuID], a
ld a, [wcc2c]
@@ -2305,7 +2305,7 @@ DisplayBagMenu:
ld a, [wCurrentMenuItem]
ld [wcc2c], a
ld a, $0
- ld [wcc37], a
+ ld [wMenuWatchMovingOutOfBounds], a
ld [wMenuItemToSwap], a
jp c, DisplayBattleMenu ; go back to battle menu if an item was not selected
@@ -2384,8 +2384,8 @@ PartyMenuOrRockOrRun:
jp UseBagItem
.partyMenuWasSelected
call LoadScreenTilesFromBuffer1
- xor a
- ld [wd07d], a
+ xor a ; NORMAL_PARTY_MENU
+ ld [wPartyMenuTypeOrMessageID], a
ld [wMenuItemToSwap], a
call DisplayPartyMenu
.checkIfPartyMonWasSelected
@@ -2403,8 +2403,8 @@ PartyMenuOrRockOrRun:
ld bc, $81
ld a, $7f
call FillMemory
- xor a
- ld [wd07d], a
+ xor a ; NORMAL_PARTY_MENU
+ ld [wPartyMenuTypeOrMessageID], a
call GoBackToPartyMenu
jr .checkIfPartyMonWasSelected
.partyMonWasSelected
@@ -2448,7 +2448,7 @@ PartyMenuOrRockOrRun:
ld hl, AnimationSubstitute
jr nz, .doEnemyMonAnimation
; enemy mon doesn't have substitute
- ld a, [wccf3]
+ ld a, [wEnemyMonMinimized]
and a ; has the enemy mon used Minimise?
ld hl, AnimationMinimizeMon
jr nz, .doEnemyMonAnimation
@@ -3215,9 +3215,9 @@ getPlayerAnimationType
playPlayerMoveAnimation
push af
ld a,[W_PLAYERBATTSTATUS2]
- bit 4,a
- ld hl,Func_79747
- ld b,BANK(Func_79747)
+ bit HasSubstituteUp,a
+ ld hl,HideSubstituteShowMonAnim
+ ld b,BANK(HideSubstituteShowMonAnim)
call nz,Bankswitch
pop af
ld [wAnimationType],a
@@ -3226,9 +3226,9 @@ playPlayerMoveAnimation
call HandleExplodingAnimation
call DrawPlayerHUDAndHPBar
ld a,[W_PLAYERBATTSTATUS2]
- bit 4,a
- ld hl,Func_79771
- ld b,BANK(Func_79771)
+ bit HasSubstituteUp,a
+ ld hl,ReshowSubstituteAnim
+ ld b,BANK(ReshowSubstituteAnim)
call nz,Bankswitch
jr MirrorMoveCheck
playerCheckIfFlyOrChargeEffect
@@ -3958,7 +3958,7 @@ PrintMoveFailureText: ; 3dbe2 (f:5be2)
ld hl, KeptGoingAndCrashedText
call PrintText
ld b, $4
- predef Func_48125
+ predef PredefShakeScreenHorizontally
ld a, [H_WHOSETURN]
and a
jr nz, .enemyTurn
@@ -5089,7 +5089,7 @@ AttackSubstitute: ; 3e25e (f:625e)
ld a,[H_WHOSETURN]
xor a,$01
ld [H_WHOSETURN],a
- callab Func_79747 ; animate the substitute breaking
+ callab HideSubstituteShowMonAnim ; animate the substitute breaking
; flip the turn back to the way it was
ld a,[H_WHOSETURN]
xor a,$01
@@ -5767,8 +5767,8 @@ playEnemyMoveAnimation: ; 3e7a4 (f:67a4)
push af
ld a, [W_ENEMYBATTSTATUS2]
bit HasSubstituteUp, a ; does mon have a substitute?
- ld hl, Func_79747
- ld b, BANK(Func_79747)
+ ld hl, HideSubstituteShowMonAnim
+ ld b, BANK(HideSubstituteShowMonAnim)
call nz, Bankswitch
pop af
ld [wAnimationType], a
@@ -5778,8 +5778,8 @@ playEnemyMoveAnimation: ; 3e7a4 (f:67a4)
call DrawEnemyHUDAndHPBar
ld a, [W_ENEMYBATTSTATUS2]
bit HasSubstituteUp, a ; does mon have a substitute?
- ld hl, Func_79771
- ld b, BANK(Func_79771)
+ ld hl, ReshowSubstituteAnim
+ ld b, BANK(ReshowSubstituteAnim)
call nz, Bankswitch ; slide the substitute's sprite out
jr EnemyCheckIfMirrorMoveEffect
@@ -6943,12 +6943,12 @@ InitBattle_Common: ; 3efeb (f:6feb)
call SaveScreenTilesToBuffer1
call ClearScreen
ld a, $98
- ld [$ffbd], a
+ ld [H_AUTOBGTRANSFERDEST + 1], a
ld a, $1
ld [H_AUTOBGTRANSFERENABLED], a
call Delay3
ld a, $9c
- ld [$ffbd], a
+ ld [H_AUTOBGTRANSFERDEST + 1], a
call LoadScreenTilesFromBuffer1
hlCoord 9, 7
ld bc, $50a
@@ -7657,24 +7657,26 @@ UpdateStatDone: ; 3f4ca (f:74ca)
call PrintStatText
ld hl, W_PLAYERBATTSTATUS2
ld de, W_PLAYERMOVENUM
- ld bc, wccf7
+ ld bc, wPlayerMonMinimized
ld a, [H_WHOSETURN]
and a
jr z, .asm_3f4e6
ld hl, W_ENEMYBATTSTATUS2
ld de, W_ENEMYMOVENUM
- ld bc, wccf3
+ ld bc, wEnemyMonMinimized
.asm_3f4e6
ld a, [de]
cp MINIMIZE
jr nz, .asm_3f4f9
- bit HasSubstituteUp, [hl] ; substitute
+ ; if a substitute is up, slide off the substitute and show the mon pic before
+ ; playing the minimize animation
+ bit HasSubstituteUp, [hl]
push af
push bc
- ld hl, Func_79747
- ld b, BANK(Func_79747)
+ ld hl, HideSubstituteShowMonAnim
+ ld b, BANK(HideSubstituteShowMonAnim)
push de
- call nz, Bankswitch ; play Minimize animation unless there's Substitute involved
+ call nz, Bankswitch
pop de
.asm_3f4f9
call PlayCurrentMoveAnimation
@@ -7684,8 +7686,8 @@ UpdateStatDone: ; 3f4ca (f:74ca)
pop bc
ld a, $1
ld [bc], a
- ld hl, Func_79771
- ld b, BANK(Func_79771)
+ ld hl, ReshowSubstituteAnim
+ ld b, BANK(ReshowSubstituteAnim)
pop af
call nz, Bankswitch
.applyBadgeBoostsAndStatusPenalties
diff --git a/engine/battle/moveEffects/transform_effect.asm b/engine/battle/moveEffects/transform_effect.asm
index 1b992df6..185d47af 100644
--- a/engine/battle/moveEffects/transform_effect.asm
+++ b/engine/battle/moveEffects/transform_effect.asm
@@ -26,8 +26,8 @@ TransformEffect_: ; 3bab1 (e:7ab1)
; animation(s) played are different if target has Substitute up
bit HasSubstituteUp, [hl]
push af
- ld hl, Func_79747
- ld b, BANK(Func_79747)
+ ld hl, HideSubstituteShowMonAnim
+ ld b, BANK(HideSubstituteShowMonAnim)
call nz, Bankswitch
ld a, [W_OPTIONS]
add a
@@ -38,8 +38,8 @@ TransformEffect_: ; 3bab1 (e:7ab1)
ld b, BANK(AnimationTransformMon)
.gotAnimToPlay
call Bankswitch
- ld hl, Func_79771
- ld b, BANK(Func_79771)
+ ld hl, ReshowSubstituteAnim
+ ld b, BANK(ReshowSubstituteAnim)
pop af
call nz, Bankswitch
pop bc