diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/zvision/console.cpp | 11 | ||||
-rw-r--r-- | engines/zvision/console.h | 2 | ||||
-rw-r--r-- | engines/zvision/image.cpp | 53 | ||||
-rw-r--r-- | engines/zvision/zvision.h | 1 |
4 files changed, 67 insertions, 0 deletions
diff --git a/engines/zvision/console.cpp b/engines/zvision/console.cpp index a26dba9d6d..d9d4182646 100644 --- a/engines/zvision/console.cpp +++ b/engines/zvision/console.cpp @@ -30,6 +30,17 @@ namespace ZVision { Console::Console(ZVision *engine) : GUI::Debugger(), _engine(engine) { + DCmd_Register("loadimage", WRAP_METHOD(Console, cmdLoadImage)); + } + + bool Console::cmdLoadImage(int argc, const char **argv) { + if (argc != 6) { + DebugPrintf("Use loadimage <fileName> <x> <y> <width> <height> to load an image to the screen"); + return false; + } + _engine->renderImageToScreen(argv[1], atoi(argv[2]), atoi(argv[3]), atoi(argv[4]), atoi(argv[5])); + + return true; } } // End of namespace ZVision diff --git a/engines/zvision/console.h b/engines/zvision/console.h index c91b362451..c341b8d226 100644 --- a/engines/zvision/console.h +++ b/engines/zvision/console.h @@ -36,6 +36,8 @@ namespace ZVision { private: ZVision *_engine; + + bool cmdLoadImage(int argc, const char **argv); }; } // End of namespace ZVision diff --git a/engines/zvision/image.cpp b/engines/zvision/image.cpp new file mode 100644 index 0000000000..95fed0c73c --- /dev/null +++ b/engines/zvision/image.cpp @@ -0,0 +1,53 @@ +/* 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 "common/scummsys.h" + +#include "common/file.h" +#include "common/system.h" + +#include "graphics/decoders/tga.h" + +#include "zvision/zvision.h" + +namespace ZVision { + +void ZVision::renderImageToScreen(const Common::String &fileName, uint32 x, uint32 y, uint32 width, uint32 height) { + Common::File file; + + if (file.open(fileName)) { + Graphics::TGADecoder tga; + if (!tga.loadStream(file)) + error("Error while reading TGA image"); + file.close(); + + const Graphics::Surface *tgaSurface = tga.getSurface(); + + _system->copyRectToScreen(tgaSurface->pixels, tgaSurface->pitch, x, y, width, height); + + tga.destroy(); + + _needsScreenUpdate = true; + } +} + +} // End of namespace ZVision diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index 9dd36662f7..7ff03ca719 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -71,6 +71,7 @@ public: virtual Common::Error run(); ScriptManager *getScriptManager() const; Common::RandomSource *getRandomSource() const; + void renderImageToScreen(const Common::String &fileName, uint32 x, uint32 y, uint32 width, uint32 height); private: void initialize(); |