engine/events.asm labels finished

fixed palred/green/blue macros
This commit is contained in:
pikalaxalt 2016-05-17 08:40:42 -04:00
parent 2eeb78d1bc
commit 98f443f70c
9 changed files with 65 additions and 71 deletions

View File

@ -167,10 +167,10 @@ HandleMap: ; 96773
cp 2 ; HandleMap cp 2 ; HandleMap
ret nz ret nz
call Function967d1 call HandleMapObjects
call NextOverworldFrame call NextOverworldFrame
call Function967e1 call HandleMapBackground
call Function967f4 call CheckPlayerState
ret ret
; 96795 ; 96795
@ -226,21 +226,21 @@ HandleMapTimeAndJoypad: ; 967c1
ret ret
; 967d1 ; 967d1
Function967d1: ; 967d1 HandleMapObjects: ; 967d1
callba HandleNPCStep ; engine/map_objects.asm callba HandleNPCStep ; engine/map_objects.asm
callba _HandlePlayerStep callba _HandlePlayerStep
call _CheckObjectEnteringVisibleRange call _CheckObjectEnteringVisibleRange
ret ret
; 967e1 ; 967e1
Function967e1: ; 967e1 HandleMapBackground: ; 967e1
callba _UpdateSprites callba _UpdateSprites
callba ScrollScreen callba ScrollScreen
callba PlaceMapNameSign callba PlaceMapNameSign
ret ret
; 967f4 ; 967f4
Function967f4: ; 967f4 CheckPlayerState: ; 967f4
ld a, [wPlayerStepFlags] ld a, [wPlayerStepFlags]
bit 5, a ; in the middle of step bit 5, a ; in the middle of step
jr z, .events jr z, .events

View File

@ -458,7 +458,7 @@ HandleQueuedCommand: ; 97e79
.okay .okay
ld e, a ld e, a
ld d, 0 ld d, 0
ld hl, .Jumptable_ba ld hl, .Jumptable
add hl, de add hl, de
add hl, de add hl, de
add hl, de add hl, de
@ -472,7 +472,7 @@ HandleQueuedCommand: ; 97e79
ret ret
; 97e94 ; 97e94
.Jumptable_ba: ; 97e94 .Jumptable: ; 97e94
dba CmdQueue_Null dba CmdQueue_Null
dba CmdQueue_Null2 dba CmdQueue_Null2
dba CmdQueue_StoneTable dba CmdQueue_StoneTable
@ -531,9 +531,9 @@ CmdQueue_Type4: ; 97ebc
ld a, [hl] ld a, [hl]
dec a dec a
ld [hl], a ld [hl], a
jr z, .asm_97eee jr z, .finish
and $1 and $1
jr z, .asm_97ee4 jr z, .add
ld hl, 2 ld hl, 2
add hl, bc add hl, bc
ld a, [hSCY] ld a, [hSCY]
@ -541,7 +541,7 @@ CmdQueue_Type4: ; 97ebc
ld [hSCY], a ld [hSCY], a
ret ret
.asm_97ee4 .add
ld hl, 2 ld hl, 2
add hl, bc add hl, bc
ld a, [hSCY] ld a, [hSCY]
@ -549,7 +549,7 @@ CmdQueue_Type4: ; 97ebc
ld [hSCY], a ld [hSCY], a
ret ret
.asm_97eee .finish
ld hl, 4 ld hl, 4
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]

View File

