[Scummvm-cvs-logs] SF.net SVN: scummvm: [22219] scummvm/trunk/engines/scumm

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sat Apr 29 06:02:03 CEST 2006


Revision: 22219
Author:   fingolfin
Date:     2006-04-29 06:01:35 -0700 (Sat, 29 Apr 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=22219&view=rev

Log Message:
-----------
Make use of the new scummLoop_* functions to move some SCUMM version specific stuff around

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/gfx.cpp
    scummvm/trunk/engines/scumm/he/intern_he.h
    scummvm/trunk/engines/scumm/intern.h
    scummvm/trunk/engines/scumm/scumm.cpp
    scummvm/trunk/engines/scumm/scumm.h
Modified: scummvm/trunk/engines/scumm/gfx.cpp
===================================================================
--- scummvm/trunk/engines/scumm/gfx.cpp	2006-04-29 12:44:06 UTC (rev 22218)
+++ scummvm/trunk/engines/scumm/gfx.cpp	2006-04-29 13:01:35 UTC (rev 22219)
@@ -790,7 +790,6 @@
 			redrawBGStrip(0, 1);
 		} else if (_fullRedraw || diff != 0) {
 			_bgNeedsRedraw = false;
-			_flashlight.isDrawn = false;
 			redrawBGStrip(0, gdi._numStrips);
 		}
 	}
@@ -1090,7 +1089,7 @@
 	}
 }
 
-void ScummEngine::drawFlashlight() {
+void ScummEngine_v5::drawFlashlight() {
 	int i, j, x, y;
 	VirtScreen *vs = &virtscr[kMainVirtScreen];
 

Modified: scummvm/trunk/engines/scumm/he/intern_he.h
===================================================================
--- scummvm/trunk/engines/scumm/he/intern_he.h	2006-04-29 12:44:06 UTC (rev 22218)
+++ scummvm/trunk/engines/scumm/he/intern_he.h	2006-04-29 13:01:35 UTC (rev 22219)
@@ -447,6 +447,8 @@
 	virtual void executeOpcode(byte i);
 	virtual const char *getOpcodeDesc(byte i);
 
+	virtual void scummLoop_handleDrawing();
+
 	virtual void setupScummVars();
 	virtual void initScummVars();
 

Modified: scummvm/trunk/engines/scumm/intern.h
===================================================================
--- scummvm/trunk/engines/scumm/intern.h	2006-04-29 12:44:06 UTC (rev 22218)
+++ scummvm/trunk/engines/scumm/intern.h	2006-04-29 13:01:35 UTC (rev 22219)
@@ -49,6 +49,13 @@
 	uint16 _cursorImages[4][17];
 	byte _cursorHotspots[2 * 4];
 
+	struct {
+		int x, y, w, h;
+		byte *buffer;
+		uint16 xStrips, yStrips;
+		bool isDrawn;
+	} _flashlight;
+
 public:
 	ScummEngine_v5(OSystem *syst, const DetectorResult &dr);
 
@@ -57,6 +64,8 @@
 	virtual void executeOpcode(byte i);
 	virtual const char *getOpcodeDesc(byte i);
 
+	virtual void scummLoop_handleActors();
+
 	virtual void setupScummVars();
 	virtual void initScummVars();
 	virtual void decodeParseString();
@@ -79,6 +88,8 @@
 	void redefineBuiltinCursorFromChar(int index, int chr);
 	void redefineBuiltinCursorHotspot(int index, int x, int y);
 
+	void drawFlashlight();
+
 	/* Version 5 script opcodes */
 	void o5_actorFollowCamera();
 	void o5_actorFromPos();
@@ -564,6 +575,8 @@
 	virtual void executeOpcode(byte i);
 	virtual const char *getOpcodeDesc(byte i);
 
+	virtual void scummLoop_handleActors();
+
 	virtual void setupScummVars();
 	virtual void decodeParseString(int a, int b);
 	virtual void readArrayFromIndexFile();
@@ -821,6 +834,9 @@
 	void clearSubtitleQueue();
 
 protected:
+	virtual void scummLoop_handleSound();
+	virtual void scummLoop_handleDrawing();
+
 	virtual void setupScummVars();
 	virtual void initScummVars();
 

Modified: scummvm/trunk/engines/scumm/scumm.cpp
===================================================================
--- scummvm/trunk/engines/scumm/scumm.cpp	2006-04-29 12:44:06 UTC (rev 22218)
+++ scummvm/trunk/engines/scumm/scumm.cpp	2006-04-29 13:01:35 UTC (rev 22219)
@@ -371,7 +371,6 @@
 
 	_doEffect = false;
 	_currentLights = 0;
-	memset(&_flashlight, 0, sizeof(_flashlight));
 	_bompActorPalettePtr = NULL;
 	_shakeEnabled = false;
 	_shakeFrame = 0;
@@ -740,6 +739,12 @@
 		memcpy(_cursorImages[i], default_cursor_images[i], 32);
 	}
 	memcpy(_cursorHotspots, default_cursor_hotspots, 8);
+
+	// Setup flashlight
+	memset(&_flashlight, 0, sizeof(_flashlight));
+	_flashlight.xStrips = 7;
+	_flashlight.yStrips = 7;
+	_flashlight.buffer = NULL;
 }
 
 ScummEngine_v4::ScummEngine_v4(OSystem *syst, const DetectorResult &dr)
