diff --git a/data/sound/NukeExplode.wav b/data/sound/NukeExplode.wav deleted file mode 100644 index e40b61f8..00000000 Binary files a/data/sound/NukeExplode.wav and /dev/null differ diff --git a/data/sound/alarm.wav b/data/sound/alarm.wav deleted file mode 100644 index a7a0bd4d..00000000 Binary files a/data/sound/alarm.wav and /dev/null differ diff --git a/data/sound/alarm_timeout.wav b/data/sound/alarm_timeout.wav deleted file mode 100644 index b4de705d..00000000 Binary files a/data/sound/alarm_timeout.wav and /dev/null differ diff --git a/data/sound/blast.wav b/data/sound/blast.wav deleted file mode 100644 index 185dc4de..00000000 Binary files a/data/sound/blast.wav and /dev/null differ diff --git a/data/sound/bumper1.wav b/data/sound/bumper1.wav deleted file mode 100644 index e2fb2589..00000000 Binary files a/data/sound/bumper1.wav and /dev/null differ diff --git a/data/sound/dosuperjump.wav b/data/sound/dosuperjump.wav deleted file mode 100644 index f0b2d701..00000000 Binary files a/data/sound/dosuperjump.wav and /dev/null differ diff --git a/data/sound/dosuperspeed.wav b/data/sound/dosuperspeed.wav deleted file mode 100644 index 62aaa733..00000000 Binary files a/data/sound/dosuperspeed.wav and /dev/null differ diff --git a/data/sound/easter.wav b/data/sound/easter.wav deleted file mode 100644 index 3787651a..00000000 Binary files a/data/sound/easter.wav and /dev/null differ diff --git a/data/sound/easterfound.wav b/data/sound/easterfound.wav deleted file mode 100644 index a350484a..00000000 Binary files a/data/sound/easterfound.wav and /dev/null differ diff --git a/data/sound/explode1.wav b/data/sound/explode1.wav deleted file mode 100644 index b130d982..00000000 Binary files a/data/sound/explode1.wav and /dev/null differ diff --git a/data/sound/firewrks.wav b/data/sound/firewrks.wav deleted file mode 100644 index 4edac508..00000000 Binary files a/data/sound/firewrks.wav and /dev/null differ diff --git a/data/sound/forcefield.wav b/data/sound/forcefield.wav deleted file mode 100644 index e8e3230f..00000000 Binary files a/data/sound/forcefield.wav and /dev/null differ diff --git a/data/sound/gotallgems.wav b/data/sound/gotallgems.wav deleted file mode 100644 index 778a7817..00000000 Binary files a/data/sound/gotallgems.wav and /dev/null differ diff --git a/data/sound/gotgem.wav b/data/sound/gotgem.wav deleted file mode 100644 index 93c8ebe5..00000000 Binary files a/data/sound/gotgem.wav and /dev/null differ diff --git a/data/sound/gotpowerup.wav b/data/sound/gotpowerup.wav deleted file mode 100644 index 220a2ebe..00000000 Binary files a/data/sound/gotpowerup.wav and /dev/null differ diff --git a/data/sound/groovepolice.ogg b/data/sound/groovepolice.ogg deleted file mode 100644 index 14e6fd30..00000000 Binary files a/data/sound/groovepolice.ogg and /dev/null differ diff --git a/data/sound/magnet.wav b/data/sound/magnet.wav deleted file mode 100644 index ca8af315..00000000 Binary files a/data/sound/magnet.wav and /dev/null differ diff --git a/data/sound/marble_fall.wav b/data/sound/marble_fall.wav deleted file mode 100644 index a3953c78..00000000 Binary files a/data/sound/marble_fall.wav and /dev/null differ diff --git a/data/sound/music/Astrolabe.ogg b/data/sound/music/Astrolabe.ogg deleted file mode 100644 index 37a8fe49..00000000 Binary files a/data/sound/music/Astrolabe.ogg and /dev/null differ diff --git a/data/sound/music/Beach Party.ogg b/data/sound/music/Beach Party.ogg deleted file mode 100644 index 675dfb1f..00000000 Binary files a/data/sound/music/Beach Party.ogg and /dev/null differ diff --git a/data/sound/music/Challenge.ogg b/data/sound/music/Challenge.ogg deleted file mode 100644 index 7a6c7e6b..00000000 Binary files a/data/sound/music/Challenge.ogg and /dev/null differ diff --git a/data/sound/music/Classic Vibe.ogg b/data/sound/music/Classic Vibe.ogg deleted file mode 100644 index dd795b39..00000000 Binary files a/data/sound/music/Classic Vibe.ogg and /dev/null differ diff --git a/data/sound/music/Comforting Mystery.ogg b/data/sound/music/Comforting Mystery.ogg deleted file mode 100644 index 6cf250e0..00000000 Binary files a/data/sound/music/Comforting Mystery.ogg and /dev/null differ diff --git a/data/sound/music/Endurance.ogg b/data/sound/music/Endurance.ogg deleted file mode 100644 index 9066e4f3..00000000 Binary files a/data/sound/music/Endurance.ogg and /dev/null differ diff --git a/data/sound/music/Flanked.ogg b/data/sound/music/Flanked.ogg deleted file mode 100644 index 64a3a7df..00000000 Binary files a/data/sound/music/Flanked.ogg and /dev/null differ diff --git a/data/sound/music/Groove Police.ogg b/data/sound/music/Groove Police.ogg deleted file mode 100644 index 2b831ed1..00000000 Binary files a/data/sound/music/Groove Police.ogg and /dev/null differ diff --git a/data/sound/music/Grudge.ogg b/data/sound/music/Grudge.ogg deleted file mode 100644 index b47c52bf..00000000 Binary files a/data/sound/music/Grudge.ogg and /dev/null differ diff --git a/data/sound/music/MBP Old Shell.ogg b/data/sound/music/MBP Old Shell.ogg deleted file mode 100644 index ddbe41f4..00000000 Binary files a/data/sound/music/MBP Old Shell.ogg and /dev/null differ diff --git a/data/sound/music/Metropolis.ogg b/data/sound/music/Metropolis.ogg deleted file mode 100644 index a9f6688b..00000000 Binary files a/data/sound/music/Metropolis.ogg and /dev/null differ diff --git a/data/sound/music/Pianoforte.ogg b/data/sound/music/Pianoforte.ogg deleted file mode 100644 index d90da0ac..00000000 Binary files a/data/sound/music/Pianoforte.ogg and /dev/null differ diff --git a/data/sound/music/Quiet Lab.ogg b/data/sound/music/Quiet Lab.ogg deleted file mode 100644 index 7f542d42..00000000 Binary files a/data/sound/music/Quiet Lab.ogg and /dev/null differ diff --git a/data/sound/music/Rising Temper.ogg b/data/sound/music/Rising Temper.ogg deleted file mode 100644 index 51b57ead..00000000 Binary files a/data/sound/music/Rising Temper.ogg and /dev/null differ diff --git a/data/sound/music/Seaside Revisited.ogg b/data/sound/music/Seaside Revisited.ogg deleted file mode 100644 index a7ae3b62..00000000 Binary files a/data/sound/music/Seaside Revisited.ogg and /dev/null differ diff --git a/data/sound/music/Shell.ogg b/data/sound/music/Shell.ogg deleted file mode 100644 index 80723135..00000000 Binary files a/data/sound/music/Shell.ogg and /dev/null differ diff --git a/data/sound/music/The Race.ogg b/data/sound/music/The Race.ogg deleted file mode 100644 index d44a5134..00000000 Binary files a/data/sound/music/The Race.ogg and /dev/null differ diff --git a/data/sound/music/Xmas Trance.ogg b/data/sound/music/Xmas Trance.ogg deleted file mode 100644 index fb322a52..00000000 Binary files a/data/sound/music/Xmas Trance.ogg and /dev/null differ diff --git a/data/sound/pugyrocoptervoice.wav b/data/sound/pugyrocoptervoice.wav deleted file mode 100644 index 01a722db..00000000 Binary files a/data/sound/pugyrocoptervoice.wav and /dev/null differ diff --git a/data/sound/pumegamarblevoice.wav b/data/sound/pumegamarblevoice.wav deleted file mode 100644 index 7393ed2d..00000000 Binary files a/data/sound/pumegamarblevoice.wav and /dev/null differ diff --git a/data/sound/pushockabsorbervoice.wav b/data/sound/pushockabsorbervoice.wav deleted file mode 100644 index 41407a24..00000000 Binary files a/data/sound/pushockabsorbervoice.wav and /dev/null differ diff --git a/data/sound/pusuperbouncevoice.wav b/data/sound/pusuperbouncevoice.wav deleted file mode 100644 index e6eea261..00000000 Binary files a/data/sound/pusuperbouncevoice.wav and /dev/null differ diff --git a/data/sound/pusuperjumpvoice.wav b/data/sound/pusuperjumpvoice.wav deleted file mode 100644 index e790eb44..00000000 Binary files a/data/sound/pusuperjumpvoice.wav and /dev/null differ diff --git a/data/sound/pusuperspeedvoice.wav b/data/sound/pusuperspeedvoice.wav deleted file mode 100644 index 30aedef8..00000000 Binary files a/data/sound/pusuperspeedvoice.wav and /dev/null differ diff --git a/data/sound/putimetravelvoice.wav b/data/sound/putimetravelvoice.wav deleted file mode 100644 index 74662e59..00000000 Binary files a/data/sound/putimetravelvoice.wav and /dev/null differ diff --git a/data/sound/set.wav b/data/sound/set.wav deleted file mode 100644 index 12e5fb68..00000000 Binary files a/data/sound/set.wav and /dev/null differ diff --git a/data/sound/teleport.wav b/data/sound/teleport.wav deleted file mode 100644 index 3b566ebe..00000000 Binary files a/data/sound/teleport.wav and /dev/null differ diff --git a/src/AudioManager.hx b/src/AudioManager.hx index 9fc59ea8..7333af1b 100644 --- a/src/AudioManager.hx +++ b/src/AudioManager.hx @@ -60,7 +60,7 @@ class AudioManager { public static function playShell() { AudioManager.manager.stopByName("music"); - var sndres = ResourceLoader.getAudio("data/sound/music/Pianoforte.ogg"); + var sndres = ResourceLoader.getAudio("data/sound/music/Tim Trance.ogg"); if (sndres == null) return; sndres.acquire(); diff --git a/src/Marble.hx b/src/Marble.hx index 10048d00..da057041 100644 --- a/src/Marble.hx +++ b/src/Marble.hx @@ -237,11 +237,8 @@ class Marble extends GameObject { public var heldPowerup:PowerUp; public var lastContactNormal:Vector; - var forcefield:DtsObject; var helicopter:HelicopterImage; var blastWave:BlastWave; - var superBounceEnableTime:Float = -1e8; - var shockAbsorberEnableTime:Float = -1e8; var helicopterEnableTime:Float = -1e8; var megaMarbleEnableTime:Float = -1e8; var blastUseTime:Float = -1e8; @@ -260,8 +257,6 @@ class Marble extends GameObject { var rollMegaSound:Channel; var slipSound:Channel; - var superbounceSound:Channel; - var shockabsorberSound:Channel; var helicopterSound:Channel; var playedSounds = []; @@ -311,12 +306,6 @@ class Marble extends GameObject { this.getAbsPos().getPosition(), true); this.rollSound.volume = 0; this.slipSound.volume = 0; - this.shockabsorberSound = AudioManager.playSound(ResourceLoader.getResource("data/sound/superbounceactive.wav", ResourceLoader.getAudio, - this.soundResources), null, true); - this.shockabsorberSound.pause = true; - this.superbounceSound = AudioManager.playSound(ResourceLoader.getResource("data/sound/forcefield.wav", ResourceLoader.getAudio, this.soundResources), - null, true); - this.superbounceSound.pause = true; this.helicopterSound = AudioManager.playSound(ResourceLoader.getResource("data/sound/use_gyrocopter.wav", ResourceLoader.getAudio, this.soundResources), null, true); this.helicopterSound.pause = true; @@ -458,17 +447,6 @@ class Marble extends GameObject { this.blastWave.z = 1e8; this.blastWave.isBoundingBoxCollideable = false; - this.forcefield = new DtsObject(); - this.forcefield.dtsPath = "data/shapes/images/glow_bounce.dts"; - this.forcefield.useInstancing = true; - this.forcefield.identifier = "GlowBounce"; - this.forcefield.showSequences = false; - this.addChild(this.forcefield); - this.forcefield.x = 1e8; - this.forcefield.y = 1e8; - this.forcefield.z = 1e8; - this.forcefield.isBoundingBoxCollideable = false; - this.helicopter = new HelicopterImage(); this.helicopter.isBoundingBoxCollideable = false; // this.addChild(this.helicopter); @@ -478,7 +456,6 @@ class Marble extends GameObject { this.helicopter.scale(0.3 / 0.2); var worker = new ResourceLoaderWorker(onFinish); - worker.addTask(fwd -> level.addDtsObject(this.forcefield, fwd)); worker.addTask(fwd -> level.addDtsObject(this.helicopter, fwd)); worker.addTask(fwd -> level.addDtsObject(this.blastWave, fwd)); worker.run(); @@ -661,12 +638,6 @@ class Marble extends GameObject { this.velocity = this.velocity.sub(surfaceVel); } else { var restitution = this._bounceRestitution; - if (currentTime - this.superBounceEnableTime < 5) { - restitution = 0.9; - } - if (currentTime - this.shockAbsorberEnableTime < 5) { - restitution = 0.01; - } restitution *= contacts[i].restitution; var velocityAdd = surfaceVel.multiply(-(1 + restitution)); @@ -1826,6 +1797,7 @@ class Marble extends GameObject { this._radius = this._prevRadius; this.collider.radius = this._radius; this._marbleScale = this._defaultScale; + AudioManager.playSound(ResourceLoader.getResource("data/sound/MegaShrink.wav", ResourceLoader.getAudio, this.soundResources), null, false); } } @@ -1921,26 +1893,6 @@ class Marble extends GameObject { } public function updatePowerupStates(currentTime:Float, dt:Float) { - if (currentTime - this.shockAbsorberEnableTime < 5) { - this.shockabsorberSound.pause = false; - } else { - this.shockabsorberSound.pause = true; - } - if (currentTime - this.superBounceEnableTime < 5) { - this.superbounceSound.pause = false; - } else { - this.superbounceSound.pause = true; - } - - if (currentTime - this.shockAbsorberEnableTime < 5) { - this.forcefield.setPosition(0, 0, 0); - } else if (currentTime - this.superBounceEnableTime < 5) { - this.forcefield.setPosition(0, 0, 0); - } else { - this.forcefield.x = 1e8; - this.forcefield.y = 1e8; - this.forcefield.z = 1e8; - } if (currentTime - this.helicopterEnableTime < 5) { this.helicopter.setPosition(x, y, z); this.helicopter.setRotationQuat(this.level.getOrientationQuat(currentTime)); @@ -1980,14 +1932,6 @@ class Marble extends GameObject { this.appliedImpulses.push({impulse: impulse, contactImpulse: contactImpulse}); } - public function enableSuperBounce(time:Float) { - this.superBounceEnableTime = time; - } - - public function enableShockAbsorber(time:Float) { - this.shockAbsorberEnableTime = time; - } - public function enableHelicopter(time:Float) { this.helicopterEnableTime = time; } @@ -2048,8 +1992,6 @@ class Marble extends GameObject { this.velocity = new Vector(); this.collider.velocity = new Vector(); this.omega = new Vector(); - this.superBounceEnableTime = Math.NEGATIVE_INFINITY; - this.shockAbsorberEnableTime = Math.NEGATIVE_INFINITY; this.helicopterEnableTime = Math.NEGATIVE_INFINITY; this.megaMarbleEnableTime = Math.NEGATIVE_INFINITY; this.blastUseTime = Math.NEGATIVE_INFINITY; diff --git a/src/MarbleWorld.hx b/src/MarbleWorld.hx index 0ed902cf..e6966d5f 100644 --- a/src/MarbleWorld.hx +++ b/src/MarbleWorld.hx @@ -260,29 +260,17 @@ class MarbleWorld extends Scheduler { this._loadingLength = resourceLoadFuncs.length; fwd(); }); - this.resourceLoadFuncs.push(fwd -> this.loadMusic(fwd)); this._loadingLength = resourceLoadFuncs.length; } - public function loadMusic(onFinish:Void->Void) { - if (this.mission.missionInfo.music != null) { - var musicFileName = 'sound/music/' + this.mission.missionInfo.music; - ResourceLoader.load(musicFileName).entry.load(onFinish); - } else { - onFinish(); - } - } - public function postInit() { // Add the sky at the last so that cubemap reflections work this.playGui.init(this.scene2d, this.mission.game.toLowerCase()); - this.scene.addChild(this.sky); // TODO FIX ANDROID + this.scene.addChild(this.sky); this._ready = true; - var musicFileName = 'data/sound/music/' + this.mission.missionInfo.music; - AudioManager.playMusic(ResourceLoader.getResource(musicFileName, ResourceLoader.getAudio, this.soundResources), this.mission.missionInfo.music); + AudioManager.playShell(); MarbleGame.canvas.clearContent(); - if (this.endPad != null) - this.endPad.generateCollider(); + this.endPad.generateCollider(); this.playGui.formatGemCounter(this.gemCount, this.totalGems); Console.log("MISSION LOADED"); start(); @@ -375,11 +363,8 @@ class MarbleWorld extends Scheduler { "particles/smoke.png", "sound/rolling_hard.wav", "sound/sliding.wav", - "sound/superbounceactive.wav", - "sound/forcefield.wav", "sound/use_gyrocopter.wav", "sound/bumperding1.wav", - "sound/bumper1.wav", "sound/jump.wav", "sound/mega_roll.wav", "sound/bouncehard1.wav", @@ -388,8 +373,6 @@ class MarbleWorld extends Scheduler { "sound/bouncehard4.wav", "sound/spawn_alternate.wav", "sound/missinggems.wav", - "shapes/images/glow_bounce.dts", - "shapes/images/glow_bounce.png", "shapes/images/helicopter.dts", "shapes/images/helicopter.jpg", // These irk us a lot because ifl shit "shapes/items/gem.dts", // Ew ew @@ -400,7 +383,7 @@ class MarbleWorld extends Scheduler { marblefiles.push("shapes/balls/pack1/marble20.normal.png"); marblefiles.push("shapes/balls/pack1/marble18.normal.png"); marblefiles.push("shapes/balls/pack1/marble01.normal.png"); - marblefiles.push("sound/blast.wav"); + marblefiles.push("sound/use_blast.wav"); } // Hacky marblefiles.push(StringTools.replace(Settings.optionsSettings.marbleModel, "data/", "")); @@ -1407,7 +1390,7 @@ class MarbleWorld extends Scheduler { AudioManager.playSound(ResourceLoader.getResource('data/sound/missinggems.wav', ResourceLoader.getAudio, this.soundResources)); displayAlert("You can't finish without all the gems!"); } else { - this.endPad.spawnFirework(this.timeState); + AudioManager.playSound(ResourceLoader.getResource('data/sound/finish.wav', ResourceLoader.getAudio, this.soundResources)); this.finishTime = this.timeState.clone(); this.marble.setMode(Finish); this.marble.camera.finish = true; @@ -1684,8 +1667,6 @@ class MarbleWorld extends Scheduler { this.marble.camera.nextCameraYaw = this.marble.camera.CameraYaw; this.marble.camera.nextCameraPitch = this.marble.camera.CameraPitch; this.marble.camera.oob = false; - @:privateAccess this.marble.superBounceEnableTime = -1e8; - @:privateAccess this.marble.shockAbsorberEnableTime = -1e8; @:privateAccess this.marble.helicopterEnableTime = -1e8; @:privateAccess this.marble.megaMarbleEnableTime = -1e8; this.blastAmount = this.cheeckpointBlast; diff --git a/src/gui/ExitGameDlg.hx b/src/gui/ExitGameDlg.hx index 0488bd35..d75b2389 100644 --- a/src/gui/ExitGameDlg.hx +++ b/src/gui/ExitGameDlg.hx @@ -66,16 +66,5 @@ class ExitGameDlg extends GuiControl { dialogImg.addChild(restartButton); this.addChild(dialogImg); - - var jukeboxButton = new GuiButton(loadButtonImages("data/ui/jukebox/jb_pausemenu")); - jukeboxButton.vertSizing = Top; - jukeboxButton.horizSizing = Left; - jukeboxButton.position = new Vector(439, 403); - jukeboxButton.extent = new Vector(187, 65); - jukeboxButton.pressedAction = (e) -> { - MarbleGame.canvas.pushDialog(new JukeboxDlg()); - } - - this.addChild(jukeboxButton); } } diff --git a/src/gui/JukeboxDlg.hx b/src/gui/JukeboxDlg.hx deleted file mode 100644 index cc8c3afc..00000000 --- a/src/gui/JukeboxDlg.hx +++ /dev/null @@ -1,165 +0,0 @@ -package gui; - -import h2d.filter.DropShadow; -import hxd.res.BitmapFont; -import h3d.Vector; -import src.ResourceLoader; -import src.MarbleGame; -import src.Settings; -import src.AudioManager; - -class JukeboxDlg extends GuiImage { - public function new() { - var img = ResourceLoader.getImage("data/ui/jukebox/window.png"); - super(img.resource.toTile()); - - this.horizSizing = Center; - this.vertSizing = Center; - this.position = new Vector(39, 35); - this.extent = new Vector(541, 409); - - function loadButtonImages(path:String) { - var normal = ResourceLoader.getResource('${path}_n.png', ResourceLoader.getImage, this.imageResources).toTile(); - var hover = ResourceLoader.getResource('${path}_h.png', ResourceLoader.getImage, this.imageResources).toTile(); - var pressed = ResourceLoader.getResource('${path}_d.png', ResourceLoader.getImage, this.imageResources).toTile(); - return [normal, hover, pressed]; - } - - var markerFelt32fontdata = ResourceLoader.getFileEntry("data/font/MarkerFelt.fnt"); - var markerFelt32b = new BitmapFont(markerFelt32fontdata.entry); - @:privateAccess markerFelt32b.loader = ResourceLoader.loader; - var markerFelt32 = markerFelt32b.toSdfFont(cast 26 * Settings.uiScale, MultiChannel); - var markerFelt24 = markerFelt32b.toSdfFont(cast 18 * Settings.uiScale, MultiChannel); - var markerFelt18 = markerFelt32b.toSdfFont(cast 14 * Settings.uiScale, MultiChannel); - - #if hl - var songPath = "data/sound/music"; - #end - #if js - var songPath = "sound/music"; - #end - var songFiles = ResourceLoader.fileSystem.dir(songPath); - var songList = songFiles.map(x -> StringTools.replace(x.name, ".ogg", "")); - - var playing:Bool = !AudioManager.currentMusicPaused; - var selectedIdx:Int = 0; - - var currentPlayingSong = StringTools.replace(AudioManager.currentMusicName, ".ogg", ""); - selectedIdx = songList.indexOf(currentPlayingSong); - - var songTitle = new GuiMLText(markerFelt24, null); - songTitle.position = new Vector(61, 262); - songTitle.extent = new Vector(416, 22); - songTitle.text.filter = new DropShadow(1.414, 0.785, 0x0000007F, 1, 0, 0.4, 1, true); - songTitle.text.textColor = 0xFFFFFF; - songTitle.text.text = '

Title: ${songList[selectedIdx]}

'; - this.addChild(songTitle); - - var songStatus = new GuiMLText(markerFelt24, null); - songStatus.position = new Vector(56, 283); - songStatus.extent = new Vector(421, 22); - songStatus.text.filter = new DropShadow(1.414, 0.785, 0x0000007F, 1, 0, 0.4, 1, true); - songStatus.text.textColor = 0xFFFFFF; - songStatus.text.text = '

${playing ? "Playing" : "Stopped"}

'; - this.addChild(songStatus); - - var scroll = new GuiScrollCtrl(ResourceLoader.getResource("data/ui/common/philscroll.png", ResourceLoader.getImage, this.imageResources).toTile()); - scroll.position = new Vector(51, 39); - scroll.extent = new Vector(439, 216); - this.addChild(scroll); - - var songCtrl = new GuiTextListCtrl(markerFelt24, songList); - songCtrl.position = new Vector(0, 0); - songCtrl.extent = new Vector(423, 456); - songCtrl.scrollable = true; - songCtrl.textYOffset = -6; - songCtrl.selectedColor = 0; - songCtrl._prevSelected = selectedIdx; - scroll.addChild(songCtrl); - scroll.setScrollMax(songCtrl.calculateFullHeight()); - - function setCurrentSong(idx:Int) { - selectedIdx = idx; - songCtrl._prevSelected = idx; - songTitle.text.text = '

Title: ${songList[idx]}

'; - songCtrl.redrawSelectionRect(songCtrl.getHitTestRect()); - - if (playing) { - songFiles[idx].load(() -> { - var audiores = ResourceLoader.getAudio(songFiles[idx].path).resource; - AudioManager.playMusic(audiores, songList[idx]); - }); - } - } - - songCtrl.onSelectedFunc = (idx) -> { - setCurrentSong(idx); - }; - - var stopBtn = new GuiButton(loadButtonImages("data/ui/jukebox/stop")); - stopBtn.position = new Vector(219, 306); - stopBtn.extent = new Vector(96, 45); - this.addChild(stopBtn); - - var playBtn = new GuiButton(loadButtonImages("data/ui/jukebox/play")); - playBtn.position = new Vector(219, 306); - playBtn.extent = new Vector(96, 45); - - stopBtn.pressedAction = (e) -> { - this.removeChild(stopBtn); - this.addChild(playBtn); - playBtn.render(MarbleGame.canvas.scene2d); - playing = false; - songStatus.text.text = '

${playing ? "Playing" : "Stopped"}

'; - AudioManager.pauseMusic(true); - }; - - playBtn.pressedAction = (e) -> { - this.removeChild(playBtn); - this.addChild(stopBtn); - stopBtn.render(MarbleGame.canvas.scene2d); - playing = true; - songStatus.text.text = '

${playing ? "Playing" : "Stopped"}

'; - if (AudioManager.currentMusicName != songList[selectedIdx]) { - songFiles[selectedIdx].load(() -> { - var audiores = ResourceLoader.getAudio(songFiles[selectedIdx].path).resource; - AudioManager.playMusic(audiores, songList[selectedIdx]); - }); - } else { - AudioManager.pauseMusic(false); - } - }; - - var prevBtn = new GuiButton(loadButtonImages("data/ui/play/prev")); - prevBtn.position = new Vector(145, 307); - prevBtn.extent = new Vector(72, 43); - prevBtn.pressedAction = (e) -> { - if (selectedIdx >= 1) { - setCurrentSong(selectedIdx - 1); - } else { - setCurrentSong(songList.length - 1); - } - } - this.addChild(prevBtn); - - var nextBtn = new GuiButton(loadButtonImages("data/ui/play/next")); - nextBtn.position = new Vector(317, 307); - nextBtn.extent = new Vector(72, 43); - nextBtn.pressedAction = (e) -> { - if (selectedIdx < songList.length - 1) { - setCurrentSong(selectedIdx + 1); - } else { - setCurrentSong(0); - } - } - this.addChild(nextBtn); - - var closeBtn = new GuiButton(loadButtonImages("data/ui/jukebox/close")); - closeBtn.position = new Vector(47, 307); - closeBtn.extent = new Vector(94, 45); - closeBtn.pressedAction = (e) -> { - MarbleGame.canvas.popDialog(this); - } - this.addChild(closeBtn); - } -} diff --git a/src/rewind/RewindManager.hx b/src/rewind/RewindManager.hx index 4c2bf9b3..8c410e05 100644 --- a/src/rewind/RewindManager.hx +++ b/src/rewind/RewindManager.hx @@ -27,12 +27,7 @@ class RewindManager { rf.bonusTime = level.bonusTime; rf.gemCount = level.gemCount; rf.gemStates = level.gems.map(x -> x.pickedUp); - rf.activePowerupStates = [@:privateAccess - level.marble.superBounceEnableTime, @:privateAccess - level.marble.shockAbsorberEnableTime, @:privateAccess - level.marble.helicopterEnableTime, @:privateAccess - level.marble.megaMarbleEnableTime - ]; + rf.activePowerupStates = [@:privateAccess level.marble.helicopterEnableTime, @:privateAccess level.marble.megaMarbleEnableTime]; rf.currentUp = level.currentUp.clone(); rf.lastContactNormal = level.marble.lastContactNormal.clone(); rf.mpStates = level.pathedInteriors.map(x -> { @@ -108,10 +103,8 @@ class RewindManager { for (i in 0...rf.gemStates.length) { level.gems[i].setHide(rf.gemStates[i]); } - @:privateAccess level.marble.superBounceEnableTime = rf.activePowerupStates[0]; - @:privateAccess level.marble.shockAbsorberEnableTime = rf.activePowerupStates[1]; - @:privateAccess level.marble.helicopterEnableTime = rf.activePowerupStates[2]; - @:privateAccess level.marble.megaMarbleEnableTime = rf.activePowerupStates[3]; + @:privateAccess level.marble.helicopterEnableTime = rf.activePowerupStates[0]; + @:privateAccess level.marble.megaMarbleEnableTime = rf.activePowerupStates[1]; if (level.currentUp.x != rf.currentUp.x || level.currentUp.y != rf.currentUp.y || level.currentUp.z != rf.currentUp.z) { level.setUp(rf.currentUp, level.timeState); diff --git a/src/shapes/EasterEgg.hx b/src/shapes/EasterEgg.hx index 9ff73c5b..9b44a2c1 100644 --- a/src/shapes/EasterEgg.hx +++ b/src/shapes/EasterEgg.hx @@ -25,7 +25,7 @@ class EasterEgg extends PowerUp { this.pickupSound = ResourceLoader.getResource("data/sound/easter_egg.wav", ResourceLoader.getAudio, this.soundResources); this.customPickupMessage = "You picked up an Easter Egg!"; } else { - this.pickupSound = ResourceLoader.getResource("data/sound/easterfound.wav", ResourceLoader.getAudio, this.soundResources); + this.pickupSound = ResourceLoader.getResource("data/sound/pu_easter.wav", ResourceLoader.getAudio, this.soundResources); this.customPickupMessage = "You picked up an Easter Egg!."; } @@ -35,7 +35,7 @@ class EasterEgg extends PowerUp { public override function init(level:src.MarbleWorld, onFinish:() -> Void) { super.init(level, () -> { ResourceLoader.load("sound/easter_egg.wav").entry.load(() -> { - ResourceLoader.load("sound/easterfound.wav").entry.load(onFinish); + ResourceLoader.load("sound/pu_easter.wav").entry.load(onFinish); }); }); } diff --git a/src/shapes/EndPad.hx b/src/shapes/EndPad.hx index 978243c1..a1aed2c1 100644 --- a/src/shapes/EndPad.hx +++ b/src/shapes/EndPad.hx @@ -25,8 +25,6 @@ import src.Resource; import h3d.mat.Texture; class EndPad extends DtsObject { - var fireworks:Array = []; - var finishCollider:ConvexHull; var finishBounds:Bounds; var inFinish:Bool = false; @@ -40,24 +38,7 @@ class EndPad extends DtsObject { } public override function init(level:MarbleWorld, onFinish:Void->Void) { - super.init(level, () -> { - ResourceLoader.load("sound/firewrks.wav").entry.load(onFinish); - }); - } - - // override function onMarbleContact(timeState:TimeState, ?contact:CollisionInfo) { - // if (!isEntered) { - // isEntered = true; - // spawnFirework(timeState); - // } - // } - - function spawnFirework(time:TimeState) { - var firework = new Firework(this.getAbsPos().getPosition(), time.timeSinceLoad, this.level); - this.fireworks.push(firework); - AudioManager.playSound(ResourceLoader.getResource("data/sound/firewrks.wav", ResourceLoader.getAudio, this.soundResources), - this.getAbsPos().getPosition()); - // AudioManager.play(this.sounds[0], 1, AudioManager.soundGain, this.worldPosition); + super.init(level, onFinish); } function generateCollider() { @@ -112,13 +93,6 @@ class EndPad extends DtsObject { override function update(timeState:TimeState) { super.update(timeState); - - for (firework in this.fireworks) { - firework.tick(timeState.timeSinceLoad); - if (timeState.timeSinceLoad - firework.spawnTime >= 10) - this.fireworks.remove(firework); - // We can safely remove the firework - } } override function postProcessMaterial(matName:String, material:h3d.mat.Material) { @@ -201,269 +175,3 @@ class EndPad extends DtsObject { } } } - -final fireworkSmoke:ParticleEmitterOptions = { - ejectionPeriod: 100, - ambientVelocity: new Vector(0, 0, 1), - ejectionVelocity: 0, - velocityVariance: 0, - emitterLifetime: 4000, - spawnOffset: () -> { - var r = Math.sqrt(Math.random()); - var theta = Math.random() * Math.PI * 2; - var randomPointInCircle = new Vector(r * Math.cos(theta), r * Math.sin(theta)); - return new Vector(randomPointInCircle.x * 1.6, randomPointInCircle.y * 1.6, Math.random() * 0.4 - 0.5); - }, - inheritedVelFactor: 0, - particleOptions: { - texture: 'particles/saturn.png', - blending: Alpha, - spinSpeed: 0, - spinRandomMin: -90, - spinRandomMax: 90, - lifetime: 2000, - lifetimeVariance: 200, - dragCoefficient: 0.5, - acceleration: 0, - colors: [new Vector(1, 1, 0, 0), new Vector(1, 0, 0, 1), new Vector(1, 0, 0, 0)], - sizes: [0.1, 0.2, 0.3], - times: [0, 0.2, 1] - } -}; - -final redTrail:ParticleEmitterOptions = { - ejectionPeriod: 30, - ambientVelocity: new Vector(0, 0, 0), - ejectionVelocity: 0, - velocityVariance: 0, - emitterLifetime: 10000, - inheritedVelFactor: 0, - particleOptions: { - texture: 'particles/spark.png', - blending: Alpha, - spinSpeed: 0, - spinRandomMin: -90, - spinRandomMax: 90, - lifetime: 600, - lifetimeVariance: 100, - dragCoefficient: 0, - acceleration: 0, - colors: [new Vector(1, 1, 0, 1), new Vector(1, 0, 0, 1), new Vector(1, 0, 0, 0)], - sizes: [0.1, 0.05, 0.01], - times: [0, 0.5, 1] - } -}; - -final blueTrail:ParticleEmitterOptions = { - ejectionPeriod: 30, - ambientVelocity: new Vector(0, 0, 0), - ejectionVelocity: 0, - velocityVariance: 0, - emitterLifetime: 10000, - inheritedVelFactor: 0, - particleOptions: { - texture: 'particles/spark.png', - blending: Alpha, - spinSpeed: 0, - spinRandomMin: -90, - spinRandomMax: 90, - lifetime: 600, - lifetimeVariance: 100, - dragCoefficient: 0, - acceleration: 0, - colors: [new Vector(0, 0, 1, 1), new Vector(0.5, 0.5, 1, 1), new Vector(1, 1, 1, 0)], - sizes: [0.1, 0.05, 0.01], - times: [0, 0.5, 1] - } -}; - -final redSpark:ParticleEmitterOptions = { - ejectionPeriod: 1, - ambientVelocity: new Vector(0, 0, 0), - ejectionVelocity: 0.8, - velocityVariance: 0.25, - emitterLifetime: 10, - inheritedVelFactor: 0, - particleOptions: { - texture: 'particles/star.png', - blending: Alpha, - spinSpeed: 40, - spinRandomMin: -90, - spinRandomMax: 90, - lifetime: 500, - lifetimeVariance: 50, - dragCoefficient: 0.5, - acceleration: 0, - colors: [new Vector(1, 1, 0, 1), new Vector(1, 1, 0, 1), new Vector(1, 0, 0, 0)], - sizes: [0.2, 0.2, 0.2], - times: [0, 0.5, 1] - } -}; - -final blueSpark:ParticleEmitterOptions = { - ejectionPeriod: 1, - ambientVelocity: new Vector(0, 0, 0), - ejectionVelocity: 0.5, - velocityVariance: 0.25, - emitterLifetime: 10, - inheritedVelFactor: 0, - particleOptions: { - texture: 'particles/bubble.png', - blending: Alpha, - spinSpeed: 40, - spinRandomMin: -90, - spinRandomMax: 90, - lifetime: 2000, - lifetimeVariance: 200, - dragCoefficient: 0, - acceleration: 0, - colors: [new Vector(0, 0, 1, 1), new Vector(0.5, 0.5, 1, 1), new Vector(1, 1, 1, 0)], - sizes: [0.2, 0.2, 0.2], - times: [0, 0.5, 1] - } -}; - -typedef Trail = { - var type:String; - var smokeEmitter:ParticleEmitter; - var targetPos:Vector; - var spawnTime:Float; - var lifetime:Float; -} - -@:publicFields -class Firework extends Scheduler { - var pos:Vector; - var spawnTime:Float; - var trails:Array = []; - - /** The fireworks are spawned in waves, this controls how many are left. */ - var wavesLeft = 4; - - var level:MarbleWorld; - - var fireworkSmokeData:ParticleData; - var fireworkRedTrailData:ParticleData; - var fireworkBlueTrailData:ParticleData; - var fireworkRedSparkData:ParticleData; - var fireworkBlueSparkData:ParticleData; - - var textureResources:Array> = []; - - public function new(pos:Vector, spawnTime:Float, level:MarbleWorld) { - this.pos = pos; - this.spawnTime = spawnTime; - this.level = level; - - fireworkSmokeData = new ParticleData(); - fireworkSmokeData.identifier = "fireworkSmoke"; - var res1 = ResourceLoader.getTexture("data/particles/saturn.png"); - res1.acquire(); - if (!this.textureResources.contains(res1)) - this.textureResources.push(res1); - fireworkSmokeData.texture = res1.resource; - - fireworkRedTrailData = new ParticleData(); - fireworkRedTrailData.identifier = "fireworkRedTrail"; - var res2 = ResourceLoader.getTexture("data/particles/spark.png"); - res2.acquire(); - if (!this.textureResources.contains(res2)) - this.textureResources.push(res2); - fireworkRedTrailData.texture = res2.resource; - - fireworkBlueTrailData = new ParticleData(); - fireworkBlueTrailData.identifier = "fireworkBlueTrail"; - var res3 = ResourceLoader.getTexture("data/particles/spark.png"); - res3.acquire(); - if (!this.textureResources.contains(res3)) - this.textureResources.push(res3); - fireworkBlueTrailData.texture = res3.resource; - - fireworkRedSparkData = new ParticleData(); - fireworkRedSparkData.identifier = "fireworkRedSpark"; - var res4 = ResourceLoader.getTexture("data/particles/star.png"); - res4.acquire(); - if (!this.textureResources.contains(res4)) - this.textureResources.push(res4); - fireworkRedSparkData.texture = res4.resource; - - fireworkBlueSparkData = new ParticleData(); - fireworkBlueSparkData.identifier = "fireworkBlueSpark"; - var res5 = ResourceLoader.getTexture("data/particles/bubble.png"); - res5.acquire(); - if (!this.textureResources.contains(res5)) - this.textureResources.push(res5); - fireworkBlueSparkData.texture = res5.resource; - - level.particleManager.createEmitter(fireworkSmoke, fireworkSmokeData, this.pos); // Start the smoke - this.doWave(this.spawnTime); // Start the first wave - } - - public function tick(time:Float) { - this.tickSchedule(time); - - // Update the trails - for (trail in this.trails) { - var completion = Util.clamp((time - trail.spawnTime) / trail.lifetime, 0, 1); - completion = 1 - Math.pow((1 - completion), 2); // ease-out - - // Make the trail travel along an arc (parabola, whatever) - var pos = this.pos.clone().multiply(1 - completion).add(trail.targetPos.clone().multiply(completion)); - pos = pos.sub(new Vector(0, 0, 1).multiply(Math.pow(completion, 2))); - trail.smokeEmitter.setPos(pos, time); - - if (completion == 1) { - // The trail has reached its end, remove the emitter and spawn the explosion. - level.particleManager.removeEmitter(trail.smokeEmitter); - this.trails.remove(trail); - - if (trail.type == 'red') { - level.particleManager.createEmitter(redSpark, fireworkRedSparkData, pos); - } else { - level.particleManager.createEmitter(blueSpark, fireworkBlueSparkData, pos); - } - } - } - } - - /** Spawns a bunch of trails going in random directions. */ - function doWave(time:Float) { - var count = Math.floor(17 + Math.random() * 10); - for (i in 0...count) - this.spawnTrail(time); - this.wavesLeft--; - if (this.wavesLeft > 0) { - var nextWaveTime = time + 0.5 + 1 * Math.random(); - this.schedule(nextWaveTime, () -> this.doWave(nextWaveTime)); - } - return null; - } - - function spawnTrail(time:Float) { - var type = (Math.random() < 0.5) ? 'red' : 'blue'; - var lifetime = 0.25 + Math.random() * 2; - var distanceFac = 0.5 + lifetime / 5; // Make sure the firework doesn't travel a great distance way too quickly - var emitter = level.particleManager.createEmitter((type == 'red') ? redTrail : blueTrail, - (type == 'red') ? fireworkRedTrailData : fireworkBlueTrailData, this.pos); - - var r = Math.sqrt(Math.random()); - var theta = Math.random() * Math.PI * 2; - - var randomPointInCircle = new Vector(r * Math.cos(theta), r * Math.sin(theta)); - var targetPos = new Vector(randomPointInCircle.x * 3, randomPointInCircle.y * 3, 1 + Math.sqrt(Math.random()) * 3).multiply(distanceFac).add(this.pos); - var trail:Trail = { - type: type, - smokeEmitter: emitter, - targetPos: targetPos, - spawnTime: time, - lifetime: lifetime - }; - this.trails.push(trail); - } - - function dispose() { - for (textureResource in this.textureResources) { - textureResource.release(); - } - } -}