From 903073df2e88e2b490c0f822d23abb7953181881 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Fri, 8 Oct 2004 07:04:57 +0000 Subject: Small correction Ensure object exists, before pushing data. svn-id: r15464 --- scumm/script_v8.cpp | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) (limited to 'scumm/script_v8.cpp') 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); -- cgit v1.2.3