hLCDCPointer and InitList

This commit is contained in:
pikalaxalt 2016-06-13 22:53:33 -04:00
parent ca01a92880
commit 4e2487c056
20 changed files with 103 additions and 101 deletions

View File

@ -933,7 +933,7 @@ BattleBGEffect_Surf: ; c8545 (32:4545)
call InitSurfWaves
.one
ld a, [hFFC6]
ld a, [hLCDCPointer]
and a
ret z
push bc
@ -997,8 +997,8 @@ BattleBGEffect_Whirlpool: ; c8599 (32:4599)
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, $42
ld [hFFC6], a
ld a, rSCY - $ff00
ld [hLCDCPointer], a
xor a
ld [hLYOverrideStart], a
ld a, $5e
@ -1017,7 +1017,7 @@ BattleBGEffect_Whirlpool: ; c8599 (32:4599)
BattleBGEffect_30: ; c85c2 (32:45c2)
call BattleBGEffects_ClearLYOverrides
ld a, $42
ld a, rSCY - $ff00
call BattleBGEffect_SetLCDStatCustoms1
call EndBattleBGEffect
ret
@ -1071,8 +1071,8 @@ BattleBGEffect_Psychic: ; c8607 (32:4607)
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, $43
ld [hFFC6], a
ld a, rSCX - $ff00
ld [hLCDCPointer], a
xor a
ld [hLYOverrideStart], a
ld a, $5f
@ -1109,7 +1109,7 @@ BattleBGEffect_Teleport: ; c863f (32:463f)
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, $43
ld a, rSCX - $ff00
call BattleBGEffect_SetLCDStatCustoms1
lb de, 6, 5
call Functionc8f2e
@ -1134,7 +1134,7 @@ BattleBGEffect_NightShade: ; c8662 (32:4662)
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, $42
ld a, rSCY - $ff00
call BattleBGEffect_SetLCDStatCustoms1
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
@ -1165,7 +1165,7 @@ BattleBGEffect_DoubleTeam: ; c8689 (32:4689)
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, $43
ld a, rSCX - $ff00
call BattleBGEffect_SetLCDStatCustoms1
ld a, [hLYOverrideEnd]
inc a
@ -1257,7 +1257,7 @@ BattleBGEffect_AcidArmor: ; c8709 (32:4709)
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, $42
ld a, rSCY - $ff00
call BattleBGEffect_SetLCDStatCustoms1
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
@ -1320,7 +1320,7 @@ BattleBGEffect_Withdraw: ; c8761 (32:4761)
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, $42
ld a, rSCY - $ff00
call BattleBGEffect_SetLCDStatCustoms1
ld a, [hLYOverrideEnd]
inc a
@ -1370,7 +1370,7 @@ BattleBGEffect_Dig: ; c87a7 (32:47a7)
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, $42
ld a, rSCY - $ff00
call BattleBGEffect_SetLCDStatCustoms1
ld a, [hLYOverrideEnd]
inc a
@ -1437,7 +1437,7 @@ BattleBGEffect_Tackle: ; c8805 (32:4805)
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, $43
ld a, rSCX - $ff00
call BattleBGEffect_SetLCDStatCustoms1
ld a, [hLYOverrideEnd]
inc a
@ -1472,7 +1472,7 @@ BattleBGEffect_25: ; c8837 (32:4837)
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, $43
ld a, rSCX - $ff00
call BattleBGEffect_SetLCDStatCustoms2
ld a, [hLYOverrideEnd]
inc a
@ -1604,7 +1604,7 @@ BattleBGEffect_2d: ; c88e7 (32:48e7)
BGEffect2d_2f_zero:
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, $43
ld a, rSCX - $ff00
call BattleBGEffect_SetLCDStatCustoms1
ld a, [hLYOverrideEnd]
inc a
@ -1648,7 +1648,7 @@ BattleBGEffect_26: ; c892a (32:492a)
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, $43
ld a, rSCX - $ff00
call BattleBGEffect_SetLCDStatCustoms1
ld a, [hLYOverrideEnd]
inc a
@ -1687,7 +1687,7 @@ BattleBGEffect_2c: ; c8964 (32:4964)
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, $43
ld a, rSCX - $ff00
call BattleBGEffect_SetLCDStatCustoms1
ld a, [hLYOverrideEnd]
inc a
@ -1742,7 +1742,7 @@ BattleBGEffect_28: ; c89b5 (32:49b5)
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, $43
ld a, rSCX - $ff00
call BattleBGEffect_SetLCDStatCustoms1
ret
@ -1785,7 +1785,7 @@ BattleBGEffect_BounceDown: ; c89ee (32:49ee)
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, $42
ld a, rSCY - $ff00
call BattleBGEffect_SetLCDStatCustoms2
ld a, [hLYOverrideEnd]
inc a
@ -1944,7 +1944,7 @@ BattleBGEffect_2b: ; c8acc (32:4acc)
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, $43
ld a, rSCX - $ff00
call BattleBGEffect_SetLCDStatCustoms1
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
@ -1986,8 +1986,8 @@ BattleBGEffect_1c: ; c8b00 (32:4b00)
call BattleBGEffects_IncrementJumptable
ld a, $e4
call BattleBGEffects_SetLYOverrides
ld a, $47
ld [hFFC6], a
ld a, rBGP - $ff00
ld [hLCDCPointer], a
xor a
ld [hLYOverrideStart], a
ld a, $60
@ -2221,7 +2221,7 @@ BattleBGEffect_VibrateMon: ; c8c61 (32:4c61)
.zero ; c8c68 (32:4c68)
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, $43
ld a, rSCX - $ff00
call BattleBGEffect_SetLCDStatCustoms1
ld a, [hLYOverrideEnd]
inc a
@ -2267,8 +2267,8 @@ BattleBGEffect_WobbleMon: ; c8ca2 (32:4ca2)
.zero ; c8cab (32:4cab)
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, $43
ld [hFFC6], a
ld a, rSCX - $ff00
ld [hLCDCPointer], a
xor a
ld [hLYOverrideStart], a
ld a, $37
@ -2655,7 +2655,7 @@ BattleBGEffect_GetNextDMGPal: ; c8eb2 (32:4eb2)
BattleBGEffects_ClearLYOverrides: ; c8eca (32:4eca)
xor a
BattleBGEffects_SetLYOverrides: ; c8ecb (32:4ecb)
ld hl, LYOverrides ; wd100
ld hl, LYOverrides ; wListPointer
ld e, $99
.loop1
ld [hli], a
@ -2670,7 +2670,7 @@ BattleBGEffects_SetLYOverrides: ; c8ecb (32:4ecb)
ret
BattleBGEffect_SetLCDStatCustoms1: ; c8ede (32:4ede)
ld [hFFC6], a
ld [hLCDCPointer], a
call BGEffect_CheckBattleTurn
jr nz, .player_turn
lb de, $00, $36
@ -2686,7 +2686,7 @@ BattleBGEffect_SetLCDStatCustoms1: ; c8ede (32:4ede)
ret
BattleBGEffect_SetLCDStatCustoms2: ; c8ef4 (32:4ef4)
ld [hFFC6], a
ld [hLCDCPointer], a
call BGEffect_CheckBattleTurn
jr nz, .player_turn
lb de, $00, $36
@ -2707,13 +2707,13 @@ BattleAnim_ResetLCDStatCustom: ; c8f0a (32:4f0a)
ld [hLYOverrideEnd], a
call BattleBGEffects_ClearLYOverrides
xor a
ld [hFFC6], a
ld [hLCDCPointer], a
call EndBattleBGEffect
ret
BattleBGEffects_ResetVideoHRAM: ; c8f19 (32:4f19)
xor a
ld [hFFC6], a
ld [hLCDCPointer], a
ld a, %11100100
ld [rBGP], a
ld [wBGP], a

