From fd2235e678c58cebd6255b5e658e704ee5138591 Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Sat, 11 Jun 2016 21:30:05 -0700 Subject: sync engine code with pokeyellow --- engine/HoF_room_pc.asm | 6 +- engine/battle/animations.asm | 25 +-- engine/battle/core.asm | 290 +++++++++++++++--------------- engine/battle/decrement_pp.asm | 2 +- engine/battle/experience.asm | 4 +- engine/battle/get_trainer_name.asm | 10 +- engine/battle/link_battle_versus_text.asm | 4 +- engine/battle/trainer_ai.asm | 2 +- engine/cable_club.asm | 12 +- engine/hall_of_fame.asm | 8 +- engine/hidden_object_functions14.asm | 12 +- engine/hidden_object_functions3.asm | 10 +- engine/hidden_object_functions7.asm | 22 +-- engine/hp_bar.asm | 5 +- engine/in_game_trades.asm | 2 +- engine/intro.asm | 2 +- engine/menu/bills_pc.asm | 2 +- engine/menu/naming_screen.asm | 10 +- engine/menu/oaks_pc.asm | 4 +- engine/menu/pc.asm | 10 +- engine/menu/pokedex.asm | 22 +++ engine/menu/prize_menu.asm | 64 +++---- engine/menu/start_sub_menus.asm | 4 +- engine/menu/status_screen.asm | 10 +- engine/menu/vending_machine.asm | 9 +- engine/mon_party_sprites.asm | 4 +- engine/oak_speech.asm | 4 +- engine/overworld/card_key.asm | 2 +- engine/overworld/cut.asm | 2 +- engine/overworld/elevator.asm | 4 +- engine/overworld/emotion_bubbles.asm | 8 +- engine/overworld/hidden_items.asm | 20 +-- engine/overworld/movement.asm | 19 +- engine/overworld/oam.asm | 2 +- engine/overworld/player_animations.asm | 2 +- engine/overworld/pokemart.asm | 2 +- engine/overworld/trainers.asm | 54 +++--- engine/predefs.asm | 14 +- engine/save.asm | 6 +- engine/slot_machine.asm | 3 +- engine/titlescreen.asm | 2 +- engine/titlescreen2.asm | 2 +- engine/town_map.asm | 14 +- engine/trade.asm | 10 +- home.asm | 4 +- text.asm | 4 +- wram.asm | 2 +- 47 files changed, 385 insertions(+), 350 deletions(-) diff --git a/engine/HoF_room_pc.asm b/engine/HoF_room_pc.asm index 09c8d5af..82aa6d52 100755 --- a/engine/HoF_room_pc.asm +++ b/engine/HoF_room_pc.asm @@ -18,7 +18,7 @@ HallOfFamePC: call FillFourRowsWithBlack coord hl, 0, 14 call FillFourRowsWithBlack - ld a, $c0 + ld a, %11000000 ld [rBGP], a call EnableLCD ld a, $ff @@ -36,13 +36,13 @@ HallOfFamePC: FadeInCreditsText: ld hl, HoFGBPalettes ld b, 4 -.asm_740bf +.loop ld a, [hli] ld [rBGP], a ld c, 5 call DelayFrames dec b - jr nz, .asm_740bf + jr nz, .loop ret DisplayCreditsMon: diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index 2578ee28..373136a8 100755 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -383,29 +383,29 @@ MoveAnimation: call SetAnimationPalette ld a,[wAnimationID] and a - jr z,.AnimationFinished + jr z, .animationFinished ; if throwing a Poké Ball, skip the regular animation code cp a,TOSS_ANIM - jr nz,.MoveAnimation - ld de,.AnimationFinished + jr nz, .moveAnimation + ld de, .animationFinished push de jp TossBallAnimation -.MoveAnimation +.moveAnimation ; check if battle animations are disabled in the options ld a,[wOptions] bit 7,a - jr nz,.AnimationsDisabled + jr nz, .animationsDisabled call ShareMoveAnimations call PlayAnimation jr .next4 -.AnimationsDisabled +.animationsDisabled ld c,30 call DelayFrames .next4 call PlayApplyingAttackAnimation ; shake the screen or flash the pic in and out (to show damage) -.AnimationFinished +.animationFinished call WaitForSoundToFinish xor a ld [wSubAnimSubEntryAddr],a @@ -431,13 +431,13 @@ ShareMoveAnimations: cp a,AMNESIA ld b,CONF_ANIM - jr z,.Replace + jr z, .replaceAnim cp a,REST ld b,SLP_ANIM ret nz -.Replace +.replaceAnim ld a,b ld [wAnimationID],a ret @@ -1845,13 +1845,13 @@ AnimationMinimizeMon: ld hl, wTempPic push hl xor a - ld bc, $310 + ld bc, 7 * 7 * $10 call FillMemory pop hl ld de, $194 add hl, de ld de, MinimizedMonSprite - ld c, $5 + ld c, MinimizedMonSpriteEnd - MinimizedMonSprite .loop ld a, [de] ld [hli], a @@ -1865,6 +1865,7 @@ AnimationMinimizeMon: MinimizedMonSprite: INCBIN "gfx/minimized_mon_sprite.1bpp" +MinimizedMonSpriteEnd: AnimationSlideMonDownAndHide: ; Slides the mon's sprite down and disappears. Used in Acid Armor. @@ -2308,7 +2309,6 @@ GetMoveSoundB: ld b, a ret -; get the sound of the (move id - 1) in a GetMoveSound: ld hl,MoveSoundTable ld e,a @@ -2363,6 +2363,7 @@ IsCryMove: ret MoveSoundTable: + ; ID, pitch mod, tempo mod db SFX_POUND, $00,$80 ; POUND db SFX_BATTLE_0C, $10,$80 ; KARATE_CHOP db SFX_DOUBLESLAP, $00,$80 ; DOUBLESLAP diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 3b474584..9d300588 100755 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -443,7 +443,7 @@ MainInBattleLoop: ; the link battle enemy has switched mons ld a, [wPlayerBattleStatus1] bit UsingTrappingMove, a ; check if using multi-turn move like Wrap - jr z, .asm_3c2dd + jr z, .specialMoveNotUsed ld a, [wPlayerMoveListIndex] ld hl, wBattleMonMoves ld c, a @@ -452,9 +452,9 @@ MainInBattleLoop: ld a, [hl] cp METRONOME ; a MIRROR MOVE check is missing, might lead to a desync in link battles ; when combined with multi-turn moves - jr nz, .asm_3c2dd + jr nz, .specialMoveNotUsed ld [wPlayerSelectedMove], a -.asm_3c2dd +.specialMoveNotUsed callab SwitchEnemyMon .noLinkBattle ld a, [wPlayerSelectedMove] @@ -665,7 +665,7 @@ HandlePoisonBurnLeechSeed_DecreaseOwnHP: and a jr z, .playersTurn ld hl, wEnemyBattleStatus3 - ld de, wEnemyToxcCounter + ld de, wEnemyToxicCounter .playersTurn bit BadlyPoisoned, [hl] jr z, .noToxic @@ -884,6 +884,8 @@ FaintEnemyPokemon: ld a, MUSIC_DEFEATED_WILD_MON call PlayBattleVictoryMusic .sfxplayed +; bug: win sfx is played for wild battles before checking for player mon HP +; this can lead to odd scenarios where both player and enemy faint, as the win sfx plays yet the player never won the battle ld hl, wBattleMonHP ld a, [hli] or [hl] @@ -1285,7 +1287,7 @@ SlideDownFaintedMonPic: call CopyData pop de pop hl - ld bc, -20 + ld bc, -SCREEN_WIDTH add hl, bc push hl ld h, d @@ -1297,7 +1299,7 @@ SlideDownFaintedMonPic: pop bc dec b jr nz, .rowLoop - ld bc, 20 + ld bc, SCREEN_WIDTH add hl, bc ld de, SevenSpacesText call PlaceString @@ -1925,9 +1927,9 @@ DrawPlayerHUDAndHPBar: ld de, wLoadedMonStatus call PrintStatusConditionNotFainted pop hl - jr nz, .asm_3cdae + jr nz, .doNotPrintLevel call PrintLevel -.asm_3cdae +.doNotPrintLevel ld a, [wLoadedMonSpecies] ld [wcf91], a coord hl, 10, 9 @@ -1939,14 +1941,14 @@ DrawPlayerHUDAndHPBar: ld hl, wBattleMonHP ld a, [hli] or [hl] - jr z, .asm_3cdd9 + jr z, .fainted ld a, [wLowHealthAlarmDisabled] and a ; has the alarm been disabled because the player has already won? ret nz ; if so, return ld a, [wPlayerHPBarColor] cp HP_BAR_RED - jr z, .asm_3cde6 -.asm_3cdd9 + jr z, .setLowHealthAlarm +.fainted ld hl, wLowHealthAlarm bit 7, [hl] ;low health alarm enabled? ld [hl], $0 @@ -1954,7 +1956,7 @@ DrawPlayerHUDAndHPBar: xor a ld [wChannelSoundIDs + CH4], a ret -.asm_3cde6 +.setLowHealthAlarm ld hl, wLowHealthAlarm set 7, [hl] ;enable low health alarm ret @@ -2572,9 +2574,10 @@ MoveSelectionMenu: ld hl, wBattleMonMoves call .loadmoves coord hl, 4, 12 - ld b, $4 - ld c, $e - di + ld b, 4 + ld c, 14 + di ; out of pure coincidence, it is possible for vblank to occur between the di and ei + ; so it is necessary to put the di ei block to not cause tearing call TextBoxBorder coord hl, 4, 12 ld [hl], $7a @@ -2590,8 +2593,8 @@ MoveSelectionMenu: ld hl, wEnemyMonMoves call .loadmoves coord hl, 0, 7 - ld b, $4 - ld c, $e + ld b, 4 + ld c, 14 call TextBoxBorder coord hl, 2, 8 call .writemoves @@ -2605,8 +2608,8 @@ MoveSelectionMenu: call AddNTimes call .loadmoves coord hl, 4, 7 - ld b, $4 - ld c, $e + ld b, 4 + ld c, 14 call TextBoxBorder coord hl, 6, 8 call .writemoves @@ -2688,9 +2691,9 @@ SelectMenuItem: ld hl, hFlags_0xFFF6 res 1, [hl] bit 6, a - jp nz, CursorUp ; up + jp nz, SelectMenuItem_CursorUp ; up bit 7, a - jp nz, CursorDown ; down + jp nz, SelectMenuItem_CursorDown ; down bit 2, a jp nz, SwapMovesInMenu ; select bit 1, a ; B, but was it reset above? @@ -2703,10 +2706,10 @@ SelectMenuItem: ld b, a ld a, [wMoveMenuType] dec a ; if not mimic - jr nz, .nob + jr nz, .notB pop af ret -.nob +.notB dec a ld a, b ld [wPlayerMoveListIndex], a @@ -2723,7 +2726,7 @@ SelectMenuItem: add hl, bc ld a, [hl] and $3f - jr z, .nopp + jr z, .noPP ld a, [wPlayerDisabledMove] swap a and $f @@ -2746,7 +2749,7 @@ SelectMenuItem: .disabled ld hl, MoveDisabledText jr .print -.nopp +.noPP ld hl, MoveNoPPText .print call PrintText @@ -2764,7 +2767,7 @@ MoveDisabledText: WhichTechniqueString: db "WHICH TECHNIQUE?@" -CursorUp: +SelectMenuItem_CursorUp: ld a, [wCurrentMenuItem] and a jp nz, SelectMenuItem @@ -2774,7 +2777,7 @@ CursorUp: ld [wCurrentMenuItem], a jp SelectMenuItem -CursorDown: +SelectMenuItem_CursorDown: ld a, [wCurrentMenuItem] ld b, a ld a, [wNumMovesMinusOne] @@ -2794,7 +2797,7 @@ AnyMoveToSelect: ld a, [wPlayerDisabledMove] and a ld hl, wBattleMonPP - jr nz, .asm_3d40e + jr nz, .handleDisabledMove ld a, [hli] or [hl] inc hl @@ -2803,26 +2806,26 @@ AnyMoveToSelect: or [hl] and $3f ret nz - jr .asm_3d423 -.asm_3d40e + jr .noMovesLeft +.handleDisabledMove swap a - and $f + and $f ; get disabled move ld b, a - ld d, $5 + ld d, NUM_MOVES + 1 xor a -.asm_3d416 +.handleDisabledMovePPLoop dec d - jr z, .asm_3d421 - ld c, [hl] + jr z, .allMovesChecked + ld c, [hl] ; get move PP inc hl - dec b - jr z, .asm_3d416 + dec b ; is this the disabled move? + jr z, .handleDisabledMovePPLoop ; if so, ignore its PP value or c - jr .asm_3d416 -.asm_3d421 - and a - ret nz -.asm_3d423 + jr .handleDisabledMovePPLoop +.allMovesChecked + and a ; any PP left? + ret nz ; return if a move has PP left +.noMovesLeft ld hl, NoMovesLeftText call PrintText ld c, 60 @@ -2914,8 +2917,8 @@ PrintMenuItem: xor a ld [H_AUTOBGTRANSFERENABLED], a coord hl, 0, 8 - ld b, $3 - ld c, $9 + ld b, 3 + ld c, 9 call TextBoxBorder ld a, [wPlayerDisabledMove] and a @@ -2997,7 +3000,7 @@ SelectEnemyMove: call LoadScreenTilesFromBuffer1 ld a, [wSerialExchangeNybbleReceiveData] cp $e - jp z, .asm_3d601 + jp z, .linkedOpponentUsedStruggle cp $d jr z, .unableToSelectMove cp $4 @@ -3075,7 +3078,7 @@ SelectEnemyMove: .done ld [wEnemySelectedMove], a ret -.asm_3d601 +.linkedOpponentUsedStruggle ld a, STRUGGLE jr .done @@ -3205,7 +3208,7 @@ PlayerCalcMoveDamage: call RandomizeDamage .moveHitTest call MoveHitTest -handleIfPlayerMoveMissed +handleIfPlayerMoveMissed: ld a,[wMoveMissed] and a jr z,getPlayerAnimationType @@ -3213,13 +3216,13 @@ handleIfPlayerMoveMissed sub a,EXPLODE_EFFECT jr z,playPlayerMoveAnimation ; don't play any animation if the move missed, unless it was EXPLODE_EFFECT jr playerCheckIfFlyOrChargeEffect -getPlayerAnimationType +getPlayerAnimationType: ld a,[wPlayerMoveEffect] and a ld a,4 ; move has no effect other than dealing damage jr z,playPlayerMoveAnimation ld a,5 ; move has effect -playPlayerMoveAnimation +playPlayerMoveAnimation: push af ld a,[wPlayerBattleStatus2] bit HasSubstituteUp,a @@ -3238,7 +3241,7 @@ playPlayerMoveAnimation ld b,BANK(ReshowSubstituteAnim) call nz,Bankswitch jr MirrorMoveCheck -playerCheckIfFlyOrChargeEffect +playerCheckIfFlyOrChargeEffect: ld c,30 call DelayFrames ld a,[wPlayerMoveEffect] @@ -3252,7 +3255,7 @@ playerCheckIfFlyOrChargeEffect ld [wAnimationType],a ld a,STATUS_AFFECTED_ANIM call PlayMoveAnimation -MirrorMoveCheck +MirrorMoveCheck: ld a,[wPlayerMoveEffect] cp a,MIRROR_MOVE_EFFECT jr nz,.metronomeCheck @@ -3785,10 +3788,10 @@ MonName1Text: and a ld a, [wPlayerMoveNum] ld hl, wPlayerUsedMove - jr z, .asm_3db11 + jr z, .playerTurn ld a, [wEnemyMoveNum] ld hl, wEnemyUsedMove -.asm_3db11 +.playerTurn ld [hl], a ld [wd11e], a call DetermineExclamationPointTextNum @@ -4682,9 +4685,9 @@ CriticalHitTest: ld a, [H_WHOSETURN] and a ld a, [wEnemyMonSpecies] - jr nz, .asm_3e032 + jr nz, .handleEnemy ld a, [wBattleMonSpecies] -.asm_3e032 +.handleEnemy ld [wd0b5], a call GetMonHeader ld a, [wMonHBaseSpeed] @@ -5051,7 +5054,7 @@ ApplyDamageToPlayerPokemon: ld a,$01 ld [wHPBarType],a predef UpdateHPBar2 ; animate the HP bar shortening -ApplyAttackToPlayerPokemonDone +ApplyAttackToPlayerPokemonDone: jp DrawHUDsAndHPBars AttackSubstitute: @@ -5751,12 +5754,12 @@ EnemyMoveHitTest: handleIfEnemyMoveMissed: ld a, [wMoveMissed] and a - jr z, .asm_3e791 + jr z, .moveDidNotMiss ld a, [wEnemyMoveEffect] cp EXPLODE_EFFECT - jr z, asm_3e7a0 + jr z, handleExplosionMiss jr EnemyCheckIfFlyOrChargeEffect -.asm_3e791 +.moveDidNotMiss call SwapPlayerAndEnemyLevels GetEnemyAnimationType: @@ -5766,7 +5769,7 @@ GetEnemyAnimationType: jr z, playEnemyMoveAnimation ld a, $2 jr playEnemyMoveAnimation -asm_3e7a0: +handleExplosionMiss: call SwapPlayerAndEnemyLevels xor a playEnemyMoveAnimation: @@ -5824,19 +5827,19 @@ EnemyCheckIfMirrorMoveEffect: jp c, JumpMoveEffect ld a, [wMoveMissed] and a - jr z, .asm_3e82b + jr z, .moveDidNotMiss call PrintMoveFailureText ld a, [wEnemyMoveEffect] cp EXPLODE_EFFECT - jr z, .asm_3e83e + jr z, .handleExplosionMiss jp ExecuteEnemyMoveDone -.asm_3e82b +.moveDidNotMiss call ApplyAttackToPlayerPokemon call PrintCriticalOHKOText callab DisplayEffectiveness ld a, 1 ld [wMoveDidntMiss], a -.asm_3e83e +.handleExplosionMiss ld a, [wEnemyMoveEffect] ld hl, AlwaysHappenSideEffects ld de, $1 @@ -5850,7 +5853,7 @@ EnemyCheckIfMirrorMoveEffect: call HandleBuildingRage ld hl, wEnemyBattleStatus1 bit AttackingMultipleTimes, [hl] ; is mon hitting multiple times? (example: double kick) - jr z, .asm_3e873 + jr z, .notMultiHitMove push hl ld hl, wEnemyNumAttacksLeft dec [hl] @@ -5861,7 +5864,7 @@ EnemyCheckIfMirrorMoveEffect: call PrintText xor a ld [wEnemyNumHits], a -.asm_3e873 +.notMultiHitMove ld a, [wEnemyMoveEffect] and a jr z, ExecuteEnemyMoveDone @@ -6801,16 +6804,16 @@ HandleExplodingAnimation: ld hl, wEnemyMonType1 ld de, wEnemyBattleStatus1 ld a, [wPlayerMoveNum] - jr z, .asm_3eeea + jr z, .player ld hl, wBattleMonType1 ld de, wEnemyBattleStatus1 ld a, [wEnemyMoveNum] -.asm_3eeea +.player cp SELFDESTRUCT - jr z, .asm_3eef1 + jr z, .isExplodingMove cp EXPLOSION ret nz -.asm_3eef1 +.isExplodingMove ld a, [de] bit Invulnerable, a ; fly/dig ret nz @@ -7333,7 +7336,7 @@ PoisonEffect: jr nz, .ok ld b, ANIM_A9 ld hl, wEnemyBattleStatus3 - ld de, wEnemyToxcCounter + ld de, wEnemyToxicCounter .ok cp TOXIC jr nz, .normalPoison ; done if move is not Toxic @@ -7341,18 +7344,18 @@ PoisonEffect: xor a ld [de], a ld hl, BadlyPoisonedText - jr .asm_3f2c0 + jr .continue .normalPoison ld hl, PoisonedText -.asm_3f2c0 +.continue pop de ld a, [de] cp POISON_EFFECT - jr z, .asm_3f2cd + jr z, .regularPoisonEffect ld a, b call PlayBattleAnimation2 jp PrintText -.asm_3f2cd +.regularPoisonEffect call PlayCurrentMoveAnimation2 jp PrintText .noEffect @@ -7717,9 +7720,9 @@ MonsStatsRoseText: ld a, [H_WHOSETURN] and a ld a, [wPlayerMoveEffect] - jr z, .asm_3f53b + jr z, .playerTurn ld a, [wEnemyMoveEffect] -.asm_3f53b +.playerTurn cp ATTACK_DOWN1_EFFECT ret nc ld hl, RoseText @@ -7728,7 +7731,7 @@ MonsStatsRoseText: GreatlyRoseText: db $0a TX_FAR _GreatlyRoseText - +; fallthrough RoseText: TX_FAR _RoseText db "@" @@ -7817,9 +7820,9 @@ StatModifierDownEffect: ld a, c add e ld e, a - jr nc, .asm_3f5e4 + jr nc, .noCarry inc d ; de = unmodified stat -.asm_3f5e4 +.noCarry pop bc ld a, [hld] sub $1 ; can't lower stat below 1 (-6) @@ -7919,12 +7922,13 @@ MonsStatsFellText: ld a, [H_WHOSETURN] and a ld a, [wPlayerMoveEffect] - jr z, .asm_3f674 + jr z, .playerTurn ld a, [wEnemyMoveEffect] -.asm_3f674 - cp $1a +.playerTurn +; check if the move's effect decreases a stat by 2 + cp BIDE_EFFECT ret c - cp $44 + cp ATTACK_DOWN_SIDE_EFFECT ret nc ld hl, GreatlyFellText ret @@ -7932,7 +7936,7 @@ MonsStatsFellText: GreatlyFellText: db $0a TX_FAR _GreatlyFellText - +; fallthrough FellText: TX_FAR _FellText db "@" @@ -7940,15 +7944,15 @@ FellText: PrintStatText: ld hl, StatsTextStrings ld c, "@" -.asm_3f68d +.findStatName_outer dec b - jr z, .asm_3f696 -.asm_3f690 + jr z, .foundStatName +.findStatName_inner ld a, [hli] cp c - jr z, .asm_3f68d - jr .asm_3f690 -.asm_3f696 + jr z, .findStatName_outer + jr .findStatName_inner +.foundStatName ld de, wcf4b ld bc, $a jp CopyData @@ -8026,41 +8030,42 @@ ThrashPetalDanceEffect: SwitchAndTeleportEffect: ld a, [H_WHOSETURN] and a - jr nz, .asm_3f791 + jr nz, .handleEnemy ld a, [wIsInBattle] dec a - jr nz, .asm_3f77e + jr nz, .notWildBattle1 ld a, [wCurEnemyLVL] ld b, a ld a, [wBattleMonLevel] - cp b - jr nc, .asm_3f76e + cp b ; is the player's level greater than the enemy's level? + jr nc, .playerMoveWasSuccessful ; if so, teleport will always succeed add b ld c, a - inc c -.asm_3f751 + inc c ; c = sum of player level and enemy level +.rejectionSampleLoop1 call BattleRandom - cp c - jr nc, .asm_3f751 + cp c ; get a random number between 0 and c + jr nc, .rejectionSampleLoop1 srl b - srl b - cp b - jr nc, .asm_3f76e + srl b ; b = enemy level * 4 +; bug: does not account for overflow, so levels above 63 can lead to erroneousness results + cp b ; is rand[0, playerLevel + enemyLevel] > enemyLevel? + jr nc, .playerMoveWasSuccessful ; if so, allow teleporting ld c, 50 call DelayFrames ld a, [wPlayerMoveNum] cp TELEPORT jp nz, PrintDidntAffectText jp PrintButItFailedText_ -.asm_3f76e +.playerMoveWasSuccessful call ReadPlayerMonCurHPAndStatus xor a ld [wAnimationType], a inc a ld [wEscapedFromBattle], a ld a, [wPlayerMoveNum] - jr .asm_3f7e4 -.asm_3f77e + jr .playAnimAndPrintText +.notWildBattle1 ld c, 50 call DelayFrames ld hl, IsUnaffectedText @@ -8068,41 +8073,41 @@ SwitchAndTeleportEffect: cp TELEPORT jp nz, PrintText jp PrintButItFailedText_ -.asm_3f791 +.handleEnemy ld a, [wIsInBattle] dec a - jr nz, .asm_3f7d1 + jr nz, .notWildBattle2 ld a, [wBattleMonLevel] ld b, a ld a, [wCurEnemyLVL] cp b - jr nc, .asm_3f7c1 + jr nc, .enemyMoveWasSuccessful add b ld c, a inc c -.asm_3f7a4 +.rejectionSampleLoop2 call BattleRandom cp c - jr nc, .asm_3f7a4 + jr nc, .rejectionSampleLoop2 srl b srl b cp b - jr nc, .asm_3f7c1 + jr nc, .enemyMoveWasSuccessful ld c, 50 call DelayFrames ld a, [wEnemyMoveNum] cp TELEPORT jp nz, PrintDidntAffectText jp PrintButItFailedText_ -.asm_3f7c1 +.enemyMoveWasSuccessful call ReadPlayerMonCurHPAndStatus xor a ld [wAnimationType], a inc a ld [wEscapedFromBattle], a ld a, [wEnemyMoveNum] - jr .asm_3f7e4 -.asm_3f7d1 + jr .playAnimAndPrintText +.notWildBattle2 ld c, 50 call DelayFrames ld hl, IsUnaffectedText @@ -8110,7 +8115,7 @@ SwitchAndTeleportEffect: cp TELEPORT jp nz, PrintText jp ConditionalPrintButItFailed -.asm_3f7e4 +.playAnimAndPrintText push af call PlayBattleAnimation ld c, 20 @@ -8118,12 +8123,12 @@ SwitchAndTeleportEffect: pop af ld hl, RanFromBattleText cp TELEPORT - jr z, .asm_3f7ff + jr z, .printText ld hl, RanAwayScaredText cp ROAR - jr z, .asm_3f7ff + jr z, .printText ld hl, WasBlownAwayText -.asm_3f7ff +.printText jp PrintText RanFromBattleText: @@ -8168,10 +8173,11 @@ TwoToFiveAttacksEffect: call BattleRandom and $3 cp $2 - jr c, .asm_3f851 + jr c, .gotNumHits +; if the number of hits was greater than 2, re-roll again for a lower chance call BattleRandom and $3 -.asm_3f851 +.gotNumHits inc a inc a .saveNumberOfHits @@ -8250,22 +8256,22 @@ ChargeMoveEffectText: ld a, [wChargeMoveNum] cp RAZOR_WIND ld hl, MadeWhirlwindText - jr z, .asm_3f8f8 + jr z, .gotText cp SOLARBEAM ld hl, TookInSunlightText - jr z, .asm_3f8f8 + jr z, .gotText cp SKULL_BASH ld hl, LoweredItsHeadText - jr z, .asm_3f8f8 + jr z, .gotText cp SKY_ATTACK ld hl, SkyAttackGlowingText - jr z, .asm_3f8f8 + jr z, .gotText cp FLY ld hl, FlewUpHighText - jr z, .asm_3f8f8 + jr z, .gotText cp DIG ld hl, DugAHoleText -.asm_3f8f8 +.gotText ret MadeWhirlwindText: @@ -8328,7 +8334,7 @@ RecoilEffect: ConfusionSideEffect: call BattleRandom - cp $19 + cp $19 ; ~10% chance ret nc jr ConfusionSideEffectSuccess @@ -8398,9 +8404,9 @@ ClearHyperBeam: ld hl, wEnemyBattleStatus2 ld a, [H_WHOSETURN] and a - jr z, .asm_3f9db + jr z, .playerTurn ld hl, wPlayerBattleStatus2 -.asm_3f9db +.playerTurn res NeedsToRecharge, [hl] ; mon no longer needs to recharge pop hl ret @@ -8421,21 +8427,21 @@ MimicEffect: call MoveHitTest ld a, [wMoveMissed] and a - jr nz, .asm_3fa74 + jr nz, .mimicMissed ld a, [H_WHOSETURN] and a ld hl, wBattleMonMoves ld a, [wPlayerBattleStatus1] - jr nz, .asm_3fa13 + jr nz, .enemyTurn ld a, [wLinkState] cp LINK_STATE_BATTLING - jr nz, .asm_3fa3a + jr nz, .letPlayerChooseMove ld hl, wEnemyMonMoves ld a, [wEnemyBattleStatus1] -.asm_3fa13 +.enemyTurn bit Invulnerable, a - jr nz, .asm_3fa74 -.asm_3fa17 + jr nz, .mimicMissed +.getRandomMove push hl call BattleRandom and $3 @@ -8445,20 +8451,20 @@ MimicEffect: ld a, [hl] pop hl and a - jr z, .asm_3fa17 + jr z, .getRandomMove ld d, a ld a, [H_WHOSETURN] and a ld hl, wBattleMonMoves ld a, [wPlayerMoveListIndex] - jr z, .asm_3fa5f + jr z, .playerTurn ld hl, wEnemyMonMoves ld a, [wEnemyMoveListIndex] - jr .asm_3fa5f -.asm_3fa3a + jr .playerTurn +.letPlayerChooseMove ld a, [wEnemyBattleStatus1] bit Invulnerable, a - jr nz, .asm_3fa74 + jr nz, .mimicMissed ld a, [wCurrentMenuItem] push af ld a, $1 @@ -8473,7 +8479,7 @@ MimicEffect: ld d, [hl] pop af ld hl, wBattleMonMoves -.asm_3fa5f +.playerTurn ld c, a ld b, $0 add hl, bc @@ -8484,7 +8490,7 @@ MimicEffect: call PlayCurrentMoveAnimation ld hl, MimicLearnedMoveText jp PrintText -.asm_3fa74 +.mimicMissed jp PrintButItFailedText_ MimicLearnedMoveText: diff --git a/engine/battle/decrement_pp.asm b/engine/battle/decrement_pp.asm index 984af087..e23a85ba 100644 --- a/engine/battle/decrement_pp.asm +++ b/engine/battle/decrement_pp.asm @@ -33,7 +33,7 @@ DecrementPP: ld a, [wPlayerMonNumber] ; which mon in party is active ld bc, wPartyMon2 - wPartyMon1 call AddNTimes ; calculate address of the mon to modify -.DecrementPP +.DecrementPP: ld a, [wPlayerMoveListIndex] ; which move (0, 1, 2, 3) did we use? ld c, a ld b, 0 diff --git a/engine/battle/experience.asm b/engine/battle/experience.asm index c1914806..f73f1d5a 100644 --- a/engine/battle/experience.asm +++ b/engine/battle/experience.asm @@ -49,11 +49,11 @@ GainExperience: ld [de], a .nextBaseStat dec c - jr z, .asm_552a1 + jr z, .statExpDone inc de inc de jr .gainStatExpLoop -.asm_552a1 +.statExpDone xor a ld [H_MULTIPLICAND], a ld [H_MULTIPLICAND + 1], a diff --git a/engine/battle/get_trainer_name.asm b/engine/battle/get_trainer_name.asm index deed8e95..36ca019e 100644 --- a/engine/battle/get_trainer_name.asm +++ b/engine/battle/get_trainer_name.asm @@ -2,15 +2,15 @@ GetTrainerName_: ld hl, wGrassRate ld a, [wLinkState] and a - jr nz, .rival + jr nz, .foundName ld hl, wRivalName ld a, [wTrainerClass] cp SONY1 - jr z, .rival + jr z, .foundName cp SONY2 - jr z, .rival + jr z, .foundName cp SONY3 - jr z, .rival + jr z, .foundName ld [wd0b5], a ld a, TRAINER_NAME ld [wNameListType], a @@ -18,7 +18,7 @@ GetTrainerName_: ld [wPredefBank], a call GetName ld hl, wcd6d -.rival +.foundName ld de, wTrainerName ld bc, $d jp CopyData diff --git a/engine/battle/link_battle_versus_text.asm b/engine/battle/link_battle_versus_text.asm index 57e7f1bb..76559117 100644 --- a/engine/battle/link_battle_versus_text.asm +++ b/engine/battle/link_battle_versus_text.asm @@ -2,8 +2,8 @@ DisplayLinkBattleVersusTextBox: call LoadTextBoxTilePatterns coord hl, 3, 4 - ld b, $7 - ld c, $c + ld b, 7 + ld c, 12 call TextBoxBorder coord hl, 4, 5 ld de, wPlayerName diff --git a/engine/battle/trainer_ai.asm b/engine/battle/trainer_ai.asm index 7999a7a0..b175fcaf 100644 --- a/engine/battle/trainer_ai.asm +++ b/engine/battle/trainer_ai.asm @@ -182,7 +182,7 @@ AIMoveChoiceModification2: jr c, .preferMove jr .nextMove .preferMove - dec [hl] ; sligthly encourage this move + dec [hl] ; slightly encourage this move jr .nextMove ; encourages moves that are effective against the player's mon (even if non-damaging). diff --git a/engine/cable_club.asm b/engine/cable_club.asm index bd9ed683..9d72d220 100755 --- a/engine/cable_club.asm +++ b/engine/cable_club.asm @@ -27,10 +27,10 @@ CableClub_DoBattleOrTradeAgain: ld hl, wSerialPlayerDataBlock ld a, SERIAL_PREAMBLE_BYTE ld b, 6 -.writePlayeDataBlockPreambleLoop +.writePlayerDataBlockPreambleLoop ld [hli], a dec b - jr nz, .writePlayeDataBlockPreambleLoop + jr nz, .writePlayerDataBlockPreambleLoop ld hl, wSerialRandomNumberListBlock ld a, SERIAL_PREAMBLE_BYTE ld b, 7 @@ -271,7 +271,7 @@ CableClub_DoBattleOrTradeAgain: cp LINK_STATE_START_BATTLE ld a, LINK_STATE_TRADING ld [wLinkState], a - jr nz, .asm_5506 + jr nz, .trading ld a, LINK_STATE_BATTLING ld [wLinkState], a ld a, OPP_SONY1 @@ -283,7 +283,7 @@ CableClub_DoBattleOrTradeAgain: predef InitOpponent predef HealParty jp ReturnToCableClubRoom -.asm_5506 +.trading ld c, BANK(Music_GameCorner) ld a, MUSIC_GAME_CORNER call PlayMusic @@ -964,8 +964,8 @@ CableClub_TextBoxBorder: ; c = width CableClub_DrawHorizontalLine: ld d, c -.asm_5ae1 +.loop ld [hli], a dec d - jr nz, .asm_5ae1 + jr nz, .loop ret diff --git a/engine/hall_of_fame.asm b/engine/hall_of_fame.asm index 0e35f709..dc1026a8 100755 --- a/engine/hall_of_fame.asm +++ b/engine/hall_of_fame.asm @@ -210,12 +210,12 @@ HoFDisplayPlayerStats: SetEvent EVENT_HALL_OF_FAME_DEX_RATING predef DisplayDexRating coord hl, 0, 4 - ld b, $6 - ld c, $a + ld b, 6 + ld c, 10 call TextBoxBorder coord hl, 5, 0 - ld b, $2 - ld c, $9 + ld b, 2 + ld c, 9 call TextBoxBorder coord hl, 7, 2 ld de, wPlayerName diff --git a/engine/hidden_object_functions14.asm b/engine/hidden_object_functions14.asm index 7591fac0..fcc79f6d 100755 --- a/engine/hidden_object_functions14.asm +++ b/engine/hidden_object_functions14.asm @@ -66,18 +66,18 @@ ViridianSchoolNotebookText4: PrintFightingDojoText2: call EnableAutoTextBoxDrawing - tx_pre_jump FightingDojoText_52a10 + tx_pre_jump EnemiesOnEverySideText -FightingDojoText_52a10: - TX_FAR _FightingDojoText_52a10 +EnemiesOnEverySideText: + TX_FAR _EnemiesOnEverySideText db "@" PrintFightingDojoText3: call EnableAutoTextBoxDrawing - tx_pre_jump FightingDojoText_52a1d + tx_pre_jump WhatGoesAroundComesAroundText -FightingDojoText_52a1d: - TX_FAR _FightingDojoText_52a1d +WhatGoesAroundComesAroundText: + TX_FAR _WhatGoesAroundComesAroundText db "@" PrintFightingDojoText: diff --git a/engine/hidden_object_functions3.asm b/engine/hidden_object_functions3.asm index efdbd081..84ce6d53 100755 --- a/engine/hidden_object_functions3.asm +++ b/engine/hidden_object_functions3.asm @@ -81,9 +81,9 @@ IndigoPlateauStatues: ld a, [wXCoord] bit 0, a ld hl, IndigoPlateauStatuesText2 - jr nz, .asm_fbd3 + jr nz, .ok ld hl, IndigoPlateauStatuesText3 -.asm_fbd3 +.ok call PrintText jp TextScriptEnd @@ -104,12 +104,12 @@ BookOrSculptureText: ld hl, PokemonBooksText ld a, [wCurMapTileset] cp MANSION ; Celadon Mansion tileset - jr nz, .asm_fbfd + jr nz, .ok aCoord 8, 6 cp $38 - jr nz, .asm_fbfd + jr nz, .ok ld hl, DiglettSculptureText -.asm_fbfd +.ok call PrintText jp TextScriptEnd diff --git a/engine/hidden_object_functions7.asm b/engine/hidden_object_functions7.asm index 9b1532bc..556fe791 100755 --- a/engine/hidden_object_functions7.asm +++ b/engine/hidden_object_functions7.asm @@ -70,10 +70,10 @@ SafariZoneGameOver: ld c, BANK(SFX_Safari_Zone_PA) ld a, SFX_SAFARI_ZONE_PA call PlayMusic -.asm_1e9c2 +.waitForMusicToPlay ld a, [wChannelSoundIDs + CH4] - cp $b9 - jr nz, .asm_1e9c2 + cp SFX_SAFARI_ZONE_PA + jr nz, .waitForMusicToPlay ld a, TEXT_SAFARI_GAME_OVER ld [hSpriteIndexOrTextID], a call DisplayTextID @@ -100,10 +100,10 @@ SafariGameOverText: TX_ASM ld a, [wNumSafariBalls] and a - jr z, .asm_1ea04 + jr z, .noMoreSafariBalls ld hl, TimesUpText call PrintText -.asm_1ea04 +.noMoreSafariBalls ld hl, GameOverText call PrintText jp TextScriptEnd @@ -326,14 +326,14 @@ BillsHousePC: cp SPRITE_FACING_UP ret nz CheckEvent EVENT_LEFT_BILLS_HOUSE_AFTER_HELPING - jr nz, .asm_1ebd2 + jr nz, .displayBillsHousePokemonList CheckEventReuseA EVENT_USED_CELL_SEPARATOR_ON_BILL - jr nz, .asm_1eb86 + jr nz, .displayBillsHouseMonitorText CheckEventReuseA EVENT_BILL_SAID_USE_CELL_SEPARATOR - jr nz, .asm_1eb8b -.asm_1eb86 + jr nz, .doCellSeparator +.displayBillsHouseMonitorText tx_pre_jump BillsHouseMonitorText -.asm_1eb8b +.doCellSeparator ld a, $1 ld [wDoNotWaitForButtonPressAfterDisplayingText], a tx_pre BillsHouseInitiatedText @@ -360,7 +360,7 @@ BillsHousePC: call PlayDefaultMusic SetEvent EVENT_USED_CELL_SEPARATOR_ON_BILL ret -.asm_1ebd2 +.displayBillsHousePokemonList ld a, $1 ld [wDoNotWaitForButtonPressAfterDisplayingText], a tx_pre BillsHousePokemonList diff --git a/engine/hp_bar.asm b/engine/hp_bar.asm index 3fa01208..221bd7a9 100755 --- a/engine/hp_bar.asm +++ b/engine/hp_bar.asm @@ -87,6 +87,7 @@ UpdateHPBar2: call UpdateHPBar_CompareNewHPToOldHP jr z, .animateHPBarDone jr nc, .HPIncrease +; HP decrease dec bc ; subtract 1 HP ld a, c ld [wHPBarNewHP], a @@ -95,7 +96,7 @@ UpdateHPBar2: call UpdateHPBar_CalcOldNewHPBarPixels ld a, e sub d ; calc pixel difference - jr .asm_fa7e + jr .ok .HPIncrease inc bc ; add 1 HP ld a, c @@ -105,7 +106,7 @@ UpdateHPBar2: call UpdateHPBar_CalcOldNewHPBarPixels ld a, d sub e ; calc pixel difference -.asm_fa7e +.ok call UpdateHPBar_PrintHPNumber and a jr z, .noPixelDifference diff --git a/engine/in_game_trades.asm b/engine/in_game_trades.asm index bacf531b..f1d12ce1 100755 --- a/engine/in_game_trades.asm +++ b/engine/in_game_trades.asm @@ -21,7 +21,7 @@ DoInGameTradeDialogue: call CopyData pop af ld l,a - ld h,$0 + ld h,0 ld de,InGameTradeTextPointers add hl,hl add hl,de diff --git a/engine/intro.asm b/engine/intro.asm index 320267c7..ed532681 100755 --- a/engine/intro.asm +++ b/engine/intro.asm @@ -305,7 +305,7 @@ PlayShootingStar: ld b, SET_PAL_GAME_FREAK_INTRO call RunPaletteCommand callba LoadCopyrightAndTextBoxTiles - ld a, $e4 + ld a, %11100100 ld [rBGP], a ld c, 180 call DelayFrames diff --git a/engine/menu/bills_pc.asm b/engine/menu/bills_pc.asm index f6865b6c..85a546e1 100644 --- a/engine/menu/bills_pc.asm +++ b/engine/menu/bills_pc.asm @@ -248,7 +248,7 @@ BillsPCDeposit: add "1" .next ld [hli], a - ld [hl], $50 + ld [hl], "@" ld hl, MonWasStoredText call PrintText jp BillsPCMenu diff --git a/engine/menu/naming_screen.asm b/engine/menu/naming_screen.asm index 217d6e54..758a2d8d 100755 --- a/engine/menu/naming_screen.asm +++ b/engine/menu/naming_screen.asm @@ -7,7 +7,7 @@ AskName: coord hl, 0, 0 ld b, 4 ld c, 11 - call z, ClearScreenArea ; only if in wild batle + call z, ClearScreenArea ; only if in wild battle ld a, [wcf91] ld [wd11e], a call GetMonName @@ -40,7 +40,7 @@ AskName: pop af ld [wUpdateSpritesEnabled], a ld a, [wcf4b] - cp $50 + cp "@" ret nz .declinedNickname ld d, h @@ -108,7 +108,7 @@ DisplayNamingScreen: ld [wMenuWatchedKeys], a ld a, 7 ld [wMaxMenuItem], a - ld a, $50 + ld a, "@" ld [wcf4b], a xor a ld hl, wNamingScreenSubmitName @@ -153,7 +153,7 @@ DisplayNamingScreen: ld h, [hl] ld l, a push de - jp [hl] + jp hl .submitNickname pop de @@ -259,7 +259,7 @@ DisplayNamingScreen: .addLetter ld a, [wNamingScreenLetter] ld [hli], a - ld [hl], $50 + ld [hl], "@" ld a, SFX_PRESS_AB call PlaySound ret diff --git a/engine/menu/oaks_pc.asm b/engine/menu/oaks_pc.asm index 55852b63..e4172ec7 100755 --- a/engine/menu/oaks_pc.asm +++ b/engine/menu/oaks_pc.asm @@ -7,9 +7,9 @@ OpenOaksPC: call YesNoChoice ld a, [wCurrentMenuItem] and a - jr nz, .asm_1e932 + jr nz, .closePC predef DisplayDexRating -.asm_1e932 +.closePC ld hl, ClosedOaksPCText call PrintText jp LoadScreenTilesFromBuffer2 diff --git a/engine/menu/pc.asm b/engine/menu/pc.asm index 8ec31226..c9e2cf08 100755 --- a/engine/menu/pc.asm +++ b/engine/menu/pc.asm @@ -121,18 +121,18 @@ RemoveItemByID: ld b, a xor a ld [hItemToRemoveIndex], a -.asm_17f40 +.loop ld a, [hli] - cp $ff + cp -1 ; reached terminator? ret z cp b - jr z, .asm_17f4f + jr z, .foundItem inc hl ld a, [hItemToRemoveIndex] inc a ld [hItemToRemoveIndex], a - jr .asm_17f40 -.asm_17f4f + jr .loop +.foundItem ld a, $1 ld [wItemQuantity], a ld a, [hItemToRemoveIndex] diff --git a/engine/menu/pokedex.asm b/engine/menu/pokedex.asm index 3078f1a9..45acec58 100755 --- a/engine/menu/pokedex.asm +++ b/engine/menu/pokedex.asm @@ -125,6 +125,7 @@ HandlePokedexSideMenu: call DrawTileLine ; cover up the menu cursor in the pokemon list pop bc ret + .buttonBPressed push bc coord hl, 15, 10 @@ -133,16 +134,19 @@ HandlePokedexSideMenu: call DrawTileLine ; cover up the menu cursor in the side menu pop bc jr .exitSideMenu + .choseData call ShowPokedexDataInternal ld b,0 jr .exitSideMenu + ; play pokemon cry .choseCry ld a,[wd11e] call GetCryData call PlaySound jr .handleMenuInput + .choseArea predef LoadTownMap_Nest ; display pokemon areas ld b,0 @@ -206,6 +210,7 @@ HandlePokedexListMenu: dec c jr nz,.maxSeenPokemonInnerLoop jr .maxSeenPokemonLoop + .storeMaxSeenPokemon ld a,b ld [wDexMaxSeenMon],a @@ -409,20 +414,25 @@ ShowPokedexDataInternal: push af xor a ld [hTilesetType],a + coord hl, 0, 0 ld de,1 lb bc, $64, SCREEN_WIDTH call DrawTileLine ; draw top border + coord hl, 0, 17 ld b, $6f call DrawTileLine ; draw bottom border + coord hl, 0, 1 ld de,20 lb bc, $66, $10 call DrawTileLine ; draw left border + coord hl, 19, 1 ld b,$67 call DrawTileLine ; draw right border + ld a,$63 ; upper left corner tile Coorda 0, 0 ld a,$65 ; upper right corner tile @@ -431,15 +441,19 @@ ShowPokedexDataInternal: Coorda 0, 17 ld a,$6e ; lower right corner tile Coorda 19, 17 + coord hl, 0, 9 ld de,PokedexDataDividerLine call PlaceString ; draw horizontal divider line + coord hl, 9, 6 ld de,HeightWeightText call PlaceString + call GetMonName coord hl, 9, 2 call PlaceString + ld hl,PokedexEntryPointers ld a,[wd11e] dec a @@ -450,14 +464,17 @@ ShowPokedexDataInternal: ld a,[hli] ld e,a ld d,[hl] ; de = address of pokedex entry + coord hl, 9, 4 call PlaceString ; print species name + ld h,b ld l,c push de ld a,[wd11e] push af call IndexToPokedex + coord hl, 2, 8 ld a, "№" ld [hli],a @@ -466,6 +483,7 @@ ShowPokedexDataInternal: ld de,wd11e lb bc, LEADING_ZEROES | 1, 3 call PrintNumber ; print pokedex number + ld hl,wPokedexOwned call IsPokemonBitSet pop af @@ -473,10 +491,12 @@ ShowPokedexDataInternal: ld a,[wcf91] ld [wd0b5],a pop de + push af push bc push de push hl + call Delay3 call GBPalNormal call GetMonHeader ; load pokemon picture location @@ -484,10 +504,12 @@ ShowPokedexDataInternal: call LoadFlippedFrontSpriteByMonIndex ; draw pokemon picture ld a,[wcf91] call PlayCry ; play pokemon cry + pop hl pop de pop bc pop af + ld a,c and a jp z,.waitForButtonPress ; if the pokemon has not been owned, don't print the height, weight, or description diff --git a/engine/menu/prize_menu.asm b/engine/menu/prize_menu.asm index b48fa99c..a1ef81e8 100755 --- a/engine/menu/prize_menu.asm +++ b/engine/menu/prize_menu.asm @@ -23,8 +23,8 @@ CeladonPrizeMenu: ld [wTopMenuItemX],a call PrintPrizePrice coord hl, 0, 2 - ld b,$08 - ld c,$10 + ld b, 8 + ld c, 16 call TextBoxBorder call GetPrizeMenuId call UpdateSprites @@ -32,12 +32,12 @@ CeladonPrizeMenu: call PrintText call HandleMenuInput ; menu choice handler bit 1,a ; keypress = B (Cancel) - jr nz,.NoChoice + jr nz, .noChoice ld a,[wCurrentMenuItem] - cp a,$03 ; "NO,THANKS" choice - jr z,.NoChoice + cp 3 ; "NO,THANKS" choice + jr z, .noChoice call HandlePrizeChoice -.NoChoice +.noChoice ld hl,wd730 res 6,[hl] ret @@ -65,7 +65,7 @@ GetPrizeMenuId: ; (distinguishing between Pokemon names ; and Items (specifically TMs) names) ld a,[hSpriteIndexOrTextID] - sub a,3 ; prize-texts' id are 3, 4 and 5 + sub 3 ; prize-texts' id are 3, 4 and 5 ld [wWhichPrizeWindow],a ; prize-texts' id (relative, i.e. 0, 1 or 2) add a add a @@ -88,7 +88,7 @@ GetPrizeMenuId: ld bc,6 call CopyData ld a,[wWhichPrizeWindow] - cp a,$02 ;is TM_menu? + cp 2 ;is TM_menu? jr nz,.putMonName ld a,[wPrize1] ld [wd11e],a @@ -138,7 +138,7 @@ GetPrizeMenuId: call PrintBCDNumber ld de,wPrize2Price coord hl, 13, 7 - ld c,(%1 << 7 | 2) + ld c,(1 << 7 | 2) call PrintBCDNumber ld de,wPrize3Price coord hl, 13, 9 @@ -149,15 +149,15 @@ INCLUDE "data/prizes.asm" PrintPrizePrice: coord hl, 11, 0 - ld b,$01 - ld c,$07 + ld b, 1 + ld c, 7 call TextBoxBorder call UpdateSprites coord hl, 12, 0 - ld de,.CoinText + ld de, .CoinString call PlaceString coord hl, 13, 1 - ld de,.SixSpacesText + ld de, .SixSpacesString call PlaceString coord hl, 13, 1 ld de,wPlayerCoins @@ -165,10 +165,10 @@ PrintPrizePrice: call PrintBCDNumber ret -.CoinText +.CoinString: db "COIN@" -.SixSpacesText +.SixSpacesString: db " @" LoadCoinsToSubtract: @@ -196,33 +196,33 @@ HandlePrizeChoice: ld a,[hl] ld [wd11e],a ld a,[wWhichPrizeWindow] - cp a,$02 ; is prize a TM? - jr nz,.GetMonName + cp 2 ; is prize a TM? + jr nz, .getMonName call GetItemName - jr .GivePrize -.GetMonName + jr .givePrize +.getMonName call GetMonName -.GivePrize +.givePrize ld hl,SoYouWantPrizeTextPtr call PrintText call YesNoChoice ld a,[wCurrentMenuItem] ; yes/no answer (Y=0, N=1) and a - jr nz,.PrintOhFineThen + jr nz, .printOhFineThen call LoadCoinsToSubtract call HasEnoughCoins - jr c,.NotEnoughCoins + jr c, .notEnoughCoins ld a,[wWhichPrizeWindow] - cp a,$02 - jr nz,.GiveMon + cp $02 + jr nz, .giveMon ld a,[wd11e] ld b,a ld a,1 ld c,a call GiveItem - jr nc,.BagFull - jr .SubtractCoins -.GiveMon + jr nc, .bagFull + jr .subtractCoins +.giveMon ld a,[wd11e] ld [wcf91],a push af @@ -243,24 +243,24 @@ HandlePrizeChoice: ; were full), return without subtracting coins. ret nc -.SubtractCoins +.subtractCoins call LoadCoinsToSubtract ld hl,hCoins + 1 ld de,wPlayerCoins + 1 ld c,$02 ; how many bytes predef SubBCDPredef jp PrintPrizePrice -.BagFull +.bagFull ld hl,PrizeRoomBagIsFullTextPtr jp PrintText -.NotEnoughCoins +.notEnoughCoins ld hl,SorryNeedMoreCoinsText jp PrintText -.PrintOhFineThen +.printOhFineThen ld hl,OhFineThenTextPtr jp PrintText -UnknownData52951: +UnknownPrizeData: ; XXX what's this? db $00,$01,$00,$01,$00,$01,$00,$00,$01 diff --git a/engine/menu/start_sub_menus.asm b/engine/menu/start_sub_menus.asm index 9ae6cbe5..bc4afdc6 100755 --- a/engine/menu/start_sub_menus.asm +++ b/engine/menu/start_sub_menus.asm @@ -34,7 +34,7 @@ StartMenu_Pokemon: ld [wTextBoxID],a call DisplayTextBoxID ; display pokemon menu options ld hl,wFieldMoves - lb bc, $02, $0c ; max menu item ID, top menu item Y + lb bc, 2, 12 ; max menu item ID, top menu item Y ld e,5 .adjustMenuVariablesLoop dec e @@ -222,7 +222,7 @@ StartMenu_Pokemon: res 4,[hl] ld c,60 call DelayFrames - call GBPalWhiteOutWithDelay3 ; zero all three palettes and wait 3 V-blanks + call GBPalWhiteOutWithDelay3 jp .goBackToMap .warpToLastPokemonCenterText TX_FAR _WarpToLastPokemonCenterText diff --git a/engine/menu/status_screen.asm b/engine/menu/status_screen.asm index a7076d35..3b01d5ab 100755 --- a/engine/menu/status_screen.asm +++ b/engine/menu/status_screen.asm @@ -249,16 +249,16 @@ PrintStatsBox: and a ; a is 0 from the status screen jr nz, .DifferentBox coord hl, 0, 8 - ld b, $8 - ld c, $8 + ld b, 8 + ld c, 8 call TextBoxBorder ; Draws the box coord hl, 1, 9 ; Start printing stats from here ld bc, $0019 ; Number offset jr .PrintStats .DifferentBox coord hl, 9, 2 - ld b, $8 - ld c, $9 + ld b, 8 + ld c, 9 call TextBoxBorder coord hl, 11, 3 ld bc, $0018 @@ -279,7 +279,7 @@ PrintStatsBox: call PrintStat ld de, wLoadedMonSpecial jp PrintNumber -PrintStat +PrintStat: push hl call PrintNumber pop hl diff --git a/engine/menu/vending_machine.asm b/engine/menu/vending_machine.asm index b32568f9..a80d1643 100755 --- a/engine/menu/vending_machine.asm +++ b/engine/menu/vending_machine.asm @@ -130,6 +130,9 @@ LoadVendingMachineItem: ret VendingPrices: - db FRESH_WATER,$00,$02,$00 - db SODA_POP, $00,$03,$00 - db LEMONADE, $00,$03,$50 + db FRESH_WATER + money 200 + db SODA_POP + money 300 + db LEMONADE + money 350 diff --git a/engine/mon_party_sprites.asm b/engine/mon_party_sprites.asm index aa9bdaeb..864ac136 100755 --- a/engine/mon_party_sprites.asm +++ b/engine/mon_party_sprites.asm @@ -132,7 +132,7 @@ LoadMonPartySpriteGfxWithLCDDisabled: ld hl, MonPartySpritePointers ld a, $1c ld bc, $0 -.asm_7179c +.loop push af push bc push hl @@ -159,7 +159,7 @@ LoadMonPartySpriteGfxWithLCDDisabled: ld c, a pop af dec a - jr nz, .asm_7179c + jr nz, .loop jp EnableLCD MonPartySpritePointers: diff --git a/engine/oak_speech.asm b/engine/oak_speech.asm index 31c00fd0..f786e3c1 100755 --- a/engine/oak_speech.asm +++ b/engine/oak_speech.asm @@ -6,7 +6,7 @@ SetDefaultNames: ld a, [wd732] push af ld hl, wPlayerName - ld bc, $d8a + ld bc, wBoxDataEnd - wPlayerName xor a call FillMemory ld hl, wSpriteStateData1 @@ -195,7 +195,7 @@ MovePicLeft: ld [rWX],a call DelayFrame - ld a,$E4 + ld a,%11100100 ld [rBGP],a .next call DelayFrame diff --git a/engine/overworld/card_key.asm b/engine/overworld/card_key.asm index 61e512de..afc55902 100755 --- a/engine/overworld/card_key.asm +++ b/engine/overworld/card_key.asm @@ -73,7 +73,7 @@ SilphCoMapList: CardKeySuccessText: TX_FAR _CardKeySuccessText1 - db $0b + TX_SFX_ITEM TX_FAR _CardKeySuccessText2 db "@" diff --git a/engine/overworld/cut.asm b/engine/overworld/cut.asm index 2f13dfba..f6ae6468 100755 --- a/engine/overworld/cut.asm +++ b/engine/overworld/cut.asm @@ -74,7 +74,7 @@ UsedCutText: InitCutAnimOAM: xor a ld [wWhichAnimationOffsets], a - ld a, $e4 + ld a, %11100100 ld [rOBP1], a ld a, [wCutTile] cp $52 diff --git a/engine/overworld/elevator.asm b/engine/overworld/elevator.asm index 4ec34922..929e4f22 100755 --- a/engine/overworld/elevator.asm +++ b/engine/overworld/elevator.asm @@ -34,7 +34,7 @@ ShakeElevator: call PlayMusic .musicLoop ld a, [wChannelSoundIDs + CH4] - cp $b9 + cp SFX_SAFARI_ZONE_PA jr z, .musicLoop call UpdateSprites jp PlayDefaultMusic @@ -56,7 +56,7 @@ ShakeElevatorRedrawRow: add hl, de ld a, h and $3 - or $98 + or vBGMap0 / $100 ld d, a ld a, l pop hl diff --git a/engine/overworld/emotion_bubbles.asm b/engine/overworld/emotion_bubbles.asm index 4df8b6f6..ac4276bd 100755 --- a/engine/overworld/emotion_bubbles.asm +++ b/engine/overworld/emotion_bubbles.asm @@ -17,11 +17,11 @@ EmotionBubble: ld [wUpdateSpritesEnabled], a ld a, [wd736] bit 6, a ; are the last 4 OAM entries reserved for a shadow or fishing rod? - ld hl, wOAMBuffer + $8f - ld de, wOAMBuffer + $9f + ld hl, wOAMBuffer + 4 * 35 + $3 ; $8f + ld de, wOAMBuffer + 4 * 39 + $3 ; $9f jr z, .next - ld hl, wOAMBuffer + $7f - ld de, wOAMBuffer + $8f + ld hl, wOAMBuffer + 4 * 31 + $3 ; $7f + ld de, wOAMBuffer + 4 * 35 + $3 ; $8f ; Copy OAM data 16 bytes forward to make room for emotion bubble OAM data at the ; start of the OAM buffer. diff --git a/engine/overworld/hidden_items.asm b/engine/overworld/hidden_items.asm index 11e6ad55..dae85c28 100755 --- a/engine/overworld/hidden_items.asm +++ b/engine/overworld/hidden_items.asm @@ -27,7 +27,7 @@ FoundHiddenItemText: ld b, a ld c, 1 call GiveItem - jr nc, .BagFull + jr nc, .bagFull ld hl, wObtainedHiddenItemsFlags ld a, [wHiddenItemOrCoinsIndex] ld c, a @@ -37,7 +37,7 @@ FoundHiddenItemText: call PlaySoundWaitForCurrent call WaitForSoundToFinish jp TextScriptEnd -.BagFull +.bagFull call WaitForTextScrollButtonPress ; wait for button press xor a ld [wDoNotWaitForButtonPressAfterDisplayingText], a @@ -77,24 +77,24 @@ HiddenCoins: cp 20 jr z, .bcd20 cp 40 - jr z, .bcd20 + jr z, .bcd20 ; should be bcd40 jr .bcd100 .bcd10 ld a, $10 ld [hCoins + 1], a - jr .bcddone + jr .bcdDone .bcd20 ld a, $20 ld [hCoins + 1], a - jr .bcddone + jr .bcdDone .bcd40 ; due to a typo, this is never used ld a, $40 ld [hCoins + 1], a - jr .bcddone + jr .bcdDone .bcd100 ld a, $1 ld [hCoins], a -.bcddone +.bcdDone ld de, wPlayerCoins + 1 ld hl, hCoins + 1 ld c, $2 @@ -107,13 +107,13 @@ HiddenCoins: call EnableAutoTextBoxDrawing ld a, [wPlayerCoins] cp $99 - jr nz, .RoomInCoinCase + jr nz, .roomInCoinCase ld a, [wPlayerCoins + 1] cp $99 - jr nz, .RoomInCoinCase + jr nz, .roomInCoinCase tx_pre_id DroppedHiddenCoinsText jr .done -.RoomInCoinCase +.roomInCoinCase tx_pre_id FoundHiddenCoinsText .done jp PrintPredefTextID diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index e60f820a..9302b6e3 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -393,7 +393,7 @@ UpdateSpriteMovementDelay: ld l, a ld [hl], $1 ; c1x1 = 1 (mark as ready to move) notYetMoving: - ld h, $c1 + ld h, wSpriteStateData1 / $100 ld a, [H_CURRENTSPRITEOFFSET] add $8 ld l, a @@ -408,7 +408,6 @@ MakeNPCFacePlayer: ld a, [wd72d] bit 5, a jr nz, notYetMoving - res 7, [hl] ld a, [wPlayerDirection] bit PLAYER_DIR_BIT_UP, a @@ -449,7 +448,7 @@ InitializeSpriteStatus: ; calculates the spprite's scrren position form its map position and the player position InitializeSpriteScreenPosition: - ld h, $c2 + ld h, wSpriteStateData2 / $100 ld a, [H_CURRENTSPRITEOFFSET] add $4 ld l, a @@ -477,7 +476,7 @@ CheckSpriteAvailability: ld a, [$ffe5] and a jp nz, .spriteInvisible - ld h, $c2 + ld h, wSpriteStateData2 / $100 ld a, [H_CURRENTSPRITEOFFSET] add $6 ld l, a @@ -525,7 +524,7 @@ CheckSpriteAvailability: cp d jr c, .spriteVisible ; standing on tile with ID >=$60 (top right tile) .spriteInvisible - ld h, $c1 + ld h, wSpriteStateData1 / $100 ld a, [H_CURRENTSPRITEOFFSET] add $2 ld l, a @@ -579,7 +578,7 @@ UpdateSpriteImage: ; e: X movement delta (-1, 0 or 1) ; set carry on failure, clears carry on success CanWalkOntoTile: - ld h, $c2 + ld h, wSpriteStateData2 / $100 ld a, [H_CURRENTSPRITEOFFSET] add $6 ld l, a @@ -607,7 +606,7 @@ CanWalkOntoTile: ld a, [hl] ; $c2x6 (movement byte 1) inc a jr z, .impassable ; if $ff, no movement allowed (however, changing direction is) - ld h, $c1 + ld h, wSpriteStateData1 / $100 ld a, [H_CURRENTSPRITEOFFSET] add $4 ld l, a @@ -626,14 +625,14 @@ CanWalkOntoTile: call DetectCollisionBetweenSprites pop bc pop de - ld h, $c1 + ld h, wSpriteStateData1 / $100 ld a, [H_CURRENTSPRITEOFFSET] add $c ld l, a ld a, [hl] ; c1xc (directions in which sprite collision would occur) and b ; check against chosen direction (1,2,4 or 8) jr nz, .impassable ; collision between sprites, don't go there - ld h, $c2 + ld h, wSpriteStateData2 / $100 ld a, [H_CURRENTSPRITEOFFSET] add $2 ld l, a @@ -690,7 +689,7 @@ CanWalkOntoTile: ; this is always the lower left tile of the 2x2 tile blocks all sprites are snapped to ; hl: output pointer GetTileSpriteStandsOn: - ld h, $c1 + ld h, wSpriteStateData1 / $100 ld a, [H_CURRENTSPRITEOFFSET] add $4 ld l, a diff --git a/engine/overworld/oam.asm b/engine/overworld/oam.asm index 94082beb..2c2a3dff 100644 --- a/engine/overworld/oam.asm +++ b/engine/overworld/oam.asm @@ -6,7 +6,7 @@ PrepareOAMData: dec a jr z, .updateEnabled - cp 0 - 1 + cp -1 ret nz ld [wUpdateSpritesEnabled], a jp HideSprites diff --git a/engine/overworld/player_animations.asm b/engine/overworld/player_animations.asm index f7b63aaa..a17e67bd 100755 --- a/engine/overworld/player_animations.asm +++ b/engine/overworld/player_animations.asm @@ -388,7 +388,7 @@ FishingAnim: set 6, [hl] ; reserve the last 4 OAM entries ld de, RedSprite ld hl, vNPCSprites - lb bc, BANK(RedSprite), $0c + lb bc, BANK(RedSprite), $c call CopyVideoData ld a, $4 ld hl, RedFishingTiles diff --git a/engine/overworld/pokemart.asm b/engine/overworld/pokemart.asm index e50c508e..823939b1 100755 --- a/engine/overworld/pokemart.asm +++ b/engine/overworld/pokemart.asm @@ -85,7 +85,7 @@ DisplayPokemartDialogue_: lb bc, 14, 1 ; location that PrintText always prints to, this is useless call PrintText coord hl, 14, 7 - lb bc, 08, 15 + lb bc, 8, 15 ld a,TWO_OPTION_MENU ld [wTextBoxID],a call DisplayTextBoxID ; yes/no menu diff --git a/engine/overworld/trainers.asm b/engine/overworld/trainers.asm index 1d0340c9..655c6b2a 100755 --- a/engine/overworld/trainers.asm +++ b/engine/overworld/trainers.asm @@ -4,16 +4,16 @@ _GetSpritePosition1: ld a, [wSpriteIndex] ld [H_SPRITEINDEX], a call GetSpriteDataPointer - ld a, [hli] + ld a, [hli] ; c1x4 (screen Y pos) ld [$ffeb], a inc hl - ld a, [hl] + ld a, [hl] ; c1x6 (screen X pos) ld [$ffec], a - ld de, $fe + ld de, (wSpriteStateData2 + $4) - (wSpriteStateData1 + $6) add hl, de - ld a, [hli] + ld a, [hli] ; c2x4 (map Y pos) ld [$ffed], a - ld a, [hl] + ld a, [hl] ; c2x5 (map X pos) ld [$ffee], a ret @@ -28,7 +28,7 @@ _GetSpritePosition2: inc hl ld a, [hl] ; c1x6 (screen X pos) ld [wSavedSpriteScreenX], a - ld de, $104 - $6 + ld de, (wSpriteStateData2 + $4) - (wSpriteStateData1 + $6) add hl, de ld a, [hli] ; c2x4 (map Y pos) ld [wSavedSpriteMapY], a @@ -47,7 +47,7 @@ _SetSpritePosition1: inc hl ld a, [$ffec] ; c1x6 (screen X pos) ld [hl], a - ld de, $104 - $6 + ld de, (wSpriteStateData2 + $4) - (wSpriteStateData1 + $6) add hl, de ld a, [$ffed] ; c2x4 (map Y pos) ld [hli], a @@ -57,21 +57,21 @@ _SetSpritePosition1: _SetSpritePosition2: ld hl, wSpriteStateData1 - ld de, $0004 + ld de, 4 ld a, [wSpriteIndex] ld [H_SPRITEINDEX], a call GetSpriteDataPointer ld a, [wSavedSpriteScreenY] - ld [hli], a + ld [hli], a ; c1x4 (screen Y pos) inc hl ld a, [wSavedSpriteScreenX] - ld [hl], a - ld de, $00fe + ld [hl], a ; c1x6 (screen X pos) + ld de, (wSpriteStateData2 + $4) - (wSpriteStateData1 + $6) add hl, de ld a, [wSavedSpriteMapY] - ld [hli], a + ld [hli], a ; c2x4 (map Y pos) ld a, [wSavedSpriteMapX] - ld [hl], a + ld [hl], a ; c2x5 (map X pos) ret TrainerWalkUpToPlayer: @@ -80,11 +80,11 @@ TrainerWalkUpToPlayer: ld [wTrainerSpriteOffset], a call ReadTrainerScreenPosition ld a, [wTrainerFacingDirection] - and a + and a ; SPRITE_FACING_DOWN jr z, .facingDown - cp $4 + cp SPRITE_FACING_UP jr z, .facingUp - cp $8 + cp SPRITE_FACING_LEFT jr z, .facingLeft jr .facingRight .facingDown @@ -148,7 +148,7 @@ TrainerWalkUpToPlayer: jp MoveSprite_ ; input: de = offset within sprite entry -; output: de = pointer to sprite data +; output: hl = pointer to sprite data GetSpriteDataPointer: push de add hl, de @@ -225,7 +225,7 @@ TrainerEngage: set 0, [hl] call EngageMapTrainer ld a, $ff -.noEngage: +.noEngage ld [wTrainerSpriteOffset], a pop de pop hl @@ -239,7 +239,7 @@ ReadTrainerScreenPosition: ld e, a ld hl, wSpriteStateData1 add hl, de - ld a, [hl] + ld a, [hl] ; c1x4 (sprite Y pos) ld [wTrainerScreenY], a ld a, [wTrainerSpriteOffset] add $6 @@ -247,7 +247,7 @@ ReadTrainerScreenPosition: ld e, a ld hl, wSpriteStateData1 add hl, de - ld a, [hl] + ld a, [hl] ; c1x6 (sprite X pos) ld [wTrainerScreenX], a ret @@ -262,13 +262,13 @@ CheckSpriteCanSeePlayer: jr .notInLine ; player too far away .checkIfLinedUp ld a, [wTrainerFacingDirection] ; sprite facing direction - cp $0 ; down + cp SPRITE_FACING_DOWN jr z, .checkXCoord - cp $4 ; up + cp SPRITE_FACING_UP jr z, .checkXCoord - cp $8 ; left + cp SPRITE_FACING_LEFT jr z, .checkYCoord - cp $c ; right + cp SPRITE_FACING_RIGHT jr z, .checkYCoord jr .notInLine .checkXCoord @@ -315,21 +315,21 @@ CheckPlayerIsInFrontOfSprite: ld a, [hl] ; c1x6 (sprite screen X pos) ld [wTrainerScreenX], a ld a, [wTrainerFacingDirection] ; facing direction - cp $0 + cp SPRITE_FACING_DOWN jr nz, .notFacingDown ld a, [wTrainerScreenY] ; sprite screen Y pos cp $3c jr c, .engage ; sprite above player jr .noEngage ; sprite below player .notFacingDown - cp $4 + cp SPRITE_FACING_UP jr nz, .notFacingUp ld a, [wTrainerScreenY] ; sprite screen Y pos cp $3c jr nc, .engage ; sprite below player jr .noEngage ; sprite above player .notFacingUp - cp $8 + cp SPRITE_FACING_LEFT jr nz, .notFacingLeft ld a, [wTrainerScreenX] ; sprite screen X pos cp $40 diff --git a/engine/predefs.asm b/engine/predefs.asm index fd11475b..7b0be1e9 100755 --- a/engine/predefs.asm +++ b/engine/predefs.asm @@ -27,10 +27,10 @@ GetPredefPointer: add a add e ld e,a - jr nc,.next + jr nc, .nocarry inc d -.next +.nocarry add hl,de ld d,h ld e,l @@ -60,7 +60,7 @@ PredefPointers:: add_predef CopyDownscaledMonTiles add_predef LoadMissableObjects add_predef HealParty - add_predef MoveAnimation; 08 play move animation + add_predef MoveAnimation add_predef DivideBCDPredef add_predef DivideBCDPredef2 add_predef AddBCDPredef @@ -81,8 +81,8 @@ PredefPointers:: add_predef LearnMoveFromLevelUp add_predef LearnMove add_predef GetQuantityOfItemInBag - dbw $03,CheckForHiddenObjectOrBookshelfOrCardKeyDoor ; for these two, the bank number is actually 0 - dbw $03,GiveItem + dbw $03,CheckForHiddenObjectOrBookshelfOrCardKeyDoor ; home bank + dbw $03,GiveItem ; home bank add_predef ChangeBGPalColor0_4Frames add_predef FindPathToPlayer add_predef PredefShakeScreenVertically @@ -122,7 +122,7 @@ PredefPointers:: add_predef CanLearnTM add_predef TMToMove add_predef _RunPaletteCommand - add_predef StarterDex ; 46 + add_predef StarterDex add_predef _AddPartyMon add_predef UpdateHPBar2 add_predef DrawEnemyHUDAndHPBar @@ -147,7 +147,7 @@ PredefPointers:: add_predef PickUpItem add_predef PrintMoveType add_predef LoadMovePPs - add_predef DrawHP ; 5F + add_predef DrawHP add_predef DrawHP2 add_predef DisplayElevatorFloorMenu add_predef OaksAideScript diff --git a/engine/save.asm b/engine/save.asm index 58326187..4fb2c4c8 100755 --- a/engine/save.asm +++ b/engine/save.asm @@ -638,7 +638,7 @@ SaveHallOfFameTeams: ld a, [wNumHoFTeams] dec a cp HOF_TEAM_CAPACITY - jr nc, .asm_73b28 + jr nc, .shiftHOFTeams ld hl, sHallOfFame ld bc, HOF_TEAM call AddNTimes @@ -648,7 +648,9 @@ SaveHallOfFameTeams: ld bc, HOF_TEAM jr HallOfFame_Copy -.asm_73b28 +.shiftHOFTeams +; if the space designated for HOF teams is full, then shift all HOF teams to the next slot, making space for the new HOF team +; this deletes the last HOF team though ld hl, sHallOfFame + HOF_TEAM ld de, sHallOfFame ld bc, HOF_TEAM * (HOF_TEAM_CAPACITY - 1) diff --git a/engine/slot_machine.asm b/engine/slot_machine.asm index 733cc29c..fb845c45 100755 --- a/engine/slot_machine.asm +++ b/engine/slot_machine.asm @@ -864,7 +864,7 @@ LoadSlotMachineTiles: call FarCopyData2 ld hl, SlotMachineMap coord de, 0, 0 - ld bc, $00f0 + ld bc, SlotMachineMapEnd - SlotMachineMap call CopyData call EnableLCD ld hl, wSlotMachineWheel1Offset @@ -878,6 +878,7 @@ LoadSlotMachineTiles: SlotMachineMap: INCBIN "gfx/tilemaps/slotmachine.map" +SlotMachineMapEnd: INCLUDE "data/slot_machine_wheels.asm" diff --git a/engine/titlescreen.asm b/engine/titlescreen.asm index ecccbf32..e1a6e015 100755 --- a/engine/titlescreen.asm +++ b/engine/titlescreen.asm @@ -169,7 +169,7 @@ ENDC db -1,2 db 0 ; terminate list with 0 -.ScrollTitleScreenPokemonLogo +.ScrollTitleScreenPokemonLogo: ; Scrolls the Pokemon logo on the title screen to create the bouncing effect ; Scrolls d pixels e times call DelayFrame diff --git a/engine/titlescreen2.asm b/engine/titlescreen2.asm index 6f47b080..2346fcc5 100755 --- a/engine/titlescreen2.asm +++ b/engine/titlescreen2.asm @@ -67,7 +67,7 @@ _TitleScroll: pop bc jr _TitleScroll -.ScrollBetween +.ScrollBetween: .wait ld a, [rLY] ; rLY cp l diff --git a/engine/town_map.asm b/engine/town_map.asm index b2f1e656..dcf50a42 100755 --- a/engine/town_map.asm +++ b/engine/town_map.asm @@ -141,7 +141,7 @@ LoadTownMap_Fly: call LoadFontTilePatterns ld de, BirdSprite ld hl, vSprites + $40 - lb bc, BANK(BirdSprite), $0c + lb bc, BANK(BirdSprite), $c call CopyVideoData ld de, TownMapUpArrow ld hl, vChars1 + $6d0 @@ -179,7 +179,7 @@ LoadTownMap_Fly: ld c, 15 call DelayFrames coord hl, 18, 0 - ld [hl], $ed + ld [hl], "▶" coord hl, 19, 0 ld [hl], $ee pop hl @@ -355,12 +355,12 @@ DrawPlayerOrBirdSprite: call WritePlayerOrBirdSpriteOAM pop hl ld de, wcd6d -.asm_711dc +.loop ld a, [hli] ld [de], a inc de - cp $50 - jr nz, .asm_711dc + cp "@" + jr nz, .loop ld hl, wOAMBuffer ld de, wTileMapBackup ld bc, $a0 @@ -397,8 +397,8 @@ DisplayWildLocations: jr nz, .drawPlayerSprite ; if no OAM entries were written, print area unknown text coord hl, 1, 7 - ld b, $2 - ld c, $f + ld b, 2 + ld c, 15 call TextBoxBorder coord hl, 2, 9 ld de, AreaUnknownText diff --git a/engine/trade.asm b/engine/trade.asm index 78444cf6..c3913a7e 100755 --- a/engine/trade.asm +++ b/engine/trade.asm @@ -305,7 +305,7 @@ Trade_AnimateBallEnteringLinkCable: ld [rOBP0], a xor a ld [wLinkCableAnimBulgeToggle], a - ld bc, $2060 + lb bc, $20, $60 .moveBallInsideLinkCableLoop push bc xor a @@ -380,7 +380,7 @@ Trade_AnimLeftToRight: call Trade_InitGameboyTransferGfx ld a, $1 ld [wTradedMonMovingRight], a - ld a, $e4 + ld a, %11100100 ld [rOBP0], a ld a, $54 ld [wBaseCoordX], a @@ -466,7 +466,7 @@ Trade_DrawLeftGameboy: ld a, $5d ld [hli], a ld a, $5e - ld c, $8 + ld c, 8 .loop ld [hli], a dec c @@ -526,8 +526,8 @@ Trade_DrawRightGameboy: ; draw text box with enemy name above link cable coord hl, 6, 0 - ld b, $2 - ld c, $7 + ld b, 2 + ld c, 7 call TextBoxBorder coord hl, 7, 2 ld de, wLinkEnemyTrainerName diff --git a/home.asm b/home.asm index d5ecbaed..8d3c7207 100644 --- a/home.asm +++ b/home.asm @@ -4710,8 +4710,8 @@ TextPredefs:: add_tx_pre LinkCableHelp ; 34 add_tx_pre TMNotebook ; 35 add_tx_pre FightingDojoText ; 36 - add_tx_pre FightingDojoText_52a10 ; 37 - add_tx_pre FightingDojoText_52a1d ; 38 + add_tx_pre EnemiesOnEverySideText ; 37 + add_tx_pre WhatGoesAroundComesAroundText ; 38 add_tx_pre NewBicycleText ; 39 add_tx_pre IndigoPlateauStatues ; 3A add_tx_pre VermilionGymTrashSuccessText1 ; 3B diff --git a/text.asm b/text.asm index 6e31fb03..49c246ee 100644 --- a/text.asm +++ b/text.asm @@ -781,12 +781,12 @@ _ViridianSchoolNotebookText4:: line "#MON LEAGUE!" prompt -_FightingDojoText_52a10:: +_EnemiesOnEverySideText:: text "Enemies on every" line "side!" done -_FightingDojoText_52a1d:: +_WhatGoesAroundComesAroundText:: text "What goes around" line "comes around!" done diff --git a/wram.asm b/wram.asm index 644617fd..d5d6a025 100755 --- a/wram.asm +++ b/wram.asm @@ -1778,7 +1778,7 @@ wEnemyNumAttacksLeft:: ; d06f wEnemyConfusedCounter:: ; d070 ds 1 -wEnemyToxcCounter:: ; d071 +wEnemyToxicCounter:: ; d071 ds 1 wEnemyDisabledMove:: ; d072 -- cgit v1.2.3 From 61ee39678695479816feff4b58baaa6953ff219f Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Sun, 12 Jun 2016 00:51:59 -0700 Subject: more syncing with pokeyellow --- engine/hidden_object_functions18.asm | 24 +++--- engine/hidden_object_functions3.asm | 34 ++++---- home/text.asm | 161 ++++++++++++++++------------------- macros.asm | 132 +++++++++++++++++++++------- 4 files changed, 206 insertions(+), 145 deletions(-) diff --git a/engine/hidden_object_functions18.asm b/engine/hidden_object_functions18.asm index 6ce582ed..c6fb3109 100755 --- a/engine/hidden_object_functions18.asm +++ b/engine/hidden_object_functions18.asm @@ -73,29 +73,29 @@ PrintBenchGuyText: ; format: db map id, player sprite facing direction, text id of PredefTextIDPointerTable BenchGuyTextPointers: db VIRIDIAN_POKECENTER, SPRITE_FACING_LEFT - db (ViridianCityPokecenterBenchGuyText_id - TextPredefs) / 2 + 1 + db_tx_pre ViridianCityPokecenterBenchGuyText db PEWTER_POKECENTER, SPRITE_FACING_LEFT - db (PewterCityPokecenterBenchGuyText_id - TextPredefs) / 2 + 1 + db_tx_pre PewterCityPokecenterBenchGuyText db CERULEAN_POKECENTER, SPRITE_FACING_LEFT - db (CeruleanCityPokecenterBenchGuyText_id - TextPredefs) / 2 + 1 + db_tx_pre CeruleanCityPokecenterBenchGuyText db LAVENDER_POKECENTER, SPRITE_FACING_LEFT - db (LavenderCityPokecenterBenchGuyText_id - TextPredefs) / 2 + 1 + db_tx_pre LavenderCityPokecenterBenchGuyText db VERMILION_POKECENTER, SPRITE_FACING_LEFT - db (VermilionCityPokecenterBenchGuyText_id - TextPredefs) / 2 + 1 + db_tx_pre VermilionCityPokecenterBenchGuyText db CELADON_POKECENTER, SPRITE_FACING_LEFT - db (CeladonCityPokecenterBenchGuyText_id - TextPredefs) / 2 + 1 + db_tx_pre CeladonCityPokecenterBenchGuyText db CELADON_HOTEL, SPRITE_FACING_LEFT - db (CeladonCityHotelText_id - TextPredefs) / 2 + 1 + db_tx_pre CeladonCityHotelText db FUCHSIA_POKECENTER, SPRITE_FACING_LEFT - db (FuchsiaCityPokecenterBenchGuyText_id - TextPredefs) / 2 + 1 + db_tx_pre FuchsiaCityPokecenterBenchGuyText db CINNABAR_POKECENTER, SPRITE_FACING_LEFT - db (CinnabarIslandPokecenterBenchGuyText_id - TextPredefs) / 2 + 1 + db_tx_pre CinnabarIslandPokecenterBenchGuyText db SAFFRON_POKECENTER, SPRITE_FACING_LEFT - db (SaffronCityPokecenterBenchGuyText_id - TextPredefs) / 2 + 1 + db_tx_pre SaffronCityPokecenterBenchGuyText db MT_MOON_POKECENTER, SPRITE_FACING_LEFT - db (MtMoonPokecenterBenchGuyText_id - TextPredefs) / 2 + 1 + db_tx_pre MtMoonPokecenterBenchGuyText db ROCK_TUNNEL_POKECENTER,SPRITE_FACING_LEFT - db (RockTunnelPokecenterBenchGuyText_id - TextPredefs) / 2 + 1 + db_tx_pre RockTunnelPokecenterBenchGuyText db $FF ViridianCityPokecenterBenchGuyText: diff --git a/engine/hidden_object_functions3.asm b/engine/hidden_object_functions3.asm index 84ce6d53..6b349a00 100755 --- a/engine/hidden_object_functions3.asm +++ b/engine/hidden_object_functions3.asm @@ -39,39 +39,39 @@ PrintBookshelfText: ; format: db tileset id, bookshelf tile id, text id BookshelfTileIDs: db PLATEAU, $30 - db (IndigoPlateauStatues_id - TextPredefs) / 2 + 1 + db_tx_pre IndigoPlateauStatues db HOUSE, $3D - db (TownMapText_id - TextPredefs) / 2 + 1 + db_tx_pre TownMapText db HOUSE, $1E - db (BookOrSculptureText_id - TextPredefs) / 2 + 1 + db_tx_pre BookOrSculptureText db MANSION, $32 - db (BookOrSculptureText_id - TextPredefs) / 2 + 1 + db_tx_pre BookOrSculptureText db REDS_HOUSE_1, $32 - db (BookOrSculptureText_id - TextPredefs) / 2 + 1 + db_tx_pre BookOrSculptureText db LAB, $28 - db (BookOrSculptureText_id - TextPredefs) / 2 + 1 + db_tx_pre BookOrSculptureText db LOBBY, $16 - db (ElevatorText_id - TextPredefs) / 2 + 1 + db_tx_pre ElevatorText db GYM, $1D - db (BookOrSculptureText_id - TextPredefs) / 2 + 1 + db_tx_pre BookOrSculptureText db DOJO, $1D - db (BookOrSculptureText_id - TextPredefs) / 2 + 1 + db_tx_pre BookOrSculptureText db GATE, $22 - db (BookOrSculptureText_id - TextPredefs) / 2 + 1 + db_tx_pre BookOrSculptureText db MART, $54 - db (PokemonStuffText_id - TextPredefs) / 2 + 1 + db_tx_pre PokemonStuffText db MART, $55 - db (PokemonStuffText_id - TextPredefs) / 2 + 1 + db_tx_pre PokemonStuffText db POKECENTER, $54 - db (PokemonStuffText_id - TextPredefs) / 2 + 1 + db_tx_pre PokemonStuffText db POKECENTER, $55 - db (PokemonStuffText_id - TextPredefs) / 2 + 1 + db_tx_pre PokemonStuffText db LOBBY, $50 - db (PokemonStuffText_id - TextPredefs) / 2 + 1 + db_tx_pre PokemonStuffText db LOBBY, $52 - db (PokemonStuffText_id - TextPredefs) / 2 + 1 + db_tx_pre PokemonStuffText db SHIP, $36 - db (BookOrSculptureText_id - TextPredefs) / 2 + 1 + db_tx_pre BookOrSculptureText db $FF IndigoPlateauStatues: diff --git a/home/text.asm b/home/text.asm index e9c0efdd..893e6826 100644 --- a/home/text.asm +++ b/home/text.asm @@ -52,28 +52,28 @@ PlaceNextChar:: ld a,[de] cp "@" - jr nz,.PlaceText + jr nz, Char4ETest ld b,h ld c,l pop hl ret -.PlaceText - cp $4E - jr nz,.next - ld bc,SCREEN_WIDTH * 2 +Char4ETest:: + cp $4E ; next + jr nz, .char4FTest + ld bc, 2 * SCREEN_WIDTH ld a,[hFlags_0xFFF6] bit 2,a - jr z,.next2 + jr z,.ok ld bc,SCREEN_WIDTH -.next2 +.ok pop hl add hl,bc push hl jp PlaceNextChar_inc -.next - cp $4F +.char4FTest + cp $4F ; line jr nz,.next3 pop hl coord hl, 1, 16 @@ -81,46 +81,36 @@ PlaceNextChar:: jp PlaceNextChar_inc .next3 ; Check against a dictionary +dict: macro +if \1 == 0 and a - jp z,Char00 - cp $4C - jp z,Char4C - cp $4B - jp z,Char4B - cp $51 - jp z,Char51 - cp $49 - jp z,Char49 - cp $52 - jp z,Char52 - cp $53 - jp z,Char53 - cp $54 - jp z,Char54 - cp $5B - jp z,Char5B - cp $5E - jp z,Char5E - cp $5C - jp z,Char5C - cp $5D - jp z,Char5D - cp $55 - jp z,Char55 - cp $56 - jp z,Char56 - cp $57 - jp z,Char57 - cp $58 - jp z,Char58 - cp $4A - jp z,Char4A - cp $5F - jp z,Char5F - cp $59 - jp z,Char59 - cp $5A - jp z,Char5A +else + cp \1 +endc + jp z, \2 +endm + + dict $00, Char00 ; error + dict $4C, Char4C ; autocont + dict $4B, Char4B ; cont_ + dict $51, Char51 ; para + dict $49, Char49 ; page + dict $52, Char52 ; player + dict $53, Char53 ; rival + dict $54, Char54 ; POKé + dict $5B, Char5B ; PC + dict $5E, Char5E ; ROCKET + dict $5C, Char5C ; TM + dict $5D, Char5D ; TRAINER + dict $55, Char55 ; cont + dict $56, Char56 ; 6 dots + dict $57, Char57 ; done + dict $58, Char58 ; prompt + dict $4A, Char4A ; PKMN + dict $5F, Char5F ; dex + dict $59, Char59 ; TARGET + dict $5A, Char5A ; USER + ld [hli],a call PrintLetterDelay PlaceNextChar_inc:: @@ -211,7 +201,6 @@ MonsterNameCharsCommon:: ; print “Enemy ” ld de,Char5AText call PlaceString - ld h,b ld l,c ld de,wEnemyMonNick ; enemy active monster name @@ -264,36 +253,36 @@ Char5F:: pop hl ret -Char58:: +Char58:: ; prompt ld a,[wLinkState] cp LINK_STATE_BATTLING - jp z,Next1AA2 - ld a,$EE + jp z, .ok + ld a, $EE Coorda 18, 16 -Next1AA2:: +.ok call ProtectedDelay3 call ManualTextScroll ld a, " " Coorda 18, 16 -Char57:: +Char57:: ; done pop hl - ld de,Char58Text + ld de, Char58Text dec de ret Char58Text:: db "@" -Char51:: +Char51:: ; para push de - ld a,$EE + ld a, $EE Coorda 18, 16 call ProtectedDelay3 call ManualTextScroll coord hl, 1, 13 lb bc, 4, 18 call ClearScreenArea - ld c,20 + ld c, 20 call DelayFrames pop de coord hl, 1, 14 @@ -328,13 +317,13 @@ Char4B:: ;fall through Char4C:: push de - call Next1B18 - call Next1B18 + call ScrollTextUpOneLine + call ScrollTextUpOneLine coord hl, 1, 16 pop de jp PlaceNextChar_inc -Next1B18:: +ScrollTextUpOneLine:: coord hl, 0, 14 coord de, 0, 13 ld b,60 @@ -372,7 +361,7 @@ TextCommandProcessor:: push af set 1,a ld e,a - ld a,[$fff4] + ld a, [$fff4] xor e ld [wLetterPrintingDelayFlags],a ld a,c @@ -389,22 +378,22 @@ NextTextCommand:: ret .doTextCommand push hl - cp a,$17 - jp z,TextCommand17 - cp a,$0e + cp a, $17 + jp z, TextCommand17 + cp a, $0e jp nc,TextCommand0B ; if a != 0x17 and a >= 0xE, go to command 0xB ; if a < 0xE, use a jump table ld hl,TextCommandJumpTable push bc add a - ld b,$00 - ld c,a - add hl,bc + ld b, 0 + ld c, a + add hl, bc pop bc - ld a,[hli] - ld h,[hl] - ld l,a - jp [hl] + ld a, [hli] + ld h, [hl] + ld l, a + jp hl ; draw box ; 04AAAABBCC @@ -523,10 +512,10 @@ TextCommand06:: ; 07 ; (no arguments) TextCommand07:: - ld a," " + ld a, " " Coorda 18, 16 ; place blank space in lower right corner of dialogue text box - call Next1B18 ; scroll up text - call Next1B18 + call ScrollTextUpOneLine + call ScrollTextUpOneLine pop hl coord bc, 1, 16 ; address of second line of dialogue text box jp NextTextCommand @@ -537,7 +526,7 @@ TextCommand08:: pop hl ld de,NextTextCommand push de ; return address - jp [hl] + jp hl ; print decimal number (converted from binary number) ; 09AAAABB @@ -626,16 +615,16 @@ TextCommand0B:: ; format: text command ID, sound ID or cry ID TextCommandSounds:: - db $0B,SFX_GET_ITEM_1 - db $12,SFX_CAUGHT_MON - db $0E,SFX_POKEDEX_RATING - db $0F,SFX_GET_ITEM_1 - db $10,SFX_GET_ITEM_2 - db $11,SFX_GET_KEY_ITEM - db $13,SFX_DEX_PAGE_ADDED - db $14,NIDORINA ; used in OakSpeech - db $15,PIDGEOT ; used in SaffronCityText12 - db $16,DEWGONG ; unused? + db $0B, SFX_GET_ITEM_1 + db $12, SFX_CAUGHT_MON + db $0E, SFX_POKEDEX_RATING + db $0F, SFX_GET_ITEM_1 + db $10, SFX_GET_ITEM_2 + db $11, SFX_GET_KEY_ITEM + db $13, SFX_DEX_PAGE_ADDED + db $14, NIDORINA ; used in OakSpeech + db $15, PIDGEOT ; used in SaffronCityText12 + db $16, DEWGONG ; unused? ; draw ellipses ; 0CAA diff --git a/macros.asm b/macros.asm index 8475582c..661fde0c 100644 --- a/macros.asm +++ b/macros.asm @@ -81,29 +81,62 @@ bcd3: MACRO coins equs "bcd2" money equs "bcd3" +validateCoords: MACRO + if \1 >= SCREEN_WIDTH + fail "x coord out of range" + endc + if \2 >= SCREEN_HEIGHT + fail "y coord out of range" + endc + endm + ;\1 = r ;\2 = X ;\3 = Y +;\4 = which tilemap (optional) coord: MACRO - ld \1, wTileMap + 20 * \3 + \2 + validateCoords \2, \3 +if _NARG >= 4 + ld \1, \4 + SCREEN_WIDTH * \3 + \2 +else + ld \1, wTileMap + SCREEN_WIDTH * \3 + \2 +endc ENDM ;\1 = X ;\2 = Y +;\3 = which tilemap (optional) aCoord: MACRO - ld a, [wTileMap + 20 * \2 + \1] + validateCoords \1, \2 +if _NARG >= 3 + ld a, [\3 + SCREEN_WIDTH * \2 + \1] +else + ld a, [wTileMap + SCREEN_WIDTH * \2 + \1] +endc ENDM ;\1 = X ;\2 = Y +;\3 = which tilemap (optional) Coorda: MACRO - ld [wTileMap + 20 * \2 + \1], a + validateCoords \1, \2 +if _NARG >= 3 + ld [\3 + SCREEN_WIDTH * \2 + \1], a +else + ld [wTileMap + SCREEN_WIDTH * \2 + \1], a +endc ENDM ;\1 = X ;\2 = Y +;\3 = which tilemap (optional) dwCoord: MACRO - dw wTileMap + 20 * \2 + \1 + validateCoords \1, \2 +if _NARG >= 3 + dw \3 + SCREEN_WIDTH * \2 + \1 +else + dw wTileMap + SCREEN_WIDTH * \2 + \1 +endc ENDM ;\1 = r @@ -134,7 +167,7 @@ EMAP: MACRO ; emap x-coordinate,y-coordinate,textpointer ; nybble: y-coordinate ; nybble: x-coordinate ; word : pointer to map name - db (\1 + (\2 << 4)) + dn \2, \1 dw \3 ENDM @@ -146,7 +179,7 @@ IMAP: MACRO ; imap mapid_less_than,x-coordinate,y-coordinate,textpointer ; nybble: x-coordinate ; word : pointer to map name db \1 + 1 - db \2 + \3 << 4 + dn \3, \2 dw \4 ENDM @@ -174,28 +207,30 @@ dbw: MACRO dw \2 ENDM -; data format macros -RGB: MACRO - dw (\3 << 10 | \2 << 5 | \1) +dba: MACRO + dbw BANK(\1), \1 ENDM -; text macros -TX_NUM: MACRO -; print a big-endian decimal number. -; \1: address to read from -; \2: number of bytes to read -; \3: number of digits to display - db $09 +dwb: MACRO dw \1 - db \2 << 4 | \3 + db \2 ENDM -TX_FAR: MACRO - db $17 - dw \1 - db BANK(\1) +dab: MACRO + dwb \1, BANK(\1) ENDM +dbbw: MACRO + db \1, \2 + dw \3 + ENDM + +; data format macros +RGB: MACRO + dw (\3 << 10 | \2 << 5 | \1) + ENDM + +; text macros ; text engine command $1 TX_RAM: MACRO ; prints text to screen @@ -212,32 +247,62 @@ TX_BCD: MACRO db \2 ENDM -TX_MART: MACRO - db $FE, _NARG - rept _NARG - db \1 - shift - endr - db $FF +TX_CURSOR: MACRO +; Move cursor to (\1, \2) +; \1: X coord (0 - 19) +; \2: Y coord (0 - 17) + db $3 + dwCoord \1, \2 ENDM TX_LINE EQUS "db $05" TX_BUTTON_SOUND EQUS "db $06" TX_ASM EQUS "db $08" + +TX_NUM: MACRO +; print a big-endian decimal number. +; \1: address to read from +; \2: number of bytes to read +; \3: number of digits to display + db $09 + dw \1 + db \2 << 4 | \3 + ENDM + TX_SFX_ITEM EQUS "db $0b" TX_WAIT_BUTTON EQUS "db $0d" TX_SFX_CONGRATS EQUS "db $10" TX_SFX_KEY_ITEM EQUS "db $11" +TX_FAR: MACRO +; 17AAAABB (call text at BB:AAAA) + db $17 + dab \1 + ENDM + TX_VENDING_MACHINE EQUS "db $f5" TX_CABLE_CLUB_RECEPTIONIST EQUS "db $f6" TX_PRIZE_VENDOR EQUS "db $f7" TX_POKECENTER_PC EQUS "db $f9" TX_PLAYERS_PC EQUS "db $fc" TX_BILLS_PC EQUS "db $fd" + +TX_MART: MACRO + db $FE, _NARG + rept _NARG + db \1 + shift + endr + db $FF + ENDM + TX_POKECENTER_NURSE EQUS "db $ff" ; Predef macro. +predef_const: MACRO + const \1PredefID + ENDM + add_predef: MACRO \1Predef:: db BANK(\1) @@ -258,11 +323,18 @@ predef_jump: MACRO jp Predef ENDM +tx_pre_const: MACRO + const \1_id + ENDM add_tx_pre: MACRO \1_id:: dw \1 ENDM +db_tx_pre: MACRO + db (\1_id - TextPredefs) / 2 + 1 +ENDM + tx_pre_id: MACRO ld a, (\1_id - TextPredefs) / 2 + 1 ENDM @@ -674,9 +746,9 @@ ENDM tmlearn: MACRO x = 0 rept _NARG -if \1 != 0 +IF \1 != 0 x = x | (1 << ((\1 - 1) % 8)) -endc +ENDC shift endr db x -- cgit v1.2.3 From bcb251261dae3cd9ba423fc139c7db4433a1a802 Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Sun, 12 Jun 2016 01:06:27 -0700 Subject: sync tileset WRAM labels --- engine/cable_club.asm | 10 +++++----- engine/items/items.asm | 2 +- engine/overworld/movement.asm | 4 ++-- home/overworld.asm | 18 +++++++++--------- main.asm | 4 ++-- wram.asm | 10 +++++----- 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/engine/cable_club.asm b/engine/cable_club.asm index 9d72d220..c3a5e235 100755 --- a/engine/cable_club.asm +++ b/engine/cable_club.asm @@ -900,16 +900,16 @@ CableClub_Run: call CableClub_DoBattleOrTrade ld hl, Club_GFX ld a, h - ld [wTileSetGFXPtr + 1], a + ld [wTilesetGfxPtr + 1], a ld a, l - ld [wTileSetGFXPtr], a + ld [wTilesetGfxPtr], a ld a, Bank(Club_GFX) - ld [wTileSetBank], a + ld [wTilesetBank], a ld hl, Club_Coll ld a, h - ld [wTileSetCollisionPtr + 1], a + ld [wTilesetCollisionPtr + 1], a ld a, l - ld [wTileSetCollisionPtr], a + ld [wTilesetCollisionPtr], a xor a ld [wGrassRate], a inc a ; LINK_STATE_IN_CABLE_CLUB diff --git a/engine/items/items.asm b/engine/items/items.asm index a6717494..24489690 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -695,7 +695,7 @@ ItemUseSurfboard: ld hl,TilePairCollisionsWater call CheckForTilePairCollisions jr c,.cannotStopSurfing - ld hl,wTileSetCollisionPtr ; pointer to list of passable tiles + ld hl,wTilesetCollisionPtr ; pointer to list of passable tiles ld a,[hli] ld h,[hl] ld l,a ; hl now points to passable tiles diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index 9302b6e3..6d05859e 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -589,9 +589,9 @@ CanWalkOntoTile: and a ret .notScripted - ld a, [wTileSetCollisionPtr] + ld a, [wTilesetCollisionPtr] ld l, a - ld a, [wTileSetCollisionPtr+1] + ld a, [wTilesetCollisionPtr+1] ld h, a .tilePassableLoop ld a, [hli] diff --git a/home/overworld.asm b/home/overworld.asm index fad9f29d..8ec457c1 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -854,13 +854,13 @@ INCLUDE "data/bike_riding_tilesets.asm" ; load the tile pattern data of the current tileset into VRAM LoadTilesetTilePatternData:: - ld a,[wTileSetGFXPtr] + ld a,[wTilesetGfxPtr] ld l,a - ld a,[wTileSetGFXPtr + 1] + ld a,[wTilesetGfxPtr + 1] ld h,a ld de,vTileset ld bc,$600 - ld a,[wTileSetBank] + ld a,[wTilesetBank] jp FarCopyData2 ; this loads the current maps complete tile map (which references blocks, not individual tiles) to C6E8 @@ -1100,7 +1100,7 @@ IsSpriteOrSignInFrontOfPlayer:: ; check if the player is front of a counter in a pokemon center, pokemart, etc. and if so, extend the range at which he can talk to the NPC .extendRangeOverCounter predef GetTileAndCoordsInFrontOfPlayer ; get the tile in front of the player in c - ld hl,wTileSetTalkingOverTiles ; list of tiles that extend talking range (counter tiles) + ld hl,wTilesetTalkingOverTiles ; list of tiles that extend talking range (counter tiles) ld b,3 ld d,$20 ; talking range in pixels (long range) .counterTilesLoop @@ -1242,7 +1242,7 @@ CheckTilePassable:: predef GetTileAndCoordsInFrontOfPlayer ; get tile in front of player ld a,[wTileInFrontOfPlayer] ; tile in front of player ld c,a - ld hl,wTileSetCollisionPtr ; pointer to list of passable tiles + ld hl,wTilesetCollisionPtr ; pointer to list of passable tiles ld a,[hli] ld h,[hl] ld l,a ; hl now points to passable tiles @@ -1354,7 +1354,7 @@ TilePairCollisionsWater:: LoadCurrentMapView:: ld a,[H_LOADEDROMBANK] push af - ld a,[wTileSetBank] ; tile data ROM bank + ld a,[wTilesetBank] ; tile data ROM bank ld [H_LOADEDROMBANK],a ld [MBC1RomBank],a ; switch to ROM bank that contains tile data ld a,[wCurrentTileBlockMapViewPointer] ; address of upper left corner of current map view @@ -1784,9 +1784,9 @@ ScheduleWestColumnRedraw:: ; Input: c = tile block ID, hl = destination address DrawTileBlock:: push hl - ld a,[wTileSetBlocksPtr] ; pointer to tiles + ld a,[wTilesetBlocksPtr] ; pointer to tiles ld l,a - ld a,[wTileSetBlocksPtr + 1] + ld a,[wTilesetBlocksPtr + 1] ld h,a ld a,c swap a @@ -1915,7 +1915,7 @@ CollisionCheckOnWater:: jr z,.noCollision ; keep surfing ; check if the [land] tile in front of the player is passable .checkIfNextTileIsPassable - ld hl,wTileSetCollisionPtr ; pointer to list of passable tiles + ld hl,wTilesetCollisionPtr ; pointer to list of passable tiles ld a,[hli] ld h,[hl] ld l,a diff --git a/main.asm b/main.asm index 6c51de59..53d2dfdb 100755 --- a/main.asm +++ b/main.asm @@ -2435,7 +2435,7 @@ GetTileTwoStepsInFrontOfPlayer: CheckForCollisionWhenPushingBoulder: call GetTileTwoStepsInFrontOfPlayer - ld hl, wTileSetCollisionPtr + ld hl, wTilesetCollisionPtr ld a, [hli] ld h, [hl] ld l, a @@ -2665,7 +2665,7 @@ LoadTilesetHeader: ld e, a ld hl, Tilesets add hl, de - ld de, wTileSetBank + ld de, wTilesetBank ld c, $b .copyTilesetHeaderLoop ld a, [hli] diff --git a/wram.asm b/wram.asm index d5d6a025..0321545c 100755 --- a/wram.asm +++ b/wram.asm @@ -2637,21 +2637,21 @@ wPlayerDirection:: ; d52a ; if the player is not moving, the last the direction in which the player moved ds 1 -wTileSetBank:: ; d52b +wTilesetBank:: ; d52b ds 1 -wTileSetBlocksPtr:: ; d52c +wTilesetBlocksPtr:: ; d52c ; maps blocks (4x4 tiles) to tiles ds 2 -wTileSetGFXPtr:: ; d52e +wTilesetGfxPtr:: ; d52e ds 2 -wTileSetCollisionPtr:: ; d530 +wTilesetCollisionPtr:: ; d530 ; list of all walkable tiles ds 2 -wTileSetTalkingOverTiles:: ; d532 +wTilesetTalkingOverTiles:: ; d532 ds 3 wGrassTile:: ; d535 -- cgit v1.2.3 From 3a6a300da48c98ab844ddc4d209abf51adf2aa44 Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Sun, 12 Jun 2016 10:11:31 -0700 Subject: sync text --- charmap.asm | 8 + constants.asm | 1 + constants/misc_constants.asm | 24 ++- constants/text_constants.asm | 14 ++ engine/gamefreak.asm | 1 - engine/hall_of_fame.asm | 4 +- text.asm | 305 ++++++++++++++++++------------------ text/maps/bike_shop.asm | 2 +- text/maps/celadon_dept_store_3f.asm | 2 +- text/maps/fan_club.asm | 6 +- text/maps/hall_of_fame.asm | 6 +- text/maps/lance.asm | 2 +- text/maps/museum_1f.asm | 2 +- text/maps/oaks_lab.asm | 64 ++++---- text/maps/reds_house_1f.asm | 2 +- text/maps/route_22.asm | 6 +- text/maps/silph_co_11f.asm | 2 +- text/maps/vermilion_city.asm | 6 +- text/oakspeech.asm | 1 - 19 files changed, 238 insertions(+), 220 deletions(-) create mode 100644 constants/text_constants.asm diff --git a/charmap.asm b/charmap.asm index 980c79a3..8f57a130 100644 --- a/charmap.asm +++ b/charmap.asm @@ -147,9 +147,16 @@ charmap "ゅ", $E1 charmap "ょ", $E2 charmap "ー", $E3 +charmap "", $4A ; PkMn charmap "@", $50 +charmap "", $52 +charmap "", $53 charmap "#", $54 ;charmap "POKé", $54 +charmap "", $59 +charmap "", $5A +charmap "′", $71 +charmap "″", $73 charmap "…", $75 charmap "┌", $79 @@ -233,6 +240,7 @@ charmap "'m", $E5 charmap "?", $E6 charmap "!", $E7 charmap ".", $E8 +charmap "▷", $EC charmap "▶", $ED charmap "♂", $EF charmap "¥", $F0 diff --git a/constants.asm b/constants.asm index 8bca86eb..d4e453ec 100644 --- a/constants.asm +++ b/constants.asm @@ -30,3 +30,4 @@ INCLUDE "constants/tilesets.asm" INCLUDE "constants/starter_mons.asm" INCLUDE "constants/event_constants.asm" INCLUDE "constants/event_macros.asm" +INCLUDE "constants/text_constants.asm" diff --git a/constants/misc_constants.asm b/constants/misc_constants.asm index de777c5d..cc10de70 100644 --- a/constants/misc_constants.asm +++ b/constants/misc_constants.asm @@ -29,6 +29,16 @@ D_LEFT EQU %00100000 D_UP EQU %01000000 D_DOWN EQU %10000000 +const_value set 0 + const BIT_A_BUTTON + const BIT_B_BUTTON + const BIT_SELECT + const BIT_START + const BIT_D_RIGHT + const BIT_D_LEFT + const BIT_D_UP + const BIT_D_DOWN + SCREEN_WIDTH EQU 20 SCREEN_HEIGHT EQU 18 @@ -152,20 +162,6 @@ FLAG_RESET EQU 0 FLAG_SET EQU 1 FLAG_TEST EQU 2 -; special text IDs -TEXT_MON_FAINTED EQU $d0 -TEXT_BLACKED_OUT EQU $d1 -TEXT_REPEL_WORE_OFF EQU $d2 -TEXT_SAFARI_GAME_OVER EQU $d3 - -; PrintNumber - -BIT_LEFT_ALIGN EQU 6 -BIT_LEADING_ZEROES EQU 7 - -LEFT_ALIGN EQU (1 << BIT_LEFT_ALIGN) -LEADING_ZEROES EQU (1 << BIT_LEADING_ZEROES) - ; HP bar HP_BAR_GREEN EQU 0 HP_BAR_YELLOW EQU 1 diff --git a/constants/text_constants.asm b/constants/text_constants.asm new file mode 100644 index 00000000..3cddce26 --- /dev/null +++ b/constants/text_constants.asm @@ -0,0 +1,14 @@ +; special text IDs +TEXT_MON_FAINTED EQU $d0 +TEXT_BLACKED_OUT EQU $d1 +TEXT_REPEL_WORE_OFF EQU $d2 +TEXT_SAFARI_GAME_OVER EQU $d3 + +; PrintNumber +BIT_MONEY_SIGN EQU 5 +BIT_LEFT_ALIGN EQU 6 +BIT_LEADING_ZEROES EQU 7 + +MONEY_SIGN EQU (1 << BIT_MONEY_SIGN) +LEFT_ALIGN EQU (1 << BIT_LEFT_ALIGN) +LEADING_ZEROES EQU (1 << BIT_LEADING_ZEROES) diff --git a/engine/gamefreak.asm b/engine/gamefreak.asm index 69c059ff..5226072b 100755 --- a/engine/gamefreak.asm +++ b/engine/gamefreak.asm @@ -199,7 +199,6 @@ MoveDownSmallStars: add hl, de dec c jr nz, .innerLoop - ; Toggle the palette so that the lower star in the small stars tile blinks in ; and out. ld a, [rOBP1] diff --git a/engine/hall_of_fame.asm b/engine/hall_of_fame.asm index dc1026a8..9eb4edc5 100755 --- a/engine/hall_of_fame.asm +++ b/engine/hall_of_fame.asm @@ -58,8 +58,8 @@ AnimateHallOfFame: ld c, 80 call DelayFrames coord hl, 2, 13 - ld b, $3 - ld c, $e + ld b, 3 + ld c, 14 call TextBoxBorder coord hl, 4, 15 ld de, HallOfFameText diff --git a/text.asm b/text.asm index 49c246ee..866d4a7f 100644 --- a/text.asm +++ b/text.asm @@ -1,4 +1,5 @@ - +INCLUDE "charmap.asm" +INCLUDE "constants/text_constants.asm" TEXT_1 EQU $20 TEXT_2 EQU TEXT_1 + 1 TEXT_3 EQU TEXT_2 + 1 @@ -15,7 +16,6 @@ POKEDEX_TEXT EQU TEXT_11 + 1 MOVE_NAMES EQU POKEDEX_TEXT + 1 INCLUDE "macros.asm" -INCLUDE "charmap.asm" INCLUDE "hram.asm" @@ -25,7 +25,7 @@ _CardKeySuccessText1:: text "Bingo!@@" _CardKeySuccessText2:: - db $0 + text "" line "The CARD KEY" cont "opened the door!" done @@ -79,7 +79,7 @@ _PokeCenterSignText:: done _FoundItemText:: - text $52, " found" + text " found" line "@" TX_RAM wcf4b text "!@@" @@ -96,7 +96,7 @@ _OaksAideHiText:: para "If you caught @" TX_NUM hOaksAideRequirement, 1, 3 - db $0 + text "" line "kinds of #MON," cont "I'm supposed to" cont "give you an" @@ -104,7 +104,7 @@ _OaksAideHiText:: TX_RAM wOaksAideRewardItemName text "!" - para "So, ", $52, "! Have" + para "So, ! Have" line "you caught at" cont "least @" TX_NUM hOaksAideRequirement, 1, 3 @@ -117,7 +117,7 @@ _OaksAideUhOhText:: line "Uh-oh! You have" cont "caught only @" TX_NUM hOaksAideNumMonsOwned, 1, 3 - db $0 + text "" cont "kinds of #MON!" para "You need @" @@ -134,7 +134,7 @@ _OaksAideComeBackText:: para "When you get @" TX_NUM hOaksAideRequirement, 1, 3 - db $0 + text "" line "kinds, come back" cont "for @" TX_RAM wOaksAideRewardItemName @@ -153,7 +153,7 @@ _OaksAideHereYouGoText:: prompt _OaksAideGotItemText:: - text $52, " got the" + text " got the" line "@" TX_RAM wOaksAideRewardItemName text "!@@" @@ -239,10 +239,10 @@ _AIBattleWithdrawText:: _AIBattleUseItemText:: TX_RAM wTrainerName - db $0 + text "" line "used @" TX_RAM wcd6d - db $0 + text "" cont "on @" TX_RAM wEnemyMonNick text "!" @@ -257,7 +257,7 @@ _TradeWentToText:: done _TradeForText:: - text "For ", $52, "'s" + text "For 's" line "@" TX_RAM wcf4b text "," @@ -295,11 +295,11 @@ _TradeWillTradeText:: text " will" line "trade @" TX_RAM wcd6d - db $0 + text "" done _TradeforText:: - text "for ", $52, "'s" + text "for 's" line "@" TX_RAM wcf4b text "." @@ -351,7 +351,7 @@ _YeahText:: _DexSeenOwnedText:: text "#DEX Seen:@" TX_NUM wDexRatingNumMonsSeen, 1, 3 - db $0 + text "" line " Owned:@" TX_NUM wDexRatingNumMonsOwned, 1, 3 db "@" @@ -362,27 +362,27 @@ _DexRatingText:: _GymStatueText1:: TX_RAM wGymCityName - db $0 + text "" line "#MON GYM" cont "LEADER: @" TX_RAM wGymLeaderName - db $0 + text "" para "WINNING TRAINERS:" - line $53 + line "" done _GymStatueText2:: TX_RAM wGymCityName - db $0 + text "" line "#MON GYM" cont "LEADER: @" TX_RAM wGymLeaderName - db $0 + text "" para "WINNING TRAINERS:" - line $53 - cont $52 + line "" + cont "" done _ViridianCityPokecenterGuyText:: @@ -627,7 +627,7 @@ _BillsHouseMonitorText:: done _BillsHouseInitiatedText:: - text $52, " initiated" + text " initiated" line "TELEPORTER's Cell" cont "Separator!@@" @@ -801,7 +801,7 @@ _IndigoPlateauHQText:: done _RedBedroomSNESText:: - text $52, " is" + text " is" line "playing the SNES!" cont "...Okay!" cont "It's time to go!" @@ -972,31 +972,31 @@ _VermilionGymTrashFailText:: cont "locks were reset!@@" _FoundHiddenItemText:: - text $52, " found" + text " found" line "@" TX_RAM wcd6d text "!@@" _HiddenItemBagFullText:: - text "But, ", $52, " has" + text "But, has" line "no more room for" cont "other items!" done _FoundHiddenCoinsText:: - text $52, " found" + text " found" line "@" - TX_BCD hCoins, $c2 + TX_BCD hCoins, 2 | LEADING_ZEROES | LEFT_ALIGN text " coins!@@" _FoundHiddenCoins2Text:: - text $52, " found" + text " found" line "@" - TX_BCD hCoins, $c2 + TX_BCD hCoins, 2 | LEADING_ZEROES | LEFT_ALIGN text " coins!@@" _DroppedHiddenCoinsText:: - db $0 + text "" para "Oops! Dropped" line "some coins!" done @@ -1050,48 +1050,48 @@ _OutOfSafariBallsText:: _WildRanText:: text "Wild @" TX_RAM wEnemyMonNick - db $0 + text "" line "ran!" prompt _EnemyRanText:: text "Enemy @" TX_RAM wEnemyMonNick - db $0 + text "" line "ran!" prompt _HurtByPoisonText:: - text $5a, "'s" + text "'s" line "hurt by poison!" prompt _HurtByBurnText:: - text $5a, "'s" + text "'s" line "hurt by the burn!" prompt _HurtByLeechSeedText:: text "LEECH SEED saps" - line $5a, "!" + line "!" prompt _EnemyMonFaintedText:: text "Enemy @" TX_RAM wEnemyMonNick - db $0 + text "" line "fainted!" prompt _MoneyForWinningText:: - text $52, " got ¥@" - TX_BCD wAmountMoneyWon, $c3 - db $0 + text " got ¥@" + TX_BCD wAmountMoneyWon, 3 | LEADING_ZEROES | LEFT_ALIGN + text "" line "for winning!" prompt _TrainerDefeatedText:: - text $52, " defeated" + text " defeated" line "@" TX_RAM wTrainerName text "!" @@ -1099,7 +1099,7 @@ _TrainerDefeatedText:: _PlayerMonFaintedText:: TX_RAM wBattleMonNick - db $0 + text "" line "fainted!" prompt @@ -1108,20 +1108,20 @@ _UseNextMonText:: done _Sony1WinText:: - text $53, ": Yeah! Am" + text ": Yeah! Am" line "I great or what?" prompt _PlayerBlackedOutText2:: - text $52, " is out of" + text " is out of" line "useable #MON!" - para $52, " blacked" + para " blacked" line "out!" prompt _LinkBattleLostText:: - text $52, " lost to" + text " lost to" line "@" TX_RAM wTrainerName text "!" @@ -1135,7 +1135,7 @@ _TrainerAboutToUseText:: TX_RAM wEnemyMonNick text "!" - para "Will ", $52 + para "Will " line "change #MON?" done @@ -1212,42 +1212,42 @@ _GetOutText:: prompt _FastAsleepText:: - text $5A + text "" line "is fast asleep!" prompt _WokeUpText:: - text $5A + text "" line "woke up!" prompt _IsFrozenText:: - text $5A + text "" line "is frozen solid!" prompt _FullyParalyzedText:: - text $5A,"'s" + text "'s" line "fully paralyzed!" prompt _FlinchedText:: - text $5A + text "" line "flinched!" prompt _MustRechargeText:: - text $5A + text "" line "must recharge!" prompt _DisabledNoMoreText:: - text $5A,"'s" + text "'s" line "disabled no more!" prompt _IsConfusedText:: - text $5A + text "" line "is confused!" prompt @@ -1257,37 +1257,37 @@ _HurtItselfText:: prompt _ConfusedNoMoreText:: - text $5A,"'s" + text "'s" line "confused no more!" prompt _SavingEnergyText:: - text $5A + text "" line "is saving energy!" prompt _UnleashedEnergyText:: - text $5A + text "" line "unleashed energy!" prompt _ThrashingAboutText:: - text $5A,"'s" + text "'s" line "thrashing about!" done _AttackContinuesText:: - text $5A,"'s" + text "'s" line "attack continues!" done _CantMoveText:: - text $5A + text "" line "can't move!" prompt _MoveIsDisabledText:: - text $5a, "'s" + text "'s" line "@" TX_RAM wcd6d text " is" @@ -1295,14 +1295,14 @@ _MoveIsDisabledText:: prompt _MonName1Text:: - text $5a, "@@" + text "@@" _Used1Text:: - db $0 + text "" line "used @@" _Used2Text:: - db $0 + text "" line "used @@" _InsteadText:: @@ -1334,24 +1334,24 @@ _ExclamationPoint5Text:: done _AttackMissedText:: - text $5a, "'s" + text "'s" line "attack missed!" prompt _KeptGoingAndCrashedText:: - text $5a + text "" line "kept going and" cont "crashed!" prompt _UnaffectedText:: - text $59, "'s" + text "'s" line "unaffected!" prompt _DoesntAffectMonText:: text "It doesn't affect" - line $59, "!" + line "!" prompt _CriticalHitText:: @@ -1388,23 +1388,23 @@ _TurnedAwayText:: _IgnoredOrdersText:: TX_RAM wBattleMonNick - db $0 + text "" line "ignored orders!" prompt _SubstituteTookDamageText:: text "The SUBSTITUTE" line "took damage for" - cont $59, "!" + cont "!" prompt _SubstituteBrokeText:: - text $59, "'s" + text "'s" line "SUBSTITUTE broke!" prompt _BuildingRageText:: - text $5a, "'s" + text "'s" line "RAGE is building!" prompt @@ -1431,6 +1431,7 @@ _WithExpAllText:: _BoostedText:: text "a boosted" cont "@@" + _ExpPointsText:: TX_NUM wExpAmountGained, 2, 4 text " EXP. Points!" @@ -1446,7 +1447,7 @@ _GrewLevelText:: _WildMonAppearedText:: text "Wild @" TX_RAM wEnemyMonNick - db $0 + text "" line "appeared!" prompt @@ -1454,13 +1455,13 @@ _HookedMonAttackedText:: text "The hooked" line "@" TX_RAM wEnemyMonNick - db $0 + text "" cont "attacked!" prompt _EnemyAppearedText:: TX_RAM wEnemyMonNick - db $0 + text "" line "appeared!" prompt @@ -1513,7 +1514,7 @@ _GoodText:: text "good!@@" _ComeBackText:: - db $0 + text "" line "Come back!" done @@ -1543,9 +1544,9 @@ _SafariZoneAngryText:: ; money related _PickUpPayDayMoneyText:: - text $52, " picked up" + text " picked up" line "¥@" - TX_BCD wTotalPayDayMoney, $c3 + TX_BCD wTotalPayDayMoney, 3 | LEADING_ZEROES | LEFT_ALIGN text "!" prompt @@ -1585,7 +1586,7 @@ _PartyMenuSwapMonText:: _PotionText:: TX_RAM wcd6d - db $0 + text "" line "recovered by @" TX_NUM wHPBarHPDifference, 2, 3 text "!" @@ -1617,7 +1618,7 @@ _IceHealText:: _AwakeningText:: TX_RAM wcd6d - db $0 + text "" line "woke up!" done @@ -1629,7 +1630,7 @@ _FullHealText:: _ReviveText:: TX_RAM wcd6d - db $0 + text "" line "is revitalized!" done @@ -1637,11 +1638,11 @@ _RareCandyText:: TX_RAM wcd6d text " grew" line "to level @" - TX_NUM wCurEnemyLVL, $1,$3 + TX_NUM wCurEnemyLVL, 1, 3 text "!@@" _TurnedOnPC1Text:: - text $52, " turned on" + text " turned on" line "the PC." prompt @@ -1669,7 +1670,7 @@ _AccessedMyPCText:: prompt _TurnedOnPC2Text:: - text $52, " turned on" + text " turned on" line "the PC." prompt @@ -1902,13 +1903,13 @@ _DoYouWantToNicknameText:: _YourNameIsText:: text "Right! So your" - line "name is ", $52, "!" + line "name is !" prompt _HisNameIsText:: text "That's right! I" line "remember now! His" - cont "name is ", $53, "!" + cont "name is !" prompt _WillBeTradedText:: @@ -2011,7 +2012,7 @@ _WouldYouLikeToSaveText:: done _GameSavedText:: - text $52, " saved" + text " saved" line "the game!" done @@ -2031,7 +2032,7 @@ _WhenYouChangeBoxText:: _ChooseABoxText:: text "Choose a" - line $4a, " BOX.@@" + line " BOX.@@" _EvolvedText:: TX_RAM wcf4b @@ -2039,7 +2040,7 @@ _EvolvedText:: done _IntoText:: - db $0 + text "" line "into @" TX_RAM wcd6d text "!" @@ -2048,54 +2049,54 @@ _IntoText:: _StoppedEvolvingText:: text "Huh? @" TX_RAM wcf4b - db $0 + text "" line "stopped evolving!" prompt _IsEvolvingText:: text "What? @" TX_RAM wcf4b - db $0 + text "" line "is evolving!" done _FellAsleepText:: - text $59 + text "" line "fell asleep!" prompt _AlreadyAsleepText:: - text $59, "'s" + text "'s" line "already asleep!" prompt _PoisonedText:: - text $59 + text "" line "was poisoned!" prompt _BadlyPoisonedText:: - text $59, "'s" + text "'s" line "badly poisoned!" prompt _BurnedText:: - text $59 + text "" line "was burned!" prompt _FrozenText:: - text $59 + text "" line "was frozen solid!" prompt _FireDefrostedText:: text "Fire defrosted" - line $59, "!" + line "!" prompt _MonsStatsRoseText:: - text $5a, "'s" + text "'s" line "@" TX_RAM wcf4b text "@@" @@ -2108,7 +2109,7 @@ _RoseText:: prompt _MonsStatsFellText:: - text $59, "'s" + text "'s" line "@" TX_RAM wcf4b text "@@" @@ -2121,60 +2122,60 @@ _FellText:: prompt _RanFromBattleText:: - text $5a + text "" line "ran from battle!" prompt _RanAwayScaredText:: - text $59 + text "" line "ran away scared!" prompt _WasBlownAwayText:: - text $59 + text "" line "was blown away!" prompt _ChargeMoveEffectText:: - text $5a, "@@" + text "@@" _MadeWhirlwindText:: - db $0 + text "" line "made a whirlwind!" prompt _TookInSunlightText:: - db $0 + text "" line "took in sunlight!" prompt _LoweredItsHeadText:: - db $0 + text "" line "lowered its head!" prompt _SkyAttackGlowingText:: - db $0 + text "" line "is glowing!" prompt _FlewUpHighText:: - db $0 + text "" line "flew up high!" prompt _DugAHoleText:: - db $0 + text "" line "dug a hole!" prompt _BecameConfusedText:: - text $59 + text "" line "became confused!" prompt _MimicLearnedMoveText:: - text $5a + text "" line "learned" cont "@" TX_RAM wcd6d @@ -2182,7 +2183,7 @@ _MimicLearnedMoveText:: prompt _MoveWasDisabledText:: - text $59, "'s" + text "'s" line "@" TX_RAM wcd6d text " was" @@ -2203,16 +2204,16 @@ _ButItFailedText:: _DidntAffectText:: text "It didn't affect" - line $59, "!" + line "!" prompt _IsUnaffectedText:: - text $59 + text "" line "is unaffected!" prompt _ParalyzedMayNotAttackText:: - text $59, "'s" + text "'s" line "paralyzed! It may" cont "not attack!" prompt @@ -2223,7 +2224,7 @@ _SubstituteText:: prompt _HasSubstituteText:: - text $5a + text "" line "has a SUBSTITUTE!" prompt @@ -2243,23 +2244,23 @@ _GettingPumpedText:: prompt _WasSeededText:: - text $59 + text "" line "was seeded!" prompt _EvadedAttackText:: - text $59 + text "" line "evaded attack!" prompt _HitWithRecoilText:: - text $5a, "'s" + text "'s" line "hit with recoil!" prompt _ConvertedTypeText:: text "Converted type to" - line $59, "'s!" + line "'s!" prompt _StatusChangesEliminatedText:: @@ -2268,23 +2269,23 @@ _StatusChangesEliminatedText:: prompt _StartedSleepingEffect:: - text $5a + text "" line "started sleeping!" done _FellAsleepBecameHealthyText:: - text $5a + text "" line "fell asleep and" cont "became healthy!" done _RegainedHealthText:: - text $5a + text "" line "regained health!" prompt _TransformedText:: - text $5a + text "" line "transformed into" cont "@" TX_RAM wcd6d @@ -2292,28 +2293,28 @@ _TransformedText:: prompt _LightScreenProtectedText:: - text $5a, "'s" + text "'s" line "protected against" cont "special attacks!" prompt _ReflectGainedArmorText:: - text $5a + text "" line "gained armor!" prompt _ShroudedInMistText:: - text $5a, "'s" + text "'s" line "shrouded in mist!" prompt _SuckedHealthText:: text "Sucked health from" - line $59, "!" + line "!" prompt _DreamWasEatenText:: - text $59, "'s" + text "'s" line "dream was eaten!" prompt @@ -2433,15 +2434,15 @@ _PokemartGreetingText:: _PokemonFaintedText:: TX_RAM wcd6d - db $0 + text "" line "fainted!" done _PlayerBlackedOutText:: - text $52, " is out of" + text " is out of" line "useable #MON!" - para $52, " blacked" + para " blacked" line "out!" prompt @@ -2459,7 +2460,7 @@ _PokemartTellBuyPriceText:: text "?" line "That will be" cont "¥@" - TX_BCD hMoney, $c3 + TX_BCD hMoney, 3 | LEADING_ZEROES | LEFT_ALIGN text ". OK?" done @@ -2486,7 +2487,7 @@ _PokemonSellingGreetingText:: _PokemartTellSellPriceText:: text "I can pay you" line "¥@" - TX_BCD hMoney, $c3 + TX_BCD hMoney, 3 | LEADING_ZEROES | LEFT_ALIGN text " for that." done @@ -2530,7 +2531,7 @@ _AbandonLearningText:: _DidNotLearnText:: TX_RAM wLearnMoveMonName - db $0 + text "" line "did not learn" cont "@" TX_RAM wcf4b @@ -2547,7 +2548,7 @@ _TryingToLearnText:: para "But, @" TX_RAM wLearnMoveMonName - db $0 + text "" line "can't learn more" cont "than 4 moves!" @@ -2565,7 +2566,7 @@ _PoofText:: text " Poof!@@" _ForgotAndText:: - db $0 + text "" para "@" TX_RAM wLearnMoveMonName text " forgot" @@ -2721,7 +2722,7 @@ _CannotGetOffHereText:: prompt _GotMonText:: - text $52, " got" + text " got" line "@" TX_RAM wcd6d text "!@@" @@ -2818,7 +2819,7 @@ _ItemUseBallText06:: text "!@@" _SurfingGotOnText:: - text $52, " got on" + text " got on" line "@" TX_RAM wcd6d text "!" @@ -2843,12 +2844,12 @@ _VitaminNoEffectText:: prompt _ThrewBaitText:: - text $52, " threw" + text " threw" line "some BAIT." done _ThrewRockText:: - text $52, " threw a" + text " threw a" line "ROCK." done @@ -2866,13 +2867,13 @@ _FluteWokeUpText:: prompt _PlayedFluteHadEffectText:: - text $52, " played the" + text " played the" line "# FLUTE.@@" _CoinCaseNumCoinsText:: text "Coins" line "@" - TX_BCD wPlayerCoins, $c2 + TX_BCD wPlayerCoins, 2 | LEADING_ZEROES | LEFT_ALIGN text " " prompt @@ -2929,7 +2930,7 @@ _TeachMachineMoveText:: para "Teach @" TX_RAM wcf4b - db $0 + text "" line "to a #MON?" done @@ -2948,7 +2949,7 @@ _MonCannotLearnMachineMoveText:: prompt _ItemUseNotTimeText:: - text "OAK: ", $52, "!" + text "OAK: !" line "This isn't the" cont "time to use that! " prompt @@ -2994,7 +2995,7 @@ _BoxFullCannotThrowBallText:: SECTION "Text 11", ROMX, BANK[TEXT_11] _ItemUseText001:: - text $52," used@@" + text " used@@" _ItemUseText002:: TX_RAM wcf4b @@ -3002,7 +3003,7 @@ _ItemUseText002:: done _GotOnBicycleText1:: - text $52, " got on the@@" + text " got on the@@" _GotOnBicycleText2:: TX_RAM wcf4b @@ -3010,7 +3011,7 @@ _GotOnBicycleText2:: prompt _GotOffBicycleText1:: - text $52, " got off@@" + text " got off@@" _GotOffBicycleText2:: text "the @" @@ -3051,7 +3052,7 @@ _ConnectCableText:: prompt _TradedForText:: - text $52, " traded" + text " traded" line "@" TX_RAM wInGameTradeGiveMonName text " for" @@ -3103,7 +3104,7 @@ _WannaTrade2Text:: para "your @" TX_RAM wInGameTradeGiveMonName - db $0 + text "" line "for @" TX_RAM wInGameTradeReceiveMonName text "?" diff --git a/text/maps/bike_shop.asm b/text/maps/bike_shop.asm index 33f53ee9..86799865 100644 --- a/text/maps/bike_shop.asm +++ b/text/maps/bike_shop.asm @@ -25,7 +25,7 @@ _BikeShopText_1d81f:: prompt _BikeShopText_1d824:: - text $52, " exchanged" + text " exchanged" line "the BIKE VOUCHER" cont "for a BICYCLE.@@" diff --git a/text/maps/celadon_dept_store_3f.asm b/text/maps/celadon_dept_store_3f.asm index 1aad756f..8211750d 100644 --- a/text/maps/celadon_dept_store_3f.asm +++ b/text/maps/celadon_dept_store_3f.asm @@ -8,7 +8,7 @@ _TM18PreReceiveText:: prompt _ReceivedTM18Text:: - text $52, " received" + text " received" line "@" TX_RAM wcf4b text "!@@" diff --git a/text/maps/fan_club.asm b/text/maps/fan_club.asm index 7477405c..4827f2e8 100644 --- a/text/maps/fan_club.asm +++ b/text/maps/fan_club.asm @@ -83,13 +83,13 @@ FanClubChairStoryText:: prompt ReceivedBikeVoucherText:: - text $52, " received" + text " received" line "a @" TX_RAM wcf4b text "!@@" ExplainBikeVoucherText:: - db $0 + text "" para "Exchange that for" line "a BICYCLE!" @@ -111,7 +111,7 @@ FanClubNoStoryText:: done FanClubChairFinalText:: - text "Hello, ", $52, "!" + text "Hello, !" para "Did you come see" line "me about my" diff --git a/text/maps/hall_of_fame.asm b/text/maps/hall_of_fame.asm index 6c5dd40e..c799268b 100644 --- a/text/maps/hall_of_fame.asm +++ b/text/maps/hall_of_fame.asm @@ -1,7 +1,7 @@ _HallofFameRoomText1:: text "OAK: Er-hem!" line "Congratulations" - cont $52, "!" + cont "!" para "This floor is the" line "#MON HALL OF" @@ -16,13 +16,13 @@ _HallofFameRoomText1:: line "also recorded in" cont "the HALL OF FAME!" - para $52, "! You have" + para "! You have" line "endeavored hard" cont "to become the new" cont "LEAGUE champion!" para "Congratulations," - line $52, ", you and" + line ", you and" cont "your #MON are" cont "HALL OF FAMERs!" done diff --git a/text/maps/lance.asm b/text/maps/lance.asm index 3c75ce47..0313b158 100644 --- a/text/maps/lance.asm +++ b/text/maps/lance.asm @@ -1,6 +1,6 @@ _LanceBeforeBattleText:: text "Ah! I heard about" - line "you ", $52, "!" + line "you !" para "I lead the ELITE" line "FOUR! You can" diff --git a/text/maps/museum_1f.asm b/text/maps/museum_1f.asm index 46b4484c..16431bda 100644 --- a/text/maps/museum_1f.asm +++ b/text/maps/museum_1f.asm @@ -81,7 +81,7 @@ _Museum1FText_5c28e:: prompt _ReceivedOldAmberText:: - text $52, " received" + text " received" line "OLD AMBER!@@" _Museum1FText_5c299:: diff --git a/text/maps/oaks_lab.asm b/text/maps/oaks_lab.asm index 52af450d..1f02c355 100644 --- a/text/maps/oaks_lab.asm +++ b/text/maps/oaks_lab.asm @@ -1,11 +1,11 @@ _OaksLabGaryText1:: - text $53,": Yo" - line $52,"! Gramps" + text ": Yo" + line "! Gramps" cont "isn't around!" done _OaksLabText40:: - text $53,": Heh, I" + text ": Heh, I" line "don't need to be" cont "greedy like you!" @@ -14,7 +14,7 @@ _OaksLabText40:: done _OaksLabText41:: - text $53,": My" + text ": My" line "#MON looks a" cont "lot stronger." done @@ -60,7 +60,7 @@ _OaksLabLastMonText:: done _OaksLabText_1d2f0:: - text "OAK: Now, ", $52, "," + text "OAK: Now, ," line "which #MON do" cont "you want?" done @@ -73,14 +73,14 @@ _OaksLabText_1d2f5:: done _OaksLabText_1d2fa:: - text "OAK: ", $52, "," + text "OAK: ," line "raise your young" cont "#MON by making" cont "it fight!" done _OaksLabDeliverParcelText1:: - text "OAK: Oh, ", $52, "!" + text "OAK: Oh, !" para "How is my old" line "#MON?" @@ -95,11 +95,11 @@ _OaksLabDeliverParcelText1:: para "What? You have" line "something for me?" - para $52, " delivered" + para " delivered" line "OAK's PARCEL.@@" _OaksLabDeliverParcelText2:: - db $0 + text "" para "Ah! This is the" line "custom # BALL" cont "I ordered!" @@ -109,7 +109,7 @@ _OaksLabDeliverParcelText2:: _OaksLabAroundWorldText:: text "#MON around the" line "world wait for" - cont "you, ", $52, "!" + cont "you, !" done _OaksLabGivePokeballsText1:: @@ -123,11 +123,11 @@ _OaksLabGivePokeballsText1:: cont "to capture wild" cont "#MON." - para $52, " got 5" + para " got 5" line "# BALLs!@@" _OaksLabGivePokeballsText2:: - db $0 + text "" para "When a wild" line "#MON appears," cont "it's fair game." @@ -182,20 +182,20 @@ _OaksLabText_1d340:: done _OaksLabRivalWaitingText:: - text $53, ": Gramps!" + text ": Gramps!" line "I'm fed up with" cont "waiting!" done _OaksLabChooseMonText:: - text "OAK: ", $53, "?" + text "OAK: ?" line "Let me think..." para "Oh, that's right," line "I told you to" cont "come! Just wait!" - para "Here, ", $52, "!" + para "Here, !" para "There are 3" line "#MON here!" @@ -216,14 +216,14 @@ _OaksLabChooseMonText:: done _OaksLabRivalInterjectionText:: - text $53, ": Hey!" + text ": Hey!" line "Gramps! What" cont "about me?" done _OaksLabBePatientText:: text "OAK: Be patient!" - line $53, ", you can" + line ", you can" cont "have one too!" done @@ -233,19 +233,19 @@ _OaksLabLeavingText:: done _OaksLabRivalPickingMonText:: - text $53, ": I'll take" + text ": I'll take" line "this one, then!" done _OaksLabRivalReceivedMonText:: - text $53, " received" + text " received" line "a @" TX_RAM wcd6d text "!@@" _OaksLabRivalChallengeText:: - text $53, ": Wait" - line $52, "!" + text ": Wait" + line "!" cont "Let's check out" cont "our #MON!" @@ -261,26 +261,26 @@ _OaksLabText_1d3be:: prompt _OaksLabText_1d3c3:: - text $53, ": Yeah! Am" + text ": Yeah! Am" line "I great or what?" prompt _OaksLabRivalToughenUpText:: - text $53, ": Okay!" + text ": Okay!" line "I'll make my" cont "#MON fight to" cont "toughen it up!" - para $52, "! Gramps!" + para "! Gramps!" line "Smell you later!" done _OaksLabText21:: - text $53, ": Gramps!" + text ": Gramps!" done _OaksLabText22:: - text $53, ": What did" + text ": What did" line "you call me for?" done @@ -305,11 +305,11 @@ _OaksLabText24:: done _OaksLabText25:: - text "OAK: ", $52, " and" - line $53, "! Take" + text "OAK: and" + line "! Take" cont "these with you!" - para $52, " got" + para " got" line "#DEX from OAK!@@" _OaksLabText26:: @@ -336,11 +336,11 @@ _OaksLabText26:: done _OaksLabText27:: - text $53, ": Alright" + text ": Alright" line "Gramps! Leave it" cont "all to me!" - para $52, ", I hate to" + para ", I hate to" line "say it, but I" cont "don't need you!" @@ -350,7 +350,7 @@ _OaksLabText27:: para "I'll tell her not" line "to lend you one," - cont $52, "! Hahaha!" + cont "! Hahaha!" done _OaksLabText_1d405:: diff --git a/text/maps/reds_house_1f.asm b/text/maps/reds_house_1f.asm index 8b82f2de..07768af9 100644 --- a/text/maps/reds_house_1f.asm +++ b/text/maps/reds_house_1f.asm @@ -10,7 +10,7 @@ _MomWakeUpText:: done _MomHealText1:: - text "MOM: ",$52,"!" + text "MOM: !" line "You should take a" cont "quick rest." prompt diff --git a/text/maps/route_22.asm b/text/maps/route_22.asm index f2d7ae96..ac4141eb 100644 --- a/text/maps/route_22.asm +++ b/text/maps/route_22.asm @@ -60,7 +60,7 @@ _Route22RivalBeforeBattleText2:: cont "That's cool!" para "Then I'll whip you" - line $52, " as a" + line " as a" cont "warm up for" cont "#MON LEAGUE!" @@ -88,8 +88,8 @@ _Route22RivalDefeatedText2:: prompt _Route22Text_511d0:: - text $53, ": Hahaha!" - line $52, "! That's" + text ": Hahaha!" + line "! That's" cont "your best? You're" cont "nowhere near as" cont "good as me, pal!" diff --git a/text/maps/silph_co_11f.asm b/text/maps/silph_co_11f.asm index 7fccab4f..8e7a3848 100644 --- a/text/maps/silph_co_11f.asm +++ b/text/maps/silph_co_11f.asm @@ -58,7 +58,7 @@ _SilphCo11Text2:: done _SilphCo11Text3:: - text "Ah ", $52, "!" + text "Ah !" line "So we meet again!" para "The PRESIDENT and" diff --git a/text/maps/vermilion_city.asm b/text/maps/vermilion_city.asm index ff90cbef..b060a123 100644 --- a/text/maps/vermilion_city.asm +++ b/text/maps/vermilion_city.asm @@ -35,7 +35,7 @@ _SSAnneWelcomeText9:: prompt _SSAnneFlashedTicketText:: - text $52, " flashed" + text " flashed" line "the S.S.TICKET!" para "Great! Welcome to" @@ -43,7 +43,7 @@ _SSAnneFlashedTicketText:: done _SSAnneNoTicketText:: - text $52, " doesn't" + text " doesn't" line "have the needed" cont "S.S.TICKET." @@ -71,7 +71,7 @@ _VermilionCityText5:: line "Gogogoh!@@" _VermilionCityText14:: - db $0 + text "" para "A MACHOP is" line "stomping the land" cont "flat." diff --git a/text/oakspeech.asm b/text/oakspeech.asm index 91aaf5c3..5911092c 100644 --- a/text/oakspeech.asm +++ b/text/oakspeech.asm @@ -53,4 +53,3 @@ _OakSpeechText3:: cont "with #MON" cont "awaits! Let's go!" done - -- cgit v1.2.3 From 3ab3f4273b1288883a43b64cae4191dfa6d2313e Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Sun, 12 Jun 2016 11:35:21 -0700 Subject: sync home --- home.asm | 126 ++++++++++++++++++++++++++--------------------------- home/fade.asm | 2 +- home/overworld.asm | 105 ++++++++++++++++++++++++++------------------ home/pic.asm | 4 +- home/serial.asm | 40 ++++++++--------- home/vblank.asm | 2 +- home/vcopy.asm | 2 +- 7 files changed, 150 insertions(+), 131 deletions(-) diff --git a/home.asm b/home.asm index 8d3c7207..bce51e4f 100644 --- a/home.asm +++ b/home.asm @@ -117,7 +117,6 @@ INCLUDE "home/joypad.asm" INCLUDE "data/map_header_pointers.asm" INCLUDE "home/overworld.asm" - CheckForUserInterruption:: ; Return carry if Up+Select+B, Start or A are pressed in c frames. ; Used only in the intro and title screen. @@ -255,7 +254,6 @@ DrawHPBar:: LoadMonData:: jpab LoadMonData_ - OverwritewMoves:: ; Write c to [wMoves + b]. Unused. ld hl, wMoves @@ -327,7 +325,7 @@ GetCryData:: add hl, bc add hl, bc - ld a, Bank(CryData) + ld a, BANK(CryData) call BankswitchHome ld a, [hli] ld b, a ; cry id @@ -347,7 +345,6 @@ GetCryData:: add c ret - DisplayPartyMenu:: ld a,[hTilesetType] push af @@ -497,6 +494,7 @@ PrintStatusCondition:: ld [hl],"T" and a ret + PrintStatusConditionNotFainted: ld a,[H_LOADEDROMBANK] push af @@ -519,7 +517,7 @@ PrintLevel:: ld [hli],a ld c,2 ; number of digits ld a,[wLoadedMonLevel] ; level - cp a,100 + cp 100 jr c,PrintLevelCommon ; if level at least 100, write over the ":L" tile dec hl @@ -569,25 +567,25 @@ GetMonHeader:: ld [wd11e],a ld de,FossilKabutopsPic ld b,$66 ; size of Kabutops fossil and Ghost sprites - cp a,FOSSIL_KABUTOPS ; Kabutops fossil + cp FOSSIL_KABUTOPS ; Kabutops fossil jr z,.specialID ld de,GhostPic - cp a,MON_GHOST ; Ghost + cp MON_GHOST ; Ghost jr z,.specialID ld de,FossilAerodactylPic ld b,$77 ; size of Aerodactyl fossil sprite - cp a,FOSSIL_AERODACTYL ; Aerodactyl fossil + cp FOSSIL_AERODACTYL ; Aerodactyl fossil jr z,.specialID cp a,MEW jr z,.mew predef IndexToPokedex ; convert pokemon ID in [wd11e] to pokedex number ld a,[wd11e] dec a - ld bc,MonBaseStatsEnd - MonBaseStats + ld bc, MonBaseStatsEnd - MonBaseStats ld hl,BaseStats call AddNTimes ld de,wMonHeader - ld bc,MonBaseStatsEnd - MonBaseStats + ld bc, MonBaseStatsEnd - MonBaseStats call CopyData jr .done .specialID @@ -703,7 +701,7 @@ PrintBCDDigit:: .skipCurrencySymbol res 7,b ; unset 7 to indicate that a nonzero digit has been reached .outputDigit - add a,"0" + add "0" ld [hli],a jp PrintLetterDelay .zeroDigit @@ -968,7 +966,6 @@ PokeCenterSignText:: db "@" PickUpItemText:: -; XXX better label (what does predef $5C do?) TX_ASM predef PickUpItem jp TextScriptEnd @@ -1000,15 +997,15 @@ ResetPlayerSpriteData_ClearSpriteData:: FadeOutAudio:: ld a, [wAudioFadeOutControl] - and a - jr nz, .asm_28dc + and a ; currently fading out audio? + jr nz, .fadingOut ld a, [wd72c] bit 1, a ret nz ld a, $77 ld [rNR50], a ret -.asm_28dc +.fadingOut ld a, [wAudioFadeOutCounter] and a jr z, .counterReachedZero @@ -1019,8 +1016,8 @@ FadeOutAudio:: ld a, [wAudioFadeOutCounterReloadValue] ld [wAudioFadeOutCounter], a ld a, [rNR50] - and a - jr z, .asm_2903 + and a ; has the volume reached 0? + jr z, .fadeOutComplete ld b, a and $f dec a @@ -1033,7 +1030,7 @@ FadeOutAudio:: or c ld [rNR50], a ret -.asm_2903 +.fadeOutComplete ld a, [wAudioFadeOutControl] ld b, a xor a @@ -1071,13 +1068,13 @@ DisplayTextID:: ld [wSpriteIndex],a and a jp z,DisplayStartMenu - cp a,TEXT_SAFARI_GAME_OVER + cp TEXT_SAFARI_GAME_OVER jp z,DisplaySafariGameOverText - cp a,TEXT_MON_FAINTED + cp TEXT_MON_FAINTED jp z,DisplayPokemonFaintedText - cp a,TEXT_BLACKED_OUT + cp TEXT_BLACKED_OUT jp z,DisplayPlayerBlackedOutText - cp a,TEXT_REPEL_WORE_OFF + cp TEXT_REPEL_WORE_OFF jp z,DisplayRepelWoreOffText ld a,[wNumSprites] ld e,a @@ -1116,24 +1113,24 @@ DisplayTextID:: ld l,a ; hl = address of the text ld a,[hl] ; a = first byte of text ; check first byte of text for special cases - cp a,$fe ; Pokemart NPC + cp $fe ; Pokemart NPC jp z,DisplayPokemartDialogue - cp a,$ff ; Pokemon Center NPC + cp $ff ; Pokemon Center NPC jp z,DisplayPokemonCenterDialogue - cp a,$fc ; Item Storage PC + cp $fc ; Item Storage PC jp z,FuncTX_ItemStoragePC - cp a,$fd ; Bill's PC + cp $fd ; Bill's PC jp z,FuncTX_BillsPC - cp a,$f9 ; Pokemon Center PC + cp $f9 ; Pokemon Center PC jp z,FuncTX_PokemonCenterPC - cp a,$f5 ; Vending Machine + cp $f5 ; Vending Machine jr nz,.notVendingMachine callba VendingMachineMenu ; jump banks to vending machine routine jr AfterDisplayingTextID .notVendingMachine - cp a,$f7 ; slot machine - jp z,FuncTX_SlotMachine - cp a,$f6 ; cable connection NPC in Pokemon Center + cp $f7 ; prize menu + jp z, FuncTX_GameCornerPrizeMenu + cp $f6 ; cable connection NPC in Pokemon Center jr nz,.notSpecialCase callab CableClubNPC jr AfterDisplayingTextID @@ -1228,7 +1225,7 @@ LoadItemList:: ld a,[hli] ld [de],a inc de - cp a,$ff + cp $ff jr nz,.loop ret @@ -1382,7 +1379,7 @@ DisplayListMenuID:: ld a,$01 ; hardcoded bank jr .bankswitch .specialBattleType ; Old Man battle - ld a, Bank(DisplayBattleMenu) + ld a, BANK(DisplayBattleMenu) .bankswitch call BankswitchHome ld hl,wd730 @@ -1411,7 +1408,7 @@ DisplayListMenuID:: ld a,1 ; max menu item ID is 1 if the list has less than 2 entries ld [wMenuWatchMovingOutOfBounds],a ld a,[wListCount] - cp a,2 ; does the list have less than 2 entries? + cp 2 ; does the list have less than 2 entries? jr c,.setMenuVariables ld a,2 ; max menu item ID is 2 if the list has at least 2 entries .setMenuVariables @@ -1481,7 +1478,7 @@ DisplayListMenuIDLoop:: ld a,c ld [wWhichPokemon],a ld a,[wListMenuID] - cp a,ITEMLISTMENU + cp ITEMLISTMENU jr nz,.skipMultiplying ; if it's an item menu sla c ; item entries are 2 bytes long, so multiply by 2 @@ -1502,7 +1499,7 @@ DisplayListMenuIDLoop:: call GetItemPrice pop hl ld a,[wListMenuID] - cp a,ITEMLISTMENU + cp ITEMLISTMENU jr nz,.skipGettingQuantity ; if it's an item menu inc hl @@ -1548,7 +1545,7 @@ DisplayListMenuIDLoop:: jr z,.upPressed .downPressed ld a,[hl] - add a,3 + add 3 ld b,a ld a,[wListCount] cp b ; will going down scroll past the Cancel button? @@ -1568,7 +1565,7 @@ DisplayChooseQuantityMenu:: ld b,1 ; height ld c,3 ; width ld a,[wListMenuID] - cp a,PRICEDITEMLISTMENU + cp PRICEDITEMLISTMENU jr nz,.drawTextBox ; text box dimensions/coordinates for quantity and price coord hl, 7, 9 @@ -1578,7 +1575,7 @@ DisplayChooseQuantityMenu:: call TextBoxBorder coord hl, 16, 10 ld a,[wListMenuID] - cp a,PRICEDITEMLISTMENU + cp PRICEDITEMLISTMENU jr nz,.printInitialQuantity coord hl, 8, 10 .printInitialQuantity @@ -1622,7 +1619,7 @@ DisplayChooseQuantityMenu:: .handleNewQuantity coord hl, 17, 10 ld a,[wListMenuID] - cp a,PRICEDITEMLISTMENU + cp PRICEDITEMLISTMENU jr nz,.printQuantity .printPrice ld c,$03 @@ -1716,7 +1713,7 @@ PrintListMenuEntries:: ld a,[wListScrollOffset] ld c,a ld a,[wListMenuID] - cp a,ITEMLISTMENU + cp ITEMLISTMENU ld a,c jr nz,.skipMultiplying ; if it's an item menu @@ -1736,7 +1733,7 @@ PrintListMenuEntries:: ld [wWhichPokemon],a ld a,[de] ld [wd11e],a - cp a,$ff + cp $ff jp z,.printCancelMenuItem push bc push de @@ -1746,7 +1743,7 @@ PrintListMenuEntries:: ld a,[wListMenuID] and a jr z,.pokemonPCMenu - cp a,$01 + cp MOVESLISTMENU jr z,.movesMenu .itemMenu call GetItemName @@ -1834,7 +1831,7 @@ PrintListMenuEntries:: pop de inc de ld a,[wListMenuID] - cp a,ITEMLISTMENU + cp ITEMLISTMENU jr nz,.nextListEntry .printItemQuantity ld a,[wd11e] @@ -1991,7 +1988,6 @@ GetMachineName:: inc de ld a,"@" ld [de],a - pop af ld [wd11e],a pop bc @@ -2007,9 +2003,9 @@ HiddenPrefix:: ; sets carry if item is HM, clears carry if item is not HM ; Input: a = item ID IsItemHM:: - cp a,HM_01 + cp HM_01 jr c,.notHM - cp a,TM_01 + cp TM_01 ret .notHM and a @@ -2189,6 +2185,7 @@ RunNPCMovementScript:: ld [H_LOADEDROMBANK], a ld [MBC1RomBank], a ret + .NPCMovementScriptPointerTables dw PalletMovementScriptPointerTable dw PewterMuseumGuyMovementScriptPointerTable @@ -2679,7 +2676,7 @@ FuncTX_BillsPC:: ld hl, BillsPC_ jr bankswitchAndContinue -FuncTX_SlotMachine:: +FuncTX_GameCornerPrizeMenu:: ; XXX find a better name for this function ; special_F7 ld b,BANK(CeladonPrizeMenu) @@ -2752,7 +2749,7 @@ CheckCoords:: ld [wCoordIndex],a .loop ld a,[hli] - cp a,$ff ; reached terminator? + cp $ff ; reached terminator? jr z,.notInArray push hl ld hl,wCoordIndex @@ -2871,7 +2868,7 @@ GetSpriteMovementByte1Pointer:: ld h,$C2 ld a,[H_SPRITEINDEX] swap a - add a,6 + add 6 ld l,a ret @@ -2924,7 +2921,6 @@ GetTrainerInformation:: GetTrainerName:: jpba GetTrainerName_ - HasEnoughMoney:: ; Check if the player has at least as much ; money as the 3-byte BCD value at hMoney. @@ -3006,12 +3002,13 @@ YesNoChoicePokeCenter:: lb bc, 8, 12 jr DisplayYesNoChoice -Func_361a:: +WideYesNoChoice:: ; unused call SaveScreenTilesToBuffer1 ld a, WIDE_YES_NO_MENU ld [wTwoOptionMenuID], a coord hl, 12, 7 lb bc, 8, 13 + DisplayYesNoChoice:: ld a, TWO_OPTION_MENU ld [wTextBoxID], a @@ -3045,7 +3042,7 @@ MoveSprite_:: ld [hli],a inc de inc c - cp a,$FF ; have we reached the end of the movement data? + cp $FF ; have we reached the end of the movement data? jr nz,.loop ld a,c @@ -3066,7 +3063,7 @@ MoveSprite_:: ; divides [hDividend2] by [hDivisor2] and stores the quotient in [hQuotient2] DivideBytes:: push hl - ld hl, $ffe7 + ld hl, hQuotient2 xor a ld [hld], a ld a, [hld] @@ -3157,7 +3154,6 @@ UncompressSpriteFromDE:: ld [hl], d jp UncompressSpriteData - SaveScreenTilesToBuffer2:: coord hl, 0, 0 ld de, wTileMapBackup2 @@ -3199,7 +3195,7 @@ LoadScreenTilesFromBuffer1:: ret DelayFrames:: -; wait n frames, where n is the value in c +; wait c frames call DelayFrame dec c jr nz,DelayFrames @@ -3300,7 +3296,7 @@ GetName:: ld e,l .nextChar ld a,[hli] - cp a, "@" + cp "@" jr nz,.nextChar inc c ;entry counter ld a,b ;wanted entry @@ -3332,9 +3328,9 @@ GetItemPrice:: ld a, [wListMenuID] cp MOVESLISTMENU ld a, BANK(ItemPrices) - jr nz, .asm_37ed + jr nz, .ok ld a, $f ; hardcoded Bank -.asm_37ed +.ok ld [H_LOADEDROMBANK], a ld [MBC1RomBank], a ld hl, wItemPrices @@ -3345,10 +3341,10 @@ GetItemPrice:: cp HM_01 jr nc, .getTMPrice ld bc, $3 -.asm_3802 +.loop add hl, bc dec a - jr nz, .asm_3802 + jr nz, .loop dec hl ld a, [hld] ld [hItemPrice + 2], a @@ -3356,13 +3352,13 @@ GetItemPrice:: ld [hItemPrice + 1], a ld a, [hl] ld [hItemPrice], a - jr .asm_381c + jr .done .getTMPrice ld a, Bank(GetMachinePrice) ld [H_LOADEDROMBANK], a ld [MBC1RomBank], a call GetMachinePrice -.asm_381c +.done ld de, hItemPrice pop af ld [H_LOADEDROMBANK], a @@ -4075,7 +4071,7 @@ PlaceMenuCursor:: jr nz,.currentMenuItemLoop .checkForArrow2 ld a,[hl] - cp a,"▶" ; has the right arrow already been placed? + cp "▶" ; has the right arrow already been placed? jr z,.skipSavingTile ; if so, don't lose the saved tile ld [wTileBehindCursor],a ; save tile before overwriting with right arrow .skipSavingTile @@ -4656,6 +4652,8 @@ SetMapTextPointer:: ret TextPredefs:: +const_value = 1 + add_tx_pre CardKeySuccessText ; 01 add_tx_pre CardKeyFailText ; 02 add_tx_pre RedBedroomPCText ; 03 diff --git a/home/fade.asm b/home/fade.asm index 08e087b4..9482fcb0 100644 --- a/home/fade.asm +++ b/home/fade.asm @@ -1,7 +1,7 @@ ; These routines manage gradual fading ; (e.g., entering a doorway) LoadGBPal:: - ld a, [wMapPalOffset] ;tells if cur.map is dark (requires HM5_FLASH?) + ld a, [wMapPalOffset] ;tells if wCurMap is dark (requires HM5_FLASH?) ld b, a ld hl, FadePal4 ld a, l diff --git a/home/overworld.asm b/home/overworld.asm index 8ec457c1..f71bb68a 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -59,7 +59,7 @@ OverworldLoopLessDelay:: res 3,[hl] jp nz,WarpFound2 ld a,[wd732] - and a,1 << 4 | 1 << 3 ; fly warp or dungeon warp + and 1 << 4 | 1 << 3 ; fly warp or dungeon warp jp nz,HandleFlyWarpOrDungeonWarp ld a,[wCurOpponent] and a @@ -133,7 +133,7 @@ OverworldLoopLessDelay:: ld hl,wFlags_0xcd60 res 2,[hl] call UpdateSprites - ld a,1 + ld a, 1 ld [wCheckFor180DegreeTurn],a ld a,[wPlayerMovingDirection] ; the direction that was pressed last time and a @@ -143,6 +143,7 @@ OverworldLoopLessDelay:: xor a ld [wPlayerMovingDirection],a ; zero the direction jp OverworldLoop + .checkIfDownButtonIsPressed ld a,[hJoyHeld] ; current joypad state bit 7,a ; down button @@ -151,6 +152,7 @@ OverworldLoopLessDelay:: ld [wSpriteStateData1 + 3],a ; delta Y ld a,PLAYER_DIR_DOWN jr .handleDirectionButtonPress + .checkIfUpButtonIsPressed bit 6,a ; up button jr z,.checkIfLeftButtonIsPressed @@ -158,6 +160,7 @@ OverworldLoopLessDelay:: ld [wSpriteStateData1 + 3],a ; delta Y ld a,PLAYER_DIR_UP jr .handleDirectionButtonPress + .checkIfLeftButtonIsPressed bit 5,a ; left button jr z,.checkIfRightButtonIsPressed @@ -165,11 +168,14 @@ OverworldLoopLessDelay:: ld [wSpriteStateData1 + 5],a ; delta X ld a,PLAYER_DIR_LEFT jr .handleDirectionButtonPress + .checkIfRightButtonIsPressed bit 4,a ; right button jr z,.noDirectionButtonsPressed - ld a,1 ; PLAYER_DIR_RIGHT + ld a, 1 ld [wSpriteStateData1 + 5],a ; delta X + + .handleDirectionButtonPress ld [wPlayerDirection],a ; new direction ld a,[wd730] @@ -226,12 +232,13 @@ OverworldLoopLessDelay:: call NewBattle jp c,.battleOccurred jp OverworldLoop + .noDirectionChange ld a,[wPlayerDirection] ; current direction ld [wPlayerMovingDirection],a ; save direction call UpdateSprites ld a,[wWalkBikeSurfState] - cp a,$02 ; surfing + cp $02 ; surfing jr z,.surfing ; not surfing call CollisionCheckOnLand @@ -248,20 +255,24 @@ OverworldLoopLessDelay:: pop hl jp c,CheckWarpsCollision jp OverworldLoop + .surfing call CollisionCheckOnWater jp c,OverworldLoop + .noCollision ld a,$08 ld [wWalkCounter],a jr .moveAhead2 + .moveAhead ld a,[wd736] bit 7,a jr z,.noSpinning - callba LoadSpinnerArrowTiles ; spin while moving + callba LoadSpinnerArrowTiles .noSpinning call UpdateSprites + .moveAhead2 ld hl,wFlags_0xcd60 res 2,[hl] @@ -271,7 +282,7 @@ OverworldLoopLessDelay:: ld a,[wd736] bit 6,a ; jumping a ledge? jr nz,.normalPlayerSpriteAdvancement - call BikeSpeedup ; if riding a bike and not jumping a ledge + call DoBikeSpeedup .normalPlayerSpriteAdvancement call AdvancePlayerSprite ld a,[wWalkCounter] @@ -323,14 +334,14 @@ OverworldLoopLessDelay:: xor a ld [hJoyHeld],a ld a,[wCurMap] - cp a,CINNABAR_GYM + cp CINNABAR_GYM jr nz,.notCinnabarGym SetEvent EVENT_2A7 .notCinnabarGym ld hl,wd72e set 5,[hl] ld a,[wCurMap] - cp a,OAKS_LAB + cp OAKS_LAB jp z,.noFaintCheck ; no blacking out if the player lost to the rival in Oak's lab callab AnyPartyAlive ld a,d @@ -363,15 +374,15 @@ NewBattle:: ret ; function to make bikes twice as fast as walking -BikeSpeedup:: +DoBikeSpeedup:: ld a,[wNPCMovementScriptPointerTableNum] and a ret nz ld a,[wCurMap] - cp a,ROUTE_17 ; Cycling Road + cp ROUTE_17 ; Cycling Road jr nz,.goFaster ld a,[hJoyHeld] - and a,D_UP | D_LEFT | D_RIGHT + and D_UP | D_LEFT | D_RIGHT ret nz .goFaster jp AdvancePlayerSprite @@ -421,7 +432,7 @@ CheckWarpsNoCollisionLoop:: pop bc pop de ld a,[hJoyHeld] - and a,D_DOWN | D_UP | D_LEFT | D_RIGHT + and D_DOWN | D_UP | D_LEFT | D_RIGHT jr z,CheckWarpsNoCollisionRetry2 ; if directional buttons aren't being pressed, do not pass through the warp jr WarpFound1 @@ -483,7 +494,7 @@ WarpFound2:: ld [wUnusedD366],a ; not read ld a,[hWarpDestinationMap] ld [wCurMap],a - cp a,ROCK_TUNNEL_1 + cp ROCK_TUNNEL_1 jr nz,.notRockTunnel ld a,$06 ld [wMapPalOffset],a @@ -491,10 +502,12 @@ WarpFound2:: .notRockTunnel call PlayMapChangeSound jr .done -; for maps that can have the 0xFF destination map, which means to return to the outside map; not all these maps are necessarily indoors, though + +; for maps that can have the 0xFF destination map, which means to return to the outside map +; not all these maps are necessarily indoors, though .indoorMaps ld a,[hWarpDestinationMap] ; destination map - cp a,$ff + cp $ff jr z,.goBackOutside ; if not going back to the previous map ld [wCurMap],a @@ -535,7 +548,7 @@ ContinueCheckWarpsNoCollisionLoop:: CheckMapConnections:: .checkWestMap ld a,[wXCoord] - cp a,$ff + cp $ff jr nz,.checkEastMap ld a,[wMapConn3Ptr] ld [wCurMap],a @@ -555,7 +568,7 @@ CheckMapConnections:: jr z,.savePointer1 .pointerAdjustmentLoop1 ld a,[wWestConnectedMapWidth] ; width of connected map - add a,MAP_BORDER * 2 + add MAP_BORDER * 2 ld e,a ld d,0 ld b,0 @@ -568,6 +581,7 @@ CheckMapConnections:: ld a,h ld [wCurrentTileBlockMapViewPointer + 1],a jp .loadNewMap + .checkEastMap ld b,a ld a,[wCurrentMapWidth2] ; map width @@ -591,7 +605,7 @@ CheckMapConnections:: jr z,.savePointer2 .pointerAdjustmentLoop2 ld a,[wEastConnectedMapWidth] - add a,MAP_BORDER * 2 + add MAP_BORDER * 2 ld e,a ld d,0 ld b,0 @@ -604,9 +618,10 @@ CheckMapConnections:: ld a,h ld [wCurrentTileBlockMapViewPointer + 1],a jp .loadNewMap + .checkNorthMap ld a,[wYCoord] - cp a,$ff + cp $ff jr nz,.checkSouthMap ld a,[wMapConn1Ptr] ld [wCurMap],a @@ -630,6 +645,7 @@ CheckMapConnections:: ld a,h ld [wCurrentTileBlockMapViewPointer + 1],a jp .loadNewMap + .checkSouthMap ld b,a ld a,[wCurrentMapHeight2] @@ -666,13 +682,14 @@ CheckMapConnections:: callba InitMapSprites call LoadTileBlockMap jp OverworldLoopLessDelay + .didNotEnterConnectedMap jp OverworldLoop ; function to play a sound when changing maps PlayMapChangeSound:: aCoord 8, 8 ; upper left tile of the 4x4 square the player's sprite is standing on - cp a,$0b ; door tile in tileset 0 + cp $0b ; door tile in tileset 0 jr nz,.didNotGoThroughDoor ld a,SFX_GO_INSIDE jr .playSound @@ -883,7 +900,7 @@ LoadTileBlockMap:: ld hl,wOverworldMap ld a,[wCurMapWidth] ld [hMapWidth],a - add a,MAP_BORDER * 2 ; east and west + add MAP_BORDER * 2 ; east and west ld [hMapStride],a ; map width + border ld b,0 ld c,a @@ -921,7 +938,7 @@ LoadTileBlockMap:: jr nz,.rowLoop .northConnection ld a,[wMapConn1Ptr] - cp a,$ff + cp $ff jr z,.southConnection call SwitchToMapRomBank ld a,[wNorthConnectionStripSrc] @@ -939,7 +956,7 @@ LoadTileBlockMap:: call LoadNorthSouthConnectionsTileMap .southConnection ld a,[wMapConn2Ptr] - cp a,$ff + cp $ff jr z,.westConnection call SwitchToMapRomBank ld a,[wSouthConnectionStripSrc] @@ -957,7 +974,7 @@ LoadTileBlockMap:: call LoadNorthSouthConnectionsTileMap .westConnection ld a,[wMapConn3Ptr] - cp a,$ff + cp $ff jr z,.eastConnection call SwitchToMapRomBank ld a,[wWestConnectionStripSrc] @@ -975,7 +992,7 @@ LoadTileBlockMap:: call LoadEastWestConnectionsTileMap .eastConnection ld a,[wMapConn4Ptr] - cp a,$ff + cp $ff jr z,.done call SwitchToMapRomBank ld a,[wEastConnectionStripSrc] @@ -1016,7 +1033,7 @@ LoadNorthSouthConnectionsTileMap:: inc h .noCarry1 ld a,[wCurMapWidth] - add a,MAP_BORDER * 2 + add MAP_BORDER * 2 add e ld e,a jr nc,.noCarry2 @@ -1045,7 +1062,7 @@ LoadEastWestConnectionsTileMap:: inc h .noCarry1 ld a,[wCurMapWidth] - add a,MAP_BORDER * 2 + add MAP_BORDER * 2 add e ld e,a jr nc,.noCarry2 @@ -1126,6 +1143,7 @@ IsSpriteInFrontOfPlayer2:: ld b,a ld a,PLAYER_DIR_UP jr .doneCheckingDirection + .checkIfPlayerFacingDown cp SPRITE_FACING_DOWN jr nz,.checkIfPlayerFacingRight @@ -1135,6 +1153,7 @@ IsSpriteInFrontOfPlayer2:: ld b,a ld a,PLAYER_DIR_DOWN jr .doneCheckingDirection + .checkIfPlayerFacingRight cp SPRITE_FACING_RIGHT jr nz,.playerFacingLeft @@ -1144,6 +1163,7 @@ IsSpriteInFrontOfPlayer2:: ld c,a ld a,PLAYER_DIR_RIGHT jr .doneCheckingDirection + .playerFacingLeft ; facing left ld a,c @@ -1225,7 +1245,7 @@ CollisionCheckOnLand:: jr nc,.noCollision .collision ld a,[wChannelSoundIDs + CH4] - cp a,SFX_COLLISION ; check if collision sound is already playing + cp SFX_COLLISION ; check if collision sound is already playing jr z,.setCarry ld a,SFX_COLLISION call PlaySound ; play collision sound (if it's not already playing) @@ -1287,7 +1307,7 @@ CheckForTilePairCollisions:: ld a,[wCurMapTileset] ; tileset number ld b,a ld a,[hli] - cp a,$ff + cp $ff jr z,.noMatch cp b jr z,.tilesetMatches @@ -1387,7 +1407,7 @@ LoadCurrentMapView:: ; update tile block map pointer to next row's address pop de ld a,[wCurMapWidth] - add a,MAP_BORDER * 2 + add MAP_BORDER * 2 add e ld e,a jr nc,.noCarry @@ -1722,8 +1742,8 @@ ScheduleSouthRowRedraw:: ld bc,$0200 add hl,bc ld a,h - and a,$03 - or a,$98 + and $03 + or $98 ld [hRedrawRowOrColumnDest + 1],a ld a,l ld [hRedrawRowOrColumnDest],a @@ -1736,11 +1756,11 @@ ScheduleEastColumnRedraw:: call ScheduleColumnRedrawHelper ld a,[wMapViewVRAMPointer] ld c,a - and a,$e0 + and $e0 ld b,a ld a,c - add a,18 - and a,$1f + add 18 + and $1f or b ld [hRedrawRowOrColumnDest],a ld a,[wMapViewVRAMPointer + 1] @@ -1791,10 +1811,10 @@ DrawTileBlock:: ld a,c swap a ld b,a - and a,$f0 + and $f0 ld c,a ld a,b - and a,$0f + and $0f ld b,a ; bc = tile block ID * 0x10 add hl,bc ld d,h @@ -1833,10 +1853,10 @@ JoypadOverworld:: bit 3,a ; check if a trainer wants a challenge jr nz,.notForcedDownwards ld a,[wCurMap] - cp a,ROUTE_17 ; Cycling Road + cp ROUTE_17 ; Cycling Road jr nz,.notForcedDownwards ld a,[hJoyHeld] - and a,D_DOWN | D_UP | D_LEFT | D_RIGHT | B_BUTTON | A_BUTTON + and D_DOWN | D_UP | D_LEFT | D_RIGHT | B_BUTTON | A_BUTTON jr nz,.notForcedDownwards ld a,D_DOWN ld [hJoyHeld],a ; on the cycling road, if there isn't a trainer and the player isn't pressing buttons, simulate a down press @@ -1868,6 +1888,7 @@ JoypadOverworld:: ld [hJoyPressed],a ld [hJoyReleased],a ret + ; if done simulating button presses .doneSimulating xor a @@ -1878,7 +1899,7 @@ JoypadOverworld:: ld [hJoyHeld],a ld hl,wd736 ld a,[hl] - and a,$f8 + and $f8 ld [hl],a ld hl,wd730 res 7,[hl] @@ -1928,7 +1949,7 @@ CollisionCheckOnWater:: jr .loop .collision ld a,[wChannelSoundIDs + CH4] - cp a,SFX_COLLISION ; check if collision sound is already playing + cp SFX_COLLISION ; check if collision sound is already playing jr z,.setCarry ld a,SFX_COLLISION call PlaySound ; play collision sound (if it's not already playing) @@ -2386,7 +2407,7 @@ IgnoreInputForHalfSecond: ld [wIgnoreInputCounter], a ld hl, wd730 ld a, [hl] - or $26 + or %00100110 ld [hl], a ; set ignore input bit ret diff --git a/home/pic.asm b/home/pic.asm index 15ee53ad..444a9f05 100644 --- a/home/pic.asm +++ b/home/pic.asm @@ -531,9 +531,9 @@ ReverseNybble:: ld de, NybbleReverseTable add e ld e, a - jr nc, .asm_283f + jr nc, .noCarry inc d -.asm_283f +.noCarry ld a, [de] ret diff --git a/home/serial.asm b/home/serial.asm index 7a515118..6c412239 100644 --- a/home/serial.asm +++ b/home/serial.asm @@ -91,79 +91,79 @@ Serial_ExchangeByte:: ld [hSerialReceivedNewData], a ld a, [hSerialConnectionStatus] cp USING_INTERNAL_CLOCK - jr nz, .asm_21a7 + jr nz, .loop ld a, START_TRANSFER_INTERNAL_CLOCK ld [rSC], a -.asm_21a7 +.loop ld a, [hSerialReceivedNewData] and a - jr nz, .asm_21f1 + jr nz, .ok ld a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK - jr nz, .asm_21cc + jr nz, .doNotIncrementUnknownCounter call IsUnknownCounterZero - jr z, .asm_21cc + jr z, .doNotIncrementUnknownCounter call WaitLoop_15Iterations push hl ld hl, wUnknownSerialCounter + 1 inc [hl] - jr nz, .asm_21c3 + jr nz, .noCarry dec hl inc [hl] -.asm_21c3 +.noCarry pop hl call IsUnknownCounterZero - jr nz, .asm_21a7 + jr nz, .loop jp SetUnknownCounterToFFFF -.asm_21cc +.doNotIncrementUnknownCounter ld a, [rIE] and (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK) cp (1 << SERIAL) - jr nz, .asm_21a7 + jr nz, .loop ld a, [wUnknownSerialCounter2] dec a ld [wUnknownSerialCounter2], a - jr nz, .asm_21a7 + jr nz, .loop ld a, [wUnknownSerialCounter2 + 1] dec a ld [wUnknownSerialCounter2 + 1], a - jr nz, .asm_21a7 + jr nz, .loop ld a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK - jr z, .asm_21f1 + jr z, .ok ld a, 255 .waitLoop dec a jr nz, .waitLoop -.asm_21f1 +.ok xor a ld [hSerialReceivedNewData], a ld a, [rIE] and (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK) sub (1 << SERIAL) - jr nz, .asm_2204 + jr nz, .skipReloadingUnknownCounter2 ld [wUnknownSerialCounter2], a ld a, $50 ld [wUnknownSerialCounter2 + 1], a -.asm_2204 +.skipReloadingUnknownCounter2 ld a, [hSerialReceiveData] cp SERIAL_NO_DATA_BYTE ret nz call IsUnknownCounterZero - jr z, .asm_221f + jr z, .done push hl ld hl, wUnknownSerialCounter + 1 ld a, [hl] dec a ld [hld], a inc a - jr nz, .asm_2219 + jr nz, .noBorrow dec [hl] -.asm_2219 +.noBorrow pop hl call IsUnknownCounterZero jr z, SetUnknownCounterToFFFF -.asm_221f +.done ld a, [rIE] and (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK) cp (1 << SERIAL) diff --git a/home/vblank.asm b/home/vblank.asm index f69d4a86..e80fba75 100644 --- a/home/vblank.asm +++ b/home/vblank.asm @@ -27,7 +27,7 @@ VBlank:: call VBlankCopyDouble call UpdateMovingBgTiles call $ff80 ; hOAMDMA - ld a, Bank(PrepareOAMData) + ld a, BANK(PrepareOAMData) ld [H_LOADEDROMBANK], a ld [MBC1RomBank], a call PrepareOAMData diff --git a/home/vcopy.asm b/home/vcopy.asm index b7fb099e..3fe19745 100644 --- a/home/vcopy.asm +++ b/home/vcopy.asm @@ -33,13 +33,13 @@ ClearBgMap:: jr nz,.loop ret -RedrawRowOrColumn:: ; This function redraws a BG row of height 2 or a BG column of width 2. ; One of its main uses is redrawing the row or column that will be exposed upon ; scrolling the BG when the player takes a step. Redrawing only the exposed ; row or column is more efficient than redrawing the entire screen. ; However, this function is also called repeatedly to redraw the whole screen ; when necessary. It is also used in trade animation and elevator code. +RedrawRowOrColumn:: ld a,[hRedrawRowOrColumnMode] and a ret z -- cgit v1.2.3 From fc474c8ee740acbe662b06db0d9cab8edc6680e9 Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 1 Jul 2016 17:06:55 -0400 Subject: Use pattern variables in the makefile. This means dependency scanning only happens as required. --- Makefile | 38 +++++++++++++++----------------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/Makefile b/Makefile index cf3983f4..12532d73 100644 --- a/Makefile +++ b/Makefile @@ -6,19 +6,8 @@ MD5 := md5sum -c --quiet pic := $(PYTHON) extras/pokemontools/pic.py compress includes := $(PYTHON) extras/pokemontools/scan_includes.py -base_obj := \ - audio.o \ - main.o \ - text.o \ - wram.o - -red_obj := $(base_obj:.o=_red.o) -blue_obj := $(base_obj:.o=_blue.o) -all_obj := $(red_obj) $(blue_obj) - -$(foreach obj, $(base_obj:.o=), \ - $(eval $(obj)_dep := $(shell $(includes) $(obj).asm)) \ -) +pokered_obj := audio_red.o main_red.o text_red.o wram_red.o +pokeblue_obj := audio_blue.o main_blue.o text_blue.o wram_blue.o .SUFFIXES: .SUFFIXES: .asm .o .gbc .png .2bpp .1bpp .pic @@ -38,21 +27,24 @@ compare: red blue @$(MD5) roms.md5 clean: - rm -f $(roms) $(all_obj) $(roms:.gbc=.sym) + rm -f $(roms) $(pokered_obj) $(pokeblue_obj) $(roms:.gbc=.sym) find . \( -iname '*.1bpp' -o -iname '*.2bpp' -o -iname '*.pic' \) -exec rm {} + %.asm: ; -$(red_obj): %_red.o: %.asm $$(%_dep) - rgbasm -D "_RED" -h -o $@ $*.asm -$(blue_obj): %_blue.o: %.asm $$(%_dep) - rgbasm -D "_BLUE" -h -o $@ $*.asm -dmg_opt = -jsv -k 01 -l 0x33 -m 0x13 -p 0 -r 03 -red_opt = $(dmg_opt) -t "POKEMON RED" -blue_opt = $(dmg_opt) -t "POKEMON BLUE" +%_red.o: dep = $(shell $(includes) $(@D)/$*.asm) +$(pokered_obj): %_red.o: %.asm $$(dep) + rgbasm -D _RED -h -o $@ $*.asm + +%_blue.o: dep = $(shell $(includes) $(@D)/$*.asm) +$(pokeblue_obj): %_blue.o: %.asm $$(dep) + rgbasm -D _BLUE -h -o $@ $*.asm + +pokered_opt = -jsv -k 01 -l 0x33 -m 0x13 -p 0 -r 03 -t "POKEMON RED" +pokeblue_opt = -jsv -k 01 -l 0x33 -m 0x13 -p 0 -r 03 -t "POKEMON BLUE" -poke%.gbc: $$(%_obj) - rgblink -n poke$*.sym -o $@ $^ +%.gbc: $$(%_obj) + rgblink -n $*.sym -o $@ $^ rgbfix $($*_opt) $@ %.png: ; -- cgit v1.2.3