@ -276,13 +276,13 @@ CheckForHiddenItems: ; b8172
; Checks to see if there are hidden items on the screen that have not yet been found. If it finds one, returns carry. ; Checks to see if there are hidden items on the screen that have not yet been found. If it finds one, returns carry.
call GetMapScriptHeaderBank call GetMapScriptHeaderBank
ld [Buffer1], a ld [Buffer1], a
; Get the coordinate of the bottom right corner of the screen, and load it in wd1ec/wd1ed. ; Get the coordinate of the bottom right corner of the screen, and load it in Buffer3/Buffer4.
ld a, [XCoord] ld a, [XCoord]
add SCREEN_WIDTH / 4 add SCREEN_WIDTH / 4
ld [wd1ed], a ld [Buffer4], a
ld a, [YCoord] ld a, [YCoord]
add SCREEN_HEIGHT / 4 add SCREEN_HEIGHT / 4
ld [wd1ec], a ld [Buffer3], a
; Get the pointer for the first signpost header in the map... ; Get the pointer for the first signpost header in the map...
ld hl, wCurrentMapSignpostHeaderPointer ld hl, wCurrentMapSignpostHeaderPointer
ld a, [hli] ld a, [hli]
@ -301,7 +301,7 @@ CheckForHiddenItems: ; b8172
call .GetFarByte call .GetFarByte
ld e, a ld e, a
; Is the Y coordinate of the signpost on the screen? If not, go to the next signpost. ; Is the Y coordinate of the signpost on the screen? If not, go to the next signpost.
ld a, [wd1ec] ld a, [Buffer3]
sub e sub e
jr c, .next jr c, .next
cp SCREEN_HEIGHT / 2 cp SCREEN_HEIGHT / 2
@ -309,7 +309,7 @@ CheckForHiddenItems: ; b8172
; Is the X coordinate of the signpost on the screen? If not, go to the next signpost. ; Is the X coordinate of the signpost on the screen? If not, go to the next signpost.
call .GetFarByte call .GetFarByte
ld d, a ld d, a
ld a, [wd1ed] ld a, [Buffer4]
sub d sub d
jr c, .next jr c, .next
cp SCREEN_WIDTH / 2 cp SCREEN_WIDTH / 2

View File

@ -258,8 +258,8 @@ MapSetupCommands: ; 15440
dba LoadMapPalettes ; 11 dba LoadMapPalettes ; 11
dba LoadWildMonData ; 12 dba LoadWildMonData ; 12
dba RefreshMapSprites ; 13 dba RefreshMapSprites ; 13
dba RunCallback_05_03 ; 14 dba HandleNewMap ; 14
dba RunCallback_03 ; 15 dba InitCommandQueue ; 15
dba LoadObjectsRunCallback_02 ; 16 dba LoadObjectsRunCallback_02 ; 16
dba LoadSpawnPoint ; 17 dba LoadSpawnPoint ; 17
dba EnterMapConnection ; 18 dba EnterMapConnection ; 18

View File

@ -694,9 +694,9 @@ Pokedex_UpdateSearchScreen: ; 40471 (10:4471)
.show_search_results .show_search_results
ld [wDexListingEnd], a ld [wDexListingEnd], a
ld a, [wDexListingScrollOffset] ld a, [wDexListingScrollOffset]
ld [wc7e0], a ld [wDexListingScrollOffsetBackup], a
ld a, [wDexListingCursor] ld a, [wDexListingCursor]
ld [wc7e1], a ld [wDexListingCursorBackup], a
ld a, [wLastDexEntry] ld a, [wLastDexEntry]
ld [wcf65], a ld [wcf65], a
xor a xor a
@ -777,9 +777,9 @@ Pokedex_UpdateSearchResultsScreen: ; 40562 (10:4562)
ret ret
.return_to_search_screen .return_to_search_screen
ld a, [wc7e0] ld a, [wDexListingScrollOffsetBackup]
ld [wDexListingScrollOffset], a ld [wDexListingScrollOffset], a
ld a, [wc7e1] ld a, [wDexListingCursorBackup]
ld [wDexListingCursor], a ld [wDexListingCursor], a
ld a, [wcf65] ld a, [wcf65]
ld [wLastDexEntry], a ld [wLastDexEntry], a

View File

