diff src/options.h @ 0:c84446dfb3f5

initial add
author paulo@localhost
date Fri, 13 Mar 2009 00:39:12 -0700
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/options.h	Fri Mar 13 00:39:12 2009 -0700
     1.3 @@ -0,0 +1,152 @@
     1.4 +/* options code for LOCKJAW, an implementation of the Soviet Mind Game
     1.5 +
     1.6 +Copyright (C) 2007 Damian Yerrick <tepples+lj@spamcop.net>
     1.7 +
     1.8 +This work is free software; you can redistribute it and/or modify
     1.9 +it under the terms of the GNU General Public License as published by
    1.10 +the Free Software Foundation; either version 2 of the License, or
    1.11 +(at your option) any later version.
    1.12 +
    1.13 +This program is distributed in the hope that it will be useful,
    1.14 +but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.15 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.16 +GNU General Public License for more details.
    1.17 +
    1.18 +You should have received a copy of the GNU General Public License
    1.19 +along with this program; if not, write to the Free Software
    1.20 +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1.21 +
    1.22 +Original game concept and design by Alexey Pajitnov.
    1.23 +The Software is not sponsored or endorsed by Alexey Pajitnov, Elorg,
    1.24 +or The Tetris Company LLC.
    1.25 +
    1.26 +*/
    1.27 +
    1.28 +#ifndef OPTIONS_H
    1.29 +#define OPTIONS_H
    1.30 +
    1.31 +#include "lj.h"
    1.32 +#include "ljcontrol.h"
    1.33 +#include "ljlocale.h"
    1.34 +
    1.35 +typedef struct OptionsLine {
    1.36 +  FourCC name;
    1.37 +  const FourCC *valueNames;
    1.38 +  unsigned char minValue;
    1.39 +  unsigned char nValues;  
    1.40 +  unsigned char startValue;
    1.41 +  unsigned char style;
    1.42 +  // const char *desc;
    1.43 +} OptionsLine;
    1.44 +
    1.45 +/*
    1.46 + * OPTSTYLE_DEFAULT and no valueNames:
    1.47 + *   Render value as a number.
    1.48 + * OPTSTYLE_DEFAULT and valueNames:
    1.49 + *   Render value as valueNames[value - minValue]
    1.50 + * OPTSTYLE_FRAMES and no valueNames:
    1.51 + *   Render value as a number and as a number times 50/3.
    1.52 + * OPTSTYLE_FRAMES and no valueNames:
    1.53 + *   Similar, except override value == minValue with valueNames[0]
    1.54 + *   and value == minValue + nValues - 1 with valueNames[1].
    1.55 + */
    1.56 +enum {
    1.57 +  OPTSTYLE_DEFAULT,  // names, or numbers
    1.58 +  OPTSTYLE_FRAMES,
    1.59 +  OPTSTYLE_FRAC_G
    1.60 +};
    1.61 +
    1.62 +typedef struct OptionsPage {
    1.63 +  unsigned int start;
    1.64 +  const char *name;
    1.65 +} OptionsPage;
    1.66 +
    1.67 +#define N_KICK_LIMITS 7
    1.68 +extern const OptionsLine commonOptionsMenu[];
    1.69 +extern const OptionsPage optionsPages[];
    1.70 +extern const FourCC optionsRotNames[N_ROTATION_SYSTEMS];
    1.71 +extern const FourCC optionsLockdownNames[];
    1.72 +extern const FourCC gimmickNames[LJGM_N_GIMMICKS];
    1.73 +extern const FourCC optionsPieceSetNames[];
    1.74 +extern const FourCC optionsBoolNames[2];
    1.75 +extern const FourCC optionsZangiNames[];
    1.76 +extern const FourCC optionsGluingNames[];
    1.77 +extern const FourCC optionsRandNames[];
    1.78 +extern const FourCC optionsTspinNames[LJTS_N_ALGOS];
    1.79 +extern const FourCC optionsGravNames[];
    1.80 +extern const FourCC optionsSpeedCurveNames[];
    1.81 +extern const FourCC optionsGarbageNames[];
    1.82 +extern const FourCC optionsHoldStyleNames[];
    1.83 +extern const FourCC optionsScoringNames[LJSCORE_N_STYLES];
    1.84 +extern const FourCC optionsDropScoringNames[LJDROP_N_STYLES];
    1.85 +extern const FourCC gimmickNames[LJGM_N_GIMMICKS];
    1.86 +extern const FourCC optionsSideNames[];
    1.87 +extern const FourCC optionsNextStyleNames[];
    1.88 +extern const FourCC optionsShadowNames[];
    1.89 +extern const FourCC optionsDASDelayNames[];
    1.90 +
    1.91 +
    1.92 +enum {
    1.93 +  OPTIONS_GIMMICK,
    1.94 +
    1.95 +  OPTIONS_WIDTH,
    1.96 +  OPTIONS_HEIGHT,
    1.97 +  OPTIONS_ENTER_ABOVE,
    1.98 +  OPTIONS_SPEED_CURVE,
    1.99 +  OPTIONS_ENTRY_DELAY,
   1.100 +  OPTIONS_PIECE_SET,
   1.101 +  OPTIONS_RANDOMIZER,
   1.102 +
   1.103 +  OPTIONS_HOLD_PIECE,
   1.104 +  OPTIONS_ROTATION_SYSTEM,
   1.105 +  OPTIONS_FLOOR_KICKS,
   1.106 +  OPTIONS_LOCKDOWN,
   1.107 +  OPTIONS_LOCK_DELAY,
   1.108 +  OPTIONS_BOTTOM_BLOCKS,
   1.109 +
   1.110 +  OPTIONS_LINE_DELAY,
   1.111 +  OPTIONS_CLEAR_GRAVITY,
   1.112 +  OPTIONS_GLUING,
   1.113 +  OPTIONS_SCORING,
   1.114 +  OPTIONS_DROP_SCORING,
   1.115 +  OPTIONS_T_SPIN,
   1.116 +  OPTIONS_GARBAGE,
   1.117 +
   1.118 +  OPTIONS_SIDEWAYS_DELAY,
   1.119 +  OPTIONS_SIDEWAYS_SPEED,
   1.120 +  OPTIONS_INITIAL_SIDEWAYS,
   1.121 +  OPTIONS_IRS,
   1.122 +  OPTIONS_DIAGONAL_MOTION,
   1.123 +  OPTIONS_SOFT_DROP_SPEED,
   1.124 +  OPTIONS_SOFT_DROP,
   1.125 +  OPTIONS_HARD_DROP,
   1.126 +
   1.127 +  OPTIONS_SHADOW,
   1.128 +  OPTIONS_HIDE_PF,
   1.129 +  OPTIONS_NEXT_PIECES,
   1.130 +  OPTIONS_SMOOTH_GRAVITY,
   1.131 +
   1.132 +  OPTIONS_MENU_LEN
   1.133 +};
   1.134 +
   1.135 +/**
   1.136 + * Builds a string representing the value of an option.
   1.137 + * @param dst 32-byte buffer to hold this string
   1.138 + * @param line index into optionsMenu
   1.139 + * @param value the (numeric) value of the option
   1.140 + * @return the description of this value, or NULL if unknown
   1.141 + */
   1.142 +const char *getOptionsValueStr(char *dst, int line, int value);
   1.143 +#define OPTIONS_VALUE_LEN 33
   1.144 +
   1.145 +void unpackCommonOptions(LJView *v, const unsigned char *prefs);
   1.146 +void initOptions(unsigned char *prefs);
   1.147 +const char *isDisabledOption(const unsigned char *prefs, int y);
   1.148 +
   1.149 +void optionsWinInit(void);
   1.150 +void optionsDrawPage(int scroll, const unsigned char *prefs);
   1.151 +void optionsDrawRow(const unsigned char *prefs,
   1.152 +                    int dstY, int line, int value, int hilite);
   1.153 +void optionsIdle(void);
   1.154 +
   1.155 +#endif