CHEWY: Remove superfluous save slot related code

This commit is contained in:
Filippos Karapetis 2022-03-16 01:27:45 +02:00
parent 810c528453
commit 060eb2627b
7 changed files with 18 additions and 60 deletions

View File

@ -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"

View File

@ -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;
}

View File

@ -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 };

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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;