Mercurial > hg > index.fcgi > lj > lj046
comparison src/gbaopt.c @ 3:17286938e22a
change DS alt. rotate key to rotate twice
author | paulo@localhost |
---|---|
date | Wed, 08 Apr 2009 21:50:13 -0700 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:be3b877792aa |
---|---|
1 /* | |
2 | |
3 options for gba port of lockjaw | |
4 | |
5 */ | |
6 | |
7 #include <stdio.h> | |
8 #include <string.h> | |
9 #include "options.h" | |
10 #include "ljlocale.h" | |
11 #include "ljplay.h" | |
12 #include "gbamenus.h" | |
13 | |
14 #ifdef ARM9 | |
15 #include "ljds.h" | |
16 #else | |
17 #include "ljgba.h" | |
18 #endif | |
19 | |
20 #define optionsMenu commonOptionsMenu | |
21 | |
22 unsigned char customPrefs[OPTIONS_MENU_LEN]; | |
23 | |
24 void unpackOptions(LJView *v, const unsigned char *prefs) { | |
25 unpackCommonOptions(v, prefs); | |
26 } | |
27 | |
28 static const char optionsHelpText[] = | |
29 "\020\021 page \026\027 move \025\024 change Start:play"; | |
30 | |
31 void optionsWinInit(void) { | |
32 ljmenu_init(); | |
33 ljmenu_cls(); | |
34 ljmenu_propPanelDrawHelp(optionsHelpText, | |
35 NULL); | |
36 } | |
37 | |
38 static void optionsClearRow(int y, int hilite) { | |
39 ljmenu_propPanelDrawRow("", "", y, hilite); | |
40 } | |
41 | |
42 static char hiliteBlinkPhase = 1; | |
43 | |
44 void optionsDrawRow(const unsigned char *prefs, | |
45 int y, int line, int value, int hilite) { | |
46 char txt[OPTIONS_VALUE_LEN]; | |
47 const char *nameText; | |
48 const char *valueDesc = NULL; | |
49 char altNameText[8]; | |
50 const char *valueOverride = isDisabledOption(prefs, line); | |
51 | |
52 { | |
53 nameText = ljGetFourCCName(optionsMenu[line].name); | |
54 if (!nameText) { | |
55 strncpy(altNameText, optionsMenu[line].name.c, 4); | |
56 altNameText[4] = 0; | |
57 nameText = altNameText; | |
58 } | |
59 } | |
60 | |
61 // Format value | |
62 if (valueOverride) { | |
63 strcpy(txt, "overridden"); | |
64 valueDesc = valueOverride; | |
65 } else { | |
66 valueDesc = getOptionsValueStr(txt, line, value); | |
67 } | |
68 | |
69 ljmenu_propPanelDrawRow(nameText, txt, y, hilite); | |
70 | |
71 if (hilite & 1) { | |
72 hiliteBlinkPhase = 0; | |
73 const char *descText = ljGetFourCCDesc(optionsMenu[line].name); | |
74 ljmenu_propPanelDrawDesc(descText ? descText : "", | |
75 valueDesc ? valueDesc : ""); | |
76 } | |
77 } | |
78 | |
79 static const char *const optionsPageShortNames[7] = { | |
80 "Game", "Well", "Move", "Line", "Ctrl", "Drop", "Disp" | |
81 }; | |
82 | |
83 void optionsDrawPage(int page, const unsigned char *prefs) { | |
84 int nPages = 0; | |
85 for (; optionsPages[nPages].name; ++nPages) { } | |
86 | |
87 // draw page title | |
88 ljmenu_setTitle("LOCKJAW > Options", optionsPages[page].name); | |
89 | |
90 // draw all tabs | |
91 ljmenu_beginTabs(4); | |
92 for (int p = 0; p < 7; ++p) { | |
93 ljmenu_addTab(optionsPageShortNames[p], p == page); | |
94 } | |
95 ljmenu_endTabs(); | |
96 | |
97 for (int i = optionsPages[page].start; | |
98 i < optionsPages[page + 1].start; ++i) { | |
99 optionsDrawRow(prefs, i - optionsPages[page].start, | |
100 i, prefs[i], 0); | |
101 } | |
102 for (int y = optionsPages[page + 1].start - optionsPages[page].start; | |
103 y < 7; ++y) { | |
104 optionsClearRow(y, 0); | |
105 } | |
106 } | |
107 | |
108 void optionsIdle(void) { | |
109 vsync(); | |
110 ljmenu_setHilitePalette(++hiliteBlinkPhase); | |
111 } | |
112 | |
113 #if 0 | |
114 typedef u16 hicolor_t; | |
115 | |
116 __attribute__((aligned(4))) | |
117 const hicolor_t gbaOptionsPalette[8] = | |
118 { | |
119 RGB5(31,31,31), RGB5(20,20,20), RGB5( 0, 0, 0), RGB5( 0, 0, 0), | |
120 RGB5(31,31,23), RGB5(20,20,15), RGB5( 0, 0, 0), RGB5( 0, 0, 0) | |
121 }; | |
122 #endif | |
123 |