comparison src/options.h @ 0:c84446dfb3f5

initial add
author paulo@localhost
date Fri, 13 Mar 2009 00:39:12 -0700
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:e9a7b80cb647
1 /* options code for LOCKJAW, an implementation of the Soviet Mind Game
2
3 Copyright (C) 2007 Damian Yerrick <tepples+lj@spamcop.net>
4
5 This work is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 Original game concept and design by Alexey Pajitnov.
20 The Software is not sponsored or endorsed by Alexey Pajitnov, Elorg,
21 or The Tetris Company LLC.
22
23 */
24
25 #ifndef OPTIONS_H
26 #define OPTIONS_H
27
28 #include "lj.h"
29 #include "ljcontrol.h"
30 #include "ljlocale.h"
31
32 typedef struct OptionsLine {
33 FourCC name;
34 const FourCC *valueNames;
35 unsigned char minValue;
36 unsigned char nValues;
37 unsigned char startValue;
38 unsigned char style;
39 // const char *desc;
40 } OptionsLine;
41
42 /*
43 * OPTSTYLE_DEFAULT and no valueNames:
44 * Render value as a number.
45 * OPTSTYLE_DEFAULT and valueNames:
46 * Render value as valueNames[value - minValue]
47 * OPTSTYLE_FRAMES and no valueNames:
48 * Render value as a number and as a number times 50/3.
49 * OPTSTYLE_FRAMES and no valueNames:
50 * Similar, except override value == minValue with valueNames[0]
51 * and value == minValue + nValues - 1 with valueNames[1].
52 */
53 enum {
54 OPTSTYLE_DEFAULT, // names, or numbers
55 OPTSTYLE_FRAMES,
56 OPTSTYLE_FRAC_G
57 };
58
59 typedef struct OptionsPage {
60 unsigned int start;
61 const char *name;
62 } OptionsPage;
63
64 #define N_KICK_LIMITS 7
65 extern const OptionsLine commonOptionsMenu[];
66 extern const OptionsPage optionsPages[];
67 extern const FourCC optionsRotNames[N_ROTATION_SYSTEMS];
68 extern const FourCC optionsLockdownNames[];
69 extern const FourCC gimmickNames[LJGM_N_GIMMICKS];
70 extern const FourCC optionsPieceSetNames[];
71 extern const FourCC optionsBoolNames[2];
72 extern const FourCC optionsZangiNames[];
73 extern const FourCC optionsGluingNames[];
74 extern const FourCC optionsRandNames[];
75 extern const FourCC optionsTspinNames[LJTS_N_ALGOS];
76 extern const FourCC optionsGravNames[];
77 extern const FourCC optionsSpeedCurveNames[];
78 extern const FourCC optionsGarbageNames[];
79 extern const FourCC optionsHoldStyleNames[];
80 extern const FourCC optionsScoringNames[LJSCORE_N_STYLES];
81 extern const FourCC optionsDropScoringNames[LJDROP_N_STYLES];
82 extern const FourCC gimmickNames[LJGM_N_GIMMICKS];
83 extern const FourCC optionsSideNames[];
84 extern const FourCC optionsNextStyleNames[];
85 extern const FourCC optionsShadowNames[];
86 extern const FourCC optionsDASDelayNames[];
87
88
89 enum {
90 OPTIONS_GIMMICK,
91
92 OPTIONS_WIDTH,
93 OPTIONS_HEIGHT,
94 OPTIONS_ENTER_ABOVE,
95 OPTIONS_SPEED_CURVE,
96 OPTIONS_ENTRY_DELAY,
97 OPTIONS_PIECE_SET,
98 OPTIONS_RANDOMIZER,
99
100 OPTIONS_HOLD_PIECE,
101 OPTIONS_ROTATION_SYSTEM,
102 OPTIONS_FLOOR_KICKS,
103 OPTIONS_LOCKDOWN,
104 OPTIONS_LOCK_DELAY,
105 OPTIONS_BOTTOM_BLOCKS,
106
107 OPTIONS_LINE_DELAY,
108 OPTIONS_CLEAR_GRAVITY,
109 OPTIONS_GLUING,
110 OPTIONS_SCORING,
111 OPTIONS_DROP_SCORING,
112 OPTIONS_T_SPIN,
113 OPTIONS_GARBAGE,
114
115 OPTIONS_SIDEWAYS_DELAY,
116 OPTIONS_SIDEWAYS_SPEED,
117 OPTIONS_INITIAL_SIDEWAYS,
118 OPTIONS_IRS,
119 OPTIONS_DIAGONAL_MOTION,
120 OPTIONS_SOFT_DROP_SPEED,
121 OPTIONS_SOFT_DROP,
122 OPTIONS_HARD_DROP,
123
124 OPTIONS_SHADOW,
125 OPTIONS_HIDE_PF,
126 OPTIONS_NEXT_PIECES,
127 OPTIONS_SMOOTH_GRAVITY,
128
129 OPTIONS_MENU_LEN
130 };
131
132 /**
133 * Builds a string representing the value of an option.
134 * @param dst 32-byte buffer to hold this string
135 * @param line index into optionsMenu
136 * @param value the (numeric) value of the option
137 * @return the description of this value, or NULL if unknown
138 */
139 const char *getOptionsValueStr(char *dst, int line, int value);
140 #define OPTIONS_VALUE_LEN 33
141
142 void unpackCommonOptions(LJView *v, const unsigned char *prefs);
143 void initOptions(unsigned char *prefs);
144 const char *isDisabledOption(const unsigned char *prefs, int y);
145
146 void optionsWinInit(void);
147 void optionsDrawPage(int scroll, const unsigned char *prefs);
148 void optionsDrawRow(const unsigned char *prefs,
149 int dstY, int line, int value, int hilite);
150 void optionsIdle(void);
151
152 #endif