[Scummvm-cvs-logs] CVS: scummvm boxes.cpp,1.7,1.8 object.cpp,1.22,1.23 resource.cpp,1.30,1.31 script_v1.cpp,1.17,1.18 scumm.h,1.42,1.43 scummvm.cpp,1.34,1.35 sdl.cpp,1.30,1.31 sound.cpp,1.14,1.15 string.cpp,1.13,1.14 verbs.cpp,1.12,1.13
James Brown
ender at users.sourceforge.net
Tue Feb 12 13:29:01 CET 2002
Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv26851
Modified Files:
boxes.cpp object.cpp resource.cpp script_v1.cpp scumm.h
scummvm.cpp sdl.cpp sound.cpp string.cpp verbs.cpp
Log Message:
Further LFL additions. Zak256 plays bits of its intro, and LoomCD partially runs (may need
to hit escape a few times, after selecting your difficulty).
Still very incomplete and in progress.
Index: boxes.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/boxes.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** boxes.cpp 12 Feb 2002 18:20:37 -0000 1.7
--- boxes.cpp 12 Feb 2002 21:28:06 -0000 1.8
***************
*** 44,56 ****
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);
}
--- 44,53 ----
Box *Scumm::getBoxBaseAddr(int box) {
! byte *ptr = getResourceAddress(rtMatrix, 2);
checkRange(ptr[0]-1, 0, box, "Illegal box %d");
! if(_features & GF_SMALL_HEADER)
! return (Box*)(ptr + box*SIZEOF_BOX + 1);
! else
! return (Box*)(ptr + box*SIZEOF_BOX + 2);
}
Index: object.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/object.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** object.cpp 12 Feb 2002 18:20:37 -0000 1.22
--- object.cpp 12 Feb 2002 21:28:07 -0000 1.23
***************
*** 135,159 ****
int x,y;
AdjustBoxResult abr;
! if (_features&GF_AFTER_V6) {
! state = getState(object)-1;
! if (state<0)
! state = 0;
!
! if (od->fl_object_index) {
! ptr = getResourceAddress(rtFlObject, od->fl_object_index);
! ptr = findResource(MKID('OBIM'), ptr);
! } else {
! ptr = getResourceAddress(rtRoom, _roomResource);
! ptr += od->offs_obim_to_room;
! }
! assert(ptr);
! imhd = (ImageHeader*)findResourceData(MKID('IMHD'), ptr);
! x = od->x_pos + (int16)READ_LE_UINT16(&imhd->hotspot[state].x);
! y = od->y_pos + (int16)READ_LE_UINT16(&imhd->hotspot[state].y);
! } else {
! x = (int16)READ_LE_UINT16(&od->walk_x);
! y = (int16)READ_LE_UINT16(&od->walk_y);
! }
// abr = adjustXYToBeInBox(0, x, y);
--- 135,165 ----
int x,y;
AdjustBoxResult abr;
+ if(!(_features & GF_SMALL_HEADER)) {
+ if (_features&GF_AFTER_V6) {
+ state = getState(object)-1;
+ if (state<0)
+ state = 0;
! if (od->fl_object_index) {
! ptr = getResourceAddress(rtFlObject, od->fl_object_index);
! ptr = findResource(MKID('OBIM'), ptr);
! } else {
! ptr = getResourceAddress(rtRoom, _roomResource);
! ptr += od->offs_obim_to_room;
! }
! assert(ptr);
! imhd = (ImageHeader*)findResourceData(MKID('IMHD'), ptr);
! x = od->x_pos + (int16)READ_LE_UINT16(&imhd->hotspot[state].x);
! y = od->y_pos + (int16)READ_LE_UINT16(&imhd->hotspot[state].y);
! } else {
! x = (int16)READ_LE_UINT16(&od->walk_x);
! y = (int16)READ_LE_UINT16(&od->walk_y);
! }
! } else {
! x = (int16)READ_LE_UINT16(&od->x_pos);
! y = (int16)READ_LE_UINT16(&od->y_pos);
! _xPos = x;
! _yPos = y;
! }
// abr = adjustXYToBeInBox(0, x, y);
***************
*** 305,309 ****
}
! ptr = findResource(IMxx_tags[getState(od->obj_nr)], ptr);
if (!ptr)
return;
--- 311,318 ----
}
! if(_features & GF_SMALL_HEADER)
! ptr +=8;
! else
! ptr = findResource(IMxx_tags[getState(od->obj_nr)], ptr);
if (!ptr)
return;
***************
*** 474,479 ****
ImageHeader *imhd;
! cdhd = (CodeHeader*)findResourceData(MKID('CDHD'), room + od->offs_obcd_to_room);
od->obj_nr = READ_LE_UINT16(&cdhd->obj_id);
--- 483,504 ----
ImageHeader *imhd;
! if(_features & GF_SMALL_HEADER) {
! byte *ptr = room + od->offs_obcd_to_room;
! od->obj_nr = READ_LE_UINT16(ptr+6);
! od->width = *(ptr+11)<<3;
! od->height = *(ptr+17);
! od->x_pos = *(ptr+9)<<3;
! od->y_pos = *(ptr+10)<<3;
!
! if(*(ptr+10) == 0x80) {
! od->parentstate = 1; // it's 0x10 in the original code
! } else {
! od->parentstate = 0;
! }
+ return;
+ }
+
+ cdhd = (CodeHeader*)findResourceData(MKID('CDHD'), room + od->offs_obcd_to_room);
od->obj_nr = READ_LE_UINT16(&cdhd->obj_id);
***************
*** 615,618 ****
--- 640,651 ----
return getActorName(derefActorSafe(obj, "getObjOrActorName"));
+ if(_features & GF_SMALL_HEADER) {
+ byte offset;
+
+ objptr = getOBCDFromObject(obj);
+ offset = *(objptr+18);
+ return(objptr+offset);
+ }
+
objptr = getOBCDFromObject(obj);
if (objptr==NULL)
***************
*** 678,682 ****
} else {
findObjectInRoom(&foir, foCodeHeader, obj, room);
! size = READ_BE_UINT32_UNALIGNED(foir.obcd+4);
slot = getInventorySlot();
_inventory[slot] = obj;
--- 711,718 ----
} else {
findObjectInRoom(&foir, foCodeHeader, obj, room);
! if(_features & GF_SMALL_HEADER )
! size = READ_LE_UINT32(foir.obcd);
! else
! size = READ_BE_UINT32_UNALIGNED(foir.obcd+4);
slot = getInventorySlot();
_inventory[slot] = obj;
***************
*** 716,728 ****
searchptr = roomptr;
for (i=0;;) {
! obcdptr = findResource(MKID('OBCD'), searchptr);
if(obcdptr==NULL)
error("findObjectInRoom: Not enough code blocks in room %d", room);
! cdhd = (CodeHeader*)findResourceData(MKID('CDHD'), obcdptr);
! if ( READ_LE_UINT16(&cdhd->obj_id) == (uint16)id) {
! fo->cdhd = cdhd;
! fo->obcd = obcdptr;
! break;
! }
if (++i == numobj)
error("findObjectInRoom: Object %d not found in room %d", id, room);
--- 752,775 ----
searchptr = roomptr;
for (i=0;;) {
! if(_features & GF_SMALL_HEADER)
! obcdptr = findResourceSmall(MKID('OBCD'), searchptr);
! else
! obcdptr = findResource(MKID('OBCD'), searchptr);
if(obcdptr==NULL)
error("findObjectInRoom: Not enough code blocks in room %d", room);
! if ( _features & GF_SMALL_HEADER) {
! if ( READ_LE_UINT16(obcdptr+6) == (uint16)id) {
! fo->cdhd = NULL;
! fo->obcd = obcdptr;
! break;
! }
! } else {
! cdhd = (CodeHeader*)findResourceData(MKID('CDHD'), obcdptr);
! if ( READ_LE_UINT16(&cdhd->obj_id) == (uint16)id) {
! fo->cdhd = cdhd;
! fo->obcd = obcdptr;
! break;
! }
! }
if (++i == numobj)
error("findObjectInRoom: Object %d not found in room %d", id, room);
***************
*** 734,747 ****
searchptr = roomptr;
for(i=0;;) {
! obimptr = findResource(MKID('OBIM'), searchptr);
if (obimptr==NULL)
error("findObjectInRoom: Not enough image blocks in room %d", room);
imhd = (ImageHeader*)findResourceData(MKID('IMHD'), obimptr);
! if (READ_LE_UINT16(&imhd->obj_id) == (uint16)id) {
! fo->obim = obimptr;
! fo->imhd = imhd;
! break;
! }
!
if (++i==numobj)
error("findObjectInRoom: Object %d image not found in room %d", id, room);
--- 781,804 ----
searchptr = roomptr;
for(i=0;;) {
! if(_features & GF_SMALL_HEADER)
! obimptr = findResourceSmall(MKID('OBIM'), searchptr);
! else
! obimptr = findResource(MKID('OBIM'), searchptr);
if (obimptr==NULL)
error("findObjectInRoom: Not enough image blocks in room %d", room);
imhd = (ImageHeader*)findResourceData(MKID('IMHD'), obimptr);
! if(_features & GF_SMALL_HEADER){
! if (READ_LE_UINT16(obimptr+6) == (uint16)id) {
! fo->obim = obimptr;
! fo->imhd = imhd;
! break;
! }
! } else {
! if (READ_LE_UINT16(&imhd->obj_id) == (uint16)id) {
! fo->obim = obimptr;
! fo->imhd = imhd;
! break;
! }
! }
if (++i==numobj)
error("findObjectInRoom: Object %d image not found in room %d", id, room);
Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/resource.cpp,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** resource.cpp 12 Feb 2002 18:20:37 -0000 1.30
--- resource.cpp 12 Feb 2002 21:28:07 -0000 1.31
***************
*** 49,53 ****
room_offs = _roomFileOffsets[room];
#else
! room_offs = room ? _roomFileOffsets[room] : 0;
#endif
--- 49,56 ----
room_offs = _roomFileOffsets[room];
#else
! if(_features & GF_EXTERNAL_CHARSET && room>=900)
! room_offs = 0;
! else
! room_offs = room ? _roomFileOffsets[room] : 0;
#endif
***************
*** 62,70 ****
sprintf(buf, "%s.la%d", _exe_name,
room==0 ? 0 : res.roomno[rtRoom][room]);
#else
! sprintf(buf, "%s.%.3d", _exe_name,
! room==0 ? 0 : res.roomno[rtRoom][room]);
#endif
! _encbyte = (_features & GF_USE_KEY) ? 0x69 : 0;
if (openResourceFile(buf)) {
if (room==0)
--- 65,96 ----
sprintf(buf, "%s.la%d", _exe_name,
room==0 ? 0 : res.roomno[rtRoom][room]);
+ _encbyte = (_features & GF_USE_KEY) ? 0x69 : 0;
#else
! if( !(_features & GF_SMALL_NAMES))
! {
! if(room==0 || room>=900) {
! sprintf(buf, "%s\\%.3d.lfl",_exe_name,room);
! _encbyte = 0;
! if (openResourceFile(buf)) {
! return;
! }
! askForDisk(buf);
!
! } else {
! sprintf(buf, "%s\\disk%.2d.lec",_exe_name,res.roomno[rtRoom][room]);
! _encbyte = 0x69;
! }
! } else {
! sprintf(buf, "%s\\%.2d.lfl",_exe_name,room);
! if(_features & GF_OLD_BUNDLE)
! _encbyte = 0xFF;
! else
! _encbyte = 0;
! }
!
! // sprintf(buf, "%s.%.3d", _exe_name, room==0 ? 0 : res.roomno[rtRoom][room]);
! // _encbyte = (_features & GF_USE_KEY) ? 0x69 : 0;
#endif
!
if (openResourceFile(buf)) {
if (room==0)
***************
*** 111,119 ****
debug(9, "readRoomOffsets()");
! deleteRoomOffsets();
! if (!_dynamicRoomOffsets)
! return;
! fileSeek(_fileHandle, 16, SEEK_SET);
num = fileReadByte();
--- 137,152 ----
debug(9, "readRoomOffsets()");
! deleteRoomOffsets();
! if(_features & GF_SMALL_NAMES)
! return;
! if (!(_features & GF_SMALL_HEADER)) {
! if (!_dynamicRoomOffsets)
! return;
!
! fileSeek(_fileHandle, 16, SEEK_SET);
! } else {
! fileSeek(_fileHandle, 12, SEEK_SET); // Directlry searching for the room offset block would be more generic...
! }
num = fileReadByte();
***************
*** 440,446 ****
allocResTypeData(id, tag, num, name, 1);
}
!
! fileRead(_fileHandle, res.roomno[id], num*sizeof(uint8));
! fileRead(_fileHandle, res.roomoffs[id], num*sizeof(uint32));
#if defined(SCUMM_BIG_ENDIAN)
--- 473,486 ----
allocResTypeData(id, tag, num, name, 1);
}
!
! if (_features & GF_SMALL_HEADER) {
! for (i=0; i<num; i++) {
! res.roomno[id][i] = fileReadByte();
! res.roomoffs[id][i]= fileReadDwordLE();
! }
! } else {
! fileRead(_fileHandle, res.roomno[id], num*sizeof(uint8));
! fileRead(_fileHandle, res.roomoffs[id], num*sizeof(uint32));
! }
#if defined(SCUMM_BIG_ENDIAN)
***************
*** 477,482 ****
debug(9, "loadCharset(%d)",no);
!
! checkRange(_maxCharsets-1, 1, no, "Loading illegal charset %d");
// ensureResourceLoaded(6, no);
ptr = getResourceAddress(6, no);
--- 517,534 ----
debug(9, "loadCharset(%d)",no);
! if(_features & GF_EXTERNAL_CHARSET) {
! uint32 size;
! checkRange(4 ,0 ,no , "Loading illegal charset %d");
! openRoom(-1);
! if( _features & GF_SMALL_NAMES)
! openRoom(98+no);
! else
! openRoom(900+no);
! size = fileReadDword();
! fileRead(_fileHandle, createResource(6, no, size), size);
! openRoom(-1);
! } else {
! checkRange(_maxCharsets-1, 1, no, "Loading illegal charset %d");
! }
// ensureResourceLoaded(6, no);
ptr = getResourceAddress(6, no);
***************
*** 523,526 ****
--- 575,583 ----
// debug(1, "loadResource(%d,%d)", type,index);
+ if(type == rtCharset && (_features & GF_SMALL_HEADER)){
+ loadCharset(index);
+ return(1);
+ }
+
roomNr = getResourceRoomNr(type, index);
if (roomNr == 0 || index >= res.num[type]) {
***************
*** 542,564 ****
fileSeek(_fileHandle, fileOffs + _fileOffset, SEEK_SET);
- if (type==rtSound) {
- fileReadDwordLE();
- fileReadDwordLE();
- return readSoundResource(type, index);
- }
-
- tag = fileReadDword();
! if (tag != res.tags[type]) {
! error("%s %d not in room %d at %d+%d",
! res.name[type], type, roomNr, _fileOffset, fileOffs);
! }
! size = fileReadDwordBE();
! fileSeek(_fileHandle, -8, SEEK_CUR);
fileRead(_fileHandle, createResource(type, index, size), size);
! /* dump the resource */
#ifdef DUMP_SCRIPTS
if(type==rtScript) {
--- 599,629 ----
fileSeek(_fileHandle, fileOffs + _fileOffset, SEEK_SET);
! if (_features & GF_SMALL_HEADER) {
! if(!(_features & GF_SMALL_NAMES))
! fileSeek(_fileHandle, 8, SEEK_CUR);
! size = fileReadDwordLE();
! tag = fileReadWordLE();
! fileSeek(_fileHandle, -6, SEEK_CUR);
! } else {
! if (type==rtSound) {
! fileReadDwordLE();
! fileReadDwordLE();
! return readSoundResource(type, index);
! }
!
! tag = fileReadDword();
! if (tag != res.tags[type]) {
! error("%s %d not in room %d at %d+%d",
! res.name[type], type, roomNr, _fileOffset, fileOffs);
! }
+ size = fileReadDwordBE();
+ fileSeek(_fileHandle, -8, SEEK_CUR);
+ }
fileRead(_fileHandle, createResource(type, index, size), size);
! /* dump the resource */
#ifdef DUMP_SCRIPTS
if(type==rtScript) {
***************
*** 734,737 ****
--- 799,809 ----
byte *Scumm::findResourceData(uint32 tag, byte *ptr) {
+ if(_features & GF_SMALL_HEADER) {
+ ptr = findResourceSmall(tag,ptr,0);
+ if (ptr==NULL)
+ return NULL;
+ return ptr + 6;
+ }
+
ptr = findResource(tag,ptr,0);
if (ptr==NULL)
***************
*** 743,747 ****
if (ptr==NULL)
return 0;
! return READ_BE_UINT32(ptr-4)-8;
}
--- 815,823 ----
if (ptr==NULL)
return 0;
!
! if (_features & GF_SMALL_HEADER)
! return READ_LE_UINT32(ptr)-6;
! else
! return READ_BE_UINT32(ptr-4)-8;
}
***************
*** 839,842 ****
--- 915,950 ----
return NULL;
+ }
+
+ byte *findResourceSmall(uint32 tag, byte *searchin, int index) {
+ uint32 maxsize,curpos,totalsize,size;
+ uint16 smallTag;
+
+ smallTag=newTag2Old(tag);
+
+ assert(searchin);
+
+ totalsize = READ_LE_UINT32(searchin);
+ searchin += 6;
+ curpos = 6;
+
+ while (curpos<totalsize) {
+ size = READ_LE_UINT32(searchin);
+
+ if (READ_LE_UINT16(searchin+4)==smallTag && !index--)
+ return searchin;
+
+ if ((int32)size <= 0) {
+ error("(%c%c%c%c) Not found in %d... illegal block len %d",
+ tag&0xFF,(tag>>8)&0xFF,(tag>>16)&0xFF,(tag>>24)&0xFF,
+ 0, size);
+ return NULL;
+ }
+
+ curpos += size;
+ searchin += size;
+ }
+
+ return NULL;
}
Index: script_v1.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/script_v1.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** script_v1.cpp 27 Dec 2001 17:51:58 -0000 1.17
--- script_v1.cpp 12 Feb 2002 21:28:07 -0000 1.18
***************
*** 142,146 ****
&Scumm::o5_divide,
/* 5C */
! &Scumm::o5_badOpcode,
&Scumm::o5_actorSetClass,
&Scumm::o5_walkActorTo,
--- 142,146 ----
&Scumm::o5_divide,
/* 5C */
! &Scumm::o5_oldRoomEffect,
&Scumm::o5_actorSetClass,
&Scumm::o5_walkActorTo,
***************
*** 364,367 ****
--- 364,368 ----
void Scumm::o5_actorSet() {
+ byte convertTable[20] = {1,0,0,2,0,4,5,6,7,8,9,10,11,12,13,14,15,16,17,20};
int act = getVarOrDirectByte(0x80);
Actor *a = derefActorSafe(act, "actorSet");
***************
*** 369,372 ****
--- 370,376 ----
while ( (_opcode = fetchScriptByte()) != 0xFF) {
+ if(_features & GF_SMALL_HEADER)
+ _opcode = (_opcode&0xE0) | convertTable[(_opcode&0x1F)-1];
+
switch(_opcode&0x1F) {
case 1: /* costume */
***************
*** 465,469 ****
break;
default:
! error("o5_actorSet: default case");
}
}
--- 469,473 ----
break;
default:
! warning("o5_actorSet: default case");
}
}
***************
*** 579,583 ****
i = getVarOrDirectByte(0x80);
j = getVarOrDirectByte(0x40);
! setCursorImg(i, j, 1);
break;
case 11: /* set cursor hotspot */
--- 583,588 ----
i = getVarOrDirectByte(0x80);
j = getVarOrDirectByte(0x40);
! if (!(_gameId==GID_LOOM256))
! setCursorImg(i, j, 1);
break;
case 11: /* set cursor hotspot */
***************
*** 699,702 ****
--- 704,739 ----
obj = getVarOrDirectWord(0x80);
+ if (_features & GF_SMALL_HEADER) {
+ int temp = getVarOrDirectWord(0x40);
+ int room = getVarOrDirectWord(0x20);
+
+ index = getObjectIndex(obj);
+ if(index==-1)
+ return;
+ od = &_objs[index];
+ xpos = ypos = 255;
+ if (temp!=0xFF) {
+ od->walk_x += (xpos<<3) - od->x_pos;
+ od->x_pos = xpos<<3;
+ od->walk_y += (ypos<<3) - od->y_pos;
+ od->y_pos = ypos<<3;
+ }
+ addObjectToDrawQue(index);
+
+ x = od->x_pos;
+ y = od->y_pos;
+ w = od->width;
+ h = od->height;
+
+ i = _numObjectsInRoom;
+ do {
+ if (_objs[i].x_pos == x && _objs[i].y_pos == y && _objs[i].width == w && _objs[i].height==h)
+ putState(_objs[i].obj_nr, 0);
+ } while (--i);
+
+ putState(obj, state);
+ return;
+ }
+
switch((_opcode = fetchScriptByte())&0x1F) {
case 1: /* draw at */
***************
*** 1319,1322 ****
--- 1356,1362 ----
loadFlObject(getVarOrDirectWord(0x40), res);
break;
+ default:
+ warning("Unknown o5_resourcesroutine: %d", _opcode&0x1F);
+ break;
}
}
***************
*** 1339,1343 ****
break;
case 2: /* room color */
! error("room-color is no longer a valid command");
break;
--- 1379,1391 ----
break;
case 2: /* room color */
! if(_features & GF_SMALL_HEADER) {
! a = getVarOrDirectWord(0x80);
! b = getVarOrDirectWord(0x40);
! checkRange(256, 0, a, "o5_roomOps: 2: Illegal room color slot (%d)");
! _currentPalette[a]=b;
! _fullRedraw = 1;
! } else {
! error("room-color is no longer a valid command");
! }
break;
***************
*** 1348,1358 ****
break;
case 4: /* set palette color */
! a = getVarOrDirectWord(0x80);
! b = getVarOrDirectWord(0x40);
! c = getVarOrDirectWord(0x20);
! _opcode = fetchScriptByte();
! d = getVarOrDirectByte(0x80);
! setPalColor(d, a, b, c); /* index, r, g, b */
! break;
case 5: /* shake on */
setShake(1);
--- 1396,1415 ----
break;
case 4: /* set palette color */
! if(_features & GF_SMALL_HEADER) {
! a = getVarOrDirectWord(0x80);
! b = getVarOrDirectWord(0x40);
! checkRange(256, 0, a, "o5_roomOps: 2: Illegal room color slot (%d)");
! _currentPalette[a]=b;
! _fullRedraw = 1;
! setDirtyColors(a,a);
! } else {
! a = getVarOrDirectWord(0x80);
! b = getVarOrDirectWord(0x40);
! c = getVarOrDirectWord(0x20);
! _opcode = fetchScriptByte();
! d = getVarOrDirectByte(0x80);
! setPalColor(d, a, b, c); /* index, r, g, b */
! }
! break;
case 5: /* shake on */
setShake(1);
***************
*** 1429,1432 ****
--- 1486,1490 ----
a = getVarOrDirectByte(0x80);
b = getVarOrDirectByte(0x40);
+ if (a < 1) a = 1; /* FIXME: ZAK256 */
checkRange(16, 1, a, "o5_roomOps: 16: color cycle out of range (%d)");
_colorCycle[a-1].delay = (b!=0) ? 0x4000 / (b*0x4C) : 0;
***************
*** 1651,1657 ****
b = getVarOrDirectByte(0x40);
ptr = getResourceAddress(rtString, a);
! if (ptr==NULL) error("String %d does not exist", a);
! c = getVarOrDirectByte(0x20);
! ptr[b] = c;
break;
--- 1709,1719 ----
b = getVarOrDirectByte(0x40);
ptr = getResourceAddress(rtString, a);
! if (!(_gameId == GID_LOOM256)) { /* FIXME - LOOM256 */
! if (ptr==NULL) error("String %d does not exist", a);
! c = getVarOrDirectByte(0x20);
! ptr[b] = c;
! } else
! getVarOrDirectByte(0x20);
!
break;
***************
*** 2001,2003 ****
--- 2063,2074 ----
}
+ void Scumm::o5_oldRoomEffect() {
+ int a;
+ _opcode=fetchScriptByte();
+ if((_opcode & 0x1F) == 3)
+ {
+ a = getVarOrDirectWord(0x80);
+ }
+ warning("Unsupported oldRoomEffect");
+ }
Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm.h,v
retrieving revision 1.42
retrieving revision 1.43
diff -C2 -d -r1.42 -r1.43
*** scumm.h 12 Feb 2002 18:20:37 -0000 1.42
--- scumm.h 12 Feb 2002 21:28:07 -0000 1.43
***************
*** 922,925 ****
--- 922,926 ----
GF_SMALL_HEADER = 32,
+ GF_EXTERNAL_CHARSET = GF_SMALL_HEADER,
GF_SMALL_NAMES = 64,
GF_OLD_BUNDLE = 128,
***************
*** 1501,1504 ****
--- 1502,1506 ----
void o5_walkActorToActor();
void o5_walkActorToObject();
+ void o5_oldRoomEffect();
void o6_pushByte();
***************
*** 2244,2247 ****
--- 2246,2250 ----
void blit(byte *dst, byte *src, int w, int h);
byte *findResource(uint32 tag, byte *searchin, int index);
+ byte *findResourceSmall(uint32 tag, byte *searchin, int index);
byte *findResource(uint32 tag, byte *searchin);
byte *findResourceSmall(uint32 tag, byte *searchin);
Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scummvm.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -d -r1.34 -r1.35
*** scummvm.cpp 12 Feb 2002 18:20:37 -0000 1.34
--- scummvm.cpp 12 Feb 2002 21:28:07 -0000 1.35
***************
*** 676,697 ****
#endif
}
!
! ptr = findResourceData(MKID('BOXD'), roomptr);
! if (ptr) {
! int size = getResourceDataSize(ptr);
! createResource(rtMatrix, 2, size);
! roomptr = getResourceAddress(rtRoom, _roomResource);
ptr = findResourceData(MKID('BOXD'), roomptr);
! memcpy(getResourceAddress(rtMatrix, 2), ptr, size);
! }
! ptr = findResourceData(MKID('BOXM'), roomptr);
! if (ptr) {
! int size = getResourceDataSize(ptr);
! createResource(rtMatrix, 1, size);
! roomptr = getResourceAddress(rtRoom, _roomResource);
! ptr = findResourceData(MKID('BOXM'), roomptr);
! memcpy(getResourceAddress(rtMatrix, 1), ptr, size);
! }
ptr = findResourceData(MKID('SCAL'), roomptr);
--- 676,711 ----
#endif
}
!
! if(_features & GF_SMALL_HEADER) {
ptr = findResourceData(MKID('BOXD'), roomptr);
! if (ptr) {
! byte numOfBoxes=*(ptr);
! int size = numOfBoxes * SIZEOF_BOX+1;
! createResource(rtMatrix, 2, size);
! memcpy(getResourceAddress(rtMatrix, 2), ptr, size);
! ptr += size;
! size = getResourceDataSize(ptr-size-6) - size;
! createResource(rtMatrix, 1, size);
! memcpy(getResourceAddress(rtMatrix, 1), ptr, size);
! }
! } else {
! ptr = findResourceData(MKID('BOXD'), roomptr);
! if (ptr) {
! int size = getResourceDataSize(ptr);
! createResource(rtMatrix, 2, size);
! roomptr = getResourceAddress(rtRoom, _roomResource);
! ptr = findResourceData(MKID('BOXD'), roomptr);
! memcpy(getResourceAddress(rtMatrix, 2), ptr, size);
! }
! ptr = findResourceData(MKID('BOXM'), roomptr);
! if (ptr) {
! int size = getResourceDataSize(ptr);
! createResource(rtMatrix, 1, size);
! roomptr = getResourceAddress(rtRoom, _roomResource);
! ptr = findResourceData(MKID('BOXM'), roomptr);
! memcpy(getResourceAddress(rtMatrix, 1), ptr, size);
! }
! }
ptr = findResourceData(MKID('SCAL'), roomptr);
***************
*** 712,743 ****
searchptr = roomptr = getResourceAddress(rtRoom, _roomResource);
! while( (ptr = findResource(MKID('LSCR'), searchptr)) != NULL ) {
! int id;
! ptr += _resourceHeaderSize; /* skip tag & size */
#ifdef FULL_THROTTLE
! id = READ_LE_UINT16(ptr);
! checkRange(2050, 2000, id, "Invalid local script %d");
! _localScriptList[id - _numGlobalScripts] = ptr + 2 - roomptr;
#else
! id = ptr[0];
! _localScriptList[id - _numGlobalScripts] = ptr + 1 - roomptr;
#endif
#ifdef DUMP_SCRIPTS
! do {
! char buf[32];
! sprintf(buf,"room-%d-",_roomResource);
! dumpResource(buf, id, ptr - 8);
! } while (0);
#endif
! searchptr = NULL;
! }
!
- ptr = findResource(MKID('EPAL'), roomptr);
if (ptr)
_EPAL_offs = ptr - roomptr;
!
! ptr = findResourceData(MKID('CLUT'), roomptr);
if (ptr) {
_CLUT_offs = ptr - roomptr;
--- 726,781 ----
searchptr = roomptr = getResourceAddress(rtRoom, _roomResource);
! if(_features & GF_SMALL_HEADER) {
! while( (ptr = findResourceSmall(MKID('LSCR'), searchptr)) != NULL ) {
! int id;
! ptr += _resourceHeaderSize; /* skip tag & size */
! #ifdef DUMP_SCRIPTS
! do {
! char buf[32];
! sprintf(buf,"room-%d-",_roomResource);
! dumpResource(buf, id, ptr - 6);
! } while (0);
! #endif
! id = ptr[0];
! _localScriptList[id - _numGlobalScripts] = ptr + 1 - roomptr;
! searchptr = NULL;
! }
! } else {
! while( (ptr = findResource(MKID('LSCR'), searchptr)) != NULL ) {
! int id;
! ptr += _resourceHeaderSize; /* skip tag & size */
#ifdef FULL_THROTTLE
! id = READ_LE_UINT16(ptr);
! checkRange(2050, 2000, id, "Invalid local script %d");
! _localScriptList[id - _numGlobalScripts] = ptr + 2 - roomptr;
#else
! id = ptr[0];
! _localScriptList[id - _numGlobalScripts] = ptr + 1 - roomptr;
#endif
#ifdef DUMP_SCRIPTS
! do {
! char buf[32];
! sprintf(buf,"room-%d-",_roomResource);
! dumpResource(buf, id, ptr - 8);
! } while (0);
#endif
! searchptr = NULL;
! }
! }
!
! if( _features & GF_SMALL_HEADER)
! ptr = findResourceSmall(MKID('EPAL'), roomptr);
! else
! ptr = findResource(MKID('EPAL'), roomptr);
if (ptr)
_EPAL_offs = ptr - roomptr;
!
! if( _features & GF_SMALL_HEADER)
! ptr = findResourceSmall(MKID('CLUT'), roomptr);
! else
! ptr = findResourceData(MKID('CLUT'), roomptr);
!
if (ptr) {
_CLUT_offs = ptr - roomptr;
Index: sdl.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sdl.cpp,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** sdl.cpp 29 Dec 2001 12:45:54 -0000 1.30
--- sdl.cpp 12 Feb 2002 21:28:07 -0000 1.31
***************
*** 544,550 ****
scumm._gui = &gui;
! scumm.scummMain(argc, argv);
! gui.init(&scumm);
last_time = SDL_GetTicks();
--- 544,551 ----
scumm._gui = &gui;
! scumm.scummMain(argc, argv);
! if (!(scumm._features & GF_SMALL_HEADER))
! gui.init(&scumm);
last_time = SDL_GetTicks();
Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** sound.cpp 2 Jan 2002 11:50:28 -0000 1.14
--- sound.cpp 12 Feb 2002 21:28:07 -0000 1.15
***************
*** 90,94 ****
void Scumm::playSound(int sound) {
! SoundEngine *se = (SoundEngine*)_soundEngine;
if (se) {
getResourceAddress(rtSound, sound);
--- 90,96 ----
void Scumm::playSound(int sound) {
! SoundEngine *se = (SoundEngine*)_soundEngine;
! if (_gameId == GID_ZAK256) return; /* FIXME */
!
if (se) {
getResourceAddress(rtSound, sound);
Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/string.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** string.cpp 27 Dec 2001 17:51:58 -0000 1.13
--- string.cpp 12 Feb 2002 21:28:07 -0000 1.14
***************
*** 30,33 ****
--- 30,35 ----
width = 1;
ptr = _vm->getResourceAddress(rtCharset, _curId) + 29;
+ if(_vm->_features & GF_SMALL_HEADER)
+ ptr-=12;
while ( (chr = text[pos++]) != 0) {
***************
*** 58,61 ****
--- 60,65 ----
pos+=2;
ptr = _vm->getResourceAddress(rtCharset, set) + 29;
+ if(_vm->_features & GF_SMALL_HEADER)
+ ptr-=12;
continue;
}
***************
*** 83,86 ****
--- 87,92 ----
ptr = _vm->getResourceAddress(rtCharset, _curId) + 29;
+ if(_vm->_features & GF_SMALL_HEADER)
+ ptr-=12;
while ( (chr=str[pos++]) != 0) {
***************
*** 115,118 ****
--- 121,126 ----
pos+=2;
ptr = _vm->getResourceAddress(rtCharset, set) + 29;
+ if(_vm->_features & GF_SMALL_HEADER)
+ ptr-=12;
continue;
}
***************
*** 236,241 ****
for (i=0; i<4; i++)
! charset._colorMap[i] = _charsetData[charset._curId][i];
!
if (_keepText) {
charset._strLeft = gdi._mask_left;
--- 244,252 ----
for (i=0; i<4; i++)
! if(_features & GF_SMALL_HEADER)
! charset._colorMap[i] = _charsetData[charset._curId][i-12];
! else
! charset._colorMap[i] = _charsetData[charset._curId][i];
!
if (_keepText) {
charset._strLeft = gdi._mask_left;
***************
*** 312,318 ****
if (!(_features&GF_AFTER_V6)) {
! if (!_vars[VAR_V5_CHARFLAG]) {
charset.printChar(c);
! }
} else {
charset.printChar(c);
--- 323,329 ----
if (!(_features&GF_AFTER_V6)) {
! // if (!_vars[VAR_V5_CHARFLAG]) { /* FIXME */
charset.printChar(c);
! // }
} else {
charset.printChar(c);
***************
*** 355,359 ****
buffer += 2;
for (i=0; i<4; i++)
! charset._colorMap[i] = _charsetData[charset._curId][i];
charset._ypos2 -= getResourceAddress(rtCharset,charset._curId)[30] - oldy;
} else if (c==12) {
--- 366,373 ----
buffer += 2;
for (i=0; i<4; i++)
! if(_features & GF_SMALL_HEADER)
! charset._colorMap[i] = _charsetData[charset._curId][i-12];
! else
! charset._colorMap[i] = _charsetData[charset._curId][i];
charset._ypos2 -= getResourceAddress(rtCharset,charset._curId)[30] - oldy;
} else if (c==12) {
***************
*** 403,409 ****
assert(charsetptr);
charsetptr += 29;
for(i=0; i<4; i++)
! charset._colorMap[i] = _charsetData[charset._curId][i];
byte1 = charsetptr[1];
--- 417,428 ----
assert(charsetptr);
charsetptr += 29;
+ if(_features & GF_SMALL_HEADER)
+ charsetptr-=12;
for(i=0; i<4; i++)
! if(_features & GF_SMALL_HEADER)
! charset._colorMap[i] = _charsetData[charset._curId][i-12];
! else
! charset._colorMap[i] = _charsetData[charset._curId][i];
byte1 = charsetptr[1];
***************
*** 486,489 ****
--- 505,511 ----
error("Message stack not allocated");
+ if (msg==NULL)
+ error("Bad message in addMessageToStack");
+
while ( (chr=*msg++) != 0) {
if (num > 500)
***************
*** 624,629 ****
int i;
! if (!getResourceAddress(rtCharset, charsetno))
! loadCharset(charsetno);
string[0].t_charset = charsetno;
--- 646,654 ----
int i;
! if (_features & GF_SMALL_HEADER)
! loadCharset(charsetno);
! else
! if (!getResourceAddress(rtCharset, charsetno))
! loadCharset(charsetno);
string[0].t_charset = charsetno;
***************
*** 631,635 ****
for (i=0; i<0x10; i++)
! charset._colorMap[i] = _charsetData[charsetno][i];
}
--- 656,663 ----
for (i=0; i<0x10; i++)
! if(_features & GF_SMALL_HEADER)
! charset._colorMap[i] = _charsetData[charset._curId][i-12];
! else
! charset._colorMap[i] = _charsetData[charset._curId][i];
}
***************
*** 644,647 ****
--- 672,678 ----
if (chr=='@')
return;
+
+ if (_vm->_features & GF_SMALL_HEADER)
+ _ptr -= 12;
_ptr = _vm->getResourceAddress(rtCharset, _curId) + 29;
Index: verbs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/verbs.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** verbs.cpp 27 Dec 2001 17:51:58 -0000 1.12
--- verbs.cpp 12 Feb 2002 21:28:07 -0000 1.13
***************
*** 185,197 ****
obim = getResourceAddress(rtVerb, vrb);
!
! imhd = (ImageHeader*)findResourceData(MKID('IMHD'), obim);
! imgw = READ_LE_UINT16(&imhd->width) >> 3;
! imgh = READ_LE_UINT16(&imhd->height) >> 3;
! imptr = findResource(MKID('IM01'), obim);
! if (!imptr)
! error("No image for verb %d", vrb);
!
for (i=0; i<imgw; i++) {
tmp = xstrip + i;
--- 185,209 ----
obim = getResourceAddress(rtVerb, vrb);
! if (_features & GF_SMALL_HEADER) {
! ObjectData *od;
! int index, obj;
! obj = READ_LE_UINT16(obim+6);
! index = getObjectIndex(obj);
! if(index==-1)
! return;
! od = &_objs[index];
!
! imgw = od->width>>3;
! imgh = od->height>>3;
! imptr = obim+8;
! } else {
! imhd = (ImageHeader*)findResourceData(MKID('IMHD'), obim);
! imgw = READ_LE_UINT16(&imhd->width) >> 3;
! imgh = READ_LE_UINT16(&imhd->height) >> 3;
! imptr = findResource(MKID('IM01'), obim);
! if (!imptr)
! error("No image for verb %d", vrb);
! }
for (i=0; i<imgw; i++) {
tmp = xstrip + i;
***************
*** 251,255 ****
findObjectInRoom(&foir, foImageHeader, object, room);
! size = READ_BE_UINT32_UNALIGNED(foir.obim+4);
createResource(rtVerb, verb, size);
obimptr = getResourceAddress(rtRoom, room) - foir.roomptr + foir.obim;
--- 263,270 ----
findObjectInRoom(&foir, foImageHeader, object, room);
! if(_features & GF_SMALL_HEADER)
! size = READ_LE_UINT32(foir.obim);
! else
! size = READ_BE_UINT32_UNALIGNED(foir.obim+4);
createResource(rtVerb, verb, size);
obimptr = getResourceAddress(rtRoom, room) - foir.roomptr + foir.obim;
More information about the Scummvm-git-logs
mailing list