@@ -1228,13 +1233,6 @@
 
 	virtscr[0].xstart = 0;
 
-	if (_game.version <= 5) {
-		// Setup light
-		_flashlight.xStrips = 7;
-		_flashlight.yStrips = 7;
-		_flashlight.buffer = NULL;
-	}
-
 	_mouse.x = 104;
 	_mouse.y = 56;
 
@@ -1554,7 +1552,7 @@
 		diff = _system->getMillis();
 		delta = scummLoop(delta);
 
-		if (delta < 1)	// Ensure we don't get into a loop
+		if (delta < 1)	// Ensure we don't get into an endless loop
 			delta = 1;  // by not decreasing sleepers.
 
 		if (_quit) {
@@ -1869,32 +1867,44 @@
 }
 
 void ScummEngine::scummLoop_handleDrawing() {
-	// FIXME / TODO: Do we really have to check for GF_NEW_CAMERA?
-	// Since old games simply don't use the y coord, we should be able to safely
-	// use "camera._cur != camera._last" here...
-	if (camera._cur.x != camera._last.x || _bgNeedsRedraw || _fullRedraw
-			|| ((_game.features & GF_NEW_CAMERA) && camera._cur.y != camera._last.y)) {
+	if (camera._cur != camera._last || _bgNeedsRedraw || _fullRedraw) {
 		redrawBGAreas();
 	}
 
 	processDrawQue();
+}
 
-	if (_game.heversion >= 99)
-		_fullRedraw = false;
+#ifndef DISABLE_SCUMM_7_8
+void ScummEngine_v7::scummLoop_handleDrawing() {
+	ScummEngine_v6::scummLoop_handleDrawing();
 
 	// Full Throttle always redraws verbs and draws verbs before actors
 	if (_game.version >= 7)
 		redrawVerbs();
+}
+#endif
 
 #ifndef DISABLE_HE
+void ScummEngine_v90he::scummLoop_handleDrawing() {
+	ScummEngine_v80he::scummLoop_handleDrawing();
+
+	if (_game.heversion >= 99)
+		_fullRedraw = false;
+
 	if (_game.heversion >= 90) {
-		((ScummEngine_v90he *)this)->_sprite->resetBackground();
-		((ScummEngine_v90he *)this)->_sprite->sortActiveSprites();
+		_sprite->resetBackground();
+		_sprite->sortActiveSprites();
 	}
+}
 #endif
+
+void ScummEngine_v6::scummLoop_handleActors() {
+	setActorRedrawFlags();
+	resetActorBgs();
+	processActors();
 }
 
-void ScummEngine::scummLoop_handleActors() {
+void ScummEngine_v5::scummLoop_handleActors() {
 	setActorRedrawFlags();
 	resetActorBgs();
 
@@ -1920,8 +1930,11 @@
 
 void ScummEngine::scummLoop_handleSound() {
 	_sound->processSound();
+}
 
 #ifndef DISABLE_SCUMM_7_8
+void ScummEngine_v7::scummLoop_handleSound() {
+	ScummEngine_v6::scummLoop_handleSound();
 	if (_imuseDigital) {
 		_imuseDigital->flushTracks();
 		if ( ((_game.id == GID_DIG) && (!(_game.features & GF_DEMO))) || (_game.id == GID_CMI) )
@@ -1930,8 +1943,8 @@
 	if (_smixer) {
 		_smixer->flush();
 	}
+}
 #endif
-}
 
 
 #pragma mark -

Modified: scummvm/trunk/engines/scumm/scumm.h
===================================================================
--- scummvm/trunk/engines/scumm/scumm.h	2006-04-29 12:44:06 UTC (rev 22218)
+++ scummvm/trunk/engines/scumm/scumm.h	2006-04-29 13:01:35 UTC (rev 22219)
@@ -475,7 +475,7 @@
 	virtual void scummLoop_updateScummVars();
 	virtual void scummLoop_handleSaveLoad();
 	virtual void scummLoop_handleDrawing();
-	virtual void scummLoop_handleActors();
+	virtual void scummLoop_handleActors() = 0;
 	virtual void scummLoop_handleEffects();
 	virtual void scummLoop_handleSound();
 
@@ -997,13 +997,6 @@
 
 	byte *_scrollBuffer;
 
-	struct {
-		int x, y, w, h;
-		byte *buffer;
-		uint16 xStrips, yStrips;
-		bool isDrawn;
-	} _flashlight;
-
 public:
 	bool isLightOn() const;
 
@@ -1088,8 +1081,6 @@
 	byte *getMaskBuffer(int x, int y, int z);
 
 protected:
-	void drawFlashlight();
-
 	void fadeIn(int effect);
 	void fadeOut(int effect);
 


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