| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
#include <stdio.h> |
| 21 |
|
| 22 |
#ifndef SCARE_H |
| 23 |
#define SCARE_H |
| 24 |
|
| 25 |
#if defined(__cplusplus) |
| 26 |
extern "C" |
| 27 |
{ |
| 28 |
#endif |
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
typedef char sc_char; |
| 42 |
typedef unsigned char sc_byte; |
| 43 |
typedef long sc_int; |
| 44 |
typedef unsigned long sc_uint; |
| 45 |
typedef int sc_bool; |
| 46 |
|
| 47 |
|
| 48 |
enum |
| 49 |
{ SC_CONF_QUIT = 0, |
| 50 |
SC_CONF_RESTART, SC_CONF_SAVE, SC_CONF_RESTORE, SC_CONF_VIEW_HINTS |
| 51 |
}; |
| 52 |
|
| 53 |
|
| 54 |
enum |
| 55 |
{ SC_TAG_UNKNOWN = 0, SC_TAG_ITALICS, SC_TAG_ENDITALICS, SC_TAG_BOLD, |
| 56 |
SC_TAG_ENDBOLD, SC_TAG_UNDERLINE, SC_TAG_ENDUNDERLINE, SC_TAG_COLOR, |
| 57 |
SC_TAG_ENDCOLOR, SC_TAG_FONT, SC_TAG_ENDFONT, SC_TAG_BGCOLOR, SC_TAG_CENTER, |
| 58 |
SC_TAG_ENDCENTER, SC_TAG_RIGHT, SC_TAG_ENDRIGHT, SC_TAG_WAIT, SC_TAG_WAITKEY, |
| 59 |
SC_TAG_CLS, |
| 60 |
|
| 61 |
|
| 62 |
SC_TAG_COLOUR = SC_TAG_COLOR, |
| 63 |
SC_TAG_ENDCOLOUR = SC_TAG_ENDCOLOR, |
| 64 |
SC_TAG_BGCOLOUR = SC_TAG_BGCOLOR, |
| 65 |
SC_TAG_CENTRE = SC_TAG_CENTER, |
| 66 |
SC_TAG_ENDCENTRE = SC_TAG_ENDCENTER |
| 67 |
}; |
| 68 |
|
| 69 |
|
| 70 |
typedef void *sc_game; |
| 71 |
extern void os_print_string (const sc_char *string); |
| 72 |
extern void os_print_tag (sc_int tag, const sc_char *argument); |
| 73 |
extern void os_play_sound (const sc_char *filepath, |
| 74 |
sc_int offset, sc_int length, sc_bool is_looping); |
| 75 |
extern void os_stop_sound (void); |
| 76 |
extern void os_show_graphic (const sc_char *filepath, |
| 77 |
sc_int offset, sc_int length); |
| 78 |
extern sc_bool os_read_line (sc_char *buffer, sc_int length); |
| 79 |
extern sc_bool os_confirm (sc_int type); |
| 80 |
extern void *os_open_file (sc_bool is_save); |
| 81 |
extern void os_write_file (void *opaque, const sc_byte *buffer, sc_int length); |
| 82 |
extern sc_int os_read_file (void *opaque, sc_byte *buffer, sc_int length); |
| 83 |
extern void os_close_file (void *opaque); |
| 84 |
extern void os_display_hints (sc_game game); |
| 85 |
|
| 86 |
extern void os_print_string_debug (const sc_char *string); |
| 87 |
extern sc_bool os_read_line_debug (sc_char *buffer, sc_int length); |
| 88 |
|
| 89 |
|
| 90 |
enum |
| 91 |
{ SC_TRACE_PARSE = 1, SC_TRACE_PROPERTIES = 2, SC_TRACE_VARIABLES = 4, |
| 92 |
SC_TRACE_PARSER = 8, SC_TRACE_LIBRARY = 16, SC_TRACE_EVENTS = 32, |
| 93 |
SC_TRACE_NPCS = 64, SC_TRACE_OBJECTS = 128, SC_TRACE_TASKS = 256, |
| 94 |
SC_TRACE_PRINTFILTER = 512, |
| 95 |
|
| 96 |
SC_DUMP_TAF = 1024, SC_DUMP_PROPERTIES = 2048, SC_DUMP_VARIABLES = 4096, |
| 97 |
SC_DUMP_PARSER_TREES = 8192, SC_DUMP_LOCALE_TABLES = 16384 |
| 98 |
}; |
| 99 |
|
| 100 |
|
| 101 |
extern void sc_set_trace_flags (sc_uint trace_flags); |
| 102 |
|
| 103 |
|
| 104 |
extern sc_game sc_game_from_filename (const sc_char *filename); |
| 105 |
extern sc_game sc_game_from_stream (FILE *stream); |
| 106 |
extern sc_game sc_game_from_callback (sc_int (*callback) |
| 107 |
(void *, sc_byte *, sc_int), |
| 108 |
void *opaque); |
| 109 |
extern void sc_interpret_game (sc_game game); |
| 110 |
extern void sc_restart_game (sc_game game); |
| 111 |
extern sc_bool sc_save_game (sc_game game); |
| 112 |
extern sc_bool sc_load_game (sc_game game); |
| 113 |
extern sc_bool sc_undo_game_turn (sc_game game); |
| 114 |
extern void sc_quit_game (sc_game game); |
| 115 |
extern sc_bool sc_save_game_to_filename (sc_game game, const sc_char *filename); |
| 116 |
extern void sc_save_game_to_stream (sc_game game, FILE *stream); |
| 117 |
extern void sc_save_game_to_callback (sc_game game, |
| 118 |
void (*callback) |
| 119 |
(void *, const sc_byte *, sc_int), |
| 120 |
void *opaque); |
| 121 |
extern sc_bool sc_load_game_from_filename (sc_game game, |
| 122 |
const sc_char *filename); |
| 123 |
extern sc_bool sc_load_game_from_stream (sc_game game, FILE *stream); |
| 124 |
extern sc_bool sc_load_game_from_callback (sc_game game, |
| 125 |
sc_int (*callback) |
| 126 |
(void *, sc_byte *, sc_int), |
| 127 |
void *opaque); |
| 128 |
extern void sc_free_game (sc_game game); |
| 129 |
extern sc_bool sc_is_game_running (sc_game game); |
| 130 |
extern const sc_char *sc_get_game_name (sc_game game); |
| 131 |
extern const sc_char *sc_get_game_author (sc_game game); |
| 132 |
extern const sc_char *sc_get_game_compile_date (sc_game game); |
| 133 |
extern sc_int sc_get_game_turns (sc_game game); |
| 134 |
extern sc_int sc_get_game_score (sc_game game); |
| 135 |
extern sc_int sc_get_game_max_score (sc_game game); |
| 136 |
extern const sc_char *sc_get_game_room (sc_game game); |
| 137 |
extern const sc_char *sc_get_game_status_line (sc_game game); |
| 138 |
extern const sc_char *sc_get_game_preferred_font (sc_game game); |
| 139 |
extern sc_bool sc_get_game_bold_room_names (sc_game game); |
| 140 |
extern sc_bool sc_get_game_verbose (sc_game game); |
| 141 |
extern sc_bool sc_get_game_notify_score_change (sc_game game); |
| 142 |
extern sc_bool sc_has_game_completed (sc_game game); |
| 143 |
extern sc_bool sc_is_game_undo_available (sc_game game); |
| 144 |
extern void sc_set_game_bold_room_names (sc_game game, sc_bool flag); |
| 145 |
extern void sc_set_game_verbose (sc_game game, sc_bool flag); |
| 146 |
extern void sc_set_game_notify_score_change (sc_game game, sc_bool flag); |
| 147 |
|
| 148 |
extern sc_bool sc_does_game_use_sounds (sc_game); |
| 149 |
extern sc_bool sc_does_game_use_graphics (sc_game); |
| 150 |
|
| 151 |
typedef void *sc_game_hint; |
| 152 |
extern sc_game_hint sc_get_first_game_hint (sc_game game); |
| 153 |
extern sc_game_hint sc_get_next_game_hint (sc_game game, sc_game_hint hint); |
| 154 |
extern const sc_char *sc_get_game_hint_question (sc_game game, |
| 155 |
sc_game_hint hint); |
| 156 |
extern const sc_char *sc_get_game_subtle_hint (sc_game game, |
| 157 |
sc_game_hint hint); |
| 158 |
extern const sc_char *sc_get_game_unsubtle_hint (sc_game game, |
| 159 |
sc_game_hint hint); |
| 160 |
|
| 161 |
extern void sc_set_game_debugger_enabled (sc_game game, sc_bool flag); |
| 162 |
extern sc_bool sc_get_game_debugger_enabled (sc_game game); |
| 163 |
extern sc_bool sc_run_game_debugger_command (sc_game game, |
| 164 |
const sc_char *debug_command); |
| 165 |
extern void sc_set_portable_random (sc_bool flag); |
| 166 |
extern void sc_reseed_random_sequence (sc_uint new_seed); |
| 167 |
|
| 168 |
|
| 169 |
extern sc_bool sc_set_locale (const sc_char *name); |
| 170 |
extern const sc_char *sc_get_locale (void); |
| 171 |
|
| 172 |
|
| 173 |
extern sc_int sc_strncasecmp (const sc_char *s1, const sc_char *s2, sc_int n); |
| 174 |
extern sc_int sc_strcasecmp (const sc_char *s1, const sc_char *s2); |
| 175 |
extern const sc_char *sc_scare_version (void); |
| 176 |
extern sc_int sc_scare_emulation (void); |
| 177 |
|
| 178 |
#if defined(__cplusplus) |
| 179 |
} |
| 180 |
#endif |
| 181 |
|
| 182 |
#endif |