diff --git a/data/ui/mp/play/platform_android.png b/data/ui/mp/play/platform_android.png new file mode 100644 index 00000000..4f78b698 Binary files /dev/null and b/data/ui/mp/play/platform_android.png differ diff --git a/data/ui/mp/play/platform_android_white.png b/data/ui/mp/play/platform_android_white.png new file mode 100644 index 00000000..342dd87b Binary files /dev/null and b/data/ui/mp/play/platform_android_white.png differ diff --git a/data/ui/mp/play/platform_desktop.png b/data/ui/mp/play/platform_desktop.png new file mode 100644 index 00000000..46ce0111 Binary files /dev/null and b/data/ui/mp/play/platform_desktop.png differ diff --git a/data/ui/mp/play/platform_desktop_white.png b/data/ui/mp/play/platform_desktop_white.png new file mode 100644 index 00000000..319801d0 Binary files /dev/null and b/data/ui/mp/play/platform_desktop_white.png differ diff --git a/data/ui/mp/play/platform_mac.png b/data/ui/mp/play/platform_mac.png new file mode 100644 index 00000000..009915ee Binary files /dev/null and b/data/ui/mp/play/platform_mac.png differ diff --git a/data/ui/mp/play/platform_mac_white.png b/data/ui/mp/play/platform_mac_white.png new file mode 100644 index 00000000..90907af5 Binary files /dev/null and b/data/ui/mp/play/platform_mac_white.png differ diff --git a/data/ui/mp/play/platform_unknown.png b/data/ui/mp/play/platform_unknown.png new file mode 100644 index 00000000..8504eeef Binary files /dev/null and b/data/ui/mp/play/platform_unknown.png differ diff --git a/data/ui/mp/play/platform_unknown_white.png b/data/ui/mp/play/platform_unknown_white.png new file mode 100644 index 00000000..07f54b8f Binary files /dev/null and b/data/ui/mp/play/platform_unknown_white.png differ diff --git a/data/ui/mp/play/platform_web.png b/data/ui/mp/play/platform_web.png new file mode 100644 index 00000000..d1e087d1 Binary files /dev/null and b/data/ui/mp/play/platform_web.png differ diff --git a/data/ui/mp/play/platform_web_white.png b/data/ui/mp/play/platform_web_white.png new file mode 100644 index 00000000..6a30a2f3 Binary files /dev/null and b/data/ui/mp/play/platform_web_white.png differ diff --git a/data/ui/mp/play/spectator.png b/data/ui/mp/play/spectator.png new file mode 100644 index 00000000..678aaaec Binary files /dev/null and b/data/ui/mp/play/spectator.png differ diff --git a/src/Marble.hx b/src/Marble.hx index 2ec602ea..08239b3a 100644 --- a/src/Marble.hx +++ b/src/Marble.hx @@ -389,15 +389,18 @@ class Marble extends GameObject { this.netCorrected = false; var marbleDts = new DtsObject(); + var marbleShader = ""; if (connection == null) { Console.log("Marble: " + Settings.optionsSettings.marbleModel + " (" + Settings.optionsSettings.marbleSkin + ")"); marbleDts.dtsPath = Settings.optionsSettings.marbleModel; marbleDts.matNameOverride.set("base.marble", Settings.optionsSettings.marbleSkin + ".marble"); + marbleShader = Settings.optionsSettings.marbleShader; } else { var marbleData = MarbleSelectGui.marbleData[connection.getMarbleCatId()][connection.getMarbleId()]; // FIXME category support Console.log("Marble: " + marbleData.dts + " (" + marbleData.skin + ")"); marbleDts.dtsPath = marbleData.dts; marbleDts.matNameOverride.set("base.marble", marbleData.skin + ".marble"); + marbleShader = marbleData.shader; } marbleDts.identifier = "Marble"; marbleDts.showSequences = false; @@ -410,12 +413,9 @@ class Marble extends GameObject { // mat.mainPass.culling = None; if (Settings.optionsSettings.reflectiveMarble) { - this.cubemapRenderer = new CubemapRenderer(level.scene, level.sky); + this.cubemapRenderer = new CubemapRenderer(level.scene, level.sky, !this.controllable && level != null); - if (Settings.optionsSettings.marbleShader == null - || Settings.optionsSettings.marbleShader == "Default" - || Settings.optionsSettings.marbleShader == "" - || !isUltra) { // Use this shit everywhere except ultra + if (marbleShader == null || marbleShader == "Default" || marbleShader == "" || !isUltra) { // Use this shit everywhere except ultra mat.mainPass.addShader(new MarbleReflection(this.cubemapRenderer.cubemap)); } else { // Generate tangents for next shaders, only for Ultra @@ -429,26 +429,26 @@ class Marble extends GameObject { mat.mainPass.removeShader(mat.textureShader); - if (Settings.optionsSettings.marbleShader == "ClassicGlassPureSphere") { + if (marbleShader == "ClassicGlassPureSphere") { var marbleNormal = ResourceLoader.getTexture("data/shapes/balls/pack1/marble01.normal.png").resource; var classicGlassShader = new ClassicGlassPureSphere(mat.texture, marbleNormal, this.cubemapRenderer.cubemap, 12, new Vector(0.6, 0.6, 0.6, 0.6), this.level.ambient, this.level.dirLight, this.level.dirLightDir, 1); mat.mainPass.addShader(classicGlassShader); } - if (Settings.optionsSettings.marbleShader == "ClassicMarb2") { + if (marbleShader == "ClassicMarb2") { var classicMarb2 = new ClassicMarb2(mat.texture, this.cubemapRenderer.cubemap, 12, new Vector(0.6, 0.6, 0.6, 0.6), this.level.ambient, this.level.dirLight, this.level.dirLightDir, 1); mat.mainPass.addShader(classicMarb2); } - if (Settings.optionsSettings.marbleShader == "ClassicMarb3") { + if (marbleShader == "ClassicMarb3") { var classicMarb3 = new ClassicMarb3(mat.texture, this.cubemapRenderer.cubemap, 12, new Vector(0.6, 0.6, 0.6, 0.6), this.level.ambient, this.level.dirLight, this.level.dirLightDir, 1); mat.mainPass.addShader(classicMarb3); } - if (Settings.optionsSettings.marbleShader == "ClassicMetal") { + if (marbleShader == "ClassicMetal") { var marbleNormal = ResourceLoader.getTexture("data/shapes/balls/pack1/marble18.normal.png").resource; marbleNormal.wrap = Repeat; var classicMetalShader = new ClassicMetal(mat.texture, marbleNormal, this.cubemapRenderer.cubemap, 12, new Vector(0.6, 0.6, 0.6, 0.6), @@ -456,7 +456,7 @@ class Marble extends GameObject { mat.mainPass.addShader(classicMetalShader); } - if (Settings.optionsSettings.marbleShader == "ClassicMarbGlass20") { + if (marbleShader == "ClassicMarbGlass20") { var marbleNormal = ResourceLoader.getTexture("data/shapes/balls/pack1/marble20.normal.png").resource; marbleNormal.wrap = Repeat; var classicGlassShader = new ClassicGlass(mat.texture, marbleNormal, this.cubemapRenderer.cubemap, 12, new Vector(0.6, 0.6, 0.6, 0.6), @@ -464,7 +464,7 @@ class Marble extends GameObject { mat.mainPass.addShader(classicGlassShader); } - if (Settings.optionsSettings.marbleShader == "ClassicMarbGlass18") { + if (marbleShader == "ClassicMarbGlass18") { var marbleNormal = ResourceLoader.getTexture("data/shapes/balls/pack1/marble18.normal.png").resource; marbleNormal.wrap = Repeat; var classicGlassShader = new ClassicGlass(mat.texture, marbleNormal, this.cubemapRenderer.cubemap, 12, new Vector(0.6, 0.6, 0.6, 0.6), @@ -2325,7 +2325,7 @@ class Marble extends GameObject { public function updatePowerupStates(timeState:TimeState) { this.shadowVolume.setPosition(x, y, z); - this.shadowVolume.setScale(marbleDts.scaleX); + this.shadowVolume.setScale(this._radius / 0.2); if (this.level == null) return; var shockEnabled = isShockAbsorberEnabled(timeState); diff --git a/src/Settings.hx b/src/Settings.hx index ea81055b..d2946b07 100644 --- a/src/Settings.hx +++ b/src/Settings.hx @@ -129,7 +129,7 @@ class Settings { fovX: 90, frameRateVis: true, oobInsults: true, - reflectiveMarble: true, + reflectiveMarble: false, marbleIndex: 0, marbleCategoryIndex: 0, marbleSkin: "base", diff --git a/src/gui/GuiMLTextListCtrl.hx b/src/gui/GuiMLTextListCtrl.hx index 8f105e50..6db54cce 100644 --- a/src/gui/GuiMLTextListCtrl.hx +++ b/src/gui/GuiMLTextListCtrl.hx @@ -60,6 +60,7 @@ class GuiMLTextListCtrl extends GuiControl { for (text in texts) { var tobj = new HtmlText(font); tobj.lineHeightMode = TextOnly; + tobj.imageVerticalAlign = Top; tobj.loadImage = imageLoader; tobj.text = text; tobj.textColor = 0; @@ -79,6 +80,7 @@ class GuiMLTextListCtrl extends GuiControl { for (text in texts) { var tobj = new HtmlText(font); tobj.loadImage = this._imageLoader; + tobj.imageVerticalAlign = Top; tobj.lineHeightMode = TextOnly; tobj.text = text; tobj.textColor = 0; diff --git a/src/gui/JoinServerGui.hx b/src/gui/JoinServerGui.hx index e72a9f04..f7d4132e 100644 --- a/src/gui/JoinServerGui.hx +++ b/src/gui/JoinServerGui.hx @@ -147,10 +147,34 @@ class JoinServerGui extends GuiImage { serverListContainer.extent = new Vector(475, 290); window.addChild(serverListContainer); + function imgLoader(path:String) { + var t = switch (path) { + case "ready": + ResourceLoader.getResource("data/ui/mp/play/Ready.png", ResourceLoader.getImage, this.imageResources).toTile(); + case "notready": + ResourceLoader.getResource("data/ui/mp/play/NotReady.png", ResourceLoader.getImage, this.imageResources).toTile(); + case "pc": + ResourceLoader.getResource("data/ui/mp/play/platform_desktop_white.png", ResourceLoader.getImage, this.imageResources).toTile(); + case "mac": + ResourceLoader.getResource("data/ui/mp/play/platform_mac_white.png", ResourceLoader.getImage, this.imageResources).toTile(); + case "web": + ResourceLoader.getResource("data/ui/mp/play/platform_web_white.png", ResourceLoader.getImage, this.imageResources).toTile(); + case "android": + ResourceLoader.getResource("data/ui/mp/play/platform_android_white.png", ResourceLoader.getImage, this.imageResources).toTile(); + case "unknown": + ResourceLoader.getResource("data/ui/mp/play/platform_unknown_white.png", ResourceLoader.getImage, this.imageResources).toTile(); + case _: + return null; + }; + if (t != null) + t.scaleToSize(t.width * (Settings.uiScale), t.height * (Settings.uiScale)); + return t; + } + var ourServerList:Array = []; var curSelection = -1; - var serverList = new GuiTextListCtrl(markerFelt18, [], 0xFFFFFF); + var serverList = new GuiMLTextListCtrl(markerFelt18, [], imgLoader); serverList.position = new Vector(0, 0); serverList.extent = new Vector(475, 63); serverList.scrollable = true; @@ -172,7 +196,7 @@ class JoinServerGui extends GuiImage { var platformToString = ["unknown", "pc", "mac", "web", "android"]; function updateServerListDisplay() { - serverDisplays = ourServerList.map(x -> '${x.name}'); + serverDisplays = ourServerList.map(x -> '${x.name}'); serverList.setTexts(serverDisplays); } diff --git a/src/gui/MPPlayMissionGui.hx b/src/gui/MPPlayMissionGui.hx index 1189aed9..ba99bcaa 100644 --- a/src/gui/MPPlayMissionGui.hx +++ b/src/gui/MPPlayMissionGui.hx @@ -48,7 +48,7 @@ class MPPlayMissionGui extends GuiImage { var previewToken:Int = 0; #end - var playerListCtrl:GuiTextListCtrl; + var playerListCtrl:GuiMLTextListCtrl; var chatInput:GuiTextInput; var chatScroll:GuiScrollCtrl; var chatBox:GuiMLText; @@ -341,12 +341,36 @@ class MPPlayMissionGui extends GuiImage { parTime.text.lineSpacing = -1; window.addChild(parTime); + function imgLoader(path:String) { + var t = switch (path) { + case "ready": + ResourceLoader.getResource("data/ui/mp/play/Ready.png", ResourceLoader.getImage, this.imageResources).toTile(); + case "notready": + ResourceLoader.getResource("data/ui/mp/play/NotReady.png", ResourceLoader.getImage, this.imageResources).toTile(); + case "pc": + ResourceLoader.getResource("data/ui/mp/play/platform_desktop_white.png", ResourceLoader.getImage, this.imageResources).toTile(); + case "mac": + ResourceLoader.getResource("data/ui/mp/play/platform_mac_white.png", ResourceLoader.getImage, this.imageResources).toTile(); + case "web": + ResourceLoader.getResource("data/ui/mp/play/platform_web_white.png", ResourceLoader.getImage, this.imageResources).toTile(); + case "android": + ResourceLoader.getResource("data/ui/mp/play/platform_android_white.png", ResourceLoader.getImage, this.imageResources).toTile(); + case "unknown": + ResourceLoader.getResource("data/ui/mp/play/platform_unknown_white.png", ResourceLoader.getImage, this.imageResources).toTile(); + case _: + return null; + }; + if (t != null) + t.scaleToSize(t.width * (Settings.uiScale), t.height * (Settings.uiScale)); + return t; + } + var playersBox = new GuiControl(); playersBox.position = new Vector(463, 279); playersBox.extent = new Vector(305, 229); window.addChild(playersBox); - playerListCtrl = new GuiTextListCtrl(markerFelt18, [], 0xFFFFFF); + playerListCtrl = new GuiMLTextListCtrl(markerFelt18, [], imgLoader); playerListCtrl.position = new Vector(0, 26); playerListCtrl.extent = new Vector(305, 203); playerListCtrl.scrollable = true; @@ -671,7 +695,8 @@ class MPPlayMissionGui extends GuiImage { } } - var playerListCompiled = playerListArr.map(player -> player.name); + var playerListCompiled = playerListArr.map(player -> + '${player.name}'); playerListCtrl.setTexts(playerListCompiled); // if (!showingCustoms) diff --git a/src/shaders/CubemapRenderer.hx b/src/shaders/CubemapRenderer.hx index b49dfdb9..726d16dc 100644 --- a/src/shaders/CubemapRenderer.hx +++ b/src/shaders/CubemapRenderer.hx @@ -21,11 +21,15 @@ class CubemapRenderer { var lastRenderTime:Float = 0; var usingSky:Bool = false; - public function new(scene:Scene, sky:Sky) { + public function new(scene:Scene, sky:Sky, useSky = false) { this.scene = scene; this.sky = sky; - this.cubemap = new Texture(128, 128, [Cube, Dynamic, Target], h3d.mat.Data.TextureFormat.RGB8); - this.cubemap.depthBuffer = new h3d.mat.DepthBuffer(128, 128, h3d.mat.DepthBuffer.DepthFormat.Depth16); + if (useSky) + this.cubemap = sky.cubemap; + else { + this.cubemap = new Texture(128, 128, [Cube, Dynamic, Target], h3d.mat.Data.TextureFormat.RGBA); + this.cubemap.depthBuffer = new h3d.mat.DepthBuffer(128, 128, h3d.mat.DepthBuffer.DepthFormat.Depth16); + } this.camera = new Camera(90, 1, 1, 0.02, scene.camera.zFar); this.position = new Vector(); this.nextFaceToRender = 0;