0
|
1 |
#ifndef HAL_H
|
|
2 |
#define HAL_H
|
|
3 |
|
|
4 |
typedef struct {
|
|
5 |
char *(*start)(char **parm);
|
|
6 |
void (*stop)();
|
|
7 |
} HalCommonDriver;
|
|
8 |
|
|
9 |
typedef struct {
|
|
10 |
const char *(*start)(char **parm);
|
|
11 |
void (*stop)();
|
|
12 |
void (*make_dirty)(int left, int top, int width, int height);
|
|
13 |
int (*main_loop)();
|
|
14 |
bool (*change_resolution)(int w, int h);
|
|
15 |
} HalVideoDriver;
|
|
16 |
|
|
17 |
enum {
|
|
18 |
ML_QUIT = 0,
|
|
19 |
ML_SWITCHDRIVER = 1,
|
|
20 |
};
|
|
21 |
|
|
22 |
typedef struct {
|
|
23 |
char *(*start)(char **parm);
|
|
24 |
void (*stop)();
|
|
25 |
} HalSoundDriver;
|
|
26 |
|
|
27 |
typedef struct {
|
|
28 |
char *(*start)(char **parm);
|
|
29 |
void (*stop)();
|
|
30 |
|
|
31 |
void (*play_song)(const char *filename);
|
|
32 |
void (*stop_song)();
|
|
33 |
bool (*is_song_playing)();
|
|
34 |
void (*set_volume)(byte vol);
|
|
35 |
} HalMusicDriver;
|
|
36 |
|
|
37 |
typedef struct {
|
|
38 |
const char *name;
|
|
39 |
const char *longname;
|
|
40 |
const void *drv;
|
|
41 |
uint flags;
|
|
42 |
} DriverDesc;
|
|
43 |
|
|
44 |
enum {
|
|
45 |
HALERR_OK = 0,
|
|
46 |
HALERR_ERROR = 1,
|
|
47 |
};
|
|
48 |
|
|
49 |
extern const HalMusicDriver _null_music_driver;
|
|
50 |
extern const HalVideoDriver _null_video_driver;
|
|
51 |
extern const HalSoundDriver _null_sound_driver;
|
|
52 |
|
|
53 |
VARDEF HalMusicDriver *_music_driver;
|
|
54 |
VARDEF HalSoundDriver *_sound_driver;
|
|
55 |
VARDEF HalVideoDriver *_video_driver;
|
|
56 |
|
|
57 |
extern const DriverDesc _video_driver_descs[];
|
|
58 |
extern const DriverDesc _sound_driver_descs[];
|
|
59 |
extern const DriverDesc _music_driver_descs[];
|
|
60 |
|
|
61 |
#if defined(WITH_SDL)
|
|
62 |
extern const HalSoundDriver _sdl_sound_driver;
|
|
63 |
extern const HalVideoDriver _sdl_video_driver;
|
|
64 |
#endif
|
|
65 |
|
|
66 |
#if defined(UNIX)
|
|
67 |
extern const HalMusicDriver _extmidi_music_driver;
|
|
68 |
#endif
|
|
69 |
|
|
70 |
#if defined(__BEOS__)
|
|
71 |
extern const HalMusicDriver _bemidi_music_driver;
|
|
72 |
#endif
|
|
73 |
|
|
74 |
enum DriverType {
|
|
75 |
VIDEO_DRIVER = 0,
|
|
76 |
SOUND_DRIVER = 1,
|
|
77 |
MUSIC_DRIVER = 2,
|
|
78 |
};
|
|
79 |
|
|
80 |
extern void GameLoop();
|
|
81 |
extern bool _dbg_screen_rect;
|
|
82 |
|
|
83 |
void LoadDriver(int driver, const char *name);
|
|
84 |
|
|
85 |
char *GetDriverParam(char **parm, const char *name);
|
|
86 |
bool GetDriverParamBool(char **parm, const char *name);
|
|
87 |
int GetDriverParamInt(char **parm, const char *name, int def);
|
|
88 |
|
|
89 |
|
|
90 |
|
|
91 |
// Deals with finding savegames
|
|
92 |
typedef struct {
|
|
93 |
uint16 id;
|
|
94 |
byte type;
|
|
95 |
uint64 mtime;
|
|
96 |
char title[64];
|
|
97 |
char name[256-12-64];
|
|
98 |
int old_extension;
|
|
99 |
} FiosItem;
|
|
100 |
|
|
101 |
// extensions of old savegames, scenarios
|
|
102 |
static const char* const _old_extensions[] = {
|
|
103 |
// old savegame types
|
|
104 |
"ss1", // Transport Tycoon Deluxe preset game
|
|
105 |
"sv1", // Transport Tycoon Deluxe (Patch) saved game
|
|
106 |
"sv2", // Transport Tycoon Deluxe (Patch) saved 2-player game
|
|
107 |
// old scenario game type
|
|
108 |
"sv0", // Transport Tycoon Deluxe (Patch) scenario
|
|
109 |
"ss0", // Transport Tycoon Deluxe preset scenario
|
|
110 |
};
|
|
111 |
|
|
112 |
enum {
|
|
113 |
FIOS_TYPE_DRIVE = 0,
|
|
114 |
FIOS_TYPE_PARENT = 1,
|
|
115 |
FIOS_TYPE_DIR = 2,
|
|
116 |
FIOS_TYPE_FILE = 3,
|
|
117 |
FIOS_TYPE_OLDFILE = 4,
|
|
118 |
FIOS_TYPE_SCENARIO = 5,
|
|
119 |
FIOS_TYPE_OLD_SCENARIO = 6,
|
|
120 |
};
|
|
121 |
|
|
122 |
// get the name of an oldstyle savegame
|
|
123 |
void GetOldSaveGameName(char *title, const char *file);
|
|
124 |
// get the name of an oldstyle scenario
|
|
125 |
void GetOldScenarioGameName(char *title, const char *file);
|
|
126 |
|
|
127 |
// Get a list of savegames
|
|
128 |
FiosItem *FiosGetSavegameList(int *num, int mode);
|
|
129 |
// Get a list of scenarios
|
|
130 |
FiosItem *FiosGetScenarioList(int *num, int mode);
|
|
131 |
// Free the list of savegames
|
|
132 |
void FiosFreeSavegameList();
|
|
133 |
// Browse to. Returns a filename w/path if we reached a file.
|
|
134 |
char *FiosBrowseTo(const FiosItem *item);
|
|
135 |
// Get descriptive texts.
|
|
136 |
// Returns a path as well as a
|
|
137 |
// string describing the path.
|
|
138 |
StringID FiosGetDescText(char **path);
|
|
139 |
// Delete a name
|
|
140 |
void FiosDelete(const char *name);
|
|
141 |
// Make a filename from a name
|
|
142 |
void FiosMakeSavegameName(char *buf, const char *name);
|
|
143 |
|
|
144 |
void CreateConsole();
|
|
145 |
|
|
146 |
#endif /* HAL_H */
|