Subversion Repositories Games.Rick Dangerous

Rev

Rev 7 | Rev 11 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  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.  
  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;
  24. #ifdef WIN32
  25. #include <stdio.h> // for sprintf_s() and the likes
  26. #else // !WIN32
  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)
  33. #endif // WIN32
  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);
  44. extern char *sys_getbasepath (void);
  45. extern void sys_panic (char *, ...);
  46. extern void sys_printf (char *, ...);
  47. extern U32 sys_gettime (void);
  48. extern void sys_sleep (int);
  49.  
  50. /*
  51.  * video section
  52.  */
  53. extern void sysvid_init (void);
  54. extern void sysvid_shutdown (void);
  55. extern void sysvid_clear (void);
  56. extern void sysvid_paint (rect_t *);
  57.  
  58. /*
  59.  * events section
  60.  */
  61. extern void sysevt_poll (void);
  62. extern void sysevt_wait (void);
  63.  
  64. /*
  65.  * sound section
  66.  */
  67. typedef struct
  68. {
  69.    U8 *buf;
  70.    U32 len;
  71.    U8 dispose;
  72. } sound_t;
  73.  
  74. extern void syssnd_init (void);
  75. extern void syssnd_shutdown (void);
  76. extern void syssnd_vol (S8);
  77. extern void syssnd_toggleMute (void);
  78. extern S8 syssnd_play (sound_t *, S8);
  79. extern void syssnd_pause (U8, U8);
  80. extern void syssnd_stopchan (S8);
  81. extern void syssnd_stopsound (sound_t *);
  82. extern void syssnd_stopall (void);
  83. extern int syssnd_isplaying (sound_t *);
  84. extern sound_t *syssnd_load (char *name);
  85. extern void syssnd_free (sound_t *);
  86.  
  87. /*
  88.  * args section
  89.  */
  90. extern int sysarg_args_period;
  91. extern int sysarg_args_map;
  92. extern int sysarg_args_submap;
  93. extern int sysarg_args_score;
  94. extern int sysarg_args_nosound;
  95. extern int sysarg_args_vol;
  96.  
  97. extern void sysarg_init (int, char **);
  98.  
  99. /*
  100.  * joystick section
  101.  */
  102. extern void sysjoy_init (void);
  103. extern void sysjoy_shutdown (void);
  104.  
  105. #endif
  106.