Skip to content

Commit

Permalink
Merge pull request #216 from Xkeeper0/misc-improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
kemenaran authored Apr 21, 2020
2 parents 6951d4e + edd06b0 commit 332e5bd
Show file tree
Hide file tree
Showing 38 changed files with 4,156 additions and 3,041 deletions.
31 changes: 18 additions & 13 deletions src/code/bank0.asm
Original file line number Diff line number Diff line change
Expand Up @@ -5624,7 +5624,7 @@ LoadRoom::
ld a, [wTradeSequenceItem]
cp $0E ; Magnifying Glass
jr nz, .goriyaRoomEnd
ld bc, IndoorsAUnreferenced02
ld bc, IndoorsAF5Alt
jp .parseRoomHeader
.goriyaRoomEnd

Expand Down Expand Up @@ -5655,7 +5655,7 @@ LoadRoom::
ld a, [$D80E]
and ROOM_STATUS_CHANGED
jr z, .altRoomsEnd
ld bc, OverworldUnreferenced01 ; Eagle's Tower open
ld bc, Overworld0EAlt ; Eagle's Tower open
jr .loadBankForOverworldRooms
.endEaglesTowerAlt

Expand All @@ -5664,7 +5664,7 @@ LoadRoom::
ld a, [$D88C]
and ROOM_STATUS_CHANGED
jr z, .altRoomsEnd
ld bc, OverworldUnreferenced05 ; South Face Shrine open
ld bc, Overworld8CAlt ; South Face Shrine open
jr .loadBankForOverworldRooms
.endSouthFaceShrineAlt

Expand All @@ -5673,7 +5673,7 @@ LoadRoom::
ld a, [$D879]
and ROOM_STATUS_CHANGED
jr z, .altRoomsEnd
ld bc, OverworldUnreferenced04 ; Upper Tal Tal Heights dry
ld bc, Overworld79Alt ; Kanalet Castle open
jr .loadBankForOverworldRooms
.endUpperTalTalHeightsAlt

Expand All @@ -5682,7 +5682,7 @@ LoadRoom::
ld a, [$D806]
and ROOM_STATUS_CHANGED
jr z, .altRoomsEnd
ld bc, OverworldUnreferenced00 ; Windfish's Egg open
ld bc, Overworld06Alt ; Windfish's Egg open
jr .loadBankForOverworldRooms
.endWindfishsEggAlt

Expand All @@ -5691,7 +5691,7 @@ LoadRoom::
ld a, [$D82B]
and ROOM_STATUS_CHANGED
jr z, .altRoomsEnd
ld bc, OverworldUnreferenced02 ; Tal Tal Heights dry
ld bc, Overworld1BAlt ; Angler's Tunnel upper water dry
jr .loadBankForOverworldRooms
.endTalTalHeightsAlt

Expand All @@ -5700,7 +5700,7 @@ LoadRoom::
ld a, [$D82B]
and ROOM_STATUS_CHANGED
jr z, .altRoomsEnd
ld bc, OverworldUnreferenced03 ; Angler's Tunnel open
ld bc, Overworld2BAlt ; Angler's Tunnel open
jr .loadBankForOverworldRooms

.altRoomsEnd
Expand Down Expand Up @@ -6119,6 +6119,11 @@ LoadRoomObject::
; clear wObjectAffectingBGPalette
xor a
ld [wObjectAffectingBGPalette], a
; POI: Potential bug: Room $1C4 (IndoorA) is the Face Shrine pre-boss room
; where you can light two torches to trigger an event. However,
; room $2C4 (IndoorB) *also* has an unlit torch. This causes some
; weird palette flickering, though $2C4 and $2D4 are inaccessible
; (part of an old Kanalet Castle entry before the side-scrolling stuff)
; If the room is $C4…
ldh a, [hMapRoom]
cp $C4
Expand Down Expand Up @@ -6299,7 +6304,7 @@ LoadRoomObject::
; Raised fences can be activated: they turn into a wall
; jumpable from the top.
;
; NB: it seems these objects are not used in the final game.
; POI: NB: it seems these objects are not used in the final game.
;

cp OBJECT_RAISED_FENCE_BOTTOM
Expand Down Expand Up @@ -6434,24 +6439,24 @@ label_3500::
cp $09
jr nz, label_350E
ldh a, [hMapRoom]
cp $97
cp $97 ; Room with the giant bombable skull thing
ret nz
jr label_3527

label_350E::
cp $E1
jr nz, label_351D
ldh a, [hMapRoom]
cp $0E
cp $0E ; Eagle's Tower room
ret z
cp $0C
cp $0C ; Tal-Tal Heights, 1N1E of the drainable water above Angler's Tunnel
ret z
cp $1B
cp $1B ; The drainable water above Angler's Tunnel
ret z

label_351D::
ldh a, [hMapRoom]
cp $80
cp $80 ; Mysterious Forest enterance from Mabe (?)
jr nc, label_3527
ld a, $09
jr label_3529
Expand Down
169 changes: 111 additions & 58 deletions src/code/bank1.asm
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,50 @@ label_41BB::
include "code/game_over.asm"
include "code/world_handler.asm"

label_4667::
db 4, 1, 2, 3, 5, 6, 7, 8, 9, $A, $B, $C, 1, 1, 1, 0
db 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2
db 1, 1, 1, 1, 3, 1, 1, 1, 1, 4, 1, 1, 1, 1, 5, 1
db 1, 1, 1, 6, 1, 1, 1, 1, 7, 1, 1, 1, 1, 8, 1, 1
db 1, 1, 9
DebugSaveFileData::
db INVENTORY_SHIELD ; B button
db INVENTORY_SWORD ; A button
db INVENTORY_BOMBS ; Inventory slots
db INVENTORY_POWER_BRACELET ; .
db INVENTORY_BOW ; .
db INVENTORY_HOOKSHOT ; .
db INVENTORY_MAGIC_ROD ; .
db INVENTORY_PEGASUS_BOOTS ; .
db INVENTORY_OCARINA ; .
db INVENTORY_ROCS_FEATHER ; .
db INVENTORY_SHOVEL ; .
db INVENTORY_MAGIC_POWDER ; .

db 1 ; Have Flippers
db 1 ; Have Medicine
db 1 ; Trading item = Yoshi doll
db 0 ; 0 Secret Seashells
db 0 ; (@TODO "Medicine count: found?")
db 1 ; Have Tail Key
db 1 ; Have Angler Key
db 1 ; Have Face Key
db 1 ; Have Bird Key
db 0 ; 0 Golden Leaves / no Slime Key

; Dungeon flags ...
; +-------------- Map
; | +----------- Compass
; | | +-------- Owl Beak / Stone Tablet
; | | | +----- Nightmare Key
; | | | | +-- Small keys
; | | | | |
db 1, 1, 1, 1, 1 ; Tail Cave
db 1, 1, 1, 1, 2 ; Bottle Grotto
db 1, 1, 1, 1, 3 ; Key Cavern
db 1, 1, 1, 1, 4 ; Angler's Tunnel
db 1, 1, 1, 1, 5 ; Catfish's Maw
db 1, 1, 1, 1, 6 ; Face Shrine
db 1, 1, 1, 1, 7 ; Eagle's Tower
db 1, 1, 1, 1, 8 ; Turtle Rock
db 1, 1, 1, 1, 9 ; POI: unused? (9th dungeon?)

DEBUG_SAVE_FILE_SIZE equ @ - DebugSaveFileData


; Initialize save files, and load debug save file if needed
InitSaveFiles::
Expand All @@ -215,7 +253,7 @@ InitSaveFiles::
ld de, $75A
call label_4794

; If DebugTool1 is enabled,
; POI: If DebugTool1 is enabled,
; write a default save file with everything unlocked
ld a, [ROM_DebugTool1]
and a
Expand All @@ -225,84 +263,89 @@ InitSaveFiles::
ld d, $00
ld bc, $A405
.loop
ld hl, label_4667
ld hl, DebugSaveFileData
add hl, de
ld a, [hli]
ld [bc], a
inc bc
inc e
ld a, e
cp $43
cp DEBUG_SAVE_FILE_SIZE
jr nz, .loop

; Set some other parts of the first save file ...
ld a, $01
ld [$A453], a
ld [$A453], a ; Sword level 1
ld a, $01
ld [$A449], a
ld [$A449], a ; Shield level 1
ld a, $02
ld [$A448], a
ld [$A448], a ; Power bracelet level 2

ld hl, $A46A
ld e, $09
ld a, $02
; Set boss flags for all dungeons
ld hl, $A46A ; Dungeon boss flags = 00000010
ld e, $09 ; POI: Sets 9 flags (but only 8 dungeons...?)
ld a, $02 ; Sets 46A~447
.loop2
ldi [hl], a
dec e
jr nz, .loop2

ld a, $60
ld [$A452], a
ld [$A47D], a
ld [$A47C], a
ld [$A44A], a
ld [$A452], a ; 60 bombs
ld [$A47D], a ; 60 max arrows
ld [$A47C], a ; 60 max bombs
ld [$A44A], a ; 60 arrows
ld a, $40
ld [$A47B], a
ld [$A451], a
ld [$A47B], a ; 40 max magic powder
ld [$A451], a ; 40 magic powder
ld a, $89
ld [$A44C], a
ld [$A44C], a ; "time/animation?" (unknown)
xor a
ld [$A414], a
ld a, $07
ld [$A44E], a
ld [$A414], a ; 0 secret seashells
ld a, %00000111 ; @TODO Ocarina song constants?
ld [$A44E], a ; all 3 Ocarina songs
ld a, $05
ld [$A462], a
ld [$A462], a ; 5xx rupees
ld a, $09
ld [$A463], a
ld [$A463], a ; x09 rupees
ld a, $01
ld [$A44D], a
ld [$A44D], a ; "Tarin at home flag"
ld a, $50
ld [$A45F], a
ld [$A45F], a ; 10 hearts of health
ld a, $0A
ld [$A460], a
ld [$A460], a ; 10 heart containers

ld a, [wGameplayType]
cp GAMEPLAY_FILE_NEW
PUSHC
SETCHARMAP NameEntryCharmap
jr z, .notOnNewFileScreen
ld a, $5B
ld a, "Z" ; Set save file name to "ZELDA"
ld [$A454], a
ld a, $46
ld a, "E"
ld [$A455], a
ld a, $4D
ld a, "L"
ld [$A456], a
ld a, $45
ld a, "D"
ld [$A457], a
ld a, $42
ld a, "A"
ld [$A458], a

POPC
.notOnNewFileScreen
xor a
ld [$A45C], a
ld [$A45D], a
ld [$A45B], a
ld [$A464], a
ld [$A465], a
ld [$A45C], a ; death counter = 0
ld [$A45D], a ; death counter = 0
ld [$A45B], a ; bowwow flag = off
ld [$A464], a ; current map = overworld
ld [$A465], a ; current submap = none
ld a, $92
ld [$A466], a
ld [$A466], a ; saved room = flying rooster in mabe village
ld a, $48
ld [$A467], a
ld [$A467], a ; saved y position
ld a, $62
ld [$A468], a
ld [$A468], a ; saved x position

; Set all overworld map tiles as seen (80)
ld hl, $A105
ld a, $80
ld e, $00
Expand Down Expand Up @@ -2880,10 +2923,12 @@ CreateFollowingNpcEntity::
cp MAP_CAVE_B
ret c
; Exclude some rooms
; POI: Curiously, these should be excluded by the
; check against side-scrolling rooms...
ldh a, [hMapRoom]
cp $FD
cp $FD ; Mambo the Sun Fish
ret z
cp $B1
cp $B1 ; Fishing minigame
ret z
.excludedRoomsEnd

Expand Down Expand Up @@ -3809,9 +3854,17 @@ LoadSirenInstrumentTiles::

; Coordinates of the borders surrounding the room objects
RoomBorderCoordinates::
db $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0A, $0B, $10, $1B, $20, $2B
db $30, $3B, $40, $4B, $50, $5B, $60, $6B, $70, $7B, $80, $8B, $90, $91, $92, $93
db $94, $95, $96, $97, $98, $99, $9A, $9B, $FF
db $00, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0A, $0B
db $10, $1B
db $20, $2B
db $30, $3B
db $40, $4B
db $50, $5B
db $60, $6B
db $70, $7B
db $80, $8B
db $90, $91, $92, $93, $94, $95, $96, $97, $98, $99, $9A, $9B
db $FF

; Surround the objects area defining a room by ROOM_BORDER values
PadRoomObjectsArea::
Expand Down Expand Up @@ -3910,22 +3963,22 @@ incbin "src/gfx/intro/rain.2bpp"

; Background tile where the Dungeon entrance arrow should be displayed
MinimapEntrancePosition::
dw vBGMap1 + $20E ; Dungeon 1
dw vBGMap1 + $20D ; Dungeon 2
dw vBGMap1 + $20C ; Dungeon 3
dw vBGMap1 + $20E ; Dungeon 4
dw vBGMap1 + $212 ; Dungeon 5
dw vBGMap1 + $20E ; Dungeon 6
dw vBGMap1 + $20C ; Dungeon 7
dw vBGMap1 + $20E ; Dungeon 8
dw vBGMap1 + $20B + MINIMAP_ARROW_TAIL_CAVE
dw vBGMap1 + $20B + MINIMAP_ARROW_BOTTLE_GROTTO
dw vBGMap1 + $20B + MINIMAP_ARROW_KEY_CAVERN
dw vBGMap1 + $20B + MINIMAP_ARROW_ANGLERS_TUNNEL
dw vBGMap1 + $20B + MINIMAP_ARROW_CATFISHS_MAW
dw vBGMap1 + $20B + MINIMAP_ARROW_FACE_SHRINE
dw vBGMap1 + $20B + MINIMAP_ARROW_EAGLES_TOWER
dw vBGMap1 + $20B + MINIMAP_ARROW_TURTLE_ROCK
dw $0 ; (unused)
dw $0 ; (unused)
dw $0 ; (unused)
dw $0 ; (unused)
dw $0 ; (unused)
dw $0 ; (unused)
dw $0 ; (unused)
dw vBGMap1 + $20D ; Color Dungeon
dw vBGMap1 + $20B + MINIMAP_ARROW_COLOR_DUNGEON

; Called after tiles are copied to the BG when loading a map all at once
UpdateMinimapEntranceArrowAndReturn::
Expand Down
Loading

0 comments on commit 332e5bd

Please sign in to comment.