From 7a3c2ae4b9588062adb02d06143b676ed90c6a41 Mon Sep 17 00:00:00 2001 From: Narishma-gb <194818981+Narishma-gb@users.noreply.github.com> Date: Tue, 9 Sep 2025 17:05:23 +0200 Subject: [PATCH 1/3] Name some printer/diploma routines, name wd434, misc. cleanup --- Makefile | 3 +- constants/map_object_constants.asm | 2 + engine/battle/core.asm | 22 ++-- engine/battle/move_effects/substitute.asm | 2 +- engine/battle/scale_sprites.asm | 2 +- engine/events/black_out.asm | 2 +- engine/events/diploma.asm | 2 +- engine/events/diploma2.asm | 110 +++++++----------- engine/events/hidden_objects/bench_guys.asm | 12 +- engine/events/pikachu_happiness.asm | 4 +- engine/events/poison.asm | 4 +- engine/events/pokecenter.asm | 8 +- engine/items/item_effects.asm | 4 +- engine/items/town_map.asm | 2 +- engine/menus/link_menu.asm | 14 +-- engine/menus/party_menu.asm | 2 +- engine/menus/save.asm | 2 +- engine/minigame/surfing_pikachu.asm | 2 +- engine/movie/hall_of_fame.asm | 6 +- engine/movie/intro_yellow.asm | 8 +- engine/movie/oak_speech/oak_speech.asm | 6 +- engine/pikachu/pikachu_emotions.asm | 8 +- engine/pikachu/pikachu_follow.asm | 4 +- engine/pikachu/pikachu_pic_animation.asm | 2 +- engine/pikachu/pikachu_status.asm | 44 +++---- engine/pikachu/respawn_overworld_pikachu.asm | 2 +- engine/pokemon/bills_pc.asm | 8 +- engine/pokemon/evos_moves.asm | 2 +- engine/pokemon/status_screen.asm | 4 +- engine/printer/printer.asm | 101 ++++++++-------- .../diploma.png} | Bin gfx/diploma/diploma_mew.tilemap | 1 + gfx/diploma/diploma_pikachu.tilemap | 1 + gfx/surfing_pikachu/high_score_1.tilemap | 1 + gfx/surfing_pikachu/high_score_2.tilemap | 2 + home/map_objects.asm | 4 +- home/overworld.asm | 29 +++-- home/pics.asm | 4 +- home/pokemon.asm | 2 +- home/uncompress.asm | 2 +- ram/wram.asm | 2 +- scripts/BillsHouse.asm | 2 +- scripts/CeladonMansion1F_2.asm | 2 +- scripts/Daycare.asm | 4 +- scripts/PewterPokecenter_2.asm | 2 +- scripts/PokemonFanClub.asm | 2 +- scripts/VictoryRoad1F.asm | 2 +- scripts/VictoryRoad2F.asm | 2 +- 48 files changed, 217 insertions(+), 241 deletions(-) rename gfx/{surfing_pikachu/surfing_pikachu_3.png => diploma/diploma.png} (100%) create mode 100644 gfx/diploma/diploma_mew.tilemap create mode 100644 gfx/diploma/diploma_pikachu.tilemap create mode 100644 gfx/surfing_pikachu/high_score_1.tilemap create mode 100644 gfx/surfing_pikachu/high_score_2.tilemap diff --git a/Makefile b/Makefile index 673af35d8..c527ad9a9 100644 --- a/Makefile +++ b/Makefile @@ -148,8 +148,9 @@ gfx/trade/game_boy.2bpp: tools/gfx += --remove-duplicates gfx/sgb/border.2bpp: tools/gfx += --trim-whitespace +gfx/diploma/diploma.2bpp: tools/gfx += --trim-whitespace + gfx/surfing_pikachu/surfing_pikachu_1c.2bpp: tools/gfx += --trim-whitespace -gfx/surfing_pikachu/surfing_pikachu_3.2bpp: tools/gfx += --trim-whitespace ### Catch-all graphics rules diff --git a/constants/map_object_constants.asm b/constants/map_object_constants.asm index 3b17c6ae6..76ee562e7 100644 --- a/constants/map_object_constants.asm +++ b/constants/map_object_constants.asm @@ -40,6 +40,8 @@ DEF SPRITESTATEDATA2_LENGTH EQU const_value DEF NUM_SPRITESTATEDATA_STRUCTS EQU 16 +DEF PIKACHU_SPRITE_INDEX EQU NUM_SPRITESTATEDATA_STRUCTS -1 + const_def 6 const BIT_TRAINER ; 6 const BIT_ITEM ; 7 diff --git a/engine/battle/core.asm b/engine/battle/core.asm index ca5dcec94..5e4021230 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -1053,7 +1053,7 @@ RemoveFaintedPlayerMon: ld a, [wPlayerMonNumber] ld [wWhichPokemon], a - callfar IsThisPartymonStarterPikachu_Party + callfar IsThisPartyMonStarterPikachu jr nc, .notPlayerPikachu ldpikacry e, PikachuCry4 callfar PlayPikachuSoundClip @@ -1794,7 +1794,7 @@ SendOutMon: call RunPaletteCommand ld hl, wEnemyBattleStatus1 res USING_TRAPPING_MOVE, [hl] - callfar IsThisPartymonStarterPikachu + callfar IsThisPartyMonStarterPikachu jr c, .starterPikachu ld a, $1 ldh [hWhoseTurn], a @@ -1829,7 +1829,7 @@ AnimateRetreatingPlayerMon: push af ld a, [wPlayerMonNumber] ld [wWhichPokemon], a - callfar IsThisPartymonStarterPikachu + callfar IsThisPartyMonStarterPikachu pop bc ld a, b ld [wWhichPokemon], a @@ -4331,7 +4331,7 @@ IgnoredOrdersText: GetDamageVarsForPlayerAttack: xor a ld hl, wDamage ; damage to eventually inflict, initialise to zero - ldi [hl], a + ld [hli], a ld [hl], a ld hl, wPlayerMovePower ld a, [hli] @@ -4637,8 +4637,8 @@ CalculateDamage: xor a ld hl, hDividend - ldi [hl], a - ldi [hl], a + ld [hli], a + ld [hli], a ld [hl], a ; Multiply level by 2 @@ -4651,11 +4651,11 @@ CalculateDamage: pop af .nc inc hl - ldi [hl], a + ld [hli], a ; Divide by 5 ld a, 5 - ldd [hl], a + ld [hld], a push bc ld b, 4 call Divide @@ -4894,7 +4894,7 @@ HandleCounterMove: ; if it did damage, double it ld a, [hl] add a - ldd [hl], a + ld [hld], a ld a, [hl] adc a ld [hl], a @@ -5245,7 +5245,7 @@ HandleBuildingRage: call StatModifierUpEffect ; stat modifier raising function pop hl xor a - ldd [hl], a ; null move effect + ld [hld], a ; null move effect ld a, RAGE ld [hl], a ; restore the target pokemon's move number to Rage ldh a, [hWhoseTurn] @@ -6561,7 +6561,7 @@ LoadPlayerBackPic: jr nz, .loop ld de, vBackPic call InterlaceMergeSpriteBuffers - ld a, $0 + ld a, BANK("Sprite Buffers") call OpenSRAM ld hl, vSprites ld de, sSpriteBuffer1 diff --git a/engine/battle/move_effects/substitute.asm b/engine/battle/move_effects/substitute.asm index b1fd8ac28..e43112097 100644 --- a/engine/battle/move_effects/substitute.asm +++ b/engine/battle/move_effects/substitute.asm @@ -39,7 +39,7 @@ SubstituteEffect_: jr c, .notEnoughHP ; underflow means user would be left with negative health ; bug: since it only branches on carry, it will possibly leave user with 0 HP .userHasZeroOrMoreHP - ldi [hl], a ; save resulting HP after subtraction into current HP + ld [hli], a ; save resulting HP after subtraction into current HP ld [hl], d ld h, b ld l, c diff --git a/engine/battle/scale_sprites.asm b/engine/battle/scale_sprites.asm index eedd2e1d7..4666f6969 100644 --- a/engine/battle/scale_sprites.asm +++ b/engine/battle/scale_sprites.asm @@ -2,7 +2,7 @@ ; assumes that input sprite chunks are 4x4 tiles, and the rightmost and bottommost 4 pixels will be ignored ; resulting in a 7*7 tile output sprite chunk ScaleSpriteByTwo: - ld a, $0 + ld a, BANK("Sprite Buffers") call OpenSRAM call .ScaleSpriteByTwo call CloseSRAM diff --git a/engine/events/black_out.asm b/engine/events/black_out.asm index f142782a1..2b017f718 100644 --- a/engine/events/black_out.asm +++ b/engine/events/black_out.asm @@ -1,7 +1,7 @@ ResetStatusAndHalveMoneyOnBlackout:: ; Reset player status on blackout. xor a - ld [wd434], a + ld [wPikachuCollisionCounter], a xor a ; gamefreak copypasting functions (double xor a) ld [wBattleResult], a ld [wWalkBikeSurfState], a diff --git a/engine/events/diploma.asm b/engine/events/diploma.asm index 678374759..539cba422 100644 --- a/engine/events/diploma.asm +++ b/engine/events/diploma.asm @@ -6,7 +6,7 @@ DisplayDiploma:: ld [wUpdateSpritesEnabled], a ld hl, wStatusFlags5 set BIT_NO_TEXT_DELAY, [hl] - callfar _DisplayDiploma + callfar DisplayDiplomaTop call WaitForTextScrollButtonPress ld hl, wStatusFlags5 res BIT_NO_TEXT_DELAY, [hl] diff --git a/engine/events/diploma2.asm b/engine/events/diploma2.asm index 87a444394..0653526de 100644 --- a/engine/events/diploma2.asm +++ b/engine/events/diploma2.asm @@ -1,22 +1,19 @@ DEF CIRCLE_TILE_ID EQU $10 -_DisplayDiploma: +DisplayDiplomaTop: call GBPalWhiteOutWithDelay3 call ClearScreen - ld de, SurfingPikachu3Graphics + ld de, DiplomaGraphics ld hl, vChars2 - lb bc, BANK(SurfingPikachu3Graphics), (SurfingPikachu3GraphicsEnd - SurfingPikachu3Graphics) / $10 + lb bc, BANK(DiplomaGraphics), (DiplomaGraphicsEnd - DiplomaGraphics) / $10 call CopyVideoData hlcoord 0, 0 - call Func_e9bdf - + call DiplomaDrawHorizontalBorder hlcoord 0, 0 - call Func_e9beb - + call DiplomaDrawVerticalBorder hlcoord 19, 0 - call Func_e9beb - + call DiplomaDrawVerticalBorder ld a, $00 hlcoord 0, 0 ld [hl], a @@ -67,105 +64,86 @@ DiplomaCongrats: DiplomaGameFreak: db "GAME FREAK@" -Func_e9ad3: +DisplayDiplomaBottom: call ClearScreen hlcoord 0, 17 - call Func_e9bdf + call DiplomaDrawHorizontalBorder hlcoord 0, 0 - call Func_e9beb + call DiplomaDrawVerticalBorder hlcoord 19, 0 - call Func_e9beb + call DiplomaDrawVerticalBorder ld a, $00 hlcoord 0, 17 ld [hl], a hlcoord 19, 17 ld [hl], a - ld de, Tilemap_e9b3e + + ld de, DiplomaPikachuTiles hlcoord 6, 2 lb bc, 10, 12 call Diploma_Surfing_CopyBox - ld de, Tilemap_e9bb6 + + ld de, CongratulationsTiles hlcoord 5, 13 lb bc, 1, 11 call Diploma_Surfing_CopyBox - ld de, String_e9bd5 + + ld de, DiplomaPlayTime hlcoord 2, 15 call PlaceString hlcoord 12, 15 ld de, wPlayTimeHours - lb bc, $40 | 1, 3 + lb bc, LEFT_ALIGN | 1, 3 call PrintNumber - ld [hl], $16 + ld [hl], $16 ; colon inc hl ld de, wPlayTimeMinutes - lb bc, $80 | 1, 2 + lb bc, LEADING_ZEROES | 1, 2 call PrintNumber + ld a, [wNumSetBits] - cp 151 + cp NUM_POKEMON ret nz - ld de, TileMap_e9bc1 + ld de, DiplomaMewTiles hlcoord 2, 0 lb bc, 4, 5 call Diploma_Surfing_CopyBox ret -Tilemap_e9b3e: - db $7f, $7f, $7f, $1a, $1b, $7f, $7f, $7f, $7f, $7f - db $7f, $7f, $7f, $7f, $7f, $1c, $1d, $1e, $1f, $20 - db $7f, $21, $22, $23, $7f, $24, $25, $26, $27, $28 - db $29, $2a, $2b, $2c, $2d, $2e, $2f, $30, $31, $32 - db $33, $34, $35, $36, $37, $38, $39, $3a, $3b, $3c - db $7f, $3d, $3e, $3f, $40, $41, $42, $43, $29, $44 - db $45, $46, $47, $48, $49, $4a, $4b, $29, $29, $4c - db $4d, $4e, $4f, $50, $51, $52, $53, $54, $55, $56 - db $57, $58, $59, $7f, $7f, $7f, $5a, $5b, $5c, $5d - db $5e, $5f, $60, $61, $62, $7f, $7f, $7f, $7f, $63 - db $64, $65, $66, $67, $68, $7f, $7f, $7f, $7f, $7f - db $7f, $69, $6a, $6b, $6c, $6d, $6e, $7f, $7f, $7f - -Tilemap_e9bb6: - db $05 - db $06 - db $07 - db $08 - db $09 - db $0a - db $0b - db $0c - db $0d - db $0e - db $0f - -TileMap_e9bc1: - db $70, $71, $7f, $72, $7f - db $73, $74, $75, $76, $77 - db $7f, $78, $11, $12, $13 - db $7f, $7f, $14, $15, $7f - -String_e9bd5: db "PLAY TIME@" - -Func_e9bdf: - ld c, 10 -.asm_e9be1 +DiplomaPikachuTiles: +INCBIN "gfx/diploma/diploma_pikachu.tilemap" + +CongratulationsTiles: + db $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $0f ; CONGRATULATIONS! + +DiplomaMewTiles: +INCBIN "gfx/diploma/diploma_mew.tilemap" + +DiplomaPlayTime: + db "PLAY TIME@" + +DiplomaDrawHorizontalBorder: + ld c, SCREEN_WIDTH / 2 +.loop ld [hl], $02 inc hl ld [hl], $01 inc hl dec c - jr nz, .asm_e9be1 + jr nz, .loop ret -Func_e9beb: - ld c, 9 +DiplomaDrawVerticalBorder: + ld c, SCREEN_HEIGHT / 2 ld de, SCREEN_WIDTH -.asm_e9bed +.loop ld [hl], $04 add hl, de ld [hl], $03 add hl, de dec c - jr nz, .asm_e9bed + jr nz, .loop ret -SurfingPikachu3Graphics: INCBIN "gfx/surfing_pikachu/surfing_pikachu_3.2bpp" -SurfingPikachu3GraphicsEnd: +DiplomaGraphics: INCBIN "gfx/diploma/diploma.2bpp" +DiplomaGraphicsEnd: diff --git a/engine/events/hidden_objects/bench_guys.asm b/engine/events/hidden_objects/bench_guys.asm index e5a2a7249..81519f2ff 100644 --- a/engine/events/hidden_objects/bench_guys.asm +++ b/engine/events/hidden_objects/bench_guys.asm @@ -18,14 +18,10 @@ PrintBenchGuyText: ld a, [wSpritePlayerStateData1FacingDirection] cp b - ; bug: an 'inc hl' instruction is needed before looping back. When trying to - ; talk to a bench guy from above, this Sprite Facing test will fail, and the - ; next loop iteration will be misaligned within BenchGuyTextPointers table. - ; As a result, the routine will miss the terminator byte, and continue to - ; process data beyond the table boundary. - ; It seems that it will only return after starting to read data from VRAM - ; (According to Pan Docs, during PPU mode 3, reads return garbage value, - ; usually $FF). + ; bug: an 'inc hl' instruction is needed before looping back. + ; Due to Yellow's new Pokecenter layout, it's now impossible to talk to a + ; bench guy from above. The bug is still present but will not be triggered + ; in a regular play. jr nz, .loop ; player isn't facing the bench guy ld a, [hl] jp PrintPredefTextID diff --git a/engine/events/pikachu_happiness.asm b/engine/events/pikachu_happiness.asm index 0aee04f99..32a69c2b2 100644 --- a/engine/events/pikachu_happiness.asm +++ b/engine/events/pikachu_happiness.asm @@ -5,14 +5,14 @@ ModifyPikachuHappiness:: cp PIKAHAPPY_WALKING jr z, .checkanywhereinparty push de - callfar IsThisPartymonStarterPikachu_Party + callfar IsThisPartyMonStarterPikachu pop de ret nc jr .proceed .checkanywhereinparty push de - callfar IsStarterPikachuInOurParty + callfar IsStarterPikachuAliveInOurParty pop de ret nc diff --git a/engine/events/poison.asm b/engine/events/poison.asm index 4645387cf..eddf932f9 100644 --- a/engine/events/poison.asm +++ b/engine/events/poison.asm @@ -62,7 +62,7 @@ ApplyOutOfBattlePoisonDamage: ld a, TEXT_MON_FAINTED ldh [hTextID], a call DisplayTextID - callfar IsThisPartymonStarterPikachu_Party + callfar IsThisPartyMonStarterPikachu jr nc, .curMonNotPlayerPikachu ldpikacry e, PikachuCry4 callfar PlayPikachuSoundClip @@ -132,7 +132,7 @@ Func_c4c7: call Random and $1 jr z, .asm_c4de - calladb_ModifyPikachuHappiness $6 + calladb_ModifyPikachuHappiness PIKAHAPPY_WALKING .asm_c4de ld hl, wPikachuMood ld a, [hl] diff --git a/engine/events/pokecenter.asm b/engine/events/pokecenter.asm index 6cb93a021..6b8c584c6 100644 --- a/engine/events/pokecenter.asm +++ b/engine/events/pokecenter.asm @@ -25,7 +25,7 @@ DisplayPokemonCenterDialogue_:: and a jp nz, .declinedHealing ; if the player chose No call SetLastBlackoutMap - callfar IsStarterPikachuInOurParty + callfar IsStarterPikachuAliveInOurParty jr nc, .notHealingPlayerPikachu call CheckPikachuFollowingPlayer jr nz, .notHealingPlayerPikachu @@ -41,7 +41,7 @@ DisplayPokemonCenterDialogue_:: call CheckPikachuFollowingPlayer jr nz, .playerPikachuNotOnScreen call DisablePikachuOverworldSpriteDrawing - callfar IsStarterPikachuInOurParty + callfar IsStarterPikachuAliveInOurParty call c, Func_6eaa .playerPikachuNotOnScreen lb bc, 1, 8 @@ -60,7 +60,7 @@ DisplayPokemonCenterDialogue_:: call PlaySound call CheckPikachuFollowingPlayer jr nz, .doNotReturnPikachu - callfar IsStarterPikachuInOurParty + callfar IsStarterPikachuAliveInOurParty call c, Func_6eaa ld a, $5 ld [wPikachuSpawnState], a @@ -70,7 +70,7 @@ DisplayPokemonCenterDialogue_:: call Func_6ebb ld hl, PokemonFightingFitText call PrintText - callfar IsStarterPikachuInOurParty + callfar IsStarterPikachuAliveInOurParty jr nc, .notInParty lb bc, 15, 0 call Func_6ebb diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index bf43293e8..f12ec299a 100644 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -809,7 +809,7 @@ ItemUseEvoStone: ld [wCurPartySpecies], a call Func_d85d jr nc, .noEffect - callfar IsThisPartymonStarterPikachu_Party + callfar IsThisPartyMonStarterPikachu jr nc, .notPlayerPikachu ldpikacry e, PikachuCry28 callfar PlayPikachuSoundClip @@ -2498,7 +2498,7 @@ ItemUseTMHM: ld a, d ld [wWhichPokemon], a callabd_ModifyPikachuHappiness PIKAHAPPY_USEDTMHM - callfar IsThisPartymonStarterPikachu_Party + callfar IsThisPartyMonStarterPikachu jr nc, .notTeachingThunderboltOrThunderToPikachu ld a, [wCurItem] cp TM_THUNDERBOLT ; are we teaching thunderbolt to the player pikachu? diff --git a/engine/items/town_map.asm b/engine/items/town_map.asm index 96f6769c4..3cf68aea4 100644 --- a/engine/items/town_map.asm +++ b/engine/items/town_map.asm @@ -193,7 +193,7 @@ LoadTownMap_Fly:: ld c, 15 call DelayFrames hlcoord 18, 0 - ld [hl], "▶" + ld [hl], "▲" hlcoord 19, 0 ld [hl], "▼" pop hl diff --git a/engine/menus/link_menu.asm b/engine/menus/link_menu.asm index 94384cb37..dcb609e27 100644 --- a/engine/menus/link_menu.asm +++ b/engine/menus/link_menu.asm @@ -5,19 +5,19 @@ Func_f531b:: ld [wBuffer], a xor a ld [wUnknownSerialFlag_d499], a - coord hl, 0, 0 + hlcoord 0, 0 lb bc, 4, 5 call TextBoxBorder ld de, Text_f5791 - coord hl, 1, 2 + hlcoord 1, 2 call PlaceString - coord hl, 8, 0 + hlcoord 8, 0 lb bc, 8, 10 call TextBoxBorder - coord hl, 10, 2 + hlcoord 10, 2 ld de, Text_f579c call PlaceString - coord hl, 0, 10 + hlcoord 0, 10 lb bc, 6, 18 call TextBoxBorder call UpdateSprites @@ -513,7 +513,7 @@ asm_f56ad:: Func_f56bd:: xor a ldh [hAutoBGTransferEnabled], a - coord hl, 1, 11 + hlcoord 1, 11 lb bc, 6, 18 call ClearScreenArea ld a, [wCurrentMenuItem] @@ -530,7 +530,7 @@ Func_f56bd:: ld l, a ld d, h ld e, l - coord hl, 1, 12 + hlcoord 1, 12 call PlaceString .asm_f56e6 call Delay3 diff --git a/engine/menus/party_menu.asm b/engine/menus/party_menu.asm index 169a0ac76..493f2e980 100644 --- a/engine/menus/party_menu.asm +++ b/engine/menus/party_menu.asm @@ -32,7 +32,7 @@ RedrawPartyMenu_:: call PlaceString ; print the pokemon's name ldh a, [hPartyMonIndex] ld [wWhichPokemon], a - callfar IsThisPartymonStarterPikachu_Party + callfar IsThisPartyMonStarterPikachu jr nc, .regularMon call CheckPikachuFollowingPlayer jr z, .regularMon diff --git a/engine/menus/save.asm b/engine/menus/save.asm index 0ad7eeacf..e4575793c 100644 --- a/engine/menus/save.asm +++ b/engine/menus/save.asm @@ -358,7 +358,7 @@ ChangeBox:: res BIT_DOUBLE_SPACED_MENU, [hl] bit B_PAD_B, a ret nz - ld a, $b6 + ld a, SFX_SAVE call PlaySoundWaitForCurrent call WaitForSoundToFinish call GetBoxSRAMLocation diff --git a/engine/minigame/surfing_pikachu.asm b/engine/minigame/surfing_pikachu.asm index 5d43cba63..27e91ba11 100644 --- a/engine/minigame/surfing_pikachu.asm +++ b/engine/minigame/surfing_pikachu.asm @@ -1723,7 +1723,7 @@ DidPlayerGetAHighScore: SurfingMinigame_PlayPikaCryIfSurfingPikaInParty: push de - callfar IsSurfingPikachuInThePlayersParty + callfar IsSurfingStarterPikachuInParty pop de ret nc callfar PlayPikachuSoundClip diff --git a/engine/movie/hall_of_fame.asm b/engine/movie/hall_of_fame.asm index 38d937f64..fb77e0739 100644 --- a/engine/movie/hall_of_fame.asm +++ b/engine/movie/hall_of_fame.asm @@ -156,7 +156,7 @@ HoFDisplayAndRecordMonInfo: call HoFDisplayMonInfo ld a, [wHoFPartyMonIndex] ld [wWhichPokemon], a - callfar IsThisPartymonStarterPikachu_Party + callfar IsThisPartyMonStarterPikachu jr nc, .asm_70336 ldpikacry e, PikachuCry35 callfar PlayPikachuSoundClip @@ -200,11 +200,11 @@ HoFLoadPlayerPics: ld de, RedPicFront ld a, BANK(RedPicFront) call UncompressSpriteFromDE - ld a, $0 + ld a, BANK("Sprite Buffers") call OpenSRAM ld hl, sSpriteBuffer1 ld de, sSpriteBuffer0 - ld bc, $310 + ld bc, 2 * SPRITEBUFFERSIZE call CopyData call CloseSRAM ld de, vFrontPic diff --git a/engine/movie/intro_yellow.asm b/engine/movie/intro_yellow.asm index 8b8866e5d..cd4115485 100644 --- a/engine/movie/intro_yellow.asm +++ b/engine/movie/intro_yellow.asm @@ -575,15 +575,15 @@ YellowIntroScene14: call MaskAllAnimatedObjectStructs call YellowIntro_BlankOAMBuffer ld hl, wTileMap - ld bc, $50 + ld bc, SCREEN_WIDTH * 4 ld a, $1 call Bank3E_FillMemory hlcoord 0, 4 - ld bc, CopyVideoDataAlternate + ld bc, SCREEN_WIDTH * 10 xor a call Bank3E_FillMemory hlcoord 0, 14 - ld bc, $50 + ld bc, SCREEN_WIDTH * 4 ld a, $1 call Bank3E_FillMemory ld a, $1 @@ -827,7 +827,7 @@ InitYellowIntroGFXAndMusic: ld a, $1 call Bank3E_FillMemory hlcoord 0, 4 - ld bc, CopyVideoDataAlternate + ld bc, SCREEN_WIDTH * 10 xor a call Bank3E_FillMemory ld a, $1 diff --git a/engine/movie/oak_speech/oak_speech.asm b/engine/movie/oak_speech/oak_speech.asm index 1591fefce..5cc807455 100644 --- a/engine/movie/oak_speech/oak_speech.asm +++ b/engine/movie/oak_speech/oak_speech.asm @@ -49,7 +49,7 @@ PrepareOakSpeech: ret OakSpeech: - call StopAllMusic ; stop music + call StopAllMusic ld a, BANK(Music_Routes2) ld c, a ld a, MUSIC_ROUTES2 @@ -231,11 +231,11 @@ IntroDisplayPicCenteredOrUpperRight: push bc ld a, b call UncompressSpriteFromDE - ld a, $0 + ld a, BANK("Sprite Buffers") call OpenSRAM ld hl, sSpriteBuffer1 ld de, sSpriteBuffer0 - ld bc, $310 + ld bc, 2 * SPRITEBUFFERSIZE call CopyData call CloseSRAM ld de, vFrontPic diff --git a/engine/pikachu/pikachu_emotions.asm b/engine/pikachu/pikachu_emotions.asm index a29fd7811..3fc083639 100644 --- a/engine/pikachu/pikachu_emotions.asm +++ b/engine/pikachu/pikachu_emotions.asm @@ -3,7 +3,7 @@ IsPlayerTalkingToPikachu:: and a ret z ldh a, [hSpriteIndex] - cp $f + cp PIKACHU_SPRITE_INDEX ret nz call InitializePikachuTextID xor a @@ -111,7 +111,7 @@ StarterPikachuEmotionCommand_emote: ShowPikachuEmoteBubble: ld [wWhichEmotionBubble], a - ld a, $f ; Pikachu + ld a, PIKACHU_SPRITE_INDEX ld [wEmotionBubbleSpriteIndex], a predef EmotionBubble ret @@ -333,7 +333,7 @@ MapSpecificPikachuExpression: call IsPlayerPikachuAsleepInParty ldpikaemotion a, PikachuEmotion11 jr c, .play_emotion - callfar CheckPikachuFaintedOrStatused ; same bank + callfar CheckPikachuStatusCondition ; same bank ldpikaemotion a, PikachuEmotion28 jr c, .play_emotion ld a, [wCurMap] @@ -383,7 +383,7 @@ IsPlayerPikachuAsleepInParty: jr z, .done cp STARTER_PIKACHU jr nz, .curMonNotStarterPikachu - callfar IsThisPartymonStarterPikachu + callfar IsThisPartyMonStarterPikachu jr nc, .curMonNotStarterPikachu ld a, [wWhichPokemon] ld hl, wPartyMon1Status diff --git a/engine/pikachu/pikachu_follow.asm b/engine/pikachu/pikachu_follow.asm index 143316821..11093c294 100644 --- a/engine/pikachu/pikachu_follow.asm +++ b/engine/pikachu/pikachu_follow.asm @@ -6,7 +6,7 @@ ShouldPikachuSpawn:: ld a, [wPikachuOverworldStateFlags] bit 7, a jr nz, .hide - call IsStarterPikachuInOurParty + call IsStarterPikachuAliveInOurParty jr nc, .hide ld a, [wWalkBikeSurfState] and a @@ -1375,7 +1375,7 @@ Func_fcc92: ld a, $ff .asm_fcca8 ld d, [hl] - ldd [hl], a + ld [hld], a ld a, d dec e jr nz, .asm_fcca8 diff --git a/engine/pikachu/pikachu_pic_animation.asm b/engine/pikachu/pikachu_pic_animation.asm index a7fd80f30..40f88dc54 100644 --- a/engine/pikachu/pikachu_pic_animation.asm +++ b/engine/pikachu/pikachu_pic_animation.asm @@ -665,7 +665,7 @@ DecompressRequestPikaPicAnimGFX: jr c, .failed ld a, b call UncompressSpriteFromDE - ld a, BANK(sSpriteBuffer1) + ld a, BANK("Sprite Buffers") call OpenSRAM ld hl, sSpriteBuffer1 ld de, sSpriteBuffer0 diff --git a/engine/pikachu/pikachu_status.asm b/engine/pikachu/pikachu_status.asm index 5fc92ead7..fc24b2c78 100644 --- a/engine/pikachu/pikachu_status.asm +++ b/engine/pikachu/pikachu_status.asm @@ -1,4 +1,4 @@ -IsStarterPikachuInOurParty:: +IsStarterPikachuAliveInOurParty:: ld hl, wPartySpecies ld de, wPartyMon1OTID ld bc, wPartyMonOT @@ -20,10 +20,11 @@ IsStarterPikachuInOurParty:: ld a, [wPlayerID+1] cp [hl] jr nz, .curMonNotPlayerPikachu + push de push bc ld hl, wPlayerName - ld d, $6 ; possible player length - 1 + ld d, $6 ; leftover hardcoded Japanese NAME_LENGTH .nameCompareLoop dec d jr z, .sameOT @@ -34,6 +35,7 @@ IsStarterPikachuInOurParty:: jr z, .nameCompareLoop pop bc pop de + .curMonNotPlayerPikachu ld hl, wPartyMon2 - wPartyMon1 add hl, de @@ -50,11 +52,11 @@ IsStarterPikachuInOurParty:: pop de ld h, d ld l, e - ld bc, -NAME_LENGTH + ld bc, wPartyMon1HP - wPartyMon1OTID add hl, bc ld a, [hli] or [hl] - jr z, .noPlayerPikachu ; XXX how is this determined? + jr z, .noPlayerPikachu ; fainted Starter Pikachu pop hl scf ret @@ -64,18 +66,17 @@ IsStarterPikachuInOurParty:: and a ret -IsThisPartymonStarterPikachu_Box:: +IsThisBoxMonStarterPikachu:: ld hl, wBoxMon1 ld bc, wBoxMon2 - wBoxMon1 ld de, wBoxMonOT - jr asm_fce21 + jr IsThisMonStarterPikachu -IsThisPartymonStarterPikachu_Party:: -IsThisPartymonStarterPikachu:: +IsThisPartyMonStarterPikachu:: ld hl, wPartyMon1 ld bc, wPartyMon2 - wPartyMon1 ld de, wPartyMonOT -asm_fce21: +IsThisMonStarterPikachu: ld a, [wWhichPokemon] call AddNTimes ld a, [hl] @@ -96,7 +97,7 @@ asm_fce21: ld bc, NAME_LENGTH call AddNTimes ld de, wPlayerName - ld b, $6 + ld b, $6 ; leftover hardcoded Japanese NAME_LENGTH .loop dec b jr z, .isPlayerPikachu @@ -117,7 +118,7 @@ UpdatePikachuMoodAfterBattle:: ; because d is always $82 at this function, it serves to ; ensure Pikachu's mood is at least 130 after battle push de - call IsStarterPikachuInOurParty + call IsStarterPikachuAliveInOurParty pop de ret nc ld a, d @@ -136,8 +137,9 @@ UpdatePikachuMoodAfterBattle:: ld [wPikachuMood], a ret -CheckPikachuFaintedOrStatused:: -; function to test if Pikachu is alive? +CheckPikachuStatusCondition:: +; set carry flag if Starter Pikachu has a status condition +; also return d = 0 if fainted, but no function uses it xor a ld [wWhichPokemon], a ld hl, wPartyCount @@ -145,9 +147,9 @@ CheckPikachuFaintedOrStatused:: inc hl ld a, [hl] cp $ff - jr z, .dead_or_not_in_party + jr z, .noAilment push hl - call IsThisPartymonStarterPikachu_Party + call IsThisPartyMonStarterPikachu pop hl jr nc, .next ld a, [wWhichPokemon] @@ -161,8 +163,8 @@ CheckPikachuFaintedOrStatused:: inc hl ld a, [hl] ; status and a - jr nz, .alive - jr .dead_or_not_in_party + jr nz, .hasAilment + jr .noAilment .next ld a, [wWhichPokemon] @@ -170,15 +172,15 @@ CheckPikachuFaintedOrStatused:: ld [wWhichPokemon], a jr .loop -.alive +.hasAilment scf ret -.dead_or_not_in_party +.noAilment and a ret -IsSurfingPikachuInThePlayersParty:: +IsSurfingStarterPikachuInParty:: ld hl, wPartySpecies ld de, wPartyMon1Moves ld bc, wPartyMonOT @@ -223,7 +225,7 @@ IsSurfingPikachuInThePlayersParty:: push de push bc ld hl, wPlayerName - ld d, $6 + ld d, $6 ; leftover hardcoded Japanese NAME_LENGTH .nameCompareLoop dec d jr z, .foundSurfingPlayerPikachu diff --git a/engine/pikachu/respawn_overworld_pikachu.asm b/engine/pikachu/respawn_overworld_pikachu.asm index 4b6100850..e412df5d0 100644 --- a/engine/pikachu/respawn_overworld_pikachu.asm +++ b/engine/pikachu/respawn_overworld_pikachu.asm @@ -1,5 +1,5 @@ RespawnOverworldPikachu: - callfar IsThisPartymonStarterPikachu_Party + callfar IsThisPartyMonStarterPikachu ret nc ld a, $3 ld [wPikachuSpawnState], a diff --git a/engine/pokemon/bills_pc.asm b/engine/pokemon/bills_pc.asm index e5c0211d9..818b3f4d0 100644 --- a/engine/pokemon/bills_pc.asm +++ b/engine/pokemon/bills_pc.asm @@ -225,7 +225,7 @@ BillsPCDeposit: ld hl, wPartyCount call DisplayMonListMenu jp c, BillsPCMenu - callfar IsThisPartymonStarterPikachu_Party + callfar IsThisPartyMonStarterPikachu jr nc, .asm_215ad call CheckPikachuFollowingPlayer jr z, .asm_215ad @@ -235,7 +235,7 @@ BillsPCDeposit: .asm_215ad call DisplayDepositWithdrawMenu jp nc, BillsPCMenu - callfar IsThisPartymonStarterPikachu_Party + callfar IsThisPartyMonStarterPikachu jr nc, .asm_215c9 ldpikacry e, PikachuCry28 callfar PlayPikachuSoundClip @@ -298,7 +298,7 @@ BillsPCWithdraw: ld a, [wWhichPokemon] ld hl, wBoxMonNicks call GetPartyMonName - callfar IsThisPartymonStarterPikachu_Box + callfar IsThisBoxMonStarterPikachu jr nc, .asm_21660 ldpikacry e, PikachuCry35 callfar PlayPikachuSoundClip @@ -329,7 +329,7 @@ BillsPCRelease: ld hl, wBoxCount call DisplayMonListMenu jp c, BillsPCMenu - callfar IsThisPartymonStarterPikachu_Box + callfar IsThisBoxMonStarterPikachu jr c, .asm_216cb ld hl, OnceReleasedText call PrintText diff --git a/engine/pokemon/evos_moves.asm b/engine/pokemon/evos_moves.asm index 25a4d0a1a..8fe004e4c 100644 --- a/engine/pokemon/evos_moves.asm +++ b/engine/pokemon/evos_moves.asm @@ -364,7 +364,7 @@ LearnMoveFromLevelUp: ld a, b and a jr z, .done - callfar IsThisPartymonStarterPikachu_Party + callfar IsThisPartyMonStarterPikachu jr nc, .done ld a, [wMoveNum] cp THUNDERBOLT diff --git a/engine/pokemon/status_screen.asm b/engine/pokemon/status_screen.asm index ec8cf1ee8..90dd85233 100644 --- a/engine/pokemon/status_screen.asm +++ b/engine/pokemon/status_screen.asm @@ -175,11 +175,11 @@ StatusScreen: jr z, .playRegularCry cp BOX_DATA jr z, .checkBoxData - callfar IsThisPartymonStarterPikachu_Party + callfar IsThisPartyMonStarterPikachu jr nc, .playRegularCry jr .playPikachuSoundClip .checkBoxData - callfar IsThisPartymonStarterPikachu_Box + callfar IsThisBoxMonStarterPikachu jr nc, .playRegularCry .playPikachuSoundClip ldpikacry e, PikachuCry17 diff --git a/engine/printer/printer.asm b/engine/printer/printer.asm index 18161e6a3..ee1bc73ea 100644 --- a/engine/printer/printer.asm +++ b/engine/printer/printer.asm @@ -72,7 +72,7 @@ PrintPokedexEntry: call Printer_ResetJoypadHRAM .print_loop call JoypadLowSensitivity - call Printer_CheckPressingB + call Printer_StopIfPressB jr c, .pressed_b ld a, [wPrinterSendState] bit 7, a @@ -133,7 +133,7 @@ PrintSurfingMinigameHighScore:: call Printer_ResetJoypadHRAM .loop call JoypadLowSensitivity - call Printer_CheckPressingB + call Printer_StopIfPressB jr c, .quit ld a, [wPrinterSendState] bit 7, a @@ -161,7 +161,7 @@ PrintDiploma:: xor a ldh [hCanceledPrinting], a call Printer_PlayPrinterMusic - call _DisplayDiploma + call DisplayDiplomaTop ldh a, [rIE] push af xor a @@ -172,8 +172,8 @@ PrintDiploma:: ld a, $10 ld [wcae2], a call Printer_CopyTileMapToPrinterTileBuffer - call Func_e8d11 - jr c, .asm_e8cfa + call PrintDiplomaPage + jr c, .quit xor a ld [wPrinterConnectionOpen], a ld [wPrinterOpcode], a @@ -182,14 +182,14 @@ PrintDiploma:: call SaveScreenTilesToBuffer1 xor a ldh [hAutoBGTransferEnabled], a - call Func_e9ad3 + call DisplayDiplomaBottom call StartTransmission_Send9Rows ld a, $3 ld [wcae2], a call Printer_CopyTileMapToPrinterTileBuffer call LoadScreenTilesFromBuffer1 - call Func_e8d11 -.asm_e8cfa + call PrintDiplomaPage +.quit xor a ld [wPrinterConnectionOpen], a ld [wPrinterOpcode], a @@ -202,33 +202,33 @@ PrintDiploma:: call Printer_PlayMapMusic ret -Func_e8d11: +PrintDiplomaPage: call Printer_ResetJoypadHRAM -.asm_e8d14 +.print_loop call JoypadLowSensitivity - call Printer_CheckPressingB - jr c, .asm_e8d33 + call Printer_StopIfPressB + jr c, .pressed_b ld a, [wPrinterSendState] bit 7, a - jr nz, .asm_e8d31 + jr nz, .completed call PrinterTransmissionJumptable call GBPrinter_CheckForErrors call GBPrinter_UpdateStatusMessage call DelayFrame - jr .asm_e8d14 + jr .print_loop -.asm_e8d31 +.completed and a ret -.asm_e8d33 +.pressed_b scf ret PrintPCBox:: - ld a, [wBoxDataStart] + ld a, [wBoxCount] and a - jp z, Func_e8df4 + jp z, .emptyBox ld a, [wUpdateSpritesEnabled] push af xor a @@ -250,8 +250,8 @@ PrintPCBox:: ld [wcae2], a call Printer_CopyTileMapToPrinterTileBuffer call LoadScreenTilesFromBuffer1 - call Func_e8dfb - jr c, .asm_e8ddc + call PrintPCBoxPage + jr c, .quit xor a ld [wPrinterConnectionOpen], a ld [wPrinterOpcode], a @@ -265,8 +265,8 @@ PrintPCBox:: ld [wcae2], a call Printer_CopyTileMapToPrinterTileBuffer call LoadScreenTilesFromBuffer1 - call Func_e8dfb - jr c, .asm_e8ddc + call PrintPCBoxPage + jr c, .quit xor a ld [wPrinterConnectionOpen], a ld [wPrinterOpcode], a @@ -280,8 +280,8 @@ PrintPCBox:: ld [wcae2], a call Printer_CopyTileMapToPrinterTileBuffer call LoadScreenTilesFromBuffer1 - call Func_e8dfb - jr c, .asm_e8ddc + call PrintPCBoxPage + jr c, .quit xor a ld [wPrinterConnectionOpen], a ld [wPrinterOpcode], a @@ -295,8 +295,8 @@ PrintPCBox:: ld [wcae2], a call Printer_CopyTileMapToPrinterTileBuffer call LoadScreenTilesFromBuffer1 - call Func_e8dfb -.asm_e8ddc + call PrintPCBoxPage +.quit xor a ld [wPrinterConnectionOpen], a ld [wPrinterOpcode], a @@ -310,35 +310,35 @@ PrintPCBox:: ld [wUpdateSpritesEnabled], a ret -Func_e8df4: - ld hl, String_e8e1f +.emptyBox + ld hl, NoPokemonText call PrintText ret -Func_e8dfb: +PrintPCBoxPage: call Printer_ResetJoypadHRAM -.asm_e8dfe +.print_loop call JoypadLowSensitivity - call Printer_CheckPressingB - jr c, .asm_e8e1d + call Printer_StopIfPressB + jr c, .pressed_b ld a, [wPrinterSendState] bit 7, a - jr nz, .asm_e8e1b + jr nz, .completed call PrinterTransmissionJumptable call GBPrinter_CheckForErrors call GBPrinter_UpdateStatusMessage call DelayFrame - jr .asm_e8dfe + jr .print_loop -.asm_e8e1b +.completed and a ret -.asm_e8e1d +.pressed_b scf ret -String_e8e1f: +NoPokemonText: text_far _NoPokemonText text_end @@ -358,20 +358,20 @@ PrintFanClubPortrait:: ld [wcae2], a call Printer_CopyTileMapToPrinterTileBuffer call Printer_ResetJoypadHRAM -.asm_e8e45 +.print_loop call JoypadLowSensitivity - call Printer_CheckPressingB - jr c, .asm_e8e62 + call Printer_StopIfPressB + jr c, .quit ld a, [wPrinterSendState] bit 7, a - jr nz, .asm_e8e62 + jr nz, .quit call PrinterTransmissionJumptable call GBPrinter_CheckForErrors call GBPrinter_UpdateStatusMessage call DelayFrame - jr .asm_e8e45 + jr .print_loop -.asm_e8e62 +.quit xor a ld [wPrinterConnectionOpen], a ld [wPrinterOpcode], a @@ -430,7 +430,7 @@ PrinterDebug: pop af ret -Printer_CheckPressingB: +Printer_StopIfPressB: ldh a, [hJoyHeld] and PAD_B jr nz, .quit @@ -719,17 +719,10 @@ Printer_PrepareSurfingMinigameHighScoreTileMap:: ret .Tilemap1: - db $7f, $7f, $10, $11, $12, $13, $14, $15 - db $0f, $3c, $3d, $3e, $20, $21, $30, $31 - db $4c, $4d, $4e, $50, $34, $1a, $51, $2d +INCBIN "gfx/surfing_pikachu/high_score_1.tilemap" .Tilemap2: - db $7f, $7f, $7f, $7f, $7f, $7f, $16, $17, $18, $19, $7f, $1b, $1c, $1d, $1e, $1f - db $7f, $7f, $22, $23, $24, $25, $26, $27, $28, $29, $2a, $2b, $2c, $7f, $2e, $2f - db $7f, $7f, $32, $33, $33, $35, $36, $37, $38, $39, $3a, $3b, $7f, $7f, $7f, $3f - db $40, $41, $42, $43, $44, $45, $46, $47, $48, $49, $4a, $4b, $40, $40, $40, $4f - db $52, $52, $52, $53, $54, $55, $56, $57, $58, $59, $5a, $5b, $5c, $5d, $5d, $5e - db $7f, $7f, $7f, $05, $06, $07, $08, $09, $0a, $0b, $0c, $0d, $0e, $7f, $7f, $7f +INCBIN "gfx/surfing_pikachu/high_score_2.tilemap" .PikachusBeachString: db "Pikachu's Beach@" @@ -903,7 +896,7 @@ PrintPCBox_PlaceBoxMonInfo: pop hl ld bc, SCREEN_WIDTH + 1 add hl, bc - ld [hl], " " + ld [hl], " " ; blank tile instead of "/" separator in Yellow inc hl call PlaceString ld hl, wBoxNumString diff --git a/gfx/surfing_pikachu/surfing_pikachu_3.png b/gfx/diploma/diploma.png similarity index 100% rename from gfx/surfing_pikachu/surfing_pikachu_3.png rename to gfx/diploma/diploma.png diff --git a/gfx/diploma/diploma_mew.tilemap b/gfx/diploma/diploma_mew.tilemap new file mode 100644 index 000000000..13521d1ef --- /dev/null +++ b/gfx/diploma/diploma_mew.tilemap @@ -0,0 +1 @@ +pqrstuvwx \ No newline at end of file diff --git a/gfx/diploma/diploma_pikachu.tilemap b/gfx/diploma/diploma_pikachu.tilemap new file mode 100644 index 000000000..953863727 --- /dev/null +++ b/gfx/diploma/diploma_pikachu.tilemap @@ -0,0 +1 @@ + !"#$%&'()*+,-./0123456789:;<=>?@ABC)DEFGHIJK))LMNOPQRSTUVWXYZ[\]^_`abcdefghijklmn \ No newline at end of file diff --git a/gfx/surfing_pikachu/high_score_1.tilemap b/gfx/surfing_pikachu/high_score_1.tilemap new file mode 100644 index 000000000..11d0c797a --- /dev/null +++ b/gfx/surfing_pikachu/high_score_1.tilemap @@ -0,0 +1 @@ +<=> !01LMNP4Q- \ No newline at end of file diff --git a/gfx/surfing_pikachu/high_score_2.tilemap b/gfx/surfing_pikachu/high_score_2.tilemap new file mode 100644 index 000000000..a0502b852 --- /dev/null +++ b/gfx/surfing_pikachu/high_score_2.tilemap @@ -0,0 +1,2 @@ +"#$%&'()*+,./23356789:;?@ABCDEFGHIJK@@@ORRRSTUVWXYZ[\]]^ +  \ No newline at end of file diff --git a/home/map_objects.asm b/home/map_objects.asm index 0988abaee..2e5533716 100644 --- a/home/map_objects.asm +++ b/home/map_objects.asm @@ -71,7 +71,7 @@ IsItemInBag:: IsSurfingPikachuInParty:: ; set bit 6 of wd471 if any Pikachu with Surf is in party ; set bit 7 of wd471 if starter Pikachu is in party (with or without Surf) -; also performs a bankswitch to IsStarterPikachuInOurParty +; also performs a bankswitch to IsStarterPikachuAliveInOurParty ld a, [wd471] and $3f ld [wd471], a @@ -114,7 +114,7 @@ IsSurfingPikachuInParty:: .checkForStarter push hl push bc - callfar IsStarterPikachuInOurParty + callfar IsStarterPikachuAliveInOurParty pop bc pop hl ret nc diff --git a/home/overworld.asm b/home/overworld.asm index 473635cc8..b5625e9dd 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -127,7 +127,7 @@ OverworldLoopLessDelay:: ld hl, wMiscFlags res BIT_TURNING, [hl] xor a - ld [wd434], a + ld [wPikachuCollisionCounter], a ld a, 1 ld [wCheckFor180DegreeTurn], a ld a, [wPlayerMovingDirection] ; the direction that was pressed last time @@ -170,7 +170,7 @@ OverworldLoopLessDelay:: jr z, .noDirectionButtonsPressed ld a, 1 ld [wSpritePlayerStateData1XStepVector], a - ld a, 1 + ld a, PLAYER_DIR_RIGHT .handleDirectionButtonPress ld [wPlayerDirection], a ; new direction @@ -185,8 +185,8 @@ OverworldLoopLessDelay:: ld a, [wPlayerLastStopDirection] ; old direction cp b jr z, .noDirectionChange - ld a, $8 - ld [wd434], a + ld a, 8 + ld [wPikachuCollisionCounter], a ; unlike in red/blue, yellow does not have the 180 degrees odd code ld hl, wMiscFlags set BIT_TURNING, [hl] @@ -239,7 +239,7 @@ OverworldLoopLessDelay:: ld hl, wMiscFlags res BIT_TURNING, [hl] xor a - ld [wd434], a + ld [wPikachuCollisionCounter], a call DoBikeSpeedup call AdvancePlayerSprite ld a, [wWalkCounter] @@ -1166,7 +1166,7 @@ IsSpriteInFrontOfPlayer2:: ld a, e ldh [hSpriteIndex], a ldh a, [hSpriteIndex] ; possible useless read because a already has the value of the read address - cp $f + cp PIKACHU_SPRITE_INDEX jr nz, .dontwritetowd436 ld a, $FF ld [wd435], a @@ -1232,26 +1232,25 @@ CollisionCheckOnLand:: xor a ldh [hTextID], a call IsSpriteInFrontOfPlayer ; check for sprite collisions again? when does the above check fail to detect a sprite collision? - jr nc, .asm_0a5c + jr nc, .noSpriteCollision res BIT_FACE_PLAYER, [hl] ldh a, [hTextID] and a ; was there a sprite collision? - jr z, .asm_0a5c -; if no sprite collision - cp $f + jr z, .noSpriteCollision + cp PIKACHU_SPRITE_INDEX jr nz, .collision call CheckPikachuFollowingPlayer jr nz, .collision ldh a, [hJoyHeld] - and $2 - jr nz, .asm_0a5c - ld hl, wd434 + and PAD_B + jr nz, .noSpriteCollision + ld hl, wPikachuCollisionCounter ld a, [hl] and a - jr z, .asm_0a5c + jr z, .noSpriteCollision dec [hl] jr nz, .collision -.asm_0a5c +.noSpriteCollision ld hl, TilePairCollisionsLand call CheckForJumpingAndTilePairCollisions jr c, .collision diff --git a/home/pics.asm b/home/pics.asm index 7a58a05e9..18d86f2e6 100644 --- a/home/pics.asm +++ b/home/pics.asm @@ -87,7 +87,7 @@ LoadUncompressedSpriteData:: add a add a ; 8*(7*((8-w)/2) + 7-h) ; combined overall offset (in bytes) ldh [hSpriteOffset], a - ld a, $0 + ld a, BANK("Sprite Buffers") call OpenSRAM ld hl, sSpriteBuffer0 call ZeroSpriteBuffer ; zero buffer 0 @@ -146,7 +146,7 @@ ZeroSpriteBuffer:: ; in the resulting sprite, the rows of the two source sprites are interlaced ; de: output address InterlaceMergeSpriteBuffers:: - ld a, $0 + ld a, BANK("Sprite Buffers") call OpenSRAM push de ld hl, sSpriteBuffer2 + (SPRITEBUFFERSIZE - 1) ; destination: end of buffer 2 diff --git a/home/pokemon.asm b/home/pokemon.asm index 549960921..b10861a6e 100644 --- a/home/pokemon.asm +++ b/home/pokemon.asm @@ -258,7 +258,7 @@ HandlePartyMenuInput:: jr nz, .asm_1258 ld a, [wCurrentMenuItem] ld [wWhichPokemon], a - callfar IsThisPartymonStarterPikachu_Party + callfar IsThisPartyMonStarterPikachu jr nc, .asm_1258 call CheckPikachuFollowingPlayer jr nz, .asm_128f diff --git a/home/uncompress.asm b/home/uncompress.asm index 091cf5f87..27e6e35c9 100644 --- a/home/uncompress.asm +++ b/home/uncompress.asm @@ -11,7 +11,7 @@ UncompressSpriteData:: push af ld a, b call BankswitchCommon - ld a, $0 + ld a, BANK("Sprite Buffers") call OpenSRAM call _UncompressSpriteData call CloseSRAM diff --git a/ram/wram.asm b/ram/wram.asm index 3778c1375..a70a981fc 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -2004,7 +2004,7 @@ wPikachuSpawnState:: db wd431:: db wd432:: db wd433:: db -wd434:: db +wPikachuCollisionCounter:: db wd435:: db wPikachuFollowCommandBufferSize:: db wPikachuFollowCommandBuffer:: ds 16 diff --git a/scripts/BillsHouse.asm b/scripts/BillsHouse.asm index 17bea71a1..cb1afbddc 100644 --- a/scripts/BillsHouse.asm +++ b/scripts/BillsHouse.asm @@ -42,7 +42,7 @@ BillsHouseScript0: ld a, [wd471] bit 7, a jr z, .asm_1e0d2 - callfar CheckPikachuFaintedOrStatused + callfar CheckPikachuStatusCondition jr c, .asm_1e0d2 callfar Func_f24d5 .asm_1e0d2 diff --git a/scripts/CeladonMansion1F_2.asm b/scripts/CeladonMansion1F_2.asm index 7fe8409fc..ab366e7db 100644 --- a/scripts/CeladonMansion1F_2.asm +++ b/scripts/CeladonMansion1F_2.asm @@ -3,7 +3,7 @@ CeladonMansion1FPrintGrannyText:: ld [wDoNotWaitForButtonPressAfterDisplayingText], a ld hl, CeladonMansion1Text_f1e96 call PrintText - callfar IsStarterPikachuInOurParty + callfar IsStarterPikachuAliveInOurParty ret nc ld hl, CeladonMansionText_f1e9c call PrintText diff --git a/scripts/Daycare.asm b/scripts/Daycare.asm index a39361d52..f9c41edf3 100644 --- a/scripts/Daycare.asm +++ b/scripts/Daycare.asm @@ -51,7 +51,7 @@ DaycareGentlemanText: ld a, PARTY_TO_DAYCARE ld [wMoveMonType], a call MoveMon - callfar IsThisPartymonStarterPikachu + callfar IsThisPartyMonStarterPikachu push af xor a ld [wRemoveMonFromBox], a @@ -211,7 +211,7 @@ DaycareGentlemanText: ld a, [wPartyCount] dec a ld [wWhichPokemon], a - callfar IsThisPartymonStarterPikachu + callfar IsThisPartyMonStarterPikachu jr c, .withdrewPikachuFromDayCare ld a, [wCurPartySpecies] call PlayCry diff --git a/scripts/PewterPokecenter_2.asm b/scripts/PewterPokecenter_2.asm index d52b06af4..2aeb23f74 100644 --- a/scripts/PewterPokecenter_2.asm +++ b/scripts/PewterPokecenter_2.asm @@ -62,7 +62,7 @@ PewterJigglypuff:: ld a, [wd471] bit 7, a ret z - callfar CheckPikachuFaintedOrStatused + callfar CheckPikachuStatusCondition ret c call DisablePikachuFollowingPlayer ret diff --git a/scripts/PokemonFanClub.asm b/scripts/PokemonFanClub.asm index f9814f23d..4c8acd39d 100644 --- a/scripts/PokemonFanClub.asm +++ b/scripts/PokemonFanClub.asm @@ -37,7 +37,7 @@ PokemonFanClubScript_59a44: ld a, [wd471] bit 7, a ret z - callfar CheckPikachuFaintedOrStatused + callfar CheckPikachuStatusCondition ret c ld a, SCRIPT_POKEMONFANCLUB_SCRIPT1 ld [wPokemonFanClubCurScript], a diff --git a/scripts/VictoryRoad1F.asm b/scripts/VictoryRoad1F.asm index b7f7a56b7..1ba1a0695 100644 --- a/scripts/VictoryRoad1F.asm +++ b/scripts/VictoryRoad1F.asm @@ -31,7 +31,7 @@ VictoryRoad1FDefaultScript: call CheckBoulderCoords jp nc, CheckFightingMapTrainers ldh a, [hSpriteIndex] - cp $f + cp PIKACHU_SPRITE_INDEX jp z, CheckFightingMapTrainers ld hl, wCurrentMapScriptFlags set BIT_CUR_MAP_LOADED_1, [hl] diff --git a/scripts/VictoryRoad2F.asm b/scripts/VictoryRoad2F.asm index 663405039..0d91ce338 100644 --- a/scripts/VictoryRoad2F.asm +++ b/scripts/VictoryRoad2F.asm @@ -47,7 +47,7 @@ VictoryRoad2FDefaultScript: call CheckBoulderCoords jp nc, CheckFightingMapTrainers ldh a, [hSpriteIndex] - cp $f + cp PIKACHU_SPRITE_INDEX jp z, CheckFightingMapTrainers EventFlagAddress hl, EVENT_VICTORY_ROAD_2_BOULDER_ON_SWITCH1 ld a, [wCoordIndex] From be9b40dd47650c85a966dfc73616b32199d67a4b Mon Sep 17 00:00:00 2001 From: Narishma-gb <194818981+Narishma-gb@users.noreply.github.com> Date: Tue, 9 Sep 2025 22:11:42 +0200 Subject: [PATCH 2/3] Format `callabd`/`calladb` into `farcall`/`callfar` --- Makefile | 4 ++-- engine/battle/core.asm | 4 ++-- engine/battle/experience.asm | 2 +- engine/battle/init_battle.asm | 2 +- engine/events/poison.asm | 4 ++-- engine/items/item_effects.asm | 14 +++++++------- engine/link/cable_club.asm | 2 +- engine/pikachu/pikachu_status.asm | 6 +++--- engine/pokemon/bills_pc.asm | 2 +- macros/farcall.asm | 4 ++-- 10 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Makefile b/Makefile index c527ad9a9..40eaf4062 100644 --- a/Makefile +++ b/Makefile @@ -137,6 +137,8 @@ gfx/battle/move_anim_1.2bpp: tools/gfx += --trim-whitespace gfx/credits/the_end.2bpp: tools/gfx += --interleave --png=$< +gfx/diploma/diploma.2bpp: tools/gfx += --trim-whitespace + gfx/slots/slots_1.2bpp: tools/gfx += --trim-whitespace gfx/tilesets/%.2bpp: tools/gfx += --trim-whitespace @@ -148,8 +150,6 @@ gfx/trade/game_boy.2bpp: tools/gfx += --remove-duplicates gfx/sgb/border.2bpp: tools/gfx += --trim-whitespace -gfx/diploma/diploma.2bpp: tools/gfx += --trim-whitespace - gfx/surfing_pikachu/surfing_pikachu_1c.2bpp: tools/gfx += --trim-whitespace diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 5e4021230..299b5ee7e 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -1076,10 +1076,10 @@ RemoveFaintedPlayerMon: cp 30 ; is the enemy 30 levels greater than us? jr nc, .carelessTrainer ; if so, punish the player for being careless, as they shouldn't be fighting a very high leveled trainer with such a level difference .regularFaint - callabd_ModifyPikachuHappiness PIKAHAPPY_FAINTED + farcall_ModifyPikachuHappiness PIKAHAPPY_FAINTED ret .carelessTrainer - callabd_ModifyPikachuHappiness PIKAHAPPY_CARELESSTRAINER + farcall_ModifyPikachuHappiness PIKAHAPPY_CARELESSTRAINER ret PlayerMonFaintedText: diff --git a/engine/battle/experience.asm b/engine/battle/experience.asm index 35f9f1a44..32afc0177 100644 --- a/engine/battle/experience.asm +++ b/engine/battle/experience.asm @@ -245,7 +245,7 @@ GainExperience: call CallBattleCore call SaveScreenTilesToBuffer1 .printGrewLevelText - callabd_ModifyPikachuHappiness PIKAHAPPY_LEVELUP + farcall_ModifyPikachuHappiness PIKAHAPPY_LEVELUP ld hl, GrewLevelText call PrintText xor a ; PLAYER_PARTY_DATA diff --git a/engine/battle/init_battle.asm b/engine/battle/init_battle.asm index 629ae7b02..27b5245b8 100644 --- a/engine/battle/init_battle.asm +++ b/engine/battle/init_battle.asm @@ -54,7 +54,7 @@ InitBattleCommon: ld a, [wLoneAttackNo] and a jp z, _InitBattleCommon - callabd_ModifyPikachuHappiness PIKAHAPPY_GYMLEADER ; useless since already in bank3d + farcall_ModifyPikachuHappiness PIKAHAPPY_GYMLEADER ; useless since already in bank3d jp _InitBattleCommon InitWildBattle: diff --git a/engine/events/poison.asm b/engine/events/poison.asm index eddf932f9..6dfe1376c 100644 --- a/engine/events/poison.asm +++ b/engine/events/poison.asm @@ -66,7 +66,7 @@ ApplyOutOfBattlePoisonDamage: jr nc, .curMonNotPlayerPikachu ldpikacry e, PikachuCry4 callfar PlayPikachuSoundClip - calladb_ModifyPikachuHappiness PIKAHAPPY_PSNFNT + callfar_ModifyPikachuHappiness PIKAHAPPY_PSNFNT .curMonNotPlayerPikachu pop de pop hl @@ -132,7 +132,7 @@ Func_c4c7: call Random and $1 jr z, .asm_c4de - calladb_ModifyPikachuHappiness PIKAHAPPY_WALKING + callfar_ModifyPikachuHappiness PIKAHAPPY_WALKING .asm_c4de ld hl, wPikachuMood ld a, [hl] diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index f12ec299a..1bbb4cf9c 100644 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -938,7 +938,7 @@ ItemUseMedicine: jr nc, .noHappinessBoost push hl push de - callabd_ModifyPikachuHappiness PIKAHAPPY_USEDITEM + farcall_ModifyPikachuHappiness PIKAHAPPY_USEDITEM pop de pop hl .noHappinessBoost @@ -1537,7 +1537,7 @@ ItemUseMedicine: xor a ld [wForceEvolution], a - callabd_ModifyPikachuHappiness PIKAHAPPY_LEVELUP + farcall_ModifyPikachuHappiness PIKAHAPPY_LEVELUP ld a, [wWhichPokemon] push af ld a, [wUsedItemOnWhichPokemon] @@ -1691,7 +1691,7 @@ ItemUseXAccuracy: jp z, ItemUseNotTime ld hl, wPlayerBattleStatus2 set USING_X_ACCURACY, [hl] ; X Accuracy bit - callabd_ModifyPikachuHappiness PIKAHAPPY_USEDXITEM + farcall_ModifyPikachuHappiness PIKAHAPPY_USEDXITEM jp PrintItemUseTextAndRemoveItem ; This function is bugged and never works. It always jumps to ItemUseNotTime. @@ -1769,7 +1769,7 @@ ItemUseGuardSpec: push af ld a, [wPlayerMonNumber] ld [wWhichPokemon], a - callabd_ModifyPikachuHappiness PIKAHAPPY_USEDXITEM + farcall_ModifyPikachuHappiness PIKAHAPPY_USEDXITEM pop af ld [wWhichPokemon], a @@ -1794,7 +1794,7 @@ ItemUseDireHit: push af ld a, [wPlayerMonNumber] ld [wWhichPokemon], a - callabd_ModifyPikachuHappiness PIKAHAPPY_USEDXITEM + farcall_ModifyPikachuHappiness PIKAHAPPY_USEDXITEM pop af ld [wWhichPokemon], a @@ -1834,7 +1834,7 @@ ItemUseXStat: push af ld a, [wPlayerMonNumber] ld [wWhichPokemon], a - callabd_ModifyPikachuHappiness PIKAHAPPY_USEDXITEM + farcall_ModifyPikachuHappiness PIKAHAPPY_USEDXITEM pop af ld [wWhichPokemon], a @@ -2497,7 +2497,7 @@ ItemUseTMHM: push af ld a, d ld [wWhichPokemon], a - callabd_ModifyPikachuHappiness PIKAHAPPY_USEDTMHM + farcall_ModifyPikachuHappiness PIKAHAPPY_USEDTMHM callfar IsThisPartyMonStarterPikachu jr nc, .notTeachingThunderboltOrThunderToPikachu ld a, [wCurItem] diff --git a/engine/link/cable_club.asm b/engine/link/cable_club.asm index f7539bdb8..ac961a4f9 100644 --- a/engine/link/cable_club.asm +++ b/engine/link/cable_club.asm @@ -798,7 +798,7 @@ TradeCenter_Trade: add hl, bc ld a, [hl] ld [wTradedPlayerMonSpecies], a - callabd_ModifyPikachuHappiness PIKAHAPPY_TRADE + farcall_ModifyPikachuHappiness PIKAHAPPY_TRADE xor a ld [wRemoveMonFromBox], a call RemovePokemon diff --git a/engine/pikachu/pikachu_status.asm b/engine/pikachu/pikachu_status.asm index fc24b2c78..23e4f757b 100644 --- a/engine/pikachu/pikachu_status.asm +++ b/engine/pikachu/pikachu_status.asm @@ -24,7 +24,7 @@ IsStarterPikachuAliveInOurParty:: push de push bc ld hl, wPlayerName - ld d, $6 ; leftover hardcoded Japanese NAME_LENGTH + ld d, $6 ; leftover hardcoded NAME_LENGTH_JP .nameCompareLoop dec d jr z, .sameOT @@ -97,7 +97,7 @@ IsThisMonStarterPikachu: ld bc, NAME_LENGTH call AddNTimes ld de, wPlayerName - ld b, $6 ; leftover hardcoded Japanese NAME_LENGTH + ld b, $6 ; leftover hardcoded NAME_LENGTH_JP .loop dec b jr z, .isPlayerPikachu @@ -225,7 +225,7 @@ IsSurfingStarterPikachuInParty:: push de push bc ld hl, wPlayerName - ld d, $6 ; leftover hardcoded Japanese NAME_LENGTH + ld d, $6 ; leftover hardcoded NAME_LENGTH_JP .nameCompareLoop dec d jr z, .foundSurfingPlayerPikachu diff --git a/engine/pokemon/bills_pc.asm b/engine/pokemon/bills_pc.asm index 818b3f4d0..c6908409d 100644 --- a/engine/pokemon/bills_pc.asm +++ b/engine/pokemon/bills_pc.asm @@ -244,7 +244,7 @@ BillsPCDeposit: ld a, [wCurPartySpecies] call PlayCry .asm_215cf - callabd_ModifyPikachuHappiness PIKAHAPPY_DEPOSITED + farcall_ModifyPikachuHappiness PIKAHAPPY_DEPOSITED ld a, PARTY_TO_BOX ld [wMoveMonType], a call MoveMon diff --git a/macros/farcall.asm b/macros/farcall.asm index 2cea16568..e8bf8e9c3 100644 --- a/macros/farcall.asm +++ b/macros/farcall.asm @@ -64,14 +64,14 @@ MACRO homejp_sf ; homejp but save flags by popping into bc instead of af jp BankswitchCommon ENDM -MACRO calladb_ModifyPikachuHappiness +MACRO callfar_ModifyPikachuHappiness ld hl, ModifyPikachuHappiness ld d, \1 ld b, BANK(ModifyPikachuHappiness) call Bankswitch ENDM -MACRO callabd_ModifyPikachuHappiness +MACRO farcall_ModifyPikachuHappiness ld hl, ModifyPikachuHappiness ld b, BANK(ModifyPikachuHappiness) ld d, \1 From 1396cd6a844473da8ef4e7fca1dab89ed46f7459 Mon Sep 17 00:00:00 2001 From: Narishma-gb <194818981+Narishma-gb@users.noreply.github.com> Date: Tue, 9 Sep 2025 22:41:10 +0200 Subject: [PATCH 3/3] Use `NAME_LENGTH_JP` --- constants/text_constants.asm | 1 + engine/pikachu/pikachu_status.asm | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/constants/text_constants.asm b/constants/text_constants.asm index 94c07e01b..bf27158c1 100644 --- a/constants/text_constants.asm +++ b/constants/text_constants.asm @@ -1,6 +1,7 @@ DEF NAME_LENGTH EQU 11 DEF ITEM_NAME_LENGTH EQU 13 DEF NAME_BUFFER_LENGTH EQU 20 +DEF NAME_LENGTH_JP EQU 6 ; PrintNumber, PrintBCDNumber const_def 5 diff --git a/engine/pikachu/pikachu_status.asm b/engine/pikachu/pikachu_status.asm index 23e4f757b..ffd2b718a 100644 --- a/engine/pikachu/pikachu_status.asm +++ b/engine/pikachu/pikachu_status.asm @@ -24,7 +24,7 @@ IsStarterPikachuAliveInOurParty:: push de push bc ld hl, wPlayerName - ld d, $6 ; leftover hardcoded NAME_LENGTH_JP + ld d, NAME_LENGTH_JP .nameCompareLoop dec d jr z, .sameOT @@ -97,7 +97,7 @@ IsThisMonStarterPikachu: ld bc, NAME_LENGTH call AddNTimes ld de, wPlayerName - ld b, $6 ; leftover hardcoded NAME_LENGTH_JP + ld b, NAME_LENGTH_JP .loop dec b jr z, .isPlayerPikachu @@ -225,7 +225,7 @@ IsSurfingStarterPikachuInParty:: push de push bc ld hl, wPlayerName - ld d, $6 ; leftover hardcoded NAME_LENGTH_JP + ld d, NAME_LENGTH_JP .nameCompareLoop dec d jr z, .foundSurfingPlayerPikachu