fork/training-mode-ce
git clone https://git.julia.blue/fork/training-mode-ce
a39dffe
nix
1#include "../MexTK/mex.h" 2#include <stdint.h> 3 4#define MENU_MAXOPTION 9 5#define MENU_DESCLINEMAX 4 6#define MENU_SCROLLOFF 2 7#define MENU_RAPID_INTERVAL 5 8#define MENU_RAPID_START 15 9#define MENU_RAPID_R 2 10 11// Custom File Structs 12typedef struct evMenu 13{ 14JOBJDesc * menu ; 15JOBJDesc * popup ; 16JOBJDesc * scroll ; 17JOBJDesc * check ; 18JOBJDesc * arrow ; 19JOBJDesc * playback ; 20JOBJDesc * message ; 21COBJDesc * hud_cobjdesc ; 22JOBJDesc * tip_jobj ; 23void ** tip_jointanim ;// pointer to array 24}evMenu ; 25 26// Structure Definitions 27typedef struct EventMenu EventMenu ; 28typedef struct EventOption 29{ 30u8 kind ;// the type of option this is; string, integers, etc 31u8 disable ;// boolean for disabling the option 32s16 value_min ;// minimum value 33u16 value_num ;// number of values 34s16 val ;// value of this option 35s16 val_prev ;// previous value of this option 36char * name ;// pointer to the name of this option 37char * desc [MENU_DESCLINEMAX ];// pointer to the description string array for this option 38union { 39EventMenu * menu ;// pointer to submenu for OPTKIND_MENU 40const char ** values ;// options for OPTKIND_STRING 41const char * format ;// format string for OPTKIND_INT 42 }; 43void (* OnChange )(GOBJ * menu_gobj ,int value );// function that runs when option is changed 44void (* OnSelect )(GOBJ * menu_gobj );// function that runs when option is selected 45}EventOption ; 46typedef struct Shortcut { 47int button_mask ; 48EventOption * option ; 49}Shortcut ; 50typedef struct ShortcutList { 51int count ; 52Shortcut * list ; 53}ShortcutList ; 54struct EventMenu 55{ 56char * name ;// name of this menu 57u8 option_num ;// number of options this menu contains 58u8 scroll ;// 59u8 cursor ;// index of the option currently selected 60EventOption * options ;// pointer to all of this menu's options 61EventMenu * prev ;// pointer to previous menu, used at runtime 62ShortcutList * shortcuts ;// pointer to shortcuts when shortcut mode is entered on this menu 63}; 64typedef enum MenuMode { 65MenuMode_Normal , 66MenuMode_Paused , 67}MenuMode ; 68typedef struct MenuData 69{ 70EventMenu * curr_menu ; 71u16 canvas_menu ; 72u16 canvas_popup ; 73u8 hide_menu ;// enable this to hide the base menu. used for custom menus. 74u8 mode ; 75u8 controller_index ;// index of the controller who paused 76Text * text_name ; 77Text * text_value ; 78Text * text_title ; 79Text * text_desc ; 80JOBJ * rowboxes [MENU_MAXOPTION ]; 81JOBJ * highlight_menu ;// pointer to the highlight jobj 82JOBJ * scrollbar ; 83JOBJ * scroll_top ; 84JOBJ * scroll_bot ; 85GOBJ * custom_gobj ;// onSelect gobj 86int (* custom_gobj_think )(GOBJ * custom_gobj );// per frame function. Returns bool indicating if the program should check to unpause 87void (* custom_gobj_destroy )(GOBJ * custom_gobj );// on destroy function 88}MenuData ; 89 90 91GOBJ * EventMenu_Init (EventMenu * start_menu ); 92void EventMenu_Draw (GOBJ * eventMenu ); 93void EventMenu_Update (GOBJ * gobj ); 94void EventMenu_UpdateText (GOBJ * gobj ); 95void EventMenu_CreateText (GOBJ * gobj ); 96void EventMenu_CreateModel (GOBJ * gobj ); 97void EventMenu_MenuThink (GOBJ * gobj ,EventMenu * currMenu ); 98void EventMenu_TextGX (GOBJ * gobj ,int pass ); 99void EventMenu_MenuGX (GOBJ * gobj ,int pass ); 100void EventMenu_Update (GOBJ * gobj ); 101 102// EventOption kind definitions 103enum option_kind { 104OPTKIND_MENU , 105OPTKIND_STRING , 106OPTKIND_INT , 107OPTKIND_FUNC , 108OPTKIND_INFO , 109OPTKIND_TOGGLE , 110}; 111 112// GX Link args 113#define GXLINK_MENUMODEL 12 114#define GXPRI_MENUMODEL 80 115#define GXLINK_MENUTEXT 12 116#define GXPRI_MENUTEXT GXPRI_MENUMODEL + 1 117// popup menu 118#define GXPRI_POPUPMODEL GXPRI_MENUTEXT + 1 119#define GXLINK_POPUPMODEL 12 120#define GXPRI_POPUPTEXT GXPRI_POPUPMODEL + 1 121#define GXLINK_POPUPTEXT 12 122// cobj 123#define MENUCAM_COBJGXLINK (1 << GXLINK_MENUMODEL) | (1 << GXLINK_MENUTEXT) | (1 << GXLINK_POPUPMODEL) | (1 << GXLINK_POPUPTEXT) 124#define MENUCAM_GXPRI 9 125 126// menu text object 127#define MENU_CANVASSCALE 0.05 128// menu title 129#define MENU_TITLEXPOS -430 130#define MENU_TITLEYPOS -366 131#define MENU_TITLESCALE 2.3 132#define MENU_TITLEASPECT 870 133// menu description 134#define MENU_DESCXPOS -21.5 135#define MENU_DESCYPOS 12 136#define MENU_DESCTXTASPECT 885 137#define MENU_DESCYOFFSET 30 138// menu option name 139#define MENU_OPTIONNAMEXPOS -430 140#define MENU_OPTIONNAMEYPOS -230 141#define MENU_NAMEASPECT 440 142// menu option value 143#define MENU_OPTIONVALXPOS 250 144#define MENU_OPTIONVALYPOS -230 145#define MENU_TEXTYOFFSET 50 146#define MENU_VALASPECT 280 147// menu scroll 148#define MENUSCROLL_SCALE 2 149#define MENUSCROLL_SCALEY 1.105 * MENUSCROLL_SCALE 150#define MENUSCROLL_X 22.5 151#define MENUSCROLL_Y 12 152#define MENUSCROLL_MAXLENGTH 10 153#define MENUSCROLL_COLOR { 255, 211, 0, 255 } 154// row jobj 155#define ROWBOX_HEIGHT 2.3 156#define ROWBOX_WIDTH 18.f 157#define ROWBOX_X 12.5 158#define ROWBOX_Y 10.8 159#define ROWBOX_YOFFSET -2.5 160#define ROWBOX_COLOR { 25, 25, 45, 255 } 161#define ROWBOX_ONCOLOR { 25, 225, 25, 255 } 162// menu highlight 163#define MENUHIGHLIGHT_HEIGHT ROWBOX_HEIGHT 164#define MENUHIGHLIGHT_WIDTH 43.175 165#define MENUHIGHLIGHT_X 0.f 166#define MENUHIGHLIGHT_Y ROWBOX_Y 167#define MENUHIGHLIGHT_YOFFSET ROWBOX_YOFFSET 168#define MENUHIGHLIGHT_COLOR { 255, 211, 0, 255 }