[Scummvm-cvs-logs] SF.net SVN: scummvm:[33275] scummvm/trunk/engines/tinsel

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Fri Jul 25 11:12:04 CEST 2008


Revision: 33275
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33275&view=rev
Author:   fingolfin
Date:     2008-07-25 09:12:03 +0000 (Fri, 25 Jul 2008)

Log Message:
-----------
TINSEL: Get rid of Graphics::Surface class

Modified Paths:
--------------
    scummvm/trunk/engines/tinsel/graphics.cpp
    scummvm/trunk/engines/tinsel/graphics.h
    scummvm/trunk/engines/tinsel/tinsel.cpp
    scummvm/trunk/engines/tinsel/tinsel.h

Modified: scummvm/trunk/engines/tinsel/graphics.cpp
===================================================================
--- scummvm/trunk/engines/tinsel/graphics.cpp	2008-07-25 09:05:04 UTC (rev 33274)
+++ scummvm/trunk/engines/tinsel/graphics.cpp	2008-07-25 09:12:03 UTC (rev 33275)
@@ -369,17 +369,20 @@
 /**
  * Clears both the screen surface buffer and screen to the specified value
  */
-void ClearScreen(uint32 val) {
-	uint32 *pDest = (uint32 *)_vm->screen().getData();
-	Common::set_to(pDest, (uint32 *)((byte *)pDest + SCREEN_WIDTH * SCREEN_HEIGHT), val);
-	_vm->screen().update();
+void ClearScreen() {
+	void *pDest = _vm->screen().getBasePtr(0, 0);
+	memset(pDest, 0, SCREEN_WIDTH * SCREEN_HEIGHT);
+	g_system->clearScreen();
+	g_system->updateScreen(); 
 }
 
 /**
  * Updates the screen surface within the following rectangle
  */
 void UpdateScreenRect(const Common::Rect &pClip) {
-	_vm->screen().updateRect(pClip);
+	byte *pDest = (byte *)_vm->screen().getBasePtr(pClip.left, pClip.top);
+	g_system->copyRectToScreen(pDest, _vm->screen().pitch, pClip.left, pClip.top, pClip.width(), pClip.height());
+	g_system->updateScreen(); 
 }
 
 /**
@@ -403,7 +406,7 @@
 	}
 
 	// Get destination starting point
-	destPtr = _vm->screen().getBasePtr(pObj->xPos, pObj->yPos);
+	destPtr = (byte *)_vm->screen().getBasePtr(pObj->xPos, pObj->yPos);
 	
 	// Handle various draw types
 	uint8 typeId = pObj->flags & 0xff;

Modified: scummvm/trunk/engines/tinsel/graphics.h
===================================================================
--- scummvm/trunk/engines/tinsel/graphics.h	2008-07-25 09:05:04 UTC (rev 33274)
+++ scummvm/trunk/engines/tinsel/graphics.h	2008-07-25 09:12:03 UTC (rev 33275)
@@ -43,31 +43,6 @@
 #define	SCRN_CENTRE_X	((SCREEN_WIDTH  - 1) / 2)	// screen centre x
 #define	SCRN_CENTRE_Y	((SCREEN_HEIGHT - 1) / 2)	// screen centre y
 
-/** Class representing either a buffered surface or the physical screen. */
-class Surface : public Graphics::Surface {
-private:
-	bool _isScreen;
-public:
-	Surface(bool isScreen = false) { _isScreen = isScreen; }
-	Surface(int Width, int Height) { create(Width, Height, 1); _isScreen = false; }
-
-	// Surface methods
-	byte *getData() { return (byte *)pixels; }
-	byte *getBasePtr(int x, int y) { return (byte *)Graphics::Surface::getBasePtr(x, y); }
-
-	void update() { 
-		if (_isScreen) {
-			g_system->copyRectToScreen((const byte *)pixels, pitch, 0, 0, w, h);
-			g_system->updateScreen(); 
-		}
-	}
-	void updateRect(const Common::Rect &r) {
-		g_system->copyRectToScreen(getBasePtr(r.left, r.top), pitch, r.left, r.top, r.width(), r.height());
-		g_system->updateScreen(); 
-	}
-
-};
-
 /** draw object structure - only used when drawing objects */
 struct DRAWOBJECT {
 	char *charBase;		// character set base address
@@ -92,7 +67,7 @@
 |*			    Function Prototypes				*|
 \*----------------------------------------------------------------------*/
 
-void ClearScreen(uint32 val);
+void ClearScreen();
 void DrawObject(DRAWOBJECT *pObj);
 
 // called to update a rectangle on the video screen from a video page

Modified: scummvm/trunk/engines/tinsel/tinsel.cpp
===================================================================
--- scummvm/trunk/engines/tinsel/tinsel.cpp	2008-07-25 09:05:04 UTC (rev 33274)
+++ scummvm/trunk/engines/tinsel/tinsel.cpp	2008-07-25 09:12:03 UTC (rev 33275)
@@ -54,6 +54,7 @@
 #include "tinsel/music.h"
 #include "tinsel/object.h"
 #include "tinsel/pid.h"
+#include "tinsel/polygons.h"
 #include "tinsel/savescn.h"
 #include "tinsel/scn.h"
 #include "tinsel/serializer.h"
@@ -386,7 +387,7 @@
 static void MasterScriptProcess(CORO_PARAM, const void *) {
 	// COROUTINE
 	CORO_BEGIN_CONTEXT;
-		PINT_CONTEXT pic;
+		INT_CONTEXT *pic;
 	CORO_END_CONTEXT(_ctx);
 
 	CORO_BEGIN_CODE(_ctx);
@@ -463,13 +464,13 @@
 static void RestoredProcess(CORO_PARAM, const void *param) {
 	// COROUTINE
 	CORO_BEGIN_CONTEXT;
-		PINT_CONTEXT pic;
+		INT_CONTEXT *pic;
 	CORO_END_CONTEXT(_ctx);
 
 	CORO_BEGIN_CODE(_ctx);
 
 	// get the stuff copied to process when it was created
-	_ctx->pic = *((PINT_CONTEXT *)param);
+	_ctx->pic = *((INT_CONTEXT **)param);
 
 	_ctx->pic = RestoreInterpretContext(_ctx->pic);
 	CORO_INVOKE_1(Interpret, _ctx->pic);
@@ -477,11 +478,11 @@
 	CORO_END_CODE;
 }
 
-void RestoreProcess(PINT_CONTEXT pic) {
+void RestoreProcess(INT_CONTEXT *pic) {
 	g_scheduler->createProcess(PID_TCODE, RestoredProcess, &pic, sizeof(pic));
 }
 
-void RestoreMasterProcess(PINT_CONTEXT pic) {
+void RestoreMasterProcess(INT_CONTEXT *pic) {
 	g_scheduler->createProcess(PID_MASTER_SCR, RestoredProcess, &pic, sizeof(pic));
 }
 
@@ -516,7 +517,7 @@
 				break;
 			}
 		} else if (--CountOut == 0) {
-			ClearScreen(0L);
+			ClearScreen();
 			
 			NewScene(NextScene.scene, NextScene.entry);
 			NextScene.scene = 0;
@@ -599,7 +600,7 @@
 };
 
 TinselEngine::TinselEngine(OSystem *syst, const TinselGameDescription *gameDesc) : 
-		Engine(syst), _gameDescription(gameDesc), _screenSurface(true) {
+		Engine(syst), _gameDescription(gameDesc) {
 	_vm = this;
 
 	// Setup mixer

Modified: scummvm/trunk/engines/tinsel/tinsel.h
===================================================================
--- scummvm/trunk/engines/tinsel/tinsel.h	2008-07-25 09:05:04 UTC (rev 33274)
+++ scummvm/trunk/engines/tinsel/tinsel.h	2008-07-25 09:12:03 UTC (rev 33275)
@@ -76,7 +76,7 @@
 	int _gameId;
 	Common::KeyState _keyPressed;
 	Common::RandomSource _random;
-	Surface _screenSurface;
+	Graphics::Surface _screenSurface;
 	Common::Point _mousePos;
 	uint8 _dosPlayerDir;
 	Console *_console;
@@ -123,7 +123,7 @@
 	Common::String getSavegamePattern() const;
 	Common::String getSavegameFilename(int16 saveNum) const;
 	Common::SaveFileManager *getSaveFileMan() { return _saveFileMan; }
-	Surface &screen() { return _screenSurface; }
+	Graphics::Surface &screen() { return _screenSurface; }
 
 	Common::Point getMousePosition() const { return _mousePos; }
 	void setMousePosition(const Common::Point &pt) {


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