[Scummvm-cvs-logs] SF.net SVN: scummvm:[34503] scummvm/trunk/engines/drascula

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Fri Sep 12 14:54:17 CEST 2008


Revision: 34503
          http://scummvm.svn.sourceforge.net/scummvm/?rev=34503&view=rev
Author:   thebluegr
Date:     2008-09-12 12:54:16 +0000 (Fri, 12 Sep 2008)

Log Message:
-----------
- Moved more animation data inside drascula.dat
- Merged copyRect and copyRectClip
- Added enums for all the possible character directions and removed duplicate directions
- Extended the talk sequence commands a bit
- Removed unnecessary buffer faceBuffer and the unneeded casts between byte * and char * that were used

Modified Paths:
--------------
    scummvm/trunk/engines/drascula/actors.cpp
    scummvm/trunk/engines/drascula/animation.cpp
    scummvm/trunk/engines/drascula/converse.cpp
    scummvm/trunk/engines/drascula/drascula.cpp
    scummvm/trunk/engines/drascula/drascula.h
    scummvm/trunk/engines/drascula/graphics.cpp
    scummvm/trunk/engines/drascula/rooms.cpp
    scummvm/trunk/engines/drascula/talk.cpp

Modified: scummvm/trunk/engines/drascula/actors.cpp
===================================================================
--- scummvm/trunk/engines/drascula/actors.cpp	2008-09-12 12:25:56 UTC (rev 34502)
+++ scummvm/trunk/engines/drascula/actors.cpp	2008-09-12 12:54:16 UTC (rev 34503)
@@ -28,45 +28,45 @@
 namespace Drascula {
 
 void DrasculaEngine::placeIgor() {
-	int pos_igor[6] = { 1, 0, igorX, igorY, 54, 61 };
+	int igY = 0;
 
 	if (currentChapter == 4) {
-		pos_igor[1] = 138;
+		igY = 138;
 	} else {
 		if (trackIgor == 3)
-			pos_igor[1] = 138;
+			igY = 138;
 		else if (trackIgor == 1)
-			pos_igor[1] = 76;
+			igY = 76;
 	}
 
-	copyRectClip(pos_igor, frontSurface, screenSurface);
+	copyRect(1, igY, igorX, igorY, 54, 61, frontSurface, screenSurface);
 }
 
 void DrasculaEngine::placeDrascula() {
-	int pos_dr[6] = { 0, 122, drasculaX, drasculaY, 45, 77 };
+	int drX = 0;
 
 	if (trackDrascula == 1)
-		pos_dr[0] = 47;
+		drX = 47;
 	else if (trackDrascula == 0)
-		pos_dr[0] = 1;
+		drX = 1;
 	else if (trackDrascula == 3 && currentChapter == 1)
-		pos_dr[0] = 93;
+		drX = 93;
 
 	if (currentChapter == 6)
-		copyRectClip(pos_dr, drawSurface2, screenSurface);
+		copyRect(drX, 122, drasculaX, drasculaY, 45, 77, drawSurface2, screenSurface);
 	else
-		copyRectClip(pos_dr, backSurface, screenSurface);
+		copyRect(drX, 122, drasculaX, drasculaY, 45, 77, backSurface, screenSurface);
 }
 
 void DrasculaEngine::placeBJ() {
-	int pos_bj[6] = { 0, 99, bjX, bjY, 26, 76 };
+	int bX = 0;
 
 	if (trackBJ == 3)
-		pos_bj[0] = 10;
+		bX = 10;
 	else if (trackBJ == 0)
-		pos_bj[0] = 37;
+		bX = 37;
 
-	copyRectClip(pos_bj, drawSurface3, screenSurface);
+	copyRect(bX, 99, bjX, bjY, 26, 76, drawSurface3, screenSurface);
 }
 
 void DrasculaEngine::hiccup(int counter) {
@@ -212,25 +212,29 @@
 		if (trackProtagonist == 0) {
 			curPos[1] = 0;
 			if (currentChapter == 2)
-				copyRectClip(curPos, extraSurface, screenSurface);
+				copyRect(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5],
+						 extraSurface, screenSurface);
 			else
 				reduce_hare_chico(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5],
 									factor_red[curY + curHeight], extraSurface, screenSurface);
 		} else if (trackProtagonist == 1) {
 			if (currentChapter == 2)
-				copyRectClip(curPos, extraSurface, screenSurface);
+				copyRect(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5],
+						 extraSurface, screenSurface);
 			else
 				reduce_hare_chico(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5],
 									factor_red[curY + curHeight], extraSurface, screenSurface);
 		} else if (trackProtagonist == 2) {
 			if (currentChapter == 2)
-				copyRectClip(curPos, backSurface, screenSurface);
+				copyRect(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5],
+						 backSurface, screenSurface);
 			else
 				reduce_hare_chico(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5],
 									factor_red[curY + curHeight], backSurface, screenSurface);
 		} else {
 			if (currentChapter == 2)
-				copyRectClip(curPos, frontSurface, screenSurface);
+				copyRect(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5],
+						 frontSurface, screenSurface);
 			else
 				reduce_hare_chico(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5],
 									factor_red[curY + curHeight], frontSurface, screenSurface);
@@ -250,25 +254,29 @@
 		if (trackProtagonist == 0) {
 			curPos[1] = 0;
 			if (currentChapter == 2)
-				copyRectClip(curPos, extraSurface, screenSurface);
+				copyRect(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5],
+						 extraSurface, screenSurface);
 			else
 				reduce_hare_chico(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5],
 									factor_red[curY + curHeight], extraSurface, screenSurface);
 		} else if (trackProtagonist == 1) {
 			if (currentChapter == 2)
-				copyRectClip(curPos, extraSurface, screenSurface);
+				copyRect(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5],
+						 extraSurface, screenSurface);
 			else
 				reduce_hare_chico(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5],
 									factor_red[curY + curHeight], extraSurface, screenSurface);
 		} else if (trackProtagonist == 2) {
 			if (currentChapter == 2)
-				copyRectClip(curPos, backSurface, screenSurface);
+				copyRect(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5],
+						 backSurface, screenSurface);
 			else
 				reduce_hare_chico(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5],
 									factor_red[curY + curHeight], backSurface, screenSurface);
 		} else {
 			if (currentChapter == 2)
-				copyRectClip(curPos, frontSurface, screenSurface);
+				copyRect(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5],
+						 frontSurface, screenSurface);
 			else
 				reduce_hare_chico(curPos[0], curPos[1], curPos[2], curPos[3], curPos[4], curPos[5],
 									factor_red[curY + curHeight], frontSurface, screenSurface);
@@ -288,11 +296,11 @@
 	distanceY = (curY + curHeight) - roomY;
 
 	if (distanceX < distanceY) {
-		curDirection = 0;
+		curDirection = kDirectionUp;
 		trackProtagonist = 2;
 		stepX = (int)(distanceX / (distanceY / STEP_Y));
 	} else {
-		curDirection = 7;
+		curDirection = kDirectionUp;
 		trackProtagonist = 0;
 		stepY = (int)(distanceY / (distanceX / STEP_X));
 	}
@@ -309,11 +317,11 @@
 	distanceY = (curY + curHeight) - roomY;
 
 	if (distanceX < distanceY) {
-		curDirection = 1;
+		curDirection = kDirectionRight;
 		trackProtagonist = 2;
 		stepX = (int)(distanceX / (distanceY / STEP_Y));
 	} else {
-		curDirection = 2;
+		curDirection = kDirectionRight;
 		trackProtagonist = 1;
 		stepY = (int)(distanceY / (distanceX / STEP_X));
 	}
@@ -330,11 +338,11 @@
 	distanceY = roomY - (curY + curHeight);
 
 	if (distanceX < distanceY) {
-		curDirection = 5;
+		curDirection = kDirectionLeft;
 		trackProtagonist = 3;
 		stepX = (int)(distanceX / (distanceY / STEP_Y));
 	} else {
-		curDirection = 6;
+		curDirection = kDirectionLeft;
 		trackProtagonist = 0;
 		stepY = (int)(distanceY / (distanceX / STEP_X));
 	}
@@ -351,11 +359,11 @@
 	distanceY = roomY - (curY + curHeight);
 
 	if (distanceX < distanceY) {
-		curDirection = 4;
+		curDirection = kDirectionDown;
 		trackProtagonist = 3;
 		stepX = (int)(distanceX / (distanceY / STEP_Y));
 	} else {
-		curDirection = 3;
+		curDirection = kDirectionDown;
 		trackProtagonist = 1;
 		stepY = (int)(distanceY / (distanceX / STEP_X));
 	}
@@ -370,16 +378,16 @@
 		if (num_frame == 6)
 			num_frame = 0;
 
-		if (curDirection == 0 || curDirection == 7) {
+		if (curDirection == kDirectionUp) {
 			curX -= stepX;
 			curY -= stepY;
-		} else if (curDirection == 1 || curDirection == 2) {
+		} else if (curDirection == kDirectionRight) {
 			curX += stepX;
 			curY -= stepY;
-		} else if (curDirection == 3 || curDirection == 4) {
+		} else if (curDirection == kDirectionDown) {
 			curX += stepX;
 			curY += stepY;
-		} else if (curDirection == 5 || curDirection == 6) {
+		} else if (curDirection == kDirectionLeft) {
 			curX -= stepX;
 			curY += stepY;
 		}
@@ -394,13 +402,13 @@
 }
 
 void DrasculaEngine::walkDown() {
-	curDirection = 4;
+	curDirection = kDirectionDown;
 	trackProtagonist = 3;
 	stepX = 0;
 }
 
 void DrasculaEngine::walkUp() {
-	curDirection = 0;
+	curDirection = kDirectionUp;
 	trackProtagonist = 2;
 	stepX = 0;
 }
@@ -432,7 +440,8 @@
 			actorFrames[kFrameVonBraun] = 1;
 	}
 
-	copyRectClip(pos_vb, frontSurface, screenSurface);
+	copyRect(pos_vb[0], pos_vb[1], pos_vb[2], pos_vb[3], pos_vb[4], pos_vb[5],
+			 frontSurface, screenSurface);
 }
 
 void DrasculaEngine::placeVonBraun(int pointX) {

Modified: scummvm/trunk/engines/drascula/animation.cpp
===================================================================
--- scummvm/trunk/engines/drascula/animation.cpp	2008-09-12 12:25:56 UTC (rev 34502)
+++ scummvm/trunk/engines/drascula/animation.cpp	2008-09-12 12:54:16 UTC (rev 34503)
@@ -55,7 +55,7 @@
 // This is the game's introduction sequence
 void DrasculaEngine::animation_1_1() {
 	int l, l2, p;
-	int pixelPos[6];
+	//int pixelPos[6];
 
 	while (term_int == 0) {
 		playMusic(29);
@@ -147,19 +147,13 @@
 				break;
 
 		l2 = 0; p = 0;
-		pixelPos[3] = 45;
-		pixelPos[4] = 63;
-		pixelPos[5] = 31;
 
 		for (l = 0; l < 180; l++) {
 			copyBackground(0, 0, 320 - l, 0, l, 200, drawSurface3, screenSurface);
 			copyBackground(l, 0, 0, 0, 320 - l, 200, bgSurface, screenSurface);
 
-			pixelPos[0] = interf_x[l2];
-			pixelPos[1] = interf_y[l2];
-			pixelPos[2] = 156 - l;
-
-			copyRectClip(pixelPos, drawSurface2, screenSurface);
+			copyRect(interf_x[l2], interf_y[l2], 156 - l, 45, 63, 31, 
+					 drawSurface2, screenSurface);
 			updateScreen();
 			p++;
 			if (p == 6) {
@@ -485,23 +479,8 @@
 		curX = 100;
 		curY = 95;
 
-		talk_bj(2);
-		talk(215);
-		talk_bj(3);
-		talk(216);
-		talk_bj(4);
-		talk_bj(5);
-		talk_bj(6);
-		talk(217);
-		talk_bj(7);
-		talk(218);
-		talk_bj(8);
-		talk(219);
-		talk_bj(9);
-		talk(220);
-		talk(221);
-		talk_bj(10);
-		talk(222);
+		playTalkSequence(2);	// sequence 2, chapter 1
+
 		if (animate("gaf.bin", 15))
 			break;
 		if (animate("bjb.bin", 14))
@@ -594,29 +573,8 @@
 void DrasculaEngine::animation_3_1() {
 	loadPic("an11y13.alg", extraSurface);
 
-	talk(192);
-	talk_bartender(1);
-	talk(193);
-	talk_bartender(2);
-	talk(194);
-	talk_bartender(3);
-	talk(195);
-	talk_bartender(4);
-	talk(196);
-	talk_bartender(5);
-	talk_bartender(6);
-	talk(197);
-	talk_bartender(7);
-	talk(198);
-	talk_bartender(8);
-	talk(199);
-	talk_bartender(9);
-	talk(200);
-	talk(201);
-	talk(202);
+	playTalkSequence(3);	// sequence 3, chapter 1
 
-	flags[0] = 1;
-
 	loadPic(97, extraSurface);
 }
 
@@ -757,7 +715,7 @@
 }
 
 void DrasculaEngine::animation_14_2() {
-	int cabinPos[6] = { 150, 6, 69, -160, 158, 161 };
+	int cY = -160;
 	int l = 0;
 
 	loadPic("an14_2.alg", backSurface);
@@ -767,8 +725,8 @@
 		updateRefresh_pre();
 		moveCharacters();
 		moveVonBraun();
-		cabinPos[3] = n;
-		copyRectClip(cabinPos, backSurface, screenSurface);
+		cY = n;
+		copyRect(150, 6, 69, cY, 158, 161, backSurface, screenSurface);
 		updateRefresh();
 		updateScreen();
 		l++;
@@ -1050,7 +1008,7 @@
 }
 
 void DrasculaEngine::animation_25_2() {
-	int cabinPos[6] = { 150, 6, 69, 0, 158, 161 };
+	int cY = 0;
 
 	loadPic("an14_2.alg", backSurface);
 	loadPic(18, bgSurface);
@@ -1066,9 +1024,9 @@
 		moveCharacters();
 		moveVonBraun();
 
-		cabinPos[3] = n;
+		cY = n;
 
-		copyRectClip(cabinPos, backSurface, screenSurface);
+		copyRect(150, 6, 69, cY, 158, 161, backSurface, screenSurface);
 
 		updateRefresh();
 		updateScreen();
@@ -1100,29 +1058,7 @@
 
 void DrasculaEngine::animation_29_2() {
 	if (flags[33] == 0) {
-		// TODO: eventually move this to drascula.dat, along with any other
-		// sequences
-		TalkSequenceCommand anim29_2Seq[] = {
-			// Chapter, sequence,		 command type, action
-			{		 -1,	  -1,	  kTalkerVBNormal,	  32 },
-			{		 -1,	  -1,	   kTalkerGeneral,	 398 },
-			{		 -1,	  -1,	  kTalkerVBNormal,	  33 },
-			{		 -1,	  -1,	   kTalkerGeneral,	 399 },
-			{		 -1,	  -1,	  kTalkerVBNormal,	  34 },
-			{		 -1,	  -1,	  kTalkerVBNormal,	  35 },
-			{		 -1,	  -1,	   kTalkerGeneral,	 400 },
-			{		 -1,	  -1,	  kTalkerVBNormal,	  36 },
-			{		 -1,	  -1,	  kTalkerVBNormal,	  37 },
-			{		 -1,	  -1,	   kTalkerGeneral,	 386 },
-			{		 -1,	  -1,	  kTalkerVBNormal,	  38 },
-			{		 -1,	  -1,	  kTalkerVBNormal,	  39 },
-			{		 -1,	  -1,	   kTalkerGeneral,	 401 },
-			{		 -1,	  -1,	  kTalkerVBNormal,	  40 },
-			{		 -1,	  -1,	  kTalkerVBNormal,	  41 },
-			{		 -1,	  -1,			 kSetFlag,	   1 }
-		};
-
-		playTalkSequence(anim29_2Seq, ARRAYSIZE(anim29_2Seq));
+		playTalkSequence(29);	// sequence 29, chapter 2
 	} else
 		talk_vonBraun(43, kVonBraunNormal);
 
@@ -1142,38 +1078,9 @@
 	pause(15);
 	gotoObject(159, 140);
 	loadPic(99, backSurface);
-	trackProtagonist = 2;
-	updateRoom();
-	updateScreen();
-	pause(78);
-	trackProtagonist = 0;
-	updateRoom();
-	updateScreen();
-	pause(22);
-	talk(406);
-	placeVonBraun(98);
-	talk_vonBraun(45, kVonBraunNormal);
-	talk_vonBraun(46, kVonBraunNormal);
-	talk_vonBraun(47, kVonBraunNormal);
-	talk(407);
-	talk_vonBraun(48, kVonBraunNormal);
-	talk_vonBraun(49, kVonBraunNormal);
-	talk(408);
-	talk_vonBraun(50, kVonBraunNormal);
-	talk_vonBraun(51, kVonBraunNormal);
-	talk(409);
-	talk_vonBraun(52, kVonBraunNormal);
-	talk_vonBraun(53, kVonBraunNormal);
-	pause(12);
-	talk_vonBraun(54, kVonBraunNormal);
-	talk_vonBraun(55, kVonBraunNormal);
-	talk(410);
-	talk_vonBraun(56, kVonBraunNormal);
 
-	breakOut = 1;
+	playTalkSequence(31);	// sequence 31, chapter 2
 
-	flags[38] = 0;
-	flags[36] = 1;
 	selectVerb(0);
 	removeObject(kItemLeaves);
 	removeObject(kItemBubbleGum);
@@ -1583,12 +1490,11 @@
 	int frame = 0;
 	int frus_x[] = {1, 46, 91, 136, 181, 226, 271};
 	int frus_y[] = {1, 1, 1, 1, 1, 1, 1, 89};
-	int pos_frusky[6] = { 1, 1, frank_x, 81, 44, 87 };
 
 	loadPic("auxfr.alg", backSurface);
 
 	updateRoom();
-	copyRectClip(pos_frusky, backSurface, screenSurface);
+	copyRect(1, 1, frank_x, 81, 44, 87, backSurface, screenSurface);
 	updateScreen();
 	pause(15);
 
@@ -1596,10 +1502,7 @@
 
 	for (;;) {
 		updateRoom();
-		pos_frusky[0] = frus_x[frame];
-		pos_frusky[1] = frus_y[frame];
-		pos_frusky[2] = frank_x;
-		copyRectClip( pos_frusky, backSurface, screenSurface);
+		copyRect(frus_x[frame], frus_y[frame], frank_x, 81, 44, 87, backSurface, screenSurface);
 		updateScreen();
 		frank_x -= 5;
 		frame++;
@@ -1708,15 +1611,15 @@
 }
 
 void DrasculaEngine::animation_5_6() {
-	int pos_pen[6] = { 1, 29, 204, -125, 18, 125 };
+	int pY = -125;
 
 	animate("man.bin", 14);
 
 	for (int n = -125; n <= 0; n = n + 2) {
 		copyBackground();
 		updateRefresh_pre();
-		pos_pen[3] = n;
-		copyRectClip(pos_pen, drawSurface3, screenSurface);
+		pY = n;
+		copyRect(1, 29, 204, pY, 18, 125, drawSurface3, screenSurface);
 
 		updateRefresh();
 
@@ -1932,15 +1835,7 @@
 void DrasculaEngine::animation_11_2() {
 	loadPic("an11y13.alg", extraSurface);
 
-	talk(352);
-	talk_bartender(1);
-	talk(353);
-	talk_bartender(17);
-	talk(354);
-	talk_bartender(18);
-	talk(355);
-	pause(40);
-	talk_bartender(82);
+	playTalkSequence(11);	// sequence 11, chapter 2
 
 	loadPic(974, extraSurface);
 }
@@ -1949,41 +1844,12 @@
 	loadPic("an11y13.alg", frontSurface);
 
 	if (flags[41] == 0) {
-		talk(103);
-		talk_drunk(4);
-		flags[12] = 1;
-		talk(367);
-		talk_drunk(5);
-		flags[12] = 1;
-		talk(368);
-		talk_drunk(6);
-		talk_drunk(7);
-		flags[41] = 1;
+		playTalkSequence(13);	// sequence 13, chapter 2
 	}
-	converse(2);
 
 	loadPic(964, frontSurface);
 }
 
-void DrasculaEngine::animation_22_2() {
-	talk(374);
-
-	trackProtagonist=2;
-	updateRoom();
-	updateScreen();
-	playSound(13);
-	finishSound();
-	trackProtagonist = 1;
-
-	talk_vonBraun(1, kVonBraunDoor);
-	talk(375);
-	talk_vonBraun(2, kVonBraunDoor);
-	talk(376);
-	talk_vonBraun(3, kVonBraunDoor);
-
-	flags[18] = 1;
-}
-
 void DrasculaEngine::animation_24_2() {
 	if (curX < 178)
 		gotoObject(208, 136);

Modified: scummvm/trunk/engines/drascula/converse.cpp
===================================================================
--- scummvm/trunk/engines/drascula/converse.cpp	2008-09-12 12:25:56 UTC (rev 34502)
+++ scummvm/trunk/engines/drascula/converse.cpp	2008-09-12 12:54:16 UTC (rev 34503)
@@ -27,7 +27,7 @@
 
 namespace Drascula {
 
-void DrasculaEngine::checkTalkSequence(int sequence) {
+void DrasculaEngine::playTalkSequence(int sequence) {
 	bool seen = false;
 
 	for (int i = 0; i < _talkSequencesSize; i++) {
@@ -41,11 +41,6 @@
 	}	
 }
 
-void DrasculaEngine::playTalkSequence(TalkSequenceCommand *seq, int size) {
-	for (int i = 0; i < size; i++)
-		doTalkSequenceCommand(seq[i]);
-}
-
 void DrasculaEngine::doTalkSequenceCommand(TalkSequenceCommand cmd) {
 	switch (cmd.commandType) {
 		case kPause:
@@ -66,6 +61,27 @@
 		case kBreakOut:
 			breakOut = 1;
 			break;
+		case kConverse:
+			converse(cmd.action);
+			break;
+		case kPlaceVB:
+			placeVonBraun(cmd.action);
+			break;
+		case kUpdateRoom:
+			updateRoom();
+			break;
+		case kUpdateScreen:
+			updateScreen();
+			break;
+		case kTrackProtagonist:
+			trackProtagonist = cmd.action;
+			break;
+		case kPlaySound:
+			playSound(cmd.action);
+			break;
+		case kFinishSound:
+			finishSound();
+			break;
 		case kTalkerGeneral:
 			talk(cmd.action);
 			break;
@@ -96,11 +112,14 @@
 		case kTalkerDrascula:
 			talk_drascula(cmd.action, 1);
 			break;
-		case kTalkerBartender:
+		case kTalkerBartender0:
+			talk_bartender(cmd.action, 0);
+			break;
+		case kTalkerBartender1:
 			talk_bartender(cmd.action, 1);
 			break;
 		default:
-			error("doTalkSequenceCommand: Unknown command");
+			error("doTalkSequenceCommand: Unknown command: %d", cmd.commandType);
 	}
 }
 
@@ -256,7 +275,7 @@
 }
 
 void DrasculaEngine::response(int function) {
-	checkTalkSequence(function);
+	playTalkSequence(function);
 
 	if (currentChapter == 2) {
 		if (function == 16)

Modified: scummvm/trunk/engines/drascula/drascula.cpp
===================================================================
--- scummvm/trunk/engines/drascula/drascula.cpp	2008-09-12 12:25:56 UTC (rev 34502)
+++ scummvm/trunk/engines/drascula/drascula.cpp	2008-09-12 12:54:16 UTC (rev 34503)
@@ -764,7 +764,6 @@
 	float totalX, totalY;
 	int n, m;
 	float pixelX, pixelY;
-	int pixelPos[6];
 
 	newWidth = (width * factor) / 100;
 	newHeight = (height * factor) / 100;
@@ -777,15 +776,9 @@
 
 	for (n = 0; n < newHeight; n++) {
 		for (m = 0; m < newWidth; m++) {
-			pixelPos[0] = (int)pixelX;
-			pixelPos[1] = (int)pixelY;
-			pixelPos[2] = xx2 + m;
-			pixelPos[3] = yy2 + n;
-			pixelPos[4] = 1;
-			pixelPos[5] = 1;
+			copyRect((int)pixelX, (int)pixelY, xx2 + m, yy2 + n, 
+					 1, 1, dir_inicio, dir_fin);
 
-			copyRectClip(pixelPos, dir_inicio, dir_fin);
-
 			pixelX += totalX;
 		}
 		pixelX = xx1;

Modified: scummvm/trunk/engines/drascula/drascula.h
===================================================================
--- scummvm/trunk/engines/drascula/drascula.h	2008-09-12 12:25:56 UTC (rev 34502)
+++ scummvm/trunk/engines/drascula/drascula.h	2008-09-12 12:54:16 UTC (rev 34503)
@@ -46,7 +46,7 @@
 
 namespace Drascula {
 
-#define DRASCULA_DAT_VER 3
+#define DRASCULA_DAT_VER 4
 #define DATAALIGNMENT 4
 
 enum DrasculaGameFeatures {
@@ -164,19 +164,34 @@
 	kPickObject = 3,
 	kAddObject = 4,
 	kBreakOut = 5,
-	kTalkerGeneral = 6,
-	kTalkerDrunk = 7,
-	kTalkerPianist = 8,
-	kTalkerBJ = 9,
-	kTalkerVBNormal = 10,
-	kTalkerVBDoor = 11,
-	kTalkerIgorSeated = 12,
-	kTalkerWerewolf = 13,
-	kTalkerMus = 14,
-	kTalkerDrascula = 15,
-	kTalkerBartender = 16
+	kConverse = 6,
+	kPlaceVB = 7,
+	kUpdateRoom = 8,
+	kUpdateScreen = 9,
+	kTrackProtagonist = 10,
+	kPlaySound = 11,
+	kFinishSound = 12,
+	kTalkerGeneral = 13,
+	kTalkerDrunk = 14,
+	kTalkerPianist = 15,
+	kTalkerBJ = 16,
+	kTalkerVBNormal = 17,
+	kTalkerVBDoor = 18,
+	kTalkerIgorSeated = 19,
+	kTalkerWerewolf = 20,
+	kTalkerMus = 21,
+	kTalkerDrascula = 22,
+	kTalkerBartender0 = 23,
+	kTalkerBartender1 = 24
 };
 
+enum CharacterDirections {
+	kDirectionUp = 0,
+	kDirectionDown = 1,
+	kDirectionLeft = 2,
+	kDirectionRight = 3
+};
+
 enum MouseCursors {
 	kCursorCrosshair = 0,
 	kCursorCurrentItem = 1
@@ -308,7 +323,6 @@
 
 	void copyRect(int xorg, int yorg, int xdes, int ydes, int width,
 				int height, byte *src, byte *dest);
-	void copyRectClip(int *Array, byte *src, byte *dest);
 	void updateScreen() {
 		updateScreen(0, 0, 0, 0, 320, 200, screenSurface);
 	}
@@ -542,9 +556,8 @@
 	void setupRoomsTable();
 	bool roomParse(int, int);
 	void cleanupString(char *string);
-	void checkTalkSequence(int sequence);
+	void playTalkSequence(int sequence);
 	void doTalkSequenceCommand(TalkSequenceCommand cmd);
-	void playTalkSequence(TalkSequenceCommand *seq, int size);
 	void converse(int);
 	void print_abc_opc(const char *, int, int);
 	void response(int);
@@ -617,7 +630,6 @@
 	void animation_14_2();
 	void animation_16_2();
 	void animation_20_2();
-	void animation_22_2();
 	void animation_23_2();
 	void animation_23_joined();
 	void animation_23_joined2();

Modified: scummvm/trunk/engines/drascula/graphics.cpp
===================================================================
--- scummvm/trunk/engines/drascula/graphics.cpp	2008-09-12 12:25:56 UTC (rev 34502)
+++ scummvm/trunk/engines/drascula/graphics.cpp	2008-09-12 12:54:16 UTC (rev 34503)
@@ -165,24 +165,7 @@
 								   int height, byte *src, byte *dest) {
 	int y, x;
 
-	dest += xdes + ydes * 320;
-	src += xorg + yorg * 320;
-
-	for (y = 0; y < height; y++)
-		for (x = 0; x < width; x++)
-			if (src[x + y * 320] != 255)
-				dest[x + y * 320] = src[x + y * 320];
-}
-
-void DrasculaEngine::copyRectClip(int *Array, byte *src, byte *dest) {
-	int y, x;
-	int xorg = Array[0];
-	int yorg = Array[1];
-	int xdes = Array[2];
-	int ydes = Array[3];
-	int width = Array[4];
-	int height = Array[5];
-
+	//
 	if (ydes < 0) {
 		yorg += -ydes;
 		height += ydes;
@@ -197,6 +180,7 @@
 		width -= (xdes + width) - 320;
 	if ((ydes + height) > 199)
 		height -= (ydes + height) - 200;
+	//
 
 	dest += xdes + ydes * 320;
 	src += xorg + yorg * 320;
@@ -258,8 +242,8 @@
 			}	// if
 		}	// for
 
-		int textPos[6] = { letterX, letterY, screenX, screenY, CHAR_WIDTH, CHAR_HEIGHT };
-		copyRectClip(textPos, tableSurface, screenSurface);
+		copyRect(letterX, letterY, screenX, screenY, 
+				 CHAR_WIDTH, CHAR_HEIGHT, tableSurface, screenSurface);
 
 		screenX = screenX + CHAR_WIDTH;
 		if (screenX > 317) {
@@ -310,8 +294,8 @@
 			}	// if
 		}	// for
 
-		int textPos[6] = { letterX, letterY, screenX, screenY, CHAR_WIDTH_OPC, CHAR_HEIGHT_OPC };
-		copyRectClip(textPos, backSurface, screenSurface);
+		copyRect(letterX, letterY, screenX, screenY, 
+				 CHAR_WIDTH_OPC, CHAR_HEIGHT_OPC, backSurface, screenSurface);
 
 		screenX = screenX + CHAR_WIDTH_OPC;
 	}

Modified: scummvm/trunk/engines/drascula/rooms.cpp
===================================================================
--- scummvm/trunk/engines/drascula/rooms.cpp	2008-09-12 12:25:56 UTC (rev 34502)
+++ scummvm/trunk/engines/drascula/rooms.cpp	2008-09-12 12:54:16 UTC (rev 34503)
@@ -29,6 +29,24 @@
 
 namespace Drascula {
 
+struct doorInfo {
+	int chapter;
+	int doorNum;
+	int flag;
+};
+
+doorInfo doors[] = {
+	{	2,	138,	 0 },	{	2,	136,	 8 },
+	{	2,	156,	16 },	{	2,	163,	17 },
+	{	2,	177,	15 },	{	2,	175,	40 },
+	{	2,	173,	36 },	{	4,	103,	 0 },
+	{	4,	104,	 1 },	{	4,	105,	 1 },
+	{	4,	106,	 2 },	{	4,	107,	 2 },
+	{	4,	110,	 6 },	{	4,	114,	 4 },
+	{	4,	115,	 4 },	{	4,	117,	 5 },
+	{	4,	120,	 8 },	{	4,	122,	 7 }
+};
+
 typedef bool (DrasculaEngine::*RoomParser)(int args);
 
 struct DrasculaRoomParser {
@@ -480,7 +498,7 @@
 	} else if (pickedObject == kVerbOpen && fl == 177 && flags[18] == 1)
 		talk(346);
 	else if (pickedObject == kVerbOpen && fl == 177 && flags[14] == 0 && flags[18] == 0)
-		animation_22_2();
+		playTalkSequence(22);	// sequence 22, chapter 2
 	else if (pickedObject == kVerbOpen && fl == 177 && flags[14] == 1)
 		toggleDoor(15, 1, kOpenDoor);
 	else if (pickedObject == kVerbClose && fl == 177 && flags[14] == 1)
@@ -1124,8 +1142,8 @@
 }
 
 void DrasculaEngine::update_2() {
-	int batPos[6];
 	int difference;
+	int w, h;
 	int batX[] = {0, 38, 76, 114, 152, 190, 228, 266,
 					0, 38, 76, 114, 152, 190, 228, 266,
 					0, 38, 76, 114, 152, 190,
@@ -1145,24 +1163,19 @@
 	if (actorFrames[kFrameBat] == 41)
 		actorFrames[kFrameBat] = 0;
 
-	batPos[0] = batX[actorFrames[kFrameBat]];
-	batPos[1] = batY[actorFrames[kFrameBat]];
-
 	if (actorFrames[kFrameBat] < 22) {
-		batPos[4] = 37;
-		batPos[5] = 21;
+		w = 37;
+		h = 21;
 	} else if (actorFrames[kFrameBat] > 27) {
-		batPos[4] = 57;
-		batPos[5] = 36;
+		w = 57;
+		h = 36;
 	} else {
-		batPos[4] = 47;
-		batPos[5] = 22;
+		w = 47;
+		h = 22;
 	}
 
-	batPos[2] = 239;
-	batPos[3] = 19;
-
-	copyRectClip(batPos, drawSurface3, screenSurface);
+	copyRect(batX[actorFrames[kFrameBat]], batY[actorFrames[kFrameBat]], 
+			 239, 19, w, h, drawSurface3, screenSurface);
 	difference = getTime() - savedTime;
 	if (difference >= 6) {
 		actorFrames[kFrameBat]++;
@@ -1845,32 +1858,7 @@
 		if (roomNumber == 45)
 			hare_se_ve = 0;
 		if (roomNumber == 49 && flags[7] == 0) {
-			flags[7] = 1;
-			updateRoom();
-			updateScreen();
-
-			// TODO: eventually move this to drascula.dat, along with any other
-			// sequences
-			TalkSequenceCommand room45Seq[] = {
-				// Chapter, sequence,		 command type, action
-				{		 -1,	  -1,	  kTalkerGeneral,	 228 },
-				{		 -1,	  -1,	 kTalkerWerewolf,	   1 },
-				{		 -1,	  -1,	 kTalkerWerewolf,	   2 },
-				{		 -1,	  -1,			  kPause,	  23 },
-				{		 -1,	  -1,	  kTalkerGeneral,	 229 },
-				{		 -1,	  -1,	 kTalkerWerewolf,	   3 },
-				{		 -1,	  -1,	 kTalkerWerewolf,	   4 },
-				{		 -1,	  -1,	  kTalkerGeneral,	 230 },
-				{		 -1,	  -1,	 kTalkerWerewolf,	   5 },
-				{		 -1,	  -1,	  kTalkerGeneral,	 231 },
-				{		 -1,	  -1,	 kTalkerWerewolf,	   6 },
-				{		 -1,	  -1,	 kTalkerWerewolf,	   7 },
-				{		 -1,	  -1,			  kPause,	  33 },
-				{		 -1,	  -1,	  kTalkerGeneral,	 232 },
-				{		 -1,	  -1,	 kTalkerWerewolf,	   8 },
-			};
-
-			playTalkSequence(room45Seq, ARRAYSIZE(room45Seq));
+			playTalkSequence(4);	// sequence 4, chapter 5
 		}
 	}
 
@@ -1974,24 +1962,6 @@
 }
 
 void DrasculaEngine::updateDoor(int doorNum) {
-	struct doorInfo {
-		int chapter;
-		int doorNum;
-		int flag;
-	};
-
-	doorInfo doors[] = {
-		{	2,	138,	 0 },	{	2,	136,	 8 },
-		{	2,	156,	16 },	{	2,	163,	17 },
-		{	2,	177,	15 },	{	2,	175,	40 },
-		{	2,	173,	36 },	{	4,	103,	 0 },
-		{	4,	104,	 1 },	{	4,	105,	 1 },
-		{	4,	106,	 2 },	{	4,	107,	 2 },
-		{	4,	110,	 6 },	{	4,	114,	 4 },
-		{	4,	115,	 4 },	{	4,	117,	 5 },
-		{	4,	120,	 8 },	{	4,	122,	 7 }
-	};
-
 	if (currentChapter != 2 && currentChapter != 4)
 		return;
 

Modified: scummvm/trunk/engines/drascula/talk.cpp
===================================================================
--- scummvm/trunk/engines/drascula/talk.cpp	2008-09-12 12:25:56 UTC (rev 34502)
+++ scummvm/trunk/engines/drascula/talk.cpp	2008-09-12 12:54:16 UTC (rev 34503)
@@ -594,9 +594,9 @@
 	const char *said = _textd[index + TEXTD_START - 1];
 	const char *syncChar = _textd1[index - 1];
 
-	byte *faceBuffer;
 	int p = 0;
-	int pos_blind[6] = { 0, 2, 73, 1, 126, 149 };
+	int bX = 0;
+	int h = 149;
 	int length = strlen(said);
 
 	color_abc(kColorBrown);
@@ -608,27 +608,25 @@
 
 	do {
 		copyBackground();
-		pos_blind[5] = 149;
+		h = 149;
 		char c = toupper(syncChar[p]);
 
 		if (c == '0' || c == '2' || c == '4' || c == '6')
-			pos_blind[0] = 1;
+			bX = 1;
 		else
-			pos_blind[0] = 132;
+			bX = 132;
 
 		if (c == '0' || c == '1')
-			faceBuffer = drawSurface3;
+			copyRect(bX, 2, 73, 1, 126, h, drawSurface3, screenSurface);
 		else if (c == '2' || c == '3')
-			faceBuffer = extraSurface;
+			copyRect(bX, 2, 73, 1, 126, h, extraSurface, screenSurface);
 		else if (c == '4' || c == '5')
-			faceBuffer = backSurface;
+			copyRect(bX, 2, 73, 1, 126, h, backSurface, screenSurface);
 		else {
-			faceBuffer = frontSurface;
-			pos_blind[5] = 146;
+			h = 146;
+			copyRect(bX, 2, 73, 1, 126, h, frontSurface, screenSurface);
 		}
 
-		copyRectClip( pos_blind, faceBuffer, screenSurface);
-
 		if (withVoices == 0)
 			centerText(said, 310, 71);
 
@@ -772,7 +770,6 @@
 	char filename[20];
 	sprintf(filename, "%i.als", index);
 	const char *said = _text[index];
-	char *faceBuffer;
 	int x_talk[3] = {1, 94, 187};
 	int face, curScreen;
 	int length = strlen(said);
@@ -785,17 +782,15 @@
 		face = _rnd->getRandomNumber(2);
 		curScreen = _rnd->getRandomNumber(2);
 
+		copyBackground();
+
 		if (face == 0 && curScreen == 0)
-			faceBuffer = (char *)drawSurface3;
+			copyBackground(x_talk[face], 1, 45, 24, 92, 108, drawSurface3, screenSurface);
 		else if (curScreen == 1)
-			faceBuffer = (char *)frontSurface;
+			copyBackground(x_talk[face], 1, 45, 24, 92, 108, frontSurface, screenSurface);
 		else
-			faceBuffer = (char *)backSurface;
-
-		copyBackground();
-
-		copyBackground(x_talk[face], 1, 45, 24, 92, 108, (byte *)faceBuffer, screenSurface);
-
+			copyBackground(x_talk[face], 1, 45, 24, 92, 108, backSurface, screenSurface);
+		
 		if (withVoices == 0)
 			centerText(said, 90, 50);
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list