diff options
| author | Rangi <remy.oukaour+rangi42@gmail.com> | 2020-06-16 19:32:30 -0400 |
|---|---|---|
| committer | Rangi <remy.oukaour+rangi42@gmail.com> | 2020-06-16 19:32:30 -0400 |
| commit | bc116a0db0857ef49ba4a65bf98b9b8339315c01 (patch) | |
| tree | d753b2bcbe162b9aa416a3fbf3007884bfbe5aa4 /engine/battle | |
| parent | 356836b1cc479381d5494dbaee40c6a6345c0b43 (diff) | |
Harmonize engine/{battle, battle_anims, events, games} with pokecrystal
Diffstat (limited to 'engine/battle')
| -rw-r--r-- | engine/battle/battle_transition.asm | 18 | ||||
| -rw-r--r-- | engine/battle/core.asm | 44 | ||||
| -rw-r--r-- | engine/battle/effect_commands.asm | 10 | ||||
| -rw-r--r-- | engine/battle/menu.asm | 2 |
4 files changed, 39 insertions, 35 deletions
diff --git a/engine/battle/battle_transition.asm b/engine/battle/battle_transition.asm index 21d332fe..3686a459 100644 --- a/engine/battle/battle_transition.asm +++ b/engine/battle/battle_transition.asm @@ -21,7 +21,7 @@ DoBattleTransition: ld hl, hVBlank ld a, [hl] push af - ld [hl], 1 + ld [hl], $1 .loop ld a, [wJumptableIndex] @@ -533,14 +533,14 @@ StartTrainerBattle_LoadPokeBallGraphics: hlcoord 2, 1 ld de, .PokeBallTransition ld b, SCREEN_WIDTH - 4 -.loop +.tile_loop push hl ld c, 2 -.loop2 +.row_loop push hl ld a, [de] inc de -.loop3 +.col_loop ; Loading is done bit by bit and a jr z, .done @@ -549,7 +549,7 @@ StartTrainerBattle_LoadPokeBallGraphics: ld [hl], BATTLETRANSITION_SQUARE .no_load inc hl - jr .loop3 + jr .col_loop .done pop hl @@ -558,7 +558,7 @@ StartTrainerBattle_LoadPokeBallGraphics: add hl, bc pop bc dec c - jr nz, .loop2 + jr nz, .row_loop pop hl push bc @@ -566,7 +566,7 @@ StartTrainerBattle_LoadPokeBallGraphics: add hl, bc pop bc dec b - jr nz, .loop + jr nz, .tile_loop ldh a, [hCGB] and a @@ -594,10 +594,12 @@ StartTrainerBattle_LoadPokeBallGraphics: ld de, wBGPals2 palette PAL_BG_TEXT ld bc, 1 palettes call CopyBytes + hlcoord 0, 0, wAttrmap ld bc, SCREEN_HEIGHT * SCREEN_WIDTH - ld a, %00000111 + ld a, PAL_BG_TEXT call ByteFill + ld a, 1 ldh [hCGBPalUpdate], a call DelayFrame diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 512c2598..65685dd4 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -1910,14 +1910,14 @@ RestoreHP: ld b, a ld a, [hl] sbc b - jr c, .asm_3ccd5 + jr c, .overflow ld a, b ld [hli], a ld [wBuffer6], a ld a, c ld [hl], a ld [wBuffer5], a -.asm_3ccd5 +.overflow call SwitchTurnCore call UpdateHPBarBattleHuds @@ -3198,7 +3198,7 @@ ScoreMonTypeMatchups: .loop5 call BattleRandom and $7 - cp 6 + cp PARTY_LENGTH jr nc, .loop5 ld b, a ld a, [wCurOTMon] @@ -5945,7 +5945,7 @@ LoadEnemyMon: jr z, .Happiness ; 40% chance of not flooring call Random - cp 40 percent - 2 + cp 39 percent + 1 jr c, .Happiness ; Try again if length < 1024 mm (i.e. if HIGH(length) < 3 feet) ld a, [wMagikarpLength] @@ -7710,7 +7710,7 @@ GetEnemyMonFrontpic_DoAnim: ldh a, [hBattleTurn] push af call SetEnemyTurn - ld a, BANK(BattleAnimCmd_MinimizeOpp) + ld a, BANK(BattleAnimCommands) rst FarCall pop af ldh [hBattleTurn], a @@ -7802,7 +7802,7 @@ InitEnemyTrainer: xor a ld [wOTPartyMon1Item], a -.ok: +.ok ld de, vTiles2 callfar GetTrainerPic xor a @@ -7928,14 +7928,14 @@ Unreferenced_Function3f41a: ExitBattle: call IsLinkBattle - jr nz, .handle_end_of_battle + jr nz, .HandleEndOfBattle call ShowLinkBattleParticipantsAfterEnd - jr .clean_up_battle_ram + jr .CleanUpBattleRAM -.handle_end_of_battle +.HandleEndOfBattle: ld a, [wBattleResult] and $f - jr nz, .clean_up_battle_ram + jr nz, .CleanUpBattleRAM ; WIN call CheckPayDay xor a @@ -7943,7 +7943,7 @@ ExitBattle: predef EvolveAfterBattle farcall GivePokerusAndConvertBerries -.clean_up_battle_ram +.CleanUpBattleRAM: call BattleEnd_HandleRoamMons xor a ld [wLowHealthAlarm], a @@ -8020,10 +8020,10 @@ ShowLinkBattleParticipantsAfterEnd: ld a, [wBattleResult] and $f cp LOSE - ld de, .Win - jr c, .store_result - ld de, .Lose - jr z, .store_result + ld de, .YouWin + jr c, .store_result ; WIN + ld de, .YouLose + jr z, .store_result ; LOSE ; DRAW ld de, .Draw @@ -8045,9 +8045,9 @@ ShowLinkBattleParticipantsAfterEnd: call ClearTilemap ret -.Win: +.YouWin: db "YOU WIN@" -.Lose: +.YouLose: db "YOU LOSE@" .Draw: db " DRAW@" @@ -8358,6 +8358,7 @@ AddLastLinkBattleToLinkRecord: call .StoreResult call .FindOpponentAndAppendRecord ret + .StoreResult: ld a, [wBattleResult] and $f @@ -8574,6 +8575,9 @@ InitBackPic: ret GetTrainerBackpic: +; Load the player character's backpic (6x6) into VRAM starting from vTiles2 tile $31. + +; Special exception for Dude. ld hl, ChrisBackpic ld a, [wBattleType] cp BATTLETYPE_TUTORIAL @@ -8582,7 +8586,7 @@ GetTrainerBackpic: .ok: ld de, vTiles2 tile $31 - ld b, BANK(ChrisBackpic) + ld b, BANK(ChrisBackpic) ; aka BANK(DudeBackpic) ld c, 7 * 7 predef DecompressGet2bpp ret @@ -8590,7 +8594,7 @@ GetTrainerBackpic: CopyBackpic: ld a, BANK(sDecompressBuffer) call OpenSRAM - ld hl, vTiles3 + ld hl, vTiles0 ld de, sDecompressBuffer ldh a, [hROMBank] ld b, a @@ -8598,7 +8602,7 @@ CopyBackpic: call Request2bpp call CloseSRAM call .LoadTrainerBackpicAsOAM - ld a, 7 * 7 + ld a, $31 ldh [hGraphicStartTile], a hlcoord 2, 6 lb bc, 6, 6 diff --git a/engine/battle/effect_commands.asm b/engine/battle/effect_commands.asm index 07717114..054eeaca 100644 --- a/engine/battle/effect_commands.asm +++ b/engine/battle/effect_commands.asm @@ -5045,10 +5045,9 @@ BattleCommand_ForceSwitch: call UpdateBattleMonInParty xor a ld [wNumHits], a - inc a + inc a ; TRUE ld [wForcedSwitch], a - ; set battle draw - inc a + inc a ; DRAW ld [wBattleResult], a ld a, [wPlayerMoveStructAnimation] jp .succeed @@ -5140,10 +5139,9 @@ BattleCommand_ForceSwitch: call UpdateBattleMonInParty xor a ld [wNumHits], a - inc a + inc a ; TRUE ld [wForcedSwitch], a - ; set battle draw - inc a + inc a ; DRAW ld [wBattleResult], a ld a, [wEnemyMoveStructAnimation] jr .succeed diff --git a/engine/battle/menu.asm b/engine/battle/menu.asm index f75d4114..4cc45d91 100644 --- a/engine/battle/menu.asm +++ b/engine/battle/menu.asm @@ -4,7 +4,7 @@ LoadBattleMenu: jr Function24e78 SafariBattleMenu: - ; untranslated +; untranslated ld hl, MenuHeader_0x24eae call LoadMenuHeader jr Function24e78 |
