[Scummvm-git-logs] scummvm master -> 5c9beed48e541986f734e6c9babf730c6c18fe22
Strangerke
noreply at scummvm.org
Mon Mar 21 21:27:43 UTC 2022
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
5c9beed48e CHEWY: Add an option for the original menus, slightly refactor get_savegame_files
Commit: 5c9beed48e541986f734e6c9babf730c6c18fe22
https://github.com/scummvm/scummvm/commit/5c9beed48e541986f734e6c9babf730c6c18fe22
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2022-03-21T22:27:36+01:00
Commit Message:
CHEWY: Add an option for the original menus, slightly refactor get_savegame_files
Changed paths:
engines/chewy/detection.cpp
engines/chewy/dialogs/files.cpp
engines/chewy/io_game.cpp
engines/chewy/io_game.h
diff --git a/engines/chewy/detection.cpp b/engines/chewy/detection.cpp
index 79d3e083b88..4e3aed9e68f 100644
--- a/engines/chewy/detection.cpp
+++ b/engines/chewy/detection.cpp
@@ -24,6 +24,8 @@
#include "chewy/detection.h"
+#include "common/translation.h"
+
static const PlainGameDescriptor chewyGames[] = {
{"chewy", "Chewy: Esc from F5"},
{nullptr, nullptr}
@@ -31,6 +33,8 @@ static const PlainGameDescriptor chewyGames[] = {
namespace Chewy {
+#define GAMEOPTION_ORIGINAL_SAVELOAD GUIO_GAMEOPTIONS1
+
static const ChewyGameDescription gameDescriptions[] = {
{
@@ -41,7 +45,7 @@ static const ChewyGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformDOS,
ADGF_NO_FLAGS,
- GUIO1(GUIO_NOMIDI)
+ GUIO2(GUIO_NOMIDI, GAMEOPTION_ORIGINAL_SAVELOAD)
},
},
@@ -54,7 +58,7 @@ static const ChewyGameDescription gameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformDOS,
ADGF_NO_FLAGS,
- GUIO1(GUIO_NOMIDI)
+ GUIO2(GUIO_NOMIDI, GAMEOPTION_ORIGINAL_SAVELOAD)
},
},
@@ -66,7 +70,7 @@ static const ChewyGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformDOS,
ADGF_NO_FLAGS,
- GUIO1(GUIO_NOMIDI)
+ GUIO2(GUIO_NOMIDI, GAMEOPTION_ORIGINAL_SAVELOAD)
},
},
@@ -78,7 +82,7 @@ static const ChewyGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformDOS,
ADGF_NO_FLAGS,
- GUIO1(GUIO_NOMIDI)
+ GUIO2(GUIO_NOMIDI, GAMEOPTION_ORIGINAL_SAVELOAD)
},
},
@@ -95,13 +99,25 @@ static const ChewyGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformDOS,
ADGF_DEMO,
- GUIO1(GUIO_NOMIDI)
+ GUIO2(GUIO_NOMIDI, GAMEOPTION_ORIGINAL_SAVELOAD)
},
},
{ AD_TABLE_END_MARKER }
};
+static const ADExtraGuiOptionsMap optionsList[] = {
+ {
+ GAMEOPTION_ORIGINAL_SAVELOAD,
+ {
+ _s("Use original save/load screens"),
+ _s("Use the original save/load screens instead of the ScummVM ones"),
+ "original_menus",
+ false
+ }
+ },
+
+ AD_EXTRA_GUI_OPTIONS_TERMINATOR};
} // namespace Chewy
class ChewyMetaEngineDetection : public AdvancedMetaEngineDetection {
diff --git a/engines/chewy/dialogs/files.cpp b/engines/chewy/dialogs/files.cpp
index 8ca9b265363..0ac7abb40c2 100644
--- a/engines/chewy/dialogs/files.cpp
+++ b/engines/chewy/dialogs/files.cpp
@@ -69,8 +69,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();
- fnames += 1;
+ FileFind *fnames = _G(iog)->io_init();
_G(fx)->blende1(_G(workptr), _G(screen0), _G(pal), 150, 0, 0);
_G(out)->setPointer(_G(workptr));
@@ -114,16 +113,16 @@ int16 Files::execute(bool isInGame) {
}
// Write the list of savegame slots
- char *tmp = fnames + (text_off * 40);
- for (int16 i = 0; i < NUM_VISIBLE_SLOTS; i++, tmp += 40) {
+ FileFind *tmp = &fnames[text_off];
+ for (int16 i = 0; i < NUM_VISIBLE_SLOTS; i++, ++tmp) {
Common::String slot = Common::String::format("%2d.", text_off + i);
if (i != active_slot) {
_G(out)->printxy(40, 68 + (i * 10), 14, 300, 0, slot.c_str());
- _G(out)->printxy(70, 68 + (i * 10), 14, 300, 0, tmp);
+ _G(out)->printxy(70, 68 + (i * 10), 14, 300, 0, tmp->_name.c_str());
} else {
_G(out)->boxFill(40, 68 + (i * 10), 308, 68 + 8 + (i * 10), 42);
_G(out)->printxy(40, 68 + (i * 10), 255, 300, 0, slot.c_str());
- _G(out)->printxy(70, 68 + (i * 10), 255, 300, 0, tmp);
+ _G(out)->printxy(70, 68 + (i * 10), 255, 300, 0, tmp->_name.c_str());
}
}
diff --git a/engines/chewy/io_game.cpp b/engines/chewy/io_game.cpp
index 81ca573f2c2..3f836c1aae8 100644
--- a/engines/chewy/io_game.cpp
+++ b/engines/chewy/io_game.cpp
@@ -19,7 +19,6 @@
*
*/
-#include "common/system.h"
#include "chewy/chewy.h"
#include "chewy/events.h"
#include "chewy/globals.h"
@@ -27,16 +26,13 @@
namespace Chewy {
-char *IOGame::io_init() {
- for (int16 i = 0; i < 20; i++)
- _fileFind[i][0] = 0;
+FileFind *IOGame::io_init() {
get_savegame_files();
-
- return &_fileFind[0][0];
+ return &_fileFind[0];
}
void IOGame::save_entry(int16 slotNum) {
- Common::String desc(&_fileFind[slotNum][1]);
+ Common::String desc = _fileFind[slotNum]._name;
g_engine->saveGameState(slotNum, desc);
}
@@ -45,14 +41,14 @@ int16 IOGame::get_savegame_files() {
int ret = 0;
for (int i = 0; i < 20; i++) {
- _fileFind[i][0] = 0;
+ _fileFind[i]._found = false;
+ _fileFind[i]._name = "";
for (uint j = 0; j < saveList.size(); ++j) {
if (saveList[j].getSaveSlot() == i) {
Common::String name = saveList[j].getDescription();
- _fileFind[i][0] = 1;
- strncpy(&_fileFind[i][1], name.c_str(), USER_NAME + 3);
- _fileFind[i][USER_NAME + 3] = '\0';
+ _fileFind[i]._found = true;
+ _fileFind[i]._name = name;
++ret;
break;
}
diff --git a/engines/chewy/io_game.h b/engines/chewy/io_game.h
index 056f979a88b..8d5bc650cc9 100644
--- a/engines/chewy/io_game.h
+++ b/engines/chewy/io_game.h
@@ -27,14 +27,21 @@ namespace Chewy {
#define IOG_END 1
#define USER_NAME 36
+struct FileFind {
+ bool _found;
+ Common::String _name;
+
+ FileFind() {
+ _found = false;
+ }
+};
+
class IOGame {
- char _fileFind[20][USER_NAME + 4];
+ FileFind _fileFind[20];
int16 get_savegame_files();
public:
- IOGame() {}
-
- char *io_init();
+ FileFind *io_init();
void save_entry(int16 nr);
};
More information about the Scummvm-git-logs
mailing list