annotate src/options.h @ 0:c84446dfb3f5

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