aboutsummaryrefslogtreecommitdiffstats
path: root/engine/battle
diff options
context:
space:
mode:
Diffstat (limited to 'engine/battle')
-rw-r--r--engine/battle/animations.asm20
-rw-r--r--engine/battle/core.asm53
-rw-r--r--engine/battle/effects.asm2
-rw-r--r--engine/battle/ghost_marowak_anim.asm2
-rw-r--r--engine/battle/init_battle.asm4
5 files changed, 42 insertions, 39 deletions
diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm
index 08399ad4..cba2f154 100644
--- a/engine/battle/animations.asm
+++ b/engine/battle/animations.asm
@@ -97,13 +97,13 @@ DrawFrameBlock:
; toggle horizontal and vertical flip
ld a, [hli] ; flags
and a
- ld b, OAM_VFLIP | OAM_HFLIP
+ ld b, OAM_YFLIP | OAM_XFLIP
jr z, .storeFlags1
- cp OAM_HFLIP
- ld b, OAM_VFLIP
+ cp OAM_XFLIP
+ ld b, OAM_YFLIP
jr z, .storeFlags1
- cp OAM_VFLIP
- ld b, OAM_HFLIP
+ cp OAM_YFLIP
+ ld b, OAM_XFLIP
jr z, .storeFlags1
ld b, 0
.storeFlags1
@@ -138,13 +138,13 @@ DrawFrameBlock:
ld [de], a ; store tile ID
inc de
ld a, [hli]
- bit OAM_X_FLIP, a
+ bit B_OAM_XFLIP, a
jr nz, .disableHorizontalFlip
.enableHorizontalFlip
- set OAM_X_FLIP, a
+ set B_OAM_XFLIP, a
jr .storeFlags2
.disableHorizontalFlip
- res OAM_X_FLIP, a
+ res B_OAM_XFLIP, a
.storeFlags2
ld b, a
ld a, [wdef4]
@@ -766,7 +766,7 @@ DoBallTossSpecialEffects:
dec b
jr nz, .loop
ld a, %00001000
- ldh [rNR10], a ; Channel 1 sweep register
+ ldh [rAUD1SWEEP], a ; Channel 1 sweep register
ret
.isTrainerBattle ; if it's a trainer battle, shorten the animation by one frame
ld a, [wSubAnimCounter]
@@ -2587,7 +2587,7 @@ FallingObjects_UpdateOAMEntry:
ld [wdef4], a
.asm_79e5c
inc hl
- ld a, 1 << OAM_X_FLIP
+ ld a, OAM_XFLIP
.next2
ld b, a
ld a, [wdef4]
diff --git a/engine/battle/core.asm b/engine/battle/core.asm
index 2a1134de..8024fb9e 100644
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -18,7 +18,7 @@ SlidePlayerAndEnemySilhouettesOnScreen:
call LoadFontTilePatterns
call LoadHudAndHpBarAndStatusTilePatterns
ld hl, vBGMap0
- ld bc, BG_MAP_WIDTH * BG_MAP_HEIGHT
+ ld bc, TILEMAP_AREA
.clearBackgroundLoop
ld a, " "
ld [hli], a
@@ -326,7 +326,7 @@ MainInBattleLoop:
bit USING_TRAPPING_MOVE, a ; check if enemy is using a multi-turn attack like wrap
jr z, .selectPlayerMove ; if not, jump
; enemy is using a multi-turn attack like wrap, so player is trapped and cannot execute a move
- ld a, $ff
+ ld a, CANNOT_MOVE
ld [wPlayerSelectedMove], a
jr .selectEnemyMove
.selectPlayerMove
@@ -2172,9 +2172,9 @@ DisplayBattleMenu::
inc hl
ld a, $1
ld [hli], a ; wMaxMenuItem
- ld [hl], D_RIGHT | A_BUTTON ; wMenuWatchedKeys
+ ld [hl], PAD_RIGHT | PAD_A ; wMenuWatchedKeys
call HandleMenuInput
- bit BIT_D_RIGHT, a
+ bit B_PAD_RIGHT, a
jr nz, .rightColumn
jr .AButtonPressed ; the A button was pressed
.rightColumn ; put cursor in right column of menu
@@ -2205,10 +2205,10 @@ DisplayBattleMenu::
inc hl
ld a, $1
ld [hli], a ; wMaxMenuItem
- ld a, D_LEFT | A_BUTTON
+ ld a, PAD_LEFT | PAD_A
ld [hli], a ; wMenuWatchedKeys
call HandleMenuInput
- bit BIT_D_LEFT, a
+ bit B_PAD_LEFT, a
jr nz, .leftColumn ; if left was pressed, jump
ld a, [wCurrentMenuItem]
add $2 ; if we're in the right column, the actual id is +2
@@ -2450,12 +2450,12 @@ PartyMenuOrRockOrRun:
inc hl
ld a, $2
ld [hli], a ; wMaxMenuItem
- ld a, B_BUTTON | A_BUTTON
+ ld a, PAD_B | PAD_A
ld [hli], a ; wMenuWatchedKeys
xor a
ld [hl], a ; wLastMenuItem
call HandleMenuInput
- bit BIT_B_BUTTON, a
+ bit B_PAD_B, a
jr nz, .partyMonDeselected ; if B was pressed, jump
; A was pressed
call PlaceUnfilledArrowMenuCursor
@@ -2481,10 +2481,10 @@ PartyMenuOrRockOrRun:
jr nz, .doEnemyMonAnimation
; enemy mon doesn't have substitute
ld a, [wEnemyMonMinimized]
- and a ; has the enemy mon used Minimise?
+ and a ; has the enemy mon used Minimize?
ld hl, AnimationMinimizeMon
jr nz, .doEnemyMonAnimation
-; enemy mon is not minimised
+; enemy mon is not minimized
ld a, [wEnemyMonSpecies]
ld [wCurPartySpecies], a
ld [wCurSpecies], a
@@ -2651,10 +2651,10 @@ MoveSelectionMenu:
ld [hli], a ; wMaxMenuItem
ld a, [wMoveMenuType]
dec a
- ld b, D_UP | D_DOWN | A_BUTTON
+ ld b, PAD_UP | PAD_DOWN | PAD_A
jr z, .matchedkeyspicked
dec a
- ld b, D_UP | D_DOWN | A_BUTTON | B_BUTTON
+ ld b, PAD_UP | PAD_DOWN | PAD_A | PAD_B
jr z, .matchedkeyspicked
ld a, [wLinkState]
cp LINK_STATE_BATTLING
@@ -2662,9 +2662,9 @@ MoveSelectionMenu:
; Disable left, right, and START buttons in regular battles.
ld a, [wStatusFlags7]
bit BIT_TEST_BATTLE, a
- ld b, D_UP | D_DOWN | A_BUTTON | B_BUTTON | SELECT
+ ld b, ~(PAD_LEFT | PAD_RIGHT | PAD_START)
jr z, .matchedkeyspicked
- ld b, D_UP | D_DOWN | D_LEFT | D_RIGHT | A_BUTTON | B_BUTTON | SELECT | START
+ ld b, PAD_CTRL_PAD | PAD_BUTTONS
.matchedkeyspicked
ld a, b
ld [hli], a ; wMenuWatchedKeys
@@ -2710,21 +2710,21 @@ SelectMenuItem:
call HandleMenuInput
ld hl, hUILayoutFlags
res BIT_DOUBLE_SPACED_MENU, [hl]
- bit BIT_D_UP, a
+ bit B_PAD_UP, a
jp nz, SelectMenuItem_CursorUp
- bit BIT_D_DOWN, a
+ bit B_PAD_DOWN, a
jp nz, SelectMenuItem_CursorDown
- bit BIT_SELECT, a
+ bit B_PAD_SELECT, a
jp nz, SwapMovesInMenu
IF DEF(_DEBUG)
- bit BIT_START, a
+ bit B_PAD_START, a
jp nz, Func_3d4f5
- bit BIT_D_RIGHT, a
+ bit B_PAD_RIGHT, a
jp nz, Func_3d529
- bit BIT_D_LEFT, a
+ bit B_PAD_LEFT, a
jp nz, Func_3d523
ENDC
- bit BIT_B_BUTTON, a
+ bit B_PAD_B, a
push af
xor a
ld [wMenuItemToSwap], a
@@ -2821,7 +2821,7 @@ SelectMenuItem_CursorDown:
Func_3d4f5:
IF DEF(_DEBUG)
- ASSERT BIT_START == BIT_TRAINER_BATTLE
+ ASSERT B_PAD_START == BIT_TRAINER_BATTLE
ENDC
bit BIT_TRAINER_BATTLE, a
ld a, $0
@@ -3165,7 +3165,7 @@ SelectEnemyMove:
pop hl
jr z, .chooseRandomMove ; move disabled, try again
and a
- jr z, .chooseRandomMove ; move non-existant, try again
+ jr z, .chooseRandomMove ; move non-existent, try again
.done
ld [wEnemySelectedMove], a
ret
@@ -3189,7 +3189,8 @@ LinkBattleExchangeData:
ld b, LINKBATTLE_STRUGGLE
jr z, .next
dec b ; LINKBATTLE_NO_ACTION
- inc a ; does move equal -1 (i.e. no action)?
+ ASSERT CANNOT_MOVE == $ff
+ inc a
jr z, .next
ld a, [wPlayerMoveListIndex]
jr .doExchange
@@ -3242,8 +3243,9 @@ ExecutePlayerMove:
xor a
ldh [hWhoseTurn], a ; set player's turn
ld a, [wPlayerSelectedMove]
+ ASSERT CANNOT_MOVE == $ff
inc a
- jp z, ExecutePlayerMoveDone ; for selected move = FF, skip most of player's turn
+ jp z, ExecutePlayerMoveDone ; if the player cannot move, skip most of their turn
xor a
ld [wMoveMissed], a
ld [wMonIsDisobedient], a
@@ -5766,6 +5768,7 @@ RandomizeDamage:
; for more detailed commentary, see equivalent function for player side (ExecutePlayerMove)
ExecuteEnemyMove:
ld a, [wEnemySelectedMove]
+ ASSERT CANNOT_MOVE == $ff
inc a
jp z, ExecuteEnemyMoveDone
call PrintGhostText
diff --git a/engine/battle/effects.asm b/engine/battle/effects.asm
index d7c7b9cb..b2976a64 100644
--- a/engine/battle/effects.asm
+++ b/engine/battle/effects.asm
@@ -329,7 +329,7 @@ FreezeBurnParalyzeEffect:
ld hl, BurnedText
jp PrintText
.freeze2
-; hyper beam bits aren't reseted for opponent's side
+; hyper beam bits aren't reset for opponent's side
ld a, 1 << FRZ
ld [wBattleMonStatus], a
ld a, SHAKE_SCREEN_ANIM
diff --git a/engine/battle/ghost_marowak_anim.asm b/engine/battle/ghost_marowak_anim.asm
index 1230b936..6514ccaa 100644
--- a/engine/battle/ghost_marowak_anim.asm
+++ b/engine/battle/ghost_marowak_anim.asm
@@ -77,7 +77,7 @@ CopyMonPicFromBGToSpriteVRAM:
ld [hli], a
ld a, d
ld [hli], a
- ld a, OAM_OBP1 | OAM_HIGH_PALS
+ ld a, OAM_PAL1 | OAM_HIGH_PALS
ld [hli], a
inc d
dec c
diff --git a/engine/battle/init_battle.asm b/engine/battle/init_battle.asm
index 58e18a3f..fabff3e3 100644
--- a/engine/battle/init_battle.asm
+++ b/engine/battle/init_battle.asm
@@ -14,7 +14,7 @@ DetermineWildOpponent:
bit BIT_DEBUG_MODE, a
jr z, .notDebugMode
ldh a, [hJoyHeld]
- bit BIT_B_BUTTON, a ; disable wild encounters
+ bit B_PAD_B, a ; disable wild encounters
ret nz
.notDebugMode
ld a, [wNumberOfNoRandomBattleStepsLeft]
@@ -157,7 +157,7 @@ _LoadTrainerPic:
ld d, a ; de contains pointer to trainer pic
ld a, [wLinkState]
and a
- ld a, BANK("Pics 6") ; this is where all the trainer pics are (not counting Red's)
+ ld a, BANK("Trainer Pics")
jr z, .loadSprite
ld a, BANK(RedPicFront)
.loadSprite