Subversion Repositories Games.Rick Dangerous

Rev

Rev 11 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 pmbaty 1
/*
2
 * src/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
 
5 pmbaty 17
#include <stdint.h>
18
typedef uint8_t U8;
19
typedef uint16_t U16;
20
typedef uint32_t U32;
21
typedef int8_t S8;
22
typedef int16_t S16;
23
typedef int32_t S32;
11 pmbaty 24
#ifdef _WIN32
7 pmbaty 25
#include <stdio.h> // for sprintf_s() and the likes
11 pmbaty 26
#else // !_WIN32
5 pmbaty 27
#define strcpy_s(dest,size,source) strcpy (dest, source)
28
#define strcat_s(dest,size,source) strcat (dest, source)
29
#define sprintf_s(dest,size,format,...) sprintf (dest, format, __VA_ARGS__)
30
#define strncpy_s(dest,size,source,count) strncpy (dest, source, count)
31
#define vsprintf_s(buffer,maxsize,format,...) vsprintf(buffer,format, ##__VA_ARGS__)
32
#define fopen_s(fp,filename,mode) *(fp) = fopen (filename, mode)
11 pmbaty 33
#endif // _WIN32
1 pmbaty 34
 
35
/* this must be after typedefs because it relies on types defined above */
36
#include "rects.h"
37
#include "img.h"
38
 
39
/*
40
 * main section
41
 */
42
extern void sys_init (int, char **);
43
extern void sys_shutdown (void);
2 pmbaty 44
extern char *sys_getbasepath (void);
13 pmbaty 45
extern char *sys_getdatapath (void); // Pierre-Marie Baty -- addition for macOS app bundles
1 pmbaty 46
extern void sys_panic (char *, ...);
47
extern void sys_printf (char *, ...);
48
extern U32 sys_gettime (void);
49
extern void sys_sleep (int);
50
 
51
/*
52
 * video section
53
 */
54
extern void sysvid_init (void);
55
extern void sysvid_shutdown (void);
56
extern void sysvid_clear (void);
57
extern void sysvid_paint (rect_t *);
58
 
59
/*
60
 * events section
61
 */
62
extern void sysevt_poll (void);
63
extern void sysevt_wait (void);
64
 
65
/*
66
 * sound section
67
 */
68
typedef struct
69
{
70
   U8 *buf;
71
   U32 len;
72
   U8 dispose;
73
} sound_t;
74
 
75
extern void syssnd_init (void);
76
extern void syssnd_shutdown (void);
77
extern void syssnd_vol (S8);
78
extern void syssnd_toggleMute (void);
79
extern S8 syssnd_play (sound_t *, S8);
80
extern void syssnd_pause (U8, U8);
81
extern void syssnd_stopchan (S8);
82
extern void syssnd_stopsound (sound_t *);
83
extern void syssnd_stopall (void);
84
extern int syssnd_isplaying (sound_t *);
85
extern sound_t *syssnd_load (char *name);
86
extern void syssnd_free (sound_t *);
87
 
88
/*
89
 * args section
90
 */
91
extern int sysarg_args_period;
92
extern int sysarg_args_map;
93
extern int sysarg_args_submap;
9 pmbaty 94
extern int sysarg_args_score;
1 pmbaty 95
extern int sysarg_args_nosound;
96
extern int sysarg_args_vol;
97
 
98
extern void sysarg_init (int, char **);
99
 
100
/*
101
 * joystick section
102
 */
103
extern void sysjoy_init (void);
104
extern void sysjoy_shutdown (void);
105
 
106
#endif