[Scummvm-cvs-logs] CVS: scummvm/queen graphics.cpp,1.26,1.27 graphics.h,1.23,1.24 cutaway.cpp,1.31,1.32 cutaway.h,1.14,1.15
David Eriksson
twogood at users.sourceforge.net
Sat Oct 18 05:49:16 CEST 2003
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/queen talk.cpp,1.15,1.16 talk.h,1.10,1.11 graphics.cpp,1.25,1.26 graphics.h,1.22,1.23 xref.txt,1.11,1.12
- Next message: [Scummvm-cvs-logs] CVS: scummvm/sound mididrv.h,1.30,1.31
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/queen
In directory sc8-pr-cvs1:/tmp/cvs-serv6095
Modified Files:
graphics.cpp graphics.h cutaway.cpp cutaway.h
Log Message:
Handle cutaway text.
Index: graphics.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/graphics.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- graphics.cpp 18 Oct 2003 12:18:43 -0000 1.26
+++ graphics.cpp 18 Oct 2003 12:48:05 -0000 1.27
@@ -909,5 +909,10 @@
textSet(lineX, y + 9 * i, lines[i]);
}
}
+
+int Graphics::textCenterX(const char *text) const {
+ return 160 - textWidth(text) / 2;
+}
+
} // End of namespace Queen
Index: graphics.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/graphics.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- graphics.h 18 Oct 2003 12:18:43 -0000 1.23
+++ graphics.h 18 Oct 2003 12:48:05 -0000 1.24
@@ -148,7 +148,8 @@
void textSetCentered(uint16 y, const char *text, bool outlined = true);
void textDrawAll(); // drawtext()
void textClear(uint16 y1, uint16 y2); // blanktexts()
- uint16 textWidth(const char* text) const; // textlen()
+ uint16 textWidth(const char *text) const; // textlen()
+ int textCenterX(const char *text) const; // MIDDLE()
void frameErase(uint32 fslot);
void frameEraseAll(bool joe); // freeframes, freeallframes
Index: cutaway.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/cutaway.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- cutaway.cpp 18 Oct 2003 11:46:51 -0000 1.31
+++ cutaway.cpp 18 Oct 2003 12:48:05 -0000 1.32
@@ -632,6 +632,8 @@
if (object.animType == 1) {
// lines 1615-1636 in cutaway.c
+
+ debug(0, "----- Not normal cutaway animation (animType = %i) -----", object.animType);
if (/*(P_BNUM==1) &&*/ (_logic->currentRoom() == 47 || _logic->currentRoom() == 63)) {
// The oracle
@@ -678,6 +680,9 @@
if (object.animType != 1) {
// lines 1657-1761 in cutaway.c
+
+ debug(0, "----- Normal cutaway animation (animType = %i) -----", object.animType);
+
for (i = 0; i < frameCount; i++) {
BobSlot *bob = _graphics->bob(objAnim[i].object);
bob->active = true;
@@ -911,6 +916,12 @@
// Do nothing?
break;
+ case OBJECT_TYPE_TEXT_SPEAK:
+ case OBJECT_TYPE_TEXT_DISPLAY_AND_SPEAK:
+ case OBJECT_TYPE_TEXT_DISPLAY:
+ handleText(objectType, object, sentence);
+ break;
+
default:
warning("Unhandled object type: %i", objectType);
break;
@@ -1182,7 +1193,6 @@
// Lines 2119-2131 in cutaway.c
if (0 == scumm_stricmp(right(_talkFile, 4), ".dog")) {
- warning("Cutaway::talk() used but not fully implemented");
nextFilename[0] = '\0';
Talk::talk(_talkFile, 0 /* XXX */, nextFilename, _graphics, _logic, _resource);
@@ -1226,6 +1236,75 @@
_graphics->bobAnimString(bobNum, cutAnim[bobNum]);
return currentImage + 1;
+}
+
+void Cutaway::handleText(
+ ObjectType type,
+ CutawayObject &object,
+ const char *sentence) {
+ // lines 1776-1863 in cutaway.c
+
+ debug(0, "----- Write '%s' ----", sentence);
+
+ int spaces = countSpaces(type, sentence);
+
+ int x;
+ int flags;
+
+ if (OBJECT_TYPE_TEXT_DISPLAY == type) {
+ x = _graphics->textCenterX(sentence);
+ flags = 2;
+ }
+ else {
+ x = object.moveToX;
+ flags = 1;
+ }
+
+ BobSlot *bob =
+ _graphics->bob( _logic->findBob(abs(object.objectNumber)) );
+
+ _graphics->bobSetText(bob, sentence, x, object.moveToY, object.specialMove, flags);
+
+ if (OBJECT_TYPE_TEXT_SPEAK == type || OBJECT_TYPE_TEXT_DISPLAY_AND_SPEAK == type) {
+ // XXX: speak
+ }
+
+ int i;
+ for (i = 0; i < spaces; i++) {
+ _graphics->update();
+
+ if (OBJECT_TYPE_TEXT_SPEAK == type || OBJECT_TYPE_TEXT_DISPLAY_AND_SPEAK == type) {
+ // XXX: see if speaking is finished
+ }
+
+ if (_quit)
+ break;
+
+// XXX if(KEYVERB==101) {
+// XXX KEYVERB=0;
+// XXX break;
+// XXX }
+
+ }
+
+ _graphics->textClear(0,198);
+ _graphics->update();
+}
+
+int Cutaway::countSpaces(ObjectType type, const char *segment) {
+ int tmp = 0;
+
+ while (*segment++)
+ tmp++;
+
+ if (tmp < 10)
+ tmp = 10;
+
+ if (OBJECT_TYPE_TEXT_DISPLAY == type)
+ tmp *= 3;
+
+ return (tmp * 2) / _logic->talkSpeed();
+
}
} // End of namespace Queen
Index: cutaway.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/cutaway.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- cutaway.h 18 Oct 2003 11:46:51 -0000 1.14
+++ cutaway.h 18 Oct 2003 12:48:05 -0000 1.15
@@ -242,6 +242,12 @@
int index,
CutawayObject &object,
const char *sentence);
+
+ //! Perform text actions
+ void handleText(
+ ObjectType type,
+ CutawayObject &object,
+ const char *sentence);
//! Restore QueenLogic::_objectData from _personData
void restorePersonData();
@@ -269,6 +275,9 @@
//! Dump a CutawayObject with debug()
void dumpCutawayObject(int index, CutawayObject &object);
+
+ //! Used by handleText()
+ int countSpaces(ObjectType type, const char *segment);
//! Dump CutawayAnum data with debug()
static void dumpCutawayAnim(CutawayAnim &anim);
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/queen talk.cpp,1.15,1.16 talk.h,1.10,1.11 graphics.cpp,1.25,1.26 graphics.h,1.22,1.23 xref.txt,1.11,1.12
- Next message: [Scummvm-cvs-logs] CVS: scummvm/sound mididrv.h,1.30,1.31
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list