diff --git a/audio/engine.asm b/audio/engine.asm index 96295b415..067e4ff87 100644 --- a/audio/engine.asm +++ b/audio/engine.asm @@ -829,7 +829,7 @@ LoadNote: ; e83d1 ld hl, Channel1PitchWheelAmountFraction - Channel1 add hl, bc ld [hl], a ; remainder - ld hl, Channel1Field0x25 - Channel1 + ld hl, Channel1Field25 - Channel1 add hl, bc xor a ld [hl], a @@ -981,12 +981,12 @@ ApplyPitchWheel: ; e84f9 add hl, de ld d, h ld e, l - ; [Channel*Field0x25] += [Channel*PitchWheelAmountFraction] + ; [Channel*Field25] += [Channel*PitchWheelAmountFraction] ; if rollover: Frequency += 1 ld hl, Channel1PitchWheelAmountFraction - Channel1 add hl, bc ld a, [hl] - ld hl, Channel1Field0x25 - Channel1 + ld hl, Channel1Field25 - Channel1 add hl, bc add [hl] ld [hl], a @@ -1023,7 +1023,7 @@ ApplyPitchWheel: ; e84f9 ld a, d sbc 0 ld d, a - ; [Channel*Field0x25] *= 2 + ; [Channel*Field25] *= 2 ; if rollover: Frequency -= 1 ld hl, Channel1PitchWheelAmountFraction - Channel1 add hl, bc @@ -1726,7 +1726,7 @@ MusicE2: ; e8873 ; seems to have been dummied out ; params: 1 call GetMusicByte - ld hl, Channel1Field0x2c - Channel1 + ld hl, Channel1Field2c - Channel1 add hl, bc ld [hl], a ld hl, Channel1Flags2 - Channel1 @@ -1849,7 +1849,7 @@ MusicE7: ; e88f7 add hl, bc set SOUND_UNKN_0E, [hl] call GetMusicByte - ld hl, Channel1Field0x29 - Channel1 + ld hl, Channel1Field29 - Channel1 add hl, bc ld [hl], a ret @@ -1885,7 +1885,7 @@ MusicE8: ; e891e add hl, bc set SOUND_UNKN_0D, [hl] call GetMusicByte - ld hl, Channel1Field0x2a - Channel1 + ld hl, Channel1Field2a - Channel1 add hl, bc ld [hl], a ret @@ -2307,7 +2307,7 @@ SetNoteDuration: ; e8a8d inc hl ld d, [hl] ; add ???? to the next result - ld hl, Channel1Field0x16 - Channel1 + ld hl, Channel1Field16 - Channel1 add hl, bc ld l, [hl] ; multiply Tempo by last result (NoteLength * LOW(delay)) @@ -2316,7 +2316,7 @@ SetNoteDuration: ; e8a8d ld e, l ld d, h ; store result in ???? - ld hl, Channel1Field0x16 - Channel1 + ld hl, Channel1Field16 - Channel1 add hl, bc ld [hl], e ; store result in NoteDuration @@ -2392,7 +2392,7 @@ Tempo: ; e8b03 ld [hl], d ; clear ???? xor a - ld hl, Channel1Field0x16 - Channel1 + ld hl, Channel1Field16 - Channel1 add hl, bc ld [hl], a ret @@ -2749,7 +2749,7 @@ PlayStereoSFX:: ; e8ca6 add hl, bc ld [hl], a - ld hl, Channel1Field0x30 - Channel1 ; $c131 - Channel1 + ld hl, Channel1Field30 - Channel1 ; $c131 - Channel1 add hl, bc ld [hl], a @@ -2760,11 +2760,11 @@ PlayStereoSFX:: ; e8ca6 ; ch3-4 ld a, [wSFXDuration] - ld hl, Channel1Field0x2e - Channel1 ; $c12f - Channel1 + ld hl, Channel1Field2e - Channel1 ; $c12f - Channel1 add hl, bc ld [hl], a - ld hl, Channel1Field0x2f - Channel1 ; $c130 - Channel1 + ld hl, Channel1Field2f - Channel1 ; $c130 - Channel1 add hl, bc ld [hl], a diff --git a/constants/battle_anim_constants.asm b/constants/battle_anim_constants.asm index 0170d5700..d49aafec4 100644 --- a/constants/battle_anim_constants.asm +++ b/constants/battle_anim_constants.asm @@ -708,7 +708,7 @@ BATTLEANIMSTRUCT_LENGTH EQU const_value const BATTLEANIMOAMSET_D7 ; BattleBGEffects indexes (see engine/battle_anims/bg_effects.asm) -const_value SET 1 +const_value set 1 const ANIM_BG_FLASH_INVERTED const ANIM_BG_FLASH_WHITE const ANIM_BG_WHITE_HUES @@ -764,7 +764,7 @@ const_value SET 1 const ANIM_BG_35 ; AnimObjGFX indexes (see data/battle_anims/object_gfx.asm) -const_value SET 1 +const_value set 1 const ANIM_GFX_HIT const ANIM_GFX_CUT const ANIM_GFX_FIRE diff --git a/constants/battle_constants.asm b/constants/battle_constants.asm index 2b1fec155..9a3323509 100644 --- a/constants/battle_constants.asm +++ b/constants/battle_constants.asm @@ -45,7 +45,7 @@ MOVE_LENGTH EQU const_value ; indexes for: ; - PlayerStats and EnemyStats (see wram.asm) ; - party_struct and battle_struct members (see macros/wram.asm) -const_value SET 1 +const_value set 1 const STAT_HP const STAT_ATK const STAT_DEF @@ -65,7 +65,7 @@ ATKDEFDV_SHINY EQU $EA SPDSPCDV_SHINY EQU $AA ; battle classes (wBattleMode values) -const_value SET 1 +const_value set 1 const WILD_BATTLE const TRAINER_BATTLE @@ -140,7 +140,7 @@ const_value SET 1 ; status condition bit flags SLP EQU %111 ; 0-7 turns -const_value SET 3 +const_value set 3 const PSN const BRN const FRZ diff --git a/constants/credits_constants.asm b/constants/credits_constants.asm index 8ee0391de..94f259e26 100644 --- a/constants/credits_constants.asm +++ b/constants/credits_constants.asm @@ -105,7 +105,7 @@ const PAAD_TESTING ; CreditsScript indexes (see data/credits_script.asm) -const_value SET -7 +const_value set -7 const CREDITS_THEEND const CREDITS_WAIT2 const CREDITS_MUSIC diff --git a/constants/hardware_constants.asm b/constants/hardware_constants.asm index 9cb278622..7e7681acf 100644 --- a/constants/hardware_constants.asm +++ b/constants/hardware_constants.asm @@ -50,6 +50,7 @@ OAM_X_FLIP EQU 5 OAM_Y_FLIP EQU 6 OAM_PRIORITY EQU 7 ; 0: OBJ above BG, 1: OBJ behind BG (colors 1-3) +; BP Map attribute flags PALETTE_MASK EQU %111 VRAM_BANK_1 EQU 1 << OAM_TILE_BANK ; $08 OBP_NUM EQU 1 << OAM_OBP_NUM ; $10 @@ -57,6 +58,10 @@ X_FLIP EQU 1 << OAM_X_FLIP ; $20 Y_FLIP EQU 1 << OAM_Y_FLIP ; $40 BEHIND_BG EQU 1 << OAM_PRIORITY ; $80 +; Other useful constants +LCDC_DEFAULT EQU %11100011 +LY_VBLANK EQU 144 + ; Hardware registers rJOYP EQU $ff00 ; Joypad (R/W) rSB EQU $ff01 ; Serial transfer data (R/W) @@ -114,6 +119,10 @@ rWave_d EQU $ff3d rWave_e EQU $ff3e rWave_f EQU $ff3f rLCDC EQU $ff40 ; LCD Control (R/W) +rLCDC_SPRITES_ENABLE EQU 1 ; 0=Off, 1=On +rLCDC_SPRITE_SIZE EQU 2 ; 0=8x8, 1=8x16 +rLCDC_WINDOW_TILEMAP EQU 6 ; 0=9800-9BFF, 1=9C00-9FFF +rLCDC_ENABLE EQU 7 ; 0=Off, 1=On rSTAT EQU $ff41 ; LCDC Status (R/W) rSCY EQU $ff42 ; Scroll Y (R/W) rSCX EQU $ff43 ; Scroll X (R/W) diff --git a/constants/item_data_constants.asm b/constants/item_data_constants.asm index 4ef221840..dfcff9eb0 100644 --- a/constants/item_data_constants.asm +++ b/constants/item_data_constants.asm @@ -52,7 +52,7 @@ MAIL_STRUCT_LENGTH EQU $2f ; mailmsg struct const HELD_7 const HELD_CLEANSE_TAG -const_value SET 10 +const_value set 10 const HELD_HEAL_POISON const HELD_HEAL_FREEZE const HELD_HEAL_BURN @@ -61,7 +61,7 @@ const_value SET 10 const HELD_HEAL_STATUS const HELD_HEAL_CONFUSION -const_value SET 20 +const_value set 20 const HELD_PREVENT_POISON const HELD_PREVENT_BURN const HELD_PREVENT_FREEZE @@ -69,7 +69,7 @@ const_value SET 20 const HELD_PREVENT_PARALYZE const HELD_PREVENT_CONFUSE -const_value SET 30 +const_value set 30 const HELD_30 const HELD_ATTACK_UP const HELD_DEFENSE_UP @@ -80,12 +80,12 @@ const_value SET 30 const HELD_EVASION_UP const HELD_38 -const_value SET 40 +const_value set 40 const HELD_40 const HELD_41 const HELD_METAL_POWDER -const_value SET 50 +const_value set 50 const HELD_NORMAL_BOOST const HELD_FIGHTING_BOOST const HELD_FLYING_BOOST @@ -104,7 +104,7 @@ const_value SET 50 const HELD_DARK_BOOST const HELD_STEEL_BOOST -const_value SET 70 +const_value set 70 const HELD_CATCH_CHANCE const HELD_71 const HELD_ESCAPE diff --git a/constants/map_data_constants.asm b/constants/map_data_constants.asm index 5d3f23c08..5a1ec6ede 100644 --- a/constants/map_data_constants.asm +++ b/constants/map_data_constants.asm @@ -17,7 +17,7 @@ MAP_NONE EQU 0 NUM_MAPHEADER_ATTRIBUTES EQU const_value ; map environments (wEnvironment) -const_value SET 1 +const_value set 1 const TOWN const ROUTE const INDOOR @@ -34,7 +34,7 @@ const_value SET 1 const PALETTE_MORN const PALETTE_DARK -; fish groups +; fish groups const_def const FISHGROUP_NONE const FISHGROUP_SHORE @@ -97,10 +97,10 @@ const_value SET 1 const OBJECT_SPRITE_X_OFFSET ; 19 const OBJECT_SPRITE_Y_OFFSET ; 1a const OBJECT_MOVEMENT_BYTE_INDEX ; 1b - const OBJECT_28 ; 1c - const OBJECT_29 ; 1d - const OBJECT_30 ; 1e - const OBJECT_31 ; 1f + const OBJECT_1C ; 1c + const OBJECT_1D ; 1d + const OBJECT_1E ; 1e + const OBJECT_1F ; 1f const OBJECT_RANGE ; 20 ; 33-39 are not used @@ -217,7 +217,7 @@ NUM_SPAWNS EQU const_value EMOTE_MEM EQU -1 ; FruitTreeItems indexes (see data/items/fruit_trees.asm) -const_value SET 1 +const_value set 1 const FRUITTREE_ROUTE_29 ; 01 const FRUITTREE_ROUTE_30_1 ; 02 const FRUITTREE_ROUTE_38 ; 03 diff --git a/constants/map_setup_constants.asm b/constants/map_setup_constants.asm index 20448f2fb..d9abd6e9b 100644 --- a/constants/map_setup_constants.asm +++ b/constants/map_setup_constants.asm @@ -1,6 +1,6 @@ ; hMapEntryMethod values ; MapSetupScripts indexes (see data/maps/setup_scripts.asm) -const_value SET $f1 +const_value set $f1 const MAPSETUP_WARP ; f1 const MAPSETUP_CONTINUE ; f2 const MAPSETUP_RELOADMAP ; f3 @@ -67,7 +67,7 @@ const_value SET $f1 map_end EQU -1 ; callback types -const_value SET 1 +const_value set 1 const MAPCALLBACK_TILES const MAPCALLBACK_OBJECTS const MAPCALLBACK_CMDQUEUE diff --git a/constants/pokemon_data_constants.asm b/constants/pokemon_data_constants.asm index c9eb84041..6e8c2d322 100644 --- a/constants/pokemon_data_constants.asm +++ b/constants/pokemon_data_constants.asm @@ -45,7 +45,7 @@ GENDERLESS EQU 255 const SLOW ; BaseEggGroups values -const_value SET 1 +const_value set 1 const MONSTER ; 1 const AMPHIBIAN ; 2 const INSECT ; 3 @@ -103,7 +103,7 @@ PARTY_LENGTH EQU 6 ; evolution types (used in data/pokemon/evos_attacks.asm) -const_value SET 1 +const_value set 1 const EVOLVE_LEVEL const EVOLVE_ITEM const EVOLVE_TRADE @@ -111,13 +111,13 @@ const_value SET 1 const EVOLVE_STAT ; EVOLVE_HAPPINESS triggers -const_value SET 1 +const_value set 1 const TR_ANYTIME const TR_MORNDAY const TR_NITE ; EVOLVE_STAT triggers -const_value SET 1 +const_value set 1 const ATK_GT_DEF const ATK_LT_DEF const ATK_EQ_DEF @@ -162,7 +162,7 @@ FISHSWARM_REMORAID EQU 2 const ANIM_MON_EGG2 ; MonMenuOptions indexes (see engine/mon_menu.asm) -const_value SET 1 +const_value set 1 ; moves const MONMENU_CUT ; 1 const MONMENU_FLY ; 2 diff --git a/constants/printer_constants.asm b/constants/printer_constants.asm index 3cbaa049a..b6b5da7e7 100755 --- a/constants/printer_constants.asm +++ b/constants/printer_constants.asm @@ -1,5 +1,5 @@ ; wPrinterStatus -const_value SET 1 +const_value set 1 const PRINTER_STATUS_CHECKING const PRINTER_STATUS_TRANSMITTING const PRINTER_STATUS_PRINTING diff --git a/constants/script_constants.asm b/constants/script_constants.asm index 9dd4987f8..9f7dae6d2 100644 --- a/constants/script_constants.asm +++ b/constants/script_constants.asm @@ -39,7 +39,7 @@ RETVAR_ADDR_DE EQU (1 << 6) RETVAR_EXECUTE EQU (2 << 6) ; PlayerEventScriptPointers indexes (see engine/events.asm) -const_value SET -1 +const_value set -1 const PLAYEREVENT_MAPSCRIPT const PLAYEREVENT_NONE const PLAYEREVENT_SEENBYTRAINER diff --git a/constants/sprite_constants.asm b/constants/sprite_constants.asm index 9e4b57c27..e657c4027 100644 --- a/constants/sprite_constants.asm +++ b/constants/sprite_constants.asm @@ -106,7 +106,7 @@ const SPRITE_STANDING_YOUNGSTER ; 66 ; SpriteMons indexes (see data/sprite_mons.asm) -const_value SET $80 +const_value set $80 SPRITE_POKEMON EQU const_value const SPRITE_UNOWN ; 80 const SPRITE_GEODUDE ; 81 @@ -145,12 +145,12 @@ SPRITE_POKEMON EQU const_value const SPRITE_HO_OH ; a2 ; special GetMonSprite values (see engine/overworld.asm) -const_value SET $e0 +const_value set $e0 const SPRITE_DAY_CARE_MON_1 ; e0 const SPRITE_DAY_CARE_MON_2 ; e1 ; VariableSprites indexes (see wram.asm) -const_value SET $f0 +const_value set $f0 SPRITE_VARS EQU const_value const SPRITE_CONSOLE ; f0 const SPRITE_DOLL_1 ; f1 diff --git a/constants/sprite_data_constants.asm b/constants/sprite_data_constants.asm index 43a3843fc..9ec78d1fb 100644 --- a/constants/sprite_data_constants.asm +++ b/constants/sprite_data_constants.asm @@ -9,7 +9,7 @@ NUM_SPRITEDATA_FIELDS EQU const_value ; sprite types -const_value SET 1 +const_value set 1 const WALKING_SPRITE ; 1 const STANDING_SPRITE ; 2 const STILL_SPRITE ; 3 diff --git a/constants/tileset_constants.asm b/constants/tileset_constants.asm index 722de0c2b..90dd0f8d2 100644 --- a/constants/tileset_constants.asm +++ b/constants/tileset_constants.asm @@ -1,5 +1,5 @@ ; Tilesets indexes (see tilesets/tilesets.asm) -const_value SET 1 +const_value set 1 const TILESET_JOHTO_1 ; 01 const TILESET_JOHTO_2 ; 02 const TILESET_KANTO ; 03 diff --git a/constants/wram_constants.asm b/constants/wram_constants.asm index 2e44208ef..165028a37 100644 --- a/constants/wram_constants.asm +++ b/constants/wram_constants.asm @@ -7,7 +7,7 @@ const WILDMON ; 4 ; Options: (bits) ; cfcc -const_value SET 4 +const_value set 4 const NO_TEXT_SCROLL ; 4 const STEREO ; 5 const BATTLE_SHIFT ; 6 @@ -41,7 +41,7 @@ GBPRINTER_DARKER EQU $60 GBPRINTER_DARKEST EQU $7f ; WalkingDirection: ; d043 -const_value SET -1 +const_value set -1 const STANDING ; -1 const DOWN ; 0 const UP ; 1 diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 2937755a6..08021fc8b 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -8395,11 +8395,11 @@ BattleIntro: ; 3f4dd ld b, SCGB_BATTLE_GRAYSCALE call GetSGBLayout ld hl, rLCDC - res 6, [hl] + res rLCDC_WINDOW_TILEMAP, [hl] ; select 9800-9BFF call InitBattleDisplay call BattleStartMessage ld hl, rLCDC - set 6, [hl] + set rLCDC_WINDOW_TILEMAP, [hl] ; select 9C00-9FFF xor a ld [hBGMapMode], a call EmptyBattleTextBox diff --git a/engine/battle_anims/bg_effects.asm b/engine/battle_anims/bg_effects.asm index c1a2bef4b..ffdce532e 100644 --- a/engine/battle_anims/bg_effects.asm +++ b/engine/battle_anims/bg_effects.asm @@ -2066,6 +2066,7 @@ BattleBGEffect_1c: ; c8b00 (32:4b00) dw .cgb_zero dw .cgb_one dw .cgb_two + .cgb_zero call BattleBGEffects_IncrementJumptable ld hl, BG_EFFECT_STRUCT_03 @@ -2313,7 +2314,7 @@ BattleBGEffect_2e: ; c8ce1 (32:4ce1) ld [hSCY], a xor $ff inc a - ld [AnimObject01_YOffset], a + ld [AnimObject01YOffset], a ret BattleBGEffect_1f: ; c8cf9 (32:4cf9) diff --git a/engine/billspc.asm b/engine/billspc.asm index 8fe578a07..f94f495c6 100755 --- a/engine/billspc.asm +++ b/engine/billspc.asm @@ -42,14 +42,12 @@ _DepositPKMN: ; e2391 (38:6391) jp hl .Jumptable: ; e23df (38:63df) - dw .Init dw .HandleJoypad dw .WhatsUp dw .Submenu dw BillsPC_EndJumptableLoop - .Init: ; e23e9 (38:63e9) xor a ld [hBGMapMode], a @@ -150,7 +148,6 @@ _DepositPKMN: ; e2391 (38:6391) jp hl BillsPCDepositJumptable: ; e24a1 (38:64a1) - dw BillsPCDepositFuncDeposit ; Deposit Pokemon dw BillsPCDepositFuncStats ; Pokemon Stats dw BillsPCDepositFuncRelease ; Release Pokemon @@ -309,14 +306,12 @@ _WithdrawPKMN: ; e2583 (38:6583) jp hl .Jumptable: ; e25d2 (38:65d2) - dw .Init dw .Joypad dw .PrepSubmenu dw BillsPC_Withdraw dw BillsPC_EndJumptableLoop - .Init: ; e25dc (38:65dc) ld a, NUM_BOXES + 1 ld [wBillsPC_LoadedBox], a @@ -560,7 +555,6 @@ _MovePKMNWithoutMail: ; e2759 ; e27ac .Jumptable: ; e27ac - dw .Init dw .Joypad dw .PrepSubmenu @@ -2029,7 +2023,6 @@ MovePKMNWitoutMail_InsertMon: ; e31e7 ; e3245 .Jumptable: ; e3245 - dw .BoxToBox dw .PartyToBox dw .BoxToParty diff --git a/engine/card_flip.asm b/engine/card_flip.asm index f03db190d..515f0ce79 100755 --- a/engine/card_flip.asm +++ b/engine/card_flip.asm @@ -80,7 +80,6 @@ _CardFlip: ; e00ee (38:40ee) ; e01a0 (38:41a0) .Jumptable: ; e01a0 - dw .AskPlayWithThree dw .DeductCoins dw .ChooseACard @@ -656,7 +655,6 @@ CardFlip_BlankDiscardedCardSlot: ; e0534 ; e0553 .Jumptable: ; e0553 - dw .Level1 dw .Level2 dw .Level3 @@ -833,7 +831,6 @@ CardFlip_CheckWinCondition: ; e0637 ; e0643 .Jumptable: ; e0643 - dw .Impossible dw .Impossible dw .PikaJiggly diff --git a/engine/color.asm b/engine/color.asm index 1f563df53..262bccbbb 100644 --- a/engine/color.asm +++ b/engine/color.asm @@ -617,7 +617,7 @@ ApplyPals: ApplyAttrMap: ld a, [rLCDC] - bit 7, a + bit rLCDC_ENABLE, a jr z, .UpdateVBank1 ld a, [hBGMapMode] push af @@ -1073,7 +1073,7 @@ SGBBorder_PushBGPals: ld bc, $100 tiles call CopyData call DrawDefaultTiles - ld a, $e3 + ld a, LCDC_DEFAULT ld [rLCDC], a ld hl, PalPacket_9d06 call PushSGBPals @@ -1107,7 +1107,7 @@ SGBBorder_MorePalPushing: ld bc, 16 palettes call CopyData call DrawDefaultTiles - ld a, $e3 + ld a, LCDC_DEFAULT ld [rLCDC], a ld hl, PalPacket_9d46 call PushSGBPals @@ -1131,7 +1131,7 @@ SGBBorder_YetMorePalPushing: dec b jr nz, .loop call DrawDefaultTiles - ld a, $e3 + ld a, LCDC_DEFAULT ld [rLCDC], a ld hl, PalPacket_9d36 call PushSGBPals diff --git a/engine/credits.asm b/engine/credits.asm index e38ba8dc5..051729531 100644 --- a/engine/credits.asm +++ b/engine/credits.asm @@ -152,9 +152,7 @@ Credits_Jumptable: ; 109926 jp hl ; 109937 - .Jumptable: ; 109937 (42:5937) - dw ParseCredits dw Credits_Next dw Credits_Next @@ -169,7 +167,6 @@ Credits_Jumptable: ; 109926 dw Credits_RequestGFX dw Credits_LoopBack - Credits_Next: ; 109951 (42:5951) ld hl, wJumptableIndex inc [hl] diff --git a/engine/dummy_game.asm b/engine/dummy_game.asm index 4a1972ec3..aecaa7425 100755 --- a/engine/dummy_game.asm +++ b/engine/dummy_game.asm @@ -34,7 +34,7 @@ _DummyGame: ; e1e5b (38:5e5b) ld [wJumptableIndex], a ld a, $1 ld [hBGMapMode], a - ld a, $e3 + ld a, LCDC_DEFAULT ld [rLCDC], a ld a, $e4 call DmgToCgbBGPals diff --git a/engine/events/magnet_train.asm b/engine/events/magnet_train.asm index 585912391..cf010fb1d 100755 --- a/engine/events/magnet_train.asm +++ b/engine/events/magnet_train.asm @@ -303,7 +303,6 @@ MagnetTrain_Jumptable: ; 8cdf7 ; 8ce06 .Jumptable: ; 8ce06 - dw .InitPlayerSpriteAnim dw .WaitScene dw .MoveTrain1 diff --git a/engine/events/overworld.asm b/engine/events/overworld.asm index 8c238cb9c..17ec54bb1 100755 --- a/engine/events/overworld.asm +++ b/engine/events/overworld.asm @@ -128,7 +128,6 @@ CutFunction: ; c785 ret .Jumptable: ; c796 (3:4796) - dw .CheckAble dw .DoCut dw .FailCut diff --git a/engine/intro_menu.asm b/engine/intro_menu.asm index faa5748dd..7d17b62e5 100755 --- a/engine/intro_menu.asm +++ b/engine/intro_menu.asm @@ -1035,7 +1035,7 @@ StartTitleScreen: ; 6219 ld [rSVBK], a ld hl, rLCDC - res 2, [hl] + res rLCDC_SPRITE_SIZE, [hl] ; 8x8 call ClearScreen call WaitBGMap2 xor a diff --git a/engine/main_menu.asm b/engine/main_menu.asm index a88f60bbf..cbd516cd7 100755 --- a/engine/main_menu.asm +++ b/engine/main_menu.asm @@ -54,7 +54,6 @@ MainMenu: ; 49cdc db "MOBILE STUDIUM@" .Jumptable: ; 0x49d60 - dw MainMenu_Continue dw MainMenu_NewGame dw MainMenu_Options diff --git a/engine/map_objects.asm b/engine/map_objects.asm index bfeefa467..fe3c13a13 100644 --- a/engine/map_objects.asm +++ b/engine/map_objects.asm @@ -285,7 +285,7 @@ EndSpriteMovement: ; 467b ld [hli], a ld [hli], a ld [hli], a - ld [hl], a ; OBJECT_30 + ld [hl], a ; OBJECT_1E ld hl, OBJECT_DIRECTION_WALKING add hl, bc ld [hl], STANDING @@ -482,22 +482,22 @@ MovementAnonymousJumptable: ; 4793 ret ; 479b -ClearObjectStructField28: ; 479b - ld hl, OBJECT_28 +ClearObjectStructField1c: ; 479b + ld hl, OBJECT_1C add hl, bc ld [hl], 0 ret ; 47a2 -IncrementObjectStructField28: ; 47a2 - ld hl, OBJECT_28 +IncrementObjectStructField1c: ; 47a2 + ld hl, OBJECT_1C add hl, bc inc [hl] ret ; 47a8 -Object28AnonymousJumptable: ; 47a8 - ld hl, OBJECT_28 +Field1cAnonymousJumptable: ; 47a8 + ld hl, OBJECT_1C add hl, bc ld a, [hl] pop hl @@ -505,15 +505,15 @@ Object28AnonymousJumptable: ; 47a8 ret ; 47b0 -GetValueObjectStructField28: ; 47b0 - ld hl, OBJECT_28 +GetValueObjectStructField1c: ; 47b0 + ld hl, OBJECT_1C add hl, bc ld a, [hl] ret ; 47b6 -SetValueObjectStructField28: ; 47b6 - ld hl, OBJECT_28 +SetValueObjectStructField1c: ; 47b6 + ld hl, OBJECT_1C add hl, bc ld [hl], a ret @@ -541,7 +541,7 @@ ObjectMovementReset: ; 47bc ; 47dd MapObjectMovementPattern: ; 47dd - call ClearObjectStructField28 + call ClearObjectStructField1c call GetSpriteMovementFunction ld a, [hl] ld hl, .Pointers @@ -1002,7 +1002,7 @@ MapObjectMovementPattern: ; 47dd ld d, b ld e, c pop bc - ld hl, OBJECT_29 + ld hl, OBJECT_1D add hl, bc ld [hl], e inc hl @@ -1021,7 +1021,7 @@ MapObjectMovementPattern: ; 47dd ld hl, OBJECT_STEP_DURATION add hl, bc ld [hl], e - ld hl, OBJECT_30 + ld hl, OBJECT_1E add hl, bc ld [hl], a ld hl, OBJECT_STEP_TYPE @@ -1141,7 +1141,7 @@ WaitStep_InPlace: ; 4b79 ; 4b86 NPCJump: ; 4b86 - call Object28AnonymousJumptable + call Field1cAnonymousJumptable ; anonymous dw dw .Jump dw .Land @@ -1158,7 +1158,7 @@ NPCJump: ; 4b86 ld hl, OBJECT_FLAGS2 add hl, bc res 3, [hl] - call IncrementObjectStructField28 + call IncrementObjectStructField1c ret .Land: @@ -1176,7 +1176,7 @@ NPCJump: ; 4b86 ; 4bbf PlayerJump: ; 4bbf - call Object28AnonymousJumptable + call Field1cAnonymousJumptable ; anonymous dw dw .initjump dw .stepjump @@ -1186,7 +1186,7 @@ PlayerJump: ; 4bbf .initjump ld hl, wPlayerStepFlags set 7, [hl] - call IncrementObjectStructField28 + call IncrementObjectStructField1c .stepjump call UpdateJumpPosition call UpdatePlayerStep @@ -1201,14 +1201,14 @@ PlayerJump: ; 4bbf ld hl, wPlayerStepFlags set 6, [hl] set 4, [hl] - call IncrementObjectStructField28 + call IncrementObjectStructField1c ret .initland call GetNextTile ld hl, wPlayerStepFlags set 7, [hl] - call IncrementObjectStructField28 + call IncrementObjectStructField1c .stepland call UpdateJumpPosition call UpdatePlayerStep @@ -1226,7 +1226,7 @@ PlayerJump: ; 4bbf ; 4c18 TeleportFrom: ; 4c18 - call Object28AnonymousJumptable + call Field1cAnonymousJumptable ; anonymous dw dw .InitSpin dw .DoSpin @@ -1241,7 +1241,7 @@ TeleportFrom: ; 4c18 ld hl, OBJECT_STEP_DURATION add hl, bc ld [hl], 16 - call IncrementObjectStructField28 + call IncrementObjectStructField1c .DoSpin: ld hl, OBJECT_ACTION add hl, bc @@ -1250,14 +1250,14 @@ TeleportFrom: ; 4c18 add hl, bc dec [hl] ret nz - call IncrementObjectStructField28 + call IncrementObjectStructField1c ret .InitSpinRise: ld hl, OBJECT_STEP_FRAME add hl, bc ld [hl], 0 - ld hl, OBJECT_31 + ld hl, OBJECT_1F add hl, bc ld [hl], $10 ld hl, OBJECT_STEP_DURATION @@ -1266,12 +1266,12 @@ TeleportFrom: ; 4c18 ld hl, OBJECT_FLAGS2 add hl, bc res 3, [hl] - call IncrementObjectStructField28 + call IncrementObjectStructField1c .DoSpinRise: ld hl, OBJECT_ACTION add hl, bc ld [hl], OBJECT_ACTION_SPIN - ld hl, OBJECT_31 + ld hl, OBJECT_1F add hl, bc inc [hl] ld a, [hl] @@ -1296,7 +1296,7 @@ TeleportFrom: ; 4c18 ; 4c89 TeleportTo: ; 4c89 - call Object28AnonymousJumptable + call Field1cAnonymousJumptable ; anonymous dw dw .InitWait dw .DoWait @@ -1314,7 +1314,7 @@ TeleportTo: ; 4c89 ld hl, OBJECT_STEP_DURATION add hl, bc ld [hl], 16 - call IncrementObjectStructField28 + call IncrementObjectStructField1c ret ; 4caa @@ -1323,18 +1323,18 @@ TeleportTo: ; 4c89 add hl, bc dec [hl] ret nz - call IncrementObjectStructField28 + call IncrementObjectStructField1c .InitDescent: ld hl, OBJECT_STEP_FRAME add hl, bc ld [hl], 0 - ld hl, OBJECT_31 + ld hl, OBJECT_1F add hl, bc ld [hl], 0 ld hl, OBJECT_STEP_DURATION add hl, bc ld [hl], 16 - call IncrementObjectStructField28 + call IncrementObjectStructField1c ret ; 4cc9 @@ -1342,7 +1342,7 @@ TeleportTo: ; 4c89 ld hl, OBJECT_ACTION add hl, bc ld [hl], OBJECT_ACTION_SPIN - ld hl, OBJECT_31 + ld hl, OBJECT_1F add hl, bc inc [hl] ld a, [hl] @@ -1357,12 +1357,12 @@ TeleportTo: ; 4c89 add hl, bc dec [hl] ret nz - call IncrementObjectStructField28 + call IncrementObjectStructField1c .InitFinalSpin: ld hl, OBJECT_STEP_DURATION add hl, bc ld [hl], 16 - call IncrementObjectStructField28 + call IncrementObjectStructField1c ret ; 4cf5 @@ -1388,7 +1388,7 @@ TeleportTo: ; 4c89 ; 4d14 Skyfall: ; 4d14 - call Object28AnonymousJumptable + call Field1cAnonymousJumptable ; anonymous dw dw .Init dw .Step @@ -1403,7 +1403,7 @@ Skyfall: ; 4d14 ld hl, OBJECT_STEP_DURATION add hl, bc ld [hl], 16 - call IncrementObjectStructField28 + call IncrementObjectStructField1c .Step: ld hl, OBJECT_STEP_DURATION add hl, bc @@ -1415,15 +1415,15 @@ Skyfall: ; 4d14 ld hl, OBJECT_STEP_FRAME add hl, bc ld [hl], 0 - ld hl, OBJECT_31 + ld hl, OBJECT_1F add hl, bc ld [hl], 0 ld hl, OBJECT_STEP_DURATION add hl, bc ld [hl], 16 - call IncrementObjectStructField28 + call IncrementObjectStructField1c .Fall: - ld hl, OBJECT_31 + ld hl, OBJECT_1F add hl, bc inc [hl] ld a, [hl] @@ -1438,7 +1438,7 @@ Skyfall: ; 4d14 add hl, bc dec [hl] ret nz - call IncrementObjectStructField28 + call IncrementObjectStructField1c .Finish: ld hl, OBJECT_STEP_FRAME add hl, bc @@ -1453,7 +1453,7 @@ Skyfall: ; 4d14 ; 4d7e GotBiteStep: ; 4d7e - call Object28AnonymousJumptable + call Field1cAnonymousJumptable ; anonymous dw dw .Init dw .Run @@ -1466,7 +1466,7 @@ GotBiteStep: ; 4d7e ld hl, OBJECT_SPRITE_Y_OFFSET add hl, bc ld [hl], 0 - call IncrementObjectStructField28 + call IncrementObjectStructField1c .Run: ld hl, OBJECT_SPRITE_Y_OFFSET add hl, bc @@ -1558,7 +1558,7 @@ StepTypeBump: ; 4dff ; 4e0c StepType05: ; 4e0c - call Object28AnonymousJumptable + call Field1cAnonymousJumptable ; anonymous dw dw .Reset dw StepType04 @@ -1569,7 +1569,7 @@ StepType05: ; 4e0c ld hl, OBJECT_FACING add hl, bc ld [hl], a - call IncrementObjectStructField28 + call IncrementObjectStructField1c StepType04: ; 4e21 call MobileFn_4fb2 ld hl, OBJECT_DIRECTION_WALKING @@ -1607,7 +1607,7 @@ StepType07: ; 4e47 PlayerStep: ; 4e56 ; AnimateStep? - call Object28AnonymousJumptable + call Field1cAnonymousJumptable ; anonymous dw dw .init dw .step @@ -1615,7 +1615,7 @@ PlayerStep: ; 4e56 .init ld hl, wPlayerStepFlags set 7, [hl] - call IncrementObjectStructField28 + call IncrementObjectStructField1c .step call UpdatePlayerStep ld hl, OBJECT_STEP_DURATION @@ -1635,7 +1635,7 @@ PlayerStep: ; 4e56 ; 4e83 PlayerOrNPCTurnStep: ; 4e83 - call Object28AnonymousJumptable + call Field1cAnonymousJumptable ; anonymous dw dw .init1 dw .step1 @@ -1653,15 +1653,15 @@ PlayerOrNPCTurnStep: ; 4e83 ld hl, OBJECT_STEP_DURATION add hl, bc ld [hl], 2 - call IncrementObjectStructField28 + call IncrementObjectStructField1c .step1 ld hl, OBJECT_STEP_DURATION add hl, bc dec [hl] ret nz - call IncrementObjectStructField28 + call IncrementObjectStructField1c .init2 - ld hl, OBJECT_29 ; new facing + ld hl, OBJECT_1D ; new facing add hl, bc ld a, [hl] ld hl, OBJECT_FACING @@ -1670,7 +1670,7 @@ PlayerOrNPCTurnStep: ; 4e83 ld hl, OBJECT_STEP_DURATION add hl, bc ld [hl], 2 - call IncrementObjectStructField28 + call IncrementObjectStructField1c .step2 ld hl, OBJECT_STEP_DURATION add hl, bc @@ -1715,7 +1715,7 @@ StepType0f: ; 4ecd ; 4f04 StepTypeTrackingObject: ; 4f04 - ld hl, OBJECT_29 + ld hl, OBJECT_1D add hl, bc ld e, [hl] inc hl @@ -1750,19 +1750,19 @@ StepTypeTrackingObject: ; 4f04 StepType14: ; 4f33 StepType15: ; 4f33 - call Object28AnonymousJumptable + call Field1cAnonymousJumptable ; anonymous dw dw .Init dw .Run .Init: xor a - ld hl, OBJECT_29 + ld hl, OBJECT_1D add hl, bc ld [hl], a - call IncrementObjectStructField28 + call IncrementObjectStructField1c .Run: - ld hl, OBJECT_29 + ld hl, OBJECT_1D add hl, bc ld d, [hl] ld a, [wPlayerStepVectorY] @@ -1774,7 +1774,7 @@ StepType15: ; 4f33 jr z, .ok ld a, [hl] call .GetSign - ld hl, OBJECT_29 + ld hl, OBJECT_1D add hl, bc ld [hl], a ld d, a @@ -1788,7 +1788,7 @@ StepType15: ; 4f33 ret .GetSign: - ld hl, OBJECT_30 + ld hl, OBJECT_1E add hl, bc and 1 ld a, [hl] @@ -1799,10 +1799,10 @@ StepType15: ; 4f33 ; 4f77 StepType16: ; 4f77 - call Object28AnonymousJumptable ; ???? + call Field1cAnonymousJumptable ; ???? ; 4f7a StepType17: ; 4f7a - call Object28AnonymousJumptable + call Field1cAnonymousJumptable ; anonymous dw dw .null dw .null @@ -1811,7 +1811,7 @@ StepType17: ; 4f7a ; 4f83 SkyfallTop: ; 4f83 - call Object28AnonymousJumptable + call Field1cAnonymousJumptable ; anonymous dw dw .Init dw .Run @@ -1823,7 +1823,7 @@ SkyfallTop: ; 4f83 ld hl, OBJECT_STEP_DURATION add hl, bc ld [hl], 16 - call IncrementObjectStructField28 + call IncrementObjectStructField1c .Run: ld hl, OBJECT_STEP_DURATION @@ -1843,7 +1843,7 @@ SkyfallTop: ; 4f83 ; 4fb2 MobileFn_4fb2: mobile - ld hl, OBJECT_29 + ld hl, OBJECT_1D add hl, bc inc [hl] ld a, [hl] @@ -1866,7 +1866,7 @@ MobileFn_4fb2: mobile UpdateJumpPosition: ; 4fd5 call GetStepVector ld a, h - ld hl, OBJECT_31 + ld hl, OBJECT_1F add hl, bc ld e, [hl] add e diff --git a/engine/mon_icons.asm b/engine/mon_icons.asm index 695e28770..316ff3bac 100755 --- a/engine/mon_icons.asm +++ b/engine/mon_icons.asm @@ -46,7 +46,6 @@ LoadMenuMonIcon: ; 8e83f dw Mobile_InitPartyMenuBGPal71 ; mobile dw .GetPartyMenuMonIcon ; unused - .GetPartyMenuMonIcon: ; 8e862 (23:6862) call InitPartyMenuIcon call .GetPartyMonItemGFX diff --git a/engine/movement.asm b/engine/movement.asm index bec089978..3ba48d60d 100644 --- a/engine/movement.asm +++ b/engine/movement.asm @@ -727,7 +727,7 @@ Movement_turn_step_right: ; 53fc jr TurnStep TurnStep: ; 5400 - ld hl, OBJECT_29 ; new facing + ld hl, OBJECT_1D ; new facing add hl, bc ld [hl], a @@ -832,7 +832,7 @@ SlideStep: ; 5468 JumpStep: ; 548a call InitStep - ld hl, OBJECT_31 + ld hl, OBJECT_1F add hl, bc ld [hl], $0 diff --git a/engine/mystery_gift.asm b/engine/mystery_gift.asm index e6d4504c2..67ce10168 100755 --- a/engine/mystery_gift.asm +++ b/engine/mystery_gift.asm @@ -116,7 +116,7 @@ DoMysteryGift: ; 1048ba (41:48ba) .PrintTextAndExit: ; 1049c5 (41:49c5) call PrintText - ld a, $e3 + ld a, LCDC_DEFAULT ld [rLCDC], a ret ; 1049cd (41:49cd) @@ -262,7 +262,7 @@ Function104a95: ; 104a95 (41:4a95) ; Delay frame .ly_loop ld a, [rLY] - cp $90 + cp LY_VBLANK jr c, .ly_loop ld c, LOW(rRP) ld a, $c0 @@ -281,14 +281,14 @@ Function104a95: ; 104a95 (41:4a95) and b ld b, a ld a, [rLY] - cp $90 + cp LY_VBLANK jr nc, .ly_loop2 .ly_loop3 ld a, [$ff00+c] and b ld b, a ld a, [rLY] - cp $90 + cp LY_VBLANK jr c, .ly_loop3 ld a, b @@ -1497,7 +1497,7 @@ Function10571a: ; 10571a (41:571a) asm_105726: ; 105726 (41:5726) call PrintText - ld a, $e3 + ld a, LCDC_DEFAULT ld [rLCDC], a ret ; 10572e (41:572e) diff --git a/engine/namingscreen.asm b/engine/namingscreen.asm index a01c02c31..177f06f73 100755 --- a/engine/namingscreen.asm +++ b/engine/namingscreen.asm @@ -48,7 +48,7 @@ NamingScreen: ; 116c1 call DisableLCD call LoadNamingScreenGFX call NamingScreen_InitText - ld a, $e3 + ld a, LCDC_DEFAULT ld [rLCDC], a call .GetNamingScreenSetup call WaitBGMap @@ -1017,7 +1017,7 @@ _ComposeMailMessage: ; 11e75 (mail?) add hl, bc ld [hl], $0 call .InitCharset - ld a, $e3 + ld a, LCDC_DEFAULT ld [rLCDC], a call .initwNamingScreenMaxNameLength ld b, SCGB_DIPLOMA diff --git a/engine/pack.asm b/engine/pack.asm index b4f6d4ef1..047924cb0 100644 --- a/engine/pack.asm +++ b/engine/pack.asm @@ -28,7 +28,6 @@ Pack: ; 10000 ; 10030 .Jumptable: ; 10030 (4:4030) - dw .InitGFX ; 0 dw .InitItemsPocket ; 1 dw .ItemsPocketMenu ; 2 @@ -694,7 +693,6 @@ BattlePack: ; 10493 ; 104c3 .Jumptable: ; 104c3 (4:44c3) - dw .InitGFX ; 0 dw .InitItemsPocket ; 1 dw .ItemsPocketMenu ; 2 @@ -865,7 +863,6 @@ TMHMSubmenu: ; 105dc (4:45dc) ; 0x10614 .UsableJumptable: ; 10614 - dw .Use dw .Quit ; 10618 @@ -885,7 +882,6 @@ TMHMSubmenu: ; 105dc (4:45dc) ; 0x10627 .UnusableJumptable: ; 10627 - dw .Quit ; 10629 @@ -897,7 +893,6 @@ TMHMSubmenu: ; 105dc (4:45dc) ret .ItemFunctionJumptable: ; 10637 (4:4637) - dw .Oak dw .Oak dw .Oak @@ -1002,11 +997,11 @@ DepositSellPack: ; 106be ; 106d1 .Jumptable: ; 106d1 (4:46d1) - dw .ItemsPocket dw .BallsPocket dw .KeyItemsPocket dw .TMHMPocket + .ItemsPocket: ; 106d9 (4:46d9) xor a call InitPocket diff --git a/engine/player_step.asm b/engine/player_step.asm index c20bc09e9..996a9b422 100755 --- a/engine/player_step.asm +++ b/engine/player_step.asm @@ -59,7 +59,6 @@ HandlePlayerStep: ; d4e5 (3:54e5) ret .Jumptable: ; d4f2 (3:54f2) - dw GetMovementPermissions dw BufferScreen dw .mobile diff --git a/engine/pokedex.asm b/engine/pokedex.asm index 95f9404f9..0297cf840 100644 --- a/engine/pokedex.asm +++ b/engine/pokedex.asm @@ -184,7 +184,6 @@ Pokedex_RunJumptable: ; 4010b call Pokedex_LoadPointer jp hl - .Jumptable: ; 40115 (10:4115) dw Pokedex_InitMainScreen dw Pokedex_UpdateMainScreen @@ -201,7 +200,6 @@ Pokedex_RunJumptable: ; 4010b dw Pokedex_UpdateUnownMode dw Pokedex_Exit - Pokedex_IncrementDexPointer: ; 40131 (10:4131) ld hl, wJumptableIndex inc [hl] @@ -1623,13 +1621,11 @@ Pokedex_OrderMonsByMode: ; 40bdc call Pokedex_LoadPointer jp hl - .Jumptable: ; 40bf0 (10:4bf0) dw .NewMode dw .OldMode dw Pokedex_ABCMode - .NewMode: ; 40bf6 (10:4bf6) ld de, NewPokedexOrder ld hl, wPokedexOrder diff --git a/engine/pokegear.asm b/engine/pokegear.asm index aff64ef6c..dba071b28 100755 --- a/engine/pokegear.asm +++ b/engine/pokegear.asm @@ -59,7 +59,7 @@ PokeGear: ; 90b8d (24:4b8d) call InitPokegearModeIndicatorArrow ld a, 8 call SkipMusic - ld a, $e3 + ld a, LCDC_DEFAULT ld [rLCDC], a call TownMap_InitCursorAndPlayerIconPositions xor a @@ -285,7 +285,6 @@ InitPokegearTilemap: ; 90da8 (24:4da8) dw .Map dw .Phone dw .Radio - ; 90e1a .Clock: ; 90e1a @@ -1852,7 +1851,7 @@ _TownMap: ; 9191c farcall ClearSpriteAnims ld a, 8 call SkipMusic - ld a, $e3 + ld a, LCDC_DEFAULT ld [rLCDC], a call TownMap_GetCurrentLandmark ld [wTownMapPlayerIconLandmark], a diff --git a/engine/printer_serial.asm b/engine/printer_serial.asm index 06891db5b..02d0595fa 100755 --- a/engine/printer_serial.asm +++ b/engine/printer_serial.asm @@ -29,9 +29,7 @@ PrinterJumptableIteration: ; 84022 jp hl ; 84031 - .Jumptable: ; 84031 (21:4031) - dw Print_InitPrinterHandshake ; 00 dw Printer_CheckConnectionStatus ; 01 dw Printer_WaitSerial ; 02 @@ -55,7 +53,6 @@ PrinterJumptableIteration: ; 84022 dw Printer_WaitLoopBack ; 12 dw Printer_WaitLoopBack_ ; 13 - Printer_NextSection: ; 84059 (21:4059) ld hl, wJumptableIndex inc [hl] @@ -471,7 +468,6 @@ _PrinterReceive:: ; 842db jp hl ; 842ea - .Jumptable: ; 842ea (21:42ea) dw Printer_DoNothing ; 00 @@ -509,7 +505,6 @@ _PrinterReceive:: ; 842db dw Printer_ReceiveTowPrinterHandshakeAndSend0x00 ; 1e dw Printer_ReceiveTowPrinterStatusFlagsAndExitSendLoop ; 1f - Printer_NextInstruction: ; 8432a (21:432a) ld hl, wPrinterOpcode inc [hl] diff --git a/engine/routines/getsquareroot.asm b/engine/routines/getsquareroot.asm index 009d9f4fe..0ba2e50a5 100644 --- a/engine/routines/getsquareroot.asm +++ b/engine/routines/getsquareroot.asm @@ -23,8 +23,8 @@ GetSquareRoot: ; 13b87 ret .Squares: ; 13b98 -root set 1 +root = 1 rept $ff - dw root*root -root set root+1 + dw root * root +root = root + 1 endr diff --git a/engine/routines/phonering_copytilemapatonce.asm b/engine/routines/phonering_copytilemapatonce.asm index b1a726675..cefe9a66d 100644 --- a/engine/routines/phonering_copytilemapatonce.asm +++ b/engine/routines/phonering_copytilemapatonce.asm @@ -17,7 +17,7 @@ PhoneRing_CopyTilemapAtOnce: ; 4d188 ld [hMapAnims], a .wait ld a, [rLY] - cp $8f + cp LY_VBLANK - 1 jr c, .wait di @@ -31,7 +31,7 @@ PhoneRing_CopyTilemapAtOnce: ; 4d188 call .CopyTilemapAtOnce .wait2 ld a, [rLY] - cp $8f + cp LY_VBLANK - 1 jr c, .wait2 ei diff --git a/engine/slot_machine.asm b/engine/slot_machine.asm index d77eb6a1a..aea08f16a 100755 --- a/engine/slot_machine.asm +++ b/engine/slot_machine.asm @@ -8,6 +8,19 @@ SLOTS_SQUIRTLE EQU $10 SLOTS_STARYU EQU $14 REEL_SIZE EQU 15 +; Constants for slot_reel offsets (see macros/wram.asm) +REEL_ACTION EQUS "(wReel1ReelAction - wReel1)" +REEL_TILEMAP_ADDR EQUS "(wReel1TilemapAddr - wReel1)" +REEL_POSITION EQUS "(wReel1Position - wReel1)" +REEL_SPIN_DISTANCE EQUS "(wReel1SpinDistance - wReel1)" +REEL_SPIN_RATE EQUS "(wReel1SpinRate - wReel1)" +REEL_OAM_ADDR EQUS "(wReel1OAMAddr - wReel1)" +REEL_X_COORD EQUS "(wReel1XCoord - wReel1)" +REEL_MANIP_COUNTER EQUS "(wReel1ManipCounter - wReel1)" +REEL_MANIP_DELAY EQUS "(wReel1ManipDelay - wReel1)" +REEL_FIELD_0B EQUS "(wReel1Field0b - wReel1)" +REEL_STOP_DELAY EQUS "(wReel1StopDelay - wReel1)" + ; SlotsJumptable constants const_def const SLOTS_INIT @@ -20,8 +33,8 @@ REEL_SIZE EQU 15 const SLOTS_WAIT_REEL3 const SLOTS_WAIT_STOP_REEL3 const SLOTS_NEXT_09 - const SLOTS_NEXT_0a - const SLOTS_NEXT_0b + const SLOTS_NEXT_0A + const SLOTS_NEXT_0B const SLOTS_FLASH_IF_WIN const SLOTS_FLASH_SCREEN const SLOTS_GIVE_EARNED_COINS @@ -76,7 +89,7 @@ _SlotMachine: ld hl, Options res NO_TEXT_SCROLL, [hl] ld hl, rLCDC - res 2, [hl] + res rLCDC_SPRITE_SIZE, [hl] ; 8x8 ret .InitGFX: ; 926f7 (24:66f7) @@ -121,7 +134,7 @@ _SlotMachine: call CopyBytes ld hl, rLCDC - set 2, [hl] + set rLCDC_SPRITE_SIZE, [hl] ; 8x16 call EnableLCD ld hl, wSlots ld bc, wSlotsEnd - wSlots @@ -536,7 +549,7 @@ Slots_CheckCoinCaseFull: ; 92a04 (24:6a04) ret Slots_GetCurrentReelState: ; 92a12 (24:6a12) - ld hl, wReel1Position - wReel1 + ld hl, REEL_POSITION add hl, bc ld a, [hl] and a @@ -547,7 +560,7 @@ Slots_GetCurrentReelState: ; 92a12 (24:6a12) and $f ld e, a ld d, $0 - ld hl, wReel1TilemapAddr - wReel1 + ld hl, REEL_TILEMAP_ADDR add hl, bc ld a, [hli] ld h, [hl] @@ -655,68 +668,68 @@ Slots_StopReel3: ; 92a60 (24:6a60) Slots_InitReelTiles: ; 92a98 (24:6a98) ld bc, wReel1 - ld hl, wReel1OAMAddr - wReel1 + ld hl, REEL_OAM_ADDR add hl, bc ld de, Sprites + 16 * 4 ld [hl], e inc hl ld [hl], d - ld hl, wReel1TilemapAddr - wReel1 + ld hl, REEL_TILEMAP_ADDR add hl, bc ld de, Reel1Tilemap ld [hl], e inc hl ld [hl], d - ld hl, wReel1XCoord - wReel1 + ld hl, REEL_X_COORD add hl, bc ld [hl], 6 * 8 call .OAM ld bc, wReel2 - ld hl, wReel1OAMAddr - wReel1 + ld hl, REEL_OAM_ADDR add hl, bc ld de, Sprites + 24 * 4 ld [hl], e inc hl ld [hl], d - ld hl, wReel1TilemapAddr - wReel1 + ld hl, REEL_TILEMAP_ADDR add hl, bc ld de, Reel2Tilemap ld [hl], e inc hl ld [hl], d - ld hl, wReel1XCoord - wReel1 + ld hl, REEL_X_COORD add hl, bc ld [hl], 10 * 8 call .OAM ld bc, wReel3 - ld hl, wReel1OAMAddr - wReel1 + ld hl, REEL_OAM_ADDR add hl, bc ld de, Sprites + 32 * 4 ld [hl], e inc hl ld [hl], d - ld hl, wReel1TilemapAddr - wReel1 + ld hl, REEL_TILEMAP_ADDR add hl, bc ld de, Reel3Tilemap ld [hl], e inc hl ld [hl], d - ld hl, wReel1XCoord - wReel1 + ld hl, REEL_X_COORD add hl, bc ld [hl], 14 * 8 call .OAM ret .OAM: ; 92af9 (24:6af9) - ld hl, wReel1ReelAction - wReel1 + ld hl, REEL_ACTION add hl, bc ld [hl], REEL_ACTION_DO_NOTHING - ld hl, wReel1Position - wReel1 + ld hl, REEL_POSITION add hl, bc ld [hl], REEL_SIZE - 1 - ld hl, wReel1SpinDistance - wReel1 + ld hl, REEL_SPIN_DISTANCE add hl, bc ld [hl], REEL_ACTION_DO_NOTHING call Slots_UpdateReelPositionAndOAM @@ -732,26 +745,26 @@ Slots_SpinReels: ; 92b0f (24:6b0f) ret .SpinReel: ; 92b22 (24:6b22) - ld hl, wReel1SpinDistance - wReel1 + ld hl, REEL_SPIN_DISTANCE add hl, bc ld a, [hl] and $f jr nz, .skip call ReelActionJumptable .skip - ld hl, wReel1SpinRate - wReel1 + ld hl, REEL_SPIN_RATE add hl, bc ld a, [hl] and a ret z ld d, a - ld hl, wReel1SpinDistance - wReel1 + ld hl, REEL_SPIN_DISTANCE add hl, bc add [hl] ld [hl], a and $f jr z, Slots_UpdateReelPositionAndOAM - ld hl, wReel1OAMAddr - wReel1 + ld hl, REEL_OAM_ADDR add hl, bc ld a, [hli] ld h, [hl] @@ -769,17 +782,17 @@ Slots_SpinReels: ; 92b0f (24:6b0f) ret Slots_UpdateReelPositionAndOAM: ; 92b53 (24:6b53) - ld hl, wReel1XCoord - wReel1 + ld hl, REEL_X_COORD add hl, bc ld a, [hl] ld [wCurrReelXCoord], a ld a, 10 * 8 ld [wCurrReelYCoord], a - ld hl, wReel1Position - wReel1 + ld hl, REEL_POSITION add hl, bc ld e, [hl] ld d, 0 - ld hl, wReel1TilemapAddr - wReel1 + ld hl, REEL_TILEMAP_ADDR add hl, bc ld a, [hli] ld h, [hl] @@ -788,7 +801,7 @@ Slots_UpdateReelPositionAndOAM: ; 92b53 (24:6b53) ld e, l ld d, h call .LoadOAM - ld hl, wReel1Position - wReel1 + ld hl, REEL_POSITION add hl, bc ld a, [hl] inc a @@ -801,7 +814,7 @@ Slots_UpdateReelPositionAndOAM: ; 92b53 (24:6b53) ret .LoadOAM: ; 92b83 (24:6b83) - ld hl, wReel1OAMAddr - wReel1 + ld hl, REEL_OAM_ADDR add hl, bc ld a, [hli] ld h, [hl] @@ -862,7 +875,7 @@ Function92bbe: ; 92bbe ; 92bd4 ReelActionJumptable: ; 92bd4 (24:6bd4) - ld hl, wReel1ReelAction - wReel1 + ld hl, REEL_ACTION add hl, bc ld e, [hl] ld d, 0 @@ -910,7 +923,7 @@ ReelAction_DoNothing: ; 92c16 ; 92c17 ReelAction_QuadrupleRate: ; 92c17 - ld hl, wReel1SpinRate - wReel1 + ld hl, REEL_SPIN_RATE add hl, bc ld [hl], 16 ret @@ -918,7 +931,7 @@ ReelAction_QuadrupleRate: ; 92c17 ; 92c1e ReelAction_DoubleRate: ; 92c1e - ld hl, wReel1SpinRate - wReel1 + ld hl, REEL_SPIN_RATE add hl, bc ld [hl], 8 ret @@ -926,7 +939,7 @@ ReelAction_DoubleRate: ; 92c1e ; 92c25 ReelAction_NormalRate: ; 92c25 - ld hl, wReel1SpinRate - wReel1 + ld hl, REEL_SPIN_RATE add hl, bc ld [hl], 4 ret @@ -934,7 +947,7 @@ ReelAction_NormalRate: ; 92c25 ; 92c2c ReelAction_HalfRate: ; 92c2c - ld hl, wReel1SpinRate - wReel1 + ld hl, REEL_SPIN_RATE add hl, bc ld [hl], 2 ret @@ -942,7 +955,7 @@ ReelAction_HalfRate: ; 92c2c ; 92c33 ReelAction_QuarterRate: ; 92c33 - ld hl, wReel1SpinRate - wReel1 + ld hl, REEL_SPIN_RATE add hl, bc ld [hl], 1 ret @@ -950,17 +963,17 @@ ReelAction_QuarterRate: ; 92c33 ; 92c3a Slots_StopReel: ; 92c3a - ld hl, wReel1SpinRate - wReel1 + ld hl, REEL_SPIN_RATE add hl, bc ld [hl], 0 - ld hl, wReel1ReelAction - wReel1 + ld hl, REEL_ACTION add hl, bc ld [hl], REEL_ACTION_STOP_REEL_IGNORE_JOYPAD - ld hl, wReel1StopDelay - wReel1 + ld hl, REEL_STOP_DELAY add hl, bc ld [hl], 3 ReelAction_StopReelIgnoreJoypad: ; 92c4c - ld hl, wReel1StopDelay - wReel1 + ld hl, REEL_STOP_DELAY add hl, bc ld a, [hl] and a @@ -969,7 +982,7 @@ ReelAction_StopReelIgnoreJoypad: ; 92c4c ret .EndReel: - ld hl, wReel1ReelAction - wReel1 + ld hl, REEL_ACTION add hl, bc ld a, REEL_ACTION_DO_NOTHING ld [hl], a @@ -979,14 +992,14 @@ ReelAction_StopReelIgnoreJoypad: ; 92c4c ReelAction_StopReel1: ; 92c5e ; If no bias: don't manipulate reel. -; If bias: manipulate reel up to wReel1ManipCounter (i.e. 4) times, +; If bias: manipulate reel up to wReel1ManipCounter (i.e. 4) slots, ; stoping early if the biased symbol shows up anywhere in reel #1, ; even if the current bet won't allow lining it up. ld a, [wSlotBias] cp SLOTS_NOBIAS jr z, .NoBias - ld hl, wReel1ManipCounter - wReel1 + ld hl, REEL_MANIP_COUNTER add hl, bc ld a, [hl] and a @@ -1018,7 +1031,7 @@ ReelAction_StopReel1: ; 92c5e ReelAction_StopReel2: ; 92c86 ; If no bias: don't manipulate reel. -; If bias: manipulate reel up to wReel2ManipCounter (i.e. 4) times, +; If bias: manipulate reel up to wReel2ManipCounter (i.e. 4) slots, ; stoping early if the biased symbol is lined up in the first two ; reels, according to the lines that the current bet allows. @@ -1032,7 +1045,7 @@ ReelAction_StopReel2: ; 92c86 ld a, [wSlotBias] cp SLOTS_NOBIAS jr z, .NoBias - ld hl, wReel1ManipCounter - wReel1 + ld hl, REEL_MANIP_COUNTER add hl, bc ld a, [hl] and a @@ -1047,7 +1060,7 @@ ReelAction_StopReel2: ; 92c86 ; 92ca9 ReelAction_StopReel3: ; 92ca9 -; Manipulate the reel up to wReel3ManipCounter (i.e. 4) times, +; Manipulate the reel up to wReel3ManipCounter (i.e. 4) slots, ; stopping early if the bias symbol is lined up for a win. ; If not biased to any symbols, stop as soon as nothing is lined up. @@ -1056,7 +1069,7 @@ ReelAction_StopReel3: ; 92ca9 ld hl, wSlotBias cp [hl] jr z, .NoBias - ld hl, wReel1ManipCounter - wReel1 + ld hl, REEL_MANIP_COUNTER add hl, bc ld a, [hl] and a @@ -1068,7 +1081,7 @@ ReelAction_StopReel3: ; 92ca9 ld a, [wSlotBias] cp SLOTS_NOBIAS jr z, .NoBias - ld hl, wReel1ManipCounter - wReel1 + ld hl, REEL_MANIP_COUNTER add hl, bc ld a, [hl] and a @@ -1099,13 +1112,13 @@ ReelAction_SetUpReel2SkipTo7: ; 92cd2 .no_match ld a, SFX_STOP_SLOT call Slots_PlaySFX - ld hl, wReel1ReelAction - wReel1 + ld hl, REEL_ACTION add hl, bc inc [hl] ; REEL_ACTION_WAIT_REEL2_SKIP_TO_7 - ld hl, wReel1ManipDelay - wReel1 + ld hl, REEL_MANIP_DELAY add hl, bc ld [hl], 32 - ld hl, wReel1SpinRate - wReel1 + ld hl, REEL_SPIN_RATE add hl, bc ld [hl], 0 ret @@ -1113,7 +1126,7 @@ ReelAction_SetUpReel2SkipTo7: ; 92cd2 ; 92cf8 ReelAction_WaitReel2SkipTo7: ; 92cf8 - ld hl, wReel1ManipDelay - wReel1 + ld hl, REEL_MANIP_DELAY add hl, bc ld a, [hl] and a @@ -1124,10 +1137,10 @@ ReelAction_WaitReel2SkipTo7: ; 92cf8 .asm_92d02 ld a, SFX_THROW_BALL call Slots_PlaySFX - ld hl, wReel1ReelAction - wReel1 + ld hl, REEL_ACTION add hl, bc inc [hl] ; REEL_ACTION_FAST_SPIN_REEL2_UNTIL_LINED_UP_7S - ld hl, wReel1SpinRate - wReel1 + ld hl, REEL_SPIN_RATE add hl, bc ld [hl], 8 ret @@ -1159,10 +1172,10 @@ ReelAction_InitGolem: ; 92d20 ld a, SFX_STOP_SLOT call Slots_PlaySFX call Slots_WaitSFX - ld hl, wReel1ReelAction - wReel1 + ld hl, REEL_ACTION add hl, bc inc [hl] ; REEL_ACTION_WAIT_GOLEM - ld hl, wReel1SpinRate - wReel1 + ld hl, REEL_SPIN_RATE add hl, bc ld [hl], 0 call Slots_GetNumberOfGolems @@ -1192,10 +1205,10 @@ ReelAction_WaitGolem: ; 92d4f ret .one - ld hl, wReel1ReelAction - wReel1 + ld hl, REEL_ACTION add hl, bc inc [hl] ; REEL_ACTION_END_GOLEM - ld hl, wReel1SpinRate - wReel1 + ld hl, REEL_SPIN_RATE add hl, bc ld [hl], 8 ret @@ -1205,10 +1218,10 @@ ReelAction_WaitGolem: ; 92d4f ReelAction_EndGolem: ; 92d6e xor a ld [wSlotsDelay], a - ld hl, wReel1ReelAction - wReel1 + ld hl, REEL_ACTION add hl, bc dec [hl] ; REEL_ACTION_WAIT_GOLEM - ld hl, wReel1SpinRate - wReel1 + ld hl, REEL_SPIN_RATE add hl, bc ld [hl], 0 ret @@ -1226,10 +1239,10 @@ ReelAction_InitChansey: ; 92d7e ld a, SFX_STOP_SLOT call Slots_PlaySFX call Slots_WaitSFX - ld hl, wReel1ReelAction - wReel1 + ld hl, REEL_ACTION add hl, bc inc [hl] ; REEL_ACTION_WAIT_CHANSEY - ld hl, wReel1SpinRate - wReel1 + ld hl, REEL_SPIN_RATE add hl, bc ld [hl], 0 push bc @@ -1247,7 +1260,7 @@ ReelAction_WaitChansey: ; 92da4 ld a, [wSlotsDelay] and a ret z - ld hl, wReel1ReelAction - wReel1 + ld hl, REEL_ACTION add hl, bc inc [hl] ; REEL_ACTION_WAIT_EGG ld a, 2 @@ -1256,17 +1269,17 @@ ReelAction_WaitEgg: ; 92db3 ld a, [wSlotsDelay] cp $4 ret c - ld hl, wReel1ReelAction - wReel1 + ld hl, REEL_ACTION add hl, bc inc [hl] ; REEL_ACTION_DROP_REEL - ld hl, wReel1SpinRate - wReel1 + ld hl, REEL_SPIN_RATE add hl, bc ld [hl], 16 - ld hl, wReel1ManipDelay - wReel1 + ld hl, REEL_MANIP_DELAY add hl, bc ld [hl], 17 ReelAction_DropReel: ; 92dca - ld hl, wReel1ManipDelay - wReel1 + ld hl, REEL_MANIP_DELAY add hl, bc ld a, [hl] and a @@ -1285,10 +1298,10 @@ ReelAction_DropReel: ; 92dca ret .EggAgain: - ld hl, wReel1SpinRate - wReel1 + ld hl, REEL_SPIN_RATE add hl, bc ld [hl], 0 - ld hl, wReel1ReelAction - wReel1 + ld hl, REEL_ACTION add hl, bc dec [hl] dec [hl] ; REEL_ACTION_WAIT_CHANSEY @@ -1304,15 +1317,15 @@ ReelAction_Unused: ; 92df7 ld a, SFX_STOP_SLOT call Slots_PlaySFX call Slots_WaitSFX - ld hl, wReel1ReelAction - wReel1 + ld hl, REEL_ACTION add hl, bc inc [hl] ; REEL_ACTION_CHECK_DROP_REEL call Slots_GetNumberOfGolems - ld hl, wReel1ManipDelay - wReel1 + ld hl, REEL_MANIP_DELAY add hl, bc ld [hl], a ReelAction_CheckDropReel: ; 92e10 - ld hl, wReel1ManipDelay - wReel1 + ld hl, REEL_MANIP_DELAY add hl, bc ld a, [hl] and a @@ -1323,17 +1336,17 @@ ReelAction_CheckDropReel: ; 92e10 .spin dec [hl] - ld hl, wReel1ReelAction - wReel1 + ld hl, REEL_ACTION add hl, bc inc [hl] ; REEL_ACTION_WAIT_DROP_REEL - ld hl, wReel1Slot0b - wReel1 + ld hl, REEL_FIELD_0B add hl, bc ld [hl], 32 - ld hl, wReel1SpinRate - wReel1 + ld hl, REEL_SPIN_RATE add hl, bc ld [hl], 0 ReelAction_WaitDropReel: ; 92e31 - ld hl, wReel1Slot0b - wReel1 + ld hl, REEL_FIELD_0B add hl, bc ld a, [hl] and a @@ -1342,10 +1355,10 @@ ReelAction_WaitDropReel: ; 92e31 ret .DropReel: - ld hl, wReel1ReelAction - wReel1 + ld hl, REEL_ACTION add hl, bc dec [hl] - ld hl, wReel1SpinRate - wReel1 + ld hl, REEL_SPIN_RATE add hl, bc ld [hl], 8 ret @@ -1365,17 +1378,17 @@ ReelAction_StartSlowAdvanceReel3: ; 92e47 ld a, SFX_STOP_SLOT call Slots_PlaySFX call Slots_WaitSFX - ld hl, wReel1SpinRate - wReel1 + ld hl, REEL_SPIN_RATE add hl, bc ld [hl], 1 - ld hl, wReel1ReelAction - wReel1 + ld hl, REEL_ACTION add hl, bc inc [hl] ; REEL_ACTION_WAIT_SLOW_ADVANCE_REEL3 - ld hl, wReel1ManipDelay - wReel1 + ld hl, REEL_MANIP_DELAY add hl, bc ld [hl], 16 ReelAction_WaitSlowAdvanceReel3: ; 92e64 - ld hl, wReel1ManipDelay - wReel1 + ld hl, REEL_MANIP_DELAY add hl, bc ld a, [hl] and a @@ -1437,7 +1450,6 @@ Slots_CheckMatchedFirstTwoReels: ; 92e94 ; 92ebd .Jumptable: ; 92ebd - dw .zero dw .one dw .two @@ -1552,7 +1564,6 @@ Slots_CheckMatchedAllThreeReels: ; 92f1d ; 92f48 .Jumptable: ; 92f48 - dw .zero dw .one dw .two @@ -1656,7 +1667,7 @@ Slots_CopyReelState: ; 92fb4 ; 92fc0 Slots_GetNumberOfGolems: ; 92fc0 - ld hl, wReel1Position - wReel1 + ld hl, REEL_POSITION add hl, bc ld a, [hl] push af @@ -1676,7 +1687,7 @@ Slots_GetNumberOfGolems: ; 92fc0 jr nz, .not_biased_to_seven ld e, $0 .loop1 - ld hl, wReel1Position - wReel1 + ld hl, REEL_POSITION add hl, bc inc [hl] inc e @@ -1697,7 +1708,7 @@ Slots_GetNumberOfGolems: ; 92fc0 .loop2 ld a, e inc e - ld hl, wReel1Position - wReel1 + ld hl, REEL_POSITION add hl, bc add [hl] ld [hl], a @@ -2032,7 +2043,7 @@ endr ; or this code was intended to lead to flipped percentages. ld a, [wKeepSevenBiasChance] and a - jr nz, .lowerSevenStreakOdds + jr nz, .lower_seven_streak_odds call Random and %0010100 ret z ; 25% chance to stick with seven symbol bias @@ -2040,7 +2051,7 @@ endr ld [wSlotBias], a ret -.lowerSevenStreakOdds +.lower_seven_streak_odds call Random and %0011100 ret z ; 12.5% chance to stick with seven symbol bias @@ -2080,12 +2091,10 @@ Slots_AnimateGolem: ; 9321d (24:721d) jp hl .Jumptable: ; 9322d (24:722d) - dw .init dw .fall dw .roll - .init ; 93233 (24:7233) ld hl, SPRITEANIMSTRUCT_0E add hl, bc @@ -2181,12 +2190,10 @@ Slots_AnimateChansey: ; 932ac (24:72ac) jp hl .Jumptable: ; 932bc (24:72bc) - dw .walk dw .one dw .two - .walk ; 932c2 (24:72c2) ld hl, SPRITEANIMSTRUCT_XCOORD add hl, bc diff --git a/engine/sprite_anims.asm b/engine/sprite_anims.asm index edd1daf32..9fb78a5d7 100755 --- a/engine/sprite_anims.asm +++ b/engine/sprite_anims.asm @@ -50,7 +50,6 @@ DoAnimFrame: ; 8d24b dw .IntroUnownF dw .IntroSuicuneAway - .Null: ; 8d2a1 (23:52a1) ret diff --git a/engine/stats_screen.asm b/engine/stats_screen.asm index fa124e1b3..9f632f388 100755 --- a/engine/stats_screen.asm +++ b/engine/stats_screen.asm @@ -534,12 +534,10 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6) ret .Jumptable: ; 4e00d (13:600d) - dw .PinkPage dw .GreenPage dw .BluePage - .PinkPage: ; 4e013 (13:6013) hlcoord 0, 9 ld b, $0 @@ -888,7 +886,6 @@ StatsScreen_GetAnimationParam: ; 4e2ad (13:62ad) dw .Tempmon dw .Wildmon - .PartyMon: ; 4e2bf (13:62bf) ld a, [CurPartyMon] ld hl, PartyMon1 diff --git a/engine/title.asm b/engine/title.asm index 2ea588cd0..6b015300f 100644 --- a/engine/title.asm +++ b/engine/title.asm @@ -201,7 +201,7 @@ _TitleScreen: ; 10ed67 ; Set sprite size to 8x16 ld a, [rLCDC] - set 2, a + set rLCDC_SPRITE_SIZE, a ld [rLCDC], a ld a, +112 diff --git a/engine/trainer_card.asm b/engine/trainer_card.asm index 2905e8eb3..87cab0103 100755 --- a/engine/trainer_card.asm +++ b/engine/trainer_card.asm @@ -80,7 +80,6 @@ TrainerCard: ; 25105 dw TrainerCard_Page3_Joypad dw TrainerCard_Quit - TrainerCard_IncrementJumptable: ; 251ab (9:51ab) ld hl, wJumptableIndex inc [hl] diff --git a/engine/unown_puzzle.asm b/engine/unown_puzzle.asm index 525345e68..ee76f817c 100755 --- a/engine/unown_puzzle.asm +++ b/engine/unown_puzzle.asm @@ -45,7 +45,7 @@ UnownPuzzle: ; e1190 ld [wHoldingUnownPuzzlePiece], a ld [wUnownPuzzleCursorPosition], a ld [wUnownPuzzleHeldPiece], a - ld a, $93 + ld a, %10010011 ld [rLCDC], a call WaitBGMap ld b, SCGB_UNOWN_PUZZLE @@ -85,7 +85,7 @@ UnownPuzzle: ; e1190 call ClearBGPalettes call ClearTileMap call ClearSprites - ld a, $e3 + ld a, LCDC_DEFAULT ld [rLCDC], a ret ; e124e @@ -188,7 +188,6 @@ UnownPuzzleJumptable: ; e12ca ; e12d9 .Jumptable: ; e12d9 - dw .Function ; e12db diff --git a/engine/unused_title.asm b/engine/unused_title.asm index ca508b593..650e17863 100644 --- a/engine/unused_title.asm +++ b/engine/unused_title.asm @@ -55,8 +55,8 @@ UnusedTitleScreen: ; 10c000 call EnableLCD ld a, [rLCDC] - set 1, a - set 2, a + set rLCDC_SPRITES_ENABLE, a + set rLCDC_SPRITE_SIZE, a ld [rLCDC], a call DelayFrame diff --git a/gfx/font.asm b/gfx/font.asm index e307d619c..9da7eaafc 100755 --- a/gfx/font.asm +++ b/gfx/font.asm @@ -107,7 +107,7 @@ _LoadStandardFont:: ; fb449 ld hl, vTiles1 lb bc, BANK(Font), $80 ld a, [rLCDC] - bit 7, a + bit rLCDC_ENABLE, a jp z, Copy1bpp ld de, Font diff --git a/home/copy.asm b/home/copy.asm index 210fb773e..33268b6bf 100644 --- a/home/copy.asm +++ b/home/copy.asm @@ -3,7 +3,7 @@ Get2bpp_2:: ; dc9 ld a, [rLCDC] - bit 7, a + bit rLCDC_ENABLE, a jp z, Copy2bpp homecall _Get2bpp @@ -13,7 +13,7 @@ Get2bpp_2:: ; dc9 Get1bpp_2:: ; ddc ld a, [rLCDC] - bit 7, a + bit rLCDC_ENABLE, a jp z, Copy1bpp homecall _Get1bpp @@ -361,7 +361,7 @@ Request1bpp:: ; f1e Get2bpp:: ; f82 ld a, [rLCDC] - bit 7, a + bit rLCDC_ENABLE, a jp nz, Request2bpp Copy2bpp:: ; f89 @@ -392,7 +392,7 @@ Copy2bpp:: ; f89 Get1bpp:: ; f9d ld a, [rLCDC] - bit 7, a + bit rLCDC_ENABLE, a jp nz, Request1bpp Copy1bpp:: ; fa4 diff --git a/home/init.asm b/home/init.asm index f71c247cd..8895da0f9 100644 --- a/home/init.asm +++ b/home/init.asm @@ -62,7 +62,7 @@ Init:: ; 17d .wait ld a, [rLY] - cp 145 + cp LY_VBLANK + 1 jr nz, .wait xor a @@ -125,7 +125,7 @@ Init:: ; 17d ld [hWX], a ld [rWX], a - ld a, %11100011 + ld a, LCDC_DEFAULT ; %11100011 ; LCD on ; Win tilemap 1 ; Win on diff --git a/home/lcd.asm b/home/lcd.asm index 8ec1e02ce..dfb174ee1 100644 --- a/home/lcd.asm +++ b/home/lcd.asm @@ -43,7 +43,7 @@ DisableLCD:: ; 568 ; Don't need to do anything if the LCD is already off ld a, [rLCDC] - bit 7, a ; lcd enable + bit rLCDC_ENABLE, a ret z xor a @@ -58,11 +58,11 @@ DisableLCD:: ; 568 .wait ; Wait until VBlank would normally happen ld a, [rLY] - cp 145 + cp LY_VBLANK + 1 jr nz, .wait ld a, [rLCDC] - and %01111111 ; lcd enable off + and $ff ^ (1 << rLCDC_ENABLE) ld [rLCDC], a xor a @@ -75,7 +75,7 @@ DisableLCD:: ; 568 EnableLCD:: ; 58a ld a, [rLCDC] - set 7, a ; lcd enable + set rLCDC_ENABLE, a ld [rLCDC], a ret ; 591 diff --git a/home/text.asm b/home/text.asm index 7cf3c2c60..4c6080bb1 100644 --- a/home/text.asm +++ b/home/text.asm @@ -31,7 +31,7 @@ ClearTileMap:: ; fc8 ; Update the BG Map. ld a, [rLCDC] - bit 7, a + bit rLCDC_ENABLE, a ret z jp WaitBGMap ; fdb diff --git a/home/video.asm b/home/video.asm index 4a25f41e0..8f14dfeee 100644 --- a/home/video.asm +++ b/home/video.asm @@ -291,9 +291,9 @@ Serve1bppRequest:: ; 170a ; Back out if we're too far into VBlank ld a, [rLY] - cp 144 + cp LY_VBLANK ret c - cp 146 + cp LY_VBLANK + 2 ret nc ; Copy [Requested1bpp] 1bpp tiles from [Requested1bppSource] to [Requested1bppDest] @@ -372,9 +372,9 @@ Serve2bppRequest:: ; 1769 ; Back out if we're too far into VBlank ld a, [rLY] - cp 144 + cp LY_VBLANK ret c - cp 146 + cp LY_VBLANK + 2 ret nc jr _Serve2bppRequest @@ -454,9 +454,9 @@ AnimateTileset:: ; 17d3 ; Back out if we're too far into VBlank ld a, [rLY] - cp 144 + cp LY_VBLANK ret c - cp 151 + cp LY_VBLANK + 7 ret nc ld a, [hROMBank] diff --git a/macros/wram.asm b/macros/wram.asm index f4a08c3a3..d30114fc8 100755 --- a/macros/wram.asm +++ b/macros/wram.asm @@ -149,7 +149,7 @@ channel_struct: MACRO \1Octave:: db ; 7-0 (0 is highest) \1PitchOffset:: db ; raises existing octaves (to repeat phrases) \1NoteDuration:: db ; frames remaining for the current note -\1Field0x16:: ds 1 ; c117 +\1Field16:: ds 1 ; c117 ds 1 ; c118 \1LoopCount:: db \1Tempo:: dw @@ -162,16 +162,16 @@ channel_struct: MACRO \1PitchWheelTarget:: dw ; frequency endpoint for pitch wheel \1PitchWheelAmount:: db ; c124 \1PitchWheelAmountFraction:: db ; c125 -\1Field0x25:: db ; c126 +\1Field25:: db ; c126 ds 1 ; c127 \1CryPitch:: dw -\1Field0x29:: ds 1 -\1Field0x2a:: ds 2 -\1Field0x2c:: ds 1 +\1Field29:: ds 1 +\1Field2a:: ds 2 +\1Field2c:: ds 1 \1NoteLength:: db ; frames per 16th note -\1Field0x2e:: ds 1 ; c12f -\1Field0x2f:: ds 1 ; c130 -\1Field0x30:: ds 1 ; c131 +\1Field2e:: ds 1 ; c12f +\1Field2f:: ds 1 ; c130 +\1Field30:: ds 1 ; c131 ds 1 ; c132 ENDM @@ -277,10 +277,10 @@ slot_reel: MACRO \1XCoord:: db \1ManipCounter:: db \1ManipDelay:: db -\1Slot0b:: ds 1 -\1Slot0c:: ds 1 -\1Slot0d:: ds 1 -\1Slot0e:: ds 1 +\1Field0b:: ds 1 +\1Field0c:: ds 1 +\1Field0d:: ds 1 +\1Field0e:: ds 1 \1StopDelay:: db ENDM @@ -313,10 +313,10 @@ object_struct: MACRO \1SpriteXOffset:: db \1SpriteYOffset:: db \1MovementByteIndex:: db -\1Object28:: ds 1 -\1Object29:: ds 1 -\1Object30:: ds 1 -\1Object31:: ds 1 +\1Field1c:: ds 1 +\1Field1d:: ds 1 +\1Field1e:: ds 1 +\1Field1f:: ds 1 \1Range:: db ds 7 \1StructEnd:: @@ -351,44 +351,44 @@ sprite_anim_struct: MACRO \1Duration:: db \1DurationOffset:: db \1FrameIndex:: db -\1Sprite0b:: ds 1 -\1Sprite0c:: ds 1 -\1Sprite0d:: ds 1 -\1Sprite0e:: ds 1 -\1Sprite0f:: ds 1 +\1JumptableIndex:: db +\1Field0c:: ds 1 +\1Field0d:: ds 1 +\1Field0e:: ds 1 +\1Field0f:: ds 1 ENDM battle_anim_struct: MACRO ; Placeholder until we can figure out what it all means -\1_Index:: db -\1_Anim01:: ds 1 -\1_Anim02:: ds 1 -\1_FramesetIndex:: db -\1_FunctionIndex:: db -\1_Anim05:: ds 1 -\1_TileID:: db -\1_XCoord:: db -\1_YCoord:: db -\1_XOffset:: db -\1_YOffset:: db -\1_Anim0b:: ds 1 -\1_Anim0c:: ds 1 -\1_Anim0d:: ds 1 -\1_AnonJumptableIndex:: db -\1_Anim0f:: ds 1 -\1_Anim10:: ds 1 -\1_Anim11:: ds 1 -\1_Anim12:: ds 1 -\1_Anim13:: ds 1 -\1_Anim14:: ds 1 -\1_Anim15:: ds 1 -\1_Anim16:: ds 1 -\1_Anim17:: ds 1 +\1Index:: db +\1Field01:: ds 1 +\1Field02:: ds 1 +\1FramesetID:: db +\1Function:: db +\1Palette:: db +\1TileID:: db +\1XCoord:: db +\1YCoord:: db +\1XOffset:: db +\1YOffset:: db +\1Field0b:: ds 1 +\1Duration:: db +\1Frame:: db +\1AnonJumptableIndex:: db +\1Field0f:: ds 1 +\1Field10:: ds 1 +\1Field11:: ds 1 +\1Field12:: ds 1 +\1Field13:: ds 1 +\1Field14:: ds 1 +\1Field15:: ds 1 +\1Field16:: ds 1 +\1Field17:: ds 1 ENDM battle_bg_effect: MACRO -\1_Function:: db -\1_01:: ds 1 -\1_02:: ds 1 -\1_03:: ds 1 +\1Function:: db +\1Field01:: ds 1 +\1Field02:: ds 1 +\1Field03:: ds 1 ENDM diff --git a/mobile/mobile_42.asm b/mobile/mobile_42.asm index 313d8c1f8..82158c1c7 100644 --- a/mobile/mobile_42.asm +++ b/mobile/mobile_42.asm @@ -381,7 +381,6 @@ MobileTradeAnim_JumptableLoop: ; 10824b ; 10828a .Jumptable: ; 10828a - dw GetMobileTradeAnimByte ; 00 dw MobileTradeAnim_ShowPlayerMonToBeSent ; 01 dw MobileTradeAnim_02 ; 02 diff --git a/mobile/mobile_45_sprite_engine.asm b/mobile/mobile_45_sprite_engine.asm index de1fc8e9c..a9335ba3d 100755 --- a/mobile/mobile_45_sprite_engine.asm +++ b/mobile/mobile_45_sprite_engine.asm @@ -411,7 +411,7 @@ Function1161d5: ; 1161d5 .wait_for_vblank ; Wait until a vblank would occur had interrupts not just been disabled. ld a, [rLY] - cp $91 + cp LY_VBLANK + 1 jr nz, .wait_for_vblank ld a, $d0 diff --git a/mobile/mobile_46.asm b/mobile/mobile_46.asm index bdf85464c..e3503a00c 100755 --- a/mobile/mobile_46.asm +++ b/mobile/mobile_46.asm @@ -7398,6 +7398,7 @@ Function11b5e8: ; 11b5e8 .RunJumptable: jumptable .Jumptable, wJumptableIndex + .Jumptable: dw Function11b66d dw Function11b6b3