Skip to content

Commit

Permalink
Merge pull request #117 from kemenaran/bank37
Browse files Browse the repository at this point in the history
Add disassembly for bank 37 (photo pictures)
  • Loading branch information
kemenaran committed Sep 25, 2019
2 parents ffcdbf7 + cb5da9c commit 45aeed6
Show file tree
Hide file tree
Showing 11 changed files with 3,470 additions and 56 deletions.
2 changes: 1 addition & 1 deletion src/ROM map.md
Expand Up @@ -57,7 +57,7 @@
34 Graphics: printer UI
35 Graphics: Color dungeon
36 Entities code
37 Code
37 Photo pictures code
38 Graphics: large font, misc
39 Graphics: photo elements
3A Graphics: photo elements
Expand Down
7 changes: 3 additions & 4 deletions src/code/bank0.asm
Expand Up @@ -496,7 +496,8 @@ label_AF6::
call $7161
jp RestoreStackedBankAndReturn

label_B02::
; Save picture to photo album?
Func_03D_4029_trampoline::
ld a, $3D
ld [MBC3SelectBank], a
call $4029
Expand Down Expand Up @@ -1275,9 +1276,7 @@ PhotoAlbumHandler::
jp returnFromGameplayHandler

PhotoPictureHandler::
ld a, $37
call SwitchBank
jp $4000
jpsw PhotosEntryPoint

; World handler for GAMEPLAY_WORLD_DEFAULT (dispatched from WorldHandlerEntryPoint)
WorldDefaultHandler::
Expand Down
4 changes: 2 additions & 2 deletions src/code/bank2.asm
Expand Up @@ -6520,7 +6520,7 @@ CheckPositionForMapTransition::
;

; If Link is at the top of the room, TOP
ld e, ROOM_TRANSITION_DIR_TOP ; $6C99: $1E $02
ld e, DIRECTION_UP ; $6C99: $1E $02
ldh a, [hLinkPositionY] ; $6C9B: $F0 $99
cp $0C ; $6C9D: $FE $0C
jr c, .verticalTransition ; $6C9F: $38 $15
Expand All @@ -6531,7 +6531,7 @@ CheckPositionForMapTransition::
jr nc, .verticalTransition ; $6CA4: $30 $10

; If Link is on the left, LEFT
ld e, ROOM_TRANSITION_DIR_LEFT ; $6CA6: $1E $01
ld e, DIRECTION_LEFT ; $6CA6: $1E $01
ldh a, [hLinkPositionX] ; $6CA8: $F0 $98
cp $04 ; $6CAA: $FE $04
jr c, .horizontalTransition ; $6CAC: $38 $65
Expand Down
3,413 changes: 3,413 additions & 0 deletions src/code/photos.asm

Large diffs are not rendered by default.

74 changes: 37 additions & 37 deletions src/code/room_transition.asm
Expand Up @@ -113,7 +113,7 @@ ApplyRoomTransition::

; If the transition direction was to the bottom…
ld a, [wRoomTransitionDirection] ; $794F: $FA $25 $C1
cp ROOM_TRANSITION_DIR_BOTTOM ; $7952: $FE $03
cp DIRECTION_DOWN ; $7952: $FE $03
jr nz, .bottomDirectionEnd ; $7954: $20 $24

; Initiate a jump if Link landed on a ledge
Expand Down Expand Up @@ -239,38 +239,38 @@ ApplyRoomTransition::
ret ; $79D9: $C9

WindFishEggMazeSequence::
db ROOM_TRANSITION_DIR_LEFT
db ROOM_TRANSITION_DIR_LEFT
db ROOM_TRANSITION_DIR_TOP
db ROOM_TRANSITION_DIR_RIGHT
db ROOM_TRANSITION_DIR_RIGHT
db ROOM_TRANSITION_DIR_TOP
db ROOM_TRANSITION_DIR_LEFT
db ROOM_TRANSITION_DIR_TOP
db ROOM_TRANSITION_DIR_RIGHT
db ROOM_TRANSITION_DIR_TOP
db ROOM_TRANSITION_DIR_TOP
db ROOM_TRANSITION_DIR_RIGHT
db ROOM_TRANSITION_DIR_TOP
db ROOM_TRANSITION_DIR_TOP
db ROOM_TRANSITION_DIR_RIGHT
db ROOM_TRANSITION_DIR_TOP
db ROOM_TRANSITION_DIR_LEFT
db ROOM_TRANSITION_DIR_TOP
db ROOM_TRANSITION_DIR_RIGHT
db ROOM_TRANSITION_DIR_TOP
db ROOM_TRANSITION_DIR_LEFT
db ROOM_TRANSITION_DIR_TOP
db ROOM_TRANSITION_DIR_RIGHT
db ROOM_TRANSITION_DIR_TOP
db ROOM_TRANSITION_DIR_RIGHT
db ROOM_TRANSITION_DIR_RIGHT
db ROOM_TRANSITION_DIR_RIGHT
db ROOM_TRANSITION_DIR_RIGHT
db ROOM_TRANSITION_DIR_TOP
db ROOM_TRANSITION_DIR_TOP
db ROOM_TRANSITION_DIR_TOP
db ROOM_TRANSITION_DIR_TOP
db DIRECTION_LEFT
db DIRECTION_LEFT
db DIRECTION_UP
db DIRECTION_RIGHT
db DIRECTION_RIGHT
db DIRECTION_UP
db DIRECTION_LEFT
db DIRECTION_UP
db DIRECTION_RIGHT
db DIRECTION_UP
db DIRECTION_UP
db DIRECTION_RIGHT
db DIRECTION_UP
db DIRECTION_UP
db DIRECTION_RIGHT
db DIRECTION_UP
db DIRECTION_LEFT
db DIRECTION_UP
db DIRECTION_RIGHT
db DIRECTION_UP
db DIRECTION_LEFT
db DIRECTION_UP
db DIRECTION_RIGHT
db DIRECTION_UP
db DIRECTION_RIGHT
db DIRECTION_RIGHT
db DIRECTION_RIGHT
db DIRECTION_RIGHT
db DIRECTION_UP
db DIRECTION_UP
db DIRECTION_UP
db DIRECTION_UP

