Skip to content

Commit 9629c99

Browse files
authored
Merge pull request #238 from idlechild/master
More fun with presets
2 parents 80e09cc + 795aed7 commit 9629c99

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+60899
-39114
lines changed

build_presets.bat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
echo Building Combined Preset Data
44
cd src\presets
5+
if exist combined_preset_names.asm del combined_preset_names.asm
56
if exist combined_map_preset_data.asm del combined_map_preset_data.asm
67
if exist combined_preset_data.asm del combined_preset_data.asm
8+
python combine_preset_names.py
79
python combine_map_preset_data.py
810
python combine_preset_data.py
911
cd ..\..

build_presets.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
echo "Building Combined Preset Data"
44
cd src/presets
5+
rm -f combined_preset_names.asm
56
rm -f combined_map_preset_data.asm
67
rm -f combined_preset_data.asm
8+
python3 combine_preset_names.py
79
python3 combine_map_preset_data.py
810
python3 combine_preset_data.py
911
cd ../..

resources/10years.0.brr

17.2 KB
Binary file not shown.

resources/10years.1.brr

5.45 KB
Binary file not shown.

resources/zsnes_palette.bin

512 Bytes
Binary file not shown.

resources/zsnes_tilemap.bin

2 KB
Binary file not shown.

resources/zsnes_tiles.bin

56.1 KB
Binary file not shown.

src/BRBmenu.asm

Lines changed: 121 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,12 @@ cm_brb_loop:
137137
JSL $808F0C ; Music queue
138138
JSL $8289EF ; Sound fx queue
139139

140+
if !ZSNES_SPLASHSCREEN_GRAPHICS
141+
LDA !ram_sram_detection
142+
CMP !SRAM_DETECTION_ZSNES : BNE .loop
143+
JSR brb_zsnes_splashscreen
144+
endif
145+
140146
.loop
141147
; [do entertaining stuff here]
142148
JSR cm_draw_brb
@@ -188,15 +194,21 @@ cm_brb_loop:
188194

189195
cm_draw_brb:
190196
{
191-
JSL cm_tilemap_bg_interior_long
192197
LDA !ram_sram_detection : BNE .splash_screen
198+
JSL cm_tilemap_bg_interior_long
193199
JSR cm_tilemap_brb
194200
JSL cm_tilemap_transfer_long
195201
JMP cm_brb_scroll_BG3
196202

197203
.splash_screen
204+
if !ZSNES_SPLASHSCREEN_GRAPHICS
205+
CMP !SRAM_DETECTION_ZSNES : BEQ .end
206+
endif
207+
JSL cm_tilemap_bg_interior_long
198208
JSR cm_tilemap_splash_screen
199209
JSL cm_tilemap_transfer_long
210+
211+
.end
200212
RTS
201213
}
202214

@@ -352,6 +364,94 @@ cm_tilemap_splash_screen:
352364
JMP cm_draw_brb_text
353365
}
354366

367+
if !ZSNES_SPLASHSCREEN_GRAPHICS
368+
brb_zsnes_splashscreen:
369+
{
370+
; Set up video mode
371+
%ai8()
372+
LDA #$80 ; screen off
373+
STA $2100 ; brightness + screen enable register
374+
LDA #$03
375+
STA $2105 ; video mode 3, 8x8 tiles, 256 color BG1, 16 color BG2
376+
STZ $2106 ; noplanes, no mosaic, = Mosaic register
377+
LDA #$01
378+
STA $210B ; Set BG1 tile data offset to $2000
379+
STZ $210D ; Plane 0 scroll x (first 8 bits)
380+
STZ $210D ; Plane 0 scroll x (last 3 bits) #$0 - #$07ff
381+
LDA #$01
382+
STA $212C ; Enable BG1
383+
LDA #$FF
384+
STA $210E ; Set BG1 scroll register
385+
STA $210E
386+
STZ $212E ; Window mask for Main Screen
387+
STZ $212F ; Window mask for Sub Screen
388+
LDA #$30
389+
STA $2130 ; Color addition and screen addition init setting
390+
STZ $2131 ; Add/Sub sub designation for screen, sprite, color
391+
LDA #$E0
392+
STA $2132 ; color data for addition/subtraction
393+
STZ $2133 ; Screen setting (interlace x,y/enable SFX data)
394+
395+
; Load tilemap and tile data
396+
%i16()
397+
STZ $2116
398+
LDA #$0C
399+
STA $2107 ; Set BG1 tilemap offset to $1800 and size to 32x32
400+
STA $2117 ; VRAM write address $1800
401+
402+
LDA #$80
403+
STA $2115 ; VRAM single word transfer, word increment
404+
LDX #$1801
405+
STX $4300 ; DMA destination: VMDATAL/VMDATAH, fixed source
406+
LDX.w #ZSNES_TileMap
407+
STX $4302 ; Low DMA source address
408+
LDA.b #ZSNES_TileMap>>16
409+
STA $4304 ; High DMA source address
410+
LDX #$0800
411+
STX $4305 ; Transfer 2048 bytes
412+
LDA #$01
413+
STA $420B ; Start DMA transfer
414+
415+
LDX.w #ZSNES_Tiles
416+
STX $4302 ; Low DMA source address
417+
LDA.b #ZSNES_Tiles>>16
418+
STA $4304 ; High DMA source address
419+
LDX #$8000
420+
STX $4305 ; Transfer 32768 bytes
421+
LDA #$01
422+
STA $420B ; Start DMA transfer
423+
424+
LDX.w #ZSNES_Tiles
425+
STX $4302 ; Low DMA source address
426+
LDA.b #ZSNES_Tiles>>16
427+
INC
428+
STA $4304 ; High DMA source address
429+
LDX #$6040
430+
STX $4305 ; Transfer 24640 bytes
431+
LDA #$01
432+
STA $420B ; Start DMA transfer
433+
434+
; Load CGRAM via DMA transfer
435+
STZ $2121 ; Start at color 0
436+
LDX #$2200
437+
STX $4300 ; DMA destination: CGDATA, byte increment
438+
LDX.w #ZSNES_Palette
439+
STX $4302 ; Low DMA source address
440+
LDA.b #ZSNES_Palette>>16
441+
STA $4304 ; High DMA source address
442+
LDX #$0200
443+
STX $4305 ; Transfer 512 bytes
444+
LDA #$01
445+
STA $420B ; Start DMA transfer
446+
447+
LDA #$0F ; screen on, full brightness
448+
STA $2100 ; brightness + screen enable register
449+
450+
%a16()
451+
RTS
452+
}
453+
endif ; !ZSNES_SPLASHSCREEN_GRAPHICS
454+
355455
brb_handle_countup_timer:
356456
{
357457
LDA !ram_cm_brb_frames : INC : STA !ram_cm_brb_frames
@@ -630,3 +730,23 @@ BRB_screen7_line2:
630730

631731
%endfree(A1)
632732

733+
734+
if !ZSNES_SPLASHSCREEN_GRAPHICS
735+
org $E28000
736+
check bankcross off
737+
print pc, " zsnes splashscreen graphics crossbank start"
738+
739+
ZSNES_Tiles:
740+
incbin ../resources/zsnes_tiles.bin
741+
742+
ZSNES_TileMap:
743+
incbin ../resources/zsnes_tilemap.bin
744+
745+
ZSNES_Palette:
746+
incbin ../resources/zsnes_palette.bin
747+
748+
print pc, " zsnes splashscreen graphics crossbank end"
749+
warnpc $E48000
750+
check bankcross on
751+
endif
752+

src/custompresets.asm

Lines changed: 35 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,11 @@ preset_scroll_fixes:
549549
.category_presets
550550
; organized by room ID for efficiency
551551
PEA $7E7E : PLB : PLB
552+
; if riding an elevator then skip straight to specialized start
553+
LDA !ELEVATOR_STATUS : BEQ .category_start
554+
JMP .specialized_start
555+
556+
.category_start
552557
%a8()
553558
LDA #$01 : LDX !ROOM_ID ; X = room ID
554559
CPX.w #ROOM_BowlingAlley : BMI .tophalf
@@ -603,6 +608,8 @@ preset_scroll_fixes:
603608

604609
.climb
605610
STA $CD39
611+
JMP .specialized_climb
612+
606613
.topdone
607614
PLB
608615
PLP
@@ -725,7 +732,6 @@ preset_scroll_fixes:
725732
CPX.w #ROOM_BatCave : BEQ .bat_cave
726733
CPX.w #ROOM_AcidStatueRoom : BEQ .acid_chozo_room
727734
CPX.w #ROOM_GoldenTorizoRoom : BEQ .golden_torizo
728-
CPX.w #ROOM_FastPillarsSetupRoom : BEQ .fast_pillars_setup
729735
CPX.w #ROOM_WorstRoomInTheGame : BEQ .worst_room
730736
CPX.w #ROOM_RedKihunterShaft : BEQ .kihunter_stairs
731737
CPX.w #ROOM_Wasteland : BEQ .wasteland
@@ -771,16 +777,6 @@ preset_scroll_fixes:
771777
INC : STA $CD20 : STA $CD21
772778
BRA .norfairdone
773779

774-
.fast_pillars_setup
775-
LDY !SAMUS_Y : CPY #$0199 ; fix varies depending on Y position
776-
BMI .above_pillars
777-
STA $CD24 : INC : STA $CD22
778-
STZ $CD21
779-
BRA .norfairdone
780-
.above_pillars
781-
INC : STA $CD21
782-
BRA .norfairdone
783-
784780
.worst_room
785781
INC : STA $CD20
786782
BRA .norfairdone
@@ -889,7 +885,7 @@ preset_scroll_fixes:
889885
BRA .halfwaydone
890886

891887
.pants_room
892-
STA $CD21 : STZ $CD22
888+
STA $CD21
893889
BRA .halfwaydone
894890

895891
.precious
@@ -966,6 +962,7 @@ endif
966962
MVP $707E ; srcBank, destBank
967963
TDC : STA !ram_load_preset_low_word
968964

965+
.specialized_start
969966
%a8()
970967
; X = room ID
971968
LDX !ROOM_ID : CPX.w #ROOM_CeresElevatorRoom : BMI .specialized_fixes
@@ -976,29 +973,34 @@ endif
976973
; -----------------------------------------------
977974
.specialized_parlor
978975
LDY !SAMUS_Y : CPY #$00D0 ; no fix if Ypos >= 208
979-
BPL .specialdone
976+
BPL .specialized_parlor_done
980977
LDY !SAMUS_X : CPY #$0175 ; no fix if Xpos >= 373
981-
BPL .specialdone
978+
BPL .specialized_parlor_done
982979
%a16() : LDA #$00FF
983980
STA $7F05C0 : STA $7F05C2
984981
LDY !SAMUS_PBS_MAX ; only clear bottom row if no power bombs
985-
BEQ .specialdone
982+
BEQ .specialized_parlor_done
986983
STA $7F0520 : STA $7F0522
987984
STA $7F0480 : STA $7F0482
985+
.specialized_parlor_done
988986
BRA .specialdone
989987

990-
.specialized_big_pink
991-
LDY !SAMUS_Y : CPY #$02C0 ; no fix if Ypos < 704
992-
BMI .specialdone
993-
CPY #$03C9 ; no fix if Ypos >= 969
988+
.specialized_climb
989+
LDY !SAMUS_X : CPY #$0125 ; no fix if Xpos >= 285
994990
BPL .specialdone
995-
%a16() : LDA #$00FF
996-
STA $7F2208 : STA $7F220A : STA $7F22A8 : STA $7F22AA
997-
STA $7F2348 : STA $7F234A : STA $7F23E8 : STA $7F23EA
991+
LDA #$01 : STA $CD38
992+
CPY #$0095 ; only clear wall if Xpos >= 149
993+
BPL .specialized_climb_wall
994+
TDC : STA $CD39
995+
.specialized_climb_wall
996+
%a16() : LDA #$00FF : STA $7F3262 : STA $7F3264
997+
STA $7F32C2 : STA $7F32C4 : STA $7F3322
998+
STA $7F3324 : STA $7F3382 : STA $7F3384
998999
BRA .specialdone
9991000

10001001
.specialized_fixes
10011002
CPX.w #ROOM_ParlorAndAlcatraz : BEQ .specialized_parlor
1003+
CPX.w #ROOM_Climb : BEQ .specialized_climb
10021004
CPX.w #ROOM_BigPink : BEQ .specialized_big_pink
10031005
CPX.w #ROOM_BlueBrinstarETank : BEQ .specialized_taco_tank_room
10041006
CPX.w #ROOM_HiJumpBootsRoom : BEQ .specialized_hjb_room
@@ -1008,6 +1010,16 @@ endif
10081010
PLP
10091011
RTL
10101012

1013+
.specialized_big_pink
1014+
LDY !SAMUS_Y : CPY #$02C0 ; no fix if Ypos < 704
1015+
BMI .specialdone
1016+
CPY #$03C9 ; no fix if Ypos >= 969
1017+
BPL .specialdone
1018+
%a16() : LDA #$00FF
1019+
STA $7F2208 : STA $7F220A : STA $7F22A8 : STA $7F22AA
1020+
STA $7F2348 : STA $7F234A : STA $7F23E8 : STA $7F23EA
1021+
BRA .specialdone
1022+
10111023
.specialized_taco_tank_room
10121024
LDY !SAMUS_X : CPY #$022B ; no fix if Xpos < 555
10131025
BMI .specialdone
@@ -1033,7 +1045,7 @@ endif
10331045
%a16() : LDA #$00FF
10341046
STA $7F036E : STA $7F0370 : STA $7F0374 : STA $7F0376
10351047
STA $7F03D4 : STA $7F0610 : STA $7F0612
1036-
BRA .specialdone
1048+
JMP .specialdone
10371049
}
10381050

10391051
LoadRandomPreset:

0 commit comments

Comments
 (0)