Skip to content
Open
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
12 changes: 4 additions & 8 deletions src/Core/Picture2D.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,10 @@ class Picture2D extends Bitmap {
{
if (!this.empty && this.loaded && sw > 0 && sh > 0) {
// Default values
x = x === null ? this.x : (positionResize ? ScreenResolution
.getScreenX(x) : x);
y = y === null ? this.y : (positionResize ? ScreenResolution
.getScreenY(y) : y);
w = w === null ? this.w * this.zoom : (this.stretch ? ScreenResolution
.getScreenX(w) : ScreenResolution.getScreenMinXY(w));
h = h === null ? this.h * this.zoom : (this.stretch ? ScreenResolution
.getScreenY(h) : ScreenResolution.getScreenMinXY(h));
x = x === null ? (this.stretch ? ScreenResolution.getScreenX(this.oX) : this.x) : (positionResize ? ScreenResolution.getScreenX(x) : x);
y = y === null ? (this.stretch ? ScreenResolution.getScreenY(this.oY) : this.y) : (positionResize ? ScreenResolution.getScreenY(y) : y);
w = w === null ? (this.stretch ? ScreenResolution.getScreenX(this.oW * this.zoom) : this.oW * this.zoom) : ScreenResolution.getScreenMinXY(w);
h = h === null ? (this.stretch ? ScreenResolution.getScreenY(this.oH * this.zoom) : this.oH * this.zoom) : ScreenResolution.getScreenMinXY(h);

// Draw the image according to all parameters
let angle = this.angle * Math.PI / 180;
Expand Down
27 changes: 16 additions & 11 deletions src/Core/Status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ class Status {
let totalWidth = l * ScreenResolution.getScreenMinXY(Datas.Systems.iconsSize);
let s: Status;
if (l > 1) {
totalWidth += (l - 1) * ScreenResolution.getScreenMinXY(Constants
.MEDIUM_SPACE);
totalWidth += (l - 1) * ScreenResolution.getScreenMinXY(Constants.MEDIUM_SPACE);
}
let xOffset: number = 0;
switch (align) {
Expand All @@ -74,10 +73,10 @@ class Status {
for (let i = 0, l = statusList.length; i < l; i++) {
s = statusList[i];
xOffset += ScreenResolution.getScreenMinXY(Datas.Systems.iconsSize);
s.draw(x - totalWidth + xOffset + ScreenResolution.getScreenMinXY(i
* Constants.MEDIUM_SPACE) - ScreenResolution.getScreenMinXY(Datas
.Systems.iconsSize), y - ScreenResolution.getScreenMinXY(Datas
.Systems.iconsSize));
s.draw(
x - totalWidth + xOffset + ScreenResolution.getScreenMinXY(i * Constants.MEDIUM_SPACE) - ScreenResolution.getScreenMinXY(Datas.Systems.iconsSize),
y - ScreenResolution.getScreenMinXY(Datas.Systems.iconsSize)
);
}
}

Expand Down Expand Up @@ -123,11 +122,17 @@ class Status {
* @param {number} y - The y position
*/
draw(x: number, y: number) {
this.picture.draw({ x: x, y: y, sx: this.system.pictureIndexX * Datas
.Systems.iconsSize, sy: this.system.pictureIndexY * Datas.Systems
.iconsSize, sw: Datas.Systems.iconsSize, sh: Datas.Systems.iconsSize,
w: ScreenResolution.getScreenMinXY(Datas.Systems.iconsSize), h:
ScreenResolution.getScreenMinXY(Datas.Systems.iconsSize) });
this.picture.draw(
{
x: x,
y: y,
sx: this.system.pictureIndexX * Datas.Systems.iconsSize,
sy: this.system.pictureIndexY * Datas.Systems.iconsSize,
sw: Datas.Systems.iconsSize,
sh: Datas.Systems.iconsSize,
w: Datas.Systems.iconsSize,
h: Datas.Systems.iconsSize
});
}
}

Expand Down
Loading