From 5f05e7b64bd87510ccf941d27182828dd7bec535 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 17 Sep 2007 23:32:25 +0000 Subject: Added a debug command for font mapping svn-id: r28935 --- engines/saga/console.cpp | 13 +++++++++++++ engines/saga/console.h | 2 ++ engines/saga/font.cpp | 11 ++++++++++- engines/saga/font.h | 6 +++++- 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/engines/saga/console.cpp b/engines/saga/console.cpp index ee5635d1ef..0a6b733e00 100644 --- a/engines/saga/console.cpp +++ b/engines/saga/console.cpp @@ -76,6 +76,9 @@ Console::Console(SagaEngine *vm) : GUI::Debugger() { DCmd_Register("current_panel_mode", WRAP_METHOD(Console, cmdCurrentPanelMode)); DCmd_Register("set_panel_mode", WRAP_METHOD(Console, cmdSetPanelMode)); + // Font commands + DCmd_Register("set_font_mapping", WRAP_METHOD(Console, cmdSetFontMapping)); + // Global flags commands DCmd_Register("global_flags_info", WRAP_METHOD(Console, cmdGlobalFlagsInfo)); DCmd_Register("set_global_flag", WRAP_METHOD(Console, cmdSetGlobalFlag)); @@ -163,6 +166,16 @@ bool Console::cmdSetPanelMode(int argc, const char **argv) { return true; } +bool Console::cmdSetFontMapping(int argc, const char **argv) { + if (argc != 2) { + DebugPrintf("Sets font mapping\nUsage: %s \n", argv[0]); + DebugPrintf("Mapping flags:\n0 - default game behavior\n1 - force font mapping\n2 - ignore font mapping\n"); + } else { + _vm->_font->setFontMapping(atoi(argv[1])); + } + return true; +} + bool Console::cmdGlobalFlagsInfo(int argc, const char **argv) { DebugPrintf("Global flags status for IHNM:\n"); diff --git a/engines/saga/console.h b/engines/saga/console.h index f2f883a63c..7936d3a959 100644 --- a/engines/saga/console.h +++ b/engines/saga/console.h @@ -55,6 +55,8 @@ private: bool cmdCurrentPanelMode(int argc, const char **argv); bool cmdSetPanelMode(int argc, const char **argv); + bool cmdSetFontMapping(int argc, const char **argv); + bool cmdGlobalFlagsInfo(int argc, const char **argv); bool cmdSetGlobalFlag(int argc, const char **argv); bool cmdClearGlobalFlag(int argc, const char **argv); diff --git a/engines/saga/font.cpp b/engines/saga/font.cpp index 8a9c10deb4..02c17d5e84 100644 --- a/engines/saga/font.cpp +++ b/engines/saga/font.cpp @@ -49,6 +49,7 @@ Font::Font(SagaEngine *vm) : _vm(vm), _initialized(false) { } _initialized = true; + _fontMapping = 0; } Font::~Font(void) { @@ -325,8 +326,16 @@ void Font::outFont(const FontStyle &drawFont, Surface *ds, const char *text, siz c_code = *textPointer & 0xFFU; // Translate character - if (!(flags & kFontDontmap)) + if (_fontMapping == 0) { // Check font mapping debug flag + // Default game behavior + if (!(flags & kFontDontmap)) + c_code = _charMap[c_code]; + } else if (_fontMapping == 1) { + // Force font mapping c_code = _charMap[c_code]; + } else { + // In all other cases, ignore font mapping + } assert(c_code < FONT_CHARCOUNT); // Check if character is defined diff --git a/engines/saga/font.h b/engines/saga/font.h index 5fd3a53721..16fdfc22b9 100644 --- a/engines/saga/font.h +++ b/engines/saga/font.h @@ -141,8 +141,11 @@ class Font { } void textDrawRect(KnownFont font, Surface *ds, const char *text, const Common::Rect &rect, int color, int effectColor, FontEffectFlags flags) { textDrawRect(knownFont2FontIdx(font), ds, text, rect, color, effectColor, flags); + } + void setFontMapping(int mapping) { + _fontMapping = mapping; } - + private: enum FontId { kSmallFont, @@ -197,6 +200,7 @@ class Font { SagaEngine *_vm; bool _initialized; + int _fontMapping; int _loadedFonts; FontData **_fonts; -- cgit v1.2.3