[Scummvm-git-logs] scummvm master -> 0df84a921fb6a44cfaf7aa4ae7d6ea6db64abfac

scemino noreply at scummvm.org
Sat Apr 20 07:47:55 UTC 2024


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

Summary:
261621e54c TWP: Split easing functions from camera
0df84a921f TWP: JANITORIAL: Fix code formatting


Commit: 261621e54c72e0a177418faffe2f46e1b2f56bb5
    https://github.com/scummvm/scummvm/commit/261621e54c72e0a177418faffe2f46e1b2f56bb5
Author: scemino (scemino74 at gmail.com)
Date: 2024-04-19T20:31:13+02:00

Commit Message:
TWP: Split easing functions from camera

Changed paths:
  A engines/twp/easing.cpp
  A engines/twp/easing.h
    engines/twp/camera.cpp
    engines/twp/camera.h
    engines/twp/module.mk


diff --git a/engines/twp/camera.cpp b/engines/twp/camera.cpp
index 0bbd5e24d94..16a5d990c83 100644
--- a/engines/twp/camera.cpp
+++ b/engines/twp/camera.cpp
@@ -114,16 +114,4 @@ void Camera::update(Common::SharedPtr<Room> room, Common::SharedPtr<Object> foll
 	}
 }
 
-InterpolationMethod intToInterpolationMethod(int value) {
-	bool loop = (value & 0x10);
-	bool swing = (value & 0x20);
-	bool stopLooping = (value & 0x40);
-	InterpolationKind kind = (InterpolationKind)(value & 0x0F);
-	InterpolationMethod im;
-	im.kind = kind;
-	im.loop = loop && !stopLooping;
-	im.swing = swing;
-	return im;
-}
-
 } // namespace Twp
diff --git a/engines/twp/camera.h b/engines/twp/camera.h
index b38e60e9a31..c4ea942ef97 100644
--- a/engines/twp/camera.h
+++ b/engines/twp/camera.h
@@ -24,6 +24,7 @@
 
 #include "common/func.h"
 #include "math/vector2d.h"
+#include "twp/easing.h"
 #include "twp/rectf.h"
 
 namespace Twp {
@@ -31,66 +32,6 @@ namespace Twp {
 class Object;
 class Room;
 
-typedef float EasingFunc(float t);
-
-typedef struct EasingFunc_t {
-	EasingFunc *func;
-} EasingFunc_t;
-
-enum InterpolationKind {
-	IK_LINEAR = 0,
-	IK_EASEIN = 1,
-	IK_EASEINOUT = 2,
-	IK_EASEOUT = 3,
-	IK_SLOWEASEIN = 4,
-	IK_SLOWEASEOUT = 5
-};
-
-struct InterpolationMethod {
-	InterpolationKind kind = IK_LINEAR;
-	bool loop = false;
-	bool swing = false;
-};
-
-InterpolationMethod intToInterpolationMethod(int value);
-
-static float linear(float t) { return t; }
-
-static float easeIn(float t) {
-	return t * t * t * t;
-}
-
-static float easeOut(float t) {
-	float f = (t - 1.0f);
-	return f * f * f * (1.0f - t) + 1.0f;
-}
-
-static float easeInOut(float t) {
-	if (t < 0.5f)
-		return 8.0f * t * t * t * t;
-	float f = (t - 1.0f);
-	return -8.f * f * f * f * f + 1.f;
-}
-
-inline EasingFunc_t easing(InterpolationKind kind) {
-	switch (kind) {
-	case IK_LINEAR:
-		return {&linear};
-	case IK_EASEIN:
-		return {&easeIn};
-	case IK_EASEINOUT:
-		return {&easeInOut};
-	case IK_EASEOUT:
-		return {&easeOut};
-	case IK_SLOWEASEIN:
-		return {&easeIn};
-	case IK_SLOWEASEOUT:
-		return {&easeOut};
-	}
-	error("Invalid interpolation kind: %d", kind);
-	return {&linear};
-}
-
 class Camera {
 public:
 	void setAt(const Math::Vector2d &at);
diff --git a/engines/twp/easing.cpp b/engines/twp/easing.cpp
new file mode 100644
index 00000000000..6b580f60438
--- /dev/null
+++ b/engines/twp/easing.cpp
@@ -0,0 +1,38 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "twp/easing.h"
+
+namespace Twp {
+
+InterpolationMethod intToInterpolationMethod(int value) {
+	bool loop = (value & 0x10);
+	bool swing = (value & 0x20);
+	bool stopLooping = (value & 0x40);
+	InterpolationKind kind = (InterpolationKind)(value & 0x0F);
+	InterpolationMethod im;
+	im.kind = kind;
+	im.loop = loop && !stopLooping;
+	im.swing = swing;
+	return im;
+}
+
+} // namespace Twp
diff --git a/engines/twp/easing.h b/engines/twp/easing.h
new file mode 100644
index 00000000000..38e28b20583
--- /dev/null
+++ b/engines/twp/easing.h
@@ -0,0 +1,93 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef TWP_EASING_H
+#define TWP_EASING_H
+
+#include "common/func.h"
+#include "math/vector2d.h"
+#include "twp/rectf.h"
+
+namespace Twp {
+
+typedef float EasingFunc(float t);
+
+typedef struct EasingFunc_t {
+	EasingFunc *func;
+} EasingFunc_t;
+
+enum InterpolationKind {
+	IK_LINEAR = 0,
+	IK_EASEIN = 1,
+	IK_EASEINOUT = 2,
+	IK_EASEOUT = 3,
+	IK_SLOWEASEIN = 4,
+	IK_SLOWEASEOUT = 5
+};
+
+struct InterpolationMethod {
+	InterpolationKind kind = IK_LINEAR;
+	bool loop = false;
+	bool swing = false;
+};
+
+InterpolationMethod intToInterpolationMethod(int value);
+
+static float linear(float t) { return t; }
+
+static float easeIn(float t) {
+	return t * t * t * t;
+}
+
+static float easeOut(float t) {
+	float f = (t - 1.0f);
+	return f * f * f * (1.0f - t) + 1.0f;
+}
+
+static float easeInOut(float t) {
+	if (t < 0.5f)
+		return 8.0f * t * t * t * t;
+	float f = (t - 1.0f);
+	return -8.f * f * f * f * f + 1.f;
+}
+
+inline EasingFunc_t easing(InterpolationKind kind) {
+	switch (kind) {
+	case IK_LINEAR:
+		return {&linear};
+	case IK_EASEIN:
+		return {&easeIn};
+	case IK_EASEINOUT:
+		return {&easeInOut};
+	case IK_EASEOUT:
+		return {&easeOut};
+	case IK_SLOWEASEIN:
+		return {&easeIn};
+	case IK_SLOWEASEOUT:
+		return {&easeOut};
+	}
+	error("Invalid interpolation kind: %d", kind);
+	return {&linear};
+}
+
+} // namespace Twp
+
+#endif
diff --git a/engines/twp/module.mk b/engines/twp/module.mk
index 60ae824b189..fe7af221890 100644
--- a/engines/twp/module.mk
+++ b/engines/twp/module.mk
@@ -9,6 +9,7 @@ MODULE_OBJS = \
 	console.o \
 	dialog.o \
 	dialogs.o \
+	easing.o \
 	enginedialogtarget.o \
 	font.o \
 	genlib.o \


Commit: 0df84a921fb6a44cfaf7aa4ae7d6ea6db64abfac
    https://github.com/scummvm/scummvm/commit/0df84a921fb6a44cfaf7aa4ae7d6ea6db64abfac
Author: scemino (scemino74 at gmail.com)
Date: 2024-04-20T09:47:40+02:00

Commit Message:
TWP: JANITORIAL: Fix code formatting

Changed paths:
    engines/twp/actorlib.cpp
    engines/twp/debugtools.h
    engines/twp/dialog.h
    engines/twp/font.h
    engines/twp/gfx.h
    engines/twp/ggpack.cpp
    engines/twp/object.cpp
    engines/twp/objlib.cpp
    engines/twp/resmanager.cpp
    engines/twp/roomlib.cpp
    engines/twp/savegame.cpp
    engines/twp/shaders.h
    engines/twp/syslib.cpp
    engines/twp/thread.h
    engines/twp/twp.cpp
    engines/twp/twp.h
    engines/twp/util.h
    engines/twp/walkboxnode.cpp


diff --git a/engines/twp/actorlib.cpp b/engines/twp/actorlib.cpp
index 61b632b70e7..c4d4c40d237 100644
--- a/engines/twp/actorlib.cpp
+++ b/engines/twp/actorlib.cpp
@@ -810,7 +810,7 @@ static SQInteger createActor(HSQUIRRELVM v) {
 	g_twp->_resManager->_allObjects[id] = actor;
 
 	Common::String key;
-	if(sqrawexists(actor->_table, "_key") && SQ_FAILED(sqgetf(actor->_table, "_key", key))) {
+	if (sqrawexists(actor->_table, "_key") && SQ_FAILED(sqgetf(actor->_table, "_key", key))) {
 		return sq_throwerror(v, "failed to get actor key");
 	}
 	actor->_key = key;
diff --git a/engines/twp/debugtools.h b/engines/twp/debugtools.h
index 89e2089fa8f..773491f64f8 100644
--- a/engines/twp/debugtools.h
+++ b/engines/twp/debugtools.h
@@ -26,6 +26,6 @@ namespace Twp {
 void onImGuiInit();
 void onImGuiRender();
 void onImGuiCleanup();
-}
+} // namespace Twp
 
 #endif
diff --git a/engines/twp/dialog.h b/engines/twp/dialog.h
index c73068f268a..64f5e8c2e0b 100644
--- a/engines/twp/dialog.h
+++ b/engines/twp/dialog.h
@@ -182,7 +182,7 @@ public:
 	void update(float dt);
 	DialogState getState() const { return _state; }
 
-	void setMousePos(const Math::Vector2d& pos) { _mousePos = pos; }
+	void setMousePos(const Math::Vector2d &pos) { _mousePos = pos; }
 
 	void start(const Common::String &actor, const Common::String &name, const Common::String &node);
 	void selectLabel(int line, const Common::String &name);
diff --git a/engines/twp/font.h b/engines/twp/font.h
index 3a2fc79018e..22321b70b50 100644
--- a/engines/twp/font.h
+++ b/engines/twp/font.h
@@ -144,7 +144,7 @@ enum TextVAlignment {
 class Text {
 public:
 	Text();
-	Text(const Common::String &fontName, const Common::String &text, TextHAlignment hAlign = thCenter, TextVAlignment vAlign = tvCenter, float maxWidth = 0.0f, const Color& color = Color());
+	Text(const Common::String &fontName, const Common::String &text, TextHAlignment hAlign = thCenter, TextVAlignment vAlign = tvCenter, float maxWidth = 0.0f, const Color &color = Color());
 
 	void setText(const Common::String &text) {
 		_txt = text;
@@ -152,7 +152,7 @@ public:
 	}
 	Common::String getText() const { return _txt; }
 
-	void setColor(const Color& c) {
+	void setColor(const Color &c) {
 		_col = c;
 		_dirty = true;
 	}
@@ -180,7 +180,7 @@ public:
 	Common::SharedPtr<Font> getFont() { return _font; }
 	Math::Vector2d getBounds();
 
-	void draw(Gfx &gfx, const Math::Matrix4& trsf = Math::Matrix4());
+	void draw(Gfx &gfx, const Math::Matrix4 &trsf = Math::Matrix4());
 
 private:
 	void update();
diff --git a/engines/twp/gfx.h b/engines/twp/gfx.h
index a1e75035869..f5488908a8d 100644
--- a/engines/twp/gfx.h
+++ b/engines/twp/gfx.h
@@ -180,7 +180,7 @@ public:
 	void drawLines(Vertex *vertices, int count, const Math::Matrix4 &trsf = Math::Matrix4());
 	void drawLinesLoop(Vertex *vertices, int count, const Math::Matrix4 &trsf = Math::Matrix4());
 	void draw(Vertex *vertices, int v_size, uint32 *indices, int i_size, const Math::Matrix4 &trsf = Math::Matrix4(), Texture *texture = NULL);
-	void drawQuad(const Math::Vector2d& size, const Color& color = Color(), const Math::Matrix4 &trsf = Math::Matrix4());
+	void drawQuad(const Math::Vector2d &size, const Color &color = Color(), const Math::Matrix4 &trsf = Math::Matrix4());
 	void drawSprite(const Common::Rect &textRect, Texture &texture, const Color &color = Color(), const Math::Matrix4 &trsf = Math::Matrix4(), bool flipX = false, bool flipY = false);
 	void drawSprite(Texture &texture, const Color &color = Color(), const Math::Matrix4 &trsf = Math::Matrix4(), bool flipX = false, bool flipY = false);
 
diff --git a/engines/twp/ggpack.cpp b/engines/twp/ggpack.cpp
index ddde29c06d5..577ca5c149c 100644
--- a/engines/twp/ggpack.cpp
+++ b/engines/twp/ggpack.cpp
@@ -737,7 +737,7 @@ bool GGPackSet::containsDLC() const {
 	return _packs.find(3) != _packs.end();
 }
 
-void GGPackSet::init(const XorKey& key) {
+void GGPackSet::init(const XorKey &key) {
 	Common::ArchiveMemberList fileList;
 	SearchMan.listMatchingMembers(fileList, "*.ggpack*");
 
diff --git a/engines/twp/object.cpp b/engines/twp/object.cpp
index 439963113ae..5e8ae103324 100644
--- a/engines/twp/object.cpp
+++ b/engines/twp/object.cpp
@@ -824,10 +824,14 @@ void Object::walk(Common::SharedPtr<Object> obj, const Math::Vector2d &pos, int
 }
 
 static Facing angleToFacing(float angle) {
-	if(angle<45.f) return Facing::FACE_RIGHT;
-	if(angle<135.f) return Facing::FACE_BACK;
-	if(angle<215.f) return Facing::FACE_LEFT;
-	if(angle<305.f) return Facing::FACE_FRONT;
+	if (angle < 45.f)
+		return Facing::FACE_RIGHT;
+	if (angle < 135.f)
+		return Facing::FACE_BACK;
+	if (angle < 215.f)
+		return Facing::FACE_LEFT;
+	if (angle < 305.f)
+		return Facing::FACE_FRONT;
 	return Facing::FACE_RIGHT;
 }
 
@@ -839,7 +843,7 @@ void Object::walk(Common::SharedPtr<Object> actor, Common::SharedPtr<Object> obj
 	Math::Vector2d dst(obj->getUsePos());
 
 	// if we walk to an actor we want to keep a minimun distance between them
-	if(g_twp->_resManager->isActor(obj->getId())) {
+	if (g_twp->_resManager->isActor(obj->getId())) {
 		const Math::Vector2d src(actor->_node->getAbsPos());
 		const float dx = dst.getX() - src.getX();
 		const float dy = dst.getY() - src.getY();
@@ -850,8 +854,7 @@ void Object::walk(Common::SharedPtr<Object> actor, Common::SharedPtr<Object> obj
 			if (angle < 0.f)
 				angle += 360.f;
 			const Facing facing2 = angleToFacing(angle);
-			switch (facing2)
-			{
+			switch (facing2) {
 			case Facing::FACE_BACK:
 				dst.setY(dst.getY() + minDistY);
 				break;
diff --git a/engines/twp/objlib.cpp b/engines/twp/objlib.cpp
index b397632f9ee..fac645ea3f6 100644
--- a/engines/twp/objlib.cpp
+++ b/engines/twp/objlib.cpp
@@ -471,7 +471,7 @@ static SQInteger objectIcon(HSQUIRRELVM v) {
 			return sq_throwerror(v, "failed to get fps");
 		sq_pop(v, 2);
 		while (SQ_SUCCEEDED(sq_next(v, -2))) {
-			if(SQ_FAILED(sqget(v, -1, icon)))
+			if (SQ_FAILED(sqget(v, -1, icon)))
 				return sq_throwerror(v, "failed to get icon");
 			icons.push_back(icon);
 			sq_pop(v, 2);
diff --git a/engines/twp/resmanager.cpp b/engines/twp/resmanager.cpp
index fee0b71e92d..bacdb9df3db 100644
--- a/engines/twp/resmanager.cpp
+++ b/engines/twp/resmanager.cpp
@@ -41,7 +41,7 @@ void ResManager::loadTexture(const Common::String &name) {
 		error("Texture %s not found", name.c_str());
 	}
 	Image::PNGDecoder d;
-	if(!d.loadStream(r)) {
+	if (!d.loadStream(r)) {
 		error("PNG %s not loaded", name.c_str());
 		return;
 	}
@@ -75,7 +75,7 @@ void ResManager::loadSpriteSheet(const Common::String &name) {
 }
 
 void ResManager::resetSaylineFont() {
-	if(_fonts.contains("sayline"))
+	if (_fonts.contains("sayline"))
 		_fonts.erase("sayline");
 }
 
diff --git a/engines/twp/roomlib.cpp b/engines/twp/roomlib.cpp
index 93443988664..b1d229c8a56 100644
--- a/engines/twp/roomlib.cpp
+++ b/engines/twp/roomlib.cpp
@@ -233,7 +233,7 @@ static SQInteger defineRoom(HSQUIRRELVM v) {
 	if (SQ_FAILED(sq_getstackobj(v, 2, &table)))
 		return sq_throwerror(v, "failed to get room table");
 	Common::String name;
-	if(SQ_FAILED(sqgetf(v, table, "background", name))) {
+	if (SQ_FAILED(sqgetf(v, table, "background", name))) {
 		return sq_throwerror(v, "failed to get room name");
 	}
 	Common::SharedPtr<Room> room = g_twp->defineRoom(name, table);
diff --git a/engines/twp/savegame.cpp b/engines/twp/savegame.cpp
index 034fd7e0a78..3c76c732e2a 100644
--- a/engines/twp/savegame.cpp
+++ b/engines/twp/savegame.cpp
@@ -584,7 +584,7 @@ SQRESULT SaveGameManager::loadGlobals(const Common::JSONObject &json) {
 	debugC(kDebugGame, "loadGlobals");
 	HSQUIRRELVM v = g_twp->getVm();
 	HSQOBJECT g;
-	if(SQ_FAILED(sqgetf("g", g)))
+	if (SQ_FAILED(sqgetf("g", g)))
 		return sq_throwerror(v, "Failed to get globals variable");
 	for (auto it = json.begin(); it != json.end(); it++) {
 		HSQOBJECT tmp;
@@ -698,7 +698,7 @@ static SQRESULT toObject(Common::JSONObject &jObj, const HSQOBJECT &obj, bool ch
 	HSQUIRRELVM v = g_twp->getVm();
 	if (checkId) {
 		SQInteger id = 0;
-		if(sqrawexists(obj, "_id") && SQ_FAILED(sqgetf(obj, "_id", id)))
+		if (sqrawexists(obj, "_id") && SQ_FAILED(sqgetf(obj, "_id", id)))
 			return sq_throwerror(v, "Failed to get id");
 		if (g_twp->_resManager->isActor(id)) {
 			Common::SharedPtr<Object> a(actor(id));
@@ -915,10 +915,10 @@ static Common::JSONValue *createJDialog() {
 
 static Common::JSONValue *createJEasyMode() {
 	HSQOBJECT g;
-	if(SQ_FAILED(sqgetf("g", g)))
+	if (SQ_FAILED(sqgetf("g", g)))
 		error("Failed to get globals variable");
 	SQInteger easyMode;
-	if(SQ_FAILED(sqgetf(g, "easy_mode", easyMode)))
+	if (SQ_FAILED(sqgetf(g, "easy_mode", easyMode)))
 		error("Failed to get easy_mode variable");
 	return new Common::JSONValue((long long int)easyMode);
 }
@@ -958,7 +958,7 @@ static Common::JSONValue *createJGameScene() {
 
 static Common::JSONValue *createJGlobals() {
 	HSQOBJECT g;
-	if(SQ_FAILED(sqgetf("g", g)))
+	if (SQ_FAILED(sqgetf("g", g)))
 		error("Failed to get globals variable");
 	//   result.fields.sort(cmpKey);
 	return tojson(g, false);
diff --git a/engines/twp/shaders.h b/engines/twp/shaders.h
index 4156fecce6e..3d361bbac1c 100644
--- a/engines/twp/shaders.h
+++ b/engines/twp/shaders.h
@@ -37,7 +37,7 @@ struct ShaderParams {
 	float sepiaFlicker = 1.f;
 	float randomValue[5] = {0.f, 0.f, 0.f, 0.f, 0.f};
 	float timeLapse = 0.f;
-	float iGlobalTime =	0.f;
+	float iGlobalTime = 0.f;
 	float iNoiseThreshold = 1.f;
 	float iFade = 1.f;
 	float wobbleIntensity = 1.f;
diff --git a/engines/twp/syslib.cpp b/engines/twp/syslib.cpp
index 67d6d02068d..2e320645d9f 100644
--- a/engines/twp/syslib.cpp
+++ b/engines/twp/syslib.cpp
@@ -352,7 +352,8 @@ static SQInteger breakwhilerunning(HSQUIRRELVM v) {
 static bool isSomeoneTalking() {
 	for (auto it = g_twp->_actors.begin(); it != g_twp->_actors.end(); it++) {
 		Common::SharedPtr<Object> obj = *it;
-		if(obj->_room != g_twp->_room) continue;
+		if (obj->_room != g_twp->_room)
+			continue;
 		if (obj->getTalking() && obj->getTalking()->isEnabled())
 			return true;
 	}
@@ -360,7 +361,8 @@ static bool isSomeoneTalking() {
 		Common::SharedPtr<Layer> layer = *it;
 		for (auto it2 = layer->_objects.begin(); it2 != layer->_objects.end(); it2++) {
 			Common::SharedPtr<Object> obj = *it2;
-			if(obj->_room != g_twp->_room) continue;
+			if (obj->_room != g_twp->_room)
+				continue;
 			if (obj->getTalking() && obj->getTalking()->isEnabled())
 				return true;
 		}
@@ -464,7 +466,7 @@ static SQInteger cutscene(HSQUIRRELVM v) {
 	HSQUIRRELVM vm = g_twp->getVm();
 	SQInteger nArgs = sq_gettop(v);
 
-	if(g_twp->_cutscene.id && !g_twp->_cutscene.inOverride && sqthread(g_twp->_cutscene.id))
+	if (g_twp->_cutscene.id && !g_twp->_cutscene.inOverride && sqthread(g_twp->_cutscene.id))
 		return sq_throwerror(v, "cutscene called while another cutscene is running");
 
 	HSQOBJECT envObj;
@@ -498,7 +500,7 @@ static SQInteger cutscene(HSQUIRRELVM v) {
 	Common::String cutsceneName = Common::String::format("%s (%lld)", _stringval(_closure(closure)->_function->_sourcename), _closure(closure)->_function->_lineinfos->_line);
 	Common::SharedPtr<Thread> cutscene(new Thread(cutsceneName, true, threadObj, envObj, closure, {}));
 	g_twp->_threads.push_back(cutscene);
-	if(!g_twp->_cutscene.id) {
+	if (!g_twp->_cutscene.id) {
 		g_twp->_cutscene.inputState = g_twp->_inputState.getState();
 		g_twp->_cutscene.showCursor = g_twp->_inputState.getShowCursor();
 		g_twp->_inputState.setInputActive(false);
diff --git a/engines/twp/thread.h b/engines/twp/thread.h
index b8ea1b644d9..b66661f9fb8 100644
--- a/engines/twp/thread.h
+++ b/engines/twp/thread.h
@@ -36,7 +36,7 @@ public:
 	int getId() const { return _id; }
 	bool isGlobal() const { return _global; }
 	HSQUIRRELVM getThread() const { return _threadObj._unVal.pThread; }
-	const Common::String& getName() const { return _name; }
+	const Common::String &getName() const { return _name; }
 
 	bool call();
 	bool update(float elapsed);
diff --git a/engines/twp/twp.cpp b/engines/twp/twp.cpp
index e490522853f..552bdaaf59d 100644
--- a/engines/twp/twp.cpp
+++ b/engines/twp/twp.cpp
@@ -578,7 +578,7 @@ void TwpEngine::update(float elapsed) {
 		size_t i = find(_threads, *it);
 		if (i != (size_t)-1) {
 			// if cutscene reset information
-			if(it->get()->getId() == _cutscene.id) {
+			if (it->get()->getId() == _cutscene.id) {
 				_cutscene.id = 0;
 				g_twp->_inputState.setState(_cutscene.inputState);
 				g_twp->_inputState.setShowCursor(_cutscene.showCursor);
@@ -1147,7 +1147,7 @@ static void onGetPairs(const Common::String &k, HSQOBJECT &oTable, void *data) {
 				}
 			}
 
-			if(SQ_FAILED(sqgetf(params->room->_table, k, obj->_table)))
+			if (SQ_FAILED(sqgetf(params->room->_table, k, obj->_table)))
 				error("Failed to get room object");
 			const int id = g_twp->_resManager->newObjId();
 			setId(obj->_table, id);
@@ -1161,7 +1161,7 @@ static void onGetPairs(const Common::String &k, HSQOBJECT &oTable, void *data) {
 			if (sqrawexists(obj->_table, "initState")) {
 				// info fmt"initState {obj.key}"
 				SQInteger state;
-				if(SQ_FAILED(sqgetf(obj->_table, "initState", state)))
+				if (SQ_FAILED(sqgetf(obj->_table, "initState", state)))
 					error("Failed to get initState");
 				obj->setState(state, true);
 			} else {
@@ -1194,7 +1194,7 @@ Common::SharedPtr<Room> TwpEngine::defineRoom(const Common::String &name, HSQOBJ
 	} else {
 		result.reset(new Room(name, table));
 		Common::String background;
-		if(SQ_FAILED(sqgetf(table, "background", background)))
+		if (SQ_FAILED(sqgetf(table, "background", background)))
 			error("Failed to get room background");
 		GGPackEntryReader entry;
 		entry.open(*_pack, background + ".wimpy");
@@ -1235,7 +1235,7 @@ Common::SharedPtr<Room> TwpEngine::defineRoom(const Common::String &name, HSQOBJ
 				} else {
 					if (pseudo) {
 						// if it's a pseudo room we need to clone each object
-						if(SQ_FAILED(sqgetf(result->_table, obj->_key, obj->_table)))
+						if (SQ_FAILED(sqgetf(result->_table, obj->_key, obj->_table)))
 							error("Failed to get room object");
 						sq_pushobject(v, obj->_table);
 						sq_clone(v, -1);
@@ -1446,7 +1446,7 @@ void TwpEngine::actorExit(Common::SharedPtr<Object> actor) {
 		if (sqrawexists(_room->_table, "actorExit")) {
 			sqcall(_room->_table, "actorExit", actor->_table);
 		}
-		if(_followActor == actor) {
+		if (_followActor == actor) {
 			_followActor = _actor;
 		}
 	}
@@ -1779,10 +1779,10 @@ float TwpEngine::getRandom(float min, float max) const {
 }
 
 SQRESULT TwpEngine::skipCutscene() {
-	if(!_cutscene.id)
+	if (!_cutscene.id)
 		return 0;
 
-	if((_dialog->getState() != DialogState::None) || _cutscene.inOverride || (_cutscene.closureOverride._type == OT_NULL)) {
+	if ((_dialog->getState() != DialogState::None) || _cutscene.inOverride || (_cutscene.closureOverride._type == OT_NULL)) {
 		_noOverride->reset();
 		return 0;
 	}
diff --git a/engines/twp/twp.h b/engines/twp/twp.h
index bdbefef08de..68d4c0fd3a5 100644
--- a/engines/twp/twp.h
+++ b/engines/twp/twp.h
@@ -136,7 +136,7 @@ public:
 	Math::Vector2d screenToRoom(const Math::Vector2d &pos);
 
 	void setActor(Common::SharedPtr<Object> actor, bool userSelected = false);
-	Common::SharedPtr<Object> objAt(const Math::Vector2d& pos);
+	Common::SharedPtr<Object> objAt(const Math::Vector2d &pos);
 	void flashSelectableActor(int flash);
 	void stopTalking();
 	void walkFast(bool state = true);
@@ -147,7 +147,7 @@ public:
 	void setRoom(Common::SharedPtr<Room> room, bool force = false);
 	void enterRoom(Common::SharedPtr<Room> room, Common::SharedPtr<Object> door = nullptr);
 
-	void cameraAt(const Math::Vector2d& at);
+	void cameraAt(const Math::Vector2d &at);
 	// Returns the camera position: the position of the middle of the screen.
 	Math::Vector2d cameraPos();
 	void follow(Common::SharedPtr<Object> actor);
diff --git a/engines/twp/util.h b/engines/twp/util.h
index a886c7bfb27..93c55ffbcdd 100644
--- a/engines/twp/util.h
+++ b/engines/twp/util.h
@@ -112,7 +112,8 @@ size_t find(const Common::Array<Common::SharedPtr<T> > &array, const T *o) {
 
 template<typename T>
 size_t minIndex(const Common::Array<T> &values) {
-	if(values.empty()) return (size_t)-1;
+	if (values.empty())
+		return (size_t)-1;
 	T min = values[0];
 	size_t index = 0;
 	for (size_t i = 1; i < values.size(); i++) {
diff --git a/engines/twp/walkboxnode.cpp b/engines/twp/walkboxnode.cpp
index 2be535521e2..96f93a92761 100644
--- a/engines/twp/walkboxnode.cpp
+++ b/engines/twp/walkboxnode.cpp
@@ -32,7 +32,7 @@ WalkboxNode::WalkboxNode() : Node("Walkbox") {
 	_mode = WalkboxMode::None;
 }
 
-void WalkboxNode::drawCore(const Math::Matrix4& trsf) {
+void WalkboxNode::drawCore(const Math::Matrix4 &trsf) {
 	if (g_twp->_room) {
 		Color white;
 		Color red(1.f, 0.f, 0.f);
@@ -110,7 +110,7 @@ Math::Vector2d PathNode::fixPos(const Math::Vector2d &pos) {
 	return pos;
 }
 
-void PathNode::drawCore(const Math::Matrix4& trsf) {
+void PathNode::drawCore(const Math::Matrix4 &trsf) {
 	if (!g_twp->_room)
 		return;
 
@@ -219,7 +219,7 @@ LightingNode::LightingNode() : Node("Lighting") {
 	_visible = false;
 }
 
-void LightingNode::drawCore(const Math::Matrix4& trsf) {
+void LightingNode::drawCore(const Math::Matrix4 &trsf) {
 	if (!g_twp->_room)
 		return;
 




More information about the Scummvm-git-logs mailing list