Subversion Repositories Games.Rick Dangerous

Rev

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