aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2003-01-16 00:40:19 +0000
committerMax Horn2003-01-16 00:40:19 +0000
commit8ad002b3a3f7d45d6056729c94b5fd4acdc24a9f (patch)
treef79236ce3ab9645e506eb5b37a914f81d200b654
parentec006a4357a7aec841164ed1207f38cd03f540b1 (diff)
downloadscummvm-rg350-8ad002b3a3f7d45d6056729c94b5fd4acdc24a9f.tar.gz
scummvm-rg350-8ad002b3a3f7d45d6056729c94b5fd4acdc24a9f.tar.bz2
scummvm-rg350-8ad002b3a3f7d45d6056729c94b5fd4acdc24a9f.zip
first blastText version. this is work in progress (note that e.g. text is not clipped, and the extra information is not removed)
svn-id: r6472
-rw-r--r--scumm/object.cpp12
-rw-r--r--scumm/script_v6.cpp4
-rw-r--r--scumm/script_v8.cpp141
-rw-r--r--scumm/scumm.h24
-rw-r--r--scumm/scummvm.cpp2
-rw-r--r--scumm/string.cpp20
6 files changed, 127 insertions, 76 deletions
diff --git a/scumm/object.cpp b/scumm/object.cpp
index 500b14c0ea..600c176ed1 100644
--- a/scumm/object.cpp
+++ b/scumm/object.cpp
@@ -1271,12 +1271,12 @@ void Scumm::enqueueObject(int objectNumber, int objectX, int objectY, int object
BlastObject *eo;
ObjectData *od;
- if (_enqueuePos == sizeof(_enqueuedObjects) / sizeof(_enqueuedObjects[0])) {
+ if (_blastObjectQueuePos == sizeof(_blastObjectQueue) / sizeof(_blastObjectQueue[0])) {
warning("enqueueObject: overflow");
return;
}
- eo = &_enqueuedObjects[_enqueuePos++];
+ eo = &_blastObjectQueue[_blastObjectQueuePos++];
eo->number = objectNumber;
eo->posX = objectX + (camera._cur.x & 7);
eo->posY = objectY + (camera._cur.y - (_realHeight / 2));
@@ -1305,8 +1305,8 @@ void Scumm::drawBlastObjects()
BlastObject *eo;
int i;
- eo = _enqueuedObjects;
- for (i = 0; i < _enqueuePos; i++, eo++) {
+ eo = _blastObjectQueue;
+ for (i = 0; i < _blastObjectQueuePos; i++, eo++) {
drawBlastObject(eo);
}
}
@@ -1568,8 +1568,8 @@ void Scumm::removeBlastObjects()
BlastObject *eo;
int i;
- eo = _enqueuedObjects;
- for (i = 0; i < _enqueuePos; i++, eo++) {
+ eo = _blastObjectQueue;
+ for (i = 0; i < _blastObjectQueuePos; i++, eo++) {
removeBlastObject(eo);
}
diff --git a/scumm/script_v6.cpp b/scumm/script_v6.cpp
index 9993452da9..d60e7b45f3 100644
--- a/scumm/script_v6.cpp
+++ b/scumm/script_v6.cpp
@@ -2294,8 +2294,8 @@ void Scumm_v6::o6_printActor()
void Scumm_v6::o6_printEgo()
{
- push(_vars[VAR_EGO]);
- decodeParseString(0, 1);
+ _actorToPrintStrFor = _vars[VAR_EGO];
+ decodeParseString(0, 0);
}
void Scumm_v6::o6_talkActor()
diff --git a/scumm/script_v8.cpp b/scumm/script_v8.cpp
index 6582948a21..0ba17d5d0b 100644
--- a/scumm/script_v8.cpp
+++ b/scumm/script_v8.cpp
@@ -199,7 +199,7 @@ void Scumm_v8::setupOpcodes()
OPCODE(o6_dummy), // O_RETURN boils down to a NOP
OPCODE(o6_startObjectEx),
/* 80 */
- OPCODE(o6_stopObjectScript), // FIXME - is this right?
+ OPCODE(o6_stopObjectScript),
OPCODE(o6_cutscene),
OPCODE(o6_endCutscene),
OPCODE(o6_freezeUnfreeze),
@@ -236,7 +236,7 @@ void Scumm_v8::setupOpcodes()
/* 9C */
OPCODE(o8_cursorCommand),
OPCODE(o6_loadRoom),
- OPCODE(o6_loadRoomWithEgo), // FIXME - this is a pure guess
+ OPCODE(o6_loadRoomWithEgo),
OPCODE(o6_walkActorToObj),
/* A0 */
OPCODE(o6_walkActorTo),
@@ -249,7 +249,7 @@ void Scumm_v8::setupOpcodes()
OPCODE(o6_pickupObject),
OPCODE(o6_setBoxFlags),
/* A8 */
- OPCODE(o6_createBoxMatrix), // fixme?
+ OPCODE(o6_createBoxMatrix),
OPCODE(o6_invalid),
OPCODE(o8_resourceRoutines),
OPCODE(o8_roomOps),
@@ -289,7 +289,7 @@ void Scumm_v8::setupOpcodes()
OPCODE(o6_invalid),
OPCODE(o6_invalid),
/* C8 */
- OPCODE(o6_startScriptQuick), // FIXME - this function returns something in V8 !
+ OPCODE(o6_startScriptQuick),
OPCODE(o6_startObjectQuick),
OPCODE(o6_pickOneOf),
OPCODE(o6_pickOneOfDefault),
@@ -299,7 +299,7 @@ void Scumm_v8::setupOpcodes()
OPCODE(o6_getRandomNumber),
OPCODE(o6_getRandomNumberRange),
/* D0 */
- OPCODE(o6_ifClassOfIs), // FIXME - this is a guess
+ OPCODE(o6_ifClassOfIs),
OPCODE(o6_getState),
OPCODE(o6_getOwner),
OPCODE(o6_isScriptRunning),
@@ -331,7 +331,7 @@ void Scumm_v8::setupOpcodes()
/* E8 */
OPCODE(o6_getActorElevation),
OPCODE(o6_getActorWidth),
- OPCODE(o6_getObjectNewDir), // FIXME: is this right?
+ OPCODE(o6_getObjectNewDir),
OPCODE(o6_getObjectX),
/* EC */
OPCODE(o6_getObjectY),
@@ -460,6 +460,7 @@ void Scumm_v8::writeVar(uint var, int value)
void Scumm_v8::decodeParseString(int m, int n)
{
byte b;
+ bool containsSpeech;
b = fetchScriptByte();
@@ -468,7 +469,7 @@ void Scumm_v8::decodeParseString(int m, int n)
setStringVars(m);
if (n)
_actorToPrintStrFor = pop();
- return;
+ break;
case 0xC9:
_string[m].t_xpos = _string[m].xpos;
_string[m].t_ypos = _string[m].ypos;
@@ -478,7 +479,7 @@ void Scumm_v8::decodeParseString(int m, int n)
_string[m].t_right = _string[m].right;
_string[m].t_color = _string[m].color;
_string[m].t_charset = _string[m].charset;
- return;
+ break;
case 0xCA:
_string[m].ypos = pop();
_string[m].xpos = pop();
@@ -491,11 +492,8 @@ void Scumm_v8::decodeParseString(int m, int n)
_string[m].center = true;
_string[m].overhead = false;
break;
- case 0xCD: { // SO_PRINT_CHARSET Set print character set
- // FIXME - TODO
- int charset = pop();
- _string[m].charset = charset;
- }
+ case 0xCD: // SO_PRINT_CHARSET Set print character set
+ _string[m].charset = pop();
break;
case 0xCE:
_string[m].center = false;
@@ -511,8 +509,10 @@ void Scumm_v8::decodeParseString(int m, int n)
break;
case 0xD1:
_messagePtr = _scriptPointer;
+
+ containsSpeech = (_messagePtr[0] == '/');
- if (_messagePtr[0] == '/') {
+ if (containsSpeech) {
char pointer[20];
int i, j;
@@ -530,40 +530,32 @@ void Scumm_v8::decodeParseString(int m, int n)
// _sound->_talkChannel = _sound->playBundleSound(pointer);
_messagePtr = _transText;
-
- switch (m) {
- case 0:
- actorTalk();
- break;
- case 1:
- drawString(1);
- break;
- case 2:
- unkMessage1();
- break;
- case 3:
- unkMessage2();
- break;
- }
- return;
- } else {
- switch (m) {
- case 0:
- actorTalk();
- break;
- case 1:
- drawString(1);
- break;
- case 2:
- unkMessage1();
- break;
- case 3:
- unkMessage2();
- break;
+ }
+
+ switch (m) {
+ case 0:
+ actorTalk();
+ break;
+ case 1:
+ drawString(1);
+ break;
+ case 2:
+ unkMessage1();
+ break;
+ case 3:
+ unkMessage2();
+ break;
+ case 5:{
+ byte buffer[256];
+ _msgPtrToAdd = buffer;
+ _messagePtr = addMessageToStack(_messagePtr);
+ enqueueText(buffer, _string[m].xpos, _string[m].ypos, _string[m].color, _string[m].charset, _string[m].center);
}
- _scriptPointer = _messagePtr;
- return;
+ break;
}
+
+ if (!containsSpeech)
+ _scriptPointer = _messagePtr;
break;
// case 0xD2: // SO_PRINT_WRAP Set print wordwrap
// error("decodeParseString: SO_PRINT_MUMBLE");
@@ -573,6 +565,56 @@ void Scumm_v8::decodeParseString(int m, int n)
}
}
+void Scumm::enqueueText(byte *text, int x, int y, byte color, byte charset, bool center)
+{
+ BlastText &bt = _blastTextQueue[_blastTextQueuePos++];
+ assert(_blastTextQueuePos <= 8);
+
+ strcpy((char *)bt.text, (const char *)text);
+ bt.xpos = x;
+ bt.ypos = y;
+ bt.color = color;
+ bt.charset = charset;
+ bt.center = center;
+}
+
+void Scumm::drawBlastTexts()
+{
+ // FIXME
+
+ byte *buf;
+ byte c;
+ int i;
+
+ _charset->_ignoreCharsetMask = true;
+ for (i = 0; i < _blastTextQueuePos; i++) {
+
+ buf = _blastTextQueue[i].text;
+
+ _charset->_top = _blastTextQueue[i].ypos;
+ _charset->_startLeft = _charset->_left = _blastTextQueue[i].xpos;
+ _charset->_right = _realWidth - 1;
+ _charset->_center = _blastTextQueue[i].center;
+ _charset->_color = _blastTextQueue[i].color;
+ _charset->_disableOffsX = _charset->_firstChar = true;
+ _charset->setCurID(_blastTextQueue[i].charset);
+ _charset->_nextLeft = _blastTextQueue[i].xpos;
+ _charset->_nextTop = _blastTextQueue[i].ypos;
+
+ do {
+ c = *buf++;
+ if (c != 0 && c != 0xFF) {
+ _charset->_left = _charset->_nextLeft;
+ _charset->_top = _charset->_nextTop;
+ _charset->printChar(c);
+ _charset->_nextLeft = _charset->_left;
+ _charset->_nextTop = _charset->_top;
+ }
+ } while (c);
+ }
+ _charset->_ignoreCharsetMask = false;
+}
+
void Scumm_v8::o8_mod()
{
int a = pop();
@@ -732,7 +774,7 @@ void Scumm_v8::o8_arrayOps()
void Scumm_v8::o8_blastText()
{
// FIXME
- decodeParseString(1, 0);
+ decodeParseString(5, 0);
}
void Scumm_v8::o8_cursorCommand()
@@ -1261,7 +1303,6 @@ void Scumm_v8::o8_verbOps()
case 0xA6: // SO_VERB_CHARSET Choose charset for verb
// FIXME - TODO
vs->charset_nr = pop();
- //printf("Set to charset %d\n", vs->charset_nr);
break;
case 0xA7: // SO_VERB_LINE_SPACING Choose linespacing for verb
// FIXME - TODO
@@ -1478,8 +1519,8 @@ void Scumm_v8::o8_kernelGetFunctions()
int y = args[2] + (camera._cur.y - (_realHeight /2));;
BlastObject *eo;
- for (int i = _enqueuePos; i >= 0; i--) {
- eo = &_enqueuedObjects[i];
+ for (int i = _blastObjectQueuePos; i >= 0; i--) {
+ eo = &_blastObjectQueue[i];
if (eo->posX <= x && eo->width + eo->posX > x &&
eo->posY <= y && eo->height + eo->posY > y) {
diff --git a/scumm/scumm.h b/scumm/scumm.h
index bbd7dff6c4..2e08a0dbda 100644
--- a/scumm/scumm.h
+++ b/scumm/scumm.h
@@ -113,7 +113,15 @@ struct NestedScript {
uint8 where;
uint8 slot;
};
-
+
+struct BlastText {
+ int16 xpos, ypos;
+ byte color;
+ byte charset;
+ bool center;
+ byte text[256];
+};
+
enum ResTypes {
rtFirst = 1,
rtRoom = 1,
@@ -792,12 +800,20 @@ public:
uint _shakeFrame;
int _screenStartStrip, _screenEndStrip;
int _screenLeft, _screenTop;
- int _enqueuePos;
- BlastObject _enqueuedObjects[128];
+
+ int _blastObjectQueuePos;
+ BlastObject _blastObjectQueue[128];
+
+ int _blastTextQueuePos;
+ BlastText _blastTextQueue[8]; // FIXME - how many blast texts can there be at once?
+
+ void enqueueText(byte *text, int x, int y, byte color, byte charset, bool center);
+ void drawBlastTexts();
+ void removeBlastTexts() { _blastTextQueuePos = 0; }
void enqueueObject(int objectNumber, int objectX, int objectY, int objectWidth,
int objectHeight, int scaleX, int scaleY, int image, int mode);
- void clearEnqueue() { _enqueuePos = 0; }
+ void clearEnqueue() { _blastObjectQueuePos = 0; }
void drawBlastObjects();
void drawBlastObject(BlastObject *eo);
void removeBlastObjects();
diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp
index 9e2ef68312..f9c98be758 100644
--- a/scumm/scummvm.cpp
+++ b/scumm/scummvm.cpp
@@ -558,8 +558,10 @@ int Scumm::scummLoop(int delta)
}
drawBlastObjects();
+ drawBlastTexts();
drawDirtyScreenParts();
removeBlastObjects();
+ removeBlastTexts();
if (!(_features & GF_AFTER_V6))
playActorSounds();
diff --git a/scumm/string.cpp b/scumm/string.cpp
index 2ac56d03eb..a044ecf0e7 100644
--- a/scumm/string.cpp
+++ b/scumm/string.cpp
@@ -374,19 +374,15 @@ void Scumm::description()
do {
c = *buf++;
- if (c == 0) {
- _haveMsg = 1;
- break;
- }
- if (c != 0xFF) {
+ if (c != 0 && c != 0xFF) {
_charset->_left = _charset->_nextLeft;
_charset->_top = _charset->_nextTop;
_charset->printChar(c);
_charset->_nextLeft = _charset->_left;
_charset->_nextTop = _charset->_top;
- continue;
}
- } while (1);
+ } while (c);
+ _haveMsg = 1;
gdi._mask_left = _charset->_strLeft;
gdi._mask_right = _charset->_strRight;
@@ -423,19 +419,15 @@ void Scumm::drawDescString(byte *msg)
do {
c = *buf++;
- if (c == 0) {
- _haveMsg = 1;
- break;
- }
- if (c != 0xFF) {
+ if (c != 0 && c != 0xFF) {
_charset->_left = _charset->_nextLeft;
_charset->_top = _charset->_nextTop;
_charset->printChar(c);
_charset->_nextLeft = _charset->_left;
_charset->_nextTop = _charset->_top;
- continue;
}
- } while (1);
+ } while (c);
+ _haveMsg = 1;
gdi._mask_left = _charset->_strLeft;
gdi._mask_right = _charset->_strRight;