diff options
Diffstat (limited to 'engine')
87 files changed, 826 insertions, 692 deletions
diff --git a/engine/battle/battle_transition.asm b/engine/battle/battle_transition.asm index bef74ad29..f2fef5553 100644 --- a/engine/battle/battle_transition.asm +++ b/engine/battle/battle_transition.asm @@ -92,7 +92,7 @@ LoadTrainerBattlePokeballTiles: ; Load the tiles used in the Pokeball Graphic that fills the screen ; at the start of every Trainer battle. ld de, TrainerBattlePokeballTiles - ld hl, VTiles1 tile $7e + ld hl, vTiles1 tile $7e ld b, BANK(TrainerBattlePokeballTiles) ld c, 2 call Request2bpp @@ -103,7 +103,7 @@ LoadTrainerBattlePokeballTiles: ld [rVBK], a ld de, TrainerBattlePokeballTiles - ld hl, VTiles4 tile $7e + ld hl, vTiles4 tile $7e ld b, BANK(TrainerBattlePokeballTiles) ld c, 2 call Request2bpp @@ -828,11 +828,11 @@ StartTrainerBattle_ZoomToBlack: ; 8c768 (23:4768) ; 8c792 (23:4792) .boxes ; 8c792 -zoombox: macro +zoombox: MACRO ; width, height, start y, start x db \1, \2 dwcoord \3, \4 -endm +ENDM zoombox 4, 2, 8, 8 zoombox 6, 4, 7, 7 zoombox 8, 6, 6, 6 diff --git a/engine/battle/core.asm b/engine/battle/core.asm index a62b70d72..2937755a6 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -5309,13 +5309,13 @@ BattleMenuPKMN_Loop: Battle_StatsScreen: ; 3e308 call DisableLCD - ld hl, VTiles2 tile $31 - ld de, VTiles0 + ld hl, vTiles2 tile $31 + ld de, vTiles0 ld bc, $11 tiles call CopyBytes - ld hl, VTiles2 - ld de, VTiles0 tile $11 + ld hl, vTiles2 + ld de, vTiles0 tile $11 ld bc, $31 tiles call CopyBytes @@ -5330,13 +5330,13 @@ Battle_StatsScreen: ; 3e308 call DisableLCD - ld hl, VTiles0 - ld de, VTiles2 tile $31 + ld hl, vTiles0 + ld de, vTiles2 tile $31 ld bc, $11 tiles call CopyBytes - ld hl, VTiles0 tile $11 - ld de, VTiles2 + ld hl, vTiles0 tile $11 + ld de, vTiles2 ld bc, $31 tiles call CopyBytes @@ -6371,8 +6371,14 @@ LoadEnemyMon: ; 3e8eb jr c, .GenerateDVs ; try again .Magikarp: -; Skimming this part recommended - +; These filters are untranslated. +; They expect at wMagikarpLength a 2-byte value in mm, +; but the value is in feet and inches (one byte each). + +; The first filter is supposed to make very large Magikarp even rarer, +; by targeting those 1600 mm or larger. +; After the conversion to feet, it is unable to target any, +; as the largest possible Magikarp is 5'3'', which reads as 1283. ld a, [TempEnemyMonSpecies] cp MAGIKARP jr nz, .Happiness @@ -6382,27 +6388,27 @@ LoadEnemyMon: ; 3e8eb ld bc, PlayerID callfar CalcMagikarpLength -; We're clear if the length is < 1536 +; No reason to keep going if length > 1536 (i.e. if length / 256 != 6) ld a, [wMagikarpLength] - cp HIGH(1536) + cp HIGH(1536) ; this compares to 6'0'', should be cp 5 jr nz, .CheckMagikarpArea ; 5% chance of skipping both size checks call Random cp 5 percent jr c, .CheckMagikarpArea -; Try again if > 1614 +; Try again if length > 1615 ld a, [wMagikarpLength + 1] - cp LOW(1614) + 2 + cp LOW(1616) ; this compares to 6'80'', should be cp 3 jr nc, .GenerateDVs ; 20% chance of skipping this check call Random cp 20 percent - 1 jr c, .CheckMagikarpArea -; Try again if > 1598 +; Try again if length > 1599 ld a, [wMagikarpLength + 1] - cp LOW(1598) + 2 + cp LOW(1600) ; this compares to 6'64'', should be cp 2 jr nc, .GenerateDVs .CheckMagikarpArea: @@ -6415,6 +6421,9 @@ LoadEnemyMon: ; 3e8eb ; Intended behavior enforces a minimum size at Lake of Rage ; The real behavior prevents size flooring in the Lake of Rage area + +; Moreover, due to the check not being translated to feet, all Magikarp +; smaller than 4'0'' may be caught by the filter, a lot more than intended ld a, [MapGroup] cp GROUP_LAKE_OF_RAGE jr z, .Happiness @@ -6427,7 +6436,7 @@ LoadEnemyMon: ; 3e8eb jr c, .Happiness ; Floor at length 1024 ld a, [wMagikarpLength] - cp HIGH(1024) + cp HIGH(1024) ; compares to 4'0'', cp 3 would be closer to intended value jr c, .GenerateDVs ; try again ; Finally done with DVs @@ -6695,7 +6704,7 @@ CheckSleepingTreeMon: ; 3eb38 CheckUnownLetter: ; 3eb75 ; Return carry if the Unown letter hasn't been unlocked yet - ld a, [UnlockedUnowns] + ld a, [wUnlockedUnowns] ld c, a ld de, 0 @@ -6779,7 +6788,7 @@ BattleWinSlideInEnemyTrainerFrontpic: ; 3ebd8 call FinishBattleAnim ld a, [OtherTrainerClass] ld [TrainerClass], a - ld de, VTiles2 + ld de, vTiles2 callfar GetTrainerPic hlcoord 19, 0 ld c, 0 @@ -7074,7 +7083,7 @@ BadgeStatBoosts: ; 3ed45 and a ret nz - ld a, [JohtoBadges] + ld a, [wJohtoBadges] ; Swap badges 3 (PlainBadge) and 5 (MineralBadge). ld d, a @@ -7155,15 +7164,15 @@ _LoadHPBar: ; 3eda6 LoadHPExpBarGFX: ; unreferenced ld de, EnemyHPBarBorderGFX - ld hl, VTiles2 tile $6c + ld hl, vTiles2 tile $6c lb bc, BANK(EnemyHPBarBorderGFX), 4 call Get1bpp ld de, HPExpBarBorderGFX - ld hl, VTiles2 tile $73 + ld hl, vTiles2 tile $73 lb bc, BANK(HPExpBarBorderGFX), 6 call Get1bpp ld de, ExpBarGFX - ld hl, VTiles2 tile $55 + ld hl, vTiles2 tile $55 lb bc, BANK(ExpBarGFX), 8 jp Get2bpp ; 3edd1 @@ -8286,7 +8295,7 @@ DropPlayerSub: ; 3f447 ld [CurPartySpecies], a ld hl, BattleMonDVs predef GetUnownLetter - ld de, VTiles2 tile $31 + ld de, vTiles2 tile $31 predef GetMonBackpic pop af ld [CurPartySpecies], a @@ -8325,7 +8334,7 @@ DropEnemySub: ; 3f486 call GetBaseData ld hl, EnemyMonDVs predef GetUnownLetter - ld de, VTiles2 + ld de, vTiles2 predef GetAnimatedFrontpicPredef pop af ld [CurPartySpecies], a @@ -8382,7 +8391,7 @@ BattleIntro: ; 3f4dd call DisableSpriteUpdates farcall ClearBattleRAM call InitEnemy - call BackUpVBGMap2 + call BackUpBGMap2 ld b, SCGB_BATTLE_GRAYSCALE call GetSGBLayout ld hl, rLCDC @@ -8428,13 +8437,13 @@ InitEnemy: ; 3f55e jp InitEnemyWildmon ; wild ; 3f568 -BackUpVBGMap2: ; 3f568 +BackUpBGMap2: ; 3f568 ld a, [rSVBK] push af ld a, $6 ; BANK(wDecompressScratch) ld [rSVBK], a ld hl, wDecompressScratch - ld bc, $40 tiles ; VBGMap3 - VBGMap2 + ld bc, $40 tiles ; vBGMap3 - vBGMap2 ld a, $2 call ByteFill ld a, [rVBK] @@ -8442,8 +8451,8 @@ BackUpVBGMap2: ; 3f568 ld a, $1 ld [rVBK], a ld de, wDecompressScratch - hlbgcoord 0, 0 ; VBGMap2 - lb bc, BANK(BackUpVBGMap2), $40 + hlbgcoord 0, 0 ; vBGMap2 + lb bc, BANK(BackUpBGMap2), $40 call Request2bpp pop af ld [rVBK], a @@ -8467,7 +8476,7 @@ InitEnemyTrainer: ; 3f594 ld [OTPartyMon1Item], a .ok - ld de, VTiles2 + ld de, vTiles2 callfar GetTrainerPic xor a ld [hGraphicStartTile], a @@ -8531,7 +8540,7 @@ InitEnemyWildmon: ; 3f607 ld a, [UnownLetter] ld [wFirstUnownSeen], a .skip_unown - ld de, VTiles2 + ld de, vTiles2 predef GetAnimatedFrontpicPredef xor a ld [TrainerClass], a @@ -9336,7 +9345,7 @@ InitBattleDisplay: ; 3fb6c ; 3fbff GetTrainerBackpic: ; 3fbff -; Load the player character's backpic (6x6) into VRAM starting from VTiles2 tile $31. +; Load the player character's backpic (6x6) into VRAM starting from vTiles2 tile $31. ; Special exception for Dude. ld b, BANK(DudeBackpic) @@ -9349,7 +9358,7 @@ GetTrainerBackpic: ; 3fbff ld a, [wPlayerSpriteSetupFlags] bit 2, a ; transformed to male jr nz, .Chris - ld a, [PlayerGender] + ld a, [wPlayerGender] bit 0, a jr z, .Chris @@ -9363,7 +9372,7 @@ GetTrainerBackpic: ; 3fbff ld hl, ChrisBackpic .Decompress: - ld de, VTiles2 tile $31 + ld de, vTiles2 tile $31 ld c, $31 predef DecompressPredef ret @@ -9374,8 +9383,8 @@ CopyBackpic: ; 3fc30 push af ld a, $6 ld [rSVBK], a - ld hl, VTiles0 - ld de, VTiles2 tile $31 + ld hl, vTiles0 + ld de, vTiles2 tile $31 ld a, [hROMBank] ld b, a ld c, $31 diff --git a/engine/battle/effect_commands.asm b/engine/battle/effect_commands.asm index 5922afea3..f86f90479 100644 --- a/engine/battle/effect_commands.asm +++ b/engine/battle/effect_commands.asm @@ -726,7 +726,7 @@ BattleCommand_CheckObedience: ; 343db .obeylevel ; The maximum obedience level is constrained by owned badges: - ld hl, JohtoBadges + ld hl, wJohtoBadges ; risingbadge bit RISINGBADGE, [hl] diff --git a/engine/battle/misc.asm b/engine/battle/misc.asm index b05dc8071..c78e9fd84 100644 --- a/engine/battle/misc.asm +++ b/engine/battle/misc.asm @@ -176,9 +176,9 @@ DoBadgeTypeBoosts: ; fbe24 ld hl, .BadgeTypes - ld a, [KantoBadges] + ld a, [wKantoBadges] ld b, a - ld a, [JohtoBadges] + ld a, [wJohtoBadges] ld c, a .CheckBadge: diff --git a/engine/battle/start_battle.asm b/engine/battle/start_battle.asm index 8d510b72e..7f0bff96b 100644 --- a/engine/battle/start_battle.asm +++ b/engine/battle/start_battle.asm @@ -191,7 +191,7 @@ ClearBattleRAM: ; 2ef18 call ClearWindowData ld hl, hBGMapAddress - xor a ; LOW(VBGMap0) + xor a ; LOW(vBGMap0) ld [hli], a - ld [hl], HIGH(VBGMap0) + ld [hl], HIGH(vBGMap0) ret diff --git a/engine/battle/trainer_huds.asm b/engine/battle/trainer_huds.asm index 9efe08414..b236fc56b 100755 --- a/engine/battle/trainer_huds.asm +++ b/engine/battle/trainer_huds.asm @@ -232,7 +232,7 @@ LoadTrainerHudOAM: ; 2c143 LoadBallIconGFX: ; 2c165 ld de, .gfx - ld hl, VTiles0 tile $31 + ld hl, vTiles0 tile $31 lb bc, BANK(LoadBallIconGFX), 4 call Get2bpp_2 ret diff --git a/engine/battle_anims/anim_commands.asm b/engine/battle_anims/anim_commands.asm index 875849ce3..2db8bf293 100644 --- a/engine/battle_anims/anim_commands.asm +++ b/engine/battle_anims/anim_commands.asm @@ -236,16 +236,16 @@ Functioncc220: ; cc220 ; Appears to be unused. xor a ld [hBGMapMode], a - ld a, LOW(VBGMap0 tile $28) + ld a, LOW(vBGMap0 tile $28) ld [hBGMapAddress], a - ld a, HIGH(VBGMap0 tile $28) + ld a, HIGH(vBGMap0 tile $28) ld [hBGMapAddress + 1], a call WaitBGMap2 ld a, $60 ld [hWY], a - xor a ; LOW(VBGMap0) + xor a ; LOW(vBGMap0) ld [hBGMapAddress], a - ld a, HIGH(VBGMap0) + ld a, HIGH(vBGMap0) ld [hBGMapAddress + 1], a call BattleAnimDelayFrame ret @@ -693,7 +693,7 @@ BattleAnimCmd_5GFX: ; cc485 (33:4485) ld [wBattleAnimTemp0], a .loop ld a, [wBattleAnimTemp0] - cp (VTiles1 - VTiles0) / $10 - $31 + cp (vTiles1 - vTiles0) / $10 - $31 ret nc call GetBattleAnimByte ld [hli], a @@ -706,7 +706,7 @@ BattleAnimCmd_5GFX: ; cc485 (33:4485) rept 4 add hl, hl endr - ld de, VTiles0 tile $31 + ld de, vTiles0 tile $31 add hl, de ld a, [BattleAnimByte] call LoadBattleAnimObj @@ -816,13 +816,13 @@ BattleAnimCmd_EnemyFeetObj: ; cc52c (33:452c) ld a, $49 ld [hl], a - ld hl, VTiles0 tile $73 - ld de, VTiles2 tile $06 + ld hl, vTiles0 tile $73 + ld de, vTiles2 tile $06 ld a, $70 ld [wBattleAnimTemp0], a ld a, $7 call .LoadFootprint - ld de, VTiles2 tile $31 + ld de, vTiles2 tile $31 ld a, $60 ld [wBattleAnimTemp0], a ld a, $6 @@ -871,13 +871,13 @@ BattleAnimCmd_PlayerHeadObj: ; cc57e (33:457e) ld a, $43 ld [hl], a - ld hl, VTiles0 tile $66 - ld de, VTiles2 tile $05 + ld hl, vTiles0 tile $66 + ld de, vTiles2 tile $05 ld a, $70 ld [wBattleAnimTemp0], a ld a, $7 call .LoadHead - ld de, VTiles2 tile $31 + ld de, vTiles2 tile $31 ld a, $60 ld [wBattleAnimTemp0], a ld a, $6 @@ -930,7 +930,7 @@ BattleAnimCmd_Transform: ; cc5dc (33:45dc) ld [CurPartySpecies], a ; CurPartySpecies ld hl, BattleMonDVs ; BattleMonDVs predef GetUnownLetter - ld de, VTiles0 tile $00 + ld de, vTiles0 tile $00 predef GetMonFrontpic jr .done @@ -939,7 +939,7 @@ BattleAnimCmd_Transform: ; cc5dc (33:45dc) ld [CurPartySpecies], a ; CurPartySpecies ld hl, EnemyMonDVs ; EnemyMonDVs predef GetUnownLetter - ld de, VTiles0 tile $00 + ld de, vTiles0 tile $00 predef GetMonBackpic .done @@ -951,19 +951,19 @@ BattleAnimCmd_Transform: ; cc5dc (33:45dc) BattleAnimCmd_UpdateActorPic: ; cc622 (33:4622) - ld de, VTiles0 tile $00 + ld de, vTiles0 tile $00 ld a, [hBattleTurn] and a jr z, .player - ld hl, VTiles2 tile $00 + ld hl, vTiles2 tile $00 ld b, 0 ld c, $31 call Request2bpp ret .player - ld hl, VTiles2 tile $31 + ld hl, vTiles2 tile $31 ld b, 0 ld c, $24 call Request2bpp @@ -1007,7 +1007,7 @@ GetSubstitutePic: ; cc64c ld de, sScratch + (3 * 7 + 6) tiles call .CopyTile - ld hl, VTiles2 tile $00 + ld hl, vTiles2 tile $00 ld de, sScratch lb bc, BANK(GetSubstitutePic), 7 * 7 call Request2bpp @@ -1027,7 +1027,7 @@ GetSubstitutePic: ; cc64c ld de, sScratch + (3 * 6 + 5) tiles call .CopyTile - ld hl, VTiles2 tile $31 + ld hl, vTiles2 tile $31 ld de, sScratch lb bc, BANK(GetSubstitutePic), 6 * 6 call Request2bpp @@ -1075,7 +1075,7 @@ GetMinimizePic: ; cc6e7 (33:46e7) ld de, sScratch + $1a tiles call CopyMinimizePic - ld hl, VTiles2 tile $00 + ld hl, vTiles2 tile $00 ld de, sScratch lb bc, BANK(GetMinimizePic), $31 ret @@ -1083,7 +1083,7 @@ GetMinimizePic: ; cc6e7 (33:46e7) .player ld de, sScratch + $160 call CopyMinimizePic - ld hl, VTiles2 tile $31 + ld hl, vTiles2 tile $31 ld de, sScratch lb bc, BANK(GetMinimizePic), $24 ret @@ -1108,7 +1108,7 @@ BattleAnimCmd_Minimize: ; cc735 (33:4735) xor a call GetSRAMBank call GetMinimizePic - ld hl, VTiles0 tile $00 + ld hl, vTiles0 tile $00 call Request2bpp call CloseSRAM pop af @@ -1157,14 +1157,14 @@ BattleAnimCmd_BeatUp: ; cc776 (33:4776) ld hl, BattleMonDVs predef GetUnownLetter - ld de, VTiles2 tile $00 + ld de, vTiles2 tile $00 predef GetMonFrontpic jr .done .player ld hl, EnemyMonDVs predef GetUnownLetter - ld de, VTiles2 tile $31 + ld de, vTiles2 tile $31 predef GetMonBackpic .done diff --git a/engine/battle_anims/bg_effects.asm b/engine/battle_anims/bg_effects.asm index ab4a8036b..c1a2bef4b 100644 --- a/engine/battle_anims/bg_effects.asm +++ b/engine/battle_anims/bg_effects.asm @@ -871,7 +871,7 @@ BattleBGEffect_RunPicResizeScript: ; c83ed (32:43ed) bgsquare: MACRO dn \1, \2 dw \3 -endm +ENDM bgsquare 6, 6, .SixBySix bgsquare 4, 4, .FourByFour diff --git a/engine/billspc.asm b/engine/billspc.asm index 2dd9a512f..554fb6bf1 100755 --- a/engine/billspc.asm +++ b/engine/billspc.asm @@ -1107,7 +1107,7 @@ PCMonInfo: ; e2ac6 (38:6ac6) ld hl, TempMonDVs predef GetUnownLetter call GetBaseData - ld de, VTiles2 tile $00 + ld de, vTiles2 tile $00 predef GetMonFrontpic xor a ld [wBillsPC_MonHasMail], a @@ -1450,7 +1450,7 @@ ENDC ld a, [wd004] inc a ld [wBillsPC_NumMonsInBox], a -endm +ENDM CopyBoxmonSpecies: ; e2d30 (38:6d30) xor a @@ -2261,18 +2261,18 @@ BillsPC_Jumptable: ; e33df (38:73df) BillsPC_InitGFX: ; e33e8 (38:73e8) call DisableLCD - ld hl, VTiles2 tile $00 + ld hl, vTiles2 tile $00 ld bc, $31 tiles xor a call ByteFill call LoadStandardFont call LoadFontsBattleExtra ld hl, PCMailGFX - ld de, VTiles2 tile $5c + ld de, vTiles2 tile $5c ld bc, 4 tiles call CopyBytes ld hl, PCSelectLZ - ld de, VTiles0 tile $00 + ld de, vTiles0 tile $00 call Decompress ld a, 6 call SkipMusic diff --git a/engine/breeding.asm b/engine/breeding.asm index 8977ae175..234e05448 100755 --- a/engine/breeding.asm +++ b/engine/breeding.asm @@ -704,22 +704,22 @@ EggHatch_AnimationSequence: ; 1728f (5:728f) farcall BlankScreen call DisableLCD ld hl, EggHatchGFX - ld de, VTiles0 tile $00 + ld de, vTiles0 tile $00 ld bc, $20 ld a, BANK(EggHatchGFX) call FarCopyBytes farcall ClearSpriteAnims - ld de, VTiles2 tile $00 + ld de, vTiles2 tile $00 ld a, [wJumptableIndex] call GetHatchlingFrontpic - ld de, VTiles2 tile $31 + ld de, vTiles2 tile $31 ld a, EGG call GetEggFrontpic ld de, MUSIC_EVOLUTION call PlayMusic call EnableLCD hlcoord 7, 4 - ld b, HIGH(VBGMap0) + ld b, HIGH(vBGMap0) ld c, $31 ; Egg tiles start here ld a, EGG call Hatch_UpdateFrontpicBGMapCenter @@ -768,7 +768,7 @@ EggHatch_AnimationSequence: ; 1728f (5:728f) call ClearSprites call Hatch_InitShellFragments hlcoord 6, 3 - ld b, HIGH(VBGMap0) + ld b, HIGH(vBGMap0) ld c, $00 ; Hatchling tiles start here ld a, [wJumptableIndex] call Hatch_UpdateFrontpicBGMapCenter diff --git a/engine/card_flip.asm b/engine/card_flip.asm index ef48283de..f03db190d 100755 --- a/engine/card_flip.asm +++ b/engine/card_flip.asm @@ -16,20 +16,20 @@ _CardFlip: ; e00ee (38:40ee) call LoadFontsExtra ld hl, CardFlipLZ01 - ld de, VTiles2 tile $00 + ld de, vTiles2 tile $00 call Decompress ld hl, CardFlipLZ02 - ld de, VTiles2 tile $3e + ld de, vTiles2 tile $3e call Decompress ld hl, CardFlipLZ03 - ld de, VTiles0 tile $00 + ld de, vTiles0 tile $00 call Decompress ld hl, CardFlipOffButtonGFX - ld de, VTiles1 tile $6f + ld de, vTiles1 tile $6f ld bc, 1 tiles call CopyBytes ld hl, CardFlipOnButtonGFX - ld de, VTiles1 tile $75 + ld de, vTiles1 tile $75 ld bc, 1 tiles call CopyBytes @@ -619,11 +619,11 @@ CardFlip_CopyOAM: ; e0509 ; e0521 CardFlip_ShiftDigitsLeftTwoPixels: ; e0521 (38:4521) - ld de, VTiles1 tile ("0" & $7f) - ld hl, VTiles1 tile ("0" & $7f) + 2 + ld de, vTiles1 tile ("0" & $7f) + ld hl, vTiles1 tile ("0" & $7f) + 2 ld bc, 10 tiles - 2 call CopyBytes - ld hl, VTiles1 tile $7f + 1 tiles - 2 + ld hl, vTiles1 tile $7f + 1 tiles - 2 xor a ld [hli], a ld [hl], a @@ -1413,7 +1413,7 @@ else dbpixel \1, \2 dw \3 endc -endm +ENDM cardflip_cursor 11, 2, .Impossible cardflip_cursor 12, 2, .Impossible diff --git a/engine/caught_data.asm b/engine/caught_data.asm index 961782908..1f8b8cac4 100644 --- a/engine/caught_data.asm +++ b/engine/caught_data.asm @@ -193,7 +193,7 @@ SetBoxmonOrEggmonCaughtData: ; 4db53 .NotPokecenter2F: call GetWorldMapLocation ld b, a - ld a, [PlayerGender] + ld a, [wPlayerGender] rrca or b ld [hl], a diff --git a/engine/cgb_layouts.asm b/engine/cgb_layouts.asm index 93e2c4434..715e41847 100644 --- a/engine/cgb_layouts.asm +++ b/engine/cgb_layouts.asm @@ -183,7 +183,7 @@ InitPartyMenuBGPal0: ; 8e9f ; 8eb9 _CGB_PokegearPals: ; 8eb9 - ld a, [PlayerGender] + ld a, [wPlayerGender] bit 0, a jr z, .male ld hl, FemalePokegearPals @@ -719,7 +719,7 @@ _CGB_TrainerCard: ; 9289 ; fill screen with opposite-gender palette for the card border hlcoord 0, 0, AttrMap ld bc, SCREEN_WIDTH * SCREEN_HEIGHT - ld a, [PlayerGender] + ld a, [wPlayerGender] and a ld a, $1 ; kris jr z, .got_gender @@ -729,7 +729,7 @@ _CGB_TrainerCard: ; 9289 ; fill trainer sprite area with same-gender palette hlcoord 14, 1, AttrMap lb bc, 7, 5 - ld a, [PlayerGender] + ld a, [wPlayerGender] and a ld a, $0 ; chris jr z, .got_gender2 @@ -768,7 +768,7 @@ _CGB_TrainerCard: ; 9289 ld a, $7 ; pryce call FillBoxCGB ; clair uses kris's palette - ld a, [PlayerGender] + ld a, [wPlayerGender] and a push af jr z, .got_gender3 @@ -847,7 +847,7 @@ _CGB_PackPals: ; 93d3 cp BATTLETYPE_TUTORIAL jr z, .tutorial_male - ld a, [PlayerGender] + ld a, [wPlayerGender] bit 0, a jr z, .tutorial_male diff --git a/engine/color.asm b/engine/color.asm index 3eafbad70..1f563df53 100644 --- a/engine/color.asm +++ b/engine/color.asm @@ -718,7 +718,7 @@ GetPlayerOrMonPalettePointer: ld a, [wPlayerSpriteSetupFlags] bit 2, a ; transformed to male jr nz, .male - ld a, [PlayerGender] + ld a, [wPlayerGender] and a jr z, .male ld hl, KrisPalette @@ -902,7 +902,7 @@ InitCGBPals:: ; CGB only ld a, $1 ld [rVBK], a - ld hl, VTiles0 + ld hl, vTiles0 ld bc, $200 tiles xor a call ByteFill @@ -1069,7 +1069,7 @@ SGBBorder_PushBGPals: ld a, %11100100 ld [rBGP], a ld hl, PredefPals - ld de, VTiles1 + ld de, vTiles1 ld bc, $100 tiles call CopyData call DrawDefaultTiles @@ -1085,7 +1085,7 @@ SGBBorder_MorePalPushing: call DisableLCD ld a, $e4 ld [rBGP], a - ld de, VTiles1 + ld de, vTiles1 ld bc, 20 tiles call CopyData ld b, 18 @@ -1119,7 +1119,7 @@ SGBBorder_YetMorePalPushing: call DisableLCD ld a, %11100100 ld [rBGP], a - ld de, VTiles1 + ld de, vTiles1 ld b, $80 .loop push bc diff --git a/engine/credits.asm b/engine/credits.asm index 12199f904..e38ba8dc5 100644 --- a/engine/credits.asm +++ b/engine/credits.asm @@ -33,17 +33,17 @@ Credits:: ; 109847 jr nz, .load_loop ld de, CreditsBorderGFX - ld hl, VTiles2 tile $20 + ld hl, vTiles2 tile $20 lb bc, BANK(CreditsBorderGFX), $09 call Request2bpp ld de, CopyrightGFX - ld hl, VTiles2 tile $60 + ld hl, vTiles2 tile $60 lb bc, BANK(CopyrightGFX), $1d call Request2bpp ld de, TheEndGFX - ld hl, VTiles2 tile $40 + ld hl, vTiles2 tile $40 lb bc, BANK(TheEndGFX), $10 call Request2bpp @@ -55,7 +55,7 @@ Credits:: ; 109847 call Credits_LoadBorderGFX ld e, l ld d, h - ld hl, VTiles2 + ld hl, vTiles2 lb bc, BANK(CreditsMonsGFX), 16 call Request2bpp @@ -193,9 +193,9 @@ Credits_UpdateGFXRequestPath: ; 109964 (42:5964) ld [Requested2bppSource], a ld a, h ld [Requested2bppSource + 1], a - ld a, LOW(VTiles2) + ld a, LOW(vTiles2) ld [Requested2bppDest], a - ld a, HIGH(VTiles2) + ld a, HIGH(vTiles2) ld [Requested2bppDest + 1], a jr Credits_RequestGFX diff --git a/engine/crystal_intro.asm b/engine/crystal_intro.asm index 4f79dc6be..1c2a39ef2 100755 --- a/engine/crystal_intro.asm +++ b/engine/crystal_intro.asm @@ -3,9 +3,9 @@ Copyright_GFPresents: ; e4579 call PlayMusic call ClearBGPalettes call ClearTileMap - ld a, HIGH(VBGMap0) + ld a, HIGH(vBGMap0) ld [hBGMapAddress + 1], a - xor a ; LOW(VBGMap0) + xor a ; LOW(vBGMap0) ld [hBGMapAddress], a ld [hJoyDown], a ld [hSCX], a @@ -51,7 +51,7 @@ Copyright_GFPresents: ; e4579 .GetGFLogoGFX: ; e45e8 ld de, GameFreakLogo - ld hl, VTiles2 + ld hl, vTiles2 lb bc, BANK(GameFreakLogo), $1c call Get1bpp @@ -65,12 +65,12 @@ Copyright_GFPresents: ; e4579 ld a, BANK(IntroLogoGFX) call FarDecompress - ld hl, VTiles0 + ld hl, vTiles0 ld de, wDecompressScratch lb bc, 1, 8 tiles call Request2bpp - ld hl, VTiles1 + ld hl, vTiles1 ld de, wDecompressScratch + $80 tiles lb bc, 1, 8 tiles call Request2bpp @@ -470,10 +470,10 @@ IntroScene1: ; e495b (39:495b) ld a, $0 ld [rVBK], a ld hl, IntroUnownsGFX - ld de, VTiles2 tile $00 + ld de, vTiles2 tile $00 call Intro_DecompressRequest2bpp_128Tiles ld hl, IntroPulseGFX - ld de, VTiles0 tile $00 + ld de, vTiles0 tile $00 call Intro_DecompressRequest2bpp_128Tiles ld hl, IntroTilemap002 debgcoord 0, 0 @@ -546,7 +546,7 @@ IntroScene3: ; e49fd (39:49fd) ld a, $0 ld [rVBK], a ld hl, IntroBackgroundGFX - ld de, VTiles2 tile $00 + ld de, vTiles2 tile $00 call Intro_DecompressRequest2bpp_128Tiles ld hl, IntroTilemap004 debgcoord 0, 0 @@ -609,10 +609,10 @@ IntroScene5: ; e4a7a (39:4a7a) ld a, $0 ld [rVBK], a ld hl, IntroUnownsGFX - ld de, VTiles2 tile $00 + ld de, vTiles2 tile $00 call Intro_DecompressRequest2bpp_128Tiles ld hl, IntroPulseGFX - ld de, VTiles0 tile $00 + ld de, vTiles0 tile $00 call Intro_DecompressRequest2bpp_128Tiles ld hl, IntroTilemap006 debgcoord 0, 0 @@ -706,17 +706,17 @@ IntroScene7: ; e4b3f (39:4b3f) call Intro_DecompressRequest2bpp_64Tiles ld hl, IntroPichuWooperGFX - ld de, VTiles0 tile $00 + ld de, vTiles0 tile $00 call Intro_DecompressRequest2bpp_128Tiles ld a, $0 ld [rVBK], a ld hl, IntroSuicuneRunGFX - ld de, VTiles0 tile $00 + ld de, vTiles0 tile $00 call Intro_DecompressRequest2bpp_255Tiles ld hl, IntroBackgroundGFX - ld de, VTiles2 tile $00 + ld de, vTiles2 tile $00 call Intro_DecompressRequest2bpp_128Tiles ld hl, IntroTilemap004 @@ -877,7 +877,7 @@ IntroScene11: ; e4c86 (39:4c86) ld a, $0 ld [rVBK], a ld hl, IntroUnownsGFX - ld de, VTiles2 tile $00 + ld de, vTiles2 tile $00 call Intro_DecompressRequest2bpp_128Tiles ld hl, IntroTilemap008 debgcoord 0, 0 @@ -1001,10 +1001,10 @@ IntroScene13: ; e4d6d (39:4d6d) ld a, $0 ld [rVBK], a ld hl, IntroSuicuneRunGFX - ld de, VTiles0 tile $00 + ld de, vTiles0 tile $00 call Intro_DecompressRequest2bpp_255Tiles ld hl, IntroBackgroundGFX - ld de, VTiles2 tile $00 + ld de, vTiles2 tile $00 call Intro_DecompressRequest2bpp_128Tiles ld hl, IntroTilemap004 debgcoord 0, 0 @@ -1105,13 +1105,13 @@ IntroScene15: ; e4e40 (39:4e40) ld a, $0 ld [rVBK], a ld hl, IntroSuicuneJumpGFX - ld de, VTiles2 tile $00 + ld de, vTiles2 tile $00 call Intro_DecompressRequest2bpp_128Tiles ld hl, IntroUnownBackGFX - ld de, VTiles0 tile $00 + ld de, vTiles0 tile $00 call Intro_DecompressRequest2bpp_128Tiles ld de, IntroGrass4GFX - ld hl, VTiles1 tile $00 + ld hl, vTiles1 tile $00 lb bc, BANK(IntroGrass4GFX), 1 call Request2bpp ld hl, IntroTilemap010 @@ -1187,7 +1187,7 @@ IntroScene17: ; e4ef5 (39:4ef5) ld a, $0 ld [rVBK], a ld hl, IntroSuicuneCloseGFX - ld de, VTiles1 tile $00 + ld de, vTiles1 tile $00 call Intro_DecompressRequest2bpp_255Tiles ld hl, IntroTilemap012 debgcoord 0, 0 @@ -1253,13 +1253,13 @@ IntroScene19: ; e4f7e (39:4f7e) ld a, $0 ld [rVBK], a ld hl, IntroSuicuneBackGFX - ld de, VTiles2 tile $00 + ld de, vTiles2 tile $00 call Intro_DecompressRequest2bpp_128Tiles ld hl, IntroUnownsGFX - ld de, VTiles1 tile $00 + ld de, vTiles1 tile $00 call Intro_DecompressRequest2bpp_128Tiles ld de, IntroGrass4GFX - ld hl, VTiles1 tile $7f + ld hl, vTiles1 tile $7f lb bc, BANK(IntroGrass4GFX), 1 call Request2bpp ld hl, IntroTilemap014 @@ -1431,7 +1431,7 @@ IntroScene26: ; e50bb (39:50bb) ld a, $0 ld [rVBK], a ld hl, IntroCrystalUnownsGFX - ld de, VTiles2 tile $00 + ld de, vTiles2 tile $00 call Intro_DecompressRequest2bpp_128Tiles ld hl, IntroTilemap017 debgcoord 0, 0 @@ -1922,9 +1922,9 @@ Intro_RustleGrass: ; e546d (39:546d) ld [Requested2bppSource], a ld a, [hli] ld [Requested2bppSource + 1], a - ld a, LOW(VTiles2 tile $09) + ld a, LOW(vTiles2 tile $09) ld [Requested2bppDest], a - ld a, HIGH(VTiles2 tile $09) + ld a, HIGH(vTiles2 tile $09) ld [Requested2bppDest + 1], a ld a, 4 ld [Requested2bppSize], a diff --git a/engine/debug.asm b/engine/debug.asm index 0ca639aaa..fda0d3e60 100755 --- a/engine/debug.asm +++ b/engine/debug.asm @@ -104,14 +104,14 @@ Function81928: ; 81928 Function81948: ; 81948 ld a, $1 ld [rVBK], a - ld hl, VTiles0 - ld bc, sScratch - VTiles0 + ld hl, vTiles0 + ld bc, sScratch - vTiles0 xor a call ByteFill ld a, $0 ld [rVBK], a - ld hl, VTiles0 - ld bc, sScratch - VTiles0 + ld hl, vTiles0 + ld bc, sScratch - vTiles0 xor a call ByteFill hlcoord 0, 0, AttrMap @@ -128,15 +128,15 @@ Function81948: ; 81948 Function8197c: ; 8197c ld hl, DebugColorTestGFX + $10 - ld de, VTiles2 tile $6a + ld de, vTiles2 tile $6a ld bc, $160 call CopyBytes ld hl, DebugColorTestGFX - ld de, VTiles0 + ld de, vTiles0 ld bc, $10 call CopyBytes call LoadStandardFont - ld hl, VTiles1 + ld hl, vTiles1 lb bc, 8, 0 .asm_8199d ld a, [hl] @@ -314,7 +314,7 @@ Function81adb: ; 81adb ld [wBoxAlignment], a hlcoord 12, 3 call _PrepMonFrontpic - ld de, VTiles2 tile $31 + ld de, vTiles2 tile $31 predef GetMonBackpic ld a, $31 ld [hGraphicStartTile], a @@ -345,7 +345,7 @@ Function81adb: ; 81adb ld de, StringBuffer1 hlcoord 4, 1 call PlaceString - ld de, VTiles2 + ld de, vTiles2 callfar GetTrainerPic xor a ld [TempEnemyMonSpecies], a @@ -1062,14 +1062,14 @@ TilesetColorTest: xor a ld [hBGMapMode], a ld de, DebugColorTestGFX + $10 - ld hl, VTiles2 tile $6a + ld hl, vTiles2 tile $6a lb bc, BANK(DebugColorTestGFX), $16 call Request2bpp ld de, DebugColorTestGFX - ld hl, VTiles1 + ld hl, vTiles1 lb bc, BANK(DebugColorTestGFX), 1 call Request2bpp - ld a, HIGH(VBGMap1) + ld a, HIGH(vBGMap1) ld [hBGMapAddress + 1], a hlcoord 0, 0 ld bc, SCREEN_WIDTH * SCREEN_HEIGHT diff --git a/engine/diploma.asm b/engine/diploma.asm index f1c67ea37..ba45e4cd5 100644 --- a/engine/diploma.asm +++ b/engine/diploma.asm @@ -10,7 +10,7 @@ PlaceDiplomaOnScreen: ; 1dd709 call ClearSprites call DisableLCD ld hl, DiplomaGFX - ld de, VTiles2 + ld de, vTiles2 call Decompress ld hl, DiplomaPage1Tilemap decoord 0, 0 diff --git a/engine/dma_transfer.asm b/engine/dma_transfer.asm index 9d95c87b1..56e7d56da 100755 --- a/engine/dma_transfer.asm +++ b/engine/dma_transfer.asm @@ -594,13 +594,13 @@ HDMATransfer_OnlyTopFourRows: ; 104303 ld [rVBK], a ld c, $8 ld hl, wScratchTileMap + $80 - debgcoord 0, 0, VBGMap1 + debgcoord 0, 0, vBGMap1 call HDMATransfer_Wait127Scanlines ld a, $0 ld [rVBK], a ld c, $8 ld hl, wScratchTileMap - debgcoord 0, 0, VBGMap1 + debgcoord 0, 0, vBGMap1 call HDMATransfer_Wait127Scanlines ret diff --git a/engine/dummy_game.asm b/engine/dummy_game.asm index c315b8f38..4a1972ec3 100755 --- a/engine/dummy_game.asm +++ b/engine/dummy_game.asm @@ -12,10 +12,10 @@ _DummyGame: ; e1e5b (38:5e5b) call GetSGBLayout callfar ClearSpriteAnims ld hl, LZ_e2221 - ld de, VTiles2 tile $00 + ld de, vTiles2 tile $00 call Decompress ld hl, Unknown_e00ed - ld de, VTiles0 tile $00 + ld de, vTiles0 tile $00 ld bc, 4 tiles ld a, BANK(Unknown_e00ed) call FarCopyBytes diff --git a/engine/events.asm b/engine/events.asm index 9b26893e7..55d02ee93 100644 --- a/engine/events.asm +++ b/engine/events.asm @@ -491,7 +491,7 @@ CheckTimeEvents: ; 9693a and a jr nz, .nothing - ld hl, StatusFlags2 + ld hl, wStatusFlags2 bit 2, [hl] ; bug contest jr z, .do_daily diff --git a/engine/events/celebi.asm b/engine/events/celebi.asm index b7bf95145..1139ad3d5 100755 --- a/engine/events/celebi.asm +++ b/engine/events/celebi.asm @@ -72,11 +72,11 @@ Special_CelebiShrineEvent: ; 4989a LoadCelebiGFX: ; 49912 farcall ClearSpriteAnims ld de, SpecialCelebiLeafGFX - ld hl, VTiles1 + ld hl, vTiles1 lb bc, BANK(SpecialCelebiLeafGFX), 4 call Request2bpp ld de, SpecialCelebiGFX - ld hl, VTiles0 tile $84 + ld hl, vTiles0 tile $84 lb bc, BANK(SpecialCelebiGFX), $10 call Request2bpp xor a diff --git a/engine/events/crystal_unown.asm b/engine/events/crystal_unown.asm index 6c0e972f8..352306055 100644 --- a/engine/events/crystal_unown.asm +++ b/engine/events/crystal_unown.asm @@ -178,7 +178,7 @@ endc shift endr db $ff -endm +ENDM .UnownText_Escape: ; db $08, $44, $04, $00, $2e, $08, $ff diff --git a/engine/events/field_moves.asm b/engine/events/field_moves.asm index 1c21f4995..a1a2e2e79 100755 --- a/engine/events/field_moves.asm +++ b/engine/events/field_moves.asm @@ -8,7 +8,7 @@ PlayWhirlpoolSound: ; 8c7d4 BlindingFlash: ; 8c7e1 farcall FadeOutPalettes - ld hl, StatusFlags + ld hl, wStatusFlags set 2, [hl] ; Flash farcall ReplaceTimeOfDayPals farcall UpdateTimeOfDayPal @@ -22,11 +22,11 @@ BlindingFlash: ; 8c7e1 ShakeHeadbuttTree: ; 8c80a farcall ClearSpriteAnims ld de, CutGrassGFX - ld hl, VTiles1 + ld hl, vTiles1 lb bc, BANK(CutGrassGFX), 4 call Request2bpp ld de, HeadbuttTreeGFX - ld hl, VTiles1 tile $04 + ld hl, vTiles1 tile $04 lb bc, BANK(HeadbuttTreeGFX), 8 call Request2bpp call Cut_Headbutt_GetPixelFacing @@ -67,7 +67,7 @@ ShakeHeadbuttTree: ; 8c80a xor a call ByteFill ld de, Font - ld hl, VTiles1 + ld hl, vTiles1 lb bc, BANK(Font), 12 call Get1bpp call ReplaceKrisSprite @@ -141,11 +141,11 @@ OWCutAnimation: ; 8c940 .LoadCutGFX: ; 8c96d callfar ClearSpriteAnims ; pointless to farcall ld de, CutGrassGFX - ld hl, VTiles1 + ld hl, vTiles1 lb bc, BANK(CutGrassGFX), 4 call Request2bpp ld de, CutTreeGFX - ld hl, VTiles1 tile $4 + ld hl, vTiles1 tile $4 lb bc, BANK(CutTreeGFX), 4 call Request2bpp ret @@ -413,7 +413,7 @@ FlyToAnim: ; 8cb33 FlyFunction_InitGFX: ; 8cb9b (23:4b9b) callfar ClearSpriteAnims ld de, CutGrassGFX - ld hl, VTiles1 tile $00 + ld hl, vTiles1 tile $00 lb bc, BANK(CutGrassGFX), 4 call Request2bpp ld a, [CurPartyMon] diff --git a/engine/events/fish.asm b/engine/events/fish.asm index c571bba56..9d1ea63ae 100644 --- a/engine/events/fish.asm +++ b/engine/events/fish.asm @@ -97,7 +97,7 @@ GetFishGroupIndex: ; 9245b ; Return the index of fishgroup d in de. push hl - ld hl, DailyFlags + ld hl, wDailyFlags bit 2, [hl] pop hl jr z, .done diff --git a/engine/events/fruit_trees.asm b/engine/events/fruit_trees.asm index 595e41824..d0b0bac15 100644 --- a/engine/events/fruit_trees.asm +++ b/engine/events/fruit_trees.asm @@ -43,7 +43,7 @@ GetCurTreeFruit: ; 44041 ; 4404c TryResetFruitTrees: ; 4404c - ld hl, DailyFlags + ld hl, wDailyFlags bit 4, [hl] ret nz jp ResetFruitTrees @@ -70,7 +70,7 @@ ResetFruitTrees: ; 4406a ld [hli], a ld [hli], a ld [hl], a - ld hl, DailyFlags + ld hl, wDailyFlags set 4, [hl] ret ; 44078 diff --git a/engine/events/halloffame.asm b/engine/events/halloffame.asm index 5fa1dc270..f1981c2fd 100755 --- a/engine/events/halloffame.asm +++ b/engine/events/halloffame.asm @@ -2,7 +2,7 @@ HALLOFFAME_COLON EQU $63 HallOfFame:: ; 0x8640e call HallOfFame_FadeOutMusic - ld a, [StatusFlags] + ld a, [wStatusFlags] push af ld a, 1 ld [wGameLogicPaused], a @@ -11,7 +11,7 @@ HallOfFame:: ; 0x8640e ld [wSpawnAfterChampion], a ; Enable the Pokégear map to cycle through all of Kanto - ld hl, StatusFlags + ld hl, wStatusFlags set 6, [hl] ; hall of fame farcall HallOfFame_InitSaveIfNeeded @@ -52,7 +52,7 @@ RedCredits:: ; 86455 call DisableSpriteUpdates ld a, SPAWN_RED ld [wSpawnAfterChampion], a - ld a, [StatusFlags] + ld a, [wStatusFlags] ld b, a farcall Credits ret @@ -249,7 +249,7 @@ AnimateHOFMonEntrance: ; 865b5 ld bc, SCREEN_WIDTH * SCREEN_HEIGHT ld a, " " call ByteFill - ld de, VTiles2 tile $31 + ld de, vTiles2 tile $31 predef GetMonBackpic ld a, $31 ld [hGraphicStartTile], a @@ -533,7 +533,7 @@ DisplayHOFMon: ; 86748 HOF_AnimatePlayerPic: ; 86810 call ClearBGPalettes - ld hl, VTiles2 tile HALLOFFAME_COLON + ld hl, vTiles2 tile HALLOFFAME_COLON ld de, FontExtra + 13 tiles ; "<COLON>" lb bc, BANK(FontExtra), 1 call Request2bpp diff --git a/engine/events/heal_machine_anim.asm b/engine/events/heal_machine_anim.asm index c7789a28d..b51976d22 100755 --- a/engine/events/heal_machine_anim.asm +++ b/engine/events/heal_machine_anim.asm @@ -72,7 +72,7 @@ HealMachineAnim: ; 12324 .LoadGFX: ; 12383 call .LoadPalettes ld de, .HealMachineGFX - ld hl, VTiles0 tile $7c + ld hl, vTiles0 tile $7c lb bc, BANK(.HealMachineGFX), $2 call Request2bpp ret diff --git a/engine/events/magikarp.asm b/engine/events/magikarp.asm index 02c4b10cd..68e8baad7 100644 --- a/engine/events/magikarp.asm +++ b/engine/events/magikarp.asm @@ -79,7 +79,7 @@ Special_CheckMagikarpLength: ; fbb32 ; 0xfbbae Magikarp_LoadFeetInchesChars: ; fbbae - ld hl, VTiles2 tile "′" ; $6e + ld hl, vTiles2 tile "′" ; $6e ld de, .feetinchchars lb bc, BANK(.feetinchchars), 2 call Request2bpp @@ -108,7 +108,7 @@ PrintMagikarpLength: ; fbbdb ; fbbfc CalcMagikarpLength: ; fbbfc -; Return Magikarp's length (in mm) at wMagikarpLength (big endian). +; Return Magikarp's length (in feet and inches) at wMagikarpLength (big endian). ; ; input: ; de: EnemyMonDVs @@ -247,6 +247,10 @@ CalcMagikarpLength: ; fbbfc ld e, l .done + ; convert from mm to feet and inches + ; in = mm / 25.4 + ; ft = in / 12 + ; hl = de × 10 ld h, d ld l, e @@ -275,9 +279,9 @@ CalcMagikarpLength: ; fbbfc ld e, a ld hl, wMagikarpLength - ld [hl], d + ld [hl], d ; ft inc hl - ld [hl], e + ld [hl], e ; in ret ; fbc9a @@ -305,8 +309,11 @@ CalcMagikarpLength: ; fbbfc ; fbca8 .Lengths: ; fbca8 -; ????, divisor - dwb 110, 1 +; [wMagikarpLength] = z * 100 + (bc - x) / y +; First argument is the bc threshold as well as x. +; Second argument is y. +; In reality, due to the bug at .BCLessThanDE, the threshold is determined by only register b. + dwb 110, 1 ; not used unless the bug is fixed dwb 310, 2 dwb 710, 4 dwb 2710, 20 diff --git a/engine/events/magnet_train.asm b/engine/events/magnet_train.asm index 3a2f902c2..585912391 100755 --- a/engine/events/magnet_train.asm +++ b/engine/events/magnet_train.asm @@ -134,14 +134,14 @@ MagntTrain_LoadGFX_PlayMusic: ; 8ccc9 farcall GetPlayerIcon pop af ld [rSVBK], a - ld hl, VTiles0 + ld hl, vTiles0 ld c, 4 call Request2bpp ld hl, 12 tiles add hl, de ld d, h ld e, l - ld hl, VTiles0 tile $04 + ld hl, vTiles0 tile $04 ld c, 4 call Request2bpp call MagnetTrain_InitLYOverrides @@ -328,7 +328,7 @@ MagnetTrain_Jumptable: ; 8cdf7 push af ld a, $1 ld [rSVBK], a - ld a, [PlayerGender] + ld a, [wPlayerGender] bit 0, a jr z, .got_gender ld b, SPRITE_ANIM_INDEX_MAGNET_TRAIN_BLUE diff --git a/engine/events/overworld.asm b/engine/events/overworld.asm index 370162fa9..8c238cb9c 100755 --- a/engine/events/overworld.asm +++ b/engine/events/overworld.asm @@ -358,7 +358,7 @@ SurfFunction: ; c909 ld de, ENGINE_FOGBADGE call CheckBadge jr c, .asm_c956 - ld hl, BikeFlags + ld hl, wBikeFlags bit 1, [hl] ; always on bike jr nz, .cannotsurf ld a, [PlayerState] @@ -520,7 +520,7 @@ TrySurfOW:: ; c9e7 call CheckPartyMove jr c, .quit - ld hl, BikeFlags + ld hl, wBikeFlags bit 1, [hl] ; always on bike (can't surf) jr nz, .quit @@ -1008,7 +1008,7 @@ StrengthFunction: ; cce5 ret SetStrengthFlag: ; cd12 - ld hl, BikeFlags + ld hl, wBikeFlags set 0, [hl] ld a, [CurPartyMon] ld e, a @@ -1086,7 +1086,7 @@ TryStrengthOW: ; cd78 call CheckEngineFlag jr c, .nope - ld hl, BikeFlags + ld hl, wBikeFlags bit 0, [hl] jr z, .already_using @@ -1683,7 +1683,7 @@ BikeFunction: ; d0b3 ret .GetOffBike: - ld hl, BikeFlags + ld hl, wBikeFlags bit 1, [hl] jr nz, .CantGetOffBike ld hl, Script_GetOffBike diff --git a/engine/events/pokepic.asm b/engine/events/pokepic.asm index ea5b3c300..82016403b 100755 --- a/engine/events/pokepic.asm +++ b/engine/events/pokepic.asm @@ -11,7 +11,7 @@ Pokepic:: ; 244e3 ld a, [CurPartySpecies] ld [CurSpecies], a call GetBaseData - ld de, VTiles1 + ld de, vTiles1 predef GetMonFrontpic ld a, [wMenuBorderTopCoord] inc a diff --git a/engine/events/pokerus/pokerus.asm b/engine/events/pokerus/pokerus.asm index 3e5e094e4..d47bcb6c1 100644 --- a/engine/events/pokerus/pokerus.asm +++ b/engine/events/pokerus/pokerus.asm @@ -18,7 +18,7 @@ GivePokerusAndConvertBerries: ; 2ed44 ; If we haven't been to Goldenrod City at least once, ; prevent the contraction of Pokerus. - ld hl, StatusFlags2 + ld hl, wStatusFlags2 bit 6, [hl] ret z call Random @@ -123,7 +123,7 @@ GivePokerusAndConvertBerries: ; 2ed44 ; any berry held by a Shuckle may be converted to berry juice ConvertBerriesToBerryJuice: ; 2ede6 - ld hl, StatusFlags2 + ld hl, wStatusFlags2 bit 6, [hl] ret z call Random diff --git a/engine/events/print_unown.asm b/engine/events/print_unown.asm index 7841a688b..72248a67b 100644 --- a/engine/events/print_unown.asm +++ b/engine/events/print_unown.asm @@ -15,12 +15,12 @@ UnownPrinter: ; 16be4 call ClearTileMap ld de, UnownDexATile - ld hl, VTiles1 tile $6f + ld hl, vTiles1 tile $6f lb bc, BANK(UnownDexBTile), 1 call Request1bpp ld de, UnownDexBTile - ld hl, VTiles1 tile $75 + ld hl, vTiles1 tile $75 lb bc, BANK(UnownDexBTile), 1 call Request1bpp @@ -139,7 +139,7 @@ UnownPrinter: ; 16be4 ld [CurPartySpecies], a xor a ld [wBoxAlignment], a - ld de, VTiles2 + ld de, vTiles2 predef GetMonFrontpic call .Load2bppToSRAM hlcoord 1, 6 @@ -147,7 +147,7 @@ UnownPrinter: ; 16be4 ld [hGraphicStartTile], a lb bc, 7, 7 predef PlaceGraphic - ld de, VTiles2 tile $31 + ld de, vTiles2 tile $31 farcall RotateUnownFrontpic ret @@ -184,7 +184,7 @@ UnownPrinter: ; 16be4 ld bc, $31 tiles xor a call ByteFill - ld hl, VTiles2 tile $31 + ld hl, vTiles2 tile $31 ld de, sScratch ld c, $31 ld a, [hROMBank] diff --git a/engine/events/print_unown_2.asm b/engine/events/print_unown_2.asm index 057db5176..c932ded38 100644 --- a/engine/events/print_unown_2.asm +++ b/engine/events/print_unown_2.asm @@ -105,7 +105,7 @@ x = x +- \2 endr y = y + 1 endr -endm +ENDM UnownPrinter_OverworldMapRectangle: ; e008b overworldmaprect 7, 7 diff --git a/engine/events/special.asm b/engine/events/special.asm index d28d0de64..939db4a25 100755 --- a/engine/events/special.asm +++ b/engine/events/special.asm @@ -53,7 +53,7 @@ SpecialGiveShuckle: ; 7305 call CopyName2 ; Engine flag for this event. - ld hl, DailyFlags + ld hl, wDailyFlags set 5, [hl] ; setflag ENGINE_SHUCKLE_GIVEN ld a, 1 diff --git a/engine/events/sweet_scent.asm b/engine/events/sweet_scent.asm index 77567488c..9b75eb9b8 100755 --- a/engine/events/sweet_scent.asm +++ b/engine/events/sweet_scent.asm @@ -36,7 +36,7 @@ SweetScentNothing: ; 0x506e9 SweetScentEncounter: ; 506ef farcall CanUseSweetScent jr nc, .no_battle - ld hl, StatusFlags2 + ld hl, wStatusFlags2 bit 2, [hl] jr nz, .not_in_bug_contest farcall GetMapEncounterRate diff --git a/engine/events_2.asm b/engine/events_2.asm index cab6b8bd0..cac736bab 100644 --- a/engine/events_2.asm +++ b/engine/events_2.asm @@ -2,7 +2,7 @@ WarpToSpawnPoint:: ; 97c28 - ld hl, StatusFlags2 + ld hl, wStatusFlags2 res 1, [hl] ; safari zone? res 2, [hl] ; bug contest ret @@ -108,7 +108,7 @@ RandomEncounter:: ; 97cc0 jr c, .nope call CanUseSweetScent jr nc, .nope - ld hl, StatusFlags2 + ld hl, wStatusFlags2 bit 2, [hl] ; bug contest jr nz, .bug_contest farcall TryWildEncounter @@ -149,7 +149,7 @@ WildBattleScript: ; 97cf9 ; 97cfd CanUseSweetScent:: ; 97cfd - ld hl, StatusFlags + ld hl, wStatusFlags bit 5, [hl] jr nz, .no ld a, [wEnvironment] @@ -263,7 +263,7 @@ DoBikeStep:: ; 97db3 ; If the bike shop owner doesn't have our number, or ; if we've already gotten the call, we don't have to ; be here. - ld hl, StatusFlags2 + ld hl, wStatusFlags2 bit 4, [hl] ; bike shop call jr z, .NoCall @@ -314,7 +314,7 @@ DoBikeStep:: ; 97db3 ld [wSpecialPhoneCallID], a xor a ld [wSpecialPhoneCallID + 1], a - ld hl, StatusFlags2 + ld hl, wStatusFlags2 res 4, [hl] ; bike shop call scf ret diff --git a/engine/events_3.asm b/engine/events_3.asm index 3d662c332..5ee113a95 100755 --- a/engine/events_3.asm +++ b/engine/events_3.asm @@ -132,7 +132,7 @@ PlaceMapNameSign:: ; b8098 (2e:4098) LoadMapNameSignGFX: ; b80c6 ld de, MapEntryFrameGFX - ld hl, VTiles2 tile $60 + ld hl, vTiles2 tile $60 lb bc, BANK(MapEntryFrameGFX), $e call Get2bpp ret @@ -648,19 +648,19 @@ LoadFishingGFX: ; b84b3 ld [rVBK], a ld de, FishingGFX - ld a, [PlayerGender] + ld a, [wPlayerGender] bit 0, a jr z, .got_gender ld de, KrisFishingGFX .got_gender - ld hl, VTiles0 tile $02 + ld hl, vTiles0 tile $02 call .LoadGFX - ld hl, VTiles0 tile $06 + ld hl, vTiles0 tile $06 call .LoadGFX - ld hl, VTiles0 tile $0a + ld hl, vTiles0 tile $0a call .LoadGFX - ld hl, VTiles1 tile $7c + ld hl, vTiles1 tile $7c call .LoadGFX pop af diff --git a/engine/evolution_animation.asm b/engine/evolution_animation.asm index dd09f9eda..1fa55c10a 100755 --- a/engine/evolution_animation.asm +++ b/engine/evolution_animation.asm @@ -39,7 +39,7 @@ EvolutionAnimation: ; 4e5e1 farcall ClearSpriteAnims ld de, .GFX - ld hl, VTiles0 + ld hl, vTiles0 lb bc, BANK(.GFX), 8 call Request2bpp @@ -58,8 +58,8 @@ EvolutionAnimation: ; 4e5e1 ld [CurSpecies], a call .PlaceFrontpic - ld de, VTiles2 - ld hl, VTiles2 tile $31 + ld de, vTiles2 + ld hl, vTiles2 tile $31 ld bc, 7 * 7 call Request2bpp @@ -167,7 +167,7 @@ EvolutionAnimation: ; 4e5e1 call GetBaseData ld a, $1 ld [wBoxAlignment], a - ld de, VTiles2 + ld de, vTiles2 predef GetAnimatedFrontpicPredef xor a ld [wBoxAlignment], a diff --git a/engine/gbc_only.asm b/engine/gbc_only.asm index a77a44d72..efceae701 100644 --- a/engine/gbc_only.asm +++ b/engine/gbc_only.asm @@ -20,12 +20,12 @@ GBCOnlyScreen: ; 4ea82 ld [rSVBK], a ld de, $d000 - ld hl, VTiles2 + ld hl, vTiles2 lb bc, BANK(GBCOnlyGFX), $54 call Get2bpp ld de, Font - ld hl, VTiles1 + ld hl, vTiles1 lb bc, BANK(Font), $80 call Get1bpp diff --git a/engine/init_gender.asm b/engine/init_gender.asm index 092a1c9ea..bb6ce3736 100755 --- a/engine/init_gender.asm +++ b/engine/init_gender.asm @@ -3,7 +3,7 @@ InitCrystalData: ; 48000 ld [wd474], a xor a ld [wd473], a - ld [PlayerGender], a + ld [wPlayerGender], a ld [wd475], a ld [wd476], a ld [wd477], a @@ -37,7 +37,7 @@ InitGender: ; 48dcb (12:4dcb) call CloseWindow ld a, [wMenuCursorY] dec a - ld [PlayerGender], a + ld [wPlayerGender], a ld c, 10 call DelayFrames ret @@ -105,7 +105,7 @@ LoadGenderScreenPal: ; 48e47 (12:4e47) LoadGenderScreenLightBlueTile: ; 48e64 (12:4e64) ld de, .LightBlueTile - ld hl, VTiles2 tile $00 + ld hl, vTiles2 tile $00 lb bc, BANK(.LightBlueTile), 1 call Get2bpp ret diff --git a/engine/init_hof_credits.asm b/engine/init_hof_credits.asm index 81def1af3..99d142236 100644 --- a/engine/init_hof_credits.asm +++ b/engine/init_hof_credits.asm @@ -6,7 +6,7 @@ InitDisplayForHallOfFame: ; 4e881 call LoadStandardFont call LoadFontsBattleExtra hlbgcoord 0, 0 - ld bc, VBGMap1 - VBGMap0 + ld bc, vBGMap1 - vBGMap0 ld a, " " call ByteFill hlcoord 0, 0, AttrMap @@ -36,7 +36,7 @@ InitDisplayForRedCredits: ; 4e8c2 call LoadStandardFont call LoadFontsBattleExtra hlbgcoord 0, 0 - ld bc, VBGMap1 - VBGMap0 + ld bc, vBGMap1 - vBGMap0 ld a, " " call ByteFill hlcoord 0, 0, AttrMap diff --git a/engine/init_map.asm b/engine/init_map.asm index b7c405b5f..e5bee971d 100644 --- a/engine/init_map.asm +++ b/engine/init_map.asm @@ -27,7 +27,7 @@ ReanchorBGMap_NoOAMUpdate:: ; 6454 ld a, $90 ld [hWY], a call OverworldTextModeSwitch - ld a, HIGH(VBGMap1) + ld a, HIGH(vBGMap1) call .LoadBGMapAddrIntoHRAM call _OpenAndCloseMenu_HDMATransferTileMapAndAttrMap farcall LoadOW_BGPal7 @@ -38,11 +38,11 @@ ReanchorBGMap_NoOAMUpdate:: ; 6454 ld [hBGMapMode], a ld [hWY], a farcall HDMATransfer_FillBGMap0WithBlack ; no need to farcall - ld a, HIGH(VBGMap0) + ld a, HIGH(vBGMap0) call .LoadBGMapAddrIntoHRAM - xor a ; LOW(VBGMap0) + xor a ; LOW(vBGMap0) ld [wBGMapAnchor], a - ld a, HIGH(VBGMap0) + ld a, HIGH(vBGMap0) ld [wBGMapAnchor + 1], a xor a ld [hSCX], a @@ -90,9 +90,9 @@ HDMATransfer_FillBGMap0WithBlack: ; 64db ld [rHDMA1], a ld a, LOW(wDecompressScratch) ld [rHDMA2], a - ld a, HIGH(VBGMap0 % $8000) + ld a, HIGH(vBGMap0 % $8000) ld [rHDMA3], a - ld a, LOW(VBGMap0 % $8000) + ld a, LOW(vBGMap0 % $8000) ld [rHDMA4], a ld a, $3f ld [hDMATransfer], a diff --git a/engine/intro_menu.asm b/engine/intro_menu.asm index 77d1af6f9..5e38589aa 100755 --- a/engine/intro_menu.asm +++ b/engine/intro_menu.asm @@ -193,8 +193,8 @@ _ResetWRAM: ; 5bae xor a ld [MonType], a - ld [JohtoBadges], a - ld [KantoBadges], a + ld [wJohtoBadges], a + ld [wKantoBadges], a ld [Coins], a ld [Coins + 1], a @@ -483,7 +483,7 @@ FinishContinueFunction: ; 5e5d xor a ld [wDontPlayMapMusicOnReload], a ld [wLinkMode], a - ld hl, GameTimerPause + ld hl, wGameTimerPause set 0, [hl] res 7, [hl] ld hl, wEnteredMapFromContinue @@ -540,7 +540,7 @@ Continue_LoadMenuHeader: ; 5ebf xor a ld [hBGMapMode], a ld hl, .MenuDataHeader_Dex - ld a, [StatusFlags] + ld a, [wStatusFlags] bit 0, a ; pokedex jr nz, .pokedex_header ld hl, .MenuDataHeader_NoDex @@ -631,7 +631,7 @@ Continue_UnknownGameTime: ; 5f48 Continue_DisplayBadgeCount: ; 5f58 push hl - ld hl, JohtoBadges + ld hl, wJohtoBadges ld b, 2 call CountSetBits pop hl @@ -641,7 +641,7 @@ Continue_DisplayBadgeCount: ; 5f58 ; 5f6b Continue_DisplayPokedexNumCaught: ; 5f6b - ld a, [StatusFlags] + ld a, [wStatusFlags] bit 0, a ; Pokedex ret z push hl @@ -813,7 +813,7 @@ NamePlayer: ; 0x6074 ld hl, PlayerName ld de, .Chris - ld a, [PlayerGender] + ld a, [wPlayerGender] bit 0, a jr z, .Male ld de, .Kris @@ -942,7 +942,7 @@ Intro_WipeInFrontpic: ; 6182 ; 619c Intro_PrepTrainerPic: ; 619c - ld de, VTiles2 + ld de, vTiles2 farcall GetTrainerPic xor a ld [hGraphicStartTile], a @@ -953,7 +953,7 @@ Intro_PrepTrainerPic: ; 619c ; 61b4 ShrinkFrame: ; 61b4 - ld de, VTiles2 + ld de, vTiles2 ld c, $31 predef DecompressPredef xor a @@ -968,7 +968,7 @@ Intro_PlacePlayerSprite: ; 61cd farcall GetPlayerIcon ld c, $c - ld hl, VTiles0 + ld hl, vTiles0 call Request2bpp ld hl, Sprites @@ -989,7 +989,7 @@ Intro_PlacePlayerSprite: ; 61cd ld [hli], a ld b, 0 - ld a, [PlayerGender] + ld a, [wPlayerGender] bit 0, a jr z, .male ld b, 1 @@ -1376,7 +1376,7 @@ Copyright: ; 63e2 call ClearTileMap call LoadFontsExtra ld de, CopyrightGFX - ld hl, VTiles2 tile $60 + ld hl, vTiles2 tile $60 lb bc, BANK(CopyrightGFX), $1d call Request2bpp hlcoord 2, 7 @@ -1405,9 +1405,9 @@ GameInit:: ; 642e call ClearWindowData call ClearBGPalettes call ClearTileMap - ld a, HIGH(VBGMap0) + ld a, HIGH(vBGMap0) ld [hBGMapAddress + 1], a - xor a ; LOW(VBGMap0) + xor a ; LOW(vBGMap0) ld [hBGMapAddress], a ld [hJoyDown], a ld [hSCX], a diff --git a/engine/link_trade.asm b/engine/link_trade.asm index bb2765b50..f85403a29 100755 --- a/engine/link_trade.asm +++ b/engine/link_trade.asm @@ -4,7 +4,7 @@ INCBIN "gfx/trade/border_tiles.2bpp" __LoadTradeScreenBorder: ; 16d421 ld de, LinkCommsBorderGFX - ld hl, VTiles2 + ld hl, vTiles2 lb bc, BANK(LinkCommsBorderGFX), 70 call Get2bpp ret @@ -139,7 +139,7 @@ _LoadTradeScreenBorder: ; 16d696 LinkComms_LoadPleaseWaitTextboxBorderGFX: ; 16d69a ld de, LinkCommsBorderGFX + $30 tiles - ld hl, VTiles2 tile $76 + ld hl, vTiles2 tile $76 lb bc, BANK(LinkCommsBorderGFX), 8 call Get2bpp ret diff --git a/engine/mail_2.asm b/engine/mail_2.asm index dfbeca485..d66bbbbd7 100755 --- a/engine/mail_2.asm +++ b/engine/mail_2.asm @@ -28,7 +28,7 @@ ReadAnyMail: ; b9237 ld de, SpanishItalianFont .got_font - ld hl, VTiles1 + ld hl, vTiles1 lb bc, BANK(StandardEnglishFont), $80 call Get1bpp pop de @@ -128,7 +128,7 @@ MailGFXPointers: ; b92f8 LoadSurfMailGFX: ; b9317 push bc - ld hl, VTiles2 tile $31 + ld hl, vTiles2 tile $31 ld de, SurfMailBorderGFX ld c, 8 * 8 call LoadMailGFX_Color2 @@ -142,7 +142,7 @@ LoadSurfMailGFX: ; b9317 LoadLiteBlueMailGFX: ; b9335 push bc - ld hl, VTiles2 tile $31 + ld hl, vTiles2 tile $31 ld de, LiteBlueMailBorderGFX ld c, 8 * 8 call LoadMailGFX_Color2 @@ -213,7 +213,7 @@ FinishLoadingSurfLiteBlueMailGFX: ; b9351 LoadEonMailGFX: ; b93d2 push bc - ld hl, VTiles2 tile $31 + ld hl, vTiles2 tile $31 ld de, EonMailBorder1GFX ld c, 1 * 8 call LoadMailGFX_Color2 @@ -232,7 +232,7 @@ LoadEonMailGFX: ; b93d2 ld de, MailEeveeGFX ld c, 6 * 8 call LoadMailGFX_Color3 - ld hl, VTiles2 tile $3d + ld hl, vTiles2 tile $3d ld de, MailLargeCircleGFX ld c, 4 * 8 call LoadMailGFX_Color1 @@ -263,7 +263,7 @@ LoadEonMailGFX: ; b93d2 LoadLovelyMailGFX: ; b944b push bc - ld hl, VTiles2 tile $31 + ld hl, vTiles2 tile $31 ld de, LovelyMailBorderGFX ld c, 5 * 8 call LoadMailGFX_Color2 @@ -326,7 +326,7 @@ LovelyEonMail_PlaceIcons: ; b9491 LoadMorphMailGFX: ; b94d6 push bc - ld hl, VTiles2 tile $31 + ld hl, vTiles2 tile $31 ld bc, 5 * 8 call MailGFX_GenerateMonochromeTilesColor2 ld de, MorphMailBorderCornerGFX + 3 * 8 @@ -402,7 +402,7 @@ LoadMorphMailGFX: ; b94d6 LoadBlueSkyMailGFX: ; b9582 push bc - ld hl, VTiles2 tile $31 + ld hl, vTiles2 tile $31 ld de, EonMailBorder1GFX ld c, 1 * 8 call LoadMailGFX_Color2 @@ -490,7 +490,7 @@ Mail_Place6TileRow: ; b9636 LoadFlowerMailGFX: ; b963e push bc - ld hl, VTiles2 tile $31 + ld hl, vTiles2 tile $31 ld de, FlowerMailBorderGFX ld c, 8 * 8 call LoadMailGFX_Color1 @@ -545,14 +545,14 @@ LoadFlowerMailGFX: ; b963e LoadPortraitMailGFX: ; b96ca push bc - ld hl, VTiles2 tile $31 + ld hl, vTiles2 tile $31 ld de, PortraitMailBorderGFX ld c, 5 * 8 call LoadMailGFX_Color2 ld de, PortraitMailUnderlineGFX ld c, 1 * 8 call LoadMailGFX_Color2 - ld hl, VTiles2 tile $3d + ld hl, vTiles2 tile $3d ld de, PortraitMailLargePokeballGFX ld c, 4 * 8 call LoadMailGFX_Color1 @@ -576,7 +576,7 @@ LoadPortraitMailGFX: ; b96ca LoadMusicMailGFX: ; b9710 push bc - ld hl, VTiles2 tile $31 + ld hl, vTiles2 tile $31 ld de, MusicMailBorderGFX ld c, 4 * 8 call LoadMailGFX_Color2 @@ -619,7 +619,7 @@ LoadMusicMailGFX: ; b9710 LoadMirageMailGFX: ; b9776 push bc - ld hl, VTiles2 tile $31 + ld hl, vTiles2 tile $31 ld bc, 5 * 8 call MailGFX_GenerateMonochromeTilesColor2 ld de, BlueSkyMailGrassGFX diff --git a/engine/main_menu.asm b/engine/main_menu.asm index 92a16f5b6..a88f60bbf 100755 --- a/engine/main_menu.asm +++ b/engine/main_menu.asm @@ -9,7 +9,7 @@ MainMenu: ; 49cdc ld b, SCGB_DIPLOMA call GetSGBLayout call SetPalettes - ld hl, GameTimerPause + ld hl, wGameTimerPause res 0, [hl] call MainMenu_GetWhichMenu ld [wWhichIndexSet], a @@ -168,7 +168,7 @@ MainMenu_GetWhichMenu: ; 49da4 cp -1 call CloseSRAM jr nz, .mystery_gift - ld a, [StatusFlags] + ld a, [wStatusFlags] bit 7, a ld a, $1 ; Continue jr z, .ok @@ -182,7 +182,7 @@ MainMenu_GetWhichMenu: ; 49da4 ret .mystery_gift - ld a, [StatusFlags] + ld a, [wStatusFlags] bit 7, a jr z, .ok3 jr .ok3 diff --git a/engine/map_setup.asm b/engine/map_setup.asm index 562916442..078e6a2fd 100644 --- a/engine/map_setup.asm +++ b/engine/map_setup.asm @@ -168,7 +168,7 @@ CheckReplaceKrisSprite: ; 154f7 .CheckBiking: ; 1550c (5:550c) and a - ld hl, BikeFlags + ld hl, wBikeFlags bit 1, [hl] ret z ld a, PLAYER_BIKE diff --git a/engine/mart.asm b/engine/mart.asm index 55c184737..4a8d9e17b 100755 --- a/engine/mart.asm +++ b/engine/mart.asm @@ -58,7 +58,7 @@ BargainShop: ; 15a84 ld a, [hli] or [hl] jr z, .skip_set - ld hl, DailyFlags + ld hl, wDailyFlags set 6, [hl] .skip_set @@ -81,7 +81,7 @@ Pharmacist: ; 15aae RooftopSale: ; 15ac4 ld b, BANK(RooftopSaleData1) ld de, RooftopSaleData1 - ld hl, StatusFlags + ld hl, wStatusFlags bit 6, [hl] ; hall of fame jr z, .ok ld b, BANK(RooftopSaleData2) diff --git a/engine/mon_icons.asm b/engine/mon_icons.asm index 2ebeb67fa..695e28770 100755 --- a/engine/mon_icons.asm +++ b/engine/mon_icons.asm @@ -331,7 +331,7 @@ rept 4 add hl, hl endr - ld de, VTiles0 + ld de, vTiles0 add hl, de push hl diff --git a/engine/mystery_gift.asm b/engine/mystery_gift.asm index 3c8f9d029..e6d4504c2 100755 --- a/engine/mystery_gift.asm +++ b/engine/mystery_gift.asm @@ -1277,7 +1277,7 @@ InitMysteryGiftLayout: ; 105153 (41:5153) call ClearBGPalettes call DisableLCD ld hl, MysteryGiftGFX - ld de, VTiles2 tile $00 + ld de, vTiles2 tile $00 ld a, BANK(MysteryGiftGFX) ld bc, MysteryGiftGFXEnd - MysteryGiftGFX call FarCopyBytes @@ -1576,12 +1576,12 @@ Function1057d7: ; 1057d7 (41:57d7) call ClearBGPalettes call DisableLCD ld hl, MysteryGiftJP_GFX - ld de, VTiles2 tile $00 + ld de, vTiles2 tile $00 ld a, BANK(MysteryGiftJP_GFX) lb bc, 4, 0 call FarCopyBytes ld hl, MysteryGiftJP_GFX + $400 - ld de, VTiles0 tile $00 + ld de, vTiles0 tile $00 ld a, BANK(MysteryGiftJP_GFX) ld bc, $80 call FarCopyBytes diff --git a/engine/namingscreen.asm b/engine/namingscreen.asm index 3c4bfff5b..a01c02c31 100755 --- a/engine/namingscreen.asm +++ b/engine/namingscreen.asm @@ -175,7 +175,7 @@ NamingScreen: ; 116c1 .Box: ; 117f5 (4:57f5) ld de, PokeBallSpriteGFX - ld hl, VTiles0 tile $00 + ld hl, vTiles0 tile $00 lb bc, BANK(PokeBallSpriteGFX), $4 call Request2bpp xor a @@ -217,7 +217,7 @@ NamingScreen: ; 116c1 .LoadSprite: ; 11847 (4:5847) push de - ld hl, VTiles0 tile $00 + ld hl, vTiles0 tile $00 ld c, $4 push bc call Request2bpp @@ -226,7 +226,7 @@ NamingScreen: ; 116c1 add hl, de ld e, l ld d, h - ld hl, VTiles0 tile $04 + ld hl, vTiles0 tile $04 call Request2bpp xor a ld hl, wSpriteAnimDict @@ -905,22 +905,22 @@ LoadNamingScreenGFX: ; 11c51 call LoadFontsExtra ld de, NamingScreenGFX_MiddleLine - ld hl, VTiles1 tile $6b + ld hl, vTiles1 tile $6b lb bc, BANK(NamingScreenGFX_MiddleLine), 1 call Get1bpp ld de, NamingScreenGFX_UnderLine - ld hl, VTiles1 tile $72 + ld hl, vTiles1 tile $72 lb bc, BANK(NamingScreenGFX_UnderLine), 1 call Get1bpp - ld de, VTiles2 tile $60 + ld de, vTiles2 tile $60 ld hl, NamingScreenGFX_Border ld bc, 1 tiles ld a, BANK(NamingScreenGFX_Border) call FarCopyBytes - ld de, VTiles0 tile $7e + ld de, vTiles0 tile $7e ld hl, NamingScreenGFX_Cursor ld bc, 2 tiles ld a, BANK(NamingScreenGFX_Cursor) @@ -998,7 +998,7 @@ _ComposeMailMessage: ; 11e75 (mail?) call ClearBGPalettes call DisableLCD call LoadNamingScreenGFX - ld de, VTiles0 tile $00 + ld de, vTiles0 tile $00 ld hl, .MailIcon ld bc, 8 tiles ld a, BANK(.MailIcon) diff --git a/engine/overworld.asm b/engine/overworld.asm index 7941b74d7..68b8adaed 100755 --- a/engine/overworld.asm +++ b/engine/overworld.asm @@ -64,7 +64,7 @@ GetPlayerSprite: ; 14183 ld a, [wPlayerSpriteSetupFlags] bit 2, a jr nz, .go - ld a, [PlayerGender] + ld a, [wPlayerGender] bit 0, a jr z, .go ld hl, .Kris @@ -663,10 +663,10 @@ rept 4 add hl, hl endr ld a, l - add LOW(VTiles0) + add LOW(vTiles0) ld l, a ld a, h - adc HIGH(VTiles0) + adc HIGH(vTiles0) ld h, a ret ; 14418 diff --git a/engine/pack.asm b/engine/pack.asm index 2b0d04aba..b4f6d4ef1 100644 --- a/engine/pack.asm +++ b/engine/pack.asm @@ -1294,7 +1294,7 @@ DrawPackGFX: ; 1089d ld a, [BattleType] cp BATTLETYPE_TUTORIAL jr z, .male_dude - ld a, [PlayerGender] + ld a, [wPlayerGender] bit 0, a jr nz, .female .male_dude @@ -1304,7 +1304,7 @@ DrawPackGFX: ; 1089d ld a, [hli] ld e, a ld d, [hl] - ld hl, VTiles2 tile $50 + ld hl, vTiles2 tile $50 lb bc, BANK(PackGFX), 15 call Request2bpp ret @@ -1411,7 +1411,7 @@ Pack_InitGFX: ; 10955 call ClearSprites call DisableLCD ld hl, PackMenuGFX - ld de, VTiles2 + ld de, vTiles2 ld bc, $60 tiles ld a, BANK(PackMenuGFX) call FarCopyBytes diff --git a/engine/pic_animation.asm b/engine/pic_animation.asm index 2b93ef749..b060f5b4b 100644 --- a/engine/pic_animation.asm +++ b/engine/pic_animation.asm @@ -56,7 +56,7 @@ pokeanim: MACRO rept _NARG ; Workaround for a bug where macro args can't come after the start of a symbol if !def(\1_POKEANIM) -\1_POKEANIM equs "PokeAnim_\1_" +\1_POKEANIM EQUS "PokeAnim_\1_" endc db (\1_POKEANIM - PokeAnim_SetupCommands) / 2 shift @@ -142,9 +142,9 @@ SetUpPokeAnim: ; d00b4 ; d00da PokeAnim_SetupCommands: ; d00da -setup_command: macro +setup_command: MACRO \1_: dw \1 -endm +ENDM setup_command PokeAnim_Finish setup_command PokeAnim_BasePic setup_command PokeAnim_SetWait @@ -586,7 +586,7 @@ x = x + 1 endr y = y + 7 endr -endm +ENDM PokeAnim_ConvertAndApplyBitmask: ; d036b xor a @@ -1120,7 +1120,7 @@ HOF_AnimateFrontpic: ; d066e Predef 49 ld l, e push bc push hl - ld de, VTiles2 + ld de, vTiles2 predef GetAnimatedFrontpicPredef pop hl pop bc diff --git a/engine/player_gfx.asm b/engine/player_gfx.asm index 6ffaa77c8..98a54684b 100644 --- a/engine/player_gfx.asm +++ b/engine/player_gfx.asm @@ -1,7 +1,7 @@ Function88248: ; 88248 ; XXX ld c, CAL - ld a, [PlayerGender] + ld a, [wPlayerGender] bit 0, a jr z, .okay ld c, KAREN @@ -58,7 +58,7 @@ MovePlayerPic: ; 88266 ShowPlayerNamingChoices: ; 88297 ld hl, ChrisNameMenuHeader - ld a, [PlayerGender] + ld a, [wPlayerGender] bit 0, a jr z, .GotGender ld hl, KrisNameMenuHeader @@ -76,7 +76,7 @@ INCLUDE "data/default_names.asm" GetPlayerNameArray: ; 88318 This Function is never called ld hl, PlayerName ld de, MalePlayerNameArray - ld a, [PlayerGender] + ld a, [wPlayerGender] bit 0, a jr z, .done ld de, FemalePlayerNameArray @@ -92,7 +92,7 @@ GetPlayerIcon: ; 8832c ld de, ChrisSpriteGFX ld b, BANK(ChrisSpriteGFX) - ld a, [PlayerGender] + ld a, [wPlayerGender] bit 0, a jr z, .done @@ -105,17 +105,17 @@ GetPlayerIcon: ; 8832c GetCardPic: ; 8833e ld hl, ChrisCardPic - ld a, [PlayerGender] + ld a, [wPlayerGender] bit 0, a jr z, .GotClass ld hl, KrisCardPic .GotClass: - ld de, VTiles2 tile $00 + ld de, vTiles2 tile $00 ld bc, $23 tiles ld a, BANK(ChrisCardPic) ; BANK(KrisCardPic) call FarCopyBytes ld hl, CardGFX - ld de, VTiles2 tile $23 + ld de, vTiles2 tile $23 ld bc, 6 tiles ld a, BANK(CardGFX) call FarCopyBytes @@ -131,7 +131,7 @@ CardGFX: ; 887c5 INCBIN "gfx/trainer_card/trainer_card.2bpp" GetPlayerBackpic: ; 88825 - ld a, [PlayerGender] + ld a, [wPlayerGender] bit 0, a jr z, GetChrisBackpic call GetKrisBackpic @@ -140,7 +140,7 @@ GetPlayerBackpic: ; 88825 GetChrisBackpic: ; 88830 ld hl, ChrisBackpic ld b, BANK(ChrisBackpic) - ld de, VTiles2 tile $31 + ld de, vTiles2 tile $31 ld c, 7 * 7 predef DecompressPredef ret @@ -150,7 +150,7 @@ HOF_LoadTrainerFrontpic: ; 88840 xor a ld [hBGMapMode], a ld e, 0 - ld a, [PlayerGender] + ld a, [wPlayerGender] bit 0, a jr z, .GotClass ld e, 1 @@ -159,13 +159,13 @@ HOF_LoadTrainerFrontpic: ; 88840 ld a, e ld [TrainerClass], a ld de, ChrisPic - ld a, [PlayerGender] + ld a, [wPlayerGender] bit 0, a jr z, .GotPic ld de, KrisPic .GotPic: - ld hl, VTiles2 + ld hl, vTiles2 ld b, BANK(ChrisPic) ; BANK(KrisPic) ld c, 7 * 7 call Get2bpp @@ -179,7 +179,7 @@ DrawIntroPlayerPic: ; 88874 ; Get class ld e, CHRIS - ld a, [PlayerGender] + ld a, [wPlayerGender] bit 0, a jr z, .GotClass ld e, KRIS @@ -189,12 +189,12 @@ DrawIntroPlayerPic: ; 88874 ; Load pic ld de, ChrisPic - ld a, [PlayerGender] + ld a, [wPlayerGender] bit 0, a jr z, .GotPic ld de, KrisPic .GotPic: - ld hl, VTiles2 + ld hl, vTiles2 ld b, BANK(ChrisPic) ; BANK(KrisPic) ld c, 7 * 7 ; dimensions call Get2bpp @@ -216,7 +216,7 @@ INCBIN "gfx/player/kris.2bpp" GetKrisBackpic: ; 88ec9 ; Kris's backpic is uncompressed. ld de, KrisBackpic - ld hl, VTiles2 tile $31 + ld hl, vTiles2 tile $31 lb bc, BANK(KrisBackpic), 7 * 7 ; dimensions call Get2bpp ret diff --git a/engine/player_movement.asm b/engine/player_movement.asm index db0c07801..fa7cc84a5 100755 --- a/engine/player_movement.asm +++ b/engine/player_movement.asm @@ -18,7 +18,7 @@ DoPlayerMovement:: ; 80000 ; Standing downhill instead moves down. - ld hl, BikeFlags + ld hl, wBikeFlags bit 2, [hl] ; downhill ret z @@ -285,7 +285,7 @@ DoPlayerMovement:: ; 80000 call .BikeCheck jr nz, .walk - ld hl, BikeFlags + ld hl, wBikeFlags bit 2, [hl] ; downhill jr z, .fast @@ -672,7 +672,7 @@ DoPlayerMovement:: ; 80000 .CheckStrengthBoulder: ; 8036f - ld hl, BikeFlags + ld hl, wBikeFlags bit 0, [hl] ; using strength jr z, .not_boulder diff --git a/engine/player_object.asm b/engine/player_object.asm index fe19d15b5..e11a30036 100755 --- a/engine/player_object.asm +++ b/engine/player_object.asm @@ -33,7 +33,7 @@ SpawnPlayer: ; 8029 ld a, [wPlayerSpriteSetupFlags] bit 2, a jr nz, .ok - ld a, [PlayerGender] + ld a, [wPlayerGender] bit 0, a jr z, .ok ln e, PAL_NPC_BLUE, OBJECTTYPE_SCRIPT diff --git a/engine/player_step.asm b/engine/player_step.asm index b55584ab1..c20bc09e9 100755 --- a/engine/player_step.asm +++ b/engine/player_step.asm @@ -156,7 +156,7 @@ UpdateOverworldMap: ; d536 (3:5536) ld a, [wBGMapAnchor + 1] inc a and $3 - or HIGH(VBGMap0) + or HIGH(vBGMap0) ld [wBGMapAnchor + 1], a .not_overflowed ld hl, wMetatileStandingY @@ -187,7 +187,7 @@ UpdateOverworldMap: ; d536 (3:5536) ld a, [wBGMapAnchor + 1] dec a and $3 - or HIGH(VBGMap0) + or HIGH(vBGMap0) ld [wBGMapAnchor + 1], a .not_underflowed ld hl, wMetatileStandingY diff --git a/engine/pokedex.asm b/engine/pokedex.asm index 12b5b2cd6..95f9404f9 100644 --- a/engine/pokedex.asm +++ b/engine/pokedex.asm @@ -103,7 +103,7 @@ InitPokedex: ; 40063 ret Pokedex_CheckUnlockedUnownMode: ; 400a2 - ld a, [StatusFlags] + ld a, [wStatusFlags] bit 1, a jr nz, .unlocked @@ -828,7 +828,7 @@ Pokedex_UpdateUnownMode: ; 405df (10:45df) .decompress ld hl, PokedexLZ - ld de, VTiles2 tile $31 + ld de, vTiles2 tile $31 lb bc, BANK(PokedexLZ), $3a call DecompressRequest2bpp @@ -2402,7 +2402,7 @@ Pokedex_LoadSelectedMonTiles: ; 4143b ld a, [wd265] ld [CurPartySpecies], a call GetBaseData - ld de, VTiles2 + ld de, vTiles2 predef GetMonFrontpic ret @@ -2410,7 +2410,7 @@ Pokedex_LoadSelectedMonTiles: ; 4143b ld a, BANK(sScratch) call GetSRAMBank farcall LoadQuestionMarkPic - ld hl, VTiles2 + ld hl, vTiles2 ld de, sScratch ld c, 7 * 7 ld a, [hROMBank] @@ -2445,7 +2445,7 @@ Pokedex_LoadAnyFootprint: ; 4147b push hl ld e, l ld d, h - ld hl, VTiles2 tile $62 + ld hl, vTiles2 tile $62 lb bc, BANK(Footprints), 2 call Request1bpp pop hl @@ -2457,7 +2457,7 @@ Pokedex_LoadAnyFootprint: ; 4147b ld e, l ld d, h - ld hl, VTiles2 tile $64 + ld hl, vTiles2 tile $64 lb bc, BANK(Footprints), 2 call Request1bpp @@ -2466,13 +2466,13 @@ Pokedex_LoadAnyFootprint: ; 4147b Pokedex_LoadGFX: ; 414b7 call DisableLCD - ld hl, VTiles2 + ld hl, vTiles2 ld bc, $31 tiles xor a call ByteFill call Pokedex_LoadInvertedFont call LoadFontsExtra - ld hl, VTiles2 tile $60 + ld hl, vTiles2 tile $60 ld bc, $20 tiles call Pokedex_InvertTiles call Pokedex_CheckSGB @@ -2482,12 +2482,12 @@ Pokedex_LoadGFX: ; 414b7 .LoadPokedexLZ: ld hl, PokedexLZ - ld de, VTiles2 tile $31 + ld de, vTiles2 tile $31 call Decompress .LoadPokedexSlowpokeLZ: ld hl, PokedexSlowpokeLZ - ld de, VTiles0 + ld de, vTiles0 call Decompress ld a, 6 call SkipMusic @@ -2496,7 +2496,7 @@ Pokedex_LoadGFX: ; 414b7 Pokedex_LoadInvertedFont: ; 414fb call LoadStandardFont - ld hl, VTiles1 + ld hl, vTiles1 ld bc, $80 tiles Pokedex_InvertTiles: ; 41504 @@ -2536,7 +2536,7 @@ Pokedex_LoadUnownFont: ; 41a2c ld bc, 27 tiles call Pokedex_InvertTiles ld de, sScratch + $188 - ld hl, VTiles2 tile $40 + ld hl, vTiles2 tile $40 lb bc, BANK(Pokedex_LoadUnownFont), 27 call Request2bpp call CloseSRAM @@ -2555,7 +2555,7 @@ Pokedex_LoadUnownFrontpicTiles: ; 41a58 (10:5a58) ld a, UNOWN ld [CurPartySpecies], a call GetBaseData - ld de, VTiles2 tile $00 + ld de, vTiles2 tile $00 predef GetMonFrontpic pop af ld [UnownLetter], a @@ -2585,7 +2585,7 @@ _NewPokedexEntry: ; 41a7f call EnableLCD call WaitBGMap call GetBaseData - ld de, VTiles2 + ld de, vTiles2 predef GetMonFrontpic ld a, SCGB_POKEDEX call Pokedex_GetSGBLayout diff --git a/engine/pokedex_3.asm b/engine/pokedex_3.asm index 6ec2ce9fd..482f55799 100644 --- a/engine/pokedex_3.asm +++ b/engine/pokedex_3.asm @@ -1,12 +1,12 @@ LoadSGBPokedexGFX: ; 1ddf1c ld hl, SGBPokedexGFX_LZ - ld de, VTiles2 tile $31 + ld de, vTiles2 tile $31 call Decompress ret LoadSGBPokedexGFX2: ; 1ddf26 (77:5f26) ld hl, SGBPokedexGFX_LZ - ld de, VTiles2 tile $31 + ld de, vTiles2 tile $31 lb bc, BANK(SGBPokedexGFX_LZ), $3a call DecompressRequest2bpp ret diff --git a/engine/pokegear.asm b/engine/pokegear.asm index a3e43cebf..aff64ef6c 100755 --- a/engine/pokegear.asm +++ b/engine/pokegear.asm @@ -35,9 +35,9 @@ PokeGear: ; 90b8d (24:4b8d) pop af ld [Options], a call ClearBGPalettes - xor a ; LOW(VBGMap0) + xor a ; LOW(vBGMap0) ld [hBGMapAddress], a - ld a, HIGH(VBGMap0) + ld a, HIGH(vBGMap0) ld [hBGMapAddress + 1], a ld a, $90 ld [hWY], a @@ -88,15 +88,15 @@ PokeGear: ; 90b8d (24:4b8d) Pokegear_LoadGFX: ; 90c4e call ClearVBank1 ld hl, TownMapGFX - ld de, VTiles2 + ld de, vTiles2 ld a, BANK(TownMapGFX) call FarDecompress ld hl, PokegearGFX - ld de, VTiles2 + $30 tiles + ld de, vTiles2 + $30 tiles ld a, BANK(PokegearGFX) call FarDecompress ld hl, PokegearSpritesGFX - ld de, VTiles0 + ld de, vTiles0 ld a, BANK(PokegearSpritesGFX) call Decompress ld a, [MapGroup] @@ -113,7 +113,7 @@ Pokegear_LoadGFX: ; 90c4e ld a, b ; standing sprite push af - ld de, VTiles0 tile $10 + ld de, vTiles0 tile $10 ld bc, 4 tiles call FarCopyBytes pop af @@ -121,14 +121,14 @@ Pokegear_LoadGFX: ; 90c4e ; walking sprite ld de, 12 tiles add hl, de - ld de, VTiles0 tile $14 + ld de, vTiles0 tile $14 ld bc, 4 tiles call FarCopyBytes ret .ssaqua ld hl, FastShipGFX - ld de, VTiles0 tile $10 + ld de, vTiles0 tile $10 ld bc, 8 tiles call CopyBytes ret @@ -243,18 +243,18 @@ InitPokegearTilemap: ; 90da8 (24:4da8) ld a, [wcf65] and a jr nz, .kanto_0 - xor a ; LOW(VBGMap0) + xor a ; LOW(vBGMap0) ld [hBGMapAddress], a - ld a, HIGH(VBGMap0) + ld a, HIGH(vBGMap0) ld [hBGMapAddress + 1], a call .UpdateBGMap ld a, $90 jr .finish .kanto_0 - xor a ; LOW(VBGMap1) + xor a ; LOW(vBGMap1) ld [hBGMapAddress], a - ld a, HIGH(VBGMap1) + ld a, HIGH(vBGMap1) ld [hBGMapAddress + 1], a call .UpdateBGMap xor a @@ -657,7 +657,7 @@ PokegearMap_InitPlayerIcon: ; 9106a push af depixel 0, 0 ld b, SPRITE_ANIM_INDEX_RED_WALK - ld a, [PlayerGender] + ld a, [wPlayerGender] bit 0, a jr z, .got_gender ld b, SPRITE_ANIM_INDEX_BLUE_WALK @@ -734,7 +734,7 @@ PokegearMap_UpdateCursorPosition: ; 910d4 ; 910e8 TownMap_GetKantoLandmarkLimits: ; 910e8 - ld a, [StatusFlags] + ld a, [wStatusFlags] bit 6, a jr z, .not_hof ld d, ROUTE_28 @@ -1583,7 +1583,7 @@ RadioChannels: .EvolutionRadio: ; This station airs in the Lake of Rage area when Rocket are still in Mahogany. - ld a, [StatusFlags] + ld a, [wStatusFlags] bit 4, a jr z, .NoSignal ld a, [wPokegearMapPlayerIconLandmark] @@ -1669,7 +1669,7 @@ LoadStation_BuenasPassword: ; 917a5 (24:57a5) ld hl, PlayRadioShow call Radio_BackUpFarCallParams ld de, NotBuenasPasswordName - ld a, [StatusFlags2] + ld a, [wStatusFlags2] bit 0, a ret z ld de, BuenasPasswordName @@ -2119,7 +2119,7 @@ _FlyMap: ; 91af3 farcall ClearSpriteAnims call LoadTownMapGFX ld de, FlyMapLabelBorderGFX - ld hl, VTiles2 tile $30 + ld hl, vTiles2 tile $30 lb bc, BANK(FlyMapLabelBorderGFX), 6 call Request1bpp call FlyMap @@ -2161,9 +2161,9 @@ _FlyMap: ; 91af3 call ClearBGPalettes ld a, $90 ld [hWY], a - xor a ; LOW(VBGMap0) + xor a ; LOW(vBGMap0) ld [hBGMapAddress], a - ld a, HIGH(VBGMap0) + ld a, HIGH(vBGMap0) ld [hBGMapAddress + 1], a ld a, [wTownMapPlayerIconLandmark] ld e, a @@ -2329,7 +2329,7 @@ CheckIfVisitedFlypoint: ; 91c3c HasVisitedSpawn: ; 91c50 ; Check if spawn point c has been visited. - ld hl, VisitedSpawns + ld hl, wVisitedSpawns ld b, CHECK_FLAG ld d, 0 predef FlagPredef @@ -2455,18 +2455,18 @@ _Area: ; 91d11 ld a, $1 ld [hInMenu], a ld de, PokedexNestIconGFX - ld hl, VTiles0 tile $7f + ld hl, vTiles0 tile $7f lb bc, BANK(PokedexNestIconGFX), 1 call Request2bpp call .GetPlayerOrFastShipIcon - ld hl, VTiles0 tile $78 + ld hl, vTiles0 tile $78 ld c, 4 call Request2bpp call LoadTownMapGFX call FillKantoMap call .PlaceString_MonsNest call TownMapPals - hlbgcoord 0, 0, VBGMap1 + hlbgcoord 0, 0, vBGMap1 call TownMapBGUpdate call FillJohtoMap call .PlaceString_MonsNest @@ -2530,7 +2530,7 @@ _Area: ; 91d11 ret .right - ld a, [StatusFlags] + ld a, [wStatusFlags] bit 6, a ; hall of fame ret z ld a, [hWY] @@ -2659,7 +2659,7 @@ _Area: ; 91d11 inc de push bc ld c, 0 ; RED - ld a, [PlayerGender] + ld a, [wPlayerGender] bit 0, a jr z, .got_gender inc c ; BLUE @@ -2871,7 +2871,7 @@ TownMapPlayerIcon: ; 91fa6 push af farcall GetPlayerIcon ; Standing icon - ld hl, VTiles0 tile $10 + ld hl, vTiles0 tile $10 ld c, 4 ; # tiles call Request2bpp ; Walking icon @@ -2879,14 +2879,14 @@ TownMapPlayerIcon: ; 91fa6 add hl, de ld d, h ld e, l - ld hl, VTiles0 tile $14 + ld hl, vTiles0 tile $14 ld c, 4 ; # tiles ld a, BANK(ChrisSpriteGFX) ; does nothing call Request2bpp ; Animation/palette depixel 0, 0 ld b, SPRITE_ANIM_INDEX_RED_WALK ; Male - ld a, [PlayerGender] + ld a, [wPlayerGender] bit 0, a jr z, .got_gender ld b, SPRITE_ANIM_INDEX_BLUE_WALK ; Female @@ -2913,7 +2913,7 @@ TownMapPlayerIcon: ; 91fa6 LoadTownMapGFX: ; 91ff2 ld hl, TownMapGFX - ld de, VTiles2 + ld de, vTiles2 lb bc, BANK(TownMapGFX), $30 call DecompressRequest2bpp ret @@ -2948,13 +2948,13 @@ INCBIN "gfx/pokegear/flymap_label_border.1bpp" farcall ClearSpriteAnims call LoadTownMapGFX ld de, FlyMapLabelBorderGFX - ld hl, VTiles2 tile $30 + ld hl, vTiles2 tile $30 lb bc, BANK(FlyMapLabelBorderGFX), 6 call Request1bpp call FillKantoMap call TownMapBubble call TownMapPals - hlbgcoord 0, 0, VBGMap1 + hlbgcoord 0, 0, vBGMap1 call TownMapBGUpdate call FillJohtoMap call TownMapBubble @@ -3003,9 +3003,9 @@ INCBIN "gfx/pokegear/flymap_label_border.1bpp" call ClearBGPalettes ld a, $90 ld [hWY], a - xor a ; LOW(VBGMap0) + xor a ; LOW(vBGMap0) ld [hBGMapAddress], a - ld a, HIGH(VBGMap0) + ld a, HIGH(vBGMap0) ld [hBGMapAddress + 1], a ld a, [wTownMapPlayerIconLandmark] ld e, a diff --git a/engine/print_party.asm b/engine/print_party.asm index 69bda8d52..f2420dfe8 100755 --- a/engine/print_party.asm +++ b/engine/print_party.asm @@ -141,17 +141,17 @@ PrintPartyMonPage1: ; 1dc381 call LoadFontsBattleExtra ld de, GBPrinterHPIcon - ld hl, VTiles2 tile $71 + ld hl, vTiles2 tile $71 lb bc, BANK(GBPrinterHPIcon), 1 call Request1bpp ld de, GBPrinterLvIcon - ld hl, VTiles2 tile $6e + ld hl, vTiles2 tile $6e lb bc, BANK(GBPrinterLvIcon), 1 call Request1bpp ld de, ShinyIconGFX - ld hl, VTiles2 tile $3f + ld hl, vTiles2 tile $3f lb bc, BANK(ShinyIconGFX), 1 call Get2bpp diff --git a/engine/printer.asm b/engine/printer.asm index b72f99375..68c3c6c9f 100755 --- a/engine/printer.asm +++ b/engine/printer.asm @@ -49,7 +49,7 @@ PrintDexEntry: ; 8442c ld a, [wPrinterQueueLength] push af - ld hl, VTiles1 + ld hl, vTiles1 ld de, FontInversed lb bc, BANK(FontInversed), $80 call Request1bpp diff --git a/engine/radio.asm b/engine/radio.asm index b5c1e075f..42db63ab0 100644 --- a/engine/radio.asm +++ b/engine/radio.asm @@ -4,7 +4,7 @@ PlayRadioShow: cp POKE_FLUTE_RADIO jr nc, .ok ; If Team Rocket is not occupying the radio tower, we don't need to be here. - ld a, [StatusFlags2] + ld a, [wStatusFlags2] bit 0, a ; checkflag ENGINE_ROCKETS_IN_RADIO_TOWER jr z, .ok ; If we're in Kanto, we don't need to be here. @@ -1176,11 +1176,11 @@ PeoplePlaces4: ; People jr nc, PeoplePlaces4 push af ld hl, .E4Names - ld a, [StatusFlags] + ld a, [wStatusFlags] bit 6, a ; ENGINE_CREDITS_SKIP jr z, .ok ld hl, .KantoLeaderNames - ld a, [KantoBadges] + ld a, [wKantoBadges] cp %11111111 jr nz, .ok ld hl, .MiscNames @@ -1571,7 +1571,7 @@ BuenasPassword4: jp c, BuenasPassword8 ld a, [wBuenasPassword] ; If we already generated the password today, we don't need to generate a new one. - ld hl, WeeklyFlags + ld hl, wWeeklyFlags bit 7, [hl] jr nz, .AlreadyGotIt ; There are only 11 groups to choose from. @@ -1593,7 +1593,7 @@ BuenasPassword4: add e ld [wBuenasPassword], a ; Set the flag so that we don't generate a new password this week. - ld hl, WeeklyFlags + ld hl, wWeeklyFlags set 7, [hl] .AlreadyGotIt: ld c, a @@ -1737,14 +1737,14 @@ BuenasPassword7: BuenasPasswordAfterMidnight: push hl - ld hl, WeeklyFlags + ld hl, wWeeklyFlags res 7, [hl] pop hl ld a, BUENAS_PASSWORD_8 jp NextRadioLine BuenasPassword8: - ld hl, WeeklyFlags + ld hl, wWeeklyFlags res 7, [hl] ld hl, BuenaRadioMidnightText10 ld a, BUENAS_PASSWORD_9 @@ -1812,7 +1812,7 @@ BuenasPassword20: farcall NoRadioName pop af ld [hBGMapMode], a - ld hl, WeeklyFlags + ld hl, wWeeklyFlags res 7, [hl] ld a, BUENAS_PASSWORD ld [wCurrentRadioLine], a diff --git a/engine/routines/drawkrispackgfx.asm b/engine/routines/drawkrispackgfx.asm index f71e43db8..457dd7110 100644 --- a/engine/routines/drawkrispackgfx.asm +++ b/engine/routines/drawkrispackgfx.asm @@ -5,7 +5,7 @@ DrawKrisPackGFX: ; 48e81 ld a, [hli] ld e, a ld d, [hl] - ld hl, VTiles2 tile $50 + ld hl, vTiles2 tile $50 lb bc, BANK(PackFGFX), 15 call Request2bpp ret diff --git a/engine/routines/phonering_copytilemapatonce.asm b/engine/routines/phonering_copytilemapatonce.asm index 1780136d1..b1a726675 100644 --- a/engine/routines/phonering_copytilemapatonce.asm +++ b/engine/routines/phonering_copytilemapatonce.asm @@ -21,11 +21,11 @@ PhoneRing_CopyTilemapAtOnce: ; 4d188 jr c, .wait di - ld a, BANK(VBGMap2) + ld a, BANK(vBGMap2) ld [rVBK], a hlcoord 0, 0, AttrMap call .CopyTilemapAtOnce - ld a, BANK(VBGMap0) + ld a, BANK(vBGMap0) ld [rVBK], a hlcoord 0, 0 call .CopyTilemapAtOnce diff --git a/engine/routines/savemenu_copytilemapatonce.asm b/engine/routines/savemenu_copytilemapatonce.asm index 0adce91c6..5d4ed8b7d 100644 --- a/engine/routines/savemenu_copytilemapatonce.asm +++ b/engine/routines/savemenu_copytilemapatonce.asm @@ -18,11 +18,11 @@ SaveMenu_CopyTilemapAtOnce: ; 4cf45 (13:4f45) jr c, .WaitLY di - ld a, BANK(VBGMap2) + ld a, BANK(vBGMap2) ld [rVBK], a hlcoord 0, 0, AttrMap call .CopyTilemapAtOnce - ld a, BANK(VBGMap0) + ld a, BANK(vBGMap0) ld [rVBK], a hlcoord 0, 0 call .CopyTilemapAtOnce diff --git a/engine/routines/trademonfrontpic.asm b/engine/routines/trademonfrontpic.asm index 3a38688d7..e312042ff 100644 --- a/engine/routines/trademonfrontpic.asm +++ b/engine/routines/trademonfrontpic.asm @@ -1,7 +1,7 @@ GetTrademonFrontpic: ; 4d7fd ld a, [wOTTrademonSpecies] ld hl, wOTTrademonDVs - ld de, VTiles2 + ld de, vTiles2 push de push af predef GetUnownLetter diff --git a/engine/save.asm b/engine/save.asm index 69bbaee82..af24b4d2f 100644 --- a/engine/save.asm +++ b/engine/save.asm @@ -691,8 +691,8 @@ TryLoadSaveData: ; 14f1c ld de, StartDay ld bc, 8 call CopyBytes - ld hl, sPlayerData + StatusFlags - wPlayerData - ld de, StatusFlags + ld hl, sPlayerData + wStatusFlags - wPlayerData + ld de, wStatusFlags ld a, [hl] ld [de], a call CloseSRAM @@ -710,8 +710,8 @@ TryLoadSaveData: ; 14f1c ld de, StartDay ld bc, 8 call CopyBytes - ld hl, sBackupPlayerData + StatusFlags - wPlayerData - ld de, StatusFlags + ld hl, sBackupPlayerData + wStatusFlags - wPlayerData + ld de, wStatusFlags ld a, [hl] ld [de], a call CloseSRAM diff --git a/engine/scripting.asm b/engine/scripting.asm index 826267f6b..7512bdc06 100644 --- a/engine/scripting.asm +++ b/engine/scripting.asm @@ -2609,14 +2609,14 @@ _EngineFlagAction: Script_wildoff: ; script command 0x38 - ld hl, StatusFlags + ld hl, wStatusFlags set 5, [hl] ret Script_wildon: ; script command 0x37 - ld hl, StatusFlags + ld hl, wStatusFlags res 5, [hl] ret @@ -2991,12 +2991,12 @@ Script_end_all: Script_halloffame: ; script command 0xa1 - ld hl, GameTimerPause + ld hl, wGameTimerPause res 0, [hl] farcall TrainerRankings_HallOfFame farcall TrainerRankings_HallOfFame2 farcall HallOfFame - ld hl, GameTimerPause + ld hl, wGameTimerPause set 0, [hl] jr ReturnFromCredits diff --git a/engine/slot_machine.asm b/engine/slot_machine.asm index 4ab673652..d77eb6a1a 100755 --- a/engine/slot_machine.asm +++ b/engine/slot_machine.asm @@ -1,3 +1,4 @@ +SLOTS_NOBIAS EQU -1 SLOTS_NOMATCH EQU -1 SLOTS_SEVEN EQU $00 SLOTS_POKEBALL EQU $04 @@ -7,6 +8,57 @@ SLOTS_SQUIRTLE EQU $10 SLOTS_STARYU EQU $14 REEL_SIZE EQU 15 +; SlotsJumptable constants + const_def + const SLOTS_INIT + const SLOTS_BET_AND_START + const SLOTS_WAIT_START + const SLOTS_WAIT_REEL1 + const SLOTS_WAIT_STOP_REEL1 + const SLOTS_WAIT_REEL2 + const SLOTS_WAIT_STOP_REEL2 + const SLOTS_WAIT_REEL3 + const SLOTS_WAIT_STOP_REEL3 + const SLOTS_NEXT_09 + const SLOTS_NEXT_0a + const SLOTS_NEXT_0b + const SLOTS_FLASH_IF_WIN + const SLOTS_FLASH_SCREEN + const SLOTS_GIVE_EARNED_COINS + const SLOTS_PAYOUT_TEXT_AND_ANIM + const SLOTS_PAYOUT_ANIM + const SLOTS_RESTART_OF_QUIT + const SLOTS_QUIT +SLOTS_END_LOOP_F EQU 7 + +; ReelActionJumptable constants + const_def + const REEL_ACTION_DO_NOTHING + const REEL_ACTION_STOP_REEL_IGNORE_JOYPAD + const REEL_ACTION_QUADRUPLE_RATE + const REEL_ACTION_DOUBLE_RATE + const REEL_ACTION_NORMAL_RATE + const REEL_ACTION_HALF_RATE + const REEL_ACTION_QUARTER_RATE + const REEL_ACTION_STOP_REEL1 + const REEL_ACTION_STOP_REEL2 + const REEL_ACTION_STOP_REEL3 + const REEL_ACTION_SET_UP_REEL2_SKIP_TO_7 + const REEL_ACTION_WAIT_REEL2_SKIP_TO_7 + const REEL_ACTION_FAST_SPIN_REEL2_UNTIL_LINED_UP_7S + const REEL_ACTION_UNUSED + const REEL_ACTION_CHECK_DROP_REEL + const REEL_ACTION_WAIT_DROP_REEL + const REEL_ACTION_START_SLOW_ADVANCE_REEL3 + const REEL_ACTION_WAIT_SLOW_ADVANCE_REEL3 + const REEL_ACTION_INIT_GOLEM + const REEL_ACTION_WAIT_GOLEM + const REEL_ACTION_END_GOLEM + const REEL_ACTION_INIT_CHANSEY + const REEL_ACTION_WAIT_CHANSEY + const REEL_ACTION_WAIT_EGG + const REEL_ACTION_DROP_REEL + _SlotMachine: ld hl, Options set NO_TEXT_SCROLL, [hl] @@ -23,7 +75,7 @@ _SlotMachine: farcall TrainerRankings_EndSlotsWinStreak ld hl, Options res NO_TEXT_SCROLL, [hl] - ld hl, rLCDC ; $ff40 + ld hl, rLCDC res 2, [hl] ret @@ -36,7 +88,7 @@ _SlotMachine: call DelayFrame call DisableLCD hlbgcoord 0, 0 - ld bc, VBGMap1 - VBGMap0 + ld bc, vBGMap1 - vBGMap0 ld a, " " call ByteFill ld b, SCGB_SLOT_MACHINE @@ -48,19 +100,19 @@ _SlotMachine: call ByteFill ld hl, Slots2LZ - ld de, VTiles0 tile $00 + ld de, vTiles0 tile $00 call Decompress ld hl, Slots3LZ - ld de, VTiles0 tile $40 + ld de, vTiles0 tile $40 call Decompress ld hl, Slots1LZ - ld de, VTiles2 tile $00 + ld de, vTiles2 tile $00 call Decompress ld hl, Slots2LZ - ld de, VTiles2 tile $25 + ld de, vTiles2 tile $25 call Decompress ld hl, SlotsTilemap @@ -68,32 +120,32 @@ _SlotMachine: ld bc, SCREEN_WIDTH * 12 call CopyBytes - ld hl, rLCDC ; $ff40 + ld hl, rLCDC set 2, [hl] call EnableLCD - ld hl, wSlots ; Alias: wTrademons - ld bc, wSlotsEnd - wSlots ; Alias: wTrademonsEnd + ld hl, wSlots + ld bc, wSlotsEnd - wSlots xor a call ByteFill - call InitReelTiles + call Slots_InitReelTiles call Slots_GetPals ld a, $7 ld hl, wSpriteAnimDict ld [hli], a ld [hl], $40 - xor a + xor a ; SLOTS_INIT ld [wJumptableIndex], a - ld a, SLOTS_NOMATCH + ld a, SLOTS_NOBIAS ld [wSlotBias], a ld de, MUSIC_GAME_CORNER call PlayMusic xor a - ld [wd002], a + ld [wKeepSevenBiasChance], a ; 87.5% chance call Random and %00101010 ret nz - ld a, $1 - ld [wd002], a + ld a, 1 + ld [wKeepSevenBiasChance], a ; 12.5% chance ret Slots_GetPals: ; 9279b (24:679b) @@ -110,7 +162,7 @@ Slots_GetPals: ; 9279b (24:679b) SlotsLoop: ; 927af (24:67af) ld a, [wJumptableIndex] - bit 7, a + bit SLOTS_END_LOOP_F, a jr nz, .stop call SlotsJumptable call Slots_SpinReels @@ -214,68 +266,68 @@ SlotsJumptable: ; 92844 (24:6844) jumptable .Jumptable, wJumptableIndex .Jumptable: - dw Slots_Init ; 00 - dw Slots_BetAndStart ; 01 - dw Slots_WaitStart ; 02 - dw Slots_WaitReel1 ; 03 - dw Slots_WaitStopReel1 ; 04 - dw Slots_WaitReel2 ; 05 - dw Slots_WaitStopReel2 ; 06 - dw Slots_WaitReel3 ; 07 - dw Slots_WaitStopReel3 ; 08 - dw Slots_Next ; 09 - dw Slots_Next ; 0a - dw Slots_Next ; 0b - dw Slots_FlashIfWin ; 0c - dw Slots_FlashScreen ; 0d - dw Slots_GiveEarnedCoins ; 0e - dw Slots_PayoutTextAndAnim ; 0f - dw Slots_PayoutAnim ; 10 - dw Slots_RestartOrQuit ; 11 - dw Slots_Quit ; 12 - -Slots_Next: ; 92879 (24:6879) + dw SlotsAction_Init ; 00 + dw SlotsAction_BetAndStart ; 01 + dw SlotsAction_WaitStart ; 02 + dw SlotsAction_WaitReel1 ; 03 + dw SlotsAction_WaitStopReel1 ; 04 + dw SlotsAction_WaitReel2 ; 05 + dw SlotsAction_WaitStopReel2 ; 06 + dw SlotsAction_WaitReel3 ; 07 + dw SlotsAction_WaitStopReel3 ; 08 + dw SlotsAction_Next ; 09 + dw SlotsAction_Next ; 0a + dw SlotsAction_Next ; 0b + dw SlotsAction_FlashIfWin ; 0c + dw SlotsAction_FlashScreen ; 0d + dw SlotsAction_GiveEarnedCoins ; 0e + dw SlotsAction_PayoutTextAndAnim ; 0f + dw SlotsAction_PayoutAnim ; 10 + dw SlotsAction_RestartOrQuit ; 11 + dw SlotsAction_Quit ; 12 + +SlotsAction_Next: ; 92879 (24:6879) ld hl, wJumptableIndex inc [hl] ret -Slots_Init: ; 9287e (24:687e) - call Slots_Next +SlotsAction_Init: ; 9287e (24:687e) + call SlotsAction_Next xor a ld [wFirstTwoReelsMatching], a ld [wFirstTwoReelsMatchingSevens], a - ld a, -1 + ld a, SLOTS_NOMATCH ld [wSlotMatched], a ret -Slots_BetAndStart: ; 9288e (24:688e) +SlotsAction_BetAndStart: ; 9288e (24:688e) call Slots_AskBet jr nc, .proceed - ld a, 18 + ld a, SLOTS_QUIT ld [wJumptableIndex], a ret .proceed - call Slots_Next + call SlotsAction_Next call Slots_IlluminateBetLights call Slots_InitBias ld a, 32 - ld [wcf64], a - ld a, 4 + ld [wSlotsDelay], a + ld a, REEL_ACTION_NORMAL_RATE ld [wReel1ReelAction], a ld [wReel2ReelAction], a ld [wReel3ReelAction], a - ld a, $4 - ld [wReel1Slot09], a - ld [wReel2Slot09], a - ld [wReel3Slot09], a + ld a, 4 + ld [wReel1ManipCounter], a + ld [wReel2ManipCounter], a + ld [wReel3ManipCounter], a call WaitSFX ld a, SFX_SLOT_MACHINE_START call Slots_PlaySFX ret -Slots_WaitStart: ; 928c6 (24:68c6) - ld hl, wcf64 +SlotsAction_WaitStart: ; 928c6 (24:68c6) + ld hl, wSlotsDelay ld a, [hl] and a jr z, .proceed @@ -283,87 +335,87 @@ Slots_WaitStart: ; 928c6 (24:68c6) ret .proceed - call Slots_Next + call SlotsAction_Next xor a ld [hJoypadSum], a ret -Slots_WaitReel1: ; 928d6 (24:68d6) - ld hl, hJoypadSum ; $ffa5 +SlotsAction_WaitReel1: ; 928d6 (24:68d6) + ld hl, hJoypadSum ld a, [hl] and A_BUTTON ret z - call Slots_Next + call SlotsAction_Next call Slots_StopReel1 ld [wReel1ReelAction], a -Slots_WaitStopReel1: ; 928e6 (24:68e6) +SlotsAction_WaitStopReel1: ; 928e6 (24:68e6) ld a, [wReel1ReelAction] - cp $0 + cp REEL_ACTION_DO_NOTHING ret nz ld a, SFX_STOP_SLOT call Slots_PlaySFX ld bc, wReel1 ld de, wReel1Stopped call Slots_LoadReelState - call Slots_Next + call SlotsAction_Next xor a ld [hJoypadSum], a -Slots_WaitReel2: ; 92900 (24:6900) - ld hl, hJoypadSum ; $ffa5 +SlotsAction_WaitReel2: ; 92900 (24:6900) + ld hl, hJoypadSum ld a, [hl] and A_BUTTON ret z - call Slots_Next + call SlotsAction_Next call Slots_StopReel2 ld [wReel2ReelAction], a -Slots_WaitStopReel2: ; 92910 (24:6910) +SlotsAction_WaitStopReel2: ; 92910 (24:6910) ld a, [wReel2ReelAction] - cp $0 + cp REEL_ACTION_DO_NOTHING ret nz ld a, SFX_STOP_SLOT call Slots_PlaySFX ld bc, wReel2 ld de, wReel2Stopped call Slots_LoadReelState - call Slots_Next + call SlotsAction_Next xor a ld [hJoypadSum], a -Slots_WaitReel3: ; 9292a (24:692a) - ld hl, hJoypadSum ; $ffa5 +SlotsAction_WaitReel3: ; 9292a (24:692a) + ld hl, hJoypadSum ld a, [hl] and A_BUTTON ret z - call Slots_Next + call SlotsAction_Next call Slots_StopReel3 ld [wReel3ReelAction], a -Slots_WaitStopReel3: ; 9293a (24:693a) +SlotsAction_WaitStopReel3: ; 9293a (24:693a) ld a, [wReel3ReelAction] - cp $0 + cp REEL_ACTION_DO_NOTHING ret nz ld a, SFX_STOP_SLOT call Slots_PlaySFX ld bc, wReel3 ld de, wReel3Stopped call Slots_LoadReelState - call Slots_Next + call SlotsAction_Next xor a ld [hJoypadSum], a ret -Slots_FlashIfWin: ; 92955 (24:6955) +SlotsAction_FlashIfWin: ; 92955 (24:6955) ld a, [wSlotMatched] - cp -1 + cp SLOTS_NOMATCH jr nz, .GotIt - call Slots_Next - call Slots_Next + call SlotsAction_Next + call SlotsAction_Next ret .GotIt: - call Slots_Next + call SlotsAction_Next ld a, 16 - ld [wcf64], a -Slots_FlashScreen: ; 9296b (24:696b) - ld hl, wcf64 + ld [wSlotsDelay], a +SlotsAction_FlashScreen: ; 9296b (24:696b) + ld hl, wSlotsDelay ld a, [hl] and a jr z, .done @@ -380,26 +432,26 @@ Slots_FlashScreen: ; 9296b (24:696b) .done call Slots_GetPals - call Slots_Next + call SlotsAction_Next ret -Slots_GiveEarnedCoins: ; 92987 (24:6987) +SlotsAction_GiveEarnedCoins: ; 92987 (24:6987) xor a ld [wFirstTwoReelsMatching], a ld [wFirstTwoReelsMatchingSevens], a ld a, %11100100 call DmgToCgbBGPals - call SlotGetPayout + call Slots_GetPayout xor a - ld [wcf64], a - call Slots_Next + ld [wSlotsDelay], a + call SlotsAction_Next ret -Slots_PayoutTextAndAnim: ; 9299e (24:699e) - call SlotPayoutText - call Slots_Next -Slots_PayoutAnim: ; 929a4 (24:69a4) - ld hl, wcf64 +SlotsAction_PayoutTextAndAnim: ; 9299e (24:699e) + call Slots_PayoutText + call SlotsAction_Next +SlotsAction_PayoutAnim: ; 929a4 (24:69a4) + ld hl, wSlotsDelay ld a, [hl] inc [hl] and $1 @@ -418,14 +470,14 @@ Slots_PayoutAnim: ; 929a4 (24:69a4) ld d, [hl] inc hl ld e, [hl] - call Slot_CheckCoinCaseFull + call Slots_CheckCoinCaseFull jr c, .okay inc de .okay ld [hl], e dec hl ld [hl], d - ld a, [wcf64] + ld a, [wSlotsDelay] and $7 ret z ; ret nz would be more appropriate ld de, SFX_GET_COIN_FROM_SLOTS @@ -433,26 +485,26 @@ Slots_PayoutAnim: ; 929a4 (24:69a4) ret .done - call Slots_Next + call SlotsAction_Next ret -Slots_RestartOrQuit: ; 929d9 (24:69d9) +SlotsAction_RestartOrQuit: ; 929d9 (24:69d9) call Slots_DeilluminateBetLights call WaitPressAorB_BlinkCursor call Slots_AskPlayAgain jr c, .exit_slots - ld a, 0 + ld a, SLOTS_INIT ld [wJumptableIndex], a ret .exit_slots - ld a, 18 + ld a, SLOTS_QUIT ld [wJumptableIndex], a ret -Slots_Quit: ; 929f0 (24:69f0) +SlotsAction_Quit: ; 929f0 (24:69f0) ld hl, wJumptableIndex - set 7, [hl] + set SLOTS_END_LOOP_F, [hl] ret Slots_LoadReelState: ; 929f6 (24:69f6) @@ -469,7 +521,7 @@ Slots_LoadReelState: ; 929f6 (24:69f6) ld [de], a ret -Slot_CheckCoinCaseFull: ; 92a04 (24:6a04) +Slots_CheckCoinCaseFull: ; 92a04 (24:6a04) ld a, d cp HIGH(MAX_COINS) jr c, .not_full @@ -504,17 +556,25 @@ Slots_GetCurrentReelState: ; 92a12 (24:6a12) ret Slots_StopReel1: ; 92a2b (24:6a2b) - ld a, $7 +; Always set the REEL_ACTION_STOP_REEL1 action. + ld a, REEL_ACTION_STOP_REEL1 ret Slots_StopReel2: ; 92a2e (24:6a2e) +; As long as, the following three meet, there's a 31.25% chance +; to set action REEL_ACTION_SET_UP_REEL2_SKIP_TO_7: +; - Bet is >= 2 coins +; - There's a 7 symbol visible in reel #1 +; - Current spin isn't biased or is biased towards SEVEN +; In any other case, REEL_ACTION_STOP_REEL2 is set. + ld a, [wSlotBet] cp $2 jr c, .dont_jump ld a, [wSlotBias] and a jr z, .skip - cp SLOTS_NOMATCH + cp SLOTS_NOBIAS jr nz, .dont_jump .skip call .CheckReel1ForASeven @@ -522,11 +582,11 @@ Slots_StopReel2: ; 92a2e (24:6a2e) call Random cp $50 ; 32% jr nc, .dont_jump - ld a, $a + ld a, REEL_ACTION_SET_UP_REEL2_SKIP_TO_7 ret .dont_jump - ld a, $8 + ld a, REEL_ACTION_STOP_REEL2 ret .CheckReel1ForASeven: ; 92a51 (24:6a51) @@ -541,6 +601,21 @@ Slots_StopReel2: ; 92a2e (24:6a2e) ret Slots_StopReel3: ; 92a60 (24:6a60) +; If no matching SEVEN symbols in reels #1 and #2: +; - REEL_ACTION_STOP_REEL3, 100% + +; If matching SEVEN symbols and NO bias to SEVEN: +; - REEL_ACTION_STOP_REEL3, 37.5% +; - REEL_ACTION_START_SLOW_ADVANCE_REEL3, 31.3% +; - REEL_ACTION_INIT_GOLEM, 31.3% +; - REEL_ACTION_INIT_CHANSEY, 0% + +; If matching SEVEN symbols and bias to SEVEN: +; - REEL_ACTION_STOP_REEL3, 29.7% +; - REEL_ACTION_START_SLOW_ADVANCE_REEL3, 23.4% +; - REEL_ACTION_INIT_GOLEM, 23.4% +; - REEL_ACTION_INIT_CHANSEY, 23.4% + ld a, [wFirstTwoReelsMatching] and a jr z, .stop @@ -557,7 +632,7 @@ Slots_StopReel3: ; 92a60 (24:6a60) jr nc, .slow_advance cp 60 jr nc, .golem - ld a, $15 + ld a, REEL_ACTION_INIT_CHANSEY ret .biased @@ -567,18 +642,18 @@ Slots_StopReel3: ; 92a60 (24:6a60) cp 80 jr nc, .slow_advance .golem - ld a, $12 + ld a, REEL_ACTION_INIT_GOLEM ret .slow_advance - ld a, $10 + ld a, REEL_ACTION_START_SLOW_ADVANCE_REEL3 ret .stop - ld a, $9 + ld a, REEL_ACTION_STOP_REEL3 ret -InitReelTiles: ; 92a98 (24:6a98) +Slots_InitReelTiles: ; 92a98 (24:6a98) ld bc, wReel1 ld hl, wReel1OAMAddr - wReel1 add hl, bc @@ -637,14 +712,14 @@ InitReelTiles: ; 92a98 (24:6a98) .OAM: ; 92af9 (24:6af9) ld hl, wReel1ReelAction - wReel1 add hl, bc - ld [hl], $0 + ld [hl], REEL_ACTION_DO_NOTHING ld hl, wReel1Position - wReel1 add hl, bc ld [hl], REEL_SIZE - 1 ld hl, wReel1SpinDistance - wReel1 add hl, bc - ld [hl], $0 - call UpdateReelPositionAndOAM + ld [hl], REEL_ACTION_DO_NOTHING + call Slots_UpdateReelPositionAndOAM ret Slots_SpinReels: ; 92b0f (24:6b0f) @@ -662,7 +737,7 @@ Slots_SpinReels: ; 92b0f (24:6b0f) ld a, [hl] and $f jr nz, .skip - call Function92bd4 + call ReelActionJumptable .skip ld hl, wReel1SpinRate - wReel1 add hl, bc @@ -675,7 +750,7 @@ Slots_SpinReels: ; 92b0f (24:6b0f) add [hl] ld [hl], a and $f - jr z, UpdateReelPositionAndOAM + jr z, Slots_UpdateReelPositionAndOAM ld hl, wReel1OAMAddr - wReel1 add hl, bc ld a, [hli] @@ -693,7 +768,7 @@ Slots_SpinReels: ; 92b0f (24:6b0f) jr nz, .loop ret -UpdateReelPositionAndOAM: ; 92b53 (24:6b53) +Slots_UpdateReelPositionAndOAM: ; 92b53 (24:6b53) ld hl, wReel1XCoord - wReel1 add hl, bc ld a, [hl] @@ -786,12 +861,12 @@ Function92bbe: ; 92bbe db 0, 1, 2, 3, 4, 5 ; 92bd4 -Function92bd4: ; 92bd4 (24:6bd4) +ReelActionJumptable: ; 92bd4 (24:6bd4) ld hl, wReel1ReelAction - wReel1 add hl, bc ld e, [hl] ld d, 0 - ld hl, .dw + ld hl, .Jumptable add hl, de add hl, de ld a, [hli] @@ -801,10 +876,9 @@ Function92bd4: ; 92bd4 (24:6bd4) ; 92be4 (24:6be4) -.dw ; 92be4 - +.Jumptable: ; 92be4 dw ReelAction_DoNothing ; 00 - dw Slots_StopReelIgnoreJoypad ; 01 + dw ReelAction_StopReelIgnoreJoypad ; 01 dw ReelAction_QuadrupleRate ; 02 dw ReelAction_DoubleRate ; 03 dw ReelAction_NormalRate ; 04 @@ -816,7 +890,7 @@ Function92bd4: ; 92bd4 (24:6bd4) dw ReelAction_SetUpReel2SkipTo7 ; 0a dw ReelAction_WaitReel2SkipTo7 ; 0b dw ReelAction_FastSpinReel2UntilLinedUp7s ; 0c - dw ReelAction_BoringReelDrops ; 0d + dw ReelAction_Unused ; 0d dw ReelAction_CheckDropReel ; 0e dw ReelAction_WaitDropReel ; 0f dw ReelAction_StartSlowAdvanceReel3 ; 10 @@ -824,7 +898,7 @@ Function92bd4: ; 92bd4 (24:6bd4) dw ReelAction_InitGolem ; 12 dw ReelAction_WaitGolem ; 13 dw ReelAction_EndGolem ; 14 - dw Slots_InitChansey ; 15 + dw ReelAction_InitChansey ; 15 dw ReelAction_WaitChansey ; 16 dw ReelAction_WaitEgg ; 17 dw ReelAction_DropReel ; 18 @@ -838,7 +912,7 @@ ReelAction_DoNothing: ; 92c16 ReelAction_QuadrupleRate: ; 92c17 ld hl, wReel1SpinRate - wReel1 add hl, bc - ld [hl], $10 + ld [hl], 16 ret ; 92c1e @@ -846,7 +920,7 @@ ReelAction_QuadrupleRate: ; 92c17 ReelAction_DoubleRate: ; 92c1e ld hl, wReel1SpinRate - wReel1 add hl, bc - ld [hl], $8 + ld [hl], 8 ret ; 92c25 @@ -854,7 +928,7 @@ ReelAction_DoubleRate: ; 92c1e ReelAction_NormalRate: ; 92c25 ld hl, wReel1SpinRate - wReel1 add hl, bc - ld [hl], $4 + ld [hl], 4 ret ; 92c2c @@ -862,7 +936,7 @@ ReelAction_NormalRate: ; 92c25 ReelAction_HalfRate: ; 92c2c ld hl, wReel1SpinRate - wReel1 add hl, bc - ld [hl], $2 + ld [hl], 2 ret ; 92c33 @@ -870,7 +944,7 @@ ReelAction_HalfRate: ; 92c2c ReelAction_QuarterRate: ; 92c33 ld hl, wReel1SpinRate - wReel1 add hl, bc - ld [hl], $1 + ld [hl], 1 ret ; 92c3a @@ -878,15 +952,15 @@ ReelAction_QuarterRate: ; 92c33 Slots_StopReel: ; 92c3a ld hl, wReel1SpinRate - wReel1 add hl, bc - ld [hl], $0 + ld [hl], 0 ld hl, wReel1ReelAction - wReel1 add hl, bc - ld [hl], $1 - ld hl, wReel1Slot0f - wReel1 + ld [hl], REEL_ACTION_STOP_REEL_IGNORE_JOYPAD + ld hl, wReel1StopDelay - wReel1 add hl, bc - ld [hl], $3 -Slots_StopReelIgnoreJoypad: ; 92c4c - ld hl, wReel1Slot0f - wReel1 + ld [hl], 3 +ReelAction_StopReelIgnoreJoypad: ; 92c4c + ld hl, wReel1StopDelay - wReel1 add hl, bc ld a, [hl] and a @@ -897,17 +971,22 @@ Slots_StopReelIgnoreJoypad: ; 92c4c .EndReel: ld hl, wReel1ReelAction - wReel1 add hl, bc - ld a, $0 + ld a, REEL_ACTION_DO_NOTHING ld [hl], a ret ; 92c5e ReelAction_StopReel1: ; 92c5e +; If no bias: don't manipulate reel. +; If bias: manipulate reel up to wReel1ManipCounter (i.e. 4) times, +; 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_NOMATCH + cp SLOTS_NOBIAS jr z, .NoBias - ld hl, wReel1Slot09 - wReel1 + ld hl, wReel1ManipCounter - wReel1 add hl, bc ld a, [hl] and a @@ -938,6 +1017,11 @@ ReelAction_StopReel1: ; 92c5e ; 92c86 ReelAction_StopReel2: ; 92c86 +; If no bias: don't manipulate reel. +; If bias: manipulate reel up to wReel2ManipCounter (i.e. 4) times, +; stoping early if the biased symbol is lined up in the first two +; reels, according to the lines that the current bet allows. + call Slots_CheckMatchedFirstTwoReels jr nc, .nope ld a, [wSlotBuildingMatch] @@ -946,9 +1030,9 @@ ReelAction_StopReel2: ; 92c86 jr z, .NoBias .nope ld a, [wSlotBias] - cp SLOTS_NOMATCH + cp SLOTS_NOBIAS jr z, .NoBias - ld hl, wReel1Slot09 - wReel1 + ld hl, wReel1ManipCounter - wReel1 add hl, bc ld a, [hl] and a @@ -963,12 +1047,16 @@ ReelAction_StopReel2: ; 92c86 ; 92ca9 ReelAction_StopReel3: ; 92ca9 +; Manipulate the reel up to wReel3ManipCounter (i.e. 4) times, +; 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. + call Slots_CheckMatchedAllThreeReels jr nc, .NoMatch ld hl, wSlotBias cp [hl] jr z, .NoBias - ld hl, wReel1Slot09 - wReel1 + ld hl, wReel1ManipCounter - wReel1 add hl, bc ld a, [hl] and a @@ -978,9 +1066,9 @@ ReelAction_StopReel3: ; 92ca9 .NoMatch: ld a, [wSlotBias] - cp SLOTS_NOMATCH + cp SLOTS_NOBIAS jr z, .NoBias - ld hl, wReel1Slot09 - wReel1 + ld hl, wReel1ManipCounter - wReel1 add hl, bc ld a, [hl] and a @@ -995,6 +1083,11 @@ ReelAction_StopReel3: ; 92ca9 ; 92cd2 ReelAction_SetUpReel2SkipTo7: ; 92cd2 +; Unique reel 2 action (see Slots_StopReel2) +; Ensures that 7 symbols become lined up in the first two reels, +; but more often than not, this is only a way to get our hopes up, as +; it makes exciting reel #3 modes with no success hope more common. + call Slots_CheckMatchedFirstTwoReels jr nc, .no_match ld a, [wFirstTwoReelsMatchingSevens] @@ -1008,19 +1101,19 @@ ReelAction_SetUpReel2SkipTo7: ; 92cd2 call Slots_PlaySFX ld hl, wReel1ReelAction - wReel1 add hl, bc - inc [hl] - ld hl, wReel1Slot0a - wReel1 + inc [hl] ; REEL_ACTION_WAIT_REEL2_SKIP_TO_7 + ld hl, wReel1ManipDelay - wReel1 add hl, bc - ld [hl], $20 + ld [hl], 32 ld hl, wReel1SpinRate - wReel1 add hl, bc - ld [hl], $0 + ld [hl], 0 ret ; 92cf8 ReelAction_WaitReel2SkipTo7: ; 92cf8 - ld hl, wReel1Slot0a - wReel1 + ld hl, wReel1ManipDelay - wReel1 add hl, bc ld a, [hl] and a @@ -1033,10 +1126,10 @@ ReelAction_WaitReel2SkipTo7: ; 92cf8 call Slots_PlaySFX ld hl, wReel1ReelAction - wReel1 add hl, bc - inc [hl] + inc [hl] ; REEL_ACTION_FAST_SPIN_REEL2_UNTIL_LINED_UP_7S ld hl, wReel1SpinRate - wReel1 add hl, bc - ld [hl], $8 + ld [hl], 8 ret ; 92d13 @@ -1053,6 +1146,14 @@ ReelAction_FastSpinReel2UntilLinedUp7s: ; 92d13 ; 92d20 ReelAction_InitGolem: ; 92d20 +; Ensures SEVENs are lined up if there's bias to SEVEN. +; Ensures nothing is lined up if there's no bias symbols. +; No other bias symbols are compatible with this mode. + +; This is achieved by throwing Golem until the desired result +; is produced. The amount of Golem thrown can be anywhere from +; 1 to 14 for SEVEN bias, and 4-8 for no bias. + call Slots_CheckMatchedAllThreeReels ret c ld a, SFX_STOP_SLOT @@ -1060,11 +1161,11 @@ ReelAction_InitGolem: ; 92d20 call Slots_WaitSFX ld hl, wReel1ReelAction - wReel1 add hl, bc - inc [hl] + inc [hl] ; REEL_ACTION_WAIT_GOLEM ld hl, wReel1SpinRate - wReel1 add hl, bc - ld [hl], $0 - call Function92fc0 + ld [hl], 0 + call Slots_GetNumberOfGolems push bc push af depixel 12, 13 @@ -1076,9 +1177,9 @@ ReelAction_InitGolem: ; 92d20 ld [hl], a pop bc xor a - ld [wcf64], a + ld [wSlotsDelay], a ReelAction_WaitGolem: ; 92d4f - ld a, [wcf64] + ld a, [wSlotsDelay] cp 2 jr z, .two cp 1 @@ -1093,28 +1194,33 @@ ReelAction_WaitGolem: ; 92d4f .one ld hl, wReel1ReelAction - wReel1 add hl, bc - inc [hl] + inc [hl] ; REEL_ACTION_END_GOLEM ld hl, wReel1SpinRate - wReel1 add hl, bc - ld [hl], $8 + ld [hl], 8 ret ; 92d6e ReelAction_EndGolem: ; 92d6e xor a - ld [wcf64], a + ld [wSlotsDelay], a ld hl, wReel1ReelAction - wReel1 add hl, bc - dec [hl] + dec [hl] ; REEL_ACTION_WAIT_GOLEM ld hl, wReel1SpinRate - wReel1 add hl, bc - ld [hl], $0 + ld [hl], 0 ret ; 92d7e -Slots_InitChansey: ; 92d7e +ReelAction_InitChansey: ; 92d7e +; Ensures the lining up of SEVEN symbols, but this mode is only possible +; when there is bias to SEVEN symbols (and even then, it's still rare). +; Chansey releases and egg and reel #3 is made to advance 17 slots very +; quickly as many times as necessary for the match to SEVENs to show up. + call Slots_CheckMatchedAllThreeReels ret c ld a, SFX_STOP_SLOT @@ -1122,45 +1228,45 @@ Slots_InitChansey: ; 92d7e call Slots_WaitSFX ld hl, wReel1ReelAction - wReel1 add hl, bc - inc [hl] + inc [hl] ; REEL_ACTION_WAIT_CHANSEY ld hl, wReel1SpinRate - wReel1 add hl, bc - ld [hl], $0 + ld [hl], 0 push bc depixel 12, 0 ld a, SPRITE_ANIM_INDEX_SLOTS_CHANSEY call _InitSpriteAnimStruct pop bc xor a - ld [wcf64], a + ld [wSlotsDelay], a ret ; 92da4 ReelAction_WaitChansey: ; 92da4 - ld a, [wcf64] + ld a, [wSlotsDelay] and a ret z ld hl, wReel1ReelAction - wReel1 add hl, bc - inc [hl] - ld a, $2 - ld [wcf64], a + inc [hl] ; REEL_ACTION_WAIT_EGG + ld a, 2 + ld [wSlotsDelay], a ReelAction_WaitEgg: ; 92db3 - ld a, [wcf64] + ld a, [wSlotsDelay] cp $4 ret c ld hl, wReel1ReelAction - wReel1 add hl, bc - inc [hl] + inc [hl] ; REEL_ACTION_DROP_REEL ld hl, wReel1SpinRate - wReel1 add hl, bc - ld [hl], $10 - ld hl, wReel1Slot0a - wReel1 + ld [hl], 16 + ld hl, wReel1ManipDelay - wReel1 add hl, bc - ld [hl], $11 + ld [hl], 17 ReelAction_DropReel: ; 92dca - ld hl, wReel1Slot0a - wReel1 + ld hl, wReel1ManipDelay - wReel1 add hl, bc ld a, [hl] and a @@ -1173,26 +1279,26 @@ ReelAction_DropReel: ; 92dca jr nc, .EggAgain and a jr nz, .EggAgain - ld a, $5 - ld [wcf64], a + ld a, 5 + ld [wSlotsDelay], a call Slots_StopReel ret .EggAgain: ld hl, wReel1SpinRate - wReel1 add hl, bc - ld [hl], $0 + ld [hl], 0 ld hl, wReel1ReelAction - wReel1 add hl, bc dec [hl] - dec [hl] - ld a, $1 - ld [wcf64], a + dec [hl] ; REEL_ACTION_WAIT_CHANSEY + ld a, 1 + ld [wSlotsDelay], a ret ; 92df7 -ReelAction_BoringReelDrops: ; 92df7 +ReelAction_Unused: ; 92df7 call Slots_CheckMatchedAllThreeReels ret c ld a, SFX_STOP_SLOT @@ -1200,13 +1306,13 @@ ReelAction_BoringReelDrops: ; 92df7 call Slots_WaitSFX ld hl, wReel1ReelAction - wReel1 add hl, bc - inc [hl] - call Function92fc0 - ld hl, wReel1Slot0a - wReel1 + inc [hl] ; REEL_ACTION_CHECK_DROP_REEL + call Slots_GetNumberOfGolems + ld hl, wReel1ManipDelay - wReel1 add hl, bc ld [hl], a ReelAction_CheckDropReel: ; 92e10 - ld hl, wReel1Slot0a - wReel1 + ld hl, wReel1ManipDelay - wReel1 add hl, bc ld a, [hl] and a @@ -1219,13 +1325,13 @@ ReelAction_CheckDropReel: ; 92e10 dec [hl] ld hl, wReel1ReelAction - wReel1 add hl, bc - inc [hl] + inc [hl] ; REEL_ACTION_WAIT_DROP_REEL ld hl, wReel1Slot0b - wReel1 add hl, bc - ld [hl], $20 + ld [hl], 32 ld hl, wReel1SpinRate - wReel1 add hl, bc - ld [hl], $0 + ld [hl], 0 ReelAction_WaitDropReel: ; 92e31 ld hl, wReel1Slot0b - wReel1 add hl, bc @@ -1241,12 +1347,19 @@ ReelAction_WaitDropReel: ; 92e31 dec [hl] ld hl, wReel1SpinRate - wReel1 add hl, bc - ld [hl], $8 ; 2x + ld [hl], 8 ret ; 92e47 ReelAction_StartSlowAdvanceReel3: ; 92e47 +; Ensures SEVENs are lined up if there's bias to SEVEN. +; Ensures nothing is lined up if there's no bias symbols. +; No other bias symbols are compatible with this mode. + +; This is achieved by slowly advancing the reel a full round, +; plus any necessary slot until the desired result is produced. + call Slots_CheckMatchedAllThreeReels ret c ld a, SFX_STOP_SLOT @@ -1254,15 +1367,15 @@ ReelAction_StartSlowAdvanceReel3: ; 92e47 call Slots_WaitSFX ld hl, wReel1SpinRate - wReel1 add hl, bc - ld [hl], $1 + ld [hl], 1 ld hl, wReel1ReelAction - wReel1 add hl, bc - inc [hl] - ld hl, wReel1Slot0a - wReel1 + inc [hl] ; REEL_ACTION_WAIT_SLOW_ADVANCE_REEL3 + ld hl, wReel1ManipDelay - wReel1 add hl, bc - ld [hl], $10 + ld [hl], 16 ReelAction_WaitSlowAdvanceReel3: ; 92e64 - ld hl, wReel1Slot0a - wReel1 + ld hl, wReel1ManipDelay - wReel1 add hl, bc ld a, [hl] and a @@ -1396,18 +1509,18 @@ Slots_CheckMatchedFirstTwoReels: ; 92e94 ld [wSlotBuildingMatch], a and a jr nz, .matching_sevens - ld a, $1 + ld a, 1 ld [wFirstTwoReelsMatchingSevens], a .matching_sevens - ld a, $1 + ld a, 1 ld [wFirstTwoReelsMatching], a ret ; 92f1d Slots_CheckMatchedAllThreeReels: ; 92f1d - ld a, $ff + ld a, SLOTS_NOMATCH ld [wSlotMatched], a call Slots_GetCurrentReelState call Slots_CopyReelState @@ -1427,7 +1540,7 @@ Slots_CheckMatchedAllThreeReels: ; 92f1d .return ld a, [wSlotMatched] - cp $ff + cp SLOTS_NOMATCH jr nz, .matched_nontrivial and a ret @@ -1542,7 +1655,7 @@ Slots_CopyReelState: ; 92fb4 ; 92fc0 -Function92fc0: ; 92fc0 +Slots_GetNumberOfGolems: ; 92fc0 ld hl, wReel1Position - wReel1 add hl, bc ld a, [hl] @@ -1629,7 +1742,7 @@ Slots_InitBias: ; 93002 (24:7002) db $14, SLOTS_SQUIRTLE ; 5/128 db $28, SLOTS_PIKACHU ; 5/64 db $30, SLOTS_CHERRY ; 1/32 - db $ff, SLOTS_NOMATCH ; everything else + db $ff, SLOTS_NOBIAS ; everything else ; 93031 .Lucky: ; 93031 @@ -1639,7 +1752,7 @@ Slots_InitBias: ; 93002 (24:7002) db $10, SLOTS_SQUIRTLE ; 1/32 db $1e, SLOTS_PIKACHU ; 7/128 db $50, SLOTS_CHERRY ; 25/128 - db $ff, SLOTS_NOMATCH ; everything else + db $ff, SLOTS_NOBIAS ; everything else ; 9303f Slots_IlluminateBetLights: ; 9303f (24:703f) @@ -1798,9 +1911,9 @@ Slots_AskPlayAgain: ; 930e9 (24:70e9) text_jump UnknownText_0x1c5092 db "@" -SlotGetPayout: ; 93124 (24:7124) +Slots_GetPayout: ; 93124 (24:7124) ld a, [wSlotMatched] - cp -1 + cp SLOTS_NOMATCH jr z, .no_win srl a ld e, a @@ -1831,9 +1944,9 @@ SlotGetPayout: ; 93124 (24:7124) ld [hl], a ret -SlotPayoutText: ; 93158 (24:7158) +Slots_PayoutText: ; 93158 (24:7158) ld a, [wSlotMatched] - cp -1 + cp SLOTS_NOMATCH jr nz, .MatchedSomething ld hl, .Text_Darn call PrintText @@ -1912,21 +2025,26 @@ endr ld a, SFX_2ND_PLACE call Slots_PlaySFX call WaitSFX - ld a, [wd002] + +; Oddly, the rarest mode (wKeepSevenBiasChance = 1) is the one with +; the worse odds to favor seven symbol streaks (12.5% vs 25%). +; it's possible that either the wKeepSevenBiasChance initialization +; or this code was intended to lead to flipped percentages. + ld a, [wKeepSevenBiasChance] and a - jr nz, .asm_931ff + jr nz, .lowerSevenStreakOdds call Random - and $14 - ret z - ld a, $ff + and %0010100 + ret z ; 25% chance to stick with seven symbol bias + ld a, SLOTS_NOBIAS ld [wSlotBias], a ret -.asm_931ff +.lowerSevenStreakOdds call Random - and $1c - ret z - ld a, $ff + and %0011100 + ret z ; 12.5% chance to stick with seven symbol bias + ld a, SLOTS_NOBIAS ld [wSlotBias], a ret @@ -1948,7 +2066,7 @@ endr ; 9321d -SlotMachine_AnimateGolem: ; 9321d (24:721d) +Slots_AnimateGolem: ; 9321d (24:721d) ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX add hl, bc ld e, [hl] @@ -1974,8 +2092,8 @@ SlotMachine_AnimateGolem: ; 9321d (24:721d) ld a, [hl] and a jr nz, .retain - ld a, $2 - ld [wcf64], a + ld a, 2 + ld [wSlotsDelay], a ld hl, SPRITEANIMSTRUCT_INDEX add hl, bc ld [hl], $0 @@ -2016,8 +2134,8 @@ SlotMachine_AnimateGolem: ; 9321d (24:721d) ld hl, SPRITEANIMSTRUCT_0D add hl, bc ld [hl], $2 - ld a, $1 - ld [wcf64], a + ld a, 1 + ld [wSlotsDelay], a ld a, SFX_PLACE_PUZZLE_PIECE_DOWN call Slots_PlaySFX ret @@ -2086,11 +2204,11 @@ Slots_AnimateChansey: ; 932ac (24:72ac) ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX add hl, bc inc [hl] - ld a, $1 - ld [wcf64], a + ld a, 1 + ld [wSlotsDelay], a .one ; 932e0 (24:72e0) - ld a, [wcf64] + ld a, [wSlotsDelay] cp $2 jr z, .retain cp $5 diff --git a/engine/sprite_anims.asm b/engine/sprite_anims.asm index 1b3fb9a0d..edd1daf32 100755 --- a/engine/sprite_anims.asm +++ b/engine/sprite_anims.asm @@ -357,7 +357,7 @@ DoAnimFrame: ; 8d24b ret .SlotsGolem: ; 8d422 (23:5422) - callfar SlotMachine_AnimateGolem + callfar Slots_AnimateGolem ret .SlotsChansey: ; 8d429 (23:5429) diff --git a/engine/sprites.asm b/engine/sprites.asm index 4a33eb5cf..bee01414f 100755 --- a/engine/sprites.asm +++ b/engine/sprites.asm @@ -386,7 +386,7 @@ InitSpriteAnimBuffer: ; 8d0ec GetSpriteAnimVTile: ; 8d109 ; a = wSpriteAnimDict[a] if a in wSpriteAnimDict else 0 -; VTiles offset +; vTiles offset push hl push bc ld hl, wSpriteAnimDict @@ -631,7 +631,7 @@ AnimateEndOfExpBar: ; 8e79d ld de, SGBEndOfExpBarGFX .load - ld hl, VTiles0 tile $00 + ld hl, vTiles0 tile $00 lb bc, BANK(EndOfExpBarGFX), 1 call Request2bpp ld c, 8 diff --git a/engine/start_menu.asm b/engine/start_menu.asm index d8fbad82d..913bf3780 100755 --- a/engine/start_menu.asm +++ b/engine/start_menu.asm @@ -7,7 +7,7 @@ StartMenu:: ; 125cd farcall ReanchorBGMap_NoOAMUpdate - ld hl, StatusFlags2 + ld hl, wStatusFlags2 bit 2, [hl] ; bug catching contest ld hl, .MenuDataHeader jr z, .GotMenuData @@ -284,7 +284,7 @@ endr ld [wWhichIndexSet], a call .FillMenuList - ld hl, StatusFlags + ld hl, wStatusFlags bit 0, [hl] jr z, .no_pokedex ld a, 0 ; pokedex @@ -301,7 +301,7 @@ endr ld a, [wLinkMode] and a jr nz, .no_pack - ld hl, StatusFlags2 + ld hl, wStatusFlags2 bit 2, [hl] ; bug catching contest jr nz, .no_pack ld a, 2 ; pack @@ -321,7 +321,7 @@ endr ld a, [wLinkMode] and a jr nz, .no_save - ld hl, StatusFlags2 + ld hl, wStatusFlags2 bit 2, [hl] ; bug catching contest ld a, 8 ; quit jr nz, .write @@ -390,7 +390,7 @@ endr ; 128d1 .DrawBugContestStatusBox: ; 128d1 - ld hl, StatusFlags2 + ld hl, wStatusFlags2 bit 2, [hl] ; bug catching contest ret z farcall StartMenu_DrawBugContestStatusBox @@ -398,7 +398,7 @@ endr ; 128de .DrawBugContestStatus: ; 128de - ld hl, StatusFlags2 + ld hl, wStatusFlags2 bit 2, [hl] ; bug catching contest jr nz, .contest ret diff --git a/engine/stats_screen.asm b/engine/stats_screen.asm index da02808b1..fa124e1b3 100755 --- a/engine/stats_screen.asm +++ b/engine/stats_screen.asm @@ -865,7 +865,7 @@ StatsScreen_PlaceFrontpic: ; 4e226 (13:6226) call IsAPokemon ret c call StatsScreen_LoadTextBoxSpaceGFX - ld de, VTiles2 tile $00 + ld de, vTiles2 tile $00 predef GetAnimatedFrontpicPredef hlcoord 0, 0 ld d, $0 @@ -954,7 +954,7 @@ StatsScreen_LoadTextBoxSpaceGFX: ; 4e307 (13:6307) ld [rVBK], a ld de, TextBoxSpaceGFX lb bc, BANK(TextBoxSpaceGFX), 1 - ld hl, VTiles2 tile $7f + ld hl, vTiles2 tile $7f call Get2bpp pop af ld [rVBK], a @@ -1071,7 +1071,7 @@ StatsScreen_AnimateEgg: ; 4e497 (13:6497) ld a, $1 ld [wBoxAlignment], a call StatsScreen_LoadTextBoxSpaceGFX - ld de, VTiles2 tile $00 + ld de, vTiles2 tile $00 predef GetAnimatedFrontpicPredef pop de hlcoord 0, 0 diff --git a/engine/time.asm b/engine/time.asm index 61ef614c3..799a24f49 100755 --- a/engine/time.asm +++ b/engine/time.asm @@ -101,7 +101,7 @@ CheckDailyResetTimer:: ; 11452 call CheckDayDependentEventHL ret nc xor a - ld hl, DailyFlags + ld hl, wDailyFlags ld [hli], a ld [hli], a ld [hli], a @@ -226,14 +226,14 @@ CheckUnusedTwoDayTimer: ; 1150c ; 1151c ; XXX - ld hl, DailyFlags + ld hl, wDailyFlags set 2, [hl] ret ; 11522 ; XXX and a - ld hl, DailyFlags + ld hl, wDailyFlags bit 2, [hl] ret nz scf diff --git a/engine/timeofdaypals.asm b/engine/timeofdaypals.asm index 7fc364f70..56a874264 100644 --- a/engine/timeofdaypals.asm +++ b/engine/timeofdaypals.asm @@ -215,7 +215,7 @@ ReplaceTimeOfDayPals: ; 8c0e5 ret .DarkCave: - ld a, [StatusFlags] + ld a, [wStatusFlags] bit 2, a ; Flash jr nz, .UsedFlash ld a, %11111111 ; 3, 3, 3, 3 diff --git a/engine/timeset.asm b/engine/timeset.asm index e68f5930a..f05e31ab5 100755 --- a/engine/timeset.asm +++ b/engine/timeset.asm @@ -24,15 +24,15 @@ InitClock: ; 90672 (24:4672) ld [hBGMapMode], a call LoadStandardFont ld de, TimeSetBackgroundGFX - ld hl, VTiles2 tile $00 + ld hl, vTiles2 tile $00 lb bc, BANK(TimeSetBackgroundGFX), 1 call Request1bpp ld de, TimeSetUpArrowGFX - ld hl, VTiles2 tile $01 + ld hl, vTiles2 tile $01 lb bc, BANK(TimeSetUpArrowGFX), 1 call Request1bpp ld de, TimeSetDownArrowGFX - ld hl, VTiles2 tile $02 + ld hl, vTiles2 tile $02 lb bc, BANK(TimeSetDownArrowGFX), 1 call Request1bpp call .ClearScreen @@ -410,11 +410,11 @@ Special_SetDayOfWeek: ; 90913 ld a, $1 ld [hInMenu], a ld de, TimeSetUpArrowGFX - ld hl, VTiles1 tile $6f + ld hl, vTiles1 tile $6f lb bc, BANK(TimeSetUpArrowGFX), 1 call Request1bpp ld de, TimeSetDownArrowGFX - ld hl, VTiles1 tile $75 + ld hl, vTiles1 tile $75 lb bc, BANK(TimeSetDownArrowGFX), 1 call Request1bpp xor a diff --git a/engine/title.asm b/engine/title.asm index 84e7550fd..2ea588cd0 100644 --- a/engine/title.asm +++ b/engine/title.asm @@ -26,7 +26,7 @@ _TitleScreen: ; 10ed67 ; Decompress running Suicune gfx ld hl, TitleSuicuneGFX - ld de, VTiles1 + ld de, vTiles1 call Decompress @@ -42,7 +42,7 @@ _TitleScreen: ; 10ed67 ; BG Map 1: ; line 0 (copyright) - hlbgcoord 0, 0, VBGMap1 + hlbgcoord 0, 0, vBGMap1 ld bc, 1 bgrows ld a, 7 ; palette call ByteFill @@ -99,12 +99,12 @@ _TitleScreen: ; 10ed67 ; Decompress logo ld hl, TitleLogoGFX - ld de, VTiles1 + ld de, vTiles1 call Decompress ; Decompress background crystal ld hl, TitleCrystalGFX - ld de, VTiles0 + ld de, vTiles0 call Decompress @@ -122,7 +122,7 @@ _TitleScreen: ; 10ed67 call DrawTitleGraphic ; Draw copyright text - hlbgcoord 3, 0, VBGMap1 + hlbgcoord 3, 0, vBGMap1 lb bc, 1, 13 ld d, $c ld e, $10 @@ -260,10 +260,10 @@ SuicuneFrameIterator: ; 10eea7 ; 10eece .Frames: ; 10eece - db $80 ; VTiles4 tile $00 - db $88 ; VTiles4 tile $08 - db $00 ; VTiles5 tile $00 - db $08 ; VTiles5 tile $08 + db $80 ; vTiles4 tile $00 + db $88 ; vTiles4 tile $08 + db $00 ; vTiles5 tile $00 + db $08 ; vTiles5 tile $08 ; 10eed2 diff --git a/engine/trade_animation.asm b/engine/trade_animation.asm index 1305fab5b..d5b97d563 100755 --- a/engine/trade_animation.asm +++ b/engine/trade_animation.asm @@ -149,8 +149,8 @@ RunTradeAnimScript: ; 28fa1 jr z, .NotCGB ld a, $1 ld [rVBK], a - ld hl, VTiles0 - ld bc, sScratch - VTiles0 + ld hl, vTiles0 + ld bc, sScratch - vTiles0 xor a call ByteFill ld a, $0 @@ -158,19 +158,19 @@ RunTradeAnimScript: ; 28fa1 .NotCGB: hlbgcoord 0, 0 - ld bc, sScratch - VBGMap0 + ld bc, sScratch - vBGMap0 ld a, " " call ByteFill ld hl, TradeGameBoyLZ - ld de, VTiles2 tile $31 + ld de, vTiles2 tile $31 call Decompress ld hl, TradeArrowGFX - ld de, VTiles1 tile $6d + ld de, vTiles1 tile $6d ld bc, $10 ld a, BANK(TradeArrowGFX) call FarCopyBytes ld hl, TradeArrowGFX + $10 - ld de, VTiles1 tile $6e + ld de, vTiles1 tile $6e ld bc, $10 ld a, BANK(TradeArrowGFX) call FarCopyBytes @@ -186,11 +186,11 @@ RunTradeAnimScript: ; 28fa1 call LoadTradeBallAndCableGFX ld a, [wPlayerTrademonSpecies] ld hl, wPlayerTrademonDVs - ld de, VTiles0 + ld de, vTiles0 call TradeAnim_GetFrontpic ld a, [wOTTrademonSpecies] ld hl, wOTTrademonDVs - ld de, VTiles0 tile $31 + ld de, vTiles0 tile $31 call TradeAnim_GetFrontpic ld a, [wPlayerTrademonSpecies] ld de, wPlayerTrademonSpeciesName @@ -490,7 +490,7 @@ TradeAnim_TubeToPlayer8: ; 29229 call DisableLCD callfar ClearSpriteAnims hlbgcoord 0, 0 - ld bc, sScratch - VBGMap0 + ld bc, sScratch - vBGMap0 ld a, " " call ByteFill xor a @@ -627,7 +627,7 @@ TradeAnim_PlaceTrademonStatsOnTubeAnim: ; 292f6 push af call ClearBGPalettes call WaitTop - ld a, HIGH(VBGMap1) + ld a, HIGH(vBGMap1) ld [hBGMapAddress + 1], a call ClearTileMap hlcoord 0, 0 @@ -657,7 +657,7 @@ TradeAnim_PlaceTrademonStatsOnTubeAnim: ; 292f6 call ByteFill call WaitBGMap call WaitTop - ld a, HIGH(VBGMap0) + ld a, HIGH(vBGMap0) ld [hBGMapAddress + 1], a call ClearTileMap ret @@ -776,7 +776,7 @@ TradeAnim_TextboxScrollStart: ; 293de TradeAnim_ScrollOutRight: ; 293ea call WaitTop - ld a, HIGH(VBGMap1) + ld a, HIGH(vBGMap1) ld [hBGMapAddress + 1], a call WaitBGMap ld a, $7 @@ -785,7 +785,7 @@ TradeAnim_ScrollOutRight: ; 293ea ld [hWY], a call DelayFrame call WaitTop - ld a, HIGH(VBGMap0) + ld a, HIGH(vBGMap0) ld [hBGMapAddress + 1], a call ClearTileMap call TradeAnim_IncrementJumptableIndex @@ -802,14 +802,14 @@ TradeAnim_ScrollOutRight2: ; 2940c ret .done - ld a, HIGH(VBGMap1) + ld a, HIGH(vBGMap1) ld [hBGMapAddress + 1], a call WaitBGMap ld a, $7 ld [hWX], a ld a, $90 ld [hWY], a - ld a, HIGH(VBGMap0) + ld a, HIGH(vBGMap0) ld [hBGMapAddress + 1], a call TradeAnim_AdvanceScriptPointer ret @@ -895,14 +895,14 @@ TradeAnim_GetNickname: ; 294a9 ; 294bb TradeAnim_ShowGivemonFrontpic: ; 294bb - ld de, VTiles0 + ld de, vTiles0 jr TradeAnim_ShowFrontpic TradeAnim_ShowGetmonFrontpic: ; 294c0 - ld de, VTiles0 tile $31 + ld de, vTiles0 tile $31 TradeAnim_ShowFrontpic: ; 294c3 call DelayFrame - ld hl, VTiles2 + ld hl, vTiles2 lb bc, 10, $31 call Request2bpp call WaitTop @@ -1009,7 +1009,7 @@ ShowOTTrademonStats: ; 29549 TrademonStats_MonTemplate: ; 29573 call WaitTop call TradeAnim_BlankTileMap - ld a, HIGH(VBGMap1) + ld a, HIGH(vBGMap1) ld [hBGMapAddress + 1], a hlcoord 3, 0 ld b, $6 @@ -1032,7 +1032,7 @@ TrademonStats_MonTemplate: ; 29573 TrademonStats_Egg: ; 295a1 call WaitTop call TradeAnim_BlankTileMap - ld a, HIGH(VBGMap1) + ld a, HIGH(vBGMap1) ld [hBGMapAddress + 1], a hlcoord 3, 0 ld b, 6 @@ -1055,7 +1055,7 @@ TrademonStats_Egg: ; 295a1 TrademonStats_WaitBGMap: ; 295d8 call WaitBGMap call WaitTop - ld a, HIGH(VBGMap0) + ld a, HIGH(vBGMap0) ld [hBGMapAddress + 1], a ret @@ -1499,15 +1499,15 @@ TradeAnim_FlashBGPals: ; 2981d LoadTradeBallAndCableGFX: ; 2982b call DelayFrame ld de, TradeBallGFX - ld hl, VTiles0 tile $62 + ld hl, vTiles0 tile $62 lb bc, BANK(TradeBallGFX), $6 call Request2bpp ld de, TradePoofGFX - ld hl, VTiles0 tile $68 + ld hl, vTiles0 tile $68 lb bc, BANK(TradePoofGFX), $c call Request2bpp ld de, TradeCableGFX - ld hl, VTiles0 tile $74 + ld hl, vTiles0 tile $74 lb bc, BANK(TradeCableGFX), $4 call Request2bpp xor a @@ -1523,7 +1523,7 @@ LoadTradeBubbleGFX: ; 2985a ld e, $3 callfar LoadMenuMonIcon ld de, TradeBubbleGFX - ld hl, VTiles0 tile $72 + ld hl, vTiles0 tile $72 lb bc, BANK(TradeBubbleGFX), $4 call Request2bpp xor a diff --git a/engine/trainer_card.asm b/engine/trainer_card.asm index 01a033650..2905e8eb3 100755 --- a/engine/trainer_card.asm +++ b/engine/trainer_card.asm @@ -37,13 +37,13 @@ TrainerCard: ; 25105 farcall GetCardPic ld hl, CardRightCornerGFX - ld de, VTiles2 tile $1c + ld de, vTiles2 tile $1c ld bc, 1 tiles ld a, BANK(CardRightCornerGFX) call FarCopyBytes ld hl, CardStatusGFX - ld de, VTiles2 tile $29 + ld de, vTiles2 tile $29 ld bc, 86 tiles ld a, BANK(CardStatusGFX) call FarCopyBytes @@ -98,7 +98,7 @@ TrainerCard_Page1_LoadGFX: ; 251b6 (9:51b6) call TrainerCard_InitBorder call WaitBGMap ld de, CardStatusGFX - ld hl, VTiles2 tile $29 + ld hl, vTiles2 tile $29 lb bc, BANK(CardStatusGFX), 86 call Request2bpp call TrainerCard_Page1_PrintDexCaught_GameTime @@ -120,7 +120,7 @@ TrainerCard_Page1_Joypad: ; 251d7 (9:51d7) .KantoCheck: ; unreferenced - ld a, [KantoBadges] + ld a, [wKantoBadges] and a ret z ld a, $4 @@ -136,11 +136,11 @@ TrainerCard_Page2_LoadGFX: ; 251f4 (9:51f4) call TrainerCard_InitBorder call WaitBGMap ld de, LeaderGFX - ld hl, VTiles2 tile $29 + ld hl, vTiles2 tile $29 lb bc, BANK(LeaderGFX), $56 call Request2bpp ld de, BadgeGFX - ld hl, VTiles0 tile $00 + ld hl, vTiles0 tile $00 lb bc, BANK(BadgeGFX), $2c call Request2bpp call TrainerCard_Page2_3_InitObjectsAndStrings @@ -166,7 +166,7 @@ TrainerCard_Page2_Joypad: ; 25221 (9:5221) .KantoCheck: ; unreferenced - ld a, [KantoBadges] + ld a, [wKantoBadges] and a ret z ld a, $4 @@ -185,11 +185,11 @@ TrainerCard_Page3_LoadGFX: ; 2524c (9:524c) call TrainerCard_InitBorder call WaitBGMap ld de, LeaderGFX2 - ld hl, VTiles2 tile $29 + ld hl, vTiles2 tile $29 lb bc, BANK(LeaderGFX2), $56 call Request2bpp ld de, BadgeGFX2 - ld hl, VTiles0 tile $00 + ld hl, vTiles0 tile $00 lb bc, BANK(BadgeGFX2), $2c call Request2bpp call TrainerCard_Page2_3_InitObjectsAndStrings @@ -281,7 +281,7 @@ TrainerCard_Page1_PrintDexCaught_GameTime: ; 2530a (9:530a) hlcoord 2, 8 ld de, .StatusTilemap call TrainerCardSetup_PlaceTilemapString - ld a, [StatusFlags] ; pokedex + ld a, [wStatusFlags] bit 0, a ret nz hlcoord 1, 9 @@ -562,7 +562,7 @@ TrainerCard_JohtoBadgesOAM: ; 254c9 ; cycle 1: face tile, in1 tile, in2 tile, in3 tile ; cycle 2: face tile, in1 tile, in2 tile, in3 tile - dw JohtoBadges + dw wJohtoBadges ; Zephyrbadge db $68, $18, 0 diff --git a/engine/unown_puzzle.asm b/engine/unown_puzzle.asm index 3afe8a17d..525345e68 100755 --- a/engine/unown_puzzle.asm +++ b/engine/unown_puzzle.asm @@ -19,11 +19,11 @@ UnownPuzzle: ; e1190 xor a call ByteFill ld hl, UnownPuzzleCursorGFX - ld de, VTiles1 tile $60 + ld de, vTiles1 tile $60 ld bc, 4 tiles call CopyBytes ld hl, UnownPuzzleStartCancelLZ - ld de, VTiles1 tile $6d + ld de, vTiles1 tile $6d call Decompress call LoadUnownPuzzlePiecesGFX hlcoord 0, 0 @@ -114,13 +114,13 @@ InitUnownPuzzlePiecePositions: ; e124e ; e126d .PuzzlePieceInitialPositions: ; e126d -initpuzcoord: macro +initpuzcoord: MACRO rept _NARG / 2 db \1 puzcoord \2 shift shift endr -endm +ENDM initpuzcoord 0,0, 0,1, 0,2, 0,3, 0,4, 0,5 initpuzcoord 1,0, 1,5 initpuzcoord 2,0, 2,5 @@ -599,11 +599,11 @@ RedrawUnownPuzzlePieces: ; e14d9 UnownPuzzleCoordData: ; e1559 -puzzle_coords: macro +puzzle_coords: MACRO dbpixel \1, \2, \3, \4 dwcoord \5, \6 db \7, \8 -endm +ENDM ; OAM coords, tilemap coords, vacant tile, filler puzzle_coords 3, 3, 4, 4, 1, 0, PUZZLE_BORDER, 0 puzzle_coords 6, 3, 4, 4, 4, 0, PUZZLE_BORDER, 0 @@ -648,8 +648,8 @@ endm puzzle_coords 18, 18, 4, 4, 16, 15, PUZZLE_BORDER, 0 ConvertLoadedPuzzlePieces: ; e1631 - ld hl, VTiles2 - ld de, VTiles0 + ld hl, vTiles2 + ld de, vTiles0 ld b, 6 .loop push bc @@ -821,14 +821,14 @@ endr ; e1703 GFXHeaders: ; e1703 - dw .TileBordersGFX + 0 tiles, VTiles0 tile $00 - dw .TileBordersGFX + 1 tiles, VTiles0 tile $01 - dw .TileBordersGFX + 2 tiles, VTiles0 tile $02 - dw .TileBordersGFX + 3 tiles, VTiles0 tile $0c - dw .TileBordersGFX + 4 tiles, VTiles0 tile $0e - dw .TileBordersGFX + 5 tiles, VTiles0 tile $18 - dw .TileBordersGFX + 6 tiles, VTiles0 tile $19 - dw .TileBordersGFX + 7 tiles, VTiles0 tile $1a + dw .TileBordersGFX + 0 tiles, vTiles0 tile $00 + dw .TileBordersGFX + 1 tiles, vTiles0 tile $01 + dw .TileBordersGFX + 2 tiles, vTiles0 tile $02 + dw .TileBordersGFX + 3 tiles, vTiles0 tile $0c + dw .TileBordersGFX + 4 tiles, vTiles0 tile $0e + dw .TileBordersGFX + 5 tiles, vTiles0 tile $18 + dw .TileBordersGFX + 6 tiles, vTiles0 tile $19 + dw .TileBordersGFX + 7 tiles, vTiles0 tile $1a ; e1723 .TileBordersGFX: ; e1723 @@ -845,7 +845,7 @@ LoadUnownPuzzlePiecesGFX: ; e17a3 ld a, [hli] ld h, [hl] ld l, a - ld de, VTiles2 + ld de, vTiles2 call Decompress call ConvertLoadedPuzzlePieces ret diff --git a/engine/unused_title.asm b/engine/unused_title.asm index 2075d86d9..ca508b593 100644 --- a/engine/unused_title.asm +++ b/engine/unused_title.asm @@ -16,18 +16,18 @@ UnusedTitleScreen: ; 10c000 ld [hl], a ; wTitleScreenTimer + 1 ld hl, UnusedTitleBG_GFX - ld de, VTiles2 - ld bc, VBGMap0 - VTiles2 + ld de, vTiles2 + ld bc, vBGMap0 - vTiles2 call CopyBytes ld hl, UnusedTitleBG_GFX + $80 tiles - ld de, VTiles1 - ld bc, VTiles2 - VTiles1 + ld de, vTiles1 + ld bc, vTiles2 - vTiles1 call CopyBytes ld hl, UnusedTitleFG_GFX - ld de, VTiles0 - ld bc, VTiles1 - VTiles0 + ld de, vTiles0 + ld bc, vTiles1 - vTiles0 call CopyBytes ld hl, UnusedTitleBG_Tilemap diff --git a/engine/warp_connection.asm b/engine/warp_connection.asm index ca0daae73..a0784caac 100755 --- a/engine/warp_connection.asm +++ b/engine/warp_connection.asm @@ -233,9 +233,9 @@ LoadMapTimeOfDay: ; 104750 ret .ClearBGMap: ; 104770 (41:4770) - ld a, HIGH(VBGMap0) + ld a, HIGH(vBGMap0) ld [wBGMapAnchor + 1], a - xor a ; LOW(VBGMap0) + xor a ; LOW(vBGMap0) ld [wBGMapAnchor], a ld [hSCY], a ld [hSCX], a @@ -247,7 +247,7 @@ LoadMapTimeOfDay: ; 104750 ld [rVBK], a xor a - ld bc, VBGMap1 - VBGMap0 + ld bc, vBGMap1 - vBGMap0 hlbgcoord 0, 0 call ByteFill @@ -255,7 +255,7 @@ LoadMapTimeOfDay: ; 104750 ld [rVBK], a ld a, "<BLACK>" - ld bc, VBGMap1 - VBGMap0 + ld bc, vBGMap1 - vBGMap0 hlbgcoord 0, 0 call ByteFill ret diff --git a/engine/wildmons.asm b/engine/wildmons.asm index 9aed7017a..dc62093b8 100755 --- a/engine/wildmons.asm +++ b/engine/wildmons.asm @@ -336,7 +336,7 @@ ChooseWildEncounter: ; 2a14f cp UNOWN jr nz, .done - ld a, [UnlockedUnowns] + ld a, [wUnlockedUnowns] and a jr z, .nowildbattle @@ -428,7 +428,7 @@ _JohtoWildmonCheck _SwarmWildmonCheck call CopyCurrMapDE push hl - ld hl, SwarmFlags + ld hl, wSwarmFlags bit 2, [hl] pop hl jr z, .CheckYanma @@ -445,7 +445,7 @@ _SwarmWildmonCheck .CheckYanma: push hl - ld hl, SwarmFlags + ld hl, wSwarmFlags bit 3, [hl] pop hl jr z, _NoSwarmWildmon |