[Scummvm-cvs-logs] CVS: scummvm gfx.cpp,1.78,1.79 gfx.h,1.6,1.7 object.cpp,1.63,1.64 resource.cpp,1.69,1.70 saveload.cpp,1.41,1.42 script.cpp,1.50,1.51 scumm.h,1.137,1.138 scummvm.cpp,1.123,1.124 string.cpp,1.37,1.38 vars.cpp,1.8,1.9

Vincent Hamm yazoo at users.sourceforge.net
Tue Apr 23 16:59:03 CEST 2002


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

Modified Files:
	gfx.cpp gfx.h object.cpp resource.cpp saveload.cpp script.cpp 
	scumm.h scummvm.cpp string.cpp vars.cpp 
Log Message:
Major V7 update with vertical scrolling. Added a few scumm vars related to scrolling. Dig inventory isn't displayed where it should. I hope it doesn't break anything else in other game...

Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gfx.cpp,v
retrieving revision 1.78
retrieving revision 1.79
diff -C2 -d -r1.78 -r1.79
*** gfx.cpp	22 Apr 2002 22:18:24 -0000	1.78
--- gfx.cpp	23 Apr 2002 23:58:30 -0000	1.79
***************
*** 52,65 ****
  
  	for (i = 0; i < 3; i++) {
! //    nukeResource(rtBuffer, i+1);
  		nukeResource(rtBuffer, i + 5);
  	}
  
  	if (!getResourceAddress(rtBuffer, 4)) {
! 		initVirtScreen(3, 80, 13, false, false);
  	}
! 	initVirtScreen(0, b, h - b, true, true);
! 	initVirtScreen(1, 0, b, false, false);
! 	initVirtScreen(2, h, 200 - h, false, false);
  
  	_screenB = b;
--- 52,65 ----
  
  	for (i = 0; i < 3; i++) {
! 	    nukeResource(rtBuffer, i+1);
  		nukeResource(rtBuffer, i + 5);
  	}
  
  	if (!getResourceAddress(rtBuffer, 4)) {
! 		initVirtScreen(3, 0, 80, 320, 13, false, false);
  	}
! 	initVirtScreen(0, 0, b, 320, h - b, true, true);
! 	initVirtScreen(1, 0, 0, 320, b, false, false);
! 	initVirtScreen(2, 0, h, 320, 200 - h, false, false);
  
  	_screenB = b;
***************
*** 68,72 ****
  }
  
! void Scumm::initVirtScreen(int slot, int top, int height, bool twobufs,
  													 bool fourextra)
  {
--- 68,72 ----
  }
  