View File

@ -5124,7 +5124,6 @@ BattleMenu: ; 3e139
jr z, .skip_dude_pack_select
callba _DudeAutoInput_DownA
.skip_dude_pack_select
call LoadBattleMenu2
ret c

View File

@ -1150,8 +1150,8 @@ BattleAnimFunction_0D: ; cd66a (33:566a)
dw .four
.zero
call BattleAnim_IncAnonJumptableIndex
ld a, $42
ld [hFFC6], a
ld a, rSCY - $ff00
ld [hLCDCPointer], a
ld a, $58
ld [hLYOverrideStart], a
ld a, $5e
@ -1209,7 +1209,7 @@ BattleAnimFunction_0D: ; cd66a (33:566a)
cp $70
jr c, asm_cd6da
xor a
ld [hFFC6], a
ld [hLCDCPointer], a
ld [hLYOverrideStart], a
ld [hLYOverrideEnd], a
.four

View File

@ -5,10 +5,10 @@ BattleIntroSlidingPics: ; 4e980
ld [rSVBK], a
call .subfunction1
ld a, rSCX - $ff00
ld [hFFC6], a
ld [hLCDCPointer], a
call .subfunction2
xor a
ld [hFFC6], a
ld [hLCDCPointer], a
pop af
ld [rSVBK], a
ret

