Skip to content

Commit

Permalink
Document and label level object handling routines
Browse files Browse the repository at this point in the history
  • Loading branch information
ElectroDeoxys committed May 16, 2024
1 parent 133a3cd commit 624a861
Show file tree
Hide file tree
Showing 81 changed files with 344 additions and 335 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
20 changes: 11 additions & 9 deletions src/engine/bank2.asm
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Func_8e06::
; outputs BG pointer to hl and wBGPtr
GetWarioBGPtr::
ld a, [wWarioYPos + 1]
sub $18
ld l, a
Expand Down Expand Up @@ -34,11 +35,12 @@ ENDR
ld h, HIGH(v0BGMap0)
add hl, de
ld a, h
ld [wccf0 + 0], a
ld [wBGPtr + 0], a
ld a, l
ld [wccf0 + 1], a
ld [wBGPtr + 1], a
ret

; outputs BG pointer to hl and wBGPtr
Func_8e5b:
ld a, [wc0a3 + 0]
ld h, a
Expand Down Expand Up @@ -71,9 +73,9 @@ ENDR
ld h, HIGH(v0BGMap0)
add hl, de
ld a, h
ld [wccf0 + 0], a
ld [wBGPtr + 0], a
ld a, l
ld [wccf0 + 1], a
ld [wBGPtr + 1], a
ret

; unreferenced
Expand Down Expand Up @@ -143,23 +145,23 @@ Func_8ed9:
call .Func_9085
ld hl, wc0bb
res 3, [hl]
farcall Func_d186
farcall SpawnColEdgeObjects
ret

.asm_8f11
call .Func_8fb3
call .Func_9085
ld hl, wc0bb
res 2, [hl]
farcall Func_d186
farcall SpawnColEdgeObjects
ret

.asm_8f2c
call .Func_8fec
call Func_a0e2
ld hl, wc0bb
res 0, [hl]
farcall Func_d11a
farcall SpawnRowEdgeObjects
ld a, [wc0bb]
bit 2, a
jr nz, .asm_8f11
Expand All @@ -172,7 +174,7 @@ Func_8ed9:
call Func_a0e2
ld hl, wc0bb
res 1, [hl]
farcall Func_d11a
farcall SpawnRowEdgeObjects
ld a, [wc0bb]
bit 2, a
jr nz, .asm_8f11
Expand Down
119 changes: 0 additions & 119 deletions src/engine/bank3.asm
Original file line number Diff line number Diff line change
@@ -1,122 +1,3 @@
Func_d11a:
ld a, [wLevelEndScreen]
and a
ret nz
ld hl, wc0a3
call GetBlockPtr
ld a, [wBlockPtrBank]
sramswitch
call .Func_d132 ; can be fallthrough
ret

.Func_d132:
ld e, $0c
.asm_d134
bit 7, [hl]
jr z, .asm_d16d
push hl
call Func_d8c
ld a, [hl]
bit 0, b
jr z, .asm_d143
swap a
.asm_d143
and $0f
ld c, a
pop hl
jr z, .asm_d16d
push de
push bc
call Func_d3e
ld d, h
ld e, l
push hl
ldh a, [rSVBK]
push af
ld a, $01
ldh [rSVBK], a
farcall SpawnObject
pop af
ldh [rSVBK], a
pop hl
pop bc
pop de
.asm_d16d
inc h
ld a, h
cp $c0
jr nz, .asm_d182
ld h, $a0
ld a, [wBlockPtrBank]
inc a
ld [wBlockPtrBank], a
sramswitch
.asm_d182
dec e
jr nz, .asm_d134
ret

Func_d186:
ld a, [wLevelEndScreen]
and a
ret nz
ld hl, wc0a3
call GetBlockPtr
ld a, [wBlockPtrBank]
sramswitch
call Func_d19e
ret

Func_d19e:
ld e, $0d
.asm_d1a0
bit 7, [hl]
jr z, .asm_d1d9
push hl
call Func_d8c
ld a, [hl]
bit 0, b
jr z, .asm_d1af
swap a
.asm_d1af
and $0f
ld c, a
pop hl
jr z, .asm_d1d9
push de
push bc
call Func_d3e
ld d, h
ld e, l
push hl
ldh a, [rSVBK]
push af
ld a, $01
ldh [rSVBK], a
farcall SpawnObject
pop af
ldh [rSVBK], a
pop hl
pop bc
pop de
.asm_d1d9
ld a, b
xor $01
ld b, a
inc l
dec e
jr nz, .asm_d1a0
ret