@ -1,5 +1,5 @@
RunCallback_05_03: ; 1045b0 HandleNewMap: ; 1045b0
call Clearwc7e8 call Clearwc7e8
call ResetMapBufferEventFlags call ResetMapBufferEventFlags
call ResetFlashIfOutOfCave call ResetFlashIfOutOfCave
@ -7,7 +7,7 @@ RunCallback_05_03: ; 1045b0
call ResetBikeFlags call ResetBikeFlags
ld a, MAPCALLBACK_NEWMAP ld a, MAPCALLBACK_NEWMAP
call RunMapCallback call RunMapCallback
RunCallback_03: ; 1045c4 InitCommandQueue: ; 1045c4
callba ClearCmdQueue callba ClearCmdQueue
ld a, MAPCALLBACK_CMDQUEUE ld a, MAPCALLBACK_CMDQUEUE
call RunMapCallback call RunMapCallback
@ -20,18 +20,16 @@ EnterMapConnection: ; 1045d6
; Return carry if a connection has been entered. ; Return carry if a connection has been entered.
ld a, [wPlayerStepDirection] ld a, [wPlayerStepDirection]
and a and a
jp z, EnterSouthConnection jp z, .south
cp 1 cp UP
jp z, EnterNorthConnection jp z, .north
cp 2 cp LEFT
jp z, EnterWestConnection jp z, .west
cp 3 cp RIGHT
jp z, EnterEastConnection jp z, .east
ret ret
; 1045ed
.west
EnterWestConnection: ; 1045ed
ld a, [WestConnectedMapGroup] ld a, [WestConnectedMapGroup]
ld [MapGroup], a ld [MapGroup], a
ld a, [WestConnectedMapNumber] ld a, [WestConnectedMapNumber]
@ -64,11 +62,9 @@ EnterWestConnection: ; 1045ed
ld [wOverworldMapAnchor], a ld [wOverworldMapAnchor], a
ld a, h ld a, h
ld [wOverworldMapAnchor + 1], a ld [wOverworldMapAnchor + 1], a
jp EnteredConnection jp .done
; 104629
.east
EnterEastConnection: ; 104629
ld a, [EastConnectedMapGroup] ld a, [EastConnectedMapGroup]
ld [MapGroup], a ld [MapGroup], a
ld a, [EastConnectedMapNumber] ld a, [EastConnectedMapNumber]
@ -85,27 +81,25 @@ EnterEastConnection: ; 104629
ld h, [hl] ld h, [hl]
ld l, a ld l, a
srl c srl c
jr z, .skip_to_load jr z, .skip_to_load2
ld a, [EastConnectedMapWidth] ld a, [EastConnectedMapWidth]
add 6 add 6
ld e, a ld e, a
ld d, 0 ld d, 0
.loop .loop2
add hl, de add hl, de
dec c dec c
jr nz, .loop jr nz, .loop2
.skip_to_load .skip_to_load2
ld a, l ld a, l
ld [wOverworldMapAnchor], a ld [wOverworldMapAnchor], a
ld a, h ld a, h
ld [wOverworldMapAnchor + 1], a ld [wOverworldMapAnchor + 1], a
jp EnteredConnection jp .done
; 104665
.north
EnterNorthConnection: ; 104665
ld a, [NorthConnectedMapGroup] ld a, [NorthConnectedMapGroup]
ld [MapGroup], a ld [MapGroup], a
ld a, [NorthConnectedMapNumber] ld a, [NorthConnectedMapNumber]
@ -128,11 +122,9 @@ EnterNorthConnection: ; 104665
ld [wOverworldMapAnchor], a ld [wOverworldMapAnchor], a
ld a, h ld a, h
ld [wOverworldMapAnchor + 1], a ld [wOverworldMapAnchor + 1], a
jp EnteredConnection jp .done
; 104696
.south
EnterSouthConnection: ; 104696
ld a, [SouthConnectedMapGroup] ld a, [SouthConnectedMapGroup]
ld [MapGroup], a ld [MapGroup], a
ld a, [SouthConnectedMapNumber] ld a, [SouthConnectedMapNumber]
@ -155,10 +147,7 @@ EnterSouthConnection: ; 104696
ld [wOverworldMapAnchor], a ld [wOverworldMapAnchor], a
ld a, h ld a, h
ld [wOverworldMapAnchor + 1], a ld [wOverworldMapAnchor + 1], a
; fallthrough .done
; 1046c4
EnteredConnection: ; 1046c4
scf scf
ret ret
; 1046c6 ; 1046c6
@ -239,11 +228,11 @@ LoadMapTimeOfDay: ; 104750
callba ReplaceTimeOfDayPals callba ReplaceTimeOfDayPals
callba UpdateTimeOfDayPal callba UpdateTimeOfDayPal
call OverworldTextModeSwitch call OverworldTextModeSwitch
call Function104770 call .ClearBGMap
call Function1047a3 call .PushAttrMap
ret ret
Function104770: ; 104770 (41:4770) .ClearBGMap: ; 104770 (41:4770)
ld a, VBGMap0 / $100 ld a, VBGMap0 / $100
ld [wBGMapAnchor + 1], a ld [wBGMapAnchor + 1], a
xor a xor a
@ -251,23 +240,27 @@ Function104770: ; 104770 (41:4770)
ld [hSCY], a ld [hSCY], a
ld [hSCX], a ld [hSCX], a
callba ApplyBGMapAnchorToObjects callba ApplyBGMapAnchorToObjects
ld a, [rVBK] ld a, [rVBK]
push af push af
ld a, $1 ld a, $1
ld [rVBK], a ld [rVBK], a
xor a xor a
ld bc, VBGMap1 - VBGMap0 ld bc, VBGMap1 - VBGMap0
hlbgcoord 0, 0 hlbgcoord 0, 0
call ByteFill call ByteFill
pop af pop af
ld [rVBK], a ld [rVBK], a
ld a, $60 ld a, $60
ld bc, VBGMap1 - VBGMap0 ld bc, VBGMap1 - VBGMap0
hlbgcoord 0, 0 hlbgcoord 0, 0
call ByteFill call ByteFill
ret ret
Function1047a3: ; 1047a3 (41:47a3) .PushAttrMap: ; 1047a3 (41:47a3)
decoord 0, 0 decoord 0, 0
call .copy call .copy
ld a, [hCGB] ld a, [hCGB]