View File

@ -253,3 +253,9 @@ FISHSWARM_REMORAID EQU 2
const FISHGROUP_QWILFISH
const FISHGROUP_REMORAID
const FISHGROUP_QWILFISH_NO_SWARM
INIT_ENEMYOT_LIST EQU 1
INIT_BAG_ITEM_LIST EQU 2
INIT_OTHER_ITEM_LIST EQU 3
INIT_PLAYEROT_LIST EQU 4
INIT_MON_LIST EQU 5

View File

@ -39,7 +39,7 @@ Predef_StartBattle: ; 8c20f
call DmgToCgbBGPals
call DelayFrame
xor a
ld [hFFC6], a
ld [hLCDCPointer], a
ld [hLYOverrideStart], a
ld [hLYOverrideEnd], a
ld [hSCY], a
@ -302,8 +302,8 @@ StartTrainerBattle_SetUpForWavyOutro: ; 8c3e8 (23:43e8)
call StartTrainerBattle_NextScene
ld a, $43
ld [hFFC6], a
ld a, rSCX - $ff00
ld [hLCDCPointer], a
xor a
ld [hLYOverrideStart], a
ld a, $90

View File

@ -183,7 +183,7 @@ Credits:: ; 109847
call ByteFill
ld a, rSCX - $ff00
ld [hFFC6], a
ld [hLCDCPointer], a
call GetCreditsPalette
call SetPalettes
@ -211,7 +211,7 @@ Credits:: ; 109847
.exit_credits
call ClearBGPalettes
xor a
ld [hFFC6], a
ld [hLCDCPointer], a
ld [hBGMapAddress], a
pop af
ld [hVBlank], a

View File

@ -621,7 +621,7 @@ IntroScene5: ; e4a7a (39:4a7a)
call ClearTileMap
xor a
ld [hBGMapMode], a
ld [hFFC6], a
ld [hLCDCPointer], a
ld a, $1
ld [rVBK], a
ld hl, IntroTilemap005
@ -815,7 +815,7 @@ IntroScene8: ; e4bd3 (39:4bd3)
IntroScene9: ; e4c04 (39:4c04)
; Set up the next scene (same bg).
xor a
ld [hFFC6], a
ld [hLCDCPointer], a
call ClearSprites
hlcoord 0, 0, AttrMap
; first 12 rows have palette 1
@ -889,7 +889,7 @@ IntroScene11: ; e4c86 (39:4c86)
call ClearTileMap
xor a
ld [hBGMapMode], a
ld [hFFC6], a
ld [hLCDCPointer], a
ld a, $1
ld [rVBK], a
ld hl, IntroTilemap007
@ -2093,8 +2093,8 @@ Intro_ResetLYOverrides: ; e5516 (39:5516)
pop af
ld [rSVBK], a
ld a, $43
ld [hFFC6], a
ld a, rSCX - $ff00
ld [hLCDCPointer], a
ret
Intro_PerspectiveScrollBG: ; e552f (39:552f)

View File

@ -55,7 +55,7 @@ ReturnFromMapSetupScript:: ; b8000
ld [rWY], a
ld [hWY], a
xor a
ld [hFFC6], a
ld [hLCDCPointer], a
ret
; b8064
@ -126,7 +126,7 @@ PlaceMapNameSign:: ; b8098 (2e:4098)
ld [rWY], a
ld [hWY], a
xor a
ld [hFFC6], a
ld [hLCDCPointer], a
ret

View File

@ -140,7 +140,7 @@ _ResetWRAM: ; 5bae
ld [wSecretID + 1], a
ld hl, PartyCount
call InitList
call .InitList
xor a
ld [wCurBox], a
@ -151,20 +151,20 @@ _ResetWRAM: ; 5bae
ld a, BANK(sBoxCount)
call GetSRAMBank
ld hl, sBoxCount
call InitList
call .InitList
call CloseSRAM
ld hl, NumItems
call InitList
call .InitList
ld hl, NumKeyItems
call InitList
call .InitList
ld hl, NumBalls
call InitList
call .InitList
ld hl, PCItems
call InitList
call .InitList
xor a
ld [wRoamMon1Species], a
@ -232,7 +232,7 @@ ENDC
ret
; 5ca1
InitList: ; 5ca1
.InitList: ; 5ca1
; Loads 0 in the count and -1 in the first item or mon slot.
xor a
ld [hli], a
@ -1041,7 +1041,7 @@ StartTitleScreen: ; 6219
call ClearScreen
call WaitBGMap2
xor a
ld [hFFC6], a
ld [hLCDCPointer], a
ld [hSCX], a
ld [hSCY], a
ld a, $7
@ -1172,7 +1172,7 @@ TitleScreenEntrance: ; 62bc
ld hl, wJumptableIndex
inc [hl]
xor a
ld [hFFC6], a
ld [hLCDCPointer], a
; Play the title screen music.
ld de, MUSIC_TITLE

View File

@ -163,9 +163,9 @@ TimeCapsule: ; 2805d
ld hl, wTimeCapsulePartyMon1Species
call Function2868a
ld a, OTPartyMonOT % $100
ld [wd102], a
ld [wUnusedD102], a
ld a, OTPartyMonOT / $100
ld [wd103], a
ld [wUnusedD102 + 1], a
ld de, MUSIC_NONE
call PlayMusic
ld a, [hLinkPlayerNumber]
@ -404,9 +404,9 @@ Gen2ToGen2LinkComms: ; 28177
ld bc, OTPartyDataEnd - OTPartyMons
call CopyBytes
ld a, OTPartyMonOT % $100
ld [wd102], a
ld [wUnusedD102], a
ld a, OTPartyMonOT / $100
ld [wd103], a
ld [wUnusedD102 + 1], a
ld de, MUSIC_NONE
call PlayMusic
ld a, [hLinkPlayerNumber]
@ -1254,8 +1254,8 @@ LinkTradeOTPartymonMenuLoop: ; 28835
bit A_BUTTON_F, a
jr z, .not_a_button
ld a, $1
ld [wd263], a
callab LoadAddrsForLinkMonStatsScreen
ld [wInitListType], a
callab InitList
ld hl, OTPartyMon1Species
callba LinkMonStatsScreen
jp LinkTradePartiesMenuMasterLoop
@ -1447,8 +1447,8 @@ Function28926: ; 28926
pop af
ld [wMenuCursorY], a
ld a, $4
ld [wd263], a
callab LoadAddrsForLinkMonStatsScreen
ld [wInitListType], a
callab InitList
callba LinkMonStatsScreen
call Call_LoadTempTileMapToTileMap
hlcoord 6, 1

View File

@ -188,8 +188,8 @@ _TitleScreen: ; 10ed67
call ByteFill
; Let LCD Stat know we're messing around with SCX
ld a, rSCX - rJOYP
ld [hFFC6], a
ld a, rSCX - $ff00
ld [hLCDCPointer], a
pop af
ld [rSVBK], a

View File

@ -61,7 +61,7 @@ Special_MagnetTrain: ; 8cc04
ld [hVBlank], a
call ClearBGPalettes
xor a
ld [hFFC6], a
ld [hLCDCPointer], a
ld [hLYOverrideStart], a
ld [hLYOverrideEnd], a
ld [hSCX], a
@ -251,8 +251,8 @@ MagnetTrain_InitLYOverrides: ; 8cda6
ld bc, LYOverridesBackupEnd - LYOverridesBackup
ld a, [wMagnetTrainInitPosition]
call ByteFill
ld a, $43
ld [hFFC6], a
ld a, rSCX - $ff00
ld [hLCDCPointer], a
ret
; 8cdc3

View File

@ -825,9 +825,9 @@ GetName:: ; 33c3
.done
ld a, e
ld [wd102], a
ld [wUnusedD102], a
ld a, d
ld [wd103], a
ld [wUnusedD102 + 1], a
pop de
pop bc
@ -1905,7 +1905,7 @@ INCLUDE "home/battle.asm"
PushLYOverrides:: ; 3b0c
ld a, [hFFC6]
ld a, [hLCDCPointer]
and a
ret z

View File

@ -3,7 +3,7 @@
Function547:: ; 547
; Unreferenced
ld a, [hFFC6]
ld a, [hLCDCPointer]
cp rSCX - $ff00
ret nz
ld c, a
@ -15,7 +15,7 @@ Function547:: ; 547
LCD:: ; 552
push af
ld a, [hFFC6]
ld a, [hLCDCPointer]
and a
jr z, .done
@ -26,7 +26,7 @@ LCD:: ; 552
ld b, LYOverrides >> 8
ld a, [bc]
ld b, a
ld a, [hFFC6]
ld a, [hLCDCPointer]
ld c, a
ld a, b
ld [$ff00+c], a

View File

@ -82,7 +82,7 @@ hMoneyTemp EQU $ffc3
hMGJoypadPressed EQU $ffc3
hMGJoypadReleased EQU $ffc4
hFFC6 EQU $ffc6
hLCDCPointer EQU $ffc6
hLYOverrideStart EQU $ffc7
hLYOverrideEnd EQU $ffc8
hMobileReceive EQU $ffc9

