diff options
author | Jordi Vilalta Prat | 2009-02-21 10:47:56 +0000 |
---|---|---|
committer | Jordi Vilalta Prat | 2009-02-21 10:47:56 +0000 |
commit | 3cc6cdf71942aba796f8d282020d1955f2fd84ef (patch) | |
tree | af85e63f9e3c5438aec367e3e3398609f2db9eff /engines | |
parent | 5d67e3de0f941fc3008c0609f8f9e8bb08ff1713 (diff) | |
download | scummvm-rg350-3cc6cdf71942aba796f8d282020d1955f2fd84ef.tar.gz scummvm-rg350-3cc6cdf71942aba796f8d282020d1955f2fd84ef.tar.bz2 scummvm-rg350-3cc6cdf71942aba796f8d282020d1955f2fd84ef.zip |
Replaced "typedef struct _state state_t" with "struct EngineState"
svn-id: r38678
Diffstat (limited to 'engines')
44 files changed, 1494 insertions, 1565 deletions
diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp index e1dd2b999f..5d72527dbb 100644 --- a/engines/sci/engine/game.cpp +++ b/engines/sci/engine/game.cpp @@ -36,7 +36,7 @@ extern calls_struct_t *send_calls; extern int send_calls_allocated; extern int bp_flag; -static int _init_vocabulary(state_t *s) { // initialize vocabulary and related resources +static int _init_vocabulary(EngineState *s) { // initialize vocabulary and related resources s->parser_lastmatch_word = SAID_NO_MATCH; s->parser_rules = NULL; @@ -70,7 +70,7 @@ static int _init_vocabulary(state_t *s) { // initialize vocabulary and related r extern int _allocd_rules; -static void _free_vocabulary(state_t *s) { +static void _free_vocabulary(EngineState *s) { sciprintf("Freeing vocabulary\n"); if (s->parser_words) { @@ -91,14 +91,14 @@ static void _free_vocabulary(state_t *s) { } -static int _init_graphics_input(state_t *s) { +static int _init_graphics_input(EngineState *s) { s->pic_priority_table = NULL; s->pics = NULL; s->pics_nr = 0; return 0; } -static void _sci1_alloc_system_colors(state_t *s) { +static void _sci1_alloc_system_colors(EngineState *s) { gfx_color_t white; gfx_color_t black; @@ -117,7 +117,7 @@ static void _sci1_alloc_system_colors(state_t *s) { gfxop_set_system_color(s->gfx_state, &black); } -int _reset_graphics_input(state_t *s) { +int _reset_graphics_input(EngineState *s) { resource_t *resource; int font_nr; gfx_color_t transparent; @@ -241,7 +241,7 @@ int _reset_graphics_input(state_t *s) { return 0; } -int game_init_graphics(state_t *s) { +int game_init_graphics(EngineState *s) { #ifndef WITH_PIC_SCALING if (s->gfx_state->options->pic0_unscaled == 0) sciprintf("WARNING: Pic scaling was disabled; your version of FreeSCI has no support for scaled pic drawing built in.\n"); @@ -251,7 +251,7 @@ int game_init_graphics(state_t *s) { return _reset_graphics_input(s); } -static void _free_graphics_input(state_t *s) { +static void _free_graphics_input(EngineState *s) { sciprintf("Freeing graphics\n"); s->visual->widfree(GFXW(s->visual)); @@ -266,7 +266,7 @@ static void _free_graphics_input(state_t *s) { s->pics = NULL; } -int game_init_sound(state_t *s, int sound_flags) { +int game_init_sound(EngineState *s, int sound_flags) { if (s->resmgr->sci_version >= SCI_VERSION_01) sound_flags |= SFX_STATE_FLAG_MULTIPLAY; @@ -290,7 +290,7 @@ static int suggested_script(resource_t *res, unsigned int classId) { return getInt16(res->data + offset); } -int test_cursor_style(state_t *s) { +int test_cursor_style(EngineState *s) { int resource_nr = 0; int ok = 0; @@ -301,7 +301,7 @@ int test_cursor_style(state_t *s) { return ok; } -int create_class_table_sci11(state_t *s) { +int create_class_table_sci11(EngineState *s) { int scriptnr; unsigned int seeker_offset; char *seeker_ptr; @@ -356,7 +356,7 @@ int create_class_table_sci11(state_t *s) { return 0; } -static int create_class_table_sci0(state_t *s) { +static int create_class_table_sci0(EngineState *s) { int scriptnr; unsigned int seeker; int classnr; @@ -441,7 +441,7 @@ static int create_class_table_sci0(state_t *s) { } // Architectural stuff: Init/Unintialize engine -int script_init_engine(state_t *s, sci_version_t version) { +int script_init_engine(EngineState *s, sci_version_t version) { int result; s->max_version = SCI_VERSION(9, 999, 999); @@ -531,11 +531,11 @@ int script_init_engine(state_t *s, sci_version_t version) { return 0; } -void script_set_gamestate_save_dir(state_t *s, const char *path) { +void script_set_gamestate_save_dir(EngineState *s, const char *path) { sys_string_set(s->sys_strings, SYS_STRING_SAVEDIR, path); } -void script_free_vm_memory(state_t *s) { +void script_free_vm_memory(EngineState *s) { int i; sciprintf("Freeing VM memory\n"); @@ -556,10 +556,10 @@ void script_free_vm_memory(state_t *s) { // exception fault whenever you try to close a never-opened file } -extern void free_kfunct_tables(state_t *s); +extern void free_kfunct_tables(EngineState *s); // From kernel.c -void script_free_engine(state_t *s) { +void script_free_engine(EngineState *s) { script_free_vm_memory(s); sciprintf("Freeing state-dependant data\n"); @@ -569,7 +569,7 @@ void script_free_engine(state_t *s) { _free_vocabulary(s); } -void script_free_breakpoints(state_t *s) { +void script_free_breakpoints(EngineState *s) { breakpoint_t *bp, *bp_next; // Free breakpoint list @@ -589,7 +589,7 @@ void script_free_breakpoints(state_t *s) { /* Game instance stuff: Init/Unitialize state-dependant data */ /*************************************************************/ -int game_init(state_t *s) { +int game_init(EngineState *s) { #ifdef __GNUC__XX # warning "Fixme: Use new VM instantiation code all over the place" #endif @@ -666,7 +666,7 @@ int game_init(state_t *s) { return 0; } -int game_exit(state_t *s) { +int game_exit(EngineState *s) { if (s->execution_stack) { free(s->execution_stack); } diff --git a/engines/sci/engine/gc.cpp b/engines/sci/engine/gc.cpp index dca06db94f..c1ce2bb8dc 100644 --- a/engines/sci/engine/gc.cpp +++ b/engines/sci/engine/gc.cpp @@ -129,7 +129,7 @@ void add_outgoing_refs(void *pre_wm, reg_t addr) { worklist_push(wm->worklist_ref, wm->nonnormal_map, addr); } -reg_t_hash_map *find_all_used_references(state_t *s) { +reg_t_hash_map *find_all_used_references(EngineState *s) { seg_manager_t *sm = &(s->seg_manager); seg_interface_t **interfaces = (seg_interface_t**)sci_calloc(sizeof(seg_interface_t *), sm->heap_size); reg_t_hash_map *nonnormal_map = new reg_t_hash_map(); @@ -253,7 +253,7 @@ void free_unless_used(void *pre_use_map, reg_t addr) { } -void run_gc(state_t *s) { +void run_gc(EngineState *s) { int seg_nr; deallocator_t deallocator; seg_manager_t *sm = &(s->seg_manager); diff --git a/engines/sci/engine/gc.h b/engines/sci/engine/gc.h index aa7b91264e..f255ea6c76 100644 --- a/engines/sci/engine/gc.h +++ b/engines/sci/engine/gc.h @@ -48,15 +48,15 @@ struct reg_t_Hash { // The reg_t_hash_map is actually really a hashset typedef Common::HashMap<reg_t, bool, reg_t_Hash, reg_t_EqualTo> reg_t_hash_map; -reg_t_hash_map *find_all_used_references(state_t *s); +reg_t_hash_map *find_all_used_references(EngineState *s); /* Finds all used references and normalises them to their memory addresses -** Parameters: (state_t *) s: The state to gather all information from +** Parameters: (EngineState *) s: The state to gather all information from ** Returns : (reg_t_hash_map *) A hash map containing entries for all used references */ -void run_gc(state_t *s); +void run_gc(EngineState *s); /* Runs garbage collection on the current system state -** Parameters: (state_t *) s: The state in which we should gc +** Parameters: (EngineState *) s: The state in which we should gc */ } // End of namespace Sci diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp index 8c07f0b2e0..23ec76067b 100644 --- a/engines/sci/engine/kernel.cpp +++ b/engines/sci/engine/kernel.cpp @@ -39,142 +39,142 @@ 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); -reg_t kReadNumber(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kStrCat(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kStrCmp(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kSetSynonyms(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kLock(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kPalette(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kNumCels(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kNumLoops(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kDrawCel(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kCoordPri(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kPriCoord(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kShakeScreen(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kSetCursor(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kMoveCursor(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kShow(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kPicNotValid(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kOnControl(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kDrawPic(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kGetPort(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kSetPort(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kNewWindow(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kDisposeWindow(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kCelWide(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kCelHigh(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kSetJump(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kDirLoop(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kDoAvoider(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kGetAngle(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kGetDistance(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kRandom(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kAbs(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kSqrt(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kTimesSin(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kTimesCos(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kCosMult(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kSinMult(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kTimesTan(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kTimesCot(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kCosDiv(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kSinDiv(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kValidPath(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kFOpen(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kFPuts(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kFGets(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kFClose(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kMapKeyToDir(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kGlobalToLocal(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kLocalToGlobal(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kWait(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kRestartGame(struct _state *s, int funct_nr, int argc, reg_t *argv); +reg_t kStrLen(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kGetFarText(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kReadNumber(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kStrCat(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kStrCmp(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kSetSynonyms(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kLock(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kPalette(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kNumCels(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kNumLoops(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kDrawCel(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kCoordPri(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kPriCoord(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kShakeScreen(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kSetCursor(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kMoveCursor(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kShow(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kPicNotValid(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kOnControl(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kDrawPic(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kGetPort(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kSetPort(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kNewWindow(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kDisposeWindow(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kCelWide(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kCelHigh(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kSetJump(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kDirLoop(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kDoAvoider(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kGetAngle(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kGetDistance(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kRandom(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kAbs(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kSqrt(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kTimesSin(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kTimesCos(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kCosMult(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kSinMult(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kTimesTan(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kTimesCot(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kCosDiv(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kSinDiv(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kValidPath(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kFOpen(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kFPuts(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kFGets(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kFClose(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kMapKeyToDir(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kGlobalToLocal(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kLocalToGlobal(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kWait(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kRestartGame(EngineState *s, int funct_nr, int argc, reg_t *argv); #ifdef WIN32 -reg_t kDeviceInfo_Win32(struct _state *s, int funct_nr, int argc, reg_t *argv); +reg_t kDeviceInfo_Win32(EngineState *s, int funct_nr, int argc, reg_t *argv); #else -reg_t kDeviceInfo_Unix(struct _state *s, int funct_nr, int argc, reg_t *argv); +reg_t kDeviceInfo_Unix(EngineState *s, int funct_nr, int argc, reg_t *argv); #endif -reg_t kGetEvent(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kCheckFreeSpace(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kFlushResources(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kGetSaveFiles(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kSetDebug(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kCheckSaveGame(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kSaveGame(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kRestoreGame(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kFileIO(struct _state *s, int funct_nr, int argc, reg_t *argp); -reg_t kGetTime(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kHaveMouse(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kJoystick(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kGameIsRestarting(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kGetCWD(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kSort(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kStrEnd(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kMemory(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kAvoidPath(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kParse(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kSaid(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kStrCpy(struct _state *s, int funct_nr, int argc, reg_t *argp); -reg_t kStrAt(struct _state *s, int funct_nr, int argc, reg_t *argp); -reg_t kEditControl(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kDrawControl(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kHiliteControl(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kClone(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kDisposeClone(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kCanBeHere(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kSetNowSeen(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kInitBresen(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kDoBresen(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kBaseSetter(struct _state *s, int funct_nr, int argc, reg_t *argp); -reg_t kAddToPic(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kAnimate(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kDisplay(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kGraph(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kFormat(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kDoSound(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kAddMenu(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kSetMenu(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kGetMenu(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kDrawStatus(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kDrawMenuBar(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kMenuSelect(struct _state *s, int funct_nr, int argc, reg_t *argv); - -reg_t kLoad(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kUnLoad(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kScriptID(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kDisposeScript(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kIsObject(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kRespondsTo(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kNewList(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kDisposeList(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kNewNode(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kFirstNode(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kLastNode(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kEmptyList(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kNextNode(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kPrevNode(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kNodeValue(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kAddAfter(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kAddToFront(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kAddToEnd(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kFindKey(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kDeleteKey(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kMemoryInfo(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kGetSaveDir(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kTextSize(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kIsItSkip(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kMessage(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t kDoAudio(struct _state *s, int funct_nr, int argc, reg_t *argv); -reg_t k_Unknown(struct _state *s, int funct_nr, int argc, reg_t *argv); +reg_t kGetEvent(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kCheckFreeSpace(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kFlushResources(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kGetSaveFiles(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kSetDebug(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kCheckSaveGame(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kSaveGame(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kRestoreGame(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kFileIO(EngineState *s, int funct_nr, int argc, reg_t *argp); +reg_t kGetTime(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kHaveMouse(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kJoystick(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kGameIsRestarting(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kGetCWD(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kSort(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kStrEnd(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kMemory(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kAvoidPath(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kParse(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kSaid(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kStrCpy(EngineState *s, int funct_nr, int argc, reg_t *argp); +reg_t kStrAt(EngineState *s, int funct_nr, int argc, reg_t *argp); +reg_t kEditControl(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kDrawControl(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kHiliteControl(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kClone(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kDisposeClone(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kCanBeHere(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kSetNowSeen(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kInitBresen(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kDoBresen(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kBaseSetter(EngineState *s, int funct_nr, int argc, reg_t *argp); +reg_t kAddToPic(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kAnimate(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kDisplay(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kGraph(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kFormat(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kDoSound(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kAddMenu(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kSetMenu(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kGetMenu(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kDrawStatus(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kDrawMenuBar(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kMenuSelect(EngineState *s, int funct_nr, int argc, reg_t *argv); + +reg_t kLoad(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kUnLoad(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kScriptID(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kDisposeScript(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kIsObject(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kRespondsTo(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kNewList(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kDisposeList(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kNewNode(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kFirstNode(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kLastNode(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kEmptyList(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kNextNode(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kPrevNode(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kNodeValue(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kAddAfter(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kAddToFront(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kAddToEnd(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kFindKey(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kDeleteKey(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kMemoryInfo(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kGetSaveDir(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kTextSize(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kIsItSkip(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kMessage(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t kDoAudio(EngineState *s, int funct_nr, int argc, reg_t *argv); +reg_t k_Unknown(EngineState *s, int funct_nr, int argc, reg_t *argv); // The Unknown/Unnamed kernel function -reg_t kstub(struct _state *s, int funct_nr, int argc, reg_t *argv); +reg_t kstub(EngineState *s, int funct_nr, int argc, reg_t *argv); // for unimplemented kernel functions -reg_t kNOP(struct _state *s, int funct_nr, int argc, reg_t *argv); +reg_t kNOP(EngineState *s, int funct_nr, int argc, reg_t *argv); // for kernel functions that don't do anything -reg_t kFsciEmu(struct _state *s, int funct_nr, int argc, reg_t *argv); +reg_t kFsciEmu(EngineState *s, int funct_nr, int argc, reg_t *argv); // Emulating "old" kernel functions on the heap @@ -354,7 +354,7 @@ sci_kernel_function_t kfunct_mappers[] = { static const char *argtype_description[] = { "Undetermined (WTF?)", "List", "Node", "Object", "Reference", "Arithmetic" }; -int kernel_oops(state_t *s, const char *file, int line, const char *reason) { +int kernel_oops(EngineState *s, const char *file, int line, const char *reason) { sciprintf("Kernel Oops in file %s, line %d: %s\n", file, line, reason); error("Kernel Oops in file %s, line %d: %s\n", file, line, reason); script_debug_flag = script_error_flag = 1; @@ -362,7 +362,7 @@ int kernel_oops(state_t *s, const char *file, int line, const char *reason) { } // Allocates a set amount of memory for a specified use and returns a handle to it. -reg_t kalloc(state_t *s, const char *type, int space) { +reg_t kalloc(EngineState *s, const char *type, int space) { reg_t reg; sm_alloc_hunk_entry(&s->seg_manager, type, space, ®); @@ -371,7 +371,7 @@ reg_t kalloc(state_t *s, const char *type, int space) { return reg; } -int has_kernel_function(state_t *s, const char *kname) { +int has_kernel_function(EngineState *s, const char *kname) { int i = 0; while (s->kernel_names[i]) { @@ -384,7 +384,7 @@ int has_kernel_function(state_t *s, const char *kname) { } // Returns a pointer to the memory indicated by the specified handle -byte *kmem(state_t *s, reg_t handle) { +byte *kmem(EngineState *s, reg_t handle) { mem_obj_t *mobj = GET_SEGMENT(s->seg_manager, handle.segment, MEM_OBJ_HUNK); hunk_table_t *ht = &(mobj->data.hunks); @@ -397,7 +397,7 @@ byte *kmem(state_t *s, reg_t handle) { } // Frees the specified handle. Returns 0 on success, 1 otherwise. -int kfree(state_t *s, reg_t handle) { +int kfree(EngineState *s, reg_t handle) { sm_free_hunk_entry(&s->seg_manager, handle); return 0; @@ -405,7 +405,7 @@ int kfree(state_t *s, reg_t handle) { char *old_save_dir; -reg_t kRestartGame(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kRestartGame(EngineState *s, int funct_nr, int argc, reg_t *argv) { char *deref_save_dir = (char*)kernel_dereference_bulk_pointer(s, s->save_dir_copy, 1); old_save_dir = strdup(deref_save_dir); @@ -419,7 +419,7 @@ reg_t kRestartGame(state_t *s, int funct_nr, int argc, reg_t *argv) { /* kGameIsRestarting(): ** Returns the restarting_flag in acc */ -reg_t kGameIsRestarting(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kGameIsRestarting(EngineState *s, int funct_nr, int argc, reg_t *argv) { char *deref_save_dir = (char*)kernel_dereference_bulk_pointer(s, s->save_dir_copy, 1); if (old_save_dir && deref_save_dir) { @@ -438,11 +438,11 @@ reg_t kGameIsRestarting(state_t *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; } -reg_t kHaveMouse(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kHaveMouse(EngineState *s, int funct_nr, int argc, reg_t *argv) { return make_reg(0, -1); } -reg_t kMemoryInfo(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kMemoryInfo(EngineState *s, int funct_nr, int argc, reg_t *argv) { switch (argv[0].offset) { case 0: // Total free heap memory case 1: // Largest heap block available @@ -458,7 +458,7 @@ reg_t kMemoryInfo(state_t *s, int funct_nr, int argc, reg_t *argv) { return NULL_REG; } -reg_t k_Unknown(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t k_Unknown(EngineState *s, int funct_nr, int argc, reg_t *argv) { if (funct_nr >= SCI_MAPPED_UNKNOWN_KFUNCTIONS_NR) { warning("Unhandled Unknown function %04x", funct_nr); return NULL_REG; @@ -474,14 +474,14 @@ reg_t k_Unknown(state_t *s, int funct_nr, int argc, reg_t *argv) { } } -reg_t kFlushResources(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kFlushResources(EngineState *s, int funct_nr, int argc, reg_t *argv) { run_gc(s); // FIXME: remove the Sci:: bit once this belongs to the Sci namespace debugC(2, Sci::kDebugLevelRoom, "Entering room number %d\n", UKPV(0)); return s->r_acc; } -reg_t kSetDebug(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kSetDebug(EngineState *s, int funct_nr, int argc, reg_t *argv) { sciprintf("Debug mode activated\n"); script_debug_flag = 1; // Enter debug mode @@ -494,7 +494,7 @@ reg_t kSetDebug(state_t *s, int funct_nr, int argc, reg_t *argv) { #define _K_NEW_GETTIME_TIME_24HOUR 2 #define _K_NEW_GETTIME_DATE 3 -reg_t kGetTime(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kGetTime(EngineState *s, int funct_nr, int argc, reg_t *argv) { struct tm* loc_time; GTimeVal time_prec; time_t the_time; @@ -583,7 +583,7 @@ reg_t kGetTime(state_t *s, int funct_nr, int argc, reg_t *argv) { #define K_MEMORY_PEEK 5 #define K_MEMORY_POKE 6 -reg_t kMemory(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kMemory(EngineState *s, int funct_nr, int argc, reg_t *argv) { switch (UKPV(0)) { case K_MEMORY_ALLOCATE_CRITICAL : if (!sm_alloc_dynmem(&s->seg_manager, UKPV(1), "kMemory() critical", &s->r_acc)) { @@ -656,7 +656,7 @@ reg_t kMemory(state_t *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; } -reg_t kstub(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kstub(EngineState *s, int funct_nr, int argc, reg_t *argv) { int i; warning("Unimplemented syscall: %s[%x](", s->kernel_names[funct_nr], funct_nr); @@ -670,7 +670,7 @@ reg_t kstub(state_t *s, int funct_nr, int argc, reg_t *argv) { return NULL_REG; } -reg_t kNOP(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kNOP(EngineState *s, int funct_nr, int argc, reg_t *argv) { const char *problem = (const char*)(s->kfunct_table[funct_nr].orig_name ? "unmapped" : "NOP"); warning("Warning: Kernel function 0x%02x invoked: %s", funct_nr, problem); @@ -764,7 +764,7 @@ void kernel_compile_signature(const char **s) { *s = result; // Write back } -int script_map_kernel(state_t *s) { +int script_map_kernel(EngineState *s) { int functnr; int mapped = 0; int ignored = 0; @@ -833,12 +833,12 @@ int script_map_kernel(state_t *s) { return 0; } -void free_kfunct_tables(state_t *s) { +void free_kfunct_tables(EngineState *s) { free(s->kfunct_table); s->kfunct_table = NULL; } -int determine_reg_type(state_t *s, reg_t reg, int allow_invalid) { +int determine_reg_type(EngineState *s, reg_t reg, int allow_invalid) { mem_obj_t *mobj; if (!reg.segment) { @@ -920,7 +920,7 @@ const char *kernel_argtype_description(int type) { return argtype_description[sci_ffs(type)]; } -int kernel_matches_signature(state_t *s, const char *sig, int argc, reg_t *argv) { +int kernel_matches_signature(EngineState *s, const char *sig, int argc, reg_t *argv) { if (!sig) return 1; @@ -955,7 +955,7 @@ int kernel_matches_signature(state_t *s, const char *sig, int argc, reg_t *argv) return (*sig == 0 || (*sig & KSIG_ELLIPSIS)); } -static inline void *_kernel_dereference_pointer(struct _state *s, reg_t pointer, int entries, int align) { +static inline void *_kernel_dereference_pointer(EngineState *s, reg_t pointer, int entries, int align) { int maxsize; void *retval = sm_dereference(&s->seg_manager, pointer, &maxsize); @@ -972,11 +972,11 @@ static inline void *_kernel_dereference_pointer(struct _state *s, reg_t pointer, } -byte *kernel_dereference_bulk_pointer(struct _state *s, reg_t pointer, int entries) { +byte *kernel_dereference_bulk_pointer(EngineState *s, reg_t pointer, int entries) { return (byte*)_kernel_dereference_pointer(s, pointer, entries, 1); } -reg_t *kernel_dereference_reg_pointer(struct _state *s, reg_t pointer, int entries) { +reg_t *kernel_dereference_reg_pointer(EngineState *s, reg_t pointer, int entries) { return (reg_t*)_kernel_dereference_pointer(s, pointer, entries, sizeof(reg_t)); } diff --git a/engines/sci/engine/kernel_types.h b/engines/sci/engine/kernel_types.h index 1572d6f652..7065b595a6 100644 --- a/engines/sci/engine/kernel_types.h +++ b/engines/sci/engine/kernel_types.h @@ -64,18 +64,18 @@ namespace Sci { #define KSIG_ALLOW_INV 0x20 #define KSIG_INVALID KSIG_ALLOW_INV -int kernel_matches_signature(state_t *s, const char *sig, int argc, reg_t *argv); +int kernel_matches_signature(EngineState *s, const char *sig, int argc, reg_t *argv); /* Determines whether a list of registers matches a given signature -** Parameters: (state_t *) s: The state to operate on +** Parameters: (EngineState *) s: The state to operate on ** (char *) sig: The signature to test against ** (int) argc: Number of arguments to test ** (reg_t *) argv: Argument list ** Returns : (int) 0 iff the signature was not matched */ -int determine_reg_type(state_t *s, reg_t reg, int allow_invalid); +int determine_reg_type(EngineState *s, reg_t reg, int allow_invalid); /* Determines the type of the object indicated by reg -** Parameters: (state_t *) s: The state to operate on +** Parameters: (EngineState *) s: The state to operate on ** (reg_t) reg: The register to check ** (int) allow_invalid: Allow invalid pointer values ** Returns : one of KSIG_* below KSIG_NULL. diff --git a/engines/sci/engine/kevent.cpp b/engines/sci/engine/kevent.cpp index 4769bb1529..5723a72115 100644 --- a/engines/sci/engine/kevent.cpp +++ b/engines/sci/engine/kevent.cpp @@ -31,7 +31,7 @@ int stop_on_event; #define SCI_VARIABLE_GAME_SPEED 3 -reg_t kGetEvent(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kGetEvent(EngineState *s, int funct_nr, int argc, reg_t *argv) { int mask = UKPV(0); reg_t obj = argv[1]; sci_event_t e; @@ -143,7 +143,7 @@ reg_t kGetEvent(state_t *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; } -reg_t kMapKeyToDir(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kMapKeyToDir(EngineState *s, int funct_nr, int argc, reg_t *argv) { reg_t obj = argv[0]; if (GET_SEL32V(obj, type) == SCI_EVT_KEYBOARD) { // Keyboard @@ -191,7 +191,7 @@ reg_t kMapKeyToDir(state_t *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; } -reg_t kGlobalToLocal(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kGlobalToLocal(EngineState *s, int funct_nr, int argc, reg_t *argv) { reg_t obj = argc ? argv[0] : NULL_REG; // Can this really happen? Lars if (obj.segment) { @@ -206,7 +206,7 @@ reg_t kGlobalToLocal(state_t *s, int funct_nr, int argc, reg_t *argv) { } -reg_t kLocalToGlobal(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kLocalToGlobal(EngineState *s, int funct_nr, int argc, reg_t *argv) { reg_t obj = argc ? argv[0] : NULL_REG; // Can this really happen? Lars if (obj.segment) { @@ -220,7 +220,7 @@ reg_t kLocalToGlobal(state_t *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; } -reg_t kJoystick(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kJoystick(EngineState *s, int funct_nr, int argc, reg_t *argv) { warning("Unimplemented syscall 'Joystick()"); return NULL_REG; } diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp index bc3e9d9d11..e246af9094 100644 --- a/engines/sci/engine/kfile.cpp +++ b/engines/sci/engine/kfile.cpp @@ -58,7 +58,7 @@ static struct _savegame_index_struct { ** to the working directory. Returns NULL if the file didn't exist. ** Otherwise, the new file is then opened for reading or writing. */ -static FILE *f_open_mirrored(state_t *s, char *fname) { +static FILE *f_open_mirrored(EngineState *s, char *fname) { int fd; char *buf = NULL; int fsize; @@ -137,7 +137,7 @@ static FILE *f_open_mirrored(state_t *s, char *fname) { #define _K_FILE_MODE_OPEN_OR_FAIL 1 #define _K_FILE_MODE_CREATE 2 -void file_open(state_t *s, char *filename, int mode) { +void file_open(EngineState *s, char *filename, int mode) { int retval = 1; // Ignore file_handles[0] FILE *file = NULL; @@ -176,7 +176,7 @@ void file_open(state_t *s, char *filename, int mode) { s->r_acc = make_reg(0, retval); } -reg_t kFOpen(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kFOpen(EngineState *s, int funct_nr, int argc, reg_t *argv) { char *name = kernel_dereference_char_pointer(s, argv[0], 0); int mode = UKPV(1); @@ -184,7 +184,7 @@ reg_t kFOpen(state_t *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; } -static FILE *getFileFromHandle(state_t *s, int handle) { +static FILE *getFileFromHandle(EngineState *s, int handle) { if (handle == 0) { error("Attempt to use file handle 0\n"); return 0; @@ -198,7 +198,7 @@ static FILE *getFileFromHandle(state_t *s, int handle) { return s->file_handles[handle]; } -void file_close(state_t *s, int handle) { +void file_close(EngineState *s, int handle) { SCIkdebug(SCIkFILE, "Closing file %d\n", handle); FILE *f = getFileFromHandle(s, handle); @@ -210,12 +210,12 @@ void file_close(state_t *s, int handle) { s->file_handles[handle] = NULL; } -reg_t kFClose(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kFClose(EngineState *s, int funct_nr, int argc, reg_t *argv) { file_close(s, UKPV(0)); return s->r_acc; } -void fputs_wrapper(state_t *s, int handle, int size, char *data) { +void fputs_wrapper(EngineState *s, int handle, int size, char *data) { SCIkdebug(SCIkFILE, "FPuts'ing \"%s\" to handle %d\n", data, handle); FILE *f = getFileFromHandle(s, handle); @@ -223,7 +223,7 @@ void fputs_wrapper(state_t *s, int handle, int size, char *data) { fwrite(data, 1, size, f); } -void fwrite_wrapper(state_t *s, int handle, char *data, int length) { +void fwrite_wrapper(EngineState *s, int handle, char *data, int length) { SCIkdebug(SCIkFILE, "fwrite()'ing \"%s\" to handle %d\n", data, handle); FILE *f = getFileFromHandle(s, handle); @@ -231,7 +231,7 @@ void fwrite_wrapper(state_t *s, int handle, char *data, int length) { fwrite(data, 1, length, f); } -reg_t kFPuts(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kFPuts(EngineState *s, int funct_nr, int argc, reg_t *argv) { int handle = UKPV(0); char *data = kernel_dereference_char_pointer(s, argv[1], 0); @@ -239,7 +239,7 @@ reg_t kFPuts(state_t *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; } -static void fgets_wrapper(state_t *s, char *dest, int maxsize, int handle) { +static void fgets_wrapper(EngineState *s, char *dest, int maxsize, int handle) { SCIkdebug(SCIkFILE, "FGets'ing %d bytes from handle %d\n", maxsize, handle); FILE *f = getFileFromHandle(s, handle); @@ -251,7 +251,7 @@ static void fgets_wrapper(state_t *s, char *dest, int maxsize, int handle) { SCIkdebug(SCIkFILE, "FGets'ed \"%s\"\n", dest); } -static void fread_wrapper(state_t *s, char *dest, int bytes, int handle) { +static void fread_wrapper(EngineState *s, char *dest, int bytes, int handle) { SCIkdebug(SCIkFILE, "fread()'ing %d bytes from handle %d\n", bytes, handle); FILE *f = getFileFromHandle(s, handle); @@ -261,7 +261,7 @@ static void fread_wrapper(state_t *s, char *dest, int bytes, int handle) { s->r_acc = make_reg(0, fread(dest, 1, bytes, f)); } -static void fseek_wrapper(state_t *s, int handle, int offset, int whence) { +static void fseek_wrapper(EngineState *s, int handle, int offset, int whence) { FILE *f = getFileFromHandle(s, handle); if (!f) return; @@ -271,7 +271,7 @@ static void fseek_wrapper(state_t *s, int handle, int offset, int whence) { #define TEST_DIR_OR_QUIT(dir) if (!dir) { return NULL_REG; } -reg_t kFGets(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kFGets(EngineState *s, int funct_nr, int argc, reg_t *argv) { char *dest = kernel_dereference_char_pointer(s, argv[0], 0); int maxsize = UKPV(1); int handle = UKPV(2); @@ -283,7 +283,7 @@ reg_t kFGets(state_t *s, int funct_nr, int argc, reg_t *argv) { /* kGetCWD(address): ** Writes the cwd to the supplied address and returns the address in acc. */ -reg_t kGetCWD(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kGetCWD(EngineState *s, int funct_nr, int argc, reg_t *argv) { char *wd = sci_getcwd(); char *targetaddr = kernel_dereference_char_pointer(s, argv[0], 0); @@ -296,7 +296,7 @@ reg_t kGetCWD(state_t *s, int funct_nr, int argc, reg_t *argv) { return argv[0]; } -void delete_savegame(state_t *s, int savedir_nr) { +void delete_savegame(EngineState *s, int savedir_nr) { Common::String filename = ((Sci::SciEngine*)g_engine)->getSavegameName(savedir_nr); sciprintf("Deleting savegame '%s'\n", filename.c_str()); @@ -314,7 +314,7 @@ void delete_savegame(state_t *s, int savedir_nr) { #ifdef WIN32 -reg_t kDeviceInfo_Win32(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kDeviceInfo_Win32(EngineState *s, int funct_nr, int argc, reg_t *argv) { char dir_buffer[MAXPATHLEN], dir_buffer2[MAXPATHLEN]; int mode = UKPV(0); @@ -388,7 +388,7 @@ reg_t kDeviceInfo_Win32(state_t *s, int funct_nr, int argc, reg_t *argv) { #else // !WIN32 -reg_t kDeviceInfo_Unix(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kDeviceInfo_Unix(EngineState *s, int funct_nr, int argc, reg_t *argv) { int mode = UKPV(0); switch (mode) { @@ -451,11 +451,11 @@ reg_t kDeviceInfo_Unix(state_t *s, int funct_nr, int argc, reg_t *argv) { #endif // !WIN32 -reg_t kGetSaveDir(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kGetSaveDir(EngineState *s, int funct_nr, int argc, reg_t *argv) { return make_reg(s->sys_strings_segment, SYS_STRING_SAVEDIR); } -reg_t kCheckFreeSpace(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kCheckFreeSpace(EngineState *s, int funct_nr, int argc, reg_t *argv) { char *path = kernel_dereference_char_pointer(s, argv[0], 0); char *testpath = (char*)sci_malloc(strlen(path) + 15); char buf[1024]; @@ -551,7 +551,7 @@ static void update_savegame_indices() { qsort(_savegame_indices, _savegame_indices_nr, sizeof(struct _savegame_index_struct), _savegame_index_struct_compare); } -reg_t kCheckSaveGame(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kCheckSaveGame(EngineState *s, int funct_nr, int argc, reg_t *argv) { //char *game_id = kernel_dereference_char_pointer(s, argv[0], 0); int savedir_nr = UKPV(1); @@ -587,7 +587,7 @@ reg_t kCheckSaveGame(state_t *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; } -reg_t kGetSaveFiles(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kGetSaveFiles(EngineState *s, int funct_nr, int argc, reg_t *argv) { //char *game_id = kernel_dereference_char_pointer(s, argv[0], 0); char *nametarget = kernel_dereference_char_pointer(s, argv[1], 0); reg_t nametarget_base = argv[1]; @@ -639,7 +639,7 @@ reg_t kGetSaveFiles(state_t *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; } -reg_t kSaveGame(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kSaveGame(EngineState *s, int funct_nr, int argc, reg_t *argv) { //char *game_id = (char*)kernel_dereference_bulk_pointer(s, argv[0], 0); int savedir_nr = UKPV(1); int savedir_id; // Savegame ID, derived from savedir_nr and the savegame ID list @@ -709,7 +709,7 @@ reg_t kSaveGame(state_t *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; } -reg_t kRestoreGame(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kRestoreGame(EngineState *s, int funct_nr, int argc, reg_t *argv) { char *game_id = (char*)kernel_dereference_bulk_pointer(s, argv[0], 0); int savedir_nr = UKPV(1); @@ -727,7 +727,7 @@ reg_t kRestoreGame(state_t *s, int funct_nr, int argc, reg_t *argv) { if ((in = saveFileMan->openForLoading(filename.c_str()))) { // found a savegame file - state_t *newstate = gamestate_restore(s, in); + EngineState *newstate = gamestate_restore(s, in); delete in; if (newstate) { @@ -748,7 +748,7 @@ reg_t kRestoreGame(state_t *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; } -reg_t kValidPath(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kValidPath(EngineState *s, int funct_nr, int argc, reg_t *argv) { char *pathname = kernel_dereference_char_pointer(s, argv[0], 0); char cpath[MAXPATHLEN + 1]; getcwd(cpath, MAXPATHLEN + 1); @@ -771,7 +771,7 @@ reg_t kValidPath(state_t *s, int funct_nr, int argc, reg_t *argv) { #define K_FILEIO_FIND_NEXT 9 #define K_FILEIO_STAT 10 -char * write_filename_to_mem(state_t *s, reg_t address, char *string) { +char * write_filename_to_mem(EngineState *s, reg_t address, char *string) { char *mem = kernel_dereference_char_pointer(s, address, 0); if (string) { @@ -782,14 +782,14 @@ char * write_filename_to_mem(state_t *s, reg_t address, char *string) { return string; } -void next_file(state_t *s) { +void next_file(EngineState *s) { if (write_filename_to_mem(s, s->dirseeker_outbuffer, sci_find_next(&(s->dirseeker)))) s->r_acc = s->dirseeker_outbuffer; else s->r_acc = NULL_REG; } -void first_file(state_t *s, const char *dir, char *mask, reg_t buffer) { +void first_file(EngineState *s, const char *dir, char *mask, reg_t buffer) { if (!buffer.segment) { sciprintf("Warning: first_file(state,\"%s\",\"%s\", 0) invoked", dir, mask); s->r_acc = NULL_REG; @@ -814,7 +814,7 @@ void first_file(state_t *s, const char *dir, char *mask, reg_t buffer) { s->r_acc = NULL_REG; } -reg_t kFileIO(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kFileIO(EngineState *s, int funct_nr, int argc, reg_t *argv) { int func_nr = UKPV(0); switch (func_nr) { diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 97a7d392cf..100f63cfb4 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -114,7 +114,7 @@ static inline int sign_extend_byte(int value) { return value; } -static void assert_primary_widget_lists(state_t *s) { +static void assert_primary_widget_lists(EngineState *s) { if (!s->dyn_views) { rect_t bounds = s->picture_port->bounds; @@ -132,7 +132,7 @@ static void assert_primary_widget_lists(state_t *s) { } } -static void reparentize_primary_widget_lists(state_t *s, gfxw_port_t *newport) { +static void reparentize_primary_widget_lists(EngineState *s, gfxw_port_t *newport) { if (!newport) newport = s->picture_port; @@ -143,7 +143,7 @@ static void reparentize_primary_widget_lists(state_t *s, gfxw_port_t *newport) { } } -int _find_view_priority(state_t *s, int y) { +int _find_view_priority(EngineState *s, int y) { /*if (s->version <= SCI_VERSION_LTU_PRIORITY_OB1) ++y; */ @@ -161,7 +161,7 @@ int _find_view_priority(state_t *s, int y) { } } -int _find_priority_band(state_t *s, int nr) { +int _find_priority_band(EngineState *s, int nr) { if (s->version >= SCI_VERSION_FTU_PRIORITY_14_ZONES && (nr < 0 || nr > 14)) { if (nr == 15) return 0xffff; @@ -192,7 +192,7 @@ int _find_priority_band(state_t *s, int nr) { } } -reg_t graph_save_box(state_t *s, rect_t area) { +reg_t graph_save_box(EngineState *s, rect_t area) { reg_t handle = kalloc(s, "graph_save_box()", sizeof(gfxw_snapshot_t *)); gfxw_snapshot_t **ptr = (gfxw_snapshot_t **) kmem(s, handle); @@ -201,7 +201,7 @@ reg_t graph_save_box(state_t *s, rect_t area) { return handle; } -void graph_restore_box(state_t *s, reg_t handle) { +void graph_restore_box(EngineState *s, reg_t handle) { gfxw_snapshot_t **ptr; int port_nr = s->port->ID; @@ -264,7 +264,7 @@ void graph_restore_box(state_t *s, reg_t handle) { static gfx_pixmap_color_t white = {GFX_COLOR_INDEX_UNMAPPED, 255, 255, 255}; -gfx_pixmap_color_t *get_pic_color(state_t *s, int color) { +gfx_pixmap_color_t *get_pic_color(EngineState *s, int color) { if (s->resmgr->sci_version < SCI_VERSION_01_VGA) return &(s->ega_colors[color].visual); @@ -279,7 +279,7 @@ gfx_pixmap_color_t *get_pic_color(state_t *s, int color) { } } -static gfx_color_t graph_map_color(state_t *s, int color, int priority, int control) { +static gfx_color_t graph_map_color(EngineState *s, int color, int priority, int control) { gfx_color_t retval; if (s->resmgr->sci_version < SCI_VERSION_01_VGA) { @@ -297,7 +297,7 @@ static gfx_color_t graph_map_color(state_t *s, int color, int priority, int cont return retval; } -reg_t kSetCursor_SCI11(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kSetCursor_SCI11(EngineState *s, int funct_nr, int argc, reg_t *argv) { switch (argc) { case 1 : if (UKPV(0) == 0) { @@ -340,7 +340,7 @@ reg_t kSetCursor_SCI11(state_t *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; } -reg_t kSetCursor(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kSetCursor(EngineState *s, int funct_nr, int argc, reg_t *argv) { if (s->version >= SCI_VERSION(1, 001, 000) || has_kernel_function(s, "MoveCursor")) { return kSetCursor_SCI11(s, funct_nr, argc, argv); @@ -365,7 +365,7 @@ reg_t kSetCursor(state_t *s, int funct_nr, int argc, reg_t *argv) { extern int oldx, oldy; -reg_t kMoveCursor(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kMoveCursor(EngineState *s, int funct_nr, int argc, reg_t *argv) { Common::Point newpos; static Common::Point oldpos(0, 0); @@ -398,7 +398,7 @@ static inline void _ascertain_port_contents(gfxw_port_t *port) { port->contents = (gfxw_widget_t *) gfxw_new_list(port->bounds, 0); } -reg_t kShow(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kShow(EngineState *s, int funct_nr, int argc, reg_t *argv) { int old_map = s->pic_visible_map; s->pic_visible_map = (gfx_map_mask_t) UKPV_OR_ALT(0, 1); @@ -428,7 +428,7 @@ reg_t kShow(state_t *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; } -reg_t kPicNotValid(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kPicNotValid(EngineState *s, int funct_nr, int argc, reg_t *argv) { s->r_acc = make_reg(0, s->pic_not_valid); if (argc) s->pic_not_valid = (byte)UKPV(0); @@ -436,7 +436,7 @@ reg_t kPicNotValid(state_t *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; } -void _k_redraw_box(state_t *s, int x1, int y1, int x2, int y2) { +void _k_redraw_box(EngineState *s, int x1, int y1, int x2, int y2) { sciprintf("_k_redraw_box(): Unimplemented"); #if 0 int i; @@ -461,7 +461,7 @@ void _k_redraw_box(state_t *s, int x1, int y1, int x2, int y2) { #endif } -void _k_graph_rebuild_port_with_color(state_t *s, gfx_color_t newbgcolor) { +void _k_graph_rebuild_port_with_color(EngineState *s, gfx_color_t newbgcolor) { gfxw_port_t *port = s->port; gfxw_port_t *newport; @@ -487,7 +487,7 @@ static int activated_icon_bar; static int port_origin_x; static int port_origin_y; -reg_t kGraph(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kGraph(EngineState *s, int funct_nr, int argc, reg_t *argv) { rect_t area; gfxw_port_t *port = s->port; int redraw_port = 0; @@ -613,7 +613,7 @@ reg_t kGraph(state_t *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; } -reg_t kTextSize(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kTextSize(EngineState *s, int funct_nr, int argc, reg_t *argv) { int width, height; char *text = argv[1].segment ? (char *) kernel_dereference_bulk_pointer(s, argv[1], 0) : NULL; reg_t *dest = kernel_dereference_reg_pointer(s, argv[0], 4); @@ -644,7 +644,7 @@ reg_t kTextSize(state_t *s, int funct_nr, int argc, reg_t *argv) { int debug_sleeptime_factor = 1; -reg_t kWait(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kWait(EngineState *s, int funct_nr, int argc, reg_t *argv) { GTimeVal time; int sleep_time = UKPV(0); @@ -663,19 +663,19 @@ reg_t kWait(state_t *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; } -reg_t kCoordPri(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kCoordPri(EngineState *s, int funct_nr, int argc, reg_t *argv) { int y = SKPV(0); return make_reg(0, VIEW_PRIORITY(y)); } -reg_t kPriCoord(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kPriCoord(EngineState *s, int funct_nr, int argc, reg_t *argv) { int priority = SKPV(0); return make_reg(0, PRIORITY_BAND_FIRST(priority)); } -void _k_dirloop(reg_t obj, word angle, state_t *s, int funct_nr, int argc, reg_t *argv) { +void _k_dirloop(reg_t obj, word angle, EngineState *s, int funct_nr, int argc, reg_t *argv) { int view = GET_SEL32V(obj, view); int signal = GET_SEL32V(obj, signal); int loop; @@ -720,7 +720,7 @@ void _k_dirloop(reg_t obj, word angle, state_t *s, int funct_nr, int argc, reg_t PUT_SEL32V(obj, loop, loop); } -reg_t kDirLoop(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kDirLoop(EngineState *s, int funct_nr, int argc, reg_t *argv) { _k_dirloop(argv[0], UKPV(1), s, funct_nr, argc, argv); return s->r_acc; @@ -729,13 +729,13 @@ reg_t kDirLoop(state_t *s, int funct_nr, int argc, reg_t *argv) { #define GASEOUS_VIEW_MASK_ACTIVE (_K_VIEW_SIG_FLAG_REMOVE | _K_VIEW_SIG_FLAG_IGNORE_ACTOR) #define GASEOUS_VIEW_MASK_PASSIVE (_K_VIEW_SIG_FLAG_NO_UPDATE | _K_VIEW_SIG_FLAG_REMOVE | _K_VIEW_SIG_FLAG_IGNORE_ACTOR) -abs_rect_t set_base(struct _state *s, reg_t object); +abs_rect_t set_base(EngineState *s, reg_t object); -inline abs_rect_t get_nsrect(struct _state *s, reg_t object, byte clip); +inline abs_rect_t get_nsrect(EngineState *s, reg_t object, byte clip); -static inline abs_rect_t nsrect_clip(state_t *s, int y, abs_rect_t retval, int priority); +static inline abs_rect_t nsrect_clip(EngineState *s, int y, abs_rect_t retval, int priority); -static int collides_with(state_t *s, abs_rect_t area, reg_t other_obj, int use_nsrect, int view_mask, int funct_nr, int argc, reg_t *argv) { +static int collides_with(EngineState *s, abs_rect_t area, reg_t other_obj, int use_nsrect, int view_mask, int funct_nr, int argc, reg_t *argv) { int other_signal = GET_SEL32V(other_obj, signal); int other_priority = GET_SEL32V(other_obj, priority); int y = GET_SEL32SV(other_obj, y); @@ -775,7 +775,7 @@ static int collides_with(state_t *s, abs_rect_t area, reg_t other_obj, int use_n return 0; } -reg_t kCanBeHere(state_t *s, int funct_nr, int argc, reg_t * argv) { +reg_t kCanBeHere(EngineState *s, int funct_nr, int argc, reg_t * argv) { reg_t obj = argv[0]; reg_t cliplist_ref = KP_ALT(1, NULL_REG); list_t *cliplist = NULL; @@ -868,7 +868,7 @@ reg_t kCanBeHere(state_t *s, int funct_nr, int argc, reg_t * argv) { return not_register(s, make_reg(0, retval)); } // CanBeHere -reg_t kIsItSkip(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kIsItSkip(EngineState *s, int funct_nr, int argc, reg_t *argv) { int view = SKPV(0); int loop = SKPV(1); int cel = SKPV(2); @@ -891,7 +891,7 @@ reg_t kIsItSkip(state_t *s, int funct_nr, int argc, reg_t *argv) { return make_reg(0, pxm->index_data[y * pxm->index_xl + x] == pxm->color_key); } -reg_t kCelHigh(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kCelHigh(EngineState *s, int funct_nr, int argc, reg_t *argv) { int view = SKPV(0); int loop = SKPV(1); int cel = SKPV(2); @@ -909,7 +909,7 @@ reg_t kCelHigh(state_t *s, int funct_nr, int argc, reg_t *argv) { return make_reg(0, height); } -reg_t kCelWide(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kCelWide(EngineState *s, int funct_nr, int argc, reg_t *argv) { int view = SKPV(0); int loop = SKPV(1); int cel = SKPV(2); @@ -927,7 +927,7 @@ reg_t kCelWide(state_t *s, int funct_nr, int argc, reg_t *argv) { return make_reg(0, width); } -reg_t kNumLoops(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kNumLoops(EngineState *s, int funct_nr, int argc, reg_t *argv) { reg_t obj = argv[0]; int view = GET_SEL32V(obj, view); int loops_nr = gfxop_lookup_view_get_loops(s->gfx_state, view); @@ -942,7 +942,7 @@ reg_t kNumLoops(state_t *s, int funct_nr, int argc, reg_t *argv) { return make_reg(0, loops_nr); } -reg_t kNumCels(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kNumCels(EngineState *s, int funct_nr, int argc, reg_t *argv) { reg_t obj = argv[0]; int loop = GET_SEL32V(obj, loop); int view = GET_SEL32V(obj, view); @@ -961,7 +961,7 @@ reg_t kNumCels(state_t *s, int funct_nr, int argc, reg_t *argv) { return make_reg(0, cel + 1); } -reg_t kOnControl(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kOnControl(EngineState *s, int funct_nr, int argc, reg_t *argv) { int arg = 0; gfx_map_mask_t map; int xstart, ystart; @@ -985,11 +985,11 @@ reg_t kOnControl(state_t *s, int funct_nr, int argc, reg_t *argv) { return make_reg(0, gfxop_scan_bitmask(s->gfx_state, gfx_rect(xstart, ystart + 10, xlen, ylen), map)); } -void _k_view_list_free_backgrounds(state_t *s, view_object_t *list, int list_nr); +void _k_view_list_free_backgrounds(EngineState *s, view_object_t *list, int list_nr); int sci01_priority_table_flags = 0; -reg_t kDrawPic(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kDrawPic(EngineState *s, int funct_nr, int argc, reg_t *argv) { int pic_nr = SKPV(0); int add_to_pic = 1; int palette = SKPV_OR_ALT(3, 0); @@ -1085,7 +1085,7 @@ reg_t kDrawPic(state_t *s, int funct_nr, int argc, reg_t *argv) { } -abs_rect_t set_base(state_t *s, reg_t object) { +abs_rect_t set_base(EngineState *s, reg_t object) { int x, y, original_y, z, ystep, xsize, ysize; int xbase, ybase, xend, yend; int view, loop, cel; @@ -1147,7 +1147,7 @@ abs_rect_t set_base(state_t *s, reg_t object) { return retval; } -void _k_base_setter(state_t *s, reg_t object) { +void _k_base_setter(EngineState *s, reg_t object) { abs_rect_t absrect = set_base(s, object); if (lookup_selector(s, object, s->selector_map.brLeft, NULL, NULL) != SELECTOR_VARIABLE) @@ -1162,7 +1162,7 @@ void _k_base_setter(state_t *s, reg_t object) { PUT_SEL32V(object, brBottom, absrect.yend); } -reg_t kBaseSetter(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kBaseSetter(EngineState *s, int funct_nr, int argc, reg_t *argv) { reg_t object = argv[0]; _k_base_setter(s, object); @@ -1170,7 +1170,7 @@ reg_t kBaseSetter(state_t *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; } // kBaseSetter -static inline abs_rect_t nsrect_clip(state_t *s, int y, abs_rect_t retval, int priority) { +static inline abs_rect_t nsrect_clip(EngineState *s, int y, abs_rect_t retval, int priority) { int pri_top; if (priority == -1) @@ -1188,7 +1188,7 @@ static inline abs_rect_t nsrect_clip(state_t *s, int y, abs_rect_t retval, int p return retval; } -inline abs_rect_t calculate_nsrect(state_t *s, int x, int y, int view, int loop, int cel) { +inline abs_rect_t calculate_nsrect(EngineState *s, int x, int y, int view, int loop, int cel) { int xbase, ybase, xend, yend, xsize, ysize; int xmod = 0, ymod = 0; abs_rect_t retval = {0, 0, 0, 0}; @@ -1217,7 +1217,7 @@ inline abs_rect_t calculate_nsrect(state_t *s, int x, int y, int view, int loop, return retval; } -inline abs_rect_t get_nsrect(state_t *s, reg_t object, byte clip) { +inline abs_rect_t get_nsrect(EngineState *s, reg_t object, byte clip) { int x, y, z; int view, loop, cel; abs_rect_t retval; @@ -1246,7 +1246,7 @@ inline abs_rect_t get_nsrect(state_t *s, reg_t object, byte clip) { return retval; } -static void _k_set_now_seen(state_t *s, reg_t object) { +static void _k_set_now_seen(EngineState *s, reg_t object) { abs_rect_t absrect = get_nsrect(s, object, 0); if (lookup_selector(s, object, s->selector_map.nsTop, NULL, NULL) != SELECTOR_VARIABLE) { @@ -1259,7 +1259,7 @@ static void _k_set_now_seen(state_t *s, reg_t object) { PUT_SEL32V(object, nsBottom, absrect.yend); } -reg_t kSetNowSeen(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kSetNowSeen(EngineState *s, int funct_nr, int argc, reg_t *argv) { reg_t object = argv[0]; _k_set_now_seen(s, object); @@ -1267,7 +1267,7 @@ reg_t kSetNowSeen(state_t *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; } // kSetNowSeen -reg_t kPalette(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kPalette(EngineState *s, int funct_nr, int argc, reg_t *argv) { switch (UKPV(0)) { case 5 : { int r = UKPV(1); @@ -1304,9 +1304,9 @@ reg_t kPalette(state_t *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; } -static void _k_draw_control(state_t *s, reg_t obj, int inverse); +static void _k_draw_control(EngineState *s, reg_t obj, int inverse); -static void _k_disable_delete_for_now(state_t *s, reg_t obj) { +static void _k_disable_delete_for_now(EngineState *s, reg_t obj) { reg_t text_pos = GET_SEL32(obj, text); char *text = IS_NULL_REG(text_pos) ? NULL : (char *) sm_dereference(&s->seg_manager, text_pos, NULL); int type = GET_SEL32V(obj, type); @@ -1318,7 +1318,7 @@ static void _k_disable_delete_for_now(state_t *s, reg_t obj) { } } -reg_t kDrawControl(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kDrawControl(EngineState *s, int funct_nr, int argc, reg_t *argv) { reg_t obj = argv[0]; _k_disable_delete_for_now(s, obj); @@ -1327,7 +1327,7 @@ reg_t kDrawControl(state_t *s, int funct_nr, int argc, reg_t *argv) { return NULL_REG; } -reg_t kHiliteControl(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kHiliteControl(EngineState *s, int funct_nr, int argc, reg_t *argv) { reg_t obj = argv[0]; _k_draw_control(s, obj, 1); @@ -1357,7 +1357,7 @@ void update_cursor_limits(int *display_offset, int *cursor, int max_displayed) { --textlen; \ } -reg_t kEditControl(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kEditControl(EngineState *s, int funct_nr, int argc, reg_t *argv) { reg_t obj = argv[0]; reg_t event = argv[1]; @@ -1536,7 +1536,7 @@ reg_t kEditControl(state_t *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; } -static void _k_draw_control(state_t *s, reg_t obj, int inverse) { +static void _k_draw_control(EngineState *s, reg_t obj, int inverse) { int x = GET_SEL32SV(obj, nsLeft); int y = GET_SEL32SV(obj, nsTop); int xl = GET_SEL32SV(obj, nsRight) - x; @@ -1655,7 +1655,7 @@ static void _k_draw_control(state_t *s, reg_t obj, int inverse) { } -static void draw_rect_to_control_map(state_t *s, abs_rect_t abs_zone) { +static void draw_rect_to_control_map(EngineState *s, abs_rect_t abs_zone) { gfxw_box_t *box; gfx_color_t color; @@ -1671,7 +1671,7 @@ static void draw_rect_to_control_map(state_t *s, abs_rect_t abs_zone) { ADD_TO_CURRENT_PICTURE_PORT(box); } -static inline void draw_obj_to_control_map(state_t *s, gfxw_dyn_view_t *view) { +static inline void draw_obj_to_control_map(EngineState *s, gfxw_dyn_view_t *view) { reg_t obj = make_reg(view->ID, view->subID); if (!is_object(s, obj)) @@ -1683,7 +1683,7 @@ static inline void draw_obj_to_control_map(state_t *s, gfxw_dyn_view_t *view) { } } -static void _k_view_list_do_postdraw(state_t *s, gfxw_list_t *list) { +static void _k_view_list_do_postdraw(EngineState *s, gfxw_list_t *list) { gfxw_dyn_view_t *widget = (gfxw_dyn_view_t *) list->contents; while (widget) { @@ -1744,7 +1744,7 @@ static void _k_view_list_do_postdraw(state_t *s, gfxw_list_t *list) { } } -void _k_view_list_mark_free(state_t *s, reg_t off) { +void _k_view_list_mark_free(EngineState *s, reg_t off) { if (s->dyn_views) { gfxw_dyn_view_t *w = (gfxw_dyn_view_t *) s->dyn_views->contents; @@ -1762,7 +1762,7 @@ void _k_view_list_mark_free(state_t *s, reg_t off) { static int _k_animate_ran = 0; -int _k_view_list_dispose_loop(state_t *s, list_t *list, gfxw_dyn_view_t *widget, int funct_nr, int argc, reg_t *argv) { +int _k_view_list_dispose_loop(EngineState *s, list_t *list, gfxw_dyn_view_t *widget, int funct_nr, int argc, reg_t *argv) { // disposes all list members flagged for disposal; funct_nr is the invoking kfunction // returns non-zero IFF views were dropped int signal; @@ -1852,7 +1852,7 @@ int _k_view_list_dispose_loop(state_t *s, list_t *list, gfxw_dyn_view_t *widget, #define _K_MAKE_VIEW_LIST_CALC_PRIORITY 2 #define _K_MAKE_VIEW_LIST_DRAW_TO_CONTROL_MAP 4 -static gfxw_dyn_view_t *_k_make_dynview_obj(state_t *s, reg_t obj, int options, int nr, int funct_nr, int argc, reg_t *argv) { +static gfxw_dyn_view_t *_k_make_dynview_obj(EngineState *s, reg_t obj, int options, int nr, int funct_nr, int argc, reg_t *argv) { short oldloop, oldcel; int cel, loop, view_nr = GET_SEL32SV(obj, view); int palette; @@ -1930,7 +1930,7 @@ static gfxw_dyn_view_t *_k_make_dynview_obj(state_t *s, reg_t obj, int options, } } -static void _k_make_view_list(state_t *s, gfxw_list_t **widget_list, list_t *list, int options, int funct_nr, int argc, reg_t *argv) { +static void _k_make_view_list(EngineState *s, gfxw_list_t **widget_list, list_t *list, int options, int funct_nr, int argc, reg_t *argv) { /* Creates a view_list from a node list in heap space. Returns the list, stores the ** number of list entries in *list_nr. Calls doit for each entry if cycle is set. ** argc, argv, funct_nr should be the same as in the calling kernel function. @@ -1991,7 +1991,7 @@ static void _k_make_view_list(state_t *s, gfxw_list_t **widget_list, list_t *lis } } -static void _k_prepare_view_list(state_t *s, gfxw_list_t *list, int options) { +static void _k_prepare_view_list(EngineState *s, gfxw_list_t *list, int options) { gfxw_dyn_view_t *view = (gfxw_dyn_view_t *) list->contents; while (view) { reg_t obj = make_reg(view->ID, view->subID); @@ -2121,7 +2121,7 @@ static void _k_view_list_kryptonize(gfxw_widget_t *v) { } } -static void _k_raise_topmost_in_view_list(state_t *s, gfxw_list_t *list, gfxw_dyn_view_t *view) { +static void _k_raise_topmost_in_view_list(EngineState *s, gfxw_list_t *list, gfxw_dyn_view_t *view) { if (view) { gfxw_dyn_view_t *next = (gfxw_dyn_view_t *)view->next; @@ -2150,7 +2150,7 @@ static void _k_raise_topmost_in_view_list(state_t *s, gfxw_list_t *list, gfxw_dy } } -static void _k_redraw_view_list(state_t *s, gfxw_list_t *list) { +static void _k_redraw_view_list(EngineState *s, gfxw_list_t *list) { gfxw_dyn_view_t *view = (gfxw_dyn_view_t *) list->contents; while (view) { @@ -2201,7 +2201,7 @@ static void _k_redraw_view_list(state_t *s, gfxw_list_t *list) { // Draw as picviews #define _K_DRAW_VIEW_LIST_PICVIEW 8 -void _k_draw_view_list(state_t *s, gfxw_list_t *list, int flags) { +void _k_draw_view_list(EngineState *s, gfxw_list_t *list, int flags) { // Draws list_nr members of list to s->pic. gfxw_dyn_view_t *widget = (gfxw_dyn_view_t *) list->contents; @@ -2245,7 +2245,7 @@ void _k_draw_view_list(state_t *s, gfxw_list_t *list, int flags) { } -reg_t kAddToPic(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kAddToPic(EngineState *s, int funct_nr, int argc, reg_t *argv) { gfxw_list_t *pic_views; reg_t list_ref = argv[0]; @@ -2304,11 +2304,11 @@ reg_t kAddToPic(state_t *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; } -reg_t kGetPort(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kGetPort(EngineState *s, int funct_nr, int argc, reg_t *argv) { return make_reg(0, s->port->ID); } -reg_t kSetPort(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kSetPort(EngineState *s, int funct_nr, int argc, reg_t *argv) { if (activated_icon_bar && argc == 6) { port_origin_x = port_origin_y = 0; activated_icon_bar = 0; @@ -2366,7 +2366,7 @@ reg_t kSetPort(state_t *s, int funct_nr, int argc, reg_t *argv) { return NULL_REG; } -static inline void add_to_chrono(state_t *s, gfxw_widget_t *widget) { +static inline void add_to_chrono(EngineState *s, gfxw_widget_t *widget) { gfxw_port_t *chrono_port; gfxw_list_t *tw; @@ -2377,7 +2377,7 @@ static inline void add_to_chrono(state_t *s, gfxw_widget_t *widget) { ADD_TO_CURRENT_PORT(chrono_port); } -reg_t kDrawCel(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kDrawCel(EngineState *s, int funct_nr, int argc, reg_t *argv) { int view = SKPV(0); int loop = SKPV(1); int cel = SKPV(2); @@ -2413,7 +2413,7 @@ reg_t kDrawCel(state_t *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; } -reg_t kDisposeWindow(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kDisposeWindow(EngineState *s, int funct_nr, int argc, reg_t *argv) { unsigned int goner_nr = SKPV(0); gfxw_port_t *goner; gfxw_port_t *pred; @@ -2453,7 +2453,7 @@ reg_t kDisposeWindow(state_t *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; } -reg_t kNewWindow(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kNewWindow(EngineState *s, int funct_nr, int argc, reg_t *argv) { gfxw_port_t *window; int x, y, xl, yl, flags; gfx_color_t bgcolor; @@ -2553,7 +2553,7 @@ reg_t kNewWindow(state_t *s, int funct_nr, int argc, reg_t *argv) { #define GRAPH_UPDATE_BOX(s, x, y, xl, yl) GFX_ASSERT(gfxop_draw_pixmap(s->gfx_state, newscreen, \ gfx_rect(x, (((y) < 10)? 10 : (y)) - 10, xl, (((y) < 10)? ((y) - 10) : 0) + (yl)), Common::Point(x, ((y) < 10)? 10 : (y) ))); -static void animate_do_animation(state_t *s, int funct_nr, int argc, reg_t *argv) { +static void animate_do_animation(EngineState *s, int funct_nr, int argc, reg_t *argv) { int i, remaining_checkers; int update_counter; int granularity0 = s->animation_granularity << 1; @@ -2935,7 +2935,7 @@ static void animate_do_animation(state_t *s, int funct_nr, int argc, reg_t *argv s->old_screen = NULL; } -reg_t kAnimate(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kAnimate(EngineState *s, int funct_nr, int argc, reg_t *argv) { // Animations are supposed to take a maximum of s->animation_delay milliseconds. reg_t cast_list_ref = KP_ALT(0, NULL_REG); int cycle = (KP_ALT(1, NULL_REG)).offset; @@ -3045,7 +3045,7 @@ reg_t kAnimate(state_t *s, int funct_nr, int argc, reg_t *argv) { #define SHAKE_DOWN 1 #define SHAKE_RIGHT 2 -reg_t kShakeScreen(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kShakeScreen(EngineState *s, int funct_nr, int argc, reg_t *argv) { int shakes = SKPV_OR_ALT(0, 1); int directions = SKPV_OR_ALT(1, 1); gfx_pixmap_t *screen = gfxop_grab_pixmap(s->gfx_state, gfx_rect(0, 0, 320, 200)); @@ -3093,7 +3093,7 @@ reg_t kShakeScreen(state_t *s, int funct_nr, int argc, reg_t *argv) { #define K_DISPLAY_RESTORE_UNDER 108 #define K_DONT_UPDATE_IMMEDIATELY 121 -reg_t kDisplay(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kDisplay(EngineState *s, int funct_nr, int argc, reg_t *argv) { int argpt; reg_t textp = argv[0]; int index = UKPV_OR_ALT(1, 0); diff --git a/engines/sci/engine/klists.cpp b/engines/sci/engine/klists.cpp index cc0072be84..e7194010fc 100644 --- a/engines/sci/engine/klists.cpp +++ b/engines/sci/engine/klists.cpp @@ -32,7 +32,7 @@ namespace Sci { # define LOOKUP_NODE(addr) inline_lookup_node(s, (addr), __FILE__, __LINE__) #endif -inline node_t *inline_lookup_node(state_t *s, reg_t addr, const char *file, int line) { +inline node_t *inline_lookup_node(EngineState *s, reg_t addr, const char *file, int line) { mem_obj_t *mobj; node_table_t *nt; @@ -57,13 +57,13 @@ inline node_t *inline_lookup_node(state_t *s, reg_t addr, const char *file, int return &(nt->table[addr.offset].entry); } -node_t *lookup_node(state_t *s, reg_t addr, const char *file, int line) { +node_t *lookup_node(EngineState *s, reg_t addr, const char *file, int line) { return inline_lookup_node(s, addr, file, line); } #define LOOKUP_NULL_LIST(addr) _lookup_list(s, addr, __FILE__, __LINE__, 1) -inline list_t *_lookup_list(state_t *s, reg_t addr, const char *file, int line, int may_be_null) { +inline list_t *_lookup_list(EngineState *s, reg_t addr, const char *file, int line, int may_be_null) { mem_obj_t *mobj; list_table_t *lt; @@ -89,7 +89,7 @@ inline list_t *_lookup_list(state_t *s, reg_t addr, const char *file, int line, return &(lt->table[addr.offset].entry); } -list_t *lookup_list(state_t *s, reg_t addr, const char *file, int line) { +list_t *lookup_list(EngineState *s, reg_t addr, const char *file, int line) { return _lookup_list(s, addr, file, line, 0); } @@ -100,7 +100,7 @@ list_t *lookup_list(state_t *s, reg_t addr, const char *file, int line) { #else -static inline int sane_nodep(state_t *s, reg_t addr) { +static inline int sane_nodep(EngineState *s, reg_t addr) { int have_prev = 0; reg_t prev = addr; @@ -121,7 +121,7 @@ static inline int sane_nodep(state_t *s, reg_t addr) { return 1; } -int sane_listp(state_t *s, reg_t addr) { +int sane_listp(EngineState *s, reg_t addr) { list_t *l = LOOKUP_LIST(addr); int empties = 0; @@ -156,7 +156,7 @@ int sane_listp(state_t *s, reg_t addr) { } #endif -reg_t kNewList(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kNewList(EngineState *s, int funct_nr, int argc, reg_t *argv) { reg_t listbase; list_t *l; l = sm_alloc_list(&s->seg_manager, &listbase); @@ -166,7 +166,7 @@ reg_t kNewList(state_t *s, int funct_nr, int argc, reg_t *argv) { return listbase; // Return list base address } -reg_t kDisposeList(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kDisposeList(EngineState *s, int funct_nr, int argc, reg_t *argv) { list_t *l = LOOKUP_LIST(argv[0]); if (!l) { @@ -192,7 +192,7 @@ reg_t kDisposeList(state_t *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; } -inline reg_t _k_new_node(state_t *s, reg_t value, reg_t key) { +inline reg_t _k_new_node(EngineState *s, reg_t value, reg_t key) { reg_t nodebase; node_t *n = sm_alloc_node(&s->seg_manager, &nodebase); @@ -208,7 +208,7 @@ inline reg_t _k_new_node(state_t *s, reg_t value, reg_t key) { return nodebase; } -reg_t kNewNode(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kNewNode(EngineState *s, int funct_nr, int argc, reg_t *argv) { s->r_acc = _k_new_node(s, argv[0], argv[1]); SCIkdebug(SCIkNODES, "New nodebase at "PREG"\n", PRINT_REG(s->r_acc)); @@ -216,7 +216,7 @@ reg_t kNewNode(state_t *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; } -reg_t kFirstNode(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kFirstNode(EngineState *s, int funct_nr, int argc, reg_t *argv) { list_t *l = LOOKUP_NULL_LIST(argv[0]); if (l && !sane_listp(s, argv[0])) @@ -228,7 +228,7 @@ reg_t kFirstNode(state_t *s, int funct_nr, int argc, reg_t *argv) { return NULL_REG; } -reg_t kLastNode(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kLastNode(EngineState *s, int funct_nr, int argc, reg_t *argv) { list_t *l = LOOKUP_LIST(argv[0]); if (l && !sane_listp(s, argv[0])) @@ -240,7 +240,7 @@ reg_t kLastNode(state_t *s, int funct_nr, int argc, reg_t *argv) { return NULL_REG; } -reg_t kEmptyList(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kEmptyList(EngineState *s, int funct_nr, int argc, reg_t *argv) { list_t *l = LOOKUP_LIST(argv[0]); if (!l || !sane_listp(s, argv[0])) @@ -249,7 +249,7 @@ reg_t kEmptyList(state_t *s, int funct_nr, int argc, reg_t *argv) { return make_reg(0, ((l) ? IS_NULL_REG(l->first) : 0)); } -inline void _k_add_to_front(state_t *s, reg_t listbase, reg_t nodebase) { +inline void _k_add_to_front(EngineState *s, reg_t listbase, reg_t nodebase) { list_t *l = LOOKUP_LIST(listbase); node_t *new_n = LOOKUP_NODE(nodebase); @@ -272,7 +272,7 @@ inline void _k_add_to_front(state_t *s, reg_t listbase, reg_t nodebase) { l->first = nodebase; } -inline void _k_add_to_end(state_t *s, reg_t listbase, reg_t nodebase) { +inline void _k_add_to_end(EngineState *s, reg_t listbase, reg_t nodebase) { list_t *l = LOOKUP_LIST(listbase); node_t *new_n = LOOKUP_NODE(nodebase); @@ -295,7 +295,7 @@ inline void _k_add_to_end(state_t *s, reg_t listbase, reg_t nodebase) { l->last = nodebase; } -reg_t kNextNode(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kNextNode(EngineState *s, int funct_nr, int argc, reg_t *argv) { node_t *n = LOOKUP_NODE(argv[0]); if (!sane_nodep(s, argv[0])) { error("List node at "PREG" is not sane anymore", PRINT_REG(argv[0])); @@ -306,7 +306,7 @@ reg_t kNextNode(state_t *s, int funct_nr, int argc, reg_t *argv) { return n->succ; } -reg_t kPrevNode(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kPrevNode(EngineState *s, int funct_nr, int argc, reg_t *argv) { node_t *n = LOOKUP_NODE(argv[0]); if (!sane_nodep(s, argv[0])) error("List node at "PREG" is not sane anymore", PRINT_REG(argv[0])); @@ -314,7 +314,7 @@ reg_t kPrevNode(state_t *s, int funct_nr, int argc, reg_t *argv) { return n->pred; } -reg_t kNodeValue(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kNodeValue(EngineState *s, int funct_nr, int argc, reg_t *argv) { node_t *n = LOOKUP_NODE(argv[0]); if (!sane_nodep(s, argv[0])) { error("List node at "PREG" is not sane", PRINT_REG(argv[0])); @@ -325,12 +325,12 @@ reg_t kNodeValue(state_t *s, int funct_nr, int argc, reg_t *argv) { return n->value; } -reg_t kAddToFront(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kAddToFront(EngineState *s, int funct_nr, int argc, reg_t *argv) { _k_add_to_front(s, argv[0], argv[1]); return s->r_acc; } -reg_t kAddAfter(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kAddAfter(EngineState *s, int funct_nr, int argc, reg_t *argv) { list_t *l = LOOKUP_LIST(argv[0]); node_t *firstnode = IS_NULL_REG(argv[1]) ? NULL : LOOKUP_NODE(argv[1]); node_t *newnode = LOOKUP_NODE(argv[2]); @@ -369,12 +369,12 @@ reg_t kAddAfter(state_t *s, int funct_nr, int argc, reg_t *argv) { } } -reg_t kAddToEnd(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kAddToEnd(EngineState *s, int funct_nr, int argc, reg_t *argv) { _k_add_to_end(s, argv[0], argv[1]); return s->r_acc; } -reg_t kFindKey(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kFindKey(EngineState *s, int funct_nr, int argc, reg_t *argv) { reg_t node_pos; reg_t key = argv[1]; reg_t list_pos = argv[0]; @@ -403,7 +403,7 @@ reg_t kFindKey(state_t *s, int funct_nr, int argc, reg_t *argv) { return NULL_REG; } -reg_t kDeleteKey(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kDeleteKey(EngineState *s, int funct_nr, int argc, reg_t *argv) { reg_t node_pos = kFindKey(s, funct_nr, 2, argv); node_t *n; list_t *l = LOOKUP_LIST(argv[0]); @@ -445,7 +445,7 @@ int sort_temp_cmp(const void *p1, const void *p2) { return 0; } -reg_t kSort(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kSort(EngineState *s, int funct_nr, int argc, reg_t *argv) { reg_t source = argv[0]; reg_t dest = argv[1]; reg_t order_func = argv[2]; diff --git a/engines/sci/engine/kmath.cpp b/engines/sci/engine/kmath.cpp index 85b3f3d020..d0695cb0e1 100644 --- a/engines/sci/engine/kmath.cpp +++ b/engines/sci/engine/kmath.cpp @@ -27,18 +27,18 @@ namespace Sci { -reg_t kRandom(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kRandom(EngineState *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)))); } -reg_t kAbs(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kAbs(EngineState *s, int funct_nr, int argc, reg_t *argv) { // This is a hack, but so is the code in Hoyle1 that needs it. if (argv[0].segment) return make_reg(0, 0x3e8); // Yes people, this is an object return make_reg(0, abs(SKPV(0))); } -reg_t kSqrt(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kSqrt(EngineState *s, int funct_nr, int argc, reg_t *argv) { return make_reg(0, (gint16) sqrt((float) abs(SKPV(0)))); } @@ -62,7 +62,7 @@ int get_angle(int xrel, int yrel) { } } -reg_t kGetAngle(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kGetAngle(EngineState *s, int funct_nr, int argc, reg_t *argv) { // Based on behavior observed with a test program created with // SCI Studio. int x1 = SKPV(0); @@ -99,28 +99,28 @@ reg_t kGetAngle(state_t *s, int funct_nr, int argc, reg_t *argv) { return make_reg(0, angle); } -reg_t kGetDistance(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kGetDistance(EngineState *s, int funct_nr, int argc, reg_t *argv) { int xrel = (int)(((float) SKPV(1) - SKPV_OR_ALT(3, 0)) / cos(SKPV_OR_ALT(5, 0) * PI / 180.0)); // This works because cos(0)==1 int yrel = SKPV(0) - SKPV_OR_ALT(2, 0); return make_reg(0, (gint16)sqrt((float) xrel*xrel + yrel*yrel)); } -reg_t kTimesSin(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kTimesSin(EngineState *s, int funct_nr, int argc, reg_t *argv) { int angle = SKPV(0); int factor = SKPV(1); return make_reg(0, (int)(factor * 1.0 * sin(angle * PI / 180.0))); } -reg_t kTimesCos(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kTimesCos(EngineState *s, int funct_nr, int argc, reg_t *argv) { int angle = SKPV(0); int factor = SKPV(1); return make_reg(0, (int)(factor * 1.0 * cos(angle * PI / 180.0))); } -reg_t kCosDiv(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kCosDiv(EngineState *s, int funct_nr, int argc, reg_t *argv) { int angle = SKPV(0); int value = SKPV(1); double cosval = cos(angle * PI / 180.0); @@ -132,7 +132,7 @@ reg_t kCosDiv(state_t *s, int funct_nr, int argc, reg_t *argv) { return make_reg(0, (gint16)(value / cosval)); } -reg_t kSinDiv(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kSinDiv(EngineState *s, int funct_nr, int argc, reg_t *argv) { int angle = SKPV(0); int value = SKPV(1); double sinval = sin(angle * PI / 180.0); @@ -144,7 +144,7 @@ reg_t kSinDiv(state_t *s, int funct_nr, int argc, reg_t *argv) { return make_reg(0, (gint16)(value / sinval)); } -reg_t kTimesTan(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kTimesTan(EngineState *s, int funct_nr, int argc, reg_t *argv) { int param = SKPV(0); int scale = SKPV_OR_ALT(1, 1); @@ -156,7 +156,7 @@ reg_t kTimesTan(state_t *s, int funct_nr, int argc, reg_t *argv) { return make_reg(0, (gint16) - (tan(param * PI / 180.0) * scale)); } -reg_t kTimesCot(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kTimesCot(EngineState *s, int funct_nr, int argc, reg_t *argv) { int param = SKPV(0); int scale = SKPV_OR_ALT(1, 1); diff --git a/engines/sci/engine/kmenu.cpp b/engines/sci/engine/kmenu.cpp index efd1a2d035..21374f555d 100644 --- a/engines/sci/engine/kmenu.cpp +++ b/engines/sci/engine/kmenu.cpp @@ -30,7 +30,7 @@ namespace Sci { reg_t -kAddMenu(state_t *s, int funct_nr, int argc, reg_t *argv) { +kAddMenu(EngineState *s, int funct_nr, int argc, reg_t *argv) { char *name = kernel_dereference_char_pointer(s, argv[0], 0); char *contents = kernel_dereference_char_pointer(s, argv[1], 0); @@ -43,7 +43,7 @@ kAddMenu(state_t *s, int funct_nr, int argc, reg_t *argv) { reg_t -kSetMenu(state_t *s, int funct_nr, int argc, reg_t *argv) { +kSetMenu(EngineState *s, int funct_nr, int argc, reg_t *argv) { int index = UKPV(0); int i = 2; @@ -56,7 +56,7 @@ kSetMenu(state_t *s, int funct_nr, int argc, reg_t *argv) { } reg_t -kGetMenu(state_t *s, int funct_nr, int argc, reg_t *argv) { +kGetMenu(EngineState *s, int funct_nr, int argc, reg_t *argv) { int index = UKPV(0); return menubar_get_attribute(s, (index >> 8) - 1, (index & 0xff) - 1, UKPV(1)); @@ -64,7 +64,7 @@ kGetMenu(state_t *s, int funct_nr, int argc, reg_t *argv) { reg_t -kDrawStatus(state_t *s, int funct_nr, int argc, reg_t *argv) { +kDrawStatus(EngineState *s, int funct_nr, int argc, reg_t *argv) { reg_t text = argv[0]; int fgcolor = SKPV_OR_ALT(1, s->status_bar_foreground); int bgcolor = SKPV_OR_ALT(2, s->status_bar_background); @@ -94,7 +94,7 @@ kDrawStatus(state_t *s, int funct_nr, int argc, reg_t *argv) { reg_t -kDrawMenuBar(state_t *s, int funct_nr, int argc, reg_t *argv) { +kDrawMenuBar(EngineState *s, int funct_nr, int argc, reg_t *argv) { if (SKPV(0)) sciw_set_menubar(s, s->titlebar_port, s->menubar, -1); @@ -203,7 +203,7 @@ static struct { void -about_freesci(state_t *s) { +about_freesci(EngineState *s) { int page; gfxw_port_t *port; int bodyfont, titlefont; @@ -287,7 +287,7 @@ about_freesci(state_t *s) { static inline int -_menu_go_down(state_t *s, int menu_nr, int item_nr) { +_menu_go_down(EngineState *s, int menu_nr, int item_nr) { int seeker, max = s->menubar->menus[menu_nr].items_nr; seeker = item_nr + 1; @@ -305,7 +305,7 @@ _menu_go_down(state_t *s, int menu_nr, int item_nr) { reg_t -kMenuSelect(state_t *s, int funct_nr, int argc, reg_t *argv) { +kMenuSelect(EngineState *s, int funct_nr, int argc, reg_t *argv) { reg_t event = argv[0]; /*int pause_sound = UKPV_OR_ALT(1, 1);*/ /* FIXME: Do this eventually */ int claimed = 0; diff --git a/engines/sci/engine/kmovement.cpp b/engines/sci/engine/kmovement.cpp index a49162ba99..7f212cabe2 100644 --- a/engines/sci/engine/kmovement.cpp +++ b/engines/sci/engine/kmovement.cpp @@ -65,7 +65,7 @@ Still, what we compute in the end is of course not a real velocity anymore, but used in an iterative stepping algorithm */ -reg_t kSetJump(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kSetJump(EngineState *s, int funct_nr, int argc, reg_t *argv) { // Input data reg_t object = argv[0]; int dx = SKPV(1); @@ -162,7 +162,7 @@ reg_t kSetJump(state_t *s, int funct_nr, int argc, reg_t *argv) { #define _K_BRESEN_AXIS_X 0 #define _K_BRESEN_AXIS_Y 1 -void initialize_bresen(state_t *s, int funct_nr, int argc, reg_t *argv, reg_t mover, int step_factor, int deltax, int deltay) { +void initialize_bresen(EngineState *s, int funct_nr, int argc, reg_t *argv, reg_t mover, int step_factor, int deltax, int deltay) { reg_t client = GET_SEL32(mover, client); int stepx = GET_SEL32SV(client, xStep) * step_factor; int stepy = GET_SEL32SV(client, yStep) * step_factor; @@ -215,7 +215,7 @@ void initialize_bresen(state_t *s, int funct_nr, int argc, reg_t *argv, reg_t mo PUT_SEL32V(mover, b_i2, bdi * 2); } -reg_t kInitBresen(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kInitBresen(EngineState *s, int funct_nr, int argc, reg_t *argv) { reg_t mover = argv[0]; reg_t client = GET_SEL32(mover, client); @@ -236,7 +236,7 @@ static enum { UNINITIALIZED } handle_movecnt = UNINITIALIZED; -int parse_reg_t(state_t *s, const char *str, reg_t *dest); +int parse_reg_t(EngineState *s, const char *str, reg_t *dest); static int checksum_bytes(byte *data, int size) { int result = 0; @@ -250,7 +250,7 @@ static int checksum_bytes(byte *data, int size) { return result; } -static void bresenham_autodetect(state_t *s) { +static void bresenham_autodetect(EngineState *s) { reg_t motion_class; if (!parse_reg_t(s, "?Motion", &motion_class)) { @@ -279,7 +279,7 @@ static void bresenham_autodetect(state_t *s) { } } -reg_t kDoBresen(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kDoBresen(EngineState *s, int funct_nr, int argc, reg_t *argv) { reg_t mover = argv[0]; reg_t client = GET_SEL32(mover, client); @@ -384,11 +384,11 @@ reg_t kDoBresen(state_t *s, int funct_nr, int argc, reg_t *argv) { return make_reg(0, completed); } -extern void _k_dirloop(reg_t obj, word angle, state_t *s, int funct_nr, int argc, reg_t *argv); -int is_heap_object(state_t *s, reg_t pos); +extern void _k_dirloop(reg_t obj, word angle, EngineState *s, int funct_nr, int argc, reg_t *argv); +int is_heap_object(EngineState *s, reg_t pos); extern int get_angle(int xrel, int yrel); -reg_t kDoAvoider(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kDoAvoider(EngineState *s, int funct_nr, int argc, reg_t *argv) { reg_t avoider = argv[0]; reg_t client, looper, mover; int angle; diff --git a/engines/sci/engine/kpathing.cpp b/engines/sci/engine/kpathing.cpp index f097371ed6..222231e009 100644 --- a/engines/sci/engine/kpathing.cpp +++ b/engines/sci/engine/kpathing.cpp @@ -172,7 +172,7 @@ static Common::Point read_point(unsigned char *list, int is_reg_t, int offset) { return point; } -static void draw_line(state_t *s, Common::Point p1, Common::Point p2, int type) { +static void draw_line(EngineState *s, Common::Point p1, Common::Point p2, int type) { // Colors for polygon debugging. // Green: Total access // Red : Barred access @@ -199,7 +199,7 @@ static void draw_line(state_t *s, Common::Point p1, Common::Point p2, int type) decorations->add((gfxw_container_t *)decorations, (gfxw_widget_t *)line); } -static void draw_point(state_t *s, Common::Point p, int start) { +static void draw_point(EngineState *s, Common::Point p, int start) { // Colors for starting and end point // Green: End point // Blue: Starting point @@ -221,7 +221,7 @@ static void draw_point(state_t *s, Common::Point p, int start) { decorations->add((gfxw_container_t *) decorations, (gfxw_widget_t *) box); } -static void draw_polygon(state_t *s, reg_t polygon) { +static void draw_polygon(EngineState *s, reg_t polygon) { reg_t points = GET_SEL32(polygon, points); int size = KP_UINT(GET_SEL32(polygon, size)); int type = KP_UINT(GET_SEL32(polygon, type)); @@ -241,7 +241,7 @@ static void draw_polygon(state_t *s, reg_t polygon) { draw_line(s, prev, first, type % 3); } -static void draw_input(state_t *s, reg_t poly_list, Common::Point start, Common::Point end, int opt) { +static void draw_input(EngineState *s, reg_t poly_list, Common::Point start, Common::Point end, int opt) { list_t *list; node_t *node; @@ -266,7 +266,7 @@ static void draw_input(state_t *s, reg_t poly_list, Common::Point start, Common: } } -static void print_polygon(state_t *s, reg_t polygon) { +static void print_polygon(EngineState *s, reg_t polygon) { reg_t points = GET_SEL32(polygon, points); int size = KP_UINT(GET_SEL32(polygon, size)); int type = KP_UINT(GET_SEL32(polygon, type)); @@ -286,7 +286,7 @@ static void print_polygon(state_t *s, reg_t polygon) { sciprintf(" (%i, %i);\n", point.x, point.y); } -static void print_input(state_t *s, reg_t poly_list, Common::Point start, Common::Point end, int opt) { +static void print_input(EngineState *s, reg_t poly_list, Common::Point start, Common::Point end, int opt) { list_t *list; node_t *node; @@ -1077,9 +1077,9 @@ static vertex_t *merge_point(pf_state_t *s, Common::Point v) { return v_new; } -static polygon_t *convert_polygon(state_t *s, reg_t polygon) { +static polygon_t *convert_polygon(EngineState *s, reg_t polygon) { // Converts an SCI polygon into a polygon_t - // Parameters: (state_t *) s: The game state + // Parameters: (EngineState *) s: The game state // (reg_t) polygon: The SCI polygon to convert // Returns : (polygon_t *) The converted polygon int i; @@ -1153,9 +1153,9 @@ static void change_polygons_opt_0(pf_state_t *s) { } } -static pf_state_t *convert_polygon_set(state_t *s, reg_t poly_list, Common::Point start, Common::Point end, int opt) { +static pf_state_t *convert_polygon_set(EngineState *s, reg_t poly_list, Common::Point start, Common::Point end, int opt) { // Converts the SCI input data for pathfinding - // Parameters: (state_t *) s: The game state + // Parameters: (EngineState *) s: The game state // (reg_t) poly_list: Polygon list // (Common::Point) start: The start point // (Common::Point) end: The end point @@ -1366,10 +1366,10 @@ static void dijkstra(pf_state_t *s) { } } -static reg_t output_path(pf_state_t *p, state_t *s) { +static reg_t output_path(pf_state_t *p, EngineState *s) { // Stores the final path in newly allocated dynmem // Parameters: (pf_state_t *) p: The pathfinding state - // (state_t *) s: The game state + // (EngineState *) s: The game state // Returns : (reg_t) Pointer to dynmem containing path int path_len = 0; byte *oref; @@ -1439,7 +1439,7 @@ static reg_t output_path(pf_state_t *p, state_t *s) { return output; } -reg_t kAvoidPath(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kAvoidPath(EngineState *s, int funct_nr, int argc, reg_t *argv) { Common::Point start = Common::Point(SKPV(0), SKPV(1)); if (s->debug_mode & (1 << SCIkAVOIDPATH_NR)) { diff --git a/engines/sci/engine/kscripts.cpp b/engines/sci/engine/kscripts.cpp index 87b7787b60..2f2b914370 100644 --- a/engines/sci/engine/kscripts.cpp +++ b/engines/sci/engine/kscripts.cpp @@ -29,7 +29,7 @@ namespace Sci { -reg_t read_selector(state_t *s, reg_t object, selector_t selector_id, const char *file, int line) { +reg_t read_selector(EngineState *s, reg_t object, selector_t selector_id, const char *file, int line) { reg_t *address; if (lookup_selector(s, object, selector_id, &address, NULL) != SELECTOR_VARIABLE) @@ -38,7 +38,7 @@ reg_t read_selector(state_t *s, reg_t object, selector_t selector_id, const char return *address; } -void write_selector(state_t *s, reg_t object, selector_t selector_id, reg_t value, const char *fname, int line) { +void write_selector(EngineState *s, reg_t object, selector_t selector_id, reg_t value, const char *fname, int line) { reg_t *address; if ((selector_id < 0) || (selector_id > s->selector_names_nr)) { @@ -54,7 +54,7 @@ void write_selector(state_t *s, reg_t object, selector_t selector_id, reg_t valu *address = value; } -int invoke_selector(state_t *s, reg_t object, int selector_id, int noinvalid, int kfunct, +int invoke_selector(EngineState *s, reg_t object, int selector_id, int noinvalid, int kfunct, stack_ptr_t k_argp, int k_argc, const char *fname, int line, int argc, ...) { va_list argp; int i; @@ -106,13 +106,13 @@ int invoke_selector(state_t *s, reg_t object, int selector_id, int noinvalid, in return 0; } -bool is_object(state_t *s, reg_t object) { +bool is_object(EngineState *s, reg_t object) { return obj_get(s, object) != NULL; } // Loads arbitrary resources of type 'restype' with resource numbers 'resnrs' // This implementation ignores all resource numbers except the first one. -reg_t kLoad(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kLoad(EngineState *s, int funct_nr, int argc, reg_t *argv) { int restype = KP_UINT(argv[0]); int resnr = KP_UINT(argv[1]); @@ -122,7 +122,7 @@ reg_t kLoad(state_t *s, int funct_nr, int argc, reg_t *argv) { return make_reg(0, ((restype << 11) | resnr)); // Return the resource identifier as handle } -reg_t kLock(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kLock(EngineState *s, int funct_nr, int argc, reg_t *argv) { int restype = UKPV(0) & 0x7f; int resnr = UKPV(1); int state = argc > 2 ? UKPV(2) : 1; @@ -142,7 +142,7 @@ reg_t kLock(state_t *s, int funct_nr, int argc, reg_t *argv) { } // Unloads an arbitrary resource of type 'restype' with resource numbber 'resnr' -reg_t kUnLoad(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kUnLoad(EngineState *s, int funct_nr, int argc, reg_t *argv) { int restype = KP_UINT(argv[0]); reg_t resnr = argv[1]; @@ -152,7 +152,7 @@ reg_t kUnLoad(state_t *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; } -reg_t kClone(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kClone(EngineState *s, int funct_nr, int argc, reg_t *argv) { reg_t parent_addr = argv[0]; object_t *parent_obj = obj_get(s, parent_addr); reg_t clone_addr; @@ -190,9 +190,9 @@ reg_t kClone(state_t *s, int funct_nr, int argc, reg_t *argv) { return clone_addr; } -extern void _k_view_list_mark_free(state_t *s, reg_t off); +extern void _k_view_list_mark_free(EngineState *s, reg_t off); -reg_t kDisposeClone(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kDisposeClone(EngineState *s, int funct_nr, int argc, reg_t *argv) { reg_t victim_addr = argv[0]; clone_t *victim_obj = obj_get(s, victim_addr); word underBits; @@ -230,7 +230,7 @@ reg_t kDisposeClone(state_t *s, int funct_nr, int argc, reg_t *argv) { } // Returns script dispatch address index in the supplied script -reg_t kScriptID(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kScriptID(EngineState *s, int funct_nr, int argc, reg_t *argv) { int script = KP_UINT(argv[0]); int index = KP_UINT(KP_ALT(1, NULL_REG)); @@ -258,7 +258,7 @@ reg_t kScriptID(state_t *s, int funct_nr, int argc, reg_t *argv) { return make_reg(scriptid, sm_validate_export_func(&s->seg_manager, index, scriptid)); } -reg_t kDisposeScript(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kDisposeScript(EngineState *s, int funct_nr, int argc, reg_t *argv) { int script = argv[0].offset; // Work around QfG1 graveyard bug @@ -277,19 +277,19 @@ reg_t kDisposeScript(state_t *s, int funct_nr, int argc, reg_t *argv) { return s->r_acc; } -int is_heap_object(state_t *s, reg_t pos) { +int is_heap_object(EngineState *s, reg_t pos) { object_t *obj = obj_get(s, pos); return (obj != NULL && (!(obj->flags & OBJECT_FLAG_FREED)) && (!sm_script_is_marked_as_deleted(&s->seg_manager, pos.segment))); } -reg_t kIsObject(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kIsObject(EngineState *s, int funct_nr, int argc, reg_t *argv) { if (argv[0].offset == 0xffff) // Treated specially return NULL_REG; else return make_reg(0, is_heap_object(s, argv[0])); } -reg_t kRespondsTo(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kRespondsTo(EngineState *s, int funct_nr, int argc, reg_t *argv) { reg_t obj = argv[0]; int selector = KP_UINT(argv[1]); diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp index c46361a60c..f6d40bd706 100644 --- a/engines/sci/engine/ksound.cpp +++ b/engines/sci/engine/ksound.cpp @@ -91,7 +91,7 @@ namespace Sci { static void -script_set_priority(state_t *s, reg_t obj, int priority) { +script_set_priority(EngineState *s, reg_t obj, int priority) { int song_nr = GET_SEL32V(obj, number); resource_t *song = scir_find_resource(s->resmgr, sci_sound, song_nr, 0); int flags = GET_SEL32V(obj, flags); @@ -110,7 +110,7 @@ script_set_priority(state_t *s, reg_t obj, int priority) { } song_iterator_t * -build_iterator(state_t *s, int song_nr, int type, songit_id_t id) { +build_iterator(EngineState *s, int song_nr, int type, songit_id_t id) { resource_t *song = scir_find_resource(s->resmgr, sci_sound, song_nr, 0); if (!song) @@ -121,7 +121,7 @@ build_iterator(state_t *s, int song_nr, int type, songit_id_t id) { void -process_sound_events(state_t *s) { /* Get all sound events, apply their changes to the heap */ +process_sound_events(EngineState *s) { /* Get all sound events, apply their changes to the heap */ int result; song_handle_t handle; int cue; @@ -174,7 +174,7 @@ process_sound_events(state_t *s) { /* Get all sound events, apply their changes reg_t -kDoSound_SCI0(state_t *s, int funct_nr, int argc, reg_t *argv) { +kDoSound_SCI0(EngineState *s, int funct_nr, int argc, reg_t *argv) { reg_t obj = KP_ALT(1, NULL_REG); word command = UKPV(0); song_handle_t handle = FROBNICATE_HANDLE(obj); @@ -366,7 +366,7 @@ sfx_send_midi(sfx_state_t *self, song_handle_t handle, int channel, int command, int arg1, int arg2); reg_t -kDoSound_SCI01(state_t *s, int funct_nr, int argc, reg_t *argv) { +kDoSound_SCI01(EngineState *s, int funct_nr, int argc, reg_t *argv) { word command = UKPV(0); reg_t obj = KP_ALT(1, NULL_REG); song_handle_t handle = FROBNICATE_HANDLE(obj); @@ -671,7 +671,7 @@ sfx_send_midi(sfx_state_t *self, song_handle_t handle, int channel, int command, int arg1, int arg2); reg_t -kDoSound_SCI1(state_t *s, int funct_nr, int argc, reg_t *argv) { +kDoSound_SCI1(EngineState *s, int funct_nr, int argc, reg_t *argv) { word command = UKPV(0); reg_t obj = KP_ALT(1, NULL_REG); song_handle_t handle = FROBNICATE_HANDLE(obj); @@ -979,7 +979,7 @@ kDoSound_SCI1(state_t *s, int funct_nr, int argc, reg_t *argv) { } reg_t -kDoSound(state_t *s, int funct_nr, int argc, reg_t *argv) { +kDoSound(EngineState *s, int funct_nr, int argc, reg_t *argv) { if (s->version >= SCI_VERSION_FTU_DOSOUND_VARIANT_2) return kDoSound_SCI1(s, funct_nr, argc, argv); else if (s->version >= SCI_VERSION_FTU_DOSOUND_VARIANT_1) @@ -989,7 +989,7 @@ kDoSound(state_t *s, int funct_nr, int argc, reg_t *argv) { } reg_t -kDoAudio(state_t *s, int funct_nr, int argc, reg_t *argv) { +kDoAudio(EngineState *s, int funct_nr, int argc, reg_t *argv) { switch (UKPV(0)) { case _K_SCI1_AUDIO_POSITION : return make_reg(0, -1); /* Finish immediately */ diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp index baa37f53ab..ecf9816e43 100644 --- a/engines/sci/engine/kstring.cpp +++ b/engines/sci/engine/kstring.cpp @@ -38,7 +38,7 @@ namespace Sci { } /* Returns the string the script intended to address */ -char *kernel_lookup_text(state_t *s, reg_t address, int index) { +char *kernel_lookup_text(EngineState *s, reg_t address, int index) { char *seeker; resource_t *textres; @@ -77,7 +77,7 @@ char *kernel_lookup_text(state_t *s, reg_t address, int index) { /**********/ #ifdef SCI_SIMPLE_SAID_CODE -int vocab_match_simple(state_t *s, heap_ptr addr) { +int vocab_match_simple(EngineState *s, heap_ptr addr) { int nextitem; int listpos = 0; @@ -112,7 +112,7 @@ int vocab_match_simple(state_t *s, heap_ptr addr) { #endif /* SCI_SIMPLE_SAID_CODE */ -reg_t kSaid(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kSaid(EngineState *s, int funct_nr, int argc, reg_t *argv) { reg_t heap_said_block = argv[0]; byte *said_block; int new_lastmatch; @@ -179,8 +179,7 @@ reg_t kSaid(state_t *s, int funct_nr, int argc, reg_t *argv) { } -reg_t -kSetSynonyms(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kSetSynonyms(EngineState *s, int funct_nr, int argc, reg_t *argv) { reg_t object = argv[0]; list_t *list; node_t *node; @@ -251,8 +250,7 @@ kSetSynonyms(state_t *s, int funct_nr, int argc, reg_t *argv) { -reg_t -kParse(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kParse(EngineState *s, int funct_nr, int argc, reg_t *argv) { reg_t stringpos = argv[0]; char *string = kernel_dereference_char_pointer(s, stringpos, 0); int words_nr; @@ -341,8 +339,7 @@ kParse(state_t *s, int funct_nr, int argc, reg_t *argv) { } -reg_t -kStrEnd(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kStrEnd(EngineState *s, int funct_nr, int argc, reg_t *argv) { reg_t address = argv[0]; char *seeker = kernel_dereference_char_pointer(s, address, 0); @@ -352,8 +349,7 @@ kStrEnd(state_t *s, int funct_nr, int argc, reg_t *argv) { return address; } -reg_t -kStrCat(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kStrCat(EngineState *s, int funct_nr, int argc, reg_t *argv) { char *s1 = kernel_dereference_char_pointer(s, argv[0], 0); char *s2 = kernel_dereference_char_pointer(s, argv[1], 0); @@ -361,8 +357,7 @@ kStrCat(state_t *s, int funct_nr, int argc, reg_t *argv) { return argv[0]; } -reg_t -kStrCmp(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kStrCmp(EngineState *s, int funct_nr, int argc, reg_t *argv) { char *s1 = kernel_dereference_char_pointer(s, argv[0], 0); char *s2 = kernel_dereference_char_pointer(s, argv[1], 0); @@ -373,8 +368,7 @@ kStrCmp(state_t *s, int funct_nr, int argc, reg_t *argv) { } -reg_t -kStrCpy(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kStrCpy(EngineState *s, int funct_nr, int argc, reg_t *argv) { char *dest = (char *) kernel_dereference_bulk_pointer(s, argv[0], 0); char *src = (char *) kernel_dereference_bulk_pointer(s, argv[1], 0); @@ -415,8 +409,7 @@ kStrCpy(state_t *s, int funct_nr, int argc, reg_t *argv) { } -reg_t -kStrAt(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kStrAt(EngineState *s, int funct_nr, int argc, reg_t *argv) { unsigned char *dest = (unsigned char *) kernel_dereference_bulk_pointer(s, argv[0], 0); reg_t *dest2; @@ -451,8 +444,7 @@ kStrAt(state_t *s, int funct_nr, int argc, reg_t *argv) { } -reg_t -kReadNumber(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kReadNumber(EngineState *s, int funct_nr, int argc, reg_t *argv) { char *source = kernel_dereference_char_pointer(s, argv[0], 0); while (isspace(*source)) @@ -476,8 +468,7 @@ kReadNumber(state_t *s, int funct_nr, int argc, reg_t *argv) { ** Formats the text from text.textresnr (offset index_inside_res) or heap_text_addr according to ** the supplied parameters and writes it to the targ_address. */ -reg_t -kFormat(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kFormat(EngineState *s, int funct_nr, int argc, reg_t *argv) { int *arguments; reg_t dest = argv[0]; char *target = (char *) kernel_dereference_bulk_pointer(s, dest, 0); @@ -692,16 +683,14 @@ kFormat(state_t *s, int funct_nr, int argc, reg_t *argv) { } -reg_t -kStrLen(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kStrLen(EngineState *s, int funct_nr, int argc, reg_t *argv) { char *str = kernel_dereference_char_pointer(s, argv[0], 0); return make_reg(0, strlen(str)); } -reg_t -kGetFarText(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kGetFarText(EngineState *s, int funct_nr, int argc, reg_t *argv) { resource_t *textres = scir_find_resource(s->resmgr, sci_text, UKPV(0), 0); char *seeker; int counter = UKPV(1); @@ -728,8 +717,7 @@ kGetFarText(state_t *s, int funct_nr, int argc, reg_t *argv) { static message_state_t state; -reg_t -kMessage(state_t *s, int funct_nr, int argc, reg_t *argv) { +reg_t kMessage(EngineState *s, int funct_nr, int argc, reg_t *argv) { if (!state.initialized) message_state_initialize(s->resmgr, &state); diff --git a/engines/sci/engine/said.cpp b/engines/sci/engine/said.cpp index 4f28697043..1e47ad3966 100644 --- a/engines/sci/engine/said.cpp +++ b/engines/sci/engine/said.cpp @@ -1999,7 +1999,7 @@ static said_spec_t said_top_branch(tree_t first) { return 0; } -int said_parse_spec(state_t *s, byte *spec) { +int said_parse_spec(EngineState *s, byte *spec) { int nextitem; said_parse_error = NULL; @@ -2434,7 +2434,7 @@ static int augment_parse_nodes(parse_tree_node_t *parset, parse_tree_node_t *sai /**** Main code ****/ /*******************/ -int said(state_t *s, byte *spec, int verbose) { +int said(EngineState *s, byte *spec, int verbose) { int retval; parse_tree_node_t *parse_tree_ptr = s->parser_nodes; @@ -2465,7 +2465,7 @@ int said(state_t *s, byte *spec, int verbose) { #ifdef SAID_DEBUG_PROGRAM int main (int argc, char *argv) { byte block[] = {0x01, 0x00, 0xf8, 0xf5, 0x02, 0x01, 0xf6, 0xf2, 0x02, 0x01, 0xf2, 0x01, 0x03, 0xff}; - state_t s; + EngineState s; con_passthrough = 1; s.parser_valid = 1; diff --git a/engines/sci/engine/savegame.cfsml b/engines/sci/engine/savegame.cfsml index 2923d4eb6c..eca85edab8 100644 --- a/engines/sci/engine/savegame.cfsml +++ b/engines/sci/engine/savegame.cfsml @@ -23,7 +23,7 @@ * */ -/* Savegame handling for state_t structs. Makes heavy use of cfsml magic. */ +/* Savegame handling for EngineState structs. Makes heavy use of cfsml magic. */ /* DON'T EDIT savegame.cpp ! Only modify savegame.cfsml, if something needs ** to be changed. Refer to freesci/docs/misc/cfsml.spec if you don't understand ** savegame.cfsml. If this doesn't solve your problem, contact the maintainer. @@ -103,7 +103,7 @@ char* SRSgets(char* s, int size, Common::SeekableReadStream* str) { -static state_t *_global_save_state; +static EngineState *_global_save_state; // Needed for some graphical stuff. #define FILE_VERSION _global_save_state->savegame_version @@ -316,7 +316,7 @@ RECORD SavegameMetadata "SavegameMetadata" { int savegame_time; } -RECORD state_t "state_t" { +RECORD EngineState "EngineState" { int savegame_version; string game_version; @@ -521,7 +521,7 @@ void write_song_tp(Common::WriteStream *fh, song_t **foo) { %CFSMLWRITE song_t *foo INTO fh; } -song_iterator_t *build_iterator(state_t *s, int song_nr, int type, songit_id_t id); +song_iterator_t *build_iterator(EngineState *s, int song_nr, int type, songit_id_t id); int read_song_tp(Common::SeekableReadStream *fh, song_t **foo, const char *lastval, int *line, int *hiteof) { char *token; @@ -707,11 +707,11 @@ int read_mem_obj_tp(Common::SeekableReadStream *fh, mem_obj_t **foo, const char // This function is called to undo some strange stuff done in preparation // to writing a gamestate to disk -void _gamestate_unfrob(state_t *s) { +void _gamestate_unfrob(EngineState *s) { } -int gamestate_save(state_t *s, Common::WriteStream *fh, const char* savename) { +int gamestate_save(EngineState *s, Common::WriteStream *fh, const char* savename) { tm curTime; g_system->getTimeAndDate(curTime); @@ -748,7 +748,7 @@ int gamestate_save(state_t *s, Common::WriteStream *fh, const char* savename) { s->game_time = time(NULL) - s->game_start_time.tv_sec; %CFSMLWRITE SavegameMetadata meta INTO fh; - %CFSMLWRITE state_t s INTO fh; + %CFSMLWRITE EngineState s INTO fh; delete meta; @@ -767,7 +767,7 @@ static seg_id_t find_unique_seg_by_type(seg_manager_t *self, int type) { return -1; } -static byte *find_unique_script_block(state_t *s, byte *buf, int type) { +static byte *find_unique_script_block(EngineState *s, byte *buf, int type) { int magic_pos_adder = s->version >= SCI_VERSION_FTU_NEW_SCRIPT_HEADER ? 0 : 2; buf += magic_pos_adder; @@ -785,7 +785,7 @@ static byte *find_unique_script_block(state_t *s, byte *buf, int type) { return NULL; } -static void reconstruct_stack(state_t *retval) { +static void reconstruct_stack(EngineState *retval) { seg_id_t stack_seg = find_unique_seg_by_type(&retval->seg_manager, MEM_OBJ_STACK); dstack_t *stack = &(retval->seg_manager.heap[stack_seg]->data.stack); @@ -810,7 +810,7 @@ static int clone_entry_used(clone_table_t *table, int n) { return 1; } -static void load_script(state_t *s, seg_id_t seg) { +static void load_script(EngineState *s, seg_id_t seg) { resource_t *script, *heap = NULL; script_t *scr = &(s->seg_manager.heap[seg]->data.script); @@ -831,7 +831,7 @@ static void load_script(state_t *s, seg_id_t seg) { } } -static void reconstruct_scripts(state_t *s, seg_manager_t *self) { +static void reconstruct_scripts(EngineState *s, seg_manager_t *self) { int i; mem_obj_t *mobj; for (i = 0; i < self->heap_size; i++) { @@ -905,7 +905,7 @@ static void reconstruct_scripts(state_t *s, seg_manager_t *self) { } } -void reconstruct_clones(state_t *s, seg_manager_t *self) { +void reconstruct_clones(EngineState *s, seg_manager_t *self) { int i; mem_obj_t *mobj; @@ -959,11 +959,11 @@ void reconstruct_clones(state_t *s, seg_manager_t *self) { } } -int _reset_graphics_input(state_t *s); +int _reset_graphics_input(EngineState *s); song_iterator_t *new_fast_forward_iterator(song_iterator_t *it, int delta); -static void reconstruct_sounds(state_t *s) { +static void reconstruct_sounds(EngineState *s) { song_t *seeker; int it_type = s->resmgr->sci_version >= SCI_VERSION_01 ? SCI_SONG_ITERATOR_TYPE_SCI1 : SCI_SONG_ITERATOR_TYPE_SCI0; @@ -997,9 +997,9 @@ static void reconstruct_sounds(state_t *s) { } } -state_t *gamestate_restore(state_t *s, Common::SeekableReadStream *fh) { +EngineState *gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) { int read_eof = 0; - state_t *retval; + EngineState *retval; songlib_t temp; /* @@ -1011,9 +1011,9 @@ state_t *gamestate_restore(state_t *s, Common::SeekableReadStream *fh) { } */ - retval = (state_t *) sci_malloc(sizeof(state_t)); + retval = (EngineState *) sci_malloc(sizeof(EngineState)); - memset(retval, 0, sizeof(state_t)); + memset(retval, 0, sizeof(EngineState)); retval->savegame_version = -1; _global_save_state = retval; @@ -1045,7 +1045,7 @@ state_t *gamestate_restore(state_t *s, Common::SeekableReadStream *fh) { retval->sound_mute = s->sound_mute; retval->sound_volume = s->sound_volume; - %CFSMLREAD-ATOMIC state_t retval FROM fh ERRVAR read_eof; + %CFSMLREAD-ATOMIC EngineState retval FROM fh ERRVAR read_eof; sfx_exit(&s->sound); _gamestate_unfrob(retval); diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index c00a8f631d..a516c8ba79 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -23,7 +23,7 @@ * */ -/* Savegame handling for state_t structs. Makes heavy use of cfsml magic. */ +/* Savegame handling for EngineState structs. Makes heavy use of cfsml magic. */ /* DON'T EDIT savegame.cpp ! Only modify savegame.cfsml, if something needs ** to be changed. Refer to freesci/docs/misc/cfsml.spec if you don't understand ** savegame.cfsml. If this doesn't solve your problem, contact the maintainer. @@ -103,7 +103,7 @@ char* SRSgets(char* s, int size, Common::SeekableReadStream* str) { -static state_t *_global_save_state; +static EngineState *_global_save_state; // Needed for some graphical stuff. #define FILE_VERSION _global_save_state->savegame_version @@ -226,11 +226,11 @@ RECORD synonym_t "synonym_t" { // Auto-generated CFSML declaration and function block -#line 736 "../../engines/sci/engine/savegame.cfsml" +#line 736 "engines/sci/engine/savegame.cfsml" #define CFSML_SUCCESS 0 #define CFSML_FAILURE 1 -#line 102 "../../engines/sci/engine/savegame.cfsml" +#line 102 "engines/sci/engine/savegame.cfsml" #include <stdarg.h> // We need va_lists #include "sci/include/sci_memory.h" @@ -400,7 +400,7 @@ static char *_cfsml_get_identifier(Common::SeekableReadStream *fd, int *line, in retval = (char *)sci_realloc(retval, mem += 1); retval[pos] = 0; // Terminate string -#line 281 "../../engines/sci/engine/savegame.cfsml" +#line 281 "engines/sci/engine/savegame.cfsml" return _cfsml_last_identifier_retrieved = retval; } @@ -443,139 +443,139 @@ static char *_cfsml_get_value(Common::SeekableReadStream *fd, int *line, int *hi retval = (char *)sci_realloc(retval, mem += 1); retval[pos] = 0; // Terminate string -#line 333 "../../engines/sci/engine/savegame.cfsml" +#line 333 "engines/sci/engine/savegame.cfsml" return (_cfsml_last_value_retrieved = (char *)sci_realloc(retval, strlen(retval) + 1)); // Re-allocate; this value might be used for quite some while (if we are restoring a string) } -#line 383 "../../engines/sci/engine/savegame.cfsml" +#line 383 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_sfx_state_t(Common::WriteStream *fh, sfx_state_t* save_struc); static int _cfsml_read_sfx_state_t(Common::SeekableReadStream *fh, sfx_state_t* save_struc, const char *lastval, int *line, int *hiteof); -#line 383 "../../engines/sci/engine/savegame.cfsml" +#line 383 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_clone_entry_t(Common::WriteStream *fh, clone_entry_t* save_struc); static int _cfsml_read_clone_entry_t(Common::SeekableReadStream *fh, clone_entry_t* save_struc, const char *lastval, int *line, int *hiteof); -#line 383 "../../engines/sci/engine/savegame.cfsml" +#line 383 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_object_t(Common::WriteStream *fh, object_t* save_struc); static int _cfsml_read_object_t(Common::SeekableReadStream *fh, object_t* save_struc, const char *lastval, int *line, int *hiteof); -#line 383 "../../engines/sci/engine/savegame.cfsml" +#line 383 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_string(Common::WriteStream *fh, char ** save_struc); static int _cfsml_read_string(Common::SeekableReadStream *fh, char ** save_struc, const char *lastval, int *line, int *hiteof); -#line 383 "../../engines/sci/engine/savegame.cfsml" +#line 383 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_menubar_t(Common::WriteStream *fh, menubar_t* save_struc); static int _cfsml_read_menubar_t(Common::SeekableReadStream *fh, menubar_t* save_struc, const char *lastval, int *line, int *hiteof); -#line 383 "../../engines/sci/engine/savegame.cfsml" +#line 383 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_size_t(Common::WriteStream *fh, size_t* save_struc); static int _cfsml_read_size_t(Common::SeekableReadStream *fh, size_t* save_struc, const char *lastval, int *line, int *hiteof); -#line 383 "../../engines/sci/engine/savegame.cfsml" +#line 383 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_list_entry_t(Common::WriteStream *fh, list_entry_t* save_struc); static int _cfsml_read_list_entry_t(Common::SeekableReadStream *fh, list_entry_t* save_struc, const char *lastval, int *line, int *hiteof); -#line 383 "../../engines/sci/engine/savegame.cfsml" +#line 383 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_int_hash_map_t(Common::WriteStream *fh, int_hash_map_t* save_struc); static int _cfsml_read_int_hash_map_t(Common::SeekableReadStream *fh, int_hash_map_t* save_struc, const char *lastval, int *line, int *hiteof); -#line 383 "../../engines/sci/engine/savegame.cfsml" +#line 383 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_song_t(Common::WriteStream *fh, song_t* save_struc); static int _cfsml_read_song_t(Common::SeekableReadStream *fh, song_t* save_struc, const char *lastval, int *line, int *hiteof); -#line 383 "../../engines/sci/engine/savegame.cfsml" +#line 383 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_menu_item_t(Common::WriteStream *fh, menu_item_t* save_struc); static int _cfsml_read_menu_item_t(Common::SeekableReadStream *fh, menu_item_t* save_struc, const char *lastval, int *line, int *hiteof); -#line 383 "../../engines/sci/engine/savegame.cfsml" +#line 383 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_node_entry_t(Common::WriteStream *fh, node_entry_t* save_struc); static int _cfsml_read_node_entry_t(Common::SeekableReadStream *fh, node_entry_t* save_struc, const char *lastval, int *line, int *hiteof); -#line 383 "../../engines/sci/engine/savegame.cfsml" +#line 383 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_seg_id_t(Common::WriteStream *fh, seg_id_t* save_struc); static int _cfsml_read_seg_id_t(Common::SeekableReadStream *fh, seg_id_t* save_struc, const char *lastval, int *line, int *hiteof); -#line 383 "../../engines/sci/engine/savegame.cfsml" +#line 383 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_dynmem_t(Common::WriteStream *fh, dynmem_t* save_struc); static int _cfsml_read_dynmem_t(Common::SeekableReadStream *fh, dynmem_t* save_struc, const char *lastval, int *line, int *hiteof); -#line 383 "../../engines/sci/engine/savegame.cfsml" +#line 383 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_local_variables_t(Common::WriteStream *fh, local_variables_t* save_struc); static int _cfsml_read_local_variables_t(Common::SeekableReadStream *fh, local_variables_t* save_struc, const char *lastval, int *line, int *hiteof); -#line 383 "../../engines/sci/engine/savegame.cfsml" -static void _cfsml_write_state_t(Common::WriteStream *fh, state_t* save_struc); -static int _cfsml_read_state_t(Common::SeekableReadStream *fh, state_t* save_struc, const char *lastval, int *line, int *hiteof); - -#line 383 "../../engines/sci/engine/savegame.cfsml" +#line 383 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_node_table_t(Common::WriteStream *fh, node_table_t* save_struc); static int _cfsml_read_node_table_t(Common::SeekableReadStream *fh, node_table_t* save_struc, const char *lastval, int *line, int *hiteof); -#line 383 "../../engines/sci/engine/savegame.cfsml" +#line 383 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_sys_strings_t(Common::WriteStream *fh, sys_strings_t* save_struc); static int _cfsml_read_sys_strings_t(Common::SeekableReadStream *fh, sys_strings_t* save_struc, const char *lastval, int *line, int *hiteof); -#line 383 "../../engines/sci/engine/savegame.cfsml" +#line 383 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_byte(Common::WriteStream *fh, byte* save_struc); static int _cfsml_read_byte(Common::SeekableReadStream *fh, byte* save_struc, const char *lastval, int *line, int *hiteof); -#line 383 "../../engines/sci/engine/savegame.cfsml" +#line 383 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_node_t(Common::WriteStream *fh, node_t* save_struc); static int _cfsml_read_node_t(Common::SeekableReadStream *fh, node_t* save_struc, const char *lastval, int *line, int *hiteof); -#line 383 "../../engines/sci/engine/savegame.cfsml" +#line 383 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_list_table_t(Common::WriteStream *fh, list_table_t* save_struc); static int _cfsml_read_list_table_t(Common::SeekableReadStream *fh, list_table_t* save_struc, const char *lastval, int *line, int *hiteof); -#line 383 "../../engines/sci/engine/savegame.cfsml" +#line 383 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_class_t(Common::WriteStream *fh, class_t* save_struc); static int _cfsml_read_class_t(Common::SeekableReadStream *fh, class_t* save_struc, const char *lastval, int *line, int *hiteof); -#line 383 "../../engines/sci/engine/savegame.cfsml" +#line 383 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_song_handle_t(Common::WriteStream *fh, song_handle_t* save_struc); static int _cfsml_read_song_handle_t(Common::SeekableReadStream *fh, song_handle_t* save_struc, const char *lastval, int *line, int *hiteof); -#line 383 "../../engines/sci/engine/savegame.cfsml" +#line 383 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_int(Common::WriteStream *fh, int* save_struc); static int _cfsml_read_int(Common::SeekableReadStream *fh, int* save_struc, const char *lastval, int *line, int *hiteof); -#line 383 "../../engines/sci/engine/savegame.cfsml" +#line 383 "engines/sci/engine/savegame.cfsml" +static void _cfsml_write_EngineState(Common::WriteStream *fh, EngineState* save_struc); +static int _cfsml_read_EngineState(Common::SeekableReadStream *fh, EngineState* save_struc, const char *lastval, int *line, int *hiteof); + +#line 383 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_SavegameMetadata(Common::WriteStream *fh, SavegameMetadata* save_struc); static int _cfsml_read_SavegameMetadata(Common::SeekableReadStream *fh, SavegameMetadata* save_struc, const char *lastval, int *line, int *hiteof); -#line 383 "../../engines/sci/engine/savegame.cfsml" +#line 383 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_menu_t(Common::WriteStream *fh, menu_t* save_struc); static int _cfsml_read_menu_t(Common::SeekableReadStream *fh, menu_t* save_struc, const char *lastval, int *line, int *hiteof); -#line 383 "../../engines/sci/engine/savegame.cfsml" +#line 383 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_clone_table_t(Common::WriteStream *fh, clone_table_t* save_struc); static int _cfsml_read_clone_table_t(Common::SeekableReadStream *fh, clone_table_t* save_struc, const char *lastval, int *line, int *hiteof); -#line 383 "../../engines/sci/engine/savegame.cfsml" +#line 383 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_clone_t(Common::WriteStream *fh, clone_t* save_struc); static int _cfsml_read_clone_t(Common::SeekableReadStream *fh, clone_t* save_struc, const char *lastval, int *line, int *hiteof); -#line 383 "../../engines/sci/engine/savegame.cfsml" +#line 383 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_list_t(Common::WriteStream *fh, list_t* save_struc); static int _cfsml_read_list_t(Common::SeekableReadStream *fh, list_t* save_struc, const char *lastval, int *line, int *hiteof); -#line 383 "../../engines/sci/engine/savegame.cfsml" +#line 383 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_sys_string_t(Common::WriteStream *fh, sys_string_t* save_struc); static int _cfsml_read_sys_string_t(Common::SeekableReadStream *fh, sys_string_t* save_struc, const char *lastval, int *line, int *hiteof); -#line 383 "../../engines/sci/engine/savegame.cfsml" +#line 383 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_script_t(Common::WriteStream *fh, script_t* save_struc); static int _cfsml_read_script_t(Common::SeekableReadStream *fh, script_t* save_struc, const char *lastval, int *line, int *hiteof); -#line 383 "../../engines/sci/engine/savegame.cfsml" +#line 383 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_seg_manager_t(Common::WriteStream *fh, seg_manager_t* save_struc); static int _cfsml_read_seg_manager_t(Common::SeekableReadStream *fh, seg_manager_t* save_struc, const char *lastval, int *line, int *hiteof); -#line 395 "../../engines/sci/engine/savegame.cfsml" +#line 395 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_sfx_state_t(Common::WriteStream *fh, sfx_state_t* save_struc) { -#line 412 "../../engines/sci/engine/savegame.cfsml" +#line 412 "engines/sci/engine/savegame.cfsml" WSprintf(fh, "{\n"); WSprintf(fh, "songlib = "); write_songlib_t(fh, (songlib_t*) &(save_struc->songlib)); @@ -583,11 +583,11 @@ _cfsml_write_sfx_state_t(Common::WriteStream *fh, sfx_state_t* save_struc) WSprintf(fh, "}"); } -#line 486 "../../engines/sci/engine/savegame.cfsml" +#line 486 "engines/sci/engine/savegame.cfsml" static int _cfsml_read_sfx_state_t(Common::SeekableReadStream *fh, sfx_state_t* save_struc, const char *lastval, int *line, int *hiteof) { -#line 541 "../../engines/sci/engine/savegame.cfsml" +#line 541 "engines/sci/engine/savegame.cfsml" char *token; int assignment, closed; @@ -620,13 +620,13 @@ _cfsml_read_sfx_state_t(Common::SeekableReadStream *fh, sfx_state_t* save_struc, return CFSML_FAILURE; } if (!strcmp(token, "songlib")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (read_songlib_t(fh, (songlib_t*) &(save_struc->songlib), value, line, hiteof)) { _cfsml_error("Token expected by read_songlib_t() for songlib at line %d\n", *line); return CFSML_FAILURE; } } else -#line 699 "../../engines/sci/engine/savegame.cfsml" +#line 699 "engines/sci/engine/savegame.cfsml" { _cfsml_error("sfx_state_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -636,11 +636,11 @@ _cfsml_read_sfx_state_t(Common::SeekableReadStream *fh, sfx_state_t* save_struc, return CFSML_SUCCESS; } -#line 395 "../../engines/sci/engine/savegame.cfsml" +#line 395 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_clone_entry_t(Common::WriteStream *fh, clone_entry_t* save_struc) { -#line 412 "../../engines/sci/engine/savegame.cfsml" +#line 412 "engines/sci/engine/savegame.cfsml" WSprintf(fh, "{\n"); WSprintf(fh, "next_free = "); _cfsml_write_int(fh, (int*) &(save_struc->next_free)); @@ -651,11 +651,11 @@ _cfsml_write_clone_entry_t(Common::WriteStream *fh, clone_entry_t* save_struc) WSprintf(fh, "}"); } -#line 486 "../../engines/sci/engine/savegame.cfsml" +#line 486 "engines/sci/engine/savegame.cfsml" static int _cfsml_read_clone_entry_t(Common::SeekableReadStream *fh, clone_entry_t* save_struc, const char *lastval, int *line, int *hiteof) { -#line 541 "../../engines/sci/engine/savegame.cfsml" +#line 541 "engines/sci/engine/savegame.cfsml" char *token; int assignment, closed; @@ -688,20 +688,20 @@ _cfsml_read_clone_entry_t(Common::SeekableReadStream *fh, clone_entry_t* save_st return CFSML_FAILURE; } if (!strcmp(token, "next_free")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->next_free), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for next_free at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "entry")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_clone_t(fh, (clone_t*) &(save_struc->entry), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_clone_t() for entry at line %d\n", *line); return CFSML_FAILURE; } } else -#line 699 "../../engines/sci/engine/savegame.cfsml" +#line 699 "engines/sci/engine/savegame.cfsml" { _cfsml_error("clone_entry_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -711,11 +711,11 @@ _cfsml_read_clone_entry_t(Common::SeekableReadStream *fh, clone_entry_t* save_st return CFSML_SUCCESS; } -#line 395 "../../engines/sci/engine/savegame.cfsml" +#line 395 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_object_t(Common::WriteStream *fh, object_t* save_struc) { -#line 412 "../../engines/sci/engine/savegame.cfsml" +#line 412 "engines/sci/engine/savegame.cfsml" WSprintf(fh, "{\n"); WSprintf(fh, "flags = "); _cfsml_write_int(fh, (int*) &(save_struc->flags)); @@ -737,7 +737,7 @@ _cfsml_write_object_t(Common::WriteStream *fh, object_t* save_struc) min = max = save_struc->variables_nr; if (!save_struc->variables) min = max = 0; /* Don't write if it points to NULL */ -#line 439 "../../engines/sci/engine/savegame.cfsml" +#line 439 "engines/sci/engine/savegame.cfsml" WSprintf(fh, "[%d][\n", max); for (int i = 0; i < min; i++) { write_reg_t(fh, &(save_struc->variables[i])); @@ -748,11 +748,11 @@ _cfsml_write_object_t(Common::WriteStream *fh, object_t* save_struc) WSprintf(fh, "}"); } -#line 486 "../../engines/sci/engine/savegame.cfsml" +#line 486 "engines/sci/engine/savegame.cfsml" static int _cfsml_read_object_t(Common::SeekableReadStream *fh, object_t* save_struc, const char *lastval, int *line, int *hiteof) { -#line 541 "../../engines/sci/engine/savegame.cfsml" +#line 541 "engines/sci/engine/savegame.cfsml" char *token; int assignment, closed; @@ -785,48 +785,48 @@ _cfsml_read_object_t(Common::SeekableReadStream *fh, object_t* save_struc, const return CFSML_FAILURE; } if (!strcmp(token, "flags")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->flags), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for flags at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "pos")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (read_reg_t(fh, (reg_t*) &(save_struc->pos), value, line, hiteof)) { _cfsml_error("Token expected by read_reg_t() for pos at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "variables_nr")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->variables_nr), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for variables_nr at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "variable_names_nr")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->variable_names_nr), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for variable_names_nr at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "methods_nr")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->methods_nr), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for methods_nr at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "variables")) { -#line 604 "../../engines/sci/engine/savegame.cfsml" +#line 604 "engines/sci/engine/savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; } int max,done,i; -#line 615 "../../engines/sci/engine/savegame.cfsml" +#line 615 "engines/sci/engine/savegame.cfsml" // Prepare to restore dynamic array max = strtol(value + 1, NULL, 0); if (max < 0) { @@ -842,11 +842,11 @@ _cfsml_read_object_t(Common::SeekableReadStream *fh, object_t* save_struc, const _cfsml_register_pointer(save_struc->variables); } else save_struc->variables = NULL; -#line 639 "../../engines/sci/engine/savegame.cfsml" +#line 639 "engines/sci/engine/savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) { -#line 647 "../../engines/sci/engine/savegame.cfsml" +#line 647 "engines/sci/engine/savegame.cfsml" _cfsml_error("Token expected at line %d\n", *line); return 1; } @@ -864,7 +864,7 @@ _cfsml_read_object_t(Common::SeekableReadStream *fh, object_t* save_struc, const } while (!done); save_struc->variables_nr = max ; // Set array size accordingly } else -#line 699 "../../engines/sci/engine/savegame.cfsml" +#line 699 "engines/sci/engine/savegame.cfsml" { _cfsml_error("object_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -874,11 +874,11 @@ _cfsml_read_object_t(Common::SeekableReadStream *fh, object_t* save_struc, const return CFSML_SUCCESS; } -#line 395 "../../engines/sci/engine/savegame.cfsml" +#line 395 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_string(Common::WriteStream *fh, char ** save_struc) { -#line 402 "../../engines/sci/engine/savegame.cfsml" +#line 402 "engines/sci/engine/savegame.cfsml" if (!(*save_struc)) WSprintf(fh, "\\null\\"); else { @@ -888,11 +888,11 @@ _cfsml_write_string(Common::WriteStream *fh, char ** save_struc) } } -#line 486 "../../engines/sci/engine/savegame.cfsml" +#line 486 "engines/sci/engine/savegame.cfsml" static int _cfsml_read_string(Common::SeekableReadStream *fh, char ** save_struc, const char *lastval, int *line, int *hiteof) { -#line 519 "../../engines/sci/engine/savegame.cfsml" +#line 519 "engines/sci/engine/savegame.cfsml" if (strcmp(lastval, "\\null\\")) { // null pointer? unsigned int length = strlen(lastval); @@ -917,18 +917,18 @@ _cfsml_read_string(Common::SeekableReadStream *fh, char ** save_struc, const cha } } -#line 395 "../../engines/sci/engine/savegame.cfsml" +#line 395 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_menubar_t(Common::WriteStream *fh, menubar_t* save_struc) { -#line 412 "../../engines/sci/engine/savegame.cfsml" +#line 412 "engines/sci/engine/savegame.cfsml" WSprintf(fh, "{\n"); WSprintf(fh, "menus = "); int min, max; min = max = save_struc->menus_nr; if (!save_struc->menus) min = max = 0; /* Don't write if it points to NULL */ -#line 439 "../../engines/sci/engine/savegame.cfsml" +#line 439 "engines/sci/engine/savegame.cfsml" WSprintf(fh, "[%d][\n", max); for (int i = 0; i < min; i++) { _cfsml_write_menu_t(fh, &(save_struc->menus[i])); @@ -939,11 +939,11 @@ _cfsml_write_menubar_t(Common::WriteStream *fh, menubar_t* save_struc) WSprintf(fh, "}"); } -#line 486 "../../engines/sci/engine/savegame.cfsml" +#line 486 "engines/sci/engine/savegame.cfsml" static int _cfsml_read_menubar_t(Common::SeekableReadStream *fh, menubar_t* save_struc, const char *lastval, int *line, int *hiteof) { -#line 541 "../../engines/sci/engine/savegame.cfsml" +#line 541 "engines/sci/engine/savegame.cfsml" char *token; int assignment, closed; @@ -976,13 +976,13 @@ _cfsml_read_menubar_t(Common::SeekableReadStream *fh, menubar_t* save_struc, con return CFSML_FAILURE; } if (!strcmp(token, "menus")) { -#line 604 "../../engines/sci/engine/savegame.cfsml" +#line 604 "engines/sci/engine/savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; } int max,done,i; -#line 615 "../../engines/sci/engine/savegame.cfsml" +#line 615 "engines/sci/engine/savegame.cfsml" // Prepare to restore dynamic array max = strtol(value + 1, NULL, 0); if (max < 0) { @@ -998,11 +998,11 @@ _cfsml_read_menubar_t(Common::SeekableReadStream *fh, menubar_t* save_struc, con _cfsml_register_pointer(save_struc->menus); } else save_struc->menus = NULL; -#line 639 "../../engines/sci/engine/savegame.cfsml" +#line 639 "engines/sci/engine/savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) { -#line 647 "../../engines/sci/engine/savegame.cfsml" +#line 647 "engines/sci/engine/savegame.cfsml" _cfsml_error("Token expected at line %d\n", *line); return 1; } @@ -1020,7 +1020,7 @@ _cfsml_read_menubar_t(Common::SeekableReadStream *fh, menubar_t* save_struc, con } while (!done); save_struc->menus_nr = max ; // Set array size accordingly } else -#line 699 "../../engines/sci/engine/savegame.cfsml" +#line 699 "engines/sci/engine/savegame.cfsml" { _cfsml_error("menubar_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -1030,18 +1030,18 @@ _cfsml_read_menubar_t(Common::SeekableReadStream *fh, menubar_t* save_struc, con return CFSML_SUCCESS; } -#line 395 "../../engines/sci/engine/savegame.cfsml" +#line 395 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_size_t(Common::WriteStream *fh, size_t* save_struc) { WSprintf(fh, "%li", (long)*save_struc); } -#line 486 "../../engines/sci/engine/savegame.cfsml" +#line 486 "engines/sci/engine/savegame.cfsml" static int _cfsml_read_size_t(Common::SeekableReadStream *fh, size_t* save_struc, const char *lastval, int *line, int *hiteof) { -#line 506 "../../engines/sci/engine/savegame.cfsml" +#line 506 "engines/sci/engine/savegame.cfsml" char *token; *save_struc = strtol(lastval, &token, 0); @@ -1056,11 +1056,11 @@ _cfsml_read_size_t(Common::SeekableReadStream *fh, size_t* save_struc, const cha return CFSML_SUCCESS; } -#line 395 "../../engines/sci/engine/savegame.cfsml" +#line 395 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_list_entry_t(Common::WriteStream *fh, list_entry_t* save_struc) { -#line 412 "../../engines/sci/engine/savegame.cfsml" +#line 412 "engines/sci/engine/savegame.cfsml" WSprintf(fh, "{\n"); WSprintf(fh, "next_free = "); _cfsml_write_int(fh, (int*) &(save_struc->next_free)); @@ -1071,11 +1071,11 @@ _cfsml_write_list_entry_t(Common::WriteStream *fh, list_entry_t* save_struc) WSprintf(fh, "}"); } -#line 486 "../../engines/sci/engine/savegame.cfsml" +#line 486 "engines/sci/engine/savegame.cfsml" static int _cfsml_read_list_entry_t(Common::SeekableReadStream *fh, list_entry_t* save_struc, const char *lastval, int *line, int *hiteof) { -#line 541 "../../engines/sci/engine/savegame.cfsml" +#line 541 "engines/sci/engine/savegame.cfsml" char *token; int assignment, closed; @@ -1108,20 +1108,20 @@ _cfsml_read_list_entry_t(Common::SeekableReadStream *fh, list_entry_t* save_stru return CFSML_FAILURE; } if (!strcmp(token, "next_free")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->next_free), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for next_free at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "entry")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_list_t(fh, (list_t*) &(save_struc->entry), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_list_t() for entry at line %d\n", *line); return CFSML_FAILURE; } } else -#line 699 "../../engines/sci/engine/savegame.cfsml" +#line 699 "engines/sci/engine/savegame.cfsml" { _cfsml_error("list_entry_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -1131,11 +1131,11 @@ _cfsml_read_list_entry_t(Common::SeekableReadStream *fh, list_entry_t* save_stru return CFSML_SUCCESS; } -#line 395 "../../engines/sci/engine/savegame.cfsml" +#line 395 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_int_hash_map_t(Common::WriteStream *fh, int_hash_map_t* save_struc) { -#line 412 "../../engines/sci/engine/savegame.cfsml" +#line 412 "engines/sci/engine/savegame.cfsml" WSprintf(fh, "{\n"); WSprintf(fh, "base_value = "); _cfsml_write_int(fh, (int*) &(save_struc->base_value)); @@ -1143,7 +1143,7 @@ _cfsml_write_int_hash_map_t(Common::WriteStream *fh, int_hash_map_t* save_struc) WSprintf(fh, "nodes = "); int min, max; min = max = DCS_INT_HASH_MAX+1; -#line 439 "../../engines/sci/engine/savegame.cfsml" +#line 439 "engines/sci/engine/savegame.cfsml" WSprintf(fh, "[%d][\n", max); for (int i = 0; i < min; i++) { write_int_hash_map_node_tp(fh, &(save_struc->nodes[i])); @@ -1154,11 +1154,11 @@ _cfsml_write_int_hash_map_t(Common::WriteStream *fh, int_hash_map_t* save_struc) WSprintf(fh, "}"); } -#line 486 "../../engines/sci/engine/savegame.cfsml" +#line 486 "engines/sci/engine/savegame.cfsml" static int _cfsml_read_int_hash_map_t(Common::SeekableReadStream *fh, int_hash_map_t* save_struc, const char *lastval, int *line, int *hiteof) { -#line 541 "../../engines/sci/engine/savegame.cfsml" +#line 541 "engines/sci/engine/savegame.cfsml" char *token; int assignment, closed; @@ -1191,14 +1191,14 @@ _cfsml_read_int_hash_map_t(Common::SeekableReadStream *fh, int_hash_map_t* save_ return CFSML_FAILURE; } if (!strcmp(token, "base_value")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->base_value), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for base_value at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "nodes")) { -#line 604 "../../engines/sci/engine/savegame.cfsml" +#line 604 "engines/sci/engine/savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; @@ -1206,11 +1206,11 @@ _cfsml_read_int_hash_map_t(Common::SeekableReadStream *fh, int_hash_map_t* save_ int max,done,i; // Prepare to restore static array max = DCS_INT_HASH_MAX+1; -#line 639 "../../engines/sci/engine/savegame.cfsml" +#line 639 "engines/sci/engine/savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) { -#line 647 "../../engines/sci/engine/savegame.cfsml" +#line 647 "engines/sci/engine/savegame.cfsml" _cfsml_error("Token expected at line %d\n", *line); return 1; } @@ -1227,7 +1227,7 @@ _cfsml_read_int_hash_map_t(Common::SeekableReadStream *fh, int_hash_map_t* save_ done = 1; } while (!done); } else -#line 699 "../../engines/sci/engine/savegame.cfsml" +#line 699 "engines/sci/engine/savegame.cfsml" { _cfsml_error("int_hash_map_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -1237,11 +1237,11 @@ _cfsml_read_int_hash_map_t(Common::SeekableReadStream *fh, int_hash_map_t* save_ return CFSML_SUCCESS; } -#line 395 "../../engines/sci/engine/savegame.cfsml" +#line 395 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_song_t(Common::WriteStream *fh, song_t* save_struc) { -#line 412 "../../engines/sci/engine/savegame.cfsml" +#line 412 "engines/sci/engine/savegame.cfsml" WSprintf(fh, "{\n"); WSprintf(fh, "handle = "); _cfsml_write_song_handle_t(fh, (song_handle_t*) &(save_struc->handle)); @@ -1270,11 +1270,11 @@ _cfsml_write_song_t(Common::WriteStream *fh, song_t* save_struc) WSprintf(fh, "}"); } -#line 486 "../../engines/sci/engine/savegame.cfsml" +#line 486 "engines/sci/engine/savegame.cfsml" static int _cfsml_read_song_t(Common::SeekableReadStream *fh, song_t* save_struc, const char *lastval, int *line, int *hiteof) { -#line 541 "../../engines/sci/engine/savegame.cfsml" +#line 541 "engines/sci/engine/savegame.cfsml" char *token; int assignment, closed; @@ -1307,62 +1307,62 @@ _cfsml_read_song_t(Common::SeekableReadStream *fh, song_t* save_struc, const cha return CFSML_FAILURE; } if (!strcmp(token, "handle")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_song_handle_t(fh, (song_handle_t*) &(save_struc->handle), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_song_handle_t() for handle at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "resource_num")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->resource_num), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for resource_num at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "priority")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->priority), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for priority at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "status")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->status), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for status at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "restore_behavior")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->restore_behavior), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for restore_behavior at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "restore_time")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->restore_time), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for restore_time at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "loops")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->loops), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for loops at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "hold")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->hold), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for hold at line %d\n", *line); return CFSML_FAILURE; } } else -#line 699 "../../engines/sci/engine/savegame.cfsml" +#line 699 "engines/sci/engine/savegame.cfsml" { _cfsml_error("song_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -1372,11 +1372,11 @@ _cfsml_read_song_t(Common::SeekableReadStream *fh, song_t* save_struc, const cha return CFSML_SUCCESS; } -#line 395 "../../engines/sci/engine/savegame.cfsml" +#line 395 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_menu_item_t(Common::WriteStream *fh, menu_item_t* save_struc) { -#line 412 "../../engines/sci/engine/savegame.cfsml" +#line 412 "engines/sci/engine/savegame.cfsml" WSprintf(fh, "{\n"); WSprintf(fh, "type = "); _cfsml_write_int(fh, (int*) &(save_struc->type)); @@ -1393,7 +1393,7 @@ _cfsml_write_menu_item_t(Common::WriteStream *fh, menu_item_t* save_struc) WSprintf(fh, "said = "); int min, max; min = max = MENU_SAID_SPEC_SIZE; -#line 439 "../../engines/sci/engine/savegame.cfsml" +#line 439 "engines/sci/engine/savegame.cfsml" WSprintf(fh, "[%d][\n", max); for (int i = 0; i < min; i++) { _cfsml_write_byte(fh, &(save_struc->said[i])); @@ -1425,11 +1425,11 @@ _cfsml_write_menu_item_t(Common::WriteStream *fh, menu_item_t* save_struc) WSprintf(fh, "}"); } -#line 486 "../../engines/sci/engine/savegame.cfsml" +#line 486 "engines/sci/engine/savegame.cfsml" static int _cfsml_read_menu_item_t(Common::SeekableReadStream *fh, menu_item_t* save_struc, const char *lastval, int *line, int *hiteof) { -#line 541 "../../engines/sci/engine/savegame.cfsml" +#line 541 "engines/sci/engine/savegame.cfsml" char *token; int assignment, closed; @@ -1462,35 +1462,35 @@ _cfsml_read_menu_item_t(Common::SeekableReadStream *fh, menu_item_t* save_struc, return CFSML_FAILURE; } if (!strcmp(token, "type")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->type), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for type at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "keytext")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_string(fh, (char **) &(save_struc->keytext), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_string() for keytext at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "keytext_size")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->keytext_size), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for keytext_size at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "flags")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->flags), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for flags at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "said")) { -#line 604 "../../engines/sci/engine/savegame.cfsml" +#line 604 "engines/sci/engine/savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; @@ -1498,11 +1498,11 @@ _cfsml_read_menu_item_t(Common::SeekableReadStream *fh, menu_item_t* save_struc, int max,done,i; // Prepare to restore static array max = MENU_SAID_SPEC_SIZE; -#line 639 "../../engines/sci/engine/savegame.cfsml" +#line 639 "engines/sci/engine/savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) { -#line 647 "../../engines/sci/engine/savegame.cfsml" +#line 647 "engines/sci/engine/savegame.cfsml" _cfsml_error("Token expected at line %d\n", *line); return 1; } @@ -1520,55 +1520,55 @@ _cfsml_read_menu_item_t(Common::SeekableReadStream *fh, menu_item_t* save_struc, } while (!done); } else if (!strcmp(token, "said_pos")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (read_reg_t(fh, (reg_t*) &(save_struc->said_pos), value, line, hiteof)) { _cfsml_error("Token expected by read_reg_t() for said_pos at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "text")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_string(fh, (char **) &(save_struc->text), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_string() for text at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "text_pos")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (read_reg_t(fh, (reg_t*) &(save_struc->text_pos), value, line, hiteof)) { _cfsml_error("Token expected by read_reg_t() for text_pos at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "modifiers")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->modifiers), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for modifiers at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "key")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->key), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for key at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "enabled")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->enabled), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for enabled at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "tag")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->tag), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for tag at line %d\n", *line); return CFSML_FAILURE; } } else -#line 699 "../../engines/sci/engine/savegame.cfsml" +#line 699 "engines/sci/engine/savegame.cfsml" { _cfsml_error("menu_item_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -1578,11 +1578,11 @@ _cfsml_read_menu_item_t(Common::SeekableReadStream *fh, menu_item_t* save_struc, return CFSML_SUCCESS; } -#line 395 "../../engines/sci/engine/savegame.cfsml" +#line 395 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_node_entry_t(Common::WriteStream *fh, node_entry_t* save_struc) { -#line 412 "../../engines/sci/engine/savegame.cfsml" +#line 412 "engines/sci/engine/savegame.cfsml" WSprintf(fh, "{\n"); WSprintf(fh, "next_free = "); _cfsml_write_int(fh, (int*) &(save_struc->next_free)); @@ -1593,11 +1593,11 @@ _cfsml_write_node_entry_t(Common::WriteStream *fh, node_entry_t* save_struc) WSprintf(fh, "}"); } -#line 486 "../../engines/sci/engine/savegame.cfsml" +#line 486 "engines/sci/engine/savegame.cfsml" static int _cfsml_read_node_entry_t(Common::SeekableReadStream *fh, node_entry_t* save_struc, const char *lastval, int *line, int *hiteof) { -#line 541 "../../engines/sci/engine/savegame.cfsml" +#line 541 "engines/sci/engine/savegame.cfsml" char *token; int assignment, closed; @@ -1630,20 +1630,20 @@ _cfsml_read_node_entry_t(Common::SeekableReadStream *fh, node_entry_t* save_stru return CFSML_FAILURE; } if (!strcmp(token, "next_free")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->next_free), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for next_free at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "entry")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_node_t(fh, (node_t*) &(save_struc->entry), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_node_t() for entry at line %d\n", *line); return CFSML_FAILURE; } } else -#line 699 "../../engines/sci/engine/savegame.cfsml" +#line 699 "engines/sci/engine/savegame.cfsml" { _cfsml_error("node_entry_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -1653,18 +1653,18 @@ _cfsml_read_node_entry_t(Common::SeekableReadStream *fh, node_entry_t* save_stru return CFSML_SUCCESS; } -#line 395 "../../engines/sci/engine/savegame.cfsml" +#line 395 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_seg_id_t(Common::WriteStream *fh, seg_id_t* save_struc) { WSprintf(fh, "%li", (long)*save_struc); } -#line 486 "../../engines/sci/engine/savegame.cfsml" +#line 486 "engines/sci/engine/savegame.cfsml" static int _cfsml_read_seg_id_t(Common::SeekableReadStream *fh, seg_id_t* save_struc, const char *lastval, int *line, int *hiteof) { -#line 506 "../../engines/sci/engine/savegame.cfsml" +#line 506 "engines/sci/engine/savegame.cfsml" char *token; *save_struc = strtol(lastval, &token, 0); @@ -1679,11 +1679,11 @@ _cfsml_read_seg_id_t(Common::SeekableReadStream *fh, seg_id_t* save_struc, const return CFSML_SUCCESS; } -#line 395 "../../engines/sci/engine/savegame.cfsml" +#line 395 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_dynmem_t(Common::WriteStream *fh, dynmem_t* save_struc) { -#line 412 "../../engines/sci/engine/savegame.cfsml" +#line 412 "engines/sci/engine/savegame.cfsml" WSprintf(fh, "{\n"); WSprintf(fh, "size = "); _cfsml_write_int(fh, (int*) &(save_struc->size)); @@ -1696,7 +1696,7 @@ _cfsml_write_dynmem_t(Common::WriteStream *fh, dynmem_t* save_struc) min = max = save_struc->size; if (!save_struc->buf) min = max = 0; /* Don't write if it points to NULL */ -#line 439 "../../engines/sci/engine/savegame.cfsml" +#line 439 "engines/sci/engine/savegame.cfsml" WSprintf(fh, "[%d][\n", max); for (int i = 0; i < min; i++) { _cfsml_write_byte(fh, &(save_struc->buf[i])); @@ -1707,11 +1707,11 @@ _cfsml_write_dynmem_t(Common::WriteStream *fh, dynmem_t* save_struc) WSprintf(fh, "}"); } -#line 486 "../../engines/sci/engine/savegame.cfsml" +#line 486 "engines/sci/engine/savegame.cfsml" static int _cfsml_read_dynmem_t(Common::SeekableReadStream *fh, dynmem_t* save_struc, const char *lastval, int *line, int *hiteof) { -#line 541 "../../engines/sci/engine/savegame.cfsml" +#line 541 "engines/sci/engine/savegame.cfsml" char *token; int assignment, closed; @@ -1744,27 +1744,27 @@ _cfsml_read_dynmem_t(Common::SeekableReadStream *fh, dynmem_t* save_struc, const return CFSML_FAILURE; } if (!strcmp(token, "size")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->size), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for size at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "description")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_string(fh, (char **) &(save_struc->description), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_string() for description at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "buf")) { -#line 604 "../../engines/sci/engine/savegame.cfsml" +#line 604 "engines/sci/engine/savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; } int max,done,i; -#line 615 "../../engines/sci/engine/savegame.cfsml" +#line 615 "engines/sci/engine/savegame.cfsml" // Prepare to restore dynamic array max = strtol(value + 1, NULL, 0); if (max < 0) { @@ -1780,11 +1780,11 @@ _cfsml_read_dynmem_t(Common::SeekableReadStream *fh, dynmem_t* save_struc, const _cfsml_register_pointer(save_struc->buf); } else save_struc->buf = NULL; -#line 639 "../../engines/sci/engine/savegame.cfsml" +#line 639 "engines/sci/engine/savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) { -#line 647 "../../engines/sci/engine/savegame.cfsml" +#line 647 "engines/sci/engine/savegame.cfsml" _cfsml_error("Token expected at line %d\n", *line); return 1; } @@ -1802,7 +1802,7 @@ _cfsml_read_dynmem_t(Common::SeekableReadStream *fh, dynmem_t* save_struc, const } while (!done); save_struc->size = max ; // Set array size accordingly } else -#line 699 "../../engines/sci/engine/savegame.cfsml" +#line 699 "engines/sci/engine/savegame.cfsml" { _cfsml_error("dynmem_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -1812,11 +1812,11 @@ _cfsml_read_dynmem_t(Common::SeekableReadStream *fh, dynmem_t* save_struc, const return CFSML_SUCCESS; } -#line 395 "../../engines/sci/engine/savegame.cfsml" +#line 395 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_local_variables_t(Common::WriteStream *fh, local_variables_t* save_struc) { -#line 412 "../../engines/sci/engine/savegame.cfsml" +#line 412 "engines/sci/engine/savegame.cfsml" WSprintf(fh, "{\n"); WSprintf(fh, "script_id = "); _cfsml_write_int(fh, (int*) &(save_struc->script_id)); @@ -1829,7 +1829,7 @@ _cfsml_write_local_variables_t(Common::WriteStream *fh, local_variables_t* save_ min = max = save_struc->nr; if (!save_struc->locals) min = max = 0; /* Don't write if it points to NULL */ -#line 439 "../../engines/sci/engine/savegame.cfsml" +#line 439 "engines/sci/engine/savegame.cfsml" WSprintf(fh, "[%d][\n", max); for (int i = 0; i < min; i++) { write_reg_t(fh, &(save_struc->locals[i])); @@ -1840,11 +1840,11 @@ _cfsml_write_local_variables_t(Common::WriteStream *fh, local_variables_t* save_ WSprintf(fh, "}"); } -#line 486 "../../engines/sci/engine/savegame.cfsml" +#line 486 "engines/sci/engine/savegame.cfsml" static int _cfsml_read_local_variables_t(Common::SeekableReadStream *fh, local_variables_t* save_struc, const char *lastval, int *line, int *hiteof) { -#line 541 "../../engines/sci/engine/savegame.cfsml" +#line 541 "engines/sci/engine/savegame.cfsml" char *token; int assignment, closed; @@ -1877,27 +1877,27 @@ _cfsml_read_local_variables_t(Common::SeekableReadStream *fh, local_variables_t* return CFSML_FAILURE; } if (!strcmp(token, "script_id")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->script_id), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for script_id at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "nr")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->nr), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for nr at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "locals")) { -#line 604 "../../engines/sci/engine/savegame.cfsml" +#line 604 "engines/sci/engine/savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; } int max,done,i; -#line 615 "../../engines/sci/engine/savegame.cfsml" +#line 615 "engines/sci/engine/savegame.cfsml" // Prepare to restore dynamic array max = strtol(value + 1, NULL, 0); if (max < 0) { @@ -1913,11 +1913,11 @@ _cfsml_read_local_variables_t(Common::SeekableReadStream *fh, local_variables_t* _cfsml_register_pointer(save_struc->locals); } else save_struc->locals = NULL; -#line 639 "../../engines/sci/engine/savegame.cfsml" +#line 639 "engines/sci/engine/savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) { -#line 647 "../../engines/sci/engine/savegame.cfsml" +#line 647 "engines/sci/engine/savegame.cfsml" _cfsml_error("Token expected at line %d\n", *line); return 1; } @@ -1935,7 +1935,7 @@ _cfsml_read_local_variables_t(Common::SeekableReadStream *fh, local_variables_t* } while (!done); save_struc->nr = max ; // Set array size accordingly } else -#line 699 "../../engines/sci/engine/savegame.cfsml" +#line 699 "engines/sci/engine/savegame.cfsml" { _cfsml_error("local_variables_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -1945,214 +1945,11 @@ _cfsml_read_local_variables_t(Common::SeekableReadStream *fh, local_variables_t* return CFSML_SUCCESS; } -#line 395 "../../engines/sci/engine/savegame.cfsml" -static void -_cfsml_write_state_t(Common::WriteStream *fh, state_t* save_struc) -{ -#line 412 "../../engines/sci/engine/savegame.cfsml" - WSprintf(fh, "{\n"); - WSprintf(fh, "savegame_version = "); - _cfsml_write_int(fh, (int*) &(save_struc->savegame_version)); - WSprintf(fh, "\n"); - WSprintf(fh, "game_version = "); - _cfsml_write_string(fh, (char **) &(save_struc->game_version)); - WSprintf(fh, "\n"); - WSprintf(fh, "version = "); - write_sci_version(fh, (sci_version_t*) &(save_struc->version)); - WSprintf(fh, "\n"); - WSprintf(fh, "menubar = "); - write_menubar_tp(fh, (menubar_t **) &(save_struc->menubar)); - WSprintf(fh, "\n"); - WSprintf(fh, "status_bar_foreground = "); - _cfsml_write_int(fh, (int*) &(save_struc->status_bar_foreground)); - WSprintf(fh, "\n"); - WSprintf(fh, "status_bar_background = "); - _cfsml_write_int(fh, (int*) &(save_struc->status_bar_background)); - WSprintf(fh, "\n"); - WSprintf(fh, "seg_manager = "); - _cfsml_write_seg_manager_t(fh, (seg_manager_t*) &(save_struc->seg_manager)); - WSprintf(fh, "\n"); - WSprintf(fh, "classtable_size = "); - _cfsml_write_int(fh, (int*) &(save_struc->classtable_size)); - WSprintf(fh, "\n"); - WSprintf(fh, "classtable = "); - int min, max; - min = max = save_struc->classtable_size; - if (!save_struc->classtable) - min = max = 0; /* Don't write if it points to NULL */ -#line 439 "../../engines/sci/engine/savegame.cfsml" - WSprintf(fh, "[%d][\n", max); - for (int i = 0; i < min; i++) { - _cfsml_write_class_t(fh, &(save_struc->classtable[i])); - WSprintf(fh, "\n"); - } - WSprintf(fh, "]"); - WSprintf(fh, "\n"); - WSprintf(fh, "sound = "); - _cfsml_write_sfx_state_t(fh, (sfx_state_t*) &(save_struc->sound)); - WSprintf(fh, "\n"); - WSprintf(fh, "}"); -} - -#line 486 "../../engines/sci/engine/savegame.cfsml" -static int -_cfsml_read_state_t(Common::SeekableReadStream *fh, state_t* save_struc, const char *lastval, int *line, int *hiteof) -{ -#line 541 "../../engines/sci/engine/savegame.cfsml" - char *token; - int assignment, closed; - - if (strcmp(lastval, "{")) { - _cfsml_error("Reading record state_t; expected opening braces in line %d, got \"%s\"\n", *line, lastval); - return CFSML_FAILURE; - }; - closed = 0; - do { - const char *value; - token = _cfsml_get_identifier(fh, line, hiteof, &assignment); - - if (!token) { - _cfsml_error("Expected token at line %d\n", *line); - return CFSML_FAILURE; - } - if (!assignment) { - if (!strcmp(token, "}")) - closed = 1; - else { - _cfsml_error("Expected assignment or closing braces in line %d\n", *line); - return CFSML_FAILURE; - } - } else { - value = ""; - while (!value || !strcmp(value, "")) - value = _cfsml_get_value(fh, line, hiteof); - if (!value) { - _cfsml_error("Expected token at line %d\n", *line); - return CFSML_FAILURE; - } - if (!strcmp(token, "savegame_version")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" - if (_cfsml_read_int(fh, (int*) &(save_struc->savegame_version), value, line, hiteof)) { - _cfsml_error("Token expected by _cfsml_read_int() for savegame_version at line %d\n", *line); - return CFSML_FAILURE; - } - } else - if (!strcmp(token, "game_version")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" - if (_cfsml_read_string(fh, (char **) &(save_struc->game_version), value, line, hiteof)) { - _cfsml_error("Token expected by _cfsml_read_string() for game_version at line %d\n", *line); - return CFSML_FAILURE; - } - } else - if (!strcmp(token, "version")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" - if (read_sci_version(fh, (sci_version_t*) &(save_struc->version), value, line, hiteof)) { - _cfsml_error("Token expected by read_sci_version() for version at line %d\n", *line); - return CFSML_FAILURE; - } - } else - if (!strcmp(token, "menubar")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" - if (read_menubar_tp(fh, (menubar_t **) &(save_struc->menubar), value, line, hiteof)) { - _cfsml_error("Token expected by read_menubar_tp() for menubar at line %d\n", *line); - return CFSML_FAILURE; - } - } else - if (!strcmp(token, "status_bar_foreground")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" - if (_cfsml_read_int(fh, (int*) &(save_struc->status_bar_foreground), value, line, hiteof)) { - _cfsml_error("Token expected by _cfsml_read_int() for status_bar_foreground at line %d\n", *line); - return CFSML_FAILURE; - } - } else - if (!strcmp(token, "status_bar_background")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" - if (_cfsml_read_int(fh, (int*) &(save_struc->status_bar_background), value, line, hiteof)) { - _cfsml_error("Token expected by _cfsml_read_int() for status_bar_background at line %d\n", *line); - return CFSML_FAILURE; - } - } else - if (!strcmp(token, "seg_manager")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" - if (_cfsml_read_seg_manager_t(fh, (seg_manager_t*) &(save_struc->seg_manager), value, line, hiteof)) { - _cfsml_error("Token expected by _cfsml_read_seg_manager_t() for seg_manager at line %d\n", *line); - return CFSML_FAILURE; - } - } else - if (!strcmp(token, "classtable_size")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" - if (_cfsml_read_int(fh, (int*) &(save_struc->classtable_size), value, line, hiteof)) { - _cfsml_error("Token expected by _cfsml_read_int() for classtable_size at line %d\n", *line); - return CFSML_FAILURE; - } - } else - if (!strcmp(token, "classtable")) { -#line 604 "../../engines/sci/engine/savegame.cfsml" - if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { - _cfsml_error("Opening brackets expected at line %d\n", *line); - return CFSML_FAILURE; - } - int max,done,i; -#line 615 "../../engines/sci/engine/savegame.cfsml" - // Prepare to restore dynamic array - max = strtol(value + 1, NULL, 0); - if (max < 0) { - _cfsml_error("Invalid number of elements to allocate for dynamic array '%s' at line %d\n", token, *line); - return CFSML_FAILURE; - } - - if (max) { - save_struc->classtable = (class_t *)sci_malloc(max * sizeof(class_t)); -#ifdef SATISFY_PURIFY - memset(save_struc->classtable, 0, max * sizeof(class_t)); -#endif - _cfsml_register_pointer(save_struc->classtable); - } else - save_struc->classtable = NULL; -#line 639 "../../engines/sci/engine/savegame.cfsml" - done = i = 0; - do { - if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) { -#line 647 "../../engines/sci/engine/savegame.cfsml" - _cfsml_error("Token expected at line %d\n", *line); - return 1; - } - if (strcmp(value, "]")) { - if (i == max) { - _cfsml_error("More elements than space available (%d) in '%s' at line %d\n", max, token, *line); - return CFSML_FAILURE; - } - if (_cfsml_read_class_t(fh, &(save_struc->classtable[i++]), value, line, hiteof)) { - _cfsml_error("Token expected by _cfsml_read_class_t() for classtable[i++] at line %d\n", *line); - return CFSML_FAILURE; - } - } else - done = 1; - } while (!done); - save_struc->classtable_size = max ; // Set array size accordingly - } else - if (!strcmp(token, "sound")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" - if (_cfsml_read_sfx_state_t(fh, (sfx_state_t*) &(save_struc->sound), value, line, hiteof)) { - _cfsml_error("Token expected by _cfsml_read_sfx_state_t() for sound at line %d\n", *line); - return CFSML_FAILURE; - } - } else -#line 699 "../../engines/sci/engine/savegame.cfsml" - { - _cfsml_error("state_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); - return CFSML_FAILURE; - } - } - } while (!closed); // Until closing braces are hit - return CFSML_SUCCESS; -} - -#line 395 "../../engines/sci/engine/savegame.cfsml" +#line 395 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_node_table_t(Common::WriteStream *fh, node_table_t* save_struc) { -#line 412 "../../engines/sci/engine/savegame.cfsml" +#line 412 "engines/sci/engine/savegame.cfsml" WSprintf(fh, "{\n"); WSprintf(fh, "entries_nr = "); _cfsml_write_int(fh, (int*) &(save_struc->entries_nr)); @@ -2171,7 +1968,7 @@ _cfsml_write_node_table_t(Common::WriteStream *fh, node_table_t* save_struc) min = max = save_struc->entries_nr; if (!save_struc->table) min = max = 0; /* Don't write if it points to NULL */ -#line 439 "../../engines/sci/engine/savegame.cfsml" +#line 439 "engines/sci/engine/savegame.cfsml" WSprintf(fh, "[%d][\n", max); for (int i = 0; i < min; i++) { _cfsml_write_node_entry_t(fh, &(save_struc->table[i])); @@ -2182,11 +1979,11 @@ _cfsml_write_node_table_t(Common::WriteStream *fh, node_table_t* save_struc) WSprintf(fh, "}"); } -#line 486 "../../engines/sci/engine/savegame.cfsml" +#line 486 "engines/sci/engine/savegame.cfsml" static int _cfsml_read_node_table_t(Common::SeekableReadStream *fh, node_table_t* save_struc, const char *lastval, int *line, int *hiteof) { -#line 541 "../../engines/sci/engine/savegame.cfsml" +#line 541 "engines/sci/engine/savegame.cfsml" char *token; int assignment, closed; @@ -2219,41 +2016,41 @@ _cfsml_read_node_table_t(Common::SeekableReadStream *fh, node_table_t* save_stru return CFSML_FAILURE; } if (!strcmp(token, "entries_nr")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->entries_nr), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for entries_nr at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "first_free")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->first_free), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for first_free at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "entries_used")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->entries_used), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for entries_used at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "max_entry")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->max_entry), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for max_entry at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "table")) { -#line 604 "../../engines/sci/engine/savegame.cfsml" +#line 604 "engines/sci/engine/savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; } int max,done,i; -#line 615 "../../engines/sci/engine/savegame.cfsml" +#line 615 "engines/sci/engine/savegame.cfsml" // Prepare to restore dynamic array max = strtol(value + 1, NULL, 0); if (max < 0) { @@ -2269,11 +2066,11 @@ _cfsml_read_node_table_t(Common::SeekableReadStream *fh, node_table_t* save_stru _cfsml_register_pointer(save_struc->table); } else save_struc->table = NULL; -#line 639 "../../engines/sci/engine/savegame.cfsml" +#line 639 "engines/sci/engine/savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) { -#line 647 "../../engines/sci/engine/savegame.cfsml" +#line 647 "engines/sci/engine/savegame.cfsml" _cfsml_error("Token expected at line %d\n", *line); return 1; } @@ -2291,7 +2088,7 @@ _cfsml_read_node_table_t(Common::SeekableReadStream *fh, node_table_t* save_stru } while (!done); save_struc->entries_nr = max ; // Set array size accordingly } else -#line 699 "../../engines/sci/engine/savegame.cfsml" +#line 699 "engines/sci/engine/savegame.cfsml" { _cfsml_error("node_table_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -2301,16 +2098,16 @@ _cfsml_read_node_table_t(Common::SeekableReadStream *fh, node_table_t* save_stru return CFSML_SUCCESS; } -#line 395 "../../engines/sci/engine/savegame.cfsml" +#line 395 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_sys_strings_t(Common::WriteStream *fh, sys_strings_t* save_struc) { -#line 412 "../../engines/sci/engine/savegame.cfsml" +#line 412 "engines/sci/engine/savegame.cfsml" WSprintf(fh, "{\n"); WSprintf(fh, "strings = "); int min, max; min = max = SYS_STRINGS_MAX; -#line 439 "../../engines/sci/engine/savegame.cfsml" +#line 439 "engines/sci/engine/savegame.cfsml" WSprintf(fh, "[%d][\n", max); for (int i = 0; i < min; i++) { _cfsml_write_sys_string_t(fh, &(save_struc->strings[i])); @@ -2321,11 +2118,11 @@ _cfsml_write_sys_strings_t(Common::WriteStream *fh, sys_strings_t* save_struc) WSprintf(fh, "}"); } -#line 486 "../../engines/sci/engine/savegame.cfsml" +#line 486 "engines/sci/engine/savegame.cfsml" static int _cfsml_read_sys_strings_t(Common::SeekableReadStream *fh, sys_strings_t* save_struc, const char *lastval, int *line, int *hiteof) { -#line 541 "../../engines/sci/engine/savegame.cfsml" +#line 541 "engines/sci/engine/savegame.cfsml" char *token; int assignment, closed; @@ -2358,7 +2155,7 @@ _cfsml_read_sys_strings_t(Common::SeekableReadStream *fh, sys_strings_t* save_st return CFSML_FAILURE; } if (!strcmp(token, "strings")) { -#line 604 "../../engines/sci/engine/savegame.cfsml" +#line 604 "engines/sci/engine/savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; @@ -2366,11 +2163,11 @@ _cfsml_read_sys_strings_t(Common::SeekableReadStream *fh, sys_strings_t* save_st int max,done,i; // Prepare to restore static array max = SYS_STRINGS_MAX; -#line 639 "../../engines/sci/engine/savegame.cfsml" +#line 639 "engines/sci/engine/savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) { -#line 647 "../../engines/sci/engine/savegame.cfsml" +#line 647 "engines/sci/engine/savegame.cfsml" _cfsml_error("Token expected at line %d\n", *line); return 1; } @@ -2387,7 +2184,7 @@ _cfsml_read_sys_strings_t(Common::SeekableReadStream *fh, sys_strings_t* save_st done = 1; } while (!done); } else -#line 699 "../../engines/sci/engine/savegame.cfsml" +#line 699 "engines/sci/engine/savegame.cfsml" { _cfsml_error("sys_strings_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -2397,18 +2194,18 @@ _cfsml_read_sys_strings_t(Common::SeekableReadStream *fh, sys_strings_t* save_st return CFSML_SUCCESS; } -#line 395 "../../engines/sci/engine/savegame.cfsml" +#line 395 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_byte(Common::WriteStream *fh, byte* save_struc) { WSprintf(fh, "%li", (long)*save_struc); } -#line 486 "../../engines/sci/engine/savegame.cfsml" +#line 486 "engines/sci/engine/savegame.cfsml" static int _cfsml_read_byte(Common::SeekableReadStream *fh, byte* save_struc, const char *lastval, int *line, int *hiteof) { -#line 506 "../../engines/sci/engine/savegame.cfsml" +#line 506 "engines/sci/engine/savegame.cfsml" char *token; *save_struc = strtol(lastval, &token, 0); @@ -2423,11 +2220,11 @@ _cfsml_read_byte(Common::SeekableReadStream *fh, byte* save_struc, const char *l return CFSML_SUCCESS; } -#line 395 "../../engines/sci/engine/savegame.cfsml" +#line 395 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_node_t(Common::WriteStream *fh, node_t* save_struc) { -#line 412 "../../engines/sci/engine/savegame.cfsml" +#line 412 "engines/sci/engine/savegame.cfsml" WSprintf(fh, "{\n"); WSprintf(fh, "pred = "); write_reg_t(fh, (reg_t*) &(save_struc->pred)); @@ -2444,11 +2241,11 @@ _cfsml_write_node_t(Common::WriteStream *fh, node_t* save_struc) WSprintf(fh, "}"); } -#line 486 "../../engines/sci/engine/savegame.cfsml" +#line 486 "engines/sci/engine/savegame.cfsml" static int _cfsml_read_node_t(Common::SeekableReadStream *fh, node_t* save_struc, const char *lastval, int *line, int *hiteof) { -#line 541 "../../engines/sci/engine/savegame.cfsml" +#line 541 "engines/sci/engine/savegame.cfsml" char *token; int assignment, closed; @@ -2481,34 +2278,34 @@ _cfsml_read_node_t(Common::SeekableReadStream *fh, node_t* save_struc, const cha return CFSML_FAILURE; } if (!strcmp(token, "pred")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (read_reg_t(fh, (reg_t*) &(save_struc->pred), value, line, hiteof)) { _cfsml_error("Token expected by read_reg_t() for pred at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "succ")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (read_reg_t(fh, (reg_t*) &(save_struc->succ), value, line, hiteof)) { _cfsml_error("Token expected by read_reg_t() for succ at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "key")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (read_reg_t(fh, (reg_t*) &(save_struc->key), value, line, hiteof)) { _cfsml_error("Token expected by read_reg_t() for key at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "value")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (read_reg_t(fh, (reg_t*) &(save_struc->value), value, line, hiteof)) { _cfsml_error("Token expected by read_reg_t() for value at line %d\n", *line); return CFSML_FAILURE; } } else -#line 699 "../../engines/sci/engine/savegame.cfsml" +#line 699 "engines/sci/engine/savegame.cfsml" { _cfsml_error("node_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -2518,11 +2315,11 @@ _cfsml_read_node_t(Common::SeekableReadStream *fh, node_t* save_struc, const cha return CFSML_SUCCESS; } -#line 395 "../../engines/sci/engine/savegame.cfsml" +#line 395 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_list_table_t(Common::WriteStream *fh, list_table_t* save_struc) { -#line 412 "../../engines/sci/engine/savegame.cfsml" +#line 412 "engines/sci/engine/savegame.cfsml" WSprintf(fh, "{\n"); WSprintf(fh, "entries_nr = "); _cfsml_write_int(fh, (int*) &(save_struc->entries_nr)); @@ -2541,7 +2338,7 @@ _cfsml_write_list_table_t(Common::WriteStream *fh, list_table_t* save_struc) min = max = save_struc->entries_nr; if (!save_struc->table) min = max = 0; /* Don't write if it points to NULL */ -#line 439 "../../engines/sci/engine/savegame.cfsml" +#line 439 "engines/sci/engine/savegame.cfsml" WSprintf(fh, "[%d][\n", max); for (int i = 0; i < min; i++) { _cfsml_write_list_entry_t(fh, &(save_struc->table[i])); @@ -2552,11 +2349,11 @@ _cfsml_write_list_table_t(Common::WriteStream *fh, list_table_t* save_struc) WSprintf(fh, "}"); } -#line 486 "../../engines/sci/engine/savegame.cfsml" +#line 486 "engines/sci/engine/savegame.cfsml" static int _cfsml_read_list_table_t(Common::SeekableReadStream *fh, list_table_t* save_struc, const char *lastval, int *line, int *hiteof) { -#line 541 "../../engines/sci/engine/savegame.cfsml" +#line 541 "engines/sci/engine/savegame.cfsml" char *token; int assignment, closed; @@ -2589,41 +2386,41 @@ _cfsml_read_list_table_t(Common::SeekableReadStream *fh, list_table_t* save_stru return CFSML_FAILURE; } if (!strcmp(token, "entries_nr")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->entries_nr), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for entries_nr at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "first_free")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->first_free), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for first_free at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "entries_used")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->entries_used), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for entries_used at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "max_entry")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->max_entry), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for max_entry at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "table")) { -#line 604 "../../engines/sci/engine/savegame.cfsml" +#line 604 "engines/sci/engine/savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; } int max,done,i; -#line 615 "../../engines/sci/engine/savegame.cfsml" +#line 615 "engines/sci/engine/savegame.cfsml" // Prepare to restore dynamic array max = strtol(value + 1, NULL, 0); if (max < 0) { @@ -2639,11 +2436,11 @@ _cfsml_read_list_table_t(Common::SeekableReadStream *fh, list_table_t* save_stru _cfsml_register_pointer(save_struc->table); } else save_struc->table = NULL; -#line 639 "../../engines/sci/engine/savegame.cfsml" +#line 639 "engines/sci/engine/savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) { -#line 647 "../../engines/sci/engine/savegame.cfsml" +#line 647 "engines/sci/engine/savegame.cfsml" _cfsml_error("Token expected at line %d\n", *line); return 1; } @@ -2661,7 +2458,7 @@ _cfsml_read_list_table_t(Common::SeekableReadStream *fh, list_table_t* save_stru } while (!done); save_struc->entries_nr = max ; // Set array size accordingly } else -#line 699 "../../engines/sci/engine/savegame.cfsml" +#line 699 "engines/sci/engine/savegame.cfsml" { _cfsml_error("list_table_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -2671,11 +2468,11 @@ _cfsml_read_list_table_t(Common::SeekableReadStream *fh, list_table_t* save_stru return CFSML_SUCCESS; } -#line 395 "../../engines/sci/engine/savegame.cfsml" +#line 395 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_class_t(Common::WriteStream *fh, class_t* save_struc) { -#line 412 "../../engines/sci/engine/savegame.cfsml" +#line 412 "engines/sci/engine/savegame.cfsml" WSprintf(fh, "{\n"); WSprintf(fh, "script = "); _cfsml_write_int(fh, (int*) &(save_struc->script)); @@ -2686,11 +2483,11 @@ _cfsml_write_class_t(Common::WriteStream *fh, class_t* save_struc) WSprintf(fh, "}"); } -#line 486 "../../engines/sci/engine/savegame.cfsml" +#line 486 "engines/sci/engine/savegame.cfsml" static int _cfsml_read_class_t(Common::SeekableReadStream *fh, class_t* save_struc, const char *lastval, int *line, int *hiteof) { -#line 541 "../../engines/sci/engine/savegame.cfsml" +#line 541 "engines/sci/engine/savegame.cfsml" char *token; int assignment, closed; @@ -2723,20 +2520,20 @@ _cfsml_read_class_t(Common::SeekableReadStream *fh, class_t* save_struc, const c return CFSML_FAILURE; } if (!strcmp(token, "script")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->script), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for script at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "reg")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (read_reg_t(fh, (reg_t*) &(save_struc->reg), value, line, hiteof)) { _cfsml_error("Token expected by read_reg_t() for reg at line %d\n", *line); return CFSML_FAILURE; } } else -#line 699 "../../engines/sci/engine/savegame.cfsml" +#line 699 "engines/sci/engine/savegame.cfsml" { _cfsml_error("class_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -2746,18 +2543,18 @@ _cfsml_read_class_t(Common::SeekableReadStream *fh, class_t* save_struc, const c return CFSML_SUCCESS; } -#line 395 "../../engines/sci/engine/savegame.cfsml" +#line 395 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_song_handle_t(Common::WriteStream *fh, song_handle_t* save_struc) { WSprintf(fh, "%li", (long)*save_struc); } -#line 486 "../../engines/sci/engine/savegame.cfsml" +#line 486 "engines/sci/engine/savegame.cfsml" static int _cfsml_read_song_handle_t(Common::SeekableReadStream *fh, song_handle_t* save_struc, const char *lastval, int *line, int *hiteof) { -#line 506 "../../engines/sci/engine/savegame.cfsml" +#line 506 "engines/sci/engine/savegame.cfsml" char *token; *save_struc = strtol(lastval, &token, 0); @@ -2772,18 +2569,18 @@ _cfsml_read_song_handle_t(Common::SeekableReadStream *fh, song_handle_t* save_st return CFSML_SUCCESS; } -#line 395 "../../engines/sci/engine/savegame.cfsml" +#line 395 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_int(Common::WriteStream *fh, int* save_struc) { WSprintf(fh, "%li", (long)*save_struc); } -#line 486 "../../engines/sci/engine/savegame.cfsml" +#line 486 "engines/sci/engine/savegame.cfsml" static int _cfsml_read_int(Common::SeekableReadStream *fh, int* save_struc, const char *lastval, int *line, int *hiteof) { -#line 506 "../../engines/sci/engine/savegame.cfsml" +#line 506 "engines/sci/engine/savegame.cfsml" char *token; *save_struc = strtol(lastval, &token, 0); @@ -2798,11 +2595,214 @@ _cfsml_read_int(Common::SeekableReadStream *fh, int* save_struc, const char *las return CFSML_SUCCESS; } -#line 395 "../../engines/sci/engine/savegame.cfsml" +#line 395 "engines/sci/engine/savegame.cfsml" +static void +_cfsml_write_EngineState(Common::WriteStream *fh, EngineState* save_struc) +{ +#line 412 "engines/sci/engine/savegame.cfsml" + WSprintf(fh, "{\n"); + WSprintf(fh, "savegame_version = "); + _cfsml_write_int(fh, (int*) &(save_struc->savegame_version)); + WSprintf(fh, "\n"); + WSprintf(fh, "game_version = "); + _cfsml_write_string(fh, (char **) &(save_struc->game_version)); + WSprintf(fh, "\n"); + WSprintf(fh, "version = "); + write_sci_version(fh, (sci_version_t*) &(save_struc->version)); + WSprintf(fh, "\n"); + WSprintf(fh, "menubar = "); + write_menubar_tp(fh, (menubar_t **) &(save_struc->menubar)); + WSprintf(fh, "\n"); + WSprintf(fh, "status_bar_foreground = "); + _cfsml_write_int(fh, (int*) &(save_struc->status_bar_foreground)); + WSprintf(fh, "\n"); + WSprintf(fh, "status_bar_background = "); + _cfsml_write_int(fh, (int*) &(save_struc->status_bar_background)); + WSprintf(fh, "\n"); + WSprintf(fh, "seg_manager = "); + _cfsml_write_seg_manager_t(fh, (seg_manager_t*) &(save_struc->seg_manager)); + WSprintf(fh, "\n"); + WSprintf(fh, "classtable_size = "); + _cfsml_write_int(fh, (int*) &(save_struc->classtable_size)); + WSprintf(fh, "\n"); + WSprintf(fh, "classtable = "); + int min, max; + min = max = save_struc->classtable_size; + if (!save_struc->classtable) + min = max = 0; /* Don't write if it points to NULL */ +#line 439 "engines/sci/engine/savegame.cfsml" + WSprintf(fh, "[%d][\n", max); + for (int i = 0; i < min; i++) { + _cfsml_write_class_t(fh, &(save_struc->classtable[i])); + WSprintf(fh, "\n"); + } + WSprintf(fh, "]"); + WSprintf(fh, "\n"); + WSprintf(fh, "sound = "); + _cfsml_write_sfx_state_t(fh, (sfx_state_t*) &(save_struc->sound)); + WSprintf(fh, "\n"); + WSprintf(fh, "}"); +} + +#line 486 "engines/sci/engine/savegame.cfsml" +static int +_cfsml_read_EngineState(Common::SeekableReadStream *fh, EngineState* save_struc, const char *lastval, int *line, int *hiteof) +{ +#line 541 "engines/sci/engine/savegame.cfsml" + char *token; + int assignment, closed; + + if (strcmp(lastval, "{")) { + _cfsml_error("Reading record EngineState; expected opening braces in line %d, got \"%s\"\n", *line, lastval); + return CFSML_FAILURE; + }; + closed = 0; + do { + const char *value; + token = _cfsml_get_identifier(fh, line, hiteof, &assignment); + + if (!token) { + _cfsml_error("Expected token at line %d\n", *line); + return CFSML_FAILURE; + } + if (!assignment) { + if (!strcmp(token, "}")) + closed = 1; + else { + _cfsml_error("Expected assignment or closing braces in line %d\n", *line); + return CFSML_FAILURE; + } + } else { + value = ""; + while (!value || !strcmp(value, "")) + value = _cfsml_get_value(fh, line, hiteof); + if (!value) { + _cfsml_error("Expected token at line %d\n", *line); + return CFSML_FAILURE; + } + if (!strcmp(token, "savegame_version")) { +#line 690 "engines/sci/engine/savegame.cfsml" + if (_cfsml_read_int(fh, (int*) &(save_struc->savegame_version), value, line, hiteof)) { + _cfsml_error("Token expected by _cfsml_read_int() for savegame_version at line %d\n", *line); + return CFSML_FAILURE; + } + } else + if (!strcmp(token, "game_version")) { +#line 690 "engines/sci/engine/savegame.cfsml" + if (_cfsml_read_string(fh, (char **) &(save_struc->game_version), value, line, hiteof)) { + _cfsml_error("Token expected by _cfsml_read_string() for game_version at line %d\n", *line); + return CFSML_FAILURE; + } + } else + if (!strcmp(token, "version")) { +#line 690 "engines/sci/engine/savegame.cfsml" + if (read_sci_version(fh, (sci_version_t*) &(save_struc->version), value, line, hiteof)) { + _cfsml_error("Token expected by read_sci_version() for version at line %d\n", *line); + return CFSML_FAILURE; + } + } else + if (!strcmp(token, "menubar")) { +#line 690 "engines/sci/engine/savegame.cfsml" + if (read_menubar_tp(fh, (menubar_t **) &(save_struc->menubar), value, line, hiteof)) { + _cfsml_error("Token expected by read_menubar_tp() for menubar at line %d\n", *line); + return CFSML_FAILURE; + } + } else + if (!strcmp(token, "status_bar_foreground")) { +#line 690 "engines/sci/engine/savegame.cfsml" + if (_cfsml_read_int(fh, (int*) &(save_struc->status_bar_foreground), value, line, hiteof)) { + _cfsml_error("Token expected by _cfsml_read_int() for status_bar_foreground at line %d\n", *line); + return CFSML_FAILURE; + } + } else + if (!strcmp(token, "status_bar_background")) { +#line 690 "engines/sci/engine/savegame.cfsml" + if (_cfsml_read_int(fh, (int*) &(save_struc->status_bar_background), value, line, hiteof)) { + _cfsml_error("Token expected by _cfsml_read_int() for status_bar_background at line %d\n", *line); + return CFSML_FAILURE; + } + } else + if (!strcmp(token, "seg_manager")) { +#line 690 "engines/sci/engine/savegame.cfsml" + if (_cfsml_read_seg_manager_t(fh, (seg_manager_t*) &(save_struc->seg_manager), value, line, hiteof)) { + _cfsml_error("Token expected by _cfsml_read_seg_manager_t() for seg_manager at line %d\n", *line); + return CFSML_FAILURE; + } + } else + if (!strcmp(token, "classtable_size")) { +#line 690 "engines/sci/engine/savegame.cfsml" + if (_cfsml_read_int(fh, (int*) &(save_struc->classtable_size), value, line, hiteof)) { + _cfsml_error("Token expected by _cfsml_read_int() for classtable_size at line %d\n", *line); + return CFSML_FAILURE; + } + } else + if (!strcmp(token, "classtable")) { +#line 604 "engines/sci/engine/savegame.cfsml" + if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { + _cfsml_error("Opening brackets expected at line %d\n", *line); + return CFSML_FAILURE; + } + int max,done,i; +#line 615 "engines/sci/engine/savegame.cfsml" + // Prepare to restore dynamic array + max = strtol(value + 1, NULL, 0); + if (max < 0) { + _cfsml_error("Invalid number of elements to allocate for dynamic array '%s' at line %d\n", token, *line); + return CFSML_FAILURE; + } + + if (max) { + save_struc->classtable = (class_t *)sci_malloc(max * sizeof(class_t)); +#ifdef SATISFY_PURIFY + memset(save_struc->classtable, 0, max * sizeof(class_t)); +#endif + _cfsml_register_pointer(save_struc->classtable); + } else + save_struc->classtable = NULL; +#line 639 "engines/sci/engine/savegame.cfsml" + done = i = 0; + do { + if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) { +#line 647 "engines/sci/engine/savegame.cfsml" + _cfsml_error("Token expected at line %d\n", *line); + return 1; + } + if (strcmp(value, "]")) { + if (i == max) { + _cfsml_error("More elements than space available (%d) in '%s' at line %d\n", max, token, *line); + return CFSML_FAILURE; + } + if (_cfsml_read_class_t(fh, &(save_struc->classtable[i++]), value, line, hiteof)) { + _cfsml_error("Token expected by _cfsml_read_class_t() for classtable[i++] at line %d\n", *line); + return CFSML_FAILURE; + } + } else + done = 1; + } while (!done); + save_struc->classtable_size = max ; // Set array size accordingly + } else + if (!strcmp(token, "sound")) { +#line 690 "engines/sci/engine/savegame.cfsml" + if (_cfsml_read_sfx_state_t(fh, (sfx_state_t*) &(save_struc->sound), value, line, hiteof)) { + _cfsml_error("Token expected by _cfsml_read_sfx_state_t() for sound at line %d\n", *line); + return CFSML_FAILURE; + } + } else +#line 699 "engines/sci/engine/savegame.cfsml" + { + _cfsml_error("EngineState: Assignment to invalid identifier '%s' in line %d\n", token, *line); + return CFSML_FAILURE; + } + } + } while (!closed); // Until closing braces are hit + return CFSML_SUCCESS; +} + +#line 395 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_SavegameMetadata(Common::WriteStream *fh, SavegameMetadata* save_struc) { -#line 412 "../../engines/sci/engine/savegame.cfsml" +#line 412 "engines/sci/engine/savegame.cfsml" WSprintf(fh, "{\n"); WSprintf(fh, "savegame_name = "); _cfsml_write_string(fh, (char **) &(save_struc->savegame_name)); @@ -2825,11 +2825,11 @@ _cfsml_write_SavegameMetadata(Common::WriteStream *fh, SavegameMetadata* save_st WSprintf(fh, "}"); } -#line 486 "../../engines/sci/engine/savegame.cfsml" +#line 486 "engines/sci/engine/savegame.cfsml" static int _cfsml_read_SavegameMetadata(Common::SeekableReadStream *fh, SavegameMetadata* save_struc, const char *lastval, int *line, int *hiteof) { -#line 541 "../../engines/sci/engine/savegame.cfsml" +#line 541 "engines/sci/engine/savegame.cfsml" char *token; int assignment, closed; @@ -2862,48 +2862,48 @@ _cfsml_read_SavegameMetadata(Common::SeekableReadStream *fh, SavegameMetadata* s return CFSML_FAILURE; } if (!strcmp(token, "savegame_name")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_string(fh, (char **) &(save_struc->savegame_name), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_string() for savegame_name at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "savegame_version")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->savegame_version), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for savegame_version at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "game_version")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_string(fh, (char **) &(save_struc->game_version), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_string() for game_version at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "version")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (read_sci_version(fh, (sci_version_t*) &(save_struc->version), value, line, hiteof)) { _cfsml_error("Token expected by read_sci_version() for version at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "savegame_date")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->savegame_date), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for savegame_date at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "savegame_time")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->savegame_time), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for savegame_time at line %d\n", *line); return CFSML_FAILURE; } } else -#line 699 "../../engines/sci/engine/savegame.cfsml" +#line 699 "engines/sci/engine/savegame.cfsml" { _cfsml_error("SavegameMetadata: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -2913,11 +2913,11 @@ _cfsml_read_SavegameMetadata(Common::SeekableReadStream *fh, SavegameMetadata* s return CFSML_SUCCESS; } -#line 395 "../../engines/sci/engine/savegame.cfsml" +#line 395 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_menu_t(Common::WriteStream *fh, menu_t* save_struc) { -#line 412 "../../engines/sci/engine/savegame.cfsml" +#line 412 "engines/sci/engine/savegame.cfsml" WSprintf(fh, "{\n"); WSprintf(fh, "title = "); _cfsml_write_string(fh, (char **) &(save_struc->title)); @@ -2933,7 +2933,7 @@ _cfsml_write_menu_t(Common::WriteStream *fh, menu_t* save_struc) min = max = save_struc->items_nr; if (!save_struc->items) min = max = 0; /* Don't write if it points to NULL */ -#line 439 "../../engines/sci/engine/savegame.cfsml" +#line 439 "engines/sci/engine/savegame.cfsml" WSprintf(fh, "[%d][\n", max); for (int i = 0; i < min; i++) { _cfsml_write_menu_item_t(fh, &(save_struc->items[i])); @@ -2944,11 +2944,11 @@ _cfsml_write_menu_t(Common::WriteStream *fh, menu_t* save_struc) WSprintf(fh, "}"); } -#line 486 "../../engines/sci/engine/savegame.cfsml" +#line 486 "engines/sci/engine/savegame.cfsml" static int _cfsml_read_menu_t(Common::SeekableReadStream *fh, menu_t* save_struc, const char *lastval, int *line, int *hiteof) { -#line 541 "../../engines/sci/engine/savegame.cfsml" +#line 541 "engines/sci/engine/savegame.cfsml" char *token; int assignment, closed; @@ -2981,34 +2981,34 @@ _cfsml_read_menu_t(Common::SeekableReadStream *fh, menu_t* save_struc, const cha return CFSML_FAILURE; } if (!strcmp(token, "title")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_string(fh, (char **) &(save_struc->title), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_string() for title at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "title_width")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->title_width), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for title_width at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "width")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->width), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for width at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "items")) { -#line 604 "../../engines/sci/engine/savegame.cfsml" +#line 604 "engines/sci/engine/savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; } int max,done,i; -#line 615 "../../engines/sci/engine/savegame.cfsml" +#line 615 "engines/sci/engine/savegame.cfsml" // Prepare to restore dynamic array max = strtol(value + 1, NULL, 0); if (max < 0) { @@ -3024,11 +3024,11 @@ _cfsml_read_menu_t(Common::SeekableReadStream *fh, menu_t* save_struc, const cha _cfsml_register_pointer(save_struc->items); } else save_struc->items = NULL; -#line 639 "../../engines/sci/engine/savegame.cfsml" +#line 639 "engines/sci/engine/savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) { -#line 647 "../../engines/sci/engine/savegame.cfsml" +#line 647 "engines/sci/engine/savegame.cfsml" _cfsml_error("Token expected at line %d\n", *line); return 1; } @@ -3046,7 +3046,7 @@ _cfsml_read_menu_t(Common::SeekableReadStream *fh, menu_t* save_struc, const cha } while (!done); save_struc->items_nr = max ; // Set array size accordingly } else -#line 699 "../../engines/sci/engine/savegame.cfsml" +#line 699 "engines/sci/engine/savegame.cfsml" { _cfsml_error("menu_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -3056,11 +3056,11 @@ _cfsml_read_menu_t(Common::SeekableReadStream *fh, menu_t* save_struc, const cha return CFSML_SUCCESS; } -#line 395 "../../engines/sci/engine/savegame.cfsml" +#line 395 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_clone_table_t(Common::WriteStream *fh, clone_table_t* save_struc) { -#line 412 "../../engines/sci/engine/savegame.cfsml" +#line 412 "engines/sci/engine/savegame.cfsml" WSprintf(fh, "{\n"); WSprintf(fh, "entries_nr = "); _cfsml_write_int(fh, (int*) &(save_struc->entries_nr)); @@ -3079,7 +3079,7 @@ _cfsml_write_clone_table_t(Common::WriteStream *fh, clone_table_t* save_struc) min = max = save_struc->entries_nr; if (!save_struc->table) min = max = 0; /* Don't write if it points to NULL */ -#line 439 "../../engines/sci/engine/savegame.cfsml" +#line 439 "engines/sci/engine/savegame.cfsml" WSprintf(fh, "[%d][\n", max); for (int i = 0; i < min; i++) { _cfsml_write_clone_entry_t(fh, &(save_struc->table[i])); @@ -3090,11 +3090,11 @@ _cfsml_write_clone_table_t(Common::WriteStream *fh, clone_table_t* save_struc) WSprintf(fh, "}"); } -#line 486 "../../engines/sci/engine/savegame.cfsml" +#line 486 "engines/sci/engine/savegame.cfsml" static int _cfsml_read_clone_table_t(Common::SeekableReadStream *fh, clone_table_t* save_struc, const char *lastval, int *line, int *hiteof) { -#line 541 "../../engines/sci/engine/savegame.cfsml" +#line 541 "engines/sci/engine/savegame.cfsml" char *token; int assignment, closed; @@ -3127,41 +3127,41 @@ _cfsml_read_clone_table_t(Common::SeekableReadStream *fh, clone_table_t* save_st return CFSML_FAILURE; } if (!strcmp(token, "entries_nr")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->entries_nr), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for entries_nr at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "first_free")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->first_free), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for first_free at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "entries_used")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->entries_used), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for entries_used at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "max_entry")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->max_entry), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for max_entry at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "table")) { -#line 604 "../../engines/sci/engine/savegame.cfsml" +#line 604 "engines/sci/engine/savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; } int max,done,i; -#line 615 "../../engines/sci/engine/savegame.cfsml" +#line 615 "engines/sci/engine/savegame.cfsml" // Prepare to restore dynamic array max = strtol(value + 1, NULL, 0); if (max < 0) { @@ -3177,11 +3177,11 @@ _cfsml_read_clone_table_t(Common::SeekableReadStream *fh, clone_table_t* save_st _cfsml_register_pointer(save_struc->table); } else save_struc->table = NULL; -#line 639 "../../engines/sci/engine/savegame.cfsml" +#line 639 "engines/sci/engine/savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) { -#line 647 "../../engines/sci/engine/savegame.cfsml" +#line 647 "engines/sci/engine/savegame.cfsml" _cfsml_error("Token expected at line %d\n", *line); return 1; } @@ -3199,7 +3199,7 @@ _cfsml_read_clone_table_t(Common::SeekableReadStream *fh, clone_table_t* save_st } while (!done); save_struc->entries_nr = max ; // Set array size accordingly } else -#line 699 "../../engines/sci/engine/savegame.cfsml" +#line 699 "engines/sci/engine/savegame.cfsml" { _cfsml_error("clone_table_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -3209,11 +3209,11 @@ _cfsml_read_clone_table_t(Common::SeekableReadStream *fh, clone_table_t* save_st return CFSML_SUCCESS; } -#line 395 "../../engines/sci/engine/savegame.cfsml" +#line 395 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_clone_t(Common::WriteStream *fh, clone_t* save_struc) { -#line 412 "../../engines/sci/engine/savegame.cfsml" +#line 412 "engines/sci/engine/savegame.cfsml" WSprintf(fh, "{\n"); WSprintf(fh, "flags = "); _cfsml_write_int(fh, (int*) &(save_struc->flags)); @@ -3235,7 +3235,7 @@ _cfsml_write_clone_t(Common::WriteStream *fh, clone_t* save_struc) min = max = save_struc->variables_nr; if (!save_struc->variables) min = max = 0; /* Don't write if it points to NULL */ -#line 439 "../../engines/sci/engine/savegame.cfsml" +#line 439 "engines/sci/engine/savegame.cfsml" WSprintf(fh, "[%d][\n", max); for (int i = 0; i < min; i++) { write_reg_t(fh, &(save_struc->variables[i])); @@ -3246,11 +3246,11 @@ _cfsml_write_clone_t(Common::WriteStream *fh, clone_t* save_struc) WSprintf(fh, "}"); } -#line 486 "../../engines/sci/engine/savegame.cfsml" +#line 486 "engines/sci/engine/savegame.cfsml" static int _cfsml_read_clone_t(Common::SeekableReadStream *fh, clone_t* save_struc, const char *lastval, int *line, int *hiteof) { -#line 541 "../../engines/sci/engine/savegame.cfsml" +#line 541 "engines/sci/engine/savegame.cfsml" char *token; int assignment, closed; @@ -3283,48 +3283,48 @@ _cfsml_read_clone_t(Common::SeekableReadStream *fh, clone_t* save_struc, const c return CFSML_FAILURE; } if (!strcmp(token, "flags")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->flags), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for flags at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "pos")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (read_reg_t(fh, (reg_t*) &(save_struc->pos), value, line, hiteof)) { _cfsml_error("Token expected by read_reg_t() for pos at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "variables_nr")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->variables_nr), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for variables_nr at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "variable_names_nr")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->variable_names_nr), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for variable_names_nr at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "methods_nr")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->methods_nr), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for methods_nr at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "variables")) { -#line 604 "../../engines/sci/engine/savegame.cfsml" +#line 604 "engines/sci/engine/savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; } int max,done,i; -#line 615 "../../engines/sci/engine/savegame.cfsml" +#line 615 "engines/sci/engine/savegame.cfsml" // Prepare to restore dynamic array max = strtol(value + 1, NULL, 0); if (max < 0) { @@ -3340,11 +3340,11 @@ _cfsml_read_clone_t(Common::SeekableReadStream *fh, clone_t* save_struc, const c _cfsml_register_pointer(save_struc->variables); } else save_struc->variables = NULL; -#line 639 "../../engines/sci/engine/savegame.cfsml" +#line 639 "engines/sci/engine/savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) { -#line 647 "../../engines/sci/engine/savegame.cfsml" +#line 647 "engines/sci/engine/savegame.cfsml" _cfsml_error("Token expected at line %d\n", *line); return 1; } @@ -3362,7 +3362,7 @@ _cfsml_read_clone_t(Common::SeekableReadStream *fh, clone_t* save_struc, const c } while (!done); save_struc->variables_nr = max ; // Set array size accordingly } else -#line 699 "../../engines/sci/engine/savegame.cfsml" +#line 699 "engines/sci/engine/savegame.cfsml" { _cfsml_error("clone_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -3372,11 +3372,11 @@ _cfsml_read_clone_t(Common::SeekableReadStream *fh, clone_t* save_struc, const c return CFSML_SUCCESS; } -#line 395 "../../engines/sci/engine/savegame.cfsml" +#line 395 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_list_t(Common::WriteStream *fh, list_t* save_struc) { -#line 412 "../../engines/sci/engine/savegame.cfsml" +#line 412 "engines/sci/engine/savegame.cfsml" WSprintf(fh, "{\n"); WSprintf(fh, "first = "); write_reg_t(fh, (reg_t*) &(save_struc->first)); @@ -3387,11 +3387,11 @@ _cfsml_write_list_t(Common::WriteStream *fh, list_t* save_struc) WSprintf(fh, "}"); } -#line 486 "../../engines/sci/engine/savegame.cfsml" +#line 486 "engines/sci/engine/savegame.cfsml" static int _cfsml_read_list_t(Common::SeekableReadStream *fh, list_t* save_struc, const char *lastval, int *line, int *hiteof) { -#line 541 "../../engines/sci/engine/savegame.cfsml" +#line 541 "engines/sci/engine/savegame.cfsml" char *token; int assignment, closed; @@ -3424,20 +3424,20 @@ _cfsml_read_list_t(Common::SeekableReadStream *fh, list_t* save_struc, const cha return CFSML_FAILURE; } if (!strcmp(token, "first")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (read_reg_t(fh, (reg_t*) &(save_struc->first), value, line, hiteof)) { _cfsml_error("Token expected by read_reg_t() for first at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "last")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (read_reg_t(fh, (reg_t*) &(save_struc->last), value, line, hiteof)) { _cfsml_error("Token expected by read_reg_t() for last at line %d\n", *line); return CFSML_FAILURE; } } else -#line 699 "../../engines/sci/engine/savegame.cfsml" +#line 699 "engines/sci/engine/savegame.cfsml" { _cfsml_error("list_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -3447,11 +3447,11 @@ _cfsml_read_list_t(Common::SeekableReadStream *fh, list_t* save_struc, const cha return CFSML_SUCCESS; } -#line 395 "../../engines/sci/engine/savegame.cfsml" +#line 395 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_sys_string_t(Common::WriteStream *fh, sys_string_t* save_struc) { -#line 412 "../../engines/sci/engine/savegame.cfsml" +#line 412 "engines/sci/engine/savegame.cfsml" WSprintf(fh, "{\n"); WSprintf(fh, "name = "); _cfsml_write_string(fh, (char **) &(save_struc->name)); @@ -3465,11 +3465,11 @@ _cfsml_write_sys_string_t(Common::WriteStream *fh, sys_string_t* save_struc) WSprintf(fh, "}"); } -#line 486 "../../engines/sci/engine/savegame.cfsml" +#line 486 "engines/sci/engine/savegame.cfsml" static int _cfsml_read_sys_string_t(Common::SeekableReadStream *fh, sys_string_t* save_struc, const char *lastval, int *line, int *hiteof) { -#line 541 "../../engines/sci/engine/savegame.cfsml" +#line 541 "engines/sci/engine/savegame.cfsml" char *token; int assignment, closed; @@ -3502,27 +3502,27 @@ _cfsml_read_sys_string_t(Common::SeekableReadStream *fh, sys_string_t* save_stru return CFSML_FAILURE; } if (!strcmp(token, "name")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_string(fh, (char **) &(save_struc->name), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_string() for name at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "max_size")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->max_size), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for max_size at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "value")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_string(fh, (char **) &(save_struc->value), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_string() for value at line %d\n", *line); return CFSML_FAILURE; } } else -#line 699 "../../engines/sci/engine/savegame.cfsml" +#line 699 "engines/sci/engine/savegame.cfsml" { _cfsml_error("sys_string_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -3532,11 +3532,11 @@ _cfsml_read_sys_string_t(Common::SeekableReadStream *fh, sys_string_t* save_stru return CFSML_SUCCESS; } -#line 395 "../../engines/sci/engine/savegame.cfsml" +#line 395 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_script_t(Common::WriteStream *fh, script_t* save_struc) { -#line 412 "../../engines/sci/engine/savegame.cfsml" +#line 412 "engines/sci/engine/savegame.cfsml" WSprintf(fh, "{\n"); WSprintf(fh, "nr = "); _cfsml_write_int(fh, (int*) &(save_struc->nr)); @@ -3573,7 +3573,7 @@ _cfsml_write_script_t(Common::WriteStream *fh, script_t* save_struc) min = max = save_struc->objects_allocated; if (!save_struc->objects) min = max = 0; /* Don't write if it points to NULL */ -#line 439 "../../engines/sci/engine/savegame.cfsml" +#line 439 "engines/sci/engine/savegame.cfsml" WSprintf(fh, "[%d][\n", max); for (int i = 0; i < min; i++) { _cfsml_write_object_t(fh, &(save_struc->objects[i])); @@ -3593,11 +3593,11 @@ _cfsml_write_script_t(Common::WriteStream *fh, script_t* save_struc) WSprintf(fh, "}"); } -#line 486 "../../engines/sci/engine/savegame.cfsml" +#line 486 "engines/sci/engine/savegame.cfsml" static int _cfsml_read_script_t(Common::SeekableReadStream *fh, script_t* save_struc, const char *lastval, int *line, int *hiteof) { -#line 541 "../../engines/sci/engine/savegame.cfsml" +#line 541 "engines/sci/engine/savegame.cfsml" char *token; int assignment, closed; @@ -3630,83 +3630,83 @@ _cfsml_read_script_t(Common::SeekableReadStream *fh, script_t* save_struc, const return CFSML_FAILURE; } if (!strcmp(token, "nr")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->nr), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for nr at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "buf_size")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_size_t(fh, (size_t*) &(save_struc->buf_size), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_size_t() for buf_size at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "script_size")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_size_t(fh, (size_t*) &(save_struc->script_size), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_size_t() for script_size at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "heap_size")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_size_t(fh, (size_t*) &(save_struc->heap_size), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_size_t() for heap_size at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "obj_indices")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (read_int_hash_map_tp(fh, (int_hash_map_t **) &(save_struc->obj_indices), value, line, hiteof)) { _cfsml_error("Token expected by read_int_hash_map_tp() for obj_indices at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "exports_nr")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->exports_nr), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for exports_nr at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "synonyms_nr")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->synonyms_nr), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for synonyms_nr at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "lockers")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->lockers), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for lockers at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "objects_allocated")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->objects_allocated), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for objects_allocated at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "objects_nr")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->objects_nr), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for objects_nr at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "objects")) { -#line 604 "../../engines/sci/engine/savegame.cfsml" +#line 604 "engines/sci/engine/savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; } int max,done,i; -#line 615 "../../engines/sci/engine/savegame.cfsml" +#line 615 "engines/sci/engine/savegame.cfsml" // Prepare to restore dynamic array max = strtol(value + 1, NULL, 0); if (max < 0) { @@ -3722,11 +3722,11 @@ _cfsml_read_script_t(Common::SeekableReadStream *fh, script_t* save_struc, const _cfsml_register_pointer(save_struc->objects); } else save_struc->objects = NULL; -#line 639 "../../engines/sci/engine/savegame.cfsml" +#line 639 "engines/sci/engine/savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) { -#line 647 "../../engines/sci/engine/savegame.cfsml" +#line 647 "engines/sci/engine/savegame.cfsml" _cfsml_error("Token expected at line %d\n", *line); return 1; } @@ -3745,27 +3745,27 @@ _cfsml_read_script_t(Common::SeekableReadStream *fh, script_t* save_struc, const save_struc->objects_allocated = max ; // Set array size accordingly } else if (!strcmp(token, "locals_offset")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->locals_offset), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for locals_offset at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "locals_segment")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->locals_segment), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for locals_segment at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "marked_as_deleted")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->marked_as_deleted), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for marked_as_deleted at line %d\n", *line); return CFSML_FAILURE; } } else -#line 699 "../../engines/sci/engine/savegame.cfsml" +#line 699 "engines/sci/engine/savegame.cfsml" { _cfsml_error("script_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -3775,11 +3775,11 @@ _cfsml_read_script_t(Common::SeekableReadStream *fh, script_t* save_struc, const return CFSML_SUCCESS; } -#line 395 "../../engines/sci/engine/savegame.cfsml" +#line 395 "engines/sci/engine/savegame.cfsml" static void _cfsml_write_seg_manager_t(Common::WriteStream *fh, seg_manager_t* save_struc) { -#line 412 "../../engines/sci/engine/savegame.cfsml" +#line 412 "engines/sci/engine/savegame.cfsml" WSprintf(fh, "{\n"); WSprintf(fh, "id_seg_map = "); write_int_hash_map_tp(fh, (int_hash_map_t **) &(save_struc->id_seg_map)); @@ -3789,7 +3789,7 @@ _cfsml_write_seg_manager_t(Common::WriteStream *fh, seg_manager_t* save_struc) min = max = save_struc->heap_size; if (!save_struc->heap) min = max = 0; /* Don't write if it points to NULL */ -#line 439 "../../engines/sci/engine/savegame.cfsml" +#line 439 "engines/sci/engine/savegame.cfsml" WSprintf(fh, "[%d][\n", max); for (int i = 0; i < min; i++) { write_mem_obj_tp(fh, &(save_struc->heap[i])); @@ -3827,11 +3827,11 @@ _cfsml_write_seg_manager_t(Common::WriteStream *fh, seg_manager_t* save_struc) WSprintf(fh, "}"); } -#line 486 "../../engines/sci/engine/savegame.cfsml" +#line 486 "engines/sci/engine/savegame.cfsml" static int _cfsml_read_seg_manager_t(Common::SeekableReadStream *fh, seg_manager_t* save_struc, const char *lastval, int *line, int *hiteof) { -#line 541 "../../engines/sci/engine/savegame.cfsml" +#line 541 "engines/sci/engine/savegame.cfsml" char *token; int assignment, closed; @@ -3864,20 +3864,20 @@ _cfsml_read_seg_manager_t(Common::SeekableReadStream *fh, seg_manager_t* save_st return CFSML_FAILURE; } if (!strcmp(token, "id_seg_map")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (read_int_hash_map_tp(fh, (int_hash_map_t **) &(save_struc->id_seg_map), value, line, hiteof)) { _cfsml_error("Token expected by read_int_hash_map_tp() for id_seg_map at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "heap")) { -#line 604 "../../engines/sci/engine/savegame.cfsml" +#line 604 "engines/sci/engine/savegame.cfsml" if ((value[0] != '[') || (value[strlen(value) - 1] != '[')) { _cfsml_error("Opening brackets expected at line %d\n", *line); return CFSML_FAILURE; } int max,done,i; -#line 615 "../../engines/sci/engine/savegame.cfsml" +#line 615 "engines/sci/engine/savegame.cfsml" // Prepare to restore dynamic array max = strtol(value + 1, NULL, 0); if (max < 0) { @@ -3893,11 +3893,11 @@ _cfsml_read_seg_manager_t(Common::SeekableReadStream *fh, seg_manager_t* save_st _cfsml_register_pointer(save_struc->heap); } else save_struc->heap = NULL; -#line 639 "../../engines/sci/engine/savegame.cfsml" +#line 639 "engines/sci/engine/savegame.cfsml" done = i = 0; do { if (!(value = _cfsml_get_identifier(fh, line, hiteof, NULL))) { -#line 647 "../../engines/sci/engine/savegame.cfsml" +#line 647 "engines/sci/engine/savegame.cfsml" _cfsml_error("Token expected at line %d\n", *line); return 1; } @@ -3916,69 +3916,69 @@ _cfsml_read_seg_manager_t(Common::SeekableReadStream *fh, seg_manager_t* save_st save_struc->heap_size = max ; // Set array size accordingly } else if (!strcmp(token, "heap_size")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->heap_size), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for heap_size at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "reserved_id")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->reserved_id), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for reserved_id at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "exports_wide")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->exports_wide), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for exports_wide at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "sci1_1")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->sci1_1), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for sci1_1 at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "gc_mark_bits")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_int(fh, (int*) &(save_struc->gc_mark_bits), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_int() for gc_mark_bits at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "mem_allocated")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_size_t(fh, (size_t*) &(save_struc->mem_allocated), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_size_t() for mem_allocated at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "clones_seg_id")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_seg_id_t(fh, (seg_id_t*) &(save_struc->clones_seg_id), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_seg_id_t() for clones_seg_id at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "lists_seg_id")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_seg_id_t(fh, (seg_id_t*) &(save_struc->lists_seg_id), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_seg_id_t() for lists_seg_id at line %d\n", *line); return CFSML_FAILURE; } } else if (!strcmp(token, "nodes_seg_id")) { -#line 690 "../../engines/sci/engine/savegame.cfsml" +#line 690 "engines/sci/engine/savegame.cfsml" if (_cfsml_read_seg_id_t(fh, (seg_id_t*) &(save_struc->nodes_seg_id), value, line, hiteof)) { _cfsml_error("Token expected by _cfsml_read_seg_id_t() for nodes_seg_id at line %d\n", *line); return CFSML_FAILURE; } } else -#line 699 "../../engines/sci/engine/savegame.cfsml" +#line 699 "engines/sci/engine/savegame.cfsml" { _cfsml_error("seg_manager_t: Assignment to invalid identifier '%s' in line %d\n", token, *line); return CFSML_FAILURE; @@ -3991,7 +3991,7 @@ _cfsml_read_seg_manager_t(Common::SeekableReadStream *fh, seg_manager_t* save_st // Auto-generated CFSML declaration and function block ends here // Auto-generation performed by cfsml.pl 0.8.2 -#line 444 "../../engines/sci/engine/savegame.cfsml" +#line 446 "engines/sci/engine/savegame.cfsml" void write_songlib_t(Common::WriteStream *fh, songlib_t *songlib) { song_t *seeker = *(songlib->lib); @@ -4003,12 +4003,12 @@ void write_songlib_t(Common::WriteStream *fh, songlib_t *songlib) { WSprintf(fh, "[\n"); while (seeker) { seeker->restore_time = seeker->it->get_timepos(seeker->it); -#line 814 "../../engines/sci/engine/savegame.cfsml" +#line 814 "engines/sci/engine/savegame.cfsml" // Auto-generated CFSML data writer code _cfsml_write_song_t(fh, seeker); WSprintf(fh, "\n"); // End of auto-generated CFSML data writer code -#line 456 "../../engines/sci/engine/savegame.cfsml" +#line 458 "engines/sci/engine/savegame.cfsml" seeker = seeker->next; } WSprintf(fh, "]\n"); @@ -4033,17 +4033,17 @@ int read_songlib_t(Common::SeekableReadStream *fh, songlib_t *songlib, const cha song_lib_init(songlib); for (i = 0; i < songcount; i++) { // Auto-generated CFSML data reader code -#line 763 "../../engines/sci/engine/savegame.cfsml" +#line 763 "engines/sci/engine/savegame.cfsml" { -#line 774 "../../engines/sci/engine/savegame.cfsml" +#line 774 "engines/sci/engine/savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; -#line 778 "../../engines/sci/engine/savegame.cfsml" +#line 778 "engines/sci/engine/savegame.cfsml" const char *_cfsml_inp = lastval; -#line 785 "../../engines/sci/engine/savegame.cfsml" +#line 785 "engines/sci/engine/savegame.cfsml" _cfsml_error = read_song_tp(fh, &newsong, _cfsml_inp, &(*line), &_cfsml_eof); -#line 789 "../../engines/sci/engine/savegame.cfsml" +#line 789 "engines/sci/engine/savegame.cfsml" *hiteof = _cfsml_error; -#line 796 "../../engines/sci/engine/savegame.cfsml" +#line 796 "engines/sci/engine/savegame.cfsml" if (_cfsml_last_value_retrieved) { free(_cfsml_last_value_retrieved); _cfsml_last_value_retrieved = NULL; @@ -4054,7 +4054,7 @@ int read_songlib_t(Common::SeekableReadStream *fh, songlib_t *songlib, const cha } } // End of auto-generated CFSML data reader code -#line 480 "../../engines/sci/engine/savegame.cfsml" +#line 482 "engines/sci/engine/savegame.cfsml" song_lib_add(*songlib, newsong); } l = fh->readLine(); // "]" @@ -4090,24 +4090,24 @@ int mem_obj_string_to_enum(const char *str) { } void write_int_hash_map_tp(Common::WriteStream *fh, int_hash_map_t **foo) { -#line 814 "../../engines/sci/engine/savegame.cfsml" +#line 814 "engines/sci/engine/savegame.cfsml" // Auto-generated CFSML data writer code _cfsml_write_int_hash_map_t(fh, *foo); WSprintf(fh, "\n"); // End of auto-generated CFSML data writer code -#line 516 "../../engines/sci/engine/savegame.cfsml" +#line 518 "engines/sci/engine/savegame.cfsml" } void write_song_tp(Common::WriteStream *fh, song_t **foo) { -#line 814 "../../engines/sci/engine/savegame.cfsml" +#line 814 "engines/sci/engine/savegame.cfsml" // Auto-generated CFSML data writer code _cfsml_write_song_t(fh, *foo); WSprintf(fh, "\n"); // End of auto-generated CFSML data writer code -#line 520 "../../engines/sci/engine/savegame.cfsml" +#line 522 "engines/sci/engine/savegame.cfsml" } -song_iterator_t *build_iterator(state_t *s, int song_nr, int type, songit_id_t id); +song_iterator_t *build_iterator(EngineState *s, int song_nr, int type, songit_id_t id); int read_song_tp(Common::SeekableReadStream *fh, song_t **foo, const char *lastval, int *line, int *hiteof) { char *token; @@ -4115,17 +4115,17 @@ int read_song_tp(Common::SeekableReadStream *fh, song_t **foo, const char *lastv *foo = (song_t*) malloc(sizeof(song_t)); token = _cfsml_get_identifier(fh, line, hiteof, &assignment); // Auto-generated CFSML data reader code -#line 763 "../../engines/sci/engine/savegame.cfsml" +#line 763 "engines/sci/engine/savegame.cfsml" { -#line 774 "../../engines/sci/engine/savegame.cfsml" +#line 774 "engines/sci/engine/savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; -#line 778 "../../engines/sci/engine/savegame.cfsml" +#line 778 "engines/sci/engine/savegame.cfsml" const char *_cfsml_inp = token; -#line 785 "../../engines/sci/engine/savegame.cfsml" +#line 785 "engines/sci/engine/savegame.cfsml" _cfsml_error = _cfsml_read_song_t(fh, (*foo), _cfsml_inp, &(*line), &_cfsml_eof); -#line 789 "../../engines/sci/engine/savegame.cfsml" +#line 789 "engines/sci/engine/savegame.cfsml" *hiteof = _cfsml_error; -#line 796 "../../engines/sci/engine/savegame.cfsml" +#line 796 "engines/sci/engine/savegame.cfsml" if (_cfsml_last_value_retrieved) { free(_cfsml_last_value_retrieved); _cfsml_last_value_retrieved = NULL; @@ -4136,7 +4136,7 @@ int read_song_tp(Common::SeekableReadStream *fh, song_t **foo, const char *lastv } } // End of auto-generated CFSML data reader code -#line 530 "../../engines/sci/engine/savegame.cfsml" +#line 532 "engines/sci/engine/savegame.cfsml" (*foo)->delay = 0; (*foo)->it = NULL; (*foo)->next_playing = (*foo)->next_stopping = (*foo)->next = NULL; @@ -4146,17 +4146,17 @@ int read_song_tp(Common::SeekableReadStream *fh, song_t **foo, const char *lastv int read_int_hash_map_tp(Common::SeekableReadStream *fh, int_hash_map_t **foo, const char *lastval, int *line, int *hiteof) { *foo = new int_hash_map_t; // Auto-generated CFSML data reader code -#line 763 "../../engines/sci/engine/savegame.cfsml" +#line 763 "engines/sci/engine/savegame.cfsml" { -#line 774 "../../engines/sci/engine/savegame.cfsml" +#line 774 "engines/sci/engine/savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; -#line 778 "../../engines/sci/engine/savegame.cfsml" +#line 778 "engines/sci/engine/savegame.cfsml" const char *_cfsml_inp = lastval; -#line 785 "../../engines/sci/engine/savegame.cfsml" +#line 785 "engines/sci/engine/savegame.cfsml" _cfsml_error = _cfsml_read_int_hash_map_t(fh, (*foo), _cfsml_inp, &(*line), &_cfsml_eof); -#line 789 "../../engines/sci/engine/savegame.cfsml" +#line 789 "engines/sci/engine/savegame.cfsml" *hiteof = _cfsml_error; -#line 796 "../../engines/sci/engine/savegame.cfsml" +#line 796 "engines/sci/engine/savegame.cfsml" if (_cfsml_last_value_retrieved) { free(_cfsml_last_value_retrieved); _cfsml_last_value_retrieved = NULL; @@ -4167,7 +4167,7 @@ int read_int_hash_map_tp(Common::SeekableReadStream *fh, int_hash_map_t **foo, c } } // End of auto-generated CFSML data reader code -#line 539 "../../engines/sci/engine/savegame.cfsml" +#line 541 "engines/sci/engine/savegame.cfsml" (*foo)->holes = NULL; return 0; } @@ -4178,12 +4178,12 @@ void write_int_hash_map_node_tp(Common::WriteStream *fh, int_hash_map_t::node_t } else { WSprintf(fh,"[\n%d=>%d\n", (*foo)->name, (*foo)->value); if ((*foo)->next) { -#line 814 "../../engines/sci/engine/savegame.cfsml" +#line 814 "engines/sci/engine/savegame.cfsml" // Auto-generated CFSML data writer code write_int_hash_map_node_tp(fh, &((*foo)->next)); WSprintf(fh, "\n"); // End of auto-generated CFSML data writer code -#line 550 "../../engines/sci/engine/savegame.cfsml" +#line 552 "engines/sci/engine/savegame.cfsml" } else WSprintf(fh, "L"); WSprintf(fh, "]"); @@ -4228,12 +4228,12 @@ int read_int_hash_map_node_tp(Common::SeekableReadStream *fh, int_hash_map_t::no void write_menubar_tp(Common::WriteStream *fh, menubar_t **foo) { if (*foo) { -#line 814 "../../engines/sci/engine/savegame.cfsml" +#line 814 "engines/sci/engine/savegame.cfsml" // Auto-generated CFSML data writer code _cfsml_write_menubar_t(fh, (*foo)); WSprintf(fh, "\n"); // End of auto-generated CFSML data writer code -#line 595 "../../engines/sci/engine/savegame.cfsml" +#line 597 "engines/sci/engine/savegame.cfsml" } else { // Nothing to write WSprintf(fh, "\\null\\"); } @@ -4246,17 +4246,17 @@ int read_menubar_tp(Common::SeekableReadStream *fh, menubar_t **foo, const char } else { *foo = (menubar_t *) sci_malloc(sizeof(menubar_t)); // Auto-generated CFSML data reader code -#line 763 "../../engines/sci/engine/savegame.cfsml" +#line 763 "engines/sci/engine/savegame.cfsml" { -#line 774 "../../engines/sci/engine/savegame.cfsml" +#line 774 "engines/sci/engine/savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; -#line 778 "../../engines/sci/engine/savegame.cfsml" +#line 778 "engines/sci/engine/savegame.cfsml" const char *_cfsml_inp = lastval; -#line 785 "../../engines/sci/engine/savegame.cfsml" +#line 785 "engines/sci/engine/savegame.cfsml" _cfsml_error = _cfsml_read_menubar_t(fh, (*foo), _cfsml_inp, &(*line), &_cfsml_eof); -#line 789 "../../engines/sci/engine/savegame.cfsml" +#line 789 "engines/sci/engine/savegame.cfsml" *hiteof = _cfsml_error; -#line 796 "../../engines/sci/engine/savegame.cfsml" +#line 796 "engines/sci/engine/savegame.cfsml" if (_cfsml_last_value_retrieved) { free(_cfsml_last_value_retrieved); _cfsml_last_value_retrieved = NULL; @@ -4267,85 +4267,85 @@ int read_menubar_tp(Common::SeekableReadStream *fh, menubar_t **foo, const char } } // End of auto-generated CFSML data reader code -#line 607 "../../engines/sci/engine/savegame.cfsml" +#line 609 "engines/sci/engine/savegame.cfsml" } return *hiteof; } void write_mem_obj_t(Common::WriteStream *fh, mem_obj_t *foo) { WSprintf(fh, "%s\n", mem_obj_string_names[foo->type].name); -#line 814 "../../engines/sci/engine/savegame.cfsml" +#line 814 "engines/sci/engine/savegame.cfsml" // Auto-generated CFSML data writer code _cfsml_write_int(fh, &foo->segmgr_id); WSprintf(fh, "\n"); // End of auto-generated CFSML data writer code -#line 614 "../../engines/sci/engine/savegame.cfsml" +#line 616 "engines/sci/engine/savegame.cfsml" switch (foo->type) { case MEM_OBJ_SCRIPT: -#line 814 "../../engines/sci/engine/savegame.cfsml" +#line 814 "engines/sci/engine/savegame.cfsml" // Auto-generated CFSML data writer code _cfsml_write_script_t(fh, &foo->data.script); WSprintf(fh, "\n"); // End of auto-generated CFSML data writer code -#line 617 "../../engines/sci/engine/savegame.cfsml" +#line 619 "engines/sci/engine/savegame.cfsml" break; case MEM_OBJ_CLONES: -#line 814 "../../engines/sci/engine/savegame.cfsml" +#line 814 "engines/sci/engine/savegame.cfsml" // Auto-generated CFSML data writer code _cfsml_write_clone_table_t(fh, &foo->data.clones); WSprintf(fh, "\n"); // End of auto-generated CFSML data writer code -#line 620 "../../engines/sci/engine/savegame.cfsml" +#line 622 "engines/sci/engine/savegame.cfsml" break; case MEM_OBJ_LOCALS: -#line 814 "../../engines/sci/engine/savegame.cfsml" +#line 814 "engines/sci/engine/savegame.cfsml" // Auto-generated CFSML data writer code _cfsml_write_local_variables_t(fh, &foo->data.locals); WSprintf(fh, "\n"); // End of auto-generated CFSML data writer code -#line 623 "../../engines/sci/engine/savegame.cfsml" +#line 625 "engines/sci/engine/savegame.cfsml" break; case MEM_OBJ_SYS_STRINGS: -#line 814 "../../engines/sci/engine/savegame.cfsml" +#line 814 "engines/sci/engine/savegame.cfsml" // Auto-generated CFSML data writer code _cfsml_write_sys_strings_t(fh, &foo->data.sys_strings); WSprintf(fh, "\n"); // End of auto-generated CFSML data writer code -#line 626 "../../engines/sci/engine/savegame.cfsml" +#line 628 "engines/sci/engine/savegame.cfsml" break; case MEM_OBJ_STACK: -#line 814 "../../engines/sci/engine/savegame.cfsml" +#line 814 "engines/sci/engine/savegame.cfsml" // Auto-generated CFSML data writer code _cfsml_write_int(fh, &foo->data.stack.nr); WSprintf(fh, "\n"); // End of auto-generated CFSML data writer code -#line 629 "../../engines/sci/engine/savegame.cfsml" +#line 631 "engines/sci/engine/savegame.cfsml" break; case MEM_OBJ_HUNK: break; case MEM_OBJ_LISTS: -#line 814 "../../engines/sci/engine/savegame.cfsml" +#line 814 "engines/sci/engine/savegame.cfsml" // Auto-generated CFSML data writer code _cfsml_write_list_table_t(fh, &foo->data.lists); WSprintf(fh, "\n"); // End of auto-generated CFSML data writer code -#line 634 "../../engines/sci/engine/savegame.cfsml" +#line 636 "engines/sci/engine/savegame.cfsml" break; case MEM_OBJ_NODES: -#line 814 "../../engines/sci/engine/savegame.cfsml" +#line 814 "engines/sci/engine/savegame.cfsml" // Auto-generated CFSML data writer code _cfsml_write_node_table_t(fh, &foo->data.nodes); WSprintf(fh, "\n"); // End of auto-generated CFSML data writer code -#line 637 "../../engines/sci/engine/savegame.cfsml" +#line 639 "engines/sci/engine/savegame.cfsml" break; case MEM_OBJ_DYNMEM: -#line 814 "../../engines/sci/engine/savegame.cfsml" +#line 814 "engines/sci/engine/savegame.cfsml" // Auto-generated CFSML data writer code _cfsml_write_dynmem_t(fh, &foo->data.dynmem); WSprintf(fh, "\n"); // End of auto-generated CFSML data writer code -#line 640 "../../engines/sci/engine/savegame.cfsml" +#line 642 "engines/sci/engine/savegame.cfsml" break; } } @@ -4358,18 +4358,18 @@ int read_mem_obj_t(Common::SeekableReadStream *fh, mem_obj_t *foo, const char *l } // Auto-generated CFSML data reader code -#line 763 "../../engines/sci/engine/savegame.cfsml" +#line 763 "engines/sci/engine/savegame.cfsml" { -#line 774 "../../engines/sci/engine/savegame.cfsml" +#line 774 "engines/sci/engine/savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; -#line 781 "../../engines/sci/engine/savegame.cfsml" +#line 781 "engines/sci/engine/savegame.cfsml" const char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, 0); -#line 785 "../../engines/sci/engine/savegame.cfsml" +#line 785 "engines/sci/engine/savegame.cfsml" _cfsml_error = _cfsml_read_int(fh, &foo->segmgr_id, _cfsml_inp, &(*line), &_cfsml_eof); -#line 789 "../../engines/sci/engine/savegame.cfsml" +#line 789 "engines/sci/engine/savegame.cfsml" *hiteof = _cfsml_error; -#line 796 "../../engines/sci/engine/savegame.cfsml" +#line 796 "engines/sci/engine/savegame.cfsml" if (_cfsml_last_value_retrieved) { free(_cfsml_last_value_retrieved); _cfsml_last_value_retrieved = NULL; @@ -4380,22 +4380,22 @@ int read_mem_obj_t(Common::SeekableReadStream *fh, mem_obj_t *foo, const char *l } } // End of auto-generated CFSML data reader code -#line 652 "../../engines/sci/engine/savegame.cfsml" +#line 654 "engines/sci/engine/savegame.cfsml" switch (foo->type) { case MEM_OBJ_SCRIPT: // Auto-generated CFSML data reader code -#line 763 "../../engines/sci/engine/savegame.cfsml" +#line 763 "engines/sci/engine/savegame.cfsml" { -#line 774 "../../engines/sci/engine/savegame.cfsml" +#line 774 "engines/sci/engine/savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; -#line 781 "../../engines/sci/engine/savegame.cfsml" +#line 781 "engines/sci/engine/savegame.cfsml" const char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, 0); -#line 785 "../../engines/sci/engine/savegame.cfsml" +#line 785 "engines/sci/engine/savegame.cfsml" _cfsml_error = _cfsml_read_script_t(fh, &foo->data.script, _cfsml_inp, &(*line), &_cfsml_eof); -#line 789 "../../engines/sci/engine/savegame.cfsml" +#line 789 "engines/sci/engine/savegame.cfsml" *hiteof = _cfsml_error; -#line 796 "../../engines/sci/engine/savegame.cfsml" +#line 796 "engines/sci/engine/savegame.cfsml" if (_cfsml_last_value_retrieved) { free(_cfsml_last_value_retrieved); _cfsml_last_value_retrieved = NULL; @@ -4406,22 +4406,22 @@ int read_mem_obj_t(Common::SeekableReadStream *fh, mem_obj_t *foo, const char *l } } // End of auto-generated CFSML data reader code -#line 655 "../../engines/sci/engine/savegame.cfsml" +#line 657 "engines/sci/engine/savegame.cfsml" break; case MEM_OBJ_CLONES: // Auto-generated CFSML data reader code -#line 763 "../../engines/sci/engine/savegame.cfsml" +#line 763 "engines/sci/engine/savegame.cfsml" { -#line 774 "../../engines/sci/engine/savegame.cfsml" +#line 774 "engines/sci/engine/savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; -#line 781 "../../engines/sci/engine/savegame.cfsml" +#line 781 "engines/sci/engine/savegame.cfsml" const char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, 0); -#line 785 "../../engines/sci/engine/savegame.cfsml" +#line 785 "engines/sci/engine/savegame.cfsml" _cfsml_error = _cfsml_read_clone_table_t(fh, &foo->data.clones, _cfsml_inp, &(*line), &_cfsml_eof); -#line 789 "../../engines/sci/engine/savegame.cfsml" +#line 789 "engines/sci/engine/savegame.cfsml" *hiteof = _cfsml_error; -#line 796 "../../engines/sci/engine/savegame.cfsml" +#line 796 "engines/sci/engine/savegame.cfsml" if (_cfsml_last_value_retrieved) { free(_cfsml_last_value_retrieved); _cfsml_last_value_retrieved = NULL; @@ -4432,22 +4432,22 @@ int read_mem_obj_t(Common::SeekableReadStream *fh, mem_obj_t *foo, const char *l } } // End of auto-generated CFSML data reader code -#line 658 "../../engines/sci/engine/savegame.cfsml" +#line 660 "engines/sci/engine/savegame.cfsml" break; case MEM_OBJ_LOCALS: // Auto-generated CFSML data reader code -#line 763 "../../engines/sci/engine/savegame.cfsml" +#line 763 "engines/sci/engine/savegame.cfsml" { -#line 774 "../../engines/sci/engine/savegame.cfsml" +#line 774 "engines/sci/engine/savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; -#line 781 "../../engines/sci/engine/savegame.cfsml" +#line 781 "engines/sci/engine/savegame.cfsml" const char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, 0); -#line 785 "../../engines/sci/engine/savegame.cfsml" +#line 785 "engines/sci/engine/savegame.cfsml" _cfsml_error = _cfsml_read_local_variables_t(fh, &foo->data.locals, _cfsml_inp, &(*line), &_cfsml_eof); -#line 789 "../../engines/sci/engine/savegame.cfsml" +#line 789 "engines/sci/engine/savegame.cfsml" *hiteof = _cfsml_error; -#line 796 "../../engines/sci/engine/savegame.cfsml" +#line 796 "engines/sci/engine/savegame.cfsml" if (_cfsml_last_value_retrieved) { free(_cfsml_last_value_retrieved); _cfsml_last_value_retrieved = NULL; @@ -4458,22 +4458,22 @@ int read_mem_obj_t(Common::SeekableReadStream *fh, mem_obj_t *foo, const char *l } } // End of auto-generated CFSML data reader code -#line 661 "../../engines/sci/engine/savegame.cfsml" +#line 663 "engines/sci/engine/savegame.cfsml" break; case MEM_OBJ_SYS_STRINGS: // Auto-generated CFSML data reader code -#line 763 "../../engines/sci/engine/savegame.cfsml" +#line 763 "engines/sci/engine/savegame.cfsml" { -#line 774 "../../engines/sci/engine/savegame.cfsml" +#line 774 "engines/sci/engine/savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; -#line 781 "../../engines/sci/engine/savegame.cfsml" +#line 781 "engines/sci/engine/savegame.cfsml" const char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, 0); -#line 785 "../../engines/sci/engine/savegame.cfsml" +#line 785 "engines/sci/engine/savegame.cfsml" _cfsml_error = _cfsml_read_sys_strings_t(fh, &foo->data.sys_strings, _cfsml_inp, &(*line), &_cfsml_eof); -#line 789 "../../engines/sci/engine/savegame.cfsml" +#line 789 "engines/sci/engine/savegame.cfsml" *hiteof = _cfsml_error; -#line 796 "../../engines/sci/engine/savegame.cfsml" +#line 796 "engines/sci/engine/savegame.cfsml" if (_cfsml_last_value_retrieved) { free(_cfsml_last_value_retrieved); _cfsml_last_value_retrieved = NULL; @@ -4484,22 +4484,22 @@ int read_mem_obj_t(Common::SeekableReadStream *fh, mem_obj_t *foo, const char *l } } // End of auto-generated CFSML data reader code -#line 664 "../../engines/sci/engine/savegame.cfsml" +#line 666 "engines/sci/engine/savegame.cfsml" break; case MEM_OBJ_LISTS: // Auto-generated CFSML data reader code -#line 763 "../../engines/sci/engine/savegame.cfsml" +#line 763 "engines/sci/engine/savegame.cfsml" { -#line 774 "../../engines/sci/engine/savegame.cfsml" +#line 774 "engines/sci/engine/savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; -#line 781 "../../engines/sci/engine/savegame.cfsml" +#line 781 "engines/sci/engine/savegame.cfsml" const char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, 0); -#line 785 "../../engines/sci/engine/savegame.cfsml" +#line 785 "engines/sci/engine/savegame.cfsml" _cfsml_error = _cfsml_read_list_table_t(fh, &foo->data.lists, _cfsml_inp, &(*line), &_cfsml_eof); -#line 789 "../../engines/sci/engine/savegame.cfsml" +#line 789 "engines/sci/engine/savegame.cfsml" *hiteof = _cfsml_error; -#line 796 "../../engines/sci/engine/savegame.cfsml" +#line 796 "engines/sci/engine/savegame.cfsml" if (_cfsml_last_value_retrieved) { free(_cfsml_last_value_retrieved); _cfsml_last_value_retrieved = NULL; @@ -4510,22 +4510,22 @@ int read_mem_obj_t(Common::SeekableReadStream *fh, mem_obj_t *foo, const char *l } } // End of auto-generated CFSML data reader code -#line 667 "../../engines/sci/engine/savegame.cfsml" +#line 669 "engines/sci/engine/savegame.cfsml" break; case MEM_OBJ_NODES: // Auto-generated CFSML data reader code -#line 763 "../../engines/sci/engine/savegame.cfsml" +#line 763 "engines/sci/engine/savegame.cfsml" { -#line 774 "../../engines/sci/engine/savegame.cfsml" +#line 774 "engines/sci/engine/savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; -#line 781 "../../engines/sci/engine/savegame.cfsml" +#line 781 "engines/sci/engine/savegame.cfsml" const char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, 0); -#line 785 "../../engines/sci/engine/savegame.cfsml" +#line 785 "engines/sci/engine/savegame.cfsml" _cfsml_error = _cfsml_read_node_table_t(fh, &foo->data.nodes, _cfsml_inp, &(*line), &_cfsml_eof); -#line 789 "../../engines/sci/engine/savegame.cfsml" +#line 789 "engines/sci/engine/savegame.cfsml" *hiteof = _cfsml_error; -#line 796 "../../engines/sci/engine/savegame.cfsml" +#line 796 "engines/sci/engine/savegame.cfsml" if (_cfsml_last_value_retrieved) { free(_cfsml_last_value_retrieved); _cfsml_last_value_retrieved = NULL; @@ -4536,22 +4536,22 @@ int read_mem_obj_t(Common::SeekableReadStream *fh, mem_obj_t *foo, const char *l } } // End of auto-generated CFSML data reader code -#line 670 "../../engines/sci/engine/savegame.cfsml" +#line 672 "engines/sci/engine/savegame.cfsml" break; case MEM_OBJ_STACK: // Auto-generated CFSML data reader code -#line 763 "../../engines/sci/engine/savegame.cfsml" +#line 763 "engines/sci/engine/savegame.cfsml" { -#line 774 "../../engines/sci/engine/savegame.cfsml" +#line 774 "engines/sci/engine/savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; -#line 781 "../../engines/sci/engine/savegame.cfsml" +#line 781 "engines/sci/engine/savegame.cfsml" const char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, 0); -#line 785 "../../engines/sci/engine/savegame.cfsml" +#line 785 "engines/sci/engine/savegame.cfsml" _cfsml_error = _cfsml_read_int(fh, &foo->data.stack.nr, _cfsml_inp, &(*line), &_cfsml_eof); -#line 789 "../../engines/sci/engine/savegame.cfsml" +#line 789 "engines/sci/engine/savegame.cfsml" *hiteof = _cfsml_error; -#line 796 "../../engines/sci/engine/savegame.cfsml" +#line 796 "engines/sci/engine/savegame.cfsml" if (_cfsml_last_value_retrieved) { free(_cfsml_last_value_retrieved); _cfsml_last_value_retrieved = NULL; @@ -4562,7 +4562,7 @@ int read_mem_obj_t(Common::SeekableReadStream *fh, mem_obj_t *foo, const char *l } } // End of auto-generated CFSML data reader code -#line 673 "../../engines/sci/engine/savegame.cfsml" +#line 675 "engines/sci/engine/savegame.cfsml" foo->data.stack.entries = (reg_t *)sci_calloc(foo->data.stack.nr, sizeof(reg_t)); break; case MEM_OBJ_HUNK: @@ -4570,18 +4570,18 @@ int read_mem_obj_t(Common::SeekableReadStream *fh, mem_obj_t *foo, const char *l break; case MEM_OBJ_DYNMEM: // Auto-generated CFSML data reader code -#line 763 "../../engines/sci/engine/savegame.cfsml" +#line 763 "engines/sci/engine/savegame.cfsml" { -#line 774 "../../engines/sci/engine/savegame.cfsml" +#line 774 "engines/sci/engine/savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; -#line 781 "../../engines/sci/engine/savegame.cfsml" +#line 781 "engines/sci/engine/savegame.cfsml" const char *_cfsml_inp = _cfsml_get_identifier(fh, &(*line), &_cfsml_eof, 0); -#line 785 "../../engines/sci/engine/savegame.cfsml" +#line 785 "engines/sci/engine/savegame.cfsml" _cfsml_error = _cfsml_read_dynmem_t(fh, &foo->data.dynmem, _cfsml_inp, &(*line), &_cfsml_eof); -#line 789 "../../engines/sci/engine/savegame.cfsml" +#line 789 "engines/sci/engine/savegame.cfsml" *hiteof = _cfsml_error; -#line 796 "../../engines/sci/engine/savegame.cfsml" +#line 796 "engines/sci/engine/savegame.cfsml" if (_cfsml_last_value_retrieved) { free(_cfsml_last_value_retrieved); _cfsml_last_value_retrieved = NULL; @@ -4592,7 +4592,7 @@ int read_mem_obj_t(Common::SeekableReadStream *fh, mem_obj_t *foo, const char *l } } // End of auto-generated CFSML data reader code -#line 680 "../../engines/sci/engine/savegame.cfsml" +#line 682 "engines/sci/engine/savegame.cfsml" break; } @@ -4601,12 +4601,12 @@ int read_mem_obj_t(Common::SeekableReadStream *fh, mem_obj_t *foo, const char *l void write_mem_obj_tp(Common::WriteStream *fh, mem_obj_t **foo) { if (*foo) { -#line 814 "../../engines/sci/engine/savegame.cfsml" +#line 814 "engines/sci/engine/savegame.cfsml" // Auto-generated CFSML data writer code write_mem_obj_t(fh, (*foo)); WSprintf(fh, "\n"); // End of auto-generated CFSML data writer code -#line 689 "../../engines/sci/engine/savegame.cfsml" +#line 691 "engines/sci/engine/savegame.cfsml" } else { // Nothing to write WSprintf(fh, "\\null\\"); } @@ -4618,17 +4618,17 @@ int read_mem_obj_tp(Common::SeekableReadStream *fh, mem_obj_t **foo, const char } else { *foo = (mem_obj_t *)sci_malloc(sizeof(mem_obj_t)); // Auto-generated CFSML data reader code -#line 763 "../../engines/sci/engine/savegame.cfsml" +#line 763 "engines/sci/engine/savegame.cfsml" { -#line 774 "../../engines/sci/engine/savegame.cfsml" +#line 774 "engines/sci/engine/savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; -#line 778 "../../engines/sci/engine/savegame.cfsml" +#line 778 "engines/sci/engine/savegame.cfsml" const char *_cfsml_inp = lastval; -#line 785 "../../engines/sci/engine/savegame.cfsml" +#line 785 "engines/sci/engine/savegame.cfsml" _cfsml_error = read_mem_obj_t(fh, (*foo), _cfsml_inp, &(*line), &_cfsml_eof); -#line 789 "../../engines/sci/engine/savegame.cfsml" +#line 789 "engines/sci/engine/savegame.cfsml" *hiteof = _cfsml_error; -#line 796 "../../engines/sci/engine/savegame.cfsml" +#line 796 "engines/sci/engine/savegame.cfsml" if (_cfsml_last_value_retrieved) { free(_cfsml_last_value_retrieved); _cfsml_last_value_retrieved = NULL; @@ -4639,7 +4639,7 @@ int read_mem_obj_tp(Common::SeekableReadStream *fh, mem_obj_t **foo, const char } } // End of auto-generated CFSML data reader code -#line 700 "../../engines/sci/engine/savegame.cfsml" +#line 702 "engines/sci/engine/savegame.cfsml" return *hiteof; } return 0; @@ -4648,11 +4648,11 @@ int read_mem_obj_tp(Common::SeekableReadStream *fh, mem_obj_t **foo, const char // This function is called to undo some strange stuff done in preparation // to writing a gamestate to disk -void _gamestate_unfrob(state_t *s) { +void _gamestate_unfrob(EngineState *s) { } -int gamestate_save(state_t *s, Common::WriteStream *fh, const char* savename) { +int gamestate_save(EngineState *s, Common::WriteStream *fh, const char* savename) { tm curTime; g_system->getTimeAndDate(curTime); @@ -4688,18 +4688,18 @@ int gamestate_save(state_t *s, Common::WriteStream *fh, const char* savename) { // Calculate the time spent with this game s->game_time = time(NULL) - s->game_start_time.tv_sec; -#line 814 "../../engines/sci/engine/savegame.cfsml" +#line 814 "engines/sci/engine/savegame.cfsml" // Auto-generated CFSML data writer code _cfsml_write_SavegameMetadata(fh, meta); WSprintf(fh, "\n"); // End of auto-generated CFSML data writer code -#line 749 "../../engines/sci/engine/savegame.cfsml" -#line 814 "../../engines/sci/engine/savegame.cfsml" +#line 751 "engines/sci/engine/savegame.cfsml" +#line 814 "engines/sci/engine/savegame.cfsml" // Auto-generated CFSML data writer code - _cfsml_write_state_t(fh, s); + _cfsml_write_EngineState(fh, s); WSprintf(fh, "\n"); // End of auto-generated CFSML data writer code -#line 750 "../../engines/sci/engine/savegame.cfsml" +#line 752 "engines/sci/engine/savegame.cfsml" delete meta; @@ -4718,7 +4718,7 @@ static seg_id_t find_unique_seg_by_type(seg_manager_t *self, int type) { return -1; } -static byte *find_unique_script_block(state_t *s, byte *buf, int type) { +static byte *find_unique_script_block(EngineState *s, byte *buf, int type) { int magic_pos_adder = s->version >= SCI_VERSION_FTU_NEW_SCRIPT_HEADER ? 0 : 2; buf += magic_pos_adder; @@ -4736,7 +4736,7 @@ static byte *find_unique_script_block(state_t *s, byte *buf, int type) { return NULL; } -static void reconstruct_stack(state_t *retval) { +static void reconstruct_stack(EngineState *retval) { seg_id_t stack_seg = find_unique_seg_by_type(&retval->seg_manager, MEM_OBJ_STACK); dstack_t *stack = &(retval->seg_manager.heap[stack_seg]->data.stack); @@ -4761,7 +4761,7 @@ static int clone_entry_used(clone_table_t *table, int n) { return 1; } -static void load_script(state_t *s, seg_id_t seg) { +static void load_script(EngineState *s, seg_id_t seg) { resource_t *script, *heap = NULL; script_t *scr = &(s->seg_manager.heap[seg]->data.script); @@ -4782,7 +4782,7 @@ static void load_script(state_t *s, seg_id_t seg) { } } -static void reconstruct_scripts(state_t *s, seg_manager_t *self) { +static void reconstruct_scripts(EngineState *s, seg_manager_t *self) { int i; mem_obj_t *mobj; for (i = 0; i < self->heap_size; i++) { @@ -4856,7 +4856,7 @@ static void reconstruct_scripts(state_t *s, seg_manager_t *self) { } } -void reconstruct_clones(state_t *s, seg_manager_t *self) { +void reconstruct_clones(EngineState *s, seg_manager_t *self) { int i; mem_obj_t *mobj; @@ -4910,11 +4910,11 @@ void reconstruct_clones(state_t *s, seg_manager_t *self) { } } -int _reset_graphics_input(state_t *s); +int _reset_graphics_input(EngineState *s); song_iterator_t *new_fast_forward_iterator(song_iterator_t *it, int delta); -static void reconstruct_sounds(state_t *s) { +static void reconstruct_sounds(EngineState *s) { song_t *seeker; int it_type = s->resmgr->sci_version >= SCI_VERSION_01 ? SCI_SONG_ITERATOR_TYPE_SCI1 : SCI_SONG_ITERATOR_TYPE_SCI0; @@ -4948,9 +4948,9 @@ static void reconstruct_sounds(state_t *s) { } } -state_t *gamestate_restore(state_t *s, Common::SeekableReadStream *fh) { +EngineState *gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) { int read_eof = 0; - state_t *retval; + EngineState *retval; songlib_t temp; /* @@ -4962,9 +4962,9 @@ state_t *gamestate_restore(state_t *s, Common::SeekableReadStream *fh) { } */ - retval = (state_t *) sci_malloc(sizeof(state_t)); + retval = (EngineState *) sci_malloc(sizeof(EngineState)); - memset(retval, 0, sizeof(state_t)); + memset(retval, 0, sizeof(EngineState)); retval->savegame_version = -1; _global_save_state = retval; @@ -4974,24 +4974,24 @@ state_t *gamestate_restore(state_t *s, Common::SeekableReadStream *fh) { memset(retval, 0, sizeof(SavegameMetadata)); // Auto-generated CFSML data reader code -#line 763 "../../engines/sci/engine/savegame.cfsml" +#line 763 "engines/sci/engine/savegame.cfsml" { -#line 766 "../../engines/sci/engine/savegame.cfsml" +#line 766 "engines/sci/engine/savegame.cfsml" int _cfsml_line_ctr = 0; -#line 771 "../../engines/sci/engine/savegame.cfsml" +#line 771 "engines/sci/engine/savegame.cfsml" struct _cfsml_pointer_refstruct **_cfsml_myptrrefptr = _cfsml_get_current_refpointer(); -#line 774 "../../engines/sci/engine/savegame.cfsml" +#line 774 "engines/sci/engine/savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; -#line 781 "../../engines/sci/engine/savegame.cfsml" +#line 781 "engines/sci/engine/savegame.cfsml" const char *_cfsml_inp = _cfsml_get_identifier(fh, &(_cfsml_line_ctr), &_cfsml_eof, 0); -#line 785 "../../engines/sci/engine/savegame.cfsml" +#line 785 "engines/sci/engine/savegame.cfsml" _cfsml_error = _cfsml_read_SavegameMetadata(fh, meta, _cfsml_inp, &(_cfsml_line_ctr), &_cfsml_eof); -#line 789 "../../engines/sci/engine/savegame.cfsml" +#line 789 "engines/sci/engine/savegame.cfsml" read_eof = _cfsml_error; -#line 793 "../../engines/sci/engine/savegame.cfsml" +#line 793 "engines/sci/engine/savegame.cfsml" _cfsml_free_pointer_references(_cfsml_myptrrefptr, _cfsml_error); -#line 796 "../../engines/sci/engine/savegame.cfsml" +#line 796 "engines/sci/engine/savegame.cfsml" if (_cfsml_last_value_retrieved) { free(_cfsml_last_value_retrieved); _cfsml_last_value_retrieved = NULL; @@ -5002,7 +5002,7 @@ state_t *gamestate_restore(state_t *s, Common::SeekableReadStream *fh) { } } // End of auto-generated CFSML data reader code -#line 1024 "../../engines/sci/engine/savegame.cfsml" +#line 1026 "engines/sci/engine/savegame.cfsml" if ((meta->savegame_version < FREESCI_MINIMUM_SAVEGAME_VERSION) || (meta->savegame_version > FREESCI_CURRENT_SAVEGAME_VERSION)) { if (meta->savegame_version < FREESCI_MINIMUM_SAVEGAME_VERSION) @@ -5026,24 +5026,24 @@ state_t *gamestate_restore(state_t *s, Common::SeekableReadStream *fh) { retval->sound_volume = s->sound_volume; // Auto-generated CFSML data reader code -#line 763 "../../engines/sci/engine/savegame.cfsml" +#line 763 "engines/sci/engine/savegame.cfsml" { -#line 766 "../../engines/sci/engine/savegame.cfsml" +#line 766 "engines/sci/engine/savegame.cfsml" int _cfsml_line_ctr = 0; -#line 771 "../../engines/sci/engine/savegame.cfsml" +#line 771 "engines/sci/engine/savegame.cfsml" struct _cfsml_pointer_refstruct **_cfsml_myptrrefptr = _cfsml_get_current_refpointer(); -#line 774 "../../engines/sci/engine/savegame.cfsml" +#line 774 "engines/sci/engine/savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; -#line 781 "../../engines/sci/engine/savegame.cfsml" +#line 781 "engines/sci/engine/savegame.cfsml" const char *_cfsml_inp = _cfsml_get_identifier(fh, &(_cfsml_line_ctr), &_cfsml_eof, 0); -#line 785 "../../engines/sci/engine/savegame.cfsml" - _cfsml_error = _cfsml_read_state_t(fh, retval, _cfsml_inp, &(_cfsml_line_ctr), &_cfsml_eof); -#line 789 "../../engines/sci/engine/savegame.cfsml" +#line 785 "engines/sci/engine/savegame.cfsml" + _cfsml_error = _cfsml_read_EngineState(fh, retval, _cfsml_inp, &(_cfsml_line_ctr), &_cfsml_eof); +#line 789 "engines/sci/engine/savegame.cfsml" read_eof = _cfsml_error; -#line 793 "../../engines/sci/engine/savegame.cfsml" +#line 793 "engines/sci/engine/savegame.cfsml" _cfsml_free_pointer_references(_cfsml_myptrrefptr, _cfsml_error); -#line 796 "../../engines/sci/engine/savegame.cfsml" +#line 796 "engines/sci/engine/savegame.cfsml" if (_cfsml_last_value_retrieved) { free(_cfsml_last_value_retrieved); _cfsml_last_value_retrieved = NULL; @@ -5054,7 +5054,7 @@ state_t *gamestate_restore(state_t *s, Common::SeekableReadStream *fh) { } } // End of auto-generated CFSML data reader code -#line 1047 "../../engines/sci/engine/savegame.cfsml" +#line 1049 "engines/sci/engine/savegame.cfsml" sfx_exit(&s->sound); _gamestate_unfrob(retval); @@ -5152,24 +5152,24 @@ bool get_savegame_metadata(Common::SeekableReadStream* stream, SavegameMetadata* int read_eof = 0; // Auto-generated CFSML data reader code -#line 763 "../../engines/sci/engine/savegame.cfsml" +#line 763 "engines/sci/engine/savegame.cfsml" { -#line 766 "../../engines/sci/engine/savegame.cfsml" +#line 766 "engines/sci/engine/savegame.cfsml" int _cfsml_line_ctr = 0; -#line 771 "../../engines/sci/engine/savegame.cfsml" +#line 771 "engines/sci/engine/savegame.cfsml" struct _cfsml_pointer_refstruct **_cfsml_myptrrefptr = _cfsml_get_current_refpointer(); -#line 774 "../../engines/sci/engine/savegame.cfsml" +#line 774 "engines/sci/engine/savegame.cfsml" int _cfsml_eof = 0, _cfsml_error; -#line 781 "../../engines/sci/engine/savegame.cfsml" +#line 781 "engines/sci/engine/savegame.cfsml" const char *_cfsml_inp = _cfsml_get_identifier(stream, &(_cfsml_line_ctr), &_cfsml_eof, 0); -#line 785 "../../engines/sci/engine/savegame.cfsml" +#line 785 "engines/sci/engine/savegame.cfsml" _cfsml_error = _cfsml_read_SavegameMetadata(stream, meta, _cfsml_inp, &(_cfsml_line_ctr), &_cfsml_eof); -#line 789 "../../engines/sci/engine/savegame.cfsml" +#line 789 "engines/sci/engine/savegame.cfsml" read_eof = _cfsml_error; -#line 793 "../../engines/sci/engine/savegame.cfsml" +#line 793 "engines/sci/engine/savegame.cfsml" _cfsml_free_pointer_references(_cfsml_myptrrefptr, _cfsml_error); -#line 796 "../../engines/sci/engine/savegame.cfsml" +#line 796 "engines/sci/engine/savegame.cfsml" if (_cfsml_last_value_retrieved) { free(_cfsml_last_value_retrieved); _cfsml_last_value_retrieved = NULL; @@ -5180,7 +5180,7 @@ bool get_savegame_metadata(Common::SeekableReadStream* stream, SavegameMetadata* } } // End of auto-generated CFSML data reader code -#line 1144 "../../engines/sci/engine/savegame.cfsml" +#line 1146 "engines/sci/engine/savegame.cfsml" if (read_eof) return false; diff --git a/engines/sci/engine/scriptconsole.cpp b/engines/sci/engine/scriptconsole.cpp index b01a4cadc3..95e09fa335 100644 --- a/engines/sci/engine/scriptconsole.cpp +++ b/engines/sci/engine/scriptconsole.cpp @@ -33,23 +33,23 @@ namespace Sci { #ifdef SCI_CONSOLE -state_t *con_gamestate = NULL; +EngineState *con_gamestate = NULL; // console commands -static int c_version(struct _state *s); // displays the package and version number -static int c_list(struct _state *s); // lists various types of things -static int c_man(struct _state *s); // 'manual page' -static int c_set(struct _state *s); // sets an int variable -static int c_print(struct _state *s); // prints a variable -static int c_size(struct _state *s); // displays the size of a resource -static int c_dump(struct _state *s); // gives a hex dump of a resource -//static int c_objinfo(struct _state *s); // shows some info about one class -//static int c_objmethods(struct _state *s); // Disassembles all methods of a class -static int c_hexgrep(struct _state *s); // Searches a string in one resource or resource class -static int c_selectornames(struct _state *s); // Displays all selector names -static int c_kernelnames(struct _state *s); // Displays all kernel function names -static int c_dissectscript(struct _state *s); // Splits a script into objects and explains them +static int c_version(EngineState *s); // displays the package and version number +static int c_list(EngineState *s); // lists various types of things +static int c_man(EngineState *s); // 'manual page' +static int c_set(EngineState *s); // sets an int variable +static int c_print(EngineState *s); // prints a variable +static int c_size(EngineState *s); // displays the size of a resource +static int c_dump(EngineState *s); // gives a hex dump of a resource +//static int c_objinfo(EngineState *s); // shows some info about one class +//static int c_objmethods(EngineState *s); // Disassembles all methods of a class +static int c_hexgrep(EngineState *s); // Searches a string in one resource or resource class +static int c_selectornames(EngineState *s); // Displays all selector names +static int c_kernelnames(EngineState *s); // Displays all kernel function names +static int c_dissectscript(EngineState *s); // Splits a script into objects and explains them typedef struct { const char *name; @@ -61,7 +61,7 @@ typedef cmd_mm_entry_t cmd_page_t; // Simple info page typedef struct { const char *name; const char *description; - int (*command)(state_t *); + int (*command)(EngineState *); const char *param; } cmd_command_t; @@ -214,7 +214,7 @@ static inline int clone_is_used(clone_table_t *t, int idx) { return ENTRY_IS_VALID(t, idx); } -int parse_reg_t(state_t *s, const char *str, reg_t *dest) { // Returns 0 on success +int parse_reg_t(EngineState *s, const char *str, reg_t *dest) { // Returns 0 on success int rel_offsetting = 0; const char *offsetting = NULL; // Non-NULL: Parse end of string for relative offsets @@ -404,7 +404,7 @@ int parse_reg_t(state_t *s, const char *str, reg_t *dest) { // Returns 0 on succ return 0; } -void con_parse(state_t *s, const char *command) { +void con_parse(EngineState *s, const char *command) { int quote = 0; // quoting? int done = 0; // are we done yet? int cdone = 0; // Done with the current command? @@ -612,7 +612,7 @@ int con_hook_page(const char *name, const char *body) { return 0; } -int con_hook_command(int command(state_t *), const char *name, const char *param, const char *description) { +int con_hook_command(int command(EngineState *), const char *name, const char *param, const char *description) { cmd_command_t *cmd = NULL; unsigned int i; @@ -691,7 +691,7 @@ static int get_resource_number(char *resid) { return res; } -static int c_version(state_t * s) { +static int c_version(EngineState * s) { if (NULL == s) { sciprintf("console.c: c_version: NULL passed for parameter s\n"); return -1; @@ -705,7 +705,7 @@ static int c_version(state_t * s) { return 0; } -static int c_list_words(state_t *s) { +static int c_list_words(EngineState *s) { word_t **words; int words_nr; int i; @@ -724,7 +724,7 @@ static int c_list_words(state_t *s) { return 0; } -int c_list_suffices(state_t *s) { +int c_list_suffices(EngineState *s) { suffix_t **suffices; int suffices_nr; int i; @@ -806,7 +806,7 @@ static void _cmd_print_page(cmd_mm_entry_t *data, int full) { sciprintf("%s\n", data->name); } -static int c_list(state_t *s) { +static int c_list(EngineState *s) { if (_lists_need_sorting) con_sort_all(); @@ -868,7 +868,7 @@ static int c_list(state_t *s) { return 0; } -static int c_man(state_t *s) { +static int c_man(EngineState *s) { int section = 0; unsigned int i; char *name = cmd_params[0].str; @@ -905,7 +905,7 @@ static int c_man(state_t *s) { return 0; } -static int c_set(state_t *s) { +static int c_set(EngineState *s) { cmd_var_t *var = (cmd_var_t *) cmd_mm_find(cmd_params[0].str, CMD_MM_VAR); if (var) @@ -914,7 +914,7 @@ static int c_set(state_t *s) { return 0; } -static int c_print(state_t *s) { +static int c_print(EngineState *s) { cmd_var_t *var = (cmd_var_t *) cmd_mm_find(cmd_params[0].str, CMD_MM_VAR); if (var) @@ -925,7 +925,7 @@ static int c_print(state_t *s) { return 0; } -static int c_size(state_t *s) { +static int c_size(EngineState *s) { int res = get_resource_number(cmd_params[0].str); if (res == -1) sciprintf("Resource type '%s' is not valid\n", cmd_params[0].str); @@ -940,7 +940,7 @@ static int c_size(state_t *s) { return 0; } -static int c_dump(state_t *s) { +static int c_dump(EngineState *s) { int res = get_resource_number(cmd_params[0].str); if (res == -1) @@ -956,7 +956,7 @@ static int c_dump(state_t *s) { return 0; } -static int c_hexgrep(state_t *s) { +static int c_hexgrep(EngineState *s) { int i, seeklen, resnr, restype, resmax; unsigned char *seekstr = NULL; resource_t *script = NULL; @@ -1026,7 +1026,7 @@ static int c_hexgrep(state_t *s) { return 0; } -static int c_selectornames(state_t * s) { +static int c_selectornames(EngineState * s) { int namectr; char **snames = NULL; int seeker = 0; @@ -1053,7 +1053,7 @@ static int c_selectornames(state_t * s) { return 0; } -static int c_kernelnames(state_t * s) { +static int c_kernelnames(EngineState * s) { int knamectr; char **knames = vocabulary_get_knames(s->resmgr, &knamectr); int seeker = 0; @@ -1077,7 +1077,7 @@ static int c_kernelnames(state_t * s) { return 0; } -static int c_dissectscript(state_t * s) { +static int c_dissectscript(EngineState * s) { if (NULL == s) { sciprintf("console.c: c_dissectscript(): NULL passed for parameter s\n"); return -1; diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp index e6cd8981ef..db9f74e897 100644 --- a/engines/sci/engine/scriptdebug.cpp +++ b/engines/sci/engine/scriptdebug.cpp @@ -265,7 +265,7 @@ static void sci01_song_header_dump(byte *data, int size) { #undef CHECK_FOR_END_ABSOLUTE #undef SONGDATA -int c_sfx_01_header(state_t *s) { +int c_sfx_01_header(EngineState *s) { resource_t *song = scir_find_resource(s->resmgr, sci_sound, cmd_params[0].val, 0); if (!song) { @@ -278,7 +278,7 @@ int c_sfx_01_header(state_t *s) { return 0; } -int c_sfx_01_track(state_t *s) { +int c_sfx_01_track(EngineState *s) { resource_t *song = scir_find_resource(s->resmgr, sci_sound, cmd_params[0].val, 0); int offset = cmd_params[1].val; @@ -295,7 +295,7 @@ int c_sfx_01_track(state_t *s) { const char *(*_debug_get_input)(void) = _debug_get_input_default; -int c_segtable(state_t *s) { +int c_segtable(EngineState *s) { int i; sciprintf(" ---- segment table ----\n"); @@ -354,12 +354,12 @@ int c_segtable(state_t *s) { return 0; } -static void print_obj_head(state_t *s, object_t *obj) { +static void print_obj_head(EngineState *s, object_t *obj) { sciprintf(PREG" %s : %3d vars, %3d methods\n", PRINT_REG(obj->pos), obj_get_name(s, obj->pos), obj->variables_nr, obj->methods_nr); } -static void print_list(state_t *s, list_t *l) { +static void print_list(EngineState *s, list_t *l) { reg_t pos = l->first; reg_t my_prev = NULL_REG_INITIALIZER; @@ -390,7 +390,7 @@ static void print_list(state_t *s, list_t *l) { sciprintf("\t>\n"); } -static void _c_single_seg_info(state_t *s, mem_obj_t *mobj) { +static void _c_single_seg_info(EngineState *s, mem_obj_t *mobj) { switch (mobj->type) { case MEM_OBJ_SCRIPT: { @@ -500,7 +500,7 @@ static void _c_single_seg_info(state_t *s, mem_obj_t *mobj) { } } -static int show_node(state_t *s, reg_t addr) { +static int show_node(EngineState *s, reg_t addr) { mem_obj_t *mobj = GET_SEGMENT(s->seg_manager, addr.segment, MEM_OBJ_LISTS); if (mobj) { @@ -540,17 +540,17 @@ static int show_node(state_t *s, reg_t addr) { return 0; } -int objinfo(state_t *s, reg_t pos); +int objinfo(EngineState *s, reg_t pos); void song_lib_dump(songlib_t songlib, int line); -static int c_songlib_print(state_t *s) { +static int c_songlib_print(EngineState *s) { song_lib_dump(s->sound.songlib, __LINE__); return 0; } -static int c_vr(state_t *s) { +static int c_vr(EngineState *s) { reg_t reg = cmd_params[0].reg; reg_t reg_end = cmd_paramlength > 1 ? cmd_params[1].reg : NULL_REG; int type_mask = determine_reg_type(s, reg, 1); @@ -644,7 +644,7 @@ static int c_vr(state_t *s) { return 0; } -int c_segkill(state_t *s) { +int c_segkill(EngineState *s) { unsigned int i = 0; while (i < cmd_paramlength) { @@ -655,7 +655,7 @@ int c_segkill(state_t *s) { return 0; } -static int c_mousepos(state_t *s) { +static int c_mousepos(EngineState *s) { sci_event_t event; sciprintf("Click somewhere in the game window...\n"); @@ -667,7 +667,7 @@ static int c_mousepos(state_t *s) { return 0; } -int c_seginfo(state_t *s) { +int c_seginfo(EngineState *s) { unsigned int i = 0; if (cmd_paramlength) { @@ -692,7 +692,7 @@ int c_seginfo(state_t *s) { return 0; } -int c_debuginfo(state_t *s) { +int c_debuginfo(EngineState *s) { exec_stack_t *eframe = NULL; if (!_debugstate_valid) { @@ -713,7 +713,7 @@ int c_debuginfo(state_t *s) { return 0; } -int c_step(state_t *s) { +int c_step(EngineState *s) { _debugstate_valid = 0; if (cmd_paramlength && (cmd_params[0].val > 0)) _debug_step_running = cmd_params[0].val - 1; @@ -723,7 +723,7 @@ int c_step(state_t *s) { #if 0 // TODO Re-implement con:so -int c_stepover(state_t *s) { +int c_stepover(EngineState *s) { int opcode, opnumber; if (!_debugstate_valid) { @@ -766,7 +766,7 @@ int c_stepover(state_t *s) { } #endif -int c_sim_parse(state_t *s) { +int c_sim_parse(EngineState *s) { unsigned int i; const char *operators = ",&/()[]#<>"; @@ -830,7 +830,7 @@ int c_sim_parse(state_t *s) { return 0; } -int c_classtable(state_t *s) { +int c_classtable(EngineState *s) { int i; if (!_debugstate_valid) { @@ -846,7 +846,7 @@ int c_classtable(state_t *s) { return 0; } -int c_viewinfo(state_t *s) { +int c_viewinfo(EngineState *s) { int view = cmd_params[0].val; int palette = cmd_params[1].val; int loops, i; @@ -889,7 +889,7 @@ int c_viewinfo(state_t *s) { return 0; } -int c_list_sentence_fragments(state_t *s) { +int c_list_sentence_fragments(EngineState *s) { int i; if (!s) { @@ -966,7 +966,7 @@ int _parse_getinp(int *i, int *nr) { return _parse_token_number; } -int _parse_nodes(state_t *s, int *i, int *pos, int type, int nr) { +int _parse_nodes(EngineState *s, int *i, int *pos, int type, int nr) { int nexttk, nextval, newpos, oldpos; if (type == _parse_token_nil) @@ -1001,7 +1001,7 @@ int _parse_nodes(state_t *s, int *i, int *pos, int type, int nr) { return oldpos; } -int c_set_parse_nodes(state_t *s) { +int c_set_parse_nodes(EngineState *s) { int i = 0; int foo, bar; int pos = -1; @@ -1023,7 +1023,7 @@ int vocab_gnf_parse(parse_tree_node_t *nodes, result_word_t *words, int words_nr parse_tree_branch_t *branch0, parse_rule_list_t *tlist, int verbose); // parses with a GNF rule set -int c_parse(state_t *s) { +int c_parse(EngineState *s) { result_word_t *words; int words_nr; char *error; @@ -1066,7 +1066,7 @@ int c_parse(state_t *s) { return 0; } -int c_save_game(state_t *s) { +int c_save_game(EngineState *s) { int omit_check = cmd_params[0].str[0] == '_'; int i; @@ -1103,8 +1103,8 @@ int c_save_game(state_t *s) { return 0; } -int c_restore_game(state_t *s) { - state_t *newstate = NULL; +int c_restore_game(EngineState *s) { + EngineState *newstate = NULL; if (!s) { sciprintf("Not in debug state\n"); @@ -1134,7 +1134,7 @@ int c_restore_game(state_t *s) { extern char *old_save_dir; -int c_restart_game(state_t *s) { +int c_restart_game(EngineState *s) { unsigned int i; char *deref_save_dir = (char*)kernel_dereference_bulk_pointer(s, s->save_dir_copy, 1); @@ -1166,7 +1166,7 @@ int c_restart_game(state_t *s) { return 0; } -int c_stack(state_t *s) { +int c_stack(EngineState *s) { int i; exec_stack_t *xs; @@ -1192,14 +1192,14 @@ int c_stack(state_t *s) { return 0; } -const char *selector_name(state_t *s, int selector) { +const char *selector_name(EngineState *s, int selector) { if (selector >= 0 && selector < s->selector_names_nr) return s->selector_names[selector]; else return "--INVALID--"; } -int prop_ofs_to_id(state_t *s, int prop_ofs, reg_t objp) { +int prop_ofs_to_id(EngineState *s, int prop_ofs, reg_t objp) { object_t *obj = obj_get(s, objp); byte *selectoroffset; int selectors; @@ -1230,7 +1230,7 @@ int prop_ofs_to_id(state_t *s, int prop_ofs, reg_t objp) { return getUInt16(selectoroffset + prop_ofs); } -reg_t disassemble(state_t *s, reg_t pos, int print_bw_tag, int print_bytecode) { +reg_t disassemble(EngineState *s, reg_t pos, int print_bw_tag, int print_bytecode) { // Disassembles one command from the heap, returns address of next command or 0 if a ret was encountered. mem_obj_t *memobj = GET_SEGMENT(s->seg_manager, pos.segment, MEM_OBJ_SCRIPT); script_t *script_entity = NULL; @@ -1476,7 +1476,7 @@ reg_t disassemble(state_t *s, reg_t pos, int print_bw_tag, int print_bytecode) { return retval; } -int c_dumpnodes(state_t *s) { +int c_dumpnodes(EngineState *s) { int end = MIN<int>(cmd_params[0].val, VOCAB_TREE_NODES); int i; @@ -1500,7 +1500,7 @@ int c_dumpnodes(state_t *s) { static const char *varnames[] = {"global", "local", "temp", "param"}; static const char *varabbrev = "gltp"; -int c_vmvarlist(state_t *s) { +int c_vmvarlist(EngineState *s) { int i; for (i = 0;i < 4;i++) { @@ -1513,7 +1513,7 @@ int c_vmvarlist(state_t *s) { return 0; } -int c_vmvars(state_t *s) { +int c_vmvars(EngineState *s) { const char *vartype_pre = strchr(varabbrev, *cmd_params[0].str); int vartype; int idx = cmd_params[1].val; @@ -1549,7 +1549,7 @@ int c_vmvars(state_t *s) { return 0; } -static int c_backtrace(state_t *s) { +static int c_backtrace(EngineState *s) { int i; if (!_debugstate_valid) { @@ -1617,7 +1617,7 @@ static int c_backtrace(state_t *s) { return 0; } -static int c_redraw_screen(state_t *s) { +static int c_redraw_screen(EngineState *s) { if (!_debugstate_valid) { sciprintf("Not in debug state\n"); return 1; @@ -1631,7 +1631,7 @@ static int c_redraw_screen(state_t *s) { return 0; } -static int c_clear_screen(state_t *s) { +static int c_clear_screen(EngineState *s) { if (!_debugstate_valid) { sciprintf("Not in debug state\n"); return 1; @@ -1643,7 +1643,7 @@ static int c_clear_screen(state_t *s) { return 0; } -static int c_visible_map(state_t *s) { +static int c_visible_map(EngineState *s) { if (!s) { sciprintf("Not in debug state\n"); return 1; @@ -1664,7 +1664,7 @@ static int c_visible_map(state_t *s) { return 0; } -static int c_gfx_current_port(state_t *s) { +static int c_gfx_current_port(EngineState *s) { if (!_debugstate_valid) { sciprintf("Not in debug state\n"); return 1; @@ -1678,7 +1678,7 @@ static int c_gfx_current_port(state_t *s) { return 0; } -static int c_gfx_print_port(state_t *s) { +static int c_gfx_print_port(EngineState *s) { gfxw_port_t *port; if (!_debugstate_valid) { @@ -1705,7 +1705,7 @@ static int c_gfx_print_port(state_t *s) { return 0; } -static int c_gfx_priority(state_t *s) { +static int c_gfx_priority(EngineState *s) { if (!_debugstate_valid) { sciprintf("Not in debug state\n"); return 1; @@ -1725,7 +1725,7 @@ static int c_gfx_priority(state_t *s) { return 0; } -static int c_gfx_print_visual(state_t *s) { +static int c_gfx_print_visual(EngineState *s) { if (!_debugstate_valid) { sciprintf("Not in debug state\n"); return 1; @@ -1739,7 +1739,7 @@ static int c_gfx_print_visual(state_t *s) { return 0; } -static int c_gfx_print_dynviews(state_t *s) { +static int c_gfx_print_dynviews(EngineState *s) { if (!_debugstate_valid) { sciprintf("Not in debug state\n"); return 1; @@ -1753,7 +1753,7 @@ static int c_gfx_print_dynviews(state_t *s) { return 0; } -static int c_gfx_print_dropviews(state_t *s) { +static int c_gfx_print_dropviews(EngineState *s) { if (!_debugstate_valid) { sciprintf("Not in debug state\n"); return 1; @@ -1767,7 +1767,7 @@ static int c_gfx_print_dropviews(state_t *s) { return 0; } -static int c_gfx_drawpic(state_t *s) { +static int c_gfx_drawpic(EngineState *s) { int flags = 1, default_palette = 0; if (!_debugstate_valid) { @@ -1794,7 +1794,7 @@ static int c_gfx_drawpic(state_t *s) { extern gfxw_widget_t *debug_widgets[]; extern int debug_widget_pos; -static int c_gfx_print_widget(state_t *s) { +static int c_gfx_print_widget(EngineState *s) { if (!_debugstate_valid) { sciprintf("Not in debug state\n"); return 1; @@ -1820,7 +1820,7 @@ static int c_gfx_print_widget(state_t *s) { } #endif -static int c_gfx_show_map(state_t *s) { +static int c_gfx_show_map(EngineState *s) { int map = cmd_params[0].val; if (!_debugstate_valid) { sciprintf("Not in debug state\n"); @@ -1855,7 +1855,7 @@ static int c_gfx_show_map(state_t *s) { return 0; } -static int c_gfx_draw_cel(state_t *s) { +static int c_gfx_draw_cel(EngineState *s) { int view = cmd_params[0].val; int loop = cmd_params[1].val; int cel = cmd_params[2].val; @@ -1873,7 +1873,7 @@ static int c_gfx_draw_cel(state_t *s) { return 0; } -static int c_gfx_fill_screen(state_t *s) { +static int c_gfx_fill_screen(EngineState *s) { int col = cmd_params[0].val; if (!s) { @@ -1891,7 +1891,7 @@ static int c_gfx_fill_screen(state_t *s) { return 0; } -static int c_gfx_draw_rect(state_t *s) { +static int c_gfx_draw_rect(EngineState *s) { int col = cmd_params[4].val; if (!s) { @@ -1909,7 +1909,7 @@ static int c_gfx_draw_rect(state_t *s) { return 0; } -static int c_gfx_propagate_rect(state_t *s) { +static int c_gfx_propagate_rect(EngineState *s) { int map = cmd_params[4].val; rect_t rect; @@ -1943,7 +1943,7 @@ bb = GET_SELECTOR(pos, bb); #if 0 // Unreferenced - removed -static int c_gfx_draw_viewobj(state_t *s) { +static int c_gfx_draw_viewobj(EngineState *s) { #ifdef __GNUC__ #warning "Re-implement con:gfx_draw_viewobj" #endif @@ -2009,7 +2009,7 @@ static int c_gfx_draw_viewobj(state_t *s) { } #endif -static int c_gfx_flush_resources(state_t *s) { +static int c_gfx_flush_resources(EngineState *s) { if (!_debugstate_valid) { sciprintf("Not in debug state\n"); return 1; @@ -2024,7 +2024,7 @@ static int c_gfx_flush_resources(state_t *s) { return 0; } -static int c_gfx_update_zone(state_t *s) { +static int c_gfx_update_zone(EngineState *s) { if (!_debugstate_valid) { sciprintf("Not in debug state\n"); return 1; @@ -2034,7 +2034,7 @@ static int c_gfx_update_zone(state_t *s) { Common::Point(cmd_params[0].val, cmd_params[1].val), GFX_BUFFER_FRONT); } -static int c_disasm_addr(state_t *s) { +static int c_disasm_addr(EngineState *s) { reg_t vpc = cmd_params[0].reg; int op_count = 1; int do_bwc = 0; @@ -2069,7 +2069,7 @@ static int c_disasm_addr(state_t *s) { return 0; } -static int c_disasm(state_t *s) { +static int c_disasm(EngineState *s) { object_t *obj = obj_get(s, cmd_params[0].reg); int selector_id = script_find_selector(s, cmd_params[1].str); reg_t addr; @@ -2096,7 +2096,7 @@ static int c_disasm(state_t *s) { return 0; } -static int c_sg(state_t *s) { +static int c_sg(EngineState *s) { _debug_seeking = _DEBUG_SEEK_GLOBAL; _debug_seek_special = cmd_params[0].val; _debugstate_valid = 0; @@ -2104,7 +2104,7 @@ static int c_sg(state_t *s) { return 0; } -static int c_snk(state_t *s) { +static int c_snk(EngineState *s) { int callk_index; char *endptr; @@ -2145,26 +2145,26 @@ static int c_snk(state_t *s) { return 0; } -static int c_sret(state_t *s) { +static int c_sret(EngineState *s) { _debug_seeking = _DEBUG_SEEK_LEVEL_RET; _debug_seek_level = s->execution_stack_pos; _debugstate_valid = 0; return 0; } -static int c_go(state_t *s) { +static int c_go(EngineState *s) { _debug_seeking = 0; _debugstate_valid = 0; script_debug_flag = 0; return 0; } -static int c_set_acc(state_t *s) { +static int c_set_acc(EngineState *s) { s->r_acc = cmd_params[0].reg; return 0; } -static int c_send(state_t *s) { +static int c_send(EngineState *s) { reg_t object = cmd_params[0].reg; char *selector_name = cmd_params[1].str; stack_ptr_t stackframe = s->execution_stack->sp; @@ -2217,7 +2217,7 @@ static int c_send(state_t *s) { return 0; } -static int c_resource_id(state_t *s) { +static int c_resource_id(EngineState *s) { int id = cmd_params[0].val; sciprintf("%s.%d (0x%x)\n", sci_resource_types[id >> 11], id &0x7ff, id & 0x7ff); @@ -2225,7 +2225,7 @@ static int c_resource_id(state_t *s) { return 0; } -static int c_listclones(state_t *s) { +static int c_listclones(EngineState *s) { /* int i, j = 0; sciprintf("Listing all logged clones:\n"); @@ -2338,7 +2338,7 @@ const generic_config_flag_t SCIk_Debug_Names[SCIk_DEBUG_MODES] = { {"Pathfinding", 'P', (1 << SCIkAVOIDPATH_NR)} } ; -void set_debug_mode(struct _state *s, int mode, const char *areas) { +void set_debug_mode(EngineState *s, int mode, const char *areas) { char *param = (char*)sci_malloc(strlen(areas) + 2); param[0] = (mode) ? '+' : '-'; @@ -2349,14 +2349,14 @@ void set_debug_mode(struct _state *s, int mode, const char *areas) { free(param); } -int c_debuglog(state_t *s) { +int c_debuglog(EngineState *s) { return c_handle_config_update(SCIk_Debug_Names, SCIk_DEBUG_MODES, "VM and kernel", (int *)&(s->debug_mode)); } #define SFX_DEBUG_MODES 2 #define FROBNICATE_HANDLE(reg) ((reg).segment << 16 | (reg).offset) -static int c_sfx_debuglog(state_t *s) { +static int c_sfx_debuglog(EngineState *s) { const generic_config_flag_t sfx_debug_modes[SFX_DEBUG_MODES] = { {"Song activation/deactivation", 's', SFX_DEBUG_SONGS}, {"Song cue polling and delivery", 'c', SFX_DEBUG_CUES} @@ -2365,7 +2365,7 @@ static int c_sfx_debuglog(state_t *s) { return c_handle_config_update(sfx_debug_modes, SFX_DEBUG_MODES, "sound subsystem", (int *)&(s->sound.debug)); } -static int c_sfx_remove(state_t *s) { +static int c_sfx_remove(EngineState *s) { reg_t id = cmd_params[0].reg; int handle = FROBNICATE_HANDLE(id); @@ -2382,7 +2382,7 @@ static int c_sfx_remove(state_t *s) { #define GFX_DEBUG_MODES 4 -int c_gfx_debuglog(state_t *s) { +int c_gfx_debuglog(EngineState *s) { gfx_driver_t *drv = s->gfx_state->driver; const generic_config_flag_t gfx_debug_modes[GFX_DEBUG_MODES] = { { "Mouse Pointer", 'p', GFX_DEBUG_POINTER}, @@ -2394,7 +2394,7 @@ int c_gfx_debuglog(state_t *s) { return c_handle_config_update(gfx_debug_modes, GFX_DEBUG_MODES, "graphics subsystem", (int *)&(drv->debug_flags)); } -int c_dump_words(state_t *s) { +int c_dump_words(EngineState *s) { int i; if (!s) { @@ -2416,13 +2416,13 @@ int c_dump_words(state_t *s) { return 0; } -int c_simkey(state_t *s) { +int c_simkey(EngineState *s) { _kdebug_cheap_event_hack = cmd_params[0].val; return 0; } -static int c_is_sample(state_t *s) { +static int c_is_sample(EngineState *s) { resource_t *song = scir_find_resource(s->resmgr, sci_sound, cmd_params[0].val, 0); song_iterator_t *songit; sfx_pcm_feed_t *data; @@ -2451,7 +2451,7 @@ static int c_is_sample(state_t *s) { return 0; } -int c_simsoundcue(state_t *s) { +int c_simsoundcue(EngineState *s) { _kdebug_cheap_soundcue_hack = cmd_params[0].val; return 0; @@ -2473,7 +2473,7 @@ bb = GET_SELECTOR(pos, bb); #ifdef __GNUC__ #warning "Re-implement viewobjinfo" #endif -static void viewobjinfo(state_t *s, heap_ptr pos) { +static void viewobjinfo(EngineState *s, heap_ptr pos) { char *signals[16] = { "stop_update", "updated", @@ -2548,7 +2548,7 @@ static void viewobjinfo(state_t *s, heap_ptr pos) { #endif #undef GETRECT -int objinfo(state_t *s, reg_t pos) { +int objinfo(EngineState *s, reg_t pos) { object_t *obj = obj_get(s, pos); object_t *var_container = obj; int i; @@ -2584,19 +2584,19 @@ int objinfo(state_t *s, reg_t pos) { return 0; } -int c_vo(state_t *s) { +int c_vo(EngineState *s) { return objinfo(s, cmd_params[0].reg); } -int c_obj(state_t *s) { +int c_obj(EngineState *s) { return objinfo(s, *p_objp); } -int c_accobj(state_t *s) { +int c_accobj(EngineState *s) { return objinfo(s, s->r_acc); } -int c_shownode(state_t *s) { +int c_shownode(EngineState *s) { reg_t addr = cmd_params[0].reg; return show_node(s, addr); @@ -2604,7 +2604,7 @@ int c_shownode(state_t *s) { // Breakpoint commands -static breakpoint_t *bp_alloc(state_t *s) { +static breakpoint_t *bp_alloc(EngineState *s) { breakpoint_t *bp; if (s->bp_list) { @@ -2623,7 +2623,7 @@ static breakpoint_t *bp_alloc(state_t *s) { return bp; } -int c_bpx(state_t *s) { +int c_bpx(EngineState *s) { breakpoint_t *bp; /* Note: We can set a breakpoint on a method that has not been loaded yet. @@ -2640,7 +2640,7 @@ int c_bpx(state_t *s) { return 0; } -int c_bpe(state_t *s) { +int c_bpe(EngineState *s) { breakpoint_t *bp; bp = bp_alloc(s); @@ -2652,7 +2652,7 @@ int c_bpe(state_t *s) { return 0; } -int c_bplist(state_t *s) { +int c_bplist(EngineState *s) { breakpoint_t *bp; int i = 0; int bpdata; @@ -2677,7 +2677,7 @@ int c_bplist(state_t *s) { return 0; } -int c_bpdel(state_t *s) { +int c_bpdel(EngineState *s) { breakpoint_t *bp, *bp_next, *bp_prev; int i = 0, found = 0; int type; @@ -2720,7 +2720,7 @@ int c_bpdel(state_t *s) { return 0; } -int c_gnf(state_t *s) { +int c_gnf(EngineState *s) { if (!s) { sciprintf("Not in debug state\n"); return 1; @@ -2731,14 +2731,14 @@ int c_gnf(state_t *s) { return 0; } -int c_se(state_t *s) { +int c_se(EngineState *s) { stop_on_event = 1; _debugstate_valid = script_debug_flag = script_error_flag = 0; return 0; } -int c_type(state_t *s) { +int c_type(EngineState *s) { int t = determine_reg_type(s, cmd_params[0].reg, 1); int invalid = t & KSIG_INVALID; @@ -2772,7 +2772,7 @@ int c_type(state_t *s) { return 0; } -int c_statusbar(state_t *s) { +int c_statusbar(EngineState *s) { if (!s) { sciprintf("Not in debug state\n"); return 1; @@ -2790,7 +2790,7 @@ int c_statusbar(state_t *s) { return 0; } -int c_sci_version(state_t *s) { +int c_sci_version(EngineState *s) { if (!s) { sciprintf("Not in debug state\n"); return 1; @@ -2802,7 +2802,7 @@ int c_sci_version(state_t *s) { return 0; } -int c_sleep(state_t *s) { +int c_sleep(EngineState *s) { sleep(cmd_params[0].val); return 0; @@ -2820,7 +2820,7 @@ static void _print_address(void * _, reg_t addr) { return 1; \ } -static int c_gc_show_reachable(state_t *s) { +static int c_gc_show_reachable(EngineState *s) { reg_t addr = cmd_params[0].reg; GET_SEG_INTERFACE(addr.segment); @@ -2833,7 +2833,7 @@ static int c_gc_show_reachable(state_t *s) { return 0; } -static int c_gc_show_freeable(state_t *s) { +static int c_gc_show_freeable(EngineState *s) { reg_t addr = cmd_params[0].reg; GET_SEG_INTERFACE(addr.segment); @@ -2846,7 +2846,7 @@ static int c_gc_show_freeable(state_t *s) { return 0; } -static int c_gc_normalise(state_t *s) { +static int c_gc_normalise(EngineState *s) { reg_t addr = cmd_params[0].reg; GET_SEG_INTERFACE(addr.segment); @@ -2859,13 +2859,13 @@ static int c_gc_normalise(state_t *s) { return 0; } -static int c_gc(state_t *s) { +static int c_gc(EngineState *s) { run_gc(s); return 0; } -static int c_gc_list_reachable(state_t *s) { +static int c_gc_list_reachable(EngineState *s) { reg_t_hash_map *use_map = find_all_used_references(s); sciprintf("Reachable references (normalised):\n"); @@ -2878,7 +2878,7 @@ static int c_gc_list_reachable(state_t *s) { return 0; } -void script_debug(state_t *s, reg_t *pc, stack_ptr_t *sp, stack_ptr_t *pp, reg_t *objp, int *restadjust, +void script_debug(EngineState *s, reg_t *pc, stack_ptr_t *sp, stack_ptr_t *pp, reg_t *objp, int *restadjust, seg_id_t *segids, reg_t **variables, reg_t **variables_base, int *variables_nr, int bp) { // Do we support a separate console? diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp index adecdc8db9..5956b4d701 100644 --- a/engines/sci/engine/seg_manager.cpp +++ b/engines/sci/engine/seg_manager.cpp @@ -146,12 +146,12 @@ void sm_destroy(seg_manager_t* self) { } // allocate a memory for script from heap -// Parameters: (state_t *) s: The state to operate on +// Parameters: (EngineState *) s: The state to operate on // (int) script_nr: The script number to load // Returns : 0 - allocation failure // 1 - allocated successfully // seg_id - allocated segment id -mem_obj_t* sm_allocate_script(seg_manager_t* self, struct _state *s, int script_nr, int* seg_id) { +mem_obj_t* sm_allocate_script(seg_manager_t* self, EngineState *s, int script_nr, int* seg_id) { int seg; char was_added; mem_obj_t* mem; @@ -173,7 +173,7 @@ mem_obj_t* sm_allocate_script(seg_manager_t* self, struct _state *s, int script_ return mem; } -static void sm_set_script_size(mem_obj_t *mem, struct _state *s, int script_nr) { +static void sm_set_script_size(mem_obj_t *mem, EngineState *s, int script_nr) { resource_t *script = scir_find_resource(s->resmgr, sci_script, script_nr, 0); resource_t *heap = scir_find_resource(s->resmgr, sci_heap, script_nr, 0); @@ -209,7 +209,7 @@ static void sm_set_script_size(mem_obj_t *mem, struct _state *s, int script_nr) } } -int sm_initialise_script(mem_obj_t *mem, struct _state *s, int script_nr) { +int sm_initialise_script(mem_obj_t *mem, EngineState *s, int script_nr) { // allocate the script.buf script_t *scr; @@ -826,7 +826,7 @@ void sm_script_relocate(seg_manager_t *self, reg_t block) { } } -void sm_heap_relocate(seg_manager_t *self, state_t *s, reg_t block) { +void sm_heap_relocate(seg_manager_t *self, EngineState *s, reg_t block) { mem_obj_t *mobj = self->heap[block.segment]; script_t *scr; int count; @@ -873,9 +873,9 @@ void sm_heap_relocate(seg_manager_t *self, state_t *s, reg_t block) { #define INST_LOOKUP_CLASS(id) ((id == 0xffff) ? NULL_REG : get_class_address(s, id, SCRIPT_GET_LOCK, NULL_REG)) -reg_t get_class_address(state_t *s, int classnr, int lock, reg_t caller); +reg_t get_class_address(EngineState *s, int classnr, int lock, reg_t caller); -static object_t *sm_script_obj_init0(seg_manager_t *self, state_t *s, reg_t obj_pos) { +static object_t *sm_script_obj_init0(seg_manager_t *self, EngineState *s, reg_t obj_pos) { mem_obj_t *mobj = self->heap[obj_pos.segment]; script_t *scr; object_t *obj; @@ -943,7 +943,7 @@ static object_t *sm_script_obj_init0(seg_manager_t *self, state_t *s, reg_t obj_ return obj; } -static object_t *sm_script_obj_init11(seg_manager_t *self, state_t *s, reg_t obj_pos) { +static object_t *sm_script_obj_init11(seg_manager_t *self, EngineState *s, reg_t obj_pos) { mem_obj_t *mobj = self->heap[obj_pos.segment]; script_t *scr; object_t *obj; @@ -1010,7 +1010,7 @@ static object_t *sm_script_obj_init11(seg_manager_t *self, state_t *s, reg_t obj return obj; } -object_t *sm_script_obj_init(seg_manager_t *self, state_t *s, reg_t obj_pos) { +object_t *sm_script_obj_init(seg_manager_t *self, EngineState *s, reg_t obj_pos) { if (!self->sci1_1) return sm_script_obj_init0(self, s, obj_pos); else @@ -1114,7 +1114,7 @@ void sm_script_relocate_exports_sci11(seg_manager_t *self, int seg) { } } -void sm_script_initialise_objects_sci11(seg_manager_t *self, state_t *s, int seg) { +void sm_script_initialise_objects_sci11(seg_manager_t *self, EngineState *s, int seg) { mem_obj_t *mobj = self->heap[seg]; script_t *scr; byte *seeker; @@ -1447,7 +1447,7 @@ static void list_all_deallocatable_base(seg_interface_t *self, void *param, void (*note)(param, make_reg(self->seg_id, 0)); } -static void list_all_outgoing_references_nop(seg_interface_t *self, state_t *s, reg_t addr, void *param, void (*note)(void*param, reg_t addr)) { +static void list_all_outgoing_references_nop(seg_interface_t *self, EngineState *s, reg_t addr, void *param, void (*note)(void*param, reg_t addr)) { } static void deallocate_self(seg_interface_t *self) { @@ -1468,7 +1468,7 @@ static void free_at_address_script(seg_interface_t *self, reg_t addr) { sm_deallocate_script(self->segmgr, script->nr); } -static void list_all_outgoing_references_script(seg_interface_t *self, state_t *s, reg_t addr, void *param, void (*note)(void*param, reg_t addr)) { +static void list_all_outgoing_references_script(seg_interface_t *self, EngineState *s, reg_t addr, void *param, void (*note)(void*param, reg_t addr)) { script_t *script = &(self->mobj->data.script); if (addr.offset <= script->buf_size && addr.offset >= -SCRIPT_OBJECT_MAGIC_OFFSET && RAW_IS_OBJECT(script->buf + addr.offset)) { @@ -1520,7 +1520,7 @@ static void list_all_deallocatable_clones(seg_interface_t *self, void *param, vo LIST_ALL_DEALLOCATABLE(clone, clones); } -static void list_all_outgoing_references_clones(seg_interface_t *self, state_t *s, reg_t addr, void *param, void (*note)(void*param, reg_t addr)) { +static void list_all_outgoing_references_clones(seg_interface_t *self, EngineState *s, reg_t addr, void *param, void (*note)(void*param, reg_t addr)) { mem_obj_t *mobj = self->mobj; clone_table_t *clone_table = &(mobj->data.clones); clone_t *clone; @@ -1593,7 +1593,7 @@ static reg_t find_canonic_address_locals(seg_interface_t *self, reg_t addr) { return make_reg(owner_seg, 0); } -static void list_all_outgoing_references_locals(seg_interface_t *self, state_t *s, reg_t addr, void *param, void (*note)(void*param, reg_t addr)) { +static void list_all_outgoing_references_locals(seg_interface_t *self, EngineState *s, reg_t addr, void *param, void (*note)(void*param, reg_t addr)) { local_variables_t *locals = &(self->mobj->data.locals); int i; @@ -1617,7 +1617,7 @@ static seg_interface_t seg_interface_locals = { /* deallocate_self = */ deallocate_self }; -static void list_all_outgoing_references_stack(seg_interface_t *self, state_t *s, reg_t addr, void *param, void (*note)(void*param, reg_t addr)) { +static void list_all_outgoing_references_stack(seg_interface_t *self, EngineState *s, reg_t addr, void *param, void (*note)(void*param, reg_t addr)) { int i; error("Emitting %d stack entries\n", self->mobj->data.stack.nr); @@ -1660,7 +1660,7 @@ static void list_all_deallocatable_list(seg_interface_t *self, void *param, void LIST_ALL_DEALLOCATABLE(list, lists); } -static void list_all_outgoing_references_list(seg_interface_t *self, state_t *s, reg_t addr, void *param, void (*note)(void*param, reg_t addr)) { +static void list_all_outgoing_references_list(seg_interface_t *self, EngineState *s, reg_t addr, void *param, void (*note)(void*param, reg_t addr)) { list_table_t *table = &(self->mobj->data.lists); list_t *list = &(table->table[addr.offset].entry); @@ -1697,7 +1697,7 @@ static void list_all_deallocatable_nodes(seg_interface_t *self, void *param, voi LIST_ALL_DEALLOCATABLE(node, nodes); } -static void list_all_outgoing_references_nodes(seg_interface_t *self, state_t *s, reg_t addr, void *param, void (*note)(void*param, reg_t addr)) { +static void list_all_outgoing_references_nodes(seg_interface_t *self, EngineState *s, reg_t addr, void *param, void (*note)(void*param, reg_t addr)) { node_table_t *table = &(self->mobj->data.nodes); node_t *node = &(table->table[addr.offset].entry); diff --git a/engines/sci/engine/seg_manager.h b/engines/sci/engine/seg_manager.h index fea67327c2..88e6f42dd6 100644 --- a/engines/sci/engine/seg_manager.h +++ b/engines/sci/engine/seg_manager.h @@ -111,7 +111,7 @@ void sm_init(seg_manager_t *self, int sci1_1); void sm_destroy(seg_manager_t *self); // Deallocate all memory associated with the segment manager -void sm_gc(seg_manager_t *self, struct _state *s); +void sm_gc(seg_manager_t *self, EngineState *s); // Perform garbage collection // Parameters: (state_t *) s: The state to operate on // Effects : Unreachable objects in 's' are deallocated @@ -120,7 +120,7 @@ void sm_gc(seg_manager_t *self, struct _state *s); void sm_free_script(mem_obj_t* mem); -mem_obj_t *sm_allocate_script(struct _seg_manager_t* self, struct _state *s, int script_nr, int* seg_id); +mem_obj_t *sm_allocate_script(struct _seg_manager_t* self, EngineState *s, int script_nr, int* seg_id); // Allocate a script into the segment manager // Parameters: (int) script_nr: number of the script to load // (state_t *) s: The state containing resource manager handlers to load the @@ -230,7 +230,7 @@ void sm_script_initialise_locals(struct _seg_manager_t *self, reg_t location); // Parameters: (reg_t) location: Location to initialize from -object_t *sm_script_obj_init(seg_manager_t *self, struct _state *s, reg_t obj_pos); +object_t *sm_script_obj_init(seg_manager_t *self, EngineState *s, reg_t obj_pos); // Initializes an object within the segment manager // Parameters: (reg_t) obj_pos: Location (segment, offset) of the object // Returns : (object_t *) A newly created object_t describing the object @@ -477,7 +477,7 @@ typedef struct _seg_interface { // makes sense // (void *) param: Parameter passed to 'note' - void (*list_all_outgoing_references)(struct _seg_interface *self, struct _state *s, reg_t object, void *param, void (*note)(void *param, reg_t addr)); + void (*list_all_outgoing_references)(struct _seg_interface *self, EngineState *s, reg_t object, void *param, void (*note)(void *param, reg_t addr)); // Iterates over all references reachable from the specified object // Parameters: (reg_t) object: The object (within the current segment) to analyse // (void *) param: Parameter passed to 'note' diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp index 2cfc83ab0a..b720df63b3 100644 --- a/engines/sci/engine/vm.cpp +++ b/engines/sci/engine/vm.cpp @@ -91,7 +91,7 @@ static inline reg_t *validate_property(object_t *obj, int index) { return obj->variables + index; } -static inline stack_ptr_t validate_stack_addr(state_t *s, stack_ptr_t sp) { +static inline stack_ptr_t validate_stack_addr(EngineState *s, stack_ptr_t sp) { if (sp >= s->stack_base && sp < s->stack_top) return sp; @@ -198,14 +198,14 @@ static inline void validate_write_var(reg_t *r, reg_t *stack_base, int type, int #define OBJ_PROPERTY(o, p) (*validate_property(o, p)) -int script_error(state_t *s, const char *file, int line, const char *reason) { +int script_error(EngineState *s, const char *file, int line, const char *reason) { sciprintf("Script error in file %s, line %d: %s\n", file, line, reason); script_debug_flag = script_error_flag = 1; return 0; } #define CORE_ERROR(area, msg) script_error(s, "[" area "] " __FILE__, __LINE__, msg) -reg_t get_class_address(state_t *s, int classnr, int lock, reg_t caller) { +reg_t get_class_address(EngineState *s, int classnr, int lock, reg_t caller) { class_t *the_class = s->classtable + classnr; if (NULL == s) { @@ -258,7 +258,7 @@ reg_t get_class_address(state_t *s, int classnr, int lock, reg_t caller) { #define OBJ_SUPERCLASS(s, reg) SEG_GET_HEAP(s, make_reg(reg.segment, reg.offset + SCRIPT_SUPERCLASS_OFFSET)) // Returns an object's superclass -inline exec_stack_t *execute_method(state_t *s, word script, word pubfunct, stack_ptr_t sp, reg_t calling_obj, word argc, stack_ptr_t argp) { +inline exec_stack_t *execute_method(EngineState *s, word script, word pubfunct, stack_ptr_t sp, reg_t calling_obj, word argc, stack_ptr_t argp) { int seg; guint16 temp; @@ -300,7 +300,7 @@ inline exec_stack_t *execute_method(state_t *s, word script, word pubfunct, stac } -static void _exec_varselectors(state_t *s) { +static void _exec_varselectors(EngineState *s) { // Executes all varselector read/write ops on the TOS // Now check the TOS to execute all varselector entries if (s->execution_stack_pos >= 0) @@ -317,7 +317,7 @@ static void _exec_varselectors(state_t *s) { } } -exec_stack_t *send_selector(state_t *s, reg_t send_obj, reg_t work_obj, stack_ptr_t sp, int framesize, stack_ptr_t argp) { +exec_stack_t *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj, stack_ptr_t sp, int framesize, stack_ptr_t argp) { // send_obj and work_obj are equal for anything but 'super' // Returns a pointer to the TOS exec_stack element #ifdef VM_DEBUG_SEND @@ -479,7 +479,7 @@ exec_stack_t *send_selector(state_t *s, reg_t send_obj, reg_t work_obj, stack_pt return retval; } -exec_stack_t *add_exec_stack_varselector(state_t *s, reg_t objp, int argc, stack_ptr_t argp, selector_t selector, reg_t *address, int origin) { +exec_stack_t *add_exec_stack_varselector(EngineState *s, reg_t objp, int argc, stack_ptr_t argp, selector_t selector, reg_t *address, int origin) { exec_stack_t *xstack = add_exec_stack_entry(s, NULL_REG, address, objp, argc, argp, selector, objp, origin, SCI_XS_CALLEE_LOCALS); // Store selector address in sp @@ -489,7 +489,7 @@ exec_stack_t *add_exec_stack_varselector(state_t *s, reg_t objp, int argc, stack return xstack; } -exec_stack_t *add_exec_stack_entry(state_t *s, reg_t pc, stack_ptr_t sp, reg_t objp, int argc, +exec_stack_t *add_exec_stack_entry(EngineState *s, reg_t pc, stack_ptr_t sp, reg_t objp, int argc, stack_ptr_t argp, selector_t selector, reg_t sendp, int origin, seg_id_t locals_segment) { // Returns new TOS element for the execution stack // locals_segment may be -1 if derived from the called object @@ -533,7 +533,7 @@ exec_stack_t *add_exec_stack_entry(state_t *s, reg_t pc, stack_ptr_t sp, reg_t o # define kernel_matches_signature(a, b, c, d) 1 #endif -void vm_handle_fatal_error(state_t *s, int line, const char *file) { +void vm_handle_fatal_error(EngineState *s, int line, const char *file) { error("Fatal VM error in %s, L%d; aborting...\n", file, line); #ifdef HAVE_SETJMP_H if (jump_initialized) @@ -543,7 +543,7 @@ void vm_handle_fatal_error(state_t *s, int line, const char *file) { exit(1); } -static inline script_t *script_locate_by_segment(state_t *s, seg_id_t seg) { +static inline script_t *script_locate_by_segment(EngineState *s, seg_id_t seg) { mem_obj_t *memobj = GET_SEGMENT(s->seg_manager, seg, MEM_OBJ_SCRIPT); if (memobj) return &(memobj->data.script); @@ -551,7 +551,7 @@ static inline script_t *script_locate_by_segment(state_t *s, seg_id_t seg) { return NULL; } -static reg_t pointer_add(state_t *s, reg_t base, int offset) { +static reg_t pointer_add(EngineState *s, reg_t base, int offset) { mem_obj_t *mobj = GET_SEGMENT_ANY(s->seg_manager, base.segment); if (!mobj) { @@ -580,7 +580,7 @@ static reg_t pointer_add(state_t *s, reg_t base, int offset) { } } -static inline void gc_countdown(state_t *s) { +static inline void gc_countdown(EngineState *s) { if (s->gc_countdown-- <= 0) { s->gc_countdown = script_gc_interval; run_gc(s); @@ -589,7 +589,7 @@ static inline void gc_countdown(state_t *s) { static byte _fake_return_buffer[2] = {op_ret << 1, op_ret << 1}; -void run_vm(state_t *s, int restoring) { +void run_vm(EngineState *s, int restoring) { reg_t *variables[4]; // global, local, temp, param, as immediate pointers reg_t *variables_base[4]; // Used for referencing VM ops seg_id_t variables_seg[4]; // Same as above, contains segment IDs @@ -1488,7 +1488,7 @@ void run_vm(state_t *s, int restoring) { } } -static inline int _obj_locate_varselector(state_t *s, object_t *obj, selector_t slc) { +static inline int _obj_locate_varselector(EngineState *s, object_t *obj, selector_t slc) { // Determines if obj explicitly defines slc as a varselector // Returns -1 if not found @@ -1521,7 +1521,7 @@ static inline int _obj_locate_varselector(state_t *s, object_t *obj, selector_t } } -static inline int _class_locate_funcselector(state_t *s, object_t *obj, selector_t slc) { +static inline int _class_locate_funcselector(EngineState *s, object_t *obj, selector_t slc) { // Determines if obj is a class and explicitly defines slc as a funcselector // Does NOT say anything about obj's superclasses, i.e. failure may be // returned even if one of the superclasses defines the funcselector. @@ -1535,7 +1535,7 @@ static inline int _class_locate_funcselector(state_t *s, object_t *obj, selector return -1; // Failed } -static inline int _lookup_selector_function(state_t *s, int seg_id, object_t *obj, selector_t selector_id, reg_t *fptr) { +static inline int _lookup_selector_function(EngineState *s, int seg_id, object_t *obj, selector_t selector_id, reg_t *fptr) { int index; // "recursive" lookup @@ -1561,7 +1561,7 @@ static inline int _lookup_selector_function(state_t *s, int seg_id, object_t *ob return SELECTOR_NONE; } -int lookup_selector(state_t *s, reg_t obj_location, selector_t selector_id, reg_t **vptr, reg_t *fptr) { +int lookup_selector(EngineState *s, reg_t obj_location, selector_t selector_id, reg_t **vptr, reg_t *fptr) { object_t *obj = obj_get(s, obj_location); object_t *species; int index; @@ -1603,7 +1603,7 @@ int lookup_selector(state_t *s, reg_t obj_location, selector_t selector_id, reg_ } // Detects SCI versions by their different script header -void script_detect_versions(state_t *s) { +void script_detect_versions(EngineState *s) { int c; resource_t *script = {0}; @@ -1625,7 +1625,7 @@ void script_detect_versions(state_t *s) { } } -seg_id_t script_get_segment(state_t *s, int script_nr, int load) { +seg_id_t script_get_segment(EngineState *s, int script_nr, int load) { seg_id_t segment; if ((load & SCRIPT_GET_LOAD) == SCRIPT_GET_LOAD) @@ -1642,7 +1642,7 @@ seg_id_t script_get_segment(state_t *s, int script_nr, int load) { return 0; } -reg_t script_lookup_export(state_t *s, int script_nr, int export_index) { +reg_t script_lookup_export(EngineState *s, int script_nr, int export_index) { seg_id_t seg = script_get_segment(s, script_nr, SCRIPT_GET_DONT_LOAD); mem_obj_t *memobj; script_t *script = NULL; @@ -1683,8 +1683,8 @@ reg_t script_lookup_export(state_t *s, int script_nr, int export_index) { #define INST_LOOKUP_CLASS(id) ((id == 0xffff)? NULL_REG : get_class_address(s, id, SCRIPT_GET_LOCK, reg)) int sm_script_marked_deleted(seg_manager_t* self, int script_nr); -int sm_initialise_script(mem_obj_t *mem, struct _state *s, int script_nr); -int script_instantiate_common(state_t *s, int script_nr, resource_t **script, resource_t **heap, int *was_new) { +int sm_initialise_script(mem_obj_t *mem, EngineState *s, int script_nr); +int script_instantiate_common(EngineState *s, int script_nr, resource_t **script, resource_t **heap, int *was_new) { int seg; int seg_id; int marked_for_deletion; @@ -1747,7 +1747,7 @@ int script_instantiate_common(state_t *s, int script_nr, resource_t **script, re return seg_id; } -int script_instantiate_sci0(state_t *s, int script_nr) { +int script_instantiate_sci0(EngineState *s, int script_nr) { int objtype; unsigned int objlength; reg_t reg, reg_tmp; @@ -1902,10 +1902,10 @@ int script_instantiate_sci0(state_t *s, int script_nr) { } void sm_script_relocate_exports_sci11(seg_manager_t *self, int seg); -void sm_script_initialise_objects_sci11(seg_manager_t *self, state_t *s, int seg); -void sm_heap_relocate(seg_manager_t *self, state_t *s, reg_t block); +void sm_script_initialise_objects_sci11(seg_manager_t *self, EngineState *s, int seg); +void sm_heap_relocate(seg_manager_t *self, EngineState *s, reg_t block); -int script_instantiate_sci11(state_t *s, int script_nr) { +int script_instantiate_sci11(EngineState *s, int script_nr) { resource_t *script, *heap; int seg_id; int heap_start; @@ -1940,7 +1940,7 @@ int script_instantiate_sci11(state_t *s, int script_nr) { return seg_id; } -int script_instantiate(state_t *s, int script_nr) { +int script_instantiate(EngineState *s, int script_nr) { if (s->version >= SCI_VERSION(1, 001, 000)) return script_instantiate_sci11(s, script_nr); else @@ -1949,7 +1949,7 @@ int script_instantiate(state_t *s, int script_nr) { void sm_mark_script_deleted(seg_manager_t* self, int script_nr); -void script_uninstantiate_sci0(state_t *s, int script_nr, seg_id_t seg) { +void script_uninstantiate_sci0(EngineState *s, int script_nr, seg_id_t seg) { reg_t reg = make_reg(seg, (s->version < SCI_VERSION_FTU_NEW_SCRIPT_HEADER) ? 2 : 0); int objtype, objlength; @@ -1991,7 +1991,7 @@ void script_uninstantiate_sci0(state_t *s, int script_nr, seg_id_t seg) { } while (objtype != 0); } -void script_uninstantiate(state_t *s, int script_nr) { +void script_uninstantiate(EngineState *s, int script_nr) { reg_t reg = make_reg(0, (s->version < SCI_VERSION_FTU_NEW_SCRIPT_HEADER) ? 2 : 0); int i; @@ -2031,13 +2031,13 @@ void script_uninstantiate(state_t *s, int script_nr) { return; } -static void _init_stack_base_with_selector(state_t *s, selector_t selector) { +static void _init_stack_base_with_selector(EngineState *s, selector_t selector) { s->stack_base[0] = make_reg(0, (word)selector); s->stack_base[1] = NULL_REG; } -static state_t *_game_run(state_t *s, int restoring) { - state_t *successor = NULL; +static EngineState *_game_run(EngineState *s, int restoring) { + EngineState *successor = NULL; int game_is_finished = 0; do { s->execution_stack_pos_changed = 0; @@ -2090,10 +2090,10 @@ static state_t *_game_run(state_t *s, int restoring) { return s; } -int objinfo(state_t *s, reg_t pos); +int objinfo(EngineState *s, reg_t pos); -int game_run(state_t **_s) { - state_t *s = *_s; +int game_run(EngineState **_s) { + EngineState *s = *_s; sciprintf(" Calling %s::play()\n", s->game_name); _init_stack_base_with_selector(s, s->selector_map.play); // Call the play selector @@ -2113,8 +2113,8 @@ int game_run(state_t **_s) { } #if 0 -int game_restore(state_t **_s, char *game_name) { - state_t *s; +int game_restore(EngineState **_s, char *game_name) { + EngineState *s; int debug_state = _debugstate_valid; sciprintf("Restoring savegame '%s'...\n", game_name); @@ -2141,7 +2141,7 @@ int game_restore(state_t **_s, char *game_name) { } #endif -object_t *obj_get(state_t *s, reg_t offset) { +object_t *obj_get(EngineState *s, reg_t offset) { mem_obj_t *memobj = GET_OBJECT_SEGMENT(s->seg_manager, offset.segment); object_t *obj = NULL; int idx; @@ -2162,7 +2162,7 @@ object_t *obj_get(state_t *s, reg_t offset) { return obj; } -const char *obj_get_name(struct _state *s, reg_t pos) { +const char *obj_get_name(EngineState *s, reg_t pos) { object_t *obj = obj_get(s, pos); if (!obj) diff --git a/engines/sci/gfx/menubar.cpp b/engines/sci/gfx/menubar.cpp index 9fed5329a5..57ecc6cc44 100644 --- a/engines/sci/gfx/menubar.cpp +++ b/engines/sci/gfx/menubar.cpp @@ -288,7 +288,7 @@ int menubar_match_key(menu_item_t *item, int message, int modifiers) { return 0; } -int menubar_set_attribute(state_t *s, int menu_nr, int item_nr, int attribute, reg_t value) { +int menubar_set_attribute(EngineState *s, int menu_nr, int item_nr, int attribute, reg_t value) { menubar_t *menubar = s->menubar; menu_item_t *item; @@ -357,7 +357,7 @@ int menubar_set_attribute(state_t *s, int menu_nr, int item_nr, int attribute, r return 0; } -reg_t menubar_get_attribute(state_t *s, int menu_nr, int item_nr, int attribute) { +reg_t menubar_get_attribute(EngineState *s, int menu_nr, int item_nr, int attribute) { menubar_t *menubar = s->menubar; menu_item_t *item; @@ -391,7 +391,7 @@ reg_t menubar_get_attribute(state_t *s, int menu_nr, int item_nr, int attribute) } } -int menubar_item_valid(state_t *s, int menu_nr, int item_nr) { +int menubar_item_valid(EngineState *s, int menu_nr, int item_nr) { menubar_t *menubar = s->menubar; menu_item_t *item; @@ -409,7 +409,7 @@ int menubar_item_valid(state_t *s, int menu_nr, int item_nr) { return 0; // May not be selected } -int menubar_map_pointer(state_t *s, int *menu_nr, int *item_nr, gfxw_port_t *port) { +int menubar_map_pointer(EngineState *s, int *menu_nr, int *item_nr, gfxw_port_t *port) { menubar_t *menubar = s->menubar; menu_t *menu; diff --git a/engines/sci/gfx/sci_widgets.cpp b/engines/sci/gfx/sci_widgets.cpp index 4fb99cecf2..320647715b 100644 --- a/engines/sci/gfx/sci_widgets.cpp +++ b/engines/sci/gfx/sci_widgets.cpp @@ -42,7 +42,7 @@ static void clear_titlebar(gfxw_port_t *titlebar) { } } -static gfxw_list_t *make_titlebar_list(state_t *s, rect_t bounds, gfxw_port_t *status_bar) { +static gfxw_list_t *make_titlebar_list(EngineState *s, rect_t bounds, gfxw_port_t *status_bar) { gfx_color_t color = status_bar->bgcolor; gfxw_list_t *list; gfxw_box_t *bgbox; @@ -57,7 +57,7 @@ static gfxw_list_t *make_titlebar_list(state_t *s, rect_t bounds, gfxw_port_t *s return list; } -static gfxw_list_t *finish_titlebar_list(state_t *s, gfxw_list_t *list, gfxw_port_t *status_bar) { +static gfxw_list_t *finish_titlebar_list(EngineState *s, gfxw_list_t *list, gfxw_port_t *status_bar) { gfx_color_t black = s->ega_colors[0]; gfxw_primitive_t *line; @@ -68,7 +68,7 @@ static gfxw_list_t *finish_titlebar_list(state_t *s, gfxw_list_t *list, gfxw_por return list; } -void sciw_set_status_bar(state_t *s, gfxw_port_t *status_bar, char *text, int fgcolor, int bgcolor) { +void sciw_set_status_bar(EngineState *s, gfxw_port_t *status_bar, char *text, int fgcolor, int bgcolor) { gfx_state_t *state; gfxw_list_t *list; gfx_color_t bg = status_bar->bgcolor; @@ -125,7 +125,7 @@ static void sciw_make_window_fit(rect_t *rect, gfxw_port_t *parent) { rect->y -= (rect->y + rect->yl) - (parent->bounds.y + parent->bounds.yl) + 2; } -gfxw_port_t *sciw_new_window(state_t *s, rect_t area, int font, gfx_color_t color, gfx_color_t bgcolor, +gfxw_port_t *sciw_new_window(EngineState *s, rect_t area, int font, gfx_color_t color, gfx_color_t bgcolor, int title_font, gfx_color_t title_color, gfx_color_t title_bgcolor, const char *title, int flags) { gfxw_visual_t *visual = s->visual; gfx_state_t *state = s->gfx_state; @@ -525,7 +525,7 @@ gfxw_list_t *sciw_new_list_control(gfxw_port_t *port, reg_t ID, rect_t zone, int return list; } -void sciw_set_menubar(state_t *s, gfxw_port_t *status_bar, menubar_t *menubar, int selection) { +void sciw_set_menubar(EngineState *s, gfxw_port_t *status_bar, menubar_t *menubar, int selection) { gfxw_list_t *list = make_titlebar_list(s, status_bar->bounds, status_bar); int offset = MENU_LEFT_BORDER; int i; @@ -553,7 +553,7 @@ void sciw_set_menubar(state_t *s, gfxw_port_t *status_bar, menubar_t *menubar, i finish_titlebar_list(s, list, status_bar); } -gfxw_port_t *sciw_new_menu(state_t *s, gfxw_port_t *status_bar, menubar_t *menubar, int selection) { +gfxw_port_t *sciw_new_menu(EngineState *s, gfxw_port_t *status_bar, menubar_t *menubar, int selection) { gfxw_port_t *retval; menu_t *menu = menubar->menus + selection; rect_t area = gfx_rect(MENU_LEFT_BORDER, 10, 0, 0); @@ -632,7 +632,7 @@ gfxw_widget_t *_make_menu_hbar(int offset, int width, gfxw_port_t *port, gfx_col return GFXW(list); } -gfxw_port_t *sciw_unselect_item(state_t *s, gfxw_port_t *menu_port, menu_t *menu, int selection) { +gfxw_port_t *sciw_unselect_item(EngineState *s, gfxw_port_t *menu_port, menu_t *menu, int selection) { menu_item_t *item = menu->items + selection; if (selection < 0 || selection >= menu->items_nr) @@ -649,7 +649,7 @@ gfxw_port_t *sciw_unselect_item(state_t *s, gfxw_port_t *menu_port, menu_t *menu return menu_port; } -gfxw_port_t *sciw_select_item(state_t *s, gfxw_port_t *menu_port, menu_t *menu, int selection) { +gfxw_port_t *sciw_select_item(EngineState *s, gfxw_port_t *menu_port, menu_t *menu, int selection) { menu_item_t *item = menu->items + selection; if (selection < 0 || selection >= menu->items_nr) diff --git a/engines/sci/include/console.h b/engines/sci/include/console.h index 9dd998cde6..4bba2edc23 100644 --- a/engines/sci/include/console.h +++ b/engines/sci/include/console.h @@ -51,8 +51,6 @@ extern FILE *con_file; ** directly to the con_file variable. */ -struct _state; /* state_t later on */ - typedef union { int32 val; char *str; @@ -65,7 +63,7 @@ extern unsigned int cmd_paramlength; extern cmd_param_t *cmd_params; /* The parameters passed to a function called by the parser */ -extern struct _state *con_gamestate; +extern struct EngineState *con_gamestate; /* The game state as used by some of the console commands */ @@ -101,16 +99,16 @@ con_init(void); void -con_parse(struct _state *s, const char *command); +con_parse(EngineState *s, const char *command); /* Parses a command and summons appropriate facilities to handle it -** Parameters: (state_t *) s: The state_t to use +** Parameters: (EngineState *) s: The EngineState to use ** command: The command to execute ** Returns : (void) */ int -con_hook_command(int command(struct _state *s), const char *name, const char *param, const char *description); +con_hook_command(int command(EngineState *s), const char *name, const char *param, const char *description); /* Adds a command to the parser's command list ** Parameters: command: The command to add ** name: The command's name @@ -121,7 +119,7 @@ con_hook_command(int command(struct _state *s), const char *name, const char *pa ** 'name' already being in use. ** A valid param string is either empty (no parameters allowed) ** or contains one of the following tokens: -** ! Special token: state_t* must be set for this function to be called +** ! Special token: EngineState* must be set for this function to be called ** i (an int) ** s (a 'string' (char *)) ** h (a byte, described in hexadecimal digits) diff --git a/engines/sci/include/engine.h b/engines/sci/include/engine.h index 8c3458c75f..b79cb7498d 100644 --- a/engines/sci/include/engine.h +++ b/engines/sci/include/engine.h @@ -77,7 +77,7 @@ namespace Sci { #define MAX_SAVE_DIR_SIZE MAX_HOMEDIR_SIZE + STRLEN_FREESCI_GAMEDIR + MAX_GAMEDIR_SIZE + 4 /* +4 for the three slashes and trailing \0 */ -/* values for state_t.restarting_flag */ +/* values for EngineState.restarting_flag */ #define SCI_GAME_IS_NOT_RESTARTING 0 #define SCI_GAME_WAS_RESTARTED 1 #define SCI_GAME_IS_RESTARTING_NOW 2 @@ -98,7 +98,7 @@ struct SavegameMetadata { int savegame_time; }; -typedef struct _state { +struct EngineState { int savegame_version; int widget_serial_counter; /* Used for savegames */ @@ -275,54 +275,47 @@ typedef struct _state { /* Backwards compatibility crap */ int port_ID; - struct _state *successor; /* Successor of this state: Used for restoring */ - -} state_t; + EngineState *successor; /* Successor of this state: Used for restoring */ +}; #define STATE_T_DEFINED -int -gamestate_save(state_t *s, Common::WriteStream *save, const char *savename); +int gamestate_save(EngineState *s, Common::WriteStream *save, const char *savename); /* Saves a game state to the hard disk in a portable way -** Parameters: (state_t *) s: The state to save +** Parameters: (EngineState *) s: The state to save ** (WriteStream *) save: The stream to save to ** (char *) savename: The description of the savegame ** Returns : (int) 0 on success, 1 otherwise */ -state_t * -gamestate_restore(state_t *s, Common::SeekableReadStream *save); +EngineState *gamestate_restore(EngineState *s, Common::SeekableReadStream *save); /* Restores a game state from a directory -** Parameters: (state_t *) s: An older state from the same game +** Parameters: (EngineState *) s: An older state from the same game ** (char *) dirname: The subdirectory to restore from -** Returns : (state_t *) NULL on failure, a pointer to a valid state_t otherwise +** Returns : (EngineState *) NULL on failure, a pointer to a valid EngineState otherwise */ bool get_savegame_metadata(Common::SeekableReadStream* stream, SavegameMetadata* meta); /* Read the header from a savegame */ -gfx_pixmap_color_t * -get_pic_color(state_t *s, int color); +gfx_pixmap_color_t *get_pic_color(EngineState *s, int color); /* Retrieves the gfx_pixmap_color_t associated with a game color index -** Parameters: (state_t *) s: The game state +** Parameters: (EngineState *) s: The game state ** (int) color: The color to look up ** Returns : (gfx_pixmap_color_t *) The requested color. */ -void -other_libs_exit(void); +void other_libs_exit(void); /* Called directly before FreeSCI ends to allow libraries to clean up */ -static inline -reg_t not_register(state_t *s, reg_t r) { +static inline reg_t not_register(EngineState *s, reg_t r) { if (s->version >= SCI_VERSION_FTU_INVERSE_CANBEHERE) return make_reg(0, !r.offset); else return r; - } } // End of namespace Sci diff --git a/engines/sci/include/event.h b/engines/sci/include/event.h index dc4bc6a83a..49480d92fa 100644 --- a/engines/sci/include/event.h +++ b/engines/sci/include/event.h @@ -30,9 +30,7 @@ namespace Sci { -struct _state; - -sci_event_t getEvent(struct _state *s); +sci_event_t getEvent(EngineState *s); /* Returns the next SCI_EV_* event ** Parameters: (struct state *) Current game state ** Returns : (sci_event_t) The next event, which may be any of the diff --git a/engines/sci/include/kdebug.h b/engines/sci/include/kdebug.h index 92a5511706..e830965b7b 100644 --- a/engines/sci/include/kdebug.h +++ b/engines/sci/include/kdebug.h @@ -30,7 +30,6 @@ namespace Sci { -struct _state; #define SCIk_DEBUG_MODES 17 #define SCIkERROR_NR -2 @@ -80,14 +79,14 @@ struct _state; /* Internal functions */ -void _SCIkdebug(struct _state *s, const char *file, int line, int area, const char *format, ...); -void _SCIGNUkdebug(const char *funcname, struct _state *s, const char *file, int line, int area, const char *format, ...); +void _SCIkdebug(EngineState *s, const char *file, int line, int area, const char *format, ...); +void _SCIGNUkdebug(const char *funcname, EngineState *s, const char *file, int line, int area, const char *format, ...); /* If mode=1, enables debugging for specified areas. If mode=0, disables ** debugging for specified areas. ** Valid area characters: ulgcmfbad */ -void set_debug_mode(struct _state *s, int mode, const char *areas); +void set_debug_mode(EngineState *s, int mode, const char *areas); extern int sci_debug_flags; diff --git a/engines/sci/include/kernel.h b/engines/sci/include/kernel.h index 21a7e7b79b..332e12fd9f 100644 --- a/engines/sci/include/kernel.h +++ b/engines/sci/include/kernel.h @@ -85,19 +85,19 @@ typedef struct { */ -reg_t read_selector(struct _state *s, reg_t object, selector_t selector_id, const char *fname, int line); -void write_selector(struct _state *s, reg_t object, selector_t selector_id, reg_t value, +reg_t read_selector(EngineState *s, reg_t object, selector_t selector_id, const char *fname, int line); +void write_selector(EngineState *s, reg_t object, selector_t selector_id, reg_t value, const char *fname, int line); -int invoke_selector(struct _state *s, reg_t object, int selector_id, int noinvalid, int kfunct, +int invoke_selector(EngineState *s, reg_t object, int selector_id, int noinvalid, int kfunct, stack_ptr_t k_argp, int k_argc, const char *fname, int line, int argc, ...); /******************** Text functionality ********************/ -char *kernel_lookup_text(struct _state *s, reg_t address, int index); +char *kernel_lookup_text(EngineState *s, reg_t address, int index); /* Looks up text referenced by scripts -** Parameters: (state_t *s): The current state +** Parameters: (EngineState *s): The current state ** (reg_t) address: The address to look up ** (int) index: The relative index ** Returns : (char *): The referenced text, or NULL on error. @@ -131,9 +131,9 @@ char *kernel_lookup_text(struct _state *s, reg_t address, int index); #endif /* !SCI_KERNEL_DEBUG */ -bool is_object(struct _state *s, reg_t obj); +bool is_object(EngineState *s, reg_t obj); /* Checks whether a heap address contains an object -** Parameters: (state_t *) s: The current state +** Parameters: (EngineState *) s: The current state ** (reg_t) obj: The address to check ** Returns : (int) 1 if it is an object, 0 otherwise */ @@ -155,11 +155,11 @@ bool is_object(struct _state *s, reg_t obj); #define SKPV_OR_ALT(x,a) KP_SINT(KP_ALT(x, make_reg(0, a))) #define UKPV_OR_ALT(x,a) KP_UINT(KP_ALT(x, make_reg(0, a))) -reg_t *kernel_dereference_reg_pointer(struct _state *s, reg_t pointer, int entries); -byte *kernel_dereference_bulk_pointer(struct _state *s, reg_t pointer, int entries); +reg_t *kernel_dereference_reg_pointer(EngineState *s, reg_t pointer, int entries); +byte *kernel_dereference_bulk_pointer(EngineState *s, reg_t pointer, int entries); #define kernel_dereference_char_pointer(state, pointer, entries) (char*)kernel_dereference_bulk_pointer(state, pointer, entries) /* Dereferences a heap pointer -** Parameters: (state_t *) s: The state to operate on +** Parameters: (EngineState *) s: The state to operate on ** (reg_t ) pointer: The pointer to dereference ** (int) entries: The number of values expected (for checking) ** (use 0 for strings) @@ -180,9 +180,9 @@ byte *kernel_dereference_bulk_pointer(struct _state *s, reg_t pointer, int entri -int kernel_oops(struct _state *s, const char *file, int line, const char *reason); +int kernel_oops(EngineState *s, const char *file, int line, const char *reason); /* Halts script execution and informs the user about an internal kernel error or failed assertion -** Paramters: (state_t *) s: The state to use +** Paramters: (EngineState *) s: The state to use ** (const char *) file: The file the oops occured in ** (int) line: The line the oops occured in ** (const char *) reason: Reason for the kernel oops @@ -193,20 +193,18 @@ int kernel_oops(struct _state *s, const char *file, int line, const char *reason /******************** Priority macros/functions ********************/ -struct _state; - extern int sci01_priority_table_flags; /* 1: delete, 2: print */ -int _find_priority_band(struct _state *s, int band); +int _find_priority_band(EngineState *s, int band); /* Finds the position of the priority band specified -** Parameters: (state_t *) s: State to search in +** Parameters: (EngineState *) s: State to search in ** (int) band: Band to look for ** Returns : (int) Offset at which the band starts */ -int _find_view_priority(struct _state *s, int y); +int _find_view_priority(EngineState *s, int y); /* Does the opposite of _find_priority_band -** Parameters: (state_t *) s: State +** Parameters: (EngineState *) s: State ** (int) y: Coordinate to check ** Returns : (int) The priority band y belongs to */ @@ -232,16 +230,16 @@ int _find_view_priority(struct _state *s, int y); /******************** Dynamic view list functions ********************/ -abs_rect_t set_base(struct _state *s, reg_t object); +abs_rect_t set_base(EngineState *s, reg_t object); /* Determines the base rectangle of the specified view object -** Parameters: (state_t *) s: The state to use +** Parameters: (EngineState *) s: The state to use ** (reg_t) object: The object to set ** Returns : (abs_rect) The absolute base rectangle */ -extern abs_rect_t get_nsrect(struct _state *s, reg_t object, byte clip); +extern abs_rect_t get_nsrect(EngineState *s, reg_t object, byte clip); /* Determines the now-seen rectangle of a view object -** Parameters: (state_t *) s: The state to use +** Parameters: (EngineState *) s: The state to use ** (reg_t) object: The object to check ** (byte) clip: Flag to determine wheter priority band ** clipping should be performed @@ -249,9 +247,9 @@ extern abs_rect_t get_nsrect(struct _state *s, reg_t object, byte clip); ** now-seen area. */ -void _k_dyn_view_list_prepare_change(struct _state *s); +void _k_dyn_view_list_prepare_change(EngineState *s); /* Removes all views in anticipation of a new window or text */ -void _k_dyn_view_list_accept_change(struct _state *s); +void _k_dyn_view_list_accept_change(EngineState *s); /* Redraws all views after a new window or text was added */ @@ -259,14 +257,14 @@ void _k_dyn_view_list_accept_change(struct _state *s); /******************** Misc functions ********************/ -void process_sound_events(struct _state *s); /* Get all sound events, apply their changes to the heap */ +void process_sound_events(EngineState *s); /* Get all sound events, apply their changes to the heap */ #define LOOKUP_NODE(addr) lookup_node(s, (addr), __FILE__, __LINE__) #define LOOKUP_LIST(addr) lookup_list(s, addr, __FILE__, __LINE__) -node_t *lookup_node(struct _state *s, reg_t addr, const char *file, int line); +node_t *lookup_node(EngineState *s, reg_t addr, const char *file, int line); /* Resolves an address into a list node -** Parameters: (state_t *) s: The state to operate on +** Parameters: (EngineState *) s: The state to operate on ** (reg_t) addr: The address to resolve ** (const char *) file: The file the function was called from ** (int) line: The line number the function was called from @@ -274,9 +272,9 @@ node_t *lookup_node(struct _state *s, reg_t addr, const char *file, int line); */ -list_t *lookup_list(struct _state *s, reg_t addr, const char *file, int line); +list_t *lookup_list(EngineState *s, reg_t addr, const char *file, int line); /* Resolves a list pointer to a list -** Parameters: (state_t *) s: The state to operate on +** Parameters: (EngineState *) s: The state to operate on ** (reg_t) addr: The address to resolve ** (const char *) file: The file the function was called from ** (int) line: The line number the function was called from @@ -327,7 +325,7 @@ list_t *lookup_list(struct _state *s, reg_t addr, const char *file, int line); /******************** Kernel functions ********************/ /* Generic description: */ -typedef reg_t kfunct(struct _state *s, int funct_nr, int argc, reg_t *argv); +typedef reg_t kfunct(EngineState *s, int funct_nr, int argc, reg_t *argv); #define FREESCI_KFUNCT_GLUTTON 1 diff --git a/engines/sci/include/menubar.h b/engines/sci/include/menubar.h index 0fec648e6d..4fed274891 100644 --- a/engines/sci/include/menubar.h +++ b/engines/sci/include/menubar.h @@ -33,8 +33,6 @@ namespace Sci { -struct _state; - #define MENU_FREESCI_BLATANT_PLUG 0xfff0 /* This adds an "About FreeSCI" menu option to the first menu */ @@ -168,7 +166,7 @@ menubar_add_menu(gfx_state_t *state, menubar_t *menubar, char *title, char *entr int -menubar_set_attribute(struct _state *s, int menu, int item, int attribute, reg_t value); +menubar_set_attribute(EngineState *s, int menu, int item, int attribute, reg_t value); /* Sets the (currently unidentified) foo and bar values. ** Parameters: (state_t *) s: The current state ** (int) menu: The menu number to edit @@ -180,7 +178,7 @@ menubar_set_attribute(struct _state *s, int menu, int item, int attribute, reg_t reg_t -menubar_get_attribute(struct _state *s, int menu, int item, int attribute); +menubar_get_attribute(EngineState *s, int menu, int item, int attribute); /* Sets the (currently unidentified) foo and bar values. ** Parameters: (state_t *) s: The current state ** (int) menu: The menu number @@ -191,7 +189,7 @@ menubar_get_attribute(struct _state *s, int menu, int item, int attribute); int -menubar_item_valid(struct _state *s, int menu, int item); +menubar_item_valid(EngineState *s, int menu, int item); /* Determines whether the specified menu entry may be activated ** Parameters: (state_t *) s: The current state ** (int x int) (menu, item): The menu item to check @@ -200,7 +198,7 @@ menubar_item_valid(struct _state *s, int menu, int item); int -menubar_map_pointer(struct _state *s, int *menu_nr, int *item_nr, gfxw_port_t *port); +menubar_map_pointer(EngineState *s, int *menu_nr, int *item_nr, gfxw_port_t *port); /* Maps the pointer position to a (menu,item) tuple. ** Parameters: (state_t *) s: The current state ** ((int *) x (int *)) (menu_nr, item_nr): Pointers to the current menu/item tuple diff --git a/engines/sci/include/sci_widgets.h b/engines/sci/include/sci_widgets.h index d9cbbefd63..5a8d8b7c93 100644 --- a/engines/sci/include/sci_widgets.h +++ b/engines/sci/include/sci_widgets.h @@ -61,20 +61,20 @@ namespace Sci { #define CONTROL_STATE_ENABLED 0x0001 void -sciw_set_status_bar(state_t *s, gfxw_port_t *status_bar, char *text, int fgcolor, int bgcolor); +sciw_set_status_bar(EngineState *s, gfxw_port_t *status_bar, char *text, int fgcolor, int bgcolor); /* Sets the contents of a port used as status bar -** Parmeters: (state_t *) s: The affected game state +** Parmeters: (EngineState *) s: The affected game state ** (gfxw_port_t *) status_bar: The status bar port ** (char *) text: The text to draw ** Returns : (void) */ gfxw_port_t * -sciw_new_window(state_t *s, rect_t area, int font, gfx_color_t color, gfx_color_t bgcolor, +sciw_new_window(EngineState *s, rect_t area, int font, gfx_color_t color, gfx_color_t bgcolor, int title_font, gfx_color_t title_color, gfx_color_t title_bg_color, const char *title, int flags); /* Creates a new SCI style window -** Parameters: (state_t *) s: The affected game state +** Parameters: (EngineState *) s: The affected game state ** (rect_t) area: The screen area to frame (not including a potential window title) ** (int) font: Default font number to use ** (gfx_color_t) color: The foreground color to use for drawing @@ -169,9 +169,9 @@ sciw_new_list_control(gfxw_port_t *port, reg_t ID, rect_t zone, int font_nr, cha /*---------------------*/ void -sciw_set_menubar(state_t *s, gfxw_port_t *status_bar, menubar_t *menubar, int selection); +sciw_set_menubar(EngineState *s, gfxw_port_t *status_bar, menubar_t *menubar, int selection); /* Draws the menu bar -** Parameters: (state_t *) s: The state to operate on +** Parameters: (EngineState *) s: The state to operate on ** (gfxw_port_t *) status_bar: The status bar port to modify ** (menubar_t *) menubar: The menu bar to use ** (int) selection: Number of the menu to hightlight, or -1 for 'none' @@ -179,9 +179,9 @@ sciw_set_menubar(state_t *s, gfxw_port_t *status_bar, menubar_t *menubar, int se */ gfxw_port_t * -sciw_new_menu(state_t *s, gfxw_port_t *status_bar, menubar_t *menubar, int selection); +sciw_new_menu(EngineState *s, gfxw_port_t *status_bar, menubar_t *menubar, int selection); /* Creates a menu port -** Parameters: (state_t *) s: The state to operate on +** Parameters: (EngineState *) s: The state to operate on ** (gfxw_port_t *) status_bar: The status bar ** (menubar_t *) menubar: The menu bar to use ** (int) selection: Number of the menu to interpret @@ -189,9 +189,9 @@ sciw_new_menu(state_t *s, gfxw_port_t *status_bar, menubar_t *menubar, int selec */ gfxw_port_t * -sciw_unselect_item(state_t *s, gfxw_port_t *menu_port, menu_t *menu, int selection); +sciw_unselect_item(EngineState *s, gfxw_port_t *menu_port, menu_t *menu, int selection); /* Unselects a previously selected item from a menu port -** Parameters: (state_t *) s: The state to operate on +** Parameters: (EngineState *) s: The state to operate on ** (gfxw_port_t *) menu_port: The port modify ** (menu_t *) menu: The menu the menu port corresponds to ** (int) selection: Number of the menu entry to unselect, or -1 to do a NOP @@ -199,9 +199,9 @@ sciw_unselect_item(state_t *s, gfxw_port_t *menu_port, menu_t *menu, int selecti */ gfxw_port_t * -sciw_select_item(state_t *s, gfxw_port_t *menu_port, menu_t *menu, int selection); +sciw_select_item(EngineState *s, gfxw_port_t *menu_port, menu_t *menu, int selection); /* Selects a menu item from a menu port -** Parameters: (state_t *) s: The state to operate on +** Parameters: (EngineState *) s: The state to operate on ** (gfxw_port_t *) menu_port: The port modify ** (menu_t *) menu: The menu the menu port corresponds to ** (int) selection: Number of the menu entry to select, or -1 to do a NOP diff --git a/engines/sci/include/script.h b/engines/sci/include/script.h index ad1e976914..00effd22a9 100644 --- a/engines/sci/include/script.h +++ b/engines/sci/include/script.h @@ -208,15 +208,14 @@ extern opcode_format formats[128][4]; void script_adjust_opcode_formats(int res_version); int -script_find_selector(struct _state *s, const char *selector_name); +script_find_selector(EngineState *s, const char *selector_name); /* Determines the selector ID of a selector by its name ** Parameters: (state_t *) s: VM state ** (char *) selector_name: Name of the selector to look up ** Returns : (int) The appropriate selector ID, or -1 on error */ -struct _state; -void script_free_breakpoints(struct _state *s); +void script_free_breakpoints(EngineState *s); } // End of namespace Sci diff --git a/engines/sci/include/uinput.h b/engines/sci/include/uinput.h index 30b39ef9f5..3b2f21a2c3 100644 --- a/engines/sci/include/uinput.h +++ b/engines/sci/include/uinput.h @@ -34,8 +34,6 @@ namespace Sci { -struct _state; - #define SCI_INPUT_DEFAULT_CLOCKTIME 100000 #define SCI_INPUT_DEFAULT_REDRAWTIME 30000 diff --git a/engines/sci/include/versions.h b/engines/sci/include/versions.h index 1b5de640f5..dfcea5ede1 100644 --- a/engines/sci/include/versions.h +++ b/engines/sci/include/versions.h @@ -32,8 +32,6 @@ namespace Sci { -struct _state; - #define SCI_VERSION(_major_, _minor_, _patchlevel_) (((_major_)<<20) | ((_minor_)<<10) | _patchlevel_) /* This allows version numbers to be compared directly */ @@ -125,19 +123,19 @@ struct _state; typedef int sci_version_t; -struct _state; +struct EngineState; void -version_require_earlier_than(struct _state *s, sci_version_t version); +version_require_earlier_than(EngineState *s, sci_version_t version); /* Function used in autodetection -** Parameters: (state_t *) s: state_t containing the version +** Parameters: (EngineState *) s: EngineState containing the version ** (sci_version_t) version: The version that we're earlier than */ void -version_require_later_than(struct _state *s, sci_version_t version); +version_require_later_than(EngineState *s, sci_version_t version); /* Function used in autodetection (read this function "version_require_later_than_or_equal_to") -** Parameters: (state_t *) s: state_t containing the version +** Parameters: (EngineState *) s: EngineState containing the version ** (sci_version_t) version: The version that we're later than */ diff --git a/engines/sci/include/vm.h b/engines/sci/include/vm.h index fa404e701c..a6e169a1d6 100644 --- a/engines/sci/include/vm.h +++ b/engines/sci/include/vm.h @@ -446,17 +446,16 @@ extern int _debug_seeking; extern int _debug_step_running; -typedef int kernel_function(struct _state* s); +typedef int kernel_function(struct EngineState *s); extern kernel_function* kfuncs[]; extern int max_instance; /*inline*/ -exec_stack_t * -execute_method(struct _state *s, word script, word pubfunct, stack_ptr_t sp, reg_t calling_obj, +exec_stack_t *execute_method(EngineState *s, word script, word pubfunct, stack_ptr_t sp, reg_t calling_obj, word argc, stack_ptr_t argp); /* Executes function pubfunct of the specified script. -** Parameters: (state_t *) s: The state which is to be executed with +** Parameters: (EngineState *) s: The state which is to be executed with ** (word) script: The script which is called ** (word) pubfunct: The exported script function which is to be called ** (stack_ptr_t) sp: Stack pointer position @@ -467,11 +466,10 @@ execute_method(struct _state *s, word script, word pubfunct, stack_ptr_t sp, reg */ -exec_stack_t * -send_selector(struct _state *s, reg_t send_obj, reg_t work_obj, +exec_stack_t *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj, stack_ptr_t sp, int framesize, stack_ptr_t argp); /* Executes a "send" or related operation to a selector -** Parameters: (state_t *) s: The state_t to operate on +** Parameters: (EngineState *) s: The EngineState to operate on ** (reg_t) send_obj: Heap address of the object to send to ** (reg_t) work_obj: Heap address of the object initiating the send ** (stack_ptr_t) sp: Stack pointer position @@ -486,12 +484,11 @@ send_selector(struct _state *s, reg_t send_obj, reg_t work_obj, #define SCI_XS_CALLEE_LOCALS -1 -exec_stack_t * -add_exec_stack_entry(struct _state *s, reg_t pc, stack_ptr_t sp, reg_t objp, int argc, +exec_stack_t *add_exec_stack_entry(EngineState *s, reg_t pc, stack_ptr_t sp, reg_t objp, int argc, stack_ptr_t argp, selector_t selector, reg_t sendp, int origin, seg_id_t local_segment); /* Adds an entry to the top of the execution stack -** Parameters: (state_t *) s: The state with which to execute +** Parameters: (EngineState *) s: The state with which to execute ** (reg_t) pc: The initial program counter ** (stack_ptr_t) sp: The initial stack pointer ** (reg_t) objp: Pointer to the beginning of the current object @@ -509,11 +506,10 @@ add_exec_stack_entry(struct _state *s, reg_t pc, stack_ptr_t sp, reg_t objp, int */ -exec_stack_t * -add_exec_stack_varselector(struct _state *s, reg_t objp, int argc, stack_ptr_t argp, +exec_stack_t *add_exec_stack_varselector(EngineState *s, reg_t objp, int argc, stack_ptr_t argp, selector_t selector, reg_t *address, int origin); /* Adds one varselector access to the execution stack -** Parameters: (state_t *) s: The state_t to use +** Parameters: (EngineState *) s: The EngineState to use ** (reg_t) objp: Pointer to the object owning the selector ** (int) argc: 1 for writing, 0 for reading ** (stack_ptr_t) argp: Pointer to the address of the data to write -2 @@ -525,33 +521,30 @@ add_exec_stack_varselector(struct _state *s, reg_t objp, int argc, stack_ptr_t a */ -void -run_vm(struct _state *s, int restoring); +void run_vm(EngineState *s, int restoring); /* Executes the code on s->heap[pc] until it hits a 'ret' operation while (stack_base == stack_pos) -** Parameters: (state_t *) s: The state to use +** Parameters: (EngineState *) s: The state to use ** (int) restoring: 1 if s has just been restored, 0 otherwise ** Returns : (void) ** This function will execute SCI bytecode. It requires s to be set up ** correctly. */ -void -vm_handle_fatal_error(struct _state *s, int line, const char *file); +void vm_handle_fatal_error(EngineState *s, int line, const char *file); /* Handles a fatal error condition -** Parameters: (state_t *) s: The state to recover from +** Parameters: (EngineState *) s: The state to recover from ** (int) line: Source code line number the error occured in ** (const char *) file: File the error occured in */ -void -script_debug(struct _state *s, reg_t *pc, stack_ptr_t *sp, stack_ptr_t *pp, reg_t *objp, +void script_debug(EngineState *s, reg_t *pc, stack_ptr_t *sp, stack_ptr_t *pp, reg_t *objp, int *restadjust, seg_id_t *segids, reg_t **variables, reg_t **variables_base, int *variables_nr, int bp); /* Debugger functionality -** Parameters: (state_t *) s: The state at which debugging should take place +** Parameters: (EngineState *) s: The state at which debugging should take place ** (reg_t *) pc: Pointer to the program counter ** (stack_ptr_t *) sp: Pointer to the stack pointer ** (stack_ptr_t *) pp: Pointer to the frame pointer @@ -566,42 +559,37 @@ script_debug(struct _state *s, reg_t *pc, stack_ptr_t *sp, stack_ptr_t *pp, reg_ ** Returns : (void) */ -int -script_init_engine(struct _state *s, sci_version_t version); -/* Initializes a state_t block -** Parameters: (state_t *) s: The state to initialize +int script_init_engine(EngineState *s, sci_version_t version); +/* Initializes a EngineState block +** Parameters: (EngineState *) s: The state to initialize ** Returns : 0 on success, 1 if vocab.996 (the class table) is missing or corrupted */ -void -script_set_gamestate_save_dir(struct _state *s, const char *path); +void script_set_gamestate_save_dir(EngineState *s, const char *path); /* Sets the gamestate's save_dir to the parameter path -** Parameters: (state_t *) s: The state to set +** Parameters: (EngineState *) s: The state to set ** (const char *) path: Path where save_dir will point to ** Returns : (void) */ -void -script_free_engine(struct _state *s); -/* Frees all additional memory associated with a state_t block -** Parameters: (state_t *) s: The state_t whose elements should be cleared +void script_free_engine(EngineState *s); +/* Frees all additional memory associated with a EngineState block +** Parameters: (EngineState *) s: The EngineState whose elements should be cleared ** Returns : (void) */ -void -script_free_vm_memory(struct _state *s); +void script_free_vm_memory(EngineState *s); /* Frees all script memory (heap, hunk, and class tables). -** Parameters: (state_t *) s: The state_t to free +** Parameters: (EngineState *) s: The EngineState to free ** Returns : (void) ** This operation is implicit in script_free_engine(), but is required for restoring ** the game state. */ -int -lookup_selector(struct _state *s, reg_t obj, selector_t selectorid, reg_t **vptr, reg_t *fptr); +int lookup_selector(EngineState *s, reg_t obj, selector_t selectorid, reg_t **vptr, reg_t *fptr); /* Looks up a selector and returns its type and value -** Parameters: (state_t *) s: The state_t to use +** Parameters: (EngineState *) s: The EngineState to use ** (reg_t) obj: Address of the object to look the selector up in ** (selector_t) selectorid: The selector to look up ** Returns : (int) SELECTOR_NONE if the selector was not found in the object or its superclasses. @@ -620,27 +608,24 @@ lookup_selector(struct _state *s, reg_t obj, selector_t selectorid, reg_t **vptr #define SCRIPT_GET_LOAD 1 /* Load, if neccessary */ #define SCRIPT_GET_LOCK 3 /* Load, if neccessary, and lock */ -seg_id_t -script_get_segment(struct _state *s, int script_id, int load); +seg_id_t script_get_segment(EngineState *s, int script_id, int load); /* Determines the segment occupied by a certain script -** Parameters: (state_t *) s: The state to operate on +** Parameters: (EngineState *) s: The state to operate on ** (int) script_id: The script in question ** (int) load: One of SCRIPT_GET_* ** Returns : The script's segment, or 0 on failure */ -reg_t -script_lookup_export(struct _state *s, int script_nr, int export_index); +reg_t script_lookup_export(EngineState *s, int script_nr, int export_index); /* Looks up an entry of the exports table of a script -** Parameters: (state_t *) s: The state to operate on +** Parameters: (EngineState *) s: The state to operate on ** (int) script_nr: The script to look up in ** Returns : (int) export_index: index of the export entry to look up */ -int -script_instantiate(struct _state *s, int script_nr); +int script_instantiate(EngineState *s, int script_nr); /* Makes sure that a script and its superclasses get loaded to the heap -** Parameters: (state_t *) s: The state to operate on +** Parameters: (EngineState *) s: The state to operate on ** (int) script_nr: The script number to load ** Returns : (int) The script's segment ID or 0 if out of heap ** If the script already has been loaded, only the number of lockers is increased. @@ -650,10 +635,9 @@ script_instantiate(struct _state *s, int script_nr); */ -void -script_uninstantiate(struct _state *s, int script_nr); +void script_uninstantiate(EngineState *s, int script_nr); /* Decreases the numer of lockers of a script and unloads it if that number reaches zero -** Parameters: (state_t *) s: The state to operate on +** Parameters: (EngineState *) s: The state to operate on ** (int) script_nr: The script number that is requestet to be unloaded ** Returns : (void) ** This function will recursively unload scripts containing its superclasses, if those @@ -661,46 +645,41 @@ script_uninstantiate(struct _state *s, int script_nr); */ -int -game_save_state(struct _state *s, char *name, int coredump); +int game_save_state(EngineState *s, char *name, int coredump); /* Saves the game state to the harddisk -** Parameters: (state_t *) s: The game state to save +** Parameters: (EngineState *) s: The game state to save ** (char *) name: Name of the subdirectory (relative to s->save_dir) ** (int) coredump: Set to non-zero in order to write additional debug information ** Returns : (int) 0 on success, 1 otherwise */ -struct _state * - game_restore_state(char *name); +EngineState *game_restore_state(char *name); /* Restores the game state from a file ** Parameters: (char *) name: Name of the saved game state to restore -** Returns : (state_t *): The restored game state, or NULL on failure +** Returns : (EngineState *): The restored game state, or NULL on failure */ -int -game_init(struct _state *s); +int game_init(EngineState *s); /* Initializes an SCI game -** Parameters: (state_t *) s: The state to operate on +** Parameters: (EngineState *) s: The state to operate on ** Returns : (int): 0 on success, 1 if an error occured. ** This function must be run before script_run() is executed. ** Graphics data is initialized iff s->gfx_state != NULL. */ -int -game_init_graphics(struct _state *s); +int game_init_graphics(EngineState *s); /* Initializes the graphics part of an SCI game -** Parameters: (state_t *) s: The state to initialize the graphics in +** Parameters: (EngineState *) s: The state to initialize the graphics in ** Returns : (int) 0 on success, 1 if an error occured ** This function may only be called if game_init() did not initialize ** the graphics data. */ -int -game_init_sound(struct _state *s, int sound_flags); +int game_init_sound(EngineState *s, int sound_flags); /* Initializes the sound part of an SCI game -** Parameters: (state_t *) s: The state to initialize the sound in +** Parameters: (EngineState *) s: The state to initialize the sound in ** (int) sound_flags: Flags to pass to the sound subsystem ** Returns : (int) 0 on success, 1 if an error occured ** This function may only be called if game_init() did not initialize @@ -708,10 +687,9 @@ game_init_sound(struct _state *s, int sound_flags); */ -int -game_run(struct _state **s); +int game_run(EngineState **s); /* Runs an SCI game -** Parameters: (state_t **) s: Pointer to the pointer of the state to operate on +** Parameters: (EngineState **) s: Pointer to the pointer of the state to operate on ** Returns : (int): 0 on success, 1 if an error occured. ** This is the main function for SCI games. It takes a valid state, loads script 0 to it, ** finds the game object, allocates a stack, and runs the init method of the game object. @@ -719,94 +697,83 @@ game_run(struct _state **s); ** By the way, *s may be changed during the game, e.g. if a game state is restored. */ -int -game_restore(struct _state **s, char *savegame_name); +int game_restore(EngineState **s, char *savegame_name); /* Restores an SCI game state and runs the game -** Parameters: (state_t **) s: Pointer to the pointer of the state to operate on +** Parameters: (EngineState **) s: Pointer to the pointer of the state to operate on ** (char *) savegame_name: Name of the savegame to restore ** Returns : (int): 0 on success, 1 if an error occured. ** This restores a savegame; otherwise, it behaves just like game_run(). */ -int -game_exit(struct _state *s); +int game_exit(EngineState *s); /* Uninitializes an initialized SCI game -** Parameters: (state_t *) s: The state to operate on +** Parameters: (EngineState *) s: The state to operate on ** Returns : (int): 0 on success, 1 if an error occured. ** This function should be run after each script_run() call. */ -void -quit_vm(void); +void quit_vm(void); /* Instructs the virtual machine to abort ** Paramteres: (void) ** Returns : (void) */ -void -script_map_selectors(struct _state *s, selector_map_t *map); +void script_map_selectors(EngineState *s, selector_map_t *map); /* Maps special selectors -** Parameters: (state_t *) s: The state from which the selector information should be taken +** Parameters: (EngineState *) s: The state from which the selector information should be taken ** (selector_map_t *) map: Pointer to the selector map to map ** Returns : (void) ** Called by script_run(); */ -int -script_map_kernel(struct _state *s); +int script_map_kernel(EngineState *s); /* Maps kernel functions -** Parameters: (state_t *) s: The state which the kernel_names are retrieved from +** Parameters: (EngineState *) s: The state which the kernel_names are retrieved from ** Returns : (void) ** This function reads from and writes to s. It is called by script_run(). */ -void -script_detect_versions(struct _state *s); +void script_detect_versions(EngineState *s); /* Detects SCI versions by their different script header -** Parameters: (state_t *) s: The state to operate on +** Parameters: (EngineState *) s: The state to operate on ** Returns : (void) */ -reg_t -kalloc(struct _state *s, const char *type, int space); +reg_t kalloc(EngineState *s, const char *type, int space); /* Allocates "kernel" memory and returns a handle suitable to be passed on to SCI scripts -** Parameters: (state_t *) s: Pointer to the state_t to operate on +** Parameters: (EngineState *) s: Pointer to the EngineState to operate on ** (const char *) type: A free-form type description string (static) ** (int) space: The space to allocate ** Returns : (reg_t) The handle */ -int -has_kernel_function(struct _state *s, const char *kname); +int has_kernel_function(EngineState *s, const char *kname); /* Detects whether a particular kernel function is required in the game -** Parameters: (state_t *) s: Pointer to the state_t to operate on +** Parameters: (EngineState *) s: Pointer to the EngineState to operate on ** (const char *) kname: The name of the desired kernel function ** Returns : (int) 1 if the kernel function is listed in the kernel table, ** 0 otherwise */ -byte * -kmem(struct _state *s, reg_t handle); +byte *kmem(EngineState *s, reg_t handle); /* Returns a pointer to "kernel" memory based on the handle -** Parameters: (state_t *) s: Pointer to the state_t to operate on +** Parameters: (EngineState *) s: Pointer to the EngineState to operate on ** (reg_t) handle: The handle to use ** Returns : (byte *) A pointer to the allocated memory */ -int -kfree(struct _state *s, reg_t handle); +int kfree(EngineState *s, reg_t handle); /* Frees all "kernel" memory associated with a handle -** Parameters: (state_t *) s: Pointer to the state_t to operate on +** Parameters: (EngineState *) s: Pointer to the EngineState to operate on ** (reg_t) handle: The handle to free ** Returns : (int) 0 on success, 1 otherwise */ -const char * -obj_get_name(struct _state *s, reg_t pos); +const char *obj_get_name(EngineState *s, reg_t pos); /* Determines the name of an object -** Parameters: (state_t *) s: Pointer to the state_t to operate on +** Parameters: (EngineState *) s: Pointer to the EngineState to operate on ** (reg_t) pos: Location of the object whose name we want to ** inspect ** Returns : (const char *) A name for that object, or a string describing @@ -815,10 +782,9 @@ obj_get_name(struct _state *s, reg_t pos); ** may it be modified). */ -object_t * -obj_get(struct _state *s, reg_t offset); +object_t *obj_get(EngineState *s, reg_t offset); /* Retreives an object from the specified location -** Parameters: (state_t *) s: Pointer to the state_t to operate on +** Parameters: (EngineState *) s: Pointer to the EngineState to operate on ** (reg_t) offset: The object's offset ** Returns : (object_t *) The object in question, or NULL if there is none */ diff --git a/engines/sci/include/vm_types.h b/engines/sci/include/vm_types.h index 847a1f30e4..c8634ce9a3 100644 --- a/engines/sci/include/vm_types.h +++ b/engines/sci/include/vm_types.h @@ -35,8 +35,6 @@ namespace Sci { typedef int seg_id_t; /* Segment ID type */ -struct _state; /* engine.h */ - struct reg_t { uint16 segment; uint16 offset; diff --git a/engines/sci/include/vocabulary.h b/engines/sci/include/vocabulary.h index b51affc570..f890b3f4ba 100644 --- a/engines/sci/include/vocabulary.h +++ b/engines/sci/include/vocabulary.h @@ -372,12 +372,10 @@ vocab_dump_parse_tree(const char *tree_name, parse_tree_node_t *nodes); -struct _state; - int -said(struct _state *s, byte *spec, int verbose); +said(EngineState *s, byte *spec, int verbose); /* Builds a parse tree from a spec and compares it to a parse tree -** Parameters: (state_t *) s: The affected state +** Parameters: (EngineState *) s: The affected state ** (byte *) spec: Pointer to the spec to build ** (int) verbose: Whether to display the parse tree after building it ** Returns : (int) 1 on a match, 0 otherwise @@ -394,9 +392,9 @@ vocab_get_any_group_word(int group, word_t **words, int words_nr); void -vocab_decypher_said_block(struct _state *s, byte *pos); +vocab_decypher_said_block(EngineState *s, byte *pos); /* Decyphers a said block and dumps its content via sciprintf. -** Parameters: (state_t *) s: The state to use +** Parameters: (EngineState *) s: The state to use ** (byte *) pos: Pointer to the data to dump ** For debugging only. */ diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index e04eab4a3f..e7bd6f155e 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -37,7 +37,7 @@ namespace Sci { extern gfx_driver_t gfx_driver_scummvm; int -c_quit(state_t *s) { +c_quit(EngineState *s) { script_abort_flag = 1; /* Terminate VM */ _debugstate_valid = 0; _debug_seeking = 0; @@ -46,7 +46,7 @@ c_quit(state_t *s) { } int -c_die(state_t *s) { +c_die(EngineState *s) { exit(0); /* Die */ return 0; /* ;-P (fixes warning) */ } @@ -82,7 +82,7 @@ init_console() { } static int -init_gamestate(state_t *gamestate, sci_version_t version) { +init_gamestate(EngineState *gamestate, sci_version_t version) { int errc; if ((errc = script_init_engine(gamestate, version))) { /* Initialize game state */ @@ -236,8 +236,8 @@ Common::Error SciEngine::go() { sciprintf("Imported FreeSCI, version "VERSION"\n"); - state_t* gamestate = (state_t *) sci_malloc(sizeof(state_t)); - memset(gamestate, 0, sizeof(state_t)); + EngineState* gamestate = (EngineState *) sci_malloc(sizeof(EngineState)); + memset(gamestate, 0, sizeof(EngineState)); gamestate->resmgr = resmgr; gamestate->gfx_state = NULL; diff --git a/engines/sci/scicore/script.cpp b/engines/sci/scicore/script.cpp index c574b67215..511a8078bd 100644 --- a/engines/sci/scicore/script.cpp +++ b/engines/sci/scicore/script.cpp @@ -108,7 +108,7 @@ void script_adjust_opcode_formats(int res_version) { } int -script_find_selector(state_t *s, const char *selectorname) { +script_find_selector(EngineState *s, const char *selectorname) { int i; for (i = 0; i < s->selector_names_nr; i++) if (strcmp(selectorname, s->selector_names[i]) == 0) @@ -121,7 +121,7 @@ script_find_selector(state_t *s, const char *selectorname) { #define FIND_SELECTOR(_slc_, _slcstr_) map->_slc_ = script_find_selector(s, _slcstr_); void -script_map_selectors(state_t *s, selector_map_t *map) { +script_map_selectors(EngineState *s, selector_map_t *map) { map->init = script_find_selector(s, "init"); map->play = script_find_selector(s, "play"); FIND_SELECTOR(replay, "replay"); diff --git a/engines/sci/scicore/tools.cpp b/engines/sci/scicore/tools.cpp index ee89c9b27d..efdd31565b 100644 --- a/engines/sci/scicore/tools.cpp +++ b/engines/sci/scicore/tools.cpp @@ -122,7 +122,7 @@ void _SCIkvprintf(FILE *file, const char *format, va_list args) { if (con_file) vfprintf(con_file, format, args); } -void _SCIkdebug(state_t *s, const char *file, int line, int area, const char *format, ...) { +void _SCIkdebug(EngineState *s, const char *file, int line, int area, const char *format, ...) { va_list args; if (s->debug_mode & (1 << area)) { @@ -134,7 +134,7 @@ void _SCIkdebug(state_t *s, const char *file, int line, int area, const char *fo } } -void _SCIGNUkdebug(const char *funcname, state_t *s, const char *file, int line, int area, const char *format, ...) { +void _SCIGNUkdebug(const char *funcname, EngineState *s, const char *file, int line, int area, const char *format, ...) { va_list xargs; int error = ((area == SCIkWARNING_NR) || (area == SCIkERROR_NR)); diff --git a/engines/sci/scicore/versions.cpp b/engines/sci/scicore/versions.cpp index 408deb58f4..d956c56a54 100644 --- a/engines/sci/scicore/versions.cpp +++ b/engines/sci/scicore/versions.cpp @@ -35,7 +35,7 @@ namespace Sci { void -version_require_earlier_than(state_t *s, sci_version_t version) { +version_require_earlier_than(EngineState *s, sci_version_t version) { if (s->version_lock_flag) return; @@ -54,7 +54,7 @@ version_require_earlier_than(state_t *s, sci_version_t version) { } void -version_require_later_than(state_t *s, sci_version_t version) { +version_require_later_than(EngineState *s, sci_version_t version) { if (s->version_lock_flag) return; diff --git a/engines/sci/scicore/vocab.cpp b/engines/sci/scicore/vocab.cpp index 9f7911272d..08c4325efa 100644 --- a/engines/sci/scicore/vocab.cpp +++ b/engines/sci/scicore/vocab.cpp @@ -404,7 +404,7 @@ vocab_get_said_spec_length(byte *addr) { } void -vocab_decypher_said_block(state_t *s, byte *addr) { +vocab_decypher_said_block(EngineState *s, byte *addr) { int nextitem; do { |