Removed unused code and structures, and a bit of cleanup.

svn-id: r34080
This commit is contained in:
Nicola Mettifogo 2008-08-21 12:11:24 +00:00
parent 513f5ae150
commit 47b1a06e3b
7 changed files with 38 additions and 77 deletions

View File

@ -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

View File

@ -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;
}

View File

@ -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);

View File

@ -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; }

View File

@ -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)

View File

@ -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

View File

@ -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);