Advertisement
vladikcomper

Vladikcomper's Menu System - Script File Example

Jul 2nd, 2012
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; ===============================================================
  2. ; MENU SYSTEM for SonicVaan
  3. ; Developed and Desgined (c) 2012 Vladikcomper
  4. ; ===============================================================
  5.  
  6. ; ---------------------------------------------------------------
  7. ; This file contains menu prefences, textes and action scripts to
  8. ; be parsed by the menu core.
  9. ; ---------------------------------------------------------------
  10.  
  11. ; ---------------------------------------------------------------
  12. ; NOTE: Data Block should be placed in following order:
  13. ;   <InitScript>
  14. ;   <EntryList>
  15. ;   <TextPointers>
  16. ; ---------------------------------------------------------------
  17.  
  18. ; ---------------------------------------------------------------
  19. ; ENTRY LIST METHODS:
  20. ;
  21. ;   _ME_TextID: ID of Text string listed in <TextPointers>
  22. ;
  23. ;   _ME_Type:   Menu Entry Type
  24. ;               _ME_Normal = Normal selectable entry
  25. ;               _ME_Option = Option entry
  26. ;
  27. ;   _ME_Action: Entry action when selected (if _ME_Type = _ME_Normal)
  28. ;               _ME_Nothing = No effect
  29. ;               _ME_GoToMenu = Go to menu set by _ME_ActionVal
  30. ;               _ME_GoToGameMode = Go to Game Mode set by _ME_ActionVal
  31. ;               _ME_CallHandler = Call handler routine set by _ME_ActionVal
  32. ;
  33. ;   _ME_ActionVal:  Value for _ME_Action (see above)
  34. ;
  35. ;   _ME_OpnNum: Number of options, zero-based (if _ME_Type = _ME_Option)
  36. ;
  37. ;   _ME_OpnAddr:    Memory address that represents option field
  38. ;
  39. ;   _ME_OpnTextID:  Start ID of text string for option variants
  40. ;
  41. ;   _ME_OpnTextPos: Text position of option text (in tiles)
  42. ;
  43. ; ---------------------------------------------------------------
  44.  
  45. ; ---------------------------------------------------------------
  46. ; Prefences
  47. ; ---------------------------------------------------------------
  48.  
  49. _Menu_BGM       equ $91
  50. _Menu_Snd_Select    equ $A1
  51. _Menu_Snd_Switch    equ $CD
  52.  
  53. ; ---------------------------------------------------------------
  54. ; Menu Scripts constants
  55. ; ---------------------------------------------------------------
  56.  
  57. ; Entry Types
  58.  
  59. _ME_Normal = 0
  60. _ME_Option = 1
  61.  
  62. ; Entry Actions
  63.  
  64. _ME_Nothing = 0
  65. _ME_GoToMenu = 1
  66. _ME_GoToGameMode = 2
  67. _ME_CallHandler = -1    ; Custom handler
  68.  
  69. ; ---------------------------------------------------------------
  70. ; Main Macros
  71. ; ---------------------------------------------------------------
  72.  
  73. ; Reset methods
  74. _ME_TextID = 0
  75. _ME_Type = 0
  76. _ME_Action = 0
  77. _ME_ActionVal = 0
  78. _ME_OpnNum = 0
  79. _ME_OpnAddr = 0
  80. _ME_OpnTextID = 0
  81. _ME_OpnTextPos = 0
  82.  
  83. _Menu_CreateEntry   macro
  84.     dc.w    _ME_TextID
  85.     dc.b    _ME_Type
  86.     if _ME_Type=_ME_Normal
  87.         dc.b    _ME_Action
  88.         if _ME_Action=_ME_Nothing
  89.             dc.l    0
  90.         elseif _ME_Action=_ME_GoToMenu
  91.             dc.b    _ME_ActionVal
  92.             dc.b    0,0,0
  93.         elseif _ME_Action=_ME_GoToGameMode
  94.             dc.b    _ME_ActionVal
  95.             dc.b    0,0,0
  96.         else
  97.             dc.l    _ME_ActionVal
  98.         endc
  99.     else
  100.         dc.b    _ME_OpnNum
  101.         dc.w    _ME_OpnAddr&$FFFF
  102.         dc.b    _ME_OpnTextID
  103.         dc.b    _ME_OpnTextPos
  104.     endc
  105.     endm
  106.  
  107. ; ===============================================================
  108. ; ---------------------------------------------------------------
  109. ; Main Pointers array
  110. ; ---------------------------------------------------------------
  111.  
  112. Menu_DataPointers:
  113. @Lst
  114.     ; $00 - Main Menu
  115.     dc.w    MainMenu_InitScript-@Lst
  116.     dc.w    MainMenu_EntryList-@Lst
  117.     dc.w    MainMenu_TextPointers-@Lst
  118.    
  119.     ; $01 - Options
  120.     dc.w    Options_InitScript-@Lst
  121.     dc.w    Options_EntryList-@Lst
  122.     dc.w    Options_TextPointers-@Lst
  123.    
  124.     ; $02 - Extras
  125.     dc.w    Extras_InitScript-@Lst
  126.     dc.w    Extras_EntryList-@Lst
  127.     dc.w    Extras_TextPointers-@Lst
  128.  
  129. ; ===============================================================
  130.  
  131.  
  132.  
  133.  
  134. ; ===============================================================
  135. ; ---------------------------------------------------------------
  136. ; Main menu
  137. ; ---------------------------------------------------------------
  138.  
  139. MainMenu_InitScript:
  140.  
  141.     ; Art Load Cues
  142.     dc.w    0           ; Number of cues ($0 = None)
  143.  
  144.     ; External Objects
  145.     dc.w    1           ; Number of objects ($0 = None)
  146.     dc.l    Obj_Emerald
  147.  
  148.     ; Palettes
  149.     dc.w    $A42,$C44,$C64      ; BG Palette
  150.     dc.w    $000,$EEE       ; Normal Menu Entry
  151.     dc.w    $000,$6E6       ; Active Menu Entry
  152.     hex 0000006000A000C600EA    ; Emerald palette
  153.  
  154.     ; Menu prefences
  155.     dc.b    0           ; Scroll Direction
  156.     dc.b    3           ; Number of entries (zero-based)
  157.     dc.b    12, 8           ; XY position of top left corner (in tiles)
  158.  
  159. ; ---------------------------------------------------------------
  160.  
  161. MainMenu_EntryList:
  162.  
  163.     ; START GAME
  164.     _ME_TextID: = 0
  165.     _ME_Type:   = _ME_Normal
  166.     _ME_Action: = _ME_GoToGameMode
  167.     _ME_ActionVal:  = $0C
  168.     _Menu_CreateEntry
  169.  
  170.     ; EXTRAS
  171.     _ME_TextID: = 1
  172.     _ME_Type:   = _ME_Normal
  173.     _ME_Action: = _ME_GoToMenu
  174.     _ME_ActionVal:  = $02
  175.     _Menu_CreateEntry
  176.  
  177.     ; OPTIONS
  178.     _ME_TextID: = 2
  179.     _ME_Type:   = _ME_Normal
  180.     _ME_Action: = _ME_GoToMenu
  181.     _ME_ActionVal:  = $01
  182.     _Menu_CreateEntry
  183.  
  184.     ; BETA INFO
  185.     _ME_TextID: = 3
  186.     _ME_Type:   = _ME_Normal
  187.     _ME_Action: = _ME_GoToGameMode
  188.     _ME_ActionVal:  = $28
  189.     _Menu_CreateEntry
  190.  
  191. ; ---------------------------------------------------------------
  192.  
  193. MainMenu_TextPointers:
  194. @Lst    dc.w    @0-@Lst
  195.     dc.w    @1-@Lst
  196.     dc.w    @2-@Lst
  197.     dc.w    @3-@Lst
  198.  
  199. @0  dc.b    'START GAME',0
  200. @1  dc.b    'EXTRAS',0
  201. @2  dc.b    'OPTIONS',0
  202. @3  dc.b    'BETA INFO',0
  203.     even
  204.  
  205. ; ===============================================================
  206.  
  207.  
  208.  
  209.  
  210. ; ===============================================================
  211. ; Options
  212. ; ===============================================================
  213.  
  214. Options_InitScript:
  215.  
  216.     ; Art Load Cues
  217.     dc.w    1           ; Number of cues ($0 = None)
  218.     dc.l    Art_MenuHeaders
  219.     dc.w    _VRAM_CArt
  220.  
  221.     ; External Objects
  222.     dc.w    2           ; Number of objects ($0 = None)
  223.     dc.l    Obj_Header
  224.     dc.l    Obj_Emerald
  225.  
  226.     ; Palettes
  227.     dc.w    $44A,$44C,$46C      ; BG Palette
  228.     dc.w    $000,$EEE       ; Normal Menu Entry
  229.     dc.w    $000,$0EE       ; Active Menu Entry
  230.     hex 00000024006800AC02EE
  231.  
  232.     ; Menu prefences
  233.     dc.b    1           ; Scroll Direction
  234.     dc.b    3           ; Number of entries (zero-based)
  235.     dc.b    8, 10           ; XY position of top left corner (in tiles)
  236.  
  237. ; ---------------------------------------------------------------
  238.  
  239. Options_EntryList:
  240.  
  241.     ; DIFFICULTY
  242.     _ME_TextID: = 0
  243.     _ME_Type:   = _ME_Option
  244.     _ME_OpnNum: = 2
  245.     _ME_OpnAddr:    = $FFFFFF3E
  246.     _ME_OpnTextID:  = 3
  247.     _ME_OpnTextPos: = 18
  248.     _Menu_CreateEntry
  249.  
  250.     ; SECRET OPTION
  251.     _ME_TextID: = 1
  252.     _ME_Type:   = _ME_Option
  253.     _ME_OpnNum: = 1
  254.     _ME_OpnAddr:    = $FFFFFF3F
  255.     _ME_OpnTextID:  = 6
  256.     _ME_OpnTextPos: = 21
  257.     _Menu_CreateEntry
  258.  
  259.     ; CLEAR SAVE DATA
  260.     _ME_TextID: = 2
  261.     _ME_Type:   = _ME_Normal
  262.     _ME_Action: = _ME_CallHandler
  263.     _ME_ActionVal:  = Hndl_ClearSave
  264.     _Menu_CreateEntry
  265.  
  266.     ; BACK TO MAIN MENU
  267.     _ME_TextID: = 8
  268.     _ME_Type:   = _ME_Normal
  269.     _ME_Action: = _ME_GoToMenu
  270.     _ME_ActionVal:  = $00
  271.     _Menu_CreateEntry
  272.  
  273. ; ---------------------------------------------------------------
  274.  
  275. Options_TextPointers:
  276. @Lst    dc.w    @0-@Lst
  277.     dc.w    @1-@Lst
  278.     dc.w    @2-@Lst
  279.     dc.w    @3-@Lst
  280.     dc.w    @4-@Lst
  281.     dc.w    @5-@Lst
  282.     dc.w    @6-@Lst
  283.     dc.w    @7-@Lst
  284.     dc.w    @8-@Lst
  285.  
  286. @0  dc.b    'DIFFICULTY',0
  287. @1  dc.b    'SECRET OPTION',0
  288. @2  dc.b    'CLEAR SAVE DATA',0
  289. @3  dc.b    '  EASY',0
  290. @4  dc.b    'NORMAL',0
  291. @5  dc.b    '  HARD',0
  292. @6  dc.b    'OFF',0
  293. @7  dc.b    ' ON',0
  294. @8  dc.b    'BACK TO MAIN MENU',0
  295.     even
  296.  
  297. ; ===============================================================
  298.  
  299.  
  300.    
  301.  
  302. ; ===============================================================
  303. ; ---------------------------------------------------------------
  304. ; Extras
  305. ; ---------------------------------------------------------------
  306.  
  307. Extras_InitScript:
  308.  
  309.     ; Art Load Cues
  310.     dc.w    1           ; Number of cues ($0 = None)
  311.     dc.l    Art_MenuHeaders
  312.     dc.w    _VRAM_CArt
  313.  
  314.     ; External Objects
  315.     dc.w    1           ; Number of objects ($0 = None)
  316.     dc.l    Obj_Header
  317.  
  318.     ; Palettes
  319.     dc.w    $444,$666,$888      ; BG Palette
  320.     dc.w    $000,$EEE       ; Normal Menu Entry
  321.     dc.w    $000,$0EE       ; Active Menu Entry
  322.     dc.w    $00E,$00E,$00E,$00E,$00E    ; Emerald palette ###
  323.  
  324.     ; Menu prefences
  325.     dc.b    1           ; Scroll Direction
  326.     dc.b    0           ; Number of entries (zero-based)
  327.     dc.b    11, 22          ; XY position of top left corner (in tiles)
  328.  
  329. ; ---------------------------------------------------------------
  330.  
  331. Extras_EntryList:
  332.  
  333.     ; BACK TO MAIN MENU
  334.     _ME_TextID: = 0
  335.     _ME_Type:   = _ME_Normal
  336.     _ME_Action: = _ME_GoToMenu
  337.     _ME_ActionVal:  = $00
  338.     _Menu_CreateEntry
  339.  
  340. ; ---------------------------------------------------------------
  341.  
  342. Extras_TextPointers:
  343. @Lst    dc.w    @0-@Lst
  344.  
  345. @0  dc.b    'BACK TO MAIN MENU',0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement