From f3326786259f4e53c06b7565369add7605bea8ba Mon Sep 17 00:00:00 2001 From: Narishma-gb <194818981+Narishma-gb@users.noreply.github.com> Date: Tue, 18 Nov 2025 21:17:31 +0100 Subject: Use more hardware and graphics constants (#532) - Use `OBJ_SIZE` and `TILE_SIZE` from hardware.inc. - `SPRITESTATEDATA1_LENGTH`, `NUM_SPRITESTATEDATA_STRUCTS` and `TILE_1BPP_SIZE` are used in some places. - Highlight an oversight in `OakSpeech` where several direct MBC bank switches are requested. - Remove redundant comments in home/overworld.asm. - Add unreferenced `FillBgMap` function to avoid a byte of dead code. - Some constants added in wram.asm. - Correctly separate the commented code in `SaveMainData`. --- engine/battle/animations.asm | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'engine/battle/animations.asm') diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index 40b2047b..711ebda4 100644 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -928,7 +928,7 @@ BallMoveDistances2: DoGrowlSpecialEffects: ld hl, wShadowOAM ld de, wShadowOAMSprite04 - ld bc, $10 + ld bc, OBJ_SIZE * 4 call CopyData ; copy the musical note graphic ld a, [wSubAnimCounter] dec a @@ -1308,7 +1308,7 @@ AdjustOAMBlockXPos: ld h, d AdjustOAMBlockXPos2: - ld de, 4 + ld de, OBJ_SIZE .loop ld a, [wCoordAdjustmentAmount] ld b, a @@ -1318,7 +1318,7 @@ AdjustOAMBlockXPos2: jr c, .skipPuttingEntryOffScreen ; put off-screen if X >= 168 dec hl - ld a, 160 + ld a, SCREEN_HEIGHT_PX + OAM_Y_OFS ld [hli], a .skipPuttingEntryOffScreen ld [hl], a @@ -1332,7 +1332,7 @@ AdjustOAMBlockYPos: ld h, d AdjustOAMBlockYPos2: - ld de, 4 + ld de, OBJ_SIZE .loop ld a, [wCoordAdjustmentAmount] ld b, a @@ -1670,7 +1670,7 @@ _AnimationShootBallsUpward: dec a ld [wNumShootingBalls], a .next - ld de, 4 + ld de, OBJ_SIZE add hl, de ; next OAM entry dec b jr nz, .innerLoop @@ -1723,10 +1723,10 @@ AnimationMinimizeMon: ld hl, wTempPic push hl xor a - ld bc, 7 * 7 * $10 + ld bc, (7 * 7) tiles call FillMemory pop hl - ld de, 7 * 3 * $10 + 4 * $10 + 4 + ld de, (7 * 3 + 4) tiles + TILE_SIZE / 4 add hl, de ld de, MinimizedMonSprite ld c, MinimizedMonSpriteEnd - MinimizedMonSprite @@ -1971,7 +1971,7 @@ AnimationSubstitute: jp AnimationShowMonPic CopyMonsterSpriteData: - ld bc, 1 tiles + ld bc, TILE_SIZE ld a, BANK(MonsterSprite) jp FarCopyData2 @@ -2379,7 +2379,7 @@ FallingObjects_UpdateOAMEntry: inc a cp 112 jr c, .next - ld a, 160 ; if Y >= 112, put it off-screen + ld a, SCREEN_HEIGHT_PX + OAM_Y_OFS ; if Y >= 112, put it off-screen .next ld [hli], a ; Y ld a, [wFallingObjectMovementByte] -- cgit v1.3.1-sl0p From e92d1af478c8381fde30f709c2619abe90104d3a Mon Sep 17 00:00:00 2001 From: Rangi <35663410+Rangi42@users.noreply.github.com> Date: Tue, 25 Nov 2025 17:53:29 -0500 Subject: Avoid magic numbers for most `CopyData` calls (#542) --- constants/gfx_constants.asm | 6 +++++- constants/text_constants.asm | 1 + engine/battle/animations.asm | 20 ++++++++++---------- engine/battle/core.asm | 21 +++++++++++---------- engine/battle/draw_hud_pokeball_gfx.asm | 8 ++++---- engine/battle/effects.asm | 2 +- engine/battle/ghost_marowak_anim.asm | 2 +- engine/battle/move_effects/transform.asm | 9 +++++---- engine/battle/trainer_ai.asm | 4 ++-- engine/events/in_game_trades.asm | 2 +- engine/items/item_effects.asm | 6 +++--- engine/items/town_map.asm | 4 ++-- engine/movie/evolution.asm | 2 +- engine/movie/hall_of_fame.asm | 2 +- engine/movie/splash.asm | 2 +- engine/overworld/cut2.asm | 6 +++--- engine/overworld/player_animations.asm | 6 +++--- engine/pokemon/add_mon.asm | 2 +- engine/slots/slot_machine.asm | 2 +- home/trainers.asm | 2 +- ram/vram.asm | 6 +++--- ram/wram.asm | 10 +++++++--- 22 files changed, 68 insertions(+), 57 deletions(-) (limited to 'engine/battle/animations.asm') diff --git a/constants/gfx_constants.asm b/constants/gfx_constants.asm index 1a06238c..c3f29ca5 100644 --- a/constants/gfx_constants.asm +++ b/constants/gfx_constants.asm @@ -7,7 +7,11 @@ DEF SCREEN_BLOCK_HEIGHT EQU 5 ; blocks DEF SURROUNDING_WIDTH EQU SCREEN_BLOCK_WIDTH * BLOCK_WIDTH ; tiles DEF SURROUNDING_HEIGHT EQU SCREEN_BLOCK_HEIGHT * BLOCK_HEIGHT ; tiles -DEF SPRITEBUFFERSIZE EQU 7 * 7 * TILE_1BPP_SIZE +DEF PIC_WIDTH EQU 7 ; tiles +DEF PIC_HEIGHT EQU PIC_WIDTH ; tiles +DEF PIC_SIZE EQU PIC_WIDTH * PIC_HEIGHT ; tiles + +DEF SPRITEBUFFERSIZE EQU PIC_WIDTH * PIC_HEIGHT * TILE_1BPP_SIZE ; HP bar DEF HP_BAR_GREEN EQU 0 diff --git a/constants/text_constants.asm b/constants/text_constants.asm index 4dbdf666..ed195172 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 GYM_CITY_LENGTH EQU 17 ; PrintNumber, PrintBCDNumber const_def 5 diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index 711ebda4..f66be640 100644 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -1213,12 +1213,12 @@ _AnimationSlideMonUp: push bc ; In each iteration, slide up all rows but the top one (which is overwritten). - ld b, 6 + ld b, PIC_HEIGHT - 1 .slideLoop push bc push de push hl - ld bc, 7 + ld bc, PIC_WIDTH call CopyData ; Note that de and hl are popped in the same order they are pushed, swapping ; their values. When CopyData is called, hl points to a tile 1 row below @@ -1242,10 +1242,10 @@ _AnimationSlideMonUp: ld a, [wSlideMonUpBottomRowLeftTile] inc a ld [wSlideMonUpBottomRowLeftTile], a - ld c, 7 + ld c, PIC_WIDTH .fillBottomRowLoop ld [hli], a - add 7 + add PIC_WIDTH dec c jr nz, .fillBottomRowLoop @@ -1723,10 +1723,10 @@ AnimationMinimizeMon: ld hl, wTempPic push hl xor a - ld bc, (7 * 7) tiles + ld bc, PIC_SIZE tiles call FillMemory pop hl - ld de, (7 * 3 + 4) tiles + TILE_SIZE / 4 + ld de, (PIC_WIDTH * 3 + 4) tiles + TILE_SIZE / 4 add hl, de ld de, MinimizedMonSprite ld c, MinimizedMonSpriteEnd - MinimizedMonSprite @@ -1774,7 +1774,7 @@ AnimationSlideMonDownAndHide: jr nz, .loop call AnimationHideMonPic ld hl, wTempPic - ld bc, 7 * 7 tiles + ld bc, PIC_SIZE tiles xor a call FillMemory jp CopyTempPicToMonPic @@ -1867,7 +1867,7 @@ CopyTempPicToMonPic: ld hl, vFrontPic ; enemy turn .next ld de, wTempPic - ld bc, 7 * 7 + ld bc, PIC_SIZE jp CopyVideoData AnimationWavyScreen: @@ -1935,7 +1935,7 @@ AnimationSubstitute: ; Changes the pokemon's sprite to the mini sprite ld hl, wTempPic xor a - ld bc, 7 * 7 tiles + ld bc, PIC_SIZE tiles call FillMemory ldh a, [hWhoseTurn] and a @@ -2473,7 +2473,7 @@ AnimationShakeEnemyHUD: ; Make a copy of the back pic's tile patterns in sprite tile pattern VRAM. ld de, vBackPic ld hl, vSprites - ld bc, 7 * 7 + ld bc, PIC_SIZE call CopyVideoData xor a diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 672bd416..4c25373a 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -1183,17 +1183,17 @@ SlideDownFaintedMonPic: push af set BIT_NO_TEXT_DELAY, a ld [wStatusFlags5], a - ld b, 7 ; number of times to slide + ld b, PIC_HEIGHT ; number of times to slide .slideStepLoop ; each iteration, the mon is slid down one row push bc push de push hl - ld b, 6 ; number of rows + ld b, PIC_HEIGHT - 1 ; number of rows .rowLoop push bc push hl push de - ld bc, $7 + ld bc, PIC_WIDTH call CopyData pop de pop hl @@ -1225,7 +1225,8 @@ SlideDownFaintedMonPic: ret SevenSpacesText: - db " @" + ds PIC_WIDTH, ' ' + db "@" ; slides the player or enemy trainer off screen ; a is the number of tiles to slide it horizontally (always 9 for the player trainer or 8 for the enemy trainer) @@ -1237,7 +1238,7 @@ SlideTrainerPicOffScreen: .slideStepLoop ; each iteration, the trainer pic is slid one tile left/right push bc push hl - ld b, 7 ; number of rows + ld b, PIC_HEIGHT ; number of rows .rowLoop push hl ldh a, [hSlideAmount] @@ -1794,7 +1795,7 @@ AnimateRetreatingPlayerMon: lb bc, 7, 7 jp ClearScreenArea -; Copies player's current pokemon's current HP and status into the party +; Copies player's current pokemon's current HP, party pos, and status into the party ; struct data so it stays after battle or switching ReadPlayerMonCurHPAndStatus: ld a, [wPlayerMonNumber] @@ -1804,7 +1805,7 @@ ReadPlayerMonCurHPAndStatus: ld d, h ld e, l ld hl, wBattleMonHP - ld bc, $4 ; 2 bytes HP, 1 byte unknown (unused?), 1 byte status + ld bc, MON_STATUS + 1 - MON_HP ; also copies party pos in-between HP and status jp CopyData DrawHUDsAndHPBars: @@ -6352,7 +6353,7 @@ LoadPlayerBackPic: ld [hl], d ; OAM Y inc hl ld [hl], e ; OAM X - ld a, $8 ; height of tile + ld a, TILE_HEIGHT add d ; increase Y by height of tile ld d, a inc hl @@ -6366,7 +6367,7 @@ LoadPlayerBackPic: ldh a, [hOAMTile] add $4 ; increase tile number by 4 ldh [hOAMTile], a - ld a, $8 ; width of tile + ld a, TILE_WIDTH add e ; increase X by width of tile ld e, a dec b @@ -6381,7 +6382,7 @@ LoadPlayerBackPic: ld de, sSpriteBuffer1 ldh a, [hLoadedROMBank] ld b, a - ld c, 7 * 7 + ld c, PIC_SIZE call CopyVideoData xor a ld [rRAMG], a diff --git a/engine/battle/draw_hud_pokeball_gfx.asm b/engine/battle/draw_hud_pokeball_gfx.asm index 983e7cdf..011b4b33 100644 --- a/engine/battle/draw_hud_pokeball_gfx.asm +++ b/engine/battle/draw_hud_pokeball_gfx.asm @@ -119,7 +119,7 @@ WritePokeballOAMData: PlacePlayerHUDTiles: ld hl, PlayerBattleHUDGraphicsTiles ld de, wHUDGraphicsTiles - ld bc, $3 + ld bc, wHUDGraphicsTilesEnd - wHUDGraphicsTiles call CopyData hlcoord 18, 10 ld de, -1 @@ -134,7 +134,7 @@ PlayerBattleHUDGraphicsTiles: PlaceEnemyHUDTiles: ld hl, EnemyBattleHUDGraphicsTiles ld de, wHUDGraphicsTiles - ld bc, $3 + ld bc, wHUDGraphicsTilesEnd - wHUDGraphicsTiles call CopyData hlcoord 1, 2 ld de, $1 @@ -150,7 +150,7 @@ PlaceHUDTiles: ld [hl], $73 ld bc, SCREEN_WIDTH add hl, bc - ld a, [wHUDGraphicsTiles + 1] ; leftmost tile + ld a, [wHUDCornerTile] ; leftmost tile ld [hl], a ld a, 8 .loop @@ -159,7 +159,7 @@ PlaceHUDTiles: dec a jr nz, .loop add hl, de - ld a, [wHUDGraphicsTiles + 2] ; rightmost tile + ld a, [wHUDTriangleTile] ; rightmost tile ld [hl], a ret diff --git a/engine/battle/effects.asm b/engine/battle/effects.asm index e107853c..003592aa 100644 --- a/engine/battle/effects.asm +++ b/engine/battle/effects.asm @@ -754,7 +754,7 @@ PrintStatText: jr .findStatName_inner .foundStatName ld de, wStringBuffer - ld bc, $a + ld bc, NAME_LENGTH - 1 ; all StatModTextStrings are at most 10 bytes jp CopyData INCLUDE "data/battle/stat_mod_names.asm" diff --git a/engine/battle/ghost_marowak_anim.asm b/engine/battle/ghost_marowak_anim.asm index 4b1eb452..1040f85f 100644 --- a/engine/battle/ghost_marowak_anim.asm +++ b/engine/battle/ghost_marowak_anim.asm @@ -52,7 +52,7 @@ MarowakAnim: CopyMonPicFromBGToSpriteVRAM: ld de, vFrontPic ld hl, vSprites - ld bc, 7 * 7 + ld bc, PIC_SIZE call CopyVideoData ld a, $10 ld [wBaseCoordY], a diff --git a/engine/battle/move_effects/transform.asm b/engine/battle/move_effects/transform.asm index 6f2e705c..343fa3ca 100644 --- a/engine/battle/move_effects/transform.asm +++ b/engine/battle/move_effects/transform.asm @@ -82,14 +82,15 @@ TransformEffect_: ld a, [hli] ld [de], a inc de -; Attack, Defense, Speed, and Special stats +; Skip level and max HP inc hl inc hl inc hl inc de inc de inc de - ld bc, $8 +; Attack, Defense, Speed, and Special stats + ld bc, (NUM_STATS - 1) * 2 call CopyData ld bc, wBattleMonMoves - wBattleMonPP add hl, bc ; ld hl, wBattleMonMoves @@ -99,7 +100,7 @@ TransformEffect_: ld a, [hli] and a jr z, .lessThanFourMoves - ld a, $5 + ld a, 5 ld [de], a inc de dec b @@ -136,7 +137,7 @@ TransformEffect_: ld l, e pop de .gotStatsOrModsToCopy - ld bc, $8 + ld bc, (NUM_STATS - 1) * 2 jp CopyData .failed diff --git a/engine/battle/trainer_ai.asm b/engine/battle/trainer_ai.asm index 4134047f..546dd60e 100644 --- a/engine/battle/trainer_ai.asm +++ b/engine/battle/trainer_ai.asm @@ -583,7 +583,7 @@ AISwitchIfEnoughMons: SwitchEnemyMon: -; prepare to withdraw the active monster: copy hp, number, and status to roster +; prepare to withdraw the active monster: copy HP, party pos, and status to roster ld a, [wEnemyMonPartyPos] ld hl, wEnemyMon1HP @@ -592,7 +592,7 @@ SwitchEnemyMon: ld d, h ld e, l ld hl, wEnemyMonHP - ld bc, 4 + ld bc, MON_STATUS + 1 - MON_HP ; also copies party pos in-between HP and status call CopyData ld hl, AIBattleWithdrawText diff --git a/engine/events/in_game_trades.asm b/engine/events/in_game_trades.asm index 4c6041b0..5cc251f4 100644 --- a/engine/events/in_game_trades.asm +++ b/engine/events/in_game_trades.asm @@ -226,7 +226,7 @@ InGameTrade_CopyDataToReceivedMon: ld bc, wPartyMon2 - wPartyMon1 call InGameTrade_GetReceivedMonPointer ld hl, wTradedEnemyMonOTID - ld bc, $2 + ld bc, 2 jp CopyData ; the received mon's index is (partyCount - 1), diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index 1b68e47a..7fffae59 100644 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -1302,13 +1302,13 @@ ItemUseMedicine: .statNameInnerLoop ld a, [hli] ld b, a - ld a, $50 + ld a, '@' cp b jr nz, .statNameInnerLoop jr .statNameLoop .gotStatName ld de, wStringBuffer - ld bc, 10 + ld bc, NAME_LENGTH - 1 ; all VitaminStats are at most 10 bytes call CopyData ; copy the stat's name to wStringBuffer ld a, SFX_HEAL_AILMENT call PlaySound @@ -2029,7 +2029,7 @@ ItemUsePPRestore: ld bc, wPartyMon2 - wPartyMon1 call AddNTimes ld de, wBattleMonPP - ld bc, 4 + ld bc, NUM_MOVES call CopyData ; copy party data to in-battle data .skipUpdatingInBattleData ld a, SFX_HEAL_AILMENT diff --git a/engine/items/town_map.asm b/engine/items/town_map.asm index 573ba581..35acaa29 100644 --- a/engine/items/town_map.asm +++ b/engine/items/town_map.asm @@ -20,7 +20,7 @@ DisplayTownMap: call PlaceString ld hl, wShadowOAMSprite00 ld de, wShadowOAMBackupSprite00 - ld bc, 4 * 4 + ld bc, OBJ_SIZE * 4 call CopyData ld hl, vSprites tile BIRD_BASE_TILE ld de, TownMapCursor @@ -64,7 +64,7 @@ DisplayTownMap: call PlaceString ld hl, wShadowOAMSprite04 ld de, wShadowOAMBackupSprite04 - ld bc, 4 * 4 + ld bc, OBJ_SIZE * 4 call CopyData .inputLoop call TownMapSpriteBlinkingAnimation diff --git a/engine/movie/evolution.asm b/engine/movie/evolution.asm index 4258b94d..b6e541c5 100644 --- a/engine/movie/evolution.asm +++ b/engine/movie/evolution.asm @@ -30,7 +30,7 @@ EvolveMon: call Evolution_LoadPic ld de, vFrontPic ld hl, vBackPic - ld bc, 7 * 7 + ld bc, PIC_SIZE call CopyVideoData ld a, [wEvoOldSpecies] ld [wCurPartySpecies], a diff --git a/engine/movie/hall_of_fame.asm b/engine/movie/hall_of_fame.asm index b2c0de42..88e777af 100644 --- a/engine/movie/hall_of_fame.asm +++ b/engine/movie/hall_of_fame.asm @@ -188,7 +188,7 @@ HoFLoadPlayerPics: call UncompressSpriteFromDE ld hl, sSpriteBuffer1 ld de, sSpriteBuffer0 - ld bc, $310 + ld bc, 2 * SPRITEBUFFERSIZE call CopyData ld de, vFrontPic call InterlaceMergeSpriteBuffers diff --git a/engine/movie/splash.asm b/engine/movie/splash.asm index 7f06c68b..cc5526ae 100644 --- a/engine/movie/splash.asm +++ b/engine/movie/splash.asm @@ -133,7 +133,7 @@ AnimateShootingStar: ; shift the existing OAM entries down to make room for the next wave ld hl, wShadowOAMSprite04 ld de, wShadowOAM - ld bc, $50 + ld bc, OBJ_SIZE * 20 call CopyData pop af diff --git a/engine/overworld/cut2.asm b/engine/overworld/cut2.asm index 69c8cb13..7697d430 100644 --- a/engine/overworld/cut2.asm +++ b/engine/overworld/cut2.asm @@ -77,13 +77,13 @@ AnimCutGrass_UpdateOAMEntries: AnimCutGrass_SwapOAMEntries: ld hl, wShadowOAMSprite36 ld de, wBuffer - ld bc, $8 + ld bc, 2 * OBJ_SIZE call CopyData ld hl, wShadowOAMSprite38 ld de, wShadowOAMSprite36 - ld bc, $8 + ld bc, 2 * OBJ_SIZE call CopyData ld hl, wBuffer ld de, wShadowOAMSprite38 - ld bc, $8 + ld bc, 2 * OBJ_SIZE jp CopyData diff --git a/engine/overworld/player_animations.asm b/engine/overworld/player_animations.asm index 4ed1f49f..657c001e 100644 --- a/engine/overworld/player_animations.asm +++ b/engine/overworld/player_animations.asm @@ -264,7 +264,7 @@ InitFacingDirectionList: ld [wSavedPlayerScreenY], a ld hl, PlayerSpinningFacingOrder ld de, wFacingDirectionList - ld bc, 4 + ld bc, OBJ_SIZE call CopyData ld a, [wSpritePlayerStateData1ImageIndex] ; (image index is locked to standing images) ld hl, wFacingDirectionList @@ -288,7 +288,7 @@ SpinPlayerSprite: push hl ld hl, wFacingDirectionList ld de, wFacingDirectionList - 1 - ld bc, 4 + ld bc, OBJ_SIZE call CopyData ld a, [wFacingDirectionList - 1] ld [wFacingDirectionList + 3], a @@ -393,7 +393,7 @@ FishingAnim: ld hl, FishingRodOAM add hl, bc ld de, wShadowOAMSprite39 - ld bc, $4 + ld bc, OBJ_SIZE call CopyData ld c, 100 call DelayFrames diff --git a/engine/pokemon/add_mon.asm b/engine/pokemon/add_mon.asm index 7eaca222..a7c201ea 100644 --- a/engine/pokemon/add_mon.asm +++ b/engine/pokemon/add_mon.asm @@ -231,7 +231,7 @@ _AddPartyMon:: dec a jr nz, .calcFreshStats ld hl, wEnemyMonMaxHP - ld bc, $a + ld bc, NUM_STATS * 2 call CopyData ; copy stats of cur enemy mon pop hl jr .done diff --git a/engine/slots/slot_machine.asm b/engine/slots/slot_machine.asm index 147519c7..2e02caf3 100644 --- a/engine/slots/slot_machine.asm +++ b/engine/slots/slot_machine.asm @@ -447,7 +447,7 @@ SlotMachine_CheckForMatches: ld h, [hl] ld l, a ld de, wStringBuffer - ld bc, 4 + ld bc, 4 ; every SlotReward*Text is at most 4 bytes call CopyData pop hl ld de, .flashScreenLoop diff --git a/home/trainers.asm b/home/trainers.asm index ab8d5fff..f00c4df9 100644 --- a/home/trainers.asm +++ b/home/trainers.asm @@ -31,7 +31,7 @@ ExecuteCurMapScriptInTable:: LoadGymLeaderAndCityName:: push de ld de, wGymCityName - ld bc, $11 + ld bc, GYM_CITY_LENGTH call CopyData ; load city name pop hl ld de, wGymLeaderName diff --git a/ram/vram.asm b/ram/vram.asm index fafb5d8e..0819fe0a 100644 --- a/ram/vram.asm +++ b/ram/vram.asm @@ -12,8 +12,8 @@ NEXTU ; battle/menu vSprites:: ds $80 tiles vFont:: ds $80 tiles -vFrontPic:: ds 7 * 7 tiles -vBackPic:: ds 7 * 7 tiles +vFrontPic:: ds PIC_SIZE tiles +vBackPic:: ds PIC_SIZE tiles NEXTU ; overworld @@ -25,7 +25,7 @@ NEXTU ; title ds $80 tiles vTitleLogo:: ds $80 tiles - ds 7 * 7 tiles + ds PIC_SIZE tiles vTitleLogo2:: ds 30 tiles ENDU diff --git a/ram/wram.asm b/ram/wram.asm index ff7d10ae..0b00d272 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -191,7 +191,7 @@ wOverworldMap:: ds 1300 wOverworldMapEnd:: NEXTU -wTempPic:: ds 7 * 7 tiles +wTempPic:: ds PIC_SIZE tiles ENDU @@ -688,7 +688,11 @@ NEXTU ds 1 ; difference in X between the next ball and the current one wHUDPokeballGfxOffsetX:: db -wHUDGraphicsTiles:: ds 3 +wHUDGraphicsTiles:: +wHUDUnusedTopTile:: db +wHUDCornerTile:: db +wHUDTriangleTile:: db +wHUDGraphicsTilesEnd:: NEXTU ; the level of the mon at the time it entered day care @@ -1079,7 +1083,7 @@ wExpAmountGained:: dw wGainBoostedExp:: db ENDU -wGymCityName:: ds 17 +wGymCityName:: ds GYM_CITY_LENGTH wGymLeaderName:: ds NAME_LENGTH -- cgit v1.3.1-sl0p From e9d3324bc06faa7de3b7a35d1f9429e610e8a761 Mon Sep 17 00:00:00 2001 From: Narishma-gb <194818981+Narishma-gb@users.noreply.github.com> Date: Mon, 15 Dec 2025 21:14:17 +0100 Subject: Comment more unreferenced local labels (#550) --- engine/battle/animations.asm | 18 +++++++------- engine/battle/core.asm | 39 ++++++++++++++++--------------- engine/battle/draw_hud_pokeball_gfx.asm | 2 +- engine/battle/effects.asm | 12 ++++++---- engine/battle/ghost_marowak_anim.asm | 2 +- engine/battle/move_effects/substitute.asm | 4 ++-- engine/battle/move_effects/transform.asm | 5 ++++ engine/events/diploma.asm | 4 ++-- engine/events/pokemart.asm | 4 ++-- engine/events/prize_menu.asm | 14 +++++------ engine/flag_action.asm | 4 ++-- engine/items/inventory.asm | 1 - engine/items/item_effects.asm | 18 +++++++------- engine/link/cable_club.asm | 2 +- engine/menus/main_menu.asm | 7 +++--- engine/menus/naming_screen.asm | 36 ++++++++++++++-------------- engine/menus/party_menu.asm | 4 ++-- engine/menus/pokedex.asm | 14 +++++------ engine/menus/start_sub_menus.asm | 6 ++--- engine/menus/swap_items.asm | 2 +- engine/movie/credits.asm | 21 ++++++++++------- engine/overworld/auto_movement.asm | 4 ++-- engine/overworld/missable_objects.asm | 4 ++-- engine/overworld/movement.asm | 11 +++++---- engine/overworld/pathfinding.asm | 4 ++-- engine/overworld/push_boulder.asm | 2 +- engine/pokemon/add_mon.asm | 4 ++-- engine/pokemon/load_mon_data.asm | 2 +- home/joypad2.asm | 4 ++-- home/list_menu.asm | 14 +++++------ home/load_font.asm | 6 ++--- home/map_objects.asm | 4 ++-- home/move_mon.asm | 2 +- home/overworld.asm | 9 ++++--- home/print_bcd.asm | 4 ++-- home/print_num.asm | 17 +++++++++----- home/print_text.asm | 2 +- home/start_menu.asm | 2 +- home/trainers.asm | 24 +++++++++---------- home/window.asm | 12 +++++----- macros/scripts/events.asm | 2 +- scripts/BillsHouse.asm | 4 ++-- scripts/Colosseum.asm | 1 + 43 files changed, 189 insertions(+), 168 deletions(-) (limited to 'engine/battle/animations.asm') diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index f66be640..eac4115a 100644 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -22,7 +22,7 @@ DrawFrameBlock: jp z, .flipHorizontalTranslateDown ; SUBANIMTYPE_HFLIP dec a jr z, .flipBaseCoords ; SUBANIMTYPE_COORDFLIP -.noTransformation +; no transformation ld a, [wBaseCoordY] add [hl] ld [de], a ; store Y @@ -130,7 +130,7 @@ DrawFrameBlock: ld a, [wNumFBTiles] cp c jp nz, .loop ; go back up if there are more tiles to draw -.afterDrawingTiles +; after drawing tiles ld a, [wFBMode] cp FRAMEBLOCKMODE_02 jr z, .advanceFrameBlockDestAddr ; skip delay and don't clean OAM buffer @@ -185,7 +185,7 @@ PlayAnimation: jr z, .AnimationOver cp FIRST_SE_ID ; is this subanimation or a special effect? jr c, .playSubanimation -.doSpecialEffect +; do Special Effect ld c, a ld de, SpecialEffectPointers .searchSpecialEffectTableLoop @@ -295,11 +295,11 @@ LoadSubanimation: and %11100000 cp SUBANIMTYPE_ENEMY << 5 vc_hook_blue Reduce_move_anim_flashing_Blizzard - jr nz, .isNotType5 -.isType5 + jr nz, .isNotTypeEnemy +; subanim type enemy call GetSubanimationTransform2 jr .saveTransformation -.isNotType5 +.isNotTypeEnemy vc_hook Reduce_move_anim_flashing_Hyper_Beam call GetSubanimationTransform1 .saveTransformation @@ -427,11 +427,11 @@ MoveAnimation: call PlayAnimation vc_hook_red Stop_reducing_move_anim_flashing_Bubblebeam_Mega_Kick vc_hook_blue Stop_reducing_move_anim_flashing_Spore - jr .next4 + jr .next .animationsDisabled ld c, 30 call DelayFrames -.next4 +.next vc_hook_red Stop_reducing_move_anim_flashing vc_hook_blue Stop_reducing_move_anim_flashing_Rock_Slide_Dream_Eater call PlayApplyingAttackAnimation ; shake the screen or flash the pic in and out (to show damage) @@ -1097,6 +1097,8 @@ SetAnimationBGPalette: ldh [rBGP], a ret +AnimationUnusedShakeScreen: ; unreferenced +; Shakes the screen for a while. ld b, $5 AnimationShakeScreenVertically: diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 44fd9a70..dd9fbc71 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -1247,7 +1247,7 @@ SlideTrainerPicOffScreen: ldh a, [hSlideAmount] cp 8 jr z, .slideRight -.slideLeft ; slide player sprite off screen +; slide player sprite left off screen ld a, [hld] ld [hli], a inc hl @@ -3557,11 +3557,12 @@ CheckPlayerStatusConditions: ld hl, AttackContinuesText call PrintText ld a, [wPlayerNumAttacksLeft] - dec a ; did multi-turn move end? + dec a ld [wPlayerNumAttacksLeft], a - ld hl, GetPlayerAnimationType ; if it didn't, skip damage calculation (deal damage equal to last hit), - ; DecrementPP and MoveHitTest - jp nz, .returnToHL + ld hl, GetPlayerAnimationType ; skip damage calculation (deal damage equal to last hit), + ; DecrementPP and MoveHitTest + jp nz, .returnToHL ; redundant leftover code, the case wEnemyNumAttacksLeft == 0 + ; is handled within CheckNumAttacksLeft jp .returnToHL .RageCheck @@ -3626,7 +3627,7 @@ ConfusedNoMoreText: text_far _ConfusedNoMoreText text_end -SavingEnergyText: +SavingEnergyText: ; unreferenced text_far _SavingEnergyText text_end @@ -4171,7 +4172,7 @@ GetDamageVarsForPlayerAttack: ld a, [hl] ; a = [wPlayerMoveType] cp SPECIAL ; types >= SPECIAL are all special jr nc, .specialAttack -.physicalAttack +; physical attack ld hl, wEnemyMonDefense ld a, [hli] ld b, a @@ -4284,7 +4285,7 @@ GetDamageVarsForEnemyAttack: ld a, [hl] ; a = [wEnemyMoveType] cp SPECIAL ; types >= SPECIAL are all special jr nc, .specialAttack -.physicalAttack +; physical attack ld hl, wBattleMonDefense ld a, [hli] ld b, a @@ -5301,7 +5302,6 @@ AdjustDamageForMoveType: ld [hl], a or b ; is damage 0? jr nz, .skipTypeImmunity -.typeImmunity ; if damage is 0, make the move miss ; this only occurs if a move that would do 2 or 3 damage is 0.25x effective against the target inc a @@ -5394,7 +5394,7 @@ MoveHitTest: ldh a, [hWhoseTurn] and a jr nz, .enemyTurn -.playerTurn +; player's turn ; this checks if the move effect is disallowed by mist ld a, [wPlayerMoveEffect] cp ATTACK_DOWN1_EFFECT @@ -5466,12 +5466,12 @@ MoveHitTest: ld [wMoveMissed], a ldh a, [hWhoseTurn] and a - jr z, .playerTurn2 -.enemyTurn2 + jr z, .playerTurn +; enemy's turn ld hl, wEnemyBattleStatus1 res USING_TRAPPING_MOVE, [hl] ; end multi-turn attack e.g. wrap ret -.playerTurn2 +.playerTurn ld hl, wPlayerBattleStatus1 res USING_TRAPPING_MOVE, [hl] ; end multi-turn attack e.g. wrap ret @@ -6063,10 +6063,11 @@ CheckEnemyStatusConditions: ld hl, AttackContinuesText call PrintText ld hl, wEnemyNumAttacksLeft - dec [hl] ; did multi-turn move end? - ld hl, GetEnemyAnimationType ; if it didn't, skip damage calculation (deal damage equal to last hit), + dec [hl] + ld hl, GetEnemyAnimationType ; skip damage calculation (deal damage equal to last hit), ; DecrementPP and MoveHitTest - jp nz, .enemyReturnToHL + jp nz, .enemyReturnToHL ; redundant leftover code, the case wEnemyNumAttacksLeft == 0 + ; is handled within CheckNumAttacksLeft jp .enemyReturnToHL .checkIfUsingRage ld a, [wEnemyBattleStatus2] @@ -6415,7 +6416,7 @@ QuarterSpeedDueToParalysis: ldh a, [hWhoseTurn] and a jr z, .playerTurn -.enemyTurn ; quarter the player's speed +; enemy's turn, quarter the player's speed ld a, [wBattleMonStatus] and 1 << PAR ret z ; return if player not paralysed @@ -6458,7 +6459,7 @@ HalveAttackDueToBurn: ldh a, [hWhoseTurn] and a jr z, .playerTurn -.enemyTurn ; halve the player's attack +; enemy's turn, halve the player's attack ld a, [wBattleMonStatus] and 1 << BRN ret z ; return if player not burnt @@ -6642,7 +6643,7 @@ LoadHudTilePatterns: ldh a, [rLCDC] add a ; is LCD disabled? jr c, .lcdEnabled -.lcdDisabled +; LCD disabled ld hl, BattleHudTiles1 ld de, vChars2 tile $6d ld bc, BattleHudTiles1End - BattleHudTiles1 diff --git a/engine/battle/draw_hud_pokeball_gfx.asm b/engine/battle/draw_hud_pokeball_gfx.asm index 768a6e20..adeaaf62 100644 --- a/engine/battle/draw_hud_pokeball_gfx.asm +++ b/engine/battle/draw_hud_pokeball_gfx.asm @@ -18,7 +18,7 @@ LoadPartyPokeballGfx: SetupOwnPartyPokeballs: call PlacePlayerHUDTiles - ld hl, wPartyMon1 + ld hl, wPartyMons ld de, wPartyCount call SetupPokeballs ld a, $60 diff --git a/engine/battle/effects.asm b/engine/battle/effects.asm index 2cef2521..22765140 100644 --- a/engine/battle/effects.asm +++ b/engine/battle/effects.asm @@ -230,7 +230,7 @@ FreezeBurnParalyzeEffect: jr z, .burn1 cp FREEZE_SIDE_EFFECT1 jr z, .freeze1 -; .paralyze1 +; paralyze1 ld a, 1 << PAR ld [wEnemyMonStatus], a call QuarterSpeedDueToParalysis ; quarter speed of affected mon @@ -283,7 +283,7 @@ FreezeBurnParalyzeEffect: jr z, .burn2 cp FREEZE_SIDE_EFFECT1 jr z, .freeze2 -; .paralyze2 +; paralyze2 ld a, 1 << PAR ld [wBattleMonStatus], a call QuarterSpeedDueToParalysis @@ -593,7 +593,7 @@ StatModifierDownEffect: ld a, [de] cp ATTACK_DOWN2_EFFECT - $16 ; $24 jr c, .ok - cp EVASION_DOWN2_EFFECT + $5 ; $44 + cp ATTACK_DOWN_SIDE_EFFECT ; move side effects, stat mod decrease is always 1 jr nc, .ok dec b ; stat down 2 effects only (dec mod again) jr nz, .ok @@ -711,7 +711,7 @@ CantLowerAnymore: MoveMissed: ld a, [de] - cp $44 + cp ATTACK_DOWN_SIDE_EFFECT ret nc jp ConditionalPrintButItFailed @@ -1321,7 +1321,7 @@ DisableEffect: cp LINK_STATE_BATTLING pop hl ; wEnemyMonMoves jr nz, .playerTurnNotLinkBattle -; .playerTurnLinkBattle +; player's turn, Link Battle push hl ld hl, wEnemyMonPP .enemyTurn @@ -1456,6 +1456,7 @@ PlayCurrentMoveAnimation2: .notEnemyTurn and a ret z +; fallthrough PlayBattleAnimation2: ; play animation ID at a and animation type 6 or 3 @@ -1482,6 +1483,7 @@ PlayCurrentMoveAnimation: .notEnemyTurn and a ret z +; fallthrough PlayBattleAnimation: ; play animation ID at a and predefined animation type diff --git a/engine/battle/ghost_marowak_anim.asm b/engine/battle/ghost_marowak_anim.asm index 1040f85f..efda9f8f 100644 --- a/engine/battle/ghost_marowak_anim.asm +++ b/engine/battle/ghost_marowak_anim.asm @@ -48,7 +48,7 @@ MarowakAnim: call Delay3 jp ClearSprites -; copies a mon pic's from background VRAM to sprite VRAM and sets up OAM +; copies a mon pic's from background VRAM to sprite VRAM and sets up OAM CopyMonPicFromBGToSpriteVRAM: ld de, vFrontPic ld hl, vSprites diff --git a/engine/battle/move_effects/substitute.asm b/engine/battle/move_effects/substitute.asm index e4311209..01d5a8a3 100644 --- a/engine/battle/move_effects/substitute.asm +++ b/engine/battle/move_effects/substitute.asm @@ -37,8 +37,8 @@ SubstituteEffect_: sbc 0 pop bc 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 + ; bug: since it only branches on carry, it will possibly leave user with 0 HP +; user has 0 or more HP ld [hli], a ; save resulting HP after subtraction into current HP ld [hl], d ld h, b diff --git a/engine/battle/move_effects/transform.asm b/engine/battle/move_effects/transform.asm index 343fa3ca..95e17833 100644 --- a/engine/battle/move_effects/transform.asm +++ b/engine/battle/move_effects/transform.asm @@ -2,17 +2,22 @@ TransformEffect_: ld hl, wBattleMonSpecies ld de, wEnemyMonSpecies ld bc, wEnemyBattleStatus3 + ; bug: on enemy's turn, a is overloaded with hWhoseTurn, + ; before the check for INVULNERABLE ld a, [wEnemyBattleStatus1] ldh a, [hWhoseTurn] and a jr nz, .hitTest +; player's turn ld hl, wEnemyMonSpecies ld de, wBattleMonSpecies ld bc, wPlayerBattleStatus3 ld [wPlayerMoveListIndex], a + ; bug: this should be target's BattleStatus1 (i.e. wEnemyBattleStatus1) ld a, [wPlayerBattleStatus1] .hitTest bit INVULNERABLE, a ; is mon invulnerable to typical attacks? (fly/dig) + ; this check doesn't work due to above bugs jp nz, .failed push hl push de diff --git a/engine/events/diploma.asm b/engine/events/diploma.asm index 3d181210..e2a34a3b 100644 --- a/engine/events/diploma.asm +++ b/engine/events/diploma.asm @@ -73,8 +73,8 @@ DisplayDiploma:: jp GBPalNormal UnusedPlayerNameLengthFunc: -; Unused function that does a calculation involving the length of the player's -; name. +; Unused function that performs bc = -(player name's length) +; leftover from the JPN versions ld hl, wPlayerName lb bc, $ff, $00 .loop diff --git a/engine/events/pokemart.asm b/engine/events/pokemart.asm index b280c711..cb25ab4c 100644 --- a/engine/events/pokemart.asm +++ b/engine/events/pokemart.asm @@ -99,7 +99,7 @@ DisplayPokemartDialogue_:: dec a jr z, .sellMenuLoop -.sellItem +; sell item ld a, [wBoughtOrSoldItemInMart] and a jr nz, .skipSettingFlag1 @@ -177,7 +177,7 @@ DisplayPokemartDialogue_:: dec a jr z, .buyMenuLoop -.buyItem +; buy item call .isThereEnoughMoney jr c, .notEnoughMoney ld hl, wNumBagItems diff --git a/engine/events/prize_menu.asm b/engine/events/prize_menu.asm index 15b991ed..1f71af42 100644 --- a/engine/events/prize_menu.asm +++ b/engine/events/prize_menu.asm @@ -195,7 +195,7 @@ HandlePrizeChoice: .getMonName call GetMonName .givePrize - ld hl, SoYouWantPrizeTextPtr + ld hl, SoYouWantPrizeText call PrintText call YesNoChoice ld a, [wCurrentMenuItem] ; yes/no answer (Y=0, N=1) @@ -243,25 +243,25 @@ HandlePrizeChoice: predef SubBCDPredef jp PrintPrizePrice .bagFull - ld hl, PrizeRoomBagIsFullTextPtr + ld hl, PrizeRoomBagIsFullText jp PrintText .notEnoughCoins ld hl, SorryNeedMoreCoinsText jp PrintText .printOhFineThen - ld hl, OhFineThenTextPtr + ld hl, OhFineThenText jp PrintText UnknownPrizeData: ; XXX what's this? db $00,$01,$00,$01,$00,$01,$00,$00,$01 -HereYouGoTextPtr: +HereYouGoText: ; unreferenced text_far _HereYouGoText text_waitbutton text_end -SoYouWantPrizeTextPtr: +SoYouWantPrizeText: text_far _SoYouWantPrizeText text_end @@ -270,12 +270,12 @@ SorryNeedMoreCoinsText: text_waitbutton text_end -PrizeRoomBagIsFullTextPtr: +PrizeRoomBagIsFullText: text_far _OopsYouDontHaveEnoughRoomText text_waitbutton text_end -OhFineThenTextPtr: +OhFineThenText: text_far _OhFineThenText text_waitbutton text_end diff --git a/engine/flag_action.asm b/engine/flag_action.asm index dc516887..150bebab 100644 --- a/engine/flag_action.asm +++ b/engine/flag_action.asm @@ -43,10 +43,10 @@ FlagAction: ld a, b and a jr z, .reset - cp 2 + cp FLAG_TEST jr z, .read -.set +; set ld b, [hl] ld a, d or b diff --git a/engine/items/inventory.asm b/engine/items/inventory.asm index 6ac75ec7..84950a4e 100644 --- a/engine/items/inventory.asm +++ b/engine/items/inventory.asm @@ -118,7 +118,6 @@ RemoveItemFromInventory_:: jr nz, .skipMovingUpSlots ; if the remaining quantity is 0, ; remove the emptied item slot and move up all the following item slots -.moveSlotsUp ld e, l ld d, h inc de diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index 90853bee..12b5bd00 100644 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -156,7 +156,7 @@ ItemUseBall: dec a jr nz, .notOldManBattle -.oldManBattle +; Old Man battle ld hl, wGrassRate ld de, wPlayerName ld bc, NAME_LENGTH @@ -645,7 +645,7 @@ ItemUseBicycle: jp z, ItemUseNotTime dec a ; is player already bicycling? jr nz, .tryToGetOnBike -.getOffBike +; get off bike call ItemUseReloadOverworldData xor a ld [wWalkBikeSurfState], a ; change player state to walking @@ -671,13 +671,13 @@ ItemUseSurfboard: ld [wWalkBikeSurfStateCopy], a cp 2 ; is the player already surfing? jr z, .tryToStopSurfing -.tryToSurf +; try to Surf call IsNextTileShoreOrWater jp c, SurfingAttemptFailed ld hl, TilePairCollisionsWater call CheckForTilePairCollisions jp c, SurfingAttemptFailed -.surf +; surfing call .makePlayerMoveForward ld hl, wStatusFlags5 set BIT_SCRIPTED_MOVEMENT_STATE, [hl] @@ -921,7 +921,7 @@ ItemUseMedicine: ld [wHPBarOldHP], a ; current HP stored at wHPBarOldHP (2 bytes, big-endian) or b jr nz, .notFainted -.fainted +; fainted ld a, [wCurItem] cp REVIVE jr z, .updateInBattleFaintedData @@ -973,7 +973,7 @@ ItemUseMedicine: .skipComparingLSB pop hl jr nz, .notFullHP -.fullHP ; if the pokemon's current HP equals its max HP +; if the pokemon's current HP equals its max HP ld a, [wCurItem] cp FULL_RESTORE jp nz, .healingItemNoEffect @@ -1753,8 +1753,8 @@ ItemUsePokeFlute: ; OUTPUT: ; [wWereAnyMonsAsleep]: set to 1 if any pokemon were asleep WakeUpEntireParty: - ld de, 44 - ld c, 6 + ld de, PARTYMON_STRUCT_LENGTH + ld c, PARTY_LENGTH .loop ld a, [hl] push af @@ -1995,7 +1995,7 @@ ItemUsePPRestore: ld a, [wPPRestoreItem] cp ETHER jr nc, .useEther ; if Ether or Max Ether -.usePPUp +; use PP Up ld bc, MON_PP - MON_MOVES add hl, bc ld a, [hl] ; move PP diff --git a/engine/link/cable_club.asm b/engine/link/cable_club.asm index 4a300164..6ffb2aea 100644 --- a/engine/link/cable_club.asm +++ b/engine/link/cable_club.asm @@ -673,7 +673,7 @@ TradeCenter_PrintPartyListNames: pop de inc de pop hl - ld bc, 20 + ld bc, SCREEN_WIDTH add hl, bc pop bc inc c diff --git a/engine/menus/main_menu.asm b/engine/menus/main_menu.asm index f4d8ec03..84af085f 100644 --- a/engine/menus/main_menu.asm +++ b/engine/menus/main_menu.asm @@ -495,6 +495,7 @@ DisplayOptionMenu: jr nz, .exitMenu bit B_PAD_A, b jr z, .checkDirectionKeys +; A was pressed ld a, [wTopMenuItemY] cp 16 ; is the cursor on Cancel? jr nz, .loop @@ -518,7 +519,7 @@ DisplayOptionMenu: jr z, .cursorInBattleStyle cp 16 ; cursor on Cancel? jr z, .loop -.cursorInTextSpeed +; cursor in Text Speed bit B_PAD_LEFT, b jp nz, .pressedLeftInTextSpeed jp .pressedRightInTextSpeed @@ -625,7 +626,7 @@ SetOptionsFromCursorPositions: ld a, [wOptionsBattleAnimCursorX] ; battle animation cursor X coordinate dec a jr z, .battleAnimationOn -.battleAnimationOff +; battle animation Off set BIT_BATTLE_ANIMATION, d jr .checkBattleStyle .battleAnimationOn @@ -634,7 +635,7 @@ SetOptionsFromCursorPositions: ld a, [wOptionsBattleStyleCursorX] ; battle style cursor X coordinate dec a jr z, .battleStyleShift -.battleStyleSet +; battle style Set set BIT_BATTLE_SHIFT, d jr .storeOptions .battleStyleShift diff --git a/engine/menus/naming_screen.asm b/engine/menus/naming_screen.asm index 24b172f0..9356cc66 100644 --- a/engine/menus/naming_screen.asm +++ b/engine/menus/naming_screen.asm @@ -379,12 +379,13 @@ PrintNicknameAndUnderscores: hlcoord 10, 3 ld a, [wNamingScreenType] cp NAME_MON_SCREEN - jr nc, .pokemon1 - ld b, 7 ; player or rival max name length - jr .playerOrRival1 -.pokemon1 - ld b, 10 ; pokemon max name length -.playerOrRival1 + jr nc, .pokemon +; player or rival + ld b, PLAYER_NAME_LENGTH - 1 + jr .gotUnderscoreCount +.pokemon + ld b, NAME_LENGTH - 1 +.gotUnderscoreCount ld a, $76 ; underscore tile id .placeUnderscoreLoop ld [hli], a @@ -394,13 +395,15 @@ PrintNicknameAndUnderscores: cp NAME_MON_SCREEN ld a, [wNamingScreenNameLength] jr nc, .pokemon2 - cp 7 ; player or rival max name length - jr .playerOrRival2 +; player or rival + cp PLAYER_NAME_LENGTH - 1 + jr .checkEmptySpaces .pokemon2 - cp 10 ; pokemon max name length -.playerOrRival2 - jr nz, .emptySpacesRemaining - ; when all spaces are filled, force the cursor onto the ED tile + cp NAME_LENGTH - 1 +.checkEmptySpaces + jr nz, .placeRaisedUnderscore ; jump if empty spaces remain + ; when all spaces are filled, force the cursor onto the ED tile, + ; and keep the last underscore raised call EraseMenuCursor ld a, $11 ; "ED" x coord ld [wTopMenuItemX], a @@ -408,11 +411,10 @@ PrintNicknameAndUnderscores: ld [wCurrentMenuItem], a ld a, [wNamingScreenType] cp NAME_MON_SCREEN - ld a, 9 ; keep the last underscore raised - jr nc, .pokemon3 - ld a, 6 ; keep the last underscore raised -.pokemon3 -.emptySpacesRemaining + ld a, NAME_LENGTH - 2 + jr nc, .placeRaisedUnderscore + ld a, PLAYER_NAME_LENGTH - 2 +.placeRaisedUnderscore ld c, a ld b, $0 hlcoord 10, 3 diff --git a/engine/menus/party_menu.asm b/engine/menus/party_menu.asm index f2688b52..15fd62be 100644 --- a/engine/menus/party_menu.asm +++ b/engine/menus/party_menu.asm @@ -90,7 +90,7 @@ RedrawPartyMenu_:: jr nz, .placeMoveLearnabilityString ld de, .notAbleToLearnMoveText .placeMoveLearnabilityString - ld bc, 20 + 9 ; down 1 row and right 9 columns + ld bc, SCREEN_WIDTH + 9 ; 1 row down and 9 columns right push hl add hl, bc call PlaceString @@ -102,7 +102,7 @@ RedrawPartyMenu_:: pop hl pop de inc de - ld bc, 2 * 20 + ld bc, 2 * SCREEN_WIDTH add hl, bc pop bc inc c diff --git a/engine/menus/pokedex.asm b/engine/menus/pokedex.asm index 3e4096bc..3d2fcbca 100644 --- a/engine/menus/pokedex.asm +++ b/engine/menus/pokedex.asm @@ -105,7 +105,7 @@ HandlePokedexSideMenu: jr z, .choseCry dec a jr z, .choseArea -.choseQuit +; chose Quit ld b, 1 .exitSideMenu pop af @@ -286,7 +286,7 @@ HandlePokedexListMenu: call HandleMenuInput bit B_PAD_B, a jp nz, .buttonBPressed -.checkIfUpPressed +; check if Up pressed bit B_PAD_UP, a jr z, .checkIfDownPressed .upPressed ; scroll up one row @@ -299,7 +299,7 @@ HandlePokedexListMenu: .checkIfDownPressed bit B_PAD_DOWN, a jr z, .checkIfRightPressed -.downPressed ; scroll down one row +; Down pressed, scroll down one row ld a, [wDexMaxSeenMon] cp 7 jp c, .loop ; can't if the list is shorter than 7 @@ -314,7 +314,7 @@ HandlePokedexListMenu: .checkIfRightPressed bit B_PAD_RIGHT, a jr z, .checkIfLeftPressed -.rightPressed ; scroll down 7 rows +; Right pressed, scroll down 7 rows ld a, [wDexMaxSeenMon] cp 7 jp c, .loop ; can't if the list is shorter than 7 @@ -332,7 +332,7 @@ HandlePokedexListMenu: .checkIfLeftPressed ; scroll up 7 rows bit B_PAD_LEFT, a jr z, .buttonAPressed -.leftPressed +; Left pressed ld a, [wListScrollOffset] sub 7 ld [wListScrollOffset], a @@ -593,8 +593,8 @@ HeightWeightText: db "HT ?′??″" next "WT ???lb@" -; XXX does anything point to this? -PokeText: +; leftover from JPN Pokedex, where species have the suffix "Pokemon" +PokeText: ; unreferenced db "#@" ; horizontal line that divides the pokedex text description from the rest of the data diff --git a/engine/menus/start_sub_menus.asm b/engine/menus/start_sub_menus.asm index ec10dd11..817dceb8 100644 --- a/engine/menus/start_sub_menus.asm +++ b/engine/menus/start_sub_menus.asm @@ -340,7 +340,7 @@ StartMenu_Item:: ld a, [wCurItem] cp BICYCLE jp z, .useOrTossItem -.notBicycle1 +; not Bicycle ld a, USE_TOSS_MENU_TEMPLATE ld [wTextBoxID], a call DisplayTextBoxID @@ -370,14 +370,14 @@ StartMenu_Item:: call CopyToStringBuffer ld a, [wCurItem] cp BICYCLE - jr nz, .notBicycle2 + jr nz, .notBicycle ld a, [wStatusFlags6] bit BIT_ALWAYS_ON_BIKE, a jr z, .useItem_closeMenu ld hl, CannotGetOffHereText call PrintText jp ItemMenuLoop -.notBicycle2 +.notBicycle ld a, [wCurrentMenuItem] and a jr nz, .tossItem diff --git a/engine/menus/swap_items.asm b/engine/menus/swap_items.asm index 2d506ce2..dc54b645 100644 --- a/engine/menus/swap_items.asm +++ b/engine/menus/swap_items.asm @@ -76,7 +76,7 @@ HandleItemListSwapping:: ld a, [hli] cp b jr z, .swapSameItemType -.swapDifferentItems +; swap different items ldh [hSwapItemID], a ; save second item ID ld a, [hld] ldh [hSwapItemQuantity], a ; save second item quantity diff --git a/engine/movie/credits.asm b/engine/movie/credits.asm index b1ca7c91..77484a80 100644 --- a/engine/movie/credits.asm +++ b/engine/movie/credits.asm @@ -6,10 +6,10 @@ HallOfFamePC: call DisableLCD ld hl, vFont ld bc, ($80 tiles) / 2 - call ZeroMemory + call ShiftFontColorIndex ld hl, vChars2 tile $60 ld bc, ($20 tiles) / 2 - call ZeroMemory + call ShiftFontColorIndex ld hl, vChars2 tile $7e ld bc, TILE_SIZE ld a, $ff ; solid black @@ -33,7 +33,7 @@ HallOfFamePC: ld [wNumCreditsMonsDisplayed], a jp Credits -FadeInCreditsText: +FadeInCredits: ld hl, HoFGBPalettes ld b, 4 .loop @@ -145,15 +145,18 @@ CreditsCopyTileMapToVRAM: ldh [hAutoBGTransferEnabled], a jp Delay3 -ZeroMemory: -; zero bc bytes at hl +ShiftFontColorIndex: +; Zero every second byte at hl, writing a total of bc bytes. +; When used on VRAM font characters that contain only black and white shades, +; it shifts the color index: black -> light gray, allowing palette-controlled +; text fade-in during the Credits roll, while the black bars remain solid. ld [hl], 0 inc hl inc hl dec bc ld a, b or c - jr nz, ZeroMemory + jr nz, ShiftFontColorIndex ret FillFourRowsWithBlack: @@ -215,7 +218,7 @@ Credits: pop de jr .nextCreditsCommand .fadeInTextAndShowMon - call FadeInCreditsText + call FadeInCredits ld c, 90 jr .next1 .showTextAndShowMon @@ -225,7 +228,7 @@ Credits: call DisplayCreditsMon jr .nextCreditsScreen .fadeInText - call FadeInCreditsText + call FadeInCredits ld c, 120 jr .next2 .showText @@ -254,7 +257,7 @@ Credits: hlcoord 4, 9 inc de call PlaceString - jp FadeInCreditsText + jp FadeInCredits TheEndTextString: ; "T H E E N D" diff --git a/engine/overworld/auto_movement.asm b/engine/overworld/auto_movement.asm index bed2ffb9..13d30cca 100644 --- a/engine/overworld/auto_movement.asm +++ b/engine/overworld/auto_movement.asm @@ -1,6 +1,6 @@ PlayerStepOutFromDoor:: - ld hl, wStatusFlags5 ; should this be wMovementFlags? - res BIT_EXITING_DOOR, [hl] + ld hl, wStatusFlags5 + res BIT_UNKNOWN_5_1, [hl] call IsPlayerStandingOnDoorTile jr nc, .notStandingOnDoor ld a, PAD_SELECT | PAD_START | PAD_CTRL_PAD diff --git a/engine/overworld/missable_objects.asm b/engine/overworld/missable_objects.asm index 1660a894..8ea79980 100644 --- a/engine/overworld/missable_objects.asm +++ b/engine/overworld/missable_objects.asm @@ -178,10 +178,10 @@ MissableObjectFlagAction: ld a, b and a jr z, .reset - cp 2 + cp FLAG_TEST jr z, .read -.set +; set ld a, [hl] ld b, a ld a, d diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index 8d02f0fe..a353c4f1 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -140,7 +140,7 @@ UpdateNPCSprite: ld b, a ld a, [wFontLoaded] bit BIT_FONT_LOADED, a - jp nz, notYetMoving + jp nz, NotYetMoving ld a, b cp $2 jp z, UpdateSpriteMovementDelay ; [x#SPRITESTATEDATA1_MOVEMENTSTATUS] == 2 @@ -389,14 +389,15 @@ UpdateSpriteMovementDelay: jr .moving .tickMoveCounter dec [hl] ; x#SPRITESTATEDATA2_MOVEMENTDELAY - jr nz, notYetMoving + jr nz, NotYetMoving .moving dec h ldh a, [hCurrentSpriteOffset] inc a ld l, a ld [hl], $1 ; [x#SPRITESTATEDATA1_MOVEMENTSTATUS] = 1 (mark as ready to move) -notYetMoving: + ; fallthrough +NotYetMoving: ld h, HIGH(wSpriteStateData1) ldh a, [hCurrentSpriteOffset] add SPRITESTATEDATA1_ANIMFRAMECOUNTER @@ -411,7 +412,7 @@ MakeNPCFacePlayer: ; disabled. This is only done when rubbing the S.S. Anne captain's back. ld a, [wStatusFlags3] bit BIT_NO_NPC_FACE_PLAYER, a - jr nz, notYetMoving + jr nz, NotYetMoving res BIT_FACE_PLAYER, [hl] ld a, [wPlayerDirection] bit PLAYER_DIR_BIT_UP, a @@ -435,7 +436,7 @@ MakeNPCFacePlayer: add $9 ld l, a ld [hl], c ; [x#SPRITESTATEDATA1_FACINGDIRECTION]: set facing direction - jr notYetMoving + jr NotYetMoving InitializeSpriteStatus: ld [hl], $1 ; [x#SPRITESTATEDATA1_MOVEMENTSTATUS] = ready diff --git a/engine/overworld/pathfinding.asm b/engine/overworld/pathfinding.asm index 878ca07d..d6e0d009 100644 --- a/engine/overworld/pathfinding.asm +++ b/engine/overworld/pathfinding.asm @@ -94,7 +94,7 @@ CalcPositionOfPlayerRelativeToNPC: ld a, [hli] ; NPC sprite screen Y position in pixels call CalcDifference jr nc, .NPCSouthOfOrAlignedWithPlayer -.NPCNorthOfPlayer +; NPC north of player push hl ld hl, hNPCPlayerRelativePosFlags bit BIT_PLAYER_LOWER_Y, [hl] @@ -122,7 +122,7 @@ CalcPositionOfPlayerRelativeToNPC: ld a, [hl] ; NPC sprite screen X position in pixels call CalcDifference jr nc, .NPCEastOfOrAlignedWithPlayer -.NPCWestOfPlayer +; NPC west of player push hl ld hl, hNPCPlayerRelativePosFlags bit BIT_PLAYER_LOWER_X, [hl] diff --git a/engine/overworld/push_boulder.asm b/engine/overworld/push_boulder.asm index 2328b07a..5e7393d2 100644 --- a/engine/overworld/push_boulder.asm +++ b/engine/overworld/push_boulder.asm @@ -43,7 +43,7 @@ TryPushingBoulder:: jr z, .pushBoulderLeft cp SPRITE_FACING_RIGHT jr z, .pushBoulderRight -.pushBoulderDown +; push boulder down bit B_PAD_DOWN, b ret z ld de, PushBoulderDownMovementData diff --git a/engine/pokemon/add_mon.asm b/engine/pokemon/add_mon.asm index 455221ce..c92acfcb 100644 --- a/engine/pokemon/add_mon.asm +++ b/engine/pokemon/add_mon.asm @@ -375,7 +375,7 @@ _MoveMon:: .copySpecies ld [hli], a ; write new mon ID ld [hl], $ff ; write new sentinel -.findMonDataDest +; find mon data dest ld a, [wMoveMonType] dec a ld hl, wPartyMons @@ -457,7 +457,7 @@ _MoveMon:: ld bc, NAME_LENGTH call CopyData ld a, [wMoveMonType] -.findNickDest +; find nick dest cp PARTY_TO_DAYCARE ld de, wDayCareMonName jr z, .findNickSrc diff --git a/engine/pokemon/load_mon_data.asm b/engine/pokemon/load_mon_data.asm index d90b9cd8..87a2be8b 100644 --- a/engine/pokemon/load_mon_data.asm +++ b/engine/pokemon/load_mon_data.asm @@ -31,7 +31,7 @@ LoadMonData_:: ld hl, wEnemyMons jr z, .getMonEntry - cp 2 + cp BOX_DATA ld hl, wBoxMons ld bc, BOXMON_STRUCT_LENGTH jr z, .getMonEntry diff --git a/home/joypad2.asm b/home/joypad2.asm index a07b9ee4..11ef9a99 100644 --- a/home/joypad2.asm +++ b/home/joypad2.asm @@ -25,7 +25,7 @@ JoypadLowSensitivity:: ldh a, [hJoyPressed] ; newly pressed buttons and a ; have any buttons been newly pressed since last check? jr z, .noNewlyPressedButtons -.newlyPressedButtons +; newly pressed buttons ld a, 30 ; half a second delay ldh [hFrameCounter], a ret @@ -33,7 +33,7 @@ JoypadLowSensitivity:: ldh a, [hFrameCounter] and a ; is the delay over? jr z, .delayOver -.delayNotOver +; delay not over xor a ldh [hJoy5], a ; report no buttons as pressed ret diff --git a/home/list_menu.asm b/home/list_menu.asm index d0d3f732..bd1197bb 100644 --- a/home/list_menu.asm +++ b/home/list_menu.asm @@ -65,7 +65,7 @@ DisplayListMenuIDLoop:: ld a, [wBattleType] and a ; is it the Old Man battle? jr z, .notOldManBattle -.oldManBattle +; Old Man battle ld a, '▶' ldcoord_a 5, 4 ; place menu cursor in front of first menu entry ld c, 80 @@ -178,7 +178,7 @@ DisplayListMenuIDLoop:: bit B_PAD_DOWN, b ld hl, wListScrollOffset jr z, .upPressed -.downPressed +; Down pressed ld a, [hl] add 3 ld b, a @@ -380,7 +380,7 @@ PrintListMenuEntries:: jr z, .pokemonPCMenu cp MOVESLISTMENU jr z, .movesMenu -.itemMenu +; item menu call GetItemName jr .placeNameString .pokemonPCMenu @@ -411,7 +411,7 @@ PrintListMenuEntries:: ld a, [wPrintItemPrices] and a ; should prices be printed? jr z, .skipPrintingItemPrice -.printItemPrice +; print item price push hl ld a, [de] ld de, ItemPrices @@ -426,7 +426,7 @@ PrintListMenuEntries:: ld a, [wListMenuID] and a ; PCPOKEMONLISTMENU? jr nz, .skipPrintingPokemonLevel -.printPokemonLevel +; print Pokemon level ld a, [wNamedObjectIndex] push af push hl @@ -451,7 +451,7 @@ PrintListMenuEntries:: ld a, [wMonDataLocation] and a ; is it a list of party pokemon or box pokemon? jr z, .skipCopyingLevel -.copyLevel +; copy level ld a, [wLoadedMonBoxLevel] ld [wLoadedMonLevel], a .skipCopyingLevel @@ -468,7 +468,7 @@ PrintListMenuEntries:: ld a, [wListMenuID] cp ITEMLISTMENU jr nz, .nextListEntry -.printItemQuantity +; print item quantity ld a, [wNamedObjectIndex] ld [wCurItem], a call IsKeyItem ; check if item is unsellable diff --git a/home/load_font.asm b/home/load_font.asm index 47ad60f1..e6e04113 100644 --- a/home/load_font.asm +++ b/home/load_font.asm @@ -2,7 +2,7 @@ LoadFontTilePatterns:: ldh a, [rLCDC] bit B_LCDC_ENABLE, a jr nz, .on -.off +; off ld hl, FontGraphics ld de, vFont ld bc, FontGraphicsEnd - FontGraphics @@ -18,7 +18,7 @@ LoadTextBoxTilePatterns:: ldh a, [rLCDC] bit B_LCDC_ENABLE, a jr nz, .on -.off +; off ld hl, TextBoxGraphics ld de, vChars2 tile $60 ld bc, TextBoxGraphicsEnd - TextBoxGraphics @@ -34,7 +34,7 @@ LoadHpBarAndStatusTilePatterns:: ldh a, [rLCDC] bit B_LCDC_ENABLE, a jr nz, .on -.off +; off ld hl, HpBarAndStatusGraphics ld de, vChars2 tile $62 ld bc, HpBarAndStatusGraphicsEnd - HpBarAndStatusGraphics diff --git a/home/map_objects.asm b/home/map_objects.asm index 44b012e6..57364518 100644 --- a/home/map_objects.asm +++ b/home/map_objects.asm @@ -115,7 +115,7 @@ CheckCoords:: ld hl, wCoordIndex inc [hl] pop hl -.compareYCoord +; compare Y coord cp b jr z, .compareXCoord inc hl @@ -124,7 +124,7 @@ CheckCoords:: ld a, [hli] cp c jr nz, .loop -.inArray +; in array scf ret .notInArray diff --git a/home/move_mon.asm b/home/move_mon.asm index cb19d0e3..def60bc1 100644 --- a/home/move_mon.asm +++ b/home/move_mon.asm @@ -106,7 +106,7 @@ CalcStat:: jr z, .getSpeedIV cp $5 jr z, .getSpecialIV -.getHpIV +; get HP IV push bc ld a, [hl] ; Atk IV swap a diff --git a/home/overworld.asm b/home/overworld.asm index f837815b..e994f694 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -546,7 +546,7 @@ ContinueCheckWarpsNoCollisionLoop:: ; if no matching warp was found CheckMapConnections:: -.checkWestMap +; check west map ld a, [wXCoord] cp $ff jr nz, .checkEastMap @@ -1097,8 +1097,7 @@ IsSpriteOrSignInFrontOfPlayer:: ld a, [hli] ; sign X cp e jr nz, .retry -.xCoordMatched -; found sign +; X coord matched: found sign push hl push bc ld hl, wSignTextIDs @@ -2047,7 +2046,7 @@ LoadMapHeader:: ; copy connection data (if any) to WRAM ld a, [wCurMapConnections] ld b, a -.checkNorth +; check north bit NORTH_F, b jr z, .checkSouth ld de, wNorthConnectionHeader @@ -2080,7 +2079,7 @@ LoadMapHeader:: ld de, wMapBackgroundTile ld a, [hli] ld [de], a -.loadWarpData +; load warp data ld a, [hli] ld [wNumberOfWarps], a and a diff --git a/home/print_bcd.asm b/home/print_bcd.asm index 2e501be5..cac6aba3 100644 --- a/home/print_bcd.asm +++ b/home/print_bcd.asm @@ -31,9 +31,9 @@ PrintBCDNumber:: inc de dec c jr nz, .loop - bit BIT_LEADING_ZEROES, b + bit BIT_LEADING_ZEROES, b ; were any non-zero digits printed? jr z, .done ; if so, we are done -.numberEqualsZero ; if every digit of the BCD number is zero +; if every digit of the BCD number is zero, print the last 0 bit BIT_LEFT_ALIGN, b jr nz, .skipRightAlignmentAdjustment dec hl ; if the string is right-aligned, it needs to be moved back one space diff --git a/home/print_num.asm b/home/print_num.asm index 32fae363..8027a764 100644 --- a/home/print_num.asm +++ b/home/print_num.asm @@ -82,11 +82,16 @@ MACRO print_digit call .NextDigit ENDM -.millions print_digit 1000000 -.hundred_thousands print_digit 100000 -.ten_thousands print_digit 10000 -.thousands print_digit 1000 -.hundreds print_digit 100 +; millions + print_digit 1000000 +.hundred_thousands + print_digit 100000 +.ten_thousands + print_digit 10000 +.thousands + print_digit 1000 +.hundreds + print_digit 100 .tens ld c, 0 @@ -113,7 +118,7 @@ ENDM .next call .NextDigit -.ones +; ones ld a, '0' add b ld [hli], a diff --git a/home/print_text.asm b/home/print_text.asm index fe784350..8e351ba3 100644 --- a/home/print_text.asm +++ b/home/print_text.asm @@ -24,7 +24,7 @@ PrintLetterDelay:: .checkButtons call Joypad ldh a, [hJoyHeld] -.checkAButton +; check A button bit B_PAD_A, a jr z, .checkBButton jr .endWait diff --git a/home/start_menu.asm b/home/start_menu.asm index 6de15182..9504d536 100644 --- a/home/start_menu.asm +++ b/home/start_menu.asm @@ -14,7 +14,7 @@ RedisplayStartMenu:: .loop call HandleMenuInput ld b, a -.checkIfUpPressed +; check if Up pressed bit B_PAD_UP, a jr z, .checkIfDownPressed ld a, [wCurrentMenuItem] ; menu selection diff --git a/home/trainers.asm b/home/trainers.asm index f00c4df9..8d2cceaf 100644 --- a/home/trainers.asm +++ b/home/trainers.asm @@ -19,7 +19,7 @@ ExecuteCurMapScriptInTable:: ld hl, wStatusFlags7 bit BIT_USE_CUR_MAP_SCRIPT, [hl] res BIT_USE_CUR_MAP_SCRIPT, [hl] - jr z, .useProvidedIndex ; test if map script index was overridden manually + jr z, .useProvidedIndex ; test if map script index was overridden manually ld a, [wCurMapScript] .useProvidedIndex pop hl @@ -32,11 +32,11 @@ LoadGymLeaderAndCityName:: push de ld de, wGymCityName ld bc, GYM_CITY_LENGTH - call CopyData ; load city name + call CopyData ; load city name pop hl ld de, wGymLeaderName ld bc, NAME_LENGTH - jp CopyData ; load gym leader name + jp CopyData ; load gym leader name ; reads specific information from trainer header (pointed to at wTrainerHeaderPtr) ; a: offset in header data @@ -155,7 +155,7 @@ ENDC ldh [hJoyHeld], a call TrainerWalkUpToPlayer_Bank0 ld hl, wCurMapScript - inc [hl] ; increment map script index (next script function is usually DisplayEnemyTrainerTextAndStartBattle) + inc [hl] ; increment map script index (next script function is usually DisplayEnemyTrainerTextAndStartBattle) ret ; display the before battle text after the enemy trainer has walked up to the player's sprite @@ -179,7 +179,7 @@ StartTrainerBattle:: ld hl, wStatusFlags4 set BIT_UNKNOWN_4_1, [hl] ld hl, wCurMapScript - inc [hl] ; increment map script index (next script function is usually EndTrainerBattle) + inc [hl] ; increment map script index (next script function is usually EndTrainerBattle) ret EndTrainerBattle:: @@ -201,14 +201,14 @@ EndTrainerBattle:: call TrainerFlagAction ; flag trainer as fought ld a, [wEnemyMonOrTrainerClass] cp OPP_ID_OFFSET - jr nc, .skipRemoveSprite ; test if trainer was fought (in that case skip removing the corresponding sprite) + jr nc, .skipRemoveSprite ; test if trainer was fought (in that case skip removing the corresponding sprite) ld hl, wMissableObjectList ld de, $2 ld a, [wSpriteIndex] - call IsInArray ; search for sprite ID + call IsInArray ; search for sprite ID inc hl ld a, [hl] - ld [wMissableObjectIndex], a ; load corresponding missable object index and remove it + ld [wMissableObjectIndex], a ; load corresponding missable object index and remove it predef HideObject .skipRemoveSprite ld hl, wStatusFlags5 @@ -269,7 +269,7 @@ CheckForEngagingTrainers:: .trainerLoop call StoreTrainerHeaderPointer ; set trainer header pointer to current trainer ld a, [de] - ld [wSpriteIndex], a ; store trainer flag's bit + ld [wSpriteIndex], a ; store trainer flag's bit ld [wTrainerHeaderFlagBit], a cp -1 ret z @@ -278,7 +278,7 @@ CheckForEngagingTrainers:: ld b, FLAG_TEST ld a, [wTrainerHeaderFlagBit] ld c, a - call TrainerFlagAction ; read trainer flag + call TrainerFlagAction ; read trainer flag ld a, c and a ; has the trainer already been defeated? jr nz, .continue @@ -299,7 +299,7 @@ CheckForEngagingTrainers:: pop hl ld a, [wTrainerSpriteOffset] and a - ret nz ; break if the trainer is engaging + ret nz ; break if the trainer is engaging .continue ld hl, $c add hl, de @@ -364,8 +364,8 @@ PrintEndBattleText:: GetSavedEndBattleTextPointer:: ld a, [wBattleResult] and a -; won battle jr nz, .lostBattle +; won battle ld a, [wEndBattleWinTextPointer] ld h, a ld a, [wEndBattleWinTextPointer + 1] diff --git a/home/window.asm b/home/window.asm index 6885a138..2f2609d7 100644 --- a/home/window.asm +++ b/home/window.asm @@ -52,11 +52,11 @@ HandleMenuInput_:: ld b, a bit B_PAD_UP, a jr z, .checkIfDownPressed -.upPressed +; Up pressed ld a, [wCurrentMenuItem] ; selected menu item and a ; already at the top of the menu? jr z, .alreadyAtTop -.notAtTop +; not at top dec a ld [wCurrentMenuItem], a ; move selected menu item up one space jr .checkOtherKeys @@ -70,14 +70,14 @@ HandleMenuInput_:: .checkIfDownPressed bit B_PAD_DOWN, a jr z, .checkOtherKeys -.downPressed +; Down pressed ld a, [wCurrentMenuItem] inc a ld c, a ld a, [wMaxMenuItem] cp c jr nc, .notAtBottom -.alreadyAtBottom +; already at bottom ld a, [wMenuWrappingEnabled] and a ; is wrapping around enabled? jr z, .noWrappingAround @@ -93,7 +93,7 @@ HandleMenuInput_:: ldh a, [hJoy5] and PAD_A | PAD_B jr z, .skipPlayingSound -.AButtonOrBButtonPressed +; A or B pressed push hl ld hl, wMiscFlags bit BIT_NO_MENU_BUTTON_SOUND, [hl] @@ -153,7 +153,7 @@ PlaceMenuCursor:: ld a, [hl] cp '▶' ; was an arrow next to the previously selected menu item? jr nz, .skipClearingArrow -.clearArrow +; clear arrow ld a, [wTileBehindCursor] ld [hl], a .skipClearingArrow diff --git a/macros/scripts/events.asm b/macros/scripts/events.asm index b07a38f3..740184dd 100644 --- a/macros/scripts/events.asm +++ b/macros/scripts/events.asm @@ -343,7 +343,7 @@ MACRO ResetEventRange IF event_fill_count > 1 ld hl, wEventFlags + event_fill_start - ; force xor a if we just to wrote to it above + ; force xor a if we just wrote to it above IF (_NARG < 3) || (((\1) % 8) != 0) xor a ENDC diff --git a/scripts/BillsHouse.asm b/scripts/BillsHouse.asm index 6b65aa38..d43ae546 100644 --- a/scripts/BillsHouse.asm +++ b/scripts/BillsHouse.asm @@ -82,13 +82,13 @@ BillsHouseBillExitsMachineScript: call DelayFrames ld a, BILLSHOUSE_BILL1 ldh [hSpriteIndex], a - ld de, BillExitMachineMovement + ld de, .BillExitMachineMovement call MoveSprite ld a, SCRIPT_BILLSHOUSE_CLEANUP ld [wBillsHouseCurScript], a ret -BillExitMachineMovement: +.BillExitMachineMovement: db NPC_MOVEMENT_DOWN db NPC_MOVEMENT_RIGHT db NPC_MOVEMENT_RIGHT diff --git a/scripts/Colosseum.asm b/scripts/Colosseum.asm index 4aaa4236..1489fd2c 100644 --- a/scripts/Colosseum.asm +++ b/scripts/Colosseum.asm @@ -1,4 +1,5 @@ Colosseum_Script: + ASSERT TRADECENTER_OPPONENT == COLOSSEUM_OPPONENT jp TradeCenter_Script Colosseum_TextPointers: -- cgit v1.3.1-sl0p