[Scummvm-cvs-logs] SF.net SVN: scummvm:[39005] scummvm/trunk/engines/sci/sfx
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Sun Mar 1 07:01:48 CET 2009
Revision: 39005
http://scummvm.svn.sourceforge.net/scummvm/?rev=39005&view=rev
Author: fingolfin
Date: 2009-03-01 06:01:48 +0000 (Sun, 01 Mar 2009)
Log Message:
-----------
SCI: Replaced fake struct 'inheritance' (using #defines) with regular C++ subclassing
Modified Paths:
--------------
scummvm/trunk/engines/sci/sfx/sfx_iterator.h
scummvm/trunk/engines/sci/sfx/sfx_iterator_internal.h
scummvm/trunk/engines/sci/sfx/test-iterator.cpp
Modified: scummvm/trunk/engines/sci/sfx/sfx_iterator.h
===================================================================
--- scummvm/trunk/engines/sci/sfx/sfx_iterator.h 2009-03-01 05:15:51 UTC (rev 39004)
+++ scummvm/trunk/engines/sci/sfx/sfx_iterator.h 2009-03-01 06:01:48 UTC (rev 39005)
@@ -106,21 +106,6 @@
} 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 {
Modified: scummvm/trunk/engines/sci/sfx/sfx_iterator_internal.h
===================================================================
--- scummvm/trunk/engines/sci/sfx/sfx_iterator_internal.h 2009-03-01 05:15:51 UTC (rev 39004)
+++ scummvm/trunk/engines/sci/sfx/sfx_iterator_internal.h 2009-03-01 06:01:48 UTC (rev 39005)
@@ -75,33 +75,27 @@
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 : 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. */
-struct base_song_iterator_t {
- INHERITS_BASE_SONG_ITERATOR;
+
+ 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 @@
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 @@
/*--------- 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 @@
#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 */
Modified: scummvm/trunk/engines/sci/sfx/test-iterator.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/test-iterator.cpp 2009-03-01 05:15:51 UTC (rev 39004)
+++ scummvm/trunk/engines/sci/sfx/test-iterator.cpp 2009-03-01 06:01:48 UTC (rev 39005)
@@ -51,17 +51,16 @@
/* 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");
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