aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/parallaction/callables_ns.cpp28
-rw-r--r--engines/parallaction/parallaction.cpp10
-rw-r--r--engines/parallaction/parallaction.h7
-rw-r--r--engines/parallaction/parser_br.cpp6
-rw-r--r--engines/parallaction/parser_ns.cpp20
5 files changed, 34 insertions, 37 deletions
diff --git a/engines/parallaction/callables_ns.cpp b/engines/parallaction/callables_ns.cpp
index 45dd597104..92a3984285 100644
--- a/engines/parallaction/callables_ns.cpp
+++ b/engines/parallaction/callables_ns.cpp
@@ -188,21 +188,21 @@ void Parallaction_ns::_c_moveSarc(void *parm) {
_introSarcData2 = 0;
if (!_moveSarcZones[0]) {
- _moveSarcZones[0] = findZone("sarc1");
- _moveSarcZones[1] = findZone("sarc2");
- _moveSarcZones[2] = findZone("sarc3");
- _moveSarcZones[3] = findZone("sarc4");
- _moveSarcZones[4] = findZone("sarc5");
-
- _moveSarcExaZones[0] = findZone("sarc1exa");
- _moveSarcExaZones[1] = findZone("sarc2exa");
- _moveSarcExaZones[2] = findZone("sarc3exa");
- _moveSarcExaZones[3] = findZone("sarc4exa");
- _moveSarcExaZones[4] = findZone("sarc5exa");
+ _moveSarcZones[0] = _location.findZone("sarc1");
+ _moveSarcZones[1] = _location.findZone("sarc2");
+ _moveSarcZones[2] = _location.findZone("sarc3");
+ _moveSarcZones[3] = _location.findZone("sarc4");
+ _moveSarcZones[4] = _location.findZone("sarc5");
+
+ _moveSarcExaZones[0] = _location.findZone("sarc1exa");
+ _moveSarcExaZones[1] = _location.findZone("sarc2exa");
+ _moveSarcExaZones[2] = _location.findZone("sarc3exa");
+ _moveSarcExaZones[3] = _location.findZone("sarc4exa");
+ _moveSarcExaZones[4] = _location.findZone("sarc5exa");
}
- a = findAnimation("sposta");
+ a = _location.findAnimation("sposta");
_moveSarcZone1 = *(ZonePtr*)parm;
@@ -239,7 +239,7 @@ void Parallaction_ns::_c_moveSarc(void *parm) {
_moveSarcZones[3]->getX() == 134 &&
_moveSarcZones[4]->getX() == 167) {
- a = findAnimation("finito");
+ a = _location.findAnimation("finito");
a->_flags |= (kFlagsActive | kFlagsActing);
setLocationFlags(0x20); // GROSS HACK: activates 'finito' flag in dinoit_museo.loc
@@ -403,7 +403,7 @@ void Parallaction_ns::_c_closeMusic(void*) {
*/
void Parallaction_ns::_c_startIntro(void *parm) {
- _rightHandAnim = findAnimation("righthand");
+ _rightHandAnim = _location.findAnimation("righthand");
if (getPlatform() == Common::kPlatformPC) {
_soundMan->setMusicFile("intro");
diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp
index 534f0e6eef..cb4122dac8 100644
--- a/engines/parallaction/parallaction.cpp
+++ b/engines/parallaction/parallaction.cpp
@@ -189,9 +189,9 @@ void Parallaction::resumeJobs() {
return;
}
-AnimationPtr Parallaction::findAnimation(const char *name) {
+AnimationPtr Location::findAnimation(const char *name) {
- for (AnimationList::iterator it = _location._animations.begin(); it != _location._animations.end(); it++)
+ for (AnimationList::iterator it = _animations.begin(); it != _animations.end(); it++)
if (!scumm_stricmp((*it)->_name, name)) return *it;
return nullAnimationPtr;
@@ -808,12 +808,10 @@ ZonePtr Parallaction::hitZone(uint32 type, uint16 x, uint16 y) {
}
-ZonePtr Parallaction::findZone(const char *name) {
-
- for (ZoneList::iterator it = _location._zones.begin(); it != _location._zones.end(); it++) {
+ZonePtr Location::findZone(const char *name) {
+ for (ZoneList::iterator it = _zones.begin(); it != _zones.end(); it++) {
if (!scumm_stricmp((*it)->_name, name)) return *it;
}
-
return findAnimation(name);
}
diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h
index e6dddb5f02..f8e775c51f 100644
--- a/engines/parallaction/parallaction.h
+++ b/engines/parallaction/parallaction.h
@@ -159,6 +159,9 @@ public:
Location();
~Location();
+ AnimationPtr findAnimation(const char *name);
+ ZonePtr findZone(const char *name);
+
void cleanup(bool removeAll);
};
@@ -325,15 +328,11 @@ public:
bool checkSpecialZoneBox(ZonePtr z, uint32 type, uint x, uint y);
bool checkZoneBox(ZonePtr z, uint32 type, uint x, uint y);
bool checkLinkedAnimBox(ZonePtr z, uint32 type, uint x, uint y);
- ZonePtr findZone(const char *name);
ZonePtr hitZone(uint32 type, uint16 x, uint16 y);
void runZone(ZonePtr z);
- void freeZones(bool removeAll);
bool pickupItem(ZonePtr z);
void updateDoor(ZonePtr z, bool close);
void showZone(ZonePtr z, bool visible);
- AnimationPtr findAnimation(const char *name);
- void freeAnimations();
void setBackground(const char *background, const char *mask, const char *path);
void freeBackground();
void highlightInventoryItem(ItemPosition pos);
diff --git a/engines/parallaction/parser_br.cpp b/engines/parallaction/parser_br.cpp
index 4b11c5caa4..474b206551 100644
--- a/engines/parallaction/parser_br.cpp
+++ b/engines/parallaction/parser_br.cpp
@@ -717,7 +717,7 @@ DECLARE_ZONE_PARSER(limits) {
if (isalpha(_tokens[1][1])) {
ctxt.z->_flags |= kFlagsAnimLinked;
- ctxt.z->_linkedAnim = _vm->findAnimation(_tokens[1]);
+ ctxt.z->_linkedAnim = _vm->_location.findAnimation(_tokens[1]);
ctxt.z->_linkedName = strdup(_tokens[1]);
} else {
ctxt.z->setBox(atoi(_tokens[1]), atoi(_tokens[2]), atoi(_tokens[3]), atoi(_tokens[4]));
@@ -912,7 +912,7 @@ DECLARE_ANIM_PARSER(endanimation) {
DECLARE_INSTRUCTION_PARSER(zone) {
debugC(7, kDebugParser, "INSTRUCTION_PARSER(zone) ");
- ctxt.inst->_z = _vm->findZone(_tokens[1]);
+ ctxt.inst->_z = _vm->_location.findZone(_tokens[1]);
ctxt.inst->_index = _parser->_lookup;
}
@@ -1029,7 +1029,7 @@ void ProgramParser_br::parseRValue(ScriptVar &v, const char *str) {
AnimationPtr a;
if (str[1] == '.') {
- a = _vm->findAnimation(&str[2]);
+ a = _vm->_location.findAnimation(&str[2]);
if (!a) {
error("unknown animation '%s' in script", &str[2]);
}
diff --git a/engines/parallaction/parser_ns.cpp b/engines/parallaction/parser_ns.cpp
index 4b90e2364f..ea0f7b8e8d 100644
--- a/engines/parallaction/parser_ns.cpp
+++ b/engines/parallaction/parser_ns.cpp
@@ -306,11 +306,11 @@ void ProgramParser_ns::parseInstruction() {
if (_tokens[0][1] == '.') {
_tokens[0][1] = '\0';
- ctxt.a = _vm->findAnimation(&_tokens[0][2]);
+ ctxt.a = _vm->_location.findAnimation(&_tokens[0][2]);
} else
if (_tokens[1][1] == '.') {
_tokens[1][1] = '\0';
- ctxt.a = _vm->findAnimation(&_tokens[1][2]);
+ ctxt.a = _vm->_location.findAnimation(&_tokens[1][2]);
} else
ctxt.a = _program->_anim;
@@ -369,7 +369,7 @@ DECLARE_INSTRUCTION_PARSER(animation) {
if (!scumm_stricmp(_tokens[1], ctxt.a->_name)) {
ctxt.inst->_a = ctxt.a;
} else {
- ctxt.inst->_a = _vm->findAnimation(_tokens[1]);
+ ctxt.inst->_a = _vm->_location.findAnimation(_tokens[1]);
}
ctxt.inst->_index = _parser->_lookup;
@@ -466,7 +466,7 @@ DECLARE_INSTRUCTION_PARSER(put) {
if (!scumm_stricmp(_tokens[1], ctxt.a->_name)) {
ctxt.inst->_a = ctxt.a;
} else {
- ctxt.inst->_a = _vm->findAnimation(_tokens[1]);
+ ctxt.inst->_a = _vm->_location.findAnimation(_tokens[1]);
}
parseRValue(ctxt.inst->_opA, _tokens[2]);
@@ -492,7 +492,7 @@ DECLARE_INSTRUCTION_PARSER(call) {
DECLARE_INSTRUCTION_PARSER(sound) {
debugC(7, kDebugParser, "INSTRUCTION_PARSER(sound) ");
- ctxt.inst->_z = _vm->findZone(_tokens[1]);
+ ctxt.inst->_z = _vm->_location.findZone(_tokens[1]);
ctxt.inst->_index = _parser->_lookup;
}
@@ -545,7 +545,7 @@ void ProgramParser_ns::parseRValue(ScriptVar &v, const char *str) {
AnimationPtr a;
if (str[1] == '.') {
- a = _vm->findAnimation(&str[2]);
+ a = _vm->_location.findAnimation(&str[2]);
} else {
a = ctxt.a;
}
@@ -575,7 +575,7 @@ void ProgramParser_ns::parseLValue(ScriptVar &v, const char *str) {
AnimationPtr a;
if (str[1] == '.') {
- a = _vm->findAnimation(&str[2]);
+ a = _vm->_location.findAnimation(&str[2]);
} else {
a = ctxt.a;
}
@@ -628,7 +628,7 @@ DECLARE_COMMAND_PARSER(zone) {
createCommand(_parser->_lookup);
- ctxt.cmd->u._zone = _vm->findZone(_tokens[ctxt.nextToken]);
+ ctxt.cmd->u._zone = _vm->_location.findZone(_tokens[ctxt.nextToken]);
if (!ctxt.cmd->u._zone) {
saveCommandForward(_tokens[ctxt.nextToken], ctxt.cmd);
}
@@ -794,7 +794,7 @@ void LocationParser_ns::saveCommandForward(const char *name, CommandPtr cmd) {
void LocationParser_ns::resolveCommandForwards() {
for (uint i = 0; i < _numForwardedCommands; i++) {
- _forwardedCommands[i].cmd->u._zone = _vm->findZone(_forwardedCommands[i].name);
+ _forwardedCommands[i].cmd->u._zone = _vm->_location.findZone(_forwardedCommands[i].name);
if (_forwardedCommands[i].cmd->u._zone == 0) {
warning("Cannot find zone '%s' into current location script. This may be a bug in the original scripts.\n", _forwardedCommands[i].name);
}
@@ -1367,7 +1367,7 @@ DECLARE_ZONE_PARSER(flags) {
void LocationParser_ns::parseZone(ZoneList &list, char *name) {
debugC(5, kDebugParser, "parseZone(name: %s)", name);
- if (_vm->findZone(name)) {
+ if (_vm->_location.findZone(name)) {
_script->skip("endzone");
return;
}