View File

@ -77,7 +77,7 @@ ReanchorBGMap_NoOAMUpdate:: ; 6454
.ReanchorBGMap:
xor a
ld [hFFC6], a
ld [hLCDCPointer], a
ld [hBGMapMode], a
ld a, $90
ld [hWY], a
@ -4258,10 +4258,10 @@ ListMoves: ; 50d6f
.done
ret
LoadAddrsForLinkMonStatsScreen: ; 50db9
ld a, [wd263]
InitList: ; 50db9
ld a, [wInitListType]
cp $1
cp INIT_ENEMYOT_LIST
jr nz, .check_party_ot_name
ld hl, OTPartyCount
ld de, OTPartyMonOT
@ -4269,7 +4269,7 @@ LoadAddrsForLinkMonStatsScreen: ; 50db9
jr .done
.check_party_ot_name
cp $4
cp INIT_PLAYEROT_LIST
jr nz, .check_mon_name
ld hl, PartyCount
ld de, PartyMonOT
@ -4277,7 +4277,7 @@ LoadAddrsForLinkMonStatsScreen: ; 50db9
jr .done
.check_mon_name
cp $5
cp INIT_MON_LIST
jr nz, .check_item_name
ld hl, CurMart
ld de, PokemonNames
@ -4285,7 +4285,7 @@ LoadAddrsForLinkMonStatsScreen: ; 50db9
jr .done
.check_item_name
cp $2
cp INIT_BAG_ITEM_LIST
jr nz, .check_ob_item_name
ld hl, NumItems
ld de, ItemNames
@ -4299,18 +4299,18 @@ LoadAddrsForLinkMonStatsScreen: ; 50db9
.done
ld [wNamedObjectTypeBuffer], a ; d265
ld a, l
ld [wd100], a
ld [wListPointer], a
ld a, h
ld [wd101], a
ld [wListPointer + 1], a
ld a, e
ld [wd102], a
ld [wUnusedD102], a
ld a, d
ld [wd103], a
ld [wUnusedD102 + 1], a
ld bc, ItemAttributes ; ParseEnemyAction, HandleMapTimeAndJoypad, Music_LakeOfRage_Ch3, String_11a7c1 $67c1
ld a, c
ld [wd104], a
ld [wItemAttributesPtr], a
ld a, b
ld [wd105], a
ld [wItemAttributesPtr + 1], a
ret
CalcLevel: ; 50e1b

View File

@ -1199,7 +1199,7 @@ Function11c7bc: ; 11c7bc (47:47bc)
ret
.asm_11c7e9
ld hl, wd100
ld hl, wListPointer
ld a, [wcd26]
ld e, a
add hl, de
@ -1433,7 +1433,7 @@ Function11c8f6: ; 11c8f6 (47:48f6)
add [hl]
ld c, a
ld b, $0
ld hl, wd100
ld hl, wListPointer
add hl, bc
ld a, [hl]
jr .asm_11c911

View File

@ -67,7 +67,7 @@ SetRAMStateForMobile: ; 100063
ld [BGMapBuffer], a
xor a
ld [hMapAnims], a
ld [hFFC6], a
ld [hLCDCPointer], a
ret
; 100082
@ -85,7 +85,7 @@ EnableMobile: ; 100082
ld [rIE], a
xor a
ld [hMapAnims], a
ld [hFFC6], a
ld [hLCDCPointer], a
ld a, $01
ld [hMobileReceive], a
ld [hMobile], a

View File

@ -1795,12 +1795,9 @@ wMailboxItems:: ds MAILBOX_CAPACITY
wMailboxEnd:: ds 1 ; d0fe
ds 2
wd100:: ds 1
wd101:: ds 1
wd102:: ds 1
wd103:: ds 1
wd104:: ds 1
wd105:: ds 1
wListPointer:: dw ; d100
wUnusedD102:: dw ; d102
wItemAttributesPtr:: dw ; d104
CurItem:: ds 1 ; d106
CurItemQuantity:: ; d107
@ -2180,7 +2177,7 @@ wNiteEncounterRate:: ds 1 ; d25c
wWaterEncounterRate:: ds 1 ; d25d
wListMoves_MoveIndicesBuffer:: ds NUM_MOVES
wPutativeTMHMMove:: ds 1
wd263:: ds 1
wInitListType:: ds 1
wAISwitch:: ds 1
wFoundMatchingIDInParty::
wNamedObjectIndexBuffer::