diff --git a/constants/gfx_constants.asm b/constants/gfx_constants.asm index ff470ff4..0f2fabd2 100644 --- a/constants/gfx_constants.asm +++ b/constants/gfx_constants.asm @@ -10,9 +10,16 @@ DEF SCREEN_HEIGHT_PX EQU SCREEN_HEIGHT * TILE_WIDTH ; pixels DEF BG_MAP_WIDTH EQU 32 ; tiles DEF BG_MAP_HEIGHT EQU 32 ; tiles +DEF BLOCK_WIDTH EQU 4 ; tiles +DEF BLOCK_HEIGHT EQU BLOCK_WIDTH ; tiles +DEF SCREEN_BLOCK_WIDTH EQU 6 ; blocks +DEF SCREEN_BLOCK_HEIGHT EQU 5 ; blocks +DEF SURROUNDING_WIDTH EQU SCREEN_BLOCK_WIDTH * BLOCK_WIDTH ; tiles +DEF SURROUNDING_HEIGHT EQU SCREEN_BLOCK_HEIGHT * BLOCK_HEIGHT ; tiles + DEF SPRITEBUFFERSIZE EQU 7 * 7 * LEN_1BPP_TILE -; DMGPalToGBCPal +; DMGPalToCGBPal DEF CONVERT_BGP EQU 0 DEF CONVERT_OBP0 EQU 1 DEF CONVERT_OBP1 EQU 2 diff --git a/constants/hardware_constants.asm b/constants/hardware_constants.asm index d1dcdd69..c3a224b3 100644 --- a/constants/hardware_constants.asm +++ b/constants/hardware_constants.asm @@ -1,6 +1,8 @@ -; From http://nocash.emubase.de/pandocs.htm. +; Reference documents: +; https://gbdev.io/pandocs/ +; https://github.com/gbdev/hardware.inc -DEF GBC EQU $11 +DEF CGB EQU $11 ; MBC1 DEF MBC1SRamEnable EQU $0000 diff --git a/data/maps/objects/Route3.asm b/data/maps/objects/Route3.asm index ce7224b5..6f491468 100644 --- a/data/maps/objects/Route3.asm +++ b/data/maps/objects/Route3.asm @@ -15,7 +15,7 @@ Route3_Object: def_warp_events def_bg_events - bg_event 59, 9, 10 ; Route3SignText + bg_event 59, 9, TEXT_ROUTE3_SIGN def_object_events object_event 57, 11, SPRITE_SUPER_NERD, STAY, NONE, TEXT_ROUTE3_SUPER_NERD diff --git a/data/maps/objects/TradeCenter.asm b/data/maps/objects/TradeCenter.asm index 74613f9a..cfa1fe0b 100644 --- a/data/maps/objects/TradeCenter.asm +++ b/data/maps/objects/TradeCenter.asm @@ -9,6 +9,6 @@ TradeCenter_Object: def_bg_events def_object_events - object_event 2, 2, SPRITE_RED, STAY, 0, TEXT_TRADECENTER_OPPONENT + object_event 2, 2, SPRITE_RED, STAY, ANY_DIR, TEXT_TRADECENTER_OPPONENT def_warps_to TRADE_CENTER diff --git a/data/moves/moves.asm b/data/moves/moves.asm index f435ab6b..ac638721 100644 --- a/data/moves/moves.asm +++ b/data/moves/moves.asm @@ -5,7 +5,7 @@ MACRO move db \4 ; type db \5 percent ; accuracy db \6 ; pp - assert \6 <= 40, "PP must be 40 or less" + ASSERT \6 <= 40, "PP must be 40 or less" ENDM Moves: diff --git a/data/predef_pointers.asm b/data/predef_pointers.asm index e960d49b..ebf81847 100644 --- a/data/predef_pointers.asm +++ b/data/predef_pointers.asm @@ -61,7 +61,7 @@ PredefPointers:: add_predef BattleTransition add_predef CopyTileIDsFromList add_predef PlayIntro - add_predef GetMoveSoundB + add_predef GetIntroMoveSound add_predef FlashScreen add_predef GetTileAndCoordsInFrontOfPlayer add_predef StatusScreen diff --git a/data/sgb/sgb_palettes.asm b/data/sgb/sgb_palettes.asm index 4f70558e..2c7537d0 100644 --- a/data/sgb/sgb_palettes.asm +++ b/data/sgb/sgb_palettes.asm @@ -43,7 +43,7 @@ SuperPalettes: RGB 31,31,30, 16,16,16, 31,25,09, 06,06,06 ; PAL_PIKACHUS_BEACH_TITLE assert_table_length NUM_SGB_PALS -GBCBasePalettes: +CGBBasePalettes: ; entries correspond to PAL_* constants table_width 2 * 4 RGB 31,31,31, 16,31,04, 11,23,31, 03,03,03 ; PAL_ROUTE diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index 33036d05..08399ad4 100644 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -274,7 +274,7 @@ PlayAnimation: push af ld a, [wAnimPalette] ldh [rOBP0], a - call UpdateGBCPal_OBP0 + call UpdateCGBPal_OBP0 call LoadMoveAnimationTiles call LoadSubanimation call PlaySubanimation @@ -282,7 +282,7 @@ PlayAnimation: vc_hook Stop_reducing_move_anim_flashing_Thunderbolt ldh [rOBP0], a vc_hook Stop_reducing_move_anim_flashing_Explosion - call UpdateGBCPal_OBP0 + call UpdateCGBPal_OBP0 .nextAnimationCommand vc_hook Stop_reducing_move_anim_flashing_Guillotine pop hl @@ -583,8 +583,8 @@ SetAnimationPalette: ld a, $6c vc_hook Reduce_move_anim_flashing_Haze ldh [rOBP1], a - call UpdateGBCPal_OBP0 - call UpdateGBCPal_OBP1 + call UpdateCGBPal_OBP0 + call UpdateCGBPal_OBP1 ret .notSGB ld a, $e4 @@ -592,8 +592,8 @@ SetAnimationPalette: ldh [rOBP0], a ld a, $6c ldh [rOBP1], a - call UpdateGBCPal_OBP0 - call UpdateGBCPal_OBP1 + call UpdateCGBPal_OBP0 + call UpdateCGBPal_OBP1 ret Func_78e98: @@ -729,7 +729,7 @@ DoBallTossSpecialEffects: ldh a, [rOBP0] xor %00111100 ; complement colors 1 and 2 ldh [rOBP0], a - call UpdateGBCPal_OBP0 + call UpdateCGBPal_OBP0 .skipFlashingEffect ld a, [wSubAnimCounter] cp 11 ; is it the beginning of the subanimation? @@ -1019,7 +1019,7 @@ AnimationFlashScreenLong: cp 1 jr z, .endOfPalettes ldh [rBGP], a - call UpdateGBCPal_BGP + call UpdateCGBPal_BGP call FlashScreenLongDelay jr .innerLoop .endOfPalettes @@ -1082,17 +1082,17 @@ AnimationFlashScreen: push af ; save initial palette ld a, %00011011 ; 0, 1, 2, 3 (inverted colors) ldh [rBGP], a - call UpdateGBCPal_BGP + call UpdateCGBPal_BGP ld c, 2 call DelayFrames xor a ; white out background ldh [rBGP], a - call UpdateGBCPal_BGP + call UpdateCGBPal_BGP ld c, 2 call DelayFrames pop af ldh [rBGP], a ; restore initial palette - call UpdateGBCPal_BGP + call UpdateCGBPal_BGP ret AnimationDarkScreenPalette: @@ -1138,7 +1138,7 @@ SetAnimationBGPalette: ld a, c .next ldh [rBGP], a - call UpdateGBCPal_BGP + call UpdateCGBPal_BGP ret ld b, $5 @@ -2019,7 +2019,7 @@ AnimationSubstitute: ; Changes the pokemon's sprite to the mini sprite ld hl, wTempPic xor a - ld bc, $310 + ld bc, 7 * 7 tiles call FillMemory ldh a, [hWhoseTurn] and a @@ -2282,7 +2282,7 @@ GetMonSpriteTileMapPointerFromRowCount: ldh a, [hWhoseTurn] and a jr nz, .enemyTurn - ld a, 20 * 5 + 1 + ld a, 5 * SCREEN_WIDTH + 1 jr .next .enemyTurn ld a, 12 @@ -2295,7 +2295,7 @@ GetMonSpriteTileMapPointerFromRowCount: sub b and a jr z, .done - ld de, 20 + ld de, SCREEN_WIDTH .loop add hl, de dec a @@ -2349,8 +2349,7 @@ AnimCopyRowRight: jr nz, AnimCopyRowRight ret -; get the sound of the move id in b -GetMoveSoundB: +GetIntroMoveSound: ; unreferenced ld a, b call GetMoveSound ld b, a @@ -2456,7 +2455,7 @@ CopyTileIDs: dec c jr nz, .columnLoop pop hl - ld bc, 20 + ld bc, SCREEN_WIDTH add hl, bc pop bc dec b @@ -2473,7 +2472,7 @@ AnimationLeavesFalling: ; in Razor Leaf's animation. ld a, [wAnimPalette] ldh [rOBP0], a - call UpdateGBCPal_OBP0 + call UpdateCGBPal_OBP0 ld d, $37 ; leaf tile ld a, 3 ; number of leaves ld [wNumFallingObjects], a @@ -2678,12 +2677,12 @@ AnimationShakeEnemyHUD: call BattleAnimCopyTileMapToVRAM ; update BGMap attributes - ldh a, [hGBC] + ldh a, [hOnCGB] and a - jr z, .notGBC + jr z, .notCGB ld c, 13 farcall LoadBGMapAttributes -.notGBC +.notCGB ; Move the window so that the row below the enemy HUD (in BG map 0) lines up ; with the top row of the window on the screen. This makes it so that the window @@ -2719,12 +2718,12 @@ AnimationShakeEnemyHUD: ld hl, vBGMap1 call BattleAnimCopyTileMapToVRAM ; update BGMap attributes - ldh a, [hGBC] + ldh a, [hOnCGB] and a - jr z, .notGBC2 + jr z, .notCGB2 ld c, 11 farcall LoadBGMapAttributes -.notGBC2 +.notCGB2 xor a ldh [hWY], a call SaveScreenTilesToBuffer1 diff --git a/engine/battle/battle_transitions.asm b/engine/battle/battle_transitions.asm index b16bcdc1..8a340bf7 100644 --- a/engine/battle/battle_transitions.asm +++ b/engine/battle/battle_transitions.asm @@ -171,9 +171,9 @@ BattleTransition_BlackScreen: ldh [rBGP], a ldh [rOBP0], a ldh [rOBP1], a - call UpdateGBCPal_BGP - call UpdateGBCPal_OBP0 - call UpdateGBCPal_OBP1 + call UpdateCGBPal_BGP + call UpdateCGBPal_OBP0 + call UpdateCGBPal_OBP1 ret ; for non-dungeon trainer battles @@ -337,7 +337,7 @@ BattleTransition_FlashScreen_: cp 1 jr z, .done ldh [rBGP], a - call UpdateGBCPal_BGP + call UpdateCGBPal_BGP ld c, 2 call DelayFrames jr .loop diff --git a/engine/battle/core.asm b/engine/battle/core.asm index d6ce6557..39e80e74 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -67,9 +67,9 @@ SlidePlayerAndEnemySilhouettesOnScreen: ldh [rBGP], a ldh [rOBP0], a ldh [rOBP1], a - call UpdateGBCPal_BGP - call UpdateGBCPal_OBP0 - call UpdateGBCPal_OBP1 + call UpdateCGBPal_BGP + call UpdateCGBPal_OBP0 + call UpdateCGBPal_OBP1 .slideSilhouettesLoop ; slide silhouettes of the player's pic and the enemy's pic onto the screen ld h, b ld l, $40 @@ -905,8 +905,8 @@ ReplaceFaintedEnemyMon: ldpal a, SHADE_BLACK, SHADE_DARK, SHADE_LIGHT, SHADE_WHITE ldh [rOBP0], a ldh [rOBP1], a - call UpdateGBCPal_OBP0 - call UpdateGBCPal_OBP1 + call UpdateCGBPal_OBP0 + call UpdateCGBPal_OBP1 callfar DrawEnemyPokeballs ld a, [wLinkState] cp LINK_STATE_BATTLING @@ -4619,7 +4619,7 @@ CalculateDamage: ; Multi-hit attacks may or may not have 0 bp. cp TWO_TO_FIVE_ATTACKS_EFFECT jr z, .skipbp - cp $1e + cp EFFECT_1E jr z, .skipbp ; Calculate OHKO damage based on remaining HP. @@ -5328,7 +5328,7 @@ MetronomePickMove: and a jr z, .pickMoveLoop cp STRUGGLE - assert NUM_ATTACKS == STRUGGLE ; random numbers greater than STRUGGLE are not moves + ASSERT NUM_ATTACKS == STRUGGLE ; random numbers greater than STRUGGLE are not moves jr nc, .pickMoveLoop cp METRONOME jr z, .pickMoveLoop @@ -6940,7 +6940,7 @@ HandleExplodingAnimation: ret nz ld a, ANIMATIONTYPE_SHAKE_SCREEN_HORIZONTALLY_LIGHT ld [wAnimationType], a - assert ANIMATIONTYPE_SHAKE_SCREEN_HORIZONTALLY_LIGHT == MEGA_PUNCH + ASSERT ANIMATIONTYPE_SHAKE_SCREEN_HORIZONTALLY_LIGHT == MEGA_PUNCH ; ld a, MEGA_PUNCH ; fallthrough PlayMoveAnimation: diff --git a/engine/battle/effects.asm b/engine/battle/effects.asm index a78de9ca..28e78c3d 100644 --- a/engine/battle/effects.asm +++ b/engine/battle/effects.asm @@ -236,8 +236,8 @@ FreezeBurnParalyzeEffect: jr c, .regular_effectiveness ; extra effectiveness ld b, 30 percent + 1 - assert PARALYZE_SIDE_EFFECT2 - PARALYZE_SIDE_EFFECT1 == BURN_SIDE_EFFECT2 - BURN_SIDE_EFFECT1 - assert PARALYZE_SIDE_EFFECT2 - PARALYZE_SIDE_EFFECT1 == FREEZE_SIDE_EFFECT2 - FREEZE_SIDE_EFFECT1 + ASSERT PARALYZE_SIDE_EFFECT2 - PARALYZE_SIDE_EFFECT1 == BURN_SIDE_EFFECT2 - BURN_SIDE_EFFECT1 + ASSERT PARALYZE_SIDE_EFFECT2 - PARALYZE_SIDE_EFFECT1 == FREEZE_SIDE_EFFECT2 - FREEZE_SIDE_EFFECT1 sub PARALYZE_SIDE_EFFECT2 - PARALYZE_SIDE_EFFECT1 ; treat extra effective as regular from now on .regular_effectiveness push af diff --git a/engine/battle/ghost_marowak_anim.asm b/engine/battle/ghost_marowak_anim.asm index 5b14f6df..1230b936 100644 --- a/engine/battle/ghost_marowak_anim.asm +++ b/engine/battle/ghost_marowak_anim.asm @@ -2,7 +2,7 @@ MarowakAnim: ; animate the ghost being unveiled as a Marowak ld a, $e4 ldh [rOBP1], a - call UpdateGBCPal_OBP1 + call UpdateCGBPal_OBP1 call CopyMonPicFromBGToSpriteVRAM ; cover the BG ghost pic with a sprite ghost pic that looks the same ; now that the ghost pic is being displayed using sprites, clear the ghost pic from the BG tilemap hlcoord 12, 0 @@ -28,7 +28,7 @@ MarowakAnim: sla a sla a ldh [rOBP1], a - call UpdateGBCPal_OBP1 + call UpdateCGBPal_OBP1 jr nz, .fadeOutGhostLoop call ClearSprites call CopyMonPicFromBGToSpriteVRAM ; copy Marowak pic from BG to sprite VRAM @@ -42,7 +42,7 @@ MarowakAnim: srl b rra ldh [rOBP1], a - call UpdateGBCPal_OBP1 + call UpdateCGBPal_OBP1 ld a, b and a jr nz, .fadeInMarowakLoop diff --git a/engine/battle/trainer_ai.asm b/engine/battle/trainer_ai.asm index d714109d..7843b1e2 100644 --- a/engine/battle/trainer_ai.asm +++ b/engine/battle/trainer_ai.asm @@ -644,7 +644,7 @@ AICureStatus: res BADLY_POISONED, [hl] ret -AIUseXAccuracy: ; unused +AIUseXAccuracy: ; unreferenced call AIPlayRestoringSFX ld hl, wEnemyBattleStatus2 set USING_X_ACCURACY, [hl] @@ -658,7 +658,7 @@ AIUseGuardSpec: ld a, GUARD_SPEC jp AIPrintItemUse -AIUseDireHit: ; unused +AIUseDireHit: ; unreferenced call AIPlayRestoringSFX ld hl, wEnemyBattleStatus2 set GETTING_PUMPED, [hl] diff --git a/engine/debug/debug_menu.asm b/engine/debug/debug_menu.asm index b2efb940..92a6853f 100644 --- a/engine/debug/debug_menu.asm +++ b/engine/debug/debug_menu.asm @@ -782,9 +782,9 @@ Func_fec10: ldh [rBGP], a ldh [rOBP0], a ldh [rOBP1], a - call UpdateGBCPal_BGP - call UpdateGBCPal_OBP0 - call UpdateGBCPal_OBP1 + call UpdateCGBPal_BGP + call UpdateCGBPal_OBP0 + call UpdateCGBPal_OBP1 hlcoord 0, 0 lb bc, 1, 18 call TextBoxBorder diff --git a/engine/debug/debug_party.asm b/engine/debug/debug_party.asm index 3c617938..407875e7 100644 --- a/engine/debug/debug_party.asm +++ b/engine/debug/debug_party.asm @@ -53,7 +53,7 @@ IF DEF(_DEBUG) ; Get some debug items. ld hl, wNumBagItems - ld de, DebugItemsList + ld de, DebugNewGameItemsList .items_loop ld a, [de] cp -1 @@ -76,12 +76,13 @@ IF DEF(_DEBUG) ; Rival chose Jolteon. ld hl, wRivalStarter + ASSERT wRivalStarter + 2 == wPlayerStarter ld a, RIVAL_STARTER_JOLTEON ld [hli], a ld a, NUM_POKEMON ld [hli], a ; hl = wUnknownDebugByte ld a, STARTER_PIKACHU - ld [hl], a ; hl = wPlayerStarter + ld [hl], a ; Give max money. ld hl, wPlayerMoney @@ -102,7 +103,7 @@ DebugSetPokedexEntries: ld [hl], %01111111 ret -DebugItemsList: +DebugNewGameItemsList: db MASTER_BALL, 99 db TOWN_MAP, 1 db BICYCLE, 1 @@ -119,7 +120,7 @@ DebugItemsList: db PP_UP, 99 db -1 ; end -DebugUnusedList: +DebugUnusedList: ; unreferenced db OLD_AMBER, 1 db DOME_FOSSIL, 1 db HELIX_FOSSIL, 1 diff --git a/engine/events/poison.asm b/engine/events/poison.asm index 18546254..c57af3c4 100644 --- a/engine/events/poison.asm +++ b/engine/events/poison.asm @@ -1,6 +1,6 @@ ApplyOutOfBattlePoisonDamage: ld a, [wStatusFlags5] - assert BIT_SCRIPTED_MOVEMENT_STATE == 7 + ASSERT BIT_SCRIPTED_MOVEMENT_STATE == 7 add a ; overflows scripted movement state bit into carry flag jp c, .noBlackOut ; no black out if joypad states are being simulated ld a, [wd492] diff --git a/engine/gfx/palettes.asm b/engine/gfx/palettes.asm index 428a6998..a618fe91 100644 --- a/engine/gfx/palettes.asm +++ b/engine/gfx/palettes.asm @@ -317,27 +317,27 @@ YellowIntroPaletteAction:: and a jr nz, .asm_720bd ld hl, PalPacket_Generic - ldh a, [hGBC] + ldh a, [hOnCGB] and a jp z, SendSGBPacket - jp InitGBCPalettes + jp InitCGBPalettes .asm_720bd ld hl, PalPacket_PikachusBeach - ldh a, [hGBC] + ldh a, [hOnCGB] and a jp z, SendSGBPacket - call InitGBCPalettes + call InitCGBPalettes ld hl, PalPacket_Generic inc hl ld a, [hli] - call GetGBCBasePalAddress + call GetCGBBasePalAddress ld a, e - ld [wGBCBasePalPointers + 2], a + ld [wCGBBasePalPointers + 2], a ld a, d - ld [wGBCBasePalPointers + 2 + 1], a + ld [wCGBBasePalPointers + 2 + 1], a xor a ; CONVERT_BGP - call DMGPalToGBCPal + call DMGPalToCGBPal ld a, 1 call TransferCurBGPData ret @@ -354,14 +354,14 @@ LoadOverworldPikachuFrontpicPalettes:: ld a, PAL_PIKACHU_PORTRAIT ld [hl], a ld hl, wPalPacket - ldh a, [hGBC] + ldh a, [hOnCGB] and a jr nz, .cgb_1 call SendSGBPacket jr .okay_1 .cgb_1 - call InitGBCPalettes + call InitCGBPalettes .okay_1 ld hl, BlkPacket_WholeScreen ld de, wPalPacket @@ -379,14 +379,14 @@ LoadOverworldPikachuFrontpicPalettes:: ld a, $a ld [hl], a ld hl, wPalPacket - ldh a, [hGBC] + ldh a, [hOnCGB] and a jr nz, .cgb_2 call SendSGBPacket jr .okay_2 .cgb_2 - call InitGBCPalettes + call InitCGBPalettes .okay_2 ret @@ -545,7 +545,7 @@ LoadSGB: ld [wOnSGB], a call CheckSGB jr c, .onSGB - ldh a, [hGBC] + ldh a, [hOnCGB] and a jr z, .onDMG ld a, $1 @@ -666,7 +666,7 @@ CopyGfxToSuperNintendoVRAM: call DisableLCD ld a, $e4 ldh [rBGP], a - call _UpdateGBCPal_BGP_CheckDMG + call _UpdateCGBPal_BGP_CheckDMG ld de, vChars1 ld a, [wCopyingSGBTileData] and a @@ -697,7 +697,7 @@ CopyGfxToSuperNintendoVRAM: call SendSGBPacket xor a ldh [rBGP], a - call _UpdateGBCPal_BGP_CheckDMG + call _UpdateCGBPal_BGP_CheckDMG ei ret @@ -715,25 +715,25 @@ Wait7000: ret SendSGBPackets: - ldh a, [hGBC] + ldh a, [hOnCGB] and a - jr z, .notGBC + jr z, .notCGB push de - call InitGBCPalettes + call InitCGBPalettes pop hl - call InitGBCPalettes + call InitCGBPalettes ldh a, [rLCDC] and 1 << rLCDC_ENABLE ret z call Delay3 ret -.notGBC +.notCGB push de call SendSGBPacket pop hl jp SendSGBPacket -InitGBCPalettes: +InitCGBPalettes: ld a, [hl] and $f8 cp $20 @@ -753,31 +753,31 @@ InitGBCPalettes: push hl ENDC - call GetGBCBasePalAddress + call GetCGBBasePalAddress ld a, e - ld [wGBCBasePalPointers + index * 2], a + ld [wCGBBasePalPointers + index * 2], a ld a, d - ld [wGBCBasePalPointers + index * 2 + 1], a + ld [wCGBBasePalPointers + index * 2 + 1], a xor a ; CONVERT_BGP - call DMGPalToGBCPal + call DMGPalToCGBPal ld a, index call TransferCurBGPData ld a, CONVERT_OBP0 - call DMGPalToGBCPal + call DMGPalToCGBPal ld a, index call TransferCurOBPData ld a, CONVERT_OBP1 - call DMGPalToGBCPal + call DMGPalToCGBPal ld a, index + 4 call TransferCurOBPData ENDR ret -GetGBCBasePalAddress:: +GetCGBBasePalAddress:: ; Input: a = palette ID ; Output: de = palette address push hl @@ -787,7 +787,7 @@ GetGBCBasePalAddress:: add hl, hl add hl, hl add hl, hl - ld de, GBCBasePalettes + ld de, CGBBasePalettes add hl, de ld a, l ld e, a @@ -796,12 +796,12 @@ GetGBCBasePalAddress:: pop hl ret -DMGPalToGBCPal:: -; Populate wGBCPal with colors from a base palette, selected using one of the +DMGPalToCGBPal:: +; Populate wCGBPal with colors from a base palette, selected using one of the ; DMG palette registers. ; Input: ; a = which DMG palette register -; de = address of GBC base palette +; de = address of CGB base palette and a jr nz, .notBGP ldh a, [rBGP] @@ -822,9 +822,9 @@ DMGPalToGBCPal:: and %11 call .GetColorAddress ld a, [hli] - ld [wGBCPal + color_index * 2], a + ld [wCGBPal + color_index * 2], a ld a, [hl] - ld [wGBCPal + color_index * 2 + 1], a + ld [wCGBPal + color_index * 2 + 1], a IF color_index < NUM_PAL_COLORS - 1 ld a, b @@ -850,7 +850,7 @@ TransferCurBGPData:: or $80 ; auto-increment ldh [rBGPI], a ld de, rBGPD - ld hl, wGBCPal + ld hl, wCGBPal ld b, %10 ; mask for non-V-blank/non-H-blank STAT mode ldh a, [rLCDC] and 1 << rLCDC_ENABLE @@ -868,7 +868,7 @@ TransferCurBGPData:: ret BufferBGPPal:: -; Copy wGBCPal to palette a in wBGPPalsBuffer. +; Copy wCGBPal to palette a in wBGPPalsBuffer. push de add a add a @@ -878,7 +878,7 @@ BufferBGPPal:: ld h, a ld de, wBGPPalsBuffer add hl, de - ld de, wGBCPal + ld de, wCGBPal ld c, PALETTE_SIZE .loop ld a, [de] @@ -926,7 +926,7 @@ TransferCurOBPData: or $80 ; auto-increment ldh [rOBPI], a ld de, rOBPD - ld hl, wGBCPal + ld hl, wCGBPal ld b, %10 ; mask for non-V-blank/non-H-blank STAT mode ldh a, [rLCDC] and 1 << rLCDC_ENABLE @@ -967,20 +967,20 @@ TransferPalColorLCDDisabled: ld [de], a ret -_UpdateGBCPal_BGP_CheckDMG:: - ldh a, [hGBC] +_UpdateCGBPal_BGP_CheckDMG:: + ldh a, [hOnCGB] and a ret z ; fall through -_UpdateGBCPal_BGP:: +_UpdateCGBPal_BGP:: FOR index, NUM_ACTIVE_PALS - ld a, [wGBCBasePalPointers + index * 2] + ld a, [wCGBBasePalPointers + index * 2] ld e, a - ld a, [wGBCBasePalPointers + index * 2 + 1] + ld a, [wCGBBasePalPointers + index * 2 + 1] ld d, a xor a ; CONVERT_BGP - call DMGPalToGBCPal + call DMGPalToCGBPal ld a, index call BufferBGPPal ENDR @@ -988,14 +988,14 @@ _UpdateGBCPal_BGP:: call TransferBGPPals ret -_UpdateGBCPal_OBP:: +_UpdateCGBPal_OBP:: FOR index, NUM_ACTIVE_PALS - ld a, [wGBCBasePalPointers + index * 2] + ld a, [wCGBBasePalPointers + index * 2] ld e, a - ld a, [wGBCBasePalPointers + index * 2 + 1] + ld a, [wCGBBasePalPointers + index * 2 + 1] ld d, a ld a, c - call DMGPalToGBCPal + call DMGPalToCGBPal ld a, c dec a rlca @@ -1015,7 +1015,7 @@ _UpdateGBCPal_OBP:: ret TranslatePalPacketToBGMapAttributes:: -; translate the SGB pal packets into something usable for the GBC +; translate the SGB pal packets into something usable for the CGB push hl pop de ld hl, PalPacketPointers diff --git a/engine/gfx/screen_effects.asm b/engine/gfx/screen_effects.asm index 0b4da01b..ece0a950 100644 --- a/engine/gfx/screen_effects.asm +++ b/engine/gfx/screen_effects.asm @@ -4,13 +4,13 @@ ChangeBGPalColor0_4Frames: ldh a, [rBGP] xor $ff ldh [rBGP], a - call UpdateGBCPal_BGP + call UpdateCGBPal_BGP ld c, 4 call DelayFrames ldh a, [rBGP] xor $ff ldh [rBGP], a - call UpdateGBCPal_BGP + call UpdateCGBPal_BGP ret PredefShakeScreenVertically: diff --git a/engine/gfx/sprite_oam.asm b/engine/gfx/sprite_oam.asm index c0cc0b4f..506b50a7 100644 --- a/engine/gfx/sprite_oam.asm +++ b/engine/gfx/sprite_oam.asm @@ -2,7 +2,7 @@ PrepareOAMData:: ; Determine OAM data for currently visible ; sprites and write it to wShadowOAM. ; Yellow code has been changed to use registers more efficiently -; as well as tweaking the code to show gbc palettes +; as well as tweaking the code to show cgb palettes ld a, [wUpdateSpritesEnabled] dec a diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index 89a20113..de95b0c7 100644 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -482,7 +482,7 @@ ItemUseBall: push hl -; If the Pokémon is transformed, the Pokémon is assumed to be a Ditto. +; Bug: If the Pokémon is transformed, the Pokémon is assumed to be a Ditto. ; This is a bug because a wild Pokémon could have used Transform via ; Mirror Move even though the only wild Pokémon that knows Transform is Ditto. ld hl, wEnemyBattleStatus3 @@ -828,7 +828,7 @@ ItemUseEvoStone: ld a, SFX_HEAL_AILMENT call PlaySoundWaitForCurrent call WaitForSoundToFinish - ld a, $01 + ld a, TRUE ld [wForceEvolution], a callfar TryEvolvingMon ; try to evolve pokemon pop af @@ -2321,10 +2321,10 @@ ItemUsePPRestore: .fullyRestorePP ld a, [hl] ; move PP -; Note that this code has a bug. It doesn't mask out the upper two bits, which -; are used to count how many PP Ups have been used on the move. So, Max Ethers -; and Max Elixirs will not be detected as having no effect on a move with full -; PP if the move has had any PP Ups used on it. +; Bug: This code doesn't mask out the upper two bits, which are used to count +; how many PP Ups have been used on the move. +; So, Max Ethers and Max Elixirs will not be detected as having no effect on +; a move with full PP if the move has had any PP Ups used on it. cp b ; does current PP equal max PP? ret z jr .storeNewAmount @@ -2794,7 +2794,7 @@ GetMaxPP: and %11000000 ; get PP Up count pop bc or b ; place normal max PP in 6 lower bits of a - assert wMoveData + MOVE_PP + 1 == wPPUpCountAndMaxPP + ASSERT wMoveData + MOVE_PP + 1 == wPPUpCountAndMaxPP ld h, d ld l, e inc hl ; hl = wPPUpCountAndMaxPP diff --git a/engine/items/town_map.asm b/engine/items/town_map.asm index abd3b13f..d5960afd 100644 --- a/engine/items/town_map.asm +++ b/engine/items/town_map.asm @@ -18,9 +18,9 @@ DisplayTownMap: hlcoord 1, 0 ld de, wNameBuffer call PlaceString - ld hl, wShadowOAM - ld de, wTileMapBackup - ld bc, $10 + ld hl, wShadowOAMSprite00 + ld de, wShadowOAMBackupSprite00 + ld bc, 4 * 4 call CopyData ld hl, vSprites tile BIRD_BASE_TILE ld de, TownMapCursor @@ -63,8 +63,8 @@ DisplayTownMap: ld de, wNameBuffer call PlaceString ld hl, wShadowOAMSprite04 - ld de, wTileMapBackup + 16 - ld bc, $10 + ld de, wShadowOAMBackupSprite04 + ld bc, 4 * 4 call CopyData .inputLoop call TownMapSpriteBlinkingAnimation @@ -222,7 +222,7 @@ LoadTownMap_Fly:: ld [wDestinationMap], a ld hl, wStatusFlags6 set BIT_FLY_WARP, [hl] - assert wStatusFlags6 + 1 == wStatusFlags7 + ASSERT wStatusFlags6 + 1 == wStatusFlags7 inc hl set BIT_USED_FLY, [hl] .pressedB @@ -376,8 +376,8 @@ DrawPlayerOrBirdSprite: cp "@" jr nz, .loop ld hl, wShadowOAM - ld de, wTileMapBackup - ld bc, $a0 + ld de, wShadowOAMBackup + ld bc, NUM_SPRITE_OAM_STRUCTS * 4 jp CopyData DisplayWildLocations: @@ -423,8 +423,8 @@ DisplayWildLocations: call DrawPlayerOrBirdSprite .done ld hl, wShadowOAM - ld de, wTileMapBackup - ld bc, $a0 + ld de, wShadowOAMBackup + ld bc, NUM_SPRITE_OAM_STRUCTS * 4 jp CopyData AreaUnknownText: @@ -611,15 +611,15 @@ TownMapSpriteBlinkingAnimation:: cp 50 jr nz, .done ; show sprites when the counter reaches 50 - ld hl, wTileMapBackup + ld hl, wShadowOAMBackup ld de, wShadowOAM - ld bc, $90 + ld bc, (NUM_SPRITE_OAM_STRUCTS - 4) * 4 call CopyData xor a jr .done .hideSprites ld hl, wShadowOAM - ld b, $24 + ld b, NUM_SPRITE_OAM_STRUCTS - 4 ld de, $4 .hideSpritesLoop ld [hl], $a0 diff --git a/engine/link/cable_club.asm b/engine/link/cable_club.asm index 26845d2e..691793e7 100644 --- a/engine/link/cable_club.asm +++ b/engine/link/cable_club.asm @@ -56,8 +56,8 @@ CableClub_DoBattleOrTradeAgain: ld [hli], a dec b jr nz, .zeroPlayerDataPatchListLoop - ld hl, wGrassRate - ld bc, wTrainerHeaderPtr - wGrassRate + ld hl, wLinkEnemyTrainerName + ld bc, wTrainerHeaderPtr - wLinkEnemyTrainerName .zeroEnemyPartyLoop xor a ld [hli], a @@ -822,7 +822,7 @@ TradeCenter_Trade: ld a, [wPartyCount] dec a ld [wWhichPokemon], a - ld a, $1 + ld a, TRUE ld [wForceEvolution], a ld a, [wTradingWhichEnemyMon] ld hl, wEnemyPartySpecies diff --git a/engine/menus/link_menu.asm b/engine/menus/link_menu.asm index e0f39eda..9b151388 100644 --- a/engine/menus/link_menu.asm +++ b/engine/menus/link_menu.asm @@ -656,20 +656,20 @@ LinkMenu: ld hl, wTopMenuItemY ld a, 5 ld [hli], a - assert wTopMenuItemY + 1 == wTopMenuItemX + ASSERT wTopMenuItemY + 1 == wTopMenuItemX ld a, 6 ld [hli], a - assert wTopMenuItemX + 1 == wCurrentMenuItem + ASSERT wTopMenuItemX + 1 == wCurrentMenuItem xor a ld [hli], a inc hl - assert wCurrentMenuItem + 2 == wMaxMenuItem + ASSERT wCurrentMenuItem + 2 == wMaxMenuItem ld a, 3 ld [hli], a - assert wMaxMenuItem + 1 == wMenuWatchedKeys - assert 2 == B_BUTTON + ASSERT wMaxMenuItem + 1 == wMenuWatchedKeys + ASSERT 2 == B_BUTTON ld [hli], a - assert wMenuWatchedKeys + 1 == wLastMenuItem + ASSERT wMenuWatchedKeys + 1 == wLastMenuItem xor a ld [hl], a .waitForInputLoop @@ -741,7 +741,7 @@ LinkMenu: ld d, " " ld e, "▷" ld a, [wLinkMenuSelectionSendBuffer] - and (B_BUTTON << 2) ; was B button pressed? + and B_BUTTON << 2 ; was B button pressed? jr nz, .updateCursorPosition ; A button was pressed ld a, [wCurrentMenuItem] @@ -762,7 +762,7 @@ LinkMenu: call Func_f59ec call LoadScreenTilesFromBuffer1 ld a, [wLinkMenuSelectionSendBuffer] - and (B_BUTTON << 2) ; was B button pressed? + and B_BUTTON << 2 ; was B button pressed? jr nz, .choseCancel ; cancel if B pressed ld a, [wCurrentMenuItem] cp $2 diff --git a/engine/menus/main_menu.asm b/engine/menus/main_menu.asm index 817205a9..a8e37ff2 100644 --- a/engine/menus/main_menu.asm +++ b/engine/menus/main_menu.asm @@ -278,7 +278,7 @@ CheckForPlayerNameInSRAM: ld [MBC1SRamEnable], a ld a, SRAM_BANKING_MODE ld [MBC1SRamBankingMode], a - assert SRAM_BANKING_MODE == BANK("Save Data") + ASSERT SRAM_BANKING_MODE == BANK("Save Data") ld [MBC1SRamBank], a ld b, NAME_LENGTH ld hl, sPlayerName diff --git a/engine/minigame/surfing_pikachu.asm b/engine/minigame/surfing_pikachu.asm index 6d31c7b7..f30d567c 100644 --- a/engine/minigame/surfing_pikachu.asm +++ b/engine/minigame/surfing_pikachu.asm @@ -29,9 +29,9 @@ SurfingPikachuMinigame:: ldh [rBGP], a ldh [rOBP0], a ldh [rOBP1], a - call UpdateGBCPal_BGP - call UpdateGBCPal_OBP0 - call UpdateGBCPal_OBP1 + call UpdateCGBPal_BGP + call UpdateCGBPal_OBP0 + call UpdateCGBPal_OBP1 call ClearObjectAnimationBuffers call ClearSprites xor a @@ -257,8 +257,8 @@ SurfingPikachuMinigame_LoadGFXAndLayout: ldh [rOBP0], a ld a, $e0 ldh [rOBP1], a - call UpdateGBCPal_OBP0 - call UpdateGBCPal_OBP1 + call UpdateCGBPal_OBP0 + call UpdateCGBPal_OBP1 ret SurfingPikachuMinigame_SetBGPals: @@ -267,13 +267,13 @@ SurfingPikachuMinigame_SetBGPals: jr nz, .sgb ld a, $d0 ldh [rBGP], a - call UpdateGBCPal_BGP + call UpdateCGBPal_BGP ret .sgb ld a, $e4 ldh [rBGP], a - call UpdateGBCPal_BGP + call UpdateCGBPal_BGP ret Func_f81ff: @@ -2376,8 +2376,8 @@ SurfingPikachuMinigameIntro: ldh [rOBP0], a ld a, $e0 ldh [rOBP1], a - call UpdateGBCPal_OBP0 - call UpdateGBCPal_OBP1 + call UpdateCGBPal_OBP0 + call UpdateCGBPal_OBP1 call DelayFrame ld a, MUSIC_SURFING_PIKACHU ld c, BANK(Music_SurfingPikachu) @@ -2518,9 +2518,9 @@ SurfingPikachuMinigame_BlankPals: ldh [rBGP], a ldh [rOBP0], a ldh [rOBP1], a - call UpdateGBCPal_BGP - call UpdateGBCPal_OBP0 - call UpdateGBCPal_OBP1 + call UpdateCGBPal_BGP + call UpdateCGBPal_OBP0 + call UpdateCGBPal_OBP1 ret SurfingPikachuMinigame_NormalPals: @@ -2529,9 +2529,9 @@ SurfingPikachuMinigame_NormalPals: ldh [rOBP0], a ld a, $e0 ldh [rOBP1], a - call UpdateGBCPal_BGP - call UpdateGBCPal_OBP0 - call UpdateGBCPal_OBP1 + call UpdateCGBPal_BGP + call UpdateCGBPal_OBP0 + call UpdateCGBPal_OBP1 ret SurfingPikachu_ClearTileMap: diff --git a/engine/movie/credits.asm b/engine/movie/credits.asm index 7a24b0b8..22006e6a 100644 --- a/engine/movie/credits.asm +++ b/engine/movie/credits.asm @@ -21,7 +21,7 @@ HallOfFamePC: call FillFourRowsWithBlack ld a, %11000000 ldh [rBGP], a - call UpdateGBCPal_BGP + call UpdateCGBPal_BGP call EnableLCD call StopAllMusic ld hl, vBGMap1 @@ -46,7 +46,7 @@ FadeInCreditsText: .loop ld a, [hli] ldh [rBGP], a - call UpdateGBCPal_BGP + call UpdateCGBPal_BGP ld c, 5 call DelayFrames dec b @@ -78,7 +78,7 @@ DisplayCreditsMon: call CreditsCopyTileMapToVRAM ld a, %11111100 ; make the mon a black silhouette ldh [rBGP], a - call UpdateGBCPal_BGP + call UpdateCGBPal_BGP ld hl, rLCDC res rLCDC_BG_TILEMAP, [hl] ld a, 1 @@ -94,7 +94,7 @@ DisplayCreditsMon: call ScrollCreditsMonLeft ld a, %11000000 ldh [rBGP], a - call UpdateGBCPal_BGP + call UpdateCGBPal_BGP xor a ldh [hSCX], a ret diff --git a/engine/movie/hall_of_fame.asm b/engine/movie/hall_of_fame.asm index 5be7d8c5..670c8261 100644 --- a/engine/movie/hall_of_fame.asm +++ b/engine/movie/hall_of_fame.asm @@ -121,7 +121,7 @@ HoFShowMonOrPlayer: call RunPaletteCommand ld a, %11100100 ldh [rBGP], a - call UpdateGBCPal_BGP + call UpdateCGBPal_BGP ld c, $31 ; back pic call HoFLoadMonPlayerPicTileIDs ld d, $a0 diff --git a/engine/movie/intro.asm b/engine/movie/intro.asm index ef2374da..33a3a134 100644 --- a/engine/movie/intro.asm +++ b/engine/movie/intro.asm @@ -85,7 +85,7 @@ PlayShootingStar: farcall LoadCopyrightAndTextBoxTiles ldpal a, SHADE_BLACK, SHADE_DARK, SHADE_LIGHT, SHADE_WHITE ldh [rBGP], a - call UpdateGBCPal_BGP + call UpdateCGBPal_BGP ld c, 180 call DelayFrames call ClearScreen @@ -122,6 +122,7 @@ PlayShootingStar: call DelayFrames farcall AnimateShootingStar push af + ; A `call LoadPresentsGraphic` here was removed in localization pop af jr c, .next ; skip the delay if the user interrupted the animation ld c, 40 @@ -147,7 +148,11 @@ IntroDrawBlackBars: ld c, BG_MAP_WIDTH * 4 jp IntroPlaceBlackTiles -EmptyFunc2: +LoadPresentsGraphic: ; unreferenced + ; This routine loaded the "PRESENTS" text graphic (tiles + ; $67, $68, $69, $6A, $6B, and $6C from gamefreak_presents.2bpp) + ; at coordinates (11, 7) in the Japanese versions. + ; It was dummied out in the English localization. ret GameFreakIntro: diff --git a/engine/movie/intro_yellow.asm b/engine/movie/intro_yellow.asm index 043ff068..4e8282bc 100644 --- a/engine/movie/intro_yellow.asm +++ b/engine/movie/intro_yellow.asm @@ -143,9 +143,9 @@ YellowIntroScene0: ldh [rOBP0], a ld a, $c4 ldh [rOBP1], a - call UpdateGBCPal_BGP - call UpdateGBCPal_OBP0 - call UpdateGBCPal_OBP1 + call UpdateCGBPal_BGP + call UpdateCGBPal_OBP0 + call UpdateCGBPal_OBP1 ld a, 130 ld [wYellowIntroSceneTimer], a call YellowIntro_NextScene @@ -198,7 +198,7 @@ YellowIntroScene2_PlaceGraphic: add $10 dec b jr nz, .row - ldh a, [hGBC] + ldh a, [hOnCGB] and a jr z, .dmg_sgb ; We can actually set palettes! @@ -278,7 +278,7 @@ YellowIntroScene4: call YellowIntro_BlankPalsDelay2AndDisableLCD ld c, $5 call UpdateMusicCTimes - ldh a, [hGBC] + ldh a, [hOnCGB] and a jr z, .dmg_sgb ; We can actually set palettes! @@ -566,9 +566,9 @@ YellowIntroScene14: ldh [rOBP0], a and $f0 ldh [rOBP1], a - call UpdateGBCPal_BGP - call UpdateGBCPal_OBP0 - call UpdateGBCPal_OBP1 + call UpdateCGBPal_BGP + call UpdateCGBPal_OBP0 + call UpdateCGBPal_OBP1 ret .expired @@ -596,8 +596,8 @@ YellowIntroScene14: ld a, $e4 ldh [rOBP0], a ldh [rBGP], a - call UpdateGBCPal_BGP - call UpdateGBCPal_OBP0 + call UpdateCGBPal_BGP + call UpdateCGBPal_OBP0 lb de, $58, $58 ld a, $7 call YellowIntro_SpawnAnimatedObjectAndSavePointer @@ -619,8 +619,8 @@ YellowIntroScene15: ldh a, [rBGP] xor $3 ldh [rBGP], a - call UpdateGBCPal_BGP - call UpdateGBCPal_OBP0 + call UpdateCGBPal_BGP + call UpdateCGBPal_OBP0 ret .expired @@ -629,8 +629,8 @@ YellowIntroScene15: ld a, $e4 ldh [rBGP], a ldh [rOBP0], a - call UpdateGBCPal_BGP - call UpdateGBCPal_OBP0 + call UpdateCGBPal_BGP + call UpdateCGBPal_OBP0 call YellowIntro_NextScene YellowIntroScene16: ld de, YellowIntroPalSequence_f9e0a @@ -638,8 +638,8 @@ YellowIntroScene16: jr c, .expired ldh [rOBP0], a ldh [rBGP], a - call UpdateGBCPal_BGP - call UpdateGBCPal_OBP0 + call UpdateCGBPal_BGP + call UpdateCGBPal_OBP0 ret .expired @@ -750,9 +750,9 @@ YellowIntro_BlankPalsDelay2AndDisableLCD: ldh [rBGP], a ldh [rOBP0], a ldh [rOBP1], a - call UpdateGBCPal_BGP - call UpdateGBCPal_OBP0 - call UpdateGBCPal_OBP1 + call UpdateCGBPal_BGP + call UpdateCGBPal_OBP0 + call UpdateCGBPal_OBP1 call DelayFrame call DelayFrame call DisableLCD @@ -773,9 +773,9 @@ Func_f9e9a: ldh [rOBP0], a ld a, $e0 ldh [rOBP1], a - call UpdateGBCPal_BGP - call UpdateGBCPal_OBP0 - call UpdateGBCPal_OBP1 + call UpdateCGBPal_BGP + call UpdateCGBPal_OBP0 + call UpdateCGBPal_OBP1 ret YellowIntro_Copy8BitSineWave: @@ -922,9 +922,9 @@ YellowIntro_BlankPalettes: ldh [rBGP], a ldh [rOBP0], a ldh [rOBP1], a - call UpdateGBCPal_BGP - call UpdateGBCPal_OBP0 - call UpdateGBCPal_OBP1 + call UpdateCGBPal_BGP + call UpdateCGBPal_OBP0 + call UpdateCGBPal_OBP1 ret YellowIntro_AnimatedObjectSpawnStateData: diff --git a/engine/movie/oak_speech/init_player_data.asm b/engine/movie/oak_speech/init_player_data.asm index d393b333..9994be51 100644 --- a/engine/movie/oak_speech/init_player_data.asm +++ b/engine/movie/oak_speech/init_player_data.asm @@ -39,7 +39,7 @@ DEF START_MONEY EQU $3000 ld hl, wObtainedBadges ld [hli], a - assert wObtainedBadges + 1 == wUnusedObtainedBadges + ASSERT wObtainedBadges + 1 == wUnusedObtainedBadges ld [hl], a ld hl, wPlayerCoins diff --git a/engine/movie/oak_speech/oak_speech.asm b/engine/movie/oak_speech/oak_speech.asm index 6cdf3e56..1591fefc 100644 --- a/engine/movie/oak_speech/oak_speech.asm +++ b/engine/movie/oak_speech/oak_speech.asm @@ -190,7 +190,7 @@ FadeInIntroPic: .next ld a, [hli] ldh [rBGP], a - call UpdateGBCPal_BGP + call UpdateCGBPal_BGP ld c, 10 call DelayFrames dec b @@ -212,7 +212,7 @@ MovePicLeft: ld a, %11100100 ldh [rBGP], a - call UpdateGBCPal_BGP + call UpdateCGBPal_BGP .next call DelayFrame ldh a, [rWX] diff --git a/engine/movie/splash.asm b/engine/movie/splash.asm index b393d319..6d9b9be9 100644 --- a/engine/movie/splash.asm +++ b/engine/movie/splash.asm @@ -3,8 +3,8 @@ LoadShootingStarGraphics: ldh [rOBP0], a ld a, $a4 ldh [rOBP1], a - call UpdateGBCPal_OBP0 - call UpdateGBCPal_OBP1 + call UpdateCGBPal_OBP0 + call UpdateCGBPal_OBP1 ld de, MoveAnimationTiles1 tile 3 ; star tile (top left quadrant) ld hl, vChars1 tile $20 lb bc, BANK(MoveAnimationTiles1), 1 @@ -77,7 +77,7 @@ AnimateShootingStar: ld hl, rOBP0 rrc [hl] rrc [hl] - call UpdateGBCPal_OBP0 + call UpdateCGBPal_OBP0 ld c, 10 call CheckForUserInterruption ret c @@ -220,7 +220,7 @@ MoveDownSmallStars: ldh a, [rOBP1] xor %10100000 ldh [rOBP1], a - call UpdateGBCPal_OBP1 + call UpdateCGBPal_OBP1 ld c, 3 call CheckForUserInterruption ret c diff --git a/engine/movie/title.asm b/engine/movie/title.asm index 2c4b61fb..96ce948c 100644 --- a/engine/movie/title.asm +++ b/engine/movie/title.asm @@ -13,9 +13,9 @@ PrepareTitleScreen:: ld [wLetterPrintingDelayFlags], a ld hl, wStatusFlags6 ld [hli], a - assert wStatusFlags6 + 1 == wStatusFlags7 + ASSERT wStatusFlags6 + 1 == wStatusFlags7 ld [hli], a - assert wStatusFlags7 + 1 == wElite4Flags + ASSERT wStatusFlags7 + 1 == wElite4Flags ld [hl], a ld a, BANK(Music_TitleScreen) ld [wAudioROMBank], a @@ -76,7 +76,7 @@ DisplayTitleScreen: call GBPalNormal ld a, %11100000 ldh [rOBP0], a - call UpdateGBCPal_OBP0 + call UpdateCGBPal_OBP0 ; make pokemon logo bounce up and down ld bc, hSCY ; background scroll Y diff --git a/engine/movie/trade.asm b/engine/movie/trade.asm index be826996..dfbe643f 100644 --- a/engine/movie/trade.asm +++ b/engine/movie/trade.asm @@ -183,7 +183,7 @@ LoadTradingGFXAndMonNames: ld a, $f0 ; SGB OBP0 .next ldh [rOBP0], a - call UpdateGBCPal_OBP0 + call UpdateCGBPal_OBP0 call EnableLCD xor a ldh [hAutoBGTransferEnabled], a @@ -201,7 +201,7 @@ LoadTradingGFXAndMonNames: Trade_LoadMonPartySpriteGfx: ld a, %11010000 ldh [rOBP1], a - call UpdateGBCPal_OBP1 + call UpdateCGBPal_OBP1 farjp LoadMonPartySpriteGfx Trade_SwapNames: @@ -305,7 +305,7 @@ Trade_AnimateBallEnteringLinkCable: call DelayFrames ld a, %11100100 ldh [rOBP0], a - call UpdateGBCPal_OBP0 + call UpdateCGBPal_OBP0 xor a ld [wLinkCableAnimBulgeToggle], a lb bc, $20, $60 @@ -386,7 +386,7 @@ Trade_AnimLeftToRight: ld [wTradedMonMovingRight], a ld a, %11100100 ldh [rOBP0], a - call UpdateGBCPal_OBP0 + call UpdateCGBPal_OBP0 ld a, $54 ld [wBaseCoordX], a ld a, $1c @@ -604,7 +604,7 @@ Trade_AnimCircledMon: ldh a, [rBGP] xor $3c ; make link cable flash ldh [rBGP], a - call UpdateGBCPal_BGP + call UpdateCGBPal_BGP ld hl, wShadowOAMSprite00TileID ld de, $4 ld c, $14 diff --git a/engine/overworld/cut.asm b/engine/overworld/cut.asm index d26832ec..76821045 100644 --- a/engine/overworld/cut.asm +++ b/engine/overworld/cut.asm @@ -76,7 +76,7 @@ InitCutAnimOAM: ld [wWhichAnimationOffsets], a ld a, %11100100 ldh [rOBP1], a - call UpdateGBCPal_OBP1 + call UpdateCGBPal_OBP1 ld a, [wCutTile] cp $52 jr z, .grass diff --git a/engine/overworld/cut2.asm b/engine/overworld/cut2.asm index 3cbd05b4..a6effff5 100644 --- a/engine/overworld/cut2.asm +++ b/engine/overworld/cut2.asm @@ -18,7 +18,7 @@ AnimCut: ldh a, [rOBP1] xor $64 ldh [rOBP1], a - call UpdateGBCPal_OBP1 + call UpdateCGBPal_OBP1 call DelayFrame pop bc dec c @@ -69,7 +69,7 @@ AnimCutGrass_UpdateOAMEntries: ldh a, [rOBP1] xor $64 ldh [rOBP1], a - call UpdateGBCPal_OBP1 + call UpdateCGBPal_OBP1 call DelayFrame pop bc dec c diff --git a/engine/overworld/dust_smoke.asm b/engine/overworld/dust_smoke.asm index 220d5794..669e1166 100644 --- a/engine/overworld/dust_smoke.asm +++ b/engine/overworld/dust_smoke.asm @@ -7,7 +7,7 @@ AnimateBoulderDust: ld [wUpdateSpritesEnabled], a ld a, %11100100 ldh [rOBP1], a - call UpdateGBCPal_OBP1 + call UpdateCGBPal_OBP1 call LoadSmokeTileFourTimes farcall WriteCutOrBoulderDustAnimationOAMBlock ld c, 8 ; number of steps in animation @@ -22,7 +22,7 @@ AnimateBoulderDust: ldh a, [rOBP1] xor %01100100 ldh [rOBP1], a - call UpdateGBCPal_OBP1 + call UpdateCGBPal_OBP1 call Delay3 pop bc dec c diff --git a/engine/overworld/healing_machine.asm b/engine/overworld/healing_machine.asm index 3bd739b7..dfc6b97b 100644 --- a/engine/overworld/healing_machine.asm +++ b/engine/overworld/healing_machine.asm @@ -12,7 +12,7 @@ AnimateHealingMachine: push af ld a, $e0 ldh [rOBP1], a - call UpdateGBCPal_OBP1 + call UpdateCGBPal_OBP1 ld hl, wShadowOAMSprite33 ld de, PokeCenterOAMData call CopyHealingMachineOAM @@ -54,7 +54,7 @@ AnimateHealingMachine: call DelayFrames pop af ldh [rOBP1], a - call UpdateGBCPal_OBP1 + call UpdateCGBPal_OBP1 pop hl pop af ld [hl], a @@ -81,7 +81,7 @@ FlashSprite8Times: ldh a, [rOBP1] xor d ldh [rOBP1], a - call UpdateGBCPal_OBP1 + call UpdateCGBPal_OBP1 ld c, 10 call DelayFrames dec b diff --git a/engine/overworld/player_state.asm b/engine/overworld/player_state.asm index 1da1b36d..d29a5425 100644 --- a/engine/overworld/player_state.asm +++ b/engine/overworld/player_state.asm @@ -396,7 +396,7 @@ CheckForBoulderCollisionWithSprites: ld a, [hli] ld b, a ldh a, [hPlayerFacing] - assert BIT_FACING_DOWN == 0 + ASSERT BIT_FACING_DOWN == 0 rrca jr c, .pushingDown ; pushing up diff --git a/engine/overworld/trainer_sight.asm b/engine/overworld/trainer_sight.asm index f32b558a..da845fda 100644 --- a/engine/overworld/trainer_sight.asm +++ b/engine/overworld/trainer_sight.asm @@ -97,8 +97,8 @@ TrainerWalkUpToPlayer:: swap a dec a ld c, a ; bc = steps yet to go to reach player - xor a - ld b, a ; a = direction to go to + xor a ; NPC_MOVEMENT_DOWN + ld b, a jr .writeWalkScript .facingUp ld a, [wTrainerScreenY] @@ -111,7 +111,7 @@ TrainerWalkUpToPlayer:: dec a ld c, a ; bc = steps yet to go to reach player ld b, $0 - ld a, $40 ; a = direction to go to + ld a, NPC_MOVEMENT_UP jr .writeWalkScript .facingRight ld a, [wTrainerScreenX] @@ -124,7 +124,7 @@ TrainerWalkUpToPlayer:: dec a ld c, a ; bc = steps yet to go to reach player ld b, $0 - ld a, $c0 ; a = direction to go to + ld a, NPC_MOVEMENT_RIGHT jr .writeWalkScript .facingLeft ld a, [wTrainerScreenX] @@ -137,7 +137,7 @@ TrainerWalkUpToPlayer:: dec a ld c, a ; bc = steps yet to go to reach player ld b, $0 - ld a, $80 ; a = direction to go to + ld a, NPC_MOVEMENT_LEFT .writeWalkScript ld hl, wNPCMovementDirections2 ld de, wNPCMovementDirections2 diff --git a/engine/pikachu/pikachu_pic_animation.asm b/engine/pikachu/pikachu_pic_animation.asm index 8abbb1f9..56ad6436 100644 --- a/engine/pikachu/pikachu_pic_animation.asm +++ b/engine/pikachu/pikachu_pic_animation.asm @@ -845,7 +845,7 @@ PikaPicAnimCommand_thunderbolt: .UpdatePal: ld a, b ldh [rBGP], a - call UpdateGBCPal_BGP + call UpdateCGBPal_BGP call DelayFrames ret diff --git a/engine/pokemon/evos_moves.asm b/engine/pokemon/evos_moves.asm index 981dd10e..25a4d0a1 100644 --- a/engine/pokemon/evos_moves.asm +++ b/engine/pokemon/evos_moves.asm @@ -99,7 +99,7 @@ Evolution_PartyMonLoop: ; loop over party mons jp nz, .nextEvoEntry1 ; don't evolve if we're in a battle as wCurPartySpecies could be holding the last mon sent out ld b, a ; evolution item - ld a, [wCurItem] + ld a, [wCurItem] ; same as [wCurPartySpecies] cp b ; was the evolution item in this entry used? jp nz, .nextEvoEntry1 ; if not, go to the next evolution entry .checkLevel @@ -264,7 +264,7 @@ Evolution_PartyMonLoop: ; loop over party mons RenameEvolvedMon: ; Renames the mon to its new, evolved form's standard name unless it had a ; nickname, in which case the nickname is kept. - assert wCurSpecies == wNameListIndex ; save+restore wCurSpecies while using wNameListIndex + ASSERT wCurSpecies == wNameListIndex ; save+restore wCurSpecies while using wNameListIndex ld a, [wCurSpecies] push af ld a, [wMonHIndex] diff --git a/engine/slots/slot_machine.asm b/engine/slots/slot_machine.asm index fd7a7466..9ad5aa6d 100644 --- a/engine/slots/slot_machine.asm +++ b/engine/slots/slot_machine.asm @@ -1,7 +1,7 @@ PromptUserToPlaySlots: call SaveScreenTilesToBuffer2 ld a, BANK(DisplayTextIDInit) - assert BANK(DisplayTextIDInit) == 1 << BIT_NO_AUTO_TEXT_BOX + ASSERT BANK(DisplayTextIDInit) == 1 << BIT_NO_AUTO_TEXT_BOX ld [wAutoTextBoxDrawingControl], a ; 1 << BIT_NO_AUTO_TEXT_BOX ld b, a ; BANK(DisplayTextIDInit) ld hl, DisplayTextIDInit @@ -28,7 +28,7 @@ PromptUserToPlaySlots: call GBPalNormal ld a, $e4 ldh [rOBP0], a - call UpdateGBCPal_OBP0 + call UpdateCGBPal_OBP0 ld hl, wStatusFlags5 set BIT_NO_TEXT_DELAY, [hl] xor a @@ -299,8 +299,8 @@ SlotMachine_StopWheel1Early: cp HIGH(SLOTSCHERRY) jr nz, .stopWheel ret -; It looks like this was intended to make the wheel stop when a 7 symbol was -; visible, but it has a bug and so the wheel stops randomly. +; Bug: This looks intended to make the wheel stop when a +; 7 symbol was visible, but instead the wheel stops randomly. .sevenAndBarMode ld c, $3 .loop @@ -459,7 +459,7 @@ SlotMachine_CheckForMatches: ldh a, [rBGP] xor $40 ldh [rBGP], a - call UpdateGBCPal_BGP + call UpdateCGBPal_BGP ld c, 5 call DelayFrames dec b @@ -476,7 +476,7 @@ SlotMachine_CheckForMatches: call SlotMachine_PrintPayoutCoins ld a, $e4 ldh [rOBP0], a - call UpdateGBCPal_OBP0 + call UpdateCGBPal_OBP0 jp .done SymbolLinedUpSlotMachineText: @@ -702,7 +702,7 @@ SlotMachine_PayCoinsToPlayer: ldh a, [rOBP0] xor $40 ; make the slot wheel symbols flash ldh [rOBP0], a - call UpdateGBCPal_OBP0 + call UpdateCGBPal_OBP0 ld a, 5 .skip1 ld [wAnimCounter], a diff --git a/home/cgb_palettes.asm b/home/cgb_palettes.asm index b8cc92c6..86d28ece 100644 --- a/home/cgb_palettes.asm +++ b/home/cgb_palettes.asm @@ -1,8 +1,8 @@ -UpdateGBCPal_BGP:: +UpdateCGBPal_BGP:: push af - ldh a, [hGBC] + ldh a, [hOnCGB] and a - jr z, .notGBC + jr z, .notCGB push bc push de push hl @@ -11,20 +11,20 @@ UpdateGBCPal_BGP:: ld a, [wLastBGP] cp b jr z, .noChangeInBGP - farcall _UpdateGBCPal_BGP + farcall _UpdateCGBPal_BGP .noChangeInBGP pop hl pop de pop bc -.notGBC +.notCGB pop af ret -UpdateGBCPal_OBP0:: +UpdateCGBPal_OBP0:: push af - ldh a, [hGBC] + ldh a, [hOnCGB] and a - jr z, .notGBC + jr z, .notCGB push bc push de push hl @@ -33,23 +33,23 @@ UpdateGBCPal_OBP0:: ld a, [wLastOBP0] cp b jr z, .noChangeInOBP0 - ld b, BANK(_UpdateGBCPal_OBP) - ld hl, _UpdateGBCPal_OBP + ld b, BANK(_UpdateCGBPal_OBP) + ld hl, _UpdateCGBPal_OBP ld c, CONVERT_OBP0 call Bankswitch .noChangeInOBP0 pop hl pop de pop bc -.notGBC +.notCGB pop af ret -UpdateGBCPal_OBP1:: +UpdateCGBPal_OBP1:: push af - ldh a, [hGBC] + ldh a, [hOnCGB] and a - jr z, .notGBC + jr z, .notCGB push bc push de push hl @@ -58,15 +58,15 @@ UpdateGBCPal_OBP1:: ld a, [wLastOBP1] cp b jr z, .noChangeInOBP1 - ld b, BANK(_UpdateGBCPal_OBP) - ld hl, _UpdateGBCPal_OBP + ld b, BANK(_UpdateCGBPal_OBP) + ld hl, _UpdateCGBPal_OBP ld c, CONVERT_OBP1 call Bankswitch .noChangeInOBP1 pop hl pop de pop bc -.notGBC +.notCGB pop af ret diff --git a/home/fade.asm b/home/fade.asm index 3180db7b..313284ce 100644 --- a/home/fade.asm +++ b/home/fade.asm @@ -16,9 +16,9 @@ LoadGBPal:: ldh [rOBP0], a ld a, [hli] ldh [rOBP1], a - call UpdateGBCPal_BGP - call UpdateGBCPal_OBP0 - call UpdateGBCPal_OBP1 + call UpdateCGBPal_BGP + call UpdateCGBPal_OBP0 + call UpdateCGBPal_OBP1 ret GBFadeInFromBlack:: @@ -37,9 +37,9 @@ GBFadeIncCommon: ldh [rOBP0], a ld a, [hli] ldh [rOBP1], a - call UpdateGBCPal_BGP - call UpdateGBCPal_OBP0 - call UpdateGBCPal_OBP1 + call UpdateCGBPal_BGP + call UpdateCGBPal_OBP0 + call UpdateCGBPal_OBP1 ld c, 8 call DelayFrames dec b @@ -62,9 +62,9 @@ GBFadeDecCommon: ldh [rOBP0], a ld a, [hld] ldh [rBGP], a - call UpdateGBCPal_BGP - call UpdateGBCPal_OBP0 - call UpdateGBCPal_OBP1 + call UpdateCGBPal_BGP + call UpdateCGBPal_OBP0 + call UpdateCGBPal_OBP1 ld c, 8 call DelayFrames dec b diff --git a/home/list_menu.asm b/home/list_menu.asm index 095cae27..49ef07ea 100644 --- a/home/list_menu.asm +++ b/home/list_menu.asm @@ -129,7 +129,7 @@ DisplayListMenuIDLoop:: and a ; PCPOKEMONLISTMENU? jr z, .pokemonList ; if it's an item menu - assert wCurListMenuItem == wCurItem + ASSERT wCurListMenuItem == wCurItem push hl call GetItemPrice pop hl @@ -147,7 +147,7 @@ DisplayListMenuIDLoop:: call GetName jr .storeChosenEntry .pokemonList - assert wCurListMenuItem == wCurPartySpecies + ASSERT wCurListMenuItem == wCurPartySpecies ld hl, wPartyCount ld a, [wListPointer] cp l ; is it a list of party pokemon or box pokemon? diff --git a/home/overworld.asm b/home/overworld.asm index a661ec04..4fe60f0f 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -1359,12 +1359,12 @@ LoadCurrentMapView:: ld e, a ld a, [wCurrentTileBlockMapViewPointer + 1] ld d, a - ld hl, wTileMapBackup - ld b, $05 + ld hl, wSurroundingTiles + ld b, SCREEN_BLOCK_HEIGHT .rowLoop ; each loop iteration fills in one row of tile blocks push hl push de - ld c, $06 + ld c, SCREEN_BLOCK_WIDTH .rowInnerLoop ; loop to draw each tile block of the current row push bc push de @@ -1393,7 +1393,7 @@ LoadCurrentMapView:: .noCarry ; update tile map pointer to next row's address pop hl - ld a, $60 + ld a, SURROUNDING_WIDTH * BLOCK_HEIGHT add l ld l, a jr nc, .noCarry2 @@ -1401,19 +1401,19 @@ LoadCurrentMapView:: .noCarry2 dec b jr nz, .rowLoop - ld hl, wTileMapBackup - ld bc, $0 + ld hl, wSurroundingTiles + ld bc, 0 .adjustForYCoordWithinTileBlock ld a, [wYBlockCoord] and a jr z, .adjustForXCoordWithinTileBlock - ld bc, $30 + ld bc, SURROUNDING_WIDTH * 2 add hl, bc .adjustForXCoordWithinTileBlock ld a, [wXBlockCoord] and a jr z, .copyToVisibleAreaBuffer - ld bc, $2 + ld bc, BLOCK_WIDTH / 2 add hl, bc .copyToVisibleAreaBuffer decoord 0, 0 ; base address for the tiles that are directly transferred to VRAM during V-blank @@ -1426,7 +1426,7 @@ LoadCurrentMapView:: inc de dec c jr nz, .rowInnerLoop2 - ld a, $04 + ld a, SURROUNDING_WIDTH - SCREEN_WIDTH add l ld l, a jr nc, .noCarry3 @@ -1520,7 +1520,7 @@ ScheduleColumnRedrawHelper:: ld a, [hl] ld [de], a inc de - ld a, 19 + ld a, SCREEN_WIDTH - 1 add l ld l, a jr nc, .noCarry @@ -1561,22 +1561,18 @@ DrawTileBlock:: ld d, h ld e, l ; de = address of the tile block's tiles pop hl - ld c, $04 ; 4 loop iterations + ld c, BLOCK_HEIGHT ; 4 loop iterations .loop ; each loop iteration, write 4 tile numbers push bc +REPT BLOCK_WIDTH - 1 ld a, [de] ld [hli], a inc de - ld a, [de] - ld [hli], a - inc de - ld a, [de] - ld [hli], a - inc de +ENDR ld a, [de] ld [hl], a inc de - ld bc, $15 + ld bc, SURROUNDING_WIDTH - (BLOCK_WIDTH - 1) add hl, bc pop bc dec c diff --git a/home/palettes.asm b/home/palettes.asm index af66e74b..967b05a5 100644 --- a/home/palettes.asm +++ b/home/palettes.asm @@ -26,9 +26,9 @@ GBPalNormal:: ldh [rBGP], a ld a, %11010000 ; 3100 ldh [rOBP0], a - call UpdateGBCPal_BGP - call UpdateGBCPal_OBP0 - call UpdateGBCPal_OBP1 + call UpdateCGBPal_BGP + call UpdateCGBPal_OBP0 + call UpdateCGBPal_OBP1 ret GBPalWhiteOut:: @@ -37,9 +37,9 @@ GBPalWhiteOut:: ldh [rBGP], a ldh [rOBP0], a ldh [rOBP1], a - call UpdateGBCPal_BGP - call UpdateGBCPal_OBP0 - call UpdateGBCPal_OBP1 + call UpdateCGBPal_BGP + call UpdateCGBPal_OBP0 + call UpdateCGBPal_OBP1 ret RunDefaultPaletteCommand:: diff --git a/home/pokemon.asm b/home/pokemon.asm index 5d2c1a24..b66fe72d 100644 --- a/home/pokemon.asm +++ b/home/pokemon.asm @@ -112,7 +112,11 @@ LoadFrontSpriteByMonIndex:: cp NUM_POKEMON + 1 jr c, .validDexNumber ; dex >#151 invalid .invalidDexNumber - ld a, RHYDON ; $1 + ; This is the so-called "Rhydon trap" or "Rhydon glitch" + ; to fail-safe invalid dex numbers + ; (see https://glitchcity.wiki/wiki/Rhydon_trap + ; or https://bulbapedia.bulbagarden.net/wiki/Rhydon_glitch) + ld a, RHYDON ld [wCurPartySpecies], a ret .validDexNumber diff --git a/home/start.asm b/home/start.asm index 366806e9..2b284647 100644 --- a/home/start.asm +++ b/home/start.asm @@ -1,10 +1,10 @@ _Start:: - cp GBC - jr z, .gbc + cp CGB + jr z, .cgb xor a jr .ok -.gbc +.cgb ld a, TRUE .ok - ldh [hGBC], a + ldh [hOnCGB], a jp Init diff --git a/home/text.asm b/home/text.asm index 9bc7f3cf..7c3589fd 100644 --- a/home/text.asm +++ b/home/text.asm @@ -111,7 +111,7 @@ NextChar:: inc de jp PlaceNextChar -NullChar:: ; unused +NullChar:: ld b, h ld c, l pop hl diff --git a/home/text_script.asm b/home/text_script.asm index af89a043..097c1028 100644 --- a/home/text_script.asm +++ b/home/text_script.asm @@ -5,7 +5,7 @@ UnknownText_2812:: ; unreferenced ; this function is used to display sign messages, sprite dialog, etc. ; INPUT: [hSpriteIndex] = sprite ID or [hTextID] = text ID DisplayTextID:: - assert hSpriteIndex == hTextID ; these are at the same memory location + ASSERT hSpriteIndex == hTextID ; these are at the same memory location ldh a, [hLoadedROMBank] push af farcall DisplayTextIDInit ; initialization diff --git a/home/yes_no.asm b/home/yes_no.asm index 3f5a5a45..8d995832 100644 --- a/home/yes_no.asm +++ b/home/yes_no.asm @@ -26,7 +26,7 @@ YesNoChoicePokeCenter:: lb bc, 8, 12 jr DisplayYesNoChoice -WideYesNoChoice:: ; unused +WideYesNoChoice:: ; unreferenced call SaveScreenTilesToBuffer1 ld a, WIDE_YES_NO_MENU ld [wTwoOptionMenuID], a diff --git a/layout.link b/layout.link index ff4c250f..e4c55e62 100644 --- a/layout.link +++ b/layout.link @@ -238,7 +238,7 @@ WRAM0 "Party Data" "Main Data" "Current Box Data" - "GBC Palette Data" + "CGB Palette Data" org $df15 "Stack" VRAM $0 diff --git a/macros/scripts/maps.asm b/macros/scripts/maps.asm index c5f0d1d0..b5799e64 100644 --- a/macros/scripts/maps.asm +++ b/macros/scripts/maps.asm @@ -106,8 +106,8 @@ ENDM ;\1 event flag ;\2 view range ;\3 TextBeforeBattle -;\4 TextAfterBattle -;\5 TextEndBattle +;\4 TextEndBattle +;\5 TextAfterBattle MACRO trainer DEF _ev_bit = \1 % 8 DEF _cur_bit = CURRENT_TRAINER_BIT % 8 diff --git a/ram/hram.asm b/ram/hram.asm index 8f6e03f0..7c38d138 100644 --- a/ram/hram.asm +++ b/ram/hram.asm @@ -406,7 +406,7 @@ hPikachuSpriteVRAMOffset:: db ds 1 -; 0 if DMG, != 0 if GBC -hGBC:: db +; 0 if DMG, != 0 if CGB +hOnCGB:: db ENDSECTION diff --git a/ram/wram.asm b/ram/wram.asm index 8d983753..68a04fcb 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -160,11 +160,25 @@ SECTION "Tilemap", WRAM0 ; buffer for tiles that are visible on screen (20 columns by 18 rows) wTileMap:: ds SCREEN_WIDTH * SCREEN_HEIGHT +; This union spans 480 bytes. UNION ; buffer for temporarily saving and restoring current screen's tiles ; (e.g. if menus are drawn on top) wTileMapBackup:: ds SCREEN_WIDTH * SCREEN_HEIGHT +NEXTU +; buffer for the blocks surrounding the player (6 columns by 5 rows of 4x4-tile blocks) +wSurroundingTiles:: ds SURROUNDING_WIDTH * SURROUNDING_HEIGHT + +NEXTU +; buffer for temporarily saving and restoring shadow OAM +wShadowOAMBackup:: +; wShadowOAMBackupSprite00 - wShadowOAMBackupSprite39 +FOR n, NUM_SPRITE_OAM_STRUCTS +wShadowOAMBackupSprite{02d:n}:: sprite_oam_struct wShadowOAMBackupSprite{02d:n} +ENDR +wShadowOAMBackupEnd:: + NEXTU ; list of indexes to patch with SERIAL_NO_DATA_BYTE after transfer wSerialPartyMonsPatchList:: ds 200 @@ -250,8 +264,6 @@ wYellowIntroAnimatedObjectStructPointer:: db wSurfingMinigameDataEnd:: ENDU - ds 80 - SECTION "Overworld Map", WRAM0 @@ -2488,10 +2500,10 @@ wBoxMonNicksEnd:: wBoxDataEnd:: -SECTION "GBC Palette Data", WRAM0 +SECTION "CGB Palette Data", WRAM0 -wGBCBasePalPointers:: ds NUM_ACTIVE_PALS * 2 -wGBCPal:: ds PALETTE_SIZE +wCGBBasePalPointers:: ds NUM_ACTIVE_PALS * 2 +wCGBPal:: ds PALETTE_SIZE wLastBGP:: db wLastOBP0:: db wLastOBP1:: db diff --git a/scripts/ChampionsRoom.asm b/scripts/ChampionsRoom.asm index f244327d..3188a5c0 100644 --- a/scripts/ChampionsRoom.asm +++ b/scripts/ChampionsRoom.asm @@ -6,7 +6,7 @@ ChampionsRoom_Script: ret ResetRivalScript: - xor a ; SCENE_CHAMPIONSROOM_DEFAULT + xor a ; SCRIPT_CHAMPIONSROOM_DEFAULT ld [wJoyIgnore], a ld [wChampionsRoomCurScript], a ret diff --git a/scripts/HallOfFame.asm b/scripts/HallOfFame.asm index ed3d2a73..c6ecf4ec 100644 --- a/scripts/HallOfFame.asm +++ b/scripts/HallOfFame.asm @@ -31,9 +31,9 @@ HallOfFameResetEventsAndSaveScript: ld [wLetterPrintingDelayFlags], a ld hl, wStatusFlags7 res BIT_NO_MAP_MUSIC, [hl] - assert wStatusFlags7 + 1 == wElite4Flags + ASSERT wStatusFlags7 + 1 == wElite4Flags inc hl - set BIT_UNUSED_BEAT_ELITE_4, [hl] ; debug, unused? + set BIT_UNUSED_BEAT_ELITE_4, [hl] ; unused xor a ; SCRIPT_*_DEFAULT ld hl, wLoreleisRoomCurScript ld [hli], a ; wLoreleisRoomCurScript diff --git a/scripts/PokemonTower6F.asm b/scripts/PokemonTower6F.asm index cf246c56..251b3759 100644 --- a/scripts/PokemonTower6F.asm +++ b/scripts/PokemonTower6F.asm @@ -74,7 +74,7 @@ PokemonTower6FMarowakBattleScript: .did_not_defeat ld a, $1 ld [wSimulatedJoypadStatesIndex], a - ld a, $10 + ld a, D_RIGHT ld [wSimulatedJoypadStatesEnd], a xor a ld [wSpritePlayerStateData2MovementByte1], a diff --git a/scripts/RocketHideoutB2F.asm b/scripts/RocketHideoutB2F.asm index 7a5c2e4a..0df2f06a 100644 --- a/scripts/RocketHideoutB2F.asm +++ b/scripts/RocketHideoutB2F.asm @@ -281,7 +281,7 @@ RocketHideoutB2F_TextPointers: RocketHideout2TrainerHeaders: def_trainers RocketHideout2TrainerHeader0: - trainer EVENT_BEAT_ROCKET_HIDEOUT_2_TRAINER_0, 4, RocketHideoutB1FRocketBattleText, RocketHideoutB1FRocketEndBattleText, RocketHideoutB1FRocketAfterBattleText + trainer EVENT_BEAT_ROCKET_HIDEOUT_2_TRAINER_0, 4, RocketHideoutB2FRocketBattleText, RocketHideoutB2FRocketEndBattleText, RocketHideoutB2FRocketAfterBattleText db -1 ; end RocketHideoutB2FRocketText: @@ -290,14 +290,14 @@ RocketHideoutB2FRocketText: call TalkToTrainer jp TextScriptEnd -RocketHideoutB1FRocketBattleText: - text_far _RocketHideoutB1FRocketBattleText +RocketHideoutB2FRocketBattleText: + text_far _RocketHideoutB2FRocketBattleText text_end -RocketHideoutB1FRocketEndBattleText: - text_far _RocketHideoutB1FRocketEndBattleText +RocketHideoutB2FRocketEndBattleText: + text_far _RocketHideoutB2FRocketEndBattleText text_end -RocketHideoutB1FRocketAfterBattleText: - text_far _RocketHideoutB1FRocketAfterBattleText +RocketHideoutB2FRocketAfterBattleText: + text_far _RocketHideoutB2FRocketAfterBattleText text_end diff --git a/scripts/RocketHideoutB4F.asm b/scripts/RocketHideoutB4F.asm index 2365ff70..bfd4a835 100644 --- a/scripts/RocketHideoutB4F.asm +++ b/scripts/RocketHideoutB4F.asm @@ -391,11 +391,11 @@ RocketHideoutB4FRocketText: jp TextScriptEnd RocketHideoutB4FRocketBattleText: - text_far _RocketHideoutB4FRocket2BattleText + text_far _RocketHideoutB4FRocketBattleText text_end RocketHideoutB4FRocketEndBattleText: - text_far _RocketHideoutB4FRocket2EndBattleText + text_far _RocketHideoutB4FRocketEndBattleText text_promptbutton text_asm SetEvent EVENT_ROCKET_DROPPED_LIFT_KEY @@ -411,5 +411,5 @@ RocketHideoutB4FRocketAfterBattleText: jp TextScriptEnd .Text: - text_far _RocketHideoutB4FRocket2AfterBattleText + text_far _RocketHideoutB4FRocketAfterBattleText text_end diff --git a/scripts/RocketHideoutElevator.asm b/scripts/RocketHideoutElevator.asm index bd6fb498..d1be4cfb 100644 --- a/scripts/RocketHideoutElevator.asm +++ b/scripts/RocketHideoutElevator.asm @@ -32,7 +32,7 @@ RocketHideoutElevatorStoreWarpEntriesScript: ret RocketHideoutElevatorScript: - ld hl, RocketHideoutElavatorFloors + ld hl, RocketHideoutElevatorFloors call LoadItemList ld hl, RocketHideoutElevatorWarpMaps ld de, wElevatorWarpMaps @@ -40,7 +40,7 @@ RocketHideoutElevatorScript: call CopyData ret -RocketHideoutElavatorFloors: +RocketHideoutElevatorFloors: db 3 ; # db FLOOR_B1F db FLOOR_B2F diff --git a/scripts/Route8.asm b/scripts/Route8.asm index 657d5c83..7b5476c9 100644 --- a/scripts/Route8.asm +++ b/scripts/Route8.asm @@ -35,7 +35,7 @@ Route8TrainerHeader1: Route8TrainerHeader2: trainer EVENT_BEAT_ROUTE_8_TRAINER_2, 4, Route8SuperNerd2BattleText, Route8SuperNerd2EndBattleText, Route8SuperNerd2AfterBattleText Route8TrainerHeader3: - trainer EVENT_BEAT_ROUTE_8_TRAINER_3, 2, Route8CooltrainerF1BattleText, Route8CooltrainerF21EndBattleText, Route8CooltrainerF1AfterBattleText + trainer EVENT_BEAT_ROUTE_8_TRAINER_3, 2, Route8CooltrainerF1BattleText, Route8CooltrainerF1EndBattleText, Route8CooltrainerF1AfterBattleText Route8TrainerHeader4: trainer EVENT_BEAT_ROUTE_8_TRAINER_4, 3, Route8SuperNerd3BattleText, Route8SuperNerd3EndBattleText, Route8SuperNerd3AfterBattleText Route8TrainerHeader5: @@ -112,8 +112,8 @@ Route8CooltrainerF1BattleText: text_far _Route8CooltrainerF1BattleText text_end -Route8CooltrainerF21EndBattleText: - text_far _Route8CooltrainerF21EndBattleText +Route8CooltrainerF1EndBattleText: + text_far _Route8CooltrainerF1EndBattleText text_end Route8CooltrainerF1AfterBattleText: diff --git a/scripts/SilphCo6F.asm b/scripts/SilphCo6F.asm index ad8e83f4..0352f5b4 100644 --- a/scripts/SilphCo6F.asm +++ b/scripts/SilphCo6F.asm @@ -56,7 +56,7 @@ SilphCo6F_TextPointers: SilphCo6TrainerHeaders: def_trainers 6 SilphCo6TrainerHeader0: - trainer EVENT_BEAT_SILPH_CO_6F_TRAINER_0, 2, SilphCo6FRocket1BattleText, SilphCo6Rocket1EndBattleText, SilphCo6Rocket1AfterBattleText + trainer EVENT_BEAT_SILPH_CO_6F_TRAINER_0, 2, SilphCo6FRocket1BattleText, SilphCo6FRocket1EndBattleText, SilphCo6FRocket1AfterBattleText SilphCo6TrainerHeader1: trainer EVENT_BEAT_SILPH_CO_6F_TRAINER_1, 3, SilphCo6FScientistBattleText, SilphCo6FScientistEndBattleText, SilphCo6FScientistAfterBattleText SilphCo6TrainerHeader2: @@ -158,12 +158,12 @@ SilphCo6FRocket1BattleText: text_far _SilphCo6FRocket1BattleText text_end -SilphCo6Rocket1EndBattleText: - text_far _SilphCo6Rocket1EndBattleText +SilphCo6FRocket1EndBattleText: + text_far _SilphCo6FRocket1EndBattleText text_end -SilphCo6Rocket1AfterBattleText: - text_far _SilphCo6Rocket1AfterBattleText +SilphCo6FRocket1AfterBattleText: + text_far _SilphCo6FRocket1AfterBattleText text_end SilphCo6FScientistText: diff --git a/scripts/SilphCo7F.asm b/scripts/SilphCo7F.asm index e0bf102f..f1532448 100644 --- a/scripts/SilphCo7F.asm +++ b/scripts/SilphCo7F.asm @@ -296,7 +296,7 @@ SilphCo7FSilphWorkerM1Text: lb bc, LAPRAS, 15 call GivePokemon jr nc, .done - ld a, [wSimulatedJoypadStatesEnd] + ld a, [wAddedToParty] and a call z, WaitForTextScrollButtonPress call EnableAutoTextBoxDrawing diff --git a/scripts/VermilionDock.asm b/scripts/VermilionDock.asm index 22312510..1de518e3 100644 --- a/scripts/VermilionDock.asm +++ b/scripts/VermilionDock.asm @@ -62,7 +62,7 @@ VermilionDockSSAnneLeavesScript: ldh [hAutoBGTransferEnabled], a ld [wSSAnneSmokeDriftAmount], a ldh [rOBP1], a - call UpdateGBCPal_OBP1 + call UpdateCGBPal_OBP1 ld a, 88 ld [wSSAnneSmokeX], a ld hl, wMapViewVRAMPointer diff --git a/text/RocketHideoutB2F.asm b/text/RocketHideoutB2F.asm index 4dffbc3b..5e25c935 100644 --- a/text/RocketHideoutB2F.asm +++ b/text/RocketHideoutB2F.asm @@ -1,15 +1,15 @@ -_RocketHideoutB1FRocketBattleText:: +_RocketHideoutB2FRocketBattleText:: text "BOSS said you can" line "see GHOSTs with" cont "the SILPH SCOPE!" done -_RocketHideoutB1FRocketEndBattleText:: +_RocketHideoutB2FRocketEndBattleText:: text "I" line "surrender!" prompt -_RocketHideoutB1FRocketAfterBattleText:: +_RocketHideoutB2FRocketAfterBattleText:: text "The TEAM ROCKET" line "HQ has 4 basement" cont "floors. Can you" diff --git a/text/RocketHideoutB4F.asm b/text/RocketHideoutB4F.asm index 5a116b45..daef15b6 100644 --- a/text/RocketHideoutB4F.asm +++ b/text/RocketHideoutB4F.asm @@ -51,17 +51,17 @@ _RocketHideoutB4FGiovanniHopeWeMeetAgainText:: line "again..." done -_RocketHideoutB4FRocket2BattleText:: +_RocketHideoutB4FRocketBattleText:: text "The elevator" line "doesn't work? Who" cont "has the LIFT KEY?" done -_RocketHideoutB4FRocket2EndBattleText:: +_RocketHideoutB4FRocketEndBattleText:: text "No!" prompt -_RocketHideoutB4FRocket2AfterBattleText:: +_RocketHideoutB4FRocketAfterBattleText:: text "Oh no! I dropped" line "the LIFT KEY!" done diff --git a/text/Route8.asm b/text/Route8.asm index a6b24d79..741fa442 100644 --- a/text/Route8.asm +++ b/text/Route8.asm @@ -50,7 +50,7 @@ _Route8CooltrainerF1BattleText:: line "I collect them!" done -_Route8CooltrainerF21EndBattleText:: +_Route8CooltrainerF1EndBattleText:: text "Why? Why??" prompt diff --git a/text/SilphCo6F.asm b/text/SilphCo6F.asm index 86581c24..83408a50 100644 --- a/text/SilphCo6F.asm +++ b/text/SilphCo6F.asm @@ -60,12 +60,12 @@ _SilphCo6FRocket1BattleText:: line "ROCKET BROTHERS!" done -_SilphCo6Rocket1EndBattleText:: +_SilphCo6FRocket1EndBattleText:: text "Flame" line "out!" prompt -_SilphCo6Rocket1AfterBattleText:: +_SilphCo6FRocket1AfterBattleText:: text "No matter!" line "My brothers will" cont "avenge me!"