comparison src/ljcontrol.h @ 0:c84446dfb3f5

initial add
author paulo@localhost
date Fri, 13 Mar 2009 00:39:12 -0700
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:b74b13f32fb2
1 /* Control for LOCKJAW, an implementation of the Soviet Mind Game
2
3 Copyright (C) 2006 Damian Yerrick <tepples+lj@spamcop.net>
4
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.
9
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.
14
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
18
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.
22
23 */
24
25 #ifndef LJCONTROL_H
26 #define LJCONTROL_H
27
28 #include "ljtypes.h"
29
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;
47
48 struct LJField;
49 struct LJInput;
50
51 #define N_SPEED_METER_PIECES 10
52
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;
69
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 };
79
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
91
92 enum {
93 LJZANGI_SLIDE,
94 LJZANGI_LOCK,
95 LJZANGI_LOCK_RELEASE,
96 LJZANGI_N_STYLES
97 };
98
99 /* VKEY_MACRO(0) to VKEY_MACRO(7)
100
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.
104
105 */
106
107 void addKeysToInput(struct LJInput *dst, LJBits keys, const struct LJField *p, LJControl *c);
108
109 #endif