diff options
Diffstat (limited to 'engines/sci/engine')
35 files changed, 128 insertions, 0 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 |