view src/ljreplay.h @ 2:80a2761bd3a4

change DS keys (add alt. rotate)
author paulo@localhost
date Mon, 23 Mar 2009 01:19:12 -0700
parents
children
line source
1 /* Replay functionality 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 */
24 #ifndef LJREPLAY_H
25 #define LJREPLAY_H
27 #include "lj.h"
28 #include "ljcontrol.h"
30 #define LJREPLAY_EOF (-1)
32 typedef struct LJReplay LJReplay;
34 /**
35 * Creates a new replay.
36 * @param filename The name of the file to which the replay is recorded.
37 * @param p The field that is observed.
38 * @return A pointer to the replay object,
39 * or NULL if allocation failed.
40 */
41 LJReplay *newReplay(const char *filename, LJField *p);
43 /**
44 * Records a single frame of input in the replay.
45 * If spawn or hold sound is played, records the new piece.
46 * @param r The replay object.
47 */
48 void replayRecord(LJReplay *r, LJBits keys, const LJInput *in);
50 /**
51 * Stops recording the replay and dumps it to the file.
52 */
53 void replayClose(LJReplay *r);
55 /**
56 * Opens an existing replay.
57 * @param filename The name of the file to which the replay is recorded.
58 * @param p The field that is observed.
59 * @return A pointer to the replay object,
60 * or NULL if allocation failed.
61 */
62 LJReplay *openReplay(const char *filename, LJField *p);
64 /**
65 * @param d The structure to be filled with input
66 * @return The keys pressed, or REPLAY_EOF.
67 */
68 int getReplayFrame(LJReplay *r, LJInput *d);
70 #endif