RoomTransitionPrepareHandler::
ld a, [wRoomTransitionDirection] ; $79FA: $FA $25 $C1
Expand Down Expand Up @@ -306,7 +306,7 @@ RoomTransitionPrepareHandler::

; … and is not sliding to the bottom…
ld a, c ; $7A1A: $79
cp ROOM_TRANSITION_DIR_BOTTOM ; $7A1B: $FE $03
cp DIRECTION_DOWN ; $7A1B: $FE $03
jr z, .noWindFishEggMaze ; $7A1D: $28 $29

; hl = WindFishEggMazeSequence + $DB7C
Expand Down Expand Up @@ -356,7 +356,7 @@ RoomTransitionPrepareHandler::

; If wRoomTransitionDirection == Top…
ld a, c ; $7A50: $79
cp ROOM_TRANSITION_DIR_TOP ; $7A51: $FE $02
cp DIRECTION_UP ; $7A51: $FE $02
jr nz, .noFaceShrineHack ; $7A53: $20 $12

; … and dungeon is Face Shrine…
Expand Down Expand Up @@ -392,7 +392,7 @@ RoomTransitionPrepareHandler::

; … and direction == top…
ld a, c ; $7A73: $79
cp ROOM_TRANSITION_DIR_TOP ; $7A74: $FE $02
cp DIRECTION_UP ; $7A74: $FE $02
jr nz, .mysteriousWoodsEnd ; $7A76: $20 $0C

; … Link got lost in the Mysterious Woods
Expand Down Expand Up @@ -427,7 +427,7 @@ RoomTransitionPrepareHandler::

; … and direction == top…
ld a, c ; $7A92: $79
cp ROOM_TRANSITION_DIR_TOP ; $7A93: $FE $02
cp DIRECTION_UP ; $7A93: $FE $02
jr nz, .forestRoomEnd ; $7A95: $20 $0E

; … and this room has not been visited yet…
Expand Down
1 change: 1 addition & 0 deletions src/constants/constants.asm
@@ -1,6 +1,7 @@
include "constants/animated_tiles.asm"
include "constants/charmap.asm"
include "constants/debug.asm"
include "constants/directions.asm"
include "constants/entities.asm"
include "constants/gameplay.asm"
include "constants/gbhw.asm"
Expand Down
7 changes: 7 additions & 0 deletions src/constants/directions.asm
@@ -0,0 +1,7 @@
; Used for:
; - hLinkDirection
; - wRoomTransitionDirection
DIRECTION_RIGHT EQU $00
DIRECTION_LEFT EQU $01
DIRECTION_UP EQU $02
DIRECTION_DOWN EQU $03
8 changes: 1 addition & 7 deletions src/constants/gameplay.asm
Expand Up @@ -43,7 +43,7 @@ GAMEPLAY_PHOTO_FISHERMAN equ $16
GAMEPLAY_PHOTO_ZORA equ $17
GAMEPLAY_PHOTO_KANALET equ $18
GAMEPLAY_PHOTO_GHOST equ $19
GAMEPLAY_PHOTO_BRIDGE equ $20
GAMEPLAY_PHOTO_BRIDGE equ $1A

; Values for wGameplaySubtype
; (depends on the gameplay type)
Expand Down Expand Up @@ -103,12 +103,6 @@ ROOM_TRANSITION_CONFIGURE_SCROLL equ $03
ROOM_TRANSITION_FIRST_HALF equ $04
ROOM_TRANSITION_SECOND_HALF equ $05

; Values for wRoomTransitionDirection
ROOM_TRANSITION_DIR_RIGHT equ $00
ROOM_TRANSITION_DIR_LEFT equ $01
ROOM_TRANSITION_DIR_TOP equ $02
ROOM_TRANSITION_DIR_BOTTOM equ $03

; Values for wDialogState
DIALOG_CLOSED equ $00
DIALOG_OPENING_1 equ $01
Expand Down
5 changes: 1 addition & 4 deletions src/constants/hram.asm
Expand Up @@ -55,10 +55,7 @@ hLinkAnimationState:: ; FF9D

hLinkDirection:: ; FF9E
; Direction Link is facing
; 0 Right
; 1 Left
; 2 Top
; 3 Down
; See DIRECTION_* constants for possible values
ds 1

hLinkFinalPositionX:: ; FF9F
Expand Down
2 changes: 1 addition & 1 deletion src/constants/wram.asm
Expand Up @@ -98,7 +98,7 @@ wRoomTransitionState:: ; C124
ds 1

wRoomTransitionDirection:: ; C125
; See ROOM_TRANSITION_DIR_* constants for possible values
; See DIRECTION_* constants for possible values
ds 1

wBGUpdateRegionOriginHigh:: ; C126
Expand Down
3 changes: 3 additions & 0 deletions src/main.asm
Expand Up @@ -300,6 +300,9 @@ incbin "gfx/world/color_dungeon.2bpp"
section "bank36",romx[$4000],bank[$36]
include "code/entities/bank36.asm"

section "bank37",romx[$4000],bank[$37]
include "code/photos.asm"

section "bank38",romx[$4000],bank[$38]
incbin "gfx/cgb_misc.2bpp"

Expand Down

0 comments on commit 45aeed6

Please sign in to comment.