diff options
author | Paul Gilbert | 2019-05-12 12:35:29 +1000 |
---|---|---|
committer | Paul Gilbert | 2019-05-12 12:35:29 +1000 |
commit | 67acfcccd6c8c629dd9c8ecd519196740598dbd1 (patch) | |
tree | 5e1f473b1fd2c49cc2a5073dbe0d69b827216a72 /engines/glk | |
parent | e6da910c146899b98f7635971f44396e04447c4d (diff) | |
download | scummvm-rg350-67acfcccd6c8c629dd9c8ecd519196740598dbd1.tar.gz scummvm-rg350-67acfcccd6c8c629dd9c8ecd519196740598dbd1.tar.bz2 scummvm-rg350-67acfcccd6c8c629dd9c8ecd519196740598dbd1.zip |
GLK: HUGO: Fixes for startup and shutdown
Diffstat (limited to 'engines/glk')
-rw-r--r-- | engines/glk/hugo/heglk.cpp | 6 | ||||
-rw-r--r-- | engines/glk/hugo/hemisc.cpp | 4 | ||||
-rw-r--r-- | engines/glk/hugo/herun.cpp | 2 | ||||
-rw-r--r-- | engines/glk/hugo/hugo.cpp | 14 | ||||
-rw-r--r-- | engines/glk/hugo/hugo.h | 7 |
5 files changed, 19 insertions, 14 deletions
diff --git a/engines/glk/hugo/heglk.cpp b/engines/glk/hugo/heglk.cpp index f6f40814f5..c4c3eec5e5 100644 --- a/engines/glk/hugo/heglk.cpp +++ b/engines/glk/hugo/heglk.cpp @@ -61,8 +61,10 @@ void Hugo::hugo_getline(const char *prmpt) { /* Request line input */ glk_request_line_event(currentwin, buffer, MAXBUFFER, 0); - while (!gotline) - { + while (!gotline) { + if (shouldQuit()) + return; + /* Grab an event */ glk_select(&ev); diff --git a/engines/glk/hugo/hemisc.cpp b/engines/glk/hugo/hemisc.cpp index 4115abebc7..03a62c56d5 100644 --- a/engines/glk/hugo/hemisc.cpp +++ b/engines/glk/hugo/hemisc.cpp @@ -1112,6 +1112,8 @@ void Hugo::LoadGame() { if ((game = TrytoOpen(gamefile, "rb", "object"))==nullptr) FatalError(OPEN_E); } +#else + game = &_gameFile; #endif hugo_fseek(game, 0, SEEK_END); @@ -1202,7 +1204,7 @@ void Hugo::LoadGame() { /* Allocate as much memory as is required */ if ((!loaded_in_memory) || (mem = (unsigned char *)hugo_blockalloc(filelength))==nullptr) { - loaded_in_memory = 0; + loaded_in_memory = false; if ((mem = (unsigned char *)hugo_blockalloc(codeend))==nullptr) FatalError(MEMORY_E); } diff --git a/engines/glk/hugo/herun.cpp b/engines/glk/hugo/herun.cpp index 8a6d9cd3f7..cb33ef9160 100644 --- a/engines/glk/hugo/herun.cpp +++ b/engines/glk/hugo/herun.cpp @@ -299,6 +299,8 @@ FreshInput: goto NormalTermination; runaway_counter = 0; #endif + if (shouldQuit()) + return; SeparateWords(); diff --git a/engines/glk/hugo/hugo.cpp b/engines/glk/hugo/hugo.cpp index 8d85c68606..34353082ed 100644 --- a/engines/glk/hugo/hugo.cpp +++ b/engines/glk/hugo/hugo.cpp @@ -30,7 +30,7 @@ Hugo::Hugo(OSystem *syst, const GlkGameDescription &gameDesc) : GlkAPI(syst, gam runtime_warnings(false), dbnest(0), address_scale(16), SCREENWIDTH(0), SCREENHEIGHT(0), FIXEDCHARWIDTH(0), FIXEDLINEHEIGHT(0), // heexpr - evalcount(0), incdec(0), getaddress(0), inexpr(0), inobj(0), + evalcount(0), incdec(0), getaddress(0), inexpr(0), inobj(0), last_precedence(0), // hemedia mchannel(nullptr), schannel(nullptr), // hemisc @@ -39,7 +39,7 @@ Hugo::Hugo(OSystem *syst, const GlkGameDescription &gameDesc) : GlkAPI(syst, gam codestart(0), objtable(0), eventtable(0), proptable(0), arraytable(0), dicttable(0), syntable(0), initaddr(0), mainaddr(0), parseaddr(0), parseerroraddr(0), findobjectaddr(0), endgameaddr(0), speaktoaddr(0), performaddr(0), - objects(0), events(0), dictcount(0), syncount(0), mem(nullptr), loaded_in_memory(0), + objects(0), events(0), dictcount(0), syncount(0), mem(nullptr), loaded_in_memory(true), defseg(0), gameseg(0), codeptr(0), codeend(0), currentpos(0), currentline(0), full(0), def_fcolor(0), def_bgcolor(0), def_slfcolor(0), def_slbgcolor(0), fcolor(0), bgcolor(0), icolor(0), default_bgcolor(0), currentfont(0), capital(0), textto(0), @@ -83,15 +83,15 @@ Hugo::Hugo(OSystem *syst, const GlkGameDescription &gameDesc) : GlkAPI(syst, gam Common::fill(&var[0], &var[MAXLOCALS + MAXGLOBALS], 0); // hemedia - Common::fill(&resids[0][0], &resids[2][MAXRES], 0); + Common::fill(&resids[0][0], &resids[2][0], 0); numres[0] = numres[1] = 0; // hemisc - Common::fill(&context_command[0][0], &context_command[MAX_CONTEXT_COMMANDS][64], 0); + Common::fill(&context_command[0][0], &context_command[MAX_CONTEXT_COMMANDS][0], 0); Common::fill(&id[0], &id[3], '\0'); Common::fill(&serial[0], &serial[9], '\0'); Common::fill(&pbuffer[0], &pbuffer[MAXBUFFER * 2 + 1], 0); - Common::fill(&undostack[0][0], &undostack[MAXUNDO][5], 0); + Common::fill(&undostack[0][0], &undostack[MAXUNDO][0], 0); // heparse Common::fill(&buffer[0], &buffer[MAXBUFFER + MAXWORDS], '\0'); @@ -120,8 +120,8 @@ Hugo::Hugo(OSystem *syst, const GlkGameDescription &gameDesc) : GlkAPI(syst, gam debug_line[0] = '\0'; Common::fill(&objectname[0], &objectname[MAX_OBJECT], (char *)nullptr); Common::fill(&propertyname[0], &propertyname[MAX_PROPERTY], (char *)nullptr); - Common::fill(&codeline[0][0], &codeline[9][100], 0); - Common::fill(&localname[0][0], &localname[9][100], 0); + Common::fill(&codeline[0][0], &codeline[9][0], 0); + Common::fill(&localname[0][0], &localname[9][0], 0); Common::fill(&code_history[0], &code_history[MAX_CODE_HISTORY], 0); Common::fill(&dbnest_history[0], &dbnest_history[MAX_CODE_HISTORY], 0); #endif diff --git a/engines/glk/hugo/hugo.h b/engines/glk/hugo/hugo.h index e49e313dd2..400bc652a3 100644 --- a/engines/glk/hugo/hugo.h +++ b/engines/glk/hugo/hugo.h @@ -59,7 +59,6 @@ private: char getaddress; ///< true when finding &routine char inexpr; ///< true when in expression char inobj; ///< true when in object compound - int last_precedence; // hemedia @@ -103,7 +102,7 @@ private: char context_command[MAX_CONTEXT_COMMANDS][64]; int context_commands; unsigned char *mem; - int loaded_in_memory; + bool loaded_in_memory; unsigned int defseg; unsigned int gameseg; long codeptr; @@ -243,7 +242,7 @@ private: CALL call[MAXCALLS]; int routines; int properties; - WINDOW window[99]; + WINDOW window[9]; int codeline[9][100]; char localname[9][100]; int current_locals; @@ -1017,7 +1016,7 @@ private: */ int hugo_fseek(Common::SeekableReadStream *s, long int offset, int whence) { - return s->seek(offset, whence); + return !s->seek(offset, whence); } int hugo_fseek(strid_t s, long int offset, int whence) { Common::SeekableReadStream *rs = *s; |