aboutsummaryrefslogtreecommitdiff
path: root/engines/parallaction
diff options
context:
space:
mode:
authorNicola Mettifogo2008-08-21 12:11:24 +0000
committerNicola Mettifogo2008-08-21 12:11:24 +0000
commit47b1a06e3b42da767e5d46529e763cd5e710d263 (patch)
treefb4d00d10918ac4b99bc2de5090add98c5cab6c5 /engines/parallaction
parent513f5ae150ad60bd899bae7ecae2435363e1d84d (diff)
downloadscummvm-rg350-47b1a06e3b42da767e5d46529e763cd5e710d263.tar.gz
scummvm-rg350-47b1a06e3b42da767e5d46529e763cd5e710d263.tar.bz2
scummvm-rg350-47b1a06e3b42da767e5d46529e763cd5e710d263.zip
Removed unused code and structures, and a bit of cleanup.
svn-id: r34080
Diffstat (limited to 'engines/parallaction')
-rw-r--r--engines/parallaction/exec_br.cpp23
-rw-r--r--engines/parallaction/gui_br.cpp2
-rw-r--r--engines/parallaction/input.cpp23
-rw-r--r--engines/parallaction/input.h19
-rw-r--r--engines/parallaction/parallaction.cpp11
-rw-r--r--engines/parallaction/parallaction.h11
-rw-r--r--engines/parallaction/parallaction_br.cpp26
7 files changed, 38 insertions, 77 deletions
diff --git a/engines/parallaction/exec_br.cpp b/engines/parallaction/exec_br.cpp
index fe7b1b2903..bcc4a5b532 100644
--- a/engines/parallaction/exec_br.cpp
+++ b/engines/parallaction/exec_br.cpp
@@ -546,27 +546,4 @@ ProgramExec_br::ProgramExec_br(Parallaction_br *vm) : ProgramExec_ns(vm), _vm(vm
ProgramExec_br::~ProgramExec_br() {
}
-#if 0
-void Parallaction_br::jobWaitRemoveLabelJob(void *parm, Job *job) {
-
-}
-
-void Parallaction_br::jobPauseSfx(void *parm, Job *job) {
-
-}
-
-
-void Parallaction_br::jobStopFollower(void *parm, Job *job) {
-
-}
-
-
-void Parallaction_br::jobScroll(void *parm, Job *job) {
-
-}
-#endif
-
-
-
-
} // namespace Parallaction
diff --git a/engines/parallaction/gui_br.cpp b/engines/parallaction/gui_br.cpp
index d2169a9073..064f6f7fa5 100644
--- a/engines/parallaction/gui_br.cpp
+++ b/engines/parallaction/gui_br.cpp
@@ -52,8 +52,6 @@ public:
pal.fadeTo(blackPal, 1);
_vm->_gfx->setPalette(pal);
_fadeSteps--;
- // TODO: properly implement timers to avoid delay calls
- _vm->_system->delayMillis(20);
return this;
}
diff --git a/engines/parallaction/input.cpp b/engines/parallaction/input.cpp
index 287618e803..e3c13bbbcb 100644
--- a/engines/parallaction/input.cpp
+++ b/engines/parallaction/input.cpp
@@ -127,7 +127,9 @@ void Input::waitForButtonEvent(uint32 buttonEventMask, int32 timeout) {
}
-void Input::updateGameInput() {
+int Input::updateGameInput() {
+
+ int event = kEvNone;
readInput();
@@ -141,25 +143,25 @@ void Input::updateGameInput() {
(_engineFlags & kEngineChangeLocation) == 0
);
- return;
+ return event;
}
if (_hasKeyPressEvent && (_vm->getFeatures() & GF_DEMO) == 0) {
- if (_keyPressed.keycode == Common::KEYCODE_l) _inputData._event = kEvLoadGame;
- if (_keyPressed.keycode == Common::KEYCODE_s) _inputData._event = kEvSaveGame;
+ if (_keyPressed.keycode == Common::KEYCODE_l) event = kEvLoadGame;
+ if (_keyPressed.keycode == Common::KEYCODE_s) event = kEvSaveGame;
}
- if (_inputData._event == kEvNone) {
- _inputData._mousePos = _mousePos;
+ if (event == kEvNone) {
translateGameInput();
}
+ return event;
}
-InputData* Input::updateInput() {
+int Input::updateInput() {
- _inputData._event = kEvNone;
+ int event = kEvNone;
switch (_inputMode) {
case kInputModeComment:
@@ -169,7 +171,7 @@ InputData* Input::updateInput() {
break;
case kInputModeGame:
- updateGameInput();
+ event = updateGameInput();
break;
case kInputModeInventory:
@@ -178,7 +180,7 @@ InputData* Input::updateInput() {
break;
}
- return &_inputData;
+ return event;
}
void Input::trackMouse(ZonePtr z) {
@@ -252,7 +254,6 @@ bool Input::translateGameInput() {
if ((_mouseButtons == kMouseLeftUp) && ((_activeItem._id != 0) || ((z->_type & 0xFFFF) == kZoneCommand))) {
- _inputData._zone = z;
if (z->_flags & kFlagsNoWalk) {
// character doesn't need to walk to take specified action
takeAction(z);
diff --git a/engines/parallaction/input.h b/engines/parallaction/input.h
index c1e912db74..0d0194cdc7 100644
--- a/engines/parallaction/input.h
+++ b/engines/parallaction/input.h
@@ -41,14 +41,6 @@ enum {
kMouseRightDown = 8
};
-struct InputData {
- uint16 _event;
- Common::Point _mousePos;
- int16 _inventoryIndex;
- ZonePtr _zone;
- uint _label;
-};
-
enum MouseTriState {
MOUSE_ENABLED_SHOW,
MOUSE_ENABLED_HIDE,
@@ -56,10 +48,7 @@ enum MouseTriState {
};
class Input {
- void updateGameInput();
-
- // input-only
- InputData _inputData;
+ int updateGameInput();
bool _hasKeyPressEvent;
Common::KeyState _keyPressed;
@@ -69,7 +58,7 @@ class Input {
int16 _transCurrentHoverItem;
- InputData *translateInput();
+ void translateInput();
bool translateGameInput();
bool updateInventoryInput();
void takeAction(ZonePtr z);
@@ -91,7 +80,7 @@ public:
kInputModeComment = 1,
kInputModeDialogue = 2,
kInputModeInventory = 3,
- kInputModeMenu = 4
+ kInputModeMenu = 4,
};
@@ -116,7 +105,7 @@ public:
InventoryItem _activeItem;
void readInput();
- InputData* updateInput();
+ int updateInput();
void trackMouse(ZonePtr z);
void waitForButtonEvent(uint32 buttonEventMask, int32 timeout = -1);
uint32 getLastButtonEvent() { return _mouseButtons; }
diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp
index fd4d3bdf59..c5817b2559 100644
--- a/engines/parallaction/parallaction.cpp
+++ b/engines/parallaction/parallaction.cpp
@@ -303,12 +303,9 @@ void Parallaction::showLocationComment(const char *text, bool end) {
}
-void Parallaction::processInput(InputData *data) {
- if (!data) {
- return;
- }
+void Parallaction::processInput(int event) {
- switch (data->_event) {
+ switch (event) {
case kEvSaveGame:
_input->stopHovering();
saveGame();
@@ -328,7 +325,7 @@ void Parallaction::processInput(InputData *data) {
void Parallaction::runGame() {
- InputData *data = _input->updateInput();
+ int event = _input->updateInput();
if (_engineFlags & kEngineQuit)
return;
@@ -337,7 +334,7 @@ void Parallaction::runGame() {
runCommentFrame();
if (_input->_inputMode == Input::kInputModeGame) {
- processInput(data);
+ processInput(event);
runPendingZones();
if (_engineFlags & kEngineQuit)
diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h
index daa14b91ae..936bb8d5a0 100644
--- a/engines/parallaction/parallaction.h
+++ b/engines/parallaction/parallaction.h
@@ -29,6 +29,7 @@
#include "common/str.h"
#include "common/stack.h"
#include "common/array.h"
+#include "common/func.h"
#include "common/savefile.h"
#include "engines/engine.h"
@@ -256,7 +257,7 @@ public:
Input *_input;
- void processInput(InputData* data);
+ void processInput(int event);
void pauseJobs();
void resumeJobs();
@@ -656,6 +657,7 @@ private:
void initPart();
void freePart();
+ void freeLocation();
void initCursors();
@@ -682,13 +684,6 @@ private:
void parseLocation(const char* name);
void loadProgram(AnimationPtr a, const char *filename);
-
-#if 0
- void jobWaitRemoveLabelJob(void *parm, Job *job);
- void jobPauseSfx(void *parm, Job *job);
- void jobStopFollower(void *parm, Job *job);
- void jobScroll(void *parm, Job *job);
-#endif
};
// FIXME: remove global
diff --git a/engines/parallaction/parallaction_br.cpp b/engines/parallaction/parallaction_br.cpp
index b94e7e5936..1030fee8dc 100644
--- a/engines/parallaction/parallaction_br.cpp
+++ b/engines/parallaction/parallaction_br.cpp
@@ -209,6 +209,7 @@ void Parallaction_br::initPart() {
}
void Parallaction_br::freePart() {
+ freeLocation();
delete _globalFlagsNames;
delete _objectsNames;
@@ -262,8 +263,7 @@ void Parallaction_br::runPendingZones() {
}
}
-
-void Parallaction_br::changeLocation(char *location) {
+void Parallaction_br::freeLocation() {
// free open location stuff
clearSubtitles();
@@ -281,27 +281,31 @@ void Parallaction_br::changeLocation(char *location) {
_location._animations.push_front(_char._ani);
-// free(_location._comment);
-// _location._comment = 0;
+ free(_location._comment);
+ _location._comment = 0;
_location._commands.clear();
_location._aCommands.clear();
+}
+
+
+
+void Parallaction_br::changeLocation(char *location) {
+ freeLocation();
// load new location
parseLocation(location);
-
- // kFlagsRemove is cleared because the character defaults to visible on new locations
- // script command can hide the character, anyway, so that's why the flag is cleared
- // before _location._commands are executed
+ // kFlagsRemove is cleared because the character is visible by default.
+ // Commands can hide the character, anyway.
_char._ani->_flags &= ~kFlagsRemove;
-
_cmdExec->run(_location._commands);
-// doLocationEnterTransition();
+
+ doLocationEnterTransition();
+
_cmdExec->run(_location._aCommands);
_engineFlags &= ~kEngineChangeLocation;
}
-
// FIXME: Parallaction_br::parseLocation() is now a verbatim copy of the same routine from Parallaction_ns.
void Parallaction_br::parseLocation(const char *filename) {
debugC(1, kDebugParser, "parseLocation('%s')", filename);