Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; Level-specific Yoshi messages ;
- ; by Zeldara109 ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; This patch allows multiple levels to have distinct Yoshi messages. It also
- ; allows Yoshi messages to appear on any submap, and frees up level message 3
- ; (actually the next higher level's message 1) for other use.
- ;
- ; Use the table at the end of this patch to customize behavior by level.
- ; Set to $FF to never display a Yoshi message, $00 to always display a Yoshi
- ; message, or $01-$08 to display that level's Yoshi message once only.
- ; If multiple levels are set to the same $01-$08 value, the message will
- ; only be displayed the first time you hatch a Yoshi in any of those levels.
- ;
- ; Make sure to apply this after saving the overworld in Lunar Magic. Also make
- ; sure the Yoshi message flag address ($0EF8) is saved using a patch such as
- ; SRAM Plus, or the messages will reappear when you reload your save file!
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- !YoshiMsgNum = $02 ; level message to use as the Yoshi message
- org $81EC29
- autoclean JML YoshiMessage
- org $83BB90 : LDY $1426 : CPY #$FF ; override Lunar Magic's routine that forces all levels' message 3 to become level 0 message 2
- freecode
- YoshiMessage:
- PHX ; X is Yoshi's sprite number and needs to be preserved, Y is free to use though
- LDX $13BF ; load translevel number
- LDA .MsgFlagTable,x
- BMI .Return ; if message flag is $80-FF, never display Yoshi message
- BEQ .DisplayMsg ; if message flag is $00, always display Yoshi message
- AND #$07 ;\
- TAX ;/ otherwise, let X be the bit number to use in the message flag, in the range 0-7
- LDA $0EF8 ; Yoshi message flag byte
- ORA.l $85B35B,x ; set the relevant bit
- ;STA $0DBF ; debug: store flag (with set bit) to coin counter
- CMP $0EF8
- BEQ .Return ; if the flag is unchanged, the bit was already set, so return
- STA $0EF8 ; if the flag has changed, store it
- .DisplayMsg
- LDA #!YoshiMsgNum ; display Yoshi message
- STA $1426
- .Return
- PLX
- JML $81EC40 ; return, bypassing original message-related code
- .MsgFlagTable
- db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; levels 000-007
- db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; levels 008-00F
- db $FF,$FF,$01,$FF,$FF,$FF,$FF,$FF ; levels 010-017
- db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; levels 018-01F
- db $FF,$FF,$FF,$FF,$FF ; levels 020-024
- db $FF,$FF,$FF,$FF,$00,$FF,$FF ; levels 101-107
- db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; levels 108-10F
- db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; levels 110-117
- db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; levels 118-11F
- db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; levels 120-127
- db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; levels 128-12F
- db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; levels 130-137
- db $FF,$FF,$FF,$FF ; levels 138-13B
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement