mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 21:31:53 +00:00
Added a debug command for font mapping
svn-id: r28935
This commit is contained in:
parent
86b3c8ddeb
commit
5f05e7b64b
@ -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 <Font mapping flag>\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");
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user