aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicola Mettifogo2007-03-02 22:34:12 +0000
committerNicola Mettifogo2007-03-02 22:34:12 +0000
commit4c2687e9c7cac7de10e2191b7bf03f562a1d579c (patch)
treef9e217d7421f2fbe626c9c6cecd8b09d45ada7d7
parent753d83f9465fb07f30480d72534f011e3f7eaba8 (diff)
downloadscummvm-rg350-4c2687e9c7cac7de10e2191b7bf03f562a1d579c.tar.gz
scummvm-rg350-4c2687e9c7cac7de10e2191b7bf03f562a1d579c.tar.bz2
scummvm-rg350-4c2687e9c7cac7de10e2191b7bf03f562a1d579c.zip
added Script loader routine
svn-id: r25938
-rw-r--r--engines/parallaction/animation.cpp18
-rw-r--r--engines/parallaction/disk.cpp18
-rw-r--r--engines/parallaction/disk.h1
3 files changed, 22 insertions, 15 deletions
diff --git a/engines/parallaction/animation.cpp b/engines/parallaction/animation.cpp
index c81a6d4d10..f7f9dac6e5 100644
--- a/engines/parallaction/animation.cpp
+++ b/engines/parallaction/animation.cpp
@@ -251,21 +251,9 @@ void jobEraseAnimations(void *arg_0, Job *j) {
void Parallaction::loadProgram(Animation *a, char *filename) {
// printf("loadProgram(%s)\n", filename);
-
- char vC8[PATH_LEN];
-
- sprintf(vC8, "%s.script", filename);
-
- if (!_archive.openArchivedFile(vC8))
- errorFileNotFound(vC8);
-
- uint32 size = _archive.size();
- char* src = (char*)memAlloc(size+1);
-
- _archive.read(src, size);
- src[size] = '\0';
-
- _archive.closeArchivedFile();
+ // the largest script in Nippon Safes is 3,668 bytes, so 4 kb is well enough
+ char* src = (char*)memAlloc(0x1000);
+ loadScript(filename, src);
_numLocals = 0;
diff --git a/engines/parallaction/disk.cpp b/engines/parallaction/disk.cpp
index f42398466f..7449f7c76f 100644
--- a/engines/parallaction/disk.cpp
+++ b/engines/parallaction/disk.cpp
@@ -89,6 +89,24 @@ void loadLocation(const char *name, char* script) {
}
+void loadScript(const char* name, char *script) {
+
+ char vC8[PATH_LEN];
+
+ sprintf(vC8, "%s.script", name);
+
+ if (!_vm->_archive.openArchivedFile(vC8))
+ errorFileNotFound(vC8);
+
+ uint32 size = _vm->_archive.size();
+
+ _vm->_archive.read(script, size);
+ script[size] = '\0';
+
+ _vm->_archive.closeArchivedFile();
+
+}
+
void loadHead(const char* name, StaticCnv* cnv) {
char path[PATH_LEN];
diff --git a/engines/parallaction/disk.h b/engines/parallaction/disk.h
index abe91b304b..292e8fa579 100644
--- a/engines/parallaction/disk.h
+++ b/engines/parallaction/disk.h
@@ -73,6 +73,7 @@ public:
};
void loadLocation(const char *name, char* script);
+void loadScript(const char* name, char *script);
void loadTalk(const char *name, Cnv *cnv);
void loadObjects(const char *name, Cnv *cnv);
void loadPointer(StaticCnv* cnv);