diff src/ljcontrol.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/ljcontrol.h	Fri Mar 13 00:39:12 2009 -0700
     1.3 @@ -0,0 +1,109 @@
     1.4 +/* Control for LOCKJAW, an implementation of the Soviet Mind Game
     1.5 +
     1.6 +Copyright (C) 2006 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 LJCONTROL_H
    1.29 +#define LJCONTROL_H
    1.30 +
    1.31 +#include "ljtypes.h"
    1.32 +
    1.33 +// The cross-platform parts of the view are stored here
    1.34 +typedef struct LJControl {
    1.35 +  LJBits lastKeys, repressKeys;
    1.36 +  unsigned int presses;
    1.37 +  unsigned char dasSpeed;
    1.38 +  unsigned char dasDelay;
    1.39 +  signed char dasCounter;
    1.40 +  unsigned char allowDiagonals;
    1.41 +  unsigned char softDropSpeed;
    1.42 +  unsigned char softDropLock;
    1.43 +  unsigned char hardDropLock;
    1.44 +  unsigned char initialDAS;
    1.45 +  unsigned char initialRotate;
    1.46 +  signed char countdown;
    1.47 +  struct LJReplay *replaySrc;
    1.48 +  struct LJReplay *replayDst;
    1.49 +} LJControl;
    1.50 +
    1.51 +struct LJField;
    1.52 +struct LJInput;
    1.53 +
    1.54 +#define N_SPEED_METER_PIECES 10
    1.55 +
    1.56 +typedef struct LJView {
    1.57 +  struct LJField *field;
    1.58 +  LJControl *control;
    1.59 +  LJBits backDirty;
    1.60 +  LJBits frontDirty;
    1.61 +  struct LJPCView *plat;
    1.62 +  unsigned char smoothGravity;
    1.63 +  unsigned char hideNext;
    1.64 +  unsigned char hideShadow;
    1.65 +  unsigned char nextPieces;
    1.66 +  unsigned char hidePF;
    1.67 +  unsigned char showTrails;
    1.68 +  unsigned char nLockTimes;
    1.69 +  unsigned int lockTime[N_SPEED_METER_PIECES];
    1.70 +  LJFixed trailY;
    1.71 +} LJView;
    1.72 +
    1.73 +enum {
    1.74 +  LJSHADOW_COLORED_25 = 0,
    1.75 +  LJSHADOW_COLORED_50,
    1.76 +  LJSHADOW_COLORED,
    1.77 +  LJSHADOW_COLORLESS,
    1.78 +  LJSHADOW_NONE,
    1.79 +  LJSHADOW_NO_FALLING,
    1.80 +  LJSHADOW_N_STYLES
    1.81 +};
    1.82 +
    1.83 +#define VKEY_UP        0x0001
    1.84 +#define VKEY_DOWN      0x0002
    1.85 +#define VKEY_LEFT      0x0004
    1.86 +#define VKEY_RIGHT     0x0008
    1.87 +#define VKEY_ROTL      0x0010
    1.88 +#define VKEY_ROTR      0x0020
    1.89 +#define VKEY_HOLD      0x0040
    1.90 +#define VKEY_ITEM      0x0080
    1.91 +#define VKEY_MACRO(x)  (0x100 << (x))
    1.92 +#define VKEY_MACROS    0xFF00
    1.93 +#define VKEY_START     0x00080000
    1.94 +
    1.95 +enum {
    1.96 +  LJZANGI_SLIDE,
    1.97 +  LJZANGI_LOCK,
    1.98 +  LJZANGI_LOCK_RELEASE,
    1.99 +  LJZANGI_N_STYLES
   1.100 +};
   1.101 +
   1.102 +/* VKEY_MACRO(0) to VKEY_MACRO(7)
   1.103 +
   1.104 +Event planners can restrict how many macros a player can use,
   1.105 +so that keyboardists don't have an unfair advantage over
   1.106 +gamepad users.
   1.107 +
   1.108 +*/
   1.109 +
   1.110 +void addKeysToInput(struct LJInput *dst, LJBits keys, const struct LJField *p, LJControl *c);
   1.111 +
   1.112 +#endif