HDMA transfer functions

This commit is contained in:
pikalaxalt
2016-05-04 22:34:09 -04:00
parent 3713b71d9e
commit a613ed915c
27 changed files with 232 additions and 193 deletions

View File

@@ -9429,7 +9429,7 @@ InitBattleDisplay: ; 3fb6c
ld [rSVBK], a
ld hl, wDecompressScratch
ld bc, wBackupAttrMap - wDecompressScratch
ld bc, wScratchAttrMap - wDecompressScratch
ld a, " "
call ByteFill

View File

@@ -56,7 +56,7 @@ Predef_StartBattle: ; 8c20f
ld a, [wLinkMode]
cp LINK_MOBILE
jr z, .mobile
callba Function6454
callba ReanchorBGMap_NoOAMUpdate
call UpdateSprites
call DelayFrame
call .NonMobile_LoadPokeballTiles

View File

@@ -45,7 +45,7 @@ ReturnFromMapSetupScript:: ; b8000
ld [wLandmarkSignTimer], a
call LoadMapNameSignGFX
call InitMapNameFrame
callba Function104303
callba HDMATransfer_OnlyTopFourRows
ret
.dont_do_map_sign
@@ -113,7 +113,7 @@ PlaceMapNameSign:: ; b8098 (2e:4098)
jr nz, .skip2
call InitMapNameFrame
call PlaceMapNameCenterAlign
callba Function104303
callba HDMATransfer_OnlyTopFourRows
.skip2
ld a, $80
ld a, $70

View File

@@ -2209,7 +2209,7 @@ Function55e0:: ; 55e0
xor a
.loop
ld [hMapObjectIndexBuffer], a
call GetObjectSprite
call DoesObjectHaveASprite
jr z, .ok
call Function565c
.ok
@@ -2260,7 +2260,7 @@ Function5629: ; 5629
cp NUM_OBJECT_STRUCTS
ret nc
call GetObjectStruct
call GetObjectSprite
call DoesObjectHaveASprite
ret z
call Function5673
ret
@@ -2363,7 +2363,7 @@ Function56a3: ; 56a3
; 56cd
Function56cd: ; 56cd
ld a, [wFollowNotExactPersonX]
ld a, [wPlayerBGMapOffsetX]
ld d, a
ld hl, OBJECT_SPRITE_X_OFFSET
add hl, bc
@@ -2392,7 +2392,7 @@ Function56cd: ; 56cd
sub $20
.ok3
ld [hUsedSpriteIndex], a
ld a, [wFollowNotExactPersonY]
ld a, [wPlayerBGMapOffsetY]
ld e, a
ld hl, OBJECT_SPRITE_Y_OFFSET
add hl, bc
@@ -2489,7 +2489,7 @@ HandleNPCStep:: ; 576a
xor a
.loop
ld [hMapObjectIndexBuffer], a
call GetObjectSprite
call DoesObjectHaveASprite
jr z, .next
call Function437b
.next
@@ -2662,7 +2662,7 @@ Function587a: ; 587a
xor a
.loop
push af
call GetObjectSprite
call DoesObjectHaveASprite
jr z, .next
ld hl, OBJECT_FLAGS2
add hl, bc
@@ -2707,7 +2707,7 @@ Function58b9:: ; 58b9
xor a
.loop
push af
call GetObjectSprite
call DoesObjectHaveASprite
jr z, .next
ld hl, OBJECT_FLAGS2
add hl, bc
@@ -2817,19 +2817,19 @@ _UpdateSprites:: ; 5920
ret
; 5958
Function5958: ; 5958
ApplyBGMapAnchorToObjects: ; 5958
push hl
push de
push bc
ld a, [wFollowNotExactPersonX]
ld a, [wPlayerBGMapOffsetX]
ld d, a
ld a, [wFollowNotExactPersonY]
ld a, [wPlayerBGMapOffsetY]
ld e, a
ld bc, ObjectStructs
ld a, NUM_OBJECT_STRUCTS
.loop
push af
call GetObjectSprite
call DoesObjectHaveASprite
jr z, .skip
ld hl, OBJECT_SPRITE_X
add hl, bc
@@ -2850,8 +2850,8 @@ Function5958: ; 5958
dec a
jr nz, .loop
xor a
ld [wFollowNotExactPersonX], a
ld [wFollowNotExactPersonY], a
ld [wPlayerBGMapOffsetX], a
ld [wPlayerBGMapOffsetY], a
pop bc
pop de
pop hl
@@ -2881,7 +2881,7 @@ PRIORITY_HIGH EQU $30
ld hl, wMovementPointer
.loop
push hl
call GetObjectSprite
call DoesObjectHaveASprite
jr z, .skip
ld hl, OBJECT_FACING_STEP
add hl, bc
@@ -2986,7 +2986,7 @@ PRIORITY_HIGH EQU $30
add [hl]
add 8
ld e, a
ld a, [wFollowNotExactPersonX]
ld a, [wPlayerBGMapOffsetX]
add e
ld [hFFBF], a
ld hl, OBJECT_SPRITE_Y
@@ -2997,7 +2997,7 @@ PRIORITY_HIGH EQU $30
add [hl]
add 12
ld e, a
ld a, [wFollowNotExactPersonY]
ld a, [wPlayerBGMapOffsetY]
add e
ld [hFFC0], a
ld hl, OBJECT_FACING_STEP

