forked from TheGLander/tworld
-
Notifications
You must be signed in to change notification settings - Fork 0
/
play.h
130 lines (102 loc) · 3.52 KB
/
play.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/* play.h: Functions to drive game-play and manage the game state.
*
* Copyright (C) 2001-2010 by Brian Raiter and Madhav Shanbhag,
* under the GNU General Public License. No warranty. See COPYING for details.
*/
#ifndef HEADER_play_h_
#define HEADER_play_h_
#include "defs.h"
/* The different modes of the program with respect to gameplay.
*/
enum {
NormalPlay, EndPlay,
SuspendPlay, SuspendPlayShuttered,
NonrenderPlay
};
/* TRUE if the program is running without a user interface.
*/
extern int batchmode;
#ifdef __cplusplus
extern "C"
{
#endif
/* Change the current gameplay mode. This affects the running of the
* timer and the handling of the keyboard.
*/
extern void setgameplaymode(int mode);
/* Initialize the current state to the starting position of the
* given level.
*/
extern int initgamestate(gamesetup *game, int ruleset);
/* Set up the current state to play from its prerecorded solution.
* FALSE is returned if no solution is available for playback.
*/
extern int prepareplayback(void);
extern int setstepping(int stepping, int display);
extern int changestepping(int delta, int display);
extern void advanceinitrandomff(int display);
/* Get a string representing the stepping and (in Lynx mode) initial random
* force floor direction. */
extern char const *getinitstatestring(void);
/* Return the amount of time passed in the current game, in seconds.
*/
extern int secondsplayed(void);
/* Handle one tick of the game. cmd is the current keyboard command
* supplied by the user, or CmdPreserve if any pending command is to
* be retained. The return value is positive if the game was completed
* successfully, negative if the game ended unsuccessfully, and zero
* if the game remains in progress.
*/
extern int doturn(int cmd);
/* Update the display during game play. If showframe is FALSE, then
* nothing is actually displayed.
*/
extern int drawscreen(int showframe);
/* Quit game play early.
*/
extern int quitgamestate(void);
/* Free any resources associates with the current game state.
*/
extern int endgamestate(void);
/* Free all persistent resources in the module.
*/
extern void shutdowngamestate(void);
/* Initialize the current state to a small level used for display at
* the completion of a series.
*/
extern void setenddisplay(void);
/* Return TRUE if a solution exists for the given level.
*/
extern int hassolution(gamesetup const *game);
/* Replace the user's solution with the just-executed solution if it
* beats the existing solution for shortest time. FALSE is returned if
* nothing was changed.
*/
extern int replacesolution(void);
/* Delete the user's best solution for the current game. FALSE is
* returned if no solution was present to delete.
*/
extern int deletesolution(void);
/* Double-check the timing for a solution that has just been played
* back. If the timing is incorrect, but the cause of the discrepancy
* can be reasonably ascertained to be benign, the timings will be
* corrected and the return value will be TRUE.
*/
extern int checksolution(void);
/* Turn pedantic mode on. The ruleset will be slightly changed to be
* as faithful as possible to the original source material.
*/
extern void setpedanticmode(void);
/* Slow down the game clock by the given factor. Used for debugging
* purposes.
*/
extern int setmudsuckingfactor(int mud);
/* Toggle whether to show stepping/initial random force floor direction
* during solution playback.
*/
extern void toggleshowinitstate(void);
extern void setinterpolation(float interpolation);
#ifdef __cplusplus
}
#endif
#endif