[Scummvm-cvs-logs] SF.net SVN: scummvm:[38330] scummvm/trunk/engines/sci

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Mon Feb 16 00:39:31 CET 2009


Revision: 38330
          http://scummvm.svn.sourceforge.net/scummvm/?rev=38330&view=rev
Author:   fingolfin
Date:     2009-02-15 23:39:31 +0000 (Sun, 15 Feb 2009)

Log Message:
-----------
SCI: Header cleanup (avoid #include <> where possible)

Modified Paths:
--------------
    scummvm/trunk/engines/sci/include/conf_extension.h
    scummvm/trunk/engines/sci/include/console.h
    scummvm/trunk/engines/sci/include/engine.h
    scummvm/trunk/engines/sci/include/gfx_system.h
    scummvm/trunk/engines/sci/include/kernel.h
    scummvm/trunk/engines/sci/include/old_objects.h
    scummvm/trunk/engines/sci/include/resource.h
    scummvm/trunk/engines/sci/include/scitypes.h
    scummvm/trunk/engines/sci/include/sfx_core.h
    scummvm/trunk/engines/sci/include/util.h
    scummvm/trunk/engines/sci/sfx/softseq/amiga.cpp

Modified: scummvm/trunk/engines/sci/include/conf_extension.h
===================================================================
--- scummvm/trunk/engines/sci/include/conf_extension.h	2009-02-15 23:24:00 UTC (rev 38329)
+++ scummvm/trunk/engines/sci/include/conf_extension.h	2009-02-15 23:39:31 UTC (rev 38330)
@@ -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

Modified: scummvm/trunk/engines/sci/include/console.h
===================================================================
--- scummvm/trunk/engines/sci/include/console.h	2009-02-15 23:24:00 UTC (rev 38329)
+++ scummvm/trunk/engines/sci/include/console.h	2009-02-15 23:39:31 UTC (rev 38330)
@@ -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"
 

Modified: scummvm/trunk/engines/sci/include/engine.h
===================================================================
--- scummvm/trunk/engines/sci/include/engine.h	2009-02-15 23:24:00 UTC (rev 38329)
+++ scummvm/trunk/engines/sci/include/engine.h	2009-02-15 23:39:31 UTC (rev 38330)
@@ -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>

Modified: scummvm/trunk/engines/sci/include/gfx_system.h
===================================================================
--- scummvm/trunk/engines/sci/include/gfx_system.h	2009-02-15 23:24:00 UTC (rev 38329)
+++ scummvm/trunk/engines/sci/include/gfx_system.h	2009-02-15 23:39:31 UTC (rev 38330)
@@ -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

Modified: scummvm/trunk/engines/sci/include/kernel.h
===================================================================
--- scummvm/trunk/engines/sci/include/kernel.h	2009-02-15 23:24:00 UTC (rev 38329)
+++ scummvm/trunk/engines/sci/include/kernel.h	2009-02-15 23:39:31 UTC (rev 38330)
@@ -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;

Modified: scummvm/trunk/engines/sci/include/old_objects.h
===================================================================
--- scummvm/trunk/engines/sci/include/old_objects.h	2009-02-15 23:24:00 UTC (rev 38329)
+++ scummvm/trunk/engines/sci/include/old_objects.h	2009-02-15 23:39:31 UTC (rev 38330)
@@ -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;
 

Modified: scummvm/trunk/engines/sci/include/resource.h
===================================================================
--- scummvm/trunk/engines/sci/include/resource.h	2009-02-15 23:24:00 UTC (rev 38329)
+++ scummvm/trunk/engines/sci/include/resource.h	2009-02-15 23:39:31 UTC (rev 38330)
@@ -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,36 +70,7 @@
 #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"
 
 // FIXME: Mostly for close() in lots of places. Get rid of this!
@@ -106,6 +78,7 @@
 #include <unistd.h>
 #endif
 
+// FIXME: Replace strcasecmp by scumm_stricmp
 #ifdef _MSC_VER
 #	undef strcasecmp
 #	undef strncasecmp

Modified: scummvm/trunk/engines/sci/include/scitypes.h
===================================================================
--- scummvm/trunk/engines/sci/include/scitypes.h	2009-02-15 23:24:00 UTC (rev 38329)
+++ scummvm/trunk/engines/sci/include/scitypes.h	2009-02-15 23:39:31 UTC (rev 38330)
@@ -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 @@
 
 #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 @@
 #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 */

Modified: scummvm/trunk/engines/sci/include/sfx_core.h
===================================================================
--- scummvm/trunk/engines/sci/include/sfx_core.h	2009-02-15 23:24:00 UTC (rev 38329)
+++ scummvm/trunk/engines/sci/include/sfx_core.h	2009-02-15 23:39:31 UTC (rev 38330)
@@ -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

Modified: scummvm/trunk/engines/sci/include/util.h
===================================================================
--- scummvm/trunk/engines/sci/include/util.h	2009-02-15 23:24:00 UTC (rev 38329)
+++ scummvm/trunk/engines/sci/include/util.h	2009-02-15 23:39:31 UTC (rev 38330)
@@ -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 ;-)*/
 

Modified: scummvm/trunk/engines/sci/sfx/softseq/amiga.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/softseq/amiga.cpp	2009-02-15 23:24:00 UTC (rev 38329)
+++ scummvm/trunk/engines/sci/sfx/softseq/amiga.cpp	2009-02-15 23:39:31 UTC (rev 38330)
@@ -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 @@
 
 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 @@
 			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 @@
 		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 @@
 		}
 
 		/* 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;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list