[Scummvm-git-logs] scummvm master -> 079e4af2dc77ff09c74f133d0d7c69df352b6018

aquadran noreply at scummvm.org
Sun Oct 13 08:51:07 UTC 2024


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:
079e4af2dc WINTERMUTE: Reorder functions placement to match original


Commit: 079e4af2dc77ff09c74f133d0d7c69df352b6018
    https://github.com/scummvm/scummvm/commit/079e4af2dc77ff09c74f133d0d7c69df352b6018
Author: Paweł Kołodziejski (aquadran at gmail.com)
Date: 2024-10-13T10:51:03+02:00

Commit Message:
WINTERMUTE: Reorder functions placement to match original

Changed paths:
    engines/wintermute/base/gfx/3dcamera.cpp
    engines/wintermute/base/gfx/3dlight.cpp
    engines/wintermute/base/gfx/base_renderer3d.cpp
    engines/wintermute/base/gfx/xmodel.h


diff --git a/engines/wintermute/base/gfx/3dcamera.cpp b/engines/wintermute/base/gfx/3dcamera.cpp
index 82edf0ccefd..3f3edfad01a 100644
--- a/engines/wintermute/base/gfx/3dcamera.cpp
+++ b/engines/wintermute/base/gfx/3dcamera.cpp
@@ -52,41 +52,6 @@ Camera3D::Camera3D(BaseGame *inGame) : BaseNamedObject(inGame) {
 Camera3D::~Camera3D() {
 }
 
-bool Camera3D::loadFrom3DS(Common::MemoryReadStream &fileStream) {
-	uint32 wholeChunkSize = fileStream.readUint32LE();
-	int32 end = fileStream.pos() + wholeChunkSize - 6;
-
-	_position.x() = fileStream.readFloatLE();
-	_position.z() = -fileStream.readFloatLE();
-	_position.y() = fileStream.readFloatLE();
-
-	_target.x() = fileStream.readFloatLE();
-	_target.z() = -fileStream.readFloatLE();
-	_target.y() = fileStream.readFloatLE();
-
-	_bank = fileStream.readFloatLE();
-
-	float lens = fileStream.readFloatLE();
-
-	if (lens > 0.0f) {
-		_fov = degToRad(1900.0f / lens);
-	} else {
-		_fov = degToRad(45.0f);
-	}
-
-	_origFov = _fov;
-
-	// discard all subchunks
-	while (fileStream.pos() < end) {
-		fileStream.readUint16LE(); // chunk id
-		uint32 chunkSize = fileStream.readUint32LE();
-
-		fileStream.seek(chunkSize - 6, SEEK_CUR);
-	}
-
-	return true;
-}
-
 //////////////////////////////////////////////////////////////////////////
 bool Camera3D::getViewMatrix(Math::Matrix4 *viewMatrix) {
 	Math::Vector3d up = Math::Vector3d(0.0f, 1.0f, 0.0f);
@@ -98,6 +63,7 @@ bool Camera3D::getViewMatrix(Math::Matrix4 *viewMatrix) {
 	}
 
 	*viewMatrix = Math::makeLookAtMatrix(_position, _target, up);
+
 	return true;
 }
 
@@ -146,4 +112,39 @@ void Camera3D::move(float speed) {
 	_target.z() += vector.z() * speed;   // Add our acceleration to our view's Z
 }
 
+bool Camera3D::loadFrom3DS(Common::MemoryReadStream &fileStream) {
+	uint32 wholeChunkSize = fileStream.readUint32LE();
+	int32 end = fileStream.pos() + wholeChunkSize - 6;
+
+	_position.x() = fileStream.readFloatLE();
+	_position.z() = -fileStream.readFloatLE();
+	_position.y() = fileStream.readFloatLE();
+
+	_target.x() = fileStream.readFloatLE();
+	_target.z() = -fileStream.readFloatLE();
+	_target.y() = fileStream.readFloatLE();
+
+	_bank = fileStream.readFloatLE();
+
+	float lens = fileStream.readFloatLE();
+
+	if (lens > 0.0f) {
+		_fov = degToRad(1900.0f / lens);
+	} else {
+		_fov = degToRad(45.0f);
+	}
+
+	_origFov = _fov;
+
+	// discard all subchunks
+	while (fileStream.pos() < end) {
+		fileStream.readUint16LE(); // chunk id
+		uint32 chunkSize = fileStream.readUint32LE();
+
+		fileStream.seek(chunkSize - 6, SEEK_CUR);
+	}
+
+	return true;
+}
+
 } // namespace Wintermute
