[Scummvm-cvs-logs] CVS: scummvm/scumm actor.cpp,1.340,1.341 actor.h,1.80,1.81 intern.h,2.436,2.437 script_v100he.cpp,2.120,2.121 script_v6he.cpp,2.151,2.152 script_v72he.cpp,2.250,2.251 script_v80he.cpp,2.89,2.90

kirben kirben at users.sourceforge.net
Mon Apr 11 19:30:11 CEST 2005


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4820/scumm

Modified Files:
	actor.cpp actor.h intern.h script_v100he.cpp script_v6he.cpp 
	script_v72he.cpp script_v80he.cpp 
Log Message:

Work in progress on opcodeE0 for HE games.
Cleanup.


Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/actor.cpp,v
retrieving revision 1.340
retrieving revision 1.341
diff -u -d -r1.340 -r1.341
--- actor.cpp	10 Apr 2005 12:58:54 -0000	1.340
+++ actor.cpp	12 Apr 2005 02:29:49 -0000	1.341
@@ -578,6 +578,29 @@
 	_needRedraw = true;
 }
 
+void Actor::drawActorToBackBuf(int x, int y) {
+	int curTop = _top;
+	int curBottom = _bottom;
+
+	_pos.x = x;
+	_pos.y = y;
+
+	_drawToBackBuf = true;
+	_needRedraw = true;
+	drawActorCostume();
+
+	_drawToBackBuf = false;
+	_needRedraw = true;
+	drawActorCostume();
+	_needRedraw = false;
+
+	if (_top > curTop)
+		_top = curTop;
+	if (_bottom < curBottom)
+		_bottom = curBottom;
+}
+
+
 void Actor::putActor(int dstX, int dstY, byte newRoom) {
 	if (_visible && _vm->_currentRoom != newRoom && _vm->getTalkingActor() == _number) {
 		_vm->stopTalk();

Index: actor.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/actor.h,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -d -r1.80 -r1.81
--- actor.h	10 Apr 2005 12:58:54 -0000	1.80
+++ actor.h	12 Apr 2005 02:29:49 -0000	1.81
@@ -191,6 +191,7 @@
 	void turnToDirection(int newdir);
 	void walkActor();
 	void walkActorOld();
+	void drawActorToBackBuf(int x, int y);
 	void drawActorCostume(bool hitTestMode = false);
 	void animateCostume();
 	void setActorCostume(int c);

Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.436
retrieving revision 2.437
diff -u -d -r2.436 -r2.437
--- intern.h	11 Apr 2005 17:59:54 -0000	2.436
+++ intern.h	12 Apr 2005 02:29:49 -0000	2.437
@@ -872,6 +872,8 @@
 
 	void loadImgSpot(int resId, int state, int16 &x, int16 &y);
 	void loadWizCursor(int resId);
+	void unknownE0(int x1, int y1, int x, int cycles, int arg_10, int type, int resNum);
+	void unknownE0Helper(int x, int y, int flags);
 	
 	/* HE version 80 script opcodes */
 	void o80_loadSBNG();

Index: script_v100he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v100he.cpp,v
retrieving revision 2.120
retrieving revision 2.121
diff -u -d -r2.120 -r2.121
--- script_v100he.cpp	11 Apr 2005 07:40:14 -0000	2.120
+++ script_v100he.cpp	12 Apr 2005 02:29:49 -0000	2.121
@@ -817,13 +817,12 @@
 }
 
 void ScummEngine_v100he::o100_unknownE0() {
-	// wizImage related
-	int b, c, d, num, x1, y1, type = 0;
+	int id, unk1, unk2, x, x1, y1, type;
 
-	b = pop();
-	num = pop();
-	c = pop();
-	d = pop();
+	unk2 = pop();
+	id = pop();
+	unk1 = pop();
+	x = pop();
 	y1 = pop();
 	x1 = pop();
 
@@ -831,45 +830,20 @@
 
 	switch (subOp) {
 	case 1:
-		{
-		Actor *a = derefActorSafe(num, "o100_unknownE0");
-		int top_actor = a->_top;
-		int bottom_actor = a->_bottom;
-		a->_drawToBackBuf = true;
-		a->_needRedraw = true;
-		a->drawActorCostume();
-		a->_drawToBackBuf = false;
-		a->_needRedraw = true;
-		a->drawActorCostume();
-		a->_needRedraw = false;
-
-		if (a->_top > top_actor)
-			a->_top = top_actor;
-		if (a->_bottom < bottom_actor)
-			a->_bottom = bottom_actor;
-
 		type = 2;
-		}
+		unknownE0(x1, y1, x, unk1, unk2, type, id);
 		break;
 	case 20:
 		type = 1;
+		unknownE0(x1, y1, x, unk1, unk2, type, id);
 		break;
 	case 40:
-		_wizParams.processFlags |= kWPFSetPos;
-		_wizParams.img.flags = 0;
-		_wizParams.img.state = 0;
-		_wizParams.img.y1 = y1;
-		_wizParams.img.x1 = x1;
-		_wizParams.img.resNum = num;
-		displayWizComplexImage(&_wizParams);
-
 		type = 3;
+		unknownE0(x1, y1, x, unk1, unk2, type, id);
 		break;
 	default:
 		error("o100_unknownE0: default case %d", subOp);
 	}
-
-	debug(1,"o100_unknownE0 stub: type %d (%d, num %d, %d, %d, y %d, x %d)", type, b, num, c, d, y1, x1);	
 }
 
 void ScummEngine_v100he::o100_drawObject() {

Index: script_v6he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v6he.cpp,v
retrieving revision 2.151
retrieving revision 2.152
diff -u -d -r2.151 -r2.152
--- script_v6he.cpp	10 Apr 2005 12:58:57 -0000	2.151
+++ script_v6he.cpp	12 Apr 2005 02:29:50 -0000	2.152
@@ -725,23 +725,7 @@
 		a->initActor(2);
 		break;
 	case 218:		
-		{
-			int top_actor = a->_top;
-			int bottom_actor = a->_bottom;
-			a->_drawToBackBuf = true;
-			a->_needRedraw = true;
-			a->drawActorCostume();
-			a->_drawToBackBuf = false;
-			a->_needRedraw = true;
-			a->drawActorCostume();
-			a->_needRedraw = false;
-
-			if (a->_top > top_actor)
-				a->_top = top_actor;
-			if (a->_bottom < bottom_actor)
-				a->_bottom = bottom_actor;
-
-		}
+		a->drawActorToBackBuf(a->_pos.x, a->_pos.y);
 		break;
 	case 219:
 		a->_drawToBackBuf = false;

Index: script_v72he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v72he.cpp,v
retrieving revision 2.250
retrieving revision 2.251
diff -u -d -r2.250 -r2.251
--- script_v72he.cpp	10 Apr 2005 12:59:15 -0000	2.250
+++ script_v72he.cpp	12 Apr 2005 02:29:50 -0000	2.251
@@ -1230,23 +1230,7 @@
 		a->initActor(2);
 		break;
 	case 218:		
-		{
-			int top_actor = a->_top;
-			int bottom_actor = a->_bottom;
-			a->_drawToBackBuf = true;
-			a->_needRedraw = true;
-			a->drawActorCostume();
-			a->_drawToBackBuf = false;
-			a->_needRedraw = true;
-			a->drawActorCostume();
-			a->_needRedraw = false;
-
-			if (a->_top > top_actor)
-				a->_top = top_actor;
-			if (a->_bottom < bottom_actor)
-				a->_bottom = bottom_actor;
-
-		}
+		a->drawActorToBackBuf(a->_pos.x, a->_pos.y);
 		break;
 	case 219:
 		a->_drawToBackBuf = false;

Index: script_v80he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v80he.cpp,v
retrieving revision 2.89
retrieving revision 2.90
diff -u -d -r2.89 -r2.90
--- script_v80he.cpp	10 Apr 2005 12:59:15 -0000	2.89
+++ script_v80he.cpp	12 Apr 2005 02:29:50 -0000	2.90
@@ -598,62 +598,193 @@
 	displayWizImage(&wi);	
 }
 
-void ScummEngine_v80he::o80_unknownE0() {
-	// wizImage related
-	int b, c, d, num, x1, y1, type = 0;
+void ScummEngine_v80he::unknownE0(int x1, int y1, int x, int unk1, int unk2, int type, int id) {
+	debug(0,"unknownE0: x1 %d y1 %d x %d unk1 %d, unk2 %d type %d id %d", x1, y1, x, unk1, unk2, type, id);	
 
-	b = pop();
-	num = pop();
-	c = pop();
-	d = pop();
-	y1 = pop();
-	x1 = pop();
+	int eax, ebx, ecx, y, edp, edx, esi;
+	int var_4, var_8, var_C;
 
-	byte subOp = fetchScriptByte();
+	// edx is never set?
+	edx = 0;
 
-	switch (subOp) {
-	case 55:
-		{
-			Actor *a = derefActorSafe(num, "o80_unknownE0");
-			int top_actor = a->_top;
-			int bottom_actor = a->_bottom;
-			a->_drawToBackBuf = true;
-			a->_needRedraw = true;
-			a->drawActorCostume();
-			a->_drawToBackBuf = false;
-			a->_needRedraw = true;
-			a->drawActorCostume();
-			a->_needRedraw = false;
+	ebx = 0;
+	var_C = 0;
 
-			if (a->_top > top_actor)
-				a->_top = top_actor;
-			if (a->_bottom < bottom_actor)
-				a->_bottom = bottom_actor;
+	if (unk2 < 0) {
+		unk2 = -unk2;
+	}
+	if (unk2 == 0) {
+		unk2 = 1;
+	}
 
-			type = 2;
+	eax = x;
+	ecx = x1;
+
+	esi = unk1;
+	y = y1;
+
+	eax -= ecx;
+	esi -= y;
+
+	var_8 = eax;
+	var_4 = esi;
+
+	edp = eax;
+	eax = esi;
+
+	edp ^= edx;
+	edp -= edx;
+
+	eax ^= edx;
+	eax -= edx;
+
+	esi = edp;
+
+	y1 = eax;
+
+	if (eax > edp) {
+		esi = eax;
+	}
+
+	x = x1;
+	x1 = 0;
+
+	if (type == 2) {
+		Actor *a = derefActorSafe(id, "unknownE0");
+		a->drawActorToBackBuf(x1, y1);
+	} else if (type == 3) {
+		WizImage wi;
+		wi.flags = 0;
+		wi.y1 = y1;
+		wi.x1 = x1;
+		wi.resNum = id;
+		wi.state = 0;
+		displayWizImage(&wi);
+	} else {
+		unknownE0Helper(x1, y1, id);
+	}
+
+	for (int i = 0; i <= esi; i++) {
+		ecx = x1;
+		eax = y1;	
+		ebx += edp;
+		ecx += eax;
+
+		eax ^= eax;
+		x1 = ecx;
+
+		if (ebx > esi) {
+			edx = var_8;
+			edx -= esi;
+
+			eax = 1;
+			int tmp = edx;
+			edx = x;
+			if (tmp >= 0) {
+				edx++;
+			} else {
+				edx--;
+			}
+
+			x = edx;
 		}
-		break;
-	case 63:
-		{
+		if (ecx > esi) {
+			eax = var_4;
+			ecx -= esi;
+
+			x1 = ecx;
+			if (eax >= 0) {
+				y++;
+			} else {
+				y--;
+			}
+		}
+
+		if (eax == 0)
+			continue;
+
+		ecx = var_C;
+		eax = ecx;
+		eax /= unk2;
+		ecx++;
+		var_C = ecx;
+
+		if (edx != 0 && esi != i)
+			continue;
+
+		if (type == 2) {
+			Actor *a = derefActorSafe(id, "unknownE0");
+			a->drawActorToBackBuf(x, y);
+		} else if (type == 3) {
 			WizImage wi;
 			wi.flags = 0;
-			wi.y1 = y1;
-			wi.x1 = x1;
-			wi.resNum = num;
+			wi.y1 = y;
+			wi.x1 = x;
+			wi.resNum = id;
 			wi.state = 0;
 			displayWizImage(&wi);
-
-			type = 3;
+		} else {
+			unknownE0Helper(x, y, id);
 		}
+	}		
+}
+
+void ScummEngine_v80he::unknownE0Helper(int x, int y, int flags) {
+	VirtScreen *vs;
+
+	if (x < 0 || x > 639)
+		return;
+
+	if (y < 0)
+		return;
+
+	if ((vs = findVirtScreen(y)) == NULL)
+		return;
+
+	markRectAsDirty(vs->number, x, y, x, y + 1);
+
+	// TODO flags
+	if (flags & 0x4000) {
+
+
+	} else if (flags & 0x2000) {
+
+
+	} else if (flags & 0x8000) {
+
+
+	}
+}
+
+void ScummEngine_v80he::o80_unknownE0() {
+	int id, unk1, unk2, x, x1, y1, type;
+
+	unk2 = pop();
+	id = pop();
+	unk1 = pop();
+	x = pop();
+	y1 = pop();
+	x1 = pop();
+
+	byte subOp = fetchScriptByte();
+
+	switch (subOp) {
+	case 55:
+		type = 2;
+		unknownE0(x1, y1, x, unk1, unk2, type, id);
+		break;
+	case 63:
+		type = 3;
+		unknownE0(x1, y1, x, unk1, unk2, type, id);
 		break;
 	case 66:
 		type = 1;
+		unknownE0(x1, y1, x, unk1, unk2, type, id);
 		break;
 	default:
 		error("o80_unknownE0: default case %d", subOp);
 	}
 
-	debug(1,"o80_unknownE0 stub: type %d (%d, num %d, %d, %d, y %d, x %d)", type, b, num, c, d, y1, x1);	
 }
 
 void ScummEngine_v80he::o80_pickVarRandom() {





More information about the Scummvm-git-logs mailing list