[Scummvm-cvs-logs] SF.net SVN: scummvm:[47992] scummvm/trunk/engines/drascula
peres001 at users.sourceforge.net
peres001 at users.sourceforge.net
Mon Feb 8 17:13:10 CET 2010
Revision: 47992
http://scummvm.svn.sourceforge.net/scummvm/?rev=47992&view=rev
Author: peres001
Date: 2010-02-08 16:13:09 +0000 (Mon, 08 Feb 2010)
Log Message:
-----------
Pass the input stream to text parser functions.
Modified Paths:
--------------
scummvm/trunk/engines/drascula/converse.cpp
scummvm/trunk/engines/drascula/drascula.cpp
scummvm/trunk/engines/drascula/drascula.h
scummvm/trunk/engines/drascula/rooms.cpp
Modified: scummvm/trunk/engines/drascula/converse.cpp
===================================================================
--- scummvm/trunk/engines/drascula/converse.cpp 2010-02-08 16:12:45 UTC (rev 47991)
+++ scummvm/trunk/engines/drascula/converse.cpp 2010-02-08 16:13:09 UTC (rev 47992)
@@ -150,17 +150,17 @@
selectVerb(kVerbNone);
- getStringFromLine(size, phrase1);
- getStringFromLine(size, phrase2);
- getStringFromLine(size, phrase3);
- getStringFromLine(size, phrase4);
- getStringFromLine(size, sound1);
- getStringFromLine(size, sound2);
- getStringFromLine(size, sound3);
- getStringFromLine(size, sound4);
- getIntFromLine(size, &answer1);
- getIntFromLine(size, &answer2);
- getIntFromLine(size, &answer3);
+ getStringFromLine(_arj, size, phrase1);
+ getStringFromLine(_arj, size, phrase2);
+ getStringFromLine(_arj, size, phrase3);
+ getStringFromLine(_arj, size, phrase4);
+ getStringFromLine(_arj, size, sound1);
+ getStringFromLine(_arj, size, sound2);
+ getStringFromLine(_arj, size, sound3);
+ getStringFromLine(_arj, size, sound4);
+ getIntFromLine(_arj, size, &answer1);
+ getIntFromLine(_arj, size, &answer2);
+ getIntFromLine(_arj, size, &answer3);
_arj.close();
Modified: scummvm/trunk/engines/drascula/drascula.cpp
===================================================================
--- scummvm/trunk/engines/drascula/drascula.cpp 2010-02-08 16:12:45 UTC (rev 47991)
+++ scummvm/trunk/engines/drascula/drascula.cpp 2010-02-08 16:13:09 UTC (rev 47992)
@@ -604,15 +604,15 @@
}
}
-char *DrasculaEngine::getLine(char *buf, int len) {
+char *DrasculaEngine::getLine(Common::SeekableReadStream &stream, char *buf, int len) {
byte c;
char *b;
for (;;) {
b = buf;
while (true) {
- c = ~_arj.readByte();
- if (_arj.eos()) break;
+ c = ~stream.readByte();
+ if (stream.eos()) break;
if (c == '\r')
continue;
@@ -621,7 +621,7 @@
*b++ = c;
}
*b = '\0';
- if (_arj.eos() && b == buf)
+ if (stream.eos() && b == buf)
return NULL;
if (b != buf)
break;
@@ -629,13 +629,15 @@
return buf;
}
-void DrasculaEngine::getIntFromLine(char *buf, int len, int* result) {
- getLine(buf, len);
+void DrasculaEngine::getIntFromLine(Common::SeekableReadStream &stream, int len, int* result) {
+ char buf[256];
+ getLine(stream, buf, len);
sscanf(buf, "%d", result);
}
-void DrasculaEngine::getStringFromLine(char *buf, int len, char* result) {
- getLine(buf, len);
+void DrasculaEngine::getStringFromLine(Common::SeekableReadStream &stream, int len, char* result) {
+ char buf[256];
+ getLine(stream, buf, len);
sscanf(buf, "%s", result);
}
Modified: scummvm/trunk/engines/drascula/drascula.h
===================================================================
--- scummvm/trunk/engines/drascula/drascula.h 2010-02-08 16:12:45 UTC (rev 47991)
+++ scummvm/trunk/engines/drascula/drascula.h 2010-02-08 16:13:09 UTC (rev 47992)
@@ -577,9 +577,9 @@
void MusicFadeout();
void playFile(const char *fname);
- char *getLine(char *buf, int len);
- void getIntFromLine(char *buf, int len, int* result);
- void getStringFromLine(char *buf, int len, char* result);
+ char *getLine(Common::SeekableReadStream &stream, char *buf, int len);
+ void getIntFromLine(Common::SeekableReadStream &stream, int len, int* result);
+ void getStringFromLine(Common::SeekableReadStream &stream, int len, char* result);
void grr();
void updateAnim(int y, int destX, int destY, int width, int height, int count, byte* src, int delayVal = 3, bool copyRectangle = false);
Modified: scummvm/trunk/engines/drascula/rooms.cpp
===================================================================
--- scummvm/trunk/engines/drascula/rooms.cpp 2010-02-08 16:12:45 UTC (rev 47991)
+++ scummvm/trunk/engines/drascula/rooms.cpp 2010-02-08 16:13:09 UTC (rev 47992)
@@ -1655,61 +1655,61 @@
}
int size = _arj.size();
- getIntFromLine(size, &roomNumber);
- getIntFromLine(size, &roomMusic);
- getStringFromLine(size, roomDisk);
- getIntFromLine(size, &palLevel);
+ getIntFromLine(_arj, size, &roomNumber);
+ getIntFromLine(_arj, size, &roomMusic);
+ getStringFromLine(_arj, size, roomDisk);
+ getIntFromLine(_arj, size, &palLevel);
if (currentChapter == 2)
- getIntFromLine(size, &martin);
+ getIntFromLine(_arj, size, &martin);
if (currentChapter == 2 && martin != 0) {
curWidth = martin;
- getIntFromLine(size, &curHeight);
- getIntFromLine(size, &feetHeight);
- getIntFromLine(size, &stepX);
- getIntFromLine(size, &stepY);
+ getIntFromLine(_arj, size, &curHeight);
+ getIntFromLine(_arj, size, &feetHeight);
+ getIntFromLine(_arj, size, &stepX);
+ getIntFromLine(_arj, size, &stepY);
- getStringFromLine(size, pant1);
- getStringFromLine(size, pant2);
- getStringFromLine(size, pant3);
- getStringFromLine(size, pant4);
+ getStringFromLine(_arj, size, pant1);
+ getStringFromLine(_arj, size, pant2);
+ getStringFromLine(_arj, size, pant3);
+ getStringFromLine(_arj, size, pant4);
strcpy(menuBackground, pant4);
}
- getIntFromLine(size, &numRoomObjs);
+ getIntFromLine(_arj, size, &numRoomObjs);
for (l = 0; l < numRoomObjs; l++) {
- getIntFromLine(size, &objectNum[l]);
- getStringFromLine(size, objName[l]);
- getIntFromLine(size, &x1[l]);
- getIntFromLine(size, &y1[l]);
- getIntFromLine(size, &x2[l]);
- getIntFromLine(size, &y2[l]);
- getIntFromLine(size, &roomObjX[l]);
- getIntFromLine(size, &roomObjY[l]);
- getIntFromLine(size, &trackObj[l]);
- getIntFromLine(size, &visible[l]);
- getIntFromLine(size, &isDoor[l]);
+ getIntFromLine(_arj, size, &objectNum[l]);
+ getStringFromLine(_arj, size, objName[l]);
+ getIntFromLine(_arj, size, &x1[l]);
+ getIntFromLine(_arj, size, &y1[l]);
+ getIntFromLine(_arj, size, &x2[l]);
+ getIntFromLine(_arj, size, &y2[l]);
+ getIntFromLine(_arj, size, &roomObjX[l]);
+ getIntFromLine(_arj, size, &roomObjY[l]);
+ getIntFromLine(_arj, size, &trackObj[l]);
+ getIntFromLine(_arj, size, &visible[l]);
+ getIntFromLine(_arj, size, &isDoor[l]);
if (isDoor[l] != 0) {
- getStringFromLine(size, _targetSurface[l]);
- getIntFromLine(size, &_destX[l]);
- getIntFromLine(size, &_destY[l]);
- getIntFromLine(size, &trackCharacter_alkeva[l]);
- getIntFromLine(size, &roomExits[l]);
+ getStringFromLine(_arj, size, _targetSurface[l]);
+ getIntFromLine(_arj, size, &_destX[l]);
+ getIntFromLine(_arj, size, &_destY[l]);
+ getIntFromLine(_arj, size, &trackCharacter_alkeva[l]);
+ getIntFromLine(_arj, size, &roomExits[l]);
updateDoor(l);
}
}
- getIntFromLine(size, &floorX1);
- getIntFromLine(size, &floorY1);
- getIntFromLine(size, &floorX2);
- getIntFromLine(size, &floorY2);
+ getIntFromLine(_arj, size, &floorX1);
+ getIntFromLine(_arj, size, &floorY1);
+ getIntFromLine(_arj, size, &floorX2);
+ getIntFromLine(_arj, size, &floorY2);
if (currentChapter != 2) {
- getIntFromLine(size, &upperLimit);
- getIntFromLine(size, &lowerLimit);
+ getIntFromLine(_arj, size, &upperLimit);
+ getIntFromLine(_arj, size, &lowerLimit);
}
_arj.close();
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