[Scummvm-cvs-logs] CVS: scummvm/scumm script_v6.cpp,1.188,1.189 scumm.h,1.300,1.301
Pawel Kolodziejski
aquadran at users.sourceforge.net
Sat Sep 13 06:42:15 CEST 2003
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv30757
Modified Files:
script_v6.cpp scumm.h
Log Message:
implemented opcodes: openfile and closefile
Index: script_v6.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6.cpp,v
retrieving revision 1.188
retrieving revision 1.189
diff -u -d -r1.188 -r1.189
--- script_v6.cpp 13 Sep 2003 12:37:21 -0000 1.188
+++ script_v6.cpp 13 Sep 2003 13:41:44 -0000 1.189
@@ -2827,7 +2827,7 @@
}
void Scumm_v6::o6_openFile() {
- int a, len;
+ int mode, len, slot;
byte filename[100];
_msgPtrToAdd = filename;
@@ -2837,15 +2837,32 @@
len = resStrLen(_scriptPointer);
_scriptPointer += len + 1;
- a = pop();
- warning("stub o6_openFile(\"%s\", %d)", filename, a);
- // -1 open failed, otherwise file slot
- push(0);
+ mode = pop();
+ slot = -1;
+ for (int l = 0; l < 17; l++) {
+ if (_hFileTable[l].isOpen() == false) {
+ slot = l;
+ break;
+ }
+ }
+
+ if (slot != -1) {
+ if (mode == 1)
+ _hFileTable[slot].open((char*)filename, this->getGameDataPath(), File::kFileReadMode);
+ else if (mode == 2)
+ _hFileTable[slot].open((char*)filename, this->getGameDataPath(), File::kFileWriteMode);
+ else
+ error("o6_openFile(): wrong open file mode");
+
+ warning("%d = o6_openFile(\"%s\", %d)", slot, filename, mode);
+ }
+ push(slot);
}
void Scumm_v6::o6_closeFile() {
- // pop'd variable should be that pushed in o6_openFile()
- warning("stub o6_closeFile(%d)", pop());
+ int slot = pop();
+ _hFileTable[slot].close();
+ warning("o6_closeFile(%d)", slot);
}
void Scumm_v6::o6_deleteFile() {
Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.300
retrieving revision 1.301
diff -u -d -r1.300 -r1.301
--- scumm.h 11 Sep 2003 10:32:14 -0000 1.300
+++ scumm.h 13 Sep 2003 13:41:44 -0000 1.301
@@ -559,6 +559,7 @@
/* Should be in Resource class */
File _fileHandle;
uint32 _fileOffset;
+ File _hFileTable[17];
int _resourceHeaderSize;
char *_exe_name; // This is the name we use for opening resource files
char *_game_name; // This is the game the user calls it, so use for saving
More information about the Scummvm-git-logs
mailing list