mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-12-24 00:42:46 +00:00
fix collision stuff with stretched interiors, fix keyname discrepancies, add oobclick respawn, fix CCD timesteps being too small
This commit is contained in:
parent
0174909310
commit
99a52d3d05
9 changed files with 86 additions and 47 deletions
BIN
marblegame.hl
BIN
marblegame.hl
Binary file not shown.
|
|
@ -386,8 +386,7 @@ class DtsObject extends GameObject {
|
|||
}
|
||||
if (flags & 4 > 0) {
|
||||
material.blendMode = BlendMode.Alpha;
|
||||
// mmaterial.mainPass.depthWrite = false;
|
||||
material.mainPass.culling = h3d.mat.Data.Face.Front;
|
||||
material.mainPass.culling = h3d.mat.Data.Face.None;
|
||||
}
|
||||
// // TODO TRANSPARENCY SHIT
|
||||
if (flags & 8 > 0) {
|
||||
|
|
@ -763,6 +762,8 @@ class DtsObject extends GameObject {
|
|||
meshIndex++;
|
||||
if (prim.buffer != null) {
|
||||
prim.addNormals();
|
||||
for (norm in prim.normals)
|
||||
norm = norm.multiply(-1);
|
||||
prim.flush();
|
||||
}
|
||||
mesh.primitive = prim;
|
||||
|
|
@ -783,6 +784,8 @@ class DtsObject extends GameObject {
|
|||
}
|
||||
if (prim.buffer != null) {
|
||||
prim.addNormals();
|
||||
for (norm in prim.normals)
|
||||
norm = norm.multiply(-1);
|
||||
prim.flush();
|
||||
}
|
||||
if (_regenNormals) {
|
||||
|
|
|
|||
|
|
@ -821,7 +821,7 @@ class Marble extends GameObject {
|
|||
|
||||
var intersectT = this.getIntersectionTime(timeStep, velocity);
|
||||
|
||||
if (intersectT < timeStep && intersectT > 0.000001) {
|
||||
if (intersectT < timeStep && intersectT >= 0.001) {
|
||||
// intersectT *= 0.8; // We uh tick the shit to not actually at the contact time cause bruh
|
||||
// intersectT /= 2;
|
||||
var diff = timeStep - intersectT;
|
||||
|
|
@ -885,7 +885,7 @@ class Marble extends GameObject {
|
|||
}
|
||||
|
||||
if (mode == Finish) {
|
||||
this.velocity = this.velocity.multiply(0.7);
|
||||
this.velocity = this.velocity.multiply(0.925);
|
||||
}
|
||||
|
||||
var newPos = pos.add(this.velocity.multiply(timeStep));
|
||||
|
|
|
|||
|
|
@ -222,9 +222,12 @@ class MarbleWorld extends Scheduler {
|
|||
this.timeState.gameplayClock = 0;
|
||||
this.bonusTime = 0;
|
||||
this.outOfBounds = false;
|
||||
this.outOfBoundsTime = null;
|
||||
this.finishTime = null;
|
||||
this.helpTextTimeState = Math.NEGATIVE_INFINITY;
|
||||
this.alertTextTimeState = Math.NEGATIVE_INFINITY;
|
||||
if (this.endPad != null)
|
||||
this.endPad.inFinish = false;
|
||||
if (this.totalGems > 0) {
|
||||
this.gemCount = 0;
|
||||
this.playGui.formatGemCounter(this.gemCount, this.totalGems);
|
||||
|
|
@ -650,6 +653,12 @@ class MarbleWorld extends Scheduler {
|
|||
this.playGui.update(timeState);
|
||||
AudioManager.update(this.scene);
|
||||
|
||||
if (this.outOfBounds && this.finishTime == null && Key.isPressed(Settings.controlsSettings.powerup)) {
|
||||
this.clearSchedule();
|
||||
this.restart();
|
||||
return;
|
||||
}
|
||||
|
||||
this.updateTexts();
|
||||
}
|
||||
|
||||
|
|
@ -715,27 +724,27 @@ class MarbleWorld extends Scheduler {
|
|||
var val = "";
|
||||
if (funcdata[0] == "bind") {
|
||||
if (funcdata[1] == "moveforward")
|
||||
val = Key.getKeyName(Settings.controlsSettings.forward);
|
||||
val = Util.getKeyForButton(Settings.controlsSettings.forward);
|
||||
if (funcdata[1] == "movebackward")
|
||||
val = Key.getKeyName(Settings.controlsSettings.backward);
|
||||
val = Util.getKeyForButton(Settings.controlsSettings.backward);
|
||||
if (funcdata[1] == "moveleft")
|
||||
val = Key.getKeyName(Settings.controlsSettings.left);
|
||||
val = Util.getKeyForButton(Settings.controlsSettings.left);
|
||||
if (funcdata[1] == "moveright")
|
||||
val = Key.getKeyName(Settings.controlsSettings.right);
|
||||
val = Util.getKeyForButton(Settings.controlsSettings.right);
|
||||
if (funcdata[1] == "panup")
|
||||
val = Key.getKeyName(Settings.controlsSettings.camForward);
|
||||
val = Util.getKeyForButton(Settings.controlsSettings.camForward);
|
||||
if (funcdata[1] == "pandown")
|
||||
val = Key.getKeyName(Settings.controlsSettings.camBackward);
|
||||
val = Util.getKeyForButton(Settings.controlsSettings.camBackward);
|
||||
if (funcdata[1] == "turnleft")
|
||||
val = Key.getKeyName(Settings.controlsSettings.camLeft);
|
||||
val = Util.getKeyForButton(Settings.controlsSettings.camLeft);
|
||||
if (funcdata[1] == "turnright")
|
||||
val = Key.getKeyName(Settings.controlsSettings.camRight);
|
||||
val = Util.getKeyForButton(Settings.controlsSettings.camRight);
|
||||
if (funcdata[1] == "jump")
|
||||
val = Key.getKeyName(Settings.controlsSettings.jump);
|
||||
val = Util.getKeyForButton(Settings.controlsSettings.jump);
|
||||
if (funcdata[1] == "mousefire")
|
||||
val = Key.getKeyName(Settings.controlsSettings.powerup);
|
||||
val = Util.getKeyForButton(Settings.controlsSettings.powerup);
|
||||
if (funcdata[1] == "freelook")
|
||||
val = Key.getKeyName(Settings.controlsSettings.freelook);
|
||||
val = Util.getKeyForButton(Settings.controlsSettings.freelook);
|
||||
}
|
||||
start = val.length + pos;
|
||||
text = pre + val + post;
|
||||
|
|
|
|||
27
src/Util.hx
27
src/Util.hx
|
|
@ -1,5 +1,6 @@
|
|||
package src;
|
||||
|
||||
import hxd.Key;
|
||||
import h2d.Tile;
|
||||
import h3d.mat.Texture;
|
||||
import hxd.BitmapData;
|
||||
|
|
@ -175,4 +176,30 @@ class Util {
|
|||
|
||||
return '${minutesTen}${minutesOne}:${secondsTen}${secondsOne}.${hundredthTen}${hundredthOne}${thousandth}';
|
||||
}
|
||||
|
||||
public static function getKeyForButton(button:Int) {
|
||||
var keyName = Key.getKeyName(button);
|
||||
if (keyName == "MouseLeft")
|
||||
keyName = "the Left Mouse Button";
|
||||
if (keyName == "MouseRight")
|
||||
keyName = "the Right Mouse Button";
|
||||
if (keyName == "MouseMiddle")
|
||||
keyName = "the Middle Mouse Button";
|
||||
if (keyName == "Space")
|
||||
keyName = "Space Bar";
|
||||
return keyName;
|
||||
}
|
||||
|
||||
public static function getKeyForButton2(button:Int) {
|
||||
var keyName = Key.getKeyName(button);
|
||||
if (keyName == "MouseLeft")
|
||||
keyName = "Left Mouse";
|
||||
if (keyName == "MouseRight")
|
||||
keyName = "Right Mouse";
|
||||
if (keyName == "MouseMiddle")
|
||||
keyName = "Middle Mouse";
|
||||
if (keyName == "Space")
|
||||
keyName = "Space Bar";
|
||||
return keyName;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,10 +92,9 @@ class CollisionEntity implements IOctreeObject {
|
|||
|
||||
var invMatrix = transform.clone();
|
||||
invMatrix.invert();
|
||||
var localpos = position.clone();
|
||||
localpos.transform(invMatrix);
|
||||
var sphereBounds = new Bounds();
|
||||
sphereBounds.addSpherePos(localpos.x, localpos.y, localpos.z, radius);
|
||||
sphereBounds.addSpherePos(position.x, position.y, position.z, radius * 1.1);
|
||||
sphereBounds.transform(invMatrix);
|
||||
var surfaces = octree.boundingSearch(sphereBounds);
|
||||
|
||||
var tform = transform.clone();
|
||||
|
|
@ -123,7 +122,7 @@ class CollisionEntity implements IOctreeObject {
|
|||
var v = surface.points[surface.indices[i + 1]].transformed(tform);
|
||||
var v2 = surface.points[surface.indices[i + 2]].transformed(tform);
|
||||
|
||||
var surfacenormal = surface.normals[surface.indices[i]].transformed3x3(transform);
|
||||
var surfacenormal = surface.normals[surface.indices[i]].transformed3x3(transform).normalized();
|
||||
|
||||
var res = Collision.IntersectTriangleSphere(v0, v, v2, surfacenormal, position, radius);
|
||||
var closest = res.point;
|
||||
|
|
|
|||
|
|
@ -400,27 +400,27 @@ class HelpCreditsGui extends GuiImage {
|
|||
var val = "";
|
||||
if (funcdata[0] == "bind") {
|
||||
if (funcdata[1] == "moveforward")
|
||||
val = Key.getKeyName(Settings.controlsSettings.forward);
|
||||
val = Util.getKeyForButton(Settings.controlsSettings.forward);
|
||||
if (funcdata[1] == "movebackward")
|
||||
val = Key.getKeyName(Settings.controlsSettings.backward);
|
||||
val = Util.getKeyForButton(Settings.controlsSettings.backward);
|
||||
if (funcdata[1] == "moveleft")
|
||||
val = Key.getKeyName(Settings.controlsSettings.left);
|
||||
val = Util.getKeyForButton(Settings.controlsSettings.left);
|
||||
if (funcdata[1] == "moveright")
|
||||
val = Key.getKeyName(Settings.controlsSettings.right);
|
||||
val = Util.getKeyForButton(Settings.controlsSettings.right);
|
||||
if (funcdata[1] == "panup")
|
||||
val = Key.getKeyName(Settings.controlsSettings.camForward);
|
||||
val = Util.getKeyForButton(Settings.controlsSettings.camForward);
|
||||
if (funcdata[1] == "pandown")
|
||||
val = Key.getKeyName(Settings.controlsSettings.camBackward);
|
||||
val = Util.getKeyForButton(Settings.controlsSettings.camBackward);
|
||||
if (funcdata[1] == "turnleft")
|
||||
val = Key.getKeyName(Settings.controlsSettings.camLeft);
|
||||
val = Util.getKeyForButton(Settings.controlsSettings.camLeft);
|
||||
if (funcdata[1] == "turnright")
|
||||
val = Key.getKeyName(Settings.controlsSettings.camRight);
|
||||
val = Util.getKeyForButton(Settings.controlsSettings.camRight);
|
||||
if (funcdata[1] == "jump")
|
||||
val = Key.getKeyName(Settings.controlsSettings.jump);
|
||||
val = Util.getKeyForButton(Settings.controlsSettings.jump);
|
||||
if (funcdata[1] == "mousefire")
|
||||
val = Key.getKeyName(Settings.controlsSettings.powerup);
|
||||
val = Util.getKeyForButton(Settings.controlsSettings.powerup);
|
||||
if (funcdata[1] == "freelook")
|
||||
val = Key.getKeyName(Settings.controlsSettings.freelook);
|
||||
val = Util.getKeyForButton(Settings.controlsSettings.freelook);
|
||||
}
|
||||
start = val.length + pos;
|
||||
text = pre + val + post;
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import hxd.res.BitmapFont;
|
|||
import src.MarbleGame;
|
||||
import h3d.Vector;
|
||||
import src.ResourceLoader;
|
||||
import src.Util;
|
||||
|
||||
class OptionsDlg extends GuiImage {
|
||||
public function new() {
|
||||
|
|
@ -392,14 +393,14 @@ Extensions: EAX 2.0, EAX 3.0, EAX Unified, and EAX-AC3";
|
|||
|
||||
var conflicting = getConflictingBinding(bindingName, key);
|
||||
if (conflicting == null) {
|
||||
ctrl.txtCtrl.text.text = Key.getKeyName(key);
|
||||
ctrl.txtCtrl.text.text = Util.getKeyForButton2(key);
|
||||
bindingFunc(key);
|
||||
} else {
|
||||
var yesNoDlg = new MessageBoxYesNoDlg('<p align="center">"${Key.getKeyName(key)}" is already bound to "${conflicting}"!<br/>Do you want to undo this mapping?</p>',
|
||||
var yesNoDlg = new MessageBoxYesNoDlg('<p align="center">"${Util.getKeyForButton2(key)}" is already bound to "${conflicting}"!<br/>Do you want to undo this mapping?</p>',
|
||||
() -> {
|
||||
ctrl.txtCtrl.text.text = Key.getKeyName(key);
|
||||
bindingFunc(key);
|
||||
}, () -> {});
|
||||
ctrl.txtCtrl.text.text = Util.getKeyForButton2(key);
|
||||
bindingFunc(key);
|
||||
}, () -> {});
|
||||
MarbleGame.canvas.pushDialog(yesNoDlg);
|
||||
}
|
||||
}
|
||||
|
|
@ -408,7 +409,7 @@ Extensions: EAX 2.0, EAX 3.0, EAX Unified, and EAX-AC3";
|
|||
var moveForward = new GuiButtonText(loadButtonImages("data/ui/options/cntr_mrb_fw"), arial14);
|
||||
moveForward.position = new Vector(82, 104);
|
||||
moveForward.setExtent(new Vector(117, 51));
|
||||
moveForward.txtCtrl.text.text = Key.getKeyName(Settings.controlsSettings.forward);
|
||||
moveForward.txtCtrl.text.text = Util.getKeyForButton2(Settings.controlsSettings.forward);
|
||||
moveForward.pressedAction = (sender) -> {
|
||||
remapFunc("Move Forward", (key) -> Settings.controlsSettings.forward = key, moveForward);
|
||||
}
|
||||
|
|
@ -417,7 +418,7 @@ Extensions: EAX 2.0, EAX 3.0, EAX Unified, and EAX-AC3";
|
|||
var moveRight = new GuiButtonText(loadButtonImages("data/ui/options/cntr_mrb_rt"), arial14);
|
||||
moveRight.position = new Vector(230, 167);
|
||||
moveRight.setExtent(new Vector(112, 45));
|
||||
moveRight.txtCtrl.text.text = Key.getKeyName(Settings.controlsSettings.right);
|
||||
moveRight.txtCtrl.text.text = Util.getKeyForButton2(Settings.controlsSettings.right);
|
||||
moveRight.pressedAction = (sender) -> {
|
||||
remapFunc("Move Right", (key) -> Settings.controlsSettings.right = key, moveRight);
|
||||
}
|
||||
|
|
@ -426,7 +427,7 @@ Extensions: EAX 2.0, EAX 3.0, EAX Unified, and EAX-AC3";
|
|||
var mouseFire = new GuiButtonText(loadButtonImages("data/ui/options/cntr_mrb_pwr"), arial14);
|
||||
mouseFire.position = new Vector(310, 84);
|
||||
mouseFire.setExtent(new Vector(120, 51));
|
||||
mouseFire.txtCtrl.text.text = Key.getKeyName(Settings.controlsSettings.powerup);
|
||||
mouseFire.txtCtrl.text.text = Util.getKeyForButton2(Settings.controlsSettings.powerup);
|
||||
mouseFire.pressedAction = (sender) -> {
|
||||
remapFunc("Use PowerUp", (key) -> Settings.controlsSettings.powerup = key, mouseFire);
|
||||
}
|
||||
|
|
@ -435,7 +436,7 @@ Extensions: EAX 2.0, EAX 3.0, EAX Unified, and EAX-AC3";
|
|||
var moveBackward = new GuiButtonText(loadButtonImages("data/ui/options/cntr_mrb_bak"), arial14);
|
||||
moveBackward.position = new Vector(135, 235);
|
||||
moveBackward.setExtent(new Vector(118, 48));
|
||||
moveBackward.txtCtrl.text.text = Key.getKeyName(Settings.controlsSettings.backward);
|
||||
moveBackward.txtCtrl.text.text = Util.getKeyForButton2(Settings.controlsSettings.backward);
|
||||
moveBackward.pressedAction = (sender) -> {
|
||||
remapFunc("Move Backward", (key) -> Settings.controlsSettings.backward = key, moveBackward);
|
||||
}
|
||||
|
|
@ -444,7 +445,7 @@ Extensions: EAX 2.0, EAX 3.0, EAX Unified, and EAX-AC3";
|
|||
var moveLeft = new GuiButtonText(loadButtonImages("data/ui/options/cntr_mrb_lft"), arial14);
|
||||
moveLeft.position = new Vector(19, 189);
|
||||
moveLeft.setExtent(new Vector(108, 45));
|
||||
moveLeft.txtCtrl.text.text = Key.getKeyName(Settings.controlsSettings.left);
|
||||
moveLeft.txtCtrl.text.text = Util.getKeyForButton2(Settings.controlsSettings.left);
|
||||
moveLeft.pressedAction = (sender) -> {
|
||||
remapFunc("Move Left", (key) -> Settings.controlsSettings.left = key, moveLeft);
|
||||
}
|
||||
|
|
@ -453,7 +454,7 @@ Extensions: EAX 2.0, EAX 3.0, EAX Unified, and EAX-AC3";
|
|||
var moveJmp = new GuiButtonText(loadButtonImages("data/ui/options/cntr_mrb_jmp"), arial14);
|
||||
moveJmp.position = new Vector(299, 231);
|
||||
moveJmp.setExtent(new Vector(120, 47));
|
||||
moveJmp.txtCtrl.text.text = Key.getKeyName(Settings.controlsSettings.jump);
|
||||
moveJmp.txtCtrl.text.text = Util.getKeyForButton2(Settings.controlsSettings.jump);
|
||||
moveJmp.pressedAction = (sender) -> {
|
||||
remapFunc("Jump", (key) -> Settings.controlsSettings.jump = key, moveJmp);
|
||||
}
|
||||
|
|
@ -491,7 +492,7 @@ Extensions: EAX 2.0, EAX 3.0, EAX Unified, and EAX-AC3";
|
|||
var panUp = new GuiButtonText(loadButtonImages("data/ui/options/cntr_cam_up"), arial14);
|
||||
panUp.position = new Vector(29, 133);
|
||||
panUp.setExtent(new Vector(108, 42));
|
||||
panUp.txtCtrl.text.text = Key.getKeyName(Settings.controlsSettings.camForward);
|
||||
panUp.txtCtrl.text.text = Util.getKeyForButton2(Settings.controlsSettings.camForward);
|
||||
panUp.pressedAction = (sender) -> {
|
||||
remapFunc("Rotate Camera Up", (key) -> Settings.controlsSettings.camForward = key, panUp);
|
||||
}
|
||||
|
|
@ -500,7 +501,7 @@ Extensions: EAX 2.0, EAX 3.0, EAX Unified, and EAX-AC3";
|
|||
var turnRight = new GuiButtonText(loadButtonImages("data/ui/options/cntr_cam_rt"), arial14);
|
||||
turnRight.position = new Vector(312, 99);
|
||||
turnRight.setExtent(new Vector(103, 36));
|
||||
turnRight.txtCtrl.text.text = Key.getKeyName(Settings.controlsSettings.camRight);
|
||||
turnRight.txtCtrl.text.text = Util.getKeyForButton2(Settings.controlsSettings.camRight);
|
||||
turnRight.pressedAction = (sender) -> {
|
||||
remapFunc("Rotate Camera Right", (key) -> Settings.controlsSettings.camRight = key, turnRight);
|
||||
}
|
||||
|
|
@ -509,7 +510,7 @@ Extensions: EAX 2.0, EAX 3.0, EAX Unified, and EAX-AC3";
|
|||
var panDown = new GuiButtonText(loadButtonImages("data/ui/options/cntr_cam_dwn"), arial14);
|
||||
panDown.position = new Vector(42, 213);
|
||||
panDown.setExtent(new Vector(109, 39));
|
||||
panDown.txtCtrl.text.text = Key.getKeyName(Settings.controlsSettings.camBackward);
|
||||
panDown.txtCtrl.text.text = Util.getKeyForButton2(Settings.controlsSettings.camBackward);
|
||||
panDown.pressedAction = (sender) -> {
|
||||
remapFunc("Rotate Camera Down", (key) -> Settings.controlsSettings.camBackward = key, panDown);
|
||||
}
|
||||
|
|
@ -518,7 +519,7 @@ Extensions: EAX 2.0, EAX 3.0, EAX Unified, and EAX-AC3";
|
|||
var turnLeft = new GuiButtonText(loadButtonImages("data/ui/options/cntr_cam_lft"), arial14);
|
||||
turnLeft.position = new Vector(319, 210);
|
||||
turnLeft.setExtent(new Vector(99, 36));
|
||||
turnLeft.txtCtrl.text.text = Key.getKeyName(Settings.controlsSettings.camLeft);
|
||||
turnLeft.txtCtrl.text.text = Util.getKeyForButton2(Settings.controlsSettings.camLeft);
|
||||
turnLeft.pressedAction = (sender) -> {
|
||||
remapFunc("Rotate Camera Left", (key) -> Settings.controlsSettings.camLeft = key, turnLeft);
|
||||
}
|
||||
|
|
@ -553,7 +554,7 @@ Extensions: EAX 2.0, EAX 3.0, EAX Unified, and EAX-AC3";
|
|||
var freelook = new GuiButtonText(loadButtonImages("data/ui/options/cntrl_mous_bttn"), arial14);
|
||||
freelook.position = new Vector(219, 225);
|
||||
freelook.setExtent(new Vector(105, 45));
|
||||
freelook.txtCtrl.text.text = Key.getKeyName(Settings.controlsSettings.freelook);
|
||||
freelook.txtCtrl.text.text = Util.getKeyForButton2(Settings.controlsSettings.freelook);
|
||||
freelook.pressedAction = (sender) -> {
|
||||
remapFunc("Free Look", (key) -> Settings.controlsSettings.freelook = key, freelook);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ class Tornado extends ForceObject {
|
|||
super.init(level);
|
||||
this.soundChannel = AudioManager.playSound(ResourceLoader.getAudio("data/sound/tornado.wav"), this.getAbsPos().getPosition(), true);
|
||||
for (material in this.materials) {
|
||||
// material.mainPass.setPassName("overlay");
|
||||
material.blendMode = Alpha;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue