diff options
author | Nicola Mettifogo | 2007-02-20 09:52:07 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2007-02-20 09:52:07 +0000 |
commit | b6a10e10ef52820d92940f16775e5ae1d84388e1 (patch) | |
tree | 2c403e08bb704b9b3d1b5cdf83d1df82ed580c60 | |
parent | 5886d3ed7f6bdcc957174d33a3f31bcd68a9739f (diff) | |
download | scummvm-rg350-b6a10e10ef52820d92940f16775e5ae1d84388e1.tar.gz scummvm-rg350-b6a10e10ef52820d92940f16775e5ae1d84388e1.tar.bz2 scummvm-rg350-b6a10e10ef52820d92940f16775e5ae1d84388e1.zip |
changed parseComment to use Script stream instead of file
svn-id: r25739
-rw-r--r-- | engines/parallaction/location.cpp | 4 | ||||
-rw-r--r-- | engines/parallaction/parallaction.h | 2 | ||||
-rw-r--r-- | engines/parallaction/parser.cpp | 44 | ||||
-rw-r--r-- | engines/parallaction/zone.cpp | 2 |
4 files changed, 26 insertions, 26 deletions
diff --git a/engines/parallaction/location.cpp b/engines/parallaction/location.cpp index bc1865373f..fa1684ffe4 100644 --- a/engines/parallaction/location.cpp +++ b/engines/parallaction/location.cpp @@ -169,10 +169,10 @@ void Parallaction::parseLocation(const char *filename) { } } if (!scumm_stricmp(_tokens[0], "COMMENT")) { - _locationComment = parseComment(file); + _locationComment = parseComment(*_locationScript); } if (!scumm_stricmp(_tokens[0], "ENDCOMMENT")) { - _locationEndComment = parseComment(file); + _locationEndComment = parseComment(*_locationScript); } if (!scumm_stricmp(_tokens[0], "ZONE")) { parseZone(file, &_zones, _tokens[1]); diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h index 897ad53489..42b26a32f5 100644 --- a/engines/parallaction/parallaction.h +++ b/engines/parallaction/parallaction.h @@ -241,7 +241,7 @@ public: void changeCursor(int32 index); void changeCharacter(const char *name); - char *parseComment(ArchivedFile *file); + char *parseComment(Script &script); char *parseDialogueString(); Dialogue *parseDialogue(ArchivedFile *file); diff --git a/engines/parallaction/parser.cpp b/engines/parallaction/parser.cpp index ead9383a2e..f8c9d3293a 100644 --- a/engines/parallaction/parser.cpp +++ b/engines/parallaction/parser.cpp @@ -74,38 +74,18 @@ void Script::seek(int32 offset, int whence) { error("seek not supported on Script streams"); } -// looks for next token in a string -// -// scans 's' until one of the stop-chars in 'brk' is found -// builds a token and return the part of the string which hasn't been parsed - -char *parseNextToken(char *s, char *tok, uint16 count, const char *brk) { - - while (*s != '\0') { - - if (brk[0] == *s) break; - if (brk[1] == *s) break; - if (brk[2] == *s) break; - - *tok++ = *s++; - } - - *tok = '\0'; - return s; -} - // // a comment can appear both at location and Zone levels // comments are displayed into rectangles on the screen // -char *Parallaction::parseComment(ArchivedFile *file) { +char *Parallaction::parseComment(Script &script) { char _tmp_comment[1000] = "\0"; char *v194; do { char v190[400]; - v194 = _locationScript->readLine(v190, 400); + v194 = script.readLine(v190, 400); v194[strlen(v194)-1] = '\0'; if (!scumm_stricmp(v194, "endtext")) @@ -131,6 +111,26 @@ void clearTokens() { } +// looks for next token in a string +// +// scans 's' until one of the stop-chars in 'brk' is found +// builds a token and return the part of the string which hasn't been parsed + +char *parseNextToken(char *s, char *tok, uint16 count, const char *brk) { + + while (*s != '\0') { + + if (brk[0] == *s) break; + if (brk[1] == *s) break; + if (brk[2] == *s) break; + + *tok++ = *s++; + } + + *tok = '\0'; + return s; +} + uint16 fillTokens(char* line) { uint16 i = 0; diff --git a/engines/parallaction/zone.cpp b/engines/parallaction/zone.cpp index fd132bc96a..cf7c340ef9 100644 --- a/engines/parallaction/zone.cpp +++ b/engines/parallaction/zone.cpp @@ -256,7 +256,7 @@ void Parallaction::parseZoneTypeBlock(ArchivedFile *file, Zone *z) { strcpy(u->examine->_filename, _tokens[1]); } if (!scumm_stricmp(_tokens[0], "desc")) { - u->examine->_description = parseComment(file); + u->examine->_description = parseComment(*_locationScript); } break; |