View File

@@ -296,7 +296,7 @@ Function241d5: ; 241d5
call Place2DMenuCursor
.loop
call Move2DMenuCursor
call Function10402d ; BUG: This function is in another bank.
call HDMATransferTileMapToWRAMBank3 ; BUG: This function is in another bank.
; Pointer in current bank (9) is bogus.
call .loop2
jr nc, .done

View File

@@ -320,7 +320,7 @@ IsNPCAtCoord: ; 7041
xor a
.loop
ld [hObjectStructIndexBuffer], a
call GetObjectSprite
call DoesObjectHaveASprite
jr z, .next
ld hl, OBJECT_FLAGS1
@@ -490,7 +490,7 @@ Function7113: ; unreferenced
xor a
.loop
ld [hObjectStructIndexBuffer], a
call GetObjectSprite
call DoesObjectHaveASprite
jr z, .next
ld hl, OBJECT_MOVEMENTTYPE
add hl, bc

View File

@@ -474,7 +474,7 @@ CopyTempObjectToObjectStruct: ; 8286
sub [hl]
and $f
swap a
ld hl, wFollowNotExactPersonY
ld hl, wPlayerBGMapOffsetY
sub [hl]
ld hl, OBJECT_SPRITE_Y
add hl, de
@@ -492,7 +492,7 @@ CopyTempObjectToObjectStruct: ; 8286
sub [hl]
and $f
swap a
ld hl, wFollowNotExactPersonX
ld hl, wPlayerBGMapOffsetX
sub [hl]
ld hl, OBJECT_SPRITE_X
add hl, de
@@ -660,7 +660,7 @@ FollowNotExact:: ; 839e
sub [hl]
and $f
swap a
ld hl, wFollowNotExactPersonX
ld hl, wPlayerBGMapOffsetX
sub [hl]
ld hl, OBJECT_SPRITE_X
add hl, de
@@ -673,7 +673,7 @@ FollowNotExact:: ; 839e
sub [hl]
and $f
swap a
ld hl, wFollowNotExactPersonY
ld hl, wPlayerBGMapOffsetY
sub [hl]
ld hl, OBJECT_SPRITE_Y
add hl, de

View File

@@ -26,12 +26,12 @@ _HandlePlayerStep:: ; d497 (3:5497)
ld d, a
ld a, [wPlayerStepVectorY]
ld e, a
ld a, [wFollowNotExactPersonX]
ld a, [wPlayerBGMapOffsetX]
sub d
ld [wFollowNotExactPersonX], a
ld a, [wFollowNotExactPersonY]
ld [wPlayerBGMapOffsetX], a
ld a, [wPlayerBGMapOffsetY]
sub e
ld [wFollowNotExactPersonY], a
ld [wPlayerBGMapOffsetY], a
ret
ScrollScreen:: ; d4d2 (3:54d2)

View File

@@ -3054,7 +3054,7 @@ Script_loadbytec2cf: ; 97b27
Script_closetext: ; 97b2f
; script command 0x49
call Function2e20
call _OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
call CloseText
ret
; 97b36

View File

@@ -5,7 +5,7 @@ StartMenu:: ; 125cd
ld de, SFX_MENU
call PlaySFX
callba Function6454
callba ReanchorBGMap_NoOAMUpdate
ld hl, StatusFlags2
bit 2, [hl] ; bug catching contest
@@ -22,8 +22,8 @@ StartMenu:: ; 125cd
call MenuFunc_1e7f
call .DrawBugContestStatusBox
call Function2e31
call Function2e20
callba Function64bf
call _OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
callba LoadFonts_NoOAMUpdate
call .DrawBugContestStatus
call UpdateTimePals
jr .Select

View File

@@ -129,7 +129,7 @@ StatsScreen_WaitAnim: ; 4dd3a (13:5d3a)
.finish
ld hl, wcf64
res 5, [hl]
callba Function10402d
callba HDMATransferTileMapToWRAMBank3
ret
StatsScreen_SetJumptableIndex: ; 4dd62 (13:5d62)
@@ -149,7 +149,7 @@ MonStatsInit: ; 4dd72 (13:5d72)
res 6, [hl]
call ClearBGPalettes
call ClearTileMap
callba Function10402d
callba HDMATransferTileMapToWRAMBank3
call StatsScreen_CopyToTempMon
ld a, [CurPartySpecies]
cp EGG
@@ -1014,7 +1014,7 @@ EggStatsScreen: ; 4e33a
call DelayFrame
hlcoord 0, 0
call PrepMonFrontpic
callba Function10402d
callba HDMATransferTileMapToWRAMBank3
call StatsScreen_AnimateEgg
ld a, [TempMonHappiness]

View File

@@ -250,7 +250,7 @@ Function104770: ; 104770 (41:4770)
ld [wBGMapAnchor], a
ld [hSCY], a
ld [hSCX], a
callba Function5958
callba ApplyBGMapAnchorToObjects
ld a, [rVBK]
push af
ld a, $1

View File

@@ -99,7 +99,7 @@ AnimateFrontpic: ; d008e
.loop
call SetUpPokeAnim
push af
callba Function10402d
callba HDMATransferTileMapToWRAMBank3
pop af
jr nc, .loop
ret
@@ -288,9 +288,9 @@ Functiond01a9: ; d01a9
ld a, $2
ld [rSVBK], a
call Functiond04bd
callba Function10402d
callba HDMATransferTileMapToWRAMBank3
call Functiond0536
callba Function104047
callba HDMATransferAttrMapToWRAMBank3
pop af
ld [rSVBK], a
ret
@@ -880,7 +880,7 @@ Functiond0504: ; d0504
xor a
ld [hBGMapMode], a
call Functiond051b
callba Function104047
callba HDMATransferAttrMapToWRAMBank3
pop af
ld [rSVBK], a
ret

View File

@@ -570,7 +570,7 @@ LoadEDTile:: ; 323d
; 323f
; XXX
callba Function104000
callba HDMATransferAttrMapAndTileMapToWRAMBank3
ret
; 3246

View File

@@ -636,7 +636,7 @@ GetObjectStruct:: ; 1ae5
ret
; 1af1
GetObjectSprite:: ; 1af1
DoesObjectHaveASprite:: ; 1af1
ld hl, OBJECT_SPRITE
add hl, bc
ld a, [hl]

View File

@@ -3,12 +3,12 @@ RefreshScreen:: ; 2dba
call ClearWindowData
ld a, [hROMBank]
push af
ld a, BANK(Function6454) ; and BANK(Function64bf)
ld a, BANK(ReanchorBGMap_NoOAMUpdate) ; and BANK(LoadFonts_NoOAMUpdate)
rst Bankswitch
call Function6454
call Function2e20
call Function64bf
call ReanchorBGMap_NoOAMUpdate
call _OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
call LoadFonts_NoOAMUpdate
pop af
rst Bankswitch
@@ -36,7 +36,7 @@ CloseText:: ; 2dcf
xor a
ld [hBGMapMode], a
call OverworldTextModeSwitch
call Function2e20
call _OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
xor a
ld [hBGMapMode], a
call Function2e31
@@ -52,26 +52,26 @@ OpenText:: ; 2e08
call ClearWindowData
ld a, [hROMBank]
push af
ld a, BANK(Function6454) ; and BANK(Function64bf)
ld a, BANK(ReanchorBGMap_NoOAMUpdate) ; and BANK(LoadFonts_NoOAMUpdate)
rst Bankswitch
call Function6454 ; clear bgmap
call ReanchorBGMap_NoOAMUpdate ; clear bgmap
call SpeechTextBox
call Function2e20 ; anchor bgmap
call Function64bf ; load font
call _OpenAndCloseMenu_HDMATransferTileMapAndAttrMap ; anchor bgmap
call LoadFonts_NoOAMUpdate ; load font
pop af
rst Bankswitch
ret
; 2e20
Function2e20:: ; 2e20
_OpenAndCloseMenu_HDMATransferTileMapAndAttrMap:: ; 2e20
ld a, [hOAMUpdate]
push af
ld a, $1
ld [hOAMUpdate], a
callba Function104110
callba OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
pop af
ld [hOAMUpdate], a

View File

@@ -53,7 +53,7 @@ INCLUDE "engine/map_objects.asm"
INCLUDE "engine/intro_menu.asm"
Function6454:: ; 6454
ReanchorBGMap_NoOAMUpdate:: ; 6454
call DelayFrame
ld a, [hOAMUpdate]
push af
@@ -64,7 +64,8 @@ Function6454:: ; 6454
push af
xor a
ld [hBGMapMode], a
call .Function6473
call .ReanchorBGMap
pop af
ld [hBGMapMode], a
@@ -74,7 +75,7 @@ Function6454:: ; 6454
set 6, [hl]
ret
.Function6473:
.ReanchorBGMap:
xor a
ld [hFFC6], a
ld [hBGMapMode], a
@@ -82,8 +83,8 @@ Function6454:: ; 6454
ld [hWY], a
call OverworldTextModeSwitch
ld a, VBGMap1 / $100
call .Function64b9
call Function2e20
call .LoadBGMapAddrIntoHRAM
call _OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
callba LoadOW_BGPal7
callba ApplyPals
ld a, $1
@@ -91,9 +92,9 @@ Function6454:: ; 6454
xor a
ld [hBGMapMode], a
ld [hWY], a
callba Function64db ; no need to farcall
callba HDMATransfer_FillBGMap0WithTile60 ; no need to farcall
ld a, VBGMap0 / $100
call .Function64b9
call .LoadBGMapAddrIntoHRAM
xor a
ld [wBGMapAnchor], a
ld a, VBGMap0 / $100
@@ -101,28 +102,28 @@ Function6454:: ; 6454
xor a
ld [hSCX], a
ld [hSCY], a
call Function5958
call ApplyBGMapAnchorToObjects
ret
.Function64b9: ; 64b9
.LoadBGMapAddrIntoHRAM: ; 64b9
ld [hBGMapAddress + 1], a
xor a
ld [hBGMapAddress], a
ret
Function64bf:: ; 64bf
LoadFonts_NoOAMUpdate:: ; 64bf
ld a, [hOAMUpdate]
push af
ld a, $1
ld [hOAMUpdate], a
call .Function64cd
call .LoadGFX
pop af
ld [hOAMUpdate], a
ret
.Function64cd:
.LoadGFX:
call LoadFontsExtra
ld a, $90
ld [hWY], a
@@ -130,7 +131,7 @@ Function64bf:: ; 64bf
call LoadStandardFont
ret
Function64db: ; 64db
HDMATransfer_FillBGMap0WithTile60: ; 64db
ld a, [rSVBK]
push af
ld a, $6
@@ -138,7 +139,7 @@ Function64db: ; 64db
ld a, $60
ld hl, wDecompressScratch
ld bc, wBackupAttrMap - wDecompressScratch
ld bc, wScratchAttrMap - wDecompressScratch
call ByteFill
ld a, wDecompressScratch / $100
ld [rHDMA1], a
@@ -3354,7 +3355,7 @@ Function4e906: ; 4e906
ld a, $6
ld [rSVBK], a
ld hl, wDecompressScratch
ld bc, wBackupAttrMap - wDecompressScratch
ld bc, wScratchAttrMap - wDecompressScratch
ld a, " "
call ByteFill
hlbgcoord 0, 0

View File

@@ -47,7 +47,7 @@ Function17a6a8: ; 17a6a8 (5e:66a8)
call Function17aba0
callba Function106464
call Function17ac0c
callba Function104000
callba HDMATransferAttrMapAndTileMapToWRAMBank3
call Function17abcf
callba LoadOW_BGPal7
callba Function49420
@@ -169,7 +169,7 @@ Function17a78f: ; 17a78f (5e:678f)
bit 7, [hl]
res 7, [hl]
jr nz, .asm_17a79f
callba Function10402d
callba HDMATransferTileMapToWRAMBank3
ret
.asm_17a79f

File diff suppressed because it is too large Load Diff

View File

@@ -359,7 +359,7 @@ Function48304: ; 48304 (12:4304)
ld a, $29
.asm_4833f
ld [wMenuScrollPosition], a
callba Function104148
callba Mobile_OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
.asm_48348
call ScrollingMenu
ld de, $629
@@ -385,7 +385,7 @@ Function48304: ; 48304 (12:4304)
ld [wd003], a
.asm_48377
call Function48187
callba Function104148
callba Mobile_OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
jp Function4840c
Function48383: ; 48383 (12:4383)

Some files were not shown because too many files have changed in this diff Show More