paulo@0: /* options code for LOCKJAW, an implementation of the Soviet Mind Game paulo@0: paulo@0: Copyright (C) 2007 Damian Yerrick paulo@0: paulo@0: This work is free software; you can redistribute it and/or modify paulo@0: it under the terms of the GNU General Public License as published by paulo@0: the Free Software Foundation; either version 2 of the License, or paulo@0: (at your option) any later version. paulo@0: paulo@0: This program is distributed in the hope that it will be useful, paulo@0: but WITHOUT ANY WARRANTY; without even the implied warranty of paulo@0: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the paulo@0: GNU General Public License for more details. paulo@0: paulo@0: You should have received a copy of the GNU General Public License paulo@0: along with this program; if not, write to the Free Software paulo@0: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA paulo@0: paulo@0: Original game concept and design by Alexey Pajitnov. paulo@0: The Software is not sponsored or endorsed by Alexey Pajitnov, Elorg, paulo@0: or The Tetris Company LLC. paulo@0: paulo@0: */ paulo@0: paulo@0: #ifndef OPTIONS_H paulo@0: #define OPTIONS_H paulo@0: paulo@0: #include "lj.h" paulo@0: #include "ljcontrol.h" paulo@0: #include "ljlocale.h" paulo@0: paulo@0: typedef struct OptionsLine { paulo@0: FourCC name; paulo@0: const FourCC *valueNames; paulo@0: unsigned char minValue; paulo@0: unsigned char nValues; paulo@0: unsigned char startValue; paulo@0: unsigned char style; paulo@0: // const char *desc; paulo@0: } OptionsLine; paulo@0: paulo@0: /* paulo@0: * OPTSTYLE_DEFAULT and no valueNames: paulo@0: * Render value as a number. paulo@0: * OPTSTYLE_DEFAULT and valueNames: paulo@0: * Render value as valueNames[value - minValue] paulo@0: * OPTSTYLE_FRAMES and no valueNames: paulo@0: * Render value as a number and as a number times 50/3. paulo@0: * OPTSTYLE_FRAMES and no valueNames: paulo@0: * Similar, except override value == minValue with valueNames[0] paulo@0: * and value == minValue + nValues - 1 with valueNames[1]. paulo@0: */ paulo@0: enum { paulo@0: OPTSTYLE_DEFAULT, // names, or numbers paulo@0: OPTSTYLE_FRAMES, paulo@0: OPTSTYLE_FRAC_G paulo@0: }; paulo@0: paulo@0: typedef struct OptionsPage { paulo@0: unsigned int start; paulo@0: const char *name; paulo@0: } OptionsPage; paulo@0: paulo@0: #define N_KICK_LIMITS 7 paulo@0: extern const OptionsLine commonOptionsMenu[]; paulo@0: extern const OptionsPage optionsPages[]; paulo@0: extern const FourCC optionsRotNames[N_ROTATION_SYSTEMS]; paulo@0: extern const FourCC optionsLockdownNames[]; paulo@0: extern const FourCC gimmickNames[LJGM_N_GIMMICKS]; paulo@0: extern const FourCC optionsPieceSetNames[]; paulo@0: extern const FourCC optionsBoolNames[2]; paulo@0: extern const FourCC optionsZangiNames[]; paulo@0: extern const FourCC optionsGluingNames[]; paulo@0: extern const FourCC optionsRandNames[]; paulo@0: extern const FourCC optionsTspinNames[LJTS_N_ALGOS]; paulo@0: extern const FourCC optionsGravNames[]; paulo@0: extern const FourCC optionsSpeedCurveNames[]; paulo@0: extern const FourCC optionsGarbageNames[]; paulo@0: extern const FourCC optionsHoldStyleNames[]; paulo@0: extern const FourCC optionsScoringNames[LJSCORE_N_STYLES]; paulo@0: extern const FourCC optionsDropScoringNames[LJDROP_N_STYLES]; paulo@0: extern const FourCC gimmickNames[LJGM_N_GIMMICKS]; paulo@0: extern const FourCC optionsSideNames[]; paulo@0: extern const FourCC optionsNextStyleNames[]; paulo@0: extern const FourCC optionsShadowNames[]; paulo@0: extern const FourCC optionsDASDelayNames[]; paulo@0: paulo@0: paulo@0: enum { paulo@0: OPTIONS_GIMMICK, paulo@0: paulo@0: OPTIONS_WIDTH, paulo@0: OPTIONS_HEIGHT, paulo@0: OPTIONS_ENTER_ABOVE, paulo@0: OPTIONS_SPEED_CURVE, paulo@0: OPTIONS_ENTRY_DELAY, paulo@0: OPTIONS_PIECE_SET, paulo@0: OPTIONS_RANDOMIZER, paulo@0: paulo@0: OPTIONS_HOLD_PIECE, paulo@0: OPTIONS_ROTATION_SYSTEM, paulo@0: OPTIONS_FLOOR_KICKS, paulo@0: OPTIONS_LOCKDOWN, paulo@0: OPTIONS_LOCK_DELAY, paulo@0: OPTIONS_BOTTOM_BLOCKS, paulo@0: paulo@0: OPTIONS_LINE_DELAY, paulo@0: OPTIONS_CLEAR_GRAVITY, paulo@0: OPTIONS_GLUING, paulo@0: OPTIONS_SCORING, paulo@0: OPTIONS_DROP_SCORING, paulo@0: OPTIONS_T_SPIN, paulo@0: OPTIONS_GARBAGE, paulo@0: paulo@0: OPTIONS_SIDEWAYS_DELAY, paulo@0: OPTIONS_SIDEWAYS_SPEED, paulo@0: OPTIONS_INITIAL_SIDEWAYS, paulo@0: OPTIONS_IRS, paulo@0: OPTIONS_DIAGONAL_MOTION, paulo@0: OPTIONS_SOFT_DROP_SPEED, paulo@0: OPTIONS_SOFT_DROP, paulo@0: OPTIONS_HARD_DROP, paulo@0: paulo@0: OPTIONS_SHADOW, paulo@0: OPTIONS_HIDE_PF, paulo@0: OPTIONS_NEXT_PIECES, paulo@0: OPTIONS_SMOOTH_GRAVITY, paulo@0: paulo@0: OPTIONS_MENU_LEN paulo@0: }; paulo@0: paulo@0: /** paulo@0: * Builds a string representing the value of an option. paulo@0: * @param dst 32-byte buffer to hold this string paulo@0: * @param line index into optionsMenu paulo@0: * @param value the (numeric) value of the option paulo@0: * @return the description of this value, or NULL if unknown paulo@0: */ paulo@0: const char *getOptionsValueStr(char *dst, int line, int value); paulo@0: #define OPTIONS_VALUE_LEN 33 paulo@0: paulo@0: void unpackCommonOptions(LJView *v, const unsigned char *prefs); paulo@0: void initOptions(unsigned char *prefs); paulo@0: const char *isDisabledOption(const unsigned char *prefs, int y); paulo@0: paulo@0: void optionsWinInit(void); paulo@0: void optionsDrawPage(int scroll, const unsigned char *prefs); paulo@0: void optionsDrawRow(const unsigned char *prefs, paulo@0: int dstY, int line, int value, int hilite); paulo@0: void optionsIdle(void); paulo@0: paulo@0: #endif