aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2008-03-27 15:27:31 +0000
committerJohannes Schickel2008-03-27 15:27:31 +0000
commit4d4fbc9e97e0c0200f8fd2d1818cb107fbe38ce5 (patch)
tree7738e747777edfb7cc53d2c90967a866f8106681
parent9eb279e1b691612811ea2cb2d0cd9b437e51e09b (diff)
downloadscummvm-rg350-4d4fbc9e97e0c0200f8fd2d1818cb107fbe38ce5.tar.gz
scummvm-rg350-4d4fbc9e97e0c0200f8fd2d1818cb107fbe38ce5.tar.bz2
scummvm-rg350-4d4fbc9e97e0c0200f8fd2d1818cb107fbe38ce5.zip
Added debugger command to set screen palette.
svn-id: r31265
-rw-r--r--engines/kyra/debugger.cpp38
-rw-r--r--engines/kyra/debugger.h1
-rw-r--r--engines/kyra/screen.h1
3 files changed, 40 insertions, 0 deletions
diff --git a/engines/kyra/debugger.cpp b/engines/kyra/debugger.cpp
index 462e15bb75..994c3de425 100644
--- a/engines/kyra/debugger.cpp
+++ b/engines/kyra/debugger.cpp
@@ -31,6 +31,7 @@
#include "kyra/kyra_v2.h"
#include "kyra/screen.h"
#include "kyra/timer.h"
+#include "kyra/resource.h"
namespace Kyra {
@@ -39,6 +40,7 @@ Debugger::Debugger(KyraEngine *vm)
_vm = vm;
DCmd_Register("screen_debug_mode", WRAP_METHOD(Debugger, cmd_setScreenDebug));
+ DCmd_Register("load_palette", WRAP_METHOD(Debugger, cmd_loadPalette));
DCmd_Register("facings", WRAP_METHOD(Debugger, cmd_showFacings));
}
@@ -57,6 +59,42 @@ bool Debugger::cmd_setScreenDebug(int argc, const char **argv) {
return true;
}
+bool Debugger::cmd_loadPalette(int argc, const char **argv) {
+ uint8 palette[768];
+
+ if (argc <= 1) {
+ DebugPrintf("Use load_palette <file> [start_col] [end_col]");
+ return true;
+ }
+
+ if (_vm->gameFlags().gameID != GI_KYRA1 && _vm->resource()->getFileSize(argv[1]) != 768) {
+ _vm->screen()->savePageToDisk("TEMP", 5);
+ _vm->screen()->loadBitmap(argv[1], 5, 5, 0);
+ memcpy(palette, _vm->screen()->getCPagePtr(5), 768);
+ _vm->screen()->loadPageFromDisk("TEMP", 5);
+ } else if (!_vm->resource()->loadFileToBuf(argv[1], palette, 768)) {
+ DebugPrintf("Palette '%s' not found!", argv[1]);
+ return true;
+ }
+
+ int startCol = 0;
+ int endCol = 255;
+ if (argc > 2)
+ startCol = MIN(255, MAX(0, atoi(argv[2])));
+ if (argc > 3)
+ endCol = MIN(255, MAX(0, atoi(argv[3])));
+
+ if (startCol > 0)
+ memcpy(palette, _vm->screen()->getScreenPalette(), startCol*3);
+ if (endCol < 255)
+ memcpy(palette + endCol * 3, _vm->screen()->getScreenPalette() + endCol * 3, (255-endCol)*3);
+
+ _vm->screen()->setScreenPalette(palette);
+ _vm->screen()->updateScreen();
+
+ return true;
+}
+
bool Debugger::cmd_showFacings(int argc, const char **argv) {
DebugPrintf("Facing directions:\n");
DebugPrintf("7 0 1\n");
diff --git a/engines/kyra/debugger.h b/engines/kyra/debugger.h
index 8fbe20d846..0bbc1d5b5a 100644
--- a/engines/kyra/debugger.h
+++ b/engines/kyra/debugger.h
@@ -43,6 +43,7 @@ protected:
KyraEngine *_vm;
bool cmd_setScreenDebug(int argc, const char **argv);
+ bool cmd_loadPalette(int argc, const char **argv);
bool cmd_showFacings(int argc, const char **argv);
};
diff --git a/engines/kyra/screen.h b/engines/kyra/screen.h
index 152ba91a21..ff5e6f1d37 100644
--- a/engines/kyra/screen.h
+++ b/engines/kyra/screen.h
@@ -145,6 +145,7 @@ public:
void setPaletteIndex(uint8 index, uint8 red, uint8 green, uint8 blue);
void setScreenPalette(const uint8 *palData);
+ const uint8 *getScreenPalette() const { return _screenPalette; }
uint8 *getPalette(int num);
// gui specific (processing on _curPage)