Advertisement
Zeldara109

Level-specific Yoshi messages (2016-7-21)

Jan 6th, 2017
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.95 KB | None | 0 0
  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ; Level-specific Yoshi messages ;
  3. ; by Zeldara109 ;
  4. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  5.  
  6. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  7. ; This patch allows multiple levels to have distinct Yoshi messages. It also
  8. ; allows Yoshi messages to appear on any submap, and frees up level message 3
  9. ; (actually the next higher level's message 1) for other use.
  10. ;
  11. ; Use the table at the end of this patch to customize behavior by level.
  12. ; Set to $FF to never display a Yoshi message, $00 to always display a Yoshi
  13. ; message, or $01-$08 to display that level's Yoshi message once only.
  14. ; If multiple levels are set to the same $01-$08 value, the message will
  15. ; only be displayed the first time you hatch a Yoshi in any of those levels.
  16. ;
  17. ; Make sure to apply this after saving the overworld in Lunar Magic. Also make
  18. ; sure the Yoshi message flag address ($0EF8) is saved using a patch such as
  19. ; SRAM Plus, or the messages will reappear when you reload your save file!
  20. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  21.  
  22. !YoshiMsgNum = $02 ; level message to use as the Yoshi message
  23.  
  24. org $81EC29
  25. autoclean JML YoshiMessage
  26.  
  27. org $83BB90 : LDY $1426 : CPY #$FF ; override Lunar Magic's routine that forces all levels' message 3 to become level 0 message 2
  28.  
  29. freecode
  30.  
  31. YoshiMessage:
  32. PHX ; X is Yoshi's sprite number and needs to be preserved, Y is free to use though
  33. LDX $13BF ; load translevel number
  34. LDA .MsgFlagTable,x
  35. BMI .Return ; if message flag is $80-FF, never display Yoshi message
  36. BEQ .DisplayMsg ; if message flag is $00, always display Yoshi message
  37. AND #$07 ;\
  38. TAX ;/ otherwise, let X be the bit number to use in the message flag, in the range 0-7
  39.  
  40. LDA $0EF8 ; Yoshi message flag byte
  41. ORA.l $85B35B,x ; set the relevant bit
  42. ;STA $0DBF ; debug: store flag (with set bit) to coin counter
  43. CMP $0EF8
  44. BEQ .Return ; if the flag is unchanged, the bit was already set, so return
  45. STA $0EF8 ; if the flag has changed, store it
  46.  
  47. .DisplayMsg
  48. LDA #!YoshiMsgNum ; display Yoshi message
  49. STA $1426
  50. .Return
  51. PLX
  52. JML $81EC40 ; return, bypassing original message-related code
  53.  
  54. .MsgFlagTable
  55. db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; levels 000-007
  56. db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; levels 008-00F
  57. db $FF,$FF,$01,$FF,$FF,$FF,$FF,$FF ; levels 010-017
  58. db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; levels 018-01F
  59. db $FF,$FF,$FF,$FF,$FF ; levels 020-024
  60. db $FF,$FF,$FF,$FF,$00,$FF,$FF ; levels 101-107
  61. db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; levels 108-10F
  62. db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; levels 110-117
  63. db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; levels 118-11F
  64. db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; levels 120-127
  65. db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; levels 128-12F
  66. db $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF ; levels 130-137
  67. db $FF,$FF,$FF,$FF ; levels 138-13B
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement