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 | |
parent | 356836b1cc479381d5494dbaee40c6a6345c0b43 (diff) |
Harmonize engine/{battle, battle_anims, events, games} with pokecrystal
-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 | ||||
-rw-r--r-- | engine/battle_anims/anim_commands.asm | 16 | ||||
-rw-r--r-- | engine/battle_anims/bg_effects.asm | 1 | ||||
-rw-r--r-- | engine/events/field_moves.asm | 10 | ||||
-rw-r--r-- | engine/events/halloffame.asm | 8 | ||||
-rw-r--r-- | engine/events/overworld.asm | 4 | ||||
-rw-r--r-- | engine/events/specials.asm | 6 | ||||
-rw-r--r-- | engine/games/dummy_game.asm | 4 |
11 files changed, 63 insertions, 60 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 diff --git a/engine/battle_anims/anim_commands.asm b/engine/battle_anims/anim_commands.asm index a60a2645..5061197c 100644 --- a/engine/battle_anims/anim_commands.asm +++ b/engine/battle_anims/anim_commands.asm @@ -870,18 +870,18 @@ BattleAnimCmd_Transform: and a jr z, .player - ld a, [wTempBattleMonSpecies] ; TempBattleMonSpecies - ld [wCurPartySpecies], a ; CurPartySpecies - ld hl, wBattleMonDVs ; BattleMonDVs + ld a, [wTempBattleMonSpecies] + ld [wCurPartySpecies], a + ld hl, wBattleMonDVs predef GetUnownLetter ld de, vTiles2 tile $00 predef GetMonFrontpic jr .done .player - ld a, [wTempEnemyMonSpecies] ; TempEnemyMonSpecies - ld [wCurPartySpecies], a ; CurPartySpecies - ld hl, wEnemyMonDVs ; EnemyMonDVs + ld a, [wTempEnemyMonSpecies] + ld [wCurPartySpecies], a + ld hl, wEnemyMonDVs predef GetUnownLetter ld de, vTiles2 tile $31 predef GetMonBackpic @@ -892,7 +892,7 @@ BattleAnimCmd_Transform: ret BattleAnimCmd_RaiseSub: - xor a ; sScratch + xor a ; BANK(sScratch) call OpenSRAM GetSubstitutePic: ; used only for BANK(GetSubstitutePic) @@ -1050,7 +1050,7 @@ BattleAnimCmd_BeatUp: .done pop af - ld [wCurPartySpecies], a ; CurPartySpecies + ld [wCurPartySpecies], a ld b, SCGB_BATTLE_COLORS call GetSGBLayout ret diff --git a/engine/battle_anims/bg_effects.asm b/engine/battle_anims/bg_effects.asm index de9d0306..fb29aad6 100644 --- a/engine/battle_anims/bg_effects.asm +++ b/engine/battle_anims/bg_effects.asm @@ -539,7 +539,6 @@ _QueueBattleAnimation: callfar QueueBattleAnimation ret - BattleBGEffect_26: call BattleBGEffects_AnonJumptable .anon_dw diff --git a/engine/events/field_moves.asm b/engine/events/field_moves.asm index 3423f840..2b0dbc39 100644 --- a/engine/events/field_moves.asm +++ b/engine/events/field_moves.asm @@ -87,7 +87,7 @@ HideHeadbuttTree: ld h, [hl] ld l, a - ld a, 5 ; grass block + ld a, $05 ; grass block ld [hli], a ld [hld], a ld bc, SCREEN_WIDTH @@ -228,7 +228,7 @@ Cut_SpawnLeaf: ld [hl], FIELDMOVE_GRASS ld hl, SPRITEANIMSTRUCT_0E add hl, bc - ld [hl], 4 + ld [hl], $4 pop af ld hl, SPRITEANIMSTRUCT_0C add hl, bc @@ -418,7 +418,7 @@ FlyFunction_FrameTimer: dec [hl] cp $40 ret c - and 7 + and $7 ret nz ld de, SFX_FLY call PlaySFX @@ -433,7 +433,7 @@ FlyFunction_FrameTimer: ld hl, wce65 ld a, [hl] inc [hl] - and 7 + and $7 ret nz ld a, [hl] and (6 * 8) >> 1 @@ -441,7 +441,7 @@ FlyFunction_FrameTimer: add 8 * 8 ; gives a number in [$40, $50, $60, $70] ld d, a ld e, 0 - ld a, SPRITE_ANIM_INDEX_FLY_LEAF ; fly land + ld a, SPRITE_ANIM_INDEX_FLY_LEAF call InitSpriteAnimStruct ld hl, SPRITEANIMSTRUCT_TILE_ID add hl, bc diff --git a/engine/events/halloffame.asm b/engine/events/halloffame.asm index f74645b7..2a10d736 100644 --- a/engine/events/halloffame.asm +++ b/engine/events/halloffame.asm @@ -107,7 +107,7 @@ AnimateHallOfFame: .done call HOF_AnimatePlayerPic - ld a, 4 + ld a, $4 ld [wMusicFade], a call RotateThreePalettesRight ld c, 8 @@ -378,7 +378,7 @@ _HallOfFamePC: hlcoord 11, 2 .finish - ld de, .EmptyString1 + ld de, .EmptyString call PlaceString call WaitBGMap ld b, SCGB_PLAYER_OR_MON_FRONTPIC_PALS @@ -389,10 +389,10 @@ _HallOfFamePC: and a ret -.EmptyString1: +.EmptyString: db "@" -.EmptyString2: +.UnreferencedEmptyString: db "@" .HOFMaster: diff --git a/engine/events/overworld.asm b/engine/events/overworld.asm index 4f2ba801..2f9d57f8 100644 --- a/engine/events/overworld.asm +++ b/engine/events/overworld.asm @@ -342,7 +342,7 @@ SurfFunction: .TrySurf: ld de, ENGINE_FOGBADGE call CheckBadge - jr c, .asm_c980 + jr c, .nofogbadge ld hl, wBikeFlags bit BIKEFLAGS_ALWAYS_ON_BIKE_F, [hl] jr nz, .cannotsurf @@ -359,7 +359,7 @@ SurfFunction: jr c, .cannotsurf ld a, $1 ret -.asm_c980 +.nofogbadge ld a, $80 ret .alreadyfail diff --git a/engine/events/specials.asm b/engine/events/specials.asm index 91ca4208..6626c081 100644 --- a/engine/events/specials.asm +++ b/engine/events/specials.asm @@ -291,7 +291,7 @@ StoreSwarmMapIndices:: ld [wSwarmMapGroup], a ld a, e ld [wSwarmMapNumber], a - ; fallthrough + SetSwarmFlag: ld hl, wDailyFlags1 set DAILYFLAGS1_SWARM_F, [hl] @@ -332,7 +332,7 @@ CheckLuckyNumberShowFlag: CountUnown: ld hl, wUnownDex - ld b, $0 + ld b, 0 .loop ld a, [hli] and a @@ -350,7 +350,7 @@ SelectApricornForKurt: and a ret z ld [wCurItem], a - ld a, $1 + ld a, 1 ld [wItemQuantityChangeBuffer], a ld hl, wNumItems call TossItem diff --git a/engine/games/dummy_game.asm b/engine/games/dummy_game.asm index e12c791b..2fe4c1ce 100644 --- a/engine/games/dummy_game.asm +++ b/engine/games/dummy_game.asm @@ -19,10 +19,10 @@ _DummyGame: ld bc, 4 tiles ld a, BANK(Unknown_e0908) call FarCopyBytes - ld a, 8 + ld a, $8 ld hl, wc508 ld [hli], a - ld [hl], 0 + ld [hl], $0 hlcoord 0, 0 ld bc, SCREEN_HEIGHT * SCREEN_WIDTH xor a |