[Scummvm-cvs-logs] CVS: scummvm/scumm actor.cpp,1.96,1.97

Max Horn fingolfin at users.sourceforge.net
Tue May 20 05:26:21 CEST 2003


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv6753/scumm

Modified Files:
	actor.cpp 
Log Message:
merged common code

Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/actor.cpp,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -d -r1.96 -r1.97
--- actor.cpp	18 May 2003 23:14:21 -0000	1.96
+++ actor.cpp	20 May 2003 12:25:47 -0000	1.97
@@ -903,13 +903,32 @@
 
 	setupActorScale();
 
-	if (!(_vm->_features & GF_NEW_COSTUMES)) {
-		CostumeRenderer cr(_vm);
+	BaseCostumeRenderer *bcr;
 
-		cr._actorX = x - _vm->virtscr[0].xstart;
-		cr._actorY = y - elevation;
-		cr._scaleX = scalex;
-		cr._scaleY = scaley;
+	if (_vm->_features & GF_NEW_COSTUMES)
+		bcr = new AkosRenderer(_vm);
+	else
+		bcr = new CostumeRenderer(_vm);
+
+	bcr->_actorX = x - _vm->virtscr[0].xstart;
+	bcr->_actorY = y - elevation;
+	bcr->_scaleX = scalex;
+	bcr->_scaleY = scaley;
+
+	bcr->_shadow_mode = shadow_mode;
+	if (_vm->_features & GF_SMALL_HEADER)
+		bcr->_shadow_table = NULL;
+	else
+		bcr->_shadow_table = _vm->_shadowPalette;
+
+	bcr->setCostume(costume);
+	bcr->setPalette(palette);
+	bcr->setFacing(this);
+
+	bcr->_dirty_id = number;
+
+	if (!(_vm->_features & GF_NEW_COSTUMES)) {
+		CostumeRenderer& cr = *(CostumeRenderer *)bcr;
 
 		cr._outheight = _vm->virtscr[0].height;
 
@@ -923,34 +942,17 @@
 				cr._zbuf = _vm->gdi._numZBuffer;
 		}
 
-		cr._shadow_mode = shadow_mode;
-		if (_vm->_features & GF_SMALL_HEADER)
-			cr._shadow_table = NULL;
-		else
-			cr._shadow_table = _vm->_shadowPalette;
-
-		cr.setCostume(costume);
-		cr.setPalette(palette);
-		cr.setFacing(this);
-
 		cr._draw_top = top = 0xFF;
 		cr._draw_bottom = bottom = 0;
 
-		cr._dirty_id = number;
-
-		/* if the actor is partially hidden, redraw it next frame */
+		// if the actor is partially hidden, redraw it next frame
 		if (cr.drawCostume(cost) & 1) {
 			needBgReset = true;
 			needRedraw = true;
 		}
-		top = cr._draw_top;
-		bottom = cr._draw_bottom;
 	} else {
-		AkosRenderer ar(_vm);
-		ar._actorX = x - _vm->virtscr[0].xstart;
-		ar._actorY = y - elevation;
-		ar._scaleX = scalex;
-		ar._scaleY = scaley;
+		AkosRenderer& ar = *(AkosRenderer *)bcr;
+
 		ar._zbuf = forceClip;
 		if (ar._zbuf == 100) {
 			ar._zbuf = _vm->getMaskFromBox(walkbox);
@@ -962,18 +964,9 @@
 		ar.outwidth = _vm->virtscr[0].width;
 		ar.outheight = _vm->virtscr[0].height;
 
-		ar._shadow_mode = shadow_mode;
-		ar._shadow_table = _vm->_shadowPalette;
-
-		ar.setCostume(costume);
-		ar.setPalette(palette);
-		ar.setFacing(this);
-
 		ar._draw_top = top = 0x7fffffff;
 		ar._draw_bottom = bottom = 0;
 
-		ar._dirty_id = number;
-
 		if (ar.drawCostume(cost)) {
 			// FIXME: this breaks talking in The Dig because the actor
 			// is redrawn too often, thus breaking the waitForActor opcode.
@@ -986,9 +979,12 @@
 			//needBgReset = true;
 			//needRedraw = true;
 		}
-		top = ar._draw_top;
-		bottom = ar._draw_bottom;
 	}
+
+	top = bcr->_draw_top;
+	bottom = bcr->_draw_bottom;
+	
+	delete bcr;
 }
 
 void Actor::animateCostume() {





More information about the Scummvm-git-logs mailing list