diff --git a/engines/wintermute/base/gfx/3dlight.cpp b/engines/wintermute/base/gfx/3dlight.cpp
index 6d84810a148..5d498a0d42e 100644
--- a/engines/wintermute/base/gfx/3dlight.cpp
+++ b/engines/wintermute/base/gfx/3dlight.cpp
@@ -72,6 +72,20 @@ bool Light3D::setLight(int index) {
 	return true;
 }
 
+//////////////////////////////////////////////////////////////////////////
+bool Light3D::getViewMatrix(Math::Matrix4 *viewMatrix) {
+	Math::Vector3d up = Math::Vector3d(0.0f, 1.0f, 0.0f);
+	*viewMatrix = Math::makeLookAtMatrix(_position, _target, up);
+	return true;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool Light3D::persist(BasePersistenceManager *persistMgr) {
+	persistMgr->transferBool("_active", &_active);
+	persistMgr->transferUint32("_diffuseColor", &_diffuseColor);
+	return true;
+}
+
 bool Light3D::loadFrom3DS(Common::MemoryReadStream &fileStream) {
 	uint32 wholeChunkSize = fileStream.readUint32LE();
 	int32 end = fileStream.pos() + wholeChunkSize - 6;
@@ -141,18 +155,4 @@ bool Light3D::loadFrom3DS(Common::MemoryReadStream &fileStream) {
 	return true;
 }
 
-//////////////////////////////////////////////////////////////////////////
-bool Light3D::getViewMatrix(Math::Matrix4 *viewMatrix) {
-	Math::Vector3d up = Math::Vector3d(0.0f, 1.0f, 0.0f);
-	*viewMatrix = Math::makeLookAtMatrix(_position, _target, up);
-	return true;
-}
-
-//////////////////////////////////////////////////////////////////////////
-bool Light3D::persist(BasePersistenceManager *persistMgr) {
-	persistMgr->transferBool("_active", &_active);
-	persistMgr->transferUint32("_diffuseColor", &_diffuseColor);
-	return true;
-}
-
 } // namespace Wintermute
diff --git a/engines/wintermute/base/gfx/base_renderer3d.cpp b/engines/wintermute/base/gfx/base_renderer3d.cpp
index 292903fe7f5..f0d0e96a3b6 100644
--- a/engines/wintermute/base/gfx/base_renderer3d.cpp
+++ b/engines/wintermute/base/gfx/base_renderer3d.cpp
@@ -44,18 +44,17 @@ BaseRenderer3D::BaseRenderer3D(Wintermute::BaseGame *inGame) : BaseRenderer(inGa
 BaseRenderer3D::~BaseRenderer3D() {
 }
 
-bool BaseRenderer3D::setAmbientLightColor(uint32 color) {
-	_ambientLightColor = color;
-	_ambientLightOverride = true;
-	setAmbientLight();
-	return true;
+void BaseRenderer3D::initLoop() {
+	deleteRectList();
+	setup2D();
 }
 
-bool BaseRenderer3D::setDefaultAmbientLightColor() {
-	_ambientLightColor = 0x00000000;
-	_ambientLightOverride = false;
-	setAmbientLight();
-	return true;
+bool BaseRenderer3D::drawSprite(BaseSurfaceOpenGL3D &tex, const Wintermute::Rect32 &rect,
+							float zoomX, float zoomY, const Wintermute::Vector2 &pos,
+							uint32 color, bool alphaDisable, Graphics::TSpriteBlendMode blendMode,
+							bool mirrorX, bool mirrorY) {
+	Vector2 scale(zoomX / 100.0f, zoomY / 100.0f);
+	return drawSpriteEx(tex, rect, pos, Vector2(0.0f, 0.0f), scale, 0.0f, color, alphaDisable, blendMode, mirrorX, mirrorY);
 }
 
 void BaseRenderer3D::project(const Math::Matrix4 &worldMatrix, const Math::Vector3d &point, int32 &x, int32 &y) {
@@ -70,23 +69,6 @@ void BaseRenderer3D::project(const Math::Matrix4 &worldMatrix, const Math::Vecto
 	y = viewport[3] - windowCoords.y();
 }
 
-Rect32 BaseRenderer3D::getViewPort() {
-	return _viewportRect;
-}
-
-Graphics::PixelFormat BaseRenderer3D::getPixelFormat() const {
-	return g_system->getScreenFormat();
-}
-
-void BaseRenderer3D::fade(uint16 alpha) {
-	fadeToColor(0, 0, 0, (byte)(255 - alpha));
-}
-
-void BaseRenderer3D::initLoop() {
-	deleteRectList();
-	setup2D();
-}
-
 Math::Ray BaseRenderer3D::rayIntoScene(int x, int y) {
 	Math::Vector3d direction((((2.0f * x) / _viewport3dRect.width()) - 1) / _projectionMatrix3d(0, 0),
 	                        -(((2.0f * y) / _viewport3dRect.height()) - 1) / _projectionMatrix3d(1, 1),
@@ -101,12 +83,30 @@ Math::Ray BaseRenderer3D::rayIntoScene(int x, int y) {
 	return Math::Ray(origin, direction);
 }
 
-bool BaseRenderer3D::drawSprite(BaseSurfaceOpenGL3D &tex, const Wintermute::Rect32 &rect,
-	                        float zoomX, float zoomY, const Wintermute::Vector2 &pos,
-	                        uint32 color, bool alphaDisable, Graphics::TSpriteBlendMode blendMode,
-	                        bool mirrorX, bool mirrorY) {
-	Vector2 scale(zoomX / 100.0f, zoomY / 100.0f);
-	return drawSpriteEx(tex, rect, pos, Vector2(0.0f, 0.0f), scale, 0.0f, color, alphaDisable, blendMode, mirrorX, mirrorY);
+bool BaseRenderer3D::setAmbientLightColor(uint32 color) {
+	_ambientLightColor = color;
+	_ambientLightOverride = true;
+	setAmbientLight();
+	return true;
+}
+
+bool BaseRenderer3D::setDefaultAmbientLightColor() {
+	_ambientLightColor = 0x00000000;
+	_ambientLightOverride = false;
+	setAmbientLight();
+	return true;
+}
+
+Rect32 BaseRenderer3D::getViewPort() {
+	return _viewportRect;
+}
+
+Graphics::PixelFormat BaseRenderer3D::getPixelFormat() const {
+	return g_system->getScreenFormat();
+}
+
+void BaseRenderer3D::fade(uint16 alpha) {
+	fadeToColor(0, 0, 0, (byte)(255 - alpha));
 }
 
 Math::Matrix3 BaseRenderer3D::build2dTransformation(const Vector2 &center, float angle) {
diff --git a/engines/wintermute/base/gfx/xmodel.h b/engines/wintermute/base/gfx/xmodel.h
index 7cc6b0de04f..3aa0abd69c6 100644
--- a/engines/wintermute/base/gfx/xmodel.h
+++ b/engines/wintermute/base/gfx/xmodel.h
@@ -126,6 +126,9 @@ public:
 	bool loadFromFile(const Common::String &filename, XModel *parentModel = nullptr);
 	bool mergeFromFile(const Common::String &filename);
 
+	bool loadAnimationSet(const Common::String &filename, XFileData *xobj);
+	bool loadAnimation(const Common::String &filename, XFileData *xobj, AnimationSet *parentAnimSet = nullptr);
+
 	bool update() override;
 	bool render();
 	bool renderFlatShadowModel();
@@ -142,9 +145,6 @@ public:
 	static bool loadName(BaseNamedObject *obj, XFileData *data);
 	static bool loadName(Common::String &targetStr, XFileData *data);
 
-	bool loadAnimationSet(const Common::String &filename, XFileData *xobj);
-	bool loadAnimation(const Common::String &filename, XFileData *xobj, AnimationSet *parentAnimSet = nullptr);
-
 	Math::Matrix4 _lastWorldMat;
 	Rect32 _boundingRect;
 	BaseObject *_owner;




More information about the Scummvm-git-logs mailing list