[Scummvm-cvs-logs] SF.net SVN: scummvm:[34080] scummvm/trunk/engines/parallaction

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Thu Aug 21 14:11:25 CEST 2008


Revision: 34080
          http://scummvm.svn.sourceforge.net/scummvm/?rev=34080&view=rev
Author:   peres001
Date:     2008-08-21 12:11:24 +0000 (Thu, 21 Aug 2008)

Log Message:
-----------
Removed unused code and structures, and a bit of cleanup.

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/exec_br.cpp
    scummvm/trunk/engines/parallaction/gui_br.cpp
    scummvm/trunk/engines/parallaction/input.cpp
    scummvm/trunk/engines/parallaction/input.h
    scummvm/trunk/engines/parallaction/parallaction.cpp
    scummvm/trunk/engines/parallaction/parallaction.h
    scummvm/trunk/engines/parallaction/parallaction_br.cpp

Modified: scummvm/trunk/engines/parallaction/exec_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/exec_br.cpp	2008-08-21 12:04:55 UTC (rev 34079)
+++ scummvm/trunk/engines/parallaction/exec_br.cpp	2008-08-21 12:11:24 UTC (rev 34080)
@@ -546,27 +546,4 @@
 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

Modified: scummvm/trunk/engines/parallaction/gui_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/gui_br.cpp	2008-08-21 12:04:55 UTC (rev 34079)
+++ scummvm/trunk/engines/parallaction/gui_br.cpp	2008-08-21 12:11:24 UTC (rev 34080)
@@ -52,8 +52,6 @@
 			pal.fadeTo(blackPal, 1);
 			_vm->_gfx->setPalette(pal);
 			_fadeSteps--;
-			// TODO: properly implement timers to avoid delay calls
-			_vm->_system->delayMillis(20);
 			return this;
 		}
 

Modified: scummvm/trunk/engines/parallaction/input.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/input.cpp	2008-08-21 12:04:55 UTC (rev 34079)
+++ scummvm/trunk/engines/parallaction/input.cpp	2008-08-21 12:11:24 UTC (rev 34080)
@@ -127,8 +127,10 @@
 }
 
 
-void Input::updateGameInput() {
+int Input::updateGameInput() {
 
+	int event = kEvNone;
+
 	readInput();
 
 	if (!isMouseEnabled() ||
@@ -141,25 +143,25 @@
 			(_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 @@
 		break;
 
 	case kInputModeGame:
-		updateGameInput();
+		event = updateGameInput();
 		break;
 
 	case kInputModeInventory:
@@ -178,7 +180,7 @@
 		break;
 	}
 
-	return &_inputData;
+	return event;
 }
 
 void Input::trackMouse(ZonePtr z) {
@@ -252,7 +254,6 @@
 
 	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);

Modified: scummvm/trunk/engines/parallaction/input.h
===================================================================
--- scummvm/trunk/engines/parallaction/input.h	2008-08-21 12:04:55 UTC (rev 34079)
+++ scummvm/trunk/engines/parallaction/input.h	2008-08-21 12:11:24 UTC (rev 34080)
@@ -41,14 +41,6 @@
 	kMouseRightDown		= 8
 };
 
-struct InputData {
-	uint16			_event;
-	Common::Point	_mousePos;
-	int16		_inventoryIndex;
-	ZonePtr		_zone;
-	uint		_label;
-};
-
 enum MouseTriState {
 	MOUSE_ENABLED_SHOW,
 	MOUSE_ENABLED_HIDE,
@@ -56,11 +48,8 @@
 };
 
 class Input {
-	void updateGameInput();
+	int 		updateGameInput();
 
-	// input-only
-	InputData	_inputData;
-
 	bool		_hasKeyPressEvent;
 	Common::KeyState _keyPressed;
 
@@ -69,7 +58,7 @@
 
 	int16		_transCurrentHoverItem;
 
-	InputData	*translateInput();
+	void		translateInput();
 	bool		translateGameInput();
 	bool		updateInventoryInput();
 	void 		takeAction(ZonePtr z);
@@ -91,7 +80,7 @@
 		kInputModeComment = 1,
 		kInputModeDialogue = 2,
 		kInputModeInventory = 3,
-		kInputModeMenu = 4
+		kInputModeMenu = 4,
 	};
 
 
@@ -116,7 +105,7 @@
 	InventoryItem	_activeItem;
 
 	void	readInput();
-	InputData* 	updateInput();
+	int 	updateInput();
 	void	trackMouse(ZonePtr z);
 	void	waitForButtonEvent(uint32 buttonEventMask, int32 timeout = -1);
 	uint32	getLastButtonEvent() { return _mouseButtons; }

Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp	2008-08-21 12:04:55 UTC (rev 34079)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp	2008-08-21 12:11:24 UTC (rev 34080)
@@ -303,12 +303,9 @@
 }
 
 
-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::runGame() {
 
-	InputData *data = _input->updateInput();
+	int event = _input->updateInput();
 	if (_engineFlags & kEngineQuit)
 		return;
 
@@ -337,7 +334,7 @@
 	runCommentFrame();
 
 	if (_input->_inputMode == Input::kInputModeGame) {
-		processInput(data);
+		processInput(event);
 		runPendingZones();
 
 		if (_engineFlags & kEngineQuit)

Modified: scummvm/trunk/engines/parallaction/parallaction.h
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.h	2008-08-21 12:04:55 UTC (rev 34079)
+++ scummvm/trunk/engines/parallaction/parallaction.h	2008-08-21 12:11:24 UTC (rev 34080)
@@ -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 @@
 
 	Input	*_input;
 
-	void		processInput(InputData* data);
+	void		processInput(int event);
 
 	void		pauseJobs();
 	void		resumeJobs();
@@ -656,6 +657,7 @@
 
 	void		initPart();
 	void		freePart();
+	void		freeLocation();
 
 	void initCursors();
 
@@ -682,13 +684,6 @@
 
 	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

Modified: scummvm/trunk/engines/parallaction/parallaction_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction_br.cpp	2008-08-21 12:04:55 UTC (rev 34079)
+++ scummvm/trunk/engines/parallaction/parallaction_br.cpp	2008-08-21 12:11:24 UTC (rev 34080)
@@ -209,6 +209,7 @@
 }
 
 void Parallaction_br::freePart() {
+	freeLocation();
 
 	delete _globalFlagsNames;
 	delete _objectsNames;
@@ -262,9 +263,8 @@
 	}
 }
 
+void Parallaction_br::freeLocation() {
 
-void Parallaction_br::changeLocation(char *location) {
-
 	// free open location stuff
 	clearSubtitles();
 	freeBackground();
@@ -281,27 +281,31 @@
 
 	_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);
 
-	_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);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list