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

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Tue Aug 25 00:37:09 CEST 2009


Revision: 43713
          http://scummvm.svn.sourceforge.net/scummvm/?rev=43713&view=rev
Author:   drmccoy
Date:     2009-08-24 22:37:09 +0000 (Mon, 24 Aug 2009)

Log Message:
-----------
Playtoons uses a variable space that exceeds 32767 bytes. Changing a few variables to unsigned makes the construction mode not crash anymore (though it now hangs in a loop)

Modified Paths:
--------------
    scummvm/trunk/engines/gob/draw.h
    scummvm/trunk/engines/gob/expression.cpp
    scummvm/trunk/engines/gob/game.h
    scummvm/trunk/engines/gob/inter_playtoons.cpp
    scummvm/trunk/engines/gob/inter_v1.cpp
    scummvm/trunk/engines/gob/inter_v2.cpp
    scummvm/trunk/engines/gob/inter_v6.cpp

Modified: scummvm/trunk/engines/gob/draw.h
===================================================================
--- scummvm/trunk/engines/gob/draw.h	2009-08-24 21:58:24 UTC (rev 43712)
+++ scummvm/trunk/engines/gob/draw.h	2009-08-24 22:37:09 UTC (rev 43713)
@@ -119,8 +119,8 @@
 	int16 _cursorWidth;
 	int16 _cursorHeight;
 
-	int16 _cursorHotspotXVar;
-	int16 _cursorHotspotYVar;
+	int32 _cursorHotspotXVar;
+	int32 _cursorHotspotYVar;
 
 	SurfaceDescPtr _cursorSprites;
 	SurfaceDescPtr _cursorSpritesBack;

