diff options
author | Nicola Mettifogo | 2007-02-20 09:17:28 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2007-02-20 09:17:28 +0000 |
commit | 5886d3ed7f6bdcc957174d33a3f31bcd68a9739f (patch) | |
tree | bf6ede51d6e1111adecfcc9863cee2153886c71e /engines | |
parent | 1bd5f9932b45e92dd73097df26acfe127df39c05 (diff) | |
download | scummvm-rg350-5886d3ed7f6bdcc957174d33a3f31bcd68a9739f.tar.gz scummvm-rg350-5886d3ed7f6bdcc957174d33a3f31bcd68a9739f.tar.bz2 scummvm-rg350-5886d3ed7f6bdcc957174d33a3f31bcd68a9739f.zip |
cleanup and small fixes
svn-id: r25738
Diffstat (limited to 'engines')
-rw-r--r-- | engines/parallaction/animation.cpp | 7 | ||||
-rw-r--r-- | engines/parallaction/location.cpp | 7 | ||||
-rw-r--r-- | engines/parallaction/parallaction.cpp | 2 | ||||
-rw-r--r-- | engines/parallaction/parallaction.h | 2 | ||||
-rw-r--r-- | engines/parallaction/parser.cpp | 96 | ||||
-rw-r--r-- | engines/parallaction/parser.h | 8 |
6 files changed, 26 insertions, 96 deletions
diff --git a/engines/parallaction/animation.cpp b/engines/parallaction/animation.cpp index 5707d6d367..10a5650fe4 100644 --- a/engines/parallaction/animation.cpp +++ b/engines/parallaction/animation.cpp @@ -269,8 +269,7 @@ void Parallaction::loadProgram(Animation *a, char *filename) { _numLocals = 0; - LocScript *script = new LocScript(src); -// scriptFillBuffers(file); + Script *script = new Script(src); fillBuffers(*script); @@ -291,12 +290,14 @@ void Parallaction::loadProgram(Animation *a, char *filename) { vCC = (Instruction*)memAlloc(sizeof(Instruction)); memset(vCC, 0, sizeof(Instruction)); fillBuffers(*script); - // scriptFillBuffers(file); } vCC->_index = INST_END; addNode(vD0, &vCC->_node); + delete script; + delete src; + a->_program->_ip = (Instruction*)a->_program->_node._next; return; diff --git a/engines/parallaction/location.cpp b/engines/parallaction/location.cpp index 5896a45ec1..bc1865373f 100644 --- a/engines/parallaction/location.cpp +++ b/engines/parallaction/location.cpp @@ -76,8 +76,7 @@ void Parallaction::parseLocation(const char *filename) { uint32 count = file->_endOffset - file->_offset; location_src = (char*)memAlloc(0x4000); - _locationScript = new LocScript(location_src); -// parseInit(location_src); + _locationScript = new Script(location_src); readArchivedFile(file, location_src, count); closeArchivedFile(file); @@ -192,6 +191,10 @@ void Parallaction::parseLocation(const char *filename) { resolveLocationForwards(); _vm->_graphics->freeCnv(&Graphics::_font); + + delete _locationScript; + _locationScript = NULL; + memFree(location_src); return; diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index 958a001cfe..d7a023e97e 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -165,6 +165,8 @@ Parallaction::Parallaction(OSystem *syst) : _activeItem._id = 0; _procCurrentHoverItem = -1; + _locationScript = NULL; + _musicData1 = 0; strcpy(_characterName1, "null"); diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h index 3abf7b070c..897ad53489 100644 --- a/engines/parallaction/parallaction.h +++ b/engines/parallaction/parallaction.h @@ -269,7 +269,7 @@ public: InventoryItem _activeItem; - LocScript *_locationScript; + Script *_locationScript; protected: // data diff --git a/engines/parallaction/parser.cpp b/engines/parallaction/parser.cpp index b17b080d5b..ead9383a2e 100644 --- a/engines/parallaction/parser.cpp +++ b/engines/parallaction/parser.cpp @@ -28,40 +28,12 @@ namespace Parallaction { char _tokens[20][40]; -/* -static char *_src = NULL; +Script::Script(const char* s) : _src(s) { - -void parseInit(char *s) { - _src = s; } -char *parseNextLine(char *s, uint16 count) { - - uint16 _si; - char v2 = 0; - for ( _si = 0; _si<count; _si++) { - - v2 = *_src++; - if (v2 == 0xA || v2 == -1) break; - if (v2 != -1 && _si < count) s[_si] = v2; - } - - if (_si == 0 && v2 == -1) - return 0; - - s[_si] = 0xA; - s[_si+1] = '\0'; - - return s; -} -*/ -LocScript::LocScript(const char* s) : _src(s) { - -} - -char *LocScript::readLine(char *buf, size_t bufSize) { +char *Script::readLine(char *buf, size_t bufSize) { uint16 _si; char v2 = 0; @@ -82,24 +54,24 @@ char *LocScript::readLine(char *buf, size_t bufSize) { } -uint32 LocScript::read(void *dataPtr, uint32 dataSize) { - error("binary read not supported on LocScript streams"); +uint32 Script::read(void *dataPtr, uint32 dataSize) { + error("binary read not supported on Script streams"); } -bool LocScript::eos() const { - error("EoS not supported on LocScript streams"); +bool Script::eos() const { + error("EoS not supported on Script streams"); } -uint32 LocScript::pos() const { - error("position not supported on LocScript streams"); +uint32 Script::pos() const { + error("position not supported on Script streams"); } -uint32 LocScript::size() const { - error("can't get size of LocScript streams"); +uint32 Script::size() const { + error("can't get size of Script streams"); } -void LocScript::seek(int32 offset, int whence) { - error("seek not supported on LocScript streams"); +void Script::seek(int32 offset, int whence) { + error("seek not supported on Script streams"); } // looks for next token in a string @@ -199,49 +171,5 @@ uint16 fillBuffers(Common::SeekableReadStream &stream, bool errorOnEOF) { return fillTokens(line); } -/* -// -// FIXME -// this function does the same Job as fillBuffers, except that -// it gets input from a SeekableStream instead of a memory buffer -// -uint16 tableFillBuffers(Common::SeekableReadStream &stream) { - - clearTokens(); - char buf[200]; - char *line = NULL; - do { - line = stream.readLine(buf, 200); - if (line == NULL) { - return 0; - } - line = Common::ltrim(line); - } while (strlen(line) == 0 || line[0] == '#'); - - return fillTokens(line); -} - - -// FIXME -// this function does the same Job as fillBuffers, except that -// it gets input from an ArchivedFile instead of a memory buffer -// -uint16 scriptFillBuffers(ArchivedFile *file) { - - clearTokens(); - - char buf[200]; - char *line = NULL; - do { - line = readArchivedFileText(buf, 200, file); - if (line == NULL) { - return 0; - } - line = Common::ltrim(line); - } while (strlen(line) == 0 || line[0] == '#'); - - return fillTokens(line); -} -*/ } // namespace Parallaction diff --git a/engines/parallaction/parser.h b/engines/parallaction/parser.h index ea9b70ee5c..51b2787ced 100644 --- a/engines/parallaction/parser.h +++ b/engines/parallaction/parser.h @@ -36,18 +36,14 @@ char *parseComment(ArchivedFile *file); uint16 fillBuffers(Common::SeekableReadStream &stream, bool errorOnEOF = false); char *parseNextToken(char *s, char *tok, uint16 count, const char *brk); -//uint16 tableFillBuffers(Common::SeekableReadStream &stream); -//uint16 scriptFillBuffers(ArchivedFile *file); - - extern char _tokens[][40]; -class LocScript : public Common::SeekableReadStream { +class Script : public Common::SeekableReadStream { const char* _src; public: - LocScript(const char* s); + Script(const char* s); uint32 read(void *dataPtr, uint32 dataSize); |