aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/parallaction/callables_ns.cpp10
-rw-r--r--engines/parallaction/debug.cpp13
-rw-r--r--engines/parallaction/exec_ns.cpp3
-rw-r--r--engines/parallaction/gui_ns.cpp6
-rw-r--r--engines/parallaction/parallaction.cpp59
-rw-r--r--engines/parallaction/parallaction.h6
-rw-r--r--engines/parallaction/parallaction_ns.cpp1
-rw-r--r--engines/parallaction/saveload.cpp5
-rw-r--r--engines/parallaction/walk.cpp3
9 files changed, 57 insertions, 49 deletions
diff --git a/engines/parallaction/callables_ns.cpp b/engines/parallaction/callables_ns.cpp
index 1437c68f42..c894c45a6f 100644
--- a/engines/parallaction/callables_ns.cpp
+++ b/engines/parallaction/callables_ns.cpp
@@ -424,9 +424,7 @@ void Parallaction_ns::_c_finito(void *parm) {
_gfx->updateScreen();
waitUntilLeftClick();
- strcpy(_location._name, "estgrotta.drki");
-
- _engineFlags |= kEngineChangeLocation;
+ scheduleLocationSwitch("estgrotta.drki");
} else {
_gfx->setFont(_menuFont);
_gfx->displayCenteredString(70, v8C[_language]);
@@ -437,8 +435,7 @@ void Parallaction_ns::_c_finito(void *parm) {
_gfx->updateScreen();
waitUntilLeftClick();
- selectCharacterForNewLocation();
- _engineFlags |= kEngineChangeLocation;
+ selectStartLocation();
}
cleanupGame();
@@ -534,8 +531,7 @@ void Parallaction_ns::_c_endIntro(void *parm) {
waitUntilLeftClick();
_engineFlags &= ~kEngineBlockInput;
- selectCharacterForNewLocation();
- _engineFlags |= kEngineChangeLocation;
+ selectStartLocation();
cleanupGame();
diff --git a/engines/parallaction/debug.cpp b/engines/parallaction/debug.cpp
index 8239ba9f8b..960dd31584 100644
--- a/engines/parallaction/debug.cpp
+++ b/engines/parallaction/debug.cpp
@@ -83,22 +83,21 @@ void Debugger::postEnter() {
bool Debugger::Cmd_Location(int argc, const char **argv) {
const char *character = _vm->_char.getName();
- char *location = _vm->_location._name;
+ const char *location = _vm->_location._name;
+
+ char tmp[PATH_LEN];
switch (argc) {
case 3:
character = const_cast<char*>(argv[2]);
location = const_cast<char*>(argv[1]);
- sprintf(_vm->_location._name, "%s.%s", location, character);
- // TODO: check if location exists
- _engineFlags |= kEngineChangeLocation;
+ sprintf(tmp, "%s.%s", location, character);
+ _vm->scheduleLocationSwitch(tmp);
break;
case 2:
location = const_cast<char*>(argv[1]);
- sprintf(_vm->_location._name, "%s", location);
- // TODO: check if location exists
- _engineFlags |= kEngineChangeLocation;
+ _vm->scheduleLocationSwitch(location);
break;
case 1:
diff --git a/engines/parallaction/exec_ns.cpp b/engines/parallaction/exec_ns.cpp
index 75e359aa04..034c7650f3 100644
--- a/engines/parallaction/exec_ns.cpp
+++ b/engines/parallaction/exec_ns.cpp
@@ -248,8 +248,7 @@ DECLARE_COMMAND_OPCODE(get) {
DECLARE_COMMAND_OPCODE(location) {
- strcpy(_location._name, _cmdRunCtxt.cmd->u._string);
- _engineFlags |= kEngineChangeLocation;
+ scheduleLocationSwitch(_cmdRunCtxt.cmd->u._string);
}
diff --git a/engines/parallaction/gui_ns.cpp b/engines/parallaction/gui_ns.cpp
index 3909761501..3eca5bd4ca 100644
--- a/engines/parallaction/gui_ns.cpp
+++ b/engines/parallaction/gui_ns.cpp
@@ -155,7 +155,7 @@ void Parallaction_ns::guiStart() {
return;
case SELECT_CHARACTER:
- selectCharacterForNewLocation();
+ selectStartLocation();
break;
}
@@ -163,12 +163,12 @@ void Parallaction_ns::guiStart() {
return;
}
-void Parallaction_ns::selectCharacterForNewLocation() {
+void Parallaction_ns::selectStartLocation() {
int character = guiSelectCharacter();
if (character == -1)
error("invalid character selected from menu screen");
- strcpy(_location._name, _charStartLocation[character]);
+ scheduleLocationSwitch(_charStartLocation[character]);
}
diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp
index c0e7bbddcc..f9bfdf2e40 100644
--- a/engines/parallaction/parallaction.cpp
+++ b/engines/parallaction/parallaction.cpp
@@ -274,23 +274,9 @@ void Parallaction::runGame() {
while ((_engineFlags & kEngineQuit) == 0) {
_keyDown = updateInput();
-
- debugC(3, kDebugInput, "runGame: input flags (%i, %i, %i, %i)",
- !_mouseHidden,
- (_engineFlags & kEngineBlockInput) == 0,
- (_engineFlags & kEngineWalking) == 0,
- (_engineFlags & kEngineChangeLocation) == 0
- );
-
- // WORKAROUND: the engine doesn't check for displayed labels before performing a location
- // switch, thus crashing whenever a jobDisplayLabel/jEraseLabel pair is left into the
- // queue after the character enters a door.
- // Skipping input processing when kEngineChangeLocation is set solves the issue. It's
- // noteworthy that the programmers added this very check in Big Red Adventure's engine,
- // so it should be ok here in Nippon Safes too.
- if ((!_mouseHidden) && ((_engineFlags & kEngineBlockInput) == 0) && ((_engineFlags & kEngineWalking) == 0) && ((_engineFlags & kEngineChangeLocation) == 0)) {
- InputData *v8 = translateInput();
- if (v8) processInput(v8);
+ InputData *v8 = translateInput();
+ if (v8) {
+ processInput(v8);
}
if (_activeZone) {
@@ -305,18 +291,23 @@ void Parallaction::runGame() {
continue;
}
- g_system->delayMillis(30);
-
runJobs();
- if ((_engineFlags & kEnginePauseJobs) == 0 || (_engineFlags & kEngineInventory)) {
- _gfx->swapBuffers();
- _gfx->animatePalette();
- }
+ updateView();
}
- return;
+}
+
+void Parallaction::updateView() {
+
+ if ((_engineFlags & kEnginePauseJobs) && (_engineFlags & kEngineInventory) == 0) {
+ return;
+ }
+
+ _gfx->animatePalette();
+ _gfx->swapBuffers();
+ g_system->delayMillis(30);
}
void Parallaction::showLabel(Label &label) {
@@ -429,6 +420,22 @@ void Parallaction::processInput(InputData *data) {
Parallaction::InputData *Parallaction::translateInput() {
+ debugC(3, kDebugInput, "translateInput: input flags (%i, %i, %i, %i)",
+ !_mouseHidden,
+ (_engineFlags & kEngineBlockInput) == 0,
+ (_engineFlags & kEngineWalking) == 0,
+ (_engineFlags & kEngineChangeLocation) == 0
+ );
+
+ if ((_mouseHidden) ||
+ (_engineFlags & kEngineBlockInput) ||
+ (_engineFlags & kEngineWalking) ||
+ (_engineFlags & kEngineChangeLocation)) {
+
+ return NULL;
+ }
+
+
if (_keyDown == kEvQuitGame) {
_input._event = kEvQuitGame;
return &_input;
@@ -1047,6 +1054,10 @@ void Parallaction::beep() {
_soundMan->playSfx("beep", 3, false);
}
+void Parallaction::scheduleLocationSwitch(const char *location) {
+ strcpy(_location._name, location);
+ _engineFlags |= kEngineChangeLocation;
+}
} // namespace Parallaction
diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h
index 66a5a12372..11e022c431 100644
--- a/engines/parallaction/parallaction.h
+++ b/engines/parallaction/parallaction.h
@@ -536,12 +536,15 @@ protected: // members
void initGlobals();
void runGame();
+ void updateView();
uint32 getElapsedTime();
void resetTimer();
InputData *translateInput();
void processInput(InputData*);
+
+ void scheduleLocationSwitch(const char *location);
void doLocationEnterTransition();
virtual void changeLocation(char *location) = 0;
virtual void changeCharacter(const char *name) = 0;
@@ -904,7 +907,7 @@ protected:
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(move);
DECLARE_UNQUALIFIED_INSTRUCTION_OPCODE(endscript);
- void selectCharacterForNewLocation();
+ void selectStartLocation();
void guiStart();
int guiSelectCharacter();
@@ -978,7 +981,6 @@ private:
const JobFn *_jobsFn;
JobOpcode* createJobOpcode(uint functionId, Job *job);
-
void changeLocation(char *location);
void changeCharacter(const char *name);
diff --git a/engines/parallaction/parallaction_ns.cpp b/engines/parallaction/parallaction_ns.cpp
index 4105ed3f16..8a70b31fff 100644
--- a/engines/parallaction/parallaction_ns.cpp
+++ b/engines/parallaction/parallaction_ns.cpp
@@ -410,6 +410,7 @@ void Parallaction_ns::changeLocation(char *location) {
}
+
void Parallaction_ns::changeCharacter(const char *name) {
debugC(1, kDebugExec, "changeCharacter(%s)", name);
diff --git a/engines/parallaction/saveload.cpp b/engines/parallaction/saveload.cpp
index 02be4c6ee8..cbc00dc720 100644
--- a/engines/parallaction/saveload.cpp
+++ b/engines/parallaction/saveload.cpp
@@ -159,8 +159,9 @@ void Parallaction_ns::doLoadGame(uint16 slot) {
// bugs, but it's a good maneuver anyway
strcpy(_characterName1, "null");
- sprintf(_location._name, "%s.%s" , l, n);
- _engineFlags |= kEngineChangeLocation;
+ char tmp[PATH_LEN];
+ sprintf(tmp, "%s.%s" , l, n);
+ scheduleLocationSwitch(tmp);
return;
}
diff --git a/engines/parallaction/walk.cpp b/engines/parallaction/walk.cpp
index 4d38bc93f0..8c12395952 100644
--- a/engines/parallaction/walk.cpp
+++ b/engines/parallaction/walk.cpp
@@ -344,9 +344,8 @@ uint16 Parallaction::checkDoor() {
if ((z->_flags & kFlagsClosed) == 0) {
_location._startPosition = z->u.door->_startPos;
_location._startFrame = z->u.door->_startFrame;
- strcpy(_location._name, z->u.door->_location);
- _engineFlags |= kEngineChangeLocation;
+ scheduleLocationSwitch(z->u.door->_location);
_zoneTrap = NULL;
} else {