aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMax Horn2009-03-01 06:01:48 +0000
committerMax Horn2009-03-01 06:01:48 +0000
commit6454a3dee147ce8ce2fb02449df52123a8459782 (patch)
treec3591c2f7a85c97e643a93cdb4e34bf95b387b25 /engines
parent6742caa87a08e8c468b2eec5cf96c1dbc86fcb3a (diff)
downloadscummvm-rg350-6454a3dee147ce8ce2fb02449df52123a8459782.tar.gz
scummvm-rg350-6454a3dee147ce8ce2fb02449df52123a8459782.tar.bz2
scummvm-rg350-6454a3dee147ce8ce2fb02449df52123a8459782.zip
SCI: Replaced fake struct 'inheritance' (using #defines) with regular C++ subclassing
svn-id: r39005
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/sfx/sfx_iterator.h15
-rw-r--r--engines/sci/sfx/sfx_iterator_internal.h46
-rw-r--r--engines/sci/sfx/test-iterator.cpp7
3 files changed, 21 insertions, 47 deletions
diff --git a/engines/sci/sfx/sfx_iterator.h b/engines/sci/sfx/sfx_iterator.h
index 2efe91a1f0..6fe6a36118 100644
--- a/engines/sci/sfx/sfx_iterator.h
+++ b/engines/sci/sfx/sfx_iterator.h
@@ -106,21 +106,6 @@ struct song_iterator_message_t {
} args[SONG_ITERATOR_MESSAGE_ARGUMENTS_NR];
};
-#define INHERITS_SONG_ITERATOR \
- songit_id_t ID; \
- uint16 channel_mask; \
- fade_params_t fade; \
- unsigned int flags; \
- int priority; \
- int (*next) (song_iterator_t *self, unsigned char *buf, int *buf_size); \
- sfx_pcm_feed_t * (*get_pcm_feed) (song_iterator_t *s); \
- song_iterator_t * (* handle_message)(song_iterator_t *self, song_iterator_message_t msg); \
- void (*init) (song_iterator_t *self); \
- void (*cleanup) (song_iterator_t *self); \
- int (*get_timepos) (song_iterator_t *self); \
- listener_t death_listeners[SONGIT_MAX_LISTENERS]; \
- int death_listeners_nr \
-
#define SONGIT_MAX_LISTENERS 2
struct song_iterator_t {
diff --git a/engines/sci/sfx/sfx_iterator_internal.h b/engines/sci/sfx/sfx_iterator_internal.h
index 1f5733f79c..b8b534b03d 100644
--- a/engines/sci/sfx/sfx_iterator_internal.h
+++ b/engines/sci/sfx/sfx_iterator_internal.h
@@ -75,33 +75,27 @@ struct song_iterator_channel_t {
byte last_cmd; /* Last operation executed, for running status */
};
-#define INHERITS_BASE_SONG_ITERATOR \
- INHERITS_SONG_ITERATOR; /* aka "extends song iterator" */ \
- \
- int polyphony[MIDI_CHANNELS]; /* # of simultaneous notes on each */ \
- int importance[MIDI_CHANNELS]; /* priority rating for each channel, 0 means unrated. */ \
- \
- \
- int ccc; /* Cumulative cue counter, for those who need it */ \
- unsigned char resetflag; /* for 0x4C -- on DoSound StopSound, do we return to start? */ \
- int device_id; /* ID of the device we generating events for */ \
- int active_channels; /* Number of active channels */ \
- unsigned int size; /* Song size */ \
- unsigned char *data; \
- \
- int loops; /* Number of loops remaining */ \
- int recover_delay
-
-struct base_song_iterator_t {
- INHERITS_BASE_SONG_ITERATOR;
+struct base_song_iterator_t : public song_iterator_t {
+ int polyphony[MIDI_CHANNELS]; /* # of simultaneous notes on each */
+ int importance[MIDI_CHANNELS]; /* priority rating for each channel, 0 means unrated. */
+
+
+ int ccc; /* Cumulative cue counter, for those who need it */
+ unsigned char resetflag; /* for 0x4C -- on DoSound StopSound, do we return to start? */
+ int device_id; /* ID of the device we generating events for */
+ int active_channels; /* Number of active channels */
+ unsigned int size; /* Song size */
+ unsigned char *data;
+
+ int loops; /* Number of loops remaining */
+ int recover_delay;
};
/********************************/
/*--------- SCI 0 --------------*/
/********************************/
-struct sci0_song_iterator_t {
- INHERITS_BASE_SONG_ITERATOR;
+struct sci0_song_iterator_t : public base_song_iterator_t {
song_iterator_channel_t channel;
int delay_remaining; /* Number of ticks that haven't been polled yet */
};
@@ -122,8 +116,7 @@ struct sci1_sample_t {
sci1_sample_t *next;
};
-struct sci1_song_iterator_t {
- INHERITS_BASE_SONG_ITERATOR;
+struct sci1_song_iterator_t : public base_song_iterator_t {
song_iterator_channel_t channels[MIDI_CHANNELS];
/* Invariant: Whenever channels[i].delay == CHANNEL_DELAY_MISSING,
@@ -163,8 +156,7 @@ int is_cleanup_iterator(song_iterator_t *it);
/*--------- Fast Forward ---------*/
/**********************************/
-struct fast_forward_song_iterator_t {
- INHERITS_SONG_ITERATOR;
+struct fast_forward_song_iterator_t : public song_iterator_t {
song_iterator_t *delegate;
int delta; /* Remaining time */
};
@@ -197,9 +189,7 @@ song_iterator_t *new_fast_forward_iterator(song_iterator_t *it, int delta);
#define TEE_MORPH_NONE 0 /* Not waiting to self-morph */
#define TEE_MORPH_READY 1 /* Ready to self-morph */
-struct tee_song_iterator_t {
- INHERITS_SONG_ITERATOR;
-
+struct tee_song_iterator_t : public song_iterator_t {
int status;
int may_destroy; /* May destroy song iterators */
diff --git a/engines/sci/sfx/test-iterator.cpp b/engines/sci/sfx/test-iterator.cpp
index 37c602bf35..9c71e2f883 100644
--- a/engines/sci/sfx/test-iterator.cpp
+++ b/engines/sci/sfx/test-iterator.cpp
@@ -51,17 +51,16 @@ void error(char *fmt, ...) {
/* The simple iterator will finish after a fixed amount of time. Before that,
** it emits (absolute) cues in ascending order. */
-struct simple_it_struct {
- INHERITS_SONG_ITERATOR;
+struct simple_iterator : public song_iterator_t {
int lifetime_remaining;
char *cues;
int cue_counter;
int cue_progress;
int cues_nr;
-} simple_iterator;
+};
int simple_it_next(song_iterator_t *_self, unsigned char *buf, int *result) {
- struct simple_it_struct *self = (struct simple_it_struct *) _self;
+ simple_iterator *self = (simple_iterator *)_self;
if (self->lifetime_remaining == -1) {
error("Song iterator called post mortem");