aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/parallaction/animation.cpp10
-rw-r--r--engines/parallaction/commands.cpp6
-rw-r--r--engines/parallaction/dialogue.cpp28
-rw-r--r--engines/parallaction/location.cpp18
-rw-r--r--engines/parallaction/parallaction.h13
-rw-r--r--engines/parallaction/parser.h1
-rw-r--r--engines/parallaction/zone.cpp20
-rw-r--r--engines/parallaction/zone.h2
8 files changed, 47 insertions, 51 deletions
diff --git a/engines/parallaction/animation.cpp b/engines/parallaction/animation.cpp
index 10a5650fe4..8c62938846 100644
--- a/engines/parallaction/animation.cpp
+++ b/engines/parallaction/animation.cpp
@@ -74,7 +74,7 @@ Animation *findAnimation(const char *name) {
}
-Animation *Parallaction::parseAnimation(ArchivedFile *file, Node *list, char *name) {
+Animation *Parallaction::parseAnimation(Script& script, Node *list, char *name) {
// printf("parseAnimation(%s)\n", name);
Animation *vD0 = (Animation*)memAlloc(sizeof(Animation));
@@ -85,7 +85,7 @@ Animation *Parallaction::parseAnimation(ArchivedFile *file, Node *list, char *na
addNode(list, &vD0->_zone._node);
- fillBuffers(*_locationScript, true);
+ fillBuffers(script, true);
while (scumm_stricmp(_tokens[0], "endanimation")) {
// printf("token[0] = %s\n", _tokens[0]);
@@ -93,7 +93,7 @@ Animation *Parallaction::parseAnimation(ArchivedFile *file, Node *list, char *na
loadProgram(vD0, _tokens[1]);
}
if (!scumm_stricmp(_tokens[0], "commands")) {
- vD0->_zone._commands = parseCommands(file);
+ vD0->_zone._commands = parseCommands(script);
}
if (!scumm_stricmp(_tokens[0], "type")) {
if (_tokens[2][0] != '\0') {
@@ -103,7 +103,7 @@ Animation *Parallaction::parseAnimation(ArchivedFile *file, Node *list, char *na
if (_si != -1) {
vD0->_zone._type |= 1 << (_si-1);
if (((vD0->_zone._type & 0xFFFF) != kZoneNone) && ((vD0->_zone._type & 0xFFFF) != kZoneCommand)) {
- parseZoneTypeBlock(file, &vD0->_zone);
+ parseZoneTypeBlock(script, &vD0->_zone);
}
}
}
@@ -142,7 +142,7 @@ Animation *Parallaction::parseAnimation(ArchivedFile *file, Node *list, char *na
vD0->_zone._moveTo._y = atoi(_tokens[2]);
}
- fillBuffers(*_locationScript, true);
+ fillBuffers(script, true);
}
vD0->_zone.pos._oldposition._x = -1000;
diff --git a/engines/parallaction/commands.cpp b/engines/parallaction/commands.cpp
index 3662579427..79c8fe586c 100644
--- a/engines/parallaction/commands.cpp
+++ b/engines/parallaction/commands.cpp
@@ -45,13 +45,13 @@ namespace Parallaction {
#define CMD_STOP 16
-Command *parseCommands(ArchivedFile *file) {
+Command *parseCommands(Script &script) {
// printf("parseCommands()");
Node root;
memset(&root, 0, sizeof(root));
- fillBuffers(*_vm->_locationScript, true);
+ fillBuffers(script, true);
while (scumm_stricmp(_tokens[0], "ENDCOMMANDS") && scumm_stricmp(_tokens[0], "ENDZONE")) {
// printf("token[0] = %s", _tokens[0]);
@@ -185,7 +185,7 @@ Command *parseCommands(ArchivedFile *file) {
}
addNode(&root, &cmd->_node);
- fillBuffers(*_vm->_locationScript, true);
+ fillBuffers(script, true);
}
diff --git a/engines/parallaction/dialogue.cpp b/engines/parallaction/dialogue.cpp
index a7ceb7c697..c6e4608d31 100644
--- a/engines/parallaction/dialogue.cpp
+++ b/engines/parallaction/dialogue.cpp
@@ -58,7 +58,7 @@ int16 _answerBalloonH[10] = { 0 };
-Dialogue *Parallaction::parseDialogue(ArchivedFile *file) {
+Dialogue *Parallaction::parseDialogue(Script &script) {
// printf("parseDialogue()\n");
uint16 num_questions = 0;
uint16 v50[20];
@@ -69,7 +69,7 @@ Dialogue *Parallaction::parseDialogue(ArchivedFile *file) {
v50[_si] = 0;
}
- fillBuffers(*_locationScript, true);
+ fillBuffers(script, true);
while (scumm_stricmp(_tokens[0], "enddialogue")) {
if (scumm_stricmp(_tokens[0], "Question")) continue;
@@ -81,15 +81,15 @@ Dialogue *Parallaction::parseDialogue(ArchivedFile *file) {
_questions_names[num_questions] = (char*)memAlloc(strlen(_tokens[1])+1);
strcpy(_questions_names[num_questions], _tokens[1]);
- vB4->_text = parseDialogueString();
+ vB4->_text = parseDialogueString(script);
// printf("Question: '%s'\n", vB4->_text);
- fillBuffers(*_locationScript, true);
+ fillBuffers(script, true);
vB4->_mood = atoi(_tokens[0]);
uint16 _di = 0;
- fillBuffers(*_locationScript, true);
+ fillBuffers(script, true);
while (scumm_stricmp(_tokens[0], "endquestion")) { // parse answers
const char** v60 = const_cast<const char **>(_localFlagNames);
@@ -119,24 +119,24 @@ Dialogue *Parallaction::parseDialogue(ArchivedFile *file) {
}
- vB4->_answers[_di] = parseDialogueString();
+ vB4->_answers[_di] = parseDialogueString(script);
// printf("answer[%i]: '%s'\n", _di, vB4->_answers[_di]);
- fillBuffers(*_locationScript, true);
+ fillBuffers(script, true);
vB4->_answer_moods[_di] = atoi(_tokens[0]);
- vB4->_following._names[_di] = parseDialogueString();
+ vB4->_following._names[_di] = parseDialogueString(script);
- fillBuffers(*_locationScript, true);
+ fillBuffers(script, true);
if (!scumm_stricmp(_tokens[0], "commands")) {
- vB4->_commands[_di] = parseCommands(file);
- fillBuffers(*_locationScript, true);
+ vB4->_commands[_di] = parseCommands(script);
+ fillBuffers(script, true);
}
_di++;
}
- fillBuffers(*_locationScript, true);
+ fillBuffers(script, true);
num_questions++;
}
@@ -172,13 +172,13 @@ Dialogue *Parallaction::parseDialogue(ArchivedFile *file) {
}
-char *Parallaction::parseDialogueString() {
+char *Parallaction::parseDialogueString(Script &script) {
char vC8[200];
char *vD0 = NULL;
do {
- vD0 = _locationScript->readLine(vC8, 200);
+ vD0 = script.readLine(vC8, 200);
if (vD0 == 0) return NULL;
vD0 = Common::ltrim(vD0);
diff --git a/engines/parallaction/location.cpp b/engines/parallaction/location.cpp
index fa1684ffe4..a27420f32c 100644
--- a/engines/parallaction/location.cpp
+++ b/engines/parallaction/location.cpp
@@ -33,7 +33,7 @@ namespace Parallaction {
void resolveLocationForwards();
void loadExternalMaskPath(char *filename);
void switchBackground(char *name);
-void parseWalkNodes(ArchivedFile *file, Node *list);
+void parseWalkNodes(Script &script, Node *list);
void freeAnimations();
Node helperNode = { NULL, NULL };
@@ -147,10 +147,10 @@ void Parallaction::parseLocation(const char *filename) {
_localFlagNames[_si] = 0;
}
if (!scumm_stricmp(_tokens[0], "COMMANDS")) {
- _locationCommands = parseCommands(file);
+ _locationCommands = parseCommands(*_locationScript);
}
if (!scumm_stricmp(_tokens[0], "ACOMMANDS")) {
- _locationACommands = parseCommands(file);
+ _locationACommands = parseCommands(*_locationScript);
}
if (!scumm_stricmp(_tokens[0], "FLAGS")) {
if ((_localFlags[_currentLocationIndex] & kFlagsVisited) == 0) {
@@ -175,13 +175,13 @@ void Parallaction::parseLocation(const char *filename) {
_locationEndComment = parseComment(*_locationScript);
}
if (!scumm_stricmp(_tokens[0], "ZONE")) {
- parseZone(file, &_zones, _tokens[1]);
+ parseZone(*_locationScript, &_zones, _tokens[1]);
}
if (!scumm_stricmp(_tokens[0], "NODES")) {
- parseWalkNodes(file, &_locationWalkNodes);
+ parseWalkNodes(*_locationScript, &_locationWalkNodes);
}
if (!scumm_stricmp(_tokens[0], "ANIMATION")) {
- parseAnimation(file, &_animations, _tokens[1]);
+ parseAnimation(*_locationScript, &_animations, _tokens[1]);
}
if (!scumm_stricmp(_tokens[0], "SOUND")) {
strcpy(_soundFile, _tokens[1]);
@@ -266,9 +266,9 @@ void freeLocation() {
-void parseWalkNodes(ArchivedFile *file, Node *list) {
+void parseWalkNodes(Script& script, Node *list) {
- fillBuffers(*_vm->_locationScript, true);
+ fillBuffers(script, true);
while (scumm_stricmp(_tokens[0], "ENDNODES")) {
if (!scumm_stricmp(_tokens[0], "COORD")) {
@@ -281,7 +281,7 @@ void parseWalkNodes(ArchivedFile *file, Node *list) {
}
- fillBuffers(*_vm->_locationScript, true);
+ fillBuffers(script, true);
}
return;
diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h
index 42b26a32f5..67db74ee12 100644
--- a/engines/parallaction/parallaction.h
+++ b/engines/parallaction/parallaction.h
@@ -145,7 +145,7 @@ void addNode(Node *list, Node *n);
void removeNode(Node *n);
void freeNodeList(Node *list);
-Command *parseCommands(ArchivedFile *file);
+Command *parseCommands(Script &script);
void runCommands(Command *list, Zone *z = NULL);
void freeCommands(Command*);
@@ -154,7 +154,6 @@ void freeZones(Node *list);
void freeLocation();
void runDialogue(SpeakData*);
-Dialogue *parseDialogue(ArchivedFile *file);
void changeCharacter(const char *name);
@@ -242,8 +241,8 @@ public:
void changeCharacter(const char *name);
char *parseComment(Script &script);
- char *parseDialogueString();
- Dialogue *parseDialogue(ArchivedFile *file);
+ char *parseDialogueString(Script &script);
+ Dialogue *parseDialogue(Script &script);
public:
@@ -322,10 +321,10 @@ protected: // members
void resetTimer();
void doLocationEnterTransition();
- void parseZone(ArchivedFile *file, Node *list, char *name);
- Animation * parseAnimation(ArchivedFile *file, Node *list, char *name);
+ void parseZone(Script &script, Node *list, char *name);
+ Animation * parseAnimation(Script &script, Node *list, char *name);
void parseScriptLine(Instruction *inst, Animation *a, LocalVariable *locals);
- void parseZoneTypeBlock(ArchivedFile *file, Zone *z);
+ void parseZoneTypeBlock(Script &script, Zone *z);
void loadProgram(Animation *a, char *filename);
void changeLocation(char *location);
diff --git a/engines/parallaction/parser.h b/engines/parallaction/parser.h
index 51b2787ced..ea96252dab 100644
--- a/engines/parallaction/parser.h
+++ b/engines/parallaction/parser.h
@@ -32,7 +32,6 @@ struct ArchivedFile;
void parseInit(char *s);
char *parseNextLine(char *s, uint16 count);
-char *parseComment(ArchivedFile *file);
uint16 fillBuffers(Common::SeekableReadStream &stream, bool errorOnEOF = false);
char *parseNextToken(char *s, char *tok, uint16 count, const char *brk);
diff --git a/engines/parallaction/zone.cpp b/engines/parallaction/zone.cpp
index cf7c340ef9..4bbb177f67 100644
--- a/engines/parallaction/zone.cpp
+++ b/engines/parallaction/zone.cpp
@@ -54,12 +54,12 @@ Zone *findZone(const char *name) {
-void Parallaction::parseZone(ArchivedFile *file, Node *list, char *name) {
+void Parallaction::parseZone(Script &script, Node *list, char *name) {
// printf("parseZone(%s)", name);
if (findZone(name)) {
while (scumm_stricmp(_tokens[0], "endzone")) {
- fillBuffers(*_locationScript, true);
+ fillBuffers(script, true);
}
return;
}
@@ -72,7 +72,7 @@ void Parallaction::parseZone(ArchivedFile *file, Node *list, char *name) {
addNode(list, &z->_node);
- fillBuffers(*_locationScript, true);
+ fillBuffers(script, true);
while (scumm_stricmp(_tokens[0], "endzone")) {
// printf("token[0] = %s", _tokens[0]);
@@ -93,12 +93,12 @@ void Parallaction::parseZone(ArchivedFile *file, Node *list, char *name) {
int16 _si = searchTable(_tokens[1], _zoneTypeNames);
if (_si != -1) {
z->_type |= 1 << (_si - 1);
- parseZoneTypeBlock(file, z);
+ parseZoneTypeBlock(script, z);
continue;
}
}
if (!scumm_stricmp(_tokens[0], "commands")) {
- z->_commands = parseCommands(file);
+ z->_commands = parseCommands(script);
}
if (!scumm_stricmp(_tokens[0], "label")) {
// printf("label: %s", _tokens[1]);
@@ -114,7 +114,7 @@ void Parallaction::parseZone(ArchivedFile *file, Node *list, char *name) {
} while (!scumm_stricmp(_tokens[_si++], "|"));
}
- fillBuffers(*_locationScript, true);
+ fillBuffers(script, true);
}
return;
@@ -205,7 +205,7 @@ void freeZones(Node *list) {
-void Parallaction::parseZoneTypeBlock(ArchivedFile *file, Zone *z) {
+void Parallaction::parseZoneTypeBlock(Script &script, Zone *z) {
// printf("parseZoneTypeBlock()");
ZoneTypeData *u = &z->u;
@@ -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(*_locationScript);
+ u->examine->_description = parseComment(script);
}
break;
@@ -347,12 +347,12 @@ void Parallaction::parseZoneTypeBlock(ArchivedFile *file, Zone *z) {
// printf("speak file name: %s", u.speak._name);
}
if (!scumm_stricmp(_tokens[0], "Dialogue")) {
- u->speak->_dialogue = parseDialogue(file);
+ u->speak->_dialogue = parseDialogue(script);
}
break;
}
- fillBuffers(*_locationScript, true);
+ fillBuffers(script, true);
} while (scumm_stricmp(_tokens[0], "endzone"));
return;
diff --git a/engines/parallaction/zone.h b/engines/parallaction/zone.h
index f9a8251d9e..a3bb372b81 100644
--- a/engines/parallaction/zone.h
+++ b/engines/parallaction/zone.h
@@ -211,8 +211,6 @@ uint16 runZone(Zone *z);
void dropItem(uint16 v);
int16 pickupItem(Zone *z);
-void parseZone(ArchivedFile *file, Node *list, char *name);
-void parseZoneTypeBlock(ArchivedFile *file, Zone *z);
Zone *hitZone(uint32 type, uint16 x, uint16 y);
uint16 checkDoor();