diff options
author | dreammaster | 2019-11-19 02:24:54 +0000 |
---|---|---|
committer | Paul Gilbert | 2019-11-22 18:49:07 -0800 |
commit | 1c6762104792fe84390c114b6eafe85dc7867d13 (patch) | |
tree | df902f872856d67d1c036d73cb6968725137fcf9 /engines/glk/magnetic/magnetic.cpp | |
parent | aff46219ef5189da48bf13838b5d4b6885d21a03 (diff) | |
download | scummvm-rg350-1c6762104792fe84390c114b6eafe85dc7867d13.tar.gz scummvm-rg350-1c6762104792fe84390c114b6eafe85dc7867d13.tar.bz2 scummvm-rg350-1c6762104792fe84390c114b6eafe85dc7867d13.zip |
GLK: MAGNETIC: Added subengine files
Diffstat (limited to 'engines/glk/magnetic/magnetic.cpp')
-rw-r--r-- | engines/glk/magnetic/magnetic.cpp | 58 |
1 files changed, 6 insertions, 52 deletions
diff --git a/engines/glk/magnetic/magnetic.cpp b/engines/glk/magnetic/magnetic.cpp index 3f9917bf7b..3689668789 100644 --- a/engines/glk/magnetic/magnetic.cpp +++ b/engines/glk/magnetic/magnetic.cpp @@ -21,41 +21,20 @@ */ #include "glk/magnetic/magnetic.h" -#include "common/config-manager.h" -#include "common/translation.h" +#include "glk/magnetic/defs.h" namespace Glk { namespace Magnetic { -Magnetic::Magnetic(OSystem *syst, const GlkGameDescription &gameDesc) : GlkAPI(syst, gameDesc), - - vm_exited_cleanly(false), dlimit(0xffffffff), slimit(0xffffffff), log_on(0), - i_count(0), string_size(0), rseed(0), pc(0), arg1i(0), mem_size(0), properties(0), fl_sub(0), - fl_tab(0), fl_size(0), fp_tab(0), fp_size(0), zflag(0), nflag(0), cflag(0), vflag(0), byte1(0), - byte2(0), regnr(0), admode(0), opsize(0), arg1(nullptr), arg2(nullptr), is_reversible(0), - lastchar(0), version(0), sd(0), decode_table(nullptr), restart(nullptr), code(nullptr), - string(nullptr), string2(nullptr), string3(nullptr), dict(nullptr), quick_flag(0), gfx_ver(0), - gfx_buf(nullptr), gfx_data(nullptr), gfx2_hdr(0), gfx2_buf(nullptr), gfx2_hsize(0), - snd_buf(nullptr), snd_hdr(nullptr), snd_hsize(0), undo_pc(0), undo_size(0), - gfxtable(0), table_dist(0), v4_id(0), next_table(1), pos_table_size(0), - command_table(nullptr), command_index(-1), pos_table_index(-1), pos_table_max(-1), - anim_repeat(0) { +Magnetic *g_vm; - // Emu fields - undo[0] = undo[1] = nullptr; - undo_stat[0] = undo_stat[1] = 0; - Common::fill(&dreg[0], &dreg[8], 0); - Common::fill(&areg[0], &areg[8], 0); - Common::fill(&tmparg[0], &tmparg[4], 0); - Common::fill(&undo_regs[0][0], &undo_regs[2][18], 0), - Common::fill(&pos_table_count[0], &pos_table_count[MAX_POSITIONS], 0); +Magnetic::Magnetic(OSystem *syst, const GlkGameDescription &gameDesc) : GlkAPI(syst, gameDesc) { + g_vm = this; } void Magnetic::runGame() { - if (!is_gamefile_valid()) - return; - - // TODO + gms_startup_code(0, nullptr); + gms_main(); } Common::Error Magnetic::readSaveData(Common::SeekableReadStream *rs) { @@ -68,30 +47,5 @@ Common::Error Magnetic::writeGameData(Common::WriteStream *ws) { return Common::kWritingFailed; } -bool Magnetic::is_gamefile_valid() { - if (_gameFile.size() < 8) { - GUIErrorMessage(_("This is too short to be a valid Glulx file.")); - return false; - } - - if (_gameFile.readUint32BE() != MKTAG('G', 'l', 'u', 'l')) { - GUIErrorMessage(_("This is not a valid Glulx file.")); - return false; - } - - // We support version 2.0 through 3.1.* - uint32 vers = _gameFile.readUint32BE(); - if (vers < 0x20000) { - GUIErrorMessage(_("This Glulx file is too old a version to execute.")); - return false; - } - if (vers >= 0x30200) { - GUIErrorMessage(_("This Glulx file is too new a version to execute.")); - return false; - } - - return true; -} - } // End of namespace Magnetic } // End of namespace Glk |