View File

@ -257,9 +257,9 @@ debgcoord EQUS "bgcoord de,"
bcbgcoord EQUS "bgcoord bc," bcbgcoord EQUS "bgcoord bc,"
bgrows EQUS "* $20" bgrows EQUS "* $20"
palred EQUS "$0400 *" palred EQUS "$0001 *"
palgreen EQUS "$0020 *" palgreen EQUS "$0020 *"
palblue EQUS "$0001 *" palblue EQUS "$0400 *"
dsprite: MACRO dsprite: MACRO
; conditional segment is there because not every instance of ; conditional segment is there because not every instance of

View File

@ -5129,10 +5129,10 @@ LoadPoisonBGPals: ; cbcdd
ld hl, BGPals ld hl, BGPals
ld c, $20 ld c, $20
.loop .loop
; RGB 31, 21, 28 ; RGB 28, 21, 31
ld a, (palred 31 + palgreen 21 + palblue 28) % $100 ld a, (palred 28 + palgreen 21 + palblue 31) % $100
ld [hli], a ld [hli], a
ld a, (palred 31 + palgreen 21 + palblue 28) / $100 ld a, (palred 28 + palgreen 21 + palblue 31) / $100
ld [hli], a ld [hli], a
dec c dec c
jr nz, .loop jr nz, .loop
@ -5358,11 +5358,11 @@ RotateUnownFrontpic: ; e0000
ld hl, OverworldMap ld hl, OverworldMap
ld de, sScratch ld de, sScratch
ld bc, $31 tiles ld bc, 7 * 7 tiles
call CopyBytes call CopyBytes
pop hl pop hl
ld de, sScratch ld de, sScratch
ld c, $31 ld c, 7 * 7
ld a, [hROMBank] ld a, [hROMBank]
ld b, a ld b, a
call Get2bpp call Get2bpp
@ -5774,7 +5774,8 @@ DrawPokedexSearchResultsWindow: ; 1de1d1 (77:61d1)
.esults_D ; 1de23c .esults_D ; 1de23c
; (SEARCH R) ; (SEARCH R)
db "ESULTS<NEXT>" db "ESULTS"
next ""
; (### FOUN) ; (### FOUN)
next "D!@" next "D!@"

View File

@ -875,8 +875,8 @@ wUnlockedUnownMode:: ds 1
wDexCurrentUnownIndex:: ds 1 wDexCurrentUnownIndex:: ds 1
wDexUnownCount:: ds 1 wDexUnownCount:: ds 1
wDexConvertedMonType:: ds 1 ; mon type converted from dex search mon type wDexConvertedMonType:: ds 1 ; mon type converted from dex search mon type
wc7e0:: ds 1 wDexListingScrollOffsetBackup:: ds 1
wc7e1:: ds 1 wDexListingCursorBackup:: ds 1
wBackupDexListingCursor:: wBackupDexListingCursor::
wc7e2:: ds 1 wc7e2:: ds 1
wBackupDexListingPage:: wBackupDexListingPage::
@ -896,7 +896,7 @@ ENDC
wMiscEnd:: wMiscEnd::
wc7e8:: ds 24 wc7e8:: ds 24 ; ????
SECTION "Overworld Map", WRAM0 [$c800] SECTION "Overworld Map", WRAM0 [$c800]
@ -1878,7 +1878,7 @@ UsedSpritesEnd::
wd154:: ; d154 wd154:: ; d154
ds 31 ; 64 ds 31 ; 64
wd173:: ds 1 wd173:: ds 1 ; related to command queue type 3
ds 13 ds 13
wd181:: ds 1 wd181:: ds 1
wd182:: ds 1 wd182:: ds 1