From 097f76ae00bd80cb6886673d45749aad95733771 Mon Sep 17 00:00:00 2001 From: Ludvig Strigeus Date: Tue, 6 Nov 2001 20:00:47 +0000 Subject: full screen flag, better mouse cursors, removed change log from individual files svn-id: r3462 --- actor.cpp | 31 +-------- boxes.cpp | 15 +---- costume.cpp | 28 +------- debug.cpp | 13 +--- gfx.cpp | 204 +++++++++++++++++++++++++++++++++++----------------------- object.cpp | 145 +++++++++++++++++++++++++---------------- resource.cpp | 34 +--------- saveload.cpp | 32 +-------- script.cpp | 24 +------ script_v1.cpp | 26 +------- script_v2.cpp | 23 +------ scumm.h | 97 +++++++++------------------- scummsys.h | 43 ++----------- scummvm.cpp | 76 +++++----------------- scummvm.dsp | 10 +-- sdl.cpp | 166 +++++++++++++++++++++++++++++++---------------- sound.cpp | 14 +--- string.cpp | 24 +------ sys.cpp | 15 +---- verbs.cpp | 22 +------ windows.cpp | 10 ++- 21 files changed, 407 insertions(+), 645 deletions(-) diff --git a/actor.cpp b/actor.cpp index efdac193a6..b82f8597de 100644 --- a/actor.cpp +++ b/actor.cpp @@ -15,36 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * Change Log: - * $Log$ - * Revision 1.8 2001/11/05 19:21:49 strigeus - * bug fixes, - * speech in dott - * - * Revision 1.7 2001/10/26 17:34:50 strigeus - * bug fixes, code cleanup - * - * Revision 1.6 2001/10/23 19:51:50 strigeus - * recompile not needed when switching games - * debugger skeleton implemented - * - * Revision 1.5 2001/10/16 10:01:44 strigeus - * preliminary DOTT support - * - * Revision 1.4 2001/10/10 17:18:33 strigeus - * fixed swapped parameters in o_walkActorToActor - * - * Revision 1.3 2001/10/10 11:24:21 strigeus - * fixed return value from adjustXYToBeInBox - * - * Revision 1.2 2001/10/09 18:35:02 strigeus - * fixed object parent bug - * fixed some signed/unsigned comparisons - * - * Revision 1.1.1.1 2001/10/09 14:30:14 strigeus - * - * initial revision - * + * $Header$ * */ diff --git a/boxes.cpp b/boxes.cpp index 8db43bb69e..96779c4f62 100644 --- a/boxes.cpp +++ b/boxes.cpp @@ -15,20 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * Change Log: - * $Log$ - * Revision 1.3 2001/11/05 19:21:49 strigeus - * bug fixes, - * speech in dott - * - * Revision 1.2 2001/10/11 10:45:39 strigeus - * Fixed bug in Scumm::getBoxCoordinates where unsigned integers were read - * instead of signed ones. - * - * Revision 1.1.1.1 2001/10/09 14:30:14 strigeus - * - * initial revision - * + * $Header$ * */ diff --git a/costume.cpp b/costume.cpp index d4327290de..f779e5e397 100644 --- a/costume.cpp +++ b/costume.cpp @@ -15,33 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * Change Log: - * $Log$ - * Revision 1.7 2001/11/05 19:21:49 strigeus - * bug fixes, - * speech in dott - * - * Revision 1.6 2001/10/26 17:34:50 strigeus - * bug fixes, code cleanup - * - * Revision 1.5 2001/10/23 19:51:50 strigeus - * recompile not needed when switching games - * debugger skeleton implemented - * - * Revision 1.4 2001/10/16 20:31:27 strigeus - * misc fixes - * - * Revision 1.3 2001/10/16 10:01:45 strigeus - * preliminary DOTT support - * - * Revision 1.2 2001/10/09 18:35:02 strigeus - * fixed object parent bug - * fixed some signed/unsigned comparisons - * - * Revision 1.1.1.1 2001/10/09 14:30:14 strigeus - * - * initial revision - * + * $Header$ * */ diff --git a/debug.cpp b/debug.cpp index ac5765297b..1567553361 100644 --- a/debug.cpp +++ b/debug.cpp @@ -15,18 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * Change Log: - * $Log$ - * Revision 1.3 2001/10/26 17:34:50 strigeus - * bug fixes, code cleanup - * - * Revision 1.2 2001/10/23 19:56:57 strigeus - * fixed spelling error - * - * Revision 1.1 2001/10/23 19:51:50 strigeus - * recompile not needed when switching games - * debugger skeleton implemented - * + * $Header$ * */ diff --git a/gfx.cpp b/gfx.cpp index dcdb0e3848..ccf3d377a4 100644 --- a/gfx.cpp +++ b/gfx.cpp @@ -15,46 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * Change Log: - * $Log$ - * Revision 1.11 2001/11/05 19:21:49 strigeus - * bug fixes, - * speech in dott - * - * Revision 1.10 2001/10/29 23:07:24 strigeus - * better MI1 compatibility - * - * Revision 1.9 2001/10/26 17:34:50 strigeus - * bug fixes, code cleanup - * - * Revision 1.8 2001/10/23 19:51:50 strigeus - * recompile not needed when switching games - * debugger skeleton implemented - * - * Revision 1.7 2001/10/17 10:07:39 strigeus - * fixed verbs not saved in non dott games, - * implemented a screen effect - * - * Revision 1.6 2001/10/17 07:12:37 strigeus - * fixed nasty signed/unsigned bug - * - * Revision 1.5 2001/10/16 20:31:27 strigeus - * misc fixes - * - * Revision 1.4 2001/10/16 10:01:47 strigeus - * preliminary DOTT support - * - * Revision 1.3 2001/10/10 12:52:21 strigeus - * fixed bug in GDI_UnkDecode7() - * - * Revision 1.2 2001/10/10 10:02:33 strigeus - * alternative mouse cursor - * basic save&load - * - * Revision 1.1.1.1 2001/10/09 14:30:14 strigeus - * - * initial revision - * + * $Header$ * */ @@ -1721,6 +1682,23 @@ void Scumm::setPalColor(int index, int r, int g, int b) { void Scumm::drawMouse() { /* TODO: handle shake here */ + if (_cursorAnimate) { + if (!(_cursorAnimateIndex&0x3)) + decompressDefaultCursor((_cursorAnimateIndex>>2)&3); + _cursorAnimateIndex++; + + } + + ::drawMouse(this, + mouse.x - _cursorHotspotX, + mouse.y - _cursorHotspotY, + _cursorWidth, + _cursorHeight, + _grabbedCursor, + gdi._unk4>0 + ); + +/* ::drawMouse(this, mouse.x - gdi._hotspot_x, mouse.y - gdi._hotspot_y, @@ -1728,6 +1706,7 @@ void Scumm::drawMouse() { gdi._mouseMask + ((gdi._drawMouseX&7)<<6), gdi._unk4>0 ); + */ } void Scumm::setCursorHotspot(int cursor, int x, int y) { @@ -1736,33 +1715,9 @@ void Scumm::setCursorHotspot(int cursor, int x, int y) { cur->hotspot_y = y; } -void Scumm::setCursorImg(int room, int img) { - byte *ptr; - int index; - CodeHeader *cdhd; - ImageHeader *imhd; - int w,h; - byte *roomptr; - RoomHeader *rmhd; - - if (getObjectIndex(img)!=-1) { - cdhd = (CodeHeader*)getObjectAddress(img); - ptr = (byte*)cdhd + READ_BE_UINT32(&cdhd->size); - cdhd = (CodeHeader*)findResource(MKID('CDHD'), (byte*)cdhd, 0); - w = READ_LE_UINT16(&cdhd->v6.w)>>3; - h = READ_LE_UINT16(&cdhd->v6.h)>>3; - imhd = (ImageHeader*)findResource(MKID('IMHD'), ptr, 0); - } else { -// error("setCursorImg: -1 not impl"); - } - - - -// offs = ((uint32*)ptr)[img+1]; -// if (!offs) -// return; - - warning("stub setCursorImg(%d,%d)", room, img); +void Scumm::setCursorHotspot2(int x,int y) { + _cursorHotspotX = x; + _cursorHotspotY = y; } byte Scumm::isMaskActiveAt(int l, int t, int r, int b, byte *mem) { @@ -1876,30 +1831,119 @@ void Scumm::darkenPalette(int a, int b, int c, int d, int e) { } } -void Scumm::unkMiscOp4(int a, int b, int c, int d) { - VirtScreen *vs = findVirtScreen(b); +void Scumm::grabCursor(int x, int y, int w, int h) { + VirtScreen *vs = findVirtScreen(y); if (vs==NULL) { - warning("unkMiscOp4: invalid virtscreen %d", b); + warning("grabCursor: invalid Y %d", y); return; } grabCursor( - getResourceAddress(rtBuffer, vs->number+1) + (b-vs->topline)*320 + a, - c,d); + getResourceAddress(rtBuffer, vs->number+1) + (y-vs->topline)*320 + x, + w,h); -// _cursor_width = c; -// _cursor_height = d; +} + +void Scumm::decompressBomp(byte *dst, byte *src, int w, int h) { + int len,num; + byte code,color; + + src += 8; + + do { + len = w; + src += 2; + while (len) { + code = *src++; + num = (code>>1)+1; + if (num>len) num=len; + len -= num; + if (code&1) { + color = *src++; + do *dst++ = color; while (--num); + } else { + do *dst++ = *src++; while (--num); + } + } + } while (--h); } void Scumm::grabCursor(byte *ptr, int width, int height) { -#if 0 - int size; - byte *ptr; + uint size; + byte *dst; size = width * height; - if (size > 10240) + if (size > sizeof(_grabbedCursor)) error("grabCursor: grabbed cursor too big"); - ptr = createResource( -#endif + + _cursorWidth = width; + _cursorHeight = height; + _cursorAnimate = false; + + dst = _grabbedCursor; + for(;height;height--) { + memcpy(dst, ptr, width); + dst += width; + ptr += 320; + } + +} + +void Scumm::useIm01Cursor(byte *im, int w, int h) { + VirtScreen *vs = &virtscr[0]; + + w<<=3; + h<<=3; + + drawBox(0,0,w-1,h-1,0xFF); + + vs->alloctwobuffers = false; + gdi._disable_zbuffer = true; + gdi.drawBitmap(im, vs, _screenStartStrip, 0, h, 0, w>>3, 0); + vs->alloctwobuffers = true; + gdi._disable_zbuffer = false; + + grabCursor(getResourceAddress(rtBuffer, 1) + vs->xstart, w, h); + + blit(getResourceAddress(rtBuffer, 1) + vs->xstart, getResourceAddress(rtBuffer, 5) + vs->xstart, w, h); +} + +void Scumm::useBompCursor(byte *im, int width, int height) { + uint size; + + width<<=3; + height<<=3; + + size = width * height; + if (size > sizeof(_grabbedCursor)) + error("useBompCursor: cursor too big"); + + _cursorWidth = width; + _cursorHeight = height; + _cursorAnimate = false; + + decompressBomp(_grabbedCursor, im+10, width, height); +} + +static const byte default_cursor_colors[4] = { + 15,15,7,8 +}; + +void Scumm::decompressDefaultCursor(int index) { + int i; + byte color; + + memset(_grabbedCursor, 0xFF, sizeof(_grabbedCursor)); + _cursorWidth = 16; + _cursorHeight = 16; + _cursorHotspotX = 8; + _cursorHotspotY = 7; + + color = default_cursor_colors[index]; + + for(i=0; i<16; i++) { + _grabbedCursor[16*8+i] = color; + _grabbedCursor[16*i+8] = color; + } } diff --git a/object.cpp b/object.cpp index 5d44855b19..0595f3389f 100644 --- a/object.cpp +++ b/object.cpp @@ -15,36 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * Change Log: - * $Log$ - * Revision 1.8 2001/11/05 19:21:49 strigeus - * bug fixes, - * speech in dott - * - * Revision 1.7 2001/10/26 17:34:50 strigeus - * bug fixes, code cleanup - * - * Revision 1.6 2001/10/23 19:51:50 strigeus - * recompile not needed when switching games - * debugger skeleton implemented - * - * Revision 1.5 2001/10/17 12:37:50 strigeus - * fixed big endian bug - * - * Revision 1.4 2001/10/16 12:20:18 strigeus - * made files compile on unix - * - * Revision 1.3 2001/10/16 10:01:47 strigeus - * preliminary DOTT support - * - * Revision 1.2 2001/10/09 18:35:02 strigeus - * fixed object parent bug - * fixed some signed/unsigned comparisons - * - * Revision 1.1.1.1 2001/10/09 14:30:14 strigeus - * - * initial revision - * + * $Header$ * */ @@ -169,8 +140,8 @@ void Scumm::getObjectXYPos(int object) { x = od->x_pos*8 + (int16)READ_LE_UINT16(&imhd->hotspot[state].x); y = od->y_pos*8 + (int16)READ_LE_UINT16(&imhd->hotspot[state].y); } else { - x = od->cdhd_10; - y = od->cdhd_12; + x = od->walk_x; + y = od->walk_y; } abr = adjustXYToBeInBox(0, x, y); @@ -401,38 +372,38 @@ void Scumm::loadRoomObjects() { od = &_objs[1]; for (i=1; i<=_numObjectsInRoom; i++,od++) { - ptr = room + _objs[i].offs_obcd_to_room; + ptr = room + od->offs_obcd_to_room; cdhd = (CodeHeader*)findResource(MKID('CDHD'), ptr,0); - _objs[i].obj_nr = READ_LE_UINT16(&cdhd->obj_id); + od->obj_nr = READ_LE_UINT16(&cdhd->obj_id); if (_majorScummVersion == 6) { - _objs[i].numstrips = READ_LE_UINT16(&cdhd->v6.w)>>3; - _objs[i].height = READ_LE_UINT16(&cdhd->v6.h)>>3; - _objs[i].x_pos = ((int16)READ_LE_UINT16(&cdhd->v6.x))>>3; - _objs[i].y_pos = ((int16)READ_LE_UINT16(&cdhd->v6.y))>>3; + od->numstrips = READ_LE_UINT16(&cdhd->v6.w)>>3; + od->height = READ_LE_UINT16(&cdhd->v6.h)>>3; + od->x_pos = ((int16)READ_LE_UINT16(&cdhd->v6.x))>>3; + od->y_pos = ((int16)READ_LE_UINT16(&cdhd->v6.y))>>3; if (cdhd->v6.flags == 0x80) { - _objs[i].parentstate = 1<<4; + od->parentstate = 1<<4; } else { - _objs[i].parentstate = (cdhd->v6.flags&0xF)<<4; + od->parentstate = (cdhd->v6.flags&0xF)<<4; } - _objs[i].parent = cdhd->v6.parent; - _objs[i].actordir = cdhd->v6.actordir; + od->parent = cdhd->v6.parent; + od->actordir = cdhd->v6.actordir; } else { - _objs[i].numstrips = cdhd->v5.w; - _objs[i].height = cdhd->v5.h; - _objs[i].x_pos = cdhd->v5.x; - _objs[i].y_pos = cdhd->v5.y; + od->numstrips = cdhd->v5.w; + od->height = cdhd->v5.h; + od->x_pos = cdhd->v5.x; + od->y_pos = cdhd->v5.y; if (cdhd->v5.flags == 0x80) { - _objs[i].parentstate = 1<<4; + od->parentstate = 1<<4; } else { - _objs[i].parentstate = (cdhd->v5.flags&0xF)<<4; + od->parentstate = (cdhd->v5.flags&0xF)<<4; } - _objs[i].parent = cdhd->v5.parent; - _objs[i].cdhd_10 = READ_LE_UINT16(&cdhd->v5.unk2); - _objs[i].cdhd_12 = READ_LE_UINT16(&cdhd->v5.unk3); - _objs[i].actordir = cdhd->v5.actordir; + od->parent = cdhd->v5.parent; + od->walk_x = READ_LE_UINT16(&cdhd->v5.walk_x); + od->walk_y = READ_LE_UINT16(&cdhd->v5.walk_y); + od->actordir = cdhd->v5.actordir; } - _objs[i].fl_object_index = 0; + od->fl_object_index = 0; } CHECK_HEAP @@ -576,7 +547,7 @@ byte *Scumm::getObjectAddress(int obj) { return 0; } -void Scumm::addObjectToInventory(int obj, int room) { +void Scumm::addObjectToInventory(uint obj, uint room) { int i, slot; byte *ptr,*obcdptr; uint32 size,cdoffs; @@ -765,3 +736,69 @@ int Scumm::getDistanceBetween(bool is_obj_1, int b, int c, bool is_obj_2, int e, return getDist(x,y,x2,y2) * 0xFF / ((i + j)>>1); } + +void Scumm::setCursorImg(uint room, uint img) { + byte *ptr; + int index; + CodeHeader *cdhd; + ImageHeader *imhd; + int w,h; + byte *roomptr,*obcd,*obim,*dataptr,*bomp; + RoomHeader *rmhd; + int i,numobj; + uint32 size; + + if (getObjectIndex(img)!=-1) { + obim = getObjectAddress(img); + ptr = obim + READ_BE_UINT32(&((ImageHeader*)obim)->size); + cdhd = (CodeHeader*)findResource(MKID('CDHD'), obim, 0); + imhd = (ImageHeader*)findResource(MKID('IMHD'), ptr, 0); + } else { + ensureResourceLoaded(1, room); + roomptr = getResourceAddress(1, room); + rmhd = (RoomHeader*)findResource(MKID('RMHD'), roomptr, 0); + + numobj = READ_LE_UINT16(&rmhd->numObjects); + for(i=0; ;i++) { + if (i>=numobj) + error("setCursorImg: object %d code not found in room %d", img, room); + + obcd = findResource(MKID('OBCD'), roomptr, i); + if (obcd==NULL) + error("setCursorImg: not enough code blocks in room %d", room); + cdhd = (CodeHeader*)findResource(MKID('CDHD'), obcd, 0); + if (READ_LE_UINT16(&cdhd->obj_id) == img) + break; + } + + for(i=0; ;i++) { + if (i>=numobj) + error("setCursorImg: object %d image not found in room %d", img, room); + obim = findResource(MKID('OBIM'), roomptr, i); + if (obim==NULL) + error("setCursorImg: not enough image blocks in room %d", room); + imhd = (ImageHeader*)findResource(MKID('IMHD'), obim, 0); + if (READ_LE_UINT16(&imhd->obj_id) == img) + break; + } + } + + setCursorHotspot2( + READ_LE_UINT16(&imhd->hotspot[0].x), + READ_LE_UINT16(&imhd->hotspot[0].y)); + + w = READ_LE_UINT16(&cdhd->v6.w)>>3; + h = READ_LE_UINT16(&cdhd->v6.h)>>3; + + size = READ_BE_UINT32(&cdhd->size); + if (size > 1000) + error("setCursorImg: Cursor image too large"); + + dataptr = findResource(MKID('IM01'),obim, 0); + + if ((bomp = findResource(MKID('BOMP'), dataptr, 0)) != NULL) + useBompCursor(bomp, w, h); + else + useIm01Cursor(dataptr, w, h); + +} diff --git a/resource.cpp b/resource.cpp index fa0f3c5033..c4451073c7 100644 --- a/resource.cpp +++ b/resource.cpp @@ -15,39 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * Change Log: - * $Log$ - * Revision 1.9 2001/11/05 19:21:49 strigeus - * bug fixes, - * speech in dott - * - * Revision 1.8 2001/10/29 21:49:25 strigeus - * fixed bug in validateResource - * - * Revision 1.7 2001/10/26 17:34:50 strigeus - * bug fixes, code cleanup - * - * Revision 1.6 2001/10/24 20:12:52 strigeus - * fixed some bugs related to string handling - * - * Revision 1.5 2001/10/23 19:51:50 strigeus - * recompile not needed when switching games - * debugger skeleton implemented - * - * Revision 1.4 2001/10/16 12:20:20 strigeus - * made files compile on unix - * - * Revision 1.3 2001/10/16 10:01:47 strigeus - * preliminary DOTT support - * - * Revision 1.2 2001/10/10 10:02:33 strigeus - * alternative mouse cursor - * basic save&load - * - * Revision 1.1.1.1 2001/10/09 14:30:14 strigeus - * - * initial revision - * + * $Header$ * */ diff --git a/saveload.cpp b/saveload.cpp index fdd4b1b32c..c4dd27a3b4 100644 --- a/saveload.cpp +++ b/saveload.cpp @@ -15,33 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * Change Log: - * $Log$ - * Revision 1.7 2001/11/05 19:21:49 strigeus - * bug fixes, - * speech in dott - * - * Revision 1.6 2001/10/26 17:34:50 strigeus - * bug fixes, code cleanup - * - * Revision 1.5 2001/10/18 20:04:58 strigeus - * flags were not saved properly - * - * Revision 1.4 2001/10/17 10:07:39 strigeus - * fixed verbs not saved in non dott games, - * implemented a screen effect - * - * Revision 1.3 2001/10/16 10:01:47 strigeus - * preliminary DOTT support - * - * Revision 1.2 2001/10/10 10:02:33 strigeus - * alternative mouse cursor - * basic save&load - * - * Revision 1.1.1.1 2001/10/09 14:30:13 strigeus - * - * initial revision - * + * $Header$ * */ @@ -156,8 +130,8 @@ void Scumm::saveOrLoad(Serializer *s) { const SaveLoadEntry objectEntries[] = { MKLINE(ObjectData,offs_obim_to_room,sleUint32), MKLINE(ObjectData,offs_obcd_to_room,sleUint32), - MKLINE(ObjectData,cdhd_10,sleUint16), - MKLINE(ObjectData,cdhd_12,sleUint16), + MKLINE(ObjectData,walk_x,sleUint16), + MKLINE(ObjectData,walk_y,sleUint16), MKLINE(ObjectData,obj_nr,sleUint16), MKLINE(ObjectData,x_pos,sleInt16), MKLINE(ObjectData,y_pos,sleInt16), diff --git a/script.cpp b/script.cpp index 654d2570a1..06d8d01176 100644 --- a/script.cpp +++ b/script.cpp @@ -15,29 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * Change Log: - * $Log$ - * Revision 1.6 2001/11/05 19:21:49 strigeus - * bug fixes, - * speech in dott - * - * Revision 1.5 2001/10/26 17:34:50 strigeus - * bug fixes, code cleanup - * - * Revision 1.4 2001/10/23 19:51:50 strigeus - * recompile not needed when switching games - * debugger skeleton implemented - * - * Revision 1.3 2001/10/16 10:01:47 strigeus - * preliminary DOTT support - * - * Revision 1.2 2001/10/11 13:36:25 strigeus - * fixed swapped parameters in o_walkActorToActor - * - * Revision 1.1.1.1 2001/10/09 14:30:13 strigeus - * - * initial revision - * + * $Header$ * */ diff --git a/script_v1.cpp b/script_v1.cpp index 481a10c10f..e9595db146 100644 --- a/script_v1.cpp +++ b/script_v1.cpp @@ -15,27 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * Change Log: - * $Log$ - * Revision 1.6 2001/11/05 19:21:49 strigeus - * bug fixes, - * speech in dott - * - * Revision 1.5 2001/10/29 22:09:20 strigeus - * script invoked loading&saving in compatible mode - * - * Revision 1.4 2001/10/26 17:34:50 strigeus - * bug fixes, code cleanup - * - * Revision 1.3 2001/10/23 19:51:50 strigeus - * recompile not needed when switching games - * debugger skeleton implemented - * - * Revision 1.2 2001/10/16 20:31:27 strigeus - * misc fixes - * - * Revision 1.1 2001/10/16 10:01:47 strigeus - * preliminary DOTT support + * $Header$ * */ @@ -737,9 +717,9 @@ void Scumm::o5_drawObject() { return; od = &_objs[index]; if (_xPos!=0xFF) { - od->cdhd_10 += (_xPos - od->x_pos)<<3; + od->walk_x += (_xPos - od->x_pos)<<3; od->x_pos = _xPos; - od->cdhd_12 += (_yPos - od->y_pos)<<3; + od->walk_y += (_yPos - od->y_pos)<<3; od->y_pos = _yPos; } addObjectToDrawQue(index); diff --git a/script_v2.cpp b/script_v2.cpp index fc49844cc2..363dd70ca2 100644 --- a/script_v2.cpp +++ b/script_v2.cpp @@ -15,24 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * Change Log: - * $Log$ - * Revision 1.5 2001/11/05 19:21:49 strigeus - * bug fixes, - * speech in dott - * - * Revision 1.4 2001/10/26 17:34:50 strigeus - * bug fixes, code cleanup - * - * Revision 1.3 2001/10/24 20:12:52 strigeus - * fixed some bugs related to string handling - * - * Revision 1.2 2001/10/23 19:51:50 strigeus - * recompile not needed when switching games - * debugger skeleton implemented - * - * Revision 1.1 2001/10/16 10:01:47 strigeus - * preliminary DOTT support + * $Header$ * */ @@ -743,7 +726,7 @@ void Scumm::o6_cursorCommand() { charset._colorMap[i] = _charsetData[string[1].t_charset][i] = args[i]; break; case 0xD6: - new_unk_1(pop()); + makeCursorColorTransparent(pop()); break; } @@ -2013,7 +1996,7 @@ void Scumm::o6_miscOps() { warning("o6_miscOps: nothing in 3"); break; case 4: - unkMiscOp4(args[1], args[2], args[3], args[4]); + grabCursor(args[1], args[2], args[3], args[4]); break; case 5: unkVirtScreen4(args[1]); diff --git a/scumm.h b/scumm.h index 7641a8acff..b6104d424a 100644 --- a/scumm.h +++ b/scumm.h @@ -15,63 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * Change Log: - * $Log$ - * Revision 1.17 2001/11/05 20:45:07 strigeus - * fixed playSfxSound types - * - * Revision 1.16 2001/11/05 19:21:49 strigeus - * bug fixes, - * speech in dott - * - * Revision 1.15 2001/10/29 23:07:24 strigeus - * better MI1 compatibility - * - * Revision 1.14 2001/10/26 17:34:50 strigeus - * bug fixes, code cleanup - * - * Revision 1.13 2001/10/24 20:12:52 strigeus - * fixed some bugs related to string handling - * - * Revision 1.12 2001/10/23 19:51:50 strigeus - * recompile not needed when switching games - * debugger skeleton implemented - * - * Revision 1.11 2001/10/17 10:07:40 strigeus - * fixed verbs not saved in non dott games, - * implemented a screen effect - * - * Revision 1.10 2001/10/17 07:12:37 strigeus - * fixed nasty signed/unsigned bug - * - * Revision 1.9 2001/10/16 20:31:27 strigeus - * misc fixes - * - * Revision 1.8 2001/10/16 10:01:47 strigeus - * preliminary DOTT support - * - * Revision 1.7 2001/10/11 12:07:35 strigeus - * Determine caption from file name. - * - * Revision 1.6 2001/10/11 08:00:42 strigeus - * Dump scripts by using DUMP_SCRIPTS as a compile option instead. - * - * Revision 1.5 2001/10/10 10:02:33 strigeus - * alternative mouse cursor - * basic save&load - * - * Revision 1.4 2001/10/09 19:02:28 strigeus - * command line parameter support - * - * Revision 1.3 2001/10/09 18:35:02 strigeus - * fixed object parent bug - * fixed some signed/unsigned comparisons - * - * Revision 1.2 2001/10/09 17:38:20 strigeus - * Autodetection of endianness. - * - * Revision 1.1.1.1 2001/10/09 14:30:12 strigeus - * initial revision + * $Header$ * */ @@ -187,7 +131,7 @@ class ObjectData { public: uint32 offs_obim_to_room; uint32 offs_obcd_to_room; - uint16 cdhd_10, cdhd_12; + uint16 walk_x, walk_y; uint16 obj_nr; int16 x_pos; int16 y_pos; @@ -217,8 +161,8 @@ struct CodeHeader { byte x,y,w,h; byte flags; byte parent; - uint16 unk2; - uint16 unk3; + uint16 walk_x; + uint16 walk_y; byte actordir; } v5; @@ -226,8 +170,8 @@ struct CodeHeader { int16 x, y; uint16 w,h; byte flags, parent; + uint16 unk1; uint16 unk2; - uint16 unk3; byte actordir; } v6; }; @@ -742,6 +686,8 @@ struct Scumm { uint32 _maxHeapThreshold; uint32 _minHeapThreshold; + bool _fullScreen; + byte _bkColor; uint16 _lastXstart; @@ -750,6 +696,11 @@ struct Scumm { int16 _virtual_mouse_x, _virtual_mouse_y; + int _cursorHotspotX, _cursorHotspotY; + int _cursorWidth, _cursorHeight; + byte _cursorAnimateIndex; + bool _cursorAnimate; + byte _charsetColor; uint16 _debugMode; @@ -928,7 +879,7 @@ struct Scumm { int _boxPathVertexHeapIndex; int _boxMatrixItem; -// void _grabbedCursor[1024]; + byte _grabbedCursor[1024]; OpcodeProc getOpcode(int i) { return _opcodes[i]; } @@ -1450,7 +1401,7 @@ struct Scumm { void walkActorTo(Actor *a, int x, int y, int direction); - void setCursorImg(int cursor, int img); + void setCursorImg(uint cursor, uint img); void setCursorHotspot(int cursor, int x, int y); void initCharset(int charset); void addObjectToDrawQue(int object); @@ -1460,7 +1411,7 @@ struct Scumm { void setBoxFlags(int box, int val); void setBoxScale(int box, int b); void createBoxMatrix(); - void addObjectToInventory(int obj, int room); + void addObjectToInventory(uint obj, uint room); void removeObjectFromRoom(int obj); void decodeParseString(); void pauseGame(int i); @@ -1480,7 +1431,7 @@ struct Scumm { byte *getObjOrActorName(int obj); void clearOwnerOf(int obj); void runVerbCode(int script, int entry, int a, int b, int16 *vars); - void setVerbObject(int room, int object, int verb); + void setVerbObject(uint room, uint object, uint verb); void unkMessage1(); void unkMessage2(); void actorTalk(); @@ -1549,7 +1500,7 @@ struct Scumm { void setCursorHotspot2(int x,int y); - void new_unk_1(int a); + void makeCursorColorTransparent(int a); void faceActorToObj(int act, int obj); void animateActor(int act, int anim); @@ -1590,7 +1541,7 @@ struct Scumm { void nukeArray(int a); int defineArray(int a, int b, int c, int d); int getDistanceBetween(bool is_obj_1, int b, int c, bool is_obj_2, int e, int f); - void unkMiscOp4(int a, int b, int c, int d); + void grabCursor(int x, int y, int w, int h); void unkMiscOp9(); void startManiac(); void readIndexFileV5(int i); @@ -1613,6 +1564,15 @@ struct Scumm { void freeResources(); void destroy(); + + void useIm01Cursor(byte *im, int w, int h); + void useBompCursor(byte *im, int w, int h); + + void decompressBomp(byte *dst, byte *src, int w, int h); + + void setupCursor() { _cursorAnimate = true; } + + void decompressDefaultCursor(int index); }; struct ScummDebugger { @@ -1686,10 +1646,11 @@ void NORETURN CDECL error(const char *s, ...); void CDECL warning(const char *s, ...); void CDECL debug(int level, const char *s, ...); void checkHeap(); -void initGraphics(Scumm *s); +void initGraphics(Scumm *s, bool fullScreen); void updateScreen(Scumm *s); void drawMouse(Scumm *s, int x, int y, int color, byte *mask, bool visible); +void drawMouse(Scumm *s, int x, int y, int w, int h, byte *buf, bool visible); void blit(byte *dst, byte *src, int w, int h); byte *findResource(uint32 id, byte *searchin, int index); void playSfxSound(void *sound, uint32 size, uint rate); diff --git a/scummsys.h b/scummsys.h index 0a6fa1dee6..ecb8624065 100644 --- a/scummsys.h +++ b/scummsys.h @@ -15,36 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * Change Log: - * $Log$ - * Revision 1.8 2001/11/06 10:34:48 cmatsuoka - * Added missing missing/sys files. - * - * Revision 1.7 2001/11/05 19:21:49 strigeus - * bug fixes, - * speech in dott - * - * Revision 1.6 2001/11/03 06:33:29 cmatsuoka - * Protecting VC++-specific pragmas with ifdef _MSC_VER to allow - * a clean Cygwin build. - * - * Revision 1.5 2001/10/23 19:51:50 strigeus - * recompile not needed when switching games - * debugger skeleton implemented - * - * Revision 1.4 2001/10/16 10:01:47 strigeus - * preliminary DOTT support - * - * Revision 1.3 2001/10/09 18:35:02 strigeus - * fixed object parent bug - * fixed some signed/unsigned comparisons - * - * Revision 1.2 2001/10/09 17:38:20 strigeus - * Autodetection of endianness. - * - * Revision 1.1.1.1 2001/10/09 14:30:14 strigeus - * initial revision - * + * $Header$ * */ @@ -131,16 +102,16 @@ typedef signed long int32; #define MKID(a) ((((a)>>24)&0xFF) | (((a)>>8)&0xFF00) | (((a)<<8)&0xFF0000) | (((a)<<24)&0xFF000000)) #if defined(SCUMM_NEED_ALIGNMENT) - int FORCEINLINE READ_LE_UINT16(void *ptr) { + uint FORCEINLINE READ_LE_UINT16(void *ptr) { return (((byte*)ptr)[1]<<8)|((byte*)ptr)[0]; } #else - int FORCEINLINE READ_LE_UINT16(void *ptr) { + uint FORCEINLINE READ_LE_UINT16(void *ptr) { return *(uint16*)(ptr); } #endif -int FORCEINLINE READ_BE_UINT16(void *ptr) { +uint FORCEINLINE READ_BE_UINT16(void *ptr) { return (((byte*)ptr)[0]<<8)|((byte*)ptr)[1]; } @@ -197,16 +168,16 @@ uint32 FORCEINLINE READ_BE_UINT32(void *ptr) { return *(uint32*)(ptr); } -int FORCEINLINE READ_LE_UINT16(void *ptr) { +uint FORCEINLINE READ_LE_UINT16(void *ptr) { byte *b = (byte*)ptr; return (b[1]<<8) + b[0]; } -int FORCEINLINE READ_BE_UINT16(void *ptr) { +uint FORCEINLINE READ_BE_UINT16(void *ptr) { return *(uint16*)(ptr); } -int FORCEINLINE READ_BE_UINT16_UNALIGNED(void *ptr) { +uint FORCEINLINE READ_BE_UINT16_UNALIGNED(void *ptr) { return (((byte*)ptr)[0]<<8)|((byte*)ptr)[1]; } diff --git a/scummvm.cpp b/scummvm.cpp index a09833c5a2..b3b8f8eb06 100644 --- a/scummvm.cpp +++ b/scummvm.cpp @@ -15,59 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * Change Log: - * $Log$ - * Revision 1.15 2001/11/05 19:21:49 strigeus - * bug fixes, - * speech in dott - * - * Revision 1.14 2001/10/29 23:07:24 strigeus - * better MI1 compatibility - * - * Revision 1.13 2001/10/26 17:34:50 strigeus - * bug fixes, code cleanup - * - * Revision 1.12 2001/10/24 20:12:52 strigeus - * fixed some bugs related to string handling - * - * Revision 1.11 2001/10/23 19:51:50 strigeus - * recompile not needed when switching games - * debugger skeleton implemented - * - * Revision 1.10 2001/10/17 10:07:40 strigeus - * fixed verbs not saved in non dott games, - * implemented a screen effect - * - * Revision 1.9 2001/10/16 20:31:27 strigeus - * misc fixes - * - * Revision 1.8 2001/10/16 12:20:22 strigeus - * made files compile on unix - * - * Revision 1.7 2001/10/16 10:01:48 strigeus - * preliminary DOTT support - * - * Revision 1.6 2001/10/11 11:49:51 strigeus - * Determine caption from file name. - * - * Revision 1.5 2001/10/10 16:29:59 strigeus - * temporary fix to prevent freeze in stan's room until sound is there - * - * Revision 1.4 2001/10/10 10:02:33 strigeus - * alternative mouse cursor - * basic save&load - * - * Revision 1.3 2001/10/09 19:02:28 strigeus - * command line parameter support - * - * Revision 1.2 2001/10/09 18:35:02 strigeus - * fixed object parent bug - * fixed some signed/unsigned comparisons - * - * Revision 1.1.1.1 2001/10/09 14:30:13 strigeus - * - * initial revision - * + * $Header$ * */ @@ -130,7 +78,7 @@ void Scumm::scummInit() { initScreens(0, 16, 320, 144); setShake(0); - setCursor(0); + setupCursor(); for (i=1,a=getFirstActor(); ++a,i<13; i++) { a->number = i; @@ -276,7 +224,7 @@ void Scumm::scummMain(int argc, char **argv) { _bootParam = -7873; } - initGraphics(this); + initGraphics(this, _fullScreen); if (_majorScummVersion==6) initThingsV6(); @@ -446,6 +394,9 @@ void Scumm::parseCommandLine(int argc, char **argv) { case 'b': _bootParam = atoi(s+1); goto NextArg; + case 'f': + _fullScreen = true; + break; default: ShowHelpAndExit:; printf( @@ -453,7 +404,8 @@ ShowHelpAndExit:; "Syntax:\n" "\tscummvm [-b] game\n" "Flags:\n" - "\tb - start in that room\n"); + "\tb - start in that room\n" + "\tf - fullscreen mode\n"); exit(1); } s++; @@ -908,12 +860,14 @@ Actor *Scumm::derefActorSafe(int id, const char *errmsg) { return derefActor(id); } -void Scumm::new_unk_1(int a) { - warning("stub new_unk_1(%d)", a); -} +void Scumm::makeCursorColorTransparent(int a) { + int i,size; + + size = _cursorWidth * _cursorHeight; -void Scumm::setCursorHotspot2(int x,int y) { - warning("stub setCursorHotspot2(%d,%d)", x,y); + for(i=0; ipixels + old_mouse_y*640*2 + old_mouse_x*2; + bak = old_backup; + + for (y=0; ypixels + ydraw*640*2 + xdraw*2; + bak = old_backup; + + for (y=0; ypixels + old_mouse_y*320 + old_mouse_x; + bak = old_backup; + + for (y=0; ypixels + ydraw*320 + xdraw; + bak = old_backup; + + for (y=0; y>1); } -void initGraphics(Scumm *s) { +void initGraphics(Scumm *s, bool fullScreen) { SDL_AudioSpec desired; if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO)==-1) { @@ -496,11 +555,10 @@ void initGraphics(Scumm *s) { SDL_WM_SetCaption(buf,buf); SDL_ShowCursor(SDL_DISABLE); - #if !defined(SCALEUP_2x2) - screen = SDL_SetVideoMode(320, 200, 8, SDL_SWSURFACE); + screen = SDL_SetVideoMode(320, 200, 8, fullScreen ? (SDL_SWSURFACE | SDL_FULLSCREEN) : SDL_SWSURFACE); #else - screen = SDL_SetVideoMode(640, 400, 8, SDL_SWSURFACE); + screen = SDL_SetVideoMode(640, 400, 8, fullScreen ? (SDL_SWSURFACE | SDL_FULLSCREEN) : SDL_SWSURFACE); #endif printf("%d %d, %d %d, %d %d %d, %d %d %d %d %d\n", diff --git a/sound.cpp b/sound.cpp index c8e3beab9a..d4c35b98cf 100644 --- a/sound.cpp +++ b/sound.cpp @@ -15,19 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * Change Log: - * $Log$ - * Revision 1.3 2001/11/05 19:21:49 strigeus - * bug fixes, - * speech in dott - * - * Revision 1.2 2001/10/16 10:01:48 strigeus - * preliminary DOTT support - * - * Revision 1.1.1.1 2001/10/09 14:30:13 strigeus - * - * initial revision - * + * $Header$ * */ diff --git a/string.cpp b/string.cpp index 7ed750f133..077bd118e1 100644 --- a/string.cpp +++ b/string.cpp @@ -15,29 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * Change Log: - * $Log$ - * Revision 1.6 2001/11/05 19:21:49 strigeus - * bug fixes, - * speech in dott - * - * Revision 1.5 2001/10/26 17:34:50 strigeus - * bug fixes, code cleanup - * - * Revision 1.4 2001/10/24 20:12:52 strigeus - * fixed some bugs related to string handling - * - * Revision 1.3 2001/10/23 19:51:50 strigeus - * recompile not needed when switching games - * debugger skeleton implemented - * - * Revision 1.2 2001/10/16 10:01:48 strigeus - * preliminary DOTT support - * - * Revision 1.1.1.1 2001/10/09 14:30:13 strigeus - * - * initial revision - * + * $Header$ * */ diff --git a/sys.cpp b/sys.cpp index 9c5a10dd6d..2b67f30012 100644 --- a/sys.cpp +++ b/sys.cpp @@ -15,20 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * Change Log: - * $Log$ - * Revision 1.3 2001/11/05 19:21:49 strigeus - * bug fixes, - * speech in dott - * - * Revision 1.2 2001/10/10 10:02:33 strigeus - * alternative mouse cursor - * basic save&load - * - * Revision 1.1.1.1 2001/10/09 14:30:13 strigeus - * - * initial revision - * + * $Header$ * */ diff --git a/verbs.cpp b/verbs.cpp index bba4f698d4..066fbb064a 100644 --- a/verbs.cpp +++ b/verbs.cpp @@ -15,25 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * Change Log: - * $Log$ - * Revision 1.5 2001/11/05 19:21:49 strigeus - * bug fixes, - * speech in dott - * - * Revision 1.4 2001/10/26 17:34:50 strigeus - * bug fixes, code cleanup - * - * Revision 1.3 2001/10/16 10:01:48 strigeus - * preliminary DOTT support - * - * Revision 1.2 2001/10/09 19:02:28 strigeus - * command line parameter support - * - * Revision 1.1.1.1 2001/10/09 14:30:13 strigeus - * - * initial revision - * + * $Header$ * */ @@ -260,7 +242,7 @@ void Scumm::killVerb(int slot) { vs->saveid = 0; } -void Scumm::setVerbObject(int room, int object, int verb) { +void Scumm::setVerbObject(uint room, uint object, uint verb) { int numobj, i; byte *obimptr; uint32 imoffs,size; diff --git a/windows.cpp b/windows.cpp index c0505968c7..bf8e13eb81 100644 --- a/windows.cpp +++ b/windows.cpp @@ -17,6 +17,11 @@ * * Change Log: * $Log$ + * Revision 1.12 2001/11/06 20:00:47 strigeus + * full screen flag, + * better mouse cursors, + * removed change log from individual files + * * Revision 1.11 2001/11/06 07:47:00 strigeus * fixed integer overflow for large sounds * @@ -926,8 +931,9 @@ void waitForTimer(Scumm *s) { wm->handleMessage(); } -void initGraphics(Scumm *s) { - +void initGraphics(Scumm *s, bool fullScreen) { + if(fullScreen) + warning("Use SDL for fullscreen support"); } void drawMouse(Scumm *s, int, int, int, byte*, bool) { -- cgit v1.2.3