[Scummvm-cvs-logs] SF.net SVN: scummvm: [29772] scummvm/trunk/engines/lure
dreammaster at users.sourceforge.net
dreammaster at users.sourceforge.net
Sun Dec 9 06:57:09 CET 2007
Revision: 29772
http://scummvm.svn.sourceforge.net/scummvm/?rev=29772&view=rev
Author: dreammaster
Date: 2007-12-08 21:57:08 -0800 (Sat, 08 Dec 2007)
Log Message:
-----------
Added new debug category for string handling
Modified Paths:
--------------
scummvm/trunk/engines/lure/lure.cpp
scummvm/trunk/engines/lure/luredefs.h
scummvm/trunk/engines/lure/strings.cpp
scummvm/trunk/engines/lure/strings.h
scummvm/trunk/engines/lure/surface.cpp
scummvm/trunk/engines/lure/surface.h
Modified: scummvm/trunk/engines/lure/lure.cpp
===================================================================
--- scummvm/trunk/engines/lure/lure.cpp 2007-12-08 18:25:00 UTC (rev 29771)
+++ scummvm/trunk/engines/lure/lure.cpp 2007-12-09 05:57:08 UTC (rev 29772)
@@ -47,6 +47,7 @@
Common::addSpecialDebugLevel(kLureDebugHotspots, "hotspots", "Hotspots debugging");
Common::addSpecialDebugLevel(kLureDebugFights, "fights", "Fights debugging");
Common::addSpecialDebugLevel(kLureDebugSounds, "sounds", "Sounds debugging");
+ Common::addSpecialDebugLevel(kLureDebugStrings, "strings", "Strings debugging");
// Setup mixer
Modified: scummvm/trunk/engines/lure/luredefs.h
===================================================================
--- scummvm/trunk/engines/lure/luredefs.h 2007-12-08 18:25:00 UTC (rev 29771)
+++ scummvm/trunk/engines/lure/luredefs.h 2007-12-09 05:57:08 UTC (rev 29772)
@@ -47,7 +47,8 @@
kLureDebugAnimations = 1 << 1,
kLureDebugHotspots = 1 << 2,
kLureDebugFights = 1 << 3,
- kLureDebugSounds = 1 << 4
+ kLureDebugSounds = 1 << 4,
+ kLureDebugStrings = 1 << 5
};
#define ERROR_BASIC 1
Modified: scummvm/trunk/engines/lure/strings.cpp
===================================================================
--- scummvm/trunk/engines/lure/strings.cpp 2007-12-08 18:25:00 UTC (rev 29771)
+++ scummvm/trunk/engines/lure/strings.cpp 2007-12-09 05:57:08 UTC (rev 29772)
@@ -103,7 +103,6 @@
bool StringData::initPosition(uint16 stringId) {
uint16 roomNumber = Room::getReference().roomNumber();
- byte *stringTable;
if ((roomNumber >= 0x2A) && (stringId >= STRING_ID_RANGE) && (stringId < STRING_ID_UPPER))
stringId = 0x76;
@@ -111,16 +110,16 @@
stringId = 0x76;
if (stringId < STRING_ID_RANGE)
- stringTable = _strings[0]->data();
+ _stringTable = _strings[0]->data();
else if (stringId < STRING_ID_RANGE*2) {
stringId -= STRING_ID_RANGE;
- stringTable = _strings[1]->data();
+ _stringTable = _strings[1]->data();
} else {
stringId -= STRING_ID_RANGE * 2;
- stringTable = _strings[2]->data();
+ _stringTable = _strings[2]->data();
}
- _srcPos = stringTable + 4;
+ _srcPos = _stringTable + 4;
uint32 total = 0;
int numLoops = stringId >> 5;
@@ -131,7 +130,7 @@
numLoops = stringId & 0x1f;
if (numLoops!= 0) {
- byte *tempPtr = stringTable + (stringId & 0xffe0) + READ_LE_UINT16(stringTable);
+ byte *tempPtr = _stringTable + (stringId & 0xffe0) + READ_LE_UINT16(_stringTable);
for (int ctr = 0; ctr < numLoops; ++ctr) {
byte v = *tempPtr++;
@@ -148,7 +147,7 @@
if ((total & 3) != 0)
_bitMask >>= (total & 3) * 2;
- _srcPos = stringTable + (total >> 2) + READ_LE_UINT16(stringTable + 2);
+ _srcPos = _stringTable + (total >> 2) + READ_LE_UINT16(_stringTable + 2);
// Final positioning to start of string
for (;;) {
@@ -172,7 +171,7 @@
// Scan through list for a match
for (int index = 0; _chars[index] != NULL; ++index) {
if ((_chars[index]->_numBits == numBits) &&
- (_chars[index]->_sequence == searchValue))
+ (_chars[index]->_sequence == searchValue))
return _chars[index]->_ascii;
}
}
@@ -184,6 +183,9 @@
void StringData::getString(uint16 stringId, char *dest, const char *hotspotName,
const char *characterName, int hotspotArticle, int characterArticle) {
+ debugC(ERROR_INTERMEDIATE, kLureDebugStrings,
+ "StringData::getString stringId=%xh hotspot=%d,%s character=%d,%s",
+ stringId, hotspotArticle, hotspotName, characterArticle, characterName);
StringList &stringList = Resources::getReference().stringList();
char ch;
strcpy(dest, "");
@@ -192,8 +194,11 @@
if (stringId == 0) return;
bool includeArticles = initPosition(stringId);
+ uint32 charOffset = _srcPos - _stringTable;
+ uint8 charBitMask = _bitMask;
ch = readCharacter();
+
while (ch != '\0') {
if (ch == '%') {
// Copy over hotspot or action
@@ -209,18 +214,29 @@
strcpy(destPos, p);
}
destPos += strlen(destPos);
+
+ debugC(ERROR_DETAILED, kLureDebugStrings, "String data %xh/%.2xh val=%.2xh name=%s",
+ charOffset, charBitMask, ch, p);
}
} else if ((uint8) ch >= 0xa0) {
const char *p = getName((uint8) ch - 0xa0);
strcpy(destPos, p);
destPos += strlen(p);
+ debugC(ERROR_DETAILED, kLureDebugStrings, "String data %xh/%.2xh val=%.2xh sequence='%s'",
+ charOffset, charBitMask, (uint8)ch, p);
} else {
*destPos++ = ch;
+ debugC(ERROR_DETAILED, kLureDebugStrings, "String data %xh/%.2xh val=%.2xh char=%c",
+ charOffset, charBitMask, ch, ch);
}
+ charOffset = _srcPos - _stringTable;
+ charBitMask = _bitMask;
ch = readCharacter();
}
+ debugC(ERROR_DETAILED, kLureDebugStrings, "String data %xh/%.2xh val=%.2xh EOS",
+ charOffset, charBitMask, ch);
*destPos = '\0';
}
Modified: scummvm/trunk/engines/lure/strings.h
===================================================================
--- scummvm/trunk/engines/lure/strings.h 2007-12-08 18:25:00 UTC (rev 29771)
+++ scummvm/trunk/engines/lure/strings.h 2007-12-09 05:57:08 UTC (rev 29772)
@@ -50,6 +50,7 @@
CharacterEntry *_chars[MAX_NUM_CHARS];
uint8 _numChars;
byte *_srcPos;
+ byte *_stringTable;
byte _bitMask;
void add(const char *sequence, char ascii);
Modified: scummvm/trunk/engines/lure/surface.cpp
===================================================================
--- scummvm/trunk/engines/lure/surface.cpp 2007-12-08 18:25:00 UTC (rev 29771)
+++ scummvm/trunk/engines/lure/surface.cpp 2007-12-09 05:57:08 UTC (rev 29772)
@@ -42,7 +42,7 @@
static MemoryBlock *int_font = NULL;
static MemoryBlock *int_dialog_frame = NULL;
static uint8 fontSize[256];
-static int numFontChars;
+int numFontChars;
void Surface::initialise() {
int_font = Disk::getReference().getEntry(FONT_RESOURCE_ID);
@@ -486,6 +486,7 @@
/*--------------------------------------------------------------------------*/
void Dialog::show(const char *text) {
+ debugC(ERROR_BASIC, kLureDebugStrings, "Dialog::show text=%s", text);
Screen &screen = Screen::getReference();
Mouse &mouse = Mouse::getReference();
Room &room = Room::getReference();
@@ -505,6 +506,8 @@
}
void Dialog::show(uint16 stringId, const char *hotspotName, const char *characterName) {
+ debugC(ERROR_BASIC, kLureDebugStrings, "Hotspot::showMessage stringId=%xh hotspot=%s, character=%s",
+ stringId, hotspotName, characterName);
char buffer[MAX_DESC_SIZE];
StringData &sl = StringData::getReference();
Modified: scummvm/trunk/engines/lure/surface.h
===================================================================
--- scummvm/trunk/engines/lure/surface.h 2007-12-08 18:25:00 UTC (rev 29771)
+++ scummvm/trunk/engines/lure/surface.h 2007-12-09 05:57:08 UTC (rev 29772)
@@ -135,6 +135,8 @@
bool show();
};
+extern int numFontChars;
+
} // End of namespace Lure
#endif
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