[Scummvm-cvs-logs] SF.net SVN: scummvm: [32161] scummvm/trunk/engines/gob

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Sun May 18 01:55:05 CEST 2008


Revision: 32161
          http://scummvm.svn.sourceforge.net/scummvm/?rev=32161&view=rev
Author:   drmccoy
Date:     2008-05-17 16:55:04 -0700 (Sat, 17 May 2008)

Log Message:
-----------
Changing the split stuff again, fixing several scrolling and hotspot-text related issues

Modified Paths:
--------------
    scummvm/trunk/engines/gob/draw_v2.cpp
    scummvm/trunk/engines/gob/inter.h
    scummvm/trunk/engines/gob/inter_v2.cpp
    scummvm/trunk/engines/gob/inter_v4.cpp
    scummvm/trunk/engines/gob/video.cpp

Modified: scummvm/trunk/engines/gob/draw_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/draw_v2.cpp	2008-05-17 21:02:10 UTC (rev 32160)
+++ scummvm/trunk/engines/gob/draw_v2.cpp	2008-05-17 23:55:04 UTC (rev 32161)
@@ -247,10 +247,7 @@
 	if (_renderFlags & RENDERFLAG_FROMSPLIT) {
 		int16 start;
 
-		if (_vm->_video->_splitHeight1 < _vm->_height)
-			start = _vm->_video->_splitHeight1;
-		else
-			start = _vm->_video->_splitStart;
+		start = _vm->_video->_splitStart;
 
 		destY = start;
 		spriteBottom = READ_LE_UINT16(ptr + 6) - READ_LE_UINT16(ptr + 2);
@@ -654,23 +651,24 @@
 	int16 destSurface = _destSurface;
 	int16 sourceSurface = _sourceSurface;
 
-	if ((_destSpriteY >= _vm->_video->_splitHeight1) &&
-	    ((_destSurface == 20) || (_destSurface == 21))) {
-
-		if (_vm->_video->_splitHeight1 < _vm->_height) {
-			_destSpriteY = (_destSpriteY - _vm->_video->_splitHeight1) + _vm->_video->_splitStart;
+	if (_vm->_video->_splitSurf && ((_destSurface == 20) || (_destSurface == 21))) {
+		if ((_destSpriteY >= _vm->_video->_splitStart)) {
+			_destSpriteY -= _vm->_video->_splitStart;
 			if ((operation == DRAW_DRAWLINE) ||
 				 ((operation >= DRAW_DRAWBAR) && (operation <= DRAW_FILLRECTABS)))
-				_spriteBottom = (_spriteBottom - _vm->_video->_splitHeight1) + _vm->_video->_splitStart;
+				_spriteBottom -= _vm->_video->_splitStart;
+
+			_destSurface += 4;
 		}
 
+		if ((_spriteTop >= _vm->_video->_splitStart) && (operation == DRAW_BLITSURF)) {
+			_spriteTop -= _vm->_video->_splitStart;
+			if (_destSurface < 24)
+				_destSurface += 4;
+		}
+
 	}
 
-	if ((_spriteTop >= _vm->_video->_splitHeight1) && (operation == DRAW_BLITSURF) &&
-	    ((_destSurface == 20) || (_destSurface == 21)))
-		if (_vm->_video->_splitHeight1 < _vm->_height)
-			_spriteTop = (_spriteTop - _vm->_video->_splitHeight1) + _vm->_video->_splitStart;
-
 	adjustCoords(0, &_destSpriteX, &_destSpriteY);
 	if ((operation != DRAW_LOADSPRITE) && (_needAdjust != 2)) {
 		adjustCoords(0, &_spriteRight, &_spriteBottom);

Modified: scummvm/trunk/engines/gob/inter.h
===================================================================
--- scummvm/trunk/engines/gob/inter.h	2008-05-17 21:02:10 UTC (rev 32160)
+++ scummvm/trunk/engines/gob/inter.h	2008-05-17 23:55:04 UTC (rev 32161)
@@ -519,6 +519,7 @@
 	virtual const char *getOpcodeFuncDesc(byte i, byte j);
 	virtual const char *getOpcodeGoblinDesc(int i);
 
+	void o4_initScreen();
 	void o4_playVmdOrMusic();
 };
 

Modified: scummvm/trunk/engines/gob/inter_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_v2.cpp	2008-05-17 21:02:10 UTC (rev 32160)
+++ scummvm/trunk/engines/gob/inter_v2.cpp	2008-05-17 23:55:04 UTC (rev 32161)
@@ -1433,50 +1433,18 @@
 	if (height > 0)
 		_vm->_video->_surfHeight = height;
 
-	if (videoMode == 0x18) {
+	_vm->_video->_splitHeight1 = MIN<int16>(_vm->_height, _vm->_video->_surfHeight - offY);
+	_vm->_video->_splitHeight2 = offY;
+	_vm->_video->_splitStart = _vm->_video->_surfHeight - offY;
 
-		if (_vm->_video->_surfWidth < _vm->_width)
-			_vm->_video->_screenDeltaX = (_vm->_width - _vm->_video->_surfWidth) / 2;
-		else
-			_vm->_video->_screenDeltaX = 0;
+	_vm->_video->_screenDeltaX = 0;
+	_vm->_video->_screenDeltaY = 0;
 
-		_vm->_global->_mouseMinX = _vm->_video->_screenDeltaX;
-		_vm->_global->_mouseMaxX = _vm->_video->_screenDeltaX + _vm->_video->_surfWidth - 1;
+	_vm->_global->_mouseMinX = 0;
+	_vm->_global->_mouseMinY = 0;
+	_vm->_global->_mouseMaxX = _vm->_width;
+	_vm->_global->_mouseMaxY = _vm->_height - _vm->_video->_splitHeight2 - 1;
 
-
-		int16 screenHeight = _vm->_video->_surfHeight;
-
-		if (screenHeight < _vm->_height) {
-			_vm->_video->_surfHeight += offY;
-			_vm->_video->_splitStart = screenHeight;
-		} else 
-			_vm->_video->_splitStart = screenHeight - offY;
-
-			_vm->_video->_splitHeight1 = MIN<int16>(_vm->_height, screenHeight - offY);
-			_vm->_video->_splitHeight2 = offY;
-
-			if ((_vm->_video->_surfHeight + offY) < _vm->_height)
-				_vm->_video->_screenDeltaY = (_vm->_height - (screenHeight + offY)) / 2;
-			else
-				_vm->_video->_screenDeltaY = 0;
-
-			_vm->_global->_mouseMaxY = (screenHeight + _vm->_video->_screenDeltaY) - offY - 1;
-			_vm->_global->_mouseMinY = _vm->_video->_screenDeltaY;
-
-	} else {
-		_vm->_video->_splitHeight1 = MIN<int16>(_vm->_height, _vm->_video->_surfHeight - offY);
-		_vm->_video->_splitHeight2 = offY;
-		_vm->_video->_splitStart = _vm->_video->_surfHeight - offY;
-
-		_vm->_video->_screenDeltaX = 0;
-		_vm->_video->_screenDeltaY = 0;
-
-		_vm->_global->_mouseMinX = 0;
-		_vm->_global->_mouseMinY = 0;
-		_vm->_global->_mouseMaxX = _vm->_width;
-		_vm->_global->_mouseMaxY = _vm->_height - _vm->_video->_splitHeight2 - 1;
-	}
-
 	_vm->_draw->closeScreen();
 	_vm->_util->clearPalette();
 	memset(_vm->_global->_redPalette, 0, 256);

Modified: scummvm/trunk/engines/gob/inter_v4.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_v4.cpp	2008-05-17 21:02:10 UTC (rev 32160)
+++ scummvm/trunk/engines/gob/inter_v4.cpp	2008-05-17 23:55:04 UTC (rev 32161)
@@ -29,6 +29,7 @@
 #include "gob/gob.h"
 #include "gob/inter.h"
 #include "gob/global.h"
+#include "gob/draw.h"
 #include "gob/game.h"
 #include "gob/parse.h"
 #include "gob/videoplayer.h"
@@ -279,7 +280,7 @@
 		{NULL, ""},
 		{NULL, ""},
 		/* 80 */
-		OPCODE(o2_initScreen),
+		OPCODE(o4_initScreen),
 		OPCODE(o2_scroll),
 		OPCODE(o2_setScrollOffset),
 		OPCODE(o4_playVmdOrMusic),
@@ -716,6 +717,85 @@
 	return "";
 }
 
+void Inter_v4::o4_initScreen() {
+	int16 offY;
+	int16 videoMode;
+	int16 width, height;
+
+	offY = load16();
+
+	videoMode = offY & 0xFF;
+	offY = (offY >> 8) & 0xFF;
+
+	width = _vm->_parse->parseValExpr();
+	height = _vm->_parse->parseValExpr();
+
+	_vm->_video->clearScreen();
+
+	_vm->_global->_fakeVideoMode = videoMode;
+
+	// Some versions require this
+	if (videoMode == 0xD)
+		videoMode = _vm->_mode;
+
+	if ((videoMode == _vm->_global->_videoMode) && (width == -1))
+		return;
+
+	if (width > 0)
+		_vm->_video->_surfWidth = width;
+	if (height > 0)
+		_vm->_video->_surfHeight = height;
+
+	_vm->_video->_screenDeltaX = 0;
+	if (_vm->_video->_surfWidth < _vm->_width)
+		_vm->_video->_screenDeltaX = (_vm->_width - _vm->_video->_surfWidth) / 2;
+
+	_vm->_global->_mouseMinX = _vm->_video->_screenDeltaX;
+	_vm->_global->_mouseMaxX = _vm->_video->_screenDeltaX + _vm->_video->_surfWidth - 1;
+
+	_vm->_video->_splitStart = _vm->_video->_surfHeight - offY;
+
+	_vm->_video->_splitHeight1 = MIN<int16>(_vm->_height, _vm->_video->_surfHeight);
+	_vm->_video->_splitHeight2 = offY;
+
+	if ((_vm->_video->_surfHeight + offY) < _vm->_height)
+		_vm->_video->_screenDeltaY = (_vm->_height - (_vm->_video->_surfHeight + offY)) / 2;
+	else
+		_vm->_video->_screenDeltaY = 0;
+
+	_vm->_global->_mouseMaxY = (_vm->_video->_surfHeight + _vm->_video->_screenDeltaY) - offY - 1;
+	_vm->_global->_mouseMinY = _vm->_video->_screenDeltaY;
+
+	_vm->_draw->closeScreen();
+	_vm->_util->clearPalette();
+	memset(_vm->_global->_redPalette, 0, 256);
+	memset(_vm->_global->_greenPalette, 0, 256);
+	memset(_vm->_global->_bluePalette, 0, 256);
+
+	_vm->_global->_videoMode = videoMode;
+	_vm->_video->initPrimary(videoMode);
+	WRITE_VAR(15, _vm->_global->_fakeVideoMode);
+
+	_vm->_global->_setAllPalette = true;
+
+	_vm->_util->setMousePos(_vm->_global->_inter_mouseX,
+			_vm->_global->_inter_mouseY);
+	_vm->_util->clearPalette();
+
+	_vm->_draw->initScreen();
+
+	_vm->_util->setScrollOffset();
+
+	_vm->_video->_splitSurf = 0;
+	_vm->_draw->_spritesArray[24] = 0;
+	_vm->_draw->_spritesArray[25] = 0;
+	if (offY > 0) {
+		_vm->_draw->_spritesArray[24] = new SurfaceDesc(videoMode, _vm->_width, offY);
+		_vm->_draw->_spritesArray[25] = new SurfaceDesc(videoMode, _vm->_width, offY);
+		_vm->_video->_splitSurf = _vm->_draw->_spritesArray[25];
+	}
+}
+
 void Inter_v4::o4_playVmdOrMusic() {
 	char fileName[128];
 	int16 x, y;

Modified: scummvm/trunk/engines/gob/video.cpp
===================================================================
--- scummvm/trunk/engines/gob/video.cpp	2008-05-17 21:02:10 UTC (rev 32160)
+++ scummvm/trunk/engines/gob/video.cpp	2008-05-17 23:55:04 UTC (rev 32161)
@@ -86,10 +86,14 @@
 Video::Video(GobEngine *vm) : _vm(vm) {
 	_doRangeClamp = false;
 	_videoDriver = 0;
+
 	_surfWidth = 320;
 	_surfHeight = 200;
+
 	_scrollOffsetX = 0;
 	_scrollOffsetY = 0;
+
+	_splitSurf = 0;
 	_splitHeight1 = 200;
 	_splitHeight2 = 0;
 	_splitStart = 0;
@@ -184,7 +188,19 @@
 		g_system->copyRectToScreen(_vm->_global->_primarySurfDesc->getVidMem() + screenOffset,
 				_surfWidth, screenX, screenY, screenWidth, screenHeight);
 
-		if (_splitHeight2 > 0) {
+		if (_splitSurf) {
+
+			screenOffset = 0;
+			screenX = 0;
+			screenY = _vm->_height - _splitSurf->getHeight();
+			screenWidth = MIN<int>(_vm->_width, _splitSurf->getWidth());
+			screenHeight = _splitSurf->getHeight();
+
+			g_system->copyRectToScreen(_splitSurf->getVidMem() + screenOffset,
+					_splitSurf->getWidth(), screenX, screenY, screenWidth, screenHeight);
+
+		} else if (_splitHeight2 > 0) {
+
 			screenOffset = _splitStart * _surfWidth;
 			screenX = 0;
 			screenY = _vm->_height - _splitHeight2;
@@ -193,6 +209,7 @@
 
 			g_system->copyRectToScreen(_vm->_global->_primarySurfDesc->getVidMem() + screenOffset,
 					_surfWidth, screenX, screenY, screenWidth, screenHeight);
+
 		}
 
 		g_system->updateScreen();


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