summaryrefslogtreecommitdiff
path: root/engine/battle
diff options
context:
space:
mode:
authorRangi <remy.oukaour+rangi42@gmail.com>2020-06-16 19:32:36 -0400
committerRangi <remy.oukaour+rangi42@gmail.com>2020-06-16 19:32:36 -0400
commitf76dabedcc8af56c871e06a4721de4c79bd30908 (patch)
tree89c6c2069f0cdb956be742019341620fc4b0df67 /engine/battle
parentc552390a15ae27a24109f369264f1caa6b9f8295 (diff)
Harmonize engine/{battle, battle_anims, events, games} with pokegold
Diffstat (limited to 'engine/battle')
-rw-r--r--engine/battle/battle_transition.asm40
-rw-r--r--engine/battle/core.asm31
-rw-r--r--engine/battle/effect_commands.asm4
-rw-r--r--engine/battle/read_trainer_party.asm3
4 files changed, 38 insertions, 40 deletions
diff --git a/engine/battle/battle_transition.asm b/engine/battle/battle_transition.asm
index a11286268..653622f86 100644
--- a/engine/battle/battle_transition.asm
+++ b/engine/battle/battle_transition.asm
@@ -55,7 +55,7 @@ DoBattleTransition:
ldh [hLYOverrideEnd], a
ldh [hSCY], a
- ld a, 1 ; unnecessary bankswitch?
+ ld a, $1 ; unnecessary bankswitch?
ldh [rSVBK], a
pop af
ldh [hVBlank], a
@@ -313,7 +313,6 @@ StartTrainerBattle_SetUpForWavyOutro:
farcall Function5602
ld a, BANK(wLYOverrides)
ldh [rSVBK], a
-
call StartTrainerBattle_NextScene
ld a, LOW(rSCX)
@@ -349,7 +348,7 @@ StartTrainerBattle_SineWave:
ld [hl], a
ld a, wLYOverridesEnd - wLYOverrides
ld bc, wLYOverrides
- ld e, $0
+ ld e, 0
.loop
push af
@@ -360,7 +359,7 @@ StartTrainerBattle_SineWave:
inc bc
pop de
ld a, e
- add $2
+ add 2
ld e, a
pop af
dec a
@@ -391,7 +390,7 @@ endr
jr z, .end
ld [wcf65], a
call .load
- ld a, $1
+ ld a, 1
ldh [hBGMapMode], a
call DelayFrame
call DelayFrame
@@ -400,7 +399,7 @@ endr
ret
.end
- ld a, $1
+ ld a, 1
ldh [hBGMapMode], a
call DelayFrame
call DelayFrame
@@ -516,7 +515,7 @@ StartTrainerBattle_SetUpForRandomScatterOutro:
call StartTrainerBattle_NextScene
ld a, $10
ld [wcf64], a
- ld a, $1
+ ld a, 1
ldh [hBGMapMode], a
ret
@@ -585,35 +584,36 @@ StartTrainerBattle_LoadPokeBallGraphics:
xor a
ldh [hBGMapMode], a
+
hlcoord 0, 0, wAttrmap
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
inc b
inc c
jr .enter_loop_midway
-.loop
+.pal_loop
; set all pals to 7
ld a, [hl]
- or %00000111
+ or PAL_BG_TEXT
ld [hli], a
.enter_loop_midway
dec c
- jr nz, .loop
+ jr nz, .pal_loop
dec b
- jr nz, .loop
+ jr nz, .pal_loop
call .loadpokeballgfx
hlcoord 2, 1
ld b, SCREEN_WIDTH - 4
-.loop2
+.tile_loop
push hl
ld c, 2
-.loop3
+.row_loop
push hl
ld a, [de]
inc de
-.loop4
+.col_loop
; Loading is done bit by bit
and a
jr z, .done
@@ -622,7 +622,7 @@ StartTrainerBattle_LoadPokeBallGraphics:
ld [hl], BATTLETRANSITION_SQUARE
.no_load
inc hl
- jr .loop4
+ jr .col_loop
.done
pop hl
@@ -631,7 +631,7 @@ StartTrainerBattle_LoadPokeBallGraphics:
add hl, bc
pop bc
dec c
- jr nz, .loop3
+ jr nz, .row_loop
pop hl
push bc
@@ -639,12 +639,12 @@ StartTrainerBattle_LoadPokeBallGraphics:
add hl, bc
pop bc
dec b
- jr nz, .loop2
+ jr nz, .tile_loop
ldh a, [hCGB]
and a
jr nz, .cgb
- ld a, $1
+ ld a, 1
ldh [hBGMapMode], a
call DelayFrame
call DelayFrame
@@ -673,7 +673,7 @@ StartTrainerBattle_LoadPokeBallGraphics:
call CopyBytes
pop af
ldh [rSVBK], a
- ld a, $1
+ ld a, 1
ldh [hCGBPalUpdate], a
call DelayFrame
call BattleStart_CopyTilemapAtOnce
@@ -827,7 +827,7 @@ ENDM
ret
Unreferenced_Function8c7c9:
- ld a, $1
+ ld a, 1
ldh [hBGMapMode], a
call WaitBGMap
xor a
diff --git a/engine/battle/core.asm b/engine/battle/core.asm
index 9805ec958..b1667381c 100644
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -1963,14 +1963,14 @@ RestoreHP:
ld b, a
ld a, [hl]
sbc b
- jr c, .asm_3cd2d
+ jr c, .overflow
ld a, b
ld [hli], a
ld [wBuffer6], a
ld a, c
ld [hl], a
ld [wBuffer5], a
-.asm_3cd2d
+.overflow
call SwitchTurnCore
call UpdateHPBarBattleHuds
@@ -5958,7 +5958,7 @@ LoadEnemyMon:
jp nz, InitEnemyMon
; and also not in a BattleTower-Battle
- ld a, [wInBattleTowerBattle] ; ????
+ ld a, [wInBattleTowerBattle]
bit 0, a
jp nz, InitEnemyMon
@@ -7764,7 +7764,6 @@ GoodComeBackText:
text_end
Unreferenced_TextJump_ComeBack:
-; this function doesn't seem to be used
ld hl, ComeBackText
ret
@@ -8127,8 +8126,8 @@ InitEnemyTrainer:
jr nz, .ok
xor a
ld [wOTPartyMon1Item], a
-.ok
+.ok
ld de, vTiles2
callfar GetTrainerPic
xor a
@@ -8374,21 +8373,21 @@ DisplayLinkBattleResult:
ld a, [wBattleResult]
and $f
cp LOSE
- jr c, .victory ; WIN
- jr z, .loss ; LOSE
+ jr c, .win ; WIN
+ jr z, .lose ; LOSE
; DRAW
farcall StubbedTrainerRankings_ColosseumDraws
ld de, .Draw
jr .store_result
-.victory
+.win
farcall StubbedTrainerRankings_ColosseumWins
- ld de, .Win
+ ld de, .YouWin
jr .store_result
-.loss
+.lose
farcall StubbedTrainerRankings_ColosseumLosses
- ld de, .Lose
+ ld de, .YouLose
jr .store_result
.store_result
@@ -8418,23 +8417,23 @@ DisplayLinkBattleResult:
call ClearTilemap
ret
-.Win:
+.YouWin:
db "YOU WIN@"
-.Lose:
+.YouLose:
db "YOU LOSE@"
.Draw:
db " DRAW@"
.Mobile_InvalidBattle:
hlcoord 6, 8
- ld de, .Invalid
+ ld de, .InvalidBattle
call PlaceString
ld c, 200
call DelayFrames
call ClearTilemap
ret
-.Invalid:
+.InvalidBattle:
db "INVALID BATTLE@"
IsMobileBattle2:
@@ -9013,7 +9012,7 @@ CopyBackpic:
ld de, vTiles2 tile $31
ldh a, [hROMBank]
ld b, a
- ld c, $31
+ ld c, 7 * 7
call Get2bpp
pop af
ldh [rSVBK], a
diff --git a/engine/battle/effect_commands.asm b/engine/battle/effect_commands.asm
index c3e913cf3..d936e9f7e 100644
--- a/engine/battle/effect_commands.asm
+++ b/engine/battle/effect_commands.asm
@@ -5079,7 +5079,7 @@ BattleCommand_ForceSwitch:
call UpdateBattleMonInParty
xor a
ld [wNumHits], a
- inc a
+ inc a ; TRUE
ld [wForcedSwitch], a
call SetBattleDraw
ld a, [wPlayerMoveStructAnimation]
@@ -5172,7 +5172,7 @@ BattleCommand_ForceSwitch:
call UpdateBattleMonInParty
xor a
ld [wNumHits], a
- inc a
+ inc a ; TRUE
ld [wForcedSwitch], a
call SetBattleDraw
ld a, [wEnemyMoveStructAnimation]
diff --git a/engine/battle/read_trainer_party.asm b/engine/battle/read_trainer_party.asm
index 9a7545a2c..e13747e07 100644
--- a/engine/battle/read_trainer_party.asm
+++ b/engine/battle/read_trainer_party.asm
@@ -380,8 +380,7 @@ CopyTrainerName:
pop de
ret
-Function39990:
-; This function is useless.
+Unreferenced_Function39990:
ld de, wStringBuffer1
push de
ld bc, NAME_LENGTH