1 /*
2  * xrick/include/system.h
3  *
4  * Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). All rights reserved.
5  *
6  * The use and distribution terms for this software are contained in the file
7  * named README, which can be found in the root of this distribution. By
8  * using this software in any fashion, you are agreeing to be bound by the
9  * terms of this license.
10  *
11  * You must not remove this notice, or any other, from this software.
12  */
13 
14 #ifndef _SYSTEM_H
15 #define _SYSTEM_H
16 
17 #include "config.h"
18 
19 /*
20  * If compiling w/gcc, then we can use attributes. UNUSED(x) flags a
21  * parameter or a variable as potentially being unused, so that gcc doesn't
22  * complain about it.
23  *
24  * Note: from OpenAL code: Darwin OS cc is based on gcc and has __GNUC__
25  * defined, yet does not support attributes. So in theory we should exclude
26  * Darwin target here.
27  */
28 #ifdef __GNUC__
29 #define UNUSED(x) x __attribute((unused))
30 #else
31 #define UNUSED(x) x
32 #endif
33 
34 /*
35  * Detect Microsoft Visual C
36  */
37 #ifdef _MSC_VER
38 #define __MSVC__
39 /*
40  * FIXME disable "integral size mismatch in argument; conversion supplied" warning
41  * as long as the code has not been cleared -- there are so many of them...
42  */
43 
44 #pragma warning( disable : 4761 )
45 #endif
46 
47 /* there are true at least on x86 platforms */
48 typedef unsigned char U8;         /*  8 bits unsigned */
49 typedef unsigned short int U16;   /* 16 bits unsigned */
50 typedef unsigned int U32;         /* 32 bits unsigned */
51 typedef signed char S8;           /*  8 bits signed   */
52 typedef signed short int S16;     /* 16 bits signed   */
53 typedef signed int S32;           /* 32 bits signed   */
54 
55 /* this must be after typedefs because it relies on types defined above */
56 #include "rects.h"
57 #include "img.h"
58 
59 /*
60  * main section
61  */
62 extern void sys_init(int, char **);
63 extern void sys_shutdown(void);
64 extern void sys_panic(char *, ...);
65 extern void sys_printf(char *, ...);
66 extern U32 sys_gettime(void);
67 
68 /*
69  * video section
70  */
71 #define SYSVID_ZOOM 1
72 #define SYSVID_MAXZOOM 4
73 #define SYSVID_WIDTH 320
74 #define SYSVID_HEIGHT 200
75 
76 extern void sysvid_init(void);
77 extern void sysvid_shutdown(void);
78 extern void sysvid_update(rect_t *);
79 extern void sysvid_clear(void);
80 extern void sysvid_zoom(S8);
81 extern void sysvid_toggleFullscreen(void);
82 extern void sysvid_setGamePalette(void);
83 extern void sysvid_setPalette(img_color_t *, U16);
84 
85 /*
86  * events section
87  */
88 extern void sysevt_poll(void);
89 extern void sysevt_wait(void);
90 
91 /*
92  * keyboard section
93  */
94 extern U8 syskbd_up;
95 extern U8 syskbd_down;
96 extern U8 syskbd_left;
97 extern U8 syskbd_right;
98 extern U8 syskbd_pause;
99 extern U8 syskbd_end;
100 extern U8 syskbd_xtra;
101 extern U8 syskbd_fire;
102 
103 /*
104  * sound section
105  */
106 #ifdef ENABLE_SOUND
107 typedef struct {
108 #ifdef DEBUG
109   char *name;
110 #endif
111   U8 *buf;
112   U32 len;
113   U8 dispose;
114 } sound_t;
115 
116 extern void syssnd_init(void);
117 extern void syssnd_shutdown(void);
118 extern void syssnd_vol(S8);
119 extern void syssnd_toggleMute(void);
120 extern S8 syssnd_play(sound_t *, S8);
121 extern void syssnd_pause(U8, U8);
122 extern void syssnd_stopchan(S8);
123 extern void syssnd_stopsound(sound_t *);
124 extern void syssnd_stopall();
125 extern int syssnd_isplaying(sound_t *);
126 extern sound_t *syssnd_load(char *name);
127 extern void syssnd_free(sound_t *);
128 #endif
129 
130 /*
131  * args section
132  */
133 extern int sysarg_args_period;
134 extern int sysarg_args_map;
135 extern int sysarg_args_submap;
136 extern int sysarg_args_fullscreen;
137 extern int sysarg_args_zoom;
138 #ifdef ENABLE_SOUND
139 extern int sysarg_args_nosound;
140 extern int sysarg_args_vol;
141 #endif
142 extern char *sysarg_args_data;
143 
144 extern void sysarg_init(int, char **);
145 
146 /*
147  * joystick section
148  */
149 #ifdef ENABLE_JOYSTICK
150 extern void sysjoy_init(void);
151 extern void sysjoy_shutdown(void);
152 #endif
153 
154 
155 #endif
156 
157 /* eof */
158 
159 
160