Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/Core/Camera.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Core/Land.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/Core/MapObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down
8 changes: 4 additions & 4 deletions src/Core/MapPortion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/EventCommand/MoveObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ class MoveObject extends Base {
Record<string, any>): Orientation | boolean
{
if (object) {
object.lookAt((Orientation.North + (this.isCameraOrientation ? Scene.Map.current.orientation : 0)) % 4);
object.lookAt((Orientation.North + (this.isCameraOrientation ? Scene.Map.current.orientation + 2 : 0)) % 4);
return true;
}
return Orientation.North;
Expand All @@ -739,7 +739,7 @@ class MoveObject extends Base {
Record<string, any>): Orientation | boolean
{
if (object) {
object.lookAt((Orientation.South + (this.isCameraOrientation ? Scene.Map.current.orientation : 0)) % 4);
object.lookAt((Orientation.South + (this.isCameraOrientation ? Scene.Map.current.orientation + 2 : 0)) % 4);
return true;
}
return Orientation.South;
Expand All @@ -756,7 +756,7 @@ class MoveObject extends Base {
Record<string, any>): Orientation | boolean
{
if (object) {
object.lookAt((Orientation.West + (this.isCameraOrientation ? Scene.Map.current.orientation : 0)) % 4);
object.lookAt((Orientation.West + (this.isCameraOrientation ? Scene.Map.current.orientation + 2 : 0)) % 4);
return true;
}
return Orientation.West;
Expand All @@ -773,7 +773,7 @@ class MoveObject extends Base {
Record<string, any>): Orientation | boolean
{
if (object) {
object.lookAt((Orientation.East + (this.isCameraOrientation ? Scene.Map.current.orientation : 0)) % 4);
object.lookAt((Orientation.East + (this.isCameraOrientation ? Scene.Map.current.orientation + 2 : 0)) % 4);
return true;
}
return Orientation.East;
Expand Down
8 changes: 3 additions & 5 deletions src/Graphic/Message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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++;
Expand Down
2 changes: 1 addition & 1 deletion src/Scene/Map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/Scene/SaveLoadGame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/System/MainMenuCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading