[Scummvm-cvs-logs] SF.net SVN: scummvm:[36065] scummvm/trunk
Kirben at users.sourceforge.net
Kirben at users.sourceforge.net
Mon Jan 26 05:22:19 CET 2009
Revision: 36065
http://scummvm.svn.sourceforge.net/scummvm/?rev=36065&view=rev
Author: Kirben
Date: 2009-01-26 04:22:19 +0000 (Mon, 26 Jan 2009)
Log Message:
-----------
Add support for text compression in the AtariST version of Elvira 1.
Modified Paths:
--------------
scummvm/trunk/README
scummvm/trunk/engines/agos/agos.cpp
scummvm/trunk/engines/agos/agos.h
scummvm/trunk/engines/agos/detection_tables.h
scummvm/trunk/engines/agos/string.cpp
Modified: scummvm/trunk/README
===================================================================
--- scummvm/trunk/README 2009-01-25 18:12:18 UTC (rev 36064)
+++ scummvm/trunk/README 2009-01-26 04:22:19 UTC (rev 36065)
@@ -670,6 +670,14 @@
Broken Sword 2:
- PlayStation 1 version isn't supported
+ Elvira - Mistress of the Dark
+ - No music in the AtariST version
+
+ Elvira II - The Jaws of Cerberus
+ - No music in the AtariST version
+ - No sound effects in the PC version
+ - Palette issues in the AtariST version
+
Inherit the Earth: Quest for the Orb
- Amiga versions aren't supported
Modified: scummvm/trunk/engines/agos/agos.cpp
===================================================================
--- scummvm/trunk/engines/agos/agos.cpp 2009-01-25 18:12:18 UTC (rev 36064)
+++ scummvm/trunk/engines/agos/agos.cpp 2009-01-26 04:22:19 UTC (rev 36065)
@@ -427,6 +427,16 @@
memset(_fcsData1, 0, sizeof(_fcsData1));
memset(_fcsData2, 0, sizeof(_fcsData2));
+ _awaitTwoByteToken = 0;
+ _byteTokens = 0;
+ _byteTokenStrings = 0;
+ _twoByteTokens = 0;
+ _twoByteTokenStrings = 0;
+ _secondTwoByteTokenStrings = 0;
+ _thirdTwoByteTokenStrings = 0;
+ memset(_textBuffer, 0, sizeof(_textBuffer));
+ _textCount = 0;
+
_freeStringSlot = 0;
memset(_stringReturnBuffer, 0, sizeof(_stringReturnBuffer));
Modified: scummvm/trunk/engines/agos/agos.h
===================================================================
--- scummvm/trunk/engines/agos/agos.h 2009-01-25 18:12:18 UTC (rev 36064)
+++ scummvm/trunk/engines/agos/agos.h 2009-01-26 04:22:19 UTC (rev 36065)
@@ -486,6 +486,16 @@
TextLocation _textLocation1, _textLocation2, _textLocation3, _textLocation4;
+ byte _awaitTwoByteToken;
+ byte *_byteTokens;
+ byte *_byteTokenStrings;
+ byte *_twoByteTokens;
+ byte *_twoByteTokenStrings;
+ byte *_secondTwoByteTokenStrings;
+ byte *_thirdTwoByteTokenStrings;
+ byte _textBuffer[180];
+ int _textCount;
+
int _freeStringSlot;
byte _stringReturnBuffer[2][180];
@@ -658,6 +668,9 @@
Item *me();
Item *actor();
+ void uncompressText(byte *ptr);
+ byte *uncompressToken(byte a, byte *ptr);
+
void showMessageFormat(const char *s, ...);
const byte *getStringPtrByID(uint16 stringId, bool upperCase = false);
const byte *getLocalStringByID(uint16 stringId);
Modified: scummvm/trunk/engines/agos/detection_tables.h
===================================================================
--- scummvm/trunk/engines/agos/detection_tables.h 2009-01-25 18:12:18 UTC (rev 36064)
+++ scummvm/trunk/engines/agos/detection_tables.h 2009-01-26 04:22:19 UTC (rev 36065)
@@ -152,7 +152,7 @@
GF_OLD_BUNDLE | GF_CRUNCHED | GF_PLANAR
},
- // Elvira 1 - French Atari ST Floppy
+ // Elvira 1 - English Atari ST Floppy alternative?
{
{
"elvira1",
@@ -164,7 +164,7 @@
{ "tbllist", GAME_TBLFILE, "5b6ff494bf7e24213758598ef4ac0a8b", 476},
{ NULL, 0, NULL, 0}
},
- Common::FR_FRA,
+ Common::EN_ANY,
Common::kPlatformAtariST,
Common::ADGF_NO_FLAGS
},
Modified: scummvm/trunk/engines/agos/string.cpp
===================================================================
--- scummvm/trunk/engines/agos/string.cpp 2009-01-25 18:12:18 UTC (rev 36064)
+++ scummvm/trunk/engines/agos/string.cpp 2009-01-26 04:22:19 UTC (rev 36065)
@@ -32,21 +32,107 @@
namespace AGOS {
+void AGOSEngine::uncompressText(byte *ptr) {
+ byte a;
+ while (1) {
+ if (_awaitTwoByteToken != 0)
+ a = _awaitTwoByteToken;
+ else
+ a = *ptr++;
+ if (a == 0)
+ return;
+ ptr = uncompressToken(a, ptr);
+ if (ptr == 0)
+ return;
+ }
+}
+
+byte *AGOSEngine::uncompressToken(byte a, byte *ptr) {
+ byte *ptr1;
+ byte *ptr2;
+ byte b;
+ int count1 = 0;
+
+ if (a == 0xFF || a == 0xFE || a == 0xFD) {
+ if (a == 0xFF)
+ ptr2 = _twoByteTokenStrings;
+ if (a == 0xFE)
+ ptr2 = _secondTwoByteTokenStrings;
+ if (a == 0xFD)
+ ptr2 = _thirdTwoByteTokenStrings;
+ _awaitTwoByteToken = a;
+ b = a;
+ a = *ptr++;
+ if (a == 0) /* Need to return such that next byte */
+ return 0; /* is used as two byte token */
+
+ _awaitTwoByteToken = 0;
+ ptr1 = _twoByteTokens;
+ while (*ptr1 != a) {
+ ptr1++;
+ count1++;
+ if (*ptr1 == 0) { /* If was not a two byte token */
+ count1 = 0; /* then was a byte token. */
+ ptr1 = _byteTokens;
+ while (*ptr1 != a) {
+ ptr1++;
+ count1++;
+ }
+ ptr1 = _byteTokenStrings; /* Find it */
+ while (count1--) {
+ while (*ptr1++);
+ }
+ ptr1 = uncompressToken(b, ptr1); /* Try this one as a two byte token */
+ uncompressText(ptr1); /* Uncompress rest of this token */
+ return ptr;
+ }
+ }
+ while (count1--) {
+ while (*ptr2++);
+ }
+ uncompressText(ptr2);
+ } else {
+ ptr1 = _byteTokens;
+ while (*ptr1 != a) {
+ ptr1++;
+ count1++;
+ if (*ptr1 == 0) {
+ _textBuffer[_textCount++] = a; /* Not a byte token */
+ return ptr; /* must be real character */
+ }
+ }
+ ptr1 = _byteTokenStrings;
+ while (count1--) { /* Is a byte token so count */
+ while (*ptr1++); /* to start of token */
+ }
+ uncompressText(ptr1); /* and do it */
+ }
+ return ptr;
+}
+
const byte *AGOSEngine::getStringPtrByID(uint16 stringId, bool upperCase) {
const byte *string_ptr;
byte *dst;
_freeStringSlot ^= 1;
+ dst = _stringReturnBuffer[_freeStringSlot];
- if (stringId < 0x8000) {
- string_ptr = _stringTabPtr[stringId];
+ if (getGameType() == GType_ELVIRA1 && getPlatform() == Common::kPlatformAtariST) {
+ byte *ptr = _stringTabPtr[stringId];
+ _textCount = 0;
+ _awaitTwoByteToken = 0;
+ uncompressText(ptr);
+ _textBuffer[_textCount] = 0;
+ strcpy((char *)dst, (const char *)_textBuffer);
} else {
- string_ptr = getLocalStringByID(stringId);
+ if (stringId < 0x8000) {
+ string_ptr = _stringTabPtr[stringId];
+ } else {
+ string_ptr = getLocalStringByID(stringId);
+ }
+ strcpy((char *)dst, (const char *)string_ptr);
}
- dst = _stringReturnBuffer[_freeStringSlot];
- strcpy((char *)dst, (const char *)string_ptr);
-
if (upperCase && *dst) {
if (islower(*dst))
*dst = toupper(*dst);
@@ -86,15 +172,53 @@
void AGOSEngine::setupStringTable(byte *mem, int num) {
int i = 0;
- for (;;) {
- _stringTabPtr[i++] = mem;
- if (--num == 0)
- break;
- for (; *mem; mem++);
- mem++;
+
+ if (getGameType() == GType_ELVIRA1 && getPlatform() == Common::kPlatformAtariST) {
+ int ct1;
+
+ _twoByteTokens = mem;
+ while (*mem++) {
+ i++;
+ }
+ _twoByteTokenStrings = mem;
+ ct1 = i;
+ while (*mem++) {
+ while (*mem++);
+ i--;
+ if ((i == 0) && (ct1 != 0)) {
+ _secondTwoByteTokenStrings = mem;
+ i = ct1;
+ ct1 = 0;
+ }
+ if (i == 0)
+ _thirdTwoByteTokenStrings = mem;
+ }
+ _byteTokens = mem;
+ while (*mem++);
+ _byteTokenStrings = mem;
+ while (*mem++) {
+ while(*mem++);
+ }
+ i = 0;
+l1: _stringTabPtr[i++] = mem;
+ num--;
+ if (!num) {
+ _stringTabPos = i;
+ return;
+ }
+ while (*mem++);
+ goto l1;
+ } else {
+ for (;;) {
+ _stringTabPtr[i++] = mem;
+ if (--num == 0)
+ break;
+ for (; *mem; mem++);
+ mem++;
+ }
+
+ _stringTabPos = i;
}
-
- _stringTabPos = i;
}
void AGOSEngine::setupLocalStringTable(byte *mem, int num) {
@@ -665,26 +789,26 @@
}
-uint16 AGOSEngine_Waxworks::checkFit(char *Ptr, int width, int lines) {
+uint16 AGOSEngine_Waxworks::checkFit(char *ptr, int width, int lines) {
int countw = 0;
int countl = 0;
char *x = NULL;
- while (*Ptr) {
- if (*Ptr == '\n')
+ while (*ptr) {
+ if (*ptr == '\n')
return 1;
if (countw == width) {
countl++;
countw = 0;
- Ptr = x;
+ ptr = x;
}
- if (*Ptr == ' ') {
- x = Ptr;
+ if (*ptr == ' ') {
+ x = ptr;
x++;
}
countw++;
if (countl == lines)
return 0;
- Ptr++;
+ ptr++;
}
return 1;
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