SCI: More cleanup

svn-id: r38725
This commit is contained in:
Max Horn 2009-02-21 19:01:32 +00:00
parent 6bb73e3b68
commit c5e00f3de2
14 changed files with 69 additions and 111 deletions

View File

@ -71,8 +71,6 @@ typedef enum {
typedef int mem_obj_enum;
struct _mem_obj;
#define GET_SEGMENT(mgr, index, rtype) ((index) > 0 && (mgr).heap_size > index) ? \
(((mgr).heap[index] && (mgr).heap[index]->type == rtype)? (mgr).heap[index] : NULL) : NULL
@ -85,7 +83,7 @@ struct _mem_obj;
struct SegManager {
int_hash_map_t *id_seg_map; // id - script id; seg - index of heap
struct _mem_obj **heap;
mem_obj_t **heap;
int heap_size; // size of the heap
int reserved_id;
int exports_wide;

View File

@ -33,9 +33,9 @@
namespace Sci {
typedef struct _gfx_res_pattern {
struct gfx_res_pattern_t {
int min, max;
} gfx_res_pattern_t;
};
/* GFX resource assignments */

View File

@ -51,22 +51,22 @@ namespace Sci {
#define GFX_COLOR_SYSTEM -1
typedef struct { /* gfx_palette_color_t: Palette color description */
/** Palette color description */
struct gfx_palette_color_t {
int lockers; /* Number of pixmaps holding a lock on that color.
** 0 means that the color is unused, -1 means that it is
** "system allocated" and may not be freed. */
byte r, g, b; /* Red, green, blue; intensity varies from 0 (min) to 255 (max) */
} gfx_palette_color_t;
};
typedef struct { /* gfx_palette_t: Palette description for color index modes */
/** Palette description for color index modes */
struct gfx_palette_t{
int max_colors_nr; /* Maximum number of allocated colors */
gfx_palette_color_t *colors; /* Actual colors, malloc()d as a block */
} gfx_palette_t;
};
@ -79,7 +79,8 @@ typedef struct { /* gfx_palette_t: Palette description for color index modes */
** enabled */
#define GFX_MODE_FLAG_REVERSE_ALPHA (1<<1)
typedef struct { /* gfx_mode_t: Graphics mode description */
/** Graphics mode description */
struct gfx_mode_t {
int xfact, yfact; /* Horizontal and vertical scaling factors */
int bytespp; /* Bytes per pixel */
@ -104,32 +105,32 @@ typedef struct { /* gfx_mode_t: Graphics mode description */
** gether. The alpha values are used as appropriate; if alpha_mask is
** zero, then images use a special alpha map. */
} gfx_mode_t;
};
#define GFX_COLOR_INDEX_UNMAPPED -1
typedef struct { /* gfx_pixmap_color_t: Pixmap-specific color entries */
/** Pixmap-specific color entries */
struct gfx_pixmap_color_t{
int global_index; /* Global index color or GFX_COLOR_INDEX_UNMAPPED. */
guint8 r, g, b; /* Real color */
} gfx_pixmap_color_t;
};
typedef struct { /* gfx_color_t: Full color */
/** Full color */
struct gfx_color_t {
gfx_pixmap_color_t visual;
guint8 alpha; /* transparency = (1-opacity) */
signed char priority, control;
byte mask; /* see mask values below */
} gfx_color_t;
};
typedef struct { /* rect_t: Rectangle description */
/** Rectangle description */
struct rect_t{
int x, y;
int xl, yl; /* width, height: (x,y,xl,yl)=(5,5,1,1) occupies 1 pixel */
} rect_t;
};
/* Generates a rect_t from index data

View File

@ -1,40 +0,0 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* $URL$
* $Id$
*
*/
#ifndef _LISTENER_H_
# define _LISTENER_H_
namespace Sci {
/* Event listener interface */
typedef struct {
void (*notify)(void *self, void *notifier);
void *self;
} listener_t;
} // End of namespace Sci
#endif

View File

@ -29,7 +29,6 @@
#define _SCI_SFX_ITERATOR_H_
#include "sci/include/sfx_pcm.h"
#include "sci/include/listener.h"
namespace Sci {
@ -89,6 +88,11 @@ typedef struct {
#define SIMSG_SEND(o, m) songit_handle_message(&(o), songit_make_message((o)->ID, m))
#define SIMSG_SEND_FADE(o, m) songit_handle_message(&(o), songit_make_ptr_message((o)->ID, _SIMSG_BASE, _SIMSG_BASEMSG_SET_FADE, m, 0))
/* Event listener interface */
struct listener_t {
void (*notify)(void *self, void *notifier);
void *self;
};
typedef unsigned long songit_id_t;

View File

@ -28,9 +28,8 @@
#ifndef _SCI_SFX_SONGLIB_H_
#define _SCI_SFX_SONGLIB_H_
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "common/scummsys.h"
#include "sci/include/scitypes.h"
#include "sci/include/sfx_iterator.h"

View File

@ -28,9 +28,6 @@
#ifndef _SCI_UINPUT_H
#define _SCI_UINPUT_H
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
namespace Sci {
@ -38,7 +35,7 @@ namespace Sci {
#define SCI_INPUT_DEFAULT_REDRAWTIME 30000
typedef struct {
struct sci_event_t {
short type;
short data;
short buckybits;
@ -52,7 +49,7 @@ typedef struct {
** For 'Alt', characters are interpreted by their
** PC keyboard scancodes.
*/
} sci_event_t;
};
/*Values for type*/
#define SCI_EVT_NONE 0

View File

@ -23,8 +23,8 @@
*
*/
#ifndef VOCABULARY_H
#define VOCABULARY_H
#ifndef SCI_VOCABULARY_H
#define SCI_VOCABULARY_H
#include "sci/include/versions.h"
#include "sci/include/sciresource.h"
@ -43,11 +43,11 @@ namespace Sci {
/* Number of bytes allocated on the heap to store bad words if parsing fails */
typedef struct opcode_ {
struct opcode {
int type;
int number;
char* name;
} opcode;
};
#define VOCAB_RESOURCE_OPCODES 998
#define VOCAB_RESOURCE_KNAMES 999

View File

@ -24,8 +24,8 @@
*/
#ifndef _SFX_ADLIB_H_
#define _SFX_ADLIB_H_
#ifndef SCI_SFX_ADLIB_H
#define SCI_SFX_ADLIB_H
#include "sci/tools.h"
@ -68,9 +68,9 @@ typedef unsigned char adlib_instr[12];
extern adlib_instr adlib_sbi[96];
/** Converts a raw SCI adlib instrument into the adlib register format. */
void make_sbi(adlib_def *one, guint8 *buffer);
/* Converts a raw SCI adlib instrument into the adlib register format. */
} // End of namespace Sci
#endif /* _SFX_ADLIB_H_ */
#endif // SCI_SFX_ADLIB_H

View File

@ -25,8 +25,10 @@
/* song player structure */
#ifndef _SFX_DEVICE_H
#define _SFX_DEVICE_H
#ifndef SCI_SFX_DEVICE_H
#define SCI_SFX_DEVICE_H
#include "common/scummsys.h"
namespace Sci {
@ -119,4 +121,4 @@ void *sfx_find_device(int type, char *name);
} // End of namespace Sci
#endif /* !_SFX_PLAYER_H */
#endif // SCI_SFX_DEVICE_H

View File

@ -23,8 +23,8 @@
*
*/
#ifndef _SFX_MIXER_H_
#define _SFX_MIXER_H_
#ifndef SCI_SFX_MIXER_H
#define SCI_SFX_MIXER_H
#include "sci/include/sfx_pcm.h"
@ -45,7 +45,7 @@ struct twochannel_data {
int left, right;
};
typedef struct {
struct sfx_pcm_feed_state_t {
sfx_pcm_feed_t *feed;
/* The following fields are for use by the mixer only and must not be
@ -59,10 +59,10 @@ typedef struct {
int pending_review; /* Timestamp needs to be checked for this stream */
twochannel_data ch_old, ch_new; /* Intermediate results of output computation */
} sfx_pcm_feed_state_t;
};
typedef struct _sfx_pcm_mixer {
struct sfx_pcm_mixer_t {
/* Mixers are the heart of all matters PCM. They take PCM data from subscribed feeds,
** mix it (hence the name) and ask the pcm device they are attached to to play the
** result. */
@ -70,34 +70,34 @@ typedef struct _sfx_pcm_mixer {
const char *name;
const char *version;
int (*init)(struct _sfx_pcm_mixer *self, sfx_pcm_device_t *device);
int (*init)(sfx_pcm_mixer_t *self, sfx_pcm_device_t *device);
/* Initialises the mixer
** Parameters: (sfx_pcm_mixer_t *) self: Self reference
** (sfx_pcm_device_t *) device: An _already initialised_ PCM output driver
** Returns : (int) SFX_OK on success, SFX_ERROR otherwise
*/
void (*exit)(struct _sfx_pcm_mixer *self);
void (*exit)(sfx_pcm_mixer_t *self);
/* Uninitialises the mixer
** Parameters: (sfx_pcm_mixer_t *) self: Self reference
** Also uninitialises all feeds and the attached output device.
*/
void (*subscribe)(struct _sfx_pcm_mixer *self, sfx_pcm_feed_t *feed);
void (*subscribe)(sfx_pcm_mixer_t *self, sfx_pcm_feed_t *feed);
/* Subscribes the mixer to a new feed
** Parameters: (sfx_pcm_mixer_t *) self: Self reference
** (sfx_pcm_feed_t *) feed: The feed to subscribe to
*/
void (*pause)(struct _sfx_pcm_mixer *self);
void (*pause)(sfx_pcm_mixer_t *self);
/* Pauses the processing of input and output
*/
void (*resume)(struct _sfx_pcm_mixer *self);
void (*resume)(sfx_pcm_mixer_t *self);
/* Resumes the processing of input and output after a pause
*/
int (*process)(struct _sfx_pcm_mixer *self);
int (*process)(sfx_pcm_mixer_t *self);
/* Processes all feeds, mixes their results, and passes everything to the output device
** Returns : (int) SFX_OK on success, SFX_ERROR otherwise (output device error or
** internal assertion failure)
@ -112,7 +112,7 @@ typedef struct _sfx_pcm_mixer {
sfx_pcm_device_t *dev;
void *private_bits;
} sfx_pcm_mixer_t;
};
sfx_pcm_mixer_t *sfx_pcm_find_mixer(char *name);
/* Looks up a mixer by name, or a default mixer
@ -126,4 +126,4 @@ sfx_pcm_mixer_t* getMixer();
} // End of namespace Sci
#endif /* !defined(_SFX_MIXER_H_) */
#endif // SCI_SFX_MIXER_H

View File

@ -25,12 +25,11 @@
/* Implementation of SCI instrument maps for GM and MT-32. */
#ifndef SCI_INSTRUMENT_MAP_
#define SCI_INSTRUMENT_MAP_
#ifndef SCI_SFX_SEQ_INSTRUMENT_MAP_H
#define SCI_SFX_SEQ_INSTRUMENT_MAP_H
#include <stdlib.h>
#include "resource.h"
#include "../device.h"
#include "sci/tools.h"
#include "sci/sfx/device.h"
namespace Sci {
@ -130,4 +129,4 @@ sfx_mapped_writer(midi_writer_t *writer, sfx_instrument_map_t *map);
} // End of namespace Sci
#endif /* !defined(SCI_INSTRUMENT_MAP_) */
#endif // SCI_SFX_SEQ_INSTRUMENT_MAP_H

View File

@ -24,14 +24,12 @@
*/
#ifndef _SFX_SEQUENCER_H_
#define _SFX_SEQUENCER_H_
#ifndef SCI_SFX_SEQUENCER_H
#define SCI_SFX_SEQUENCER_H
#include "common/scummsys.h"
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif /* HAVE_CONFIG_H */
#include "sci/include/sfx_core.h"
#include <stdio.h>
#include "sci/sfx/device.h"
#include "sci/include/scitypes.h"
@ -143,4 +141,4 @@ sfx_sequencer_t *sfx_find_sequencer(char *name);
} // End of namespace Sci
#endif /* _SFX_SEQUENCER_H_ */
#endif // SCI_SFX_SEQUENCER_H

View File

@ -23,8 +23,8 @@
*
*/
#ifndef SFX_SOFTSEQ_H_
#define SFX_SOFTSEQ_H_
#ifndef SCI_SFX_SOFTSEQ_H
#define SCI_SFX_SOFTSEQ_H
#include "sci/include/sfx_core.h"
#include "sci/include/sfx_pcm.h"
@ -122,4 +122,4 @@ sfx_softseq_t *sfx_find_softseq(const char *name);
} // End of namespace Sci
#endif /* !defined(SFX_SOFTSEQ_H_) */
#endif // SCI_SFX_SOFTSEQ_H