more bugfixes

This commit is contained in:
RandomityGuy 2021-07-13 16:11:12 +05:30
parent afb8a2dc97
commit b2c56da65e
11 changed files with 80 additions and 38 deletions

View file

@ -1 +1 @@
by17:font%2FExpo50.fntaoy3:veri1y4:timei1625241820y4:hashy40:f2bb3df897a1cbe1bc70650168d9ecf7de1195f1y3:outy24:tmp%2Ffont%2FExpo50.bfntghy17:font%2FExpo32.fntaoR1i1R2i1625241820R3y40:d3397b6efedac7bfa90be848901a0167dfd32e7eR5y24:tmp%2Ffont%2FExpo32.bfntghy24:font%2FDomCasual32px.fntaoR1i1R2i1625241820R3y40:f9ae7ff4e7b94f78bd6a050e51a9f92fbfdbb40cR5y31:tmp%2Ffont%2FDomCasual32px.bfntghy24:font%2FDomCasual24px.fntaoR1i1R2i1625241820R3y40:f5f86d351ba84a7e1a5f1a459463a4eaf66ca893R5y31:tmp%2Ffont%2FDomCasual24px.bfntghy24:font%2FArialBold14px.fntaoR1i1R2i1625241820R3y40:4f58a547a119d447806129c12b660d267212a382R5y31:tmp%2Ffont%2FArialBold14px.bfntghy18:font%2FArial14.fntaoR1i1R2i1625241820R3y40:5433840b11f487315b7372dd95a79eda5986d558R5y25:tmp%2Ffont%2FArial14.bfntghh
by17:font%2FExpo50.fntaoy3:veri1y4:timei1626163037y4:hashy40:f2bb3df897a1cbe1bc70650168d9ecf7de1195f1y3:outy24:tmp%2Ffont%2FExpo50.bfntghy17:font%2FExpo32.fntaoR1i1R2i1626163037R3y40:d3397b6efedac7bfa90be848901a0167dfd32e7eR5y24:tmp%2Ffont%2FExpo32.bfntghy24:font%2FDomCasual32px.fntaoR1i1R2i1626163037R3y40:f9ae7ff4e7b94f78bd6a050e51a9f92fbfdbb40cR5y31:tmp%2Ffont%2FDomCasual32px.bfntghy24:font%2FDomCasual24px.fntaoR1i1R2i1626163037R3y40:f5f86d351ba84a7e1a5f1a459463a4eaf66ca893R5y31:tmp%2Ffont%2FDomCasual24px.bfntghy24:font%2FArialBold14px.fntaoR1i1R2i1626163037R3y40:4f58a547a119d447806129c12b660d267212a382R5y31:tmp%2Ffont%2FArialBold14px.bfntghy18:font%2FArial14.fntaoR1i1R2i1626163037R3y40:5433840b11f487315b7372dd95a79eda5986d558R5y25:tmp%2Ffont%2FArial14.bfntghh

Binary file not shown.

View file

@ -305,6 +305,7 @@ class DifBuilder {
if (canFindTex(grp)) {
texture = ResourceLoader.getFileEntry(tex(grp)).toImage().toTexture();
texture.wrap = Wrap.Repeat;
texture.mipMap = Nearest;
material = h3d.mat.Material.create(texture);
} else {
material = Material.create();

View file

@ -63,11 +63,6 @@ class Main extends hxd.App {
static function main() {
// h3d.mat.PbrMaterialSetup.set();
#if hl
sdl.Sdl.setGLOptions(3, 2, 24, 8, 1, 2);
sdl.Sdl.setHint("SDL_HINT_RENDER_SCALE_QUALITY", "1");
#end
h3d.Engine.ANTIALIASING = 4;
new Main();
}
}

View file

@ -116,9 +116,11 @@ class MarbleGame {
public function quitMission() {
world.setCursorLock(false);
paused = false;
var pmg = new PlayMissionGui();
PlayMissionGui.currentSelectionStatic = world.mission.index;
world.dispose();
world = null;
canvas.setContent(new PlayMissionGui());
canvas.setContent(pmg);
}
public function playMission(mission:Mission) {

View file

@ -193,9 +193,7 @@ class MarbleWorld extends Scheduler {
this.instanceManager = new InstanceManager(scene);
this.particleManager = new ParticleManager(cast this);
// var renderer = cast(this.scene.renderer, h3d.scene.pbr.Renderer);
// renderer.skyMode = Hide;
var renderer = cast(this.scene.renderer, h3d.scene.fwd.Renderer);
for (element in mission.root.elements) {
if (element._type != MissionElementType.Sun)
@ -975,7 +973,9 @@ class MarbleWorld extends Scheduler {
var egg:EndGameGui = null;
egg = new EndGameGui((sender) -> {
this.dispose();
MarbleGame.canvas.setContent(new PlayMissionGui());
var pmg = new PlayMissionGui();
PlayMissionGui.currentSelectionStatic = mission.index + 1;
MarbleGame.canvas.setContent(pmg);
}, (sender) -> {
MarbleGame.canvas.popDialog(egg);
this.setCursorLock(true);

View file

@ -97,7 +97,13 @@ class ResourceLoader {
if (textureCache.exists(path))
return textureCache.get(path);
if (fileSystem.exists(path)) {
var tex = loader.load(path).toTexture();
var img = loader.load(path).toImage();
Image.setupTextureFlags = (texObj) -> {
texObj.flags.set(MipMapped);
}
var tex = img.toTexture();
tex.mipMap = Nearest;
// tex.filter = Nearest;
textureCache.set(path, tex);
return tex;

View file

@ -64,11 +64,10 @@ class Collision {
normal: null
};
var pnorm = v1.sub(v0).cross(v2.sub(v0)).normalized();
var d = -v0.dot(normal);
var pnorm = normal.clone();
var d = -v0.dot(pnorm);
var p = PlaneF.PointNormal(new Point3F(v0.x, v0.y, v0.z), new Point3F(normal.x, normal.y, normal.z));
var pdist = p.distance(new Point3F(center.x, center.y, center.z));
var pdist = center.dot(pnorm) + d;
if (pdist < 0.001) {
return res; // Dont collide internal edges

View file

@ -130,17 +130,13 @@ class CollisionEntity implements IOctreeObject {
var closest = res.point;
// var closest = Collision.ClosestPtPointTriangle(position, radius, v0, v, v2, surfacenormal);
if (closest != null) {
if (position.sub(closest).lengthSq() <= radius * radius) {
var contactDist = closest.distanceSq(position);
if (contactDist <= radius * radius) {
var normal = res.normal;
if (position.sub(closest).dot(surfacenormal) > 0) {
normal.normalize();
var supportVec = surface.support(normal, tform);
if (!(supportVec.equals(v0) || supportVec.equals(v) || supportVec.equals(v2))) {
// normal = surfacenormal;
}
// We find the normal that is closest to the surface normal, sort of fixes weird edge cases of when colliding with
var testDot = normal.dot(surfacenormal);
if (testDot > bestDot) {
@ -151,7 +147,7 @@ class CollisionEntity implements IOctreeObject {
cinfo.point = closest;
// cinfo.collider = this;
cinfo.velocity = this.velocity.clone();
cinfo.contactDistance = closest.distance(position);
cinfo.contactDistance = Math.sqrt(contactDist);
cinfo.otherObject = this.go;
// cinfo.penetration = radius - (position.sub(closest).dot(normal));
cinfo.restitution = surface.restitution;

View file

@ -1,5 +1,6 @@
package gui;
import gui.GuiControl.MouseState;
import src.AudioManager;
import hxd.Key;
import src.Settings;
@ -12,6 +13,8 @@ import src.ResourceLoader;
import src.Util;
class OptionsDlg extends GuiImage {
var musicSliderFunc:(dt:Float, mouseState:MouseState) -> Void;
public function new() {
super(ResourceLoader.getImage("data/ui/background.jpg").toTile());
this.horizSizing = Width;
@ -297,6 +300,21 @@ class OptionsDlg extends GuiImage {
}
audioPane.addChild(audSndKnob);
musicSliderFunc = (dt:Float, mouseState:MouseState) -> {
if (mouseState.button == Key.MOUSE_LEFT) {
var musRect = audMusKnob.getRenderRectangle();
if (musRect.inRect(mouseState.position)) {
Settings.optionsSettings.musicVolume = audMusKnob.sliderValue;
AudioManager.updateVolumes();
}
var sndRect = audSndKnob.getRenderRectangle();
if (sndRect.inRect(mouseState.position)) {
Settings.optionsSettings.soundVolume = audSndKnob.sliderValue;
AudioManager.updateVolumes();
}
}
}
var audTxtWndo = new GuiImage(ResourceLoader.getImage("data/ui/options/aud_txt_wndo.png").toTile());
audTxtWndo.position = new Vector(26, 130);
audTxtWndo.extent = new Vector(396, 132);
@ -662,4 +680,10 @@ Extensions: EAX 2.0, EAX 3.0, EAX Unified, and EAX-AC3";
this.render(MarbleGame.canvas.scene2d);
}
}
public override function update(dt:Float, mouseState:MouseState) {
super.update(dt, mouseState);
if (musicSliderFunc != null)
musicSliderFunc(dt, mouseState);
}
}

View file

@ -21,17 +21,30 @@ import h3d.Vector;
import src.Util;
class PlayMissionGui extends GuiImage {
static var currentSelectionStatic:Int = -1;
static var currentCategoryStatic:String = "beginner";
var currentSelection:Int = 0;
var currentCategory:String = "beginner";
var currentList:Array<Mission>;
var setSelectedFunc:Int->Void;
var setCategoryFunc:(String, ?Bool) -> Void;
var buttonHoldFunc:(dt:Float, mouseState:MouseState) -> Void;
var buttonCooldown:Float = 0.5;
var maxButtonCooldown:Float = 0.5;
public function new() {
MissionList.buildMissionList();
if (currentSelectionStatic == -1)
currentSelectionStatic = cast Math.min(MissionList.beginnerMissions.length - 1,
Settings.progression[["beginner", "intermediate", "advanced"].indexOf(currentCategory)]);
currentSelection = PlayMissionGui.currentSelectionStatic;
currentCategory = PlayMissionGui.currentCategoryStatic;
super(ResourceLoader.getImage("data/ui/background.jpg").toTile());
this.horizSizing = Width;
@ -39,8 +52,6 @@ class PlayMissionGui extends GuiImage {
this.extent = new Vector(640, 480);
this.position = new Vector(0, 0);
MissionList.buildMissionList();
var localContainer = new GuiControl();
localContainer.horizSizing = Center;
localContainer.vertSizing = Center;
@ -56,15 +67,12 @@ class PlayMissionGui extends GuiImage {
return [normal, hover, pressed, disabled];
}
var setCategoryFunc:String->Void = null;
var tabAdvanced = new GuiImage(ResourceLoader.getImage("data/ui/play/tab_adv.png").toTile());
tabAdvanced.position = new Vector(410, 21);
tabAdvanced.extent = new Vector(166, 43);
tabAdvanced.pressedAction = (sender) -> {
currentList = MissionList.advancedMissions;
currentCategory = "advanced";
setSelectedFunc(cast Math.min(Settings.progression[2], currentList.length - 1));
setCategoryFunc("advanced");
}
localContainer.addChild(tabAdvanced);
@ -75,7 +83,6 @@ class PlayMissionGui extends GuiImage {
tabIntermediate.pressedAction = (sender) -> {
currentList = MissionList.intermediateMissions;
currentCategory = "intermediate";
setSelectedFunc(cast Math.min(Settings.progression[1], currentList.length - 1));
setCategoryFunc("intermediate");
}
localContainer.addChild(tabIntermediate);
@ -86,7 +93,6 @@ class PlayMissionGui extends GuiImage {
tabCustom.pressedAction = (sender) -> {
currentList = MissionList.customMissions;
currentCategory = "custom";
setSelectedFunc(currentList.length - 1);
setCategoryFunc("custom");
}
localContainer.addChild(tabCustom);
@ -165,6 +171,8 @@ class PlayMissionGui extends GuiImage {
// Wacky hacks
currentList[currentSelection].index = currentSelection;
currentList[currentSelection].difficultyIndex = ["beginner", "intermediate", "advanced"].indexOf(currentCategory);
currentSelectionStatic = currentSelection;
currentCategoryStatic = currentCategory;
cast(this.parent, Canvas).marbleGame.playMission(currentList[currentSelection]);
}
pmBox.addChild(pmPlay);
@ -296,19 +304,21 @@ class PlayMissionGui extends GuiImage {
currentList = MissionList.beginnerMissions;
setCategoryFunc = function(category:String) {
setCategoryFunc = function(category:String, ?doRender:Bool = true) {
localContainer.removeChild(tabBeginner);
localContainer.removeChild(tabIntermediate);
localContainer.removeChild(tabAdvanced);
localContainer.removeChild(tabCustom);
localContainer.removeChild(pmBox);
AudioManager.playSound(ResourceLoader.getAudio("data/sound/buttonpress.wav"));
if (doRender)
AudioManager.playSound(ResourceLoader.getAudio("data/sound/buttonpress.wav"));
if (category == "beginner") {
localContainer.addChild(tabIntermediate);
localContainer.addChild(tabAdvanced);
localContainer.addChild(tabCustom);
localContainer.addChild(pmBox);
localContainer.addChild(tabBeginner);
currentList = MissionList.beginnerMissions;
}
if (category == "intermediate") {
localContainer.addChild(tabBeginner);
@ -316,6 +326,7 @@ class PlayMissionGui extends GuiImage {
localContainer.addChild(tabCustom);
localContainer.addChild(pmBox);
localContainer.addChild(tabIntermediate);
currentList = MissionList.intermediateMissions;
}
if (category == "advanced") {
localContainer.addChild(tabBeginner);
@ -323,6 +334,7 @@ class PlayMissionGui extends GuiImage {
localContainer.addChild(tabCustom);
localContainer.addChild(pmBox);
localContainer.addChild(tabAdvanced);
currentList = MissionList.advancedMissions;
}
if (category == "custom") {
localContainer.addChild(tabBeginner);
@ -330,8 +342,16 @@ class PlayMissionGui extends GuiImage {
localContainer.addChild(tabAdvanced);
localContainer.addChild(pmBox);
localContainer.addChild(tabCustom);
currentList = MissionList.customMissions;
}
this.render(cast(this.parent, Canvas).scene2d);
currentCategoryStatic = currentCategory;
if (currentCategory != "custom")
setSelectedFunc(cast Math.min(currentList.length - 1,
Settings.progression[["beginner", "intermediate", "advanced"].indexOf(currentCategory)]));
else
setSelectedFunc(currentList.length - 1);
if (doRender)
this.render(cast(this.parent, Canvas).scene2d);
}
function splitTextWithPadding(textElement:Text, textStr:String) {
@ -371,6 +391,7 @@ class PlayMissionGui extends GuiImage {
}
currentSelection = index;
currentSelectionStatic = currentSelection;
var currentMission = currentList[currentSelection];
@ -447,15 +468,13 @@ class PlayMissionGui extends GuiImage {
levelBkgnd.text.text = currentCategory.charAt(0).toUpperCase() + currentCategory.substr(1) + ' Level ${currentSelection + 1}';
levelFgnd.text.text = currentCategory.charAt(0).toUpperCase() + currentCategory.substr(1) + ' Level ${currentSelection + 1}';
}
setCategoryFunc(currentCategoryStatic, false);
}
public override function render(scene2d:Scene) {
super.render(scene2d);
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(currentSelectionStatic);
}
public override function update(dt:Float, mouseState:MouseState) {