annotate src/ljcontrol.h @ 2:80a2761bd3a4

change DS keys (add alt. rotate)
author paulo@localhost
date Mon, 23 Mar 2009 01:19:12 -0700
parents
children
rev   line source
paulo@0 1 /* Control for LOCKJAW, an implementation of the Soviet Mind Game
paulo@0 2
paulo@0 3 Copyright (C) 2006 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 LJCONTROL_H
paulo@0 26 #define LJCONTROL_H
paulo@0 27
paulo@0 28 #include "ljtypes.h"
paulo@0 29
paulo@0 30 // The cross-platform parts of the view are stored here
paulo@0 31 typedef struct LJControl {
paulo@0 32 LJBits lastKeys, repressKeys;
paulo@0 33 unsigned int presses;
paulo@0 34 unsigned char dasSpeed;
paulo@0 35 unsigned char dasDelay;
paulo@0 36 signed char dasCounter;
paulo@0 37 unsigned char allowDiagonals;
paulo@0 38 unsigned char softDropSpeed;
paulo@0 39 unsigned char softDropLock;
paulo@0 40 unsigned char hardDropLock;
paulo@0 41 unsigned char initialDAS;
paulo@0 42 unsigned char initialRotate;
paulo@0 43 signed char countdown;
paulo@0 44 struct LJReplay *replaySrc;
paulo@0 45 struct LJReplay *replayDst;
paulo@0 46 } LJControl;
paulo@0 47
paulo@0 48 struct LJField;
paulo@0 49 struct LJInput;
paulo@0 50
paulo@0 51 #define N_SPEED_METER_PIECES 10
paulo@0 52
paulo@0 53 typedef struct LJView {
paulo@0 54 struct LJField *field;
paulo@0 55 LJControl *control;
paulo@0 56 LJBits backDirty;
paulo@0 57 LJBits frontDirty;
paulo@0 58 struct LJPCView *plat;
paulo@0 59 unsigned char smoothGravity;
paulo@0 60 unsigned char hideNext;
paulo@0 61 unsigned char hideShadow;
paulo@0 62 unsigned char nextPieces;
paulo@0 63 unsigned char hidePF;
paulo@0 64 unsigned char showTrails;
paulo@0 65 unsigned char nLockTimes;
paulo@0 66 unsigned int lockTime[N_SPEED_METER_PIECES];
paulo@0 67 LJFixed trailY;
paulo@0 68 } LJView;
paulo@0 69
paulo@0 70 enum {
paulo@0 71 LJSHADOW_COLORED_25 = 0,
paulo@0 72 LJSHADOW_COLORED_50,
paulo@0 73 LJSHADOW_COLORED,
paulo@0 74 LJSHADOW_COLORLESS,
paulo@0 75 LJSHADOW_NONE,
paulo@0 76 LJSHADOW_NO_FALLING,
paulo@0 77 LJSHADOW_N_STYLES
paulo@0 78 };
paulo@0 79
paulo@0 80 #define VKEY_UP 0x0001
paulo@0 81 #define VKEY_DOWN 0x0002
paulo@0 82 #define VKEY_LEFT 0x0004
paulo@0 83 #define VKEY_RIGHT 0x0008
paulo@0 84 #define VKEY_ROTL 0x0010
paulo@0 85 #define VKEY_ROTR 0x0020
paulo@0 86 #define VKEY_HOLD 0x0040
paulo@0 87 #define VKEY_ITEM 0x0080
paulo@0 88 #define VKEY_MACRO(x) (0x100 << (x))
paulo@0 89 #define VKEY_MACROS 0xFF00
paulo@0 90 #define VKEY_START 0x00080000
paulo@0 91
paulo@0 92 enum {
paulo@0 93 LJZANGI_SLIDE,
paulo@0 94 LJZANGI_LOCK,
paulo@0 95 LJZANGI_LOCK_RELEASE,
paulo@0 96 LJZANGI_N_STYLES
paulo@0 97 };
paulo@0 98
paulo@0 99 /* VKEY_MACRO(0) to VKEY_MACRO(7)
paulo@0 100
paulo@0 101 Event planners can restrict how many macros a player can use,
paulo@0 102 so that keyboardists don't have an unfair advantage over
paulo@0 103 gamepad users.
paulo@0 104
paulo@0 105 */
paulo@0 106
paulo@0 107 void addKeysToInput(struct LJInput *dst, LJBits keys, const struct LJField *p, LJControl *c);
paulo@0 108
paulo@0 109 #endif