[Scummvm-cvs-logs] scummvm master -> b2fe6232c264799b06705fde676854a7f94599c0

dreammaster dreammaster at scummvm.org
Sun Sep 29 21:25:17 CEST 2013


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
b2fe6232c2 TSAGE: Implemented proper R2R object/player shading


Commit: b2fe6232c264799b06705fde676854a7f94599c0
    https://github.com/scummvm/scummvm/commit/b2fe6232c264799b06705fde676854a7f94599c0
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2013-09-29T12:24:32-07:00

Commit Message:
TSAGE: Implemented proper R2R object/player shading

Changed paths:
    engines/tsage/core.cpp
    engines/tsage/core.h
    engines/tsage/ringworld2/ringworld2_logic.cpp
    engines/tsage/ringworld2/ringworld2_scenes0.h



diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp
index b0220b5..f7fbb1d 100644
--- a/engines/tsage/core.cpp
+++ b/engines/tsage/core.cpp
@@ -2066,8 +2066,8 @@ SceneObject::SceneObject() : SceneHotspot() {
 	_visage = 0;
 	_strip = 0;
 	_frame = 0;
-	_effect = 0;
-	_shade = _shade2 = 0;
+	_effect = EFFECT_NONE;
+	_shade = _oldShade = 0;
 	_linkedActor = NULL;
 
 	_field8A = Common::Point(0, 0);
@@ -2473,7 +2473,7 @@ void SceneObject::synchronize(Serializer &s) {
 	if (g_vm->getGameID() == GType_Ringworld2) {
 		s.syncAsSint16LE(_effect);
 		s.syncAsSint16LE(_shade);
-		s.syncAsSint16LE(_shade2);
+		s.syncAsSint16LE(_oldShade);
 		SYNC_POINTER(_linkedActor);
 	}
 }
@@ -2519,9 +2519,9 @@ void SceneObject::remove() {
 
 void SceneObject::dispatch() {
 	if (g_vm->getGameID() == GType_Ringworld2) {
-		if (_shade != _shade2)
+		if (_shade != _oldShade)
 			_flags |= OBJFLAG_PANES;
-		_shade2 = _shade;
+		_oldShade = _shade;
 	}
 
 	uint32 currTime = g_globals->_events.getFrameNumber();
@@ -2639,8 +2639,9 @@ void SceneObject::dispatch() {
 			_linkedActor->setFrame(_frame);
 		}
 
-		if ((_effect == 1) && (getRegionIndex() < 11))
-			_shade = 0;
+		int regionIndex = getRegionIndex();
+		if ((_effect == EFFECT_SHADED) && (regionIndex < 11))
+			_shade = regionIndex;
 	}
 }
 
@@ -2669,7 +2670,24 @@ void SceneObject::removeObject() {
 
 GfxSurface SceneObject::getFrame() {
 	_visageImages.setVisage(_visage, _strip);
-	return _visageImages.getFrame(_frame);
+	GfxSurface frame = _visageImages.getFrame(_frame);
+
+	// If shading is needed, post apply the shadiing onto the frame
+	if ((g_vm->getGameID() == GType_Ringworld2) && (_shade >= 1)) {
+		Graphics::Surface s = frame.lockSurface();
+		byte *p = (byte *)s.getPixels();
+		byte *endP = p + s.w * s.h;
+		
+		while (p < endP) {
+			if (*p != frame._transColor)
+				*p = R2_GLOBALS._fadePaletteMap[_shade - 1][*p];
+			++p;
+		}
+
+		frame.unlockSurface();
+	}
+
+	return frame;
 }
 
 void SceneObject::reposition() {
@@ -3290,7 +3308,7 @@ void Player::postInit(SceneObjectList *OwnerList) {
 	{
 		_moveDiff.x = 3;
 		_moveDiff.y = 2;
-		_effect = 1;
+		_effect = EFFECT_SHADED;
 		_shade = 0;
 		_linkedActor = NULL;
 
diff --git a/engines/tsage/core.h b/engines/tsage/core.h
index 6156d13..2c88f6b 100644
--- a/engines/tsage/core.h
+++ b/engines/tsage/core.h
@@ -466,6 +466,9 @@ enum AnimateMode {ANIM_MODE_NONE = 0, ANIM_MODE_1 = 1, ANIM_MODE_2 = 2, ANIM_MOD
 		ANIM_MODE_9 = 9
 };
 
+enum Effect { EFFECT_NONE = 0, EFFECT_SHADED = 1, EFFECT_2 = 2, EFFECT_3 = 3,
+	EFFECT_4 = 4, EFFECT_5 = 5 };
+
 class SceneObject;
 
 class Visage {
@@ -550,7 +553,7 @@ public:
 
 	// Ringworld 2 specific fields
 	byte *_field9C;
-	int _shade, _shade2;
+	int _shade, _oldShade;
 	int _effect;
 	SceneObject *_linkedActor;
 public:
diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp
index 5e4e892..b86b828 100644
--- a/engines/tsage/ringworld2/ringworld2_logic.cpp
+++ b/engines/tsage/ringworld2/ringworld2_logic.cpp
@@ -1317,18 +1317,18 @@ GfxSurface SceneActor::getFrame() {
 
 	// TODO: Proper effects handling
 	switch (_effect) {
-	case 0:
-	case 5:
+	case EFFECT_NONE:
+	case EFFECT_5:
 		// TODO: Figure out purpose of setting image flags to 64, and getting
 		// scene priorities -1 or _shade
 		break;
-	case 1:
+	case EFFECT_SHADED:
 		// TODO: Transposing using R2_GLOBALS._pixelArrayMap
 		break;
-	case 2:
+	case EFFECT_2:
 		// No effect
 		break;
-	case 4:
+	case EFFECT_4:
 		break;
 	default:
 		// TODO: Default effect
diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.h b/engines/tsage/ringworld2/ringworld2_scenes0.h
index 3153b86..b735f7c 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes0.h
+++ b/engines/tsage/ringworld2/ringworld2_scenes0.h
@@ -306,7 +306,6 @@ public:
 	virtual void dispatch();
 };
 
-
 class Scene250: public SceneExt {
 	class Button: public SceneActor {
 	public:
@@ -477,7 +476,6 @@ public:
 	virtual void dispatch();
 };
 
-
 class Scene400: public SceneExt {
 	/* Items */
 	class Terminal: public NamedHotspot {






More information about the Scummvm-git-logs mailing list