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

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Sun Jun 4 19:24:30 CEST 2006


Revision: 22917
Author:   drmccoy
Date:     2006-06-04 10:24:03 -0700 (Sun, 04 Jun 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=22917&view=rev

Log Message:
-----------
- Fixed endianness/signess issues
- Added a memset in Video_v2::SpriteUncompressor(), that should have
  been there in the first place; this fixes the tree in GOB2's first room
- Fixed ADL delete[]ing

Modified Paths:
--------------
    scummvm/trunk/engines/gob/game.cpp
    scummvm/trunk/engines/gob/game.h
    scummvm/trunk/engines/gob/inter_v1.cpp
    scummvm/trunk/engines/gob/inter_v2.cpp
    scummvm/trunk/engines/gob/map_v2.cpp
    scummvm/trunk/engines/gob/music.cpp
    scummvm/trunk/engines/gob/parse_v2.cpp
    scummvm/trunk/engines/gob/video_v2.cpp
Modified: scummvm/trunk/engines/gob/game.cpp
===================================================================
--- scummvm/trunk/engines/gob/game.cpp	2006-06-04 15:39:08 UTC (rev 22916)
+++ scummvm/trunk/engines/gob/game.cpp	2006-06-04 17:24:03 UTC (rev 22917)
@@ -69,6 +69,8 @@
 		_soundSamples[i] = 0;
 		_soundIds[i] = 0;
 		_soundTypes[i] = 0;
+		_soundFromExt[i] = 0;
+		_soundADL[i] = false;
 	}
 
 	_curTotFile[0] = 0;
@@ -89,7 +91,6 @@
 
 	_tempStr[0] = 0;
 	_curImaFile[0] = 0;
-	_soundFromExt[0] = 0;
 	_collStr[0] = 0;
 
 	_backupedCount = 0;
@@ -401,16 +402,20 @@
 	if ((slot < 0) || (slot >= 60) || (_soundSamples[slot] == 0))
 		return;
 
-	char* data = _soundSamples[slot]->data;
+	if (_soundADL[slot]) {
+		_vm->_music->stopPlay();
+		delete[] ((char *) _soundSamples[slot]);
+	} else {
+		char* data = _soundSamples[slot]->data;
 
-	_vm->_snd->freeSoundDesc(_soundSamples[slot], false);
-	_soundSamples[slot] = 0;
+		_vm->_snd->freeSoundDesc(_soundSamples[slot], false);
+		_soundSamples[slot] = 0;
 
-	if (_soundFromExt[slot] == 1) {
-		delete[] (data - 6);
-		_soundFromExt[slot] = 0;
+		if (_soundFromExt[slot] == 1) {
+			delete[] (data - 6);
+			_soundFromExt[slot] = 0;
+		}
 	}
-
 }
 
 int16 Game::inputArea(int16 xPos, int16 yPos, int16 width, int16 height, int16 backColor,

Modified: scummvm/trunk/engines/gob/game.h
===================================================================
--- scummvm/trunk/engines/gob/game.h	2006-06-04 15:39:08 UTC (rev 22916)
+++ scummvm/trunk/engines/gob/game.h	2006-06-04 17:24:03 UTC (rev 22917)
@@ -144,14 +144,14 @@
 	Snd::SoundDesc *_soundSamples[60];
 	int16 _soundIds[60];
 	int8 _soundTypes[60];
+	char _soundFromExt[60];
+	bool _soundADL[60];
 
 	char _totToLoad[20];
 
 	int32 _startTimeKey;
 	int16 _mouseButtons;
 
-	char _soundFromExt[20];
-
 	// For totSub()
 	int8 _backupedCount;
 	int8 _curBackupPos;

Modified: scummvm/trunk/engines/gob/inter_v1.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_v1.cpp	2006-06-04 15:39:08 UTC (rev 22916)
+++ scummvm/trunk/engines/gob/inter_v1.cpp	2006-06-04 17:24:03 UTC (rev 22917)
@@ -938,6 +938,7 @@
 	int16 dataVar;
 	int16 offset;
 	int16 handle;
+	char buf[4];
 
 	evalExpr(0);
 	dataVar = _vm->_parse->parseVarIndex();
@@ -956,7 +957,11 @@
 		else
 			_vm->_dataio->seekData(handle, offset, 0);
 
-		retSize = _vm->_dataio->readData(handle, _vm->_global->_inter_variables + dataVar, size);
+		if (((dataVar >> 2) == 59) && (size == 4)) {
+			retSize = _vm->_dataio->readData(handle, buf, 4);
+			WRITE_VAR(59, READ_LE_UINT32(buf));
+		} else
+			retSize = _vm->_dataio->readData(handle, _vm->_global->_inter_variables + dataVar, size);
 		_vm->_dataio->closeData(handle);
 
 		if (retSize == size)

Modified: scummvm/trunk/engines/gob/inter_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_v2.cpp	2006-06-04 15:39:08 UTC (rev 22916)
+++ scummvm/trunk/engines/gob/inter_v2.cpp	2006-06-04 17:24:03 UTC (rev 22917)
@@ -856,6 +856,7 @@
 		_vm->_game->freeSoundSlot(slot);
 
 	_vm->_game->_soundIds[slot] = id;
+	_vm->_game->_soundADL[slot] = isADL;
 
 	if (id == -1) { // loc_969D
 		strcpy(sndfile, _vm->_global->_inter_execPtr);
@@ -865,7 +866,7 @@
 			_vm->_game->_soundSamples[slot] = _vm->_game->loadSND(sndfile, 3);
 		} else {
 			strcat(sndfile, ".ADL");
-			// TODO: This is very ugly (and doesn't work with Snd::freeSoundDesc())
+			// TODO: This is very ugly
 			_vm->_game->_soundSamples[slot] = (Snd::SoundDesc *) _vm->_dataio->getData(sndfile);
 		}
 		_vm->_game->_soundTypes[slot] = 2;
@@ -899,7 +900,7 @@
 				if (!isADL)
 					_vm->_game->loadSound(slot, extData);
 				else
-					// TODO: This is very ugly (and doesn't work with Snd::freeSoundDesc())
+					// TODO: This is very ugly
 					_vm->_game->_soundSamples[slot] = (Snd::SoundDesc *) extData;
 			}
 		} else { // loc_9A13
@@ -907,7 +908,7 @@
 			if (!isADL)
 				_vm->_game->loadSound(slot, extData);
 			else
-				// TODO: This is very ugly (and doesn't work with Snd::freeSoundDesc())
+				// TODO: This is very ugly
 				_vm->_game->_soundSamples[slot] = (Snd::SoundDesc *) extData;
 		}
 	}
@@ -1753,12 +1754,12 @@
 
 void Inter_v2::o2_totSub(void) {
 	char totFile[14];
+	byte length;
 	int flags;
-	int length;
 	int i;
 
 	length = *_vm->_global->_inter_execPtr++;
-	if (length > 13)
+	if ((length & 0x7F) > 13)
 		error("Length in o2_totSub is greater than 13 (%d)", length);
 	if (length & 0x80) {
 		evalExpr(0);

Modified: scummvm/trunk/engines/gob/map_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/map_v2.cpp	2006-06-04 15:39:08 UTC (rev 22916)
+++ scummvm/trunk/engines/gob/map_v2.cpp	2006-06-04 17:24:03 UTC (rev 22917)
@@ -59,7 +59,7 @@
 	char *dataPtr;
 	char *dataPtrBak;
 	char *dataPtrBak2;
-	char statesMask[102];
+	int8 statesMask[102];
 	Goblin::Gob2_State *statesPtr;
 
 	var = _vm->_parse->parseVarIndex();
@@ -168,13 +168,13 @@
 				_vm->_mult->_objects[i].goblinStates[state][0].field_4 = numData;
 				for (k = 0; k < numData; k++) {
 					dataPtr++;
-					_vm->_mult->_objects[i].goblinStates[state][k].animation = *dataPtr << 8;
+					_vm->_mult->_objects[i].goblinStates[state][k].animation = *((byte *) dataPtr) << 8;
 					dataPtr += 2;
-					_vm->_mult->_objects[i].goblinStates[state][k].animation += *dataPtr;
+					_vm->_mult->_objects[i].goblinStates[state][k].animation += *((byte *) dataPtr);
 					dataPtr += 2;
-					_vm->_mult->_objects[i].goblinStates[state][k].layer = *dataPtr << 8;
+					_vm->_mult->_objects[i].goblinStates[state][k].layer = *((byte *) dataPtr) << 8;
 					dataPtr += 2;
-					_vm->_mult->_objects[i].goblinStates[state][k].layer += *dataPtr;
+					_vm->_mult->_objects[i].goblinStates[state][k].layer += *((byte *) dataPtr);
 					_vm->_mult->_objects[i].goblinStates[state][k].field_4 = READ_LE_UINT16(dataPtr);
 					dataPtr += 2;
 					statesPtr++;

Modified: scummvm/trunk/engines/gob/music.cpp
===================================================================
--- scummvm/trunk/engines/gob/music.cpp	2006-06-04 15:39:08 UTC (rev 22916)
+++ scummvm/trunk/engines/gob/music.cpp	2006-06-04 17:24:03 UTC (rev 22917)
@@ -389,6 +389,8 @@
 			switch (instr & 0x0F) {
 			case 0xF: // End instruction
 				_ended = true;
+				_samplesTillPoll = 0;
+				return;
 				break;
 			default:
 				warning("Unknown special command in ADL, stopping playback: %X", instr & 0x0F);

Modified: scummvm/trunk/engines/gob/parse_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/parse_v2.cpp	2006-06-04 15:39:08 UTC (rev 22916)
+++ scummvm/trunk/engines/gob/parse_v2.cpp	2006-06-04 17:24:03 UTC (rev 22917)
@@ -178,12 +178,12 @@
 				break;
 
 			case 21:
-				*valPtr = *_vm->_global->_inter_execPtr++;
+				*valPtr = *((int8 *) _vm->_global->_inter_execPtr++);
 				break;
 
 			case 23:
 			case 24:
-				*valPtr = *(uint16*)(_vm->_global->_inter_variables + _vm->_inter->load16() * 4);
+				*valPtr = VAR(_vm->_inter->load16());
 				break;
 
 			case 25:
@@ -435,7 +435,7 @@
 
 			case 21:
 				*operPtr = 20;
-				*valPtr = *_vm->_global->_inter_execPtr++;
+				*valPtr = *((int8 *) _vm->_global->_inter_execPtr++);
 				break;
 
 			case 22:
@@ -445,15 +445,11 @@
 				break;
 
 			case 23:
+			case 24:
 				*operPtr = 20;
 				*valPtr = VAR(_vm->_inter->load16());
 				break;
 
-			case 24:
-				*operPtr = 20;
-				*valPtr = *(uint16*)(_vm->_global->_inter_variables + _vm->_inter->load16() * 4);
-				break;
-
 			case 25:
 				*operPtr = 22;
 				temp = _vm->_inter->load16() * 4;

Modified: scummvm/trunk/engines/gob/video_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/video_v2.cpp	2006-06-04 15:39:08 UTC (rev 22916)
+++ scummvm/trunk/engines/gob/video_v2.cpp	2006-06-04 17:24:03 UTC (rev 22917)
@@ -229,6 +229,8 @@
 		else
 			var_2E = 0;
 
+		memset(memBuffer, 32, bufPos);
+
 		cmdVar = 0;
 		while (1) {
 			cmdVar >>= 1;


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