From 31d64982e2f58ba4c4fe092f6e891f0b28a23b0e Mon Sep 17 00:00:00 2001 From: Russo Date: Wed, 3 Apr 2024 12:51:39 -0300 Subject: [PATCH 1/6] Small bugfix --- src/Scene/Map.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Scene/Map.ts b/src/Scene/Map.ts index 8bf6d73d..2de3c7bb 100644 --- a/src/Scene/Map.ts +++ b/src/Scene/Map.ts @@ -1079,7 +1079,7 @@ class Map extends Base { let angle = Math.atan2(vector.x, vector.z) + Math.PI; // Update the objects - if (!this.isBattleMap) { + if (Game.current !== null) { Game.current.hero.update(angle); } this.updatePortions(this, function(x: number, y: number, z: number, From ecc089528589b038aa234a6c63fef9ed47864089 Mon Sep 17 00:00:00 2001 From: Russo Date: Wed, 22 May 2024 13:23:20 -0300 Subject: [PATCH 2/6] bugfix: script menu commands --- src/System/MainMenuCommand.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/System/MainMenuCommand.ts b/src/System/MainMenuCommand.ts index 2304f21e..bafa0a2b 100644 --- a/src/System/MainMenuCommand.ts +++ b/src/System/MainMenuCommand.ts @@ -102,9 +102,9 @@ class MainMenuCommand extends Translatable { return true; }; case Enum.MainMenuCommandKind.Script: + const t = this; return function() { - return Interpreter.evaluate(this.script, { additionalName: - "menu", additionalValue: this}); + return Interpreter.evaluate(t.script, { additionalName: "menu", additionalValue: t, addReturn: false }); }; default: return null; From c994936988d0e0766a23e2116cf178bab85b5f4c Mon Sep 17 00:00:00 2001 From: Russo Date: Wed, 12 Jun 2024 13:43:28 -0300 Subject: [PATCH 3/6] bugfix: text alignment --- src/Graphic/Message.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Graphic/Message.ts b/src/Graphic/Message.ts index b66d7446..b35de713 100644 --- a/src/Graphic/Message.ts +++ b/src/Graphic/Message.ts @@ -479,8 +479,8 @@ class Message extends Graphic.Base { if (Datas.Systems.dbOptions.v_fPosAbove) { this.drawFaceset(x, y, w, h); } - let newX = x + ScreenResolution.getScreenMinXY(Constants.HUGE_SPACE) + - (this.faceset.empty ? 0 : ScreenResolution.getScreenMinXY(Datas + let newX = x + ScreenResolution.getScreenX(Constants.HUGE_SPACE * 2) + + (this.faceset.empty ? 0 : ScreenResolution.getScreenX(Datas .Systems.facesetScalingWidth)); let newY = y + ScreenResolution.getScreenMinXY(Constants.HUGE_SPACE); let offsetY = 0; From 8b55910ebdae37c690354cee21fe68e66416cf96 Mon Sep 17 00:00:00 2001 From: Russo Date: Tue, 23 Jul 2024 15:13:33 -0300 Subject: [PATCH 4/6] Update SaveLoadGame.ts --- src/Scene/SaveLoadGame.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Scene/SaveLoadGame.ts b/src/Scene/SaveLoadGame.ts index 26a18880..2588fbff 100644 --- a/src/Scene/SaveLoadGame.ts +++ b/src/Scene/SaveLoadGame.ts @@ -39,8 +39,9 @@ class SaveLoadGame extends Base { let currentGame = Game.current; for (let i = 1; i <= Datas.Systems.saveSlots; i++) { this.gamesDatas.push(null); - Game.current = new Game(i); - await Game.current.load(); + const newGame = new Game(i); + await newGame.load(); + Game.current = newGame; this.initializeGame(Game.current); } Game.current = currentGame; From 2d72bf62560a1db75f95b6394044f8c9abc4399f Mon Sep 17 00:00:00 2001 From: Russo Date: Fri, 10 Jan 2025 14:39:27 -0300 Subject: [PATCH 5/6] bugfixes --- src/Core/Camera.ts | 3 +-- src/Core/Land.ts | 4 ++-- src/Core/MapObject.ts | 4 ++-- src/Core/MapPortion.ts | 8 ++++---- src/EventCommand/MoveObject.ts | 12 ++++++------ src/Graphic/Message.ts | 8 +++----- src/Scene/Map.ts | 2 +- 7 files changed, 19 insertions(+), 22 deletions(-) diff --git a/src/Core/Camera.ts b/src/Core/Camera.ts index ecc61e44..04c8aa21 100644 --- a/src/Core/Camera.ts +++ b/src/Core/Camera.ts @@ -236,8 +236,7 @@ class Camera { * Update the distance. */ updateDistance() { - this.distance = this.getThreeCamera().position.distanceTo(this - .targetPosition); + this.getThreeCamera().position.normalize().multiplyScalar(this.distance); } /** diff --git a/src/Core/Land.ts b/src/Core/Land.ts index d5954f15..138b0b3c 100644 --- a/src/Core/Land.ts +++ b/src/Core/Land.ts @@ -153,9 +153,9 @@ class Land extends MapElement { p: position, l: localPosition, b: [ - a + rect[0] + Datas.Systems.SQUARE_SIZE / 2, + a + rect[0] + rect[2] / 2, b + 0.5, - c + rect[1] + Datas.Systems.SQUARE_SIZE / 2, + c + rect[1] + rect[3] / 2, rect[2], rect[3], 1, diff --git a/src/Core/MapObject.ts b/src/Core/MapObject.ts index ef4d6bc9..b33e9eb1 100644 --- a/src/Core/MapObject.ts +++ b/src/Core/MapObject.ts @@ -545,7 +545,7 @@ class MapObject { this.frame.value = this.currentStateInstance.indexX >= Datas.Systems .FRAMES ? Datas.Systems.FRAMES - 1 : this.currentStateInstance .indexX; - this.orientationEye = this.currentStateInstance.indexY; + this.orientationEye = this.currentStateInstance.setWithCamera ? this.currentStateInstance.indexY : Mathf.mod(Scene.Map.current.orientation + this.currentStateInstance.indexY - 2, 4); this.updateOrientation(); let result: [CustomGeometry, [number, StructMapElementCollision[]]]; let positionTranformation = Position.createFromVector3(this.position); @@ -629,7 +629,7 @@ class MapObject { } this.mesh.position.set(this.position.x, this.position.y, this .position.z); - this.mesh.renderOrder = 9999; + this.mesh.renderOrder = -1; this.boundingBoxSettings = objCollision[1][0]; if (this.boundingBoxSettings) { if (this.currentStateInstance.graphicID === 0) { diff --git a/src/Core/MapPortion.ts b/src/Core/MapPortion.ts index 3eae9031..c78a5c70 100644 --- a/src/Core/MapPortion.ts +++ b/src/Core/MapPortion.ts @@ -185,7 +185,7 @@ class MapPortion { if (!geometry.isEmpty()) { geometry.updateAttributes(); this.staticFloorsMesh = new THREE.Mesh(geometry, material); - this.staticFloorsMesh.renderOrder = 0; + this.staticFloorsMesh.renderOrder = -1; if (Scene.Map.current.mapProperties.isSunLight) { this.staticFloorsMesh.receiveShadow = true; this.staticFloorsMesh.castShadow = true; @@ -321,7 +321,7 @@ class MapPortion { if (!staticGeometry.isEmpty()) { staticGeometry.updateAttributes(); this.staticSpritesMesh = new THREE.Mesh(staticGeometry, material); - this.staticSpritesMesh.renderOrder = 999; + this.staticSpritesMesh.renderOrder = -1; if (Scene.Map.current.mapProperties.isSunLight) { this.staticSpritesMesh.receiveShadow = true; this.staticSpritesMesh.castShadow = true; @@ -332,7 +332,7 @@ class MapPortion { if (!faceGeometry.isEmpty()) { faceGeometry.updateAttributes(); this.faceSpritesMesh = new THREE.Mesh(faceGeometry, material); - this.faceSpritesMesh.renderOrder = 999; + this.faceSpritesMesh.renderOrder = -1; if (Scene.Map.current.mapProperties.isSunLight) { this.faceSpritesMesh.castShadow = true; this.faceSpritesMesh.receiveShadow = true; @@ -584,7 +584,7 @@ class MapPortion { geometry.updateAttributes(); mesh = new THREE.Mesh(geometry, obj.material); this.staticObjects3DList.push(mesh); - mesh.renderOrder = 999; + mesh.renderOrder = -1; if (Scene.Map.current.mapProperties.isSunLight) { mesh.receiveShadow = true; mesh.castShadow = true; diff --git a/src/EventCommand/MoveObject.ts b/src/EventCommand/MoveObject.ts index 41778e28..bb3fda44 100644 --- a/src/EventCommand/MoveObject.ts +++ b/src/EventCommand/MoveObject.ts @@ -722,7 +722,7 @@ class MoveObject extends Base { Record): Orientation | boolean { if (object) { - object.lookAt(Orientation.North); + object.lookAt((Orientation.North + (this.isCameraOrientation ? Scene.Map.current.orientation + 2 : 0)) % 4); return true; } return Orientation.North; @@ -739,7 +739,7 @@ class MoveObject extends Base { Record): Orientation | boolean { if (object) { - object.lookAt(Orientation.South); + object.lookAt((Orientation.South + (this.isCameraOrientation ? Scene.Map.current.orientation + 2 : 0)) % 4); return true; } return Orientation.South; @@ -756,7 +756,7 @@ class MoveObject extends Base { Record): Orientation | boolean { if (object) { - object.lookAt(Orientation.West); + object.lookAt((Orientation.West + (this.isCameraOrientation ? Scene.Map.current.orientation + 2 : 0)) % 4); return true; } return Orientation.West; @@ -773,7 +773,7 @@ class MoveObject extends Base { Record): Orientation | boolean { if (object) { - object.lookAt(Orientation.East); + object.lookAt((Orientation.East + (this.isCameraOrientation ? Scene.Map.current.orientation + 2 : 0)) % 4); return true; } return Orientation.East; @@ -918,7 +918,7 @@ class MoveObject extends Base { options.sid = object.currentStateInstance.speedID; } object.currentStateInstance.indexX = object.frame.value; - object.currentStateInstance.indexY = object.orientation; + object.currentStateInstance.indexY = object.orientationEye; object.changeState(); } return Orientation.None; @@ -948,7 +948,7 @@ class MoveObject extends Base { options.fid = object.currentStateInstance.frequencyID; } object.currentStateInstance.indexX = object.frame.value; - object.currentStateInstance.indexY = object.orientation; + object.currentStateInstance.indexY = object.orientationEye; object.changeState(); } return Orientation.None; diff --git a/src/Graphic/Message.ts b/src/Graphic/Message.ts index b35de713..be8a84da 100644 --- a/src/Graphic/Message.ts +++ b/src/Graphic/Message.ts @@ -479,9 +479,7 @@ class Message extends Graphic.Base { if (Datas.Systems.dbOptions.v_fPosAbove) { this.drawFaceset(x, y, w, h); } - let newX = x + ScreenResolution.getScreenX(Constants.HUGE_SPACE * 2) + - (this.faceset.empty ? 0 : ScreenResolution.getScreenX(Datas - .Systems.facesetScalingWidth)); + let newX = x + (this.faceset.empty ? 0 : ScreenResolution.getScreenX(Datas.Systems.facesetScalingWidth)); let newY = y + ScreenResolution.getScreenMinXY(Constants.HUGE_SPACE); let offsetY = 0; let align = Align.None; @@ -506,10 +504,10 @@ class Message extends Graphic.Base { offsetX = 0; break; case Align.Center: - offsetX = (w - this.totalWidths[j] - newX) / 2; + offsetX = (w - this.totalWidths[j]) / 2; break; case Align.Right: - offsetX = w - this.totalWidths[j] - newX; + offsetX = w - this.totalWidths[j]; break; } j++; diff --git a/src/Scene/Map.ts b/src/Scene/Map.ts index 2de3c7bb..0c4ff4d4 100644 --- a/src/Scene/Map.ts +++ b/src/Scene/Map.ts @@ -901,7 +901,7 @@ class Map extends Base { points.position.set(Scene.Map.current.camera.target.position.x, Scene .Map.current.camera.target.position.y, Scene.Map.current.camera.target .position.z) - points.renderOrder = 1000; + points.renderOrder = -1; this.scene.add(points); if (current) { this.weatherPoints = points; From d5b40fff0a3af8e0223fadf10b2c59552e857734 Mon Sep 17 00:00:00 2001 From: Russo Date: Fri, 10 Jan 2025 14:47:00 -0300 Subject: [PATCH 6/6] Update SaveLoadGame.ts --- src/Scene/SaveLoadGame.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Scene/SaveLoadGame.ts b/src/Scene/SaveLoadGame.ts index 2588fbff..cd331fcc 100644 --- a/src/Scene/SaveLoadGame.ts +++ b/src/Scene/SaveLoadGame.ts @@ -41,7 +41,7 @@ class SaveLoadGame extends Base { this.gamesDatas.push(null); const newGame = new Game(i); await newGame.load(); - Game.current = newGame; + Game.current = newGame; this.initializeGame(Game.current); } Game.current = currentGame;