[Scummvm-cvs-logs] CVS: scummvm/scumm intern.h,2.110,2.111 script_v6.cpp,1.190,1.191
Pawel Kolodziejski
aquadran at users.sourceforge.net
Sat Sep 13 09:26:03 CEST 2003
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv29424
Modified Files:
intern.h script_v6.cpp
Log Message:
implemented fileread opcode
Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.110
retrieving revision 2.111
diff -u -d -r2.110 -r2.111
--- intern.h 13 Sep 2003 13:59:46 -0000 2.110
+++ intern.h 13 Sep 2003 16:25:33 -0000 2.111
@@ -345,6 +345,7 @@
int popRoomAndObj(int *room);
void shuffleArray(int num, int minIdx, int maxIdx);
void unknownEA_func(int a, int b, int c, int d, int e);
+ int readFileToArray(int slot, int32 size);
/* Version 6 script opcodes */
void o6_setBlastObjectWindow();
Index: script_v6.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6.cpp,v
retrieving revision 1.190
retrieving revision 1.191
diff -u -d -r1.190 -r1.191
--- script_v6.cpp 13 Sep 2003 13:59:46 -0000 1.190
+++ script_v6.cpp 13 Sep 2003 16:25:33 -0000 1.191
@@ -2827,7 +2827,7 @@
}
void Scumm_v6::o6_openFile() {
- int mode, len, slot;
+ int mode, len, slot, l, r;
byte filename[100];
_msgPtrToAdd = filename;
@@ -2836,10 +2836,15 @@
len = resStrLen(_scriptPointer);
_scriptPointer += len + 1;
-
+
+ for (r = strlen((char*)filename); r != 0; r--) {
+ if (filename[r - 1] == '\\')
+ break;
+ }
+
mode = pop();
slot = -1;
- for (int l = 0; l < 17; l++) {
+ for (l = 0; l < 17; l++) {
if (_hFileTable[l].isOpen() == false) {
slot = l;
break;
@@ -2848,9 +2853,9 @@
if (slot != -1) {
if (mode == 1)
- _hFileTable[slot].open((char*)filename, this->getGameDataPath(), File::kFileReadMode);
+ _hFileTable[slot].open((char*)filename + r, getGameDataPath(), File::kFileReadMode);
else if (mode == 2)
- _hFileTable[slot].open((char*)filename, this->getGameDataPath(), File::kFileWriteMode);
+ _hFileTable[slot].open((char*)filename + r, getGameDataPath(), File::kFileWriteMode);
else
error("o6_openFile(): wrong open file mode");
@@ -2879,8 +2884,27 @@
warning("stub o6_deleteFile(\"%s\")", filename);
}
+int Scumm_v6::readFileToArray(int slot, int32 size) {
+ int rest = _hFileTable[slot].size() - _hFileTable[slot].pos();
+ writeVar(0, 0);
+ defineArray(0, 3, 0, rest);
+ byte *ptr = getResourceAddress(rtString, readVar(0));
+ _hFileTable[slot].read(ptr, rest);
+ return readVar(0);
+}
+
void Scumm_v6::o6_readFile() {
- error("stub o6_readFile(%d, %d)", pop(), pop());
+ int32 size = pop();
+ int slot = pop();
+
+ if (size == -2) {
+ push(_hFileTable[slot].readUint16LE());
+ } else if (size == -1) {
+ push(_hFileTable[slot].readByte());
+ } else {
+ push(readFileToArray(slot, size));
+ }
+ warning("o6_readFile(%d, %d)", slot, size);
}
void Scumm_v6::o6_findAllObjects() {
More information about the Scummvm-git-logs
mailing list