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

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Sun May 13 16:38:07 CEST 2007


Revision: 26834
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26834&view=rev
Author:   peres001
Date:     2007-05-13 07:38:05 -0700 (Sun, 13 May 2007)

Log Message:
-----------
cleanup

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/animation.cpp
    scummvm/trunk/engines/parallaction/callables.cpp
    scummvm/trunk/engines/parallaction/commands.cpp
    scummvm/trunk/engines/parallaction/commands.h
    scummvm/trunk/engines/parallaction/debug.cpp
    scummvm/trunk/engines/parallaction/dialogue.cpp
    scummvm/trunk/engines/parallaction/disk.cpp
    scummvm/trunk/engines/parallaction/font.cpp
    scummvm/trunk/engines/parallaction/graphics.cpp
    scummvm/trunk/engines/parallaction/intro.cpp
    scummvm/trunk/engines/parallaction/inventory.cpp
    scummvm/trunk/engines/parallaction/inventory.h
    scummvm/trunk/engines/parallaction/location.cpp
    scummvm/trunk/engines/parallaction/menu.cpp
    scummvm/trunk/engines/parallaction/parallaction.cpp
    scummvm/trunk/engines/parallaction/parallaction.h
    scummvm/trunk/engines/parallaction/parser.cpp
    scummvm/trunk/engines/parallaction/parser.h
    scummvm/trunk/engines/parallaction/saveload.cpp
    scummvm/trunk/engines/parallaction/staticres.cpp
    scummvm/trunk/engines/parallaction/walk.cpp
    scummvm/trunk/engines/parallaction/walk.h
    scummvm/trunk/engines/parallaction/zone.cpp
    scummvm/trunk/engines/parallaction/zone.h

Modified: scummvm/trunk/engines/parallaction/animation.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/animation.cpp	2007-05-13 13:19:46 UTC (rev 26833)
+++ scummvm/trunk/engines/parallaction/animation.cpp	2007-05-13 14:38:05 UTC (rev 26834)
@@ -20,13 +20,9 @@
  *
  */
 
-#include "parallaction/disk.h"
+#include "common/stdafx.h"
+
 #include "parallaction/parallaction.h"
-#include "parallaction/graphics.h"
-#include "parallaction/sound.h"
-#include "parallaction/parser.h"
-#include "parallaction/walk.h"
-#include "parallaction/zone.h"
 
 
 namespace Parallaction {

Modified: scummvm/trunk/engines/parallaction/callables.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/callables.cpp	2007-05-13 13:19:46 UTC (rev 26833)
+++ scummvm/trunk/engines/parallaction/callables.cpp	2007-05-13 14:38:05 UTC (rev 26834)
@@ -26,14 +26,11 @@
 
 #include "common/file.h"
 
-#include "parallaction/disk.h"
 #include "parallaction/parallaction.h"
-#include "parallaction/graphics.h"
-#include "parallaction/inventory.h"
 #include "parallaction/menu.h"
 #include "parallaction/sound.h"
-#include "parallaction/zone.h"
 
+
 namespace Parallaction {
 
 

Modified: scummvm/trunk/engines/parallaction/commands.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/commands.cpp	2007-05-13 13:19:46 UTC (rev 26833)
+++ scummvm/trunk/engines/parallaction/commands.cpp	2007-05-13 14:38:05 UTC (rev 26834)
@@ -23,11 +23,8 @@
 #include "common/stdafx.h"
 
 #include "parallaction/parallaction.h"
-#include "parallaction/parser.h"
-#include "parallaction/commands.h"
-#include "parallaction/walk.h"
-#include "parallaction/zone.h"
 
+
 namespace Parallaction {
 
 #define CMD_SET 			1

Modified: scummvm/trunk/engines/parallaction/commands.h
===================================================================
--- scummvm/trunk/engines/parallaction/commands.h	2007-05-13 13:19:46 UTC (rev 26833)
+++ scummvm/trunk/engines/parallaction/commands.h	2007-05-13 14:38:05 UTC (rev 26834)
@@ -73,7 +73,6 @@
 	~Command();
 };
 
-//typedef Common::List<Command*> CommandList;
 typedef ManagedList<Command*> CommandList;
 
 } // namespace Parallaction

Modified: scummvm/trunk/engines/parallaction/debug.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/debug.cpp	2007-05-13 13:19:46 UTC (rev 26833)
+++ scummvm/trunk/engines/parallaction/debug.cpp	2007-05-13 14:38:05 UTC (rev 26834)
@@ -23,9 +23,8 @@
 
 #include "common/stdafx.h"
 #include "common/system.h"
-#include "parallaction/parallaction.h"
-#include "parallaction/graphics.h"
 
+#include "parallaction/parallaction.h"
 #include "parallaction/debug.h"
 
 namespace Parallaction {

Modified: scummvm/trunk/engines/parallaction/dialogue.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/dialogue.cpp	2007-05-13 13:19:46 UTC (rev 26833)
+++ scummvm/trunk/engines/parallaction/dialogue.cpp	2007-05-13 14:38:05 UTC (rev 26834)
@@ -22,16 +22,11 @@
 
 #include "common/stdafx.h"
 
-#include "parallaction/commands.h"
+#include "common/events.h"
 #include "parallaction/parallaction.h"
-#include "parallaction/graphics.h"
-#include "parallaction/disk.h"
-#include "parallaction/inventory.h"
-#include "parallaction/parser.h"
-#include "parallaction/zone.h"
 
-#include "common/events.h"
 
+
 namespace Parallaction {
 
 #define SKIPPED_ANSWER		   1000
@@ -184,7 +179,7 @@
 
 	} while (strlen(vD0) == 0);
 
-	vD0[strlen(vD0)-1] = '\0';	// deletes the trailing '0xA' inserted by parseNextLine
+	vD0[strlen(vD0)-1] = '\0';	// deletes the trailing '0xA'
 								// this is critical for Gfx::displayBalloonString to work properly
 
 	char *vCC = (char*)malloc(strlen(vD0)+1);

Modified: scummvm/trunk/engines/parallaction/disk.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/disk.cpp	2007-05-13 13:19:46 UTC (rev 26833)
+++ scummvm/trunk/engines/parallaction/disk.cpp	2007-05-13 14:38:05 UTC (rev 26834)
@@ -23,13 +23,9 @@
 #include "common/stdafx.h"
 
 #include "graphics/iff.h"
-
-#include "parallaction/defs.h"
-#include "parallaction/graphics.h"
 #include "parallaction/parallaction.h"
-#include "parallaction/disk.h"
-#include "parallaction/walk.h"
 
+
 namespace Audio {
 	AudioStream *make8SVXStream(Common::ReadStream &input);
 }
@@ -418,7 +414,7 @@
 
 	_vm->_gfx->setBackground(bg);
 	_vm->_gfx->setMask(mask);
-	setPath(path);
+	_vm->setPath(path);
 
 	free(bg);
 	free(mask);
@@ -449,7 +445,7 @@
 	_resArchive.read(maskBuf, SCREENMASK_WIDTH*SCREEN_HEIGHT);
 
 	_vm->_gfx->setMask(maskBuf);
-	setPath(pathBuf);
+	_vm->setPath(pathBuf);
 
 	return;
 }
@@ -1066,7 +1062,7 @@
 	Graphics::PackBitsReadStream stream(*s);
 	byte *buf = (byte*)malloc(SCREENPATH_WIDTH*SCREEN_HEIGHT);
 	stream.read(buf, SCREENPATH_WIDTH*SCREEN_HEIGHT);
-	setPath(buf);
+	_vm->setPath(buf);
 	free(buf);
 	delete s;
 

Modified: scummvm/trunk/engines/parallaction/font.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/font.cpp	2007-05-13 13:19:46 UTC (rev 26833)
+++ scummvm/trunk/engines/parallaction/font.cpp	2007-05-13 14:38:05 UTC (rev 26834)
@@ -24,8 +24,6 @@
 #include "common/endian.h"
 #include "common/stream.h"
 
-#include "parallaction/defs.h"
-#include "parallaction/graphics.h"
 #include "parallaction/parallaction.h"
 
 namespace Parallaction {

Modified: scummvm/trunk/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.cpp	2007-05-13 13:19:46 UTC (rev 26833)
+++ scummvm/trunk/engines/parallaction/graphics.cpp	2007-05-13 14:38:05 UTC (rev 26834)
@@ -24,13 +24,10 @@
 #include "common/system.h"
 #include "common/file.h"
 
-#include "parallaction/graphics.h"
-#include "parallaction/parser.h"
 #include "parallaction/parallaction.h"
-#include "parallaction/disk.h"
-#include "parallaction/zone.h"
 
 
+
 extern OSystem *g_system;
 
 namespace Parallaction {

Modified: scummvm/trunk/engines/parallaction/intro.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/intro.cpp	2007-05-13 13:19:46 UTC (rev 26833)
+++ scummvm/trunk/engines/parallaction/intro.cpp	2007-05-13 14:38:05 UTC (rev 26834)
@@ -25,8 +25,6 @@
 #include "parallaction/parallaction.h"
 #include "parallaction/menu.h"
 #include "parallaction/sound.h"
-#include "parallaction/graphics.h"
-#include "parallaction/zone.h"
 
 #include "graphics/primitives.h"
 

Modified: scummvm/trunk/engines/parallaction/inventory.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/inventory.cpp	2007-05-13 13:19:46 UTC (rev 26833)
+++ scummvm/trunk/engines/parallaction/inventory.cpp	2007-05-13 14:38:05 UTC (rev 26834)
@@ -23,12 +23,9 @@
 #include "common/stdafx.h"
 
 #include "parallaction/parallaction.h"
-#include "parallaction/disk.h"
-#include "parallaction/zone.h"
-#include "parallaction/graphics.h"
-#include "parallaction/inventory.h"
 
 
+
 namespace Parallaction {
 
 //
@@ -116,6 +113,21 @@
 }
 
 
+void refreshInventory(const char *character) {
+	for (uint16 _si = 0; _si < INVENTORY_MAX_ITEMS; _si++) {
+		drawInventoryItem(_si, &_inventory[_si]);
+	}
+
+	return;
+}
+
+
+void refreshInventoryItem(const char *character, uint16 index) {
+	drawInventoryItem(index, &_inventory[index]);
+
+	return;
+}
+
 int Parallaction::addInventoryItem(uint16 item) {
 
 	uint16 _si = 0;
@@ -164,6 +176,9 @@
 
 
 
+
+
+
 void drawInventoryItem(uint16 pos, InventoryItem *item) {
 
 	uint16 line = pos / INVENTORY_ITEMS_PER_LINE;
@@ -325,19 +340,6 @@
 	_engineFlags &= ~kEngineInventory;
 }
 
-
-
-// refreshes inventory view
-//
-void redrawInventory() {
-
-
-	for (uint16 _si = 0; _si < INVENTORY_MAX_ITEMS; _si++) {
-		drawInventoryItem(_si, &_inventory[_si]);
-	}
-
-}
-
 void initInventory() {
 	_buffer = (byte*)malloc(INVENTORY_WIDTH * INVENTORY_HEIGHT);	  // this buffer is also used by menu so it must stay this size
 
@@ -354,19 +356,4 @@
 }
 
 
-
-
-void refreshInventory(const char *character) {
-	redrawInventory();
-
-	return;
-}
-
-
-void refreshInventoryItem(const char *character, uint16 index) {
-	drawInventoryItem(index, &_inventory[index]);
-
-	return;
-}
-
 } // namespace Parallaction

Modified: scummvm/trunk/engines/parallaction/inventory.h
===================================================================
--- scummvm/trunk/engines/parallaction/inventory.h	2007-05-13 13:19:46 UTC (rev 26833)
+++ scummvm/trunk/engines/parallaction/inventory.h	2007-05-13 14:38:05 UTC (rev 26834)
@@ -47,9 +47,7 @@
 void cleanInventory();
 void addInventoryItem(uint16 item);
 
-void redrawInventory();
 void highlightInventoryItem(int16 pos, byte color);
-void refreshInventoryItem(const char *character, uint16 index);
 void refreshInventory(const char *character);
 
 void extractInventoryGraphics(int16 pos, byte *dst);

Modified: scummvm/trunk/engines/parallaction/location.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/location.cpp	2007-05-13 13:19:46 UTC (rev 26833)
+++ scummvm/trunk/engines/parallaction/location.cpp	2007-05-13 14:38:05 UTC (rev 26834)
@@ -23,13 +23,7 @@
 #include "common/stdafx.h"
 
 #include "parallaction/parallaction.h"
-#include "parallaction/graphics.h"
-#include "parallaction/disk.h"
-#include "parallaction/parser.h"
 #include "parallaction/sound.h"
-#include "parallaction/commands.h"
-#include "parallaction/walk.h"
-#include "parallaction/zone.h"
 
 namespace Parallaction {
 

Modified: scummvm/trunk/engines/parallaction/menu.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/menu.cpp	2007-05-13 13:19:46 UTC (rev 26833)
+++ scummvm/trunk/engines/parallaction/menu.cpp	2007-05-13 14:38:05 UTC (rev 26834)
@@ -23,11 +23,9 @@
 #include "common/stdafx.h"
 #include "common/system.h"
 
+#include "parallaction/parallaction.h"
 #include "parallaction/menu.h"
-#include "parallaction/disk.h"
 #include "parallaction/sound.h"
-#include "parallaction/graphics.h"
-#include "parallaction/parallaction.h"
 
 
 namespace Parallaction {

Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp	2007-05-13 13:19:46 UTC (rev 26833)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp	2007-05-13 14:38:05 UTC (rev 26834)
@@ -33,15 +33,10 @@
 #include "parallaction/parallaction.h"
 #include "parallaction/debug.h"
 #include "parallaction/menu.h"
-#include "parallaction/parser.h"
-#include "parallaction/disk.h"
 #include "parallaction/sound.h"
-#include "parallaction/inventory.h"
-#include "parallaction/graphics.h"
-#include "parallaction/walk.h"
-#include "parallaction/zone.h"
 
 
+
 namespace Parallaction {
 
 // FIXME: remove this

Modified: scummvm/trunk/engines/parallaction/parallaction.h
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.h	2007-05-13 13:19:46 UTC (rev 26833)
+++ scummvm/trunk/engines/parallaction/parallaction.h	2007-05-13 14:38:05 UTC (rev 26834)
@@ -315,6 +315,11 @@
 	void 		resumeJobs();
 	void 		runJobs();
 
+	void 		setPath(byte *path);
+	void 		finalizeWalk(WalkNodeList *list);
+	int16 		selectWalkFrame(const Common::Point& pos, const WalkNode* from);
+	void 		clipMove(Common::Point& pos, const WalkNode* from);
+
 	Zone 		*findZone(const char *name);
 	Zone   		*hitZone(uint32 type, uint16 x, uint16 y);
 	uint16		runZone(Zone*);
@@ -400,28 +405,27 @@
 
 	JobList		_jobs;
 
+	Common::String      _saveFileName;
+
+
 protected:		// members
 	bool detectGame(void);
 
 	void		initGame();
 	void		initGlobals();
+	void 		initResources();
+	void		runGame();
+	uint32		getElapsedTime();
+	void		resetTimer();
 
-	Common::String      _saveFileName;
+	InputData 	*translateInput();
+	void		processInput(InputData*);
+
 	int         buildSaveFileList(Common::StringList& l);
 	int         selectSaveFile(uint16 arg_0, const char* caption, const char* button);
 	void		doLoadGame(uint16 slot);
 	void		doSaveGame(uint16 slot, const char* name);
 
-	void		runGame();
-
-	InputData 	*translateInput();
-	void		processInput(InputData*);
-
-	int16		getHoverInventoryItem(int16 x, int16 y);
-
-	uint32		getElapsedTime();
-	void		resetTimer();
-
 	void		doLocationEnterTransition();
 	void		changeLocation(char *location);
 	void 		showSlide(const char *name);
@@ -431,10 +435,13 @@
 
 	void		parseZone(Script &script, ZoneList &list, char *name);
 	void		parseZoneTypeBlock(Script &script, Zone *z);
-	void 		parseWalkNodes(Script& script, WalkNodeList &list);
 	void 		displayCharacterComment(ExamineData *data);
 	void 		displayItemComment(ExamineData *data);
 
+	void 		parseWalkNodes(Script& script, WalkNodeList &list);
+	void		initWalk();
+	uint16 		checkDoor();
+
 	Animation * parseAnimation(Script &script, AnimationList &list, char *name);
 	void		parseScriptLine(Instruction *inst, Animation *a, LocalVariable *locals);
 	void		loadProgram(Animation *a, char *filename);
@@ -444,8 +451,6 @@
 
 	void 		freeCharacter();
 
-	void 		initResources();
-
 	uint16 		askDialoguePassword(Dialogue *q, StaticCnv *face);
 	bool 		displayAnswer(Dialogue *q, uint16 i);
 	bool 		displayAnswers(Dialogue *q);
@@ -459,6 +464,7 @@
 	void 		dropItem(uint16 item);
 	int16 		pickupItem(Zone *z);
 	int16 		isItemInInventory(int32 v);
+	int16		getHoverInventoryItem(int16 x, int16 y);
 };
 
 // FIXME: remove global

Modified: scummvm/trunk/engines/parallaction/parser.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parser.cpp	2007-05-13 13:19:46 UTC (rev 26833)
+++ scummvm/trunk/engines/parallaction/parser.cpp	2007-05-13 14:38:05 UTC (rev 26834)
@@ -20,11 +20,11 @@
  *
  */
 
-#include "parallaction/defs.h"
-#include "parallaction/parser.h"
+#include "common/stdafx.h"
+
 #include "parallaction/parallaction.h"
-#include "parallaction/disk.h"
 
+
 namespace Parallaction {
 
 char			_tokens[20][40];

Modified: scummvm/trunk/engines/parallaction/parser.h
===================================================================
--- scummvm/trunk/engines/parallaction/parser.h	2007-05-13 13:19:46 UTC (rev 26833)
+++ scummvm/trunk/engines/parallaction/parser.h	2007-05-13 14:38:05 UTC (rev 26834)
@@ -29,7 +29,6 @@
 
 namespace Parallaction {
 
-char   *parseNextLine(char *s, uint16 count);
 uint16 fillBuffers(Common::SeekableReadStream &stream, bool errorOnEOF = false);
 char   *parseNextToken(char *s, char *tok, uint16 count, const char *brk);
 

Modified: scummvm/trunk/engines/parallaction/saveload.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/saveload.cpp	2007-05-13 13:19:46 UTC (rev 26833)
+++ scummvm/trunk/engines/parallaction/saveload.cpp	2007-05-13 14:38:05 UTC (rev 26834)
@@ -28,10 +28,8 @@
 #include "gui/message.h"
 
 #include "parallaction/parallaction.h"
-#include "parallaction/disk.h"
-#include "parallaction/graphics.h"
-#include "parallaction/zone.h"
 
+
 /* Nippon Safes savefiles are called 'game.0' to 'game.9'. The game conventiently allows users to
  * give meanigful name to savegames, and it uses an extra file 'savegame' to keep track of these
  * names.

Modified: scummvm/trunk/engines/parallaction/staticres.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/staticres.cpp	2007-05-13 13:19:46 UTC (rev 26833)
+++ scummvm/trunk/engines/parallaction/staticres.cpp	2007-05-13 14:38:05 UTC (rev 26834)
@@ -23,7 +23,6 @@
 #include "common/stdafx.h"
 
 #include "parallaction/parallaction.h"
-#include "parallaction/graphics.h"
 
 
 namespace Parallaction {

Modified: scummvm/trunk/engines/parallaction/walk.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/walk.cpp	2007-05-13 13:19:46 UTC (rev 26833)
+++ scummvm/trunk/engines/parallaction/walk.cpp	2007-05-13 14:38:05 UTC (rev 26834)
@@ -20,17 +20,12 @@
  *
  */
 
-#include "parallaction/defs.h"
+#include "common/stdafx.h"
+
 #include "parallaction/parallaction.h"
-#include "parallaction/commands.h"
-#include "parallaction/graphics.h"
-#include "parallaction/walk.h"
-#include "parallaction/zone.h"
 
 namespace Parallaction {
 
-uint16 walkFunc1(int16, int16, WalkNode *);
-
 static byte		*_buffer;
 
 static uint16 _doorData1 = 1000;
@@ -40,6 +35,17 @@
 static uint16	walkData2 = 0; 	// next walk frame
 
 
+uint16 queryPath(uint16 x, uint16 y) {
+
+	// NOTE: a better solution would have us mirror each byte in the mask in the loading routine
+	// AmigaDisk::loadPath() instead of doing it here.
+
+	byte _al = _buffer[y*40 + x/8];
+	byte _dl = (_vm->getPlatform() == Common::kPlatformPC) ? (x & 7) : (7 - (x & 7));
+
+	return _al & (1 << _dl);
+}
+
 // adjusts position towards nearest walkable point
 //
 void PathBuilder::correctPathPoint(Common::Point &to) {
@@ -208,7 +214,7 @@
 //	1 : Point reachable in a straight line
 //	other values: square distance to target (point not reachable in a straight line)
 //
-uint16 walkFunc1(int16 x, int16 y, WalkNode *Node) {
+uint16 PathBuilder::walkFunc1(int16 x, int16 y, WalkNode *Node) {
 
 	Common::Point arg(x, y);
 
@@ -261,7 +267,7 @@
 	return 1;
 }
 
-void clipMove(Common::Point& pos, const WalkNode* from) {
+void Parallaction::clipMove(Common::Point& pos, const WalkNode* from) {
 
 	if ((pos.x < from->_x) && (pos.x < SCREEN_WIDTH) && (queryPath(_vm->_char._ani.width()/2 + pos.x + 2, _vm->_char._ani.height() + pos.y) != 0)) {
 		pos.x = (pos.x + 2 < from->_x) ? pos.x + 2 : from->_x;
@@ -282,7 +288,7 @@
 	return;
 }
 
-int16 selectWalkFrame(const Common::Point& pos, const WalkNode* from) {
+int16 Parallaction::selectWalkFrame(const Common::Point& pos, const WalkNode* from) {
 
 	Common::Point dist(from->_x - pos.x, from->_y - pos.y);
 
@@ -324,53 +330,7 @@
 	return v16;
 }
 
-void finalizeWalk(WalkNodeList *list) {
-	checkDoor();
-	delete list;
-}
-
-void jobWalk(void *parm, Job *j) {
-	WalkNodeList *list = (WalkNodeList*)parm;
-
-	Common::Point pos(_vm->_char._ani._left, _vm->_char._ani._top);
-	_vm->_char._ani._oldPos = pos;
-
-	WalkNodeList::iterator it = list->begin();
-
-	if (it != list->end()) {
-		if ((*it)->_x == pos.x && (*it)->_y == pos.y) {
-			debugC(1, kDebugWalk, "jobWalk reached node (%i, %i)", (*it)->_x, (*it)->_y);
-			it = list->erase(it);
-		}
-	}
-	if (it == list->end()) {
-		debugC(1, kDebugWalk, "jobWalk reached last node");
-		j->_finished = 1;
-		finalizeWalk(list);
-		return;
-	}
-	j->_parm = list;
-
-	// selectWalkFrame must be performed before position is changed by clipMove
-	int16 v16 = selectWalkFrame(pos, *it);
-	clipMove(pos, *it);
-
-	_vm->_char._ani._left = pos.x;
-	_vm->_char._ani._top = pos.y;
-
-	if (pos == _vm->_char._ani._oldPos) {
-		debugC(1, kDebugWalk, "jobWalk was blocked by an unforeseen obstacle");
-		j->_finished = 1;
-		finalizeWalk(list);
-	} else {
-		_vm->_char._ani._frame = v16 + walkData2 + 1;
-	}
-
-	return;
-}
-
-
-uint16 checkDoor() {
+uint16 Parallaction::checkDoor() {
 //	printf("checkDoor()...");
 
 	if (_vm->_currentLocationIndex != _doorData1) {
@@ -418,22 +378,58 @@
 	return _vm->_char._ani._frame;
 }
 
-uint16 queryPath(uint16 x, uint16 y) {
 
-	// NOTE: a better solution would have us mirror each byte in the mask in the loading routine
-	// AmigaDisk::loadPath() instead of doing it here.
+void Parallaction::finalizeWalk(WalkNodeList *list) {
+	checkDoor();
+	delete list;
+}
 
-	byte _al = _buffer[y*40 + x/8];
-	byte _dl = (_vm->getPlatform() == Common::kPlatformPC) ? (x & 7) : (7 - (x & 7));
+void jobWalk(void *parm, Job *j) {
+	WalkNodeList *list = (WalkNodeList*)parm;
 
-	return _al & (1 << _dl);
+	Common::Point pos(_vm->_char._ani._left, _vm->_char._ani._top);
+	_vm->_char._ani._oldPos = pos;
+
+	WalkNodeList::iterator it = list->begin();
+
+	if (it != list->end()) {
+		if ((*it)->_x == pos.x && (*it)->_y == pos.y) {
+			debugC(1, kDebugWalk, "jobWalk reached node (%i, %i)", (*it)->_x, (*it)->_y);
+			it = list->erase(it);
+		}
+	}
+	if (it == list->end()) {
+		debugC(1, kDebugWalk, "jobWalk reached last node");
+		j->_finished = 1;
+		_vm->finalizeWalk(list);
+		return;
+	}
+	j->_parm = list;
+
+	// selectWalkFrame must be performed before position is changed by clipMove
+	int16 v16 = _vm->selectWalkFrame(pos, *it);
+	_vm->clipMove(pos, *it);
+
+	_vm->_char._ani._left = pos.x;
+	_vm->_char._ani._top = pos.y;
+
+	if (pos == _vm->_char._ani._oldPos) {
+		debugC(1, kDebugWalk, "jobWalk was blocked by an unforeseen obstacle");
+		j->_finished = 1;
+		_vm->finalizeWalk(list);
+	} else {
+		_vm->_char._ani._frame = v16 + walkData2 + 1;
+	}
+
+	return;
 }
 
-void setPath(byte *path) {
+
+void Parallaction::setPath(byte *path) {
 	memcpy(_buffer, path, SCREENPATH_WIDTH*SCREEN_HEIGHT);
 }
 
-void initWalk() {
+void Parallaction::initWalk() {
 	_buffer = (byte*)malloc(SCREENPATH_WIDTH * SCREEN_HEIGHT);
 }
 

Modified: scummvm/trunk/engines/parallaction/walk.h
===================================================================
--- scummvm/trunk/engines/parallaction/walk.h	2007-05-13 13:19:46 UTC (rev 26833)
+++ scummvm/trunk/engines/parallaction/walk.h	2007-05-13 14:38:05 UTC (rev 26834)
@@ -44,13 +44,10 @@
 
 typedef ManagedList<WalkNode*> WalkNodeList;
 
-//WalkNode 	*buildWalkPath(uint16 x, uint16 y);
+
 void 		 jobWalk(void*, Job *j);
-uint16		 checkDoor();
-void 		 setPath(byte *path);
-void		 initWalk();
-uint16 		 queryPath(uint16 x, uint16 y);
 
+
 class PathBuilder {
 
 	Animation 		*_anim;
@@ -60,6 +57,7 @@
 
 	void correctPathPoint(Common::Point &to);
 	uint32 buildSubPath(const Common::Point& pos, const Common::Point& stop);
+	uint16 walkFunc1(int16 x, int16 y, WalkNode *Node);
 
 public:
 	PathBuilder(Animation *anim);

Modified: scummvm/trunk/engines/parallaction/zone.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/zone.cpp	2007-05-13 13:19:46 UTC (rev 26833)
+++ scummvm/trunk/engines/parallaction/zone.cpp	2007-05-13 14:38:05 UTC (rev 26834)
@@ -21,11 +21,9 @@
  */
 
 
-#include "parallaction/parser.h"
+#include "common/stdafx.h"
+
 #include "parallaction/parallaction.h"
-#include "parallaction/graphics.h"
-#include "parallaction/inventory.h"
-#include "parallaction/zone.h"
 #include "parallaction/sound.h"
 
 namespace Parallaction {

Modified: scummvm/trunk/engines/parallaction/zone.h
===================================================================
--- scummvm/trunk/engines/parallaction/zone.h	2007-05-13 13:19:46 UTC (rev 26833)
+++ scummvm/trunk/engines/parallaction/zone.h	2007-05-13 14:38:05 UTC (rev 26834)
@@ -26,6 +26,7 @@
 #include "common/list.h"
 
 #include "parallaction/defs.h"
+
 #include "parallaction/commands.h"
 #include "parallaction/graphics.h"
 
@@ -311,14 +312,7 @@
 typedef Animation* AnimationPointer;
 typedef ManagedList<AnimationPointer> AnimationList;
 
-void	dropItem(uint16 v);
-int16	pickupItem(Zone *z);
 
-
-void		loadProgram(Animation *, char *filename);
-
-
-
 } // namespace Parallaction
 
 #endif


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