mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
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:
parent
8919809912
commit
4435ae4084
10 changed files with 34 additions and 14 deletions
BIN
marblegame.hl
BIN
marblegame.hl
Binary file not shown.
|
|
@ -149,7 +149,8 @@ class CameraController extends Object {
|
||||||
CameraYaw += 0.75 * 5 * dt;
|
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 getRotQuat(v1:Vector, v2:Vector) {
|
||||||
function orthogonal(v:Vector) {
|
function orthogonal(v:Vector) {
|
||||||
|
|
|
||||||
|
|
@ -372,6 +372,8 @@ class DtsObject extends GameObject {
|
||||||
// TODO TRANSLUENCY SHIT
|
// TODO TRANSLUENCY SHIT
|
||||||
}
|
}
|
||||||
material.shadows = false;
|
material.shadows = false;
|
||||||
|
if (this.isCollideable)
|
||||||
|
material.receiveShadows = true;
|
||||||
if (material.texture == null && !iflMaterial) {
|
if (material.texture == null && !iflMaterial) {
|
||||||
// var dtsshader = new DtsTexture();
|
// var dtsshader = new DtsTexture();
|
||||||
// dtsshader.currentOpacity = 1;
|
// dtsshader.currentOpacity = 1;
|
||||||
|
|
@ -398,6 +400,7 @@ class DtsObject extends GameObject {
|
||||||
if (flags & 4 > 0) {
|
if (flags & 4 > 0) {
|
||||||
material.blendMode = BlendMode.Alpha;
|
material.blendMode = BlendMode.Alpha;
|
||||||
material.mainPass.culling = h3d.mat.Data.Face.None;
|
material.mainPass.culling = h3d.mat.Data.Face.None;
|
||||||
|
material.receiveShadows = false;
|
||||||
}
|
}
|
||||||
// // TODO TRANSPARENCY SHIT
|
// // TODO TRANSPARENCY SHIT
|
||||||
if (flags & 8 > 0) {
|
if (flags & 8 > 0) {
|
||||||
|
|
@ -411,7 +414,7 @@ class DtsObject extends GameObject {
|
||||||
|
|
||||||
if (flags & 32 > 0) {
|
if (flags & 32 > 0) {
|
||||||
material.mainPass.enableLights = false;
|
material.mainPass.enableLights = false;
|
||||||
// material.receiveShadows = false;
|
material.receiveShadows = false;
|
||||||
// material.mainPass.setPassName("overlay");
|
// material.mainPass.setPassName("overlay");
|
||||||
// var pbrprops = material.mainPass.getShader(h3d.shader.pbr.PropsValues);
|
// var pbrprops = material.mainPass.getShader(h3d.shader.pbr.PropsValues);
|
||||||
// pbrprops.emissiveValue = 1;
|
// pbrprops.emissiveValue = 1;
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,7 @@ class InstanceManager {
|
||||||
// minfo.transparencymeshbatch.material.mainPass.setPassName(minfo.mesh.material.mainPass.name);
|
// minfo.transparencymeshbatch.material.mainPass.setPassName(minfo.mesh.material.mainPass.name);
|
||||||
minfo.transparencymeshbatch.shadersChanged = true;
|
minfo.transparencymeshbatch.shadersChanged = true;
|
||||||
minfo.transparencymeshbatch.material.mainPass.enableLights = minfo.mesh.material.mainPass.enableLights;
|
minfo.transparencymeshbatch.material.mainPass.enableLights = minfo.mesh.material.mainPass.enableLights;
|
||||||
|
minfo.transparencymeshbatch.material.receiveShadows = false;
|
||||||
// minfo.transparencymeshbatch.material.mainPass.depthWrite = false;
|
// minfo.transparencymeshbatch.material.mainPass.depthWrite = false;
|
||||||
// if (dtsShader != null) {
|
// if (dtsShader != null) {
|
||||||
// dtsShader.currentOpacity = instance.gameObject.currentOpacity;
|
// dtsShader.currentOpacity = instance.gameObject.currentOpacity;
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ class MarbleGame {
|
||||||
// Pause shit
|
// Pause shit
|
||||||
js.Browser.document.addEventListener('pointerlockchange', () -> {
|
js.Browser.document.addEventListener('pointerlockchange', () -> {
|
||||||
if (!paused && world != null) {
|
if (!paused && world != null) {
|
||||||
if (world.finishTime == null) {
|
if (world.finishTime == null && world._ready) {
|
||||||
if (js.Browser.document.pointerLockElement != @:privateAccess Window.getInstance().canvas) {
|
if (js.Browser.document.pointerLockElement != @:privateAccess Window.getInstance().canvas) {
|
||||||
paused = true;
|
paused = true;
|
||||||
handlePauseGame();
|
handlePauseGame();
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ class GuiAnim extends GuiControl {
|
||||||
|
|
||||||
public override function render(scene2d:Scene) {
|
public override function render(scene2d:Scene) {
|
||||||
var renderRect = this.getRenderRectangle();
|
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.scaleX = renderRect.extent.x / anim.getFrame().width;
|
||||||
anim.scaleY = renderRect.extent.y / anim.getFrame().height;
|
anim.scaleY = renderRect.extent.y / anim.getFrame().height;
|
||||||
if (scene2d.contains(anim)) {
|
if (scene2d.contains(anim)) {
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ class GuiImage extends GuiControl {
|
||||||
|
|
||||||
public override function render(scene2d:Scene) {
|
public override function render(scene2d:Scene) {
|
||||||
var renderRect = this.getRenderRectangle();
|
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.scaleX = renderRect.extent.x / bmp.tile.width;
|
||||||
// bmp.scaleY = renderRect.extent.y / bmp.tile.height;
|
// bmp.scaleY = renderRect.extent.y / bmp.tile.height;
|
||||||
bmp.width = renderRect.extent.x;
|
bmp.width = renderRect.extent.x;
|
||||||
|
|
|
||||||
|
|
@ -22,15 +22,15 @@ class GuiMLText extends GuiControl {
|
||||||
var renderRect = this.getRenderRectangle();
|
var renderRect = this.getRenderRectangle();
|
||||||
text.maxWidth = renderRect.extent.x;
|
text.maxWidth = renderRect.extent.x;
|
||||||
if (justify == Left) {
|
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;
|
text.textAlign = Left;
|
||||||
}
|
}
|
||||||
if (justify == Right) {
|
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;
|
text.textAlign = Right;
|
||||||
}
|
}
|
||||||
if (justify == Center) {
|
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;
|
text.textAlign = Center;
|
||||||
}
|
}
|
||||||
if (scene2d.contains(text))
|
if (scene2d.contains(text))
|
||||||
|
|
|
||||||
|
|
@ -24,15 +24,15 @@ class GuiText extends GuiControl {
|
||||||
public override function render(scene2d:Scene) {
|
public override function render(scene2d:Scene) {
|
||||||
var renderRect = this.getRenderRectangle();
|
var renderRect = this.getRenderRectangle();
|
||||||
if (justify == Left) {
|
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;
|
text.textAlign = Left;
|
||||||
}
|
}
|
||||||
if (justify == Right) {
|
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;
|
text.textAlign = Right;
|
||||||
}
|
}
|
||||||
if (justify == Center) {
|
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;
|
text.textAlign = Center;
|
||||||
}
|
}
|
||||||
if (scene2d.contains(text))
|
if (scene2d.contains(text))
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package gui;
|
package gui;
|
||||||
|
|
||||||
|
import hxd.Key;
|
||||||
|
import gui.GuiControl.MouseState;
|
||||||
import h3d.Matrix;
|
import h3d.Matrix;
|
||||||
import h2d.filter.ColorMatrix;
|
import h2d.filter.ColorMatrix;
|
||||||
import h2d.Tile;
|
import h2d.Tile;
|
||||||
|
|
@ -64,7 +66,7 @@ class PlayMissionGui extends GuiImage {
|
||||||
localContainer.addChild(tabAdvanced);
|
localContainer.addChild(tabAdvanced);
|
||||||
|
|
||||||
var tabIntermediate = new GuiImage(ResourceLoader.getImage("data/ui/play/tab_inter.png").toTile());
|
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.extent = new Vector(205, 58);
|
||||||
tabIntermediate.pressedAction = (sender) -> {
|
tabIntermediate.pressedAction = (sender) -> {
|
||||||
currentList = MissionList.intermediateMissions;
|
currentList = MissionList.intermediateMissions;
|
||||||
|
|
@ -149,7 +151,7 @@ class PlayMissionGui extends GuiImage {
|
||||||
noQualText.extent = new Vector(254, 32);
|
noQualText.extent = new Vector(254, 32);
|
||||||
noQualText.text.textColor = 0xCCCCCC;
|
noQualText.text.textColor = 0xCCCCCC;
|
||||||
noQualText.justify = Center;
|
noQualText.justify = Center;
|
||||||
noQualText.text.text = "Not qualified!";
|
noQualText.text.text = "Not Qualified!";
|
||||||
levelWnd.addChild(noQualText);
|
levelWnd.addChild(noQualText);
|
||||||
|
|
||||||
var pmPlay = new GuiButton(loadButtonImages("data/ui/play/play"));
|
var pmPlay = new GuiButton(loadButtonImages("data/ui/play/play"));
|
||||||
|
|
@ -372,6 +374,7 @@ class PlayMissionGui extends GuiImage {
|
||||||
currentMission.title = "";
|
currentMission.title = "";
|
||||||
currentMission.description = "";
|
currentMission.description = "";
|
||||||
currentMission.path = "bruh";
|
currentMission.path = "bruh";
|
||||||
|
currentSelection = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
var scoreData:Array<Score> = Settings.getScores(currentMission.path);
|
var scoreData:Array<Score> = Settings.getScores(currentMission.path);
|
||||||
|
|
@ -415,7 +418,19 @@ class PlayMissionGui extends GuiImage {
|
||||||
|
|
||||||
public override function render(scene2d:Scene) {
|
public override function render(scene2d:Scene) {
|
||||||
super.render(scene2d);
|
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);
|
// 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue