aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorMax Horn2009-02-15 23:39:31 +0000
committerMax Horn2009-02-15 23:39:31 +0000
commit296686e81217700c0b94c8fe386a396ace81de3b (patch)
tree01724d4739b8f21e5ab86bce579cc1c6dbb44508 /engines/sci
parentc556589d74b4439391d3968975e44c02cdea9818 (diff)
downloadscummvm-rg350-296686e81217700c0b94c8fe386a396ace81de3b.tar.gz
scummvm-rg350-296686e81217700c0b94c8fe386a396ace81de3b.tar.bz2
scummvm-rg350-296686e81217700c0b94c8fe386a396ace81de3b.zip
SCI: Header cleanup (avoid #include <> where possible)
svn-id: r38330
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/include/conf_extension.h3
-rw-r--r--engines/sci/include/console.h6
-rw-r--r--engines/sci/include/engine.h4
-rw-r--r--engines/sci/include/gfx_system.h4
-rw-r--r--engines/sci/include/kernel.h13
-rw-r--r--engines/sci/include/old_objects.h5
-rw-r--r--engines/sci/include/resource.h33
-rw-r--r--engines/sci/include/scitypes.h89
-rw-r--r--engines/sci/include/sfx_core.h4
-rw-r--r--engines/sci/include/util.h3
-rw-r--r--engines/sci/sfx/softseq/amiga.cpp16
11 files changed, 24 insertions, 156 deletions
diff --git a/engines/sci/include/conf_extension.h b/engines/sci/include/conf_extension.h
index f1a430bc87..68c74fa2da 100644
--- a/engines/sci/include/conf_extension.h
+++ b/engines/sci/include/conf_extension.h
@@ -33,8 +33,7 @@
#ifndef CONF_EXTENSION_H_
#define CONF_EXTENSION_H_
-#include <stdio.h>
-#include <stdlib.h>
+#include "common/scummsys.h"
#define CONF_EXT_TYPE_INVALID -1
#define CONF_EXT_TYPE_GFX 0
diff --git a/engines/sci/include/console.h b/engines/sci/include/console.h
index 7580efc961..7c8c4fa1b0 100644
--- a/engines/sci/include/console.h
+++ b/engines/sci/include/console.h
@@ -33,14 +33,12 @@
#ifndef _SCI_CONSOLE_H_
#define _SCI_CONSOLE_H_
+#include "common/scummsys.h"
+
#include "sci/include/sci_memory.h"
#include "sci/include/resource.h"
#include "sci/include/vm_types.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif /* HAVE_CONFIG_H */
-
#define SCI_CONSOLE
#include "sci/include/gfx_operations.h"
diff --git a/engines/sci/include/engine.h b/engines/sci/include/engine.h
index 2a41708618..d5bd2e7757 100644
--- a/engines/sci/include/engine.h
+++ b/engines/sci/include/engine.h
@@ -26,9 +26,7 @@
#ifndef _SCI_ENGINE_H
#define _SCI_ENGINE_H
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif /* HAVE_CONFIG_H */
+#include "common/scummsys.h"
// FIXME. Remove after transiton to File class
#include <sys/stat.h>
diff --git a/engines/sci/include/gfx_system.h b/engines/sci/include/gfx_system.h
index 8aed515ccd..b071a63cc7 100644
--- a/engines/sci/include/gfx_system.h
+++ b/engines/sci/include/gfx_system.h
@@ -28,11 +28,9 @@
#ifndef _SCI_GFX_SYSTEM_
#define _SCI_GFX_SYSTEM_
+#include "common/scummsys.h"
#include "sci/include/sci_memory.h"
#include "sci/include/resource.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#define GFX_DEBUG
diff --git a/engines/sci/include/kernel.h b/engines/sci/include/kernel.h
index d04dc6bd02..c01a52dc43 100644
--- a/engines/sci/include/kernel.h
+++ b/engines/sci/include/kernel.h
@@ -27,23 +27,14 @@
#ifndef _SCI_KERNEL_H_
#define _SCI_KERNEL_H_
-#include <math.h>
-#include <ctype.h>
+#include "common/scummsys.h"
+
#include "sci/include/kdebug.h"
#include "sci/include/uinput.h"
#include "sci/include/event.h"
#include "sci/include/vm.h"
#include "sci/include/console.h" /* sciprintf() */
-#ifdef _MSC_VER
-# include <direct.h>
-# include <ctype.h>
-#endif
-
-#ifndef PI
-# define PI 3.14159265358979323846
-#endif /* !PI */
-
extern int _kdebug_cheap_event_hack;
extern int _kdebug_cheap_soundcue_hack;
extern int stop_on_event;
diff --git a/engines/sci/include/old_objects.h b/engines/sci/include/old_objects.h
index de246dc61d..e13e2a5c32 100644
--- a/engines/sci/include/old_objects.h
+++ b/engines/sci/include/old_objects.h
@@ -1,8 +1,9 @@
#ifndef OLD_OBJECTS_H
#define OLD_OBJECTS_H
-#include <sciresource.h>
-#include <util.h>
+#include "common/scummsys.h"
+#include "engine/sci/include/sciresource.h"
+#include "engine/sci/include/util.h"
typedef FLEXARRAY(script_opcode, int number;) script_method;
diff --git a/engines/sci/include/resource.h b/engines/sci/include/resource.h
index 7fab40d81b..4f25145034 100644
--- a/engines/sci/include/resource.h
+++ b/engines/sci/include/resource.h
@@ -32,6 +32,8 @@
#ifndef FREESCI_PRIMARY_RESOURCE_H_
#define FREESCI_PRIMARY_RESOURCE_H_
+#include "common/scummsys.h"
+
/** This header file defines (mostly) generic tools and utility functions.
** It also handles portability stuff, in cooperation with scitypes.h
** (which specializes in primitive data types).
@@ -57,7 +59,6 @@
# define SCI_SAFE_ALLOC /* Undefine for debugging */
#endif
-#ifdef SCUMMVM
//TODO: Remove these defines by replacing their functionality by their ScummVM counterparts
#define HAVE_MEMCHR
#define HAVE_UNLINK
@@ -69,35 +70,6 @@
#define HAVE_GETTIMEOFDAY
#endif
#define VERSION "0.6.4"
-#endif // SCUMMVM
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#ifndef __unix__
-# if defined(__OpenBSD__) || defined(__NetBSD__)
-# define __unix__
-# endif
-#endif
-
-#if defined(HAVE_FORK) && !defined(__BEOS__)
-# define HAVE_SYSV_IPC
-#else
-# undef HAVE_SYSV_IPC
-#endif
-
-#ifdef __DECC
-# include <c_asm.h>
-#endif
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <string.h>
-
-#ifdef WITH_DMALLOC
-# include <dmalloc.h>
-#endif
#include "sci/include/scitypes.h"
@@ -106,6 +78,7 @@
#include <unistd.h>
#endif
+// FIXME: Replace strcasecmp by scumm_stricmp
#ifdef _MSC_VER
# undef strcasecmp
# undef strncasecmp
diff --git a/engines/sci/include/scitypes.h b/engines/sci/include/scitypes.h
index 2b3f561de5..5cde9135a1 100644
--- a/engines/sci/include/scitypes.h
+++ b/engines/sci/include/scitypes.h
@@ -27,8 +27,6 @@
#ifndef SCI_TYPES
#define SCI_TYPES
-#ifdef SCUMMVM
-
#include "common/scummsys.h"
// TODO: rework sci_dir_t to use common/fs.h and remove these includes
@@ -52,68 +50,6 @@ typedef uint32 guint32;
#undef byte
-#else // SCUMMVM
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#ifdef HAVE_DIRENT_H
-# include <sys/types.h>
-# include <dirent.h>
-#endif
-#ifdef WIN32
-# include <io.h>
-# include <sci_win32.h>
-#endif
-#ifdef __DC__
-# include <stdio.h>
-#endif
-
-#if defined(WIN32) && defined(_MSC_VER)
-# define TYPE_16 short
-# define TYPE_32 int
-#endif
-
-#ifndef TYPE_8
-# define TYPE_8 char /* Guaranteed by ISO */
-#endif
-
-#ifndef TYPE_16
-# if (SIZEOF_SHORT == 2)
-# define TYPE_16 short
-# elif (SIZEOF_INT == 2)
-# define TYPE_16 int
-# else
-# error "Could not find a 16 bit data type!"
-# endif
-#endif /* !TYPE_16 */
-
-#ifndef TYPE_32
-# if (SIZEOF_INT == 4)
-# define TYPE_32 int
-# elif (SIZEOF_LONG == 4)
-# define TYPE_32 long
-# else
-# error "Could not find a 32 bit data type!"
-# endif
-#endif /* !TYPE_32 */
-
-typedef signed TYPE_8 gint8;
-typedef unsigned TYPE_8 guint8;
-
-typedef signed TYPE_16 gint16;
-typedef unsigned TYPE_16 guint16;
-
-typedef signed TYPE_32 gint32;
-typedef unsigned TYPE_32 guint32;
-
-#undef TYPE_8
-#undef TYPE_16
-#undef TYPE_32
-
-#endif // SCUMMVM
-
typedef gint8 sbyte;
typedef guint8 byte;
typedef guint16 word;
@@ -133,29 +69,4 @@ typedef struct {
#endif
} sci_dir_t; /* used by sci_find_first and friends */
-/*
- * Fixed point type, borrowed from ScummVM.
- * The precision of the fractional (fixed point) type we define below.
- * Normally you should never have to modify this value.
- */
-enum {
- FRAC_BITS = 16,
- FRAC_LO_MASK = ((1L << FRAC_BITS) - 1),
- FRAC_HI_MASK = (((1L << (32 - FRAC_BITS)) - 1) << FRAC_BITS),
-
- FRAC_ONE = (1L << FRAC_BITS), // 1.0
- FRAC_HALF = (1L << (FRAC_BITS - 1)) // 0.5
-};
-
-/*
- * Fixed-point fractions, used by the sound rate converter and other code.
- */
-typedef gint32 frac_t;
-
-static inline frac_t double_to_frac(double value) { return (frac_t)(value * FRAC_ONE); }
-static inline double frac_to_double(frac_t value) { return ((double)value) / FRAC_ONE; }
-
-static inline frac_t int_to_frac(gint32 value) { return value << FRAC_BITS; }
-static inline gint32 frac_to_int(frac_t value) { return value >> FRAC_BITS; }
-
#endif /* !SCI_TYPES */
diff --git a/engines/sci/include/sfx_core.h b/engines/sci/include/sfx_core.h
index 3b8498b5bc..08e342be98 100644
--- a/engines/sci/include/sfx_core.h
+++ b/engines/sci/include/sfx_core.h
@@ -30,9 +30,7 @@
#ifndef _SFX_CORE_H_
#define _SFX_CORE_H_
-#ifndef _MSC_VER
-#include <config.h>
-#endif
+#include "common/scummsys.h"
#define SFX_OK 0
#define SFX_ERROR -1
diff --git a/engines/sci/include/util.h b/engines/sci/include/util.h
index 75ec2e6706..410d032c04 100644
--- a/engines/sci/include/util.h
+++ b/engines/sci/include/util.h
@@ -28,8 +28,7 @@
#ifndef UTIL_H
#define UTIL_H
-#include <stdlib.h>
-#include <stdio.h>
+#include "common/scummsys.h"
/* An excercise in bloated macro writing ;-)*/
diff --git a/engines/sci/sfx/softseq/amiga.cpp b/engines/sci/sfx/softseq/amiga.cpp
index 111ffdf5cf..8850b5a731 100644
--- a/engines/sci/sfx/softseq/amiga.cpp
+++ b/engines/sci/sfx/softseq/amiga.cpp
@@ -31,6 +31,8 @@
#include "sci/include/sci_memory.h"
#include "sci/sfx/softseq.h"
+#include "common/frac.h"
+
#define FREQUENCY 44100
#define CHANNELS_NR 10
#define HW_CHANNELS_NR 16
@@ -144,10 +146,10 @@ set_envelope(channel_t *channel, envelope_t *envelope, int phase) {
static inline int
interpolate(sbyte *samples, frac_t offset) {
- int x = frac_to_int(offset);
+ int x = fracToInt(offset);
int diff = (samples[x + 1] - samples[x]) << 8;
- return (samples[x] << 8) + frac_to_int(diff * (offset & FRAC_LO_MASK));
+ return (samples[x] << 8) + fracToInt(diff * (offset & FRAC_LO_MASK));
}
static void
@@ -170,7 +172,7 @@ play_instrument(gint16 *dest, channel_t *channel, int count) {
seg_end = instrument->size;
}
- lin_avail = int_to_frac(seg_end) - channel->offset;
+ lin_avail = intToFrac(seg_end) - channel->offset;
rem = count - index;
@@ -239,10 +241,10 @@ play_instrument(gint16 *dest, channel_t *channel, int count) {
if (index == count)
break;
- if (frac_to_int(channel->offset) >= seg_end) {
+ if (fracToInt(channel->offset) >= seg_end) {
if (instrument->mode & MODE_LOOP) {
/* Loop the samples */
- channel->offset -= int_to_frac(seg_end);
+ channel->offset -= intToFrac(seg_end);
channel->looping = 1;
} else {
/* All samples have been played */
@@ -338,9 +340,9 @@ start_note(int ch, int note, int velocity) {
}
/* Compute rate for note */
- channels[channel].rate = double_to_frac(freq_table[fnote] / (double) FREQUENCY);
+ channels[channel].rate = doubleToFrac(freq_table[fnote] / (double) FREQUENCY);
} else
- channels[channel].rate = double_to_frac(BASE_FREQ / (double) FREQUENCY);
+ channels[channel].rate = doubleToFrac(BASE_FREQ / (double) FREQUENCY);
channels[channel].instrument = hw_channels[ch].instrument;
channels[channel].note = note;