extended camera pitch, dts shadows test, fixed wacky rendering in browser when paused and level is still loading, fixed misaligned intermediate tab, fixed no custom levels preview

This commit is contained in:
RandomityGuy 2021-07-12 23:13:34 +05:30
parent 8919809912
commit 4435ae4084
10 changed files with 34 additions and 14 deletions

Binary file not shown.

View file

@ -149,7 +149,8 @@ class CameraController extends Object {
CameraYaw += 0.75 * 5 * dt;
}
CameraPitch = Util.clamp(CameraPitch, -Math.PI / 12, Math.PI / 2);
CameraPitch = Math.max(-Math.PI / 2 + Math.PI / 4,
Math.min(Math.PI / 2 - 0.0001, CameraPitch)); // Util.clamp(CameraPitch, -Math.PI / 12, Math.PI / 2);
function getRotQuat(v1:Vector, v2:Vector) {
function orthogonal(v:Vector) {

View file

@ -372,6 +372,8 @@ class DtsObject extends GameObject {
// TODO TRANSLUENCY SHIT
}
material.shadows = false;
if (this.isCollideable)
material.receiveShadows = true;
if (material.texture == null && !iflMaterial) {
// var dtsshader = new DtsTexture();
// dtsshader.currentOpacity = 1;
@ -398,6 +400,7 @@ class DtsObject extends GameObject {
if (flags & 4 > 0) {
material.blendMode = BlendMode.Alpha;
material.mainPass.culling = h3d.mat.Data.Face.None;
material.receiveShadows = false;
}
// // TODO TRANSPARENCY SHIT
if (flags & 8 > 0) {
@ -411,7 +414,7 @@ class DtsObject extends GameObject {
if (flags & 32 > 0) {
material.mainPass.enableLights = false;
// material.receiveShadows = false;
material.receiveShadows = false;
// material.mainPass.setPassName("overlay");
// var pbrprops = material.mainPass.getShader(h3d.shader.pbr.PropsValues);
// pbrprops.emissiveValue = 1;

View file

@ -56,6 +56,7 @@ class InstanceManager {
// minfo.transparencymeshbatch.material.mainPass.setPassName(minfo.mesh.material.mainPass.name);
minfo.transparencymeshbatch.shadersChanged = true;
minfo.transparencymeshbatch.material.mainPass.enableLights = minfo.mesh.material.mainPass.enableLights;
minfo.transparencymeshbatch.material.receiveShadows = false;
// minfo.transparencymeshbatch.material.mainPass.depthWrite = false;
// if (dtsShader != null) {
// dtsShader.currentOpacity = instance.gameObject.currentOpacity;

View file

@ -34,7 +34,7 @@ class MarbleGame {
// Pause shit
js.Browser.document.addEventListener('pointerlockchange', () -> {
if (!paused && world != null) {
if (world.finishTime == null) {
if (world.finishTime == null && world._ready) {
if (js.Browser.document.pointerLockElement != @:privateAccess Window.getInstance().canvas) {
paused = true;
handlePauseGame();

View file

@ -17,7 +17,7 @@ class GuiAnim extends GuiControl {
public override function render(scene2d:Scene) {
var renderRect = this.getRenderRectangle();
anim.setPosition(Math.round(renderRect.position.x), Math.round(renderRect.position.y));
anim.setPosition(Math.floor(renderRect.position.x), Math.floor(renderRect.position.y));
anim.scaleX = renderRect.extent.x / anim.getFrame().width;
anim.scaleY = renderRect.extent.y / anim.getFrame().height;
if (scene2d.contains(anim)) {

View file

@ -19,7 +19,7 @@ class GuiImage extends GuiControl {
public override function render(scene2d:Scene) {
var renderRect = this.getRenderRectangle();
bmp.setPosition(Math.round(renderRect.position.x), Math.round(renderRect.position.y));
bmp.setPosition(Math.floor(renderRect.position.x), Math.floor(renderRect.position.y));
// bmp.scaleX = renderRect.extent.x / bmp.tile.width;
// bmp.scaleY = renderRect.extent.y / bmp.tile.height;
bmp.width = renderRect.extent.x;

View file

@ -22,15 +22,15 @@ class GuiMLText extends GuiControl {
var renderRect = this.getRenderRectangle();
text.maxWidth = renderRect.extent.x;
if (justify == Left) {
text.setPosition(Math.round(renderRect.position.x), Math.round(renderRect.position.y));
text.setPosition(Math.floor(renderRect.position.x), Math.floor(renderRect.position.y));
text.textAlign = Left;
}
if (justify == Right) {
text.setPosition(Math.round(renderRect.position.x + renderRect.extent.x), Math.round(renderRect.position.y));
text.setPosition(Math.floor(renderRect.position.x + renderRect.extent.x), Math.floor(renderRect.position.y));
text.textAlign = Right;
}
if (justify == Center) {
text.setPosition(Math.round(renderRect.position.x + renderRect.extent.x / 2), Math.round(renderRect.position.y));
text.setPosition(Math.floor(renderRect.position.x + renderRect.extent.x / 2), Math.floor(renderRect.position.y));
text.textAlign = Center;
}
if (scene2d.contains(text))

View file

@ -24,15 +24,15 @@ class GuiText extends GuiControl {
public override function render(scene2d:Scene) {
var renderRect = this.getRenderRectangle();
if (justify == Left) {
text.setPosition(Math.round(renderRect.position.x), Math.round(renderRect.position.y));
text.setPosition(Math.floor(renderRect.position.x), Math.floor(renderRect.position.y));
text.textAlign = Left;
}
if (justify == Right) {
text.setPosition(Math.round(renderRect.position.x + renderRect.extent.x), Math.round(renderRect.position.y));
text.setPosition(Math.floor(renderRect.position.x + renderRect.extent.x), Math.floor(renderRect.position.y));
text.textAlign = Right;
}
if (justify == Center) {
text.setPosition(Math.round(renderRect.position.x + renderRect.extent.x / 2), Math.round(renderRect.position.y));
text.setPosition(Math.floor(renderRect.position.x + renderRect.extent.x / 2), Math.floor(renderRect.position.y));
text.textAlign = Center;
}
if (scene2d.contains(text))

View file

@ -1,5 +1,7 @@
package gui;
import hxd.Key;
import gui.GuiControl.MouseState;
import h3d.Matrix;
import h2d.filter.ColorMatrix;
import h2d.Tile;
@ -64,7 +66,7 @@ class PlayMissionGui extends GuiImage {
localContainer.addChild(tabAdvanced);
var tabIntermediate = new GuiImage(ResourceLoader.getImage("data/ui/play/tab_inter.png").toTile());
tabIntermediate.position = new Vector(213, 4);
tabIntermediate.position = new Vector(213, 6);
tabIntermediate.extent = new Vector(205, 58);
tabIntermediate.pressedAction = (sender) -> {
currentList = MissionList.intermediateMissions;
@ -149,7 +151,7 @@ class PlayMissionGui extends GuiImage {
noQualText.extent = new Vector(254, 32);
noQualText.text.textColor = 0xCCCCCC;
noQualText.justify = Center;
noQualText.text.text = "Not qualified!";
noQualText.text.text = "Not Qualified!";
levelWnd.addChild(noQualText);
var pmPlay = new GuiButton(loadButtonImages("data/ui/play/play"));
@ -372,6 +374,7 @@ class PlayMissionGui extends GuiImage {
currentMission.title = "";
currentMission.description = "";
currentMission.path = "bruh";
currentSelection = -1;
}
var scoreData:Array<Score> = Settings.getScores(currentMission.path);
@ -415,7 +418,19 @@ class PlayMissionGui extends GuiImage {
public override function render(scene2d:Scene) {
super.render(scene2d);
setSelectedFunc(cast Math.min(currentList.length - 1, Settings.progression[["beginner", "intermediate", "advanced"].indexOf(currentCategory)]));
if (currentCategory != "custom")
setSelectedFunc(cast Math.min(currentList.length - 1, Settings.progression[["beginner", "intermediate", "advanced"].indexOf(currentCategory)]));
else
setSelectedFunc(currentList.length - 1);
// setSelectedFunc(0);
}
public override function update(dt:Float, mouseState:MouseState) {
super.update(dt, mouseState);
if (Key.isPressed(Key.LEFT))
setSelectedFunc(currentSelection - 1);
if (Key.isPressed(Key.RIGHT))
setSelectedFunc(currentSelection + 1);
}
}