diff options
Diffstat (limited to 'engines/sci')
27 files changed, 194 insertions, 358 deletions
diff --git a/engines/sci/engine/heap.cpp b/engines/sci/engine/heap.cpp index c3cea90d64..5907582e37 100644 --- a/engines/sci/engine/heap.cpp +++ b/engines/sci/engine/heap.cpp @@ -55,8 +55,8 @@ static unsigned int get_next(heap_t *h, int block_pos) { } // Allocates a new heap -heap_t* heap_new() { - heap_t* h; +heap_t *heap_new() { + heap_t *h; if ((h = (heap_t*)sci_malloc(sizeof(heap_t))) == 0) return 0; @@ -248,7 +248,7 @@ void heap_dump_all(heap_t *h) { } } -/* +#if 0 int main(int argc, char **argv) { heap_t *h = heap_new(); int a, b, c, d, e; @@ -281,6 +281,6 @@ int main(int argc, char **argv) { return 0; } -*/ +#endif } // End of namespace Sci diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp index 22437d86b7..3a60f77fff 100644 --- a/engines/sci/engine/ksound.cpp +++ b/engines/sci/engine/ksound.cpp @@ -91,8 +91,7 @@ namespace Sci { #define SCRIPT_ASSERT_ZERO(fun) if (fun) script_debug_flag = script_error_flag = 1; -static void -script_set_priority(EngineState *s, reg_t obj, int priority) { +static void script_set_priority(EngineState *s, reg_t obj, int priority) { int song_nr = GET_SEL32V(obj, number); resource_t *song = scir_find_resource(s->resmgr, sci_sound, song_nr, 0); int flags = GET_SEL32V(obj, flags); @@ -110,8 +109,7 @@ script_set_priority(EngineState *s, reg_t obj, int priority) { PUT_SEL32V(obj, flags, flags); } -song_iterator_t * -build_iterator(EngineState *s, int song_nr, int type, songit_id_t id) { +song_iterator_t *build_iterator(EngineState *s, int song_nr, int type, songit_id_t id) { resource_t *song = scir_find_resource(s->resmgr, sci_sound, song_nr, 0); if (!song) @@ -121,8 +119,7 @@ build_iterator(EngineState *s, int song_nr, int type, songit_id_t id) { } -void -process_sound_events(EngineState *s) { /* Get all sound events, apply their changes to the heap */ +void process_sound_events(EngineState *s) { /* Get all sound events, apply their changes to the heap */ int result; song_handle_t handle; int cue; @@ -174,8 +171,7 @@ process_sound_events(EngineState *s) { /* Get all sound events, apply their chan } -reg_t -kDoSound_SCI0(EngineState *s, int funct_nr, int argc, reg_t *argv) { +reg_t kDoSound_SCI0(EngineState *s, int funct_nr, int argc, reg_t *argv) { reg_t obj = KP_ALT(1, NULL_REG); uint16 command = UKPV(0); song_handle_t handle = FROBNICATE_HANDLE(obj); @@ -362,12 +358,10 @@ kDoSound_SCI0(EngineState *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; } -int -sfx_send_midi(sfx_state_t *self, song_handle_t handle, int channel, +int sfx_send_midi(sfx_state_t *self, song_handle_t handle, int channel, int command, int arg1, int arg2); -reg_t -kDoSound_SCI01(EngineState *s, int funct_nr, int argc, reg_t *argv) { +reg_t kDoSound_SCI01(EngineState *s, int funct_nr, int argc, reg_t *argv) { uint16 command = UKPV(0); reg_t obj = KP_ALT(1, NULL_REG); song_handle_t handle = FROBNICATE_HANDLE(obj); @@ -667,12 +661,10 @@ kDoSound_SCI01(EngineState *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; } -int -sfx_send_midi(sfx_state_t *self, song_handle_t handle, int channel, +int sfx_send_midi(sfx_state_t *self, song_handle_t handle, int channel, int command, int arg1, int arg2); -reg_t -kDoSound_SCI1(EngineState *s, int funct_nr, int argc, reg_t *argv) { +reg_t kDoSound_SCI1(EngineState *s, int funct_nr, int argc, reg_t *argv) { uint16 command = UKPV(0); reg_t obj = KP_ALT(1, NULL_REG); song_handle_t handle = FROBNICATE_HANDLE(obj); @@ -979,8 +971,7 @@ kDoSound_SCI1(EngineState *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; } -reg_t -kDoSound(EngineState *s, int funct_nr, int argc, reg_t *argv) { +reg_t kDoSound(EngineState *s, int funct_nr, int argc, reg_t *argv) { if (s->version >= SCI_VERSION_FTU_DOSOUND_VARIANT_2) return kDoSound_SCI1(s, funct_nr, argc, argv); else if (s->version >= SCI_VERSION_FTU_DOSOUND_VARIANT_1) @@ -989,8 +980,7 @@ kDoSound(EngineState *s, int funct_nr, int argc, reg_t *argv) { return kDoSound_SCI0(s, funct_nr, argc, argv); } -reg_t -kDoAudio(EngineState *s, int funct_nr, int argc, reg_t *argv) { +reg_t kDoAudio(EngineState *s, int funct_nr, int argc, reg_t *argv) { switch (UKPV(0)) { case _K_SCI1_AUDIO_POSITION : return make_reg(0, -1); /* Finish immediately */ diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp index 56a9795c9f..b84e703c47 100644 --- a/engines/sci/engine/scriptdebug.cpp +++ b/engines/sci/engine/scriptdebug.cpp @@ -1917,10 +1917,10 @@ static int c_gfx_propagate_rect(EngineState *s) { } #define GETRECT(ll, rr, tt, bb) \ -ll = GET_SELECTOR(pos, ll); \ -rr = GET_SELECTOR(pos, rr); \ -tt = GET_SELECTOR(pos, tt); \ -bb = GET_SELECTOR(pos, bb); + ll = GET_SELECTOR(pos, ll); \ + rr = GET_SELECTOR(pos, rr); \ + tt = GET_SELECTOR(pos, tt); \ + bb = GET_SELECTOR(pos, bb); #if 0 // Unreferenced - removed @@ -2207,7 +2207,8 @@ static int c_resource_id(EngineState *s) { } static int c_listclones(EngineState *s) { -/* int i, j = 0; +#if 0 + int i, j = 0; sciprintf("Listing all logged clones:\n"); @@ -2218,7 +2219,8 @@ static int c_listclones(EngineState *s) { } } - sciprintf("Total of %d clones.\n", j);*/ + sciprintf("Total of %d clones.\n", j); +#endif sciprintf("This function is temporarily disabled.\n"); return 0; @@ -2445,10 +2447,10 @@ int c_simsoundcue(EngineState *s) { } #define GETRECT(ll, rr, tt, bb) \ -ll = GET_SELECTOR(pos, ll); \ -rr = GET_SELECTOR(pos, rr); \ -tt = GET_SELECTOR(pos, tt); \ -bb = GET_SELECTOR(pos, bb); + ll = GET_SELECTOR(pos, ll); \ + rr = GET_SELECTOR(pos, rr); \ + tt = GET_SELECTOR(pos, tt); \ + bb = GET_SELECTOR(pos, bb); #if 0 #ifdef __GNUC__ diff --git a/engines/sci/gfx/gfx_test.cpp b/engines/sci/gfx/gfx_test.cpp index bca8d56748..cec4bb50c0 100644 --- a/engines/sci/gfx/gfx_test.cpp +++ b/engines/sci/gfx/gfx_test.cpp @@ -45,8 +45,7 @@ namespace Sci { -int -sci0_palette; +int sci0_palette; gfx_pixmap_color_t gfx_sci0_image_colors[1][16]; @@ -55,8 +54,7 @@ gfxr_interpreter_get_static_palette(gfx_resstate_t *state, int version, int *col return NULL; } -int -sciprintf(const char *fmt, ...) { +int sciprintf(const char *fmt, ...) { va_list argp; va_start(argp, fmt); vprintf(fmt, argp); @@ -65,8 +63,7 @@ sciprintf(const char *fmt, ...) { } -void * -memdup(void *mem, size_t size) { +void *memdup(void *mem, size_t size) { void *r = malloc(size); if (r) memcpy(r, mem, size); @@ -77,8 +74,7 @@ memdup(void *mem, size_t size) { # include "../scicore/sci_memory.c" #endif -void -sci_gettime(long *seconds, long *useconds) { +void sci_gettime(long *seconds, long *useconds) { struct timeval tv; #ifdef WIN32 @@ -131,8 +127,7 @@ static struct { {GFX_CAPABILITY_KEYTRANSLATE, "built-in keyboard translation"} }; -int -init_driver(gfx_driver_t *drv) { +int init_driver(gfx_driver_t *drv) { int i; state->driver = drv; @@ -177,21 +172,18 @@ int test_views[TEST_VIEWS_NR] = {0}; int test_fonts[TEST_FONTS_NR] = {0}; int test_cursors[TEST_CURSORS_NR] = {0, 1}; -int -gfxr_interpreter_options_hash(gfx_resource_type_t type, int version, gfx_options_t *options, void *internal, int palette) { +int gfxr_interpreter_options_hash(gfx_resource_type_t type, int version, gfx_options_t *options, void *internal, int palette) { return 0; } -int * -arrdup(int *src, int count) { +int *arrdup(int *src, int count) { int *retval = sci_malloc(sizeof(int) * count); memcpy(retval, src, sizeof(int) * count); return retval; } -int * -gfxr_interpreter_get_resources(gfx_resstate_t *resstate, gfx_resource_type_t type, +int *gfxr_interpreter_get_resources(gfx_resstate_t *resstate, gfx_resource_type_t type, int version, int *entries_nr, void *internal) { switch (type) { @@ -254,8 +246,7 @@ gfx_pixmap_color_t pic_colors[PIC_COLORS_NR] = { {GFX_COLOR_INDEX_UNMAPPED, 0x00, 0x00, 0xff} }; -gfxr_pic_t * -gfxr_interpreter_init_pic(int version, gfx_mode_t *mode, int ID, void *internal) { +gfxr_pic_t *gfxr_interpreter_init_pic(int version, gfx_mode_t *mode, int ID, void *internal) { gfxr_pic_t *pic = sci_malloc(sizeof(gfxr_pic_t)); pic->mode = mode; @@ -284,8 +275,7 @@ gfxr_interpreter_init_pic(int version, gfx_mode_t *mode, int ID, void *internal) -void -gfxr_interpreter_clear_pic(int version, gfxr_pic_t *pic, void *internal) { +void gfxr_interpreter_clear_pic(int version, gfxr_pic_t *pic, void *internal) { memset(pic->visual_map->index_data, 0x00, 320 * 200); memset(pic->priority_map->index_data, 0, 320 * pic->mode->xfact * 200 * pic->mode->yfact); memset(pic->control_map->index_data, 0, GFXR_AUX_MAP_SIZE); @@ -293,8 +283,7 @@ gfxr_interpreter_clear_pic(int version, gfxr_pic_t *pic, void *internal) { } -int -gfxr_interpreter_calculate_pic(gfx_resstate_t *state, gfxr_pic_t *scaled_pic, gfxr_pic_t *unscaled_pic, +int gfxr_interpreter_calculate_pic(gfx_resstate_t *state, gfxr_pic_t *scaled_pic, gfxr_pic_t *unscaled_pic, int flags, int default_palette, int nr, void *internal) { gfxr_pic_t *pic = scaled_pic; int i, x, y, pos; @@ -367,8 +356,7 @@ gfx_pixmap_color_t view_colors[VIEW_COLORS_NR] = { {GFX_COLOR_INDEX_UNMAPPED, 0x00, 0xff, 0x00} }; -gfxr_view_t * -gfxr_interpreter_get_view(gfx_resstate_t *state, int nr, void *internal, int palette) { +gfxr_view_t *gfxr_interpreter_get_view(gfx_resstate_t *state, int nr, void *internal, int palette) { gfxr_view_t *view; gfxr_loop_t *loop; int i; @@ -434,8 +422,7 @@ gfxr_interpreter_get_view(gfx_resstate_t *state, int nr, void *internal, int pal extern byte builtin_font[]; -gfx_bitmap_font_t * -gfxr_interpreter_get_font(gfx_resstate_t *state, int nr, void *internal) { +gfx_bitmap_font_t *gfxr_interpreter_get_font(gfx_resstate_t *state, int nr, void *internal) { gfx_bitmap_font_t *font; int i; if (nr < 0 || nr > TEST_FONTS_NR) @@ -463,8 +450,7 @@ gfx_pixmap_color_t _cursor_colors[3] = { {GFX_COLOR_INDEX_UNMAPPED, 0x80, 0x80, 0x80} }; -gfx_pixmap_t * -gfxr_interpreter_get_cursor(gfx_resstate_t *state, int nr, void *internal) { +gfx_pixmap_t *gfxr_interpreter_get_cursor(gfx_resstate_t *state, int nr, void *internal) { gfx_pixmap_t *cursor; int xl, yl, x, y; @@ -535,20 +521,17 @@ gfxr_interpreter_get_cursor(gfx_resstate_t *state, int nr, void *internal) { return cursor; } -gfx_pixmap_color_t * -gfxr_interpreter_get_palette(gfx_resstate_t *state, int version, int *colors_nr, void *internal, int nr) { +gfx_pixmap_color_t *gfxr_interpreter_get_palette(gfx_resstate_t *state, int version, int *colors_nr, void *internal, int nr) { return NULL; } -int -gfxr_interpreter_needs_multicolored_pointers(int version, void *internal) { +int gfxr_interpreter_needs_multicolored_pointers(int version, void *internal) { return multicolored_pointers; } gfx_color_t red, green, blue, dblue, white, white8, white16, white24, black, transparent; -void -init_colors() { +void init_colors() { gfxop_set_color(state, &red, 0xff, 0x00, 0x00, 0x00, -1, -1); gfxop_set_color(state, &green, 0x00, 0xff, 0x00, 0x00, -1, -1); gfxop_set_color(state, &blue, 0x00, 0x00, 0xff, 0x00, -1, -1); @@ -569,8 +552,7 @@ init_colors() { #define MESSAGE4(foo,a,b,c,d) { char buf[1024]; sprintf(buf,foo,a,b,c,d); if (message(buf)) { fprintf(stderr,"Message '%s' could not be print!\n", buf); return;}} -int -waitkey(void) { +int waitkey(void) { int count = 100000; sci_event_t event; @@ -585,8 +567,7 @@ waitkey(void) { return 1; } -int -wait_specific_key(int key) { +int wait_specific_key(int key) { int count = 20000; sci_event_t event; @@ -603,8 +584,7 @@ wait_specific_key(int key) { } -int -message(char *msg) { +int message(char *msg) { gfx_text_handle_t *handle; rect_t text_rect = gfx_rect(0, 150, 320, 50); @@ -623,32 +603,27 @@ message(char *msg) { return 0; } -void -update(void) { +void update(void) { /* gfxop_update_box(state, gfx_rect(0, 0, 320, 150)); */ gfxop_update(state); } -void -explicit_clear_buffer(void) { +void explicit_clear_buffer(void) { gfxop_clear_box(state, gfx_rect(0, 0, 320, 150)); gfxop_update(state); } -void -clear_buffer(void) { +void clear_buffer(void) { gfxop_disable_dirty_frames(state); gfxop_clear_box(state, gfx_rect(0, 0, 320, 150)); gfxop_enable_dirty_frames(state); } -void -clear(void) { +void clear(void) { gfxop_fill_box(state, gfx_rect(0, 0, 320, 150), black); } -void -identify_event(sci_event_t event) { +void identify_event(sci_event_t event) { switch (event.type) { case SCI_EVT_NONE: @@ -686,8 +661,7 @@ identify_event(sci_event_t event) { } -int -test_a(void) { +int test_a(void) { if (message("-- Test A --\nText display and basic input\nPlease press 'space' within 20 seconds")) return 1; @@ -725,8 +699,7 @@ int test_b_lines[LINES_NR][4] = { {170, 90, 20, 10} }; -void -test_b(void) { +void test_b(void) { int i; MESSAGE("-- Test B --\nLines"); @@ -776,8 +749,7 @@ test_b(void) { } -void -test_c(void) { +void test_c(void) { int i; clear(); update(); @@ -831,8 +803,7 @@ test_c(void) { } -void -test_d(void) { +void test_d(void) { rect_t line; int pressed = 0; sci_event_t event; @@ -904,8 +875,7 @@ test_d(void) { } -void -test_e(void) { +void test_e(void) { int x; gfxop_set_pointer_cursor(state, 1); @@ -980,8 +950,7 @@ test_e(void) { waitkey(); } -void -test_wrap(int width, char *text) { +void test_wrap(int width, char *text) { rect_t rect = gfx_rect(0, 0, width, 120); gfx_text_handle_t *handle = gfxop_new_text(state, 0, text, @@ -993,8 +962,7 @@ test_wrap(int width, char *text) { gfxop_free_text(state, handle); } -void -test_f(void) { +void test_f(void) { int i; int x, y; gfx_text_handle_t *handle; @@ -1047,8 +1015,7 @@ test_f(void) { waitkey(); } -void -do_tests(char *conf) { +void do_tests(char *conf) { init_colors(); @@ -1072,14 +1039,12 @@ do_tests(char *conf) { test_f(); } -int -c_quit(void *S) { +int c_quit(void *S) { exit(0); return 0; /* hahaha */ } -int -main(int argc, char **argv) { +int main(int argc, char **argv) { gfx_driver_t *drv = NULL; char c; diff --git a/engines/sci/gfx/gfx_widgets.cpp b/engines/sci/gfx/gfx_widgets.cpp index 02bf37b314..f20e3d8a53 100644 --- a/engines/sci/gfx/gfx_widgets.cpp +++ b/engines/sci/gfx/gfx_widgets.cpp @@ -128,7 +128,7 @@ static int _gfxwop_print_empty(gfxw_widget_t *widget, int indentation) { return 0; } -gfxw_widget_t * _gfxw_new_widget(int size, gfxw_widget_type_t type) { +gfxw_widget_t *_gfxw_new_widget(int size, gfxw_widget_type_t type) { gfxw_widget_t *widget = (gfxw_widget_t*)sci_malloc(size); #ifdef SATISFY_PURIFY memset(widget, 0, size); @@ -2039,7 +2039,7 @@ gfxw_dyn_view_t *gfxw_picviewize_dynview(gfxw_dyn_view_t *dynview) { // Chrono-Ports (tm) -gfxw_port_t * gfxw_get_chrono_port(gfxw_visual_t *visual, gfxw_list_t **temp_widgets_list, int flags) { +gfxw_port_t *gfxw_get_chrono_port(gfxw_visual_t *visual, gfxw_list_t **temp_widgets_list, int flags) { gfxw_port_t *result = NULL; gfx_color_t transparent = {{0, 0, 0, 0}, 0, 0, 0, 0}; int id = 0; diff --git a/engines/sci/gfx/resource/sci_pic_0.cpp b/engines/sci/gfx/resource/sci_pic_0.cpp index c8209cd172..19a0a63bcf 100644 --- a/engines/sci/gfx/resource/sci_pic_0.cpp +++ b/engines/sci/gfx/resource/sci_pic_0.cpp @@ -137,8 +137,7 @@ void gfxr_init_static_palette() { } -gfxr_pic_t * -gfxr_init_pic(gfx_mode_t *mode, int ID, int sci1) { +gfxr_pic_t *gfxr_init_pic(gfx_mode_t *mode, int ID, int sci1) { gfxr_pic_t *pic = (gfxr_pic_t*)sci_malloc(sizeof(gfxr_pic_t)); pic->mode = mode; @@ -335,8 +334,7 @@ static void _gfxr_auxbuf_propagate_changes(gfxr_pic_t *pic, int bitmask) { #endif -static inline void -_gfxr_auxbuf_tag_line(gfxr_pic_t *pic, int pos, int width) { +static inline void _gfxr_auxbuf_tag_line(gfxr_pic_t *pic, int pos, int width) { int i; for (i = 0; i < width; i++) pic->aux_map[i+pos] |= FRESH_PAINT; diff --git a/engines/sci/scicore/resource.cpp b/engines/sci/scicore/resource.cpp index 0081926311..f68b50ef17 100644 --- a/engines/sci/scicore/resource.cpp +++ b/engines/sci/scicore/resource.cpp @@ -39,7 +39,7 @@ namespace Sci { #undef SCI_REQUIRE_RESOURCE_FILES //#define SCI_VERBOSE_RESMGR 1 -const char* sci_version_types[] = { +const char *sci_version_types[] = { "SCI version undetermined (Autodetect failed / not run)", "SCI version 0.xxx", "SCI version 0.xxx w/ 1.000 compression", @@ -53,7 +53,7 @@ const char* sci_version_types[] = { const int sci_max_resource_nr[] = {65536, 1000, 2048, 2048, 2048, 8192, 8192, 65536}; -const char* sci_error_types[] = { +const char *sci_error_types[] = { "No error", "I/O error", "Resource is empty (size 0)", @@ -67,7 +67,7 @@ const char* sci_error_types[] = { "SCI version is unsupported" }; -const char* sci_resource_types[] = {"view", "pic", "script", "text", "sound", +const char *sci_resource_types[] = {"view", "pic", "script", "text", "sound", "memory", "vocab", "font", "cursor", "patch", "bitmap", "palette", "cdaudio", "audio", "sync", "message", "map", "heap" diff --git a/engines/sci/scicore/resource.h b/engines/sci/scicore/resource.h index 2b6c4b0474..443c6c775a 100644 --- a/engines/sci/scicore/resource.h +++ b/engines/sci/scicore/resource.h @@ -93,10 +93,10 @@ enum ResourceType { #define RESSOURCE_ADDRESSING_EXTENDED 128 #define RESSOURCE_ADDRESSING_MASK 128 -extern const char* sci_error_types[]; -extern const char* sci_version_types[]; -extern const char* sci_resource_types[]; -extern const char* sci_resource_type_suffixes[]; /* Suffixes for SCI1 patch files */ +extern const char *sci_error_types[]; +extern const char *sci_version_types[]; +extern const char *sci_resource_types[]; +extern const char *sci_resource_type_suffixes[]; /* Suffixes for SCI1 patch files */ extern const int sci_max_resource_nr[]; /* Highest possible resource numbers */ diff --git a/engines/sci/scicore/sciconsole.cpp b/engines/sci/scicore/sciconsole.cpp index 0c0124aaf5..a8e57e6d74 100644 --- a/engines/sci/scicore/sciconsole.cpp +++ b/engines/sci/scicore/sciconsole.cpp @@ -36,7 +36,7 @@ namespace Sci { int con_passthrough = 0; FILE *con_file = NULL; -static void(*_con_string_callback)(char*) = NULL; +static void (*_con_string_callback)(char*) = NULL; static void (*_con_pixmap_callback)(gfx_pixmap_t *) = NULL; int sciprintf(const char *fmt, ...) { diff --git a/engines/sci/sfx/core.cpp b/engines/sci/sfx/core.cpp index 77f0a0c17a..40061d3e23 100644 --- a/engines/sci/sfx/core.cpp +++ b/engines/sci/sfx/core.cpp @@ -159,8 +159,7 @@ static int is_playing(sfx_state_t *self, song_t *song) { return 0; } -static void -_sfx_set_song_status(sfx_state_t *self, song_t *song, int status) { +static void _sfx_set_song_status(sfx_state_t *self, song_t *song, int status) { switch (status) { case SOUND_STATUS_STOPPED: diff --git a/engines/sci/sfx/device/alsa-midi.cpp b/engines/sci/sfx/device/alsa-midi.cpp index 2528ed1aa3..cc4037b020 100644 --- a/engines/sci/sfx/device/alsa-midi.cpp +++ b/engines/sci/sfx/device/alsa-midi.cpp @@ -43,8 +43,7 @@ static int subport_nr = 0; static const char *seq_name = "default"; -static void -_set_tempo(void) { +static void _set_tempo(void) { int resolution = 60; int tempo = 1; snd_seq_queue_tempo_t *queue_tempo; @@ -72,8 +71,7 @@ _set_tempo(void) { } -static int -am_subscribe_to_ports(void) { +static int am_subscribe_to_ports(void) { if ((port_out = snd_seq_connect_to(seq, port_out, port_nr, subport_nr)) < 0) { fprintf(stderr, "[SFX] Could not connect to ALSA sequencer port: %s\n", snd_strerror(port_out)); return SFX_ERROR; @@ -82,8 +80,7 @@ am_subscribe_to_ports(void) { } -static int -aminit(midi_writer_t *self) { +static int aminit(midi_writer_t *self) { int err; snd_midi_event_new(4096, &parser); @@ -124,14 +121,12 @@ aminit(midi_writer_t *self) { return SFX_OK; } -static int -amsetopt(midi_writer_t *self, char *name, char *value) { +static int amsetopt(midi_writer_t *self, char *name, char *value) { return SFX_ERROR; } -static int -amwrite(midi_writer_t *self, unsigned char *buf, int len) { +static int amwrite(midi_writer_t *self, unsigned char *buf, int len) { snd_seq_event_t evt; #if 0 @@ -170,13 +165,11 @@ amwrite(midi_writer_t *self, unsigned char *buf, int len) { return SFX_OK; } -static void -amdelay(midi_writer_t *self, int ticks) { +static void amdelay(midi_writer_t *self, int ticks) { delta += ticks; } -static void -amreset_timer(midi_writer_t *self) { +static void amreset_timer(midi_writer_t *self) { snd_seq_drain_output(seq); snd_seq_stop_queue(seq, queue, NULL); @@ -198,8 +191,7 @@ amreset_timer(midi_writer_t *self) { snd_seq_start_queue(seq, queue, NULL); } -static void -amclose(midi_writer_t *self) { +static void amclose(midi_writer_t *self) { snd_midi_event_free(parser); parser = NULL; } diff --git a/engines/sci/sfx/device/camd-midi.cpp b/engines/sci/sfx/device/camd-midi.cpp index d06324aaed..78be387d3c 100644 --- a/engines/sci/sfx/device/camd-midi.cpp +++ b/engines/sci/sfx/device/camd-midi.cpp @@ -61,8 +61,7 @@ static struct MidiNode *midi_node = NULL; return SFX_ERROR; \ } -static int -camd_init(midi_writer_t *self) { +static int camd_init(midi_writer_t *self) { sciprintf("[SFX] Initialising CAMD raw MIDI backend, v%s\n", SCI_CAMD_MIDI_VERSION); CamdBase = IExec->OpenLibrary("camd.library", 36L); @@ -86,15 +85,13 @@ camd_init(midi_writer_t *self) { return SFX_OK; } -static int -camd_set_option(midi_writer_t *self, char *name, char *value) { +static int camd_set_option(midi_writer_t *self, char *name, char *value) { return SFX_ERROR; } #define MAX_MIDI_LEN 3 -static int -camd_write(midi_writer_t *self, unsigned char *buffer, int len) { +static int camd_write(midi_writer_t *self, unsigned char *buffer, int len) { if (len == 0) return SFX_OK; @@ -123,16 +120,13 @@ camd_write(midi_writer_t *self, unsigned char *buffer, int len) { return SFX_OK; } -static void -camd_delay(midi_writer_t *self, int ticks) { +static void camd_delay(midi_writer_t *self, int ticks) { } -static void -camd_reset_timer(midi_writer_t *self) { +static void camd_reset_timer(midi_writer_t *self) { } -static void -camd_close(midi_writer_t *self) { +static void camd_close(midi_writer_t *self) { #ifdef NO_OP return; #endif diff --git a/engines/sci/sfx/device/unixraw-midi.cpp b/engines/sci/sfx/device/unixraw-midi.cpp index 501e154cb1..c6f393423c 100644 --- a/engines/sci/sfx/device/unixraw-midi.cpp +++ b/engines/sci/sfx/device/unixraw-midi.cpp @@ -41,8 +41,7 @@ namespace Sci { static int fd; static const char *devicename = "/dev/midi"; -static int -unixraw_init(midi_writer_t *self) { +static int unixraw_init(midi_writer_t *self) { sciprintf("[SFX] Initialising UNIX raw MIDI backend, v%s\n", SCI_UNIXRAW_MIDI_VERSION); fd = open(devicename, O_WRONLY | O_SYNC); @@ -55,13 +54,11 @@ unixraw_init(midi_writer_t *self) { return SFX_OK; } -static int -unixraw_set_option(midi_writer_t *self, char *name, char *value) { +static int unixraw_set_option(midi_writer_t *self, char *name, char *value) { return SFX_ERROR; } -static int -unixraw_write(midi_writer_t *self, unsigned char *buffer, int len) { +static int unixraw_write(midi_writer_t *self, unsigned char *buffer, int len) { if (write(fd, buffer, len) != len) { sciprintf("[SFX] MIDI write error\n"); return SFX_ERROR; @@ -69,16 +66,13 @@ unixraw_write(midi_writer_t *self, unsigned char *buffer, int len) { return SFX_OK; } -static void -unixraw_delay(midi_writer_t *self, int ticks) { +static void unixraw_delay(midi_writer_t *self, int ticks) { } -static void -unixraw_reset_timer(midi_writer_t *self) { +static void unixraw_reset_timer(midi_writer_t *self) { } -static void -unixraw_close(midi_writer_t *self) { +static void unixraw_close(midi_writer_t *self) { close(fd); } diff --git a/engines/sci/sfx/iterator.cpp b/engines/sci/sfx/iterator.cpp index 8c6f82c62e..d738d1222e 100644 --- a/engines/sci/sfx/iterator.cpp +++ b/engines/sci/sfx/iterator.cpp @@ -1062,8 +1062,7 @@ static int _sci1_process_next_command(sci1_song_iterator_t *self, return retval; } -static song_iterator_t * - _sci1_handle_message(sci1_song_iterator_t *self, +static song_iterator_t *_sci1_handle_message(sci1_song_iterator_t *self, song_iterator_message_t msg) { if (msg.recipient == _SIMSG_BASE) { /* May extend this in the future */ switch (msg.type) { diff --git a/engines/sci/sfx/mixer.h b/engines/sci/sfx/mixer.h index aea58ce2c9..5f24482904 100644 --- a/engines/sci/sfx/mixer.h +++ b/engines/sci/sfx/mixer.h @@ -122,7 +122,7 @@ sfx_pcm_mixer_t *sfx_pcm_find_mixer(char *name); extern sfx_pcm_mixer_t *mixer; /* _THE_ global pcm mixer */ -sfx_pcm_mixer_t* getMixer(); +sfx_pcm_mixer_t *getMixer(); } // End of namespace Sci diff --git a/engines/sci/sfx/mixer/soft.cpp b/engines/sci/sfx/mixer/soft.cpp index 05812e7aaf..53e4d94399 100644 --- a/engines/sci/sfx/mixer/soft.cpp +++ b/engines/sci/sfx/mixer/soft.cpp @@ -352,12 +352,11 @@ static inline void mix_swap_buffers(sfx_pcm_mixer_t *self) { /* Swap buffers */ P->writebuf = tmp; } -static inline int mix_compute_buf_len(sfx_pcm_mixer_t *self, int *skip_frames) +static inline int mix_compute_buf_len(sfx_pcm_mixer_t *self, int *skip_frames) { /* Computes the number of frames we ought to write. It tries to minimise the number, ** in order to reduce latency. */ /* It sets 'skip_frames' to the number of frames to assume lost by latency, effectively ** skipping them. */ -{ int free_frames; int played_frames = 0; /* since the last call */ uint32 msecs; @@ -922,6 +921,6 @@ sfx_pcm_mixer_t sfx_pcm_mixer_soft_linear = { NULL }; -sfx_pcm_mixer_t* getMixer() { return &sfx_pcm_mixer_soft_linear; } +sfx_pcm_mixer_t *getMixer() { return &sfx_pcm_mixer_soft_linear; } } // End of namespace Sci diff --git a/engines/sci/sfx/mixer/test.cpp b/engines/sci/sfx/mixer/test.cpp index 52102ba81b..8d7f31e059 100644 --- a/engines/sci/sfx/mixer/test.cpp +++ b/engines/sci/sfx/mixer/test.cpp @@ -230,15 +230,13 @@ sample_feed_t sample_feeds[FEEDS_NR] = { #endif }; -void -feed_destroy(sfx_pcm_feed_t *self) { +void feed_destroy(sfx_pcm_feed_t *self) { int_struct *s = (int_struct *) self->internal; s->i = 0; /* reset */ } -int -feed_poll(sfx_pcm_feed_t *self, byte *dest, int size) { +int feed_poll(sfx_pcm_feed_t *self, byte *dest, int size) { int_struct *s = (int_struct *) self->internal; int sample_size = self->sample_size; sample_feed_t *data = &(sample_feeds[self->debug_nr]); @@ -292,8 +290,7 @@ extern FILE *con_file; #define DELAY usleep((rand() / (RAND_MAX / 250L))) -int -main(int argc, char **argv) { +int main(int argc, char **argv) { int dev_nr; mix = sfx_pcm_find_mixer(NULL); diff --git a/engines/sci/sfx/player/realtime.cpp b/engines/sci/sfx/player/realtime.cpp index 84b40ced53..03c2b9ed04 100644 --- a/engines/sci/sfx/player/realtime.cpp +++ b/engines/sci/sfx/player/realtime.cpp @@ -55,8 +55,7 @@ static int play_it_done = 0; static int play_writeahead = 0; static int play_moredelay = 0; -static void -play_song(song_iterator_t *it, uint32 *wakeup_time, int writeahead_time) { +static void play_song(song_iterator_t *it, uint32 *wakeup_time, int writeahead_time) { unsigned char buf[8]; int result; @@ -106,13 +105,11 @@ play_song(song_iterator_t *it, uint32 *wakeup_time, int writeahead_time) { } } -static void -rt_tell_synth(int buf_nr, byte *buf) { +static void rt_tell_synth(int buf_nr, byte *buf) { seq->event(buf[0], buf_nr - 1, buf + 1); } -static void -rt_timer_callback(void) { +static void rt_timer_callback(void) { if (play_it && !play_it_done) { if (!play_moredelay) { int delta = delta_time(play_last_time, g_system->getMillis()); @@ -131,8 +128,7 @@ rt_timer_callback(void) { } } -static resource_t * -find_patch(ResourceManager *resmgr, const char *seq_name, int patchfile) { +static resource_t *find_patch(ResourceManager *resmgr, const char *seq_name, int patchfile) { resource_t *res = NULL; if (patchfile != SFX_SEQ_PATCHFILE_NONE) { @@ -148,13 +144,11 @@ find_patch(ResourceManager *resmgr, const char *seq_name, int patchfile) { /* API implementation */ -static int -rt_set_option(char *name, char *value) { +static int rt_set_option(char *name, char *value) { return SFX_ERROR; } -static int -rt_init(ResourceManager *resmgr, int expected_latency) { +static int rt_init(ResourceManager *resmgr, int expected_latency) { resource_t *res = NULL, *res2 = NULL; void *seq_dev = NULL; @@ -194,8 +188,7 @@ rt_init(ResourceManager *resmgr, int expected_latency) { return SFX_OK; } -static int -rt_add_iterator(song_iterator_t *it, uint32 start_time) { +static int rt_add_iterator(song_iterator_t *it, uint32 start_time) { if (seq->reset_timer) /* Restart timer counting if possible */ seq->reset_timer(start_time); @@ -210,14 +203,12 @@ rt_add_iterator(song_iterator_t *it, uint32 start_time) { return SFX_OK; } -static int -rt_fade_out(void) { +static int rt_fade_out(void) { fprintf(stderr, __FILE__": Attempt to fade out- not implemented yet\n"); return SFX_ERROR; } -static int -rt_stop(void) { +static int rt_stop(void) { song_iterator_t *it = play_it; play_it = NULL; @@ -230,8 +221,7 @@ rt_stop(void) { return SFX_OK; } -static int -rt_send_iterator_message(song_iterator_message_t msg) { +static int rt_send_iterator_message(song_iterator_message_t msg) { if (!play_it) return SFX_ERROR; @@ -239,8 +229,7 @@ rt_send_iterator_message(song_iterator_message_t msg) { return SFX_OK; } -static int -rt_pause(void) { +static int rt_pause(void) { play_pause_started = g_system->getMillis(); /* Also, indicate that we haven't modified the time counter ** yet */ @@ -254,14 +243,12 @@ rt_pause(void) { return seq->allstop(); } -static int -rt_resume(void) { +static int rt_resume(void) { play_paused = 0; return SFX_OK; } -static int -rt_exit(void) { +static int rt_exit(void) { int retval = SFX_OK; if (seq->close()) { diff --git a/engines/sci/sfx/seq/gm.cpp b/engines/sci/sfx/seq/gm.cpp index 7daa2b9535..bd4a171ed5 100644 --- a/engines/sci/sfx/seq/gm.cpp +++ b/engines/sci/sfx/seq/gm.cpp @@ -32,8 +32,7 @@ namespace Sci { static midi_writer_t *writer = NULL; -static int -midi_gm_open(int patch_len, byte *data, int patch2_len, byte *data2, void *device) { +static int midi_gm_open(int patch_len, byte *data, int patch2_len, byte *data2, void *device) { sfx_instrument_map_t *instrument_map = sfx_instrument_map_load_sci(data, patch_len); if (!instrument_map) { @@ -52,13 +51,11 @@ midi_gm_open(int patch_len, byte *data, int patch2_len, byte *data2, void *devic return SFX_OK; } -static int -midi_gm_close(void) { +static int midi_gm_close(void) { return SFX_OK; } -static int -midi_gm_event(byte command, int argc, byte *argv) { +static int midi_gm_event(byte command, int argc, byte *argv) { byte data[4]; assert(argc < 4); @@ -70,15 +67,13 @@ midi_gm_event(byte command, int argc, byte *argv) { return SFX_OK; } -static int -midi_gm_delay(int ticks) { +static int midi_gm_delay(int ticks) { writer->delay(writer, ticks); return SFX_OK; } -static int -midi_gm_reset_timer(uint32 ts) { +static int midi_gm_reset_timer(uint32 ts) { writer->reset_timer(writer); return SFX_OK; @@ -86,8 +81,7 @@ midi_gm_reset_timer(uint32 ts) { #define MIDI_MASTER_VOLUME_LEN 8 -static int -midi_gm_volume(uint8 volume) { +static int midi_gm_volume(uint8 volume) { byte data[MIDI_MASTER_VOLUME_LEN] = { 0xf0, 0x7f, @@ -106,8 +100,7 @@ midi_gm_volume(uint8 volume) { return SFX_OK; } -static int -midi_gm_allstop(void) { +static int midi_gm_allstop(void) { byte data[3] = { 0xb0, 0x78, /* all sound off */ 0 @@ -125,8 +118,7 @@ midi_gm_allstop(void) { return SFX_OK; } -static int -midi_gm_reverb(int reverb) { +static int midi_gm_reverb(int reverb) { byte data[3] = { 0xb0, 91, /* set reverb */ reverb @@ -145,8 +137,7 @@ midi_gm_reverb(int reverb) { return SFX_OK; } -static int -midi_gm_set_option(char *x, char *y) { +static int midi_gm_set_option(char *x, char *y) { return SFX_ERROR; } diff --git a/engines/sci/sfx/seq/instrument-map.cpp b/engines/sci/sfx/seq/instrument-map.cpp index 07179fbaeb..35b2f9ff05 100644 --- a/engines/sci/sfx/seq/instrument-map.cpp +++ b/engines/sci/sfx/seq/instrument-map.cpp @@ -31,8 +31,7 @@ namespace Sci { -sfx_instrument_map_t * -sfx_instrument_map_new(int velocity_maps_nr) { +sfx_instrument_map_t *sfx_instrument_map_new(int velocity_maps_nr) { sfx_instrument_map_t *map = (sfx_instrument_map_t *)sci_malloc(sizeof(sfx_instrument_map_t)); int i; @@ -67,8 +66,7 @@ sfx_instrument_map_new(int velocity_maps_nr) { return map; } -void -sfx_instrument_map_free(sfx_instrument_map_t *map) { +void sfx_instrument_map_free(sfx_instrument_map_t *map) { if (!map) return; @@ -103,8 +101,7 @@ sfx_instrument_map_free(sfx_instrument_map_t *map) { #define PATCH_MIN_SIZE PATCH_INIT_DATA -static int -patch001_type0_length(byte *data, size_t length) { +static int patch001_type0_length(byte *data, size_t length) { unsigned int pos = 492 + 246 * data[491]; /* printf("timbres %d (post = %04x)\n",data[491], pos);*/ @@ -125,15 +122,13 @@ patch001_type0_length(byte *data, size_t length) { return 0; } -static int -patch001_type1_length(byte *data, size_t length) { +static int patch001_type1_length(byte *data, size_t length) { if ((length >= 1155) && (((data[1154] << 8) + data[1153] + 1155) == (int)length)) return 1; return 0; } -int -sfx_instrument_map_detect(byte *data, size_t length) { +int sfx_instrument_map_detect(byte *data, size_t length) { /* length test */ if (length < 1155) return SFX_MAP_MT32; @@ -149,8 +144,7 @@ sfx_instrument_map_detect(byte *data, size_t length) { } -sfx_instrument_map_t * -sfx_instrument_map_load_sci(byte *data, size_t size) { +sfx_instrument_map_t *sfx_instrument_map_load_sci(byte *data, size_t size) { sfx_instrument_map_t * map; int i, m; @@ -220,40 +214,34 @@ struct decorated_midi_writer_t : public midi_writer_t { }; -static void -init_decorated(struct _midi_writer *self_) { +static void init_decorated(struct _midi_writer *self_) { decorated_midi_writer_t *self = (decorated_midi_writer_t *) self_; self->writer->init(self->writer); } -static void -set_option_decorated(struct _midi_writer *self_, char *name, char *value) { +static void set_option_decorated(struct _midi_writer *self_, char *name, char *value) { decorated_midi_writer_t *self = (decorated_midi_writer_t *) self_; self->writer->set_option(self->writer, name, value); } -static void -delay_decorated(struct _midi_writer *self_, int ticks) { +static void delay_decorated(struct _midi_writer *self_, int ticks) { decorated_midi_writer_t *self = (decorated_midi_writer_t *) self_; self->writer->delay(self->writer, ticks); } -static void -flush_decorated(struct _midi_writer *self_) { +static void flush_decorated(struct _midi_writer *self_) { decorated_midi_writer_t *self = (decorated_midi_writer_t *) self_; if (self->writer->flush) self->writer->flush(self->writer); } -static void -reset_timer_decorated(struct _midi_writer *self_) { +static void reset_timer_decorated(struct _midi_writer *self_) { decorated_midi_writer_t *self = (decorated_midi_writer_t *) self_; self->writer->reset_timer(self->writer); } -static void -close_decorated(decorated_midi_writer_t *self) { +static void close_decorated(decorated_midi_writer_t *self) { sfx_instrument_map_free(self->map); self->map = NULL; self->writer->close(self->writer); @@ -264,16 +252,14 @@ close_decorated(decorated_midi_writer_t *self) { #define BOUND_127(x) (((x) < 0)? 0 : (((x) > 0x7f)? 0x7f : (x))) -static int -bound_hard_127(int i, const char *descr) { +static int bound_hard_127(int i, const char *descr) { int r = BOUND_127(i); if (r != i) fprintf(stderr, "[instrument-map] Hard-clipping %02x to %02x in %s\n", i, r, descr); return r; } -static int -set_bend_range(midi_writer_t *writer, int channel, int range) { +static int set_bend_range(midi_writer_t *writer, int channel, int range) { byte buf[3] = {0xb0, 0x65, 0x00}; buf[0] |= channel & 0xf; @@ -297,8 +283,7 @@ set_bend_range(midi_writer_t *writer, int channel, int range) { return SFX_OK; } -static int -write_decorated(decorated_midi_writer_t *self, byte *buf, int len) { +static int write_decorated(decorated_midi_writer_t *self, byte *buf, int len) { sfx_instrument_map_t *map = self->map; int op = *buf & 0xf0; int chan = *buf & 0x0f; @@ -423,8 +408,7 @@ write_decorated(decorated_midi_writer_t *self, byte *buf, int len) { #define MIDI_BYTES_PER_SECOND 3250 /* This seems to be the minimum guarantee by the standard */ #define MAX_PER_TICK (MIDI_BYTES_PER_SECOND / 60) /* After this, we ought to issue one tick of pause */ -static void -init(midi_writer_t *writer, byte *data, size_t len) { +static void init(midi_writer_t *writer, byte *data, size_t len) { size_t offset = 0; byte status = 0; @@ -489,8 +473,7 @@ init(midi_writer_t *writer, byte *data, size_t len) { #define NAME_SUFFIX "+instruments" -midi_writer_t * -sfx_mapped_writer(midi_writer_t *writer, sfx_instrument_map_t *map) { +midi_writer_t *sfx_mapped_writer(midi_writer_t *writer, sfx_instrument_map_t *map) { int i; decorated_midi_writer_t *retval; diff --git a/engines/sci/sfx/seq/instrument-map.h b/engines/sci/sfx/seq/instrument-map.h index 95233f9099..c223e68a33 100644 --- a/engines/sci/sfx/seq/instrument-map.h +++ b/engines/sci/sfx/seq/instrument-map.h @@ -75,21 +75,18 @@ struct sfx_instrument_map_t { byte *initialisation_block; /* Initial MIDI commands to set up the device */ }; -sfx_instrument_map_t * -sfx_instrument_map_new(int velocity_maps_nr); +sfx_instrument_map_t *sfx_instrument_map_new(int velocity_maps_nr); /* Constructs a new default-initialised velocity map ** Parameters: (int) velocity_maps_nr: Number of velocity maps to allocate ** Returns : (sfx_instrument_map *) an initialised instrument map */ -void -sfx_instrument_map_free(sfx_instrument_map_t *map); +void sfx_instrument_map_free(sfx_instrument_map_t *map); /* Deallocates an instrument map ** Parameters: (sfx_instrument_map *) map: The map to deallocate, or NULL for a no-op */ -sfx_instrument_map_t * -sfx_instrument_map_load_sci(byte *data, size_t length); +sfx_instrument_map_t *sfx_instrument_map_load_sci(byte *data, size_t length); /* Allocate and initialise an instrument map from SCI data ** Parameters: (byte *) Pointer to the data to initialise from ** (size_t) Number of bytes to expect within @@ -98,8 +95,7 @@ sfx_instrument_map_load_sci(byte *data, size_t length); ** If `data' is null, the function will return NULL quietly. */ -sfx_instrument_map_t * -sfx_instrument_map_mt32_to_gm(byte *data, size_t size); +sfx_instrument_map_t *sfx_instrument_map_mt32_to_gm(byte *data, size_t size); /* Allocate and initialise an instrument map from MT-32 patch data ** Parameters: (byte *) Pointer to the MT-32 patch data to initialise from ** (size_t) Number of bytes to expect within @@ -107,8 +103,7 @@ sfx_instrument_map_mt32_to_gm(byte *data, size_t size); ** If `data' is null or invalid, the function will return a default MT-32 to GM map. */ -int -sfx_instrument_map_detect(byte *data, size_t size); +int sfx_instrument_map_detect(byte *data, size_t size); /* Detects the type of patch data ** Parameters: (byte *) Pointer to the patch data ** (size_t) Number of bytes to expect within @@ -116,8 +111,7 @@ sfx_instrument_map_detect(byte *data, size_t size); ** or SFX_MAP_UNKNOWN for unknown. */ -midi_writer_t * -sfx_mapped_writer(midi_writer_t *writer, sfx_instrument_map_t *map); +midi_writer_t *sfx_mapped_writer(midi_writer_t *writer, sfx_instrument_map_t *map); /* Wrap a midi_writer_t into an instrument map ** Parameters: (midi_writer_t *) writer: The writer to wrap ** (sfx_instrument_map_t *) map: The map to apply to all commands going into the writer, or NULL diff --git a/engines/sci/sfx/seq/map-mt32-to-gm.cpp b/engines/sci/sfx/seq/map-mt32-to-gm.cpp index 777409d694..8c909905e1 100644 --- a/engines/sci/sfx/seq/map-mt32-to-gm.cpp +++ b/engines/sci/sfx/seq/map-mt32-to-gm.cpp @@ -32,8 +32,7 @@ namespace Sci { #define DEBUG_MT32_TO_GM -static const char -*GM_Instrument_Names[] = { +static const char *GM_Instrument_Names[] = { /*000*/ "Acoustic Grand Piano", /*001*/ "Bright Acoustic Piano", /*002*/ "Electric Grand Piano", @@ -165,8 +164,7 @@ static const char }; /* The GM Percussion map is downwards compatible to the MT32 map, which is used in SCI */ -static const char -*GM_Percussion_Names[] = { +static const char *GM_Percussion_Names[] = { /*00*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*10*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*20*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -398,8 +396,7 @@ static struct { /*29*/ {"OpenHiHat2", SFX_MAPPED_TO_RHYTHM, 43} }; -static int8 -MT32_PresetRhythmKeymap[] = { +static int8 MT32_PresetRhythmKeymap[] = { SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, SFX_UNMAPPED, @@ -560,8 +557,7 @@ static struct { {0, 0, 0} }; -static int8 -lookup_instrument(const char *iname) { +static int8 lookup_instrument(const char *iname) { int i = 0; while (MT32_MemoryTimbreMaps[i].name) { @@ -572,8 +568,7 @@ lookup_instrument(const char *iname) { return SFX_UNMAPPED; } -static int8 -lookup_rhythm_key(const char *iname) { +static int8 lookup_rhythm_key(const char *iname) { int i = 0; while (MT32_MemoryTimbreMaps[i].name) { @@ -584,8 +579,7 @@ lookup_rhythm_key(const char *iname) { return SFX_UNMAPPED; } -static void -print_map(int sci, int ins, int rhythm, int mt32) { +static void print_map(int sci, int ins, int rhythm, int mt32) { #ifdef DEBUG_MT32_TO_GM if (ins == SFX_UNMAPPED || (ins == SFX_MAPPED_TO_RHYTHM && rhythm == SFX_UNMAPPED)) { sciprintf("[MT32-to-GM] No mapping available for [%i] `%s' (%i)\n", @@ -606,8 +600,7 @@ print_map(int sci, int ins, int rhythm, int mt32) { #endif } -static void -print_map_mem(int sci, int ins, int rhythm, char *mt32) { +static void print_map_mem(int sci, int ins, int rhythm, char *mt32) { #ifdef DEBUG_MT32_TO_GM char name[11]; @@ -631,8 +624,7 @@ print_map_mem(int sci, int ins, int rhythm, char *mt32) { #endif } -static void -print_map_rhythm(int sci, int ins, int rhythm, int mt32) { +static void print_map_rhythm(int sci, int ins, int rhythm, int mt32) { #ifdef DEBUG_MT32_TO_GM if (ins == SFX_UNMAPPED || (ins == SFX_MAPPED_TO_RHYTHM && rhythm == SFX_UNMAPPED)) { sciprintf("[MT32-to-GM] No mapping available for [%i] `%s' [R] (%i)\n", @@ -653,8 +645,7 @@ print_map_rhythm(int sci, int ins, int rhythm, int mt32) { #endif } -static void -print_map_rhythm_mem(int sci, int rhythm, char *mt32) { +static void print_map_rhythm_mem(int sci, int rhythm, char *mt32) { #ifdef DEBUG_MT32_TO_GM char name[11]; @@ -672,8 +663,7 @@ print_map_rhythm_mem(int sci, int rhythm, char *mt32) { #endif } -sfx_instrument_map_t * -sfx_instrument_map_mt32_to_gm(byte *data, size_t size) { +sfx_instrument_map_t *sfx_instrument_map_mt32_to_gm(byte *data, size_t size) { int memtimbres, patches; uint8 group, number, keyshift, finetune, bender_range; uint8 *patchpointer; diff --git a/engines/sci/sfx/seq/oss-adlib.cpp b/engines/sci/sfx/seq/oss-adlib.cpp index 2222544781..9285fd5a2c 100644 --- a/engines/sci/sfx/seq/oss-adlib.cpp +++ b/engines/sci/sfx/seq/oss-adlib.cpp @@ -143,8 +143,7 @@ int adlib_kill_one_note(int chn) { return oldest; } -static void -adlib_start_note(int chn, int note, int velocity) { +static void adlib_start_note(int chn, int note, int velocity) { int free; struct timeval now; @@ -174,8 +173,7 @@ adlib_start_note(int chn, int note, int velocity) { SEQ_DUMPBUF(); } -static int -midi_adlib_open(int data_length, byte *data_ptr, int data2_length, +static int midi_adlib_open(int data_length, byte *data_ptr, int data2_length, byte *data2_ptr, void *seq) { int nrdevs, i, n; struct synth_info info; @@ -237,15 +235,13 @@ midi_adlib_open(int data_length, byte *data_ptr, int data2_length, } -static int -midi_adlib_close(void) { +static int midi_adlib_close(void) { SEQ_DUMPBUF(); return close(seqfd); } -static int -midi_adlib_allstop(void) { +static int midi_adlib_allstop(void) { int i; for (i = 0; i < ADLIB_VOICES ; i++) { if (oper_chn[i] == 255) @@ -257,14 +253,12 @@ midi_adlib_allstop(void) { return 0; } -static int -midi_adlib_reverb(int param) { +static int midi_adlib_reverb(int param) { printf("reverb NYI %04x \n", param); return 0; } -static inline int -midi_adlib_event1(uint8 command, uint8 note, uint8 velocity) { +static inline int midi_adlib_event1(uint8 command, uint8 note, uint8 velocity) { uint8 channel, oper; channel = command & 0x0f; @@ -297,8 +291,7 @@ midi_adlib_event1(uint8 command, uint8 note, uint8 velocity) { return 0; } -static inline int -midi_adlib_event2(uint8 command, uint8 param) { +static inline int midi_adlib_event2(uint8 command, uint8 param) { uint8 channel; uint8 oper; @@ -320,22 +313,19 @@ midi_adlib_event2(uint8 command, uint8 param) { return 0; } -static int -midi_adlib_event(byte command, int argc, byte *argv) { +static int midi_adlib_event(byte command, int argc, byte *argv) { if (argc > 1) return midi_adlib_event1(command, argv[0], argv[1]); else return midi_adlib_event2(command, argv[0]); } -static int -midi_adlib_delay(int ticks) { +static int midi_adlib_delay(int ticks) { SEQ_DELTA_TIME(ticks); return SFX_OK; } -static int -midi_adlib_set_option(char *name, char *value) { +static int midi_adlib_set_option(char *name, char *value) { return SFX_ERROR; /* No options are supported at this time */ } diff --git a/engines/sci/sfx/softseq/fluidsynth.cpp b/engines/sci/sfx/softseq/fluidsynth.cpp index ab73c381bd..9450ab55de 100644 --- a/engines/sci/sfx/softseq/fluidsynth.cpp +++ b/engines/sci/sfx/softseq/fluidsynth.cpp @@ -50,18 +50,15 @@ static int rpn[16]; /* MIDI writer */ -static int -fluidsynth_midi_init(struct _midi_writer *self) { +static int fluidsynth_midi_init(struct _midi_writer *self) { return SFX_OK; } -static int -fluidsynth_midi_set_option(struct _midi_writer *self, char *name, char *value) { +static int fluidsynth_midi_set_option(struct _midi_writer *self, char *name, char *value) { return SFX_ERROR; } -static int -fluidsynth_midi_write(struct _midi_writer *self, unsigned char *buf, int len) { +static int fluidsynth_midi_write(struct _midi_writer *self, unsigned char *buf, int len) { if (buf[0] == 0xf0) sciprintf("FluidSynth: Skipping sysex message.\n"); else if (len == 2) { @@ -124,16 +121,13 @@ fluidsynth_midi_write(struct _midi_writer *self, unsigned char *buf, int len) { return SFX_OK; } -static void -fluidsynth_midi_delay(struct _midi_writer *self, int ticks) { +static void fluidsynth_midi_delay(struct _midi_writer *self, int ticks) { } -static void -fluidsynth_midi_reset_timer(struct _midi_writer *self) { +static void fluidsynth_midi_reset_timer(struct _midi_writer *self) { } -static void -fluidsynth_midi_close(struct _midi_writer *self) { +static void fluidsynth_midi_close(struct _midi_writer *self) { } static midi_writer_t midi_writer_fluidsynth = { @@ -149,13 +143,11 @@ static midi_writer_t midi_writer_fluidsynth = { /* Software sequencer */ -static void -fluidsynth_poll(sfx_softseq_t *self, byte *dest, int count) { +static void fluidsynth_poll(sfx_softseq_t *self, byte *dest, int count) { fluid_synth_write_s16(synth, count, dest, 0, 2, dest + 2, 0, 2); } -static int -fluidsynth_init(sfx_softseq_t *self, byte *data_ptr, int data_length, +static int fluidsynth_init(sfx_softseq_t *self, byte *data_ptr, int data_length, byte *data2_ptr, int data2_length) { int sfont_id; double min, max; @@ -198,31 +190,26 @@ fluidsynth_init(sfx_softseq_t *self, byte *data_ptr, int data_length, return SFX_OK; } -static void -fluidsynth_exit(sfx_softseq_t *self) { +static void fluidsynth_exit(sfx_softseq_t *self) { delete_fluid_synth(synth); delete_fluid_settings(settings); } -static void -fluidsynth_allstop(sfx_softseq_t *self) { +static void fluidsynth_allstop(sfx_softseq_t *self) { if (gmseq->allstop) gmseq->allstop(); } -static void -fluidsynth_volume(sfx_softseq_t *self, int volume) { +static void fluidsynth_volume(sfx_softseq_t *self, int volume) { if (gmseq->volume) gmseq->volume(volume); } -static int -fluidsynth_set_option(sfx_softseq_t *self, const char *name, const char *value) { +static int fluidsynth_set_option(sfx_softseq_t *self, const char *name, const char *value) { return SFX_ERROR; } -static void -fluidsynth_event(sfx_softseq_t *self, byte cmd, int argc, byte *argv) { +static void fluidsynth_event(sfx_softseq_t *self, byte cmd, int argc, byte *argv) { gmseq->event(cmd, argc, argv); } diff --git a/engines/sci/sfx/softseq/opl2.cpp b/engines/sci/sfx/softseq/opl2.cpp index fa1fc54a0e..cd6db5f03c 100644 --- a/engines/sci/sfx/softseq/opl2.cpp +++ b/engines/sci/sfx/softseq/opl2.cpp @@ -170,8 +170,7 @@ static inline int opl_write(int a, int v) { } /* -static inline uint8 opl_read (int a) -{ +static inline uint8 opl_read (int a) { OPLWrite (ym3812_L, 0x388, a); return OPLRead (ym3812_L, 0x389); } diff --git a/engines/sci/sfx/test-iterator.cpp b/engines/sci/sfx/test-iterator.cpp index 939d8ff8d6..37c602bf35 100644 --- a/engines/sci/sfx/test-iterator.cpp +++ b/engines/sci/sfx/test-iterator.cpp @@ -37,8 +37,7 @@ using namespace Sci; int errors = 0; -void -error(char *fmt, ...) { +void error(char *fmt, ...) { va_list ap; fprintf(stderr, "[ERROR] "); @@ -61,8 +60,7 @@ struct simple_it_struct { int cues_nr; } simple_iterator; -int -simple_it_next(song_iterator_t *_self, unsigned char *buf, int *result) { +int simple_it_next(song_iterator_t *_self, unsigned char *buf, int *result) { struct simple_it_struct *self = (struct simple_it_struct *) _self; if (self->lifetime_remaining == -1) { @@ -106,23 +104,19 @@ simple_it_next(song_iterator_t *_self, unsigned char *buf, int *result) { } } -sfx_pcm_feed_t * -simple_it_pcm_feed(song_iterator_t *_self) { +sfx_pcm_feed_t *simple_it_pcm_feed(song_iterator_t *_self) { error("No PCM feed!\n"); return NULL; } -void -simple_it_init(song_iterator_t *_self) { +void simple_it_init(song_iterator_t *_self) { } -song_iterator_t * -simple_it_handle_message(song_iterator_t *_self, song_iterator_message_t msg) { +song_iterator_t *simple_it_handle_message(song_iterator_t *_self, song_iterator_message_t msg) { return NULL; } -void -simple_it_cleanup(song_iterator_t *_self) { +void simple_it_cleanup(song_iterator_t *_self) { } /* Initialises the simple iterator. @@ -131,8 +125,7 @@ simple_it_cleanup(song_iterator_t *_self) { ** (int) cues_nr: Number of cues in ``cues'' ** The first cue is emitted after cues[0] ticks, and it is 1. After cues[1] additional ticks ** the next cue is emitted, and so on. */ -song_iterator_t * -setup_simple_iterator(int delay, char *cues, int cues_nr) { +song_iterator_t *setup_simple_iterator(int delay, char *cues, int cues_nr) { simple_iterator.lifetime_remaining = delay; simple_iterator.cues = cues; simple_iterator.cue_counter = 0; @@ -161,8 +154,7 @@ setup_simple_iterator(int delay, char *cues, int cues_nr) { #define ASSERT_RESULT(n) ASSERT(result == n) #define ASSERT_CUE(n) ASSERT_NEXT(SI_ABSOLUTE_CUE); ASSERT_RESULT(n) -void -test_simple_it() { +void test_simple_it() { song_iterator_t *it; song_iterator_t *simple_it = (song_iterator_t *) & simple_iterator; unsigned char data[4]; @@ -193,8 +185,7 @@ test_simple_it() { puts("[TEST] Test OK."); } -void -test_fastforward() { +void test_fastforward() { song_iterator_t *it; song_iterator_t *simple_it = (song_iterator_t *) & simple_iterator; song_iterator_t *ff_it; @@ -297,8 +288,7 @@ static unsigned char simple_song[SIMPLE_SONG_SIZE] = { ASSERT(data[1] == arg0); \ ASSERT(data[2] == arg1); -void -test_iterator_sci0() { +void test_iterator_sci0() { song_iterator_t *it = songit_new(simple_song, SIMPLE_SONG_SIZE, SCI_SONG_ITERATOR_TYPE_SCI0, 0l); unsigned char data[4]; int result; @@ -322,8 +312,7 @@ test_iterator_sci0() { -void -test_iterator_sci0_loop() { +void test_iterator_sci0_loop() { song_iterator_t *it = songit_new(simple_song, SIMPLE_SONG_SIZE, SCI_SONG_ITERATOR_TYPE_SCI0, 0l); unsigned char data[4]; int result; @@ -379,8 +368,7 @@ unsigned char loop_song[LOOP_SONG_SIZE] = { }; -void -test_iterator_sci0_mark_loop() { +void test_iterator_sci0_mark_loop() { song_iterator_t *it = songit_new(loop_song, LOOP_SONG_SIZE, SCI_SONG_ITERATOR_TYPE_SCI0, 0l); unsigned char data[4]; int result; @@ -424,8 +412,7 @@ test_iterator_sci0_mark_loop() { -int -main(int argc, char **argv) { +int main(int argc, char **argv) { test_simple_it(); test_fastforward(); test_iterator_sci0(); diff --git a/engines/sci/sfx/timetest.cpp b/engines/sci/sfx/timetest.cpp index 9b50e247b0..c7f9222213 100644 --- a/engines/sci/sfx/timetest.cpp +++ b/engines/sci/sfx/timetest.cpp @@ -31,8 +31,7 @@ using namespace Sci; sfx_timestamp_t a, b, c; -int -main(int argc, char **argv) { +int main(int argc, char **argv) { int i; a = sfx_new_timestamp(10, 0, 1000); b = sfx_new_timestamp(10, 1000, 1000); |