V2 text drawing

svn-id: r7502
This commit is contained in:
Max Horn 2003-05-14 13:30:52 +00:00
parent 50a857a406
commit bc99915aa5
8 changed files with 73 additions and 29 deletions

View file

@ -1162,6 +1162,8 @@ void Scumm::actorTalk() {
_talkDelay = 0;
_haveMsg = 0xFF;
VAR(VAR_HAVE_MSG) = 0xFF;
if (VAR_CHARCOUNT != 0xFF)
VAR(VAR_CHARCOUNT) = 0;
CHARSET_1();
}

View file

@ -110,6 +110,7 @@ public:
void printChar(int chr);
void setCurID(byte id);
void setColor(byte color);
int getFontHeight() { return 8; }
};
class CharsetRendererV2 : public CharsetRendererV3 {
@ -120,7 +121,6 @@ public:
CharsetRendererV2(Scumm *vm) : CharsetRendererV3(vm) {}
void setCurID(byte id);
int getFontHeight() { return 8; }
};
class CharsetRendererNut : public CharsetRenderer {

View file

@ -376,7 +376,7 @@ void Scumm::drawDirtyScreenParts() {
byte *src;
updateDirtyScreen(2);
if (_features & GF_AFTER_V3)
if (_features & GF_AFTER_V2 || _features & GF_AFTER_V3)
updateDirtyScreen(1);
if (camera._last.x == camera._cur.x && (camera._last.y == camera._cur.y || !(_features & GF_AFTER_V7))) {

View file

@ -395,6 +395,48 @@ void Scumm_v2::decodeParseString() {
*ptr = 0;
printf("TODO: Scumm_v2::decodeParseString(\"%s\") from %d\n", buffer, vm.slot[_currentScript].number);
int textSlot;
if (_actorToPrintStrFor < 128)
textSlot = 0;
else
textSlot = 1;
textSlot = 0;
_string[textSlot].xpos = 0;
_string[textSlot].ypos = 0;
_string[textSlot].right = 320;
_string[textSlot].center = false;
_string[textSlot].overhead = false;
_string[textSlot].color = 13; // HACK, make it pink, just for fun 8-)
_messagePtr = buffer;
switch (textSlot) {
case 0:
actorTalk();
break;
case 1:
drawString(1);
break;
case 2:
unkMessage1();
break;
case 3:
unkMessage2();
break;
}
/*
_string[textSlot].t_xpos = _string[textSlot].xpos;
_string[textSlot].t_ypos = _string[textSlot].ypos;
_string[textSlot].t_center = _string[textSlot].center;
_string[textSlot].t_overhead = _string[textSlot].overhead;
_string[textSlot].t_right = _string[textSlot].right;
_string[textSlot].t_color = _string[textSlot].color;
_string[textSlot].t_charset = _string[textSlot].charset;
*/
}
int Scumm_v2::readVar(uint var) {
@ -752,8 +794,10 @@ void Scumm_v2::o2_verbOps() {
int x = fetchScriptByte() << 3;
int y = fetchScriptByte() << 3;
slot = getVarOrDirectByte(0x80) + 1;
// int unk = fetchScriptByte(); // ?
fetchScriptByte();
/*int unk =*/ fetchScriptByte(); // ?
//printf("o2_verbOps: verb = %d, slot = %d, x = %d, y = %d, unk = %d, name = %s\n",
// verb, slot, x, y, unk, _scriptPointer);
VerbSlot *vs;
assert(0 < slot && slot < _maxVerbs);
@ -774,9 +818,6 @@ void Scumm_v2::o2_verbOps() {
vs->x = x;
vs->y = y;
//printf("o2_verbOps: verb = %d, slot = %d, x = %d, y = %d, unk = %d, name = %s\n",
// verb, slot, x, y, unk, _scriptPointer);
// It follows the verb name
loadPtrToResource(rtVerb, slot, NULL);
}

View file

@ -1091,6 +1091,7 @@ public:
byte VAR_CUTSCENE_START_SCRIPT;
byte VAR_CUTSCENE_END_SCRIPT;
byte VAR_CHARINC;
byte VAR_CHARCOUNT;
byte VAR_WALKTO_OBJ;
byte VAR_DEBUGMODE;
byte VAR_HEAPSPACE;

View file

@ -439,6 +439,7 @@ Scumm::Scumm (GameDetector *detector, OSystem *syst)
VAR_CUTSCENE_START_SCRIPT = 0xFF;
VAR_CUTSCENE_END_SCRIPT = 0xFF;
VAR_CHARINC = 0xFF;
VAR_CHARCOUNT = 0xFF;
VAR_WALKTO_OBJ = 0xFF;
VAR_DEBUGMODE = 0xFF;
VAR_HEAPSPACE = 0xFF;

View file

@ -141,7 +141,7 @@ void Scumm::CHARSET_1() {
_charset->_right = _string[0].right;
_charset->setColor(_charsetColor);
if (!(_features & GF_AFTER_V3)) // FIXME
if (!(_features & GF_AFTER_V2 || _features & GF_AFTER_V3)) // FIXME
for (i = 0; i < 4; i++)
_charsetColorMap[i] = _charsetData[_charset->getCurID()][i];
@ -184,7 +184,7 @@ void Scumm::CHARSET_1() {
_talkDelay = _defaultTalkDelay;
if (!_keepText) {
if (_features & GF_AFTER_V3 && _gameId != GID_LOOM) {
if ((_features & GF_AFTER_V2 || _features & GF_AFTER_V3) && _gameId != GID_LOOM) {
gdi._mask_left = _string[0].xpos;
gdi._mask_top = _string[0].ypos;
gdi._mask_bottom = _string[0].ypos + 8;
@ -224,22 +224,16 @@ void Scumm::CHARSET_1() {
}
if (c == 13) {
newLine:;
if (_features & GF_AFTER_V3) {
_charset->_nextTop += 8;
_charset->_nextLeft = _string[0].xpos;
if (_charset->_center) {
_charset->_nextLeft -= _charset->getStringWidth(0, buffer) >> 1;
}
continue;
} else {
_charset->_nextLeft = _string[0].xpos;
if (_charset->_center) {
_charset->_nextLeft -= _charset->getStringWidth(0, buffer) >> 1;
}
_charset->_nextTop += _charset->getFontHeight();
if (!(_features & GF_AFTER_V2 || _features & GF_AFTER_V3)) {
// FIXME - is this really needed?
_charset->_disableOffsX = true;
continue;
}
continue;
}
if (c == 0xFE)
@ -248,7 +242,7 @@ void Scumm::CHARSET_1() {
if (c != 0xFF) {
_charset->_left = _charset->_nextLeft;
_charset->_top = _charset->_nextTop;
if (_features & GF_AFTER_V3) {
if (_features & GF_AFTER_V2 || _features & GF_AFTER_V3) {
_charset->printChar(c);
} else if (_features & GF_AFTER_V6) {
if (!_noSubtitles || (_haveMsg != 0xFE && _haveMsg != 0xFF))
@ -260,6 +254,10 @@ void Scumm::CHARSET_1() {
_charset->_nextLeft = _charset->_left;
_charset->_nextTop = _charset->_top;
if (_features & GF_AFTER_V2) {
_talkDelay += _defaultTalkDelay / 20;
VAR(VAR_CHARCOUNT)++;
} else
_talkDelay += (int)VAR(VAR_CHARINC);
continue;
}
@ -410,12 +408,12 @@ void Scumm::drawString(int a) {
_charset->_disableOffsX = _charset->_firstChar = true;
_charset->setCurID(_string[a].charset);
if (!(_features & GF_AFTER_V3)) {
if (!(_features & GF_AFTER_V2 || _features & GF_AFTER_V3)) {
for (i = 0; i < 4; i++)
_charsetColorMap[i] = _charsetData[_charset->getCurID()][i];
}
fontHeight = _charset->getFontHeight();
}
_msgPtrToAdd = buf;

View file

@ -105,6 +105,7 @@ void Scumm_v2::setupScummVars() {
VAR_ROOM = 4;
VAR_OVERRIDE = 5;
VAR_MACHINE_SPEED = 6;
VAR_CHARCOUNT = 7;
VAR_NUM_ACTOR = 11;
VAR_CURRENT_LIGHTS = 12;
VAR_CURRENTDRIVE = 13;