paulo@0: /* Control for LOCKJAW, an implementation of the Soviet Mind Game paulo@0: paulo@0: Copyright (C) 2006 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 LJCONTROL_H paulo@0: #define LJCONTROL_H paulo@0: paulo@0: #include "ljtypes.h" paulo@0: paulo@0: // The cross-platform parts of the view are stored here paulo@0: typedef struct LJControl { paulo@0: LJBits lastKeys, repressKeys; paulo@0: unsigned int presses; paulo@0: unsigned char dasSpeed; paulo@0: unsigned char dasDelay; paulo@0: signed char dasCounter; paulo@0: unsigned char allowDiagonals; paulo@0: unsigned char softDropSpeed; paulo@0: unsigned char softDropLock; paulo@0: unsigned char hardDropLock; paulo@0: unsigned char initialDAS; paulo@0: unsigned char initialRotate; paulo@0: signed char countdown; paulo@0: struct LJReplay *replaySrc; paulo@0: struct LJReplay *replayDst; paulo@0: } LJControl; paulo@0: paulo@0: struct LJField; paulo@0: struct LJInput; paulo@0: paulo@0: #define N_SPEED_METER_PIECES 10 paulo@0: paulo@0: typedef struct LJView { paulo@0: struct LJField *field; paulo@0: LJControl *control; paulo@0: LJBits backDirty; paulo@0: LJBits frontDirty; paulo@0: struct LJPCView *plat; paulo@0: unsigned char smoothGravity; paulo@0: unsigned char hideNext; paulo@0: unsigned char hideShadow; paulo@0: unsigned char nextPieces; paulo@0: unsigned char hidePF; paulo@0: unsigned char showTrails; paulo@0: unsigned char nLockTimes; paulo@0: unsigned int lockTime[N_SPEED_METER_PIECES]; paulo@0: LJFixed trailY; paulo@0: } LJView; paulo@0: paulo@0: enum { paulo@0: LJSHADOW_COLORED_25 = 0, paulo@0: LJSHADOW_COLORED_50, paulo@0: LJSHADOW_COLORED, paulo@0: LJSHADOW_COLORLESS, paulo@0: LJSHADOW_NONE, paulo@0: LJSHADOW_NO_FALLING, paulo@0: LJSHADOW_N_STYLES paulo@0: }; paulo@0: paulo@0: #define VKEY_UP 0x0001 paulo@0: #define VKEY_DOWN 0x0002 paulo@0: #define VKEY_LEFT 0x0004 paulo@0: #define VKEY_RIGHT 0x0008 paulo@0: #define VKEY_ROTL 0x0010 paulo@0: #define VKEY_ROTR 0x0020 paulo@0: #define VKEY_HOLD 0x0040 paulo@0: #define VKEY_ITEM 0x0080 paulo@0: #define VKEY_MACRO(x) (0x100 << (x)) paulo@0: #define VKEY_MACROS 0xFF00 paulo@0: #define VKEY_START 0x00080000 paulo@0: paulo@0: enum { paulo@0: LJZANGI_SLIDE, paulo@0: LJZANGI_LOCK, paulo@0: LJZANGI_LOCK_RELEASE, paulo@0: LJZANGI_N_STYLES paulo@0: }; paulo@0: paulo@0: /* VKEY_MACRO(0) to VKEY_MACRO(7) paulo@0: paulo@0: Event planners can restrict how many macros a player can use, paulo@0: so that keyboardists don't have an unfair advantage over paulo@0: gamepad users. paulo@0: paulo@0: */ paulo@0: paulo@0: void addKeysToInput(struct LJInput *dst, LJBits keys, const struct LJField *p, LJControl *c); paulo@0: paulo@0: #endif