[Scummvm-cvs-logs] CVS: scummvm actor.cpp,1.28,1.29 akos.cpp,1.6,1.7 gfx.cpp,1.38,1.39 object.cpp,1.33,1.34 script_v2.cpp,1.26,1.27 scumm.h,1.62,1.63 scummvm.cpp,1.59,1.60

Vincent Hamm yazoo at users.sourceforge.net
Wed Mar 6 01:41:04 CET 2002


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

Modified Files:
	actor.cpp akos.cpp gfx.cpp object.cpp script_v2.cpp scumm.h 
	scummvm.cpp 
Log Message:
Reimplemented the preliminary Dig features. Implemented actor with many direction. Fixed bomp bug

Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/actor.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** actor.cpp	5 Mar 2002 23:05:55 -0000	1.28
--- actor.cpp	6 Mar 2002 09:40:21 -0000	1.29
***************
*** 22,25 ****
--- 22,26 ----
  #include "stdafx.h"
  #include "scumm.h"
+ #include "math.h"
  
  void Scumm::initActor(Actor *a, int mode) {
***************
*** 154,159 ****
  	a->walkdata.xfrac = 0;
  	a->walkdata.yfrac = 0;
! 	
! 	a->newDirection = getAngleFromPos(XYFactor, YXFactor);
  
  	return actorWalkStep(a);
--- 155,166 ----
  	a->walkdata.xfrac = 0;
  	a->walkdata.yfrac = 0;
! 
! 	if(_gameId==GID_DIG) {
! 		float temp;
! 		temp = atan2 (XYFactor, -YXFactor);
! 		a->newDirection = normalizeAngle(temp * 1.8e2 / 3.14);
! 	} else {
! 		a->newDirection = getAngleFromPos(XYFactor, YXFactor);
! 	}
  
  	return actorWalkStep(a);

Index: akos.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/akos.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** akos.cpp	24 Feb 2002 17:25:02 -0000	1.6
--- akos.cpp	6 Mar 2002 09:40:21 -0000	1.7
***************
*** 36,43 ****
  }
  
  
  int Scumm::akos_frameToAnim(Actor *a, int frame) {
! 	if (akos_hasManyDirections(a)) {
! 		error("akos_frameToAnim: hasManyDirections not supported");
  	} else {
  		return newDirToOldDir(a->facing) + frame * 4;
--- 36,72 ----
  }
  
+ int Scumm::akos_findManyDirection(int16 ManyDirection, uint16 facing)
+ {
+ 	int32 direction;
+ 	int32 temp;
+ 	int32 temp_facing;
+ 	temp=many_direction_tab[ManyDirection];
+ 	direction=temp + ManyDirection * 8;
+ 	do{
+ 		if(facing>=many_direction_tab[direction+1])
+ 		{
+ 			if(facing<=many_direction_tab[direction+2])
+ 			{
+ 				return(temp);
+ 			}
+ 		}
+ 		
+ 		--temp;
+ 		--direction;
+ 		
+ 	}while(temp);
+ 
+ 	return(temp);
+ }
+ 
  
  int Scumm::akos_frameToAnim(Actor *a, int frame) {
! 	bool ManyDirection;
! 
! 	ManyDirection = akos_hasManyDirections(a);
! 	
! 	if (ManyDirection){
! 		frame*=many_direction_tab[ManyDirection];
! 		return akos_findManyDirection(ManyDirection, a->facing) + frame;
  	} else {
  		return newDirToOldDir(a->facing) + frame * 4;
***************
*** 1083,1092 ****
  
  int Scumm::getAnimVar(Actor *a, byte var) {
- 	assert(var>=0 && var<=15);
  	return a->animVariable[var];
  }
  
  void Scumm::setAnimVar(Actor *a, byte var, int value) {
- 	assert(var>=0 && var<=15);
  	a->animVariable[var] = value;
  }
--- 1112,1119 ----

Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gfx.cpp,v
retrieving revision 1.38
retrieving revision 1.39
diff -C2 -d -r1.38 -r1.39
*** gfx.cpp	5 Mar 2002 23:41:41 -0000	1.38
--- gfx.cpp	6 Mar 2002 09:40:21 -0000	1.39
***************
*** 38,43 ****
  
  	_vars[VAR_PERFORMANCE_2] = 0;//_scummTimer;
! 	
! 	initScreens(0, 16, 320, 144);
  }
  
--- 38,46 ----
  
  	_vars[VAR_PERFORMANCE_2] = 0;//_scummTimer;
! 
! 	if(_gameId == GID_DIG)
! 		initScreens(0, 0, 320, 200);
! 	else
! 		initScreens(0, 16, 320, 144);
  }
  
***************
*** 2319,2408 ****
  
  void Scumm::drawBomp(BompDrawData *bd) {
! 	byte *dest = bd->out + bd->y * bd->outwidth, *src;
! 	int h = bd->srcheight;
! 	bool inside;
! 
! 	if (h==0 || bd->srcwidth==0)
! 		return;
  
! 	inside = (bd->x>=0) && (bd->y>=0) &&
! 		(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 */
! 		if (inside) {
! 			dest += bd->x;
! 			src = bd->dataptr;
! 			do {
! 				byte code,color;
! 				uint len = bd->srcwidth, num, i;
! 				byte *d = dest;
! 				src += 2;
! 				do {
! 					code = *src++;
! 					num = (code>>1)+1;
! 					if (num>len) num=len;
! 					len -= num;
! 					if (code&1) {
! 						color = *src++;
! 						if (color!=255) {
! 							do *d++ = color; while (--num);
! 						} else {
! 							d += num;
! 						}
! 					} else {
! 						for(i=0;i<num; i++)
! 							if ( (color=src[i]) != 255)
! 								d[i] = color;
! 						d += num;
! 						src += num;
! 					}
! 				} while (len);
! 				dest += bd->outwidth;
! 			} while (--h);
  		} else {
! 			uint y = bd->y;
! 			src = bd->dataptr;
  
! 			do {
! 				byte color;
! 				uint len, num;
! 				uint x;
! 				if ((uint)y >= (uint)bd->outheight) {
! 					src += READ_LE_UINT16(src) + 2;
! 					continue;
! 				}
! 				len = bd->srcwidth;
! 				x = bd->x;
  
- 				src += 2;
- 				do {
- 					byte code = *src++;
- 					num = (code>>1)+1;
- 					if (num>len) num=len;
- 					len -= num;
- 					if (code&1) {
- 						if ((color = *src++)!=255) {
- 							do {
- 								if ((uint)x < (uint)bd->outwidth)
- 									dest[x] = color;
- 							} while (++x,--num);
- 						} else {
- 							x += num;
- 						}
- 					} else {
- 						do {
- 							if ((color=*src++) != 255 && (uint)x < (uint)bd->outwidth)
- 								dest[x] = color;
- 						} while (++x,--num);
- 					}
- 				} while (len);
- 			} while (dest += bd->outwidth,y++,--h);
- 		}
- 	} else {
- 		/* scaling of bomp images not supported yet */
- 	}
  	CHECK_HEAP
  
--- 2322,2411 ----
  
  void Scumm::drawBomp(BompDrawData *bd) {
!         byte *dest = bd->out + bd->y * bd->outwidth, *src;
!         int h = bd->srcheight;
!         bool inside;
  
!         if (h==0 || bd->srcwidth==0)
!                 return;
  
+         inside = (bd->x>=0) && (bd->y>=0) &&
+                 (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 */
!                 if (inside) {
!                         dest += bd->x;
!                         src = bd->dataptr;
!                         do {
!                                 byte code,color;
!                                 uint len = bd->srcwidth, num, i;
!                                 byte *d = dest;
!                                 src += 2;
!                                 do {
!                                         code = *src++;
!                                         num = (code>>1)+1;
!                                         if (num>len) num=len;
!                                         len -= num;
!                                         if (code&1) {
!                                                 color = *src++;
!                                                 if (color!=255) {
!                                                         do *d++ = color; while (--num);
!                                                 } else {
!                                                         d += num;
!                                                 }
!                                         } else {
!                                                 for(i=0;i<num; i++)
!                                                         if ( (color=src[i]) != 255)
!                                                                 d[i] = color;
!                                                 d += num;
!                                                 src += num;
!                                         }
!                                 } while (len);
!                                 dest += bd->outwidth;
!                         } while (--h);
  		} else {
!                         uint y = bd->y;
!                         src = bd->dataptr;
  
!                         do {
!                                 byte color,code;
!                                 uint len, num;
!                                 uint x;
!                                 if ((uint)y >= (uint)bd->outheight) {
!                                         src += READ_LE_UINT16(src) + 2;
!                                         continue;
!                                 }
!                                 len = bd->srcwidth;
!                                 x = bd->x;
! 
!                                 src += 2;
!                                 do {
!                                         byte code = *src++;
!                                         num = (code>>1)+1;
!                                         if (num>len) num=len;
!                                         len -= num;
!                                         if (code&1) {
!                                                 if ((color = *src++)!=255) {
!                                                         do {
!                                                                 if ((uint)x < (uint)bd->outwidth)
!                                                                         dest[x] = color;
!                                                         } while (++x,--num);
!                                                 } else {
!                                                         x += num;
!                                                 }
!                                         } else {
!                                                 do {
!                                                         if ((color=*src++) != 255 && (uint)x < (uint)bd->outwidth)
!                                                                 dest[x] = color;
!                                                 } while (++x,--num);
!                                         }
!                                 } while (len);
!                         } while (dest += bd->outwidth,y++,--h);
!                 }
!         } else {
!                 /* scaling of bomp images not supported yet */
!         }
  
  	CHECK_HEAP
  

Index: object.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/object.cpp,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -d -r1.33 -r1.34
*** object.cpp	5 Mar 2002 23:41:41 -0000	1.33
--- object.cpp	6 Mar 2002 09:40:21 -0000	1.34
***************
*** 1166,1170 ****
  	bdd.outwidth = 320;
  	bdd.outheight = vs->height;
! 	bdd.dataptr = bomp + 18;
  	bdd.x = eo->x;
  	bdd.y = eo->y;
--- 1166,1170 ----
  	bdd.outwidth = 320;
  	bdd.outheight = vs->height;
! 	bdd.dataptr = bomp + 10;
  	bdd.x = eo->x;
  	bdd.y = eo->y;

Index: script_v2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/script_v2.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** script_v2.cpp	6 Mar 2002 00:18:22 -0000	1.26
--- script_v2.cpp	6 Mar 2002 09:40:21 -0000	1.27
***************
*** 2693,2696 ****
--- 2693,2707 ----
  		push(a->frame);
  		break;
+ 	case 215:
+ 		if(_extraBoxFlags[args[1]]&0x00FF==0x00C0)
+ 		{
+ 			push(_extraBoxFlags[args[1]]);
+ 		}
+ 		else
+ 		{
+ 			byte* temp = (byte*)getBoxBaseAddr(args[1]);
+ 			push((byte)(*(temp+17)));
+ 		}
+ 		break;
  	default:
  		error("o6_kernelFunction: default case %d", args[0]);

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm.h,v
retrieving revision 1.62
retrieving revision 1.63
diff -C2 -d -r1.62 -r1.63
*** scumm.h	5 Mar 2002 22:23:48 -0000	1.62
--- scumm.h	6 Mar 2002 09:40:21 -0000	1.63
***************
*** 44,47 ****
--- 44,84 ----
  };
  
+ const uint16 many_direction_tab[18] = {
+ 	4,
+ 	8,
+ 	71,
+ 	109,
+ 	251,
+ 	530,
+ 	0,
+ 	0,
+ 	0,
+ 	0,
+ 	22,
+ 	72,
+ 	107,
+ 	157,
+ 	202,
+ 	252,
+ 	287,
+ 	337 };
+ 
+ const int16 many_direction_tab_2 [16] = {
+ 	0,
+ 	90,
+ 	180,
+ 	270,
+ 	-1,
+ 	-1,
+ 	-1,
+ 	-1,
+ 	0,
+ 	45,
+ 	90,
+ 	135,
+ 	180,
+ 	225,
+ 	270,
+ 	315 };
  
  struct Point {
***************
*** 797,800 ****
--- 834,839 ----
  	char *_gameDataPath;
  
+ 	int akos_findManyDirection(int16 ManyDirection, uint16 facing);
+ 	
  	byte _saveLoadFlag;
  	byte _saveLoadSlot;

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scummvm.cpp,v
retrieving revision 1.59
retrieving revision 1.60
diff -C2 -d -r1.59 -r1.60
*** scummvm.cpp	6 Mar 2002 00:18:22 -0000	1.59
--- scummvm.cpp	6 Mar 2002 09:40:21 -0000	1.60
***************
*** 1118,1136 ****
  
  
- 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;
--- 1118,1121 ----
***************
*** 1140,1144 ****
  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])
--- 1125,1129 ----
  int Scumm::toSimpleDir(int dirType, int dir) {
  	int num = dirType ? 8 : 4, i;
! 	const uint16 *dirtab = &many_direction_tab[dirType*8+2];
  	for(i=1;i<num;i++,dirtab++) {
  		if (dir >= dirtab[0] && dir <= dirtab[1])





More information about the Scummvm-git-logs mailing list