annotate src/ljreplay.h @ 0:c84446dfb3f5

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