Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added patches/ips/animated_map_tiles.ips
Binary file not shown.
3 changes: 2 additions & 1 deletion patches/rom_map/Bank DF.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ D4DF - D761: ; credits.asm
D91B - DF0A: ; credits.asm
E000 - E127: ; credits.asm
E200 - E212: ; alternate_door_colors.asm
E212 - FEEF: [free]
E212 - E3C2: ; animated_map_tiles.asm
E3C2 - FEF0: [free]
FEF0 - FEFF: seed name (null-terminated ASCII string)
FF00 - FF03: display seed / internal seed hash
FF04 - FF04: [free]
Expand Down
3 changes: 2 additions & 1 deletion patches/rom_map/RAM.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ $7EF597-$7EF599: split_speed.asm
$7EF59A-$7EF59C: reserve_backward_fill.asm
$7EF59C-$7EF59E: crash_handle_xmode.asm
$7EF59E-$7EF5A0: trimmed_fanfare.asm
$7EF5A0-$7EFE00: [FREE]
$7EF5A0-$7EF5A6: animated_map_tiles.asm
$7EF5A6-$7EFE00: [FREE]
$7EFE00: map area (copy of $1F5B to be saved to SRAM)
$7EFE02: map area explored mask
$7EFE04: copy of $1F5D (to be saved to SRAM for escape autosave)
Expand Down
239 changes: 239 additions & 0 deletions patches/src/animated_map_tiles.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,239 @@
;; Animated Maptiles for pause map double_item rooms
;; nn_357

lorom
arch 65816

!bank_df_free_space_start = $dfe212 ; this location must match fn write_double_item_table in map_tiles.rs
!bank_df_free_space_end = $dfe3c2

!interval = #$001B
!current_area = $7e1f5b
!animate_mask = $7ef5a0
!tile_timer = $7ef5a2
!tile_state = $7ef5a4

;;; Vanilla hooks

org $82913B ;;; $9120: Pause menu - index 0: map screen ;;;
jsl AnimateTile
nop
nop

org $82941e ;;; ;;; $93C3: Load pause menu map tilemap and area label ;;;
jsl BuildAnimateBitMask
nop
nop
nop
nop


;;; Custom code

org !bank_df_free_space_start

; the contents of this table is modified by fn write_double_item_table in map_tiles.rs
;
; +0 area index [table is generated in area order of the rooms]
; +2 VRAM tilemap dest
; +4 tile_a, the priority tile, revealed (palette 7). $FFFF if both items are the same type, so it never matches and tries to flip a tile to an identical tile
; +6 tile_b, the other item’s tile, revealed (palette 7)
; +8 byte offset of tile_b’s item in the collected-items array at $7ED870
; +10 bit mask for tile_b’s item within that byte
; +12 tile_a for visited tiles (palette 2). $FFFF if same type
; +14 tile_b for visited tiles (palette 2)

; Padding: unused entries are $FFFF, $0000, $FFFF, $0000, $0000, $0000, $FFFF, $0000.

DoubleItemTable:
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000 ; Billy Mays
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000 ; West Sand Pit
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000 ; Watering Hole
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000 ; Green Pirates Shaft
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000 ; Green Brinstar Reserve
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000 ; Norfair Reserve
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000 ; Bomb Torizo (when it's an objective)
DoubleItemTableEnd:

; Mask layout: !animate_mask uses bit n for “animate entry n” and bit n+8 for “entry n is visited” (VisitedRowMasks).

RowBitMasks:
dw $0001, $0002, $0004, $0008, $0010, $0020, $0040

VisitedRowMasks:
dw $0101, $0202, $0404, $0808, $1010, $2020, $4040

BuildAnimateBitMask:

phb
php
rep #$30
pha
phx
phy
phk
plb

lda #$0015
sta !tile_timer
lda #$0000
sta !tile_state
sta !animate_mask

ldy #$0000

.loop
lda.w DoubleItemTable,y
cmp !current_area
bne .next_entry

lda.w DoubleItemTable+8,y
tax
lda $7ed870,x
and.w DoubleItemTable+10,y
bne .next_entry

lda.w DoubleItemTable+2,y
sec
sbc #$3000
asl
tax
lda $7e4000,x
cmp.w DoubleItemTable+4,y
beq .revealed
cmp.w DoubleItemTable+12,y
bne .next_entry

tya
lsr
lsr
lsr
tax
lda.w VisitedRowMasks,x
bra .set_mask

.revealed
tya
lsr
lsr
lsr
tax
lda.w RowBitMasks,x

.set_mask
ora !animate_mask
sta !animate_mask

.next_entry
tya
clc
adc #$0010
tay
cpy #DoubleItemTableEnd-DoubleItemTable
bne .loop

ply
plx
pla
plp
plb
cmp #$0007 ;
bmi .skip ; hijacked code. (dont' think this does anything in MapRando anyway, it's for Debug options but restore it regardless.)
lda #$0000 ;
.skip
rtl


AnimateTile:
php
rep #$30
lda !tile_timer
inc
cmp !interval
bcs .run

sta !tile_timer
plp
lda #$0000
sta $0763
rtl

.run
phx
phy
phb
phk
plb


lda #$0000
sta !tile_timer
lda !tile_state
eor #$0002 ; byte offset of tile_a / tile_b
sta !tile_state

lda !animate_mask
beq .done
pha ; running copy of the mask, shifted once per entry

ldy #$0000 ; table offset
lda.l $7e0330
tax

.loop
lda $01,s
lsr
sta $01,s
bcc .next ; bit not set

lda DoubleItemTable,y
cmp !current_area
bne .next

lda #$0002
sta $7e00d0,x ; size
lda $01,s
and #$0080
lsr
lsr
lsr
lsr
clc
adc !tile_state
sta $7e00d2,x
tya
clc
adc #DoubleItemTable+4
adc $7e00d2,x
sta $7e00d2,x ; source = tile_a or tile_b, revealed or visited
lda #$00df
sta $7e00d4,x ; bank (dest write below overwrites the stray high byte)
lda DoubleItemTable+2,y
sta $7e00d5,x ; VRAM dest
txa
clc
adc #$0007
tax

.next
tya
clc
adc #$0010
tay
cpy #DoubleItemTableEnd-DoubleItemTable
bne .loop

txa
sta.l $7e0330
pla

.done
plb
ply
plx
plp
lda #$0000
sta $0763
rtl

assert pc() <= !bank_df_free_space_end
Original file line number Diff line number Diff line change
Expand Up @@ -4755,6 +4755,7 @@
"room_outline_revealed": true,
"opposite_area_revealed": true,
"hazard_markers": true,
"animated_tiles": false,
"mother_brain_fight": "Short",
"supers_double": true,
"escape_autosave": true,
Expand Down
1 change: 1 addition & 0 deletions rust/data/presets/full-settings/Default.json
Original file line number Diff line number Diff line change
Expand Up @@ -4667,6 +4667,7 @@
"room_outline_revealed": true,
"opposite_area_revealed": false,
"hazard_markers": true,
"animated_tiles": false,
"mother_brain_fight": "Short",
"supers_double": true,
"escape_autosave": true,
Expand Down
1 change: 1 addition & 0 deletions rust/data/presets/full-settings/Mentor Tournament.json
Original file line number Diff line number Diff line change
Expand Up @@ -4755,6 +4755,7 @@
"room_outline_revealed": true,
"opposite_area_revealed": true,
"hazard_markers": true,
"animated_tiles": false,
"mother_brain_fight": "Short",
"supers_double": true,
"escape_autosave": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4667,6 +4667,7 @@
"room_outline_revealed": true,
"opposite_area_revealed": true,
"hazard_markers": true,
"animated_tiles": false,
"mother_brain_fight": "Short",
"supers_double": true,
"escape_autosave": true,
Expand Down
1 change: 1 addition & 0 deletions rust/data/presets/quality-of-life/Default.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"room_outline_revealed": true,
"opposite_area_revealed": false,
"hazard_markers": true,
"animated_tiles": false,
"mother_brain_fight": "Short",
"supers_double": true,
"escape_autosave": true,
Expand Down
1 change: 1 addition & 0 deletions rust/data/presets/quality-of-life/High.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"room_outline_revealed": true,
"opposite_area_revealed": true,
"hazard_markers": true,
"animated_tiles": true,
"mother_brain_fight": "Short",
"supers_double": true,
"escape_autosave": true,
Expand Down
1 change: 1 addition & 0 deletions rust/data/presets/quality-of-life/Low.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"room_outline_revealed": false,
"opposite_area_revealed": false,
"hazard_markers": true,
"animated_tiles": false,
"mother_brain_fight": "Short",
"supers_double": true,
"escape_autosave": true,
Expand Down
1 change: 1 addition & 0 deletions rust/data/presets/quality-of-life/Max.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"room_outline_revealed": true,
"opposite_area_revealed": true,
"hazard_markers": true,
"animated_tiles": true,
"mother_brain_fight": "Skip",
"supers_double": true,
"escape_autosave": true,
Expand Down
1 change: 1 addition & 0 deletions rust/data/presets/quality-of-life/Off.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"room_outline_revealed": false,
"opposite_area_revealed": false,
"hazard_markers": false,
"animated_tiles": false,
"mother_brain_fight": "Vanilla",
"supers_double": false,
"escape_autosave": false,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<div class="modal" id="animatedTilesModal" tabindex="-1" data-parent-modal="qualityOfLifeModal">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title fs-5">Animated map tiles</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p>If enabled, the pause map displays a tile containing two items by alternating between the two tile shapes; it also applies when a tile contains both an item and an objective marker. The minimap is unaffected. This setting affects the following rooms:</p>
<p><ul>
<li>Billy Mays Room
<li>Brinstar Reserve Tank Room
<li>Green Pirates Shaft
<li>Norfair Reserve Tank Room
<li>Watering Hole
<li>West Sand Pit
<li>Bomb Torizo Room (if it is an objective)</li>
</ul></p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
19 changes: 19 additions & 0 deletions rust/maprando-web/templates/generate/quality_of_life.html
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,24 @@ <h1 class="modal-title fs-5">Quality-of-life options</h1>
<label class="btn btn-outline-primary" for="hazardMarkersYes">Yes</label>
</div>
</div>

<div class="form-group row my-3">
<div class="col-lg-5 ml-0 my-1 align-items-center">
<button type="button" class="btn mr-1 px-2 py-1" data-bs-toggle="modal"
data-bs-target="#animatedTilesModal">
<i class="bi bi-question-circle"></i>
</button>
<label for="preset">Animated map tiles</label>
</div>
<div id="animatedTiles" class="col-2 btn-group" role="group">
<input type="radio" class="btn-check" name="animated_tiles" id="animatedTilesNo"
value="false" checked>
<label class="btn btn-outline-primary" for="animatedTilesNo">No</label>
<input type="radio" class="btn-check" name="animated_tiles"
id="animatedTilesYes" value="true">
<label class="btn btn-outline-primary" for="animatedTilesYes">Yes</label>
</div>
</div>
</div>
</div>
</div>
Expand Down Expand Up @@ -872,6 +890,7 @@ <h1 class="modal-title fs-5">Quality-of-life options</h1>
{% include "help/quality/room_outline.html" %}
{% include "help/quality/opposite_area_revealed.html" %}
{% include "help/quality/hazard_markers.html" %}
{% include "help/quality/animated_tiles.html" %}

{% include "help/quality/mother_brain_fight.html" %}
{% include "help/quality/supers_double.html" %}
Expand Down
Loading
Loading