Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- !base1 = $0000
- !15F6 = $15F6
- !1602 = $1602
- !154C = $154C
- !151C = $151C
- if read1($00ffd5) == $23
- sa1rom
- !base1 = $6000
- !15F6 = $33B8
- !1602 = $33CE
- !154C = $32DC
- !151C = $3284
- endif
- ;=======================================================================
- ; SMA2-Styled Yoshi Blocks
- ; By Erik557
- ;
- ; Makes the Yoshi question blocks act similar to Super Mario Advance 2,
- ; giving you a different yoshi color based on powerup status and wheter
- ; the Yoshi has been obtained.
- ;=======================================================================
- !freeRAM = $1F2C+!base1 ; Must be backed up in SRAM!
- ; Format: ----1rby
- ; - = unused
- ; 1 = green yoshi, always set
- ; rby = colored yoshi, set to 1 when acquired
- ; Notes:
- ; A colored yoshi only sets the flag when it gets fully grown.
- ; Small and big always give a random colored yoshi, as long as you have already picked them and grown them once.
- ; Flower and feather give red and blue yoshis respectively, UNLESS you have not got that specific yoshi color.
- ; In that case, the color gets picked randomly between unlocked yoshis.
- ; Green is unlocked by default, else what? Transparent?
- org $01A2E6 ; store yoshi of specific color in free RAM
- autoclean JSL saveObtainedYoshi
- NOP
- org $009AB9 ; allow any color of yoshi to be displayed on the title screen
- autoclean JML saveTS
- org $009E56 ; set green yoshi as set on file load
- autoclean JML saveLoad
- org $01F86C ; fix spawned yoshi always being green
- LDA !15F6,x
- autoclean JML growCorrectly
- org $028A18 ; main hijack
- autoclean JML yoshiSpawn
- freecode
- saveObtainedYoshi:
- AND #$0E ; lowest bit is already clear wHATEVER
- LSR ;\
- TAX ; | shift and store
- LDA.l $009E7C,x ; | bitmask table minus two
- TSB !freeRAM ;/
- LDX $15E9+!base1 ; restore index
- LDA #$0C ;\ restore
- STA !1602,x ;/
- RTL
- saveTS:
- LDA #$12 ;\ restore
- STA $44 ;/
- LDA #$0F ;\ set all yoshies as obtained
- STA !freeRAM ;/
- JML $009ABD ; return
- saveLoad:
- STZ $0F36+!base1 ;\ restore
- STZ $0F39+!base1 ;/
- LDA #$08 ;\ set green yoshi as obtained
- TSB !freeRAM ;/
- JML $009E5C ; return
- yoshiSpawn:
- STA $AA,x ;\
- LDA #$2C ; | restore
- STA !154C,x ;/
- CMP $9E,x ;\ ok what a coincidence the value was set to the sprite value of the egg.
- BNE .return ;/ return if not egg
- LDA !151C,x ;\
- CMP #$78 ; | return if egg will spawn an 1-up
- BEQ .return ;/
- PHX ; preserve the index (not stored to 15E9 here)
- LDX $19 ;\
- CPX #$02 ; | branch if fiery or caped
- BCS .fireFeather ;/
- .getRandom
- JSL $01ACF9 ;\ get random number between 0 and 3
- AND #$03 ;/
- TAX ; use it to index
- .fireFeather
- LDA.l eggColorMask,x ; obtain values for specific colored yoshi
- AND !freeRAM ;\ if that color has not been obtained, get a random one
- BEQ .getRandom ;/
- LDA.l props,x ; get color properties
- PLX ; restore index
- STA !15F6,x ; store
- .return
- JML $028A1F ; return
- growCorrectly:
- PHA ; preserve palette
- JSL $07F7D2 ; reset sprite tables
- PLA ;\ restore palette
- STA !15F6,x ;/
- JML $01A2B5 ; return
- eggColorMask:
- db $01,$08,$02,$04
- props:
- db $05,$0B,$07,$09
Advertisement
Add Comment
Please, Sign In to add comment