Mercurial > hg > index.fcgi > lj > lj046
view src/ljcontrol.h @ 0:c84446dfb3f5
initial add
author | paulo@localhost |
---|---|
date | Fri, 13 Mar 2009 00:39:12 -0700 |
parents | |
children |
line source
1 /* Control for LOCKJAW, an implementation of the Soviet Mind Game
3 Copyright (C) 2006 Damian Yerrick <tepples+lj@spamcop.net>
5 This work is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 Original game concept and design by Alexey Pajitnov.
20 The Software is not sponsored or endorsed by Alexey Pajitnov, Elorg,
21 or The Tetris Company LLC.
23 */
25 #ifndef LJCONTROL_H
26 #define LJCONTROL_H
28 #include "ljtypes.h"
30 // The cross-platform parts of the view are stored here
31 typedef struct LJControl {
32 LJBits lastKeys, repressKeys;
33 unsigned int presses;
34 unsigned char dasSpeed;
35 unsigned char dasDelay;
36 signed char dasCounter;
37 unsigned char allowDiagonals;
38 unsigned char softDropSpeed;
39 unsigned char softDropLock;
40 unsigned char hardDropLock;
41 unsigned char initialDAS;
42 unsigned char initialRotate;
43 signed char countdown;
44 struct LJReplay *replaySrc;
45 struct LJReplay *replayDst;
46 } LJControl;
48 struct LJField;
49 struct LJInput;
51 #define N_SPEED_METER_PIECES 10
53 typedef struct LJView {
54 struct LJField *field;
55 LJControl *control;
56 LJBits backDirty;
57 LJBits frontDirty;
58 struct LJPCView *plat;
59 unsigned char smoothGravity;
60 unsigned char hideNext;
61 unsigned char hideShadow;
62 unsigned char nextPieces;
63 unsigned char hidePF;
64 unsigned char showTrails;
65 unsigned char nLockTimes;
66 unsigned int lockTime[N_SPEED_METER_PIECES];
67 LJFixed trailY;
68 } LJView;
70 enum {
71 LJSHADOW_COLORED_25 = 0,
72 LJSHADOW_COLORED_50,
73 LJSHADOW_COLORED,
74 LJSHADOW_COLORLESS,
75 LJSHADOW_NONE,
76 LJSHADOW_NO_FALLING,
77 LJSHADOW_N_STYLES
78 };
80 #define VKEY_UP 0x0001
81 #define VKEY_DOWN 0x0002
82 #define VKEY_LEFT 0x0004
83 #define VKEY_RIGHT 0x0008
84 #define VKEY_ROTL 0x0010
85 #define VKEY_ROTR 0x0020
86 #define VKEY_HOLD 0x0040
87 #define VKEY_ITEM 0x0080
88 #define VKEY_MACRO(x) (0x100 << (x))
89 #define VKEY_MACROS 0xFF00
90 #define VKEY_START 0x00080000
92 enum {
93 LJZANGI_SLIDE,
94 LJZANGI_LOCK,
95 LJZANGI_LOCK_RELEASE,
96 LJZANGI_N_STYLES
97 };
99 /* VKEY_MACRO(0) to VKEY_MACRO(7)
101 Event planners can restrict how many macros a player can use,
102 so that keyboardists don't have an unfair advantage over
103 gamepad users.
105 */
107 void addKeysToInput(struct LJInput *dst, LJBits keys, const struct LJField *p, LJControl *c);
109 #endif