[Scummvm-git-logs] scummvm master -> 78cb87bb783adb1700cab8f2e96080beb9dd96e8
alxpnv
a04198622 at gmail.com
Tue Sep 28 12:25:34 UTC 2021
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
3c71f32950 ASYLUM: add Insert Disc screen
dad4565809 ASYLUM: add a simple resource viewer
78cb87bb78 ASYLUM: don't autosave when the player is walking/interacting
Commit: 3c71f329504f78807553f9e9cbc3553c3771f89d
https://github.com/scummvm/scummvm/commit/3c71f329504f78807553f9e9cbc3553c3771f89d
Author: alxpnv (alxpnv22 at yahoo.com)
Date: 2021-09-28T15:27:29+03:00
Commit Message:
ASYLUM: add Insert Disc screen
Changed paths:
A engines/asylum/views/insertdisc.cpp
A engines/asylum/views/insertdisc.h
engines/asylum/asylum.h
engines/asylum/console.cpp
engines/asylum/console.h
engines/asylum/module.mk
diff --git a/engines/asylum/asylum.h b/engines/asylum/asylum.h
index c699fc3270..78feab7a83 100644
--- a/engines/asylum/asylum.h
+++ b/engines/asylum/asylum.h
@@ -195,6 +195,7 @@ public:
Common::Language getLanguage() { return _gameDescription->language; }
Common::String getMoviesFileName() { return Common::String::format("%s.movies", _targetName.c_str()); }
bool isMenuVisible() { return _handler == (EventHandler *)_menu; }
+ EventHandler *getEventHandler() { return _handler; }
// Save/Load
int getAutosaveSlot() const { return getMetaEngine()->getAutosaveSlot(); }
diff --git a/engines/asylum/console.cpp b/engines/asylum/console.cpp
index de26eeb255..dca69ec46e 100644
--- a/engines/asylum/console.cpp
+++ b/engines/asylum/console.cpp
@@ -38,6 +38,7 @@
#include "asylum/system/screen.h"
#include "asylum/system/text.h"
+#include "asylum/views/insertdisc.h"
#include "asylum/views/scene.h"
#include "asylum/views/video.h"
@@ -252,7 +253,7 @@ static const int32 itemIndices[][16] = {
{69, 70, 78}
};
-Console::Console(AsylumEngine *engine) : _vm(engine) {
+Console::Console(AsylumEngine *engine) : _vm(engine), _insertDisc(engine) {
// Commands
registerCmd("help", WRAP_METHOD(Console, cmdHelp));
@@ -271,6 +272,7 @@ Console::Console(AsylumEngine *engine) : _vm(engine) {
registerCmd("show_script", WRAP_METHOD(Console, cmdShowScript));
registerCmd("kill_script", WRAP_METHOD(Console, cmdKillScript));
+ registerCmd("insertdisc", WRAP_METHOD(Console, cmdInsertDisc));
registerCmd("scene", WRAP_METHOD(Console, cmdChangeScene));
registerCmd("puzzle", WRAP_METHOD(Console, cmdRunPuzzle));
@@ -335,6 +337,7 @@ bool Console::cmdHelp(int, const char **) {
debugPrintf(" show_script - show script commands\n");
debugPrintf(" kill_script - terminate a script\n");
debugPrintf(" puzzle - run an puzzle\n");
+ debugPrintf(" insertdisc - show Insert Disc screen\n");
debugPrintf("\n");
debugPrintf(" get_status - get actor's status\n");
debugPrintf(" set_status - set actor's status\n");
@@ -774,6 +777,20 @@ bool Console::cmdChangeScene(int argc, const char **argv) {
return false;
}
+bool Console::cmdInsertDisc(int argc, const char **argv) {
+ if (argc < 2) {
+ debugPrintf("Syntax: %s (1|2|3)\n", argv[0]);
+ return true;
+ }
+
+ int cdNumber = CLIP<int>(atoi(argv[1]), 1, 3);
+ _insertDisc.setCdNumber(cdNumber);
+ _insertDisc.setEventHandler(_vm->getEventHandler());
+ _vm->switchEventHandler(&_insertDisc);
+
+ return false;
+}
+
bool Console::cmdRunEncounter(int argc, const char **argv) {
int i, j, subIndex = 0;
const EncounterData *data;
diff --git a/engines/asylum/console.h b/engines/asylum/console.h
index 3d98da806f..e06fde665e 100644
--- a/engines/asylum/console.h
+++ b/engines/asylum/console.h
@@ -27,6 +27,8 @@
#include "gui/debugger.h"
+#include "views/insertdisc.h"
+
namespace Asylum {
enum kDebugLevels {
@@ -57,6 +59,7 @@ public:
private:
AsylumEngine *_vm;
+ InsertDisc _insertDisc;
bool cmdHelp(int argc, const char **argv);
@@ -74,6 +77,7 @@ private:
bool cmdShowScript(int argc, const char **argv);
bool cmdRunScript(int argc, const char **argv);
bool cmdKillScript(int argc, const char **argv);
+ bool cmdInsertDisc(int argc, const char **argv);
bool cmdChangeScene(int argc, const char **argv);
bool cmdRunPuzzle(int argc, const char **argv);
diff --git a/engines/asylum/module.mk b/engines/asylum/module.mk
index 930ef5a3a8..4cbcaa534d 100644
--- a/engines/asylum/module.mk
+++ b/engines/asylum/module.mk
@@ -36,6 +36,7 @@ MODULE_OBJS := \
system/sound.o \
system/speech.o \
system/text.o \
+ views/insertdisc.o \
views/menu.o \
views/scene.o \
views/scenetitle.o \
diff --git a/engines/asylum/views/insertdisc.cpp b/engines/asylum/views/insertdisc.cpp
new file mode 100644
index 0000000000..1a210f2d75
--- /dev/null
+++ b/engines/asylum/views/insertdisc.cpp
@@ -0,0 +1,80 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "asylum/views/insertdisc.h"
+
+#include "asylum/system/cursor.h"
+#include "asylum/system/graphics.h"
+#include "asylum/system/screen.h"
+#include "asylum/system/text.h"
+
+#include "asylum/asylum.h"
+
+namespace Asylum {
+
+InsertDisc::InsertDisc(AsylumEngine *engine) : _vm(engine) {
+ _handler = NULL;
+ _cdNumber = -1;
+ _frameIndex = _frameCount = 0;
+}
+
+void InsertDisc::init() {
+ getScreen()->setPalette(MAKE_RESOURCE(kResourcePackSound, 10 + _cdNumber));
+ getScreen()->setGammaLevel(MAKE_RESOURCE(kResourcePackSound, 10 + _cdNumber));
+ getText()->loadFont(MAKE_RESOURCE(kResourcePackSound, 19));
+
+ _frameIndex = 0;
+ _frameCount = GraphicResource::getFrameCount(_vm, MAKE_RESOURCE(kResourcePackSound, 13 + _cdNumber));
+}
+
+void InsertDisc::update() {
+ getCursor()->hide();
+ getScreen()->draw(MAKE_RESOURCE(kResourcePackSound, 7 + _cdNumber), 0, Common::Point( 0, 0));
+ getScreen()->draw(MAKE_RESOURCE(kResourcePackSound, 13 + _cdNumber), _frameIndex, Common::Point(295, 206));
+ getText()->drawCentered(Common::Point(0, 40), 640, MAKE_RESOURCE(kResourcePackText, 1416 + _cdNumber));
+ getScreen()->copyBackBufferToScreen();
+
+ _frameIndex = (_frameIndex + 1) % _frameCount;
+}
+
+bool InsertDisc::handleEvent(const AsylumEvent &evt) {
+ switch ((int32)evt.type) {
+ default:
+ break;
+
+ case EVENT_ASYLUM_INIT:
+ init();
+ return true;
+
+ case EVENT_ASYLUM_UPDATE:
+ update();
+ return true;
+
+ case Common::EVENT_KEYDOWN:
+ _vm->switchEventHandler(_handler);
+ return true;
+ }
+
+ return false;
+}
+
+} // End of namespace Asylum
diff --git a/engines/asylum/views/insertdisc.h b/engines/asylum/views/insertdisc.h
new file mode 100644
index 0000000000..8242511c2b
--- /dev/null
+++ b/engines/asylum/views/insertdisc.h
@@ -0,0 +1,54 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef ASYLUM_VIEWS_INSERTDISC_H
+#define ASYLUM_VIEWS_INSERTDISC_H
+
+#include "asylum/eventhandler.h"
+
+namespace Asylum {
+
+class AsylumEngine;
+
+class InsertDisc : public EventHandler {
+public:
+ InsertDisc(AsylumEngine *engine);
+ ~InsertDisc() {};
+
+ void setCdNumber(int cdNumber) { _cdNumber = cdNumber; }
+ void setEventHandler(EventHandler *handler) { _handler = handler; }
+ bool handleEvent(const AsylumEvent &evt);
+
+private:
+ AsylumEngine *_vm;
+ EventHandler *_handler;
+ int _cdNumber;
+ uint _frameIndex;
+ uint _frameCount;
+
+ void init();
+ void update();
+};
+
+} // End of namespace Asylum
+
+#endif // ASYLUM_VIEWS_INSERTDISC_H
Commit: dad4565809e481760ae4fc5bf163f695545cdebb
https://github.com/scummvm/scummvm/commit/dad4565809e481760ae4fc5bf163f695545cdebb
Author: alxpnv (alxpnv22 at yahoo.com)
Date: 2021-09-28T15:27:29+03:00
Commit Message:
ASYLUM: add a simple resource viewer
Changed paths:
A engines/asylum/views/resviewer.cpp
A engines/asylum/views/resviewer.h
engines/asylum/console.cpp
engines/asylum/console.h
engines/asylum/module.mk
diff --git a/engines/asylum/console.cpp b/engines/asylum/console.cpp
index dca69ec46e..3164f8ec98 100644
--- a/engines/asylum/console.cpp
+++ b/engines/asylum/console.cpp
@@ -253,7 +253,7 @@ static const int32 itemIndices[][16] = {
{69, 70, 78}
};
-Console::Console(AsylumEngine *engine) : _vm(engine), _insertDisc(engine) {
+Console::Console(AsylumEngine *engine) : _vm(engine), _insertDisc(engine), _resViewer(engine) {
// Commands
registerCmd("help", WRAP_METHOD(Console, cmdHelp));
@@ -287,7 +287,7 @@ Console::Console(AsylumEngine *engine) : _vm(engine), _insertDisc(engine) {
registerCmd("throw", WRAP_METHOD(Console, cmdRemoveFromInventory));
registerCmd("palette", WRAP_METHOD(Console, cmdSetPalette));
- registerCmd("draw", WRAP_METHOD(Console, cmdDrawResource));
+ registerCmd("view", WRAP_METHOD(Console, cmdViewResource));
registerCmd("toggle_flag", WRAP_METHOD(Console, cmdToggleFlag));
@@ -350,7 +350,7 @@ bool Console::cmdHelp(int, const char **) {
debugPrintf(" throw - remove an item from inventory\n");
debugPrintf("\n");
debugPrintf(" palette - set the screen palette\n");
- debugPrintf(" draw - draw a resource\n");
+ debugPrintf(" view - view game resources\n");
debugPrintf("\n");
debugPrintf(" toggle_flag - toggle a flag\n");
debugPrintf("\n");
@@ -1046,22 +1046,26 @@ bool Console::cmdSetPalette(int argc, const char **argv) {
return true;
}
-bool Console::cmdDrawResource(int argc, const char **argv) {
- if (argc != 3 && argc != 4) {
- debugPrintf("Syntax: %s <pack> <index> (<frame>)\n", argv[0]);
+bool Console::cmdViewResource(int argc, const char **argv) {
+ if (argc != 2 && argc != 3) {
+ debugPrintf("Syntax: %s <pack> (<index>)\n", argv[0]);
+ debugPrintf("\nControls:\n");
+ debugPrintf(" Space/Backspace - next/previous resource\n");
+ debugPrintf(" Enter - toggle animation\n");
+ debugPrintf(" PageDown/PageUp - next/previous palette\n");
+ debugPrintf(" Arrow keys - scroll the image\n");
+ debugPrintf(" Escape - quit\n");
return true;
}
int32 pack = atoi(argv[1]);
- int32 index = atoi(argv[2]);
-
- int32 frame = 0;
- if (argc == 4)
- frame = atoi(argv[3]);
+ int32 index = pack < 18 ? 0 : 8;
+ if (argc > 2)
+ index = atoi(argv[2]);
// Check resource pack
- if (pack < 0 || pack > 18) {
- debugPrintf("[Error] Invalid resource pack (was: %d - valid: [0-18])\n", pack);
+ if (pack < 1 || (pack > 1 && pack < 5)|| pack > 18) {
+ debugPrintf("[Error] Invalid resource pack (was: %d - valid: [1,5-18])\n", pack);
return true;
}
@@ -1073,34 +1077,14 @@ bool Console::cmdDrawResource(int argc, const char **argv) {
ResourceId resourceId = MAKE_RESOURCE((uint32)pack, index);
- // Try loading resource
- GraphicResource *resource = new GraphicResource(_vm);
- if (!resource->load(resourceId)) {
- debugPrintf("[Error] Invalid resource index (was: %d)\n", index);
- delete resource;
- return true;
- }
-
- if (frame < 0 || frame >= (int32)resource->count()) {
- debugPrintf("[Error] Invalid resource frame index (was: %d , max: %d)\n", frame, resource->count() - 1);
- delete resource;
+ if (_resViewer.setResourceId(resourceId)) {
+ _resViewer.setEventHandler(_vm->getEventHandler());
+ _vm->switchEventHandler(&_resViewer);
+ return false;
+ } else {
+ debugPrintf("[Error] Could not load resource 0x%X\n", resourceId);
return true;
}
-
- delete resource;
-
- // Stop current event handler (to prevent screen refresh)
- _vm->switchEventHandler(NULL);
- getCursor()->hide();
-
- // Draw resource
- getScreen()->clear();
- getScreen()->draw(resourceId, (uint32)frame, Common::Point(0, 0));
- getScreen()->copyBackBufferToScreen();
-
- g_system->updateScreen();
-
- return false;
}
//////////////////////////////////////////////////////////////////////////
diff --git a/engines/asylum/console.h b/engines/asylum/console.h
index e06fde665e..45de630ad6 100644
--- a/engines/asylum/console.h
+++ b/engines/asylum/console.h
@@ -28,6 +28,7 @@
#include "gui/debugger.h"
#include "views/insertdisc.h"
+#include "views/resviewer.h"
namespace Asylum {
@@ -60,6 +61,7 @@ public:
private:
AsylumEngine *_vm;
InsertDisc _insertDisc;
+ ResourceViewer _resViewer;
bool cmdHelp(int argc, const char **argv);
@@ -92,7 +94,7 @@ private:
bool cmdRemoveFromInventory(int argc, const char **argv);
bool cmdSetPalette(int argc, const char **argv);
- bool cmdDrawResource(int argc, const char **argv);
+ bool cmdViewResource(int argc, const char **argv);
bool cmdToggleFlag(int argc, const char **argv);
};
diff --git a/engines/asylum/module.mk b/engines/asylum/module.mk
index 4cbcaa534d..71a84d16f9 100644
--- a/engines/asylum/module.mk
+++ b/engines/asylum/module.mk
@@ -38,6 +38,7 @@ MODULE_OBJS := \
system/text.o \
views/insertdisc.o \
views/menu.o \
+ views/resviewer.o \
views/scene.o \
views/scenetitle.o \
views/video.o \
diff --git a/engines/asylum/views/resviewer.cpp b/engines/asylum/views/resviewer.cpp
new file mode 100644
index 0000000000..28962402e3
--- /dev/null
+++ b/engines/asylum/views/resviewer.cpp
@@ -0,0 +1,222 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "asylum/views/resviewer.h"
+
+#include "asylum/system/cursor.h"
+#include "asylum/system/screen.h"
+#include "asylum/system/text.h"
+
+#include "asylum/asylum.h"
+#include "asylum/respack.h"
+
+namespace Asylum {
+
+#define SCROLL_STEP 10
+
+#define NOPALETTE {0, 0, 0, 0, 0, 0, 0, 0}
+static int paletteIds[][8] {
+ NOPALETTE,
+ {0x0011, 0x001A, 0x001F, 0x003B, 0x003C},
+ NOPALETTE,
+ NOPALETTE,
+ NOPALETTE,
+ {0x0014, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x00B7, 0x00CD},
+ {0x0014, 0x0020, 0x026C, 0x0277, 0x02A6},
+ {0x0014, 0x0018, 0x0019, 0x001A, 0x0163, 0x0191},
+ {0x0014, 0x0018, 0x01BC},
+ {0x0014, 0x008C, 0x00AB, 0x00D4},
+ {0x0014, 0x001E, 0x001F, 0x0171, 0x0185, 0x01C0},
+ {0x0012, 0x001F, 0x011B, 0x011E, 0x0120, 0x0135, 0x0159},
+ {0x0014, 0x018F, 0x01A3, 0x01B0, 0x01C1},
+ {0x0014, 0x019D, 0x019E, 0x019F, 0x01A7},
+ {0x0014, 0x001E, 0x001F, 0x0121, 0x0124},
+ {0x0014, 0x00AD},
+ {0x0014, 0x0018, 0x0095},
+ {0x0014, 0x006B},
+ {0x000B, 0x000C, 0x000D}
+};
+
+static const int resPackSizes[] = {
+ 4112, 61, 28, 534, 1, 215, 701, 418, 458, 230, 475, 354, 461, 459, 310, 176, 168, 121, 22
+};
+
+ResourceViewer::ResourceViewer(AsylumEngine *engine) : _vm(engine), _resource(_vm) {
+ _handler = NULL;
+ _resourceId = kResourceNone;
+ _frameIndex = _frameCount = 0;
+ _frameIncrement = 1;
+ _x = _y = 0;
+ _width = _height = 0;
+ _scroll = false;
+ _resPack = -1;
+ _paletteIndex = 0;
+ _animate = true;
+}
+
+bool ResourceViewer::setResourceId(ResourceId resourceId) {
+ if (resourceId == kResourceNone ||
+ !getResource()->get(resourceId) ||
+ strncmp((const char *)getResource()->get(resourceId)->data, "D3GR", 4) ||
+ getResource()->get(resourceId)->size == 800)
+
+ return false;
+
+ _resourceId = resourceId;
+ _frameIndex = 0;
+ _frameCount = GraphicResource::getFrameCount(_vm, _resourceId);
+
+ _resource.load(_resourceId);
+
+ _frameIncrement = 1;
+ _x = _y = 0;
+ _width = _resource.getFrame(0)->getWidth();
+ _height = _resource.getFrame(0)->getHeight();
+ _scroll = _width > 640 || _height > 480;
+ _resPack = RESOURCE_PACK(_resourceId);
+ _paletteIndex = 0;
+
+ int fontIndex = 13;
+ if (_resPack == 1)
+ fontIndex = 16;
+ else if (_resPack == 18)
+ fontIndex = 19;
+ getText()->loadFont(MAKE_RESOURCE(_resPack, fontIndex));
+
+ return true;
+}
+
+void ResourceViewer::update() {
+ int16 x, y;
+ GraphicFrame *frame = _resource.getFrame(_frameIndex);
+
+ if (_scroll) {
+ x = _x;
+ y = _y;
+ } else {
+ x = (640 - frame->getWidth()) / 2 - frame->x;
+ y = (480 - frame->getHeight()) / 2 - frame->y;
+ }
+
+ getScreen()->setPalette(MAKE_RESOURCE(_resPack, paletteIds[_resPack][_paletteIndex]));
+
+ getCursor()->hide();
+ getScreen()->clear();
+ getScreen()->draw(_resourceId, _frameIndex, Common::Point(x, y));
+ getText()->draw(Common::Point(615, 440), Common::String::format("%X", _resourceId).c_str());
+ getScreen()->copyBackBufferToScreen();
+
+ if (_frameCount > 1 && _animate) {
+ if (_frameIndex + 1 >= _frameCount)
+ _frameIncrement = -1;
+ else if (_frameIndex == 0)
+ _frameIncrement = 1;
+
+ _frameIndex += _frameIncrement;
+ }
+}
+
+void ResourceViewer::key(const AsylumEvent &evt) {
+ switch (evt.kbd.keycode) {
+ default:
+ break;
+
+ case Common::KEYCODE_ESCAPE:
+ _vm->switchEventHandler(_handler);
+ break;
+
+ case Common::KEYCODE_SPACE:
+ if (RESOURCE_INDEX(_resourceId) < resPackSizes[_resPack] - 1) {
+ int i = 1;
+ do {
+ if (setResourceId(_resourceId + i))
+ break;
+ i++;
+ } while (RESOURCE_INDEX(_resourceId + i) < resPackSizes[_resPack] - 1);
+ }
+ break;
+
+ case Common::KEYCODE_BACKSPACE:
+ if (RESOURCE_INDEX(_resourceId)) {
+ int i = 0;
+ do {
+ i++;
+ if (setResourceId(_resourceId - i))
+ break;
+ } while (RESOURCE_INDEX(_resourceId - i));
+ }
+ break;
+
+ case Common::KEYCODE_RETURN:
+ _animate = !_animate;
+ break;
+
+ case Common::KEYCODE_UP:
+ case Common::KEYCODE_DOWN:
+ case Common::KEYCODE_RIGHT:
+ case Common::KEYCODE_LEFT:
+ if (_scroll) {
+ int16 x = _x, y = _y;
+ int dir = (int)(evt.kbd.keycode - Common::KEYCODE_UP);
+
+ if (dir < 2)
+ y -= SCROLL_STEP * (2 * dir - 1);
+ else
+ x -= SCROLL_STEP * (1 - 2 * (dir - 2));
+
+ if (640 - x <= _width && x <= 0 && 480 - y <= _height && y <= 0) {
+ _x = x;
+ _y = y;
+ }
+ }
+ break;
+
+ case Common::KEYCODE_PAGEUP:
+ if (_paletteIndex)
+ _paletteIndex = _paletteIndex - 1;
+ break;
+
+ case Common::KEYCODE_PAGEDOWN:
+ if (_paletteIndex < 8 && paletteIds[_resPack][_paletteIndex + 1])
+ _paletteIndex = _paletteIndex + 1;
+ break;
+ }
+}
+
+bool ResourceViewer::handleEvent(const AsylumEvent &evt) {
+ switch ((int32)evt.type) {
+ default:
+ break;
+
+ case EVENT_ASYLUM_UPDATE:
+ update();
+ return true;
+
+ case Common::EVENT_KEYDOWN:
+ key(evt);
+ return true;
+ }
+
+ return false;
+}
+
+} // End of namespace Asylum
diff --git a/engines/asylum/views/resviewer.h b/engines/asylum/views/resviewer.h
new file mode 100644
index 0000000000..f592aa24ee
--- /dev/null
+++ b/engines/asylum/views/resviewer.h
@@ -0,0 +1,65 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef ASYLUM_VIEWS_RESVIEWER_H
+#define ASYLUM_VIEWS_RESVIEWER_H
+
+#include "asylum/system/graphics.h"
+
+#include "asylum/eventhandler.h"
+#include "asylum/shared.h"
+
+namespace Asylum {
+
+class AsylumEngine;
+
+class ResourceViewer : public EventHandler {
+public:
+ ResourceViewer(AsylumEngine *engine);
+ ~ResourceViewer() {};
+
+ void setEventHandler(EventHandler *handler) { _handler = handler; }
+ bool setResourceId(ResourceId resourceId);
+ bool handleEvent(const AsylumEvent &evt);
+
+private:
+ AsylumEngine *_vm;
+ EventHandler *_handler;
+ ResourceId _resourceId;
+ GraphicResource _resource;
+ int _frameIndex;
+ uint _frameCount;
+ int _frameIncrement;
+ int16 _x, _y;
+ uint16 _width, _height;
+ bool _scroll;
+ int _resPack;
+ int _paletteIndex;
+ bool _animate;
+
+ void key(const AsylumEvent &evt);
+ void update();
+};
+
+} // End of namespace Asylum
+
+#endif // ASYLUM_VIEWS_RESVIEWER_H
Commit: 78cb87bb783adb1700cab8f2e96080beb9dd96e8
https://github.com/scummvm/scummvm/commit/78cb87bb783adb1700cab8f2e96080beb9dd96e8
Author: alxpnv (alxpnv22 at yahoo.com)
Date: 2021-09-28T15:27:29+03:00
Commit Message:
ASYLUM: don't autosave when the player is walking/interacting
Changed paths:
engines/asylum/asylum.cpp
engines/asylum/asylum.h
diff --git a/engines/asylum/asylum.cpp b/engines/asylum/asylum.cpp
index cde3f39cdd..d979300242 100644
--- a/engines/asylum/asylum.cpp
+++ b/engines/asylum/asylum.cpp
@@ -681,6 +681,11 @@ bool AsylumEngine::canSaveGameStateCurrently() {
&& !speech()->getSoundResourceId());
}
+bool AsylumEngine::canSaveAutosaveCurrently() {
+ return canSaveGameStateCurrently()
+ && (scene()->getActor()->getStatus() == kActorStatusEnabled);
+}
+
Common::Error AsylumEngine::loadGameState(int slot) {
savegame()->loadList();
savegame()->setIndex(slot);
diff --git a/engines/asylum/asylum.h b/engines/asylum/asylum.h
index 78feab7a83..344b0f4b55 100644
--- a/engines/asylum/asylum.h
+++ b/engines/asylum/asylum.h
@@ -202,6 +202,7 @@ public:
bool canLoadGameStateCurrently();
Common::Error loadGameState(int slot);
bool canSaveGameStateCurrently();
+ bool canSaveAutosaveCurrently();
Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave = false);
private:
More information about the Scummvm-git-logs
mailing list