diff options
author | Max Horn | 2003-05-08 22:44:46 +0000 |
---|---|---|
committer | Max Horn | 2003-05-08 22:44:46 +0000 |
commit | c63ec9d0084f341c39118cfe8d5a01434bc9bbf5 (patch) | |
tree | 5804dc9e67adc749a3fc770d886c66db2248540d | |
parent | 4d7f7a8c80fdf78cf29f8517546a5a2a89694bab (diff) | |
download | scummvm-rg350-c63ec9d0084f341c39118cfe8d5a01434bc9bbf5.tar.gz scummvm-rg350-c63ec9d0084f341c39118cfe8d5a01434bc9bbf5.tar.bz2 scummvm-rg350-c63ec9d0084f341c39118cfe8d5a01434bc9bbf5.zip |
added a v2 charset rendered (with a hardcoded font take from german zak); enabled verbs in zak (well, they are drawn at least :-)
svn-id: r7398
-rw-r--r-- | scumm/charset.cpp | 199 | ||||
-rw-r--r-- | scumm/charset.h | 18 | ||||
-rw-r--r-- | scumm/script_v2.cpp | 59 | ||||
-rw-r--r-- | scumm/scummvm.cpp | 6 |
4 files changed, 253 insertions, 29 deletions
diff --git a/scumm/charset.cpp b/scumm/charset.cpp index ebadc9b371..0099031dd3 100644 --- a/scumm/charset.cpp +++ b/scumm/charset.cpp @@ -32,15 +32,27 @@ void CharsetRendererCommon::setCurID(byte id) { if (_fontPtr == 0) error("CharsetRendererCommon::setCurID: charset %d not found!\n", id); - if (_vm->_features & GF_AFTER_V3) { - _nbChars = _fontPtr[4]; - _fontPtr += 6 + _nbChars; - } else if (_vm->_features & GF_AFTER_V4) + if (_vm->_features & GF_AFTER_V4) _fontPtr += 17; else _fontPtr += 29; } +void CharsetRendererV3::setCurID(byte id) { + _vm->checkRange(_vm->_maxCharsets - 1, 0, _curId, "Printing with bad charset %d"); + + _curId = id; + + _fontPtr = _vm->getResourceAddress(rtCharset, id); + if (_fontPtr == 0) + error("CharsetRendererCommon::setCurID: charset %d not found!\n", id); + + _nbChars = _fontPtr[4]; + _fontPtr += 6; + _widthTable = _fontPtr; + _fontPtr += _nbChars; +} + // do spacing for variable width old-style font int CharsetRendererClassic::getCharWidth(byte chr) { int spacing = 0; @@ -58,14 +70,6 @@ int CharsetRendererClassic::getCharWidth(byte chr) { return spacing; } -int CharsetRendererOld256::getCharWidth(byte chr) { - int spacing = 0; - - spacing = *(_fontPtr - _nbChars + chr); - - return spacing; -} - int CharsetRenderer::getStringWidth(int arg, byte *text) { int pos = 0; int width = 1; @@ -168,7 +172,174 @@ void CharsetRenderer::addLinebreaks(int a, byte *str, int pos, int maxwidth) { setCurID(oldID); } -void CharsetRendererOld256::setColor(byte color) +// German Zak font (should work for US version too). +// See patch #732072 +static byte charsetDataV2[] = { + 0x89, 0x04, 0x00, 0x00, 0x63, 0x01, 0x80, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x07, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x04, 0x04, 0x07, 0x08, 0x07, 0x07, 0x08, 0x04, + 0x05, 0x05, 0x03, 0x08, 0x04, 0x06, 0x04, 0x08, + 0x07, 0x04, 0x07, 0x07, 0x08, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x04, 0x04, 0x08, 0x08, 0x08, 0x07, + 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x03, 0x06, 0x07, 0x07, 0x08, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x08, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x08, 0x02, 0x08, + 0x08, 0x07, 0x07, 0x06, 0x07, 0x07, 0x06, 0x07, + 0x07, 0x03, 0x05, 0x07, 0x04, 0x08, 0x07, 0x07, // h i j k l m n o / 104 - 111 + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x08, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x08, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xc0, 0x80, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7e, 0x7c, + 0x7c, 0x7e, 0x7f, 0x7e, 0x7e, 0x7e, 0x7e, 0x00, + 0x00, 0xfe, 0xfe, 0xfe, 0xfc, 0xfe, 0x7e, 0x3e, + 0x3e, 0x7e, 0xfe, 0x7e, 0x7e, 0x7e, 0x7e, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x1c, 0x20, 0x20, 0x20, 0x1c, 0x00, + 0x04, 0x04, 0x3c, 0x44, 0x44, 0x44, 0x3c, 0x00, + 0x00, 0x00, 0x38, 0x44, 0x78, 0x40, 0x3c, 0x00, + 0x0c, 0x10, 0x38, 0x10, 0x10, 0x10, 0x10, 0x00, + 0x00, 0x00, 0x38, 0x44, 0x44, 0x3c, 0x04, 0x38, + 0x00, 0x00, 0x38, 0x04, 0x3c, 0x44, 0x3c, 0x00, + 0x40, 0x40, 0x78, 0x44, 0x44, 0x44, 0x78, 0x00, + 0x02, 0x02, 0x38, 0x40, 0x40, 0x40, 0x38, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xfc, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x60, 0x00, + 0xcc, 0xcc, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x66, 0x66, 0xff, 0x66, 0xff, 0x66, 0x66, 0x00, + 0x30, 0x7c, 0xc0, 0x78, 0x0c, 0xf8, 0x30, 0x00, + 0xc4, 0xcc, 0x18, 0x30, 0x60, 0xcc, 0x8c, 0x00, + 0x78, 0xcc, 0x78, 0x70, 0xce, 0xcc, 0x7e, 0x00, + 0x60, 0x60, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x30, 0x60, 0xc0, 0xc0, 0xc0, 0x60, 0x30, 0x00, + 0xc0, 0x60, 0x30, 0x30, 0x30, 0x60, 0xc0, 0x00, + 0x00, 0x80, 0xc0, 0xc0, 0xc0, 0xc0, 0x80, 0x00, + 0x66, 0xcc, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0xc0, + 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, + 0x66, 0x66, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, + 0x60, 0xe0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, + 0x78, 0xcc, 0x0c, 0x18, 0x60, 0xc0, 0xfc, 0x00, + 0x78, 0xcc, 0x0c, 0x38, 0x0c, 0xcc, 0x78, 0x00, + 0x0c, 0x1c, 0x2c, 0x4c, 0xfe, 0x0c, 0x0c, 0x00, + 0xfc, 0xc0, 0xf8, 0x0c, 0x0c, 0xcc, 0x78, 0x00, + 0x78, 0xcc, 0xc0, 0xf8, 0xcc, 0xcc, 0x78, 0x00, + 0xfc, 0xcc, 0x18, 0x30, 0x30, 0x30, 0x30, 0x00, + 0x78, 0xcc, 0xcc, 0x78, 0xcc, 0xcc, 0x78, 0x00, + 0x78, 0xcc, 0xcc, 0x7c, 0x0c, 0xcc, 0x78, 0x00, + 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x60, 0x00, + 0x00, 0x00, 0x60, 0x60, 0x00, 0x60, 0x60, 0xc0, + 0x7c, 0xfe, 0xfc, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x3f, 0x61, 0xcc, 0xd0, 0xd0, 0xcc, 0x61, 0x3f, + 0x78, 0xcc, 0x0c, 0x18, 0x30, 0x00, 0x30, 0x00, + 0x00, 0x00, 0x00, 0xf8, 0xf8, 0x00, 0x00, 0x00, + 0x30, 0x78, 0xcc, 0xfc, 0xcc, 0xcc, 0xcc, 0x00, + 0xf8, 0xcc, 0xcc, 0xf8, 0xcc, 0xcc, 0xf8, 0x00, + 0x78, 0xcc, 0xc0, 0xc0, 0xc0, 0xcc, 0x78, 0x00, + 0xf0, 0xd8, 0xcc, 0xcc, 0xcc, 0xd8, 0xf0, 0x00, + 0xfc, 0xc0, 0xc0, 0xf8, 0xc0, 0xc0, 0xfc, 0x00, + 0xfc, 0xc0, 0xc0, 0xf8, 0xc0, 0xc0, 0xc0, 0x00, + 0x78, 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0x4a, 0x48, 0x00, 0x00, 0x00, 0x00, + 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, + 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0xfe, + 0xfe, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0x7c, 0x00, + 0xc0, 0xc0, 0xf8, 0xcc, 0xcc, 0xcc, 0xf8, 0x00, + 0x00, 0x00, 0x78, 0xc0, 0xc0, 0xc0, 0x78, 0x00, + 0x0c, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x7c, 0x00, + 0x00, 0x00, 0x78, 0xcc, 0xfc, 0xc0, 0x78, 0x00, + 0x38, 0x60, 0xf8, 0x60, 0x60, 0x60, 0x60, 0x00, + 0x00, 0x00, 0x78, 0xcc, 0xcc, 0x7c, 0x0c, 0x78, + 0xc0, 0xc0, 0xf8, 0xcc, 0xcc, 0xcc, 0xcc, 0x00, + 0xc0, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, + 0x30, 0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0xe0, + 0xc0, 0xc0, 0xcc, 0xd8, 0xf0, 0xd8, 0xcc, 0x00, + 0xe0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, + 0x00, 0x00, 0xcc, 0xfe, 0xfe, 0xd6, 0xc6, 0x00, + 0x00, 0x00, 0xf8, 0xcc, 0xcc, 0xcc, 0xcc, 0x00, + 0x00, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0x78, 0x00, + 0x00, 0x00, 0xf8, 0xcc, 0xcc, 0xf8, 0xc0, 0xc0, + 0x00, 0x00, 0x7c, 0xcc, 0xcc, 0x7c, 0x0c, 0x0c, + 0x00, 0x00, 0xf8, 0xcc, 0xc0, 0xc0, 0xc0, 0x00, + 0x00, 0x00, 0x7c, 0xc0, 0x78, 0x0c, 0xf8, 0x00, + 0x30, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x1c, 0x00, + 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x00, + 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0x78, 0x30, 0x00, + 0x00, 0x00, 0xc6, 0xd6, 0xfe, 0x7c, 0x6c, 0x00, + 0x00, 0x00, 0xcc, 0x78, 0x30, 0x78, 0xcc, 0x00, + 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0x7c, 0x18, 0x70, + 0x00, 0x00, 0xfc, 0x18, 0x30, 0x60, 0xfc, 0x00, + 0xcc, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0x78, 0x00, + 0xcc, 0x30, 0x78, 0xcc, 0xfc, 0xcc, 0xcc, 0x00, + 0x84, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, + 0x38, 0x6c, 0x6c, 0xf8, 0xcc, 0xcc, 0xf8, 0x80, + 0x08, 0x0c, 0x0e, 0xff, 0xff, 0x0e, 0x0c, 0x08, + 0x0e +}; + +void CharsetRendererV2::setCurID(byte id) { + printf("CharsetRendererV2::setCurID(%d)\n", id); + + _nbChars = charsetDataV2[6]; + _widthTable = charsetDataV2 + 8; + _fontPtr = charsetDataV2 + 8 + _nbChars; +} + +int CharsetRendererV3::getCharWidth(byte chr) { + int spacing = 0; + + spacing = *(_widthTable + chr); + + return spacing; +} + +void CharsetRendererV3::setColor(byte color) { _color = color; if (_vm->_features & GF_16COLOR) { @@ -178,7 +349,7 @@ void CharsetRendererOld256::setColor(byte color) _dropShadow = false; } -void CharsetRendererOld256::printChar(int chr) { +void CharsetRendererV3::printChar(int chr) { // Indy3 / Zak256 / Loom VirtScreen *vs; byte *char_ptr, *dest_ptr, *mask_ptr; diff --git a/scumm/charset.h b/scumm/charset.h index baa4480649..72328c03a8 100644 --- a/scumm/charset.h +++ b/scumm/charset.h @@ -35,7 +35,6 @@ public: int _top; int _left, _startLeft; int _right; - int _nbChars; protected: byte _color; @@ -98,18 +97,29 @@ public: void printChar(int chr); }; -class CharsetRendererOld256 : public CharsetRendererCommon { +class CharsetRendererV3 : public CharsetRendererCommon { protected: + int _nbChars; + byte *_widthTable; + int getCharWidth(byte chr); public: - CharsetRendererOld256(Scumm *vm) : CharsetRendererCommon(vm) {} + CharsetRendererV3(Scumm *vm) : CharsetRendererCommon(vm) {} void printChar(int chr); - + void setCurID(byte id); void setColor(byte color); }; +class CharsetRendererV2 : public CharsetRendererV3 { +public: + CharsetRendererV2(Scumm *vm) : CharsetRendererV3(vm) {} + + void setCurID(byte id); + int getFontHeight() { return 8; } +}; + class CharsetRendererNut : public CharsetRenderer { protected: int getCharWidth(byte chr); diff --git a/scumm/script_v2.cpp b/scumm/script_v2.cpp index ae6ea37aaa..1e7adcee50 100644 --- a/scumm/script_v2.cpp +++ b/scumm/script_v2.cpp @@ -728,31 +728,72 @@ void Scumm_v2::o2_resourceRoutines() { void Scumm_v2::o2_verbOps() { int opcode = fetchScriptByte(); - int slot, state; + int verb, slot, state; switch (opcode) { case 0: // Delete Verb - slot = getVarOrDirectByte(0x80); + verb = getVarOrDirectByte(0x80); + slot = getVerbSlot(verb, 0); + + printf("o2_verbOps delete verb = %d, slot = %d\n", verb, slot); + killVerb(slot); break; case 0xFF: // Verb On/Off - slot = fetchScriptByte(); + verb = fetchScriptByte(); state = fetchScriptByte(); + slot = getVerbSlot(verb, 0); + + printf("o2_verbOps Verb On/Off: verb = %d, slot = %d, state = %d\n", verb, slot, state); + + _verbs[slot].curmode = state; + break; default: { // New Verb - int x = fetchScriptByte(); - int y = fetchScriptByte(); - slot = getVarOrDirectByte(0x80); + int x = fetchScriptByte() << 3; + int y = fetchScriptByte() << 3; + verb = getVarOrDirectByte(0x80); int unk = fetchScriptByte(); // ? - // It follows the verb name printf("o2_verbOps: opcode = %d, x = %d, y = %d, slot = %d, unk = %d, name = %s\n", - opcode, x, y, slot, unk, _scriptPointer); - _scriptPointer += strlen((char *)_scriptPointer) + 1; + opcode, x, y, verb, unk, _scriptPointer); + + VerbSlot *vs; + slot = getVerbSlot(verb, 0); + if (slot == 0) { + for (slot = 1; slot < _maxVerbs; slot++) { + if (_verbs[slot].verbid == 0) + break; + } + if (slot == _maxVerbs) + error("Too many verbs"); + } + vs = &_verbs[slot]; + vs->verbid = verb; + vs->color = 2; + vs->hicolor = 0; + vs->dimcolor = 8; + vs->type = kTextVerbType; + vs->charset_nr = _string[0].t_charset; + vs->curmode = 1; + vs->saveid = 0; + vs->key = 0; + vs->center = 0; + vs->imgindex = 0; + + vs->x = x; + vs->y = y; + + // It follows the verb name + loadPtrToResource(rtVerb, slot, NULL); } break; } + + // FIXME - hack! + drawVerb(slot, 0); + verbMouseOver(0); } void Scumm_v2::o2_doSentence() { diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp index 7fb70eee68..e7fc80fcfd 100644 --- a/scumm/scummvm.cpp +++ b/scumm/scummvm.cpp @@ -664,8 +664,10 @@ void Scumm::scummInit() { setupEGAPalette(); } - if (_features & GF_AFTER_V3) - _charset = new CharsetRendererOld256(this); + if (_features & GF_AFTER_V2) + _charset = new CharsetRendererV2(this); + else if (_features & GF_AFTER_V3) + _charset = new CharsetRendererV3(this); else if (_features & GF_AFTER_V8) _charset = new CharsetRendererNut(this); else |