aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorNicola Mettifogo2009-02-26 14:42:03 +0000
committerNicola Mettifogo2009-02-26 14:42:03 +0000
commitb76ad3dc4ff3448c360e23e9af4aaf80ca2e1501 (patch)
tree4f171c2cfa1d4f382d118c853a38f50fbdd7520d /engines
parent868b589af62d8afec68265651d807c183c4659bf (diff)
downloadscummvm-rg350-b76ad3dc4ff3448c360e23e9af4aaf80ca2e1501.tar.gz
scummvm-rg350-b76ad3dc4ff3448c360e23e9af4aaf80ca2e1501.tar.bz2
scummvm-rg350-b76ad3dc4ff3448c360e23e9af4aaf80ca2e1501.zip
changeLocation now uses the internal variable _newLocationName instead of an input parameter.
svn-id: r38902
Diffstat (limited to 'engines')
-rw-r--r--engines/parallaction/parallaction.cpp4
-rw-r--r--engines/parallaction/parallaction.h7
-rw-r--r--engines/parallaction/parallaction_br.cpp14
-rw-r--r--engines/parallaction/parallaction_ns.cpp11
4 files changed, 27 insertions, 9 deletions
diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp
index c3b5799e08..7565346e39 100644
--- a/engines/parallaction/parallaction.cpp
+++ b/engines/parallaction/parallaction.cpp
@@ -338,7 +338,7 @@ void Parallaction::runGameFrame(int event) {
return;
if (_engineFlags & kEngineChangeLocation) {
- changeLocation(_location._name);
+ changeLocation();
}
_programExec->runScripts(_location._programs.begin(), _location._programs.end());
@@ -954,7 +954,7 @@ void Parallaction::beep() {
void Parallaction::scheduleLocationSwitch(const char *location) {
debugC(9, kDebugExec, "scheduleLocationSwitch(%s)\n", location);
- strcpy(_location._name, location);
+ _newLocationName = location;
_engineFlags |= kEngineChangeLocation;
}
diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h
index b7bf8af72c..0a20d519bb 100644
--- a/engines/parallaction/parallaction.h
+++ b/engines/parallaction/parallaction.h
@@ -291,6 +291,7 @@ public:
char _characterName1[50]; // only used in changeCharacter
ZonePtr _zoneTrap;
ZonePtr _commentZone;
+ Common::String _newLocationName;
protected:
void runGame();
@@ -352,7 +353,7 @@ public:
void closeInventory();
virtual void parseLocation(const char* name) = 0;
- virtual void changeLocation(char *location) = 0;
+ virtual void changeLocation() = 0;
virtual void changeCharacter(const char *name) = 0;
virtual void callFunction(uint index, void* parm) = 0;
virtual void runPendingZones() = 0;
@@ -376,7 +377,7 @@ public:
public:
virtual void parseLocation(const char *filename);
- virtual void changeLocation(char *location);
+ virtual void changeLocation();
virtual void changeCharacter(const char *name);
virtual void callFunction(uint index, void* parm);
virtual void runPendingZones();
@@ -474,7 +475,7 @@ public:
public:
virtual void parseLocation(const char* name);
- virtual void changeLocation(char *location);
+ virtual void changeLocation();
virtual void changeCharacter(const char *name);
virtual void callFunction(uint index, void* parm);
virtual void runPendingZones();
diff --git a/engines/parallaction/parallaction_br.cpp b/engines/parallaction/parallaction_br.cpp
index 1e695844ff..b790b90c7c 100644
--- a/engines/parallaction/parallaction_br.cpp
+++ b/engines/parallaction/parallaction_br.cpp
@@ -224,14 +224,20 @@ void Parallaction_br::cleanupGame() {
}
-void Parallaction_br::changeLocation(char *location) {
+void Parallaction_br::changeLocation() {
+ if (_newLocationName.empty()) {
+ return;
+ }
+
+ char location[200];
+ strcpy(location, _newLocationName.c_str());
+
char *partStr = strrchr(location, '.');
if (partStr) {
cleanupGame();
int n = partStr - location;
- strncpy(_location._name, location, n);
- _location._name[n] = '\0';
+ location[n] = '\0';
_part = atoi(++partStr);
if (getFeatures() & GF_DEMO) {
@@ -260,6 +266,7 @@ void Parallaction_br::changeLocation(char *location) {
freeLocation(false);
// load new location
+ strcpy(_location._name, location);
parseLocation(location);
if (_location._startPosition.x != -1000) {
@@ -293,6 +300,7 @@ void Parallaction_br::changeLocation(char *location) {
_cmdExec->run(_location._aCommands);
_engineFlags &= ~kEngineChangeLocation;
+ _newLocationName.clear();
}
// FIXME: Parallaction_br::parseLocation() is now a verbatim copy of the same routine from Parallaction_ns.
diff --git a/engines/parallaction/parallaction_ns.cpp b/engines/parallaction/parallaction_ns.cpp
index a94d4a90b6..8d0317f1f2 100644
--- a/engines/parallaction/parallaction_ns.cpp
+++ b/engines/parallaction/parallaction_ns.cpp
@@ -288,7 +288,15 @@ void Parallaction_ns::runPendingZones() {
// changeLocation handles transitions between locations, and is able to display slides
// between one and the other.
//
-void Parallaction_ns::changeLocation(char *location) {
+void Parallaction_ns::changeLocation() {
+ if (_newLocationName.empty()) {
+ return;
+ }
+
+ char location[200];
+ strcpy(location, _newLocationName.c_str());
+ strcpy(_location._name, _newLocationName.c_str());
+
debugC(1, kDebugExec, "changeLocation(%s)", location);
MouseTriState oldMouseState = _input->getMouseState();
@@ -368,6 +376,7 @@ void Parallaction_ns::changeLocation(char *location) {
}
debugC(1, kDebugExec, "changeLocation() done");
+ _newLocationName.clear();
}