! void Scumm::initVirtScreen(int slot, int number, int top, int width, int height, bool twobufs,
  													 bool fourextra)
  {
***************
*** 93,99 ****
  	if (vs->scrollable)
  		size += 320 * 4;
! //  createResource(rtBuffer, slot+1, size);
  
! 	vs->screenPtr = _videoBuffer + 328 * top;
  
  	ptr = vs->screenPtr;
--- 93,100 ----
  	if (vs->scrollable)
  		size += 320 * 4;
! 
! 	createResource(rtBuffer, slot+1, size);
  
! 	vs->screenPtr = getResourceAddress(rtBuffer, slot+1);
  
  	ptr = vs->screenPtr;
***************
*** 130,134 ****
  {
  	int i;
! 	VirtScreen *vs;
  
  	updateDirtyScreen(2);
--- 131,136 ----
  {
  	int i;
! 	VirtScreen *vs;
! 	byte * src;
  
  	updateDirtyScreen(2);
***************
*** 141,148 ****
  		updateDirtyScreen(0);
  	} else {
! 		vs = &virtscr[0];
! 
! 		_system->copy_rect(vs->screenPtr + _screenStartStrip * 8, 320, 
! 					0, vs->topline, 320, vs->height);
  
  		for (i = 0; i < 40; i++) {
--- 143,151 ----
  		updateDirtyScreen(0);
  	} else {
! 		vs = &virtscr[0];
! 		
! 		src = vs->screenPtr + _screenStartStrip * 8 + camera._cur.y - 100;
! 		
! 		_system->copy_rect(src , 320, 0, vs->topline, 320, vs->height);
  
  		for (i = 0; i < 40; i++) {
***************
*** 180,184 ****
  
  	for (i = 0; i < 40; i++) {
! 		bottom = vs->bdirty[i];
  		if (bottom) {
  			top = vs->tdirty[i];
--- 183,190 ----
  
  	for (i = 0; i < 40; i++) {
! 		bottom = vs->bdirty[i];
! 		if (_vm->camera._cur.y != _vm->camera._last.y)
! 			drawStripToScreen(vs, start, w, 0, vs->height);
! 		else
  		if (bottom) {
  			top = vs->tdirty[i];
***************
*** 190,194 ****
  				continue;
  			}
! 			drawStripToScreen(vs, start, w, top, bottom);
  			w = 8;
  		}
--- 196,201 ----
  				continue;
  			}
! 		//	drawStripToScreen(vs, start, w, top, bottom);
! 			drawStripToScreen(vs, start, w, 0, vs->height);
  			w = 8;
  		}
***************
*** 199,203 ****
  void Gdi::drawStripToScreen(VirtScreen * vs, int x, int w, int t, int b)
  {
! 	byte *ptr;
  
  	if (b <= t)
--- 206,218 ----
  void Gdi::drawStripToScreen(VirtScreen * vs, int x, int w, int t, int b)
  {
! 	byte *ptr;
! 	int scrollY;
! 	int width = w;
! 	int height;
! 
! 	height = b - t;
! 
! 	if(height > 200)
! 		height = 200;
  
  	if (b <= t)
***************
*** 208,222 ****
  
  	if (b > vs->height)
! 		b = vs->height;
  
! 	ptr = vs->screenPtr + (t * 40 + x) * 8 + _readOffs;
  	
  	_vm->_system->copy_rect(
! 		ptr, 320, x * 8, vs->topline + t, w, b - t);
  }
  
  void blit(byte *dst, byte *src, int w, int h)
  {
! 	assert(h > 0);
  	do {
  		memcpy(dst, src, w);
--- 223,242 ----
  
  	if (b > vs->height)
! 		b = vs->height;
! 
! 	scrollY = _vm->camera._cur.y - 100;
! 	if(scrollY == -100)
! 		scrollY = 0;
  
! 	ptr = vs->screenPtr + (t * 40 + x) * 8 + _readOffs + scrollY * 320;
  	
  	_vm->_system->copy_rect(
! 		ptr, 320, x * 8, vs->topline + t , w, height);
  }
  
  void blit(byte *dst, byte *src, int w, int h)
  {
! 	assert(h > 0);
! 
  	do {
  		memcpy(dst, src, w);
***************
*** 333,341 ****
  }
  
! void Scumm::initBGBuffers()
  {
  	byte *ptr;
  	int size, itemsize, i;
  	byte *room;
  
  	room = getResourceAddress(rtRoom, _roomResource);
--- 353,366 ----
  }
  
! void Scumm::initBGBuffers(int height)
  {
  	byte *ptr;
  	int size, itemsize, i;
  	byte *room;
+ 
+ 	if (_features & GF_AFTER_V7)
+ 	{
+ 		initVirtScreen(0, 0, virtscr[0].topline, 200, height, 1, 1);
+ 	}
  
  	room = getResourceAddress(rtRoom, _roomResource);
***************
*** 348,352 ****
  	assert(gdi._numZBuffer >= 1 && gdi._numZBuffer <= 5);
  
! 	itemsize = (_scrHeight + 4) * 40;
  	size = itemsize * gdi._numZBuffer;
  
--- 373,378 ----
  	assert(gdi._numZBuffer >= 1 && gdi._numZBuffer <= 5);
  
! //	itemsize = (_scrHeight + 4) * 40;
! 	itemsize = (virtscr[0].height +4) * 40;
  	size = itemsize * gdi._numZBuffer;
  
***************
*** 637,645 ****
  	byte *smap_ptr, *where_draw_ptr;
  	int i;
! 	byte *zplane_list[4];
  	int bottom;
  	byte twobufs;
  	int numzbuf;
! 	int sx;
  
  	CHECK_HEAP;
--- 663,671 ----
  	byte *smap_ptr, *where_draw_ptr;
  	int i;
! 	byte *zplane_list[4];
  	int bottom;
  	byte twobufs;
  	int numzbuf;
! 	int sx;
  
  	CHECK_HEAP;
***************
*** 668,676 ****
  			zplane_list[i] = findResource(zplane_tags[i], ptr);
  		}
! 	}
! 
  	bottom = y + h;
  	if (bottom > vs->height) {
! 		error("Gdi::drawBitmap, strip drawn to %d below window bottom %d", bottom,
  					vs->height);
  	}
--- 694,702 ----
  			zplane_list[i] = findResource(zplane_tags[i], ptr);
  		}
! 	}
! 
  	bottom = y + h;
  	if (bottom > vs->height) {
! 		warning("Gdi::drawBitmap, strip drawn to %d below window bottom %d", bottom,
  					vs->height);
  	}
***************
*** 1902,1907 ****
  		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 {
--- 1928,1937 ----
  		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;
! 			_vars[VAR_CAMERA_DEST_X] = cd->_dest.x;
! 			_vars[VAR_CAMERA_DEST_Y] = cd->_dest.y;
! 			_vars[VAR_CAMERA_FOLLOWED_ACTOR] = cd ->_follows;
! 			if(_vars[VAR_SCROLL_SCRIPT])
! 				runScript(_vars[VAR_SCROLL_SCRIPT], 0, 0, 0);
  		}
  	} else {
***************
*** 2173,2178 ****
  		while (onlyActorFlags) {
  			if (onlyActorFlags & 1 && a->top != 0xFF && a->needBgReset) {
! 				gfxUsageBits[_screenStartStrip + i] ^= bitpos;
! 				gdi.resetBackground(a->top, a->bottom, i);
  			}
  			bitpos <<= 1;
--- 2203,2209 ----
  		while (onlyActorFlags) {
  			if (onlyActorFlags & 1 && a->top != 0xFF && a->needBgReset) {
! 				gfxUsageBits[_screenStartStrip + i] ^= bitpos;
! 				if((a->bottom - a->top) >=0)
! 					gdi.resetBackground(a->top, a->bottom, i);
  			}
  			bitpos <<= 1;
***************
*** 2187,2191 ****
  }
  
! void Gdi::resetBackground(byte top, byte bottom, int strip)
  {
  	VirtScreen *vs = &_vm->virtscr[0];
--- 2218,2222 ----
  }
  
! void Gdi::resetBackground(int top, int bottom, int strip)
  {
  	VirtScreen *vs = &_vm->virtscr[0];
***************
*** 2198,2202 ****
  		vs->bdirty[strip] = bottom;
  
! 	offs = (top * 40 + _vm->_screenStartStrip + strip);
  	_mask_ptr = _vm->getResourceAddress(rtBuffer, 9) + offs;
  	_bgbak_ptr = _vm->getResourceAddress(rtBuffer, 5) + (offs << 3);
--- 2229,2233 ----
  		vs->bdirty[strip] = bottom;
  
! 	offs = (top * 40 + _vm->_screenStartStrip + strip );
  	_mask_ptr = _vm->getResourceAddress(rtBuffer, 9) + offs;
  	_bgbak_ptr = _vm->getResourceAddress(rtBuffer, 5) + (offs << 3);

Index: gfx.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gfx.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** gfx.h	22 Apr 2002 13:55:28 -0000	1.6
--- gfx.h	23 Apr 2002 23:58:31 -0000	1.7
***************
*** 107,112 ****
  
  	bool _useOrDecompress;
! 	byte _numLinesToProcess;
! 	byte _tempNumLines;
  	byte _currentX;
  	byte _hotspot_x;
--- 107,112 ----
  
  	bool _useOrDecompress;
! 	int _numLinesToProcess;
! 	int _tempNumLines;
  	byte _currentX;
  	byte _hotspot_x;
***************
*** 133,137 ****
  	byte _decomp_shr, _decomp_mask;
  	byte _transparency;
! 	uint16 _vertStripNextInc;
  	byte *_backupIsWhere;
  
--- 133,137 ----
  	byte _decomp_shr, _decomp_mask;
  	byte _transparency;
! 	uint32 _vertStripNextInc;
  	byte *_backupIsWhere;
  
***************
*** 162,166 ****
  	void decompressMaskImg();
  
! 	void resetBackground(byte top, byte bottom, int strip);
  	void drawStripToScreen(VirtScreen *vs, int x, int w, int t, int b);
  	void updateDirtyScreen(VirtScreen *vs);
--- 162,166 ----
  	void decompressMaskImg();
  
! 	void resetBackground(int top, int bottom, int strip);
  	void drawStripToScreen(VirtScreen *vs, int x, int w, int t, int b);
  	void updateDirtyScreen(VirtScreen *vs);

Index: object.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/object.cpp,v
retrieving revision 1.63
retrieving revision 1.64
diff -C2 -d -r1.63 -r1.64
*** object.cpp	22 Apr 2002 16:18:20 -0000	1.63
--- object.cpp	23 Apr 2002 23:58:31 -0000	1.64
***************
*** 336,340 ****
  
  	xpos = od->x_pos >> 3;
! 	ypos = od->y_pos;
  	width = od->width >> 3;
  	height = od->height &= 0xF8;	// Ender
--- 336,340 ----
  
  	xpos = od->x_pos >> 3;
! 	ypos = od->y_pos;
  	width = od->width >> 3;
  	height = od->height &= 0xF8;	// Ender

Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/resource.cpp,v
retrieving revision 1.69
retrieving revision 1.70
diff -C2 -d -r1.69 -r1.70
*** resource.cpp	21 Apr 2002 19:38:00 -0000	1.69
--- resource.cpp	23 Apr 2002 23:58:31 -0000	1.70
***************
*** 684,690 ****
  	CHECK_HEAP debug(9, "createResource(%d,%d,%d)", type, idx, size);
  
- 	if (size > 65536 * 4 + 37856)
- 		warning("Probably invalid size allocating %d", size);
- 
  	validateResource("allocating", type, idx);
  	nukeResource(type, idx);
--- 684,687 ----

Index: saveload.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saveload.cpp,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -d -r1.41 -r1.42
*** saveload.cpp	20 Apr 2002 04:09:01 -0000	1.41
--- saveload.cpp	23 Apr 2002 23:58:31 -0000	1.42
***************
*** 176,180 ****
  		cameraMoved();
  
! 	initBGBuffers();
  
  	CHECK_HEAP debug(1, "State loaded from '%s'", filename);
--- 176,180 ----
  		cameraMoved();
  
! 	initBGBuffers(_scrHeight);
  
  	CHECK_HEAP debug(1, "State loaded from '%s'", filename);

Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/script.cpp,v
retrieving revision 1.50
retrieving revision 1.51
diff -C2 -d -r1.50 -r1.51
*** script.cpp	19 Apr 2002 21:06:50 -0000	1.50
--- script.cpp	23 Apr 2002 23:58:31 -0000	1.51
***************
*** 32,36 ****
  	int slot;
  	ScriptSlot *s;
! 
  	if (script == 0)
  		return;
--- 32,36 ----
  	int slot;
  	ScriptSlot *s;
! 
  	if (script == 0)
  		return;
***************
*** 267,271 ****
  /* Execute a script - Read opcode, and execute it from the table */
  void Scumm::executeScript()
! {
  	OpcodeProc op;
  	while (_currentScript != 0xFF) {
--- 267,271 ----
  /* Execute a script - Read opcode, and execute it from the table */
  void Scumm::executeScript()
! {
  	OpcodeProc op;
  	while (_currentScript != 0xFF) {

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm.h,v
retrieving revision 1.137
retrieving revision 1.138
diff -C2 -d -r1.137 -r1.138
*** scumm.h	22 Apr 2002 16:18:20 -0000	1.137
--- scumm.h	23 Apr 2002 23:58:31 -0000	1.138
***************
*** 1146,1151 ****
  	void getGraphicsPerformance();
  	void initScreens(int a, int b, int w, int h);
! 	void initVirtScreen(int slot, int top, int height, bool twobufs, bool fourextra);
! 	void initBGBuffers();
  	void initCycl(byte *ptr);	// Color cycle
  
--- 1146,1151 ----
  	void getGraphicsPerformance();
  	void initScreens(int a, int b, int w, int h);
! 	void initVirtScreen(int slot, int number, int top, int width, int height, bool twobufs, bool fourextra);
! 	void initBGBuffers(int height);
  	void initCycl(byte *ptr);	// Color cycle
  
***************
*** 1692,1696 ****
  	byte VAR_CAMERA_SPEED_Y;
  	byte VAR_CAMERA_ACCEL_X;
! 	byte VAR_CAMERA_ACCEL_Y;
  
  	byte VAR_LEFTBTN_DOWN;
--- 1692,1699 ----
  	byte VAR_CAMERA_SPEED_Y;
  	byte VAR_CAMERA_ACCEL_X;
! 	byte VAR_CAMERA_ACCEL_Y;
! 	byte VAR_CAMERA_DEST_X;
! 	byte VAR_CAMERA_DEST_Y;
! 	byte VAR_CAMERA_FOLLOWED_ACTOR;
  
  	byte VAR_LEFTBTN_DOWN;

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scummvm.cpp,v
retrieving revision 1.123
retrieving revision 1.124
diff -C2 -d -r1.123 -r1.124
*** scummvm.cpp	21 Apr 2002 21:56:41 -0000	1.123
--- scummvm.cpp	23 Apr 2002 23:58:31 -0000	1.124
***************
*** 328,332 ****
  			if (camera._cur.x != camera._last.x || camera._cur.y != camera._last.y
  					|| _BgNeedsRedraw || _fullRedraw) {
! 				redrawBGAreas();
  			}
  		}
--- 328,333 ----
  			if (camera._cur.x != camera._last.x || camera._cur.y != camera._last.y
  					|| _BgNeedsRedraw || _fullRedraw) {
! 				redrawBGAreas();
! 				_videoBuffer = virtscr[0].screenPtr + (camera._cur.y - 100) * 328;
  			}
  		}
***************
*** 456,460 ****
  	if (!(_features & GF_AFTER_V7)) {
  		camera._mode = CM_NORMAL;
! 		camera._cur.x = camera._dest.x = 160;
  	}
  
--- 457,462 ----
  	if (!(_features & GF_AFTER_V7)) {
  		camera._mode = CM_NORMAL;
! 		camera._cur.x = camera._dest.x = 160;
! 		camera._cur.y = camera._dest.y = 100;
  	}
  
***************
*** 708,712 ****
  		gdi._transparency = 255;
  
! 	initBGBuffers();
  
  	memset(_extraBoxFlags, 0, sizeof(_extraBoxFlags));
--- 710,716 ----
  		gdi._transparency = 255;
  
! 	initBGBuffers(_scrHeight);
! 
! 	_videoBuffer = virtscr[0].screenPtr;
  
  	memset(_extraBoxFlags, 0, sizeof(_extraBoxFlags));
***************
*** 817,822 ****
  	getKeyInput(0);
  
! 	_virtual_mouse_x = mouse.x + virtscr[0].xstart;
! 	_virtual_mouse_y = mouse.y;
  
  	if (!(_features & GF_OLD256))
--- 821,830 ----
  	getKeyInput(0);
  
! 	_virtual_mouse_x = mouse.x + virtscr[0].xstart;
! 
! 	if(_features & GF_AFTER_V7)
! 		_virtual_mouse_y = mouse.y + camera._cur.y-100;
! 	else
! 		_virtual_mouse_y = mouse.y;
  
  	if (!(_features & GF_OLD256))
***************
*** 1252,1259 ****
  
  	/* Create a primary virtual screen */
! 	_videoBuffer = (byte*)malloc(328*200);
  
  	allocResTypeData(rtBuffer, MKID('NONE'), 10, "buffer", 0);
! 	initVirtScreen(0, 0, 200, false, false);
  
  	if (_features & GF_AFTER_V7)
--- 1260,1267 ----
  
  	/* Create a primary virtual screen */
! 	_videoBuffer = (byte*)malloc(328*800);
  
  	allocResTypeData(rtBuffer, MKID('NONE'), 10, "buffer", 0);
! 	initVirtScreen(0, 0, 0, 320, 200, false, false);
  
  	if (_features & GF_AFTER_V7)

Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/string.cpp,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -d -r1.37 -r1.38
*** string.cpp	22 Apr 2002 13:15:30 -0000	1.37
--- string.cpp	23 Apr 2002 23:58:31 -0000	1.38
***************
*** 237,241 ****
  			string[0].ypos = ((a->new_1 - s) >> 1) + s - a->elevation + a->y;
  			if (string[0].ypos < 1)
! 				string[0].ypos = 1;
  
  			s = a->scalex * a->new_2 / 0xFF;
--- 237,243 ----
  			string[0].ypos = ((a->new_1 - s) >> 1) + s - a->elevation + a->y;
  			if (string[0].ypos < 1)
! 				string[0].ypos = 1;
! 			if (string[0].ypos < camera._cur.y - 100)
! 				string[0].ypos = camera._cur.y - 100;
  
  			s = a->scalex * a->new_2 / 0xFF;

Index: vars.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/vars.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** vars.cpp	21 Apr 2002 19:38:00 -0000	1.8
--- vars.cpp	23 Apr 2002 23:58:31 -0000	1.9
***************
*** 140,143 ****
--- 140,147 ----
  	VAR_NEW_ROOM = 35;
  	VAR_WALKTO_OBJ = 36;
+ 
+ 	VAR_CAMERA_DEST_X = 38;
+ 	VAR_CAMERA_DEST_Y = 39;
+ 	VAR_CAMERA_FOLLOWED_ACTOR = 40;
  
  	VAR_SCROLL_SCRIPT = 50;





More information about the Scummvm-git-logs mailing list