diff options
author | Rangi <remy.oukaour+rangi42@gmail.com> | 2020-06-16 19:32:36 -0400 |
---|---|---|
committer | Rangi <remy.oukaour+rangi42@gmail.com> | 2020-06-16 19:32:36 -0400 |
commit | f76dabedcc8af56c871e06a4721de4c79bd30908 (patch) | |
tree | 89c6c2069f0cdb956be742019341620fc4b0df67 | |
parent | c552390a15ae27a24109f369264f1caa6b9f8295 (diff) |
Harmonize engine/{battle, battle_anims, events, games} with pokegold
-rw-r--r-- | engine/battle/battle_transition.asm | 40 | ||||
-rw-r--r-- | engine/battle/core.asm | 31 | ||||
-rw-r--r-- | engine/battle/effect_commands.asm | 4 | ||||
-rw-r--r-- | engine/battle/read_trainer_party.asm | 3 | ||||
-rw-r--r-- | engine/battle_anims/anim_commands.asm | 59 | ||||
-rw-r--r-- | engine/battle_anims/bg_effects.asm | 3 | ||||
-rw-r--r-- | engine/events/daycare.asm | 4 | ||||
-rw-r--r-- | engine/events/field_moves.asm | 6 | ||||
-rw-r--r-- | engine/events/halloffame.asm | 2 | ||||
-rw-r--r-- | engine/events/lucky_number.asm | 1 | ||||
-rw-r--r-- | engine/events/magnet_train.asm | 5 | ||||
-rw-r--r-- | engine/events/overworld.asm | 20 | ||||
-rw-r--r-- | engine/games/dummy_game.asm | 4 |
13 files changed, 97 insertions, 85 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 diff --git a/engine/battle_anims/anim_commands.asm b/engine/battle_anims/anim_commands.asm index bbfc1240e..c4846a334 100644 --- a/engine/battle_anims/anim_commands.asm +++ b/engine/battle_anims/anim_commands.asm @@ -41,7 +41,7 @@ _PlayBattleAnim: pop af ldh [hVBlank], a - ld a, $1 + ld a, 1 ldh [hBGMapMode], a call BattleAnimDelayFrame @@ -155,9 +155,10 @@ BattleAnimRestoreHuds: ld a, BANK(wCurBattleMon) ; aka BANK(wTempMon), BANK(wPartyMon1), and several others ldh [rSVBK], a +; this block should just be "call UpdateBattleHuds" ld hl, UpdateBattleHuds ld a, BANK(UpdatePlayerHUD) - rst FarCall ; Why not "call UpdateBattleHuds"? + rst FarCall pop af ldh [rSVBK], a @@ -891,32 +892,34 @@ BattleAnimCmd_Transform: push af ld a, BANK(wCurPartySpecies) ldh [rSVBK], a - ld a, [wCurPartySpecies] ; CurPartySpecies + + ld a, [wCurPartySpecies] push af ldh a, [hBattleTurn] 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, vTiles0 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, vTiles0 tile $00 predef GetMonBackpic .done pop af - ld [wCurPartySpecies], a ; CurPartySpecies + ld [wCurPartySpecies], a + pop af ldh [rSVBK], a ret @@ -945,11 +948,11 @@ BattleAnimCmd_RaiseSub: push af ld a, 1 ; unnecessary bankswitch? ldh [rSVBK], a - xor a ; sScratch + + xor a ; BANK(sScratch) call GetSRAMBank GetSubstitutePic: ; used only for BANK(GetSubstitutePic) - ld hl, sScratch ld bc, (7 * 7) tiles .loop @@ -1004,6 +1007,7 @@ GetSubstitutePic: ; used only for BANK(GetSubstitutePic) .done call CloseSRAM + pop af ldh [rSVBK], a ret @@ -1019,11 +1023,13 @@ BattleAnimCmd_MinimizeOpp: push af ld a, 1 ; unnecessary bankswitch? ldh [rSVBK], a - xor a ; sScratch + + xor a ; BANK(sScratch) call GetSRAMBank call GetMinimizePic call Request2bpp call CloseSRAM + pop af ldh [rSVBK], a ret @@ -1073,12 +1079,14 @@ BattleAnimCmd_Minimize: push af ld a, 1 ; unnecessary bankswitch? ldh [rSVBK], a - xor a ; sScratch + + xor a ; BANK(sScratch) call GetSRAMBank call GetMinimizePic ld hl, vTiles0 tile $00 call Request2bpp call CloseSRAM + pop af ldh [rSVBK], a ret @@ -1089,7 +1097,7 @@ BattleAnimCmd_DropSub: ld a, BANK(wCurPartySpecies) ldh [rSVBK], a - ld a, [wCurPartySpecies] ; CurPartySpecies + ld a, [wCurPartySpecies] push af ldh a, [hBattleTurn] and a @@ -1103,7 +1111,8 @@ BattleAnimCmd_DropSub: .done pop af - ld [wCurPartySpecies], a ; CurPartySpecies + ld [wCurPartySpecies], a + pop af ldh [rSVBK], a ret @@ -1113,11 +1122,12 @@ BattleAnimCmd_BeatUp: push af ld a, BANK(wCurPartySpecies) ldh [rSVBK], a - ld a, [wCurPartySpecies] ; CurPartySpecies + + ld a, [wCurPartySpecies] push af ld a, [wBattleAnimParam] - ld [wCurPartySpecies], a ; CurPartySpecies + ld [wCurPartySpecies], a ldh a, [hBattleTurn] and a @@ -1137,9 +1147,10 @@ BattleAnimCmd_BeatUp: .done pop af - ld [wCurPartySpecies], a ; CurPartySpecies + ld [wCurPartySpecies], a ld b, SCGB_BATTLE_COLORS call GetSGBLayout + pop af ldh [rSVBK], a ret @@ -1176,7 +1187,7 @@ BattleAnimCmd_Sound: ld [wSFXDuration], a call .GetCryTrack maskbits NUM_NOISE_CHANS - ld [wCryTracks], a ; CryTracks + ld [wCryTracks], a ld e, a ld d, 0 @@ -1220,7 +1231,7 @@ endr ldh a, [rSVBK] push af - ld a, BANK(wEnemyMon) ; wBattleMon is in WRAM0, but EnemyMon is in WRAMX + ld a, BANK(wEnemyMon) ; wBattleMon is in WRAM0, but wEnemyMon is in WRAMX ldh [rSVBK], a ldh a, [hBattleTurn] @@ -1263,14 +1274,14 @@ endr ld a, [hli] ld c, a ld b, [hl] - ld hl, wCryLength ; CryLength + ld hl, wCryLength ld a, [hli] ld h, [hl] ld l, a add hl, bc ld a, l - ld [wCryLength], a ; CryLength + ld [wCryLength], a ld a, h ld [wCryLength + 1], a ld a, 1 @@ -1347,7 +1358,7 @@ ClearBattleAnims:: ld hl, wLYOverrides ld bc, wBattleAnimEnd - wLYOverrides .loop - ld [hl], $0 + ld [hl], 0 inc hl dec bc ld a, c diff --git a/engine/battle_anims/bg_effects.asm b/engine/battle_anims/bg_effects.asm index c74560232..63c610850 100644 --- a/engine/battle_anims/bg_effects.asm +++ b/engine/battle_anims/bg_effects.asm @@ -2839,7 +2839,8 @@ BGEffect_FillLYOverridesBackup: ret BGEffect_DisplaceLYOverridesBackup: - ; e = a; d = [hLYOverrideEnd] - [hLYOverrideStart] - a + ; e = a + ; d = [hLYOverrideEnd] - [hLYOverrideStart] - a push af ld e, a ldh a, [hLYOverrideStart] diff --git a/engine/events/daycare.asm b/engine/events/daycare.asm index a3c1ccfd1..cd9ec42de 100644 --- a/engine/events/daycare.asm +++ b/engine/events/daycare.asm @@ -1,9 +1,9 @@ ; PrintDayCareText.TextTable indexes const_def const DAYCARETEXT_MAN_INTRO - const DAYCARETEXT_MAN_EGG + const DAYCARETEXT_MAN_ODD_EGG const DAYCARETEXT_LADY_INTRO - const DAYCARETEXT_LADY_EGG + const DAYCARETEXT_LADY_ODD_EGG const DAYCARETEXT_WHICH_ONE const DAYCARETEXT_DEPOSIT const DAYCARETEXT_CANT_BREED_EGG diff --git a/engine/events/field_moves.asm b/engine/events/field_moves.asm index 6413840cc..4d95d60cd 100644 --- a/engine/events/field_moves.asm +++ b/engine/events/field_moves.asm @@ -204,7 +204,7 @@ Cut_SpawnAnimateLeaves: ret Cut_StartWaiting: - ld a, $1 + ld a, 1 ldh [hBGMapMode], a ; Cut_WaitAnimSFX ld hl, wJumptableIndex @@ -445,8 +445,8 @@ FlyFunction_FrameTimer: sla a 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 e, 0 + 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 06b6b9390..e488a3941 100644 --- a/engine/events/halloffame.asm +++ b/engine/events/halloffame.asm @@ -278,7 +278,7 @@ HOF_SlideBackpic: ldh a, [hSCX] cp $70 ret z - add $4 + add 4 ldh [hSCX], a call DelayFrame jr .backpicloop diff --git a/engine/events/lucky_number.asm b/engine/events/lucky_number.asm index 6b1d4d8a9..43eb79558 100644 --- a/engine/events/lucky_number.asm +++ b/engine/events/lucky_number.asm @@ -103,6 +103,7 @@ CheckForLuckyNumberWinners: ld a, [wScriptVar] and a ret z ; found nothing + farcall StubbedTrainerRankings_LuckyNumberShow ld a, [wTempByteValue] and a diff --git a/engine/events/magnet_train.asm b/engine/events/magnet_train.asm index 068e2670f..2f4c1dca4 100644 --- a/engine/events/magnet_train.asm +++ b/engine/events/magnet_train.asm @@ -78,6 +78,7 @@ MagnetTrain: ldh [hSCX], a xor a ldh [hBGMapMode], a + pop af ldh [rSVBK], a ret @@ -127,7 +128,7 @@ MagnetTrain_LoadGFX_PlayMusic: ldh [hSCX], a ldh [hSCY], a - ; Load the player sprite + ; Load the player sprite's standing frames ldh a, [rSVBK] push af ld a, BANK(wPlayerGender) @@ -139,7 +140,7 @@ MagnetTrain_LoadGFX_PlayMusic: ld c, 4 call Request2bpp - ; Load the trainer walking frame + ; Load the player sprite's walking frames ld hl, 12 tiles add hl, de ld d, h diff --git a/engine/events/overworld.asm b/engine/events/overworld.asm index d221b7445..58db6106b 100644 --- a/engine/events/overworld.asm +++ b/engine/events/overworld.asm @@ -349,7 +349,7 @@ SurfFunction: .TrySurf: ld de, ENGINE_FOGBADGE call CheckBadge - jr c, .asm_c956 + jr c, .nofogbadge ld hl, wBikeFlags bit BIKEFLAGS_ALWAYS_ON_BIKE_F, [hl] jr nz, .cannotsurf @@ -368,7 +368,7 @@ SurfFunction: jr c, .cannotsurf ld a, $1 ret -.asm_c956 +.nofogbadge ld a, $80 ret .alreadyfail @@ -407,7 +407,7 @@ UsedSurfScript: waitbutton closetext - callasm .empty_fn ; empty function + callasm .stubbed_fn readmem wBuffer2 writevar VAR_MOVEMENT @@ -419,7 +419,7 @@ UsedSurfScript: applymovement PLAYER, wMovementBuffer end -.empty_fn +.stubbed_fn farcall StubbedTrainerRankings_Surf ret @@ -1369,7 +1369,7 @@ RockSmashScript: special WaitSFX playsound SFX_STRENGTH earthquake 84 - applymovementlasttalked MovementData_0xcf55 + applymovementlasttalked MovementData_RockSmash disappear -2 callasm RockMonEncounter @@ -1381,7 +1381,7 @@ RockSmashScript: .done end -MovementData_0xcf55: +MovementData_RockSmash: rock_smash 10 step_end @@ -1591,11 +1591,11 @@ Script_FishCastRod: loademote EMOTE_ROD callasm LoadFishingGFX loademote EMOTE_SHOCK - applymovement PLAYER, MovementData_0xd093 + applymovement PLAYER, MovementData_CastRod pause 40 end -MovementData_0xd093: +MovementData_CastRod: fish_cast_rod step_end @@ -1787,10 +1787,10 @@ AskCutScript: opentext writetext AskCutText yesorno - iffalse .script_d1b8 + iffalse .declined callasm .CheckMap iftrue Script_Cut -.script_d1b8 +.declined closetext end diff --git a/engine/games/dummy_game.asm b/engine/games/dummy_game.asm index d3360ff3f..cf61f56f4 100644 --- a/engine/games/dummy_game.asm +++ b/engine/games/dummy_game.asm @@ -11,7 +11,7 @@ _DummyGame: ld b, SCGB_DIPLOMA call GetSGBLayout callfar ClearSpriteAnims - ld hl, LZ_e2221 + ld hl, DummyGameLZ ld de, vTiles2 tile $00 call Decompress ld hl, Unknown_e00ed @@ -586,5 +586,5 @@ DummyGame_InterpretJoypad_AnimateCursor: ld [hl], a ret -LZ_e2221: +DummyGameLZ: INCBIN "gfx/dummy_game/dummy_game.2bpp.lz" |