paulo@0: /* paulo@0: paulo@0: options for gba port of lockjaw paulo@0: paulo@0: */ paulo@0: paulo@0: #include paulo@0: #include paulo@0: #include "options.h" paulo@0: #include "ljlocale.h" paulo@0: #include "ljplay.h" paulo@0: #include "gbamenus.h" paulo@0: paulo@0: #ifdef ARM9 paulo@0: #include "ljds.h" paulo@0: #else paulo@0: #include "ljgba.h" paulo@0: #endif paulo@0: paulo@0: #define optionsMenu commonOptionsMenu paulo@0: paulo@0: unsigned char customPrefs[OPTIONS_MENU_LEN]; paulo@0: paulo@0: void unpackOptions(LJView *v, const unsigned char *prefs) { paulo@0: unpackCommonOptions(v, prefs); paulo@0: } paulo@0: paulo@0: static const char optionsHelpText[] = paulo@0: "\020\021 page \026\027 move \025\024 change Start:play"; paulo@0: paulo@0: void optionsWinInit(void) { paulo@0: ljmenu_init(); paulo@0: ljmenu_cls(); paulo@0: ljmenu_propPanelDrawHelp(optionsHelpText, paulo@0: NULL); paulo@0: } paulo@0: paulo@0: static void optionsClearRow(int y, int hilite) { paulo@0: ljmenu_propPanelDrawRow("", "", y, hilite); paulo@0: } paulo@0: paulo@0: static char hiliteBlinkPhase = 1; paulo@0: paulo@0: void optionsDrawRow(const unsigned char *prefs, paulo@0: int y, int line, int value, int hilite) { paulo@0: char txt[OPTIONS_VALUE_LEN]; paulo@0: const char *nameText; paulo@0: const char *valueDesc = NULL; paulo@0: char altNameText[8]; paulo@0: const char *valueOverride = isDisabledOption(prefs, line); paulo@0: paulo@0: { paulo@0: nameText = ljGetFourCCName(optionsMenu[line].name); paulo@0: if (!nameText) { paulo@0: strncpy(altNameText, optionsMenu[line].name.c, 4); paulo@0: altNameText[4] = 0; paulo@0: nameText = altNameText; paulo@0: } paulo@0: } paulo@0: paulo@0: // Format value paulo@0: if (valueOverride) { paulo@0: strcpy(txt, "overridden"); paulo@0: valueDesc = valueOverride; paulo@0: } else { paulo@0: valueDesc = getOptionsValueStr(txt, line, value); paulo@0: } paulo@0: paulo@0: ljmenu_propPanelDrawRow(nameText, txt, y, hilite); paulo@0: paulo@0: if (hilite & 1) { paulo@0: hiliteBlinkPhase = 0; paulo@0: const char *descText = ljGetFourCCDesc(optionsMenu[line].name); paulo@0: ljmenu_propPanelDrawDesc(descText ? descText : "", paulo@0: valueDesc ? valueDesc : ""); paulo@0: } paulo@0: } paulo@0: paulo@0: static const char *const optionsPageShortNames[7] = { paulo@0: "Game", "Well", "Move", "Line", "Ctrl", "Drop", "Disp" paulo@0: }; paulo@0: paulo@0: void optionsDrawPage(int page, const unsigned char *prefs) { paulo@0: int nPages = 0; paulo@0: for (; optionsPages[nPages].name; ++nPages) { } paulo@0: paulo@0: // draw page title paulo@0: ljmenu_setTitle("LOCKJAW > Options", optionsPages[page].name); paulo@0: paulo@0: // draw all tabs paulo@0: ljmenu_beginTabs(4); paulo@0: for (int p = 0; p < 7; ++p) { paulo@0: ljmenu_addTab(optionsPageShortNames[p], p == page); paulo@0: } paulo@0: ljmenu_endTabs(); paulo@0: paulo@0: for (int i = optionsPages[page].start; paulo@0: i < optionsPages[page + 1].start; ++i) { paulo@0: optionsDrawRow(prefs, i - optionsPages[page].start, paulo@0: i, prefs[i], 0); paulo@0: } paulo@0: for (int y = optionsPages[page + 1].start - optionsPages[page].start; paulo@0: y < 7; ++y) { paulo@0: optionsClearRow(y, 0); paulo@0: } paulo@0: } paulo@0: paulo@0: void optionsIdle(void) { paulo@0: vsync(); paulo@0: ljmenu_setHilitePalette(++hiliteBlinkPhase); paulo@0: } paulo@0: paulo@0: #if 0 paulo@0: typedef u16 hicolor_t; paulo@0: paulo@0: __attribute__((aligned(4))) paulo@0: const hicolor_t gbaOptionsPalette[8] = paulo@0: { paulo@0: RGB5(31,31,31), RGB5(20,20,20), RGB5( 0, 0, 0), RGB5( 0, 0, 0), paulo@0: RGB5(31,31,23), RGB5(20,20,15), RGB5( 0, 0, 0), RGB5( 0, 0, 0) paulo@0: }; paulo@0: #endif paulo@0: