[Scummvm-cvs-logs] CVS: scummvm/sword2/driver animation.cpp,1.22,1.23

Max Horn fingolfin at users.sourceforge.net
Sat Feb 21 12:13:04 CET 2004


Update of /cvsroot/scummvm/scummvm/sword2/driver
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30803/sword2/driver

Modified Files:
	animation.cpp 
Log Message:
unified code a little

Index: animation.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/driver/animation.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- animation.cpp	15 Feb 2004 14:22:54 -0000	1.22
+++ animation.cpp	21 Feb 2004 20:00:51 -0000	1.23
@@ -20,6 +20,10 @@
  */
 
 #include "common/stdafx.h"
+#include "common/file.h"
+#include "sound/vorbis.h"
+#include "sound/mp3.h"
+
 #include "sword2/sword2.h"
 #include "sword2/maketext.h"
 #include "sword2/driver/animation.h"
@@ -28,10 +32,8 @@
 #include "sword2/driver/menu.h"
 #include "sword2/driver/render.h"
 
-#include "common/file.h"
-
-#include "sound/vorbis.h"
-#include "sound/mp3.h"
+#define MOVIE_WIDTH		640
+#define MOVIE_HEIGHT	480
 
 namespace Sword2 {
 
@@ -119,7 +121,7 @@
 	lutcalcnum = (BITDEPTH + palettes[palnum].end + 2) / (palettes[palnum].end + 2);
 #else
 	buildLookup();
-	overlay = (NewGuiColor*)calloc(640 * 480, sizeof(NewGuiColor));
+	overlay = (NewGuiColor*)calloc(MOVIE_WIDTH * MOVIE_HEIGHT, sizeof(NewGuiColor));
 	_vm->_system->show_overlay();
 #endif
 
@@ -235,7 +237,6 @@
 	return false;
 }
 
-
 #else
 
 NewGuiColor *AnimationState::lookup = 0;
@@ -273,7 +274,7 @@
 
 void AnimationState::plotYUV(NewGuiColor *lut, int width, int height, byte *const *dat) {
 
-	NewGuiColor *ptr = overlay + (480 - height) / 2 * 640 + (640 - width) / 2;
+	NewGuiColor *ptr = overlay + (MOVIE_HEIGHT - height) / 2 * MOVIE_WIDTH + (MOVIE_WIDTH - width) / 2;
 
 	int x, y;
 
@@ -292,7 +293,7 @@
 			ptr[RENDERWIDE + linepos++] = lut[i + dat[0][width + ypos++]];
 
 		}
-		linepos += (2 * 640 - width);
+		linepos += (2 * MOVIE_WIDTH - width);
 		ypos += width;
 	}
 }
@@ -326,12 +327,12 @@
 void AnimationState::clearDisplay(void) {
 	NewGuiColor black = _vm->_system->RGBToColor(0, 0, 0);
 
-	for (int i = 0; i < 640 * 480; i++)
+	for (int i = 0; i < MOVIE_WIDTH * MOVIE_HEIGHT; i++)
 		overlay[i] = black;
 }
 
 void AnimationState::updateDisplay(void) {
-	_vm->_system->copy_rect_overlay(overlay, 640, 0, 0, 640, 480);
+	_vm->_system->copy_rect_overlay(overlay, MOVIE_WIDTH, 0, 0, MOVIE_WIDTH, MOVIE_HEIGHT);
 }
 
 #endif
@@ -651,7 +652,7 @@
 		memset(_vm->_graphics->_buffer, 0, _vm->_graphics->_screenWide * MENUDEEP);
 
 		uint8 msg[] = "Cutscene - Narration Only: Press ESC to exit, or visit www.scummvm.org to download cutscene videos";
-		Memory *data = _vm->_fontRenderer->makeTextSprite(msg, 640, 255, _vm->_speechFontId);
+		Memory *data = _vm->_fontRenderer->makeTextSprite(msg, MOVIE_WIDTH, 255, _vm->_speechFontId);
 		FrameHeader *frame = (FrameHeader *) data->ad;
 		SpriteInfo msgSprite;
 		uint8 *msgSurface;





More information about the Scummvm-git-logs mailing list