diff --git a/engines/chewy/defines.h b/engines/chewy/defines.h index 9f6b73887f7..1085c8e6cb7 100644 --- a/engines/chewy/defines.h +++ b/engines/chewy/defines.h @@ -158,7 +158,6 @@ enum SetupScreenMode { #define CH_SPZ_FILE "misc/ch_spez.taf" #define OPTION_TAF "MISC/OPTION.TAF" -#define SAVEDIR "save/savegame." #define DETAILTEST "room/test.rdi" #define GBOOK "BACK/GBOOK.TGP" diff --git a/engines/chewy/dialogs/files.cpp b/engines/chewy/dialogs/files.cpp index 53757a57de5..8f97a94c5e4 100644 --- a/engines/chewy/dialogs/files.cpp +++ b/engines/chewy/dialogs/files.cpp @@ -68,7 +68,7 @@ int16 Files::execute(bool isInGame) { _G(out)->map_spr2screen(_G(ablage)[_G(room_blk).AkAblage], 0, 0); _G(out)->setPointer(_G(screen0)); _G(room)->set_ak_pal(&_G(room_blk)); - char *fnames = _G(iog)->io_init(&_G(ioptr)); + char *fnames = _G(iog)->io_init(); fnames += 1; _G(fx)->blende1(_G(workptr), _G(screen0), _G(pal), 150, 0, 0); @@ -258,11 +258,16 @@ int16 Files::execute(bool isInGame) { case Common::KEYCODE_RETURN + ALT: enter: if (mode[LOAD]) { - tmp = fnames + ((text_off + active_slot) * 40); - if (tmp[0]) { - _G(currentSong) = -1; - _G(iog)->load(text_off + active_slot, _G(ioptr).save_path); - key = Common::KEYCODE_ESCAPE; + const int16 slotNum = text_off + active_slot; + SaveStateList saveList = g_engine->listSaves(); + for (uint j = 0; j < saveList.size(); ++j) { + if (saveList[j].getSaveSlot() == slotNum) { + _G(currentSong) = -1; + _G(cur)->hide_cur(); + g_engine->loadGameState(slotNum); + key = Common::KEYCODE_ESCAPE; + break; + } } } else if (mode[SAVE]) { _G(out)->back2screen(_G(workpage)); @@ -272,8 +277,7 @@ enter: 255, 42, 14, 0, "%36s36", tmp); _G(out)->setPointer(_G(workptr)); if (key != Common::KEYCODE_ESCAPE) { - _G(iog)->save_entry(text_off + active_slot, - _G(ioptr).save_path); + _G(iog)->save_entry(text_off + active_slot); } key = Common::KEYCODE_ESCAPE; } diff --git a/engines/chewy/globals.h b/engines/chewy/globals.h index dff41023121..e00d72c20af 100644 --- a/engines/chewy/globals.h +++ b/engines/chewy/globals.h @@ -217,7 +217,6 @@ public: MouseInfo _minfo; CurBlk _curblk; CurAni _curani; - IogInit _ioptr; RaumBlk _room_blk; Flags _flags = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; diff --git a/engines/chewy/inits.cpp b/engines/chewy/inits.cpp index 16cd27da017..60424f65016 100644 --- a/engines/chewy/inits.cpp +++ b/engines/chewy/inits.cpp @@ -63,10 +63,7 @@ void standard_init() { _G(cur) = new Cursor(&_G(curblk)); _G(cur)->set_cur_ani(&_G(curani)); - _G(iog) = new IOGame(_G(out), _G(in), _G(cur)); - strcpy(_G(ioptr).id, "CHE"); - strcpy(_G(ioptr).save_path, SAVEDIR); - _G(ioptr).delay = 8; + _G(iog) = new IOGame(); alloc_buffers(); _G(pal)[765] = 63; _G(pal)[766] = 63; diff --git a/engines/chewy/io_game.cpp b/engines/chewy/io_game.cpp index fe8f6535abb..81ca573f2c2 100644 --- a/engines/chewy/io_game.cpp +++ b/engines/chewy/io_game.cpp @@ -27,14 +27,7 @@ namespace Chewy { -IOGame::IOGame(McgaGraphics *out, InputMgr *in, Cursor *cur) { - _out = out; - _in = in; - _cur = cur; -} - -char *IOGame::io_init(IogInit *iostruc) { - _io = iostruc; +char *IOGame::io_init() { for (int16 i = 0; i < 20; i++) _fileFind[i][0] = 0; get_savegame_files(); @@ -42,20 +35,11 @@ char *IOGame::io_init(IogInit *iostruc) { return &_fileFind[0][0]; } -void IOGame::save_entry(int16 slotNum, char *fname) { +void IOGame::save_entry(int16 slotNum) { Common::String desc(&_fileFind[slotNum][1]); g_engine->saveGameState(slotNum, desc); } -void IOGame::load(int16 slotNum, char *fname) { - get_savegame_files(); - - _cur->hide_cur(); - if (_fileFind[slotNum][0] == 1) { - (void)g_engine->loadGameState(slotNum); - } -} - int16 IOGame::get_savegame_files() { SaveStateList saveList = g_engine->listSaves(); int ret = 0; diff --git a/engines/chewy/io_game.h b/engines/chewy/io_game.h index c9f40e7b31f..36a20ebe2f2 100644 --- a/engines/chewy/io_game.h +++ b/engines/chewy/io_game.h @@ -29,30 +29,20 @@ namespace Chewy { #define IOG_END 1 -#define IOG_LOAD 2 -#define IOG_SAVE 3 -#define IOG_BACK 4 #define USER_NAME 36 -#define DOPPEL_KLICK 0.5 - class IOGame { private: - Cursor *_cur; - IogInit *_io; - InputMgr *_in; - McgaGraphics *_out; char _fileFind[20][USER_NAME + 4]; private: int16 get_savegame_files(); public: - IOGame(McgaGraphics *out, InputMgr *in, Cursor *cur); + IOGame() {} - char *io_init(IogInit *iostruc); - void load(int16 nr, char *fname); - void save_entry(int16 nr, char *fname); + char *io_init(); + void save_entry(int16 nr); }; } // namespace Chewy diff --git a/engines/chewy/ngstypes.h b/engines/chewy/ngstypes.h index 4d540f9b245..e6b7c737b87 100644 --- a/engines/chewy/ngstypes.h +++ b/engines/chewy/ngstypes.h @@ -83,21 +83,6 @@ struct musik_info { char *cur_pattern = nullptr; }; -struct IogInit { - char id[4] = { 0 }; - char save_path[30] = { 0 }; - - int16 popx = 0; - int16 popy = 0; - const byte *m_col = nullptr; - uint8 f1 = 0; - uint8 f2 = 0; - uint8 f3 = 0; - uint8 f4 = 0; - uint8 key_nr = 0; - int16 delay = 0; -}; - struct GedPoolHeader { char _id[4] = { 0 }; int16 _nr = 0;