Mercurial > hg > index.fcgi > lj > lj046
diff src/ljreplay.h @ 0:c84446dfb3f5
initial add
author | paulo@localhost |
---|---|
date | Fri, 13 Mar 2009 00:39:12 -0700 |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/ljreplay.h Fri Mar 13 00:39:12 2009 -0700 1.3 @@ -0,0 +1,70 @@ 1.4 +/* Replay functionality for LOCKJAW, an implementation of the Soviet Mind Game 1.5 + 1.6 +Copyright (C) 2006 Damian Yerrick <tepples+lj@spamcop.net> 1.7 + 1.8 +This work is free software; you can redistribute it and/or modify 1.9 +it under the terms of the GNU General Public License as published by 1.10 +the Free Software Foundation; either version 2 of the License, or 1.11 +(at your option) any later version. 1.12 + 1.13 +This program is distributed in the hope that it will be useful, 1.14 +but WITHOUT ANY WARRANTY; without even the implied warranty of 1.15 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1.16 +GNU General Public License for more details. 1.17 + 1.18 +You should have received a copy of the GNU General Public License 1.19 +along with this program; if not, write to the Free Software 1.20 +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 1.21 + 1.22 +Original game concept and design by Alexey Pajitnov. 1.23 +The Software is not sponsored or endorsed by Alexey Pajitnov, Elorg, 1.24 +or The Tetris Company LLC. 1.25 + 1.26 +*/ 1.27 +#ifndef LJREPLAY_H 1.28 +#define LJREPLAY_H 1.29 + 1.30 +#include "lj.h" 1.31 +#include "ljcontrol.h" 1.32 + 1.33 +#define LJREPLAY_EOF (-1) 1.34 + 1.35 +typedef struct LJReplay LJReplay; 1.36 + 1.37 +/** 1.38 + * Creates a new replay. 1.39 + * @param filename The name of the file to which the replay is recorded. 1.40 + * @param p The field that is observed. 1.41 + * @return A pointer to the replay object, 1.42 + * or NULL if allocation failed. 1.43 + */ 1.44 +LJReplay *newReplay(const char *filename, LJField *p); 1.45 + 1.46 +/** 1.47 + * Records a single frame of input in the replay. 1.48 + * If spawn or hold sound is played, records the new piece. 1.49 + * @param r The replay object. 1.50 + */ 1.51 +void replayRecord(LJReplay *r, LJBits keys, const LJInput *in); 1.52 + 1.53 +/** 1.54 + * Stops recording the replay and dumps it to the file. 1.55 + */ 1.56 +void replayClose(LJReplay *r); 1.57 + 1.58 +/** 1.59 + * Opens an existing replay. 1.60 + * @param filename The name of the file to which the replay is recorded. 1.61 + * @param p The field that is observed. 1.62 + * @return A pointer to the replay object, 1.63 + * or NULL if allocation failed. 1.64 + */ 1.65 +LJReplay *openReplay(const char *filename, LJField *p); 1.66 + 1.67 +/** 1.68 + * @param d The structure to be filled with input 1.69 + * @return The keys pressed, or REPLAY_EOF. 1.70 + */ 1.71 +int getReplayFrame(LJReplay *r, LJInput *d); 1.72 + 1.73 +#endif