[Scummvm-cvs-logs] CVS: scummvm actor.cpp,1.21,1.22 boxes.cpp,1.6,1.7 costume.cpp,1.12,1.13 gfx.cpp,1.27,1.28 object.cpp,1.21,1.22 resource.cpp,1.29,1.30 script.cpp,1.19,1.20 scumm.h,1.41,1.42 scummvm.cpp,1.33,1.34

James Brown ender at users.sourceforge.net
Tue Feb 12 10:21:06 CET 2002


Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv8100

Modified Files:
	actor.cpp boxes.cpp costume.cpp gfx.cpp object.cpp 
	resource.cpp script.cpp scumm.h scummvm.cpp 
Log Message:
First part of Yazoo and mines work on making older scumm games work.
Not enough here to actually work yet, just the base groundwork needed.



Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/actor.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** actor.cpp	29 Dec 2001 12:45:54 -0000	1.21
--- actor.cpp	12 Feb 2002 18:20:37 -0000	1.22
***************
*** 450,453 ****
--- 450,454 ----
  
  AdjustBoxResult Scumm::adjustXYToBeInBox(Actor *a, int x, int y, int pathfrom) {
+         // Yazoo: need to recheck with Loom for the class data flags (0x400000)
  	AdjustBoxResult abr,tmp;
  	uint threshold;
***************
*** 462,465 ****
--- 463,469 ----
  	if (a && a->ignoreBoxes==0) {
  		threshold = 30;
+ 
+                 if ((_features & GF_SMALL_HEADER) && (_classData[a->number] & 0x200000))
+                        return abr;
  		
  		while(1) {
***************
*** 468,472 ****
  			b = 0;
  
! 			do {
  				flags = getBoxFlags(box);
  				if (flags&0x80 && (!(flags&0x20) || getClass(a->number, 0x1F)) )
--- 472,477 ----
  			b = 0;
  
!                         if(((_features & GF_SMALL_HEADER) && box) || !(_features & GF_SMALL_HEADER))
!                         do {
  				flags = getBoxFlags(box);
  				if (flags&0x80 && (!(flags&0x20) || getClass(a->number, 0x1F)) )

Index: boxes.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/boxes.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** boxes.cpp	27 Dec 2001 17:51:58 -0000	1.6
--- boxes.cpp	12 Feb 2002 18:20:37 -0000	1.7
***************
*** 44,48 ****
  
  Box *Scumm::getBoxBaseAddr(int box) {
! 	byte *ptr = getResourceAddress(rtMatrix, 2);
  	checkRange(ptr[0]-1, 0, box, "Illegal box %d");
  	return (Box*)(ptr + box*SIZEOF_BOX + 2);
--- 44,54 ----
  
  Box *Scumm::getBoxBaseAddr(int box) {
! 	byte *ptr;
! 
!     if(_features & GF_SMALL_HEADER)
! 		ptr = getResourceAddress(rtMatrix, 1);
!     else
! 		ptr = getResourceAddress(rtMatrix, 2);
! 
  	checkRange(ptr[0]-1, 0, box, "Illegal box %d");
  	return (Box*)(ptr + box*SIZEOF_BOX + 2);

Index: costume.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/costume.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** costume.cpp	27 Dec 2001 17:51:58 -0000	1.12
--- costume.cpp	12 Feb 2002 18:20:37 -0000	1.13
***************
*** 675,679 ****
  	if (_vm->_features&GF_AFTER_V6) {
  		_ptr += 8;
! 	} else {
  		_ptr += 2;
  	}
--- 675,679 ----
  	if (_vm->_features&GF_AFTER_V6) {
  		_ptr += 8;
!         } else if(!(_features&GF_SMALL_HEADER)) {
  		_ptr += 2;
  	}
***************
*** 754,758 ****
  	if (_features&GF_AFTER_V6) {
  		lc->_ptr += 8;
! 	} else {
  		lc->_ptr += 2;
  	}
--- 754,758 ----
  	if (_features&GF_AFTER_V6) {
  		lc->_ptr += 8;
!         } else if (!(_features&GF_SMALL_HEADER)) {
  		lc->_ptr += 2;
  	}

Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gfx.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** gfx.cpp	2 Feb 2002 19:07:10 -0000	1.27
--- gfx.cpp	12 Feb 2002 18:20:37 -0000	1.28
***************
*** 338,345 ****
  	room = getResourceAddress(rtRoom, _roomResource);
  
! 	ptr = findResource(MKID('RMIH'), findResource(MKID('RMIM'), room));
! 
! 	gdi._numZBuffer = READ_LE_UINT16(ptr+8) + 1;
! 
  	assert(gdi._numZBuffer>=1 && gdi._numZBuffer<=4);
  	
--- 338,347 ----
  	room = getResourceAddress(rtRoom, _roomResource);
  
!         if(_features & GF_SMALL_HEADER) {
!                 gdi._numZBuffer = 1;
!         } else {
!                 ptr = findResource(MKID('RMIH'), findResource(MKID('RMIM'), room));
!                 gdi._numZBuffer = READ_LE_UINT16(ptr+8) + 1;
!         }
  	assert(gdi._numZBuffer>=1 && gdi._numZBuffer<=4);
  	
***************
*** 358,362 ****
  	int numcolor;
  
! 	numcolor = getResourceDataSize(ptr) / 3;
  
  	checkRange(256, 0, numcolor, "Too many colors (%d) in Palette");
--- 360,374 ----
  	int numcolor;
  
!         if( _features & GF_SMALL_HEADER ) {
!                 if (_features & GF_OLD256) {
!                         numcolor = 256;
!                         ptr+=2;
!                 } else {
!                         numcolor = READ_LE_UINT16(ptr+6) / 3;
!                         ptr+=8;
!                 }
!         } else {
!                 numcolor = getResourceDataSize(ptr) / 3;
!         }
  
  	checkRange(256, 0, numcolor, "Too many colors (%d) in Palette");
***************
*** 532,535 ****
--- 544,548 ----
  //		updateDirtyScreen(0);
  		/* XXX: EGA_proc4(0); */
+                 warning("EGA_proc4"); /* FIXME */
  		break;
  	case 134:
***************
*** 612,619 ****
  	int numzbuf;
  	int sx;
! 	
  	CHECK_HEAP
  
! 	smap_ptr = findResource(MKID('SMAP'), ptr);
  
  	assert(smap_ptr);
--- 625,638 ----
  	int numzbuf;
  	int sx;
! 
!         if(_vm->_features & GF_16COLOR) /* FIXME */
!                 return;
! 
  	CHECK_HEAP
  
!         if(_vm->_features & GF_SMALL_HEADER)
!                 smap_ptr = _smap_ptr = ptr;
!         else
!                smap_ptr = findResource(MKID('SMAP'), ptr);
  
  	assert(smap_ptr);
***************
*** 637,641 ****
  
  	do {
! 		_smap_ptr = smap_ptr + READ_LE_UINT32(smap_ptr + stripnr*4 + 8);
  
  		CHECK_HEAP
--- 656,663 ----
  
  	do {
!                 if(_vm->_features & GF_SMALL_HEADER)
!                         _smap_ptr = smap_ptr + READ_LE_UINT32(smap_ptr + stripnr*4 + 4);
!                 else
!                         _smap_ptr = smap_ptr + READ_LE_UINT32(smap_ptr + stripnr*4 + 8);
  
  		CHECK_HEAP
***************
*** 724,727 ****
--- 746,766 ----
  		unkDecode7();
  		break;
+ 
+     case 2:
+         unkDecode8();   /* Ender - Zak256/Indy256 */
+         break;
+  
+     case 3:
+         unkDecode9();   /* Ender - Zak256/Indy256 */
+         break;
+ 
+     case 4:
+         unkDecode10();  /* Ender - Zak256/Indy256 */
+         break;
+ 
+     case 7:                                           
+         unkDecode11();  /* Ender - Zak256/Indy256 */
+         break;
+ 
  	case 14: case 15: case 16: case 17: case 18:
  		_decomp_shr = code - 10;
***************
*** 1208,1211 ****
--- 1247,1393 ----
  }
  
+ /* Ender - Zak256/Indy256 decoders */
+ #define READ_256BIT \
+  if ((mask <<= 1) == 256) {buffer = *src++;  mask = 1;}     \
+  bits = ((buffer & mask) != 0);
+ 
+ #define NEXT_ROW                                               \
+                 dst += 320;                                     \
+                 if (--h == 0) {                                 \
+                         if (!--_currentX)                       \
+                                 return;                         \
+                         dst -= _vertStripNextInc;               \
+                         h = _numLinesToProcess;                 \
+                 }
+ 
+ void Gdi::unkDecode8() {
+        byte *src = _smap_ptr;
+        byte *dst = _bgbak_ptr; 
+        int i;
+        uint h = _numLinesToProcess;
+ 
+        _currentX = 8;
+        for(;;) {
+         uint run = (*src++)+1;
+         byte color = *src++;
+         
+          do {
+              *dst = color;
+              NEXT_ROW
+           } while (--run);
+        }
+ }
+ 
+ void Gdi::unkDecode9() { /* FIXME: This one doesn't work.. */
+        byte *src = _smap_ptr;
+        byte *dst = _bgbak_ptr;
+        unsigned char c, bits, color, run;
+        int x, y, i, z;
+        uint buffer, mask = 128;
+        int h = _numLinesToProcess;
+        x = y = i = z = run = 0;
+   
+        while (x < 8) {
+             c = 0;
+             for (i = 0; i < 4; i++) {READ_256BIT;  c+=(bits<<i);}
+             /* printf("%d,", c>>2); */
+             switch ((c>>2)) {
+                 case 0:
+                         color= 0;
+                         for (i=0; i<4; i++) {READ_256BIT; color+=bits<<i;}// color+=getbit(-1)<<i;
+                         for (i=0; i<((c&3)+2); i++) {
+                                 *dst = (run * 16 + color);
+                                 NEXT_ROW
+                         }
+                break;
+ 
+                case 1:
+                         for (i=0; i<((c&3)+1); i++) {
+                                color = 0;
+                                for (z=0; z < 4; z++) {READ_256BIT; color+=bits<<i;}
+                                *dst = (run * 16 + color);
+                                NEXT_ROW // y++; if (y>=height) {y=0; x++;}}
+                         }
+               break;
+ 
+               case 2:
+                       run = 0;
+                       for (i = 0; i < 4; i++) {READ_256BIT; c+=run<<i;}
+                       break;
+             }
+   }
+   /* printf("\n"); */
+ }
+ 
+ void Gdi::unkDecode10() {
+        byte *src = _smap_ptr;
+        byte *dst = _bgbak_ptr; 
+        int i;
+        unsigned char local_palette[256], numcolors = *src++;
+        uint h = _numLinesToProcess;
+ 
+        for (i=0; i < numcolors; i++) 
+                local_palette[i] = *src++;
+  
+        _currentX = 8;
+ 
+        for(;;) {
+         byte color = *src++;
+         if (color < numcolors) {
+                 *dst = local_palette[color];
+                 NEXT_ROW
+         } else {
+                 uint run = color - numcolors + 1;
+                 color = *src++;
+                do {
+                         *dst = color;
+                         NEXT_ROW
+                 } while (--run);
+         }
+        }
+ }
+  
+ 
+ void Gdi::unkDecode11() {
+        byte *src = _smap_ptr;
+        byte *dst = _bgbak_ptr;
+        int bits, i;
+        uint buffer, mask = 128;
+        unsigned char inc = 1, color = *src++;
+  
+        _currentX = 8;
+        do {
+                _tempNumLines = _numLinesToProcess;
+                do {
+                        *dst = color;
+                        dst+=320;
+                        for (i=0; i<3; i++) {READ_256BIT if (!bits) break;}
+                        switch (i) {
+                                case 1:
+                                        inc=-inc;
+                                        color-=inc;
+                                break;
+ 
+                                case 2:
+                                        color-=inc;
+                                break;
+ 
+                                case 3:
+                                        color = 0;
+                                        inc = 1;
+                                        for (i=0; i<8; i++) {
+                                                READ_256BIT
+                                                color+= bits<<i;
+                                        }
+                                break;
+                        }
+                } while (--_tempNumLines);
+                dst -= _vertStripNextInc;
+        } while (--_currentX); 
+ }
+ 
+ 
+ #undef NEXT_ROW
+ #undef READ_256BIT
  #undef READ_BIT
  #undef FILL_BITS
***************
*** 1894,1898 ****
  byte Scumm::isMaskActiveAt(int l, int t, int r, int b, byte *mem) {
  	int w,h,i;
! 	
  	l>>=3;
  	if (l<0) l = 0;
--- 2076,2083 ----
  byte Scumm::isMaskActiveAt(int l, int t, int r, int b, byte *mem) {
  	int w,h,i;
! 
!         if(_features & GF_SMALL_HEADER) /* FIXME */
!                 return false;
! 
  	l>>=3;
  	if (l<0) l = 0;

Index: object.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/object.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** object.cpp	29 Dec 2001 13:19:53 -0000	1.21
--- object.cpp	12 Feb 2002 18:20:37 -0000	1.22
***************
*** 402,407 ****
  }
  
  void Scumm::setupRoomObject(ObjectData *od, byte *room) {
! 	byte *obcd;
  	CodeHeader *cdhd;
  	ImageHeader *imhd;
--- 402,474 ----
  }
  
+ void Scumm::loadRoomObjectsSmall() {
+        int i,j;
+        ObjectData *od;
+        byte *ptr;
+        uint16 obim_id;
+        byte *room,*searchptr;
+        ImageHeader *imhd;
+        RoomHeader *roomhdr;
+ 
+        CodeHeader *cdhd;
+ 
+        CHECK_HEAP
+  
+        room = getResourceAddress(rtRoom, _roomResource);
+        roomhdr = (RoomHeader*)findResourceData(MKID('RMHD'), room);
+ 
+        _numObjectsInRoom = READ_LE_UINT16(&roomhdr->numObjects);
+ 
+        if (_numObjectsInRoom == 0)
+                return;
+  
+        if (_numObjectsInRoom > _numLocalObjects)
+                error("More than %d objects in room %d", _numLocalObjects, _roomResource);
+ 
+        od = &_objs[1];
+        searchptr = room;
+        for (i=0; i<_numObjectsInRoom; i++,od++) {
+                ptr = findResourceSmall(MKID('OBCD'), searchptr);
+                if (ptr==NULL)
+                        error("Room %d missing object code block(s)", _roomResource);
+ 
+                od->offs_obcd_to_room = ptr - room;
+                od->obj_nr = READ_LE_UINT16(ptr+6);
+ 
+ #ifdef DUMP_SCRIPTS
+                do {
+                        char buf[32];
+                        sprintf(buf,"roomobj-%d-",_roomResource);
+                        dumpResource(buf, od->obj_nr, ptr);
+                } while (0);
+ #endif
+                searchptr = NULL;
+        }
+ 
+        searchptr = room;
+        for (i=0; i<_numObjectsInRoom; i++) {
+                ptr = findResourceSmall(MKID('OBIM'), searchptr);
+                if (ptr==NULL)
+                        error("Room %d missing image blocks(s)", _roomResource);
+ 
+                obim_id = READ_LE_UINT16(ptr+6);
+ 
+                for(j=1; j<=_numObjectsInRoom; j++) {
+                        if (_objs[j].obj_nr==obim_id)
+                                _objs[j].offs_obim_to_room = ptr - room;
+                }
+                searchptr = NULL;
+        }
+ 
+        od = &_objs[1];
+        for (i=1; i<=_numObjectsInRoom; i++,od++) {
+                setupRoomObject(od, room);
+        }
+ 
+        CHECK_HEAP
+ }
+ 
  void Scumm::setupRoomObject(ObjectData *od, byte *room) {
!       byte *obcd;
  	CodeHeader *cdhd;
  	ImageHeader *imhd;

Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/resource.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** resource.cpp	27 Dec 2001 18:03:20 -0000	1.29
--- resource.cpp	12 Feb 2002 18:20:37 -0000	1.30
***************
*** 96,100 ****
  /* Delete the currently loaded room offsets */
  void Scumm::deleteRoomOffsets() {
! 	if (!_dynamicRoomOffsets)
  		return;
  	
--- 96,100 ----
  /* Delete the currently loaded room offsets */
  void Scumm::deleteRoomOffsets() {
!         if (!(_features & GF_SMALL_HEADER) && !_dynamicRoomOffsets)
  		return;
  	
***************
*** 285,288 ****
--- 285,409 ----
  }
  
+ void Scumm::readIndexFileSmall() {
+        uint16 blocktype;
+        uint32 itemsize;
+        int numblock = 0;
+        int num, i;
+ 
+        debug(9, "readIndexFile()");
+ 
+        openRoom(-1);
+        openRoom(0);
+ 
+        if (!(_features & GF_AFTER_V6)) {
+                while (!fileEof(_fileHandle)) {
+                        itemsize = fileReadDwordLE();
+                        blocktype = fileReadWordLE();
+                        if (fileReadFailed(_fileHandle))
+                                break;
+ 
+                        switch(blocktype) {
+                        case 0x4E52:
+                                fileReadWordLE();
+                                break;
+                        case 0x5230:
+                                _numRooms = fileReadWordLE();
+                                break;
+                        case 0x5330:
+                                _numScripts = fileReadWordLE();
+                                break;
+                        case 0x4E30:
+                                _numSounds = fileReadWordLE();
+                                break;
+                        case 0x4330:
+                                _numCostumes = fileReadWordLE();
+                                break;
+                        case 0x4F30:
+                                _numGlobalObjects = fileReadWordLE();
+                                break;
+                        }
+                        fileSeek(_fileHandle, itemsize-8,SEEK_CUR);
+                }
+                clearFileReadFailed(_fileHandle);
+                fileSeek(_fileHandle, 0, SEEK_SET);
+        }
+ 
+        /* I'm not sure for those values yet, they will have to be rechecked */
+ 
+        _numVariables = 800; /* 800 */
+        _numBitVariables = 4096; /* 2048 */
+        _numLocalObjects = 200; /* 200 */
+        _numArray = 50;
+        _numVerbs = 100;
+        _numNewNames = 0;
+        _objectRoomTable = NULL;
+        _numCharsets = 9; /* 9 */
+        _numInventory = 80; /* 80 */
+        _numGlobalScripts = 200;
+ 
+        _shadowPaletteSize = 256;
+        _shadowPalette = (byte*)alloc(_shadowPaletteSize); // stupid for now. Need to be removed later
+        _numFlObject = 50;
+ 
+        allocateArrays();
+ 
+        while (1) {
+                itemsize = fileReadDwordLE();
+ 
+                if (fileReadFailed(_fileHandle))
+                        break;
+ 
+                blocktype = fileReadWordLE();
+ 
+                numblock++;
+ 
+                switch(blocktype) {
+ 
+                case 0x4E52:
+                        fileSeek(_fileHandle, itemsize-6,SEEK_CUR);
+                        break;
+ 
+                case 0x5230:
+                        readResTypeList(rtRoom,MKID('ROOM'),"room");
+                        break;
+ 
+                case 0x5330:
+                        readResTypeList(rtScript,MKID('SCRP'),"script");
+                        break;
+ 
+                case 0x4E30:
+                        readResTypeList(rtSound,MKID('SOUN'),"sound");
+                        break;
+ 
+                case 0x4330:
+                        readResTypeList(rtCostume,MKID('COST'),"costume");
+                        break;
+ 
+                case 0x4F30:
+                        num = fileReadWordLE();
+                        assert(num == _numGlobalObjects);
+                        for (i=0; i<num; i++) { /* not too sure about all that */
+                                _classData[i] = fileReadWordLE(); //+ fileReadByte();
+                                fileReadByte();
+                                _objectOwnerTable[i] = fileReadByte();
+                                _objectStateTable[i] = _objectOwnerTable[i]>>OF_STATE_SHL;
+                                _objectOwnerTable[i] &= OF_OWNER_MASK;
+                        }
+                
+ #if defined(SCUMM_BIG_ENDIAN)
+                        for (i=0; i<num; i++) {
+                                _classData[i] = FROM_LE_32(_classData[i]);
+                        }
+ #endif
+                        break;
+ 
+                default:
+                        error("Bad ID %c%c found in directory!", blocktype&0xFF, blocktype>>8);
+                        return;
+                }
+        }
+ 
+        openRoom(-1);
+ }
  
  void Scumm::readArrayFromIndexFile() {
***************
*** 475,479 ****
  		fileRead(_fileHandle,createResource(type, index, total_size+8), total_size+8);
  		return 1;
! 	}
  #else
  	best_pri = -1;
--- 596,600 ----
  		fileRead(_fileHandle,createResource(type, index, total_size+8), total_size+8);
  		return 1;
!         }
  #else
  	best_pri = -1;
***************
*** 659,662 ****
--- 780,814 ----
  }
  
+ byte *findResourceSmall(uint32 tag, byte *searchin) {
+        uint32 size;
+        static FindResourceState frs;
+        FindResourceState *f = &frs; /* easier to make it thread safe like this */
+        uint16 smallTag;
+ 
+        smallTag=newTag2Old(tag);
+ 
+        if (searchin) {
+                f->size = READ_LE_UINT32(searchin);
+                f->pos = 6;
+                f->ptr = searchin+6;
+                goto StartScan;
+        }
+ 
+        do {
+                size = READ_LE_UINT32(f->ptr);
+                if ((int32)size <= 0)
+                        return NULL;
+ 
+                f->pos += size;
+                f->ptr += size;
+         
+ StartScan:
+                if (f->pos >= f->size)
+                       return NULL;
+        } while (READ_LE_UINT16(f->ptr+4) != smallTag);
+ 
+        return f->ptr;
+ }
+ 
  byte *findResource(uint32 tag, byte *searchin, int index) {
  	uint32 maxsize,curpos,totalsize,size;
***************
*** 953,954 ****
--- 1105,1147 ----
  	allocResTypeData(rtMatrix, MKID('NONE'),10,"boxes", 0);
  }
+ 
+ uint16 newTag2Old(uint32 oldTag) {
+        switch(oldTag) {
+                case(MKID('RMHD')):
+                        return(0x4448);
+                        break;
+                case(MKID('IM00')):
+                        return(0x4D42);
+                        break;
+                case(MKID('EXCD')):
+                        return(0x5845);
+                        break;
+                case(MKID('ENCD')):
+                        return(0x4E45);
+                        break;
+                case(MKID('SCAL')):
+                        return(0x4153);
+                        break;
+                case(MKID('LSCR')):
+                        return(0x534C);
+                        break;
+                case(MKID('OBCD')):
+                        return(0x434F);
+                        break;
+                case(MKID('OBIM')):
+                        return(0x494F);
+                        break;
+                case(MKID('SMAP')):
+                        return(0x4D42);
+                        break;
+                case(MKID('CLUT')):
+                        return(0x4150);
+                        break;
+                case(MKID('BOXD')):
+                        return(0x5842);
+                        break;
+                default:
+                        return(0);
+       }
+ }
+ 		

Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/script.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** script.cpp	2 Feb 2002 19:07:10 -0000	1.19
--- script.cpp	12 Feb 2002 18:20:37 -0000	1.20
***************
*** 38,42 ****
  	if (script < _numGlobalScripts) {
  		scriptPtr = getResourceAddress(rtScript, script);
! 		scriptOffs = 8;
  		scriptType = WIO_GLOBAL;
  	} else {
--- 38,45 ----
  	if (script < _numGlobalScripts) {
  		scriptPtr = getResourceAddress(rtScript, script);
!                 if(_features & GF_SMALL_HEADER)
!                         scriptOffs = 6;
!                 else
!                         scriptOffs = 8;
  		scriptType = WIO_GLOBAL;
  	} else {
***************
*** 663,667 ****
  
  	offs = getVerbEntrypoint(object, entry);
! 	if (offs==0)
  		return;
  
--- 666,670 ----
  
  	offs = getVerbEntrypoint(object, entry);
!         if (offs==0)
  		return;
  
***************
*** 701,705 ****
  	assert(objptr);
  
! 	verbptr = findResource(MKID('VERB'), objptr);
  	if (verbptr==NULL)
  		error("No verb block in object %d", obj);
--- 704,712 ----
  	assert(objptr);
  
!         if(_features & GF_SMALL_HEADER)
!                 verbptr = objptr+19;
!         else
!                 verbptr = findResource(MKID('VERB'), objptr);
! 
  	if (verbptr==NULL)
  		error("No verb block in object %d", obj);
***************
*** 707,711 ****
  	verboffs = verbptr - objptr;
  
! 	verbptr += _resourceHeaderSize;
  	do {
  		if (!*verbptr)
--- 714,720 ----
  	verboffs = verbptr - objptr;
  
!         if(!(_features & GF_SMALL_HEADER))
!                 verbptr += _resourceHeaderSize;
! 
  	do {
  		if (!*verbptr)
***************
*** 716,720 ****
  	} while (1);
  
! 	return verboffs + READ_LE_UINT16(verbptr+1);
  }
  
--- 725,732 ----
  	} while (1);
  
!         if(_features & GF_SMALL_HEADER)
!                 return READ_LE_UINT16(verbptr+1);
!         else
!                 return verboffs + READ_LE_UINT16(verbptr+1);
  }
  

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm.h,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -d -r1.41 -r1.42
*** scumm.h	3 Feb 2002 20:41:23 -0000	1.41
--- scumm.h	12 Feb 2002 18:20:37 -0000	1.42
***************
*** 854,857 ****
--- 854,861 ----
  	void unkDecode6();
  	void unkDecode7();
+         void unkDecode8();
+         void unkDecode9();
+         void unkDecode10();
+         void unkDecode11();
  
  	void decompressBitmap();
***************
*** 898,901 ****
--- 902,910 ----
  	GID_MONKEY = 4,
  	GID_SAMNMAX = 5,
+ 	GID_MONKEY_EGA = 6,
+ 	GID_LOOM256 = 7,
+ 	GID_ZAK256 = 8,
+ 	GID_INDY3_256 = 9,
+ 	GID_LOOM = 10,
  };
  
***************
*** 911,914 ****
--- 920,929 ----
  
  	GF_DEFAULT = GF_USE_KEY,
+ 
+ 	GF_SMALL_HEADER = 32,
+         GF_SMALL_NAMES = 64,
+         GF_OLD_BUNDLE = 128,
+ 	GF_16COLOR = 256,
+ 	GF_OLD256 = 512,
  };
  
***************
*** 1689,1692 ****
--- 1704,1708 ----
  	void initRoomSubBlocks();
  	void loadRoomObjects();
+         void loadRoomObjectsSmall();
  
  	void setPaletteFromRes();
***************
*** 1898,1902 ****
  	void readArrayFromIndexFile();
  	void readMAXS();
! 	void readIndexFile();
  
  	int readArray(int array, int index, int base);
--- 1914,1919 ----
  	void readArrayFromIndexFile();
  	void readMAXS();
!         void readIndexFile();
!         void readIndexFileSmall();
  
  	int readArray(int array, int index, int base);
***************
*** 2228,2233 ****
--- 2245,2252 ----
  byte *findResource(uint32 tag, byte *searchin, int index);
  byte *findResource(uint32 tag, byte *searchin);
+ byte *findResourceSmall(uint32 tag, byte *searchin);
  void playSfxSound(void *sound, uint32 size, uint rate);
  bool isSfxFinished();
  void waitForTimer(Scumm *s, int msec_delay);
  void setShakePos(Scumm *s, int shake_pos);
+ uint16 newTag2Old(uint32 oldTag);

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scummvm.cpp,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -d -r1.33 -r1.34
*** scummvm.cpp	3 Feb 2002 21:46:26 -0000	1.33
--- scummvm.cpp	12 Feb 2002 18:20:37 -0000	1.34
***************
*** 47,53 ****
  	debug(9, "scummInit");
  
! 	_resourceHeaderSize = 8;
  
- 	loadCharset(1);
  	initScreens(0, 16, 320, 144);
  
--- 47,58 ----
  	debug(9, "scummInit");
  
!         if(_features & GF_SMALL_HEADER)
!                 _resourceHeaderSize = 6;
!         else
!                 _resourceHeaderSize = 8;
! 
!         if(!(_features & GF_SMALL_NAMES))
!                 loadCharset(1);
  
  	initScreens(0, 16, 320, 144);
  
***************
*** 168,172 ****
  void Scumm::checkRange(int max, int min, int no, const char *str) {
  	if (no < min || no > max) {
! 		error("Value %d is out of bounds (%d,%d) msg %s", no, min,max, str);
  	}
  }
--- 173,177 ----
  void Scumm::checkRange(int max, int min, int no, const char *str) {
  	if (no < min || no > max) {
!                 error("Value %d is out of bounds (%d,%d) int script(%d) msg %s", no, min,max, vm.slot[_curExecScript].number, str);
  	}
  }
***************
*** 206,211 ****
  	initGraphics(this, _fullScreen);
  
! 	readIndexFile();
! 	
  	initRandSeeds();
  
--- 211,219 ----
  	initGraphics(this, _fullScreen);
  
!     if (_features & GF_SMALL_HEADER)
!         readIndexFileSmall();
!     else
!         readIndexFile();
! 
  	initRandSeeds();
  
***************
*** 413,435 ****
  };
  
  static const VersionSettings version_settings[] = {
! 	{"monkey", "Monkey Island 1", GID_MONKEY, 5, 2, 2, 
! 		GF_USE_KEY},
! 	{"monkey2", "Monkey Island 2: LeChuck's revenge", GID_MONKEY2, 5, 2, 2, 
! 		GF_USE_KEY},
! 	{"atlantis", "Indiana Jones 4 and the Fate of Atlantis", GID_INDY4, 5, 5, 0,
! 		GF_USE_KEY},
! 	{"playfate", "Indiana Jones 4 and the Fate of Atlantis (Demo)", GID_INDY4, 5, 5, 0,
! 		GF_USE_KEY},
! 	{"tentacle", "Day Of The Tentacle", GID_TENTACLE, 6, 4, 2, 
! 		GF_NEW_OPCODES|GF_AFTER_V6|GF_USE_KEY},
! 	{"dottdemo", "Day Of The Tentacle (Demo)", GID_TENTACLE, 6, 3, 2,
! 		GF_NEW_OPCODES|GF_AFTER_V6|GF_USE_KEY},
! 	{"samnmax", "Sam & Max", GID_SAMNMAX, 6, 4, 2, 
! 		GF_NEW_OPCODES|GF_AFTER_V6|GF_USE_KEY|GF_DRAWOBJ_OTHER_ORDER},
! 	{"snmdemo", "Sam & Max (Demo)", GID_SAMNMAX, 6, 3, 0, 
! 		GF_NEW_OPCODES|GF_AFTER_V6|GF_USE_KEY},
! 	{"ft", "Full Throttle", GID_SAMNMAX, 7, 3, 0, 
! 		GF_NEW_OPCODES|GF_AFTER_V6|GF_AFTER_V7},
  	{NULL,NULL}
  };
--- 421,464 ----
  };
  
+ /*
+         This is a list of all known SCUMM games. Commented games are not
+         supported at this time */
+ 
  static const VersionSettings version_settings[] = {
!         /* Scumm Version 1 */
! //      {"maniac",      "Maniac Mansion (C64)",                         GID_MANIAC64, 1, 0, 0,},
! //      {"zak",         "Zak McKracken and the Alien Mindbenders (C64)", GID_ZAK64, 1, 0, 0,},
! 
!         /* Scumm Version 2 */
! //      {"maniac",      "Maniac Mansion", GID_MANIAC, 2, 0, 0,},
! //      {"zak",         "Zak McKracken and the Alien Mindbenders",      GID_ZAK,     2, 0, 0,},
! //      {"indy3",       "Indiana Jones and the Last Crusade",           GID_INDY3,   2, 0, 0,},
! 
!         /* Scumm Version 3 */
!         {"indy3",       "Indiana Jones and the Last Crusade (256)",     GID_INDY3_256,  3, 0, 22, GF_SMALL_HEADER|GF_USE_KEY|GF_SMALL_NAMES|GF_OLD256},
!         {"zak256",      "Zak McKracken and the Alien Mindbenders (256)",GID_ZAK256,     3, 0, 0,  GF_SMALL_HEADER|GF_USE_KEY|GF_SMALL_NAMES|GF_OLD256},
!         {"loom",        "Loom",                                         GID_LOOM,       3, 5, 40, GF_SMALL_HEADER|GF_USE_KEY|GF_SMALL_NAMES|GF_OLD_BUNDLE|GF_16COLOR},
! 
!         /* Scumm Version 4 */
!         {"monkeyEGA",   "Monkey Island 1 (EGA)",                        GID_MONKEY_EGA, 4, 0, 67, GF_SMALL_HEADER|GF_USE_KEY|GF_16COLOR}, // EGA version
! 
!         /* Scumm version 5 */
!         {"loomcd",      "Loom (256 color CD version)",                  GID_LOOM256,    5, 1, 42, GF_SMALL_HEADER|GF_USE_KEY},
!         {"monkey",      "Monkey Island 1",                              GID_MONKEY,     5, 2, 2,  GF_USE_KEY},
!         {"monkey2",     "Monkey Island 2: LeChuck's revenge",           GID_MONKEY2,    5, 2, 2,  GF_USE_KEY},
!         {"atlantis",    "Indiana Jones 4 and the Fate of Atlantis",     GID_INDY4,      5, 5, 0,  GF_USE_KEY},
!         {"playfate",    "Indiana Jones 4 and the Fate of Atlantis (Demo)", GID_INDY4,   5, 5, 0,  GF_USE_KEY},
! 
!         /* Scumm Version 6 */
!         {"tentacle",    "Day Of The Tentacle",                          GID_TENTACLE, 6, 4, 2, GF_NEW_OPCODES|GF_AFTER_V6|GF_USE_KEY},
!         {"dottdemo",    "Day Of The Tentacle (Demo)",                   GID_TENTACLE, 6, 3, 2, GF_NEW_OPCODES|GF_AFTER_V6|GF_USE_KEY},
!         {"samnmax",     "Sam & Max",                                    GID_SAMNMAX,  6, 4, 2, GF_NEW_OPCODES|GF_AFTER_V6|GF_USE_KEY|GF_DRAWOBJ_OTHER_ORDER},
!         {"snmdemo",     "Sam & Max (Demo)",                             GID_SAMNMAX,  6, 3, 0, GF_NEW_OPCODES|GF_AFTER_V6|GF_USE_KEY},
! 
!         /* Scumm Version 7 */
!         {"ft",          "Full Throttle",                                GID_SAMNMAX,  7, 3, 0, GF_NEW_OPCODES|GF_AFTER_V6|GF_AFTER_V7},
! 
!         /* Scumm Version 8 */
! //      {"curse",       "The Curse of Monkey Island",                   GID_CMI,      8, 1, 0,},
  	{NULL,NULL}
  };
***************
*** 539,543 ****
  
  	initRoomSubBlocks();
! 	loadRoomObjects();
  
  #if !defined(FULL_THROTTLE)
--- 568,575 ----
  
  	initRoomSubBlocks();
!         if(_features & GF_SMALL_HEADER)
!                 loadRoomObjectsSmall();
!         else
!                 loadRoomObjects();
  
  #if !defined(FULL_THROTTLE)
***************
*** 624,629 ****
  	_scrHeight = READ_LE_UINT16(&rmhd->height);
  
! 	_IM00_offs = findResource(MKID('IM00'), findResource(MKID('RMIM'), roomptr))
! 		- roomptr;
  	
  	ptr = findResourceData(MKID('EXCD'), roomptr);
--- 656,663 ----
  	_scrHeight = READ_LE_UINT16(&rmhd->height);
  
!         if( _features & GF_SMALL_HEADER)
!                _IM00_offs = findResourceData(MKID('IM00'), roomptr) - roomptr;
!         else
!                _IM00_offs = findResource(MKID('IM00'), findResource(MKID('RMIM'), roomptr)) - roomptr;
  	
  	ptr = findResourceData(MKID('EXCD'), roomptr);
***************
*** 718,723 ****
  		}
  	}
! 	
! 	initCycl(findResourceData(MKID('CYCL'), roomptr));
  
  	ptr = findResourceData(MKID('TRNS'), roomptr);
--- 752,763 ----
  		}
  	}
! 
!         if( _features & GF_SMALL_HEADER)
!                 ptr = findResourceData(MKID('CYCL'), roomptr);
!         else
!                 ptr = findResourceData(MKID('CYCL'), roomptr);
! 
!         if (ptr)
!                 initCycl(findResourceData(MKID('CYCL'), roomptr));
  
  	ptr = findResourceData(MKID('TRNS'), roomptr);
***************
*** 757,761 ****
  	FILE *out;
  	
! 	uint32 size = READ_BE_UINT32_UNALIGNED(ptr+4);
  
  	sprintf(buf, "dumps\\%s%d.dmp", tag,index);
--- 797,805 ----
  	FILE *out;
  	
!         uint32 size;
!         if( _features & GF_SMALL_HEADER )
!                 size = READ_LE_UINT32(ptr);
!         else
!                 size = READ_BE_UINT32_UNALIGNED(ptr+4);
  
  	sprintf(buf, "dumps\\%s%d.dmp", tag,index);
***************
*** 895,899 ****
  Actor *Scumm::derefActorSafe(int id, const char *errmsg) {
  	if (id<1 || id>=NUM_ACTORS)
! 		error("Invalid actor %d in %s", id, errmsg);
  	return derefActor(id);
  }
--- 939,943 ----
  Actor *Scumm::derefActorSafe(int id, const char *errmsg) {
  	if (id<1 || id>=NUM_ACTORS)
!                 error("Invalid actor %d in %s (script %d)", id, errmsg, vm.slot[_curExecScript].number);
  	return derefActor(id);
  }





More information about the Scummvm-git-logs mailing list