Modified: scummvm/trunk/engines/gob/expression.cpp
===================================================================
--- scummvm/trunk/engines/gob/expression.cpp	2009-08-24 21:58:24 UTC (rev 43712)
+++ scummvm/trunk/engines/gob/expression.cpp	2009-08-24 22:37:09 UTC (rev 43713)
@@ -655,7 +655,7 @@
 // Load a value according to the operation
 void Expression::loadValue(byte operation, uint32 varBase, const StackFrame &stackFrame) {
 	int16 dimCount;
-	int16 temp;
+	uint16 temp;
 	int16 temp2;
 	int16 offset;
 	int16 dim;

Modified: scummvm/trunk/engines/gob/game.h
===================================================================
--- scummvm/trunk/engines/gob/game.h	2009-08-24 21:58:24 UTC (rev 43712)
+++ scummvm/trunk/engines/gob/game.h	2009-08-24 22:37:09 UTC (rev 43713)
@@ -55,8 +55,8 @@
 
 private:
 	struct Environment {
-		int16      cursorHotspotX;
-		int16      cursorHotspotY;
+		int32      cursorHotspotX;
+		int32      cursorHotspotY;
 		char       curTotFile[14];
 		Variables *variables;
 		Script    *script;

Modified: scummvm/trunk/engines/gob/inter_playtoons.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_playtoons.cpp	2009-08-24 21:58:24 UTC (rev 43712)
+++ scummvm/trunk/engines/gob/inter_playtoons.cpp	2009-08-24 22:37:09 UTC (rev 43713)
@@ -108,7 +108,7 @@
 
 bool Inter_Playtoons::oPlaytoons_checkData(OpFuncParams &params) {
 	int16 handle;
-	int16 varOff;
+	uint16 varOff;
 	int32 size;
 	SaveLoad::SaveMode mode;
 
@@ -155,7 +155,7 @@
 	int32 retSize;
 	int32 size;
 	int32 offset;
-	int16 dataVar;
+	uint16 dataVar;
 	int16 handle;
 	byte *buf;
 	SaveLoad::SaveMode mode;

Modified: scummvm/trunk/engines/gob/inter_v1.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_v1.cpp	2009-08-24 21:58:24 UTC (rev 43712)
+++ scummvm/trunk/engines/gob/inter_v1.cpp	2009-08-24 22:37:09 UTC (rev 43713)
@@ -306,8 +306,8 @@
 	int16 height;
 	int16 count;
 
-	_vm->_draw->_cursorHotspotXVar = _vm->_game->_script->readVarIndex() / 4;
-	_vm->_draw->_cursorHotspotYVar = _vm->_game->_script->readVarIndex() / 4;
+	_vm->_draw->_cursorHotspotXVar = ((uint16) _vm->_game->_script->readVarIndex()) / 4;
+	_vm->_draw->_cursorHotspotYVar = ((uint16) _vm->_game->_script->readVarIndex()) / 4;
 
 	width = _vm->_game->_script->readInt16();
 	if (width < 16)
@@ -561,18 +561,32 @@
 
 	_vm->_game->_script->evalExpr(&objIndex);
 
-	Mult::Mult_AnimData &animData = *(_vm->_mult->_objects[objIndex].pAnimData);
-	if (animData.isStatic == 0)
-		_vm->_scenery->updateAnim(animData.layer, animData.frame,
-		    animData.animation, 0, *(_vm->_mult->_objects[objIndex].pPosX),
-		    *(_vm->_mult->_objects[objIndex].pPosY), 0);
+	uint16 varLeft   = _vm->_game->_script->readVarIndex();
+	uint16 varTop    = _vm->_game->_script->readVarIndex();
+	uint16 varRight  = _vm->_game->_script->readVarIndex();
+	uint16 varBottom = _vm->_game->_script->readVarIndex();
 
-	_vm->_scenery->_toRedrawLeft = MAX(_vm->_scenery->_toRedrawLeft, (int16) 0);
-	_vm->_scenery->_toRedrawTop = MAX(_vm->_scenery->_toRedrawTop, (int16) 0);
-	WRITE_VAR_OFFSET(_vm->_game->_script->readVarIndex(), _vm->_scenery->_toRedrawLeft);
-	WRITE_VAR_OFFSET(_vm->_game->_script->readVarIndex(), _vm->_scenery->_toRedrawTop);
-	WRITE_VAR_OFFSET(_vm->_game->_script->readVarIndex(), _vm->_scenery->_toRedrawRight);
-	WRITE_VAR_OFFSET(_vm->_game->_script->readVarIndex(), _vm->_scenery->_toRedrawBottom);
+	if ((objIndex < 0) || (objIndex >= _vm->_mult->_objCount)) {
+		warning("o1_getObjAnimSize(): objIndex = %d (%d)", objIndex, _vm->_mult->_objCount);
+		_vm->_scenery->_toRedrawLeft   = 0;
+		_vm->_scenery->_toRedrawTop    = 0;
+		_vm->_scenery->_toRedrawRight  = 0;
+		_vm->_scenery->_toRedrawBottom = 0;
+	} else {
+		Mult::Mult_AnimData &animData = *(_vm->_mult->_objects[objIndex].pAnimData);
+		if (animData.isStatic == 0)
+			_vm->_scenery->updateAnim(animData.layer, animData.frame,
+					animData.animation, 0, *(_vm->_mult->_objects[objIndex].pPosX),
+					*(_vm->_mult->_objects[objIndex].pPosY), 0);
+
+		_vm->_scenery->_toRedrawLeft = MAX<int16>(_vm->_scenery->_toRedrawLeft, 0);
+		_vm->_scenery->_toRedrawTop  = MAX<int16>(_vm->_scenery->_toRedrawTop , 0);
+	}
+
+	WRITE_VAR_OFFSET(varLeft  , _vm->_scenery->_toRedrawLeft);
+	WRITE_VAR_OFFSET(varTop   , _vm->_scenery->_toRedrawTop);
+	WRITE_VAR_OFFSET(varRight , _vm->_scenery->_toRedrawRight);
+	WRITE_VAR_OFFSET(varBottom, _vm->_scenery->_toRedrawBottom);
 }
 
 void Inter_v1::o1_loadStatic() {

Modified: scummvm/trunk/engines/gob/inter_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_v2.cpp	2009-08-24 21:58:24 UTC (rev 43712)
+++ scummvm/trunk/engines/gob/inter_v2.cpp	2009-08-24 22:37:09 UTC (rev 43713)
@@ -163,7 +163,7 @@
 
 	type = _vm->_game->_script->peekByte();
 
-	value = _vm->_game->_script->readVarIndex();
+	value = (uint16) _vm->_game->_script->readVarIndex();
 
 	switch (type) {
 	case TYPE_VAR_INT8:
@@ -284,9 +284,9 @@
 	int16 oldAnimHeight;
 	int16 oldAnimWidth;
 	int16 oldObjCount;
-	int16 posXVar;
-	int16 posYVar;
-	int16 animDataVar;
+	uint16 posXVar;
+	uint16 posYVar;
+	uint16 animDataVar;
 
 	oldAnimWidth = _vm->_mult->_animWidth;
 	oldAnimHeight = _vm->_mult->_animHeight;
@@ -1278,14 +1278,14 @@
 }
 
 bool Inter_v2::o2_getFreeMem(OpFuncParams &params) {
-	int16 freeVar;
-	int16 maxFreeVar;
+	uint16 freeVar;
+	uint16 maxFreeVar;
 
-	freeVar = _vm->_game->_script->readVarIndex();
+	freeVar    = _vm->_game->_script->readVarIndex();
 	maxFreeVar = _vm->_game->_script->readVarIndex();
 
 	// HACK
-	WRITE_VAR_OFFSET(freeVar, 1000000);
+	WRITE_VAR_OFFSET(freeVar   , 1000000);
 	WRITE_VAR_OFFSET(maxFreeVar, 1000000);
 	WRITE_VAR(16, _vm->_game->_script->getVariablesCount() * 4);
 	return false;

Modified: scummvm/trunk/engines/gob/inter_v6.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_v6.cpp	2009-08-24 21:58:24 UTC (rev 43712)
+++ scummvm/trunk/engines/gob/inter_v6.cpp	2009-08-24 22:37:09 UTC (rev 43713)
@@ -274,7 +274,7 @@
 
 bool Inter_v6::o6_assign(OpFuncParams &params) {
 	uint16 size, destType;
-	int16 dest = _vm->_game->_script->readVarIndex(&size, &destType);
+	uint16 dest = _vm->_game->_script->readVarIndex(&size, &destType);
 
 	if (size != 0) {
 		int16 src;
@@ -284,7 +284,7 @@
 		src = _vm->_game->_script->readVarIndex(&size, 0);
 
 		memcpy(_vm->_inter->_variables->getAddressOff8(dest),
-				_vm->_inter->_variables->getAddressOff8(src), size * 4);
+				_vm->_inter->_variables->getAddressOff8((uint16) src), size * 4);
 
 		_vm->_game->_script->pop();
 


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