mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
Small Fixes
This commit is contained in:
parent
0f4ccde6dc
commit
7b7d07707c
15 changed files with 123 additions and 66 deletions
|
|
@ -1,8 +1,6 @@
|
|||
-cp src
|
||||
-lib headbutt
|
||||
-lib heaps
|
||||
-lib hlsdl
|
||||
-lib polygonal-ds
|
||||
-hl native/marblegame.c
|
||||
--main Main
|
||||
-debug
|
||||
|
|
@ -101,12 +101,12 @@ class CameraController extends Object {
|
|||
function orbit(mouseX:Float, mouseY:Float) {
|
||||
var window = Window.getInstance();
|
||||
var deltaposX = (window.width / 2) - mouseX;
|
||||
var deltaposY = (window.height / 2) - mouseY;
|
||||
var deltaposY = (window.height / 2) - mouseY * (Settings.controlsSettings.invertYAxis ? -1 : 1);
|
||||
if (!Settings.controlsSettings.alwaysFreeLook && !Key.isDown(Settings.controlsSettings.freelook)) {
|
||||
deltaposY = 0;
|
||||
}
|
||||
var rotX = deltaposX * 0.001 * CameraSensitivity * Math.PI * 2;
|
||||
var rotY = deltaposY * 0.001 * CameraSensitivity * Math.PI * 2;
|
||||
var rotX = deltaposX * 0.001 * Settings.controlsSettings.cameraSensitivity * Math.PI * 2;
|
||||
var rotY = deltaposY * 0.001 * Settings.controlsSettings.cameraSensitivity * Math.PI * 2;
|
||||
CameraYaw -= rotX;
|
||||
CameraPitch += rotY;
|
||||
// CameraYaw = Math.PI / 2;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package src;
|
||||
|
||||
import src.Settings;
|
||||
import gui.LoadingGui;
|
||||
import gui.PlayMissionGui;
|
||||
import src.MarbleGame;
|
||||
|
|
@ -397,29 +398,29 @@ class MarbleWorld extends Scheduler {
|
|||
shape = new Gem(cast element);
|
||||
this.totalGems++;
|
||||
} else if (dataBlockLowerCase == "superjumpitem")
|
||||
shape = new SuperJump();
|
||||
shape = new SuperJump(cast element);
|
||||
else if (StringTools.startsWith(dataBlockLowerCase, "signcaution"))
|
||||
shape = new SignCaution(element);
|
||||
else if (dataBlockLowerCase == "superbounceitem")
|
||||
shape = new SuperBounce();
|
||||
shape = new SuperBounce(cast element);
|
||||
else if (dataBlockLowerCase == "roundbumper")
|
||||
shape = new RoundBumper();
|
||||
else if (dataBlockLowerCase == "trianglebumper")
|
||||
shape = new TriangleBumper();
|
||||
else if (dataBlockLowerCase == "helicopteritem")
|
||||
shape = new Helicopter();
|
||||
shape = new Helicopter(cast element);
|
||||
else if (dataBlockLowerCase == "ductfan")
|
||||
shape = new DuctFan();
|
||||
else if (dataBlockLowerCase == "smallductfan")
|
||||
shape = new SmallDuctFan();
|
||||
else if (dataBlockLowerCase == "antigravityitem")
|
||||
shape = new AntiGravity();
|
||||
shape = new AntiGravity(cast element);
|
||||
else if (dataBlockLowerCase == "landmine")
|
||||
shape = new LandMine();
|
||||
else if (dataBlockLowerCase == "shockabsorberitem")
|
||||
shape = new ShockAbsorber();
|
||||
shape = new ShockAbsorber(cast element);
|
||||
else if (dataBlockLowerCase == "superspeeditem")
|
||||
shape = new SuperSpeed();
|
||||
shape = new SuperSpeed(cast element);
|
||||
else if (dataBlockLowerCase == "timetravelitem")
|
||||
shape = new TimeTravel(cast element);
|
||||
else if (dataBlockLowerCase == "tornado")
|
||||
|
|
@ -475,27 +476,27 @@ class MarbleWorld extends Scheduler {
|
|||
shape = new Gem(cast element);
|
||||
this.totalGems++;
|
||||
} else if (dataBlockLowerCase == "superjumpitem")
|
||||
shape = new SuperJump();
|
||||
shape = new SuperJump(cast element);
|
||||
else if (dataBlockLowerCase == "superbounceitem")
|
||||
shape = new SuperBounce();
|
||||
shape = new SuperBounce(cast element);
|
||||
else if (dataBlockLowerCase == "roundbumper")
|
||||
shape = new RoundBumper();
|
||||
else if (dataBlockLowerCase == "trianglebumper")
|
||||
shape = new TriangleBumper();
|
||||
else if (dataBlockLowerCase == "helicopteritem")
|
||||
shape = new Helicopter();
|
||||
shape = new Helicopter(cast element);
|
||||
else if (dataBlockLowerCase == "ductfan")
|
||||
shape = new DuctFan();
|
||||
else if (dataBlockLowerCase == "smallductfan")
|
||||
shape = new SmallDuctFan();
|
||||
else if (dataBlockLowerCase == "antigravityitem")
|
||||
shape = new AntiGravity();
|
||||
shape = new AntiGravity(cast element);
|
||||
else if (dataBlockLowerCase == "landmine")
|
||||
shape = new LandMine();
|
||||
else if (dataBlockLowerCase == "shockabsorberitem")
|
||||
shape = new ShockAbsorber();
|
||||
shape = new ShockAbsorber(cast element);
|
||||
else if (dataBlockLowerCase == "superspeeditem")
|
||||
shape = new SuperSpeed();
|
||||
shape = new SuperSpeed(cast element);
|
||||
else if (dataBlockLowerCase == "timetravelitem")
|
||||
shape = new TimeTravel(cast element);
|
||||
else if (dataBlockLowerCase == "tornado")
|
||||
|
|
@ -665,6 +666,45 @@ class MarbleWorld extends Scheduler {
|
|||
}
|
||||
|
||||
public function displayHelp(text:String) {
|
||||
var start = 0;
|
||||
var pos = text.indexOf("<func:", start);
|
||||
while (pos != -1) {
|
||||
var end = text.indexOf(">", start + 5);
|
||||
if (end == -1)
|
||||
break;
|
||||
var pre = text.substr(0, pos);
|
||||
var post = text.substr(end + 1);
|
||||
var func = text.substr(pos + 6, end - (pos + 6));
|
||||
var funcdata = func.split(' ');
|
||||
var val = "";
|
||||
if (funcdata[0] == "bind") {
|
||||
if (funcdata[1] == "moveforward")
|
||||
val = Key.getKeyName(Settings.controlsSettings.forward);
|
||||
if (funcdata[1] == "movebackward")
|
||||
val = Key.getKeyName(Settings.controlsSettings.backward);
|
||||
if (funcdata[1] == "moveleft")
|
||||
val = Key.getKeyName(Settings.controlsSettings.left);
|
||||
if (funcdata[1] == "moveright")
|
||||
val = Key.getKeyName(Settings.controlsSettings.right);
|
||||
if (funcdata[1] == "panup")
|
||||
val = Key.getKeyName(Settings.controlsSettings.camForward);
|
||||
if (funcdata[1] == "pandown")
|
||||
val = Key.getKeyName(Settings.controlsSettings.camBackward);
|
||||
if (funcdata[1] == "panleft")
|
||||
val = Key.getKeyName(Settings.controlsSettings.camLeft);
|
||||
if (funcdata[1] == "panright")
|
||||
val = Key.getKeyName(Settings.controlsSettings.camRight);
|
||||
if (funcdata[1] == "jump")
|
||||
val = Key.getKeyName(Settings.controlsSettings.jump);
|
||||
if (funcdata[1] == "mousefire")
|
||||
val = Key.getKeyName(Settings.controlsSettings.powerup);
|
||||
if (funcdata[1] == "freelook")
|
||||
val = Key.getKeyName(Settings.controlsSettings.freelook);
|
||||
}
|
||||
start = val.length + pos;
|
||||
text = pre + val + post;
|
||||
pos = text.indexOf("<func:", start);
|
||||
}
|
||||
this.playGui.setHelpText(text);
|
||||
this.helpTextTimeState = this.timeState.currentAttemptTime;
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@ typedef ControlsSettings = {
|
|||
var powerup:Int;
|
||||
var freelook:Int;
|
||||
var alwaysFreeLook:Bool;
|
||||
var cameraSensitivity:Float;
|
||||
var invertYAxis:Bool;
|
||||
}
|
||||
|
||||
class Settings {
|
||||
|
|
@ -65,7 +67,9 @@ class Settings {
|
|||
jump: Key.SPACE,
|
||||
powerup: Key.MOUSE_LEFT,
|
||||
freelook: Key.MOUSE_RIGHT,
|
||||
alwaysFreeLook: true
|
||||
alwaysFreeLook: true,
|
||||
cameraSensitivity: 0.6,
|
||||
invertYAxis: false
|
||||
};
|
||||
|
||||
public static function applySettings() {
|
||||
|
|
@ -73,6 +77,7 @@ class Settings {
|
|||
Window.getInstance().displayMode = optionsSettings.isFullScreen ? FullscreenResize : Windowed;
|
||||
|
||||
MarbleGame.canvas.render(MarbleGame.canvas.scene2d);
|
||||
save();
|
||||
}
|
||||
|
||||
public static function saveScore(mapPath:String, score:Score) {
|
||||
|
|
@ -96,7 +101,9 @@ class Settings {
|
|||
|
||||
public static function save() {
|
||||
var outputData = {
|
||||
highScores: highScores
|
||||
highScores: highScores,
|
||||
options: optionsSettings,
|
||||
controls: controlsSettings
|
||||
};
|
||||
var json = Json.stringify(outputData);
|
||||
File.saveContent("settings.json", json);
|
||||
|
|
@ -109,6 +116,8 @@ class Settings {
|
|||
for (key => value in highScoreData) {
|
||||
highScores.set(key, value);
|
||||
}
|
||||
optionsSettings = json.options;
|
||||
controlsSettings = json.controls;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -55,16 +55,31 @@ class Collision {
|
|||
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));
|
||||
|
||||
if (Math.abs(pdist) < 0.001) {
|
||||
if (pdist < 0.001) {
|
||||
return res; // Dont collide internal edges
|
||||
}
|
||||
|
||||
function toDifPoint(pt:Vector) {
|
||||
return new Point3F(pt.x, pt.y, pt.z);
|
||||
// Check edges
|
||||
var r1 = IntersectLineSphere(v0, v1, center, radius);
|
||||
if (r1 != null) {
|
||||
res.result = true;
|
||||
res.point = r1;
|
||||
res.normal = center.sub(r1).normalized();
|
||||
return res;
|
||||
}
|
||||
|
||||
function fromDifPoint(pt:Point3F) {
|
||||
return new Vector(pt.x, pt.y, pt.z);
|
||||
var r2 = IntersectLineSphere(v1, v2, center, radius);
|
||||
if (r2 != null) {
|
||||
res.result = true;
|
||||
res.point = r2;
|
||||
res.normal = center.sub(r2).normalized();
|
||||
return res;
|
||||
}
|
||||
var r3 = IntersectLineSphere(v2, v0, center, radius);
|
||||
if (r3 != null) {
|
||||
res.result = true;
|
||||
res.point = r3;
|
||||
res.normal = center.sub(r3).normalized();
|
||||
return res;
|
||||
}
|
||||
|
||||
if (pdist < radius) {
|
||||
|
|
@ -105,29 +120,6 @@ class Collision {
|
|||
// return res;
|
||||
// }
|
||||
|
||||
// Check edges
|
||||
var r1 = IntersectLineSphere(v0, v1, center, radius);
|
||||
if (r1 != null) {
|
||||
res.result = true;
|
||||
res.point = r1;
|
||||
res.normal = center.sub(r1).normalized();
|
||||
return res;
|
||||
}
|
||||
var r2 = IntersectLineSphere(v1, v2, center, radius);
|
||||
if (r2 != null) {
|
||||
res.result = true;
|
||||
res.point = r2;
|
||||
res.normal = center.sub(r2).normalized();
|
||||
return res;
|
||||
}
|
||||
var r3 = IntersectLineSphere(v2, v0, center, radius);
|
||||
if (r3 != null) {
|
||||
res.result = true;
|
||||
res.point = r3;
|
||||
res.normal = center.sub(r3).normalized();
|
||||
return res;
|
||||
}
|
||||
|
||||
// Check plane
|
||||
// var p = PlaneF.ThreePoints(toDifPoint(v0), toDifPoint(v1), toDifPoint(v2));
|
||||
return res;
|
||||
|
|
|
|||
|
|
@ -73,11 +73,13 @@ class OptionsDlg extends GuiImage {
|
|||
graphicsPane.extent = new Vector(438, 298);
|
||||
|
||||
mainPane.addChild(graphicsPane);
|
||||
var applyFunc:Void->Void = null;
|
||||
|
||||
var mainMenuButton = new GuiButton(loadButtonImages("data/ui/options/mainm"));
|
||||
mainMenuButton.position = new Vector(330, 356);
|
||||
mainMenuButton.extent = new Vector(121, 53);
|
||||
mainMenuButton.pressedAction = (sender) -> {
|
||||
applyFunc();
|
||||
MarbleGame.canvas.setContent(new MainMenuGui());
|
||||
}
|
||||
mainPane.addChild(mainMenuButton);
|
||||
|
|
@ -205,8 +207,6 @@ class OptionsDlg extends GuiImage {
|
|||
}
|
||||
graphicsPane.addChild(gfxd3d);
|
||||
|
||||
var applyFunc:Void->Void = null;
|
||||
|
||||
var applyButton = new GuiButton(loadButtonImages("data/ui/options/grafapply"));
|
||||
applyButton.position = new Vector(188, 239);
|
||||
applyButton.extent = new Vector(106, 60);
|
||||
|
|
@ -577,6 +577,10 @@ Extensions: EAX 2.0, EAX 3.0, EAX Unified, and EAX-AC3";
|
|||
invertAxis.position = new Vector(95, 249);
|
||||
invertAxis.extent = new Vector(43, 53);
|
||||
invertAxis.buttonType = Toggle;
|
||||
invertAxis.pressed = Settings.controlsSettings.invertYAxis;
|
||||
invertAxis.pressedAction = (sender) -> {
|
||||
Settings.controlsSettings.invertYAxis = !Settings.controlsSettings.invertYAxis;
|
||||
}
|
||||
mouseControlsPane.addChild(invertAxis);
|
||||
|
||||
var alwaysFreelook = new GuiButton(loadButtonImages("data/ui/options/cntrl_mous_freel"));
|
||||
|
|
@ -592,6 +596,10 @@ Extensions: EAX 2.0, EAX 3.0, EAX Unified, and EAX-AC3";
|
|||
var mouseSensitivity = new GuiSlider(ResourceLoader.getImage("data/ui/options/cntrl_mous_knb.png").toTile());
|
||||
mouseSensitivity.position = new Vector(147, 148);
|
||||
mouseSensitivity.extent = new Vector(254, 34);
|
||||
mouseSensitivity.sliderValue = (Settings.controlsSettings.cameraSensitivity - 0.2) / (3 - 0.2);
|
||||
mouseSensitivity.pressedAction = (sender) -> {
|
||||
Settings.controlsSettings.cameraSensitivity = 0.2 + (3 - 0.2) * mouseSensitivity.sliderValue;
|
||||
}
|
||||
mouseControlsPane.addChild(mouseSensitivity);
|
||||
|
||||
// INVISIBLE BUTTON SHIT
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
package shapes;
|
||||
|
||||
import mis.MissionElement.MissionElementItem;
|
||||
import src.TimeState;
|
||||
import h3d.Vector;
|
||||
import src.DtsObject;
|
||||
|
||||
class AntiGravity extends PowerUp {
|
||||
public function new() {
|
||||
super();
|
||||
public function new(element:MissionElementItem) {
|
||||
super(element);
|
||||
this.dtsPath = "data/shapes/items/antigravity.dts";
|
||||
this.isCollideable = false;
|
||||
this.isTSStatic = false;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
package shapes;
|
||||
|
||||
import mis.MissionElement.MissionElementItem;
|
||||
import src.TimeState;
|
||||
import src.DtsObject;
|
||||
|
||||
class Helicopter extends PowerUp {
|
||||
public function new() {
|
||||
super();
|
||||
public function new(element:MissionElementItem) {
|
||||
super(element);
|
||||
this.dtsPath = "data/shapes/images/helicopter.dts";
|
||||
this.isCollideable = false;
|
||||
this.isTSStatic = false;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package shapes;
|
||||
|
||||
import mis.MissionElement.MissionElementItem;
|
||||
import src.TimeState;
|
||||
import src.Util;
|
||||
import h3d.Vector;
|
||||
|
|
@ -29,11 +30,13 @@ abstract class PowerUp extends DtsObject {
|
|||
public var autoUse:Bool = false;
|
||||
public var powerupParams:PowerupParams = new PowerupParams();
|
||||
public var pickUpName:String;
|
||||
public var element:MissionElementItem;
|
||||
|
||||
public function new() {
|
||||
public function new(element:MissionElementItem) {
|
||||
super();
|
||||
this.isCollideable = false;
|
||||
this.ambientRotate = true;
|
||||
this.element = element;
|
||||
}
|
||||
|
||||
public override function onMarbleInside(timeState:TimeState) {
|
||||
|
|
@ -49,7 +52,8 @@ abstract class PowerUp extends DtsObject {
|
|||
this.use(timeState);
|
||||
|
||||
this.level.displayAlert('You picked up a ${this.pickUpName}!');
|
||||
// if (this.element.showhelponpickup === "1" && !this.autoUse) displayHelp(`Press <func:bind mousefire> to use the ${this.pickUpName}!`);
|
||||
if (this.element.showhelponpickup == "1" && !this.autoUse)
|
||||
this.level.displayHelp('Press <func:bind mousefire> to use the ${this.pickUpName}!');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
package shapes;
|
||||
|
||||
import mis.MissionElement.MissionElementItem;
|
||||
import src.TimeState;
|
||||
import src.DtsObject;
|
||||
|
||||
class ShockAbsorber extends PowerUp {
|
||||
public function new() {
|
||||
super();
|
||||
public function new(element:MissionElementItem) {
|
||||
super(element);
|
||||
this.dtsPath = "data/shapes/items/shockabsorber.dts";
|
||||
this.isCollideable = false;
|
||||
this.isTSStatic = false;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
package shapes;
|
||||
|
||||
import mis.MissionElement.MissionElementItem;
|
||||
import src.TimeState;
|
||||
import src.DtsObject;
|
||||
|
||||
class SuperBounce extends PowerUp {
|
||||
public function new() {
|
||||
super();
|
||||
public function new(element:MissionElementItem) {
|
||||
super(element);
|
||||
this.dtsPath = "data/shapes/items/superbounce.dts";
|
||||
this.isCollideable = false;
|
||||
this.isTSStatic = false;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package shapes;
|
||||
|
||||
import mis.MissionElement.MissionElementItem;
|
||||
import src.TimeState;
|
||||
import src.ResourceLoader;
|
||||
import src.ParticleSystem.ParticleData;
|
||||
|
|
@ -32,8 +33,8 @@ final superJumpParticleOptions:src.ParticleSystem.ParticleEmitterOptions = {
|
|||
class SuperJump extends PowerUp {
|
||||
var sjEmitterParticleData:ParticleData;
|
||||
|
||||
public function new() {
|
||||
super();
|
||||
public function new(element:MissionElementItem) {
|
||||
super(element);
|
||||
this.dtsPath = "data/shapes/items/superjump.dts";
|
||||
this.isCollideable = false;
|
||||
this.isTSStatic = false;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package shapes;
|
||||
|
||||
import mis.MissionElement.MissionElementItem;
|
||||
import src.TimeState;
|
||||
import src.ResourceLoader;
|
||||
import src.ParticleSystem.ParticleData;
|
||||
|
|
@ -38,8 +39,8 @@ final superSpeedParticleOptions:ParticleEmitterOptions = {
|
|||
class SuperSpeed extends PowerUp {
|
||||
var ssEmitterParticleData:ParticleData;
|
||||
|
||||
public function new() {
|
||||
super();
|
||||
public function new(element:MissionElementItem) {
|
||||
super(element);
|
||||
this.dtsPath = "data/shapes/items/superspeed.dts";
|
||||
this.isCollideable = false;
|
||||
this.isTSStatic = false;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ class TimeTravel extends PowerUp {
|
|||
var timeBonus:Float = 5;
|
||||
|
||||
public function new(element:MissionElementItem) {
|
||||
super();
|
||||
super(element);
|
||||
this.dtsPath = "data/shapes/items/timetravel.dts";
|
||||
this.isCollideable = false;
|
||||
this.isTSStatic = false;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import src.ForceObject;
|
|||
|
||||
class Trapdoor extends DtsObject {
|
||||
var lastContactTime = -1e8;
|
||||
var timeout:Float = 0;
|
||||
var timeout:Float = 0.2;
|
||||
var lastDirection:Float;
|
||||
var lastCompletion:Float = 0;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue