diff options
Diffstat (limited to 'engines/sci')
158 files changed, 592 insertions, 14 deletions
diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp index 28f0454710..e1dd2b999f 100644 --- a/engines/sci/engine/game.cpp +++ b/engines/sci/engine/game.cpp @@ -29,6 +29,8 @@ #include "sci/include/kernel.h" #include "sci/engine/kernel_types.h" +namespace Sci { + // Structures and data from vm.c: extern calls_struct_t *send_calls; extern int send_calls_allocated; @@ -704,3 +706,4 @@ int game_exit(state_t *s) { return 0; } +} // End of namespace Sci diff --git a/engines/sci/engine/gc.cpp b/engines/sci/engine/gc.cpp index bf523e5f7b..dca06db94f 100644 --- a/engines/sci/engine/gc.cpp +++ b/engines/sci/engine/gc.cpp @@ -25,6 +25,8 @@ #include "sci/engine/gc.h" +namespace Sci { + #define WORKLIST_CHUNK_SIZE 32 //#define DEBUG_GC @@ -287,3 +289,5 @@ void run_gc(state_t *s) { } #endif } + +} // End of namespace Sci diff --git a/engines/sci/engine/gc.h b/engines/sci/engine/gc.h index ab387d7d5e..aa7b91264e 100644 --- a/engines/sci/engine/gc.h +++ b/engines/sci/engine/gc.h @@ -31,6 +31,7 @@ #include "sci/include/vm_types.h" #include "sci/include/engine.h" +namespace Sci { struct reg_t_EqualTo { bool operator()(const reg_t& x, const reg_t& y) const { @@ -58,4 +59,6 @@ void run_gc(state_t *s); ** Parameters: (state_t *) s: The state in which we should gc */ +} // End of namespace Sci + #endif // !defined(GC_H_) diff --git a/engines/sci/engine/grammar.cpp b/engines/sci/engine/grammar.cpp index 2429de00ae..c478d6c1c9 100644 --- a/engines/sci/engine/grammar.cpp +++ b/engines/sci/engine/grammar.cpp @@ -32,6 +32,8 @@ #include "sci/include/vocabulary.h" #include "sci/include/console.h" +namespace Sci { + #define TOKEN_OPAREN 0xff000000 #define TOKEN_CPAREN 0xfe000000 #define TOKEN_TERMINAL_CLASS 0x10000 @@ -583,3 +585,5 @@ int vocab_gnf_parse(parse_tree_node_t *nodes, result_word_t *words, int words_nr return 0; } + +} // End of namespace Sci diff --git a/engines/sci/engine/heap.cpp b/engines/sci/engine/heap.cpp index b356172c16..bd1959ea49 100644 --- a/engines/sci/engine/heap.cpp +++ b/engines/sci/engine/heap.cpp @@ -27,6 +27,8 @@ #include "sci/include/console.h" #include "sci/engine/heap.h" +namespace Sci { + #define assert_in_range(pos) assert(pos >= 1000 && pos <= 0xffff) static void set_size(heap_t *h, int block_pos, int size) { @@ -280,3 +282,5 @@ int main(int argc, char **argv) { return 0; } */ + +} // End of namespace Sci diff --git a/engines/sci/engine/heap.h b/engines/sci/engine/heap.h index 9c9c378037..5fd745d547 100644 --- a/engines/sci/engine/heap.h +++ b/engines/sci/engine/heap.h @@ -28,6 +28,8 @@ #include "sci/include/resource.h" +namespace Sci { + #define SCI_HEAP_SIZE 0x10000 typedef guint16 heap_ptr; @@ -108,4 +110,6 @@ void heap_dump_all(heap_t *h); ** Returns : (void) */ +} // End of namespace Sci + #endif // !_SCI_HEAP_H diff --git a/engines/sci/engine/int_hashmap.cpp b/engines/sci/engine/int_hashmap.cpp index cdca3e5e5b..b48653ede1 100644 --- a/engines/sci/engine/int_hashmap.cpp +++ b/engines/sci/engine/int_hashmap.cpp @@ -25,6 +25,7 @@ #include "sci/engine/int_hashmap.h" +namespace Sci { #define HASH_MAX DCS_INT_HASH_MAX #define HASH(x) (x & 0xff) @@ -107,3 +108,4 @@ int int_hash_map_t::remove_value(int value) { return -1; // Not found } +} // End of namespace Sci diff --git a/engines/sci/engine/int_hashmap.h b/engines/sci/engine/int_hashmap.h index 092ad4ffba..c677079211 100644 --- a/engines/sci/engine/int_hashmap.h +++ b/engines/sci/engine/int_hashmap.h @@ -28,6 +28,7 @@ #include "common/scummsys.h" +namespace Sci { /* * Defines a hash map that maps values to small integers. @@ -82,5 +83,6 @@ public: typedef int_hash_map_t *int_hash_map_ptr; +} // End of namespace Sci #endif // INT_HASHMAP_H diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp index 470f407ac6..8c07f0b2e0 100644 --- a/engines/sci/engine/kernel.cpp +++ b/engines/sci/engine/kernel.cpp @@ -36,6 +36,8 @@ #include "sci/include/gfx_operations.h" #include "sci/engine/kernel_types.h" +namespace Sci { + // New kernel functions reg_t kStrLen(struct _state *s, int funct_nr, int argc, reg_t *argv); reg_t kGetFarText(struct _state *s, int funct_nr, int argc, reg_t *argv); @@ -977,3 +979,5 @@ byte *kernel_dereference_bulk_pointer(struct _state *s, reg_t pointer, int entri reg_t *kernel_dereference_reg_pointer(struct _state *s, reg_t pointer, int entries) { return (reg_t*)_kernel_dereference_pointer(s, pointer, entries, sizeof(reg_t)); } + +} // End of namespace Sci diff --git a/engines/sci/engine/kernel_compat.h b/engines/sci/engine/kernel_compat.h index 128044ca71..923b5ee8c0 100644 --- a/engines/sci/engine/kernel_compat.h +++ b/engines/sci/engine/kernel_compat.h @@ -32,6 +32,8 @@ #warning "Old kernel compatibility crap" #endif +namespace Sci { + // Minimal heap position/ #define HEAP_MIN 800 @@ -71,4 +73,6 @@ static inline unsigned int getHeapUInt16(unsigned char *base, int address) { return getUInt16(base + address); } +} // End of namespace Sci + #endif // !_SCI_KERNEL_COMPAT_ diff --git a/engines/sci/engine/kernel_types.h b/engines/sci/engine/kernel_types.h index 41a7dbf20b..1572d6f652 100644 --- a/engines/sci/engine/kernel_types.h +++ b/engines/sci/engine/kernel_types.h @@ -28,6 +28,8 @@ #include "sci/include/vm_types.h" +namespace Sci { + #define KSIG_TERMINATOR 0 // Uncompiled signatures @@ -87,4 +89,6 @@ const char *kernel_argtype_description(int type); ** Returns: (const char *) Pointer to a (static) descriptive string */ +} // End of namespace Sci + #endif // ! _FREESCI_KERNEL_TYPES_H_ diff --git a/engines/sci/engine/kevent.cpp b/engines/sci/engine/kevent.cpp index e0f26f8fa8..4769bb1529 100644 --- a/engines/sci/engine/kevent.cpp +++ b/engines/sci/engine/kevent.cpp @@ -25,6 +25,8 @@ #include "sci/include/engine.h" +namespace Sci { + int stop_on_event; #define SCI_VARIABLE_GAME_SPEED 3 @@ -222,3 +224,5 @@ reg_t kJoystick(state_t *s, int funct_nr, int argc, reg_t *argv) { warning("Unimplemented syscall 'Joystick()"); return NULL_REG; } + +} // End of namespace Sci diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp index 9ed22989bd..bc3e9d9d11 100644 --- a/engines/sci/engine/kfile.cpp +++ b/engines/sci/engine/kfile.cpp @@ -37,6 +37,8 @@ #include <errno.h> +namespace Sci { + #ifndef O_BINARY #define O_BINARY 0 #endif @@ -904,3 +906,5 @@ reg_t kFileIO(state_t *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; } + +} // End of namespace Sci diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 64789031bd..97a7d392cf 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -29,6 +29,8 @@ #include "sci/engine/sci_graphics.h" #include "sci/include/sci_widgets.h" +namespace Sci { + #undef DEBUG_LSRECT // Graph subfunctions @@ -3274,3 +3276,5 @@ reg_t kDisplay(state_t *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; } + +} // End of namespace Sci diff --git a/engines/sci/engine/klists.cpp b/engines/sci/engine/klists.cpp index 0e17b3a083..cc0072be84 100644 --- a/engines/sci/engine/klists.cpp +++ b/engines/sci/engine/klists.cpp @@ -25,6 +25,8 @@ #include "sci/include/engine.h" +namespace Sci { + #ifdef LOOKUP_NODE # undef LOOKUP_NODE # define LOOKUP_NODE(addr) inline_lookup_node(s, (addr), __FILE__, __LINE__) @@ -494,3 +496,5 @@ reg_t kSort(state_t *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; } + +} // End of namespace Sci diff --git a/engines/sci/engine/kmath.cpp b/engines/sci/engine/kmath.cpp index fb8a191337..85b3f3d020 100644 --- a/engines/sci/engine/kmath.cpp +++ b/engines/sci/engine/kmath.cpp @@ -25,6 +25,8 @@ #include "sci/include/engine.h" +namespace Sci { + reg_t kRandom(state_t *s, int funct_nr, int argc, reg_t *argv) { return make_reg(0, SKPV(0) + (int)((SKPV(1) + 1.0 - SKPV(0)) * (rand() / (RAND_MAX + 1.0)))); } @@ -164,3 +166,5 @@ reg_t kTimesCot(state_t *s, int funct_nr, int argc, reg_t *argv) { } else return make_reg(0, (gint16)(tan(param * PI / 180.0) * scale)); } + +} // End of namespace Sci diff --git a/engines/sci/engine/kmenu.cpp b/engines/sci/engine/kmenu.cpp index 8a476e1eb1..efd1a2d035 100644 --- a/engines/sci/engine/kmenu.cpp +++ b/engines/sci/engine/kmenu.cpp @@ -27,6 +27,7 @@ #include "sci/include/engine.h" #include "sci/include/sci_widgets.h" +namespace Sci { reg_t kAddMenu(state_t *s, int funct_nr, int argc, reg_t *argv) { @@ -520,3 +521,5 @@ kMenuSelect(state_t *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; } + +} // End of namespace Sci diff --git a/engines/sci/engine/kmovement.cpp b/engines/sci/engine/kmovement.cpp index a5e9a4ec53..a49162ba99 100644 --- a/engines/sci/engine/kmovement.cpp +++ b/engines/sci/engine/kmovement.cpp @@ -26,6 +26,8 @@ #include "sci/include/sciresource.h" #include "sci/include/engine.h" +namespace Sci { + /* Compute "velocity" vector (xStep,yStep)=(vx,vy) for a jump from (0,0) to (dx,dy), with gravity gy. The gravity is assumed to be non-negative. @@ -509,3 +511,5 @@ reg_t kDoAvoider(state_t *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; } + +} // End of namespace Sci diff --git a/engines/sci/engine/kpathing.cpp b/engines/sci/engine/kpathing.cpp index 9d400d8aaa..f097371ed6 100644 --- a/engines/sci/engine/kpathing.cpp +++ b/engines/sci/engine/kpathing.cpp @@ -31,6 +31,8 @@ #include "sci/include/aatree.h" #include "sci/include/list.h" +namespace Sci { + #define POLY_LAST_POINT 0x7777 #define POLY_POINT_SIZE 4 @@ -1528,3 +1530,5 @@ reg_t kAvoidPath(state_t *s, int funct_nr, int argc, reg_t *argv) { break; } } + +} // End of namespace Sci diff --git a/engines/sci/engine/kscripts.cpp b/engines/sci/engine/kscripts.cpp index 560c9d6b8b..87b7787b60 100644 --- a/engines/sci/engine/kscripts.cpp +++ b/engines/sci/engine/kscripts.cpp @@ -27,6 +27,8 @@ #include "sci/include/engine.h" #include "sci/engine/kernel_types.h" +namespace Sci { + reg_t read_selector(state_t *s, reg_t object, selector_t selector_id, const char *file, int line) { reg_t *address; @@ -293,3 +295,5 @@ reg_t kRespondsTo(state_t *s, int funct_nr, int argc, reg_t *argv) { return make_reg(0, is_heap_object(s, obj) && lookup_selector(s, obj, selector, NULL, NULL) != SELECTOR_NONE); } + +} // End of namespace Sci diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp index 2a02461fa3..c46361a60c 100644 --- a/engines/sci/engine/ksound.cpp +++ b/engines/sci/engine/ksound.cpp @@ -26,6 +26,8 @@ #include "sci/include/engine.h" #include "sci/include/sfx_player.h" +namespace Sci { + #define _K_SCI0_SOUND_INIT_HANDLE 0 #define _K_SCI0_SOUND_PLAY_HANDLE 1 #define _K_SCI0_SOUND_NOP 2 @@ -996,3 +998,4 @@ kDoAudio(state_t *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; } +} // End of namespace Sci diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp index dbba274871..baa37f53ab 100644 --- a/engines/sci/engine/kstring.cpp +++ b/engines/sci/engine/kstring.cpp @@ -29,6 +29,8 @@ #include "sci/include/engine.h" #include "sci/engine/message.h" +namespace Sci { + #define CHECK_OVERFLOW1(pt, size, rv) \ if (((pt) - (str_base)) + (size) > maxsize) { \ error("String expansion exceeded heap boundaries\n"); \ @@ -779,3 +781,5 @@ kMessage(state_t *s, int funct_nr, int argc, reg_t *argv) { return NULL_REG; } + +} // End of namespace Sci diff --git a/engines/sci/engine/message.cpp b/engines/sci/engine/message.cpp index 0ef4f2efb7..65679bb2d1 100644 --- a/engines/sci/engine/message.cpp +++ b/engines/sci/engine/message.cpp @@ -25,6 +25,8 @@ #include "sci/engine/message.h" +namespace Sci { + #if 0 // Unreferenced - removed static int get_talker_trivial(index_record_cursor_t *cursor) { @@ -198,3 +200,5 @@ void message_state_initialize(ResourceManager *resmgr, message_state_t *state) { state->record_count = 0; state->handler = &fixed_handler; } + +} // End of namespace Sci diff --git a/engines/sci/engine/message.h b/engines/sci/engine/message.h index a4e0b90275..572501c00f 100644 --- a/engines/sci/engine/message.h +++ b/engines/sci/engine/message.h @@ -25,6 +25,8 @@ #include "sci/include/sciresource.h" +namespace Sci { + typedef struct { int noun; int verb; @@ -73,3 +75,5 @@ int message_get_length(message_state_t *state); int message_get_text(message_state_t *state, char *buffer, int length); int message_state_load_res(message_state_t *state, int module); void message_state_initialize(ResourceManager *resmgr, message_state_t *state); + +} // End of namespace Sci diff --git a/engines/sci/engine/said.cpp b/engines/sci/engine/said.cpp index f8a7ea75e8..4f28697043 100644 --- a/engines/sci/engine/said.cpp +++ b/engines/sci/engine/said.cpp @@ -133,6 +133,8 @@ #include "sci/include/engine.h" +namespace Sci { + #define SAID_BRANCH_NULL 0 #define MAX_SAID_TOKENS 128 @@ -2471,3 +2473,4 @@ int main (int argc, char *argv) { } #endif +} // End of namespace Sci diff --git a/engines/sci/engine/said.y b/engines/sci/engine/said.y index 3cf8c9661a..0663387f24 100644 --- a/engines/sci/engine/said.y +++ b/engines/sci/engine/said.y @@ -26,6 +26,8 @@ #include "sci/include/engine.h" +namespace Sci { + #define SAID_BRANCH_NULL 0 #define MAX_SAID_TOKENS 128 @@ -826,3 +828,5 @@ int main (int argc, char *argv) { said(&s, block); } #endif + +} // End of namespace Sci diff --git a/engines/sci/engine/savegame.cfsml b/engines/sci/engine/savegame.cfsml index d886cadddc..2923d4eb6c 100644 --- a/engines/sci/engine/savegame.cfsml +++ b/engines/sci/engine/savegame.cfsml @@ -46,6 +46,8 @@ #pragma warning( disable : 4101 ) #endif +namespace Sci { + #define HUNK_TYPE_GFX_SNAPSHOT_STRING "g\n" /* Missing: @@ -1158,3 +1160,4 @@ bool get_savegame_metadata(Common::SeekableReadStream* stream, SavegameMetadata* return true; } +} // End of namespace Sci diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index caf154f7e5..c00a8f631d 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -46,6 +46,8 @@ #pragma warning( disable : 4101 ) #endif +namespace Sci { + #define HUNK_TYPE_GFX_SNAPSHOT_STRING "g\n" /* Missing: @@ -5196,3 +5198,4 @@ bool get_savegame_metadata(Common::SeekableReadStream* stream, SavegameMetadata* return true; } +} // End of namespace Sci diff --git a/engines/sci/engine/sci_graphics.h b/engines/sci/engine/sci_graphics.h index fde9d97575..89f719d63b 100644 --- a/engines/sci/engine/sci_graphics.h +++ b/engines/sci/engine/sci_graphics.h @@ -28,6 +28,8 @@ #ifndef _SCI_GRAPHICS_H_ #define _SCI_GRAPHICS_H_ +namespace Sci { + #define MAX_TEXT_WIDTH_MAGIC_VALUE 192 // This is the real width of a text with a specified width of 0 @@ -38,5 +40,6 @@ // Internal states #define SELECTOR_STATE_DITHER_FRAMED 0x1000 +} // End of namespace Sci #endif // !_SCI_GRAPHICS_H_ diff --git a/engines/sci/engine/scriptconsole.cpp b/engines/sci/engine/scriptconsole.cpp index 286671bf8f..b01a4cadc3 100644 --- a/engines/sci/engine/scriptconsole.cpp +++ b/engines/sci/engine/scriptconsole.cpp @@ -28,6 +28,9 @@ #include "sci/include/sci_memory.h" #include "sci/include/engine.h" + +namespace Sci { + #ifdef SCI_CONSOLE state_t *con_gamestate = NULL; @@ -1085,3 +1088,5 @@ static int c_dissectscript(state_t * s) { } #endif // SCI_CONSOLE + +} // End of namespace Sci diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp index c669bc8eca..e6cd8981ef 100644 --- a/engines/sci/engine/scriptdebug.cpp +++ b/engines/sci/engine/scriptdebug.cpp @@ -66,6 +66,8 @@ # include <signal.h> #endif +namespace Sci { + extern int debug_sleeptime_factor; int _debugstate_valid = 0; // Set to 1 while script_debug is running int _debug_step_running = 0; // Set to >0 to allow multiple stepping @@ -3300,3 +3302,5 @@ void script_debug(state_t *s, reg_t *pc, stack_ptr_t *sp, stack_ptr_t *pp, reg_t sfx_suspend(&s->sound, 0); } } + +} // End of namespace Sci diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp index b3bad34b42..adecdc8db9 100644 --- a/engines/sci/engine/seg_manager.cpp +++ b/engines/sci/engine/seg_manager.cpp @@ -28,6 +28,7 @@ #include "sci/include/versions.h" #include "sci/include/engine.h" +namespace Sci { //#define GC_DEBUG*/ // Debug garbage collection //#define GC_DEBUG_VERBOSE*/ // Debug garbage verbosely @@ -1812,3 +1813,5 @@ seg_interface_t *get_seg_interface(seg_manager_t *self, seg_id_t segid) { return retval; } + +} // End of namespace Sci diff --git a/engines/sci/engine/seg_manager.h b/engines/sci/engine/seg_manager.h index 5f39af3a46..fea67327c2 100644 --- a/engines/sci/engine/seg_manager.h +++ b/engines/sci/engine/seg_manager.h @@ -31,6 +31,8 @@ #include "sci/include/sys_strings.h" #include "sci/include/vm.h" +namespace Sci { + #define DEFAULT_SCRIPTS 32 #define DEFAULT_OBJECTS 8 // default # of objects per script #define DEFAULT_OBJECTS_INCREMENT 4 // Number of additional objects to instantiate if we're running out of them @@ -492,4 +494,6 @@ seg_interface_t *get_seg_interface(seg_manager_t *self, seg_id_t segid); // Returns : (seg_interface_t *): An interface to the specified segment ID, or NULL on error // The returned interface 'si' must be freed after use by calling 'si->dealloc_self(si)'; +} // End of namespace Sci + #endif diff --git a/engines/sci/engine/sys_strings.cpp b/engines/sci/engine/sys_strings.cpp index f5ef4a8234..9ffb4323cd 100644 --- a/engines/sci/engine/sys_strings.cpp +++ b/engines/sci/engine/sys_strings.cpp @@ -27,6 +27,8 @@ #include "sci/include/sys_strings.h" #include "sci/include/sci_memory.h" +namespace Sci { + void sys_string_acquire(sys_strings_t *strings, int index, const char *name, int max_len) { sys_string_t *str = strings->strings + index; @@ -99,3 +101,5 @@ void sys_strings_restore(sys_strings_t *new_strings, sys_strings_t *old_strings) sys_string_set(new_strings, SYS_STRING_SAVEDIR, old_strings->strings[SYS_STRING_SAVEDIR].value); } + +} // End of namespace Sci diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp index 6770c32cb9..2cfc83ab0a 100644 --- a/engines/sci/engine/vm.cpp +++ b/engines/sci/engine/vm.cpp @@ -38,6 +38,8 @@ #include <setjmp.h> #endif +namespace Sci { + reg_t NULL_REG = NULL_REG_INITIALIZER; //#define VM_DEBUG_SEND @@ -2175,3 +2177,5 @@ void quit_vm() { _debug_seeking = 0; _debug_step_running = 0; } + +} // End of namespace Sci diff --git a/engines/sci/gfx/antialias.cpp b/engines/sci/gfx/antialias.cpp index a730868ca1..f297301236 100644 --- a/engines/sci/gfx/antialias.cpp +++ b/engines/sci/gfx/antialias.cpp @@ -28,6 +28,8 @@ #include "sci/include/gfx_system.h" #include "sci/include/gfx_tools.h" +namespace Sci { + static void antialiase_simple(gfx_pixmap_t *pixmap, int mask[], int shift_const, gfx_mode_t *mode) { int x, y, c; int bytespp = mode->bytespp; @@ -157,3 +159,5 @@ void gfxr_antialiase(gfx_pixmap_t *pixmap, gfx_mode_t *mode, gfxr_antialiasing_t GFXERROR("Invalid antialiasing mode %d (internal error)\n", type); } } + +} // End of namespace Sci diff --git a/engines/sci/gfx/font-5x8.cpp b/engines/sci/gfx/font-5x8.cpp index 5234570adc..7e446b8363 100644 --- a/engines/sci/gfx/font-5x8.cpp +++ b/engines/sci/gfx/font-5x8.cpp @@ -2,6 +2,8 @@ #include "sci/include/gfx_system.h" +namespace Sci { + static int gfxfont_5x8_widths[] = { 5, /* 0x00 */ 5, /* 0x01 */ @@ -2578,3 +2580,5 @@ gfx_bitmap_font_t gfxfont_5x8 = { 8, /* Char size (occupied, in bytes) */ gfxfont_5x8_data /* Bulk data */ }; + +} // End of namespace Sci diff --git a/engines/sci/gfx/font-6x10.cpp b/engines/sci/gfx/font-6x10.cpp index 6fbf661cbe..390bc5c7fa 100644 --- a/engines/sci/gfx/font-6x10.cpp +++ b/engines/sci/gfx/font-6x10.cpp @@ -2,6 +2,8 @@ #include "sci/include/gfx_system.h" +namespace Sci { + static int gfxfont_6x10_widths[] = { 6, /* 0x00 */ 6, /* 0x01 */ @@ -3090,3 +3092,5 @@ gfx_bitmap_font_t gfxfont_6x10 = { 10, /* Char size (occupied, in bytes) */ gfxfont_6x10_data /* Bulk data */ }; + +} // End of namespace Sci diff --git a/engines/sci/gfx/font.cpp b/engines/sci/gfx/font.cpp index 55e9b02cbb..abea8540a5 100644 --- a/engines/sci/gfx/font.cpp +++ b/engines/sci/gfx/font.cpp @@ -28,6 +28,8 @@ #include "sci/include/gfx_resource.h" #include "sci/include/gfx_tools.h" +namespace Sci { + int font_counter = 0; void gfxr_free_font(gfx_bitmap_font_t *font) { @@ -352,3 +354,5 @@ gfx_pixmap_t *gfxr_draw_font(gfx_bitmap_font_t *font, const char *stext, int cha return pxm; } + +} // End of namespace Sci diff --git a/engines/sci/gfx/gfx_crossblit.cpp b/engines/sci/gfx/gfx_crossblit.cpp index ab6d6019ef..d861b8ac25 100644 --- a/engines/sci/gfx/gfx_crossblit.cpp +++ b/engines/sci/gfx/gfx_crossblit.cpp @@ -49,6 +49,8 @@ # endif #endif +namespace Sci { + static void FUNCTION_NAME(byte *dest, byte *src, int bytes_per_dest_line, int bytes_per_src_line, int xl, int yl, byte *alpha, int bytes_per_alpha_line, int bytes_per_alpha_pixel, unsigned int alpha_test_mask, unsigned int alpha_min @@ -99,6 +101,8 @@ static void FUNCTION_NAME(byte *dest, byte *src, int bytes_per_dest_line, int by } } +} // End of namespace Sci + /* reset to original optimisations for Win32: */ /* (does not reset intrinsics) */ #ifdef WIN32 diff --git a/engines/sci/gfx/gfx_driver.cpp b/engines/sci/gfx/gfx_driver.cpp index 97c48eccae..ad726e1b14 100644 --- a/engines/sci/gfx/gfx_driver.cpp +++ b/engines/sci/gfx/gfx_driver.cpp @@ -30,6 +30,8 @@ #include "sci/include/gfx_driver.h" #include "sci/include/gfx_tools.h" +namespace Sci { + struct _scummvm_driver_state { gfx_pixmap_t *priority[2]; byte *visual[3]; @@ -504,3 +506,5 @@ gfx_driver_t gfx_driver_scummvm = { scummvm_usec_sleep, NULL }; + +} // End of namespace Sci diff --git a/engines/sci/gfx/gfx_line.cpp b/engines/sci/gfx/gfx_line.cpp index 3bc52098b8..21f2f429b1 100644 --- a/engines/sci/gfx/gfx_line.cpp +++ b/engines/sci/gfx/gfx_line.cpp @@ -23,6 +23,8 @@ * */ +namespace Sci { + #define LINEMACRO(startx, starty, deltalinear, deltanonlinear, linearvar, nonlinearvar, \ linearend, nonlinearstart, linearmod, nonlinearmod) \ x = (startx); y = (starty); \ @@ -89,3 +91,5 @@ static inline void DRAWLINE_FUNC(byte *buffer, int linewidth, Common::Point star #undef LINEMACRO + +} // End of namespace Sci diff --git a/engines/sci/gfx/gfx_pixmap_scale.cpp b/engines/sci/gfx/gfx_pixmap_scale.cpp index b1a26d2a5d..215be8c4d5 100644 --- a/engines/sci/gfx/gfx_pixmap_scale.cpp +++ b/engines/sci/gfx/gfx_pixmap_scale.cpp @@ -31,6 +31,8 @@ #include "sci/include/sci_memory.h" +namespace Sci { + #define EXTEND_COLOR(x) (unsigned) ((((unsigned) x) << 24) | (((unsigned) x) << 16) | (((unsigned) x) << 8) | ((unsigned) x)) #define PALETTE_MODE mode->palette @@ -485,3 +487,4 @@ void FUNCNAME_TRILINEAR(gfx_mode_t *mode, gfx_pixmap_t *pxm, int scale) { #undef SIZETYPE #undef EXTEND_COLOR +} // End of namespace Sci diff --git a/engines/sci/gfx/gfx_res_options.cpp b/engines/sci/gfx/gfx_res_options.cpp index db776617bb..5a57c03fa3 100644 --- a/engines/sci/gfx/gfx_res_options.cpp +++ b/engines/sci/gfx/gfx_res_options.cpp @@ -29,6 +29,8 @@ #include <ctype.h> +namespace Sci { + //#define DEBUG static inline int matches_patternlist(gfx_res_pattern_t *patterns, int nr, int val) { @@ -196,3 +198,5 @@ int gfx_get_res_config(gfx_options_t *options, gfx_pixmap_t *pxm) { return 0; } + +} // End of namespace Sci diff --git a/engines/sci/gfx/gfx_resource.cpp b/engines/sci/gfx/gfx_resource.cpp index bcdf3f4623..c65668a6db 100644 --- a/engines/sci/gfx/gfx_resource.cpp +++ b/engines/sci/gfx/gfx_resource.cpp @@ -27,6 +27,8 @@ #include "sci/include/gfx_resource.h" #include "sci/include/gfx_tools.h" +namespace Sci { + gfx_mode_t mode_1x1_color_index = { /* Fake 1x1 mode */ /* xfact */ 1, /* yfact */ 1, /* bytespp */ 1, @@ -200,6 +202,8 @@ gfx_pixmap_t *gfxr_endianness_adjust(gfx_pixmap_t *pixmap, gfx_mode_t *mode) { return pixmap; } +} // End of namespace Sci + // Now construct the pixmap scaling functions #define EXTRA_BYTE_OFFSET 0 #define SIZETYPE guint8 @@ -244,6 +248,8 @@ gfx_pixmap_t *gfxr_endianness_adjust(gfx_pixmap_t *pixmap, gfx_mode_t *mode) { #undef EXTRA_BYTE_OFFSET #undef SIZETYPE +namespace Sci { + static inline void _gfx_xlate_pixmap_unfiltered(gfx_mode_t *mode, gfx_pixmap_t *pxm, int scale) { switch (mode->bytespp) { @@ -414,3 +420,5 @@ void gfxr_free_pic(gfx_driver_t *driver, gfxr_pic_t *pic) { pic->undithered_buffer = 0; free(pic); } + +} // End of namespace Sci diff --git a/engines/sci/gfx/gfx_support.cpp b/engines/sci/gfx/gfx_support.cpp index 77f93e3b41..b99e179d60 100644 --- a/engines/sci/gfx/gfx_support.cpp +++ b/engines/sci/gfx/gfx_support.cpp @@ -30,8 +30,6 @@ #include "sci/include/gfx_system.h" #include "sci/include/gfx_tools.h" -int gfx_crossblit_alpha_threshold = 128; - #define DRAWLINE_FUNC _gfx_draw_line_buffer_1 #define PIXELWIDTH 1 #include "gfx_line.cpp" @@ -56,6 +54,10 @@ int gfx_crossblit_alpha_threshold = 128; #undef PIXELWIDTH #undef DRAWLINE_FUNC +namespace Sci { + +int gfx_crossblit_alpha_threshold = 128; + inline void gfx_draw_line_buffer(byte *buffer, int linewidth, int pixelwidth, Common::Point start, Common::Point end, unsigned int color) { switch (pixelwidth) { @@ -105,6 +107,7 @@ void gfx_draw_box_pixmap_i(gfx_pixmap_t *pxm, rect_t box, int color) { gfx_draw_box_buffer(pxm->index_data, pxm->index_xl, box, color); } +} // End of namespace Sci // Import various crossblit functions #undef USE_PRIORITY @@ -223,6 +226,8 @@ void gfx_draw_box_pixmap_i(gfx_pixmap_t *pxm, rect_t box, int color) { #undef BYTESPP #undef REVERSE_ALPHA +namespace Sci { + static void (*crossblit_fns[5])(byte *, byte *, int, int, int, int, byte *, int, int, unsigned int, unsigned int) = { NULL, _gfx_crossblit_8, _gfx_crossblit_16, @@ -397,3 +402,5 @@ int gfx_crossblit_pixmap(gfx_mode_t *mode, gfx_pixmap_t *pxm, int priority, rect return GFX_OK; } + +} // End of namespace Sci diff --git a/engines/sci/gfx/gfx_test.cpp b/engines/sci/gfx/gfx_test.cpp index 1f465c6319..6a4e476f89 100644 --- a/engines/sci/gfx/gfx_test.cpp +++ b/engines/sci/gfx/gfx_test.cpp @@ -43,6 +43,8 @@ #include <gfx_tools.h> #include <gfx_operations.h> +namespace Sci { + int sci0_palette; @@ -1469,6 +1471,4 @@ byte builtin_font[] = { 0xc6, 0x00, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0xfc }; - - - +} // End of namespace Sci diff --git a/engines/sci/gfx/gfx_tools.cpp b/engines/sci/gfx/gfx_tools.cpp index c8f1401907..75a742b743 100644 --- a/engines/sci/gfx/gfx_tools.cpp +++ b/engines/sci/gfx/gfx_tools.cpp @@ -26,6 +26,8 @@ #include "sci/include/sci_memory.h" #include "sci/include/gfx_tools.h" +namespace Sci { + rect_t gfx_rect_fullscreen = {0, 0, 320, 200}; void gfx_clip_box_basic(rect_t *box, int maxx, int maxy) { @@ -398,3 +400,5 @@ gfx_pixmap_t *gfx_pixmap_scale_index_data(gfx_pixmap_t *pixmap, gfx_mode_t *mode return pixmap; } + +} // End of namespace Sci diff --git a/engines/sci/gfx/menubar.cpp b/engines/sci/gfx/menubar.cpp index 89d2d0335f..9fed5329a5 100644 --- a/engines/sci/gfx/menubar.cpp +++ b/engines/sci/gfx/menubar.cpp @@ -32,6 +32,8 @@ #include "sci/include/engine.h" #include "sci/include/menubar.h" +namespace Sci { + #define SIZE_INF 32767 menubar_t *menubar_new() { @@ -449,3 +451,5 @@ int menubar_map_pointer(state_t *s, int *menu_nr, int *item_nr, gfxw_port_t *por return 0; } } + +} // End of namespace Sci diff --git a/engines/sci/gfx/operations.cpp b/engines/sci/gfx/operations.cpp index 46a492692d..a3c3d96779 100644 --- a/engines/sci/gfx/operations.cpp +++ b/engines/sci/gfx/operations.cpp @@ -30,6 +30,8 @@ #include <ctype.h> +namespace Sci { + #define PRECISE_PRIORITY_MAP // Duplicate all operations on the local priority map as appropriate #undef GFXW_DEBUG_DIRTY @@ -2180,3 +2182,5 @@ int gfxop_free_pixmap(gfx_state_t *state, gfx_pixmap_t *pxm) { gfx_free_pixmap(state->driver, pxm); return GFX_OK; } + +} // End of namespace Sci diff --git a/engines/sci/gfx/resmgr.cpp b/engines/sci/gfx/resmgr.cpp index 7302b6868e..1d31a57d32 100644 --- a/engines/sci/gfx/resmgr.cpp +++ b/engines/sci/gfx/resmgr.cpp @@ -35,6 +35,8 @@ #include "sci/include/gfx_resmgr.h" #include "sci/include/gfx_state_internal.h" +namespace Sci { + #undef TIME_PICDRAWING // Invalid hash mode: Used to invalidate modified pics @@ -617,3 +619,5 @@ gfx_pixmap_t *gfxr_get_cursor(gfx_resstate_t *state, int nr) { return res->unscaled_data.pointer; } } + +} // End of namespace Sci diff --git a/engines/sci/gfx/resource/sci_cursor_0.cpp b/engines/sci/gfx/resource/sci_cursor_0.cpp index e95b9cff68..aa60fb4b7d 100644 --- a/engines/sci/gfx/resource/sci_cursor_0.cpp +++ b/engines/sci/gfx/resource/sci_cursor_0.cpp @@ -27,6 +27,7 @@ #include "sci/include/gfx_resource.h" #include "sci/include/gfx_tools.h" +namespace Sci { #define CURSOR_RESOURCE_SIZE 68 #define CURSOR_SIZE 16 @@ -93,3 +94,5 @@ gfx_pixmap_t *gfxr_draw_cursor0(int id, byte *resource, int size) { gfx_pixmap_t *gfxr_draw_cursor01(int id, byte *resource, int size) { return _gfxr_draw_cursor(id, resource, size, 1); } + +} // End of namespace Sci diff --git a/engines/sci/gfx/resource/sci_font.cpp b/engines/sci/gfx/resource/sci_font.cpp index 6a9c40f332..8b1eb4b8b2 100644 --- a/engines/sci/gfx/resource/sci_font.cpp +++ b/engines/sci/gfx/resource/sci_font.cpp @@ -28,6 +28,7 @@ #include "sci/include/gfx_resource.h" #include "sci/include/gfx_tools.h" +namespace Sci { extern int font_counter; @@ -137,3 +138,5 @@ gfx_bitmap_font_t *gfxr_read_font(int id, byte *resource, int size) { return font; } + +} // End of namespace Sci diff --git a/engines/sci/gfx/resource/sci_pal_1.cpp b/engines/sci/gfx/resource/sci_pal_1.cpp index b344ee355f..6ba33b5ae7 100644 --- a/engines/sci/gfx/resource/sci_pal_1.cpp +++ b/engines/sci/gfx/resource/sci_pal_1.cpp @@ -29,6 +29,8 @@ #include "sci/include/gfx_system.h" #include "sci/include/gfx_resource.h" +namespace Sci { + #define MAX_COLORS 256 #define PALETTE_START 260 #define COLOR_OK 0x01 @@ -157,3 +159,5 @@ gfx_pixmap_color_t *gfxr_read_pal1_amiga(int *colors_nr, FILE *f) { return retval; } + +} // End of namespace Sci diff --git a/engines/sci/gfx/resource/sci_pic_0.cpp b/engines/sci/gfx/resource/sci_pic_0.cpp index cfe60a585b..665ebf7314 100644 --- a/engines/sci/gfx/resource/sci_pic_0.cpp +++ b/engines/sci/gfx/resource/sci_pic_0.cpp @@ -28,6 +28,8 @@ #include "sci/include/gfx_resource.h" #include "sci/include/gfx_tools.h" +namespace Sci { + #undef GFXR_DEBUG_PIC0 /* Enable to debug pic0 messages */ #undef FILL_RECURSIVE_DEBUG /* Enable for verbose fill debugging */ @@ -1204,6 +1206,8 @@ _gfxr_find_fill_point(gfxr_pic_t *pic, int min_x, int min_y, int max_x, int max_ #undef TEST_POINT +} // End of namespace Sci + /* Now include the actual filling code (with scaling support) */ #define FILL_FUNCTION _gfxr_fill_any #define FILL_FUNCTION_RECURSIVE _gfxr_fill_any_recursive @@ -1218,8 +1222,12 @@ _gfxr_find_fill_point(gfxr_pic_t *pic, int min_x, int min_y, int max_x, int max_ #undef FILL_FUNCTION_RECURSIVE #undef FILL_FUNCTION -#endif /* defined(WITH_PIC_SCALING) */ +namespace Sci { +#endif /* defined(WITH_PIC_SCALING) */ + +} // End of namespace Sci + /* Include again, but this time without support for scaling */ #define FILL_FUNCTION _gfxr_fill_1 #define FILL_FUNCTION_RECURSIVE _gfxr_fill_1_recursive @@ -1232,6 +1240,7 @@ _gfxr_find_fill_point(gfxr_pic_t *pic, int min_x, int min_y, int max_x, int max_ #undef FILL_FUNCTION_RECURSIVE #undef FILL_FUNCTION +namespace Sci { #define GET_ABS_COORDS(x, y) \ temp = *(resource + pos++); \ @@ -1999,3 +2008,4 @@ gfxr_dither_pic0(gfxr_pic_t *pic, int dmode, int pattern) { } } +} // End of namespace Sci diff --git a/engines/sci/gfx/resource/sci_picfill.cpp b/engines/sci/gfx/resource/sci_picfill.cpp index 325ec1c646..669c30ee8e 100644 --- a/engines/sci/gfx/resource/sci_picfill.cpp +++ b/engines/sci/gfx/resource/sci_picfill.cpp @@ -25,6 +25,8 @@ #include "sci/include/gfx_resource.h" +namespace Sci { + /* Generic pic filling code, to be included by sci_pic_0.c * * @@ -416,3 +418,5 @@ static void FILL_FUNCTION(gfxr_pic_t *pic, int x_320, int y_200, int color, int # undef proj_xl_bound # undef proj_xr_bound #endif + +} // End of namespace Sci diff --git a/engines/sci/gfx/resource/sci_picfill_aux.cpp b/engines/sci/gfx/resource/sci_picfill_aux.cpp index 1760d233c8..f7deff27fa 100644 --- a/engines/sci/gfx/resource/sci_picfill_aux.cpp +++ b/engines/sci/gfx/resource/sci_picfill_aux.cpp @@ -35,6 +35,8 @@ * */ +namespace Sci { + #define CLIPMASK_HARD_BOUND 0x80 /* ensures that we don't re-fill filled stuff */ static void AUXBUF_FILL_HELPER(gfxr_pic_t *pic, int old_xl, int old_xr, int y, int dy, @@ -209,3 +211,5 @@ static void AUXBUF_FILL(gfxr_pic_t *pic, int x, int y, int clipmask, int control #undef CLIPMASK_HARD_BOUND + +} // End of namespace Sci diff --git a/engines/sci/gfx/resource/sci_resmgr.cpp b/engines/sci/gfx/resource/sci_resmgr.cpp index f66ecec332..a82ff3c979 100644 --- a/engines/sci/gfx/resource/sci_resmgr.cpp +++ b/engines/sci/gfx/resource/sci_resmgr.cpp @@ -33,6 +33,8 @@ #include "common/util.h" +namespace Sci { + int gfxr_interpreter_options_hash(gfx_resource_type_t type, int version, gfx_options_t *options, void *internal, int palette) { switch (type) { case GFX_RESOURCE_TYPE_VIEW: @@ -292,3 +294,5 @@ gfx_pixmap_color_t *gfxr_interpreter_get_palette(gfx_resstate_t *state, int vers int gfxr_interpreter_needs_multicolored_pointers(int version, void *internal) { return (version > SCI_VERSION_1); } + +} // End of namespace Sci diff --git a/engines/sci/gfx/resource/sci_view_0.cpp b/engines/sci/gfx/resource/sci_view_0.cpp index 82b3e5d9d2..437733328e 100644 --- a/engines/sci/gfx/resource/sci_view_0.cpp +++ b/engines/sci/gfx/resource/sci_view_0.cpp @@ -28,6 +28,8 @@ #include "sci/include/gfx_resource.h" #include "sci/include/gfx_tools.h" +namespace Sci { + gfx_pixmap_t *gfxr_draw_cel0(int id, int loop, int cel, byte *resource, int size, gfxr_view_t *view, int mirrored) { int xl = get_int_16(resource); int yl = get_int_16(resource + 2); @@ -226,3 +228,5 @@ gfxr_view_t *gfxr_draw_view0(int id, byte *resource, int size, int palette) { return view; } + +} // End of namespace Sci diff --git a/engines/sci/gfx/resource/sci_view_1.cpp b/engines/sci/gfx/resource/sci_view_1.cpp index ce038c11da..a268cba1dd 100644 --- a/engines/sci/gfx/resource/sci_view_1.cpp +++ b/engines/sci/gfx/resource/sci_view_1.cpp @@ -30,6 +30,8 @@ #include "sci/include/gfx_resource.h" #include "sci/include/gfx_tools.h" +namespace Sci { + #define V1_LOOPS_NR_OFFSET 0 #define V1_MIRROR_MASK 2 #define V1_PALETTE_OFFSET 6 @@ -516,3 +518,5 @@ gfxr_view_t *gfxr_draw_view11(int id, byte *resource, int size) { return view; } + +} // End of namespace Sci diff --git a/engines/sci/gfx/sbtree.cpp b/engines/sci/gfx/sbtree.cpp index 03f5de365f..1893b0c711 100644 --- a/engines/sci/gfx/sbtree.cpp +++ b/engines/sci/gfx/sbtree.cpp @@ -31,6 +31,8 @@ #include <stdlib.h> #include <stdio.h> +namespace Sci { + #define NOT_A_KEY -1 typedef struct { @@ -421,3 +423,5 @@ int main(int argc, char **argv) { } #endif // SBTREE_DEBUG + +} // End of namespace Sci diff --git a/engines/sci/gfx/sci_widgets.cpp b/engines/sci/gfx/sci_widgets.cpp index 8d5b48da5a..4fb99cecf2 100644 --- a/engines/sci/gfx/sci_widgets.cpp +++ b/engines/sci/gfx/sci_widgets.cpp @@ -29,6 +29,8 @@ #include "sci/include/menubar.h" #include "sci/include/sci_widgets.h" +namespace Sci { + #define SCI_SPECIAL_CHAR_ARROW_UP 0x18 #define SCI_SPECIAL_CHAR_ARROW_DOWN 0x19 @@ -663,3 +665,5 @@ gfxw_port_t *sciw_select_item(state_t *s, gfxw_port_t *menu_port, menu_t *menu, return menu_port; } + +} // End of namespace Sci diff --git a/engines/sci/gfx/widgets.cpp b/engines/sci/gfx/widgets.cpp index 2e92242a9e..107c89956a 100644 --- a/engines/sci/gfx/widgets.cpp +++ b/engines/sci/gfx/widgets.cpp @@ -26,6 +26,8 @@ #include "sci/include/sci_memory.h" #include "sci/include/gfx_widgets.h" +namespace Sci { + #undef GFXW_DEBUG_DIRTY // Enable to debug dirty rectangle propagation (writes to stderr) #ifdef GFXW_DEBUG_DIRTY @@ -2147,3 +2149,5 @@ void gfxw_widget_kill_chrono(gfxw_visual_t *visual, int window) { gfxw_annihilate(GFXW(visual->port_refs[i])); } } + +} // End of namespace Sci diff --git a/engines/sci/include/aatree.h b/engines/sci/include/aatree.h index bf7eb31a47..6d84f62062 100644 --- a/engines/sci/include/aatree.h +++ b/engines/sci/include/aatree.h @@ -26,6 +26,8 @@ #ifndef _SCI_AATREE_H #define _SCI_AATREE_H +namespace Sci { + /* Andersson tree implementation. Stores data pointers in a balanced binary ** tree. A user-supplied comparison function defines the ordering. For the ** semantics of this function see qsort(3) @@ -80,4 +82,6 @@ void *aatree_get_data(aatree_t *t); ** Returns : (void *) The data element */ +} // End of namespace Sci + #endif /* !_SCI_AATREE_H */ diff --git a/engines/sci/include/console.h b/engines/sci/include/console.h index a9521686ae..9dd998cde6 100644 --- a/engines/sci/include/console.h +++ b/engines/sci/include/console.h @@ -41,6 +41,7 @@ #define SCI_CONSOLE #include "sci/include/gfx_operations.h" +namespace Sci { extern int con_passthrough; /* Echo all sciprintf() stuff to the text console */ @@ -244,4 +245,6 @@ close_console_file(void); ** Returns : (void) */ +} // End of namespace Sci + #endif /* _SCI_CONSOLE_H_ */ diff --git a/engines/sci/include/engine.h b/engines/sci/include/engine.h index 374572d510..8c3458c75f 100644 --- a/engines/sci/include/engine.h +++ b/engines/sci/include/engine.h @@ -49,6 +49,8 @@ namespace Common { #include "sci/include/gfx_state_internal.h" #include "sci/include/sfx_engine.h" +namespace Sci { + #define FREESCI_CURRENT_SAVEGAME_VERSION 8 #define FREESCI_MINIMUM_SAVEGAME_VERSION 8 @@ -323,4 +325,6 @@ reg_t not_register(state_t *s, reg_t r) { } +} // End of namespace Sci + #endif /* !_SCI_ENGINE_H */ diff --git a/engines/sci/include/event.h b/engines/sci/include/event.h index 07a4db3a06..dc4bc6a83a 100644 --- a/engines/sci/include/event.h +++ b/engines/sci/include/event.h @@ -28,6 +28,8 @@ #include "sci/include/uinput.h" +namespace Sci { + struct _state; sci_event_t getEvent(struct _state *s); @@ -37,4 +39,6 @@ sci_event_t getEvent(struct _state *s); ** existing events. */ +} // End of namespace Sci + #endif diff --git a/engines/sci/include/gfx_driver.h b/engines/sci/include/gfx_driver.h index 4257bf46d9..8319c6ee14 100644 --- a/engines/sci/include/gfx_driver.h +++ b/engines/sci/include/gfx_driver.h @@ -29,6 +29,7 @@ #include "sci/include/gfx_system.h" #include "sci/include/uinput.h" +namespace Sci { typedef enum { GFX_BUFFER_FRONT = 0, @@ -316,4 +317,6 @@ typedef struct _gfx_driver { /* Graphics driver */ } gfx_driver_t; +} // End of namespace Sci + #endif /* !_SCI_GFX_DRIVER_H_ */ diff --git a/engines/sci/include/gfx_operations.h b/engines/sci/include/gfx_operations.h index d08211dad9..39bcbc97a2 100644 --- a/engines/sci/include/gfx_operations.h +++ b/engines/sci/include/gfx_operations.h @@ -34,6 +34,8 @@ #include "sci/include/gfx_system.h" #include "sci/include/uinput.h" +namespace Sci { + #define GFXOP_NO_POINTER -1 /* Threshold in color index mode to differentiate between visible and non-visible stuff. @@ -722,4 +724,6 @@ _gfxop_clip(rect_t *rect, rect_t clipzone); ** Reuturns : (int) 1 if rect is empty now, 0 otherwise */ +} // End of namespace Sci + #endif /* !_GFX_OPERATIONS_H_ */ diff --git a/engines/sci/include/gfx_options.h b/engines/sci/include/gfx_options.h index 033613a82c..c2586b0566 100644 --- a/engines/sci/include/gfx_options.h +++ b/engines/sci/include/gfx_options.h @@ -31,6 +31,8 @@ #include "sci/include/gfx_tools.h" #include "sci/include/gfx_res_options.h" +namespace Sci { + /* Dirty rectangle heuristics: */ /* One: Redraw one rectangle surrounding the dirty area (insert is O(1)) */ @@ -79,6 +81,7 @@ typedef struct _gfx_options { /* SQ3 counts whitespaces towards the total text size, as does gfxop_get_text_params() if this is set: */ #define GFX_WORKAROUND_WHITESPACE_COUNT (1<<0) +} // End of namespace Sci #endif /* !_GFX_OPTIONS_H_ */ diff --git a/engines/sci/include/gfx_res_options.h b/engines/sci/include/gfx_res_options.h index f22989437d..774243bbaf 100644 --- a/engines/sci/include/gfx_res_options.h +++ b/engines/sci/include/gfx_res_options.h @@ -31,6 +31,8 @@ #include "sci/include/gfx_resource.h" #include "sci/include/gfx_resmgr.h" +namespace Sci { + typedef struct _gfx_res_pattern { int min, max; } gfx_res_pattern_t; @@ -104,4 +106,6 @@ gfx_get_res_config(struct _gfx_options *options, ** not do anything in colour index mode. */ +} // End of namespace Sci + #endif /* !_GFX_RES_OPTIONS_H_ */ diff --git a/engines/sci/include/gfx_resmgr.h b/engines/sci/include/gfx_resmgr.h index 22a944f233..0a53ecc7b4 100644 --- a/engines/sci/include/gfx_resmgr.h +++ b/engines/sci/include/gfx_resmgr.h @@ -33,6 +33,8 @@ #include "sci/include/gfx_resource.h" #include "sci/include/sbtree.h" +namespace Sci { + typedef enum { GFX_RESOURCE_TYPE_VIEW = 0, GFX_RESOURCE_TYPE_PIC, @@ -353,4 +355,6 @@ gfxr_interpreter_needs_multicolored_pointers(int version, void *internal); ** otherwise */ +} // End of namespace Sci + #endif /* !_GFX_RSMGR_H_ */ diff --git a/engines/sci/include/gfx_resource.h b/engines/sci/include/gfx_resource.h index 24bc823779..eb2ead54b2 100644 --- a/engines/sci/include/gfx_resource.h +++ b/engines/sci/include/gfx_resource.h @@ -31,6 +31,8 @@ #include "sci/include/gfx_system.h" #include "sci/include/gfx_driver.h" +namespace Sci { + /*** Styles for pic0 drawing ***/ /* Dithering modes */ #define GFXR_DITHER_MODE_D16 0 /* Sierra SCI style */ @@ -431,6 +433,7 @@ get_int_16(const byte *offset) { return ((int) offset[0] | (((int) offset[1]) << 8)); } +} // End of namespace Sci #endif /* !_GFX_RESOURCE_H_ */ diff --git a/engines/sci/include/gfx_state_internal.h b/engines/sci/include/gfx_state_internal.h index 92bb62fc79..f32c19988e 100644 --- a/engines/sci/include/gfx_state_internal.h +++ b/engines/sci/include/gfx_state_internal.h @@ -32,6 +32,7 @@ #include "sci/include/gfx_resmgr.h" #include "sci/include/gfx_system.h" +namespace Sci { #define GFXW_FLAG_VISIBLE (1<<0) #define GFXW_FLAG_OPAQUE (1<<1) @@ -232,5 +233,7 @@ typedef struct _gfxw_port { #undef WIDGET_COMMON #undef WIDGET_CONTAINER +} // End of namespace Sci + #endif /* !_GFX_STATE_INTERNAL_H_ */ diff --git a/engines/sci/include/gfx_system.h b/engines/sci/include/gfx_system.h index 33bfcf64cf..9bd87ce46d 100644 --- a/engines/sci/include/gfx_system.h +++ b/engines/sci/include/gfx_system.h @@ -31,6 +31,7 @@ #include "sci/include/sci_memory.h" #include "sci/include/resource.h" +namespace Sci { #define GFX_DEBUG @@ -400,4 +401,6 @@ typedef enum { GFX_COLOR_MODE_TRUE = 4 /* True color mode (24 bpp padded to 32 bpp) */ } gfx_color_mode_t; +} // End of namespace Sci + #endif /* !_SCI_GFX_SYSTEM_ */ diff --git a/engines/sci/include/gfx_tools.h b/engines/sci/include/gfx_tools.h index 575a52dc0d..dbbbb02347 100644 --- a/engines/sci/include/gfx_tools.h +++ b/engines/sci/include/gfx_tools.h @@ -32,6 +32,8 @@ #include "sci/include/gfx_system.h" #include "sci/include/gfx_driver.h" +namespace Sci { + typedef enum { GFX_XLATE_FILTER_NONE, GFX_XLATE_FILTER_LINEAR, @@ -270,5 +272,6 @@ gfx_pixmap_scale_index_data(gfx_pixmap_t *pixmap, gfx_mode_t *mode); ** Returns : (gfx_pixmap_t *) pixmap */ +} // End of namespace Sci #endif /* !_GFX_TOOLS_H_ */ diff --git a/engines/sci/include/gfx_widgets.h b/engines/sci/include/gfx_widgets.h index 1da0b91a81..99e76c5994 100644 --- a/engines/sci/include/gfx_widgets.h +++ b/engines/sci/include/gfx_widgets.h @@ -30,6 +30,8 @@ #include "sci/include/gfx_state_internal.h" +namespace Sci { + /* Enable the next line to keep a list of pointers to all widgets, with up to the specified amount ** of members (/SLOW/) */ /* #define GFXW_DEBUG_WIDGETS 2048 */ @@ -544,4 +546,6 @@ gfxw_widget_reparent_chrono(gfxw_visual_t *visual, gfxw_widget_t *view, gfxw_lis void gfxw_widget_kill_chrono(gfxw_visual_t *visual, int window); +} // End of namespace Sci + #endif /* !_GFX_WIDGETS_H_ */ diff --git a/engines/sci/include/heapmgr.h b/engines/sci/include/heapmgr.h index c6912b6f44..d8d787e95d 100644 --- a/engines/sci/include/heapmgr.h +++ b/engines/sci/include/heapmgr.h @@ -31,6 +31,8 @@ #include "sci/include/resource.h" #include "sci/include/sci_memory.h" +namespace Sci { + #define HEAPENTRY_INVALID -1 // FIXME: We write (i == 0 || i > 0) instead of (i >= 0) to silence certain annoying warnings: @@ -118,4 +120,6 @@ alloc_##ENTRY##_entry(ENTRY##_table_t *table) \ #define _HEAPENTRY_IGNORE_ME(x) #define DEFINE_HEAPENTRY(e, i, p) DEFINE_HEAPENTRY_WITH_CLEANUP(e, i, p, _HEAPENTRY_IGNORE_ME) +} // End of namespace Sci + #endif /* !_FREESCI_HEAPMGR_H_ */ diff --git a/engines/sci/include/kdebug.h b/engines/sci/include/kdebug.h index 68a9e51755..92a5511706 100644 --- a/engines/sci/include/kdebug.h +++ b/engines/sci/include/kdebug.h @@ -28,6 +28,8 @@ #ifndef _SCI_KDEBUG_H_ #define _SCI_KDEBUG_H_ +namespace Sci { + struct _state; #define SCIk_DEBUG_MODES 17 @@ -93,5 +95,6 @@ extern int sci_debug_flags; #define _DEBUG_FLAG_LOGGING 1 /* Log each command executed */ #define _DEBUG_FLAG_BREAK_ON_WARNINGS 2 /* Break on warnings */ +} // End of namespace Sci #endif diff --git a/engines/sci/include/kernel.h b/engines/sci/include/kernel.h index 587582d9b7..21a7e7b79b 100644 --- a/engines/sci/include/kernel.h +++ b/engines/sci/include/kernel.h @@ -35,6 +35,8 @@ #include "sci/include/vm.h" #include "sci/include/console.h" /* sciprintf() */ +namespace Sci { + extern int _kdebug_cheap_event_hack; extern int _kdebug_cheap_soundcue_hack; extern int stop_on_event; @@ -348,4 +350,6 @@ typedef struct { extern sci_kernel_function_t kfunct_mappers[]; +} // End of namespace Sci + #endif /* _SCI_KERNEL_H_ */ diff --git a/engines/sci/include/list.h b/engines/sci/include/list.h index 59c6bdcc61..ec5e15ec67 100644 --- a/engines/sci/include/list.h +++ b/engines/sci/include/list.h @@ -61,6 +61,8 @@ #include "common/scummsys.h" +namespace Sci { + /* List definitions. */ #define LIST_HEAD(name, type) \ struct name { \ @@ -184,4 +186,6 @@ struct { \ #define CLIST_NEXT(elm, field) ((elm)->field.cle_next) #define CLIST_PREV(elm, field) ((elm)->field.cle_prev) +} // End of namespace Sci + #endif /* !_SCI_LIST_H */ diff --git a/engines/sci/include/listener.h b/engines/sci/include/listener.h index 270556c05b..5457391d88 100644 --- a/engines/sci/include/listener.h +++ b/engines/sci/include/listener.h @@ -26,6 +26,8 @@ #ifndef _LISTENER_H_ # define _LISTENER_H_ +namespace Sci { + /* Event listener interface */ typedef struct { @@ -33,4 +35,6 @@ typedef struct { void *self; } listener_t; +} // End of namespace Sci + #endif diff --git a/engines/sci/include/menubar.h b/engines/sci/include/menubar.h index 79ed37a41d..0fec648e6d 100644 --- a/engines/sci/include/menubar.h +++ b/engines/sci/include/menubar.h @@ -31,6 +31,8 @@ #include "sci/include/gfx_operations.h" #include "sci/include/gfx_widgets.h" +namespace Sci { + struct _state; #define MENU_FREESCI_BLATANT_PLUG 0xfff0 @@ -214,5 +216,7 @@ menubar_match_key(menu_item_t *item, int message, int modifiers); ** Returns : (int) 1 on match, 0 otherwise */ +} // End of namespace Sci + #endif /* !_SCI_MENUBAR_H_ */ diff --git a/engines/sci/include/resource.h b/engines/sci/include/resource.h index 8db6ef9185..070e662e1c 100644 --- a/engines/sci/include/resource.h +++ b/engines/sci/include/resource.h @@ -103,6 +103,8 @@ # define O_BINARY 0 #endif +namespace Sci { + /**** FUNCTION DECLARATIONS ****/ #ifdef WIN32 @@ -117,7 +119,7 @@ getInt16(byte *d) { } #define getUInt16(d) (guint16)(getInt16(d)) - + /* Turns a little endian 16 bit value into a machine-dependant 16 bit value ** Parameters: d: Pointer to the memory position from which to read ** Returns : (gint16) The (possibly converted) 16 bit value @@ -293,4 +295,6 @@ void sci_sched_yield(void); # define BREAKPOINT() { error("Missed breakpoint in %s, line %d\n", __FILE__, __LINE__); *((int *) NULL) = 42; } #endif /* !BREAKPOINT() */ +} // End of namespace Sci + #endif diff --git a/engines/sci/include/sbtree.h b/engines/sci/include/sbtree.h index d972dee0ba..65790344a2 100644 --- a/engines/sci/include/sbtree.h +++ b/engines/sci/include/sbtree.h @@ -36,6 +36,7 @@ # include <stdio.h> #endif +namespace Sci { typedef struct { int entries_nr; @@ -104,6 +105,7 @@ sbtree_foreach(sbtree_t *tree, void *args, void *(*operation)(sbtree_t *, const ** This function will only work properly the original data contained no duplicate keys. */ +} // End of namespace Sci #endif /* !_SBTREE_H_ */ diff --git a/engines/sci/include/sci_memory.h b/engines/sci/include/sci_memory.h index 616d6633b0..ff09b4b1b6 100644 --- a/engines/sci/include/sci_memory.h +++ b/engines/sci/include/sci_memory.h @@ -50,6 +50,8 @@ # include <direct.h> // for chdir, rmdir, _gecwd, getcwd, mkdir #endif +namespace Sci { + /********** the memory allocation macros **********/ #ifdef UNCHECKED_MALLOCS @@ -169,4 +171,6 @@ extern void *sci_refcount_memdup(void *data, size_t len); ** The number of references accounted for will be one. */ +} // End of namespace Sci + #endif /* _SCI_MEMORY_H */ diff --git a/engines/sci/include/sci_midi.h b/engines/sci/include/sci_midi.h index 88e2b92f24..372a06a201 100644 --- a/engines/sci/include/sci_midi.h +++ b/engines/sci/include/sci_midi.h @@ -26,6 +26,8 @@ #ifndef _SCI_MIDI_H_ #define _SCI_MIDI_H_ +namespace Sci { + #define MIDI_RHYTHM_CHANNEL 9 /* Special SCI sound stuff */ @@ -48,4 +50,6 @@ #define SCI_MIDI_CONTROLLER(status) ((status & 0xF0) == 0xB0) +} // End of namespace Sci + #endif /* !defined(_SCI_MIDI_H_) */ diff --git a/engines/sci/include/sci_widgets.h b/engines/sci/include/sci_widgets.h index 339c59632a..d9cbbefd63 100644 --- a/engines/sci/include/sci_widgets.h +++ b/engines/sci/include/sci_widgets.h @@ -30,6 +30,8 @@ #include "sci/include/engine.h" +namespace Sci { + /* The following flags are applicable to windows in SCI0: */ #define WINDOW_FLAG_TRANSPARENT 0x01 @@ -206,5 +208,7 @@ sciw_select_item(state_t *s, gfxw_port_t *menu_port, menu_t *menu, int selection ** Returns : (gfxw_port_t *) The modified menu */ +} // End of namespace Sci + #endif /* _!SCI_WIDGETS_H_ */ diff --git a/engines/sci/include/sciresource.h b/engines/sci/include/sciresource.h index fc9bec41e8..9b30d7d8ba 100644 --- a/engines/sci/include/sciresource.h +++ b/engines/sci/include/sciresource.h @@ -35,6 +35,8 @@ #include "sci/include/resource.h" #include "sci/include/versions.h" +namespace Sci { + #define SCI_MAX_RESOURCE_SIZE 0x0400000 /* The maximum allowed size for a compressed or decompressed resource */ @@ -432,6 +434,7 @@ void _scir_add_altsource(resource_t *res, ResourceSource *source, unsigned int f ** Returns : (void) */ +} // End of namespace Sci #endif diff --git a/engines/sci/include/scitypes.h b/engines/sci/include/scitypes.h index 8d18ab5aec..cc3728be38 100644 --- a/engines/sci/include/scitypes.h +++ b/engines/sci/include/scitypes.h @@ -36,6 +36,8 @@ #include <io.h> #endif +namespace Sci { + typedef int8 gint8; typedef uint8 guint8; @@ -66,4 +68,6 @@ typedef struct { #endif } sci_dir_t; /* used by sci_find_first and friends */ +} // End of namespace Sci + #endif /* !SCI_TYPES */ diff --git a/engines/sci/include/script.h b/engines/sci/include/script.h index f1886a89e3..ad1e976914 100644 --- a/engines/sci/include/script.h +++ b/engines/sci/include/script.h @@ -28,6 +28,8 @@ #include "sci/include/sciresource.h" +namespace Sci { + /*#define SCRIPT_DEBUG */ #define SCI_SCRIPTS_NR 1000 @@ -216,4 +218,6 @@ script_find_selector(struct _state *s, const char *selector_name); struct _state; void script_free_breakpoints(struct _state *s); +} // End of namespace Sci + #endif diff --git a/engines/sci/include/sfx_core.h b/engines/sci/include/sfx_core.h index 3904bfc0e5..7ac02d6cfc 100644 --- a/engines/sci/include/sfx_core.h +++ b/engines/sci/include/sfx_core.h @@ -28,9 +28,13 @@ #include "common/scummsys.h" +namespace Sci { + #define SFX_OK 0 #define SFX_ERROR -1 #define MIDI_CHANNELS 16 +} // End of namespace Sci + #endif /* !defined(_SFX_CORE_H_) */ diff --git a/engines/sci/include/sfx_engine.h b/engines/sci/include/sfx_engine.h index 47d4ffa058..fe48463b65 100644 --- a/engines/sci/include/sfx_engine.h +++ b/engines/sci/include/sfx_engine.h @@ -32,6 +32,8 @@ #include "sci/include/sfx_iterator.h" #include "sci/include/sciresource.h" +namespace Sci { + #define SOUND_TICK 1000000 / 60 /* Approximately 16666 microseconds */ @@ -174,5 +176,6 @@ sfx_song_set_fade(sfx_state_t *self, song_handle_t handle, fade_params_t *fade_s ** (fade_params_t *) fade_setup: The precise fade-out configuration to use */ +} // End of namespace Sci #endif /* !defined(_SFX_ENGINE_H_) */ diff --git a/engines/sci/include/sfx_iterator.h b/engines/sci/include/sfx_iterator.h index 6152dc6630..5dbafa8b9a 100644 --- a/engines/sci/include/sfx_iterator.h +++ b/engines/sci/include/sfx_iterator.h @@ -31,6 +31,8 @@ #include "sci/include/sfx_pcm.h" #include "sci/include/listener.h" +namespace Sci { + #define SI_FINISHED -1 /* Song finished playing */ #define SI_LOOP -2 /* Song just looped */ #define SI_ABSOLUTE_CUE -3 /* Found a song cue (absolute) */ @@ -350,4 +352,6 @@ sfx_play_iterator_pcm(song_iterator_t *it, unsigned long handle); ** This assumes that the last call to 'it->next()' returned SI_PCM. */ +} // End of namespace Sci + #endif diff --git a/engines/sci/include/sfx_iterator_internal.h b/engines/sci/include/sfx_iterator_internal.h index b0a6e0d8d5..54d63bde36 100644 --- a/engines/sci/include/sfx_iterator_internal.h +++ b/engines/sci/include/sfx_iterator_internal.h @@ -29,6 +29,7 @@ #include "sci/include/sfx_iterator.h" #include "sci/include/sci_midi.h" +namespace Sci { /* States */ @@ -234,4 +235,6 @@ sfx_iterator_make_feed(byte *base_data, int offset, ** (pcm_data_internal_t) conf: PCM encoding */ +} // End of namespace Sci + #endif /* !defined(_SFX_ITERATOR_INTERNAL_ */ diff --git a/engines/sci/include/sfx_pcm.h b/engines/sci/include/sfx_pcm.h index f275fd3f03..b1402acc1a 100644 --- a/engines/sci/include/sfx_pcm.h +++ b/engines/sci/include/sfx_pcm.h @@ -31,6 +31,8 @@ #include "sci/include/sfx_time.h" #include "sci/include/scitypes.h" +namespace Sci { + #define SFX_PCM_MONO 0 #define SFX_PCM_STEREO_LR 1 /* left sample, then right sample */ #define SFX_PCM_STEREO_RL 2 /* right sample, then left sample */ @@ -178,4 +180,6 @@ sfx_pcm_available(void); ** Returns : (int) zero iff no PCM device is available */ +} // End of namespace Sci + #endif /* !defined(_SFX_PCM_H_) */ diff --git a/engines/sci/include/sfx_player.h b/engines/sci/include/sfx_player.h index 526d8b46d6..a9b59582f8 100644 --- a/engines/sci/include/sfx_player.h +++ b/engines/sci/include/sfx_player.h @@ -25,12 +25,14 @@ /* song player structure */ +#ifndef _SFX_PLAYER_H +#define _SFX_PLAYER_H + #include "sci/include/sfx_engine.h" #include "sci/include/sfx_iterator.h" #include "sci/include/sciresource.h" -#ifndef _SFX_PLAYER_H -#define _SFX_PLAYER_H +namespace Sci { typedef void tell_synth_func(int buf_nr, byte *buf); @@ -162,4 +164,6 @@ sfx_iterator_combine(song_iterator_t *it1, song_iterator_t *it2); ** call should be used by song players, but not by the core sound system */ +} // End of namespace Sci + #endif /* !_SFX_PLAYER_H */ diff --git a/engines/sci/include/sfx_songlib.h b/engines/sci/include/sfx_songlib.h index 3bc149bddc..09dbc631e3 100644 --- a/engines/sci/include/sfx_songlib.h +++ b/engines/sci/include/sfx_songlib.h @@ -34,6 +34,8 @@ #include "sci/include/scitypes.h" #include "sci/include/sfx_iterator.h" +namespace Sci { + #define SOUND_STATUS_STOPPED 0 #define SOUND_STATUS_PLAYING 1 #define SOUND_STATUS_SUSPENDED 2 @@ -197,4 +199,6 @@ song_lib_set_restore_behavior(songlib_t songlib, song_handle_t handle, ** (RESTORE_BEHAVIOR) action: The desired action */ +} // End of namespace Sci + #endif /* !_SCI_SOUND_SERVER_H_ */ diff --git a/engines/sci/include/sfx_time.h b/engines/sci/include/sfx_time.h index 66677d709a..d2e0cbec3e 100644 --- a/engines/sci/include/sfx_time.h +++ b/engines/sci/include/sfx_time.h @@ -26,6 +26,8 @@ #ifndef _SFX_TIME_H_ #define _SFX_TIME_H_ +namespace Sci { + typedef struct { long secs; long usecs; @@ -84,6 +86,6 @@ sfx_timestamp_gettime(sfx_timestamp_t *timestamp, long *secs, long *usecs); ** the epoch described there */ - +} // End of namespace Sci #endif /* !defined(_SFX_TIME_H_) */ diff --git a/engines/sci/include/sfx_timer.h b/engines/sci/include/sfx_timer.h index 5f5f24e6f6..6342503121 100644 --- a/engines/sci/include/sfx_timer.h +++ b/engines/sci/include/sfx_timer.h @@ -28,6 +28,8 @@ #include "sci/include/sfx_core.h" +namespace Sci { + typedef struct { int delay_ms; /* Approximate delay (in milliseconds) between calls */ @@ -51,4 +53,6 @@ typedef struct { */ } sfx_timer_t; +} // End of namespace Sci + #endif /* !_FREESCI_SFX_TIMER_H_ */ diff --git a/engines/sci/include/sys_strings.h b/engines/sci/include/sys_strings.h index d648b4982d..3a16777a0b 100644 --- a/engines/sci/include/sys_strings.h +++ b/engines/sci/include/sys_strings.h @@ -26,6 +26,8 @@ #ifndef _FREESCI_SYSTEM_STRINGS_H_ #define _FREESCI_SYSTEM_STRINGS_H_ +namespace Sci { + #define SYS_STRINGS_MAX 4 #define SYS_STRING_SAVEDIR 0 @@ -75,4 +77,6 @@ sys_string_free_all(sys_strings_t *strings); ** Parameters: (sys_strings_t *) strings: The string table to deallocate */ +} // End of namespace Sci + #endif /* !_FREESCI_SYSTEM_STRINGS_H_ */ diff --git a/engines/sci/include/uinput.h b/engines/sci/include/uinput.h index fb05dfc694..30b39ef9f5 100644 --- a/engines/sci/include/uinput.h +++ b/engines/sci/include/uinput.h @@ -32,6 +32,7 @@ # include <unistd.h> #endif +namespace Sci { struct _state; @@ -126,4 +127,6 @@ typedef struct { #define SCI_EVM_NO_FOOLOCK (~(SCI_EVM_SCRLOCK | SCI_EVM_NUMLOCK | SCI_EVM_CAPSLOCK | SCI_EVM_INSERT)) #define SCI_EVM_ALL 0xFF +} // End of namespace Sci + #endif /* _SCI_UINPUT_H */ diff --git a/engines/sci/include/versions.h b/engines/sci/include/versions.h index c18840598a..1b5de640f5 100644 --- a/engines/sci/include/versions.h +++ b/engines/sci/include/versions.h @@ -30,6 +30,8 @@ #include "sci/include/scitypes.h" +namespace Sci { + struct _state; #define SCI_VERSION(_major_, _minor_, _patchlevel_) (((_major_)<<20) | ((_minor_)<<10) | _patchlevel_) @@ -147,4 +149,6 @@ version_parse(const char *vn, sci_version_t *result); ** (sci_version_t) *result: The resulting version number on success */ +} // End of namespace Sci + #endif /* !_SCI_VERSIONS_H_ */ diff --git a/engines/sci/include/vm.h b/engines/sci/include/vm.h index 6df7723022..fa404e701c 100644 --- a/engines/sci/include/vm.h +++ b/engines/sci/include/vm.h @@ -37,6 +37,8 @@ #ifndef _SCI_VM_H #define _SCI_VM_H +namespace Sci { + #define VM_STACK_SIZE 0x1000 /* Number of bytes to be allocated for the stack */ @@ -821,4 +823,6 @@ obj_get(struct _state *s, reg_t offset); ** Returns : (object_t *) The object in question, or NULL if there is none */ +} // End of namespace Sci + #endif /* !_SCI_VM_H */ diff --git a/engines/sci/include/vm_types.h b/engines/sci/include/vm_types.h index 8fb865656e..847a1f30e4 100644 --- a/engines/sci/include/vm_types.h +++ b/engines/sci/include/vm_types.h @@ -28,6 +28,8 @@ #include "sci/include/scitypes.h" +namespace Sci { + #define SCI_REG_SIZE 16; #define SCI_SEG_SIZE 16; @@ -63,5 +65,6 @@ make_reg(int segment, int offset) { #define NULL_REG_INITIALIZER {0, 0} extern reg_t NULL_REG; +} // End of namespace Sci #endif /* !_SCI_VM_TYPES_H_ */ diff --git a/engines/sci/include/vocabulary.h b/engines/sci/include/vocabulary.h index 33bc32409a..b51affc570 100644 --- a/engines/sci/include/vocabulary.h +++ b/engines/sci/include/vocabulary.h @@ -29,6 +29,8 @@ #include "sci/include/versions.h" #include "sci/include/sciresource.h" +namespace Sci { + /*#define VOCABULARY_DEBUG */ /*#define SCI_SIMPLE_SAID_CODE */ /* Whether the simplified Said() matching should be used */ /*#define SCI_SIMPLE_SAID_DEBUG */ /* uncomment to enable simple said debugging */ @@ -416,5 +418,6 @@ vocab_gnf_parse(parse_tree_node_t *nodes, result_word_t *words, int words_nr, void vocab_gnf_dump(parse_tree_branch_t *branches, int branches_nr); +} // End of namespace Sci #endif diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index 23e143b13d..e04eab4a3f 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -32,10 +32,10 @@ #include "sci/console.h" #include "sci/include/engine.h" -extern gfx_driver_t gfx_driver_scummvm; - namespace Sci { +extern gfx_driver_t gfx_driver_scummvm; + int c_quit(state_t *s) { script_abort_flag = 1; /* Terminate VM */ diff --git a/engines/sci/scicore/aatree.cpp b/engines/sci/scicore/aatree.cpp index 0b1da08aa5..2ec239259c 100644 --- a/engines/sci/scicore/aatree.cpp +++ b/engines/sci/scicore/aatree.cpp @@ -27,6 +27,8 @@ #include "sci/include/sci_memory.h" +namespace Sci { + struct aatree { struct aatree *left, *right; int level; @@ -165,3 +167,5 @@ aatree_free(aatree_t *t) { free(t); } + +} // End of namespace Sci diff --git a/engines/sci/scicore/console.cpp b/engines/sci/scicore/console.cpp index 1d8b1c1a7b..6cb2bf5b55 100644 --- a/engines/sci/scicore/console.cpp +++ b/engines/sci/scicore/console.cpp @@ -28,6 +28,9 @@ #include "sci/include/sci_memory.h" #include "sci/include/engine.h" + +namespace Sci { + #ifdef SCI_CONSOLE int con_passthrough = 0; @@ -137,3 +140,5 @@ close_console_file(void) { #endif /* SCI_CONSOLE */ + +} // End of namespace Sci diff --git a/engines/sci/scicore/decompress0.cpp b/engines/sci/scicore/decompress0.cpp index 1027c156b2..c132edebd1 100644 --- a/engines/sci/scicore/decompress0.cpp +++ b/engines/sci/scicore/decompress0.cpp @@ -31,6 +31,8 @@ #include "sci/include/sci_memory.h" #include "sci/include/sciresource.h" +namespace Sci { + /* #define _SCI_DECOMPRESS_DEBUG */ /* 9-12 bit LZW encoding */ @@ -361,3 +363,4 @@ int decompress0(resource_t *result, Common::ReadStream &stream, int sci_version) return 0; } +} // End of namespace Sci diff --git a/engines/sci/scicore/decompress01.cpp b/engines/sci/scicore/decompress01.cpp index b0bc2a95f3..e6c4dcd9fa 100644 --- a/engines/sci/scicore/decompress01.cpp +++ b/engines/sci/scicore/decompress01.cpp @@ -29,6 +29,8 @@ #include "sci/include/sci_memory.h" #include "sci/include/sciresource.h" +namespace Sci { + /*************************************************************************** * The following code was originally created by Carl Muckenhoupt for his * SCI decoder. It has been ported to the FreeSCI environment by Sergey Lapin. @@ -633,3 +635,4 @@ int decompress01(resource_t *result, Common::ReadStream &stream, int sci_version return 0; } +} // End of namespace Sci diff --git a/engines/sci/scicore/decompress1.cpp b/engines/sci/scicore/decompress1.cpp index d9fbd72d77..306540c889 100644 --- a/engines/sci/scicore/decompress1.cpp +++ b/engines/sci/scicore/decompress1.cpp @@ -29,7 +29,7 @@ #include "sci/include/sci_memory.h" #include "sci/include/sciresource.h" - +namespace Sci { /* DEFLATE-DCL ** Refer to the FreeSCI docs for a full description. @@ -432,3 +432,4 @@ int decompress1(resource_t *result, Common::ReadStream &stream, int sci_version) return 0; } +} // End of namespace Sci diff --git a/engines/sci/scicore/decompress11.cpp b/engines/sci/scicore/decompress11.cpp index 4f7e808f1c..701f4ea089 100644 --- a/engines/sci/scicore/decompress11.cpp +++ b/engines/sci/scicore/decompress11.cpp @@ -29,6 +29,8 @@ #include "sci/include/sci_memory.h" #include "sci/include/sciresource.h" +namespace Sci { + #define DDEBUG if (0) printf void decryptinit3(void); @@ -162,3 +164,4 @@ int decompress11(resource_t *result, Common::ReadStream &stream, int sci_version return 0; } +} // End of namespace Sci diff --git a/engines/sci/scicore/resource.cpp b/engines/sci/scicore/resource.cpp index 1eb69fa163..fc8a59336b 100644 --- a/engines/sci/scicore/resource.cpp +++ b/engines/sci/scicore/resource.cpp @@ -33,6 +33,8 @@ #include "sci/include/sciresource.h" #include "sci/include/vocabulary.h" /* For SCI version auto-detection */ +namespace Sci { + #undef SCI_REQUIRE_RESOURCE_FILES /* #define SCI_VERBOSE_RESMGR 1 */ @@ -804,3 +806,4 @@ scir_unlock_resource(ResourceManager *mgr, resource_t *res, int resnum, int rest _scir_free_old_resources(mgr, 0); } +} // End of namespace Sci diff --git a/engines/sci/scicore/resource_map.cpp b/engines/sci/scicore/resource_map.cpp index 5aa5a61303..fef1aafd04 100644 --- a/engines/sci/scicore/resource_map.cpp +++ b/engines/sci/scicore/resource_map.cpp @@ -29,6 +29,7 @@ #include "common/file.h" +namespace Sci { #define RESOURCE_MAP_FILENAME "resource.map" @@ -529,3 +530,5 @@ main(int argc, char **argv) { return 0; } #endif + +} // End of namespace Sci diff --git a/engines/sci/scicore/resource_patch.cpp b/engines/sci/scicore/resource_patch.cpp index c861bd9adc..b4fc6dd2c0 100644 --- a/engines/sci/scicore/resource_patch.cpp +++ b/engines/sci/scicore/resource_patch.cpp @@ -29,6 +29,8 @@ #include "sci/include/sciresource.h" #include "sci/include/sci_memory.h" +namespace Sci { + void sci0_sprintf_patch_file_name(char *string, resource_t *res) { sprintf(string, "%s.%03i", sci_resource_types[res->type], res->number); } @@ -183,3 +185,4 @@ int sci1_read_resource_patches(ResourceSource *source, resource_t **resource_p, return 0; } +} // End of namespace Sci diff --git a/engines/sci/scicore/sci_memory.cpp b/engines/sci/scicore/sci_memory.cpp index e762475e20..539879568d 100644 --- a/engines/sci/scicore/sci_memory.cpp +++ b/engines/sci/scicore/sci_memory.cpp @@ -26,6 +26,8 @@ #include "sci/include/sci_memory.h" #include "common/util.h" +namespace Sci { + /* set optimisations for Win32: */ /* g on: enable global optimizations */ /* t on: use fast code */ @@ -174,3 +176,5 @@ extern void *sci_refcount_memdup(void *data, size_t len) { memcpy(dest, data, len); return dest; } + +} // End of namespace Sci diff --git a/engines/sci/scicore/script.cpp b/engines/sci/scicore/script.cpp index 09fec62a89..c574b67215 100644 --- a/engines/sci/scicore/script.cpp +++ b/engines/sci/scicore/script.cpp @@ -27,6 +27,8 @@ #include "sci/include/engine.h" #include "common/util.h" +namespace Sci { + /* #define SCRIPT_DEBUG */ #define END Script_None @@ -491,3 +493,5 @@ script_dissect(ResourceManager *resmgr, int res_no, char **snames, int snames_nr /*vocabulary_free_snames(snames);*/ } + +} // End of namespace Sci diff --git a/engines/sci/scicore/tools.cpp b/engines/sci/scicore/tools.cpp index ae1c343336..ee89c9b27d 100644 --- a/engines/sci/scicore/tools.cpp +++ b/engines/sci/scicore/tools.cpp @@ -67,6 +67,7 @@ #include "sci/include/engine.h" +namespace Sci { // FIXME: Get rid of G_DIR_SEPARATOR / G_DIR_SEPARATOR_S #if _MSC_VER @@ -535,3 +536,5 @@ int is_print_str(char *str) { return ((float) printable / (float) len >= 0.5); } + +} // End of namespace Sci diff --git a/engines/sci/scicore/versions.cpp b/engines/sci/scicore/versions.cpp index e05106ce88..408deb58f4 100644 --- a/engines/sci/scicore/versions.cpp +++ b/engines/sci/scicore/versions.cpp @@ -32,6 +32,8 @@ #include "sci/include/engine.h" #include "sci/include/resource.h" +namespace Sci { + void version_require_earlier_than(state_t *s, sci_version_t version) { if (s->version_lock_flag) @@ -88,3 +90,5 @@ version_parse(const char *vn, sci_version_t *result) { } #undef VERSION_DETECT_BUF_SIZE + +} // End of namespace Sci diff --git a/engines/sci/scicore/vocab.cpp b/engines/sci/scicore/vocab.cpp index c76ddc1e68..9f7911272d 100644 --- a/engines/sci/scicore/vocab.cpp +++ b/engines/sci/scicore/vocab.cpp @@ -30,6 +30,8 @@ #include "sci/include/engine.h" #include "sci/include/kernel.h" +namespace Sci { + int vocab_version; #define VOCAB_RESOURCE_PARSE_TREE_BRANCHES vocab_version==1 ? \ @@ -708,3 +710,5 @@ vocab_synonymize_tokens(result_word_t *words, int words_nr, synonym_t *synonyms, if (words[i].group == synonyms[sync].replaceant) words[i].group = synonyms[sync].replacement; } + +} // End of namespace Sci diff --git a/engines/sci/scicore/vocab_debug.cpp b/engines/sci/scicore/vocab_debug.cpp index bccb8fcf72..bd3eb2e312 100644 --- a/engines/sci/scicore/vocab_debug.cpp +++ b/engines/sci/scicore/vocab_debug.cpp @@ -27,6 +27,8 @@ #include "sci/include/engine.h" #include "sci/include/sciresource.h" +namespace Sci { + /* Default kernel name table */ #define SCI0_KNAMES_WELL_DEFINED 0x6e #define SCI0_KNAMES_DEFAULT_ENTRIES_NR 0x72 @@ -418,3 +420,5 @@ void vocabulary_free_knames(char** names) { free(names); } + +} // End of namespace Sci diff --git a/engines/sci/sfx/adlib.cpp b/engines/sci/sfx/adlib.cpp index dbce4d2ad1..f1da3fbdae 100644 --- a/engines/sci/sfx/adlib.cpp +++ b/engines/sci/sfx/adlib.cpp @@ -25,6 +25,8 @@ #include "sci/sfx/adlib.h" +namespace Sci { + adlib_instr adlib_sbi[96]; void @@ -69,3 +71,5 @@ make_sbi(adlib_def *one, guint8 *buffer) { return; } + +} // End of namespace Sci diff --git a/engines/sci/sfx/adlib.h b/engines/sci/sfx/adlib.h index eeeec62a91..890f573cdf 100644 --- a/engines/sci/sfx/adlib.h +++ b/engines/sci/sfx/adlib.h @@ -29,6 +29,7 @@ #include "sci/include/resource.h" +namespace Sci { #define ADLIB_VOICES 12 @@ -70,4 +71,6 @@ extern adlib_instr adlib_sbi[96]; 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_ */ diff --git a/engines/sci/sfx/core.cpp b/engines/sci/sfx/core.cpp index 6a2180d2ed..7452305dc7 100644 --- a/engines/sci/sfx/core.cpp +++ b/engines/sci/sfx/core.cpp @@ -33,6 +33,7 @@ #include "sci/include/sci_midi.h" #include "common/mutex.h" +namespace Sci { /*#define DEBUG_SONG_API*/ /*#define DEBUG_CUES*/ @@ -903,3 +904,5 @@ sfx_all_stop(sfx_state_t *self) { song_lib_free(self->songlib); _update(self); } + +} // End of namespace Sci diff --git a/engines/sci/sfx/device.h b/engines/sci/sfx/device.h index c000f7817c..fc5328e1d9 100644 --- a/engines/sci/sfx/device.h +++ b/engines/sci/sfx/device.h @@ -28,6 +28,8 @@ #ifndef _SFX_DEVICE_H #define _SFX_DEVICE_H +namespace Sci { + /* Various types of resources */ #define SFX_DEVICE_NONE 0 #define SFX_DEVICE_MIDI 1 /* midi writer */ @@ -116,4 +118,6 @@ sfx_find_device(int type, char *name); ** Returns : (void *) The device requested, or NULL if no match was found */ +} // End of namespace Sci + #endif /* !_SFX_PLAYER_H */ diff --git a/engines/sci/sfx/device/alsa-midi.cpp b/engines/sci/sfx/device/alsa-midi.cpp index 22f9fbc8d2..2528ed1aa3 100644 --- a/engines/sci/sfx/device/alsa-midi.cpp +++ b/engines/sci/sfx/device/alsa-midi.cpp @@ -29,6 +29,8 @@ #include <alsa/asoundlib.h> +namespace Sci { + #define SCI_ALSA_MIDI_VERSION "0.1" static snd_midi_event_t *parser = NULL; @@ -214,4 +216,6 @@ midi_writer_t sfx_device_midi_alsa = { amclose, }; +} // End of namespace Sci + #endif diff --git a/engines/sci/sfx/device/camd-midi.cpp b/engines/sci/sfx/device/camd-midi.cpp index c4205414cb..307e215a50 100644 --- a/engines/sci/sfx/device/camd-midi.cpp +++ b/engines/sci/sfx/device/camd-midi.cpp @@ -37,6 +37,7 @@ #include <proto/intuition.h> #include <stdio.h> +namespace Sci { #define SWAP_BYTES #define FILL_BYTES @@ -150,4 +151,6 @@ midi_writer_t sfx_device_midi_camd = { &camd_close }; +} // End of namespace Sci + #endif /* HAVE_PROTO_CAMD_H */ diff --git a/engines/sci/sfx/device/devices.cpp b/engines/sci/sfx/device/devices.cpp index 42f5a89dbb..6c4da7e50a 100644 --- a/engines/sci/sfx/device/devices.cpp +++ b/engines/sci/sfx/device/devices.cpp @@ -33,6 +33,8 @@ #include "sci/include/resource.h" +namespace Sci { + static struct _midi_device *devices_midi[] = { NULL }; @@ -84,3 +86,5 @@ sfx_find_device(int type, char *name) { return NULL; } + +} // End of namespace Sci diff --git a/engines/sci/sfx/device/unixraw-midi.cpp b/engines/sci/sfx/device/unixraw-midi.cpp index bd158622bd..501e154cb1 100644 --- a/engines/sci/sfx/device/unixraw-midi.cpp +++ b/engines/sci/sfx/device/unixraw-midi.cpp @@ -30,6 +30,8 @@ #include <sys/stat.h> #include <fcntl.h> +namespace Sci { + #define SCI_UNIXRAW_MIDI_VERSION "0.1" #ifndef O_SYNC @@ -90,3 +92,5 @@ midi_writer_t sfx_device_midi_unixraw = { &unixraw_reset_timer, &unixraw_close }; + +} // End of namespace Sci diff --git a/engines/sci/sfx/iterator.cpp b/engines/sci/sfx/iterator.cpp index ae1f2fa588..bc2d2f5a8c 100644 --- a/engines/sci/sfx/iterator.cpp +++ b/engines/sci/sfx/iterator.cpp @@ -33,6 +33,8 @@ #include "sci/include/resource.h" #include "sci/include/sci_memory.h" +namespace Sci { + static const int MIDI_cmdlen[16] = {0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 1, 1, 2, 0 }; @@ -2051,3 +2053,5 @@ sfx_iterator_combine(song_iterator_t *it1, song_iterator_t *it2) { /* Both are non-NULL: */ return songit_new_tee(it1, it2, 1); /* 'may destroy' */ } + +} // End of namespace Sci diff --git a/engines/sci/sfx/mixer.h b/engines/sci/sfx/mixer.h index 70aad8d483..051d50aa94 100644 --- a/engines/sci/sfx/mixer.h +++ b/engines/sci/sfx/mixer.h @@ -28,6 +28,7 @@ #include "sci/include/sfx_pcm.h" +namespace Sci { #define SFX_PCM_FEED_MODE_ALIVE 0 #define SFX_PCM_FEED_MODE_DEAD 1 @@ -124,4 +125,6 @@ extern sfx_pcm_mixer_t *mixer; /* _THE_ global pcm mixer */ sfx_pcm_mixer_t* getMixer(); +} // End of namespace Sci + #endif /* !defined(_SFX_MIXER_H_) */ diff --git a/engines/sci/sfx/mixer/soft.cpp b/engines/sci/sfx/mixer/soft.cpp index 5aa80c11ae..01f132393d 100644 --- a/engines/sci/sfx/mixer/soft.cpp +++ b/engines/sci/sfx/mixer/soft.cpp @@ -27,6 +27,8 @@ #include "../mixer.h" #include "sci/include/sci_memory.h" +namespace Sci { + /* Max. number of microseconds in difference allowed between independent audio streams */ #define TIMESTAMP_MAX_ALLOWED_DELTA 2000 @@ -970,4 +972,6 @@ sfx_pcm_mixer_t sfx_pcm_mixer_soft_linear = { NULL }; -sfx_pcm_mixer_t* getMixer() { return &sfx_pcm_mixer_soft_linear; }
\ No newline at end of file +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 fead1d7916..f35a546cfd 100644 --- a/engines/sci/sfx/mixer/test.cpp +++ b/engines/sci/sfx/mixer/test.cpp @@ -29,6 +29,8 @@ #include "../mixer.h" #include <time.h> +namespace Sci { + #if 0 sfx_pcm_mixer_t *mix; @@ -344,3 +346,5 @@ main(int argc, char **argv) { #else int main() {} #endif + +} // End of namespace Sci diff --git a/engines/sci/sfx/pcm-iterator.cpp b/engines/sci/sfx/pcm-iterator.cpp index cbe358b104..9507b6fd3d 100644 --- a/engines/sci/sfx/pcm-iterator.cpp +++ b/engines/sci/sfx/pcm-iterator.cpp @@ -27,6 +27,8 @@ #include "sci/include/resource.h" /* for BREAKPOINT */ #include "sci/include/sci_memory.h" +namespace Sci { + #define D ((pcm_data_internal_t *)self->internal) static int @@ -108,3 +110,5 @@ pi_destroy(sfx_pcm_feed_t *self) { free(D); free(self); } + +} // End of namespace Sci diff --git a/engines/sci/sfx/pcm_device.cpp b/engines/sci/sfx/pcm_device.cpp index 906aa69450..267dfa25e2 100644 --- a/engines/sci/sfx/pcm_device.cpp +++ b/engines/sci/sfx/pcm_device.cpp @@ -29,6 +29,7 @@ #include "sound/audiostream.h" #include "sound/mixer.h" +namespace Sci { static int pcmout_scummvm_framesize; static Audio::AppendableAudioStream * pcmout_scummvm_audiostream; @@ -74,3 +75,5 @@ sfx_pcm_device_t sfx_pcm_driver_scummvm = { {0, 0, 0}, 0 }; + +} // End of namespace Sci diff --git a/engines/sci/sfx/player/players.cpp b/engines/sci/sfx/player/players.cpp index 03b6298378..b92ce930b1 100644 --- a/engines/sci/sfx/player/players.cpp +++ b/engines/sci/sfx/player/players.cpp @@ -25,6 +25,8 @@ #include "sci/include/sfx_player.h" +namespace Sci { + extern sfx_player_t sfx_player_realtime; extern sfx_player_t sfx_player_polled; @@ -49,3 +51,5 @@ sfx_find_player(char *name) { return sfx_players[n]; } } + +} // End of namespace Sci diff --git a/engines/sci/sfx/player/polled.cpp b/engines/sci/sfx/player/polled.cpp index 2274b0003a..9d307940cb 100644 --- a/engines/sci/sfx/player/polled.cpp +++ b/engines/sci/sfx/player/polled.cpp @@ -32,6 +32,8 @@ #include "sci/sfx/softseq.h" #include "sci/sfx/mixer.h" +namespace Sci { + static song_iterator_t *play_it; static int play_paused = 0; static sfx_softseq_t *seq; @@ -315,3 +317,5 @@ sfx_player_t sfx_player_polled = { &pp_tell_synth, 0 /* polyphony */ }; + +} // End of namespace Sci diff --git a/engines/sci/sfx/player/realtime.cpp b/engines/sci/sfx/player/realtime.cpp index ab3abc1513..6aa53d60d3 100644 --- a/engines/sci/sfx/player/realtime.cpp +++ b/engines/sci/sfx/player/realtime.cpp @@ -31,6 +31,8 @@ #include "sci/include/sfx_player.h" #include "sci/sfx/sequencer.h" +namespace Sci { + static sfx_sequencer_t *seq; extern sfx_player_t sfx_player_realtime; @@ -310,3 +312,5 @@ sfx_player_t sfx_player_realtime = { &rt_tell_synth, 0 /* polyphony */ }; + +} // End of namespace Sci diff --git a/engines/sci/sfx/seq/gm.cpp b/engines/sci/sfx/seq/gm.cpp index 9ad94a54cc..13520b2eec 100644 --- a/engines/sci/sfx/seq/gm.cpp +++ b/engines/sci/sfx/seq/gm.cpp @@ -35,6 +35,8 @@ #include "instrument-map.h" #include <resource.h> +namespace Sci { + static midi_writer_t *writer = NULL; static int @@ -175,3 +177,5 @@ sfx_sequencer_t sfx_sequencer_gm = { 64, /* max polyphony */ 0 /* no write-ahead needed inherently */ }; + +} // End of namespace Sci diff --git a/engines/sci/sfx/seq/instrument-map.cpp b/engines/sci/sfx/seq/instrument-map.cpp index 2382d89003..8f9ee56371 100644 --- a/engines/sci/sfx/seq/instrument-map.cpp +++ b/engines/sci/sfx/seq/instrument-map.cpp @@ -29,6 +29,8 @@ #include "instrument-map.h" #include "sfx_engine.h" +namespace Sci { + 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)); @@ -522,3 +524,4 @@ sfx_mapped_writer(midi_writer_t *writer, sfx_instrument_map_t *map) { return (midi_writer_t *) retval; } +} // End of namespace Sci diff --git a/engines/sci/sfx/seq/instrument-map.h b/engines/sci/sfx/seq/instrument-map.h index 45dc64262c..a18bdaff79 100644 --- a/engines/sci/sfx/seq/instrument-map.h +++ b/engines/sci/sfx/seq/instrument-map.h @@ -32,6 +32,8 @@ #include "resource.h" #include "../device.h" +namespace Sci { + #define SFX_INSTRUMENTS_NR 0x80 #define SFX_RHYTHM_NR 0x80 #define SFX_VELOCITIES_NR 0x80 @@ -126,5 +128,6 @@ sfx_mapped_writer(midi_writer_t *writer, sfx_instrument_map_t *map); ** deallocates the instrument map when the writer is closed. */ +} // End of namespace Sci #endif /* !defined(SCI_INSTRUMENT_MAP_) */ diff --git a/engines/sci/sfx/seq/map-mt32-to-gm.cpp b/engines/sci/sfx/seq/map-mt32-to-gm.cpp index 4f21f24f7a..bc472935d4 100644 --- a/engines/sci/sfx/seq/map-mt32-to-gm.cpp +++ b/engines/sci/sfx/seq/map-mt32-to-gm.cpp @@ -28,6 +28,8 @@ #include <stdarg.h> #include "instrument-map.h" +namespace Sci { + #define DEBUG_MT32_TO_GM static const char @@ -797,3 +799,4 @@ sfx_instrument_map_mt32_to_gm(byte *data, size_t size) { return map; } +} // End of namespace Sci diff --git a/engines/sci/sfx/seq/oss-adlib.cpp b/engines/sci/sfx/seq/oss-adlib.cpp index 361b0ad43c..be12033efb 100644 --- a/engines/sci/sfx/seq/oss-adlib.cpp +++ b/engines/sci/sfx/seq/oss-adlib.cpp @@ -38,6 +38,8 @@ #include <sys/soundcard.h> #include <sfx_iterator.h> /* for some MIDI information */ +namespace Sci { + #if 1 SEQ_DEFINEBUF(2048); static int seqfd; @@ -363,4 +365,6 @@ sfx_sequencer_t sfx_sequencer_oss_adlib = { 0 /* Does not require any write-ahead by its own */ }; +} // End of namespace Sci + #endif /* HAVE_SYS_SOUNDCARD_H */ diff --git a/engines/sci/sfx/seq/sequencers.cpp b/engines/sci/sfx/seq/sequencers.cpp index 2f4751b963..561f4c4cf7 100644 --- a/engines/sci/sfx/seq/sequencers.cpp +++ b/engines/sci/sfx/seq/sequencers.cpp @@ -26,6 +26,8 @@ #include "../sequencer.h" #include "sci/include/resource.h" +namespace Sci { + sfx_sequencer_t *sfx_sequencers[] = { NULL }; @@ -48,3 +50,5 @@ sfx_find_sequencer(char *name) { return sfx_sequencers[n]; } } + +} // End of namespace Sci diff --git a/engines/sci/sfx/sequencer.h b/engines/sci/sfx/sequencer.h index 4bc2a2b048..6f5a20b91e 100644 --- a/engines/sci/sfx/sequencer.h +++ b/engines/sci/sfx/sequencer.h @@ -35,6 +35,8 @@ #include "sci/sfx/device.h" #include "sci/include/scitypes.h" +namespace Sci { + #define SFX_SEQ_PATCHFILE_NONE -1 typedef struct _sfx_sequencer { @@ -142,5 +144,6 @@ sfx_find_sequencer(char *name); ** if not found */ +} // End of namespace Sci #endif /* _SFX_SEQUENCER_H_ */ diff --git a/engines/sci/sfx/softseq.h b/engines/sci/sfx/softseq.h index f5acf9d428..f37a4daecf 100644 --- a/engines/sci/sfx/softseq.h +++ b/engines/sci/sfx/softseq.h @@ -31,6 +31,7 @@ #include "sci/sfx/sequencer.h" #include "sci/include/resource.h" +namespace Sci { /* Software sequencer */ typedef struct sfx_softseq { @@ -127,4 +128,6 @@ sfx_find_softseq(const char *name); ** Returns : (sfx_softseq_t *) The requested sequencer, or NULL if not found */ +} // End of namespace Sci + #endif /* !defined(SFX_SOFTSEQ_H_) */ diff --git a/engines/sci/sfx/softseq/SN76496.cpp b/engines/sci/sfx/softseq/SN76496.cpp index 8ec8eb89e4..b341fcaa64 100644 --- a/engines/sci/sfx/softseq/SN76496.cpp +++ b/engines/sci/sfx/softseq/SN76496.cpp @@ -28,6 +28,8 @@ #include "sci/sfx/softseq.h" #include "sci/include/sci_midi.h" +namespace Sci { + #define FREQUENCY 44100 #define CHANNELS_NR 3 #define VOLUME_SHIFT 3 @@ -235,3 +237,5 @@ sfx_softseq_t sfx_softseq_SN76496 = { 3, /* # of voices */ {FREQUENCY, SFX_PCM_MONO, SFX_PCM_FORMAT_S16_NATIVE} }; + +} // End of namespace Sci diff --git a/engines/sci/sfx/softseq/amiga.cpp b/engines/sci/sfx/softseq/amiga.cpp index c45807583c..815d84f17f 100644 --- a/engines/sci/sfx/softseq/amiga.cpp +++ b/engines/sci/sfx/softseq/amiga.cpp @@ -29,6 +29,8 @@ #include "common/frac.h" +namespace Sci { + #define FREQUENCY 44100 #define CHANNELS_NR 10 #define HW_CHANNELS_NR 16 @@ -635,3 +637,5 @@ sfx_softseq_t sfx_softseq_amiga = { HW_CHANNELS_NR, /* # of voices */ {FREQUENCY, SFX_PCM_STEREO_LR, SFX_PCM_FORMAT_S16_NATIVE} }; + +} // End of namespace Sci diff --git a/engines/sci/sfx/softseq/fluidsynth.cpp b/engines/sci/sfx/softseq/fluidsynth.cpp index c3ef336f80..05e99c5738 100644 --- a/engines/sci/sfx/softseq/fluidsynth.cpp +++ b/engines/sci/sfx/softseq/fluidsynth.cpp @@ -36,6 +36,8 @@ #include "../device.h" #include "resource.h" +namespace Sci { + static sfx_sequencer_t *gmseq; static fluid_settings_t* settings; static fluid_synth_t* synth; @@ -243,4 +245,6 @@ sfx_softseq_t sfx_softseq_fluidsynth = { {SAMPLE_RATE, CHANNELS, SFX_PCM_FORMAT_S16_NATIVE} }; +} // End of namespace Sci + #endif /* HAVE_FLUIDSYNTH_H */ diff --git a/engines/sci/sfx/softseq/opl2.cpp b/engines/sci/sfx/softseq/opl2.cpp index d84a114158..29f600a634 100644 --- a/engines/sci/sfx/softseq/opl2.cpp +++ b/engines/sci/sfx/softseq/opl2.cpp @@ -50,6 +50,8 @@ #include "sound/fmopl.h" +namespace Sci { + #ifdef __DC__ #define SAMPLE_RATE 22050 #define CHANNELS SFX_PCM_MONO @@ -699,3 +701,5 @@ sfx_softseq_t sfx_softseq_opl2 = { ADLIB_VOICES, /* # of voices */ {SAMPLE_RATE, CHANNELS, SFX_PCM_FORMAT_S16_NATIVE} }; + +} // End of namespace Sci diff --git a/engines/sci/sfx/softseq/pcspeaker.cpp b/engines/sci/sfx/softseq/pcspeaker.cpp index f0685914f1..c03724524d 100644 --- a/engines/sci/sfx/softseq/pcspeaker.cpp +++ b/engines/sci/sfx/softseq/pcspeaker.cpp @@ -28,6 +28,8 @@ #include "sci/sfx/softseq.h" #include "sci/include/sci_midi.h" +namespace Sci { + #define FREQUENCY 94020 static int volume = 0x0600; @@ -172,3 +174,5 @@ sfx_softseq_t sfx_softseq_pcspeaker = { 1, /* # of voices */ {FREQUENCY, SFX_PCM_MONO, SFX_PCM_FORMAT_S16_NATIVE} }; + +} // End of namespace Sci diff --git a/engines/sci/sfx/softseq/softsequencers.cpp b/engines/sci/sfx/softseq/softsequencers.cpp index e10ef6edd2..e43e9b8cda 100644 --- a/engines/sci/sfx/softseq/softsequencers.cpp +++ b/engines/sci/sfx/softseq/softsequencers.cpp @@ -29,6 +29,8 @@ #include "../softseq.h" +namespace Sci { + extern sfx_softseq_t sfx_softseq_opl2; extern sfx_softseq_t sfx_softseq_SN76496; extern sfx_softseq_t sfx_softseq_pcspeaker; @@ -64,3 +66,5 @@ sfx_find_softseq(const char *name) { return NULL; /* Not found */ } } + +} // End of namespace Sci diff --git a/engines/sci/sfx/songlib.cpp b/engines/sci/sfx/songlib.cpp index ed83223fd6..909de98da9 100644 --- a/engines/sci/sfx/songlib.cpp +++ b/engines/sci/sfx/songlib.cpp @@ -27,6 +27,8 @@ #include "sci/include/sfx_engine.h" #include "sci/include/sci_memory.h" +namespace Sci { + #define debug_stream stderr GTimeVal @@ -264,3 +266,4 @@ song_lib_dump(songlib_t songlib, int line) { } +} // End of namespace Sci diff --git a/engines/sci/sfx/test-iterator.cpp b/engines/sci/sfx/test-iterator.cpp index 8f9a1c7913..939d8ff8d6 100644 --- a/engines/sci/sfx/test-iterator.cpp +++ b/engines/sci/sfx/test-iterator.cpp @@ -28,6 +28,8 @@ #include <stdarg.h> #include <stdio.h> +using namespace Sci; + #define ASSERT_S(x) if (!(x)) { error("Failed assertion in L%d: " #x "\n", __LINE__); return; } #define ASSERT(x) ASSERT_S(x) diff --git a/engines/sci/sfx/time.cpp b/engines/sci/sfx/time.cpp index 9e366ca4d9..15d7ea5dd5 100644 --- a/engines/sci/sfx/time.cpp +++ b/engines/sci/sfx/time.cpp @@ -27,6 +27,8 @@ #include "sci/include/sfx_time.h" #include "sci/include/resource.h" +namespace Sci { + sfx_timestamp_t sfx_new_timestamp(long secs, long usecs, int frame_rate) { sfx_timestamp_t r; @@ -120,3 +122,4 @@ sfx_timestamp_gettime(sfx_timestamp_t *timestamp, long *secs, long *usecs) { *usecs = ust; } +} // End of namespace Sci diff --git a/engines/sci/sfx/timer.cpp b/engines/sci/sfx/timer.cpp index 8edb7c2097..ba2453579d 100644 --- a/engines/sci/sfx/timer.cpp +++ b/engines/sci/sfx/timer.cpp @@ -27,6 +27,7 @@ #include "engines/engine.h" #include "sci/include/sfx_timer.h" +namespace Sci { #define FREQ 60 #define DELAY (1000000 / FREQ) @@ -72,3 +73,5 @@ sfx_timer_t sfx_timer_scummvm = { &scummvm_timer_start, &scummvm_timer_stop }; + +} // End of namespace Sci diff --git a/engines/sci/sfx/timetest.cpp b/engines/sci/sfx/timetest.cpp index 40635c260f..9b50e247b0 100644 --- a/engines/sci/sfx/timetest.cpp +++ b/engines/sci/sfx/timetest.cpp @@ -27,6 +27,8 @@ #include <sfx_time.h> #include <assert.h> +using namespace Sci; + sfx_timestamp_t a, b, c; int |