mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-08 10:51:11 +00:00
CHEWY: Only allow GMM saving/loading from main game loop
This commit is contained in:
parent
264835e44a
commit
c7a89d1c0a
@ -37,10 +37,7 @@ Graphics::Screen *g_screen;
|
||||
ChewyEngine::ChewyEngine(OSystem *syst, const ChewyGameDescription *gameDesc)
|
||||
: Engine(syst),
|
||||
_gameDescription(gameDesc),
|
||||
_rnd("chewy"),
|
||||
_events(nullptr),
|
||||
_screen(nullptr),
|
||||
_sound(nullptr) {
|
||||
_rnd("chewy") {
|
||||
|
||||
g_engine = this;
|
||||
g_screen = nullptr;
|
||||
|
@ -49,6 +49,10 @@ class ChewyEngine : public Engine {
|
||||
protected:
|
||||
// Engine APIs
|
||||
Common::Error run() override;
|
||||
|
||||
/**
|
||||
* Returns engine features
|
||||
*/
|
||||
bool hasFeature(EngineFeature f) const override;
|
||||
|
||||
void initialize();
|
||||
@ -58,9 +62,10 @@ public:
|
||||
const ChewyGameDescription *_gameDescription;
|
||||
Common::RandomSource _rnd;
|
||||
TempFileArchive _tempFiles;
|
||||
EventsManager *_events;
|
||||
Sound *_sound;
|
||||
Graphics::Screen *_screen;
|
||||
EventsManager *_events = nullptr;
|
||||
Sound *_sound = nullptr;
|
||||
Graphics::Screen *_screen = nullptr;
|
||||
bool _canLoadSave = false;
|
||||
public:
|
||||
ChewyEngine(OSystem *syst, const ChewyGameDescription *gameDesc);
|
||||
~ChewyEngine() override;
|
||||
@ -68,6 +73,13 @@ public:
|
||||
uint32 getFeatures() const;
|
||||
Common::Language getLanguage() const;
|
||||
|
||||
bool canLoadGameStateCurrently() override {
|
||||
return _canLoadSave;
|
||||
}
|
||||
bool canSaveGameStateCurrently() override {
|
||||
return _canLoadSave;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load savegame data
|
||||
*/
|
||||
|
@ -43,9 +43,11 @@ namespace Chewy {
|
||||
#define SCREEN_WIDTH 320
|
||||
#define SCREEN_HEIGHT 200
|
||||
|
||||
#define NO_SETUP 0
|
||||
|
||||
#define DO_SETUP 1
|
||||
enum SetupScreenMode {
|
||||
NO_SETUP = 0,
|
||||
DO_SETUP = 1,
|
||||
DO_MAIN_LOOP = 2
|
||||
};
|
||||
|
||||
#define MIN_FAR_MEM 3000000
|
||||
#define MIN_LOW_MEM 100000
|
||||
|
@ -240,7 +240,7 @@ void free_buffers();
|
||||
|
||||
int16 main_loop(int16 mode);
|
||||
|
||||
void set_up_screen(int16 mode);
|
||||
void set_up_screen(SetupScreenMode mode);
|
||||
|
||||
void kb_mov(int16 mode);
|
||||
|
||||
|
@ -540,21 +540,25 @@ int16 main_loop(int16 mode) {
|
||||
}
|
||||
kbinfo.scan_code = Common::KEYCODE_INVALID;
|
||||
if (mode == DO_SETUP)
|
||||
set_up_screen(DO_SETUP);
|
||||
set_up_screen(DO_MAIN_LOOP);
|
||||
#ifdef DEMO
|
||||
if (spieler.PersonRoomNr[P_CHEWY] > 24)
|
||||
ende = 1;
|
||||
#endif
|
||||
return (ende);
|
||||
return ende;
|
||||
}
|
||||
|
||||
void set_up_screen(int16 mode) {
|
||||
void set_up_screen(SetupScreenMode mode) {
|
||||
int16 nr;
|
||||
int16 tmp;
|
||||
int16 i;
|
||||
int16 *ScrXy;
|
||||
int16 txt_nr;
|
||||
|
||||
bool isMainLoop = mode == DO_MAIN_LOOP;
|
||||
if (isMainLoop)
|
||||
mode = DO_SETUP;
|
||||
|
||||
if (flags.InitSound && spieler.SpeechSwitch)
|
||||
ailsnd->serve_db_samples();
|
||||
uhr->calc_timer();
|
||||
@ -716,7 +720,10 @@ void set_up_screen(int16 mode) {
|
||||
&spieler.scrollx, &spieler.scrolly);
|
||||
|
||||
g_screen->update();
|
||||
|
||||
g_engine->_canLoadSave = isMainLoop;
|
||||
g_events->update();
|
||||
g_engine->_canLoadSave = false;
|
||||
}
|
||||
|
||||
void mous_obj_action(int16 nr, int16 mode, int16 txt_mode, int16 txt_nr) {
|
||||
|
Loading…
Reference in New Issue
Block a user