diff options
| author | Travis Howell | 2004-10-08 07:04:57 +0000 | 
|---|---|---|
| committer | Travis Howell | 2004-10-08 07:04:57 +0000 | 
| commit | 903073df2e88e2b490c0f822d23abb7953181881 (patch) | |
| tree | 40540e9a993a85c2891d9980b4696a1acc5625cf | |
| parent | 970a782edf005540067424c104e615e392439235 (diff) | |
| download | scummvm-rg350-903073df2e88e2b490c0f822d23abb7953181881.tar.gz scummvm-rg350-903073df2e88e2b490c0f822d23abb7953181881.tar.bz2 scummvm-rg350-903073df2e88e2b490c0f822d23abb7953181881.zip | |
Small correction
Ensure object exists, before pushing data.
svn-id: r15464
| -rw-r--r-- | scumm/script_v8.cpp | 32 | 
1 files changed, 10 insertions, 22 deletions
| diff --git a/scumm/script_v8.cpp b/scumm/script_v8.cpp index 0873eb2809..e334717385 100644 --- a/scumm/script_v8.cpp +++ b/scumm/script_v8.cpp @@ -1212,30 +1212,14 @@ void ScummEngine_v8::o8_kernelSetFunctions() {  	switch (args[0]) {  	case 11: {	// lockObject  		int objidx = getObjectIndex(args[1]); -		if (objidx == -1) { -			warning("Cannot find object %d to lock", args[1]); -			break; -		} - +		assert(objidx != -1);  		lock(rtFlObject, objidx); - -//		if (ObjData.fl_object_index != 0) { -//			ObjData.locked = 1; -//		}  		break;  	}  	case 12: {	// unlockObject  		int objidx = getObjectIndex(args[1]); -		if (objidx == -1) { -			warning("Cannot find object %d to unlock", args[1]); -			break; -		} - +		assert(objidx != -1);  		unlock(rtFlObject, objidx); - -//		if (ObjData.fl_object_index != 0) { -//			ObjData.locked = 0; -//		}  		break;  	}  	case 13:	// remapCostume @@ -1466,21 +1450,25 @@ void ScummEngine_v8::o8_getActorZPlane() {  void ScummEngine_v8::o8_getObjectImageX() {  	int i = getObjectIndex(pop()); +	assert(i);  	push(_objs[i].x_pos);  }  void ScummEngine_v8::o8_getObjectImageY() {  	int i = getObjectIndex(pop()); +	assert(i);  	push(_objs[i].y_pos);  }  void ScummEngine_v8::o8_getObjectImageWidth() {  	int i = getObjectIndex(pop()); +	assert(i);  	push(_objs[i].width);  }  void ScummEngine_v8::o8_getObjectImageHeight() {  	int i = getObjectIndex(pop()); +	assert(i);  	push(_objs[i].height);  } @@ -1519,7 +1507,7 @@ void ScummEngine_v8::o8_drawObject() {  	int imagecount;  	ObjectData *od; -	if (!objnum) +	if (objnum == -1)  		return;  	od = &_objs[objnum]; @@ -1530,17 +1518,17 @@ void ScummEngine_v8::o8_drawObject() {  	addObjectToDrawQue(objnum); -	if (state == 255) { +	if (state == 0xFF) {  		state = getState(obj);  		imagecount = getObjectImageCount(obj); -		if (imagecount != state) +		if (state < imagecount)  			state++;  		else  			state = 1;  	} -	if (state == 254) +	if (state == 0xFE)  		state = _rnd.getRandomNumber(getObjectImageCount(obj));  	putState(obj, state); | 
