[Scummvm-cvs-logs] SF.net SVN: scummvm: [28591] scummvm/trunk/engines/gob

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Mon Aug 13 16:04:51 CEST 2007


Revision: 28591
          http://scummvm.svn.sourceforge.net/scummvm/?rev=28591&view=rev
Author:   drmccoy
Date:     2007-08-13 07:04:50 -0700 (Mon, 13 Aug 2007)

Log Message:
-----------
Woodruff is now controllable

Modified Paths:
--------------
    scummvm/trunk/engines/gob/coktelvideo.cpp
    scummvm/trunk/engines/gob/gob.cpp
    scummvm/trunk/engines/gob/init.cpp
    scummvm/trunk/engines/gob/inter_v2.cpp
    scummvm/trunk/engines/gob/map.cpp
    scummvm/trunk/engines/gob/map.h
    scummvm/trunk/engines/gob/map_v1.cpp
    scummvm/trunk/engines/gob/map_v2.cpp
    scummvm/trunk/engines/gob/module.mk
    scummvm/trunk/engines/gob/videoplayer.cpp

Added Paths:
-----------
    scummvm/trunk/engines/gob/map_v4.cpp

Modified: scummvm/trunk/engines/gob/coktelvideo.cpp
===================================================================
--- scummvm/trunk/engines/gob/coktelvideo.cpp	2007-08-13 12:43:09 UTC (rev 28590)
+++ scummvm/trunk/engines/gob/coktelvideo.cpp	2007-08-13 14:04:50 UTC (rev 28591)
@@ -885,9 +885,9 @@
 	_vidBufferSize = _stream->readUint32LE();
 
 	if (_hasVideo) {
-		if (_frameDataSize == 0)
+		if ((_frameDataSize == 0) || (_frameDataSize > 1048576))
 			_frameDataSize = _width * _height + 500;
-		if (_vidBufferSize == 0)
+		if ((_vidBufferSize == 0) || (_vidBufferSize > 1048576))
 			_vidBufferSize = _frameDataSize;
 
 		_frameData = new byte[_frameDataSize];

Modified: scummvm/trunk/engines/gob/gob.cpp
===================================================================
--- scummvm/trunk/engines/gob/gob.cpp	2007-08-13 12:43:09 UTC (rev 28590)
+++ scummvm/trunk/engines/gob/gob.cpp	2007-08-13 14:04:50 UTC (rev 28591)
@@ -333,7 +333,7 @@
 			_mult = new Mult_v2(this);
 			_draw = new Draw_v2(this);
 			_game = new Game_v2(this);
-			_map = new Map_v2(this);
+			_map = new Map_v4(this);
 			_goblin = new Goblin_v3(this);
 			_scenery = new Scenery_v2(this);
 			_saveLoad = new SaveLoad_v3(this, _targetName.c_str());
@@ -349,8 +349,6 @@
 	if (!_noMusic && hasAdlib())
 		_adlib = new Adlib(this);
 
-	_map->init();
-
 	if (is640()) {
 		_video->_surfWidth = _width = 640;
 		_video->_surfHeight = _video->_splitHeight1 = _height = 480;

Modified: scummvm/trunk/engines/gob/init.cpp
===================================================================
--- scummvm/trunk/engines/gob/init.cpp	2007-08-13 12:43:09 UTC (rev 28590)
+++ scummvm/trunk/engines/gob/init.cpp	2007-08-13 14:04:50 UTC (rev 28591)
@@ -60,10 +60,10 @@
 	int16 handle2;
 	int16 handle;
 	int16 imdHandle;
-	char *infBuf;
+	byte *infBuf;
 	char *infPtr;
 	char *infEnd;
-	char buffer[20];
+	char buffer[128];
 	int32 varsCount;
 
 	initVideo();
@@ -120,10 +120,10 @@
 	} else {
 		_vm->_dataIO->closeData(handle);
 
-		infPtr = (char *) _vm->_dataIO->getData("intro.inf");
-		infBuf = infPtr;
+		infBuf = _vm->_dataIO->getData("intro.inf");
+		infPtr = (char *) infBuf;
 
-		infEnd = infBuf + _vm->_dataIO->getDataSize("intro.inf");
+		infEnd = (char *) (infBuf + _vm->_dataIO->getDataSize("intro.inf"));
 
 		for (int i = 0; i < 4; i++, infPtr++) {
 			int j;

Modified: scummvm/trunk/engines/gob/inter_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_v2.cpp	2007-08-13 12:43:09 UTC (rev 28590)
+++ scummvm/trunk/engines/gob/inter_v2.cpp	2007-08-13 14:04:50 UTC (rev 28591)
@@ -1561,7 +1561,8 @@
 
 	evalExpr(0);
 	strncpy0(fileName, _vm->_global->_inter_resStr, 27);
-	strcat(fileName, ".ITK");
+	if (!strchr(fileName, '.'))
+		strcat(fileName, ".ITK");
 
 	_vm->_dataIO->openDataFile(fileName, true);
 }

Modified: scummvm/trunk/engines/gob/map.cpp
===================================================================
--- scummvm/trunk/engines/gob/map.cpp	2007-08-13 12:43:09 UTC (rev 28590)
+++ scummvm/trunk/engines/gob/map.cpp	2007-08-13 14:04:50 UTC (rev 28591)
@@ -34,9 +34,11 @@
 namespace Gob {
 
 Map::Map(GobEngine *vm) : _vm(vm) {
+	_widthByte = 0;
 	_mapWidth = -1;
 	_mapHeight = -1;
 	_screenWidth = 0;
+	_screenHeight = 0;
 	_tilesWidth = 0;
 	_tilesHeight = 0;
 	_passWidth = 0;

Modified: scummvm/trunk/engines/gob/map.h
===================================================================
--- scummvm/trunk/engines/gob/map.h	2007-08-13 12:43:09 UTC (rev 28590)
+++ scummvm/trunk/engines/gob/map.h	2007-08-13 14:04:50 UTC (rev 28591)
@@ -63,9 +63,11 @@
 
 #include "common/pack-end.h"	// END STRUCT PACKING
 
+	byte _widthByte;
 	int16 _mapWidth;
 	int16 _mapHeight;
 	int16 _screenWidth;
+	int16 _screenHeight;
 	int16 _tilesWidth;
 	int16 _tilesHeight;
 	int16 _passWidth;
@@ -107,7 +109,6 @@
 	virtual void findNearestToDest(Mult::Mult_Object *obj) = 0;
 	virtual void optimizePoints(Mult::Mult_Object *obj, int16 x, int16 y) = 0;
 
-	virtual void init(void) = 0;
 	Map(GobEngine *vm);
 	virtual ~Map();
 
@@ -127,18 +128,24 @@
 	virtual void optimizePoints(Mult::Mult_Object *obj, int16 x, int16 y);
 
 	virtual int8 getPass(int x, int y, int heightOff = -1) {
+		if (!_passMap)
+			return 0;
+
 		return _passMap[y * _mapWidth + x];
 	}
 	
 	virtual void setPass(int x, int y, int8 pass, int heightOff = -1) {
+		if (!_passMap)
+			return;
+
 		_passMap[y * _mapWidth + x] = pass;
 	}
 
-	virtual void init(void);
 	Map_v1(GobEngine *vm);
 	virtual ~Map_v1();
 
 protected:
+	void init(void);
 	void loadSounds(Common::SeekableReadStream &data);
 	void loadGoblins(Common::SeekableReadStream &data, uint32 gobsPos);
 	void loadObjects(Common::SeekableReadStream &data, uint32 objsPos);
@@ -153,18 +160,23 @@
 	virtual void optimizePoints(Mult::Mult_Object *obj, int16 x, int16 y);
 
 	virtual int8 getPass(int x, int y, int heightOff = -1) {
+		if (!_passMap)
+			return 0;
+
 		if (heightOff == -1)
 			heightOff = _passWidth;
 		return _passMap[y * heightOff + x];
 	}
 	
 	virtual void setPass(int x, int y, int8 pass, int heightOff = -1) {
+		if (!_passMap)
+			return;
+
 		if (heightOff == -1)
 			heightOff = _passWidth;
 		_passMap[y * heightOff + x] = pass;
 	}
 
-	virtual void init(void);
 	Map_v2(GobEngine *vm);
 	virtual ~Map_v2();
 
@@ -172,6 +184,14 @@
 	void loadGoblinStates(Common::SeekableReadStream &data, int index);
 };
 
+class Map_v4 : public Map_v2 {
+public:
+	virtual void loadMapObjects(const char *avjFile);
+
+	Map_v4(GobEngine *vm);
+	virtual ~Map_v4();
+};
+
 } // End of namespace Gob
 
 #endif // GOB_MAP_H

Modified: scummvm/trunk/engines/gob/map_v1.cpp
===================================================================
--- scummvm/trunk/engines/gob/map_v1.cpp	2007-08-13 12:43:09 UTC (rev 28590)
+++ scummvm/trunk/engines/gob/map_v1.cpp	2007-08-13 14:04:50 UTC (rev 28591)
@@ -42,6 +42,9 @@
 }
 
 void Map_v1::init(void) {
+	if (_passMap || _itemsMap)
+		return;
+
 	_mapWidth = 26;
 	_mapHeight = 28;
 
@@ -84,6 +87,8 @@
 	}
 	Common::MemoryReadStream mapData(dataBuf, 4294967295U);
 
+	init();
+
 	if (_loadFromAvo) {
 		mapData.read(_passMap, _mapHeight * _mapWidth);
 

Modified: scummvm/trunk/engines/gob/map_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/map_v2.cpp	2007-08-13 12:43:09 UTC (rev 28590)
+++ scummvm/trunk/engines/gob/map_v2.cpp	2007-08-13 14:04:50 UTC (rev 28591)
@@ -38,15 +38,13 @@
 namespace Gob {
 
 Map_v2::Map_v2(GobEngine *vm) : Map_v1(vm) {
+	_screenHeight = 200;
 }
 
 Map_v2::~Map_v2() {
 	_passMap = 0;
 }
 
-void Map_v2::init(void) {
-}
-
 void Map_v2::loadMapObjects(const char *avjFile) {
 	uint8 wayPointsCount;
 	int16 var;
@@ -86,7 +84,7 @@
 	_tilesHeight &= 0xFF;
 
 	_mapWidth = _screenWidth / _tilesWidth;
-	_mapHeight = 200 / _tilesHeight;
+	_mapHeight = _screenHeight / _tilesHeight;
 
 	passPos = mapData.pos();
 	mapData.skip(_mapWidth * _mapHeight);
@@ -96,9 +94,7 @@
 	else
 		wayPointsCount = _wayPointsCount == 0 ? 1 : _wayPointsCount;
 
-	if (_wayPoints)
-		delete[] _wayPoints;
-
+	delete[] _wayPoints;
 	_wayPoints = new Point[wayPointsCount];
 	for (int i = 0; i < _wayPointsCount; i++) {
 		_wayPoints[i].x = mapData.readSByte();
@@ -113,7 +109,7 @@
 		byte *sizes;
 
 		_passMap = (int8 *) variables;
-		mapHeight = 200 / _tilesHeight;
+		mapHeight = _screenHeight / _tilesHeight;
 		mapWidth = _screenWidth / _tilesWidth;
 		sizes = _vm->_global->_inter_variablesSizes +
 			(((byte *) _passMap) - _vm->_global->_inter_variables);

Added: scummvm/trunk/engines/gob/map_v4.cpp
===================================================================
--- scummvm/trunk/engines/gob/map_v4.cpp	                        (rev 0)
+++ scummvm/trunk/engines/gob/map_v4.cpp	2007-08-13 14:04:50 UTC (rev 28591)
@@ -0,0 +1,158 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "common/stdafx.h"
+#include "common/stream.h"
+
+#include "gob/gob.h"
+#include "gob/map.h"
+#include "gob/global.h"
+#include "gob/goblin.h"
+#include "gob/inter.h"
+#include "gob/game.h"
+#include "gob/parse.h"
+#include "gob/mult.h"
+
+namespace Gob {
+
+Map_v4::Map_v4(GobEngine *vm) : Map_v2(vm) {
+}
+
+Map_v4::~Map_v4() {
+}
+
+void Map_v4::loadMapObjects(const char *avjFile) {
+	uint8 wayPointsCount;
+	int16 var;
+	int16 id;
+	int16 mapWidth, mapHeight;
+	int16 tmp;
+	byte *variables;
+	byte *extData;
+	uint32 tmpPos;
+	uint32 passPos;
+
+	var = _vm->_parse->parseVarIndex();
+	variables = _vm->_global->_inter_variables + var;
+
+	id = _vm->_inter->load16();
+
+	if (((uint16) id) >= 65520) {
+		warning("Woodruff Stub: loadMapObjects ID >= 65520");
+		return;
+	} else if (id == -1) {
+		_passMap = (int8 *)(_vm->_global->_inter_variables + var);
+		return;
+	}
+
+	extData = _vm->_game->loadExtData(id, 0, 0);
+	Common::MemoryReadStream mapData(extData, 4294967295U);
+
+	_widthByte = mapData.readByte();
+	if (_widthByte == 4) {
+		_screenWidth = 640;
+		_screenHeight = 400;
+	} else if (_widthByte == 3) {
+		_screenWidth = 640;
+		_screenHeight = 200;
+	} else {
+		_screenWidth = 320;
+		_screenHeight = 200;
+	}
+
+	_wayPointsCount = mapData.readByte();
+	_tilesWidth = mapData.readSint16LE();
+	_tilesHeight = mapData.readSint16LE();
+
+	_bigTiles = !(_tilesHeight & 0xFF00);
+	_tilesHeight &= 0xFF;
+
+	if (_widthByte == 4) {
+		_screenWidth = mapData.readSint16LE();
+		_screenHeight = mapData.readSint16LE();
+	}
+
+	_mapWidth = _screenWidth / _tilesWidth;
+	_mapHeight = _screenHeight / _tilesHeight;
+
+	passPos = mapData.pos();
+	mapData.skip(_mapWidth * _mapHeight);
+
+	if (*extData == 1)
+		wayPointsCount = _wayPointsCount = 40;
+	else
+		wayPointsCount = _wayPointsCount == 0 ? 1 : _wayPointsCount;
+
+	delete[] _wayPoints;
+	_wayPoints = new Point[wayPointsCount];
+	for (int i = 0; i < _wayPointsCount; i++) {
+		_wayPoints[i].x = mapData.readSByte();
+		_wayPoints[i].y = mapData.readSByte();
+		_wayPoints[i].notWalkable = mapData.readSByte();
+	}
+
+	if (_widthByte == 4)
+		_mapWidth = (int16) READ_VARO_UINT16(68);
+
+	_passWidth = _mapWidth;
+
+	// In the original asm, this writes byte-wise into the variables-array
+	tmpPos = mapData.pos();
+	mapData.seek(passPos);
+	if (variables != _vm->_global->_inter_variables) {
+		byte *sizes;
+
+		_passMap = (int8 *) variables;
+		mapHeight = _screenHeight / _tilesHeight;
+		mapWidth = _screenWidth / _tilesWidth;
+		sizes = _vm->_global->_inter_variablesSizes +
+			(((byte *) _passMap) - _vm->_global->_inter_variables);
+		for (int i = 0; i < mapHeight; i++) {
+			for (int j = 0; j < mapWidth; j++)
+				setPass(j, i, mapData.readSByte());
+			memset(sizes + i * _passWidth, 0, mapWidth);
+		}
+	}
+	mapData.seek(tmpPos);
+
+	tmp = mapData.readSint16LE();
+	mapData.skip(tmp * 14);
+	tmp = mapData.readSint16LE();
+	mapData.skip(tmp * 14 + 28);
+	tmp = mapData.readSint16LE();
+	mapData.skip(tmp * 14);
+
+	_vm->_goblin->_gobsCount = tmp;
+	for (int i = 0; i < _vm->_goblin->_gobsCount; i++)
+		loadGoblinStates(mapData, i);
+
+	_vm->_goblin->_soundSlotsCount = _vm->_inter->load16();
+	for (int i = 0; i < _vm->_goblin->_soundSlotsCount; i++)
+		_vm->_goblin->_soundSlots[i] = _vm->_inter->loadSound(1);
+
+	delete[] extData;
+}
+
+} // End of namespace Gob


Property changes on: scummvm/trunk/engines/gob/map_v4.cpp
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Date Rev Author URL Id
Name: svn:eol-style
   + native

Modified: scummvm/trunk/engines/gob/module.mk
===================================================================
--- scummvm/trunk/engines/gob/module.mk	2007-08-13 12:43:09 UTC (rev 28590)
+++ scummvm/trunk/engines/gob/module.mk	2007-08-13 14:04:50 UTC (rev 28591)
@@ -33,6 +33,7 @@
 	map.o \
 	map_v1.o \
 	map_v2.o \
+	map_v4.o \
 	mult.o \
 	mult_v1.o \
 	mult_v2.o \

Modified: scummvm/trunk/engines/gob/videoplayer.cpp
===================================================================
--- scummvm/trunk/engines/gob/videoplayer.cpp	2007-08-13 12:43:09 UTC (rev 28590)
+++ scummvm/trunk/engines/gob/videoplayer.cpp	2007-08-13 14:04:50 UTC (rev 28591)
@@ -53,7 +53,13 @@
 
 	strncpy0(fileName, video, 250);
 
-	char *extStart = strchr(fileName, '.');
+	char *extStart = strrchr(fileName, '.');
+	// There's no empty extension
+	if (extStart == (fileName + strlen(fileName) - 1)) {
+		*extStart = 0;
+		extStart = 0;
+	}
+
 	if (extStart) {
 		// The requested file already has an extension. Verifying.
 


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