[Scummvm-cvs-logs] CVS: scummvm actor.cpp,1.19,1.20 akos.cpp,1.3,1.4 boxes.cpp,1.5,1.6 costume.cpp,1.11,1.12 debug.cpp,1.11,1.12 gfx.cpp,1.24,1.25 object.cpp,1.18,1.19 resource.cpp,1.27,1.28 saveload.cpp,1.20,1.21 script.cpp,1.16,1.17 script_v1.cpp,1.16,1.17 script_v2.cpp,1.16,1.17 scumm.h,1.35,1.36 scummvm.cpp,1.30,1.31 scummvm.dsp,1.16,1.17 sdl.cpp,1.26,1.27 sound.cpp,1.12,1.13 string.cpp,1.12,1.13 verbs.cpp,1.11,1.12 windows.cpp,1.22,1.23

Ludvig Strigeus strigeus at users.sourceforge.net
Thu Dec 27 10:03:05 CET 2001


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

Modified Files:
	actor.cpp akos.cpp boxes.cpp costume.cpp debug.cpp gfx.cpp 
	object.cpp resource.cpp saveload.cpp script.cpp script_v1.cpp 
	script_v2.cpp scumm.h scummvm.cpp scummvm.dsp sdl.cpp 
	sound.cpp string.cpp verbs.cpp windows.cpp 
Log Message:
better full throttle support, 
a couple of MI2 fixes.

Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/actor.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** actor.cpp	2001/12/11 13:35:16	1.19
--- actor.cpp	2001/12/27 17:51:57	1.20
***************
*** 30,35 ****
--- 30,37 ----
  		a->y = 0;
  		a->facing = 180;
+ 		a->newDirection = 180;
  	} else if (mode==2) {
  		a->facing = 180;
+ 		a->newDirection = 180;
  	}
  
***************
*** 50,56 ****
  	a->sound[7] = 0;
  	a->newDirection = 0;
! 	a->moving = 0;
! 	a->unk1 = 0;
  
  	setActorWalkSpeed(a, 8, 2);
  
--- 52,61 ----
  	a->sound[7] = 0;
  	a->newDirection = 0;
! 	
! 	stopActorMoving(a);
  
+ 	a->shadow_mode = 0;
+ 	a->layer = 0;
+ 
  	setActorWalkSpeed(a, 8, 2);
  
***************
*** 64,68 ****
  	a->talkFrame2 = 5;
  
! 	_classData[a->number] = 0;
  }
  
--- 69,85 ----
  	a->talkFrame2 = 5;
  
! 	a->walk_script = 0;
! 	a->talk_script = 0;
! 
! 	if (_features & GF_AFTER_V7) {
! 		_classData[a->number] = _classData[0];
! 	} else {
! 		_classData[a->number] = 0;
! 	}
! }
! 
! void Scumm::stopActorMoving(Actor *a) {
! 	stopScriptNr(a->walk_script);
! 	a->moving = 0;
  }
  
***************
*** 184,193 ****
  	int from,to;
  	int diff;
  
! 	from = toSimpleDir(a->facing);
! 	to = toSimpleDir(remapDirection(a, a->newDirection));
  	diff = to - from;
  
! 	if (abs(diff) > 2)
  		diff = -diff;
  
--- 201,216 ----
  	int from,to;
  	int diff;
+ 	int dirType;
+ 	int num;
  
! 	dirType = akos_hasManyDirections(a);
! 
! 	from = toSimpleDir(dirType, a->facing);
! 	to = toSimpleDir(dirType, remapDirection(a, a->newDirection));
  	diff = to - from;
  
! 	num = numSimpleDirDirections(dirType);
! 
! 	if (abs(diff) > (num>>1))
  		diff = -diff;
  
***************
*** 199,203 ****
  	}
  
! 	return fromSimpleDir(from&3);
  }
  
--- 222,226 ----
  	}
  
! 	return fromSimpleDir(dirType, from & (num-1));
  }
  
***************
*** 272,275 ****
--- 295,299 ----
  	uint16 scale;
  	byte *resptr;
+ 	int y;
  
  	if (a->ignoreBoxes != 0)
***************
*** 283,289 ****
  		if (resptr==NULL)
  			error("Scale table %d not defined",scale);
! 		if (a->y >= 0)
! 			resptr += a->y;
! 		scale = *resptr;
  	}
  
--- 307,316 ----
  		if (resptr==NULL)
  			error("Scale table %d not defined",scale);
! 		y = a->y;
! 		if (y>=200)
! 			y=199;
! 		if (y<0)
! 			y=0;
! 		scale = resptr[y];
  	}
  
***************
*** 295,352 ****
  }
  
- #if defined(FULL_THROTTLE)
  void Scumm::startAnimActor(Actor *a, int frame) {
! 	switch(frame) {
! 	case 1001: frame = a->initFrame; break;
! 	case 1002: frame = a->walkFrame; break;
! 	case 1003: frame = a->standFrame; break;
! 	case 1004: frame = a->talkFrame1; break;
! 	case 1005: frame = a->talkFrame2; break;
! 	}
  
! 	if (a->costume != 0) {
! 		a->animProgress = 0;
! 		a->needRedraw = true;
! 		a->needBgReset = true;
! 		if (frame == a->initFrame)
! 			initActorCostumeData(a);
! 		akos_decodeData(a, frame, (uint)-1);
! 	}
! }
! #else
! void Scumm::startAnimActor(Actor *a, int frame) {
! 	if (frame==0x38)
! 		frame = a->initFrame;
  
! 	if (frame==0x39)
! 		frame = a->walkFrame;
  
! 	if (frame==0x3A)
! 		frame = a->standFrame;
  
! 	if (frame==0x3B)
! 		frame = a->talkFrame1;
  
! 	if (frame==0x3C)
! 		frame = a->talkFrame2;
  
! 	if (a->room == _currentRoom && a->costume) {
! 		a->animProgress = 0;
! 		a->cost.animCounter1 = 0;
! 		a->needRedraw = true;
! 	
! 		cost.loadCostume(a->costume);
  		
! 		if (a->initFrame==frame)
! 			initActorCostumeData(a);
  
! 		if (frame!=0x3E) {
! 			decodeCostData(a, frame, -1);
  		}
- 	}
  
! 	a->needBgReset = true;
  }
- #endif
  
  void Scumm::fixActorDirection(Actor *a, int direction) {
--- 322,376 ----
  }
  
  void Scumm::startAnimActor(Actor *a, int frame) {
! 	if (_features & GF_NEW_COSTUMES) {
! 		switch(frame) {
! 		case 1001: frame = a->initFrame; break;
! 		case 1002: frame = a->walkFrame; break;
! 		case 1003: frame = a->standFrame; break;
! 		case 1004: frame = a->talkFrame1; break;
! 		case 1005: frame = a->talkFrame2; break;
! 		}
  
! 		if (a->costume != 0) {
! 			a->animProgress = 0;
! 			a->needRedraw = true;
! 			a->needBgReset = true;
! 			if (frame == a->initFrame)
! 				initActorCostumeData(a);
! 			akos_decodeData(a, frame, (uint)-1);
! 		}
  
! 	} else {
! 		if (frame==0x38)
! 			frame = a->initFrame;
  
! 		if (frame==0x39)
! 			frame = a->walkFrame;
  
! 		if (frame==0x3A)
! 			frame = a->standFrame;
  
! 		if (frame==0x3B)
! 			frame = a->talkFrame1;
  
! 		if (frame==0x3C)
! 			frame = a->talkFrame2;
! 
! 		if (a->room == _currentRoom && a->costume) {
! 			a->animProgress = 0;
! 			a->cost.animCounter1 = 0;
! 			a->needRedraw = true;
  		
! 			if (a->initFrame==frame)
! 				initActorCostumeData(a);
  
! 			if (frame!=0x3E) {
! 				cost_decodeData(a, frame, -1);
! 			}
  		}
  
! 		a->needBgReset = true;
! 	}
  }
  
  void Scumm::fixActorDirection(Actor *a, int direction) {
***************
*** 363,370 ****
  		return;
  
- #if !defined(FULL_THROTTLE)
- 	cost.loadCostume(a->costume);
- #endif
- 
  	mask = 0x8000;
  	for (i=0; i<16; i++,mask>>=1) {
--- 387,390 ----
***************
*** 373,377 ****
  			continue;
  #if !defined(FULL_THROTTLE)
! 		decodeCostData(a, vald, mask);
  #else
  		akos_decodeData(a, vald, mask);
--- 393,397 ----
  			continue;
  #if !defined(FULL_THROTTLE)
! 		cost_decodeData(a, vald, mask);
  #else
  		akos_decodeData(a, vald, mask);
***************
*** 756,760 ****
  		cnt2 = numactors;
  		do {
! 			if ( (*ac2)->y > (*ac)->y ) {
  				tmp = *ac;
  				*ac = *ac2;
--- 776,780 ----
  		cnt2 = numactors;
  		do {
! 			if ( (*ac2)->y - ((*ac2)->layer<<11) > (*ac)->y - ((*ac)->layer<<11) ) {
  				tmp = *ac;
  				*ac = *ac2;
***************
*** 778,824 ****
  }
  
- void Scumm::setupCostumeRenderer(CostumeRenderer *c, Actor *a) {
- 	c->_actorX = a->x - virtscr->xstart;
- 	c->_actorY = a->y - a->elevation;
- 	c->_zbuf = a->mask;
- 	if (c->_zbuf > gdi._numZBuffer)
- 		c->_zbuf = (byte)gdi._numZBuffer;
- 	if (a->forceClip)
- 		c->_zbuf = a->forceClip;
- 	
- 	c->_scaleX = a->scalex;
- 	c->_scaleY = a->scaley;
- }
- 
- void Scumm::setActorCostPalette(Actor *a) {
- 	int i;
- 	byte color;
- 
- 	cost.loadCostume(a->costume);
- 	
- 	for (i=0; i<cost._numColors; i++) {
- 		color = a->palette[i];
- 		if (color==255)
- 			color = cost._ptr[8+i];
- 		cost._palette[i] = color;
- 	}
- }
- 
  #if !defined(FULL_THROTTLE)
  void Scumm::drawActorCostume(Actor *a) {
  	if (a==NULL || !a->needRedraw)
  		return;
  
  	setupActorScale(a);
- 	setupCostumeRenderer(&cost, a);
- 	setActorCostPalette(a);
  
  	a->top = 0xFF;
! 	a->needRedraw = 0;
  	a->bottom = 0;
- 	cost.loadCostume(a->costume);
- 	cost._mirror = newDirToOldDir(a->facing)!=0 || (cost._ptr[7]&0x80);
  
! 	cost.drawCostume(a);
  }
  #else
--- 798,841 ----
  }
  
  #if !defined(FULL_THROTTLE)
  void Scumm::drawActorCostume(Actor *a) {
+ 	CostumeRenderer cr;
+ 
  	if (a==NULL || !a->needRedraw)
  		return;
  
+ 	a->needRedraw = false;
+ 
  	setupActorScale(a);
  
+ 	cr._actorX = a->x - virtscr->xstart;
+ 	cr._actorY = a->y - a->elevation;
+ 	cr._scaleX = a->scalex;
+ 	cr._scaleY = a->scaley;
+ 
+ 	cr._outheight = virtscr->height;
+ 	cr._vm = this;
+ 
+ 	cr._zbuf = a->mask;
+ 	if (cr._zbuf > gdi._numZBuffer)
+ 		cr._zbuf = (byte)gdi._numZBuffer;
+ 	if (a->forceClip)
+ 		cr._zbuf = a->forceClip;
+ 	
+ 	cr._shadow_table = _shadowPalette;
+ 
+ 	cost_setCostume(&cr, a->costume);
+ 	cost_setPalette(&cr, a->palette);
+ 	cost_setFacing(&cr, a);
+ 
  	a->top = 0xFF;
! 	
  	a->bottom = 0;
  
! 	/* if the actor is partially hidden, redraw it next frame */
! 	if(cr.drawCostume(a)&1) {
! 		a->needBgReset = true;
! 		a->needRedraw = true;
! 	}
  }
  #else
***************
*** 843,846 ****
--- 860,864 ----
  			ar.clipping = gdi._numZBuffer;
  	}
+ 	ar.charsetmask = _vars[VAR_CHARSET_MASK]!=0;
  
  	ar.outptr = getResourceAddress(rtBuffer, 1) + virtscr->xstart;
***************
*** 848,851 ****
--- 866,872 ----
  	ar.outheight = virtscr->height;
  
+ 	ar.shadow_mode = a->shadow_mode;
+ 	ar.shadow_table = _shadowPalette;
+ 
  	akos_setCostume(&ar, a->costume);
  	akos_setPalette(&ar, a->palette);
***************
*** 865,869 ****
--- 886,894 ----
  
  void Scumm::actorAnimate(Actor *a) {
+ #if defined(FULL_THROTTLE)
  	byte *akos;
+ #else
+ 	LoadedCostume lc;
+ #endif
  
  	if (a==NULL || a->costume == 0)
***************
*** 879,884 ****
  		if (akos_increaseAnims(akos, a)) {
  #else
! 		cost.loadCostume(a->costume);
! 		if (cost.animate(a)) {
  #endif
  			a->needRedraw = true;
--- 904,909 ----
  		if (akos_increaseAnims(akos, a)) {
  #else
! 		loadCostume(&lc, a->costume);
! 		if (cost_increaseAnims(&lc, a)) {
  #endif
  			a->needRedraw = true;
***************
*** 1088,1092 ****
  
  		// allow remap of generic palette entry?
! 		if (!a->unk1 || akpl_color>=16) {
  			if (r_fact!=256) r = (r*r_fact) >> 8;
  			if (g_fact!=256) g = (g*g_fact) >> 8;
--- 1113,1117 ----
  
  		// allow remap of generic palette entry?
! 		if (!a->shadow_mode || akpl_color>=16) {
  			if (r_fact!=256) r = (r*r_fact) >> 8;
  			if (g_fact!=256) g = (g*g_fact) >> 8;
***************
*** 1098,1101 ****
  
  void Scumm::setupShadowPalette(int slot,int rfact,int gfact,int bfact,int from,int to) {
! 	warning("stub setupShadowPalette(%d,%d,%d,%d,%d,%d)", slot,rfact,gfact,bfact,from,to);
  }
--- 1123,1150 ----
  
  void Scumm::setupShadowPalette(int slot,int rfact,int gfact,int bfact,int from,int to) {
! 	byte *table;
! 	int i,num;
! 	byte *curpal;
! 
! 	if (slot<0 || slot > 7)
! 		error("setupShadowPalette: invalid slot %d", slot);
! 
! 	if (from<0 || from>255 || to<0 || from>255 || to < from)
! 		error("setupShadowPalette: invalid range from %d to %d", from, to);
! 
! 	table = _shadowPalette + slot * 256;
! 	for(i=0; i<256; i++)
! 		table[i] = i;
! 
! 	table += from;
! 	curpal = _currentPalette + from*3;
! 	num = to - from + 1;
! 	do {
! 		*table++ = remapPaletteColor(
! 			curpal[0] * rfact >> 8,
! 			curpal[1] * gfact >> 8,
! 			curpal[2] * bfact >> 8,
! 			(uint)-1);
! 		curpal+=3;
! 	} while (--num);
  }

Index: akos.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/akos.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** akos.cpp	2001/12/03 11:49:06	1.3
--- akos.cpp	2001/12/27 17:51:58	1.4
***************
*** 22,35 ****
  #include "scumm.h"
  
- #if defined(FULL_THROTTLE)
- 
  bool Scumm::akos_hasManyDirections(Actor *a) {
! 	byte *akos;
! 	AkosHeader *akhd;
  
! 	akos = getResourceAddress(rtCostume, a->costume);
! 	assert(akos);
! 	akhd = (AkosHeader*)findResource(MKID('AKHD'), akos);
! 	return (akhd->flags&2) != 0;
  }
  
--- 22,37 ----
  #include "scumm.h"
  
  bool Scumm::akos_hasManyDirections(Actor *a) {
! 	if (_features & GF_NEW_COSTUMES) {	
! 		byte *akos;
! 		AkosHeader *akhd;
  
! 		akos = getResourceAddress(rtCostume, a->costume);
! 		assert(akos);
! 
! 		akhd = (AkosHeader*)findResourceData(MKID('AKHD'), akos);
! 		return (akhd->flags&2) != 0;
! 	}
! 	return 0;
  }
  
***************
*** 61,65 ****
  	assert(akos);
  
! 	akhd = (AkosHeader*)findResource(MKID('AKHD'), akos);
  
  	if (anim>=READ_LE_UINT16(&akhd->num_anims))
--- 63,67 ----
  	assert(akos);
  
! 	akhd = (AkosHeader*)findResourceData(MKID('AKHD'), akos);
  
  	if (anim>=READ_LE_UINT16(&akhd->num_anims))
***************
*** 122,128 ****
  	uint size, i;
  
! 	akpl = findResource(MKID('AKPL'), ar->akos);
! 	size = READ_BE_UINT32_UNALIGNED(akpl+4) - 8;
! 	akpl += 8;
  
  	if (size > 256)
--- 124,129 ----
  	uint size, i;
  
! 	akpl = findResourceData(MKID('AKPL'), ar->akos);
! 	size = getResourceDataSize(akpl);
  
  	if (size > 256)
***************
*** 138,147 ****
  	assert(ar->akos);
  
! 	ar->akhd = (AkosHeader*)findResource(MKID('AKHD'), ar->akos);
! 	ar->akof = (AkosOffset*)(findResource(MKID('AKOF'), ar->akos)+8);
! 	ar->akci = (findResource(MKID('AKCI'), ar->akos)+8);
! 	ar->aksq = (findResource(MKID('AKSQ'), ar->akos)+8);
! 	ar->akcd = (findResource(MKID('AKCD'), ar->akos)+8);
! 	ar->akpl = (findResource(MKID('AKPL'), ar->akos)+8);
  	ar->codec = READ_LE_UINT16(&ar->akhd->codec);
  }
--- 139,148 ----
  	assert(ar->akos);
  
! 	ar->akhd = (AkosHeader*)findResourceData(MKID('AKHD'), ar->akos);
! 	ar->akof = (AkosOffset*)findResourceData(MKID('AKOF'), ar->akos);
! 	ar->akci = findResourceData(MKID('AKCI'), ar->akos);
! 	ar->aksq = findResourceData(MKID('AKSQ'), ar->akos);
! 	ar->akcd = findResourceData(MKID('AKCD'), ar->akos);
! 	ar->akpl = findResourceData(MKID('AKPL'), ar->akos);
  	ar->codec = READ_LE_UINT16(&ar->akhd->codec);
  }
***************
*** 189,193 ****
  
  		ar->srcptr = ar->akcd + READ_LE_UINT32(&off->akcd);
! 		akci = (AkosCI*)ar->akci + READ_LE_UINT16(&off->akci);
  
  		ar->move_x_cur = ar->move_x + (int16)READ_LE_UINT16(&akci->rel_x);
--- 190,194 ----
  
  		ar->srcptr = ar->akcd + READ_LE_UINT32(&off->akcd);
! 		akci = (AkosCI*)(ar->akci + READ_LE_UINT16(&off->akci));
  
  		ar->move_x_cur = ar->move_x + (int16)READ_LE_UINT16(&akci->rel_x);
***************
*** 265,269 ****
  	y = ar->v1.y;
  
! 	if (ar->v1.doContinue) goto StartPos;
  
  	do {
--- 266,270 ----
  	y = ar->v1.y;
  
! 	if (len) goto StartPos;
  
  	do {
***************
*** 292,348 ****
  }
  
! #if 0
  void akos_c1_spec1(AkosRenderer *ar) {
! 	byte *mask,*src,*dst,*dstorg;
! 	byte maskbit,len,height,pcolor,width;
! 	uint y;
! 	int color;
  	int t;
  
- 	mask = _mask_ptr = ar->v1.mask_ptr_dest;
- 	maskbit = revBitMask[ar_xpos&7];
- 	y = _ypos;
  
! 	dstorg = dst = _backbuff_ptr;
! 	height = _height2;
! 	width = _width2;
! 	len = _replen;
! 	color = _repcolor;
! 	src = _srcptr;
  
! 	if (_docontinue) goto StartPos;
  
  	do {
  		len = *src++;
! 		color = len>>_shrval;
! 		len &= _maskval;
  		if (!len) len = *src++;
  		
  		do {
! 			if (cost_scaleTable[_scaleIndexY++] < _scaleY) {
! 				if (color && y < _vscreenheight) {
! 					pcolor = _palette[color];
  					if (pcolor==13)
! 						pcolor = _transEffect[*dst];
  					*dst = pcolor;
  				}
! 				dst += 320;
  				y++;
  			}
  			if (!--height) {
! 				if(!--width)
  					return;
! 				height = _height;
! 				y = _ypostop;
! 				_scaleIndexY = _scaleIndexYTop;
! 				t = _scaleIndexX;
! 				_scaleIndexX = t + _scaleIndexXStep;
! 				if (cost_scaleTable[t] < _scaleX) {
! 					_xpos += _scaleIndexXStep;
! 					if (_xpos >= 320)
  						return;
! 					_backbuff_ptr += _scaleIndexXStep;
  				}
! 				dst = _backbuff_ptr;
  			}
  StartPos:;
--- 293,418 ----
  }
  
! void akos_generic_decode(AkosRenderer *ar) {
! 	byte *src,*dst;
! 	byte len,height,pcolor, maskbit;
! 	uint y,scrheight;
! 	uint color;
! 	int t;
! 	const byte *scaleytab, *mask;
! 
! 
! 	y = ar->v1.y;
! 
! 	len = ar->v1.replen;
! 	src = ar->srcptr;
! 	dst = ar->v1.destptr;
! 	color = ar->v1.repcolor;
! 	height = ar->height;
! 
! 	scaleytab = &ar->v1.scaletable[ar->v1.tmp_y];
! 	maskbit = revBitMask[ar->v1.x&7];
! 	mask = ar->v1.mask_ptr + (ar->v1.x>>3);
! 
! 	if (len) goto StartPos;
! 
! 	do {
! 		len = *src++;
! 		color = len>>ar->v1.shl;
! 		len &= ar->v1.mask;
! 		if (!len) len = *src++;
! 		
! 		do {
! 			if (*scaleytab++ < ar->scale_y) {
! 				if (color && y < ar->outheight && (!ar->v1.mask_ptr || !((mask[0]|mask[ar->v1.imgbufoffs]) & maskbit)) ) {
! 					*dst = ar->palette[color];
! 				}
! 				mask += 40;
! 				dst += ar->outwidth;
! 				y++;
! 			}
! 			if (!--height) {
! 				if(!--ar->v1.skip_width)
! 					return;
! 				height = ar->height;
! 				y = ar->v1.y;
! 
! 				scaleytab = &ar->v1.scaletable[ar->v1.tmp_y];
! 								
! 				if (ar->v1.scaletable[ar->v1.tmp_x] < ar->scale_x) {
! 					ar->v1.x += ar->v1.scaleXstep;
! 					if ((uint)ar->v1.x >= 320)
! 						return;
! 					maskbit = revBitMask[ar->v1.x&7];
! 					ar->v1.destptr += ar->v1.scaleXstep;
! 				}
! 				mask = ar->v1.mask_ptr + (ar->v1.x>>3);
! 				ar->v1.tmp_x += ar->v1.scaleXstep;
! 				dst = ar->v1.destptr;
! 			}
! StartPos:;
! 		} while (--len);
! 	} while(1);
! }
! 
! 
  void akos_c1_spec1(AkosRenderer *ar) {
! 	byte *src,*dst;
! 	byte len,height,pcolor, maskbit;
! 	uint y,scrheight;
! 	uint color;
  	int t;
+ 	const byte *scaleytab, *mask;
  
  
! 	y = ar->v1.y;
  
! 	len = ar->v1.replen;
! 	src = ar->srcptr;
! 	dst = ar->v1.destptr;
! 	color = ar->v1.repcolor;
! 	height = ar->height;
! 
! 	scaleytab = &ar->v1.scaletable[ar->v1.tmp_y];
! 	maskbit = revBitMask[ar->v1.x&7];
! 	mask = ar->v1.mask_ptr + (ar->v1.x>>3);
  
+ 	if (len) goto StartPos;
+ 
  	do {
  		len = *src++;
! 		color = len>>ar->v1.shl;
! 		len &= ar->v1.mask;
  		if (!len) len = *src++;
  		
  		do {
! 			if (*scaleytab++ < ar->scale_y) {
! 				if (color && y < ar->outheight && (!ar->v1.mask_ptr || !((mask[0]|mask[ar->v1.imgbufoffs]) & maskbit)) ) {
! 					pcolor = ar->palette[color];
  					if (pcolor==13)
! 						pcolor = ar->shadow_table[*dst];
  					*dst = pcolor;
  				}
! 				mask += 40;
! 				dst += ar->outwidth;
  				y++;
  			}
  			if (!--height) {
! 				if(!--ar->v1.skip_width)
  					return;
! 				height = ar->height;
! 				y = ar->v1.y;
! 
! 				scaleytab = &ar->v1.scaletable[ar->v1.tmp_y];
! 								
! 				if (ar->v1.scaletable[ar->v1.tmp_x] < ar->scale_x) {
! 					ar->v1.x += ar->v1.scaleXstep;
! 					if ((uint)ar->v1.x >= 320)
  						return;
! 					maskbit = revBitMask[ar->v1.x&7];
! 					ar->v1.destptr += ar->v1.scaleXstep;
  				}
! 				mask = ar->v1.mask_ptr + (ar->v1.x>>3);
! 				ar->v1.tmp_x += ar->v1.scaleXstep;
! 				dst = ar->v1.destptr;
  			}
  StartPos:;
***************
*** 350,354 ****
  	} while(1);
  }
- #endif
  
  const byte default_scale_table[768] = {
--- 420,423 ----
***************
*** 470,474 ****
  
  	/* Setup color decoding variables */
! 	num_colors = READ_BE_UINT32_UNALIGNED(ar->akpl-4)-8;
  	if (num_colors == 32) {
  		ar->v1.mask = (1<<3)-1;
--- 539,543 ----
  
  	/* Setup color decoding variables */
! 	num_colors = getResourceDataSize(ar->akpl);
  	if (num_colors == 32) {
  		ar->v1.mask = (1<<3)-1;
***************
*** 484,489 ****
  	use_scaling = (ar->scale_x!=0xFF) || (ar->scale_y!=0xFF);
  
- 	use_scaling = false;
- 
  	x = ar->x;
  	y = ar->y;
--- 553,556 ----
***************
*** 532,536 ****
  			j = tmp_x;
  			for(i=0,skip=0; i<ar->width; i++) {
! 				if (x_left >= ar->outwidth) {
  					tmp_x = j;
  					skip++;
--- 599,603 ----
  			j = tmp_x;
  			for(i=0,skip=0; i<ar->width; i++) {
! 				if (x_left >= (int)ar->outwidth) {
  					tmp_x = j;
  					skip++;
***************
*** 597,607 ****
  		return;
  
! 	if ((uint)x_left >= (uint)ar->outwidth || x_right <= 0)
  		return;
  
! 	updateDirtyRect(0, x_left, x_right, y_top, y_bottom, 1<<ar->dirty_id);
! 
! 	ar->v1.doContinue = false;
! 
  	ar->v1.y_pitch = ar->height * ar->outwidth;
  	
--- 664,671 ----
  		return;
  
! 	if ((int)x_left >= (int)ar->outwidth || x_right <= 0)
  		return;
  
! 	ar->v1.replen = 0;
  	ar->v1.y_pitch = ar->height * ar->outwidth;
  	
***************
*** 614,618 ****
  			akos_codec1_ignorePakCols(ar, skip);
  			x = 0;
- 			ar->v1.doContinue = true;
  		} else {
  			skip = x_right - ar->outwidth;
--- 678,681 ----
***************
*** 629,633 ****
  			akos_codec1_ignorePakCols(ar, skip);
  			x = ar->outwidth - 1;
- 			ar->v1.doContinue = true;
  		} else {
  			skip = -1 - x_left;
--- 692,695 ----
***************
*** 643,648 ****
  		return;
  
  
! 	y_clipping = (y_bottom > ar->outheight || y_top < 0);
  
  	if ( (uint)y_top > (uint)ar->outheight)
--- 705,711 ----
  		return;
  
+ 	updateDirtyRect(0, x_left, x_right, y_top, y_bottom, 1<<ar->dirty_id);
  
! 	y_clipping = ((uint)y_bottom > ar->outheight || y_top < 0);
  
  	if ( (uint)y_top > (uint)ar->outheight)
***************
*** 660,666 ****
  
  	ar->v1.destptr = ar->outptr + x + y * ar->outwidth;
- 
- 	charsetmask = false;
  
  	masking = false;
  	if (ar->clipping) {
--- 723,728 ----
  
  	ar->v1.destptr = ar->outptr + x + y * ar->outwidth;
  
+ 	charsetmask = ar->charsetmask;
  	masking = false;
  	if (ar->clipping) {
***************
*** 670,674 ****
  	}
  	
! 	if (masking || charsetmask || ar->actor_unk1) {
  		ar->v1.mask_ptr = getResourceAddress(rtBuffer, 9) + y*40 + _screenStartStrip;
  		ar->v1.imgbufoffs = gdi._imgBufOffs[ar->clipping];
--- 732,738 ----
  	}
  	
! 	ar->v1.mask_ptr = NULL;
! 
! 	if (masking || charsetmask || ar->shadow_mode) {
  		ar->v1.mask_ptr = getResourceAddress(rtBuffer, 9) + y*40 + _screenStartStrip;
  		ar->v1.imgbufoffs = gdi._imgBufOffs[ar->clipping];
***************
*** 677,702 ****
  			ar->v1.imgbufoffs = 0;
  		}
- 		ar->v1.mask_ptr_dest = ar->v1.mask_ptr + (x >> 3);
  	}
- 
- 	ar->actor_unk1 = 0;
- 
- 	if(ar->actor_unk1==0)
- 		akos_c1_0y_decode(ar);
  
! #if 0
! 
! 	switch(ar->actor_unk1) {
  	case 1:
  		akos_c1_spec1(ar);
  		return;
  	case 2:
! 		akos_c1_spec2(ar);
  		return;
  	case 3:
! 		akos_c1_spec3(ar);
  		return;
  	}
  
  	switch(((byte)y_clipping<<3) | ((byte)use_scaling<<2) | ((byte)masking<<1) | (byte)charsetmask) {
  	case 0: akos_c1_0_decode(ar); break;
--- 741,764 ----
  			ar->v1.imgbufoffs = 0;
  		}
  	}
  
! 	switch(ar->shadow_mode) {
  	case 1:
  		akos_c1_spec1(ar);
  		return;
  	case 2:
! //		akos_c1_spec2(ar);
  		return;
  	case 3:
! //		akos_c1_spec3(ar);
  		return;
  	}
  
+ 	akos_generic_decode(ar);
+ 	
+ 	//	akos_c1_0y_decode(ar);
+ 
+ #if 0
+ 
  	switch(((byte)y_clipping<<3) | ((byte)use_scaling<<2) | ((byte)masking<<1) | (byte)charsetmask) {
  	case 0: akos_c1_0_decode(ar); break;
***************
*** 763,774 ****
  	bool result;
  
! 	aksq = findResource(MKID('AKSQ'), akos) + 8;
! 	akfo = findResource(MKID('AKFO'), akos);
  	
! 	size = 0;
! 	if (akfo) {
! 		size = (READ_BE_UINT32_UNALIGNED(akfo)-8)>>1;
! 		akfo += 8;
! 	}	
  	
  	result = false;
--- 825,832 ----
  	bool result;
  
! 	aksq = findResourceData(MKID('AKSQ'), akos);
! 	akfo = findResourceData(MKID('AKFO'), akos);
  	
! 	size = getResourceDataSize(akfo)>>1;
  	
  	result = false;
***************
*** 1037,1042 ****
  	assert(var>=0 && var<=15);
  	a->animVariable[var] = value;
! }
! 
! 
! #endif
--- 1095,1097 ----
  	assert(var>=0 && var<=15);
  	a->animVariable[var] = value;
! }
\ No newline at end of file

Index: boxes.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/boxes.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** boxes.cpp	2001/11/26 19:57:57	1.5
--- boxes.cpp	2001/12/27 17:51:58	1.6
***************
*** 40,50 ****
  byte Scumm::getNumBoxes() {
  	byte *ptr = getResourceAddress(rtMatrix, 2);
! 	return ptr[8];
  }
  
  Box *Scumm::getBoxBaseAddr(int box) {
  	byte *ptr = getResourceAddress(rtMatrix, 2);
! 	checkRange(ptr[8]-1, 0, box, "Illegal box %d");
! 	return (Box*)(ptr + box*SIZEOF_BOX + 10);
  }
  
--- 40,50 ----
  byte Scumm::getNumBoxes() {
  	byte *ptr = getResourceAddress(rtMatrix, 2);
! 	return ptr[0];
  }
  
  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);
  }
  
***************
*** 291,295 ****
  
  byte *Scumm::getBoxMatrixBaseAddr() {
! 	byte *ptr = getResourceAddress(rtMatrix, 1) + 8;
  	if (*ptr==0xFF) ptr++;
  	return ptr;
--- 291,295 ----
  
  byte *Scumm::getBoxMatrixBaseAddr() {
! 	byte *ptr = getResourceAddress(rtMatrix, 1);
  	if (*ptr==0xFF) ptr++;
  	return ptr;
***************
*** 492,505 ****
  	createResource(rtMatrix, 4, 1000);
  	createResource(rtMatrix, 3, 4160); //65 items of something of size 64
! 	createResource(rtMatrix, 1, BOX_MATRIX_SIZE+8);
  
  	matrix_ptr = getResourceAddress(rtMatrix, 1);
  
- 	/* endian & alignment safe */
- 	((uint32*)matrix_ptr)[1] = TO_BE_32(BOX_MATRIX_SIZE+8);
- 	((uint32*)matrix_ptr)[0] = MKID('BOXM');
- 
  	_boxMatrixPtr4 = getResourceAddress(rtMatrix, 4);
! 	_boxMatrixPtr1 = getResourceAddress(rtMatrix, 1) + 8;
  	_boxMatrixPtr3 = getResourceAddress(rtMatrix, 3);
  
--- 492,501 ----
  	createResource(rtMatrix, 4, 1000);
  	createResource(rtMatrix, 3, 4160); //65 items of something of size 64
! 	createResource(rtMatrix, 1, BOX_MATRIX_SIZE);
  
  	matrix_ptr = getResourceAddress(rtMatrix, 1);
  
  	_boxMatrixPtr4 = getResourceAddress(rtMatrix, 4);
! 	_boxMatrixPtr1 = getResourceAddress(rtMatrix, 1);
  	_boxMatrixPtr3 = getResourceAddress(rtMatrix, 3);
  

Index: costume.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/costume.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** costume.cpp	2001/11/26 19:57:57	1.11
--- costume.cpp	2001/12/27 17:51:58	1.12
***************
*** 83,87 ****
  	_maskval = 0xF;
  	_shrval = 4;
! 	if (_numColors == 32) {
  		_maskval = 7;
  		_shrval = 3;
--- 83,87 ----
  	_maskval = 0xF;
  	_shrval = 4;
! 	if (_loaded._numColors == 32) {
  		_maskval = 7;
  		_shrval = 3;
***************
*** 98,102 ****
  	_srcptr += 12;
  
! 	switch(_ptr[7]&0x7F) {
  	case 0x60: case 0x61:
  		ex1 = _srcptr[0];
--- 98,102 ----
  	_srcptr += 12;
  
! 	switch(_loaded._ptr[7]&0x7F) {
  	case 0x60: case 0x61:
  		ex1 = _srcptr[0];
***************
*** 104,109 ****
  		_srcptr += 2;
  		if (ex1!=0xFF || ex2!=0xFF) {
! 			ex1=READ_LE_UINT16(_ptr + _numColors + 10 + ex1*2);
! 			_srcptr = _ptr + READ_LE_UINT16(_ptr + ex1 + ex2*2) + 14;
  		}
  	} 
--- 104,109 ----
  		_srcptr += 2;
  		if (ex1!=0xFF || ex2!=0xFF) {
! 			ex1=READ_LE_UINT16(_loaded._ptr + _loaded._numColors + 10 + ex1*2);
! 			_srcptr = _loaded._ptr + READ_LE_UINT16(_loaded._ptr + ex1 + ex2*2) + 14;
  		}
  	} 
***************
*** 201,208 ****
  		_scaleIndexXStep = 1;
  	_ypostop = _ypos;
! 	_vscreenheight = _vm->virtscr[0].height;
  	_vm->updateDirtyRect(0, _left, _right+1,_top,_bottom,1<<a->number);
  
! 	if (_top >= (int)_vscreenheight || _bottom <= 0)
  		return 0;
  
--- 201,208 ----
  		_scaleIndexXStep = 1;
  	_ypostop = _ypos;
! 
  	_vm->updateDirtyRect(0, _left, _right+1,_top,_bottom,1<<a->number);
  
! 	if (_top >= (int)_outheight || _bottom <= 0)
  		return 0;
  
***************
*** 211,215 ****
  	b = 1;
  	if (_left > 319 || _right <= 0)
! 		return 0;
  	if (_mirror) {
  		_ypitch--;
--- 211,215 ----
  	b = 1;
  	if (_left > 319 || _right <= 0)
! 		return 1;
  	if (_mirror) {
  		_ypitch--;
***************
*** 251,261 ****
  		return 0;
  
! 	if ((uint)_top > (uint)_vscreenheight)
  		_top = 0;
  
  	if (_left<0) _left=0;
  
! 	if ((uint)_bottom > _vscreenheight)
! 		_bottom = _vscreenheight;
  
  	if (a->top > _top)
--- 251,261 ----
  		return 0;
  
! 	if ((uint)_top > (uint)_outheight)
  		_top = 0;
  
  	if (_left<0) _left=0;
  
! 	if ((uint)_bottom > _outheight)
! 		_bottom = _outheight;
  
  	if (a->top > _top)
***************
*** 270,274 ****
  	}
  
- 
  	_bgbak_ptr = _vm->getResourceAddress(rtBuffer, 5) + _vm->virtscr[0].xstart + _ypos*320 + _xpos;
  	_backbuff_ptr = _vm->getResourceAddress(rtBuffer, 1) + _vm->virtscr[0].xstart + _ypos*320 + _xpos;
--- 270,273 ----
***************
*** 293,298 ****
  	CHECK_HEAP
  
! 	if (a->unk1) {
! 		proc_special(a->unk1);
  		return b;
  	}
--- 292,297 ----
  	CHECK_HEAP
  
! 	if (a->shadow_mode) {
! 		proc_special(a->shadow_mode);
  		return b;
  	}
***************
*** 336,340 ****
  	dst = _backbuff_ptr;
  	color = _repcolor;
! 	scrheight = _vscreenheight;
  	width = _width2;
  	height = _height2;
--- 335,339 ----
  	dst = _backbuff_ptr;
  	color = _repcolor;
! 	scrheight = _outheight;
  	width = _width2;
  	height = _height2;
***************
*** 384,388 ****
  	len = _replen;
  	color = _repcolor;
! 	scrheight = _vscreenheight;
  	height = _height2;
  
--- 383,387 ----
  	len = _replen;
  	color = _repcolor;
! 	scrheight = _outheight;
  	height = _height2;
  
***************
*** 444,448 ****
  	len = _replen;
  	color = _repcolor;
! 	scrheight = _vscreenheight;
  	height = _height2;
  
--- 443,447 ----
  	len = _replen;
  	color = _repcolor;
! 	scrheight = _outheight;
  	height = _height2;
  
***************
*** 516,520 ****
  		do {
  			if (cost_scaleTable[_scaleIndexY++] < _scaleY) {
! 				if (color && y < _vscreenheight && !((*mask|mask[_imgbufoffs])&maskbit)) {
  					pcolor = _palette[color];
  					if (pcolor==13)
--- 515,519 ----
  		do {
  			if (cost_scaleTable[_scaleIndexY++] < _scaleY) {
! 				if (color && y < _outheight && !((*mask|mask[_imgbufoffs])&maskbit)) {
  					pcolor = _palette[color];
  					if (pcolor==13)
***************
*** 574,578 ****
  		do {
  			if (cost_scaleTable[_scaleIndexY++] < _scaleY) {
! 				if (color && y < _vscreenheight && !(*mask&maskbit)) {
  					pcolor = _palette[color];
  					if (pcolor==13)
--- 573,577 ----
  		do {
  			if (cost_scaleTable[_scaleIndexY++] < _scaleY) {
! 				if (color && y < _outheight && !(*mask&maskbit)) {
  					pcolor = _palette[color];
  					if (pcolor==13)
***************
*** 636,640 ****
  		do {
  			if (cost_scaleTable[_scaleIndexY++] < _scaleY) {
! 				if (color && y < _vscreenheight) {
  					pcolor = _palette[color];
  					if (pcolor==13)
--- 635,639 ----
  		do {
  			if (cost_scaleTable[_scaleIndexY++] < _scaleY) {
! 				if (color && y < _outheight) {
  					pcolor = _palette[color];
  					if (pcolor==13)
***************
*** 670,673 ****
--- 669,673 ----
  }
  
+ #if 0
  void CostumeRenderer::loadCostume(int id) {
  	_ptr = _vm->getResourceAddress(rtCostume, id);
***************
*** 698,701 ****
--- 698,702 ----
  	_dataptr = _ptr + READ_LE_UINT16(_ptr + _numColors + 8);
  }
+ #endif
  
  void Scumm::initActorCostumeData(Actor *a) {
***************
*** 720,727 ****
  	
  	i = cd->curpos[slot]&0x7FFF;
! 	_frameptr = _ptr + READ_LE_UINT16(_ptr + _numColors + slot*2 + 10);
! 	code = _dataptr[i]&0x7F;
  
! 	_srcptr = _ptr + READ_LE_UINT16(_frameptr + code*2);
  
  	if (code != 0x7B) {
--- 721,728 ----
  	
  	i = cd->curpos[slot]&0x7FFF;
! 	_frameptr = _loaded._ptr + READ_LE_UINT16(_loaded._ptr + _loaded._numColors + slot*2 + 10);
! 	code = _loaded._dataptr[i]&0x7F;
  
! 	_srcptr = _loaded._ptr + READ_LE_UINT16(_frameptr + code*2);
  
  	if (code != 0x7B) {
***************
*** 739,814 ****
  
  	_xmove = _ymove = 0;
! 	for (i=0; i<16; i++)
  		r|=drawOneSlot(a, i);
  	return r;
  }
- 
- byte CostumeRenderer::animateOneSlot(Actor *a, int slot) {
- 	int highflag;
- 	int i,end;
- 	byte code,nc;
- 
- 	if (a->cost.curpos[slot]==0xFFFF)
- 		return 0;
- 
- 	highflag = a->cost.curpos[slot]&0x8000;
- 	i = a->cost.curpos[slot]&0x7FFF;
- 	end = a->cost.end[slot];
- 	code=_dataptr[i]&0x7F;
- 
- 	do {
- 		if (!highflag) {
- 			if (i++ >= end)
- 				i = a->cost.start[slot];
- 		} else {
- 			if (i != end)
- 				i++;
- 		}
- 
- 		nc = _dataptr[i];
- 
- 		if (nc==0x7C) {
- 			a->cost.animCounter1++;
- 			if(a->cost.start[slot] != end)
- 				continue;
- 		} else {
- 			if (_vm->_features&GF_AFTER_V6) {
- 				if (nc>=0x71 && nc<=0x78) {
- 					_vm->addSoundToQueue2(a->sound[nc-0x71]);
- 					if(a->cost.start[slot] != end)
- 						continue;
- 				}
- 			} else {
- 				if (nc==0x78) {
- 					a->cost.animCounter2++;
- 					if(a->cost.start[slot] != end)
- 						continue;
- 				}
- 			}
- 		}
  
! 		a->cost.curpos[slot] = i|highflag;
! 		return (_dataptr[i]&0x7F) != code;
! 	} while(1);
  }
  
! byte CostumeRenderer::animate(Actor *a) {
! 	int i;
! 	byte r = 0;
  
! #if !defined(FULL_THROTTLE)
! 	for (i=0; i<16; i++) {
! 		if(a->cost.curpos[i]!=0xFFFF)
! 			r+=animateOneSlot(a, i);
  	}
- #endif
- 	return r;
- }
  
! int Scumm::cost_frameToAnim(Actor *a, int frame) {
! 	return newDirToOldDir(a->facing) + frame * 4;
  }
  
! void Scumm::decodeCostData(Actor *a, int frame, uint usemask) {
  	byte *p,*r;
  	uint mask,j;
--- 740,782 ----
  
  	_xmove = _ymove = 0;
! 	for (i=0; i!=16; i++)
  		r|=drawOneSlot(a, i);
  	return r;
  }
  
! int Scumm::cost_frameToAnim(Actor *a, int frame) {
! 	return newDirToOldDir(a->facing) + frame * 4;
  }
  
! void Scumm::loadCostume(LoadedCostume *lc, int costume) {
! 	lc->_ptr = getResourceAddress(rtCostume, costume);
! 	
! 	if (_features&GF_AFTER_V6) {
! 		lc->_ptr += 8;
! 	} else {
! 		lc->_ptr += 2;
! 	}
  
! 	switch(lc->_ptr[7]&0x7F) {
! 	case 0x58:
! 		lc->_numColors = 16;
! 		break;
! 	case 0x59:
! 		lc->_numColors = 32;
! 		break;
! 	case 0x60: /* New since version 6 */
! 		lc->_numColors = 16;
! 		break;
! 	case 0x61: /* New since version 6 */
! 		lc->_numColors = 32;
! 		break;
! 	default:
! 		error("Costume %d is invalid", costume);
  	}
  
! 	lc->_dataptr = lc->_ptr + READ_LE_UINT16(lc->_ptr + lc->_numColors + 8);
  }
  
! void Scumm::cost_decodeData(Actor *a, int frame, uint usemask) {
  	byte *p,*r;
  	uint mask,j;
***************
*** 817,834 ****
  	byte *dataptr;
  	int anim;
  
  	anim = cost_frameToAnim(a, frame);
  	
! 	p = cost._ptr;
  	if (anim > p[6]) {
  		return;
  	}
  
! 	r = p + READ_LE_UINT16(p + anim*2 + cost._numColors + 42);
  	if (r==p) {
  		return;
  	}
  
! 	dataptr = p + READ_LE_UINT16(p + cost._numColors + 8);
  
  	mask = READ_LE_UINT16(r);
--- 785,805 ----
  	byte *dataptr;
  	int anim;
+ 	LoadedCostume lc;
+ 
+ 	loadCostume(&lc, a->costume);
  
  	anim = cost_frameToAnim(a, frame);
  	
! 	p = lc._ptr;
  	if (anim > p[6]) {
  		return;
  	}
  
! 	r = p + READ_LE_UINT16(p + anim*2 + lc._numColors + 42);
  	if (r==p) {
  		return;
  	}
  
! 	dataptr = p + READ_LE_UINT16(p + lc._numColors + 8);
  
  	mask = READ_LE_UINT16(r);
***************
*** 869,870 ****
--- 840,922 ----
  	} while ((uint16)mask);
  }
+ 
+ void Scumm::cost_setPalette(CostumeRenderer *cr, byte *palette) {
+ 	int i;
+ 	byte color;
+ 
+ 	for (i=0; i<cr->_loaded._numColors; i++) {
+ 		color = palette[i];
+ 		if (color==255)
+ 			color = cr->_loaded._ptr[8+i];
+ 		cr->_palette[i] = color;
+ 	}
+ }
+ 
+ void Scumm::cost_setFacing(CostumeRenderer *cr, Actor *a) {
+ 	cr->_mirror = newDirToOldDir(a->facing)!=0 || (cr->_loaded._ptr[7]&0x80);
+ }
+ 
+ void Scumm::cost_setCostume(CostumeRenderer *cr, int costume) {
+ 	loadCostume(&cr->_loaded, costume);
+ }
+ 
+ byte Scumm::cost_increaseAnims(LoadedCostume *lc, Actor *a) {
+ 	int i;
+ 	byte r = 0;
+ 
+ 	for (i=0; i!=16; i++) {
+ 		if(a->cost.curpos[i]!=0xFFFF)
+ 			r+=cost_increaseAnim(lc, a, i);
+ 	}
+ 	return r;
+ }
+ 
+ byte Scumm::cost_increaseAnim(LoadedCostume *lc, Actor *a, int slot) {
+ 	int highflag;
+ 	int i,end;
+ 	byte code,nc;
+ 
+ 	if (a->cost.curpos[slot]==0xFFFF)
+ 		return 0;
+ 
+ 	highflag = a->cost.curpos[slot]&0x8000;
+ 	i = a->cost.curpos[slot]&0x7FFF;
+ 	end = a->cost.end[slot];
+ 	code=lc->_dataptr[i]&0x7F;
+ 
+ 	do {
+ 		if (!highflag) {
+ 			if (i++ >= end)
+ 				i = a->cost.start[slot];
+ 		} else {
+ 			if (i != end)
+ 				i++;
+ 		}
+ 
+ 		nc = lc->_dataptr[i];
+ 
+ 		if (nc==0x7C) {
+ 			a->cost.animCounter1++;
+ 			if(a->cost.start[slot] != end)
+ 				continue;
+ 		} else {
+ 			if (_features&GF_AFTER_V6) {
+ 				if (nc>=0x71 && nc<=0x78) {
+ 					addSoundToQueue2(a->sound[nc-0x71]);
+ 					if(a->cost.start[slot] != end)
+ 						continue;
+ 				}
+ 			} else {
+ 				if (nc==0x78) {
+ 					a->cost.animCounter2++;
+ 					if(a->cost.start[slot] != end)
+ 						continue;
+ 				}
+ 			}
+ 		}
+ 
+ 		a->cost.curpos[slot] = i|highflag;
+ 		return (lc->_dataptr[i]&0x7F) != code;
+ 	} while(1);
+ }
+ 

Index: debug.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/debug.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** debug.cpp	2001/11/27 17:56:04	1.11
--- debug.cpp	2001/12/27 17:51:58	1.12
***************
*** 38,41 ****
--- 38,42 ----
  	CMD_ACTOR,
  	CMD_SCRIPTS,
+ 	CMD_LOAD_ROOM,
  	CMD_EXIT
  };
***************
*** 66,69 ****
--- 67,71 ----
  				"(g)o [numframes] -> increase frame\n"
  				"(a)ctor [actornum] -> show actor information\n"
+ 				"(r)oom roomnum -> load room\n"
  				"(s)cripts -> show running scripts\n"
  				"(e)xit -> exit game\n"
***************
*** 90,93 ****
--- 92,106 ----
  		printScripts();
  		return true;
+ 	case CMD_LOAD_ROOM:
+ 		if (!_parameters[0]) {
+ 			printf("Enter a room number...\n");
+ 		} else {	
+ 			int room=atoi(_parameters);
+ 			_s->actor[_s->_vars[VAR_EGO]].room=room;
+ 			_s->startScene(room, 0, 0);
+ 			_s->_fullRedraw = 1;
+ 		}
+ 		return true;
+ 
  	case CMD_EXIT:
  		exit(1);
***************
*** 131,134 ****
--- 144,148 ----
  	{ "a", 1, CMD_ACTOR },
  	{ "s", 1, CMD_SCRIPTS },
+ 	{ "r", 1, CMD_LOAD_ROOM },
  	{ "e", 1, CMD_EXIT },
  	{ 0, 0, 0 },

Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gfx.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** gfx.cpp	2001/12/11 13:34:15	1.24
--- gfx.cpp	2001/12/27 17:51:58	1.25
***************
*** 108,112 ****
  	updateDirtyScreen(2);
  
! 	if (camera._lastPos == camera._curPos) {
  		updateDirtyScreen(0);
  	} else {
--- 108,117 ----
  	updateDirtyScreen(2);
  
! #if defined(FULL_THROTTLE)
! 	if (camera._last.x==camera._cur.x &&
! 		  camera._last.y==camera._cur.y) {
! #else
! 	if (camera._last.x == camera._cur.x) {
! #endif
  		updateDirtyScreen(0);
  	} else {
***************
*** 183,280 ****
  }
  
! /* TODO: writes are being done to this data */
! MouseCursor mouse_cursors[4] = {
! 	8,7,{15,15,7,8},
! 	{
! 	0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,
! 	0x00,0x80,0x00,0x80,0x00,0x00,0x7E,0x3F,
! 	0x00,0x00,0x00,0x80,0x00,0x80,0x00,0x80,
! 	0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x00,
! 	},
! 	8,7,{15,15,7,8},
! 	{
! 	0x00,0x00,0x7F,0xFE,0x60,0x06,0x30,0x0C,
! 	0x18,0x18,0x0C,0x30,0x06,0x60,0x03,0xC0,
! 	0x06,0x60,0x0C,0x30,0x19,0x98,0x33,0xCC,
! 	0x67,0xE6,0x7F,0xFE,0x00,0x00,0x00,0x00,
! 	},
  
! 	8,7,{15,15,7,8},
! 	{
! 	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
! 	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
! 	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
! 	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
! 	},
! 	8,7,{15,15,7,8},
! 	{
! 	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
! 	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
! 	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
! 	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
! 	},
  
! };
  
! void Scumm::setCursor(int cursor) {
! 	MouseCursor *cur = &mouse_cursors[cursor];
! 	int i,j;
! 	byte *mask;
! 	const byte *src;
! 	byte shramount;
! 	uint32 data;
  
! 	debug(1,"Loading cursor %d", cursor);
! 	gdi._hotspot_x = cur->hotspot_x;
! 	gdi._hotspot_y = cur->hotspot_y;
! 	gdi._currentCursor = cursor;
  
! 	for (i=0; i<4; i++)
! 		gdi._mouseColors[i] = cur->colors[i];
! 	
! 	mask = gdi._mouseMask;
! 	shramount = 0;
  
! 	for(j=0; j<8; j++) {
! 		src = cur->data;	
! 		i=16;
! 		do {
! 			data = ((src[0]<<16) | (src[1]<<8))>>shramount;
! 			src += 2;
! 			mask[0] = (byte)(data>>24);
! 			mask[1] = (byte)(data>>16);
! 			mask[2] = (byte)(data>>8);
! 			mask[3] = (byte)(data);
! 			mask += 4;
! 		} while (--i);
! 		shramount++;
  	}
  }
! 
! void Scumm::setCameraAt(int dest) {
  	int t;
  	CameraData *cd = &camera;
  
! 	if (cd->_mode!=CM_FOLLOW_ACTOR || abs(dest - cd->_curPos) > 160) {
! 		cd->_curPos = dest;
  	}
! 	cd->_destPos = dest;
  
  	t = _vars[VAR_CAMERA_MIN_X];
! 	if (cd->_curPos < t) cd->_curPos = t;
  
  	t = _vars[VAR_CAMERA_MAX_X];
! 	if (cd->_curPos > t) cd->_curPos = t;
  
  	if (_vars[VAR_SCROLL_SCRIPT]) {
! 		_vars[VAR_CAMERA_POS_X] = cd->_curPos;
  		runScript(_vars[VAR_SCROLL_SCRIPT], 0, 0, 0);
  	}
  
! 	if (cd->_curPos != cd->_lastPos && charset._hasMask)
  		stopTalk();
  }
  
  void Scumm::setCameraFollows(Actor *a) {
  	int t,i;
  	CameraData *cd = &camera;
--- 188,272 ----
  }
  
! void Scumm::setCursor(int cursor) {
! 	warning("setCursor(%d)", cursor);
! }
  
! #if defined(FULL_THROTTLE)
  
! void Scumm::setCameraAt(int pos_x, int pos_y) {
! 	CameraData *cd = &camera;
! 	Point old;
  
! 	old = cd->_cur;
  
! 	cd->_cur.x = pos_x;
! 	cd->_cur.y = pos_y;
  
! 	clampCameraPos(&cd->_cur);
  
! 	cd->_dest = cd->_cur;
! 
! 	assert(cd->_cur.x>=160 && cd->_cur.y>=100);
! 
! 	if ((cd->_cur.x != old.x || cd->_cur.y != old.y) && _vars[VAR_SCROLL_SCRIPT]) {
! 		_vars[VAR_CAMERA_POS_X] = cd->_cur.x;
! 		_vars[VAR_CAMERA_POS_Y] = cd->_cur.y;
! 		runScript(_vars[VAR_SCROLL_SCRIPT], 0, 0, 0);
  	}
  }
! #else
! void Scumm::setCameraAt(int pos_x, int pos_y) {
  	int t;
  	CameraData *cd = &camera;
  
! 	if (cd->_mode!=CM_FOLLOW_ACTOR || abs(pos_x - cd->_cur.x) > 160) {
! 		cd->_cur.x = pos_x;
  	}
! 	cd->_dest.x = pos_x;
  
  	t = _vars[VAR_CAMERA_MIN_X];
! 	if (cd->_cur.x < t) cd->_cur.x = t;
  
  	t = _vars[VAR_CAMERA_MAX_X];
! 	if (cd->_cur.x > t) cd->_cur.x = t;
  
  	if (_vars[VAR_SCROLL_SCRIPT]) {
! 		_vars[VAR_CAMERA_POS_X] = cd->_cur.x;
  		runScript(_vars[VAR_SCROLL_SCRIPT], 0, 0, 0);
  	}
  
! 	if (cd->_cur.x != cd->_last.x && charset._hasMask)
  		stopTalk();
  }
+ #endif
  
+ #if defined(FULL_THROTTLE)
  void Scumm::setCameraFollows(Actor *a) {
+ 	CameraData *cd = &camera;
+ 	byte oldfollow = cd->_follows;
+ 	int ax,ay;
+ 
+ 	cd->_follows = a->number;
+ 
+ 	if (a->room != _currentRoom) {
+ 		startScene(a->room, 0, 0);
+ 	}
+ 	
+ 	ax = abs(a->x - cd->_cur.x);
+ 	ay = abs(a->y - cd->_cur.y);
+ 
+ 	if ( ax > _vars[VAR_CAMERA_THRESHOLD_X] ||
+ 		   ay > _vars[VAR_CAMERA_THRESHOLD_Y] ||
+ 			 ax > 160 ||
+ 			 ay > 100) {
+ 		setCameraAt(a->x, a->y);
+ 	}
+ 
+ 	if (a->number != oldfollow)
+ 		runHook(0);
+ }
+ 
+ #else
+ void Scumm::setCameraFollows(Actor *a) {
  	int t,i;
  	CameraData *cd = &camera;
***************
*** 286,291 ****
  		startScene(a->room, 0, 0);
  		cd->_mode = CM_FOLLOW_ACTOR;
! 		cd->_curPos = a->x;
! 		setCameraAt(cd->_curPos);
  	}
  
--- 278,283 ----
  		startScene(a->room, 0, 0);
  		cd->_mode = CM_FOLLOW_ACTOR;
! 		cd->_cur.x = a->x;
! 		setCameraAt(cd->_cur.x, 0);
  	}
  
***************
*** 294,298 ****
  	if (t-_screenStartStrip < cd->_leftTrigger ||
  		  t-_screenStartStrip > cd->_rightTrigger)
! 		setCameraAt(a->x);
  
  	for (i=1,a=getFirstActor(); ++a,i<NUM_ACTORS; i++) {
--- 286,290 ----
  	if (t-_screenStartStrip < cd->_leftTrigger ||
  		  t-_screenStartStrip > cd->_rightTrigger)
! 		setCameraAt(a->x, 0);
  
  	for (i=1,a=getFirstActor(); ++a,i<NUM_ACTORS; i++) {
***************
*** 302,305 ****
--- 294,298 ----
  	runHook(0);
  }
+ #endif
  
  void Scumm::initBGBuffers() {
***************
*** 326,337 ****
  
  void Scumm::setPaletteFromPtr(byte *ptr) {
- 	uint32 size = READ_BE_UINT32_UNALIGNED(ptr+4);
  	int i, r, g, b;
  	byte *dest, *epal;
  	int numcolor;
  
! 	numcolor = (size-8) / 3;
! 
! 	ptr += 8;
  
  	checkRange(256, 0, numcolor, "Too many colors (%d) in Palette");
--- 319,327 ----
  
  void Scumm::setPaletteFromPtr(byte *ptr) {
  	int i, r, g, b;
  	byte *dest, *epal;
  	int numcolor;
  
! 	numcolor = getResourceDataSize(ptr) / 3;
  
  	checkRange(256, 0, numcolor, "Too many colors (%d) in Palette");
***************
*** 482,486 ****
  
  	setDirtyRange(0, 0, 0);
! 	camera._lastPos = camera._curPos;
  	if (!_screenEffectFlag)
  		return;
--- 472,478 ----
  
  	setDirtyRange(0, 0, 0);
! #if !defined(FULL_THROTTLE)
! 	camera._last.x = camera._cur.x;
! #endif
  	if (!_screenEffectFlag)
  		return;
***************
*** 521,532 ****
  	int val;
  	CameraData *cd = &camera;
  
! 	if (cd->_curPos!=cd->_lastPos && charset._hasMask)
  		stopTalk();
  
  	val = 0;
  
  	if (!_fullRedraw && _BgNeedsRedraw) {
! 		for (i=0; i<40; i++) {
  			if (gfxUsageBits[_screenStartStrip + i]&0x80000000) {
  				redrawBGStrip(i, 1);
--- 513,527 ----
  	int val;
  	CameraData *cd = &camera;
+ 	int diff;
  
! #if !defined(FULL_THROTTLE)
! 	if (cd->_cur.x!=cd->_last.x && charset._hasMask)
  		stopTalk();
+ #endif
  
  	val = 0;
  
  	if (!_fullRedraw && _BgNeedsRedraw) {
! 		for (i=0; i!=40; i++) {
  			if (gfxUsageBits[_screenStartStrip + i]&0x80000000) {
  				redrawBGStrip(i, 1);
***************
*** 535,549 ****
  	}
  
! 	if (_fullRedraw==0 && cd->_curPos - cd->_lastPos == 8) {
  		val = 2;
  		redrawBGStrip(39, 1);
! 	} else if (_fullRedraw==0 && cd->_curPos - cd->_lastPos == -8) {
  		val = 1;
  		redrawBGStrip(0, 1);
! 	} else if (_fullRedraw!=0 || cd->_curPos != cd->_lastPos) {
  		_BgNeedsRedraw = false;
  		redrawBGStrip(0, 40);
  	}
  
  	drawRoomObjects(val);
  	_BgNeedsRedraw = false;
--- 530,560 ----
  	}
  
! #if defined(FULL_THROTTLE)
! 	diff = (cd->_cur.x>>3) - (cd->_last.x>>3);
! 	if (_fullRedraw==0 && diff==1) {
  		val = 2;
  		redrawBGStrip(39, 1);
! 	} else if (_fullRedraw==0 && diff==-1) {
  		val = 1;
  		redrawBGStrip(0, 1);
! 	} else if (_fullRedraw!=0 || diff!=0) {
  		_BgNeedsRedraw = false;
+ 		_fullRedraw = false;
  		redrawBGStrip(0, 40);
  	}
  
+ #else
+ 	if (_fullRedraw==0 && cd->_cur.x - cd->_last.x == 8) {
+ 		val = 2;
+ 		redrawBGStrip(39, 1);
+ 	} else if (_fullRedraw==0 && cd->_cur.x - cd->_last.x == -8) {
+ 		val = 1;
+ 		redrawBGStrip(0, 1);
+ 	} else if (_fullRedraw!=0 || cd->_cur.x != cd->_last.x) {
+ 		_BgNeedsRedraw = false;
+ 		redrawBGStrip(0, 40);
+ 	}
+ #endif
+ 
  	drawRoomObjects(val);
  	_BgNeedsRedraw = false;
***************
*** 554,558 ****
  	MKID('ZP01'),
  	MKID('ZP02'),
! 	MKID('ZP03')
  };
  
--- 565,570 ----
  	MKID('ZP01'),
  	MKID('ZP02'),
! 	MKID('ZP03'),
! 	MKID('ZP04')
  };
  
***************
*** 1246,1256 ****
  	int num;
  
! 	if (top > vs->height || bottom < 0)
  		return;
  	
  	if (top<0)
  		top=0;
  	if (bottom > vs->height)
  		bottom = vs->height;
  
  	if (virt==0 && dirtybits) {
--- 1258,1272 ----
  	int num;
  
! 	if (top > vs->height || left > vs->width || right < 0 || bottom < 0)
  		return;
  	
  	if (top<0)
  		top=0;
+ 	if (left<0)
+ 		left=0;
  	if (bottom > vs->height)
  		bottom = vs->height;
+ 	if (right > vs->width)
+ 		right = vs->width;
  
  	if (virt==0 && dirtybits) {
***************
*** 1426,1451 ****
  }
  
  void Scumm::moveCamera() {
  	CameraData *cd = &camera;
! 	int pos = cd->_curPos;
  	int actorx, t;
  	Actor *a;
  
! 	cd->_curPos &= 0xFFF8;
  
! 	if (cd->_curPos < _vars[VAR_CAMERA_MIN_X]) {
  		if (_vars[VAR_CAMERA_FAST_X])
! 			cd->_curPos = _vars[VAR_CAMERA_MIN_X];
  		else
! 			cd->_curPos += 8;
  		cameraMoved();
  		return;
  	}
  
! 	if (cd->_curPos > _vars[VAR_CAMERA_MAX_X]) {
  		if (_vars[VAR_CAMERA_FAST_X])
! 			cd->_curPos = _vars[VAR_CAMERA_MAX_X];
  		else
! 			cd->_curPos-=8;
  		cameraMoved();
  		return;
--- 1442,1569 ----
  }
  
+ #if defined(FULL_THROTTLE)
+ 
+ void Scumm::clampCameraPos(Point *pt) {
+ 	if (pt->x < _vars[VAR_CAMERA_MIN_X])
+ 		pt->x = _vars[VAR_CAMERA_MIN_X];
+ 
+ 	if (pt->x > _vars[VAR_CAMERA_MAX_X])
+ 		pt->x = _vars[VAR_CAMERA_MAX_X];
+ 
+ 	if (pt->y < _vars[VAR_CAMERA_MIN_Y])
+ 		pt->y = _vars[VAR_CAMERA_MIN_Y];
+ 
+ 	if (pt->y > _vars[VAR_CAMERA_MAX_Y])
+ 		pt->y = _vars[VAR_CAMERA_MAX_Y];
+ }
+ 
+ 
  void Scumm::moveCamera() {
  	CameraData *cd = &camera;
! 	Point old = cd->_cur;
! 	Actor *a;
! 
! 	if (cd->_follows) {
! 		a = derefActorSafe(cd->_follows, "moveCamera");
! 		if (abs(cd->_cur.x - a->x) > _vars[VAR_CAMERA_THRESHOLD_X] ||
! 				abs(cd->_cur.y - a->y) > _vars[VAR_CAMERA_THRESHOLD_Y]) {
! 			cd->_movingToActor = true;
! 			if (_vars[VAR_CAMERA_THRESHOLD_X] == 0)
! 				cd->_cur.x = a->x;
! 			if (_vars[VAR_CAMERA_THRESHOLD_Y] == 0)
! 				cd->_cur.y = a->y;
! 			clampCameraPos(&cd->_cur);
! 		}
! 	} else {
! 		cd->_movingToActor = false;
! 	}
! 
! 	if (cd->_movingToActor) {
! 		cd->_dest.x = a->x;
! 		cd->_dest.y = a->y;
! 	}
! 
! 	assert(cd->_cur.x>=160 && cd->_cur.y>=100);
! 
! 	clampCameraPos(&cd->_dest);
! 
! 	if (cd->_cur.x < cd->_dest.x) {
! 		cd->_cur.x += _vars[VAR_CAMERA_SPEED_X];
! 		if (cd->_cur.x > cd->_dest.x)
! 			cd->_cur.x = cd->_dest.x;
! 	}
! 
! 	if (cd->_cur.x > cd->_dest.x) {
! 		cd->_cur.x -= _vars[VAR_CAMERA_SPEED_X];
! 		if (cd->_cur.x < cd->_dest.x)
! 			cd->_cur.x = cd->_dest.x;
! 	}
! 
! 	if (cd->_cur.y < cd->_dest.y) {
! 		cd->_cur.y += _vars[VAR_CAMERA_SPEED_Y];
! 		if (cd->_cur.y > cd->_dest.y)
! 			cd->_cur.y = cd->_dest.y;
! 	}
! 
! 	if (cd->_cur.y > cd->_dest.y) {
! 		cd->_cur.y -= _vars[VAR_CAMERA_SPEED_Y];
! 		if (cd->_cur.y < cd->_dest.y)
! 			cd->_cur.y = cd->_dest.y;
! 	}
! 	
! 	if (cd->_cur.x == cd->_dest.x &&
! 		  cd->_cur.y == cd->_dest.y) {
! 		
! 		cd->_movingToActor = false;
! 		cd->_accel.x = cd->_accel.y = 0;
! 		_vars[VAR_CAMERA_SPEED_X] = _vars[VAR_CAMERA_SPEED_Y] = 0;
! 	} else {
! 		
! 		cd->_accel.x += _vars[VAR_CAMERA_ACCEL_X];
! 		cd->_accel.y += _vars[VAR_CAMERA_ACCEL_Y];
! 		
! 		_vars[VAR_CAMERA_SPEED_X] += cd->_accel.x / 100;
! 		_vars[VAR_CAMERA_SPEED_Y] += cd->_accel.y / 100;
! 
! 		if (_vars[VAR_CAMERA_SPEED_X] < 8)
! 			_vars[VAR_CAMERA_SPEED_X] = 8;
! 
! 		if (_vars[VAR_CAMERA_SPEED_Y] < 8)
! 			_vars[VAR_CAMERA_SPEED_Y] = 8;
! 
! 	}
! 	
! 	cameraMoved();
! 
! 	if (cd->_cur.x != old.x || cd->_cur.y != old.y) {
! 		_vars[VAR_CAMERA_POS_X] = cd->_cur.x;
! 		_vars[VAR_CAMERA_POS_Y] = cd->_cur.y;
! 		runScript(_vars[VAR_SCROLL_SCRIPT], 0, 0, 0);
! 	}
! }
! 
! #else
! void Scumm::moveCamera() {
! 	CameraData *cd = &camera;
! 	int pos = cd->_cur.x;
  	int actorx, t;
  	Actor *a;
  
! 	cd->_cur.x &= 0xFFF8;
  
! 	if (cd->_cur.x < _vars[VAR_CAMERA_MIN_X]) {
  		if (_vars[VAR_CAMERA_FAST_X])
! 			cd->_cur.x = _vars[VAR_CAMERA_MIN_X];
  		else
! 			cd->_cur.x += 8;
  		cameraMoved();
  		return;
  	}
  
! 	if (cd->_cur.x > _vars[VAR_CAMERA_MAX_X]) {
  		if (_vars[VAR_CAMERA_FAST_X])
! 			cd->_cur.x = _vars[VAR_CAMERA_MAX_X];
  		else
! 			cd->_cur.x-=8;
  		cameraMoved();
  		return;
***************
*** 1461,1467 ****
  			if (_vars[VAR_CAMERA_FAST_X]) {
  				if (t > 35)
! 					cd->_destPos = actorx + 80;
  				if (t < 5)
! 					cd->_destPos = actorx - 80;
  			} else 
  				cd->_movingToActor = 1;
--- 1579,1585 ----
  			if (_vars[VAR_CAMERA_FAST_X]) {
  				if (t > 35)
! 					cd->_dest.x = actorx + 80;
  				if (t < 5)
! 					cd->_dest.x = actorx - 80;
  			} else 
  				cd->_movingToActor = 1;
***************
*** 1471,1494 ****
  	if (cd->_movingToActor) {
  		a = derefActorSafe(cd->_follows, "moveCamera(2)");
! 		cd->_destPos = a->x;
  	}
  
! 	if (cd->_destPos < _vars[VAR_CAMERA_MIN_X])
! 		cd->_destPos = _vars[VAR_CAMERA_MIN_X];
  
! 	if (cd->_destPos > _vars[VAR_CAMERA_MAX_X])
! 		cd->_destPos = _vars[VAR_CAMERA_MAX_X];
  
  	if (_vars[VAR_CAMERA_FAST_X]) {
! 		cd->_curPos = cd->_destPos;
  	} else {
! 		if (cd->_curPos < cd->_destPos)
! 			cd->_curPos+=8;
! 		if (cd->_curPos > cd->_destPos)
! 			cd->_curPos-=8;
  	}
  
  	/* a is set a bit above */
! 	if (cd->_movingToActor && cd->_curPos>>3 == a->x>>3) {
  		cd->_movingToActor = 0;
  	}
--- 1589,1612 ----
  	if (cd->_movingToActor) {
  		a = derefActorSafe(cd->_follows, "moveCamera(2)");
! 		cd->_dest.x = a->x;
  	}
  
! 	if (cd->_dest.x < _vars[VAR_CAMERA_MIN_X])
! 		cd->_dest.x = _vars[VAR_CAMERA_MIN_X];
  
! 	if (cd->_dest.x > _vars[VAR_CAMERA_MAX_X])
! 		cd->_dest.x = _vars[VAR_CAMERA_MAX_X];
  
  	if (_vars[VAR_CAMERA_FAST_X]) {
! 		cd->_cur.x = cd->_dest.x;
  	} else {
! 		if (cd->_cur.x < cd->_dest.x)
! 			cd->_cur.x+=8;
! 		if (cd->_cur.x > cd->_dest.x)
! 			cd->_cur.x-=8;
  	}
  
  	/* a is set a bit above */
! 	if (cd->_movingToActor && cd->_cur.x>>3 == a->x>>3) {
  		cd->_movingToActor = 0;
  	}
***************
*** 1496,1527 ****
  	cameraMoved();
  
! 	if (pos != cd->_curPos && _vars[VAR_SCROLL_SCRIPT]) {
! 		_vars[VAR_CAMERA_POS_X] = cd->_curPos;
  		runScript(_vars[VAR_SCROLL_SCRIPT], 0, 0, 0);
  	}
  }
  
  void Scumm::cameraMoved() {
  	CameraData *cd = &camera;
  
! 	if (cd->_curPos < 160) {
! 		cd->_curPos = 160;
! 	} else if (cd->_curPos + 160 >= _scrWidthIn8Unit<<3) {
! 		cd->_curPos = (_scrWidthIn8Unit-20)<<3;
  	}
  
! 	_screenStartStrip = (cd->_curPos >> 3) - 20;
  	_screenEndStrip = _screenStartStrip + 39;
  	virtscr[0].xstart = _screenStartStrip << 3;
  }
  
! void Scumm::panCameraTo(int x) {
  	CameraData *cd = &camera;
! 	cd->_destPos = x;
  	cd->_mode = CM_PANNING;
  	cd->_movingToActor = 0;
  }
  
  void Scumm::actorFollowCamera(int act) {
  	int old;
  	CameraData *cd = &camera;
--- 1614,1674 ----
  	cameraMoved();
  
! 	if (pos != cd->_cur.x && _vars[VAR_SCROLL_SCRIPT]) {
! 		_vars[VAR_CAMERA_POS_X] = cd->_cur.x;
  		runScript(_vars[VAR_SCROLL_SCRIPT], 0, 0, 0);
  	}
  }
+ #endif
  
+ #if defined(FULL_THROTTLE)
  void Scumm::cameraMoved() {
  	CameraData *cd = &camera;
  
! 	assert(cd->_cur.x>=160 && cd->_cur.y>=100);
! 
! 	_screenStartStrip = (cd->_cur.x-160) >> 3;
! 	_screenEndStrip = _screenStartStrip + 39;
! 	virtscr[0].xstart = _screenStartStrip << 3;
! 	
! 	_screenLeft = cd->_cur.x - 160;
! 	_screenTop = cd->_cur.y - 100;
! }
! 
! 
! #else
! void Scumm::cameraMoved() {
! 	CameraData *cd = &camera;
! 
! 	if (cd->_cur.x < 160) {
! 		cd->_cur.x = 160;
! 	} else if (cd->_cur.x + 160 >= _scrWidth) {
! 		cd->_cur.x = _scrWidth-160;
  	}
  
! 	_screenStartStrip = (cd->_cur.x >> 3) - 20;
  	_screenEndStrip = _screenStartStrip + 39;
  	virtscr[0].xstart = _screenStartStrip << 3;
  }
+ #endif
  
! #if defined(FULL_THROTTLE)
! void Scumm::panCameraTo(int x, int y) {
  	CameraData *cd = &camera;
! 	cd->_follows = 0;
! 	cd->_dest.x = x;
! 	cd->_dest.y = y;
! }
! 
! #else
! void Scumm::panCameraTo(int x, int y) {
! 	CameraData *cd = &camera;
! 	cd->_dest.x = x;
  	cd->_mode = CM_PANNING;
  	cd->_movingToActor = 0;
  }
+ #endif
  
  void Scumm::actorFollowCamera(int act) {
+ #if !defined(FULL_THROTTLE)
  	int old;
  	CameraData *cd = &camera;
***************
*** 1541,1552 ****
  
  	cd->_movingToActor = 0;
  }
  
  void Scumm::setCameraAtEx(int at) {
  	CameraData *cd = &camera;
  	cd->_mode = CM_NORMAL;
! 	cd->_curPos = at;
! 	setCameraAt(at);
  	cd->_movingToActor = 0;
  }
  
--- 1688,1702 ----
  
  	cd->_movingToActor = 0;
+ #endif
  }
  
  void Scumm::setCameraAtEx(int at) {
+ #if !defined(FULL_THROTTLE)
  	CameraData *cd = &camera;
  	cd->_mode = CM_NORMAL;
! 	cd->_cur.x = at;
! 	setCameraAt(at, 0);
  	cd->_movingToActor = 0;
+ #endif
  }
  
***************
*** 1706,1715 ****
  }
  
- void Scumm::setCursorHotspot(int cursor, int x, int y) {
- 	MouseCursor *cur = &mouse_cursors[cursor];
- 	cur->hotspot_x = x;
- 	cur->hotspot_y = y;
- }
- 
  void Scumm::setCursorHotspot2(int x,int y) {
  	_cursorHotspotX = x;
--- 1856,1859 ----
***************
*** 1760,1773 ****
  		return NULL;
  
! 	offs = findResource(MKID('OFFS'),pal);
  	if (offs==NULL)
  		return NULL;
  
! 	size = (READ_BE_UINT32_UNALIGNED(offs+4)-8) >> 2;
  	
  	if ((uint32)index >= (uint32)size)
  		return NULL;
  
! 	return offs + READ_LE_UINT32(offs + 8 + index * sizeof(uint32));
  }
  
--- 1904,1917 ----
  		return NULL;
  
! 	offs = findResourceData(MKID('OFFS'),pal);
  	if (offs==NULL)
  		return NULL;
  
! 	size = getResourceDataSize(offs) >> 2;
  	
  	if ((uint32)index >= (uint32)size)
  		return NULL;
  
! 	return offs + READ_LE_UINT32(offs + index * sizeof(uint32));
  }
  
***************
*** 1789,1794 ****
  	int color;
  
! 	cptr = getPalettePtr();
! 	cptr += 8 + a*3;
  	cur = _currentPalette + a*3;
  	if (a <= b) {
--- 1933,1937 ----
  	int color;
  
! 	cptr = getPalettePtr() + a*3;
  	cur = _currentPalette + a*3;
  	if (a <= b) {
***************
*** 1996,2001 ****
  		(bd->x <= bd->outwidth - bd->srcwidth) &&
  		(bd->y <= bd->outheight - bd->srcheight);
- 	assert(_objs[2].obj_nr == 36);
  
  	if (1 || bd->scale_x==255 && bd->scale_y==255) {
  		/* Routine used when no scaling is needed */
--- 2139,2144 ----
  		(bd->x <= bd->outwidth - bd->srcwidth) &&
  		(bd->y <= bd->outheight - bd->srcheight);
  
+ 
  	if (1 || bd->scale_x==255 && bd->scale_y==255) {
  		/* Routine used when no scaling is needed */
***************
*** 2073,2076 ****
  	}
  	CHECK_HEAP
! 	assert(_objs[2].obj_nr == 36);
  }
--- 2216,2219 ----
  	}
  	CHECK_HEAP
! 
  }

Index: object.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/object.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** object.cpp	2001/12/04 21:44:41	1.18
--- object.cpp	2001/12/27 17:51:58	1.19
***************
*** 149,153 ****
  		}
  		assert(ptr);
! 		imhd = (ImageHeader*)findResource(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);
--- 149,153 ----
  		}
  		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);
***************
*** 327,331 ****
  	if (numstrip!=0) {
  		byte flags = Gdi::dbAllowMaskOr;
! 		if (getClass(od->obj_nr, 22))
  			flags |= Gdi::dbDrawMaskOnBoth;
  		gdi.drawBitmap(ptr, _curVirtScreen, x, ypos, height, x-xpos, numstrip, flags);
--- 327,331 ----
  	if (numstrip!=0) {
  		byte flags = Gdi::dbAllowMaskOr;
! 		if (_features&GF_AFTER_V7 && getClass(od->obj_nr, 22))
  			flags |= Gdi::dbDrawMaskOnBoth;
  		gdi.drawBitmap(ptr, _curVirtScreen, x, ypos, height, x-xpos, numstrip, flags);
***************
*** 347,351 ****
  	
  	room = getResourceAddress(rtRoom, _roomResource);
! 	roomhdr = (RoomHeader*)findResource(MKID('RMHD'), room);
  
  	_numObjectsInRoom = READ_LE_UINT16(&roomhdr->numObjects);
--- 347,351 ----
  	
  	room = getResourceAddress(rtRoom, _roomResource);
! 	roomhdr = (RoomHeader*)findResourceData(MKID('RMHD'), room);
  
  	_numObjectsInRoom = READ_LE_UINT16(&roomhdr->numObjects);
***************
*** 365,369 ****
  
  		od->offs_obcd_to_room = ptr - room;
! 		cdhd = (CodeHeader*)findResource(MKID('CDHD'), ptr, 0);
  		od->obj_nr = READ_LE_UINT16(&cdhd->obj_id);
  
--- 365,369 ----
  
  		od->offs_obcd_to_room = ptr - room;
! 		cdhd = (CodeHeader*)findResourceData(MKID('CDHD'), ptr);
  		od->obj_nr = READ_LE_UINT16(&cdhd->obj_id);
  
***************
*** 384,388 ****
  			error("Room %d missing image blocks(s)", _roomResource);
  
! 		imhd = (ImageHeader*)findResource(MKID('IMHD'), ptr, 0);
  		obim_id = READ_LE_UINT16(&imhd->obj_id);
  
--- 384,388 ----
  			error("Room %d missing image blocks(s)", _roomResource);
  
! 		imhd = (ImageHeader*)findResourceData(MKID('IMHD'), ptr);
  		obim_id = READ_LE_UINT16(&imhd->obj_id);
  
***************
*** 407,411 ****
  	ImageHeader *imhd;
  
! 	cdhd = (CodeHeader*)findResource(MKID('CDHD'), room + od->offs_obcd_to_room);
  
  	od->obj_nr = READ_LE_UINT16(&cdhd->obj_id);
--- 407,411 ----
  	ImageHeader *imhd;
  
! 	cdhd = (CodeHeader*)findResourceData(MKID('CDHD'), room + od->offs_obcd_to_room);
  
  	od->obj_nr = READ_LE_UINT16(&cdhd->obj_id);
***************
*** 443,447 ****
  	od->parentstate = cdhd->parentstate;
  
! 	imhd = (ImageHeader*)findResource(MKID('IMHD'), room + od->offs_obim_to_room);
  	od->x_pos = imhd->x_pos;
  	od->y_pos = imhd->y_pos;
--- 443,447 ----
  	od->parentstate = cdhd->parentstate;
  
! 	imhd = (ImageHeader*)findResourceData(MKID('IMHD'), room + od->offs_obim_to_room);
  	od->x_pos = imhd->x_pos;
  	od->y_pos = imhd->y_pos;
***************
*** 548,556 ****
  		return getActorName(derefActorSafe(obj, "getObjOrActorName"));
  
! 	objptr = getObjectAddress(obj);
  	if (objptr==NULL)
  		return (byte*)" ";
  	
! 	return findResource(MKID('OBNA'), objptr) + 8;
  }
  
--- 548,556 ----
  		return getActorName(derefActorSafe(obj, "getObjOrActorName"));
  
! 	objptr = getOBCDFromObject(obj);
  	if (objptr==NULL)
  		return (byte*)" ";
  	
! 	return findResourceData(MKID('OBNA'), objptr);
  }
  
***************
*** 570,574 ****
  }
  
! byte *Scumm::getObjectAddress(int obj) {
  	int i;
  
--- 570,574 ----
  }
  
! byte *Scumm::getOBCDFromObject(int obj) {
  	int i;
  
***************
*** 602,611 ****
  	if (whereIsObject(obj)==WIO_FLOBJECT) {
  		i = getObjectIndex(obj);
! 		ptr = getResourceAddress(rtFlObject, _objs[i].fl_object_index) + 64;
  		size = READ_BE_UINT32_UNALIGNED(ptr+4);
  		slot = getInventorySlot();
  		_inventory[slot] = obj;
  		createResource(rtInventory, slot, size);
! 		ptr = getResourceAddress(rtFlObject, _objs[i].fl_object_index) + 64;
  		memcpy(getResourceAddress(rtInventory, slot), ptr, size);
  	} else {
--- 602,611 ----
  	if (whereIsObject(obj)==WIO_FLOBJECT) {
  		i = getObjectIndex(obj);
! 		ptr = getResourceAddress(rtFlObject, _objs[i].fl_object_index) + 8;
  		size = READ_BE_UINT32_UNALIGNED(ptr+4);
  		slot = getInventorySlot();
  		_inventory[slot] = obj;
  		createResource(rtInventory, slot, size);
! 		ptr = getResourceAddress(rtFlObject, _objs[i].fl_object_index) + 8;
  		memcpy(getResourceAddress(rtInventory, slot), ptr, size);
  	} else {
***************
*** 630,643 ****
  	
  	if (findWhat&foCheckAlreadyLoaded && getObjectIndex(id) != -1) {
! 		fo->obcd = obcdptr = getObjectAddress(id);
  		assert((byte*)obcdptr > (byte*)256);
! 		fo->obim = obimptr = obcdptr + READ_BE_UINT32_UNALIGNED(&((ImageHeader*)obcdptr)->size);
! 		fo->cdhd = (CodeHeader*)findResource(MKID('CDHD'), obcdptr);
! 		fo->imhd = (ImageHeader*)findResource(MKID('IMHD'), obimptr);
  		return;
  	}
  
  	fo->roomptr = roomptr = getResourceAddress(rtRoom, room);
! 	roomhdr = (RoomHeader*)findResource(MKID('RMHD'), roomptr);
  	numobj = READ_LE_UINT16(&roomhdr->numObjects);
  	if (numobj==0)
--- 630,643 ----
  	
  	if (findWhat&foCheckAlreadyLoaded && getObjectIndex(id) != -1) {
! 		fo->obcd = obcdptr = getOBCDFromObject(id);
  		assert((byte*)obcdptr > (byte*)256);
! 		fo->obim = obimptr = obcdptr + READ_BE_UINT32_UNALIGNED(&((ResHdr*)obcdptr)->size);
! 		fo->cdhd = (CodeHeader*)findResourceData(MKID('CDHD'), obcdptr);
! 		fo->imhd = (ImageHeader*)findResourceData(MKID('IMHD'), obimptr);
  		return;
  	}
  
  	fo->roomptr = roomptr = getResourceAddress(rtRoom, room);
! 	roomhdr = (RoomHeader*)findResourceData(MKID('RMHD'), roomptr);
  	numobj = READ_LE_UINT16(&roomhdr->numObjects);
  	if (numobj==0)
***************
*** 652,656 ****
  			if(obcdptr==NULL)
  				error("findObjectInRoom: Not enough code blocks in room %d", room);
! 			cdhd = (CodeHeader*)findResource(MKID('CDHD'), obcdptr, 0);
  			if ( READ_LE_UINT16(&cdhd->obj_id) == (uint16)id) {
  				fo->cdhd = cdhd;
--- 652,656 ----
  			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;
***************
*** 670,674 ****
  			if (obimptr==NULL)
  				error("findObjectInRoom: Not enough image blocks in room %d", room);
! 			imhd = (ImageHeader*)findResource(MKID('IMHD'), obimptr, 0);
  			if (READ_LE_UINT16(&imhd->obj_id) == (uint16)id) {
  				fo->obim = obimptr;
--- 670,674 ----
  			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;
***************
*** 731,737 ****
  }
  
! int Scumm::getObjDir(int obj) {
  	if (obj < NUM_ACTORS) {
! 		return newDirToOldDir(derefActorSafe(obj,"getObjDir")->facing);
  	} else {
  		getObjectXYPos(obj);
--- 731,737 ----
  }
  
! int Scumm::getObjOldDir(int obj) {
  	if (obj < NUM_ACTORS) {
! 		return newDirToOldDir(derefActorSafe(obj,"getObjOldDir")->facing);
  	} else {
  		getObjectXYPos(obj);
***************
*** 740,743 ****
--- 740,752 ----
  }
  
+ int Scumm::getObjNewDir(int obj) {
+ 	if (obj < NUM_ACTORS) {
+ 		return derefActorSafe(obj,"getObjNewDir")->facing;
+ 	} else {
+ 		getObjectXYPos(obj);
+ 		return oldDirToNewDir(_dir);
+ 	}
+ }
+ 
  int Scumm::findInventory(int owner, int index) {
  	int count = 1, i, obj;
***************
*** 877,881 ****
  }
  
! void Scumm::enqueueObject(int a, int b, int c, int d, int e, int f, int g, int h) {
  	EnqueuedObject *eo;
  	ObjectData *od;
--- 886,890 ----
  }
  
! void Scumm::enqueueObject(int a, int b, int c, int d, int e, int f, int g, int h, int mode) {
  	EnqueuedObject *eo;
  	ObjectData *od;
***************
*** 956,960 ****
  	ptr = findResource(MKID('IM01'), ptr);
  	assert(ptr);
! 	bomp = findResource(MKID('BOMP'), ptr);
  
  	bdd.srcwidth = READ_LE_UINT16(&((BompHeader*)bomp)->width);
--- 965,969 ----
  	ptr = findResource(MKID('IM01'), ptr);
  	assert(ptr);
! 	bomp = findResourceData(MKID('BOMP'), ptr);
  
  	bdd.srcwidth = READ_LE_UINT16(&((BompHeader*)bomp)->width);
***************
*** 1012,1018 ****
  	if (whereIsObject(object) != WIO_NOT_FOUND)
  		return;
- 
- 	if (room==(uint)-1)
- 		room = getObjectRoom(object);
  
  	/* Locate the object in the room resource */
--- 1021,1024 ----

Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/resource.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** resource.cpp	2001/12/11 13:34:15	1.27
--- resource.cpp	2001/12/27 17:51:58	1.28
***************
*** 567,571 ****
  
  	if (size > 65536*4+37856)
! 		warning("Probably invalid size allocating");
  
  	validateResource("allocating", type, index);
--- 567,571 ----
  
  	if (size > 65536*4+37856)
! 		warning("Probably invalid size allocating %d", size);
  
  	validateResource("allocating", type, index);
***************
*** 613,617 ****
  
  byte *Scumm::findResourceData(uint32 tag, byte *ptr) {
! 	ptr = findResource(tag,ptr);
  	if (ptr==NULL)
  		return NULL;
--- 613,617 ----
  
  byte *Scumm::findResourceData(uint32 tag, byte *ptr) {
! 	ptr = findResource(tag,ptr,0);
  	if (ptr==NULL)
  		return NULL;
***************
*** 619,622 ****
--- 619,628 ----
  }
  
+ int Scumm::getResourceDataSize(byte *ptr) {
+ 	if (ptr==NULL)
+ 		return 0;
+ 	return READ_BE_UINT32(ptr-4)-8;
+ }
+ 
  struct FindResourceState {
  	uint32 size,pos;
***************
*** 862,865 ****
--- 868,873 ----
  		_objectRoomTable = (byte*)alloc(_numGlobalObjects);
  		_numGlobalScripts = 2000;
+ 
+ 		_shadowPaletteSize = NUM_SHADOW_PALETTE * 256;
  	} else if (_features & GF_AFTER_V6) {
  		_numVariables = fileReadWordLE();
***************
*** 882,885 ****
--- 890,895 ----
  		_objectRoomTable = NULL;
  		_numGlobalScripts = 200;
+ 
+ 		_shadowPaletteSize = 256;
  	} else {
  		_numVariables = fileReadWordLE(); /* 800 */
***************
*** 898,903 ****
--- 908,919 ----
  		_numInventory = fileReadWordLE(); /* 80 */
  		_numGlobalScripts = 200;
+ 
+ 		_shadowPaletteSize = 256;
+ 
+ 		_numFlObject = 50;
  	}
  
+ 	if (_shadowPaletteSize)
+ 		_shadowPalette = (byte*)alloc(_shadowPaletteSize);
  	
  	allocateArrays();
***************
*** 918,926 ****
  	_bitVars = (byte*)alloc(_numBitVariables >> 3);
  
! #if defined(FULL_THROTTLE)
! 	allocResTypeData(rtCostume, MKID('AKOS'), _numCostumes, "costume", 1);
! #else
! 	allocResTypeData(rtCostume, MKID('COST'), _numCostumes, "costume", 1);
! #endif
  	allocResTypeData(rtRoom, MKID('ROOM'), _numRooms, "room", 1);
  	allocResTypeData(rtSound, MKID('SOUN'), _numSounds, "sound", 1);
--- 934,941 ----
  	_bitVars = (byte*)alloc(_numBitVariables >> 3);
  
! 	allocResTypeData(rtCostume, 
! 		(_features & GF_NEW_COSTUMES) ? MKID('AKOS') : MKID('COST'),
! 		_numCostumes, "costume", 1);
! 
  	allocResTypeData(rtRoom, MKID('ROOM'), _numRooms, "room", 1);
  	allocResTypeData(rtSound, MKID('SOUN'), _numSounds, "sound", 1);
***************
*** 931,935 ****
  	allocResTypeData(rtTemp,MKID('NONE'),10, "temp", 0);
  	allocResTypeData(rtScaleTable,MKID('NONE'),5, "scale table", 0);
! 	allocResTypeData(rtActorName, MKID('NONE'),13,"actor name", 0);
  	allocResTypeData(rtBuffer, MKID('NONE'),10,"buffer", 0);
   	allocResTypeData(rtVerb, MKID('NONE'),_numVerbs,"verb", 0);
--- 946,950 ----
  	allocResTypeData(rtTemp,MKID('NONE'),10, "temp", 0);
  	allocResTypeData(rtScaleTable,MKID('NONE'),5, "scale table", 0);
! 	allocResTypeData(rtActorName, MKID('NONE'),NUM_ACTORS,"actor name", 0);
  	allocResTypeData(rtBuffer, MKID('NONE'),10,"buffer", 0);
   	allocResTypeData(rtVerb, MKID('NONE'),_numVerbs,"verb", 0);

Index: saveload.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saveload.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** saveload.cpp	2001/12/11 13:34:15	1.20
--- saveload.cpp	2001/12/27 17:51:58	1.21
***************
*** 31,35 ****
  };
  
! #define CURRENT_VER 5
  
  bool Scumm::saveState(int slot, bool compat) {
--- 31,35 ----
  };
  
! #define CURRENT_VER 7
  
  bool Scumm::saveState(int slot, bool compat) {
***************
*** 133,136 ****
--- 133,140 ----
  	_verbMouseOver = 0;
  
+ #if defined(FULL_THROTTLE)
+ 	cameraMoved();
+ #endif
+ 
  	initBGBuffers();
  
***************
*** 236,240 ****
  		MKARRAY(Actor,palette[0],sleByte,64),
  		MKLINE(Actor,mask,sleByte),
! 		MKLINE(Actor,unk1,sleByte),
  		MKLINE(Actor,visible,sleByte),
  		MKLINE(Actor,frame,sleByte),
--- 240,244 ----
  		MKARRAY(Actor,palette[0],sleByte,64),
  		MKLINE(Actor,mask,sleByte),
! 		MKLINE(Actor,shadow_mode,sleByte),
  		MKLINE(Actor,visible,sleByte),
  		MKLINE(Actor,frame,sleByte),
***************
*** 250,253 ****
--- 254,259 ----
  		MKLINE(Actor,new_3,sleByte),
  
+ 		MKLINE(Actor,layer,sleByte),
+ 
  		MKLINE(Actor,talk_script,sleUint16),
  		MKLINE(Actor,walk_script,sleUint16),
***************
*** 302,306 ****
  	
  	const SaveLoadEntry mainEntries[] = {
! 		MKLINE(Scumm,_scrWidthIn8Unit,sleUint16),
  		MKLINE(Scumm,_scrHeight,sleUint16),
  		MKLINE(Scumm,_ENCD_offs,sleUint32),
--- 308,312 ----
  	
  	const SaveLoadEntry mainEntries[] = {
! 		MKLINE(Scumm,_scrWidth,sleUint16),
  		MKLINE(Scumm,_scrHeight,sleUint16),
  		MKLINE(Scumm,_ENCD_offs,sleUint32),
***************
*** 322,328 ****
  		MKLINE(Scumm,_curExecScript,sleUint16),
  
! 		MKLINE(Scumm,camera._destPos,sleInt16),
! 		MKLINE(Scumm,camera._curPos,sleInt16),
! 		MKLINE(Scumm,camera._lastPos,sleInt16),
  		MKLINE(Scumm,_screenStartStrip,sleInt16),
  		MKLINE(Scumm,_screenEndStrip,sleInt16),
--- 328,346 ----
  		MKLINE(Scumm,_curExecScript,sleUint16),
  
! #if defined(FULL_THROTTLE)
! 		MKLINE(Scumm,camera._dest.x,sleInt16),
! 		MKLINE(Scumm,camera._dest.y,sleInt16),
! 		MKLINE(Scumm,camera._cur.x,sleInt16),
! 		MKLINE(Scumm,camera._cur.y,sleInt16),
! 		MKLINE(Scumm,camera._last.x,sleInt16),
! 		MKLINE(Scumm,camera._last.y,sleInt16),
! 		MKLINE(Scumm,camera._accel.x,sleInt16),
! 		MKLINE(Scumm,camera._accel.y,sleInt16),
! 		MKLINE(Scumm,camera._follows,sleByte),
! 		MKLINE(Scumm,camera._movingToActor,sleUint16),
! #else
! 		MKLINE(Scumm,camera._dest.x,sleInt16),
! 		MKLINE(Scumm,camera._cur.x,sleInt16),
! 		MKLINE(Scumm,camera._last.x,sleInt16),
  		MKLINE(Scumm,_screenStartStrip,sleInt16),
  		MKLINE(Scumm,_screenEndStrip,sleInt16),
***************
*** 332,336 ****
  		MKLINE(Scumm,camera._rightTrigger,sleInt16),
  		MKLINE(Scumm,camera._movingToActor,sleUint16),
! 
  		MKLINE(Scumm,_actorToPrintStrFor,sleByte),
  		MKLINE(Scumm,_charsetColor,sleByte),
--- 350,354 ----
  		MKLINE(Scumm,camera._rightTrigger,sleInt16),
  		MKLINE(Scumm,camera._movingToActor,sleUint16),
! #endif
  		MKLINE(Scumm,_actorToPrintStrFor,sleByte),
  		MKLINE(Scumm,_charsetColor,sleByte),
***************
*** 387,392 ****
  		MKLINE(Scumm,_screenH,sleUint16),
  
- 		MKARRAY(Scumm,cost._transEffect[0],sleByte,256),
- 
  		MKEND()
  	};
--- 405,408 ----
***************
*** 476,481 ****
  		s->saveLoadArrayOf(_objectRoomTable, _numGlobalObjects, sizeof(_objectRoomTable[0]), sleByte);
  
! 	if (_shadowPalette)
! 		s->saveLoadArrayOf(_shadowPalette, NUM_SHADOW_PALETTE * 256, 1, sleByte);
  
  	s->saveLoadArrayOf(_classData, _numGlobalObjects, sizeof(_classData[0]), sleUint32);
--- 492,497 ----
  		s->saveLoadArrayOf(_objectRoomTable, _numGlobalObjects, sizeof(_objectRoomTable[0]), sleByte);
  
! 	if (_shadowPaletteSize)
! 		s->saveLoadArrayOf(_shadowPalette, _shadowPaletteSize, 1, sleByte);
  
  	s->saveLoadArrayOf(_classData, _numGlobalObjects, sizeof(_classData[0]), sleUint32);

Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/script.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** script.cpp	2001/12/11 13:34:15	1.16
--- script.cpp	2001/12/27 17:51:58	1.17
***************
*** 23,28 ****
  #include "scumm.h"
  
- #define NO_SOUND_HACK
- 
  void Scumm::runScript(int script, int a, int b, int16 *lvarptr) {
  	byte *scriptPtr;
--- 23,26 ----
***************
*** 32,40 ****
  	ScriptSlot *s;
  
- #ifdef NO_SOUND_HACK
- 	if (script==212 && _currentRoom==50)
- 		return;
- #endif
- 
  	if (script==0)
  		return;
--- 30,33 ----
***************
*** 527,531 ****
  		vm.slot[slot].number = 10001;
  		vm.slot[slot].where = WIO_ROOM;
! 		vm.slot[slot].offs = _EXCD_offs + 8;
  		vm.slot[slot].unk1 = 0;
  		vm.slot[slot].unk2 = 0;
--- 520,524 ----
  		vm.slot[slot].number = 10001;
  		vm.slot[slot].where = WIO_ROOM;
! 		vm.slot[slot].offs = _EXCD_offs;
  		vm.slot[slot].unk1 = 0;
  		vm.slot[slot].unk2 = 0;
***************
*** 545,549 ****
  		vm.slot[slot].number = 10002;
  		vm.slot[slot].where = WIO_ROOM;
! 		vm.slot[slot].offs = _ENCD_offs + 8;
  		vm.slot[slot].unk1 = 0;
  		vm.slot[slot].unk2 = 0;
--- 538,542 ----
  		vm.slot[slot].number = 10002;
  		vm.slot[slot].where = WIO_ROOM;
! 		vm.slot[slot].offs = _ENCD_offs;
  		vm.slot[slot].unk1 = 0;
  		vm.slot[slot].unk2 = 0;
***************
*** 701,705 ****
  		return 0;
  
! 	objptr = getObjectAddress(obj);
  	assert(objptr);
  
--- 694,698 ----
  		return 0;
  
! 	objptr = getOBCDFromObject(obj);
  	assert(objptr);
  
***************
*** 710,714 ****
  	verboffs = verbptr - objptr;
  
! 	verbptr += 8;
  	do {
  		if (!*verbptr)
--- 703,707 ----
  	verboffs = verbptr - objptr;
  
! 	verbptr += _resourceHeaderSize;
  	do {
  		if (!*verbptr)

Index: script_v1.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/script_v1.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** script_v1.cpp	2001/11/27 17:56:04	1.16
--- script_v1.cpp	2001/12/27 17:51:58	1.17
***************
*** 462,466 ****
  			break;
  		case 23: /* unk2 */
! 			a->unk1 = getVarOrDirectByte(0x80); /* unused? */
  			break;
  		default:
--- 462,466 ----
  			break;
  		case 23: /* unk2 */
! 			a->shadow_mode = getVarOrDirectByte(0x80); /* shadow mode */
  			break;
  		default:
***************
*** 585,589 ****
  		j = getVarOrDirectByte(0x40);
  		k = getVarOrDirectByte(0x20);
! 		setCursorHotspot(i, j, k);
  		break;
  
--- 585,589 ----
  		j = getVarOrDirectByte(0x40);
  		k = getVarOrDirectByte(0x20);
! 		setCursorHotspot2(j, k);
  		break;
  
***************
*** 896,903 ****
  void Scumm::o5_getDist() {
  	int o1,o2;
  	getResultPos();
  	o1 = getVarOrDirectWord(0x80);
  	o2 = getVarOrDirectWord(0x40);
! 	setResult(getObjActToObjActDist(o1,o2));
  }
  
--- 896,909 ----
  void Scumm::o5_getDist() {
  	int o1,o2;
+ 	int r;
  	getResultPos();
  	o1 = getVarOrDirectWord(0x80);
  	o2 = getVarOrDirectWord(0x40);
! 	r = getObjActToObjActDist(o1,o2);
! 	
! 	/* Fix for monkey 2, dunno what's wrong in scummvm */
! 	if (_gameId==GID_MONKEY2 && vm.slot[_currentScript].number==40 && r<60)
! 		r=60;
! 	setResult(r);
  }
  
***************
*** 1078,1087 ****
  
  	_vars[VAR_WALKTO_OBJ] = obj;
- 
  	startScene(a->room, a, obj);
- 
  	_vars[VAR_WALKTO_OBJ] = 0;
! 	camera._destPos = camera._curPos = a->x;
  	setCameraFollows(a);
  	_fullRedraw=1;
  
--- 1084,1095 ----
  
  	_vars[VAR_WALKTO_OBJ] = obj;
  	startScene(a->room, a, obj);
  	_vars[VAR_WALKTO_OBJ] = 0;
! 
! #if !defined(FULL_THROTTLE)
! 	camera._dest.x = camera._cur.x = a->x;
  	setCameraFollows(a);
+ #endif
+ 
  	_fullRedraw=1;
  
***************
*** 1145,1149 ****
  
  void Scumm::o5_panCameraTo() {
! 	panCameraTo(getVarOrDirectWord(0x80));
  }
  
--- 1153,1157 ----
  
  void Scumm::o5_panCameraTo() {
! 	panCameraTo(getVarOrDirectWord(0x80), 0);
  }
  
***************
*** 1324,1330 ****
  		b = getVarOrDirectWord(0x40);
  		if (a < 160) a=160;
- 		if (a > ((_scrWidthIn8Unit-20)<<3)) a=((_scrWidthIn8Unit-20)<<3);
  		if (b < 160) b=160;
! 		if (b > ((_scrWidthIn8Unit-20)<<3)) b=((_scrWidthIn8Unit-20)<<3);
  		_vars[VAR_CAMERA_MIN_X] = a;
  		_vars[VAR_CAMERA_MAX_X] = b;
--- 1332,1338 ----
  		b = getVarOrDirectWord(0x40);
  		if (a < 160) a=160;
  		if (b < 160) b=160;
! 		if (a > _scrWidth-160) a=_scrWidth-160;
! 		if (b > _scrWidth-160) b=_scrWidth-160;
  		_vars[VAR_CAMERA_MIN_X] = a;
  		_vars[VAR_CAMERA_MAX_X] = b;
***************
*** 1481,1512 ****
  
  void Scumm::o5_setObjectName() {
! 	int act = getVarOrDirectWord(0x80);
  	int size;
  	int a;
  	int i;
  
! 	if (act < NUM_ACTORS)
! 		error("Can't set actor %d name with new-name-of", act);
  
! 	if (!getObjectAddress(act))
! 		error("Can't set name of object %d", act);
  
! 	size = READ_BE_UINT32_UNALIGNED(getObjOrActorName(act) - 4)-9;
  	i = 0;
  
  	while ((a = fetchScriptByte()) != 0) {
! 		 getObjOrActorName(act)[i++] = a;
  
  		if (a==0xFF) {
! 			getObjOrActorName(act)[i++] = fetchScriptByte();
! 			getObjOrActorName(act)[i++] = fetchScriptByte();
! 			getObjOrActorName(act)[i++] = fetchScriptByte();
  		}
  
! 		if (i > size)
! 			error("New name of object %d too long", act);
  	}
  
! 	getObjOrActorName(act)[i] = 0;
  	runHook(0);
  }
--- 1489,1522 ----
  
  void Scumm::o5_setObjectName() {
! 	int obj = getVarOrDirectWord(0x80);
  	int size;
  	int a;
  	int i;
+ 	byte *name;
  
! 	if (obj < NUM_ACTORS)
! 		error("Can't set actor %d name with new-name-of", obj);
  
! 	if (!getOBCDFromObject(obj))
! 		error("Can't set name of object %d", obj);
  
! 	name = getObjOrActorName(obj);
! 	size = getResourceDataSize(name);
  	i = 0;
  
  	while ((a = fetchScriptByte()) != 0) {
! 		 name[i++] = a;
  
  		if (a==0xFF) {
! 			name[i++] = fetchScriptByte();
! 			name[i++] = fetchScriptByte();
! 			name[i++] = fetchScriptByte();
  		}
  
! 		if (i >= size)
! 			error("New name of object %d too long", obj);
  	}
  
! 	name[i] = 0;
  	runHook(0);
  }
***************
*** 1808,1812 ****
  		return;
  	case 3: /* wait for camera */
! 		if (camera._curPos>>3 != camera._destPos>>3)
  			break;
  		return;
--- 1818,1822 ----
  		return;
  	case 3: /* wait for camera */
! 		if (camera._cur.x>>3 != camera._dest.x>>3)
  			break;
  		return;

Index: script_v2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/script_v2.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** script_v2.cpp	2001/12/04 10:44:33	1.16
--- script_v2.cpp	2001/12/27 17:51:58	1.17
***************
*** 150,154 ****
  	&Scumm::o6_setObjectState,
  	&Scumm::o6_setObjectXY,
! 	&Scumm::o6_invalid,
  	/* 64 */
  	&Scumm::o6_invalid,
--- 150,154 ----
  	&Scumm::o6_setObjectState,
  	&Scumm::o6_setObjectXY,
! 	&Scumm::o6_drawBlastObject,
  	/* 64 */
  	&Scumm::o6_invalid,
***************
*** 205,209 ****
  	&Scumm::o6_getObjectX,
  	&Scumm::o6_getObjectY,
! 	&Scumm::o6_getObjectDir,
  	/* 90 */
  	&Scumm::o6_getActorWalkBox,
--- 205,209 ----
  	&Scumm::o6_getObjectX,
  	&Scumm::o6_getObjectY,
! 	&Scumm::o6_getObjectOldDir,
  	/* 90 */
  	&Scumm::o6_getActorWalkBox,
***************
*** 289,293 ****
  	&Scumm::o6_invalid,
  	&Scumm::o6_invalid,
! 	&Scumm::o6_invalid,
  	&Scumm::o6_invalid,
  	/* D4 */	
--- 289,293 ----
  	&Scumm::o6_invalid,
  	&Scumm::o6_invalid,
! 	&Scumm::o6_getAnimateVariable,
  	&Scumm::o6_invalid,
  	/* D4 */	
***************
*** 323,327 ****
  	/* EC */	
  	&Scumm::o6_invalid,
! 	&Scumm::o6_invalid,
  	&Scumm::o6_invalid,
  	&Scumm::o6_invalid,
--- 323,327 ----
  	/* EC */	
  	&Scumm::o6_invalid,
! 	&Scumm::o6_getObjectNewDir,
  	&Scumm::o6_invalid,
  	&Scumm::o6_invalid,
***************
*** 351,354 ****
--- 351,369 ----
  }
  
+ int Scumm::popRoomAndObj(int *room) {
+ 	int obj;
+ 
+ 	if (_features & GF_HAS_ROOMTABLE) {
+ 		obj = pop();
+ 		*room = getObjectRoom(obj);
+ 	} else {
+ 		*room = pop();
+ 		obj = pop();
+ 	}
+ 
+ 	return obj;
+ }
+ 
+ 
  int Scumm::readArray(int array, int index, int base) {
  	ArrayHeader *ah = (ArrayHeader*)getResourceAddress(rtString, readVar(array));
***************
*** 728,735 ****
  		_userPut--;
  		break;
! 	case 0x99:
! 		a = pop();
! 		setCursorImg(pop(), a, 1);
  		break;
  	case 0x9A:
  		a = pop();
--- 743,751 ----
  		_userPut--;
  		break;
! 	case 0x99: {
! 		int room,obj = popRoomAndObj(&room);
! 		setCursorImg(obj,room, 1);
  		break;
+ 	}
  	case 0x9A:
  		a = pop();
***************
*** 840,852 ****
  
  void Scumm::o6_panCameraTo() {
! 	panCameraTo(pop());
  }
  
  void Scumm::o6_actorFollowCamera() {
  	actorFollowCamera(pop());
  }
  
  void Scumm::o6_setCameraAt() {
  	setCameraAtEx(pop());
  }
  
--- 856,889 ----
  
  void Scumm::o6_panCameraTo() {
! #if defined(FULL_THROTTLE)
! 	int y = pop();
! 	int x = pop();
! 	panCameraTo(x,y);
! #else
! 	panCameraTo(pop(), 0);
! #endif
  }
  
  void Scumm::o6_actorFollowCamera() {
+ #if defined(FULL_THROTTLE)
+ 	setCameraFollows(derefActorSafe(pop(), "actorFollowCamera"));
+ #else
  	actorFollowCamera(pop());
+ #endif
  }
  
  void Scumm::o6_setCameraAt() {
+ #if defined(FULL_THROTTLE)
+ 	int x,y;
+ 
+ 	camera._follows = 0;
+ 
+ 	y = pop();
+ 	x = pop();
+ 
+ 	setCameraAt(x,y);
+ #else
  	setCameraAtEx(pop());
+ #endif
  }
  
***************
*** 925,939 ****
  }
  
  void Scumm::o6_putActorAtObject() {
  	int room,obj,x,y;
  	Actor *a;
  
! 	if (_features & GF_HAS_ROOMTABLE) {
! 		obj = pop();
! 		room = getObjectRoom(obj);
! 	} else {
! 		room = pop();
! 		obj = pop();
! 	}
  
  	a = derefActorSafe(pop(), "o6_putActorAtObject");
--- 962,971 ----
  }
  
+ 
  void Scumm::o6_putActorAtObject() {
  	int room,obj,x,y;
  	Actor *a;
  
! 	obj=popRoomAndObj(&room);
  
  	a = derefActorSafe(pop(), "o6_putActorAtObject");
***************
*** 985,997 ****
  	int i;
  
! 	if (_features & GF_HAS_ROOMTABLE) {
! 		obj = pop();
! 		room = getObjectRoom(obj);
! 	} else {
! 		room = pop();
! 		obj = pop();
! 		if (room==0)
! 			room = _roomResource;
! 	}
  
  	for(i=1; i<_maxInventoryItems; i++) {
--- 1017,1023 ----
  	int i;
  
! 	obj=popRoomAndObj(&room);
! 	if (room==0)
! 		room = _roomResource;
  
  	for(i=1; i<_maxInventoryItems; i++) {
***************
*** 1018,1030 ****
  	y = pop();
  	x = pop();
- 	
- 	if (_features & GF_HAS_ROOMTABLE) {
- 		obj = pop();
- 		room = getObjectRoom(obj);
- 	} else {
- 		room = pop();
- 		obj = pop();
- 	}
  	
  	a = derefActorSafe(_vars[VAR_EGO], "o_loadRoomWithEgo");
  
--- 1044,1050 ----
  	y = pop();
  	x = pop();
  	
+ 	obj=popRoomAndObj(&room);
+ 
  	a = derefActorSafe(_vars[VAR_EGO], "o_loadRoomWithEgo");
  
***************
*** 1037,1042 ****
  
  	/* startScene maybe modifies VAR_EGO, i hope not */
! 	camera._destPos = camera._curPos = a->x;
  	setCameraFollows(a);
  	_fullRedraw=1;
  	if (x != -1) {
--- 1057,1064 ----
  
  	/* startScene maybe modifies VAR_EGO, i hope not */
! #if !defined(FULL_THROTTLE)
! 	camera._dest.x = camera._cur.x = a->x;
  	setCameraFollows(a);
+ #endif
  	_fullRedraw=1;
  	if (x != -1) {
***************
*** 1084,1095 ****
  }
  
! void Scumm::o6_getObjectDir() {
! 	int dir = getObjDir(pop());
! 
! 	if (_features & GF_USE_ANGLES) {
! 		dir = oldDirToNewDir(dir);
! 	}
  
! 	push(dir);
  }
  
--- 1106,1115 ----
  }
  
! void Scumm::o6_getObjectOldDir() {
! 	push(getObjOldDir(pop()));
! }
  
! void Scumm::o6_getObjectNewDir() {
! 	push(getObjNewDir(pop()));
  }
  
***************
*** 1137,1141 ****
  		error("Can't set actor %d name with new-name-of", obj);
  
! 	if (!getObjectAddress(obj))
  		error("Can't set name of object %d", obj);
  
--- 1157,1161 ----
  		error("Can't set actor %d name with new-name-of", obj);
  
! 	if (!getOBCDFromObject(obj))
  		error("Can't set name of object %d", obj);
  
***************
*** 1190,1193 ****
--- 1210,1217 ----
  	case 100: /* load script */
  		res = pop();
+ #if defined(FULL_THROTTLE)
+ 		if (res >= _numGlobalScripts)
+ 			break;
+ #endif
  		ensureResourceLoaded(rtScript, res);
  		break;
***************
*** 1206,1209 ****
--- 1230,1237 ----
  	case 104: /* nuke script */
  		res = pop();
+ #if defined(FULL_THROTTLE)
+ 		if (res >= _numGlobalScripts)
+ 			break;
+ #endif
  		setResourceCounter(rtScript, res, 0x7F);
  		debug(5, "nuke script %d", res);
***************
*** 1274,1281 ****
  		nukeCharset(res);
  		break;
! 	case 119:/* load fl object */
! 		res = (_features & GF_HAS_ROOMTABLE) ? -1 : pop();
! 		loadFlObject(pop(), res);
  		break;
  	default:
  		error("o6_resourceRoutines: default case");
--- 1302,1310 ----
  		nukeCharset(res);
  		break;
! 	case 119: {/* load fl object */
! 		int room,obj = popRoomAndObj(&room);
! 		loadFlObject(obj,room);
  		break;
+ 	}
  	default:
  		error("o6_resourceRoutines: default case");
***************
*** 1291,1297 ****
  		a = pop();
  		if (a < 160) a=160;
! 		if (a > ((_scrWidthIn8Unit-20)<<3)) a=((_scrWidthIn8Unit-20)<<3);
  		if (b < 160) b=160;
! 		if (b > ((_scrWidthIn8Unit-20)<<3)) b=((_scrWidthIn8Unit-20)<<3);
  		_vars[VAR_CAMERA_MIN_X] = a;
  		_vars[VAR_CAMERA_MAX_X] = b;
--- 1320,1326 ----
  		a = pop();
  		if (a < 160) a=160;
! 		if (a > _scrWidth) a=_scrWidth;
  		if (b < 160) b=160;
! 		if (b > _scrHeight) b=_scrHeight;
  		_vars[VAR_CAMERA_MIN_X] = a;
  		_vars[VAR_CAMERA_MAX_X] = b;
***************
*** 1499,1503 ****
  		break;
  	case 98:
! 		a->unk1 = pop();
  		break;
  	case 99:
--- 1528,1532 ----
  		break;
  	case 98:
! 		a->shadow_mode = pop();
  		break;
  	case 99:
***************
*** 1505,1508 ****
--- 1534,1541 ----
  		a->new_2 = pop();
  		break;
+ 	case 198: /* set anim variable */
+ 		i = pop(); /* value */
+ 		setAnimVar(a, pop(), i);
+ 		break;
  	case 215:
  		a->new_3 = 1;
***************
*** 1514,1530 ****
  		initActor(a, 2);
  		break;
  	case 235: /* talk_script */
  		a->talk_script = pop();
  		break;
- 	
- 	case 198: /* set anim variable */
- 	case 227: /* actor_unk2 */
- 	case 228: /* actor script */
  	case 229: /* stand */
! 	case 230: /* turn? */
! 	case 231: /* turn? */
! 	case 233: /* ? */
! 	case 234: /* ? */
! 
  	default:
  		error("o6_actorset: default case %d", b);
--- 1547,1576 ----
  		initActor(a, 2);
  		break;
+ 	case 227: /* actor_layer */
+ 		a->layer = pop();
+ 		break;
+ 	case 228: /* walk script */
+ 		a->walk_script = pop();
+ 		break;
  	case 235: /* talk_script */
  		a->talk_script = pop();
  		break;
  	case 229: /* stand */
! 		stopActorMoving(a);
! 		startAnimActor(a, a->standFrame);
! 		break;
! 	case 230: /* set direction */
! 		a->moving&=~4;
! 		fixActorDirection(a, pop());
! 		break;
! 	case 231: /* turn to direction */
! 		turnToDirection(a, pop());
! 		break;
! 	case 233: /* freeze actor */
! 		a->moving|=0x80;
! 		break;
! 	case 234: /* unfreeze actor */
! 		a->moving&=~0x7f;
! 		break;
  	default:
  		error("o6_actorset: default case %d", b);
***************
*** 1788,1799 ****
  	
  	switch(fetchScriptByte()) {
! 	case 168:
  		if (derefActorSafe(pop(), "o6_wait")->moving) {
! 			_scriptPointer += (int16)fetchScriptWord();
  			o6_breakHere();
- 		} else {
- 			fetchScriptWord();
  		}
  		return;
  	case 169:
  		if (_vars[VAR_HAVE_MSG])
--- 1834,1845 ----
  	
  	switch(fetchScriptByte()) {
! 	case 168: {
! 		int offs = (int16)fetchScriptWord();
  		if (derefActorSafe(pop(), "o6_wait")->moving) {
! 			_scriptPointer += offs;
  			o6_breakHere();
  		}
  		return;
+ 	}
  	case 169:
  		if (_vars[VAR_HAVE_MSG])
***************
*** 1801,1806 ****
  		return;
  	case 170:
! 		if (camera._curPos>>3 != camera._destPos>>3)
  			break;
  		return;
  	case 171:
--- 1847,1858 ----
  		return;
  	case 170:
! #if !defined(FULL_THROTTLE)
! 		if (camera._cur.x>>3 != camera._dest.x>>3)
  			break;
+ #else
+ 		if (camera._dest.x != camera._cur.x ||
+ 			  camera._dest.y != camera._cur.y)
+ 				break;
+ #endif
  		return;
  	case 171:
***************
*** 1814,1817 ****
--- 1866,1887 ----
  			return;
  		break;
+ 	case 226: { /* wait until actor drawn */
+ 		Actor *a = derefActorSafe(pop(), "o6_wait:226");
+ 		int offs = (int16)fetchScriptWord();
+ 		if (a->room==_currentRoom && a->needRedraw) {
+ 			_scriptPointer += offs;
+ 			o6_breakHere();
+ 		}
+ 		return;
+ 	}
+ 	case 232: { /* wait until actor stops turning */
+ 		Actor *a = derefActorSafe(pop(), "o6_wait:226");
+ 		int offs = (int16)fetchScriptWord();
+ 		if (a->room==_currentRoom && a->moving&4) {
+ 			_scriptPointer += offs;
+ 			o6_breakHere();
+ 		}
+ 		return;
+ 	}
  	default:
  		error("o6_wait: default case");
***************
*** 1830,1833 ****
--- 1900,1908 ----
  }
  
+ void Scumm::o6_getAnimateVariable() {
+ 	int var = pop();
+ 	push(getAnimVar(derefActorSafe(pop(),"o6_getAnimateVariable"), var));
+ }
+ 
  void Scumm::o6_soundKludge() {
  	int16 list[16];
***************
*** 2049,2052 ****
--- 2124,2140 ----
  }
  
+ void Scumm::o6_drawBlastObject() {
+ 	int16 args[16];
+ 	int a,b,c,d,e;
+ 
+ 	getStackList(args,sizeof(args)/sizeof(args[0]));
+ 	e = pop();
+ 	d = pop();
+ 	c = pop();
+ 	b = pop();
+ 	a = pop();
+ 	enqueueObject(a, b, c, d, e, 0xFF, 0xFF, 1, 0);
+ }
+ 
  void Scumm::o6_miscOps() {
  	int16 args[30];
***************
*** 2085,2091 ****
  		warning("o6_miscOps: stub15(%d)", args[1]);
  		break;
! 	case 16:
! 		warning("o6_miscOps: stub16(%d,%d,%d,%d)",args[1],args[2],args[3],args[4]);
  		break;
  	case 17:
  		warning("o6_miscOps: stub17(%d,%d,%d,%d)",args[1],args[2],args[3],args[4]);
--- 2173,2183 ----
  		warning("o6_miscOps: stub15(%d)", args[1]);
  		break;
! 	case 16: {
! 		byte buf[200];
! 		_msgPtrToAdd = buf;
! 		addMessageToStack(getStringAddress(_vars[VAR_STRING2DRAW]));
! 		warning("o6_miscOps: drawString(%s,charset=%d,color=%d,x=%d,y=%d)",buf, args[1],args[2],args[3],args[4]);
  		break;
+ 	}
  	case 17:
  		warning("o6_miscOps: stub17(%d,%d,%d,%d)",args[1],args[2],args[3],args[4]);
***************
*** 2110,2120 ****
  		break;
  	case 117:
! 		warning("o6_miscOps: stub117()");
  		break;
  	case 118:
! 		warning("o6_miscOps: stub118(%d,%d,%d,%d,%d,%d,%d,%d)",args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8]);
  		break;
  	case 119:
! 		warning("o6_miscOps: stub119(%d,%d,%d,%d,%d,%d,%d,%d)",args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8]);
  		break;
  	case 120:
--- 2202,2212 ----
  		break;
  	case 117:
! 		freezeScripts(2);
  		break;
  	case 118:
! 		enqueueObject(args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8], 3);
  		break;
  	case 119:
! 		enqueueObject(args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8], 0);
  		break;
  	case 120:
***************
*** 2184,2188 ****
  	case 111:
  		a = derefActorSafe(args[1], "o6_miscops: 111");
! 		a->unk1 = args[2] + args[3];
  		break;
  
--- 2276,2280 ----
  	case 111:
  		a = derefActorSafe(args[1], "o6_miscops: 111");
! 		a->shadow_mode = args[2] + args[3];
  		break;
  
***************
*** 2209,2213 ****
  	case 119:
  		enqueueObject(args[1], args[2], args[3], args[4], args[5],
! 			args[6], args[7], args[8]);
  		break;
  
--- 2301,2305 ----
  	case 119:
  		enqueueObject(args[1], args[2], args[3], args[4], args[5],
! 			args[6], args[7], args[8], 0);
  		break;
  

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -d -r1.35 -r1.36
*** scumm.h	2001/12/11 13:34:15	1.35
--- scumm.h	2001/12/27 17:51:58	1.36
***************
*** 77,81 ****
  
  struct RoomHeader {
- 	uint32 tag, size;
  #ifdef FULL_THROTTLE
  	uint32 version;
--- 77,80 ----
***************
*** 86,90 ****
  
  struct BompHeader {
- 	uint32 tag,size;
  	uint16 unk;
  	uint16 width,height;
--- 85,88 ----
***************
*** 92,97 ****
  
  struct AkosHeader {
- 	uint32 tag;
- 	uint32 size;
  	byte x_1[2];
  	byte flags;
--- 90,93 ----
***************
*** 115,120 ****
  #if defined(FULL_THROTTLE)
  struct CodeHeader {
- 	uint32 tag;
- 	uint32 size;
  	uint32 version;
  	uint16 obj_id;
--- 111,114 ----
***************
*** 125,130 ****
  #else
  struct CodeHeader {
- 	uint32 id;
- 	uint32 size;
  	uint16 obj_id;
  
--- 119,122 ----
***************
*** 153,158 ****
  #if defined(FULL_THROTTLE)
  struct ImageHeader { /* file format */
- 	uint32 tag;
- 	uint32 size;
  	uint32 version;
  	uint16 obj_id;
--- 145,148 ----
***************
*** 169,178 ****
  #else
  struct ImageHeader { /* file format */
- 	uint32 id;
- 	uint32 size;
  	uint16 obj_id;
  	uint16 unk[5];
! 	uint16 img_w;
! 	uint16 img_h;
  	uint16 unk_2;
  	struct {
--- 159,166 ----
  #else
  struct ImageHeader { /* file format */
  	uint16 obj_id;
  	uint16 unk[5];
! 	uint16 width;
! 	uint16 height;
  	uint16 unk_2;
  	struct {
***************
*** 399,402 ****
--- 387,395 ----
  	VAR_TIMER = 14,
  	VAR_TMR_4 = 15,
+ 	VAR_LEFTBTN_DOWN = 22,
+ 	VAR_RIGHTBTN_DOWN = 23,
+ 	VAR_LEFTBTN_HOLD = 24,
+ 	VAR_RIGHTBTN_HOLD = 25,
+ 
  	VAR_PERFORMANCE_1 = 26,
  	VAR_PERFORMANCE_2 = 27,
***************
*** 434,439 ****
  	VAR_CAMERA_MIN_Y = 103,
  	VAR_CAMERA_MAX_Y = 104,
! 	VAR_CAMERA_FAST_X = 105,
! 	VAR_CAMERA_FAST_Y = 106,
  	VAR_CAMERA_SPEED_X = 107,
  	VAR_CAMERA_SPEED_Y = 108,
--- 427,432 ----
  	VAR_CAMERA_MIN_Y = 103,
  	VAR_CAMERA_MAX_Y = 104,
! 	VAR_CAMERA_THRESHOLD_X = 105,
! 	VAR_CAMERA_THRESHOLD_Y = 106,
  	VAR_CAMERA_SPEED_X = 107,
  	VAR_CAMERA_SPEED_Y = 108,
***************
*** 448,451 ****
--- 441,446 ----
  	VAR_CHARINC = 115,
  	VAR_DEBUGMODE = 116,
+ 
+ 	VAR_CHARSET_MASK = 119,
  	
  	//VAR_V5_DRAWFLAGS = 9,
***************
*** 457,461 ****
  
  	VAR_V6_EMSSPACE = 76,
! 	
  };
  
--- 452,457 ----
  
  	VAR_V6_EMSSPACE = 76,
! 
! 	VAR_STRING2DRAW = 130,
  };
  
***************
*** 596,605 ****
  	byte scale_x, scale_y; /* scaling */
  	byte clipping; /* clip mask */
! 	byte actor_unk1;
  	uint16 codec;
  	bool mirror; /* draw actor mirrored */
  	byte dirty_id;
  	byte *outptr;
! 	int outwidth, outheight;
  	
  	/* pointer to various parts of the costume resource */
--- 592,602 ----
  	byte scale_x, scale_y; /* scaling */
  	byte clipping; /* clip mask */
! 	bool charsetmask;
! 	byte shadow_mode;
  	uint16 codec;
  	bool mirror; /* draw actor mirrored */
  	byte dirty_id;
  	byte *outptr;
! 	uint outwidth, outheight;
  	
  	/* pointer to various parts of the costume resource */
***************
*** 615,618 ****
--- 612,616 ----
  	
  	byte *srcptr;
+ 	byte *shadow_table;
  
  	struct {
***************
*** 629,633 ****
  		int skip_width;
  		byte *destptr;
! 		byte *mask_ptr,*mask_ptr_dest;
  		int imgbufoffs;
  	} v1;
--- 627,631 ----
  		int skip_width;
  		byte *destptr;
! 		byte *mask_ptr;
  		int imgbufoffs;
  	} v1;
***************
*** 639,643 ****
  	byte *akcd;
  
- 
  	byte palette[256];
  };
--- 637,640 ----
***************
*** 652,660 ****
  };
  
! struct CostumeRenderer {
! 	Scumm *_vm;
  	byte *_ptr;
- 	byte _numColors;
  	byte *_dataptr;
  	byte *_frameptr;
  	byte *_srcptr;
--- 649,666 ----
  };
  
! struct LoadedCostume {
  	byte *_ptr;
  	byte *_dataptr;
+ 	byte _numColors;
+ 	
+ };
+ 
+ struct CostumeRenderer {
+ 	Scumm *_vm;
+ 	
+ 	LoadedCostume _loaded;
+ 		
+ 	byte *_shadow_table;
+ 
  	byte *_frameptr;
  	byte *_srcptr;
***************
*** 672,676 ****
  	int _height;
  	int _xpos, _ypos;
! 	
  	int _scaleIndexXStep;
  	int _scaleIndexYStep;
--- 678,683 ----
  	int _height;
  	int _xpos, _ypos;
! 
! 	uint _outheight;
  	int _scaleIndexXStep;
  	int _scaleIndexYStep;
***************
*** 681,685 ****
  	int _top,_bottom;
  	int _ypostop;
- 	uint _vscreenheight;
  	int _ypitch;
  	byte _docontinue;
--- 688,691 ----
***************
*** 700,709 ****
  	void ignorePakCols(int num);
  
- 	void loadCostume(int id);
  	byte drawOneSlot(Actor *a, int slot);
  	byte drawCostume(Actor *a);
  
- 	byte animateOneSlot(Actor *a, int slot);
- 	byte animate(Actor *a);
  };
  
--- 706,712 ----
***************
*** 725,732 ****
  	byte initFrame,walkFrame,standFrame,talkFrame1,talkFrame2;
  	bool needRedraw, needBgReset,costumeNeedsInit,visible;
! 	byte unk1;
! #if defined(FULL_THROTTLE)
  	bool flip;
- #endif
  	uint speedx,speedy;
  	byte frame;
--- 728,733 ----
  	byte initFrame,walkFrame,standFrame,talkFrame1,talkFrame2;
  	bool needRedraw, needBgReset,costumeNeedsInit,visible;
! 	byte shadow_mode;
  	bool flip;
  	uint speedx,speedy;
  	byte frame;
***************
*** 737,740 ****
--- 738,742 ----
  	uint16 talk_script, walk_script;
  	byte new_3;
+ 	int8 layer;
  	ActorWalkData walkdata;
  //#if defined(FULL_THROTTLE)
***************
*** 746,755 ****
  };
  
  struct CameraData {
! 	int16 _destPos, _curPos, _lastPos;
! 	int16 _leftTrigger, _rightTrigger;
  	byte _follows, _mode;
! 	uint16 _movingToActor;
  };
  
  #define ARRAY_HDR_SIZE 6
--- 748,770 ----
  };
  
+ #if defined(FULL_THROTTLE)
  struct CameraData {
! 	Point _cur;
! 	Point _dest;
! 	Point _accel;
! 	Point _last;
! 	byte _follows;
! 	bool _movingToActor;
! };
! #else
! struct CameraData {
! 	Point _cur;
! 	Point _dest;
! 	Point _last;
! 	int _leftTrigger, _rightTrigger;
  	byte _follows, _mode;
! 	bool _movingToActor;
  };
+ #endif
  
  #define ARRAY_HDR_SIZE 6
***************
*** 829,834 ****
  	byte *_backupIsWhere;
  	
- 	byte _mouseMask[0x200];
- 
  	void unkDecode1();
  	void unkDecode2();
--- 844,847 ----
***************
*** 890,893 ****
--- 903,907 ----
  	GF_HAS_ROOMTABLE = GF_AFTER_V7,
  	GF_USE_KEY = 8,
+ 	GF_NEW_COSTUMES = GF_AFTER_V7,
  	GF_USE_ANGLES = GF_AFTER_V7,
  	GF_DRAWOBJ_OTHER_ORDER = 16,
***************
*** 908,911 ****
--- 922,930 ----
  };
  
+ enum MouseButtonStatus {
+ 	msDown = 1,
+ 	msClicked = 2,
+ };
+ 
  struct BoxCoords {
  	Point ul;
***************
*** 1020,1023 ****
--- 1039,1044 ----
  	byte _switchRoomEffect2, _switchRoomEffect;
  
+ 	int _resourceHeaderSize;
+ 
  	bool _egoPositioned;
  	bool _doEffect;
***************
*** 1056,1061 ****
  	byte _actorToPrintStrFor;
  
! 	int16 _screenStartStrip;
! 	int16 _screenEndStrip;
  
  	byte _fastMode;
--- 1077,1085 ----
  	byte _actorToPrintStrFor;
  
! 	int _screenStartStrip;
! 	int _screenEndStrip;
! 
! 	int _screenLeft;
! 	int _screenTop;
  
  	byte _fastMode;
***************
*** 1139,1142 ****
--- 1163,1167 ----
  
  	byte *_shadowPalette;
+ 	int _shadowPaletteSize;
  	
  //	int _numSoundTags;
***************
*** 1161,1166 ****
  	StringTab string[6];
  
- 	CostumeRenderer cost;
- 
  	uint16 _mouthSyncTimes[52];
  
--- 1186,1189 ----
***************
*** 1180,1184 ****
  	uint16 _curExecScript;
  
! 	int _scrWidthIn8Unit;
  	int _scrHeight;
  
--- 1203,1207 ----
  	uint16 _curExecScript;
  
! 	int _scrWidth;
  	int _scrHeight;
  
***************
*** 1212,1216 ****
  	int _boxMatrixItem;
  
! 	byte _grabbedCursor[1024];
  
  	char _saveLoadName[32];
--- 1235,1239 ----
  	int _boxMatrixItem;
  
! 	byte _grabbedCursor[2048];
  
  	char _saveLoadName[32];
***************
*** 1331,1335 ****
  	void initActorCostumeData(Actor *a);
  	void fixActorDirection(Actor *a, int direction);
! 	void decodeCostData(Actor *a, int frame, uint mask);
  
  	void scummInit();
--- 1354,1358 ----
  	void initActorCostumeData(Actor *a);
  	void fixActorDirection(Actor *a, int direction);
! 	void cpst_decodeData(Actor *a, int frame, uint mask);
  
  	void scummInit();
***************
*** 1543,1547 ****
  	void o6_getObjectX();
  	void o6_getObjectY();
! 	void o6_getObjectDir();
  	void o6_getActorWalkBox();
  	void o6_getActorCostume();
--- 1566,1571 ----
  	void o6_getObjectX();
  	void o6_getObjectY();
! 	void o6_getObjectOldDir();
! 	void o6_getObjectNewDir();
  	void o6_getActorWalkBox();
  	void o6_getActorCostume();
***************
*** 1603,1606 ****
--- 1627,1634 ----
  	void o6_isRoomScriptRunning();
  	void o6_kernelFunction();
+ 	void o6_getAnimateVariable();
+ 	void o6_drawBlastObject();
+ 
+ 	int popRoomAndObj(int *room);
  
  	void soundKludge(int16 *list);
***************
*** 1633,1637 ****
  	AdjustBoxResult getClosestPtOnBox(int box, int x, int y);
  
! 	void setCameraAt(int dest);
  	void stopTalk();
  	void restoreCharsetBg();
--- 1661,1665 ----
  	AdjustBoxResult getClosestPtOnBox(int box, int x, int y);
  
! 	void setCameraAt(int pos_x, int pos_y);
  	void stopTalk();
  	void restoreCharsetBg();
***************
*** 1724,1728 ****
  	int findPathTowards(Actor *a, byte box, byte box2, byte box3);
  
- 	void setActorCostPalette(Actor *a);
  	void drawActorCostume(Actor *a);
  	void actorAnimate(Actor *a);
--- 1752,1755 ----
***************
*** 1744,1748 ****
  
  	void setCursorImg(uint img, uint room, uint imgindex);
! 	void setCursorHotspot(int cursor, int x, int y);
  	void initCharset(int charset);
  	void addObjectToDrawQue(int object);
--- 1771,1775 ----
  
  	void setCursorImg(uint img, uint room, uint imgindex);
! //	void setCursorHotspot(int cursor, int x, int y);
  	void initCharset(int charset);
  	void addObjectToDrawQue(int object);
***************
*** 1769,1773 ****
  	int getVerbSlot(int id, int mode);
  	void killVerb(int slot);
! 	byte *getObjectAddress(int obj);
  	byte *getObjOrActorName(int obj);
  	void clearOwnerOf(int obj);
--- 1796,1800 ----
  	int getVerbSlot(int id, int mode);
  	void killVerb(int slot);
! 	byte *getOBCDFromObject(int obj);
  	byte *getObjOrActorName(int obj);
  	void clearOwnerOf(int obj);
***************
*** 1814,1819 ****
  	Actor *getFirstActor() { return actor; } 
  
- 	void setupCostumeRenderer(CostumeRenderer *c, Actor *a);
- 
  	PathVertex *unkMatrixProc1(PathVertex *vtx, PathNode *node);
  	PathNode *unkMatrixProc2(PathVertex *vtx, int i);
--- 1841,1844 ----
***************
*** 1836,1843 ****
  
  	void setOwnerOf(int obj, int owner);
! 	void panCameraTo(int x);
  	void actorFollowCamera(int act);
  	void setCameraAtEx(int at);
  
  	void setCursorHotspot2(int x,int y);
  
--- 1861,1870 ----
  
  	void setOwnerOf(int obj, int owner);
! 	void panCameraTo(int x, int y);
  	void actorFollowCamera(int act);
  	void setCameraAtEx(int at);
  
+ 	void clampCameraPos(Point *pt);
+ 
  	void setCursorHotspot2(int x,int y);
  
***************
*** 1850,1854 ****
  	int getObjX(int obj);
  	int getObjY(int obj);
! 	int getObjDir(int obj);
  	int findInventory(int owner, int index);
  	int getInventoryCount(int owner);
--- 1877,1882 ----
  	int getObjX(int obj);
  	int getObjY(int obj);
! 	int getObjOldDir(int obj);
! 	int getObjNewDir(int obj);
  	int findInventory(int owner, int index);
  	int getInventoryCount(int owner);
***************
*** 1933,1937 ****
  	void swapPalColors(int a, int b);
  
! 	void enqueueObject(int a, int b, int c, int d, int e, int f, int g, int h);
  
  	void clearEnqueue() { _enqueuePos = 0; }
--- 1961,1965 ----
  	void swapPalColors(int a, int b);
  
! 	void enqueueObject(int a, int b, int c, int d, int e, int f, int g, int h, int mode);
  
  	void clearEnqueue() { _enqueuePos = 0; }
***************
*** 1974,1982 ****
  
  	byte *findResourceData(uint32 tag, byte *ptr);
  
  	void akos_decodeData(Actor *a, int frame, uint usemask);
  	int akos_frameToAnim(Actor *a, int frame);
  	bool akos_hasManyDirections(Actor *a);
! 	void stopActorMoving(Actor *a) { a->moving = 0; }
  
  	int newDirToOldDir(int dir);
--- 2002,2011 ----
  
  	byte *findResourceData(uint32 tag, byte *ptr);
+ 	int getResourceDataSize(byte *ptr);
  
  	void akos_decodeData(Actor *a, int frame, uint usemask);
  	int akos_frameToAnim(Actor *a, int frame);
  	bool akos_hasManyDirections(Actor *a);
! 	void stopActorMoving(Actor *a);
  
  	int newDirToOldDir(int dir);
***************
*** 1996,2000 ****
  	void akos_codec16(AkosRenderer *ar);
  	void akos_codec1_ignorePakCols(AkosRenderer *ar, int num);
- 	void akos_c1_spec1(AkosRenderer *ar);
  	void akos_c1_spec2(AkosRenderer *ar);
  	void akos_c1_spec3(AkosRenderer *ar);
--- 2025,2028 ----
***************
*** 2020,2025 ****
  
  	static int normalizeAngle(int angle);
! 	static int fromSimpleDir(int dir);
! 	static int toSimpleDir(int dir);
  
  	void doSentence(int c, int b, int a);
--- 2048,2054 ----
  
  	static int normalizeAngle(int angle);
! 	static int fromSimpleDir(int dirtype, int dir);
! 	static int toSimpleDir(int dirtype, int dir);
! 	static int numSimpleDirDirections(int dirType);
  
  	void doSentence(int c, int b, int a);
***************
*** 2029,2032 ****
--- 2058,2069 ----
  
  	void drawBomp(BompDrawData *bd);
+ 	void loadCostume(LoadedCostume *lc, int costume);
+ 
+ 	void cost_setPalette(CostumeRenderer *cr, byte *palette);
+ 	void cost_setFacing(CostumeRenderer *cr, Actor *a);
+ 	void cost_setCostume(CostumeRenderer *cr, int costume);
+ 	byte cost_increaseAnims(LoadedCostume *lc, Actor *a);
+ 	byte cost_increaseAnim(LoadedCostume *lc, Actor *a, int slot);
+ 	void cost_decodeData(Actor *a, int frame, uint usemask);
  };
  

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scummvm.cpp,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** scummvm.cpp	2001/12/04 21:44:41	1.30
--- scummvm.cpp	2001/12/27 17:51:58	1.31
***************
*** 47,50 ****
--- 47,52 ----
  	debug(9, "scummInit");
  
+ 	_resourceHeaderSize = 8;
+ 
  	loadCharset(1);
  	initScreens(0, 16, 320, 144);
***************
*** 81,87 ****
--- 83,91 ----
  	}
  
+ #if !defined(FULL_THROTTLE)
  	camera._leftTrigger = 10;
  	camera._rightTrigger = 30;
  	camera._mode = 0;
+ #endif
  	camera._follows = 0;
  
***************
*** 173,177 ****
  
  	charset._vm = this;
- 	cost._vm = this;
  	gdi._vm = this;
  
--- 177,180 ----
***************
*** 248,252 ****
  	processKbd();
  
! 	_vars[VAR_CAMERA_POS_X] = camera._curPos;
  	_vars[VAR_HAVE_MSG] = _haveMsg;
  	_vars[VAR_VIRT_MOUSE_X] = _virtual_mouse_x;
--- 251,260 ----
  	processKbd();
  
! #if defined(FULL_THROTTLE)
! 	_vars[VAR_CAMERA_POS_X] = camera._cur.x;
! 	_vars[VAR_CAMERA_POS_Y] = camera._cur.y;
! #else
! 	_vars[VAR_CAMERA_POS_X] = camera._cur.x;
! #endif
  	_vars[VAR_HAVE_MSG] = _haveMsg;
  	_vars[VAR_VIRT_MOUSE_X] = _virtual_mouse_x;
***************
*** 294,298 ****
  		drawDirtyScreenParts();
  		processSoundQues();
! 		camera._lastPos = camera._curPos;
  	} else {
  		walkActors();
--- 302,306 ----
  		drawDirtyScreenParts();
  		processSoundQues();
! 		camera._last = camera._cur;
  	} else {
  		walkActors();
***************
*** 300,304 ****
  		fixObjectFlags();
  		CHARSET_1();
! 		if (camera._curPos != camera._lastPos || _BgNeedsRedraw || _fullRedraw) {
  			redrawBGAreas();
  		}
--- 308,318 ----
  		fixObjectFlags();
  		CHARSET_1();
! #if !defined(FULL_THROTTLE)
! 		if (camera._cur.x != camera._last.x || _BgNeedsRedraw || _fullRedraw) {
! #else
! 		if (camera._cur.x != camera._last.x || 
! 			  camera._cur.y != camera._last.y || _BgNeedsRedraw || 
! 				_fullRedraw) {
! #endif
  			redrawBGAreas();
  		}
***************
*** 336,340 ****
  
  		processSoundQues();
! 		camera._lastPos = camera._curPos;
  	}
  
--- 350,354 ----
  
  		processSoundQues();
! 		camera._last = camera._cur;
  	}
  
***************
*** 480,492 ****
  	runExitScript();
  	killScriptsAndResources();
  	stopCycle(0);
! 	
  	for(i=1,at=getFirstActor(); ++at,i<NUM_ACTORS; i++) {
  		if (at->visible)
  			hideActor(at);
  	}
! 
! 	for (i=0; i<0x100; i++)
! 		cost._transEffect[i] = i;
  
  	clearDrawObjectQueue();
--- 494,509 ----
  	runExitScript();
  	killScriptsAndResources();
+ 	clearEnqueue();
  	stopCycle(0);
! 
  	for(i=1,at=getFirstActor(); ++at,i<NUM_ACTORS; i++) {
  		if (at->visible)
  			hideActor(at);
  	}
! 	
! 	if (!(_features & GF_AFTER_V7)) {
! 		for (i=0; i<0x100; i++)
! 			_shadowPalette[i] = i;
! 	}
  
  	clearDrawObjectQueue();
***************
*** 519,538 ****
  
  	initRoomSubBlocks();
- 
  	loadRoomObjects();
  
  	camera._mode = CM_NORMAL;
! 	camera._curPos = camera._destPos = 160;
  
  	if (_features&GF_AFTER_V6) {
! 		_vars[VAR_V6_SCREEN_WIDTH] = _scrWidthIn8Unit<<3;
  		_vars[VAR_V6_SCREEN_HEIGHT] = _scrHeight;
  	}
  
  	if (_roomResource == 0)
  		return;
  
- 	_vars[VAR_CAMERA_MAX_X] = (_scrWidthIn8Unit<<3) - 160;
- 	_vars[VAR_CAMERA_MIN_X] = 160;
  
  	memset(gfxUsageBits, 0, sizeof(gfxUsageBits));
--- 536,565 ----
  
  	initRoomSubBlocks();
  	loadRoomObjects();
  
+ #if !defined(FULL_THROTTLE)
  	camera._mode = CM_NORMAL;
! 	camera._cur.x = camera._dest.x = 160;
! #endif
  
  	if (_features&GF_AFTER_V6) {
! 		_vars[VAR_V6_SCREEN_WIDTH] = _scrWidth;
  		_vars[VAR_V6_SCREEN_HEIGHT] = _scrHeight;
  	}
  
+ #if defined(FULL_THROTTLE)
+ 	_vars[VAR_CAMERA_MIN_X] = 160;
+ 	_vars[VAR_CAMERA_MAX_X] = _scrWidth - 160;
+ 	_vars[VAR_CAMERA_MIN_Y] = 100;
+ 	_vars[VAR_CAMERA_MAX_Y] = _scrHeight - 100;
+ 	setCameraAt(160, 100);
+ #else
+ 	_vars[VAR_CAMERA_MAX_X] = _scrWidth - 160;
+ 	_vars[VAR_CAMERA_MIN_X] = 160;
+ #endif
+ 
  	if (_roomResource == 0)
  		return;
  
  
  	memset(gfxUsageBits, 0, sizeof(gfxUsageBits));
***************
*** 552,555 ****
--- 579,584 ----
  	_egoPositioned = false;
  	runEntryScript();
+ 
+ #if !defined(FULL_THROTTLE)
  	if (a && !_egoPositioned) {
  		getObjectXYPos(objectNr);
***************
*** 557,560 ****
--- 586,595 ----
  		a->moving = 0;
  	}
+ #else
+ 	if (camera._follows) {
+ 		Actor *a = derefActorSafe(camera._follows, "startScene: follows");
+ 		setCameraAt(a->x, a->y);
+ 	}
+ #endif
  
  	_doEffect = true;
***************
*** 567,570 ****
--- 602,606 ----
  	byte *ptr;
  	byte *roomptr,*searchptr;
+ 	RoomHeader *rmhd;
  
  	_ENCD_offs = 0;
***************
*** 581,633 ****
  	roomptr = getResourceAddress(rtRoom, _roomResource);
  	
! 	ptr = findResource(MKID('RMHD'), roomptr);
! 	_scrWidthIn8Unit = READ_LE_UINT16(&((RoomHeader*)ptr)->width) >> 3;
! 	_scrHeight = READ_LE_UINT16(&((RoomHeader*)ptr)->height);
  
  	_IM00_offs = findResource(MKID('IM00'), findResource(MKID('RMIM'), roomptr))
  		- roomptr;
  	
! 	ptr = findResource(MKID('EXCD'), roomptr);
  	if (ptr) {
  		_EXCD_offs = ptr - roomptr;
  #ifdef DUMP_SCRIPTS
! 		dumpResource("exit-", _roomResource, ptr);
  #endif
  	}
  
! 	ptr = findResource(MKID('ENCD'), roomptr);
  	if (ptr) {
  		_ENCD_offs = ptr - roomptr;
  #ifdef DUMP_SCRIPTS
! 		dumpResource("entry-", _roomResource, ptr);
  #endif
  	}
  	
! 	ptr = findResource(MKID('BOXD'), roomptr);
  	if (ptr) {
! 		int size = READ_BE_UINT32_UNALIGNED(ptr+4);
! 		createResource(rtMatrix, 2, size);
  		roomptr = getResourceAddress(rtRoom, _roomResource);
! 		ptr = findResource(MKID('BOXD'), roomptr);
  		memcpy(getResourceAddress(rtMatrix, 2), ptr, size);
  	}
  
! 	ptr = findResource(MKID('BOXM'), roomptr);
  	if (ptr) {
! 		int size = READ_BE_UINT32_UNALIGNED(ptr+4);
  		createResource(rtMatrix, 1, size);
  		roomptr = getResourceAddress(rtRoom, _roomResource);
! 		ptr = findResource(MKID('BOXM'), roomptr);
  		memcpy(getResourceAddress(rtMatrix, 1), ptr, size);
  	}
  
! 	ptr = findResource(MKID('SCAL'), roomptr);
  	if (ptr) {
  		offs = ptr - roomptr;
  		for (i=1; i<_maxScaleTable; i++, offs+=8) {
! 			int a = READ_LE_UINT16(roomptr + offs + 8);
! 			int b = READ_LE_UINT16(roomptr + offs + 10);
! 			int c = READ_LE_UINT16(roomptr + offs + 12);
! 			int d = READ_LE_UINT16(roomptr + offs + 14);
  			if (a || b || c || d) {
  				setScaleItem(i, b, a, d, c);
--- 617,669 ----
  	roomptr = getResourceAddress(rtRoom, _roomResource);
  	
! 	rmhd = (RoomHeader*)findResourceData(MKID('RMHD'), roomptr);
! 	_scrWidth = READ_LE_UINT16(&rmhd->width);
! 	_scrHeight = READ_LE_UINT16(&rmhd->height);
  
  	_IM00_offs = findResource(MKID('IM00'), findResource(MKID('RMIM'), roomptr))
  		- roomptr;
  	
! 	ptr = findResourceData(MKID('EXCD'), roomptr);
  	if (ptr) {
  		_EXCD_offs = ptr - roomptr;
  #ifdef DUMP_SCRIPTS
! 		dumpResource("exit-", _roomResource, ptr - 8);
  #endif
  	}
  
! 	ptr = findResourceData(MKID('ENCD'), roomptr);
  	if (ptr) {
  		_ENCD_offs = ptr - roomptr;
  #ifdef DUMP_SCRIPTS
! 		dumpResource("entry-", _roomResource, ptr - 8);
  #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);
  	if (ptr) {
  		offs = ptr - roomptr;
  		for (i=1; i<_maxScaleTable; i++, offs+=8) {
! 			int a = READ_LE_UINT16(roomptr + offs);
! 			int b = READ_LE_UINT16(roomptr + offs + 2);
! 			int c = READ_LE_UINT16(roomptr + offs + 4);
! 			int d = READ_LE_UINT16(roomptr + offs + 6);
  			if (a || b || c || d) {
  				setScaleItem(i, b, a, d, c);
***************
*** 641,651 ****
  	while( (ptr = findResource(MKID('LSCR'), searchptr)) != NULL ) {
  		int id;
  #ifdef FULL_THROTTLE
! 		id = READ_LE_UINT16(ptr + 8);
  		checkRange(2050, 2000, id, "Invalid local script %d");
! 		_localScriptList[id - _numGlobalScripts] = ptr + 10 - roomptr;
  #else
! 		id = ptr[8];
! 		_localScriptList[id - _numGlobalScripts] = ptr + 9 - roomptr;
  #endif
  #ifdef DUMP_SCRIPTS
--- 677,689 ----
  	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
***************
*** 653,657 ****
  			char buf[32];
  			sprintf(buf,"room-%d-",_roomResource);
! 			dumpResource(buf, id, ptr);
  		} while (0);
  #endif
--- 691,695 ----
  			char buf[32];
  			sprintf(buf,"room-%d-",_roomResource);
! 			dumpResource(buf, id, ptr - 8);
  		} while (0);
  #endif
***************
*** 664,668 ****
  		_EPAL_offs = ptr - roomptr;
  	
! 	ptr = findResource(MKID('CLUT'), roomptr);
  	if (ptr) {
  		_CLUT_offs = ptr - roomptr;
--- 702,706 ----
  		_EPAL_offs = ptr - roomptr;
  	
! 	ptr = findResourceData(MKID('CLUT'), roomptr);
  	if (ptr) {
  		_CLUT_offs = ptr - roomptr;
***************
*** 678,686 ****
  	}
  	
! 	initCycl(findResource(MKID('CYCL'), roomptr) + 8);
  
! 	ptr = findResource(MKID('TRNS'), roomptr);
  	if (ptr)
! 		gdi._transparency = ptr[8];
  	else
  		gdi._transparency = 255;
--- 716,724 ----
  	}
  	
! 	initCycl(findResourceData(MKID('CYCL'), roomptr));
  
! 	ptr = findResourceData(MKID('TRNS'), roomptr);
  	if (ptr)
! 		gdi._transparency = ptr[0];
  	else
  		gdi._transparency = 255;
***************
*** 818,833 ****
  	if (mouse.y>199) mouse.y=199;
  
! 	if (_leftBtnPressed&1 && _rightBtnPressed&1) {
  		_mouseButStat = 0;
  		_lastKeyHit = _vars[VAR_CUTSCENEEXIT_KEY];
! 	} else if (_leftBtnPressed&1) {
  		_mouseButStat = MBS_LEFT_CLICK;
! 	} else if (_rightBtnPressed&1) {
  		_mouseButStat = MBS_RIGHT_CLICK;
  	}
- 	
- 	_leftBtnPressed &= ~1;
- 	_rightBtnPressed &= ~1;
  
  	return _lastKeyHit;
  }
--- 856,878 ----
  	if (mouse.y>199) mouse.y=199;
  
! 	if (_leftBtnPressed&msClicked && _rightBtnPressed&msClicked) {
  		_mouseButStat = 0;
  		_lastKeyHit = _vars[VAR_CUTSCENEEXIT_KEY];
! 	} else if (_leftBtnPressed&msClicked) {
  		_mouseButStat = MBS_LEFT_CLICK;
! 	} else if (_rightBtnPressed&msClicked) {
  		_mouseButStat = MBS_RIGHT_CLICK;
  	}
  
+ #if defined(FULL_THROTTLE)
+ //	_vars[VAR_LEFTBTN_DOWN] = (_leftBtnPressed&msClicked) != 0;
+ 	_vars[VAR_LEFTBTN_HOLD] = (_leftBtnPressed&msDown) != 0;
+ //	_vars[VAR_RIGHTBTN_DOWN] = (_rightBtnPressed&msClicked) != 0;
+ 	_vars[VAR_RIGHTBTN_HOLD] = (_rightBtnPressed&msDown) != 0;
+ #endif
+ 
+ 	_leftBtnPressed &= ~msClicked;
+ 	_rightBtnPressed &= ~msClicked;
+ 
  	return _lastKeyHit;
  }
***************
*** 918,933 ****
  }
  
! int Scumm::toSimpleDir(int dir) {
! 	if (dir>=71 && dir<=109)
! 		return 1;
! 	if (dir>=109 && dir<=251)
! 		return 2;
! 	if (dir>=251 && dir<=289)
! 		return 3;
  	return 0;
  }
  
! int Scumm::fromSimpleDir(int dir) {
! 	return dir * 90;
  }
  
--- 963,1002 ----
  }
  
! 
! const uint16 many_direction_tab[18] = {
! 	71,	109,	251,	530,
! 	0,
! 	0,
! 	0,
! 	0,
! 	22,72,107,
! 	157,
! 	202,
! 	252,
! 	287,
! 	337
! };
! 
! 
! int Scumm::numSimpleDirDirections(int dirType) {
! 	return dirType ? 8 : 4;
! }
! 
! /* Convert an angle to a simple direction */
! int Scumm::toSimpleDir(int dirType, int dir) {
! 	int num = dirType ? 8 : 4, i;
! 	const uint16 *dirtab = &many_direction_tab[dirType*8];
! 	for(i=1;i<num;i++,dirtab++) {
! 		if (dir >= dirtab[0] && dir <= dirtab[1])
! 			return i;
! 	}
  	return 0;
+ 
  }
  
! /* Convert a simple direction to an angle */
! int Scumm::fromSimpleDir(int dirType, int dir) {
! 	if (!dirType)dir+=dir;
! 	return dir * 45;
  }
  

Index: scummvm.dsp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scummvm.dsp,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** scummvm.dsp	2001/12/04 10:44:33	1.16
--- scummvm.dsp	2001/12/27 17:51:58	1.17
***************
*** 67,71 ****
  # PROP Target_Dir ""
  # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
! # ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "./sound" /I "./" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "ALLOW_GDI" /D "BYPASS_COPY_PROT" /D "USE_ADLIB" /Yu"stdafx.h" /FD /GZ /c
  # SUBTRACT CPP /Fr
  # ADD BASE RSC /l 0x41d /d "_DEBUG"
--- 67,71 ----
  # PROP Target_Dir ""
  # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
! # ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "./sound" /I "./" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "ALLOW_GDI" /D "BYPASS_COPY_PROT" /D "USE_ADLIB" /D "DUMP_SCRIPTS" /D "FULL_THROTTLE" /D "CHECK_HEAP" /Yu"stdafx.h" /FD /GZ /c
  # SUBTRACT CPP /Fr
  # ADD BASE RSC /l 0x41d /d "_DEBUG"

Index: sdl.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sdl.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** sdl.cpp	2001/12/11 13:34:15	1.26
--- sdl.cpp	2001/12/27 17:51:58	1.27
***************
*** 140,147 ****
  			case SDL_MOUSEBUTTONDOWN:
  				if (event.button.button==SDL_BUTTON_LEFT)
! 					s->_leftBtnPressed |= 1;
  				else if (event.button.button==SDL_BUTTON_RIGHT)
! 					s->_rightBtnPressed |= 1;
  				break;
  			case SDL_QUIT:
  				exit(1);
--- 140,154 ----
  			case SDL_MOUSEBUTTONDOWN:
  				if (event.button.button==SDL_BUTTON_LEFT)
! 					s->_leftBtnPressed |= msClicked|msDown;
  				else if (event.button.button==SDL_BUTTON_RIGHT)
! 					s->_rightBtnPressed |= msClicked|msDown;
! 				break;
! 			case SDL_MOUSEBUTTONUP:
! 				if (event.button.button==SDL_BUTTON_LEFT)
! 					s->_leftBtnPressed &= ~msDown;
! 				else if (event.button.button==SDL_BUTTON_RIGHT)
! 					s->_rightBtnPressed &= ~msDown;
  				break;
+ 
  			case SDL_QUIT:
  				exit(1);
***************
*** 166,170 ****
  
  #define BAK_WIDTH 40
! #define BAK_HEIGHT 24
  byte old_backup[BAK_WIDTH*BAK_HEIGHT*2];
  
--- 173,177 ----
  
  #define BAK_WIDTH 40
! #define BAK_HEIGHT 40
  byte old_backup[BAK_WIDTH*BAK_HEIGHT*2];
  
***************
*** 253,256 ****
--- 260,264 ----
  	if (fullRedraw) {
  		SDL_UpdateRect(screen, 0,0,0,0);
+ 		fullRedraw = false;
  #if defined(SHOW_AREA)
  		debug(2,"update area 100 %%");
***************
*** 277,280 ****
--- 285,290 ----
  	if (hide_mouse)
  		visible = false;
+ 
+ 	assert(w<=BAK_WIDTH && h<=BAK_HEIGHT);
  
  	if (SDL_LockSurface(screen)==-1)

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** sound.cpp	2001/12/01 17:06:13	1.12
--- sound.cpp	2001/12/27 17:51:58	1.13
***************
*** 321,324 ****
--- 321,326 ----
  	byte *data;
  
+ 	/* Full throttle audio fix HERE */
+ 
  	if (fread(&hdr, sizeof(hdr), 1, (FILE*)file) != 1 || 
  		memcmp(hdr.id, VALID_VOC_ID, sizeof(hdr.id)) != 0) {

Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/string.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** string.cpp	2001/12/04 10:44:33	1.12
--- string.cpp	2001/12/27 17:51:58	1.13
***************
*** 178,185 ****
  	byte *buffer;
  
! 	if (!_haveMsg || (camera._destPos>>3) != (camera._curPos>>3) ||
! 			camera._curPos != camera._lastPos 
  		) return;
! 
  	a = NULL;
  	if (_vars[VAR_TALK_ACTOR] != 0xFF)
--- 178,189 ----
  	byte *buffer;
  
! #if !defined(FULL_THROTTLE)
! 	if (!_haveMsg || (camera._dest.x>>3) != (camera._cur.x>>3) ||
! 			camera._cur.x != camera._last.x 
  		) return;
! #else
! 	if (!_haveMsg)
! 		return;
! #endif
  	a = NULL;
  	if (_vars[VAR_TALK_ACTOR] != 0xFF)
***************
*** 188,192 ****
  	if (a && string[0].overhead!=0) {
  		if (!(_features & GF_AFTER_V6)) {
! 			string[0].xpos = a->x - camera._curPos + 160;
  
  			if (_vars[VAR_V5_TALK_STRING_Y] < 0) {
--- 192,196 ----
  	if (a && string[0].overhead!=0) {
  		if (!(_features & GF_AFTER_V6)) {
! 			string[0].xpos = a->x - camera._cur.x + 160;
  
  			if (_vars[VAR_V5_TALK_STRING_Y] < 0) {
***************
*** 210,214 ****
  			
  			s = a->scalex * a->new_2 / 0xFF;
! 			string[0].xpos = ((a->new_2 - s)>>1) + s + a->x - camera._curPos + 160;
  			if (string[0].xpos < 80)
  				string[0].xpos = 80;
--- 214,218 ----
  			
  			s = a->scalex * a->new_2 / 0xFF;
! 			string[0].xpos = ((a->new_2 - s)>>1) + s + a->x - camera._cur.x + 160;
  			if (string[0].xpos < 80)
  				string[0].xpos = 80;

Index: verbs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/verbs.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** verbs.cpp	2001/11/26 19:57:57	1.11
--- verbs.cpp	2001/12/27 17:51:58	1.12
***************
*** 168,173 ****
  	int imgw, imgh;
  	int i,tmp;
- 	byte *IMHD_ptr;
  	byte *obim;
  
  	if ((vs=findVirtScreen(y)) == NULL)
--- 168,173 ----
  	int imgw, imgh;
  	int i,tmp;
  	byte *obim;
+ 	ImageHeader *imhd;
  
  	if ((vs=findVirtScreen(y)) == NULL)
***************
*** 184,193 ****
  	ydiff = y - vs->topline;
  
- 
  	obim = getResourceAddress(rtVerb, vrb);
- 	IMHD_ptr = findResource(MKID('IMHD'), obim);
  
! 	imgw = READ_LE_UINT16(IMHD_ptr+0x14) >> 3;
! 	imgh = READ_LE_UINT16(IMHD_ptr+0x16) >> 3;
  	
  	imptr = findResource(MKID('IM01'), obim);
--- 184,192 ----
  	ydiff = y - vs->topline;
  
  	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);

Index: windows.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/windows.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** windows.cpp	2001/12/11 13:34:15	1.22
--- windows.cpp	2001/12/27 17:51:58	1.23
***************
*** 19,34 ****
   */
  
- #if USE_DIRECTX
- #define INITGUID
- #include <ddraw.h>
- #endif
- 
  #include "stdafx.h"
  #include <assert.h>
  
- #if USE_DRAWDIB
- #include <vfw.h>
- #endif
- 
  #include "scumm.h"
  #include "sound.h"
--- 19,25 ----
***************
*** 74,79 ****
  
  #if USE_GDI
- //	BITMAPINFO *biHeader;
- //	byte *BmpBG;
  public:
  	DIB dib;
--- 65,68 ----
***************
*** 81,89 ****
  #endif
  
- #if USE_DRAWDIB
- 	BITMAPINFOHEADER *biHeader;
- 	HDRAWDIB hdb;
- #endif
- 
  public:
  	byte *_vgabuf;
--- 70,73 ----
***************
*** 91,103 ****
  	Scumm *_scumm;
  
- #if USE_DIRECTX
- 	IDirectDrawSurface4 *MainSurf,*Surf2;
- 	IDirectDraw *DxObject;
- 	IDirectDraw4 *Dx4Object;
- 	IDirectDrawPalette *DxPal;
- 	bool OutOfGame;
- 	void InitDirectX();
- #endif
- 
  	HANDLE _event;
  	DWORD _threadId;
--- 75,78 ----
***************
*** 154,159 ****
  		case WM_DESTROY:
  		case WM_CLOSE:
- //			TerminateThread((void*)wm->_threadId, 0);
- //			wm->_scumm->destroy();
  			exit(0);
  			break;
--- 129,132 ----
***************
*** 196,203 ****
  			break;
  		case WM_LBUTTONDOWN:
! 			wm->_scumm->_leftBtnPressed |= 1;
  			break;
  		case WM_RBUTTONDOWN:
! 			wm->_scumm->_rightBtnPressed |= 1;
  			break;
  		default:
--- 169,182 ----
  			break;
  		case WM_LBUTTONDOWN:
! 			wm->_scumm->_leftBtnPressed |= msClicked|msDown;
! 			break;
! 		case WM_LBUTTONUP:
! 			wm->_scumm->_leftBtnPressed &= ~msDown;
  			break;
  		case WM_RBUTTONDOWN:
! 			wm->_scumm->_rightBtnPressed |= msClicked|msDown;
! 			break;
! 		case WM_RBUTTONUP:
! 			wm->_scumm->_rightBtnPressed &= ~msDown;
  			break;
  		default:
***************
*** 209,255 ****
  #if USE_GDI
  
- void copy_320x200_to_640x400(byte *s, byte *d) {
- 	_asm {
- 		push ebp
- 
- 		mov esi,s
- 		mov edi,d
- 		
- 		mov ebp,SRC_HEIGHT
- 		againouter:
- 
- 		mov ebx,320/4
- 		againinner:
- 			mov eax,[esi]
- 			mov dl,ah
- 			mov dh,ah
- 			shl edx,16
- 			mov dl,al
- 			mov dh,al
- 			shr eax,16
- 			mov cl,ah
- 			mov	ch,ah
- 			shl ecx,16
- 			mov cl,al
- 			mov ch,al
- 
- 			mov [edi],edx
- 			mov [edi+4],ecx
- 			mov [edi+640],edx
- 			mov [edi+644],ecx
- 
- 			add esi,4
- 			add edi,8
- 
- 			dec ebx
- 		jnz againinner
- //		add esi,15
- 		add edi,640
- 		dec ebp
- 		jnz againouter
- 		pop ebp
- 	}
- }
- 
  bool WndMan::allocateDIB(int w, int h) {
  	struct {
--- 188,191 ----
***************
*** 282,290 ****
  	HDC dc,bmpdc;
  	HBITMAP bmpOld;
- //	if (!BmpBG)
- //		BmpBG = (byte*)LocalAlloc(LMEM_FIXED, DEST_WIDTH*DEST_HEIGHT);
- #if DEST_WIDTH==640
- 	copy_320x200_to_640x400(_vgabuf, dib.buf);
- #endif
  #if DEST_WIDTH==320
  	if (_vgabuf) {
--- 218,221 ----
***************
*** 295,300 ****
  #endif
  
- //	setsel(dib.buf);
- 
  	r.left = r.top = 0;
  	r.right = DEST_WIDTH;
--- 226,229 ----
***************
*** 312,323 ****
  
  	SetStretchBltMode(dc, BLACKONWHITE);
- #if DEST_WIDTH==640
- 	StretchBlt(dc, r.left, r.top, r.right-r.left, r.bottom-r.top, bmpdc, 0, 0, 640,480, SRCCOPY);
- #endif
  
  #if DEST_WIDTH==320
  	StretchBlt(dc, r.left, r.top, r.right-r.left, r.bottom-r.top, bmpdc, 0, 0, 320,200, SRCCOPY);
  #endif
- //	//StretchDIBits(dc, r.left, r.top, r.right - r.left, r.bottom - r.top, 0, 0, DEST_WIDTH, DEST_HEIGHT, BmpBG, biHeader, DIB_RGB_COLORS, SRCCOPY);
  
  
--- 241,248 ----
***************
*** 330,334 ****
  	int i;
  
- #if 1
  	for (i=0; i<256; i++) {
  		dib.pal[i].rgbRed = ctab[i*3+0];
--- 255,258 ----
***************
*** 336,346 ****
  		dib.pal[i].rgbBlue = ctab[i*3+2];
  	}
- #else
- 	for (i=0; i<256; i++) {
- 		dib.pal[i].rgbRed = i;
- 		dib.pal[i].rgbGreen = i;
- 		dib.pal[i].rgbBlue = i;
- 	}
- #endif
  
  	dib.new_pal = true;
--- 260,263 ----
***************
*** 349,615 ****
  #endif
  
- #if USE_DIRECTX
- 
- void WndMan::writeToScreen() {
- 	RECT r;
- 	DDSURFACEDESC2 dd;
- 
- 	r.left = r.top = 0;
- 	r.right = SRC_WIDTH;
- 	r.bottom = SRC_HEIGHT;
- 
- 	if (OutOfGame) {
- 		if (GetForegroundWindow() != hWnd) return;
- 		OutOfGame = false;
- 	}
- 	
- 	dd.dwSize = sizeof(dd);
- 	
- 	int j;
- 	do {
- 		j = MainSurf->Lock(NULL, &dd, DDLOCK_WRITEONLY, NULL);
- 		if (j!=DDERR_SURFACELOST) break;
- 		if (MainSurf->Restore() != DD_OK) {
- 			OutOfGame = true;
- 			return;
- 		}
- 	} while (1);
- 	
- 	if (j == DD_OK) {
- 		byte *d = (byte*)dd.lpSurface;
- 		byte *s = _vgabuf;
- 
- 		for(int h=SRC_HEIGHT;--h>=0; ) {
- 			memcpy(d, s, SRC_WIDTH);
- 			d+=dd.lPitch;
- 			s+=SRC_PITCH;
- 		}
- 
- 		MainSurf->Unlock(NULL);
- 	}
- }
- 
- void WndMan::setPalette(byte *ctab, int first, int num) {
- 	PALETTEENTRY pal[256];
- 
- 	for (int i=0; i<256; i++) {
- 		pal[i].peFlags = 0;
- 		pal[i].peRed = *ctab++;
- 		pal[i].peGreen = *ctab++;
- 		pal[i].peBlue = *ctab++;
- 	}
- 
- 	DxPal->SetEntries(0, 0, 256, (PALETTEENTRY*)&pal);
- }
- 
- IDirectDrawSurface4 *CreateMainSurface(IDirectDraw4 *dd);
- 
- void WndMan::InitDirectX() {
- 	
- 	if (DirectDrawCreate(NULL, &DxObject, NULL) != DD_OK) Error("DirectDrawCreate failed!");
- 	if (DxObject->QueryInterface(IID_IDirectDraw4, (void**)&Dx4Object) != DD_OK) Error("QueryInterface failed!");
- 
- if (Dx4Object->SetCooperativeLevel(hWnd,DDSCL_NORMAL) != DD_OK) Error("SetCooperativeLevel failed!");
- 
- 	DDCAPS ddcaps;
- 	BOOL bHasOverlay, bHasColorKey, bCanStretch;
- 	ddcaps.dwSize = sizeof( ddcaps );
- 	if (Dx4Object->GetCaps(&ddcaps, NULL ) != DD_OK) Error("GetCaps failed!");
- 
- 	/* Determine if the hardware supports overlay surfaces */
- 	bHasOverlay = ddcaps.dwCaps & DDCAPS_OVERLAY;
- 
- 	/* Determine if the hardware supports colorkeying */
- 	bHasColorKey = ((ddcaps.dwCaps & DDCAPS_COLORKEY) == DDCAPS_COLORKEY) ? TRUE : FALSE;
- 
- 	/* Determine if the hardware supports scaling of the overlay surface */
- 	bCanStretch = ((ddcaps.dwCaps & DDCAPS_OVERLAYSTRETCH) == DDCAPS_OVERLAYSTRETCH) ? TRUE : FALSE;
- 
-    if ( ( ddcaps.dwCaps & DDCAPS_ALIGNBOUNDARYDEST ) ||
-         ( ddcaps.dwCaps & DDCAPS_ALIGNBOUNDARYSRC ) ||
-         ( ddcaps.dwCaps & DDCAPS_ALIGNSIZEDEST ) ||
-         ( ddcaps.dwCaps & DDCAPS_ALIGNSIZESRC ) ) {
- 
- 			Error("Alignment restriction!");
- 	}
- 
-     // Are any overlays available for use?
-   if ( ddcaps.dwMaxVisibleOverlays == 
- 				ddcaps.dwCurrVisibleOverlays )
- 	{
- 		Error("No overlay free");
- 
- 	}
- 
- 
- 	if (!bHasOverlay || !bHasColorKey || !bCanStretch) {
- 		Error("Bad hardware!");
- 	}
- 
- 	/* Create primary surface */
- 		
- 	DDSURFACEDESC2 ddsd;
- 	DDSCAPS ddscaps;
- 	LPDIRECTDRAWSURFACE4 lpFrontBuffer;
- 	LPDIRECTDRAWSURFACE4 lpBackBuffer;
- 	LPDIRECTDRAWSURFACE4 lpPrimary;
- 	HRESULT LastError;
- 	RECT rectOverlaySource, rectOverlayDest;
- 	DDOVERLAYFX ddofx;
- 
- 	
- 
- //	if (!CreateMainSurface(Dx4Object))
- //		Error("sad");
- 
- 	/* Create the primary surface */
- 	memset(&ddsd, 0, sizeof(ddsd));
- 	ddsd.dwSize = sizeof(ddsd);
- 	ddsd.dwFlags = DDSD_CAPS  | DDSD_BACKBUFFERCOUNT;
- 	ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE|DDSCAPS_FLIP |
-                               DDSCAPS_COMPLEX |
-                               DDSCAPS_VIDEOMEMORY;
- 	ddsd.dwBackBufferCount = 1;
- 
- 	if (Dx4Object->CreateSurface(&ddsd, &lpPrimary, NULL) != DD_OK)
- 		Error("Main surface creation failed!");
- 	
- 	/* Create a flippable scaleable overlay surface */
- 	ddsd.dwSize = sizeof(ddsd);
- 	ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_BACKBUFFERCOUNT | DDSD_PIXELFORMAT;
- 	ddsd.ddsCaps.dwCaps = DDSCAPS_OVERLAY | DDSCAPS_FLIP | DDSCAPS_COMPLEX | DDSCAPS_VIDEOMEMORY;
- 	ddsd.dwBackBufferCount = 1; /* One back buffer for triple buffering, set to 2 */
- 	ddsd.dwWidth = 320;
- 	ddsd.dwHeight = 240; 
- //	ddsd.ddckCKDestOverlay.dwColorSpaceLowValue = 0x123456;
- //	ddsd.ddckCKDestOverlay.dwColorSpaceHighValue = 0x123456;
- 
- 
- 	ddsd.ddpfPixelFormat.dwSize = sizeof(ddsd.ddpfPixelFormat);
- 
-   ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB;
-   ddsd.ddpfPixelFormat.dwFourCC = 0;
-   ddsd.ddpfPixelFormat.dwRGBBitCount = 16;
-   ddsd.ddpfPixelFormat.dwRBitMask = 0x7C00;	//0x7C00 is a hexadecimal memory address
-   ddsd.ddpfPixelFormat.dwGBitMask = 0x03e0;
-   ddsd.ddpfPixelFormat.dwBBitMask = 0x001F;
-   ddsd.ddpfPixelFormat.dwRGBAlphaBitMask = 0;
- 
- //	ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB | DDPF_PALETTEINDEXED8;
- //	ddsd.ddpfPixelFormat.dwRGBBitCount = 8;
- 
- 	if ((LastError = Dx4Object->CreateSurface(&ddsd, &lpFrontBuffer, NULL)) != DD_OK) {
- 		if (LastError==DDERR_NOOVERLAYHW )
- 			Error("No hardware!");
- 		else
- 			Error("2nd surface failed");
- 	}
- 
- #if 0
- 	if (Dx4Object->SetCooperativeLevel(hWnd, DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE) != DD_OK) Error("SetCooperativeLevel failed!");
- 	//	if (Dx4Object->SetDisplayMode(SRC_WIDTH,SRC_HEIGHT,8,0,DDSDM_STANDARDVGAMODE) != DD_OK) Error("SetDisplayMode failed!");
- 	if (!(MainSurf = CreateMainSurface(Dx4Object))) Error("CreateMainSurface failed!");
- 	if (!(Surf2 = Create2ndSurface(Dx4Object, _vgabuf))) Error("Create 2ndSurface failed!");
- 	if (!(DxPal = CreateGamePalette(Dx4Object))) Error("CreateGamePalette failed!");
- 	if (MainSurf->SetPalette(DxPal) != DD_OK) Error("SetPalette Failed!");
- #endif
- 
- }
- 
- 
- IDirectDrawSurface4 *CreateMainSurface(IDirectDraw4 *dd) {
- 	DDSURFACEDESC2 d;
- 	IDirectDrawSurface4 *ds;
- 
- //	if(dd->GetGDISurface(&ds) != DD_OK)
- //		return NULL;
- 
- 	memset(&d, 0, sizeof(d));
- 
- 	d.dwSize = sizeof(d);
- 	d.dwFlags = DDSD_CAPS;
- 	d.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
- 	
- 	int i;
- 	if ((i = dd->CreateSurface(&d, &ds, NULL)) != DD_OK)
- 		return NULL;	
- 	
- 	return ds;
- }
- 
- 
- IDirectDrawSurface4 *Create2ndSurface(IDirectDraw4 *dd, byte *surfmem) {
- 	DDSURFACEDESC2 d;
- 	IDirectDrawSurface4 *ds;
- 
- 	memset(&d, 0, sizeof(d));
- 
- 	d.dwSize = sizeof(d);
- 	d.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PITCH | /*DDSD_LPSURFACE |*/ DDSD_PIXELFORMAT;
- 	d.dwWidth = 640/*SRC_WIDTH*/;
- 	d.dwHeight = 480/*SRC_HEIGHT*/;
- 	d.lPitch = 640;
- 	d.lpSurface = surfmem;
- 
- 	d.ddpfPixelFormat.dwSize  = sizeof(DDPIXELFORMAT);
- 	d.ddpfPixelFormat.dwFlags = DDPF_RGB | DDPF_PALETTEINDEXED8;
- 	d.ddpfPixelFormat.dwRGBBitCount = 8;
- 
- 	d.ddsCaps.dwCaps = DDSCAPS_OVERLAY;
- 
- 	int i;
- 	if ((i = dd->CreateSurface(&d, &ds, NULL)) != DD_OK)
- 		return NULL;
- 	return ds;
- }
- 
- IDirectDrawPalette *CreateGamePalette(IDirectDraw4 *dd) {
- 	PALETTEENTRY pal[256];
- 	int i;
- 	IDirectDrawPalette *p;
- 
- 	memset(&pal, 0, sizeof(pal));
- 	if ((i=dd->CreatePalette(DDPCAPS_8BIT | DDPCAPS_ALLOW256, pal, &p, NULL)) != DD_OK)
- 		return NULL;
- 
- 	return p;
- }
- 
- #endif
- 
- #if USE_DRAWDIB
- void WndMan::writeToScreen() {
- 	RECT r;
- 	HDC dc;
- 
- 	r.left = r.top = 0;
- 	r.right = DEST_WIDTH/2;
- 	r.bottom = DEST_HEIGHT/2;
- 
- 	dc = GetDC(hWnd);
- 	
- 	DrawDibRealize(hdb, dc, TRUE);
- 	DrawDibDraw(hdb, dc, r.left, r.top, r.right-r.left, r.bottom-r.top, biHeader, _vgabuf, 0, 0, 320, 240, 0);
- 	
- //		StretchDIBits(dc, r.left, r.top, r.right - r.left, r.bottom - r.top, 0, 0, DEST_WIDTH, DEST_HEIGHT, BmpBG, biHeader, DIB_RGB_COLORS, SRCCOPY);
- 	ReleaseDC(hWnd, dc);
- }
- 
- void WndMan::setPalette(byte *ctab, int first, int num) {
- 	PALETTEENTRY pal[256];
- 	for (int i=0; i < num; i++,ctab+=3) {
- 		pal[i].peFlags = 0;
- 		pal[i].peRed = ctab[0];
- 		pal[i].peGreen = ctab[1];
- 		pal[i].peBlue = ctab[2];
- 	}
- 
- 	DrawDibChangePalette(hdb, 0, 16, pal);
- 
- 	GetLastError();
- }
- 
- 
- #endif
  HWND globWnd;
  
--- 266,269 ----
***************
*** 636,658 ****
  		Error("Cannot register window class!");
  
- #if USE_DIRECTX
- 	hWnd = CreateWindow("ScummVM", "ScummVM", 0,
-       CW_USEDEFAULT, CW_USEDEFAULT, SRC_WIDTH, SRC_HEIGHT, NULL, NULL, hInst, NULL);
- 
- 	SetWindowLong(hWnd, GWL_USERDATA, (long)this);
- 	SetWindowLong(hWnd, GWL_STYLE, 0);
- 	ShowCursor(false);
- 
- 	
- 	InitDirectX();
- 
- 	ShowWindow(hWnd, SW_SHOW);
- #endif
- 
  #if USE_GDI
  	globWnd = hWnd = CreateWindow("ScummVM", "ScummVM", WS_OVERLAPPEDWINDOW,
        CW_USEDEFAULT, CW_USEDEFAULT, DEST_WIDTH+10, DEST_HEIGHT+30, NULL, NULL, hInst, NULL);
  	SetWindowLong(hWnd, GWL_USERDATA, (long)this);
- //	ShowCursor(false);
  
  	dib.pal = (RGBQUAD*)calloc(sizeof(RGBQUAD),256);
--- 290,297 ----
***************
*** 662,705 ****
  		Error("allocateDIB failed!");
  
- #if 0
- 	biHeader = (BITMAPINFO*)LocalAlloc(LMEM_FIXED, sizeof(BITMAPINFOHEADER) + 1024 );
- 	memset(biHeader, 0, sizeof(BITMAPINFOHEADER) + 1024);
- 
- 	biHeader->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
- 	biHeader->bmiHeader.biWidth = DEST_WIDTH;
- 	biHeader->bmiHeader.biHeight = -DEST_HEIGHT;	/* top down */
- 	biHeader->bmiHeader.biPlanes = 1;
- 	biHeader->bmiHeader.biBitCount = 8;	/* 256 colors */
- 	biHeader->bmiHeader.biCompression = BI_RGB;	/* uncompressed */
- #endif
- 
  	ShowWindow(hWnd, SW_SHOW);
  #endif
  
- #if USE_DRAWDIB
- 	hdb = DrawDibOpen();
- 
- 	hWnd = CreateWindow("ScummVM", "ScummVM", WS_OVERLAPPEDWINDOW,
-       CW_USEDEFAULT, CW_USEDEFAULT, DEST_WIDTH+10, DEST_HEIGHT+30, NULL, NULL, hInst, NULL);
- 	SetWindowLong(hWnd, GWL_USERDATA, (long)this);
- 	ShowCursor(false);
- 
- 	biHeader = (BITMAPINFOHEADER*)LocalAlloc(LMEM_FIXED, sizeof(BITMAPINFOHEADER));
- 	memset(biHeader, 0, sizeof(BITMAPINFOHEADER));
- 
- 	biHeader->biSize = sizeof(BITMAPINFOHEADER);
- 	biHeader->biWidth = SRC_PITCH;
- 	biHeader->biHeight = SRC_HEIGHT;	/* top down */
- 	biHeader->biPlanes = 1;
- 	biHeader->biBitCount = 8;	/* 256 colors */
- 	biHeader->biCompression = BI_RGB;	/* uncompressed */
- 
- 	ShowWindow(hWnd, SW_SHOW);
- 
- //	int k = DrawDibProfileDisplay(biHeader);
- //	printf("%d\n", k&PD_CAN_STRETCHDIB);
- 		
- 
- #endif
  }
  
--- 301,307 ----
***************
*** 742,764 ****
  }
  
- 
  
! 
! void decompressMask(byte *d, byte *s) {
  	int x,y;
! 	byte bits = 0x80, bdata = *s++;
! 
! 	for (y=0; y<144; y++)
! 		for (x=0; x<320; x++) {
! 			*d++ = (bdata & bits) ? 128 : 0;
  			bits>>=1;
  			if (!bits) {
! 				bdata = *s++;
  				bits=0x80;
  			}
  		}
  }
- 
  
  
  void outputdisplay2(Scumm *s, int disp) {
--- 344,373 ----
  }
  
  
! void decompressMask(byte *d, byte *s, int w=320, int h=144) {
  	int x,y;
! 	
! 	for (y=0; y<h; y++) {
! 		byte *p = s+y*40;
! 		byte *pd = d + y*320;
! 		byte bits = 0x80, bdata = *p++;
! 		for (x=0; x<w; x++) {
! 			*pd++ = (bdata & bits) ? 128 : 0;
  			bits>>=1;
  			if (!bits) {
! 				bdata = *p++;
  				bits=0x80;
  			}
  		}
+ 	}
  }
  
+ void outputlittlemask(byte *mask, int w, int h) {
+ 	byte *old = wm->_vgabuf;
+ 	wm->_vgabuf = NULL;
+ 	decompressMask(wm->dib.buf, mask, w, h);
+ 	wm->writeToScreen();	
+ 	wm->_vgabuf = old;
+ }
  
  void outputdisplay2(Scumm *s, int disp) {
***************
*** 771,780 ****
  		wm->_vgabuf = buf;
  		memcpy(buf, wm->_vgabuf, 64000);
! 		memcpy(buf,s->getResourceAddress(rtBuffer, 5),320*144);
  		break;
  	case 1:
  		wm->_vgabuf = buf;
  		memcpy(buf, wm->_vgabuf, 64000);
! 		memcpy(buf,s->getResourceAddress(rtBuffer, 1),320*144);
  		break;
  	case 2:
--- 380,389 ----
  		wm->_vgabuf = buf;
  		memcpy(buf, wm->_vgabuf, 64000);
! 		memcpy(buf,s->getResourceAddress(rtBuffer, 5),320*200);
  		break;
  	case 1:
  		wm->_vgabuf = buf;
  		memcpy(buf, wm->_vgabuf, 64000);
! 		memcpy(buf,s->getResourceAddress(rtBuffer, 1),320*200);
  		break;
  	case 2:





More information about the Scummvm-git-logs mailing list