[Scummvm-cvs-logs] SF.net SVN: scummvm:[47931] scummvm/trunk/engines/sci
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Sat Feb 6 17:13:17 CET 2010
Revision: 47931
http://scummvm.svn.sourceforge.net/scummvm/?rev=47931&view=rev
Author: thebluegr
Date: 2010-02-06 16:12:19 +0000 (Sat, 06 Feb 2010)
Log Message:
-----------
Added a sanity check for kListAt and made the hack for displaying text work in SCI2 only
Modified Paths:
--------------
scummvm/trunk/engines/sci/engine/klists.cpp
scummvm/trunk/engines/sci/graphics/frameout.cpp
Modified: scummvm/trunk/engines/sci/engine/klists.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/klists.cpp 2010-02-06 15:58:59 UTC (rev 47930)
+++ scummvm/trunk/engines/sci/engine/klists.cpp 2010-02-06 16:12:19 UTC (rev 47931)
@@ -473,6 +473,10 @@
List *list = s->_segMan->lookupList(argv[0]);
reg_t curAddress = list->first;
+ if (list->first.isNull()) {
+ warning("kListAt tried to reference empty list (%04x:%04x)", PRINT_REG(argv[0]));
+ return NULL_REG;
+ }
Node *curNode = s->_segMan->lookupNode(curAddress);
reg_t curObject = curNode->value;
int16 listIndex = argv[1].toUint16();
Modified: scummvm/trunk/engines/sci/graphics/frameout.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/frameout.cpp 2010-02-06 15:58:59 UTC (rev 47930)
+++ scummvm/trunk/engines/sci/graphics/frameout.cpp 2010-02-06 16:12:19 UTC (rev 47931)
@@ -233,26 +233,29 @@
// Most likely a text entry
// This draws text the "SCI0-SCI11" way. In SCI2, text is prerendered in kCreateTextBitmap
// TODO: rewrite this the "SCI2" way (i.e. implement the text buffer to draw inside kCreateTextBitmap)
- Kernel *kernel = ((SciEngine *)g_engine)->getKernel();
- if (lookup_selector(_segMan, itemEntry->object, kernel->_selectorCache.text, NULL, NULL) == kSelectorVariable) {
- Common::String text = _segMan->getString(GET_SEL32(_segMan, itemEntry->object, SELECTOR(text)));
- int16 fontRes = GET_SEL32V(_segMan, itemEntry->object, SELECTOR(font));
- GfxFont *font = new GfxFont(_resMan, _screen, fontRes);
- bool dimmed = GET_SEL32V(_segMan, itemEntry->object, SELECTOR(dimmed));
- uint16 foreColor = GET_SEL32V(_segMan, itemEntry->object, SELECTOR(fore));
- uint16 curX = itemEntry->x;
- uint16 curY = itemEntry->y;
- for (uint32 i = 0; i < text.size(); i++) {
- // TODO: proper text splitting... this is a hack
- if ((text[i] == ' ' && i > 0 && text[i - i] == ' ') || text[i] == '\n' ||
- (curX + font->getCharWidth(text[i]) > _screen->getWidth())) {
- curY += font->getCharHeight('A');
- curX = itemEntry->x;
+ // This doesn't work for SCI2.1 games...
+ if (getSciVersion() == SCI_VERSION_2) {
+ Kernel *kernel = ((SciEngine *)g_engine)->getKernel();
+ if (lookup_selector(_segMan, itemEntry->object, kernel->_selectorCache.text, NULL, NULL) == kSelectorVariable) {
+ Common::String text = _segMan->getString(GET_SEL32(_segMan, itemEntry->object, SELECTOR(text)));
+ int16 fontRes = GET_SEL32V(_segMan, itemEntry->object, SELECTOR(font));
+ GfxFont *font = new GfxFont(_resMan, _screen, fontRes);
+ bool dimmed = GET_SEL32V(_segMan, itemEntry->object, SELECTOR(dimmed));
+ uint16 foreColor = GET_SEL32V(_segMan, itemEntry->object, SELECTOR(fore));
+ uint16 curX = itemEntry->x;
+ uint16 curY = itemEntry->y;
+ for (uint32 i = 0; i < text.size(); i++) {
+ // TODO: proper text splitting... this is a hack
+ if ((text[i] == ' ' && i > 0 && text[i - i] == ' ') || text[i] == '\n' ||
+ (curX + font->getCharWidth(text[i]) > _screen->getWidth())) {
+ curY += font->getCharHeight('A');
+ curX = itemEntry->x;
+ }
+ font->draw(text[i], curY, curX, foreColor, dimmed);
+ curX += font->getCharWidth(text[i]);
}
- font->draw(text[i], curY, curX, foreColor, dimmed);
- curX += font->getCharWidth(text[i]);
+ delete font;
}
- delete font;
}
}
listIterator++;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list