LoadLevelCommonGfxAndTreasures:
ld hl, LevelsCommonGfx
ld de, v0Tiles1
ld bc, $800
call CopyHLToDE_BC

farcall LoadLevelTreasureData
ret

Pals_d1fe:
rgb 0, 22, 16
rgb 28, 31, 29
Expand Down
140 changes: 70 additions & 70 deletions src/engine/bank30.asm
Original file line number Diff line number Diff line change
Expand Up @@ -321,110 +321,110 @@ LevelHeaders::
dw NULL

.out_of_the_woods
dab OutOfTheWoodsLayout
dw OutOfTheWoodsObjectsMap
dab OutOfTheWoodsBlockMap
dw OutOfTheWoodsObjectMap
.the_peaceful_village_1
dab ThePeacefulVillage1Layout
dw ThePeacefulVillage1ObjectsMap
dab ThePeacefulVillage1BlockMap
dw ThePeacefulVillage1ObjectMap
.the_vast_plain_1
dab TheVastPlain1Layout
dw TheVastPlain1ObjectsMap
dab TheVastPlain1BlockMap
dw TheVastPlain1ObjectMap
.bank_of_the_wild_river
dab BankOfTheWildRiverLayout
dw BankOfTheWildRiverObjectsMap
dab BankOfTheWildRiverBlockMap
dw BankOfTheWildRiverObjectMap
.the_tidal_coast_1
dab TheTidalCoast1Layout
dw TheTidalCoast1ObjectsMap
dab TheTidalCoast1BlockMap
dw TheTidalCoast1ObjectMap
.sea_turtle_rocks
dab SeaTurtleRocksLayout
dw SeaTurtleRocksObjectsMap
dab SeaTurtleRocksBlockMap
dw SeaTurtleRocksObjectMap
.desert_ruins
dab DesertRuinsLayout
dw DesertRuinsObjectsMap
dab DesertRuinsBlockMap
dw DesertRuinsObjectMap
.the_volcanos_base_1
dab TheVolcanosBase1Layout
dw TheVolcanosBase1ObjectsMap
dab TheVolcanosBase1BlockMap
dw TheVolcanosBase1ObjectMap
.the_pool_of_rain_1
dab ThePoolOfRain1Layout
dw ThePoolOfRain1ObjectsMap
dab ThePoolOfRain1BlockMap
dw ThePoolOfRain1ObjectMap
.a_town_in_chaos
dab ATownInChaosLayout
dw ATownInChaosObjectsMap
dab ATownInChaosBlockMap
dw ATownInChaosObjectMap
.beneath_the_waves
dab BeneathTheWavesLayout
dw BeneathTheWavesObjectsMap
dab BeneathTheWavesBlockMap
dw BeneathTheWavesObjectMap
.the_west_crater
dab TheWestCraterLayout
dw TheWestCraterObjectsMap
dab TheWestCraterBlockMap
dw TheWestCraterObjectMap
.the_grasslands
dab TheGrasslandsLayout
dw TheGrasslandsObjectsMap
dab TheGrasslandsBlockMap
dw TheGrasslandsObjectMap
.the_big_bridge
dab TheBigBridgeLayout
dw TheBigBridgeObjectsMap
dab TheBigBridgeBlockMap
dw TheBigBridgeObjectMap
.tower_of_revival
dab TowerOfRevivalLayout
dw TowerOfRevivalObjectsMap
dab TowerOfRevivalBlockMap
dw TowerOfRevivalObjectMap
.the_steep_canyon_1
dab TheSteepCanyon1Layout
dw TheSteepCanyon1ObjectsMap
dab TheSteepCanyon1BlockMap
dw TheSteepCanyon1ObjectMap
.cave_of_flames
dab CaveOfFlamesLayout
dw CaveOfFlamesObjectsMap
dab CaveOfFlamesBlockMap
dw CaveOfFlamesObjectMap
.above_the_clouds_1
dab AboveTheClouds1Layout
dw AboveTheClouds1ObjectsMap
dab AboveTheClouds1BlockMap
dw AboveTheClouds1ObjectMap
.the_stagnant_swamp_1
dab TheStagnantSwamp1Layout
dw TheStagnantSwamp1ObjectsMap
dab TheStagnantSwamp1BlockMap
dw TheStagnantSwamp1ObjectMap
.the_frigid_sea
dab TheFrigidSeaLayout
dw TheFrigidSeaObjectsMap
dab TheFrigidSeaBlockMap
dw TheFrigidSeaObjectMap
.castle_of_illusions
dab CastleOfIllusionsLayout
dw CastleOfIllusionsObjectsMap
dab CastleOfIllusionsBlockMap
dw CastleOfIllusionsObjectMap
.the_colossal_hole_1
dab TheColossalHole1Layout
dw TheColossalHole1ObjectsMap
dab TheColossalHole1BlockMap
dw TheColossalHole1ObjectMap
.the_warped_void
dab TheWarpedVoidLayout
dw TheWarpedVoidObjectsMap
dab TheWarpedVoidBlockMap
dw TheWarpedVoidObjectMap
.the_east_crater
dab TheEastCraterLayout
dw TheEastCraterObjectsMap
dab TheEastCraterBlockMap
dw TheEastCraterObjectMap
.forest_of_fear
dab ForestOfFearLayout
dw ForestOfFearObjectsMap
dab ForestOfFearBlockMap
dw ForestOfFearObjectMap
.the_temple
dab HiddenFigureRoomLayout
dw HiddenFigureRoomObjectsMap
dab HiddenFigureRoomBlockMap
dw HiddenFigureRoomObjectMap
.the_vast_plain_2
dab TheVastPlain2Layout
dw TheVastPlain2ObjectsMap
dab TheVastPlain2BlockMap
dw TheVastPlain2ObjectMap
.the_volcanos_base_2
dab TheVolcanosBase2Layout
dw TheVolcanosBase2ObjectsMap
dab TheVolcanosBase2BlockMap
dw TheVolcanosBase2ObjectMap
.the_pool_of_rain_2
dab ThePoolOfRain2Layout
dw ThePoolOfRain2ObjectsMap
dab ThePoolOfRain2BlockMap
dw ThePoolOfRain2ObjectMap
.the_colossal_hole_2
dab TheColossalHole2Layout
dw TheColossalHole2ObjectsMap
dab TheColossalHole2BlockMap
dw TheColossalHole2ObjectMap
.the_tidal_coast_2
dab TheTidalCoast2Layout
dw TheTidalCoast2ObjectsMap
dab TheTidalCoast2BlockMap
dw TheTidalCoast2ObjectMap
.the_stagnant_swamp_2
dab TheStagnantSwamp2Layout
dw TheStagnantSwamp2ObjectsMap
dab TheStagnantSwamp2BlockMap
dw TheStagnantSwamp2ObjectMap
.above_the_clouds_2
dab AboveTheClouds2Layout
dw AboveTheClouds2ObjectsMap
dab AboveTheClouds2BlockMap
dw AboveTheClouds2ObjectMap
.the_steep_canyon_2
dab TheSteepCanyon2Layout
dw TheSteepCanyon2ObjectsMap
dab TheSteepCanyon2BlockMap
dw TheSteepCanyon2ObjectMap
.the_peaceful_village_2
dab ThePeacefulVillage2Layout
dw ThePeacefulVillage2ObjectsMap
dab ThePeacefulVillage2BlockMap
dw ThePeacefulVillage2ObjectMap

PointerTable_c0319::
dw LevelRooms_c0d1f ; OUT_OF_THE_WOODS_DAY_1
Expand Down
4 changes: 2 additions & 2 deletions src/engine/bank7c.asm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ _PauseMenuStateTable:
dw UpdatePauseMenu

dw SlowFadeBGToWhite
dw ReturnFromPauseMenu
dw ExitPauseMenu
dw DarkenBGToPal_Fast
dw ReturnToPendingLevelState

Expand Down Expand Up @@ -446,7 +446,7 @@ UpdatePauseMenu:
ld [wSubState], a
ret

ReturnFromPauseMenu:
ExitPauseMenu:
call DisableLCD
call ClearVirtualOAM
call Func_1f0969
Expand Down
Loading

0 comments on commit 624a861

Please sign in to comment.