Merge remote-tracking branch 'logarrhythmic/skycolor'

This commit is contained in:
Owain van Brakel
2020-01-13 16:52:20 +01:00
4 changed files with 130 additions and 0 deletions

View File

@@ -349,14 +349,17 @@ class Skybox
}
int cv = chunks[(stride * (cy - y1)) + (cx - x1)];
if (cv == -1)
{
return -1;
}
if ((cv & 0x8000_0000) != 0)
{
cv = planeOverrides[(cv & 0x7FFF_FFFF) | plane];
}
return cv;
}

View File

@@ -26,6 +26,7 @@ package net.runelite.client.plugins.skybox;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.google.inject.Provides;
import java.io.IOException;
import net.runelite.api.Client;
import net.runelite.api.GameState;
@@ -33,10 +34,12 @@ import net.runelite.api.Player;
import net.runelite.api.coords.LocalPoint;
import net.runelite.api.events.BeforeRender;
import net.runelite.api.events.GameStateChanged;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.plugins.skybox.config.SkyOverrideMode;
@PluginDescriptor(
name = "Skybox",
@@ -51,6 +54,9 @@ public class SkyboxPlugin extends Plugin
@Inject
private Client client;
@Inject
private SkyboxPluginConfig config;
private Skybox skybox;
@Override
@@ -67,6 +73,12 @@ public class SkyboxPlugin extends Plugin
skybox = null;
}
@Provides
SkyboxPluginConfig provideConfig(ConfigManager configManager)
{
return configManager.getConfig(SkyboxPluginConfig.class);
}
private int mapChunk(int cx, int cy, int plane)
{
cx -= client.getBaseX() / 8;
@@ -96,6 +108,17 @@ public class SkyboxPlugin extends Plugin
return;
}
if
(
config.overrideMode() == SkyOverrideMode.ALL ||
(config.overrideMode() == SkyOverrideMode.OVERWORLD && client.getLocalPlayer().getWorldLocation().getY() < 4200)
)
{
client.setSkyboxColor(config.customColor().getRGB());
return;
}
int px, py;
if (client.getOculusOrbState() == 1)
{

View File

@@ -0,0 +1,58 @@
/*
* Copyright (c) 2019 logarrhytmic <https://github.com/logarrhythmic>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.skybox;
import java.awt.Color;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.plugins.skybox.config.SkyOverrideMode;
@ConfigGroup("skybox")
public interface SkyboxPluginConfig extends Config
{
@ConfigItem(
keyName = "customColor",
name = "Custom sky color",
description = "Set a color here to use for the sky",
position = 1
)
default Color customColor()
{
return Color.BLACK;
}
@ConfigItem(
keyName = "skyOverrideMode",
name = "Mode",
description = "Replace the sky color in just the overworld, or everywhere",
position = 2
)
default SkyOverrideMode overrideMode()
{
return SkyOverrideMode.NONE;
}
}

View File

@@ -0,0 +1,46 @@
/*
* Copyright (c) 2019 logarrhytmic <https://github.com/logarrhythmic>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.skybox.config;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
@Getter
@RequiredArgsConstructor
public enum SkyOverrideMode
{
NONE("None"),
OVERWORLD("Overworld"),
ALL("Everywhere");
private final String name;
@Override
public String toString()
{
return name;
}
}