Merge pull request #3040 from Owain94/hd

project: Merge upstream
This commit is contained in:
Owain van Brakel
2021-09-13 19:55:01 +02:00
committed by GitHub
35 changed files with 835 additions and 159 deletions

View File

@@ -25,9 +25,9 @@
object ProjectVersions {
const val launcherVersion = "2.2.0"
const val rlVersion = "1.7.23"
const val rlVersion = "1.7.24"
const val openosrsVersion = "4.9.14"
const val openosrsVersion = "4.10.0"
const val rsversion = 199
const val cacheversion = 165

View File

@@ -77,7 +77,14 @@ public class DeobAnnotations
@Nullable
public static String getImplements(@NotNull ClassFile cf)
{
return getStringValue(cf, IMPLEMENTS);
String stringValue = getStringValue(cf, IMPLEMENTS);
if (stringValue != null)
{
stringValue = flatten(stringValue);
}
return stringValue;
}
@Nullable
@@ -114,4 +121,9 @@ public class DeobAnnotations
final var a = an.findAnnotation(type);
return a == null ? null : a.getValueString();
}
public static String flatten(String className)
{
return className.substring(className.lastIndexOf('/') + 1);
}
}

View File

@@ -105,4 +105,8 @@ public interface Model extends Renderable
boolean isClickable();
void drawFace(int face);
int[] getVertexNormalsX();
int[] getVertexNormalsY();
int[] getVertexNormalsZ();
}

View File

@@ -74,4 +74,22 @@ public interface Scene
void generateHouses();
void setRoofRemovalMode(int flags);
/**
* Get the underlay ids for the scene. The value stored is id + 1, with 0 for no underlay.
* @return
*/
byte[][][] getUnderlayIds();
/**
* Get the overlay ids for the scene. The value stored is id + 1, with 0 for no overlay.
* @return
*/
byte[][][] getOverlayIds();
/**
* Get the shapes of the tiles for the scene.
* @return
*/
byte[][][] getTileShapes();
}

View File

@@ -62,9 +62,9 @@ dependencies {
implementation(group = "com.jakewharton.rxrelay3", name = "rxrelay", version = "3.0.0")
implementation(group = "com.squareup.okhttp3", name = "okhttp", version = "3.7.0")
implementation(group = "io.reactivex.rxjava3", name = "rxjava", version = "3.0.10")
implementation(group = "net.java.dev.jna", name = "jna", version = "5.8.0")
implementation(group = "net.java.dev.jna", name = "jna", version = "5.9.0")
implementation(group = "org.jgroups", name = "jgroups", version = "5.0.4.Final")
implementation(group = "net.java.dev.jna", name = "jna-platform", version = "5.8.0")
implementation(group = "net.java.dev.jna", name = "jna-platform", version = "5.9.0")
implementation(group = "net.runelite", name = "discord", version = "1.4")
implementation(group = "net.runelite.pushingpixels", name = "substance", version = "8.0.02")
implementation(group = "net.sf.jopt-simple", name = "jopt-simple", version = "5.0.1")

View File

@@ -33,7 +33,9 @@ import java.util.function.Function;
import javax.inject.Inject;
import javax.inject.Singleton;
import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.api.NPC;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.NpcChanged;
import net.runelite.api.events.NpcDespawned;
import net.runelite.api.events.NpcSpawned;
@@ -62,6 +64,16 @@ public class NpcOverlayService
eventBus.register(this);
}
@Subscribe
private void onGameStateChanged(GameStateChanged event)
{
if (event.getGameState() == GameState.LOGIN_SCREEN ||
event.getGameState() == GameState.HOPPING)
{
highlightedNpcs.clear();
}
}
@Subscribe(
// Run after plugins, which typically capture NPCs on spawn and reference them in the highlight functions
priority = -1
@@ -81,14 +93,18 @@ public class NpcOverlayService
}
}
@Subscribe
@Subscribe(
priority = -1
)
private void onNpcDespawned(NpcDespawned npcDespawned)
{
final NPC npc = npcDespawned.getNpc();
highlightedNpcs.remove(npc);
}
@Subscribe
@Subscribe(
priority = -1
)
private void onNpcChanged(NpcChanged event)
{
final NPC npc = event.getNpc();

View File

@@ -53,6 +53,18 @@ public @interface PluginDescriptor
*/
String[] tags() default {};
/**
* A list of plugin names that are mutually exclusive with this plugin. Any plugins
* with a name or conflicts value that matches this will be disabled when this plugin
* is started
*/
String[] conflicts() default {};
/**
* If this plugin should be defaulted to on. Plugin-Hub plugins should always
* have this set to true (the default), since having them off by defaults means
* the user has to install the plugin, then separately enable it, which is confusing.
*/
boolean enabledByDefault() default true;
/**
@@ -62,6 +74,9 @@ public @interface PluginDescriptor
boolean developerPlugin() default false;
/**
* If this plugin should be loaded when there is no {@link net.runelite.api.Client}
*/
boolean loadWhenOutdated() default false;
boolean loadInSafeMode() default true;

View File

@@ -41,8 +41,10 @@ import com.google.inject.Module;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -405,6 +407,19 @@ public class PluginManager
return false;
}
List<Plugin> conflicts = conflictsForPlugin(plugin);
for (Plugin conflict : conflicts)
{
if (isPluginEnabled(conflict))
{
setPluginEnabled(conflict, false);
}
if (activePlugins.contains(conflict))
{
stopPlugin(conflict);
}
}
activePlugins.add(plugin);
try
@@ -470,6 +485,18 @@ public class PluginManager
final PluginDescriptor pluginDescriptor = plugin.getClass().getAnnotation(PluginDescriptor.class);
final String keyName = Strings.isNullOrEmpty(pluginDescriptor.configName()) ? plugin.getClass().getSimpleName() : pluginDescriptor.configName();
configManager.setConfiguration(RuneLiteConfig.GROUP_NAME, keyName.toLowerCase(), String.valueOf(enabled));
if (enabled)
{
List<Plugin> conflicts = conflictsForPlugin(plugin);
for (Plugin conflict : conflicts)
{
if (isPluginEnabled(conflict))
{
setPluginEnabled(conflict, false);
}
}
}
}
public boolean isPluginEnabled(Plugin plugin)
@@ -671,4 +698,40 @@ public class PluginManager
}
return l;
}
public List<Plugin> conflictsForPlugin(Plugin plugin)
{
Set<String> conflicts;
{
PluginDescriptor desc = plugin.getClass().getAnnotation(PluginDescriptor.class);
conflicts = new HashSet<>(Arrays.asList(desc.conflicts()));
conflicts.add(desc.name());
}
return plugins.stream()
.filter(p ->
{
if (p == plugin)
{
return false;
}
PluginDescriptor desc = p.getClass().getAnnotation(PluginDescriptor.class);
if (conflicts.contains(desc.name()))
{
return true;
}
for (String conflict : desc.conflicts())
{
if (conflicts.contains(conflict))
{
return true;
}
}
return false;
})
.collect(Collectors.toList());
}
}

View File

@@ -243,6 +243,7 @@ class ConfigPanel extends PluginPanel
if (pluginConfig.getPlugin() != null)
{
pluginToggle.setConflicts(pluginConfig.getConflicts());
pluginToggle.setSelected(pluginManager.isPluginEnabled(pluginConfig.getPlugin()));
pluginToggle.addItemListener(i ->
{

View File

@@ -75,11 +75,11 @@ public class ConfigPlugin extends Plugin
pluginListPanel.addFakePlugin(new PluginConfigurationDescriptor(
"RuneLite", "RuneLite client settings",
new String[]{"client", "notification", "size", "position", "window", "chrome", "focus", "font", "overlay", "tooltip", "infobox"},
null, runeLiteConfig, configManager.getConfigDescriptor(runeLiteConfig)
runeLiteConfig, configManager.getConfigDescriptor(runeLiteConfig)
),
new PluginConfigurationDescriptor(
"Chat Color", "Recolor chat text", new String[]{"colour", "messages"},
null, chatColorConfig, configManager.getConfigDescriptor(chatColorConfig)
chatColorConfig, configManager.getConfigDescriptor(chatColorConfig)
));
pluginListPanel.rebuildPluginList();

View File

@@ -24,8 +24,10 @@
*/
package net.runelite.client.plugins.config;
import java.util.List;
import javax.annotation.Nullable;
import javax.swing.JMenuItem;
import lombok.RequiredArgsConstructor;
import lombok.Value;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigDescriptor;
@@ -35,6 +37,7 @@ import net.runelite.client.plugins.Plugin;
import net.runelite.client.util.LinkBrowser;
@Value
@RequiredArgsConstructor
class PluginConfigurationDescriptor
{
private final String name;
@@ -52,11 +55,19 @@ class PluginConfigurationDescriptor
@Nullable
private final ConfigDescriptor configDescriptor;
@Nullable
private final List<String> conflicts;
boolean hasConfigurables()
{
return configDescriptor != null && !configDescriptor.getItems().stream().allMatch(item -> item.getItem().hidden());
}
PluginConfigurationDescriptor(String name, String description, String[] tags, Config config, ConfigDescriptor configDescriptor)
{
this(name, description, tags, null, config, configDescriptor, null);
}
/**
* Creates a menu item for linking to a support page for the plugin
*

View File

@@ -77,7 +77,7 @@ class PluginListItem extends JPanel implements SearchablePlugin
private final List<String> keywords = new ArrayList<>();
private final JToggleButton pinButton;
private final JToggleButton onOffToggle;
private final PluginToggleButton onOffToggle;
static
{
@@ -232,6 +232,7 @@ class PluginListItem extends JPanel implements SearchablePlugin
add(nameLabel, BorderLayout.CENTER);
onOffToggle = new PluginToggleButton();
onOffToggle.setConflicts(pluginConfig.getConflicts());
buttonPanel.add(onOffToggle);
if (pluginConfig.getPlugin() != null)
{

View File

@@ -207,6 +207,9 @@ class PluginListPanel extends PluginPanel
PluginDescriptor descriptor = plugin.getClass().getAnnotation(PluginDescriptor.class);
Config config = pluginManager.getPluginConfigProxy(plugin);
ConfigDescriptor configDescriptor = config == null ? null : configManager.getConfigDescriptor(config);
List<String> conflicts = pluginManager.conflictsForPlugin(plugin).stream()
.map(Plugin::getName)
.collect(Collectors.toList());
return new PluginConfigurationDescriptor(
descriptor.name(),
@@ -214,7 +217,8 @@ class PluginListPanel extends PluginPanel
descriptor.tags(),
plugin,
config,
configDescriptor);
configDescriptor,
conflicts);
})
)
.map(desc ->

View File

@@ -27,6 +27,7 @@ package net.runelite.client.plugins.config;
import java.awt.Dimension;
import java.awt.image.BufferedImage;
import java.util.List;
import javax.swing.ImageIcon;
import javax.swing.JToggleButton;
import net.runelite.client.ui.ColorScheme;
@@ -52,12 +53,47 @@ class PluginToggleButton extends JToggleButton
));
}
private String conflictString = "";
public PluginToggleButton()
{
super(OFF_SWITCHER);
setSelectedIcon(ON_SWITCHER);
SwingUtil.removeButtonDecorations(this);
setPreferredSize(new Dimension(25, 0));
SwingUtil.addModalTooltip(this, "Disable plugin", "Enable plugin");
addItemListener(l -> updateTooltip());
updateTooltip();
}
private void updateTooltip()
{
setToolTipText(isSelected() ? "Disable plugin" : "<html>Enable plugin" + conflictString);
}
public void setConflicts(List<String> conflicts)
{
if (conflicts != null && !conflicts.isEmpty())
{
StringBuilder sb = new StringBuilder("<br>Conflicts with ");
for (int i = 0; i < conflicts.size() - 2; i++)
{
sb.append(conflicts.get(i));
sb.append(", ");
}
if (conflicts.size() > 2)
{
sb.append(conflicts.get(conflicts.size() - 2));
sb.append(" and ");
}
sb.append(conflicts.get(conflicts.size() - 1));
conflictString = sb.toString();
}
else
{
conflictString = "";
}
updateTooltip();
}
}

View File

@@ -186,7 +186,7 @@ public class MusicPlugin extends Plugin
channels = new Channel[]{musicChannel, effectChannel, areaChannel};
addMusicButtons();
if (musicConfig.granularSliders())
if (client.getGameState() == GameState.LOGGED_IN && musicConfig.granularSliders())
{
updateMusicOptions();
resetSettingsWindow();

View File

@@ -41,8 +41,6 @@ interface RLLibC extends LibC
int socket(int domain, int type, int protocol);
int close(int socket);
int sendto(int sockfd, byte[] buf, int len, int flags, byte[] dest_addr, int addrlen);
int recvfrom(int sockfd, Pointer buf, int len, int flags, Pointer src_addr, Pointer addrlen);

View File

@@ -47,7 +47,7 @@ public class WidgetOverlay extends Overlay
// The client forces the oxygen bar below the xp tracker, so set its priority lower
new WidgetOverlay(client, WidgetInfo.FOSSIL_ISLAND_OXYGENBAR, OverlayPosition.TOP_CENTER, OverlayPriority.HIGH),
new XpTrackerWidgetOverlay(overlayManager, client, WidgetInfo.EXPERIENCE_TRACKER_WIDGET, OverlayPosition.TOP_RIGHT),
new WidgetOverlay(client, WidgetInfo.RAIDS_POINTS_INFOBOX, OverlayPosition.TOP_RIGHT),
new WidgetOverlay(client, WidgetInfo.RAIDS_POINTS_INFOBOX, OverlayPosition.TOP_LEFT),
new WidgetOverlay(client, WidgetInfo.TOB_PARTY_INTERFACE, OverlayPosition.TOP_LEFT),
new WidgetOverlay(client, WidgetInfo.TOB_PARTY_STATS, OverlayPosition.TOP_LEFT),
new WidgetOverlay(client, WidgetInfo.GWD_KC, OverlayPosition.TOP_RIGHT),

View File

@@ -24,11 +24,19 @@
*/
package net.runelite.client.util;
import java.awt.Component;
import javax.swing.Popup;
import javax.swing.PopupFactory;
/**
* Dummy popup factory for Java 8
* Popup factory for Java 11 which forces heavyweight popups. Lightweight popups do not render correctly
* over AWT canvases on OSX.
*/
class MacOSPopupFactory extends PopupFactory
{
@Override
protected Popup getPopup(Component owner, Component contents, int x, int y, boolean isHeavyWeightPopup) throws IllegalArgumentException
{
return super.getPopup(owner, contents, x, y, true);
}
}

View File

@@ -1,42 +0,0 @@
/*
* Copyright (c) 2021, Adam <Adam@sigterm.info>
* 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.util;
import java.awt.Component;
import javax.swing.Popup;
import javax.swing.PopupFactory;
/**
* Popup factory for Java 11 which forces heavyweight popups. Lightweight popups do not render correctly
* over AWT canvases on OSX.
*/
class MacOSPopupFactory extends PopupFactory
{
@Override
protected Popup getPopup(Component owner, Component contents, int x, int y, boolean isHeavyWeightPopup) throws IllegalArgumentException
{
return super.getPopup(owner, contents, x, y, true);
}
}

View File

@@ -29,6 +29,7 @@ import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet;
import java.util.HashSet;
@@ -2290,5 +2291,25 @@ public abstract class RSClientMixin implements RSClient
@Inject
public static RSArchive[] archives = new RSArchive[21];
@Inject
@FieldHook("rndHue")
public static void rndHue(int idx)
{
int rndHue = client.getRndHue();
if (rndHue >= -8 && rndHue <= 8)
{
RSScene scene = client.getScene();
byte[][][] underlays = client.getTileUnderlays();
byte[][][] overlays = client.getTileOverlays();
byte[][][] tileShapes = client.getTileShapes();
scene.setUnderlayIds(Arrays.copyOf(underlays, underlays.length));
scene.setOverlayIds(Arrays.copyOf(overlays, overlays.length));
scene.setTileShapes(Arrays.copyOf(tileShapes, tileShapes.length));
}
}
}

View File

@@ -33,6 +33,7 @@ import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSModel;
import net.runelite.rs.api.RSModelData;
import net.runelite.rs.api.RSVertexNormal;
@Mixin(RSModelData.class)
public abstract class RSModelDataMixin implements RSModelData
@@ -43,6 +44,15 @@ public abstract class RSModelDataMixin implements RSModelData
@Inject
private float[] faceTextureUVCoordinates;
@Inject
private int[] vertexNormalsX;
@Inject
private int[] vertexNormalsY;
@Inject
private int[] vertexNormalsZ;
@Copy("toModel")
@Replace("toModel")
@SuppressWarnings("InfiniteRecursion")
@@ -61,11 +71,50 @@ public abstract class RSModelDataMixin implements RSModelData
computeTextureUVCoordinates();
}
vertexNormals();
RSModel rsModel = (RSModel) model;
rsModel.setVertexNormalsX(vertexNormalsX);
rsModel.setVertexNormalsY(vertexNormalsY);
rsModel.setVertexNormalsZ(vertexNormalsZ);
rsModel.setFaceTextureUVCoordinates(faceTextureUVCoordinates);
return model;
}
@Inject
public void vertexNormals()
{
RSVertexNormal[] vertexNormals = getVertexNormals();
RSVertexNormal[] vertexVertices = getVertexVertices();
if (vertexNormals != null && vertexNormalsX == null)
{
int verticesCount = getVerticesCount();
vertexNormalsX = new int[verticesCount];
vertexNormalsY = new int[verticesCount];
vertexNormalsZ = new int[verticesCount];
for (int i = 0; i < verticesCount; ++i)
{
RSVertexNormal vertexNormal;
if (vertexVertices != null && (vertexNormal = vertexVertices[i]) != null)
{
vertexNormalsX[i] = vertexNormal.getX();
vertexNormalsY[i] = vertexNormal.getY();
vertexNormalsZ[i] = vertexNormal.getZ();
}
else if ((vertexNormal = vertexNormals[i]) != null)
{
vertexNormalsX[i] = vertexNormal.getX();
vertexNormalsY[i] = vertexNormal.getY();
vertexNormalsZ[i] = vertexNormal.getZ();
}
}
}
}
@Inject
public void computeTextureUVCoordinates()
{
@@ -171,6 +220,6 @@ public abstract class RSModelDataMixin implements RSModelData
}
}
this.faceTextureUVCoordinates = faceTextureUCoordinates;
faceTextureUVCoordinates = faceTextureUCoordinates;
}
}

View File

@@ -63,13 +63,22 @@ public abstract class RSModelMixin implements RSModel
@Inject
private float[] rl$faceTextureUVCoordinates;
@Inject
private int[] rl$vertexNormalsX;
@Inject
private int[] rl$vertexNormalsY;
@Inject
private int[] rl$vertexNormalsZ;
@MethodHook(value = "<init>", end = true)
@Inject
public void rl$init(RSModel[] models, int length)
{
if (this.getFaceTextures() != null)
if (getFaceTextures() != null)
{
int count = this.getTrianglesCount();
int count = getTrianglesCount();
float[] uv = new float[count * 6];
int idx = 0;
@@ -91,6 +100,8 @@ public abstract class RSModelMixin implements RSModel
setFaceTextureUVCoordinates(uv);
}
vertexNormals();
}
@Override
@@ -154,6 +165,9 @@ public abstract class RSModelMixin implements RSModel
if (model != null && model != this)
{
RSModel rsModel = (RSModel) model;
rsModel.setVertexNormalsX(rl$vertexNormalsX);
rsModel.setVertexNormalsY(rl$vertexNormalsY);
rsModel.setVertexNormalsZ(rl$vertexNormalsZ);
rsModel.setFaceTextureUVCoordinates(rl$faceTextureUVCoordinates);
}
return model;
@@ -176,6 +190,9 @@ public abstract class RSModelMixin implements RSModel
{
// Animated models are usually a shared Model instance that is global
RSModel rsModel = (RSModel) sharedModel;
rsModel.setVertexNormalsX(rl$vertexNormalsX);
rsModel.setVertexNormalsY(rl$vertexNormalsY);
rsModel.setVertexNormalsZ(rl$vertexNormalsZ);
rsModel.setFaceTextureUVCoordinates(rl$faceTextureUVCoordinates);
}
@@ -217,7 +234,7 @@ public abstract class RSModelMixin implements RSModel
for (int i = 0; i < frame.getTransformCount(); i++)
{
int type = frame.getTransformTypes()[i];
this.animate(skin.getTypes()[type], skin.getList()[type], frame.getTranslatorX()[i],
animate(skin.getTypes()[type], skin.getList()[type], frame.getTranslatorX()[i],
frame.getTranslatorY()[i], frame.getTranslatorZ()[i]);
}
}
@@ -316,10 +333,10 @@ public abstract class RSModelMixin implements RSModel
@Inject
public Shape getConvexHull(int localX, int localY, int orientation, int tileHeight)
{
int[] x2d = new int[this.getVerticesCount()];
int[] y2d = new int[this.getVerticesCount()];
int[] x2d = new int[getVerticesCount()];
int[] y2d = new int[getVerticesCount()];
Perspective.modelToCanvas(client, this.getVerticesCount(), localX, localY, tileHeight, orientation, this.getVerticesX(), this.getVerticesZ(), this.getVerticesY(), x2d, y2d);
Perspective.modelToCanvas(client, getVerticesCount(), localX, localY, tileHeight, orientation, getVerticesX(), getVerticesZ(), getVerticesY(), x2d, y2d);
return Jarvis.convexHull(x2d, y2d);
}
@@ -335,7 +352,7 @@ public abstract class RSModelMixin implements RSModel
@Override
public void setSceneId(int sceneId)
{
this.rl$sceneId = sceneId;
rl$sceneId = sceneId;
}
@Inject
@@ -377,6 +394,114 @@ public abstract class RSModelMixin implements RSModel
@Override
public void setFaceTextureUVCoordinates(float[] faceTextureUVCoordinates)
{
this.rl$faceTextureUVCoordinates = faceTextureUVCoordinates;
rl$faceTextureUVCoordinates = faceTextureUVCoordinates;
}
@Inject
public void vertexNormals()
{
if (rl$vertexNormalsX == null)
{
int verticesCount = getVerticesCount();
rl$vertexNormalsX = new int[verticesCount];
rl$vertexNormalsY = new int[verticesCount];
rl$vertexNormalsZ = new int[verticesCount];
int[] trianglesX = getTrianglesX();
int[] trianglesY = getTrianglesY();
int[] trianglesZ = getTrianglesZ();
int[] verticesX = getVerticesX();
int[] verticesY = getVerticesY();
int[] verticesZ = getVerticesZ();
for (int i = 0; i < getTrianglesCount(); ++i)
{
int var9 = trianglesX[i];
int var10 = trianglesY[i];
int var11 = trianglesZ[i];
int var12 = verticesX[var10] - verticesX[var9];
int var13 = verticesY[var10] - verticesY[var9];
int var14 = verticesZ[var10] - verticesZ[var9];
int var15 = verticesX[var11] - verticesX[var9];
int var16 = verticesY[var11] - verticesY[var9];
int var17 = verticesZ[var11] - verticesZ[var9];
int var18 = var13 * var17 - var16 * var14;
int var19 = var14 * var15 - var17 * var12;
int var20;
for (var20 = var12 * var16 - var15 * var13; var18 > 8192 || var19 > 8192 || var20 > 8192 || var18 < -8192 || var19 < -8192 || var20 < -8192; var20 >>= 1)
{
var18 >>= 1;
var19 >>= 1;
}
int var21 = (int) Math.sqrt(var18 * var18 + var19 * var19 + var20 * var20);
if (var21 <= 0)
{
var21 = 1;
}
var18 = var18 * 256 / var21;
var19 = var19 * 256 / var21;
var20 = var20 * 256 / var21;
rl$vertexNormalsX[var9] += var18;
rl$vertexNormalsY[var9] += var19;
rl$vertexNormalsZ[var9] += var20;
rl$vertexNormalsX[var10] += var18;
rl$vertexNormalsY[var10] += var19;
rl$vertexNormalsZ[var10] += var20;
rl$vertexNormalsX[var11] += var18;
rl$vertexNormalsY[var11] += var19;
rl$vertexNormalsZ[var11] += var20;
}
}
}
@Inject
@Override
public int[] getVertexNormalsX()
{
return rl$vertexNormalsX;
}
@Inject
@Override
public void setVertexNormalsX(int[] vertexNormalsX)
{
rl$vertexNormalsX = vertexNormalsX;
}
@Inject
@Override
public int[] getVertexNormalsY()
{
return rl$vertexNormalsY;
}
@Inject
@Override
public void setVertexNormalsY(int[] vertexNormalsY)
{
rl$vertexNormalsY = vertexNormalsY;
}
@Inject
@Override
public int[] getVertexNormalsZ()
{
return rl$vertexNormalsZ;
}
@Inject
@Override
public void setVertexNormalsZ(int[] vertexNormalsZ)
{
rl$vertexNormalsZ = vertexNormalsZ;
}
}

View File

@@ -24,10 +24,17 @@
*/
package net.runelite.mixins;
import java.util.HashSet;
import java.util.Set;
import static net.runelite.api.Constants.ROOF_FLAG_BETWEEN;
import static net.runelite.api.Constants.ROOF_FLAG_DESTINATION;
import static net.runelite.api.Constants.ROOF_FLAG_HOVERED;
import static net.runelite.api.Constants.ROOF_FLAG_POSITION;
import net.runelite.api.Perspective;
import net.runelite.api.Tile;
import net.runelite.api.SceneTileModel;
import net.runelite.api.SceneTilePaint;
import net.runelite.api.Tile;
import net.runelite.api.coords.LocalPoint;
import net.runelite.api.coords.WorldPoint;
import net.runelite.api.hooks.DrawCallbacks;
import net.runelite.api.mixins.Copy;
@@ -37,11 +44,13 @@ import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Replace;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSNode;
import net.runelite.rs.api.RSNodeDeque;
import net.runelite.rs.api.RSPlayer;
import net.runelite.rs.api.RSScene;
import net.runelite.rs.api.RSSceneTileModel;
import net.runelite.rs.api.RSTile;
import net.runelite.rs.api.RSTileItem;
import net.runelite.rs.api.RSSceneTileModel;
@Mixin(RSScene.class)
public abstract class RSSceneMixin implements RSScene
@@ -63,18 +72,42 @@ public abstract class RSSceneMixin implements RSScene
@Shadow("Rasterizer3D_colorPalette")
private static int[] colorPalette;
@Inject
private static int[] tmpX = new int[6];
@Shadow("skyboxColor")
static int skyboxColor;
@Inject
private static int[] tmpX = new int[6];
@Inject
private static int[] tmpY = new int[6];
@Inject
private static int rl$drawDistance;
@Inject
private static int rl$roofRemovalMode = 0;
@Inject
private static int[][][] rl$tiles = new int[4][104][104];
@Inject
private static final Set<Integer> rl$tilesToRemove = new HashSet<>();
@Inject
private static int rl$hoverX = -1;
@Inject
private static int rl$hoverY = -1;
@Inject
private static byte[][][] rl$underlayIds;
@Inject
private static byte[][][] rl$overlayIds;
@Inject
private static byte[][][] rl$tileShapes;
@Replace("draw")
void drawScene(int cameraX, int cameraY, int cameraZ, int cameraPitch, int cameraYaw, int plane)
{
@@ -208,6 +241,73 @@ public abstract class RSSceneMixin implements RSScene
client.setTileUpdateCount(0);
if (rl$roofRemovalMode != 0)
{
rl$tilesToRemove.clear();
RSPlayer localPlayer = client.getLocalPlayer();
if (localPlayer != null && (rl$roofRemovalMode & ROOF_FLAG_POSITION) != 0)
{
LocalPoint localLocation = localPlayer.getLocalLocation();
if (localLocation.isInScene())
{
rl$tilesToRemove.add(rl$tiles[client.getPlane()][localLocation.getSceneX()][localLocation.getSceneY()]);
}
}
if (rl$hoverX >= 0 && rl$hoverX < 104 && rl$hoverY >= 0 && rl$hoverY < 104 && (rl$roofRemovalMode & ROOF_FLAG_HOVERED) != 0)
{
rl$tilesToRemove.add(rl$tiles[client.getPlane()][rl$hoverX][rl$hoverY]);
}
LocalPoint localDestinationLocation = client.getLocalDestinationLocation();
if (localDestinationLocation != null && localDestinationLocation.isInScene() && (rl$roofRemovalMode & ROOF_FLAG_DESTINATION) != 0)
{
rl$tilesToRemove.add(rl$tiles[client.getPlane()][localDestinationLocation.getSceneX()][localDestinationLocation.getSceneY()]);
}
if (client.getCameraPitch() < 310 && (rl$roofRemovalMode & ROOF_FLAG_BETWEEN) != 0 && localPlayer != null)
{
int playerX = localPlayer.getX() >> 7;
int playerY = localPlayer.getY() >> 7;
int var29 = client.getCameraX() >> 7;
int var30 = client.getCameraY() >> 7;
if (playerX >= 0 && playerY >= 0 && var29 >= 0 && var30 >= 0 && playerX < 104 && playerY < 104 && var29 < 104 && var30 < 104)
{
int var31 = Math.abs(playerX - var29);
int var32 = Integer.compare(playerX, var29);
int var33 = -Math.abs(playerY - var30);
int var34 = Integer.compare(playerY, var30);
int var35 = var31 + var33;
while (var29 != playerX || var30 != playerY)
{
if (blocking(client.getPlane(), var29, var30))
{
rl$tilesToRemove.add(rl$tiles[client.getPlane()][var29][var30]);
}
int var36 = 2 * var35;
if (var36 >= var33)
{
var35 += var33;
var29 += var32;
}
else
{
var35 += var31;
var30 += var34;
}
}
}
}
}
if (!client.isMenuOpen())
{
rl$hoverY = -1;
rl$hoverX = -1;
}
for (int z = minLevel; z < maxY; ++z)
{
RSTile[][] planeTiles = tiles[z];
@@ -219,22 +319,24 @@ public abstract class RSSceneMixin implements RSScene
RSTile tile = planeTiles[x][y];
if (tile != null)
{
if (tile.getPhysicalLevel() <= plane
&& (isGpu
|| renderArea[x - screenCenterX + DEFAULT_DISTANCE][y - screenCenterZ + DEFAULT_DISTANCE]
|| tileHeights[z][x][y] - cameraY >= 2000))
int var30 = rl$tiles[client.getPlane()][x][y];
if (tile.getPhysicalLevel() > plane && rl$roofRemovalMode == 0
|| !isGpu && !renderArea[x - screenCenterX + DEFAULT_DISTANCE][y - screenCenterZ + DEFAULT_DISTANCE]
&& tileHeights[z][x][y] - cameraY < 2000
|| rl$roofRemovalMode != 0 && client.getPlane() < tile.getPhysicalLevel()
&& var30 != 0 && rl$tilesToRemove.contains(var30))
{
tile.setDraw(false);
tile.setVisible(false);
tile.setWallCullDirection(0);
}
else
{
tile.setDraw(true);
tile.setVisible(true);
tile.setDrawEntities(true);
client.setTileUpdateCount(client.getTileUpdateCount() + 1);
}
else
{
tile.setDraw(false);
tile.setVisible(false);
tile.setWallCullDirection(0);
}
}
}
}
@@ -409,6 +511,15 @@ public abstract class RSSceneMixin implements RSScene
@Replace("drawTileUnderlay")
public void copy$drawTileUnderlay(SceneTilePaint tile, int z, int pitchSin, int pitchCos, int yawSin, int yawCos, int x, int y)
{
byte[][][] tileSettings = client.getTileSettings();
final boolean checkClick = client.isCheckClick();
int tilePlane = z;
if ((tileSettings[1][x][x] & 2) != 0)
{
tilePlane = z - 1;
}
if (!client.isGpu())
{
try
@@ -419,8 +530,12 @@ public abstract class RSSceneMixin implements RSScene
{
client.getLogger().warn("error during tile underlay rendering", ex);
}
if (rl$roofRemovalMode == 0 || !checkClick || client.getPlane() != tilePlane)
{
return;
}
}
final DrawCallbacks drawCallbacks = client.getDrawCallbacks();
@@ -444,8 +559,6 @@ public abstract class RSSceneMixin implements RSScene
final int mouseX2 = client.getMouseX2();
final int mouseY2 = client.getMouseY2();
final boolean checkClick = client.isCheckClick();
int var9;
int var10 = var9 = (x << 7) - cameraX2;
int var11;
@@ -508,6 +621,11 @@ public abstract class RSSceneMixin implements RSScene
if (checkClick && client.containsBounds(mouseX2, mouseY2, ax, bx, cx, ay, by, cy))
{
setTargetTile(x, y);
if (mouseX2 >= client.getViewportXOffset() && mouseX2 < client.getViewportXOffset() + client.getViewportWidth() && mouseY2 >= client.getViewportYOffset() && mouseY2 < client.getViewportYOffset() + client.getViewportHeight())
{
hoverTile(x, y, tilePlane);
}
}
}
@@ -516,6 +634,11 @@ public abstract class RSSceneMixin implements RSScene
if (checkClick && client.containsBounds(mouseX2, mouseY2, dx, cx, bx, dy, cy, by))
{
setTargetTile(x, y);
if (mouseX2 >= client.getViewportXOffset() && mouseX2 < client.getViewportXOffset() + client.getViewportWidth() && mouseY2 >= client.getViewportYOffset() && mouseY2 < client.getViewportYOffset() + client.getViewportHeight())
{
hoverTile(x, y, tilePlane);
}
}
}
@@ -534,11 +657,18 @@ public abstract class RSSceneMixin implements RSScene
@Replace("drawTileOverlay")
public void copy$drawTileOverlay(SceneTileModel tile, int pitchSin, int pitchCos, int yawSin, int yawCos, int tileX, int tileY)
{
Tile rsTile = getTiles()[client.getPlane()][tileX][tileY];
final boolean checkClick = client.isCheckClick();
if (!client.isGpu())
{
copy$drawTileOverlay(tile, pitchSin, pitchCos, yawSin, yawCos, tileX, tileY);
if (rl$roofRemovalMode == 0 || !checkClick || rsTile == null || rsTile.getSceneTileModel() != tile || rsTile.getPhysicalLevel() != client.getPlane())
{
return;
}
}
final DrawCallbacks drawCallbacks = client.getDrawCallbacks();
@@ -560,7 +690,6 @@ public abstract class RSSceneMixin implements RSScene
tile, client.getPlane(), tileX, tileY,
zoom, centerX, centerY);
final boolean checkClick = client.isCheckClick();
if (!checkClick)
{
return;
@@ -624,6 +753,11 @@ public abstract class RSSceneMixin implements RSScene
if (client.containsBounds(mouseX2, mouseY2, y1, y2, y3, x1, x2, x3))
{
setTargetTile(tileX, tileY);
if (rsTile != null && tile == rsTile.getSceneTileModel() && mouseX2 >= client.getViewportXOffset() && mouseX2 < client.getViewportXOffset() + client.getViewportWidth() && mouseY2 >= client.getViewportYOffset() && mouseY2 < client.getViewportYOffset() + client.getViewportHeight())
{
hoverTile(tileX, tileY, rsTile.getPhysicalLevel());
}
break;
}
}
@@ -970,4 +1104,140 @@ public abstract class RSSceneMixin implements RSScene
}
}
}
@Inject
@Override
public void setRoofRemovalMode(int roofRemovalMode)
{
rl$roofRemovalMode = roofRemovalMode;
}
@Inject
@Override
public void generateHouses()
{
rl$tiles = new int[4][104][104];
final Tile[][][] tiles = getTiles();
int var2 = 1;
for (int plane = 0; plane < 4; ++plane)
{
for (int y = 0; y < 104; ++y)
{
for (int x = 0; x < 104; ++x)
{
Tile tile = tiles[plane][x][y];
if (tile != null && rl$tiles[plane][x][y] == 0 && blocking(plane, x, y))
{
iterateDeque(tile, var2);
++var2;
}
}
}
}
}
@Inject
public void iterateDeque(Tile var1, int var2)
{
Tile[][][] tiles = getTiles();
RSNodeDeque tilesDeque = client.getTilesDeque();
tilesDeque.addFirst((RSNode) var1);
RSTile rsTile;
while ((rsTile = (RSTile) tilesDeque.removeLast()) != null)
{
int x = rsTile.getX();
int y = rsTile.getY();
int plane = rsTile.getPlane();
if (rl$tiles[plane][x][y] == 0)
{
if (blocking(plane, x, y))
{
neighbourTile(tilesDeque, tiles, plane, x - 1, y);
neighbourTile(tilesDeque, tiles, plane, x + 1, y);
neighbourTile(tilesDeque, tiles, plane, x, y - 1);
neighbourTile(tilesDeque, tiles, plane, x, y + 1);
neighbourTile(tilesDeque, tiles, plane, x - 1, y - 1);
neighbourTile(tilesDeque, tiles, plane, x + 1, y - 1);
neighbourTile(tilesDeque, tiles, plane, x - 1, y + 1);
neighbourTile(tilesDeque, tiles, plane, x + 1, y + 1);
}
rl$tiles[plane][x][y] = var2;
}
}
}
@Inject
public static boolean blocking(int plane, int x, int y)
{
return (client.getTileSettings()[plane][x][y] & 4) != 0;
}
@Inject
public static void neighbourTile(RSNodeDeque rsNodeDeque, Tile[][][] tiles, int plane, int x, int y)
{
if (x >= 0 && x < 104 && y >= 0 && y < 104)
{
Tile tile = tiles[plane][x][y];
if (tile != null)
{
rsNodeDeque.addFirst((RSNode) tile);
}
}
}
@Inject
public static void hoverTile(int x, int y, int plane)
{
if (plane == client.getPlane() && !client.isMenuOpen())
{
rl$hoverX = x;
rl$hoverY = y;
}
}
@Inject
@Override
public byte[][][] getUnderlayIds()
{
return rl$underlayIds;
}
@Inject
@Override
public void setUnderlayIds(byte[][][] underlayIds)
{
rl$underlayIds = underlayIds;
}
@Inject
@Override
public byte[][][] getOverlayIds()
{
return rl$overlayIds;
}
@Inject
@Override
public void setOverlayIds(byte[][][] overlayIds)
{
rl$overlayIds = overlayIds;
}
@Inject
@Override
public byte[][][] getTileShapes()
{
return rl$tileShapes;
}
@Inject
@Override
public void setTileShapes(byte[][][] tileShapes)
{
rl$tileShapes = tileShapes;
}
}

View File

@@ -243,6 +243,9 @@ public interface RSClient extends RSGameEngine, Client
@Import("combatTargetPlayerIndex")
void setLocalInteractingIndex(int idx);
@Import("Scene_tilesDeque")
RSNodeDeque getTilesDeque();
@Import("groundItems")
RSNodeDeque[][][] getGroundItemDeque();
@@ -1436,4 +1439,16 @@ public interface RSClient extends RSGameEngine, Client
@Import("readStringIntParameters")
RSIterableNodeHashTable readStringIntParameters(RSBuffer buffer, RSIterableNodeHashTable table);
@Import("rndHue")
int getRndHue();
@Import("Tiles_underlays")
byte[][][] getTileUnderlays();
@Import("Tiles_overlays")
byte[][][] getTileOverlays();
@Import("Tiles_shapes")
byte[][][] getTileShapes();
}

View File

@@ -170,5 +170,14 @@ public interface RSModel extends RSRenderable, Model
Shape getConvexHull(int localX, int localY, int orientation, int tileHeight);
float[] getFaceTextureUVCoordinates();
void setFaceTextureUVCoordinates(float[] rl$faceTextureUVCoordinates);
void setFaceTextureUVCoordinates(float[] faceTextureUVCoordinates);
int[] getVertexNormalsX();
void setVertexNormalsX(int[] vertexNormalsX);
int[] getVertexNormalsY();
void setVertexNormalsY(int[] vertexNormalsY);
int[] getVertexNormalsZ();
void setVertexNormalsZ(int[] vertexNormalsZ);
}

View File

@@ -42,4 +42,13 @@ public interface RSModelData extends RSRenderable
@Import("textureRenderTypes")
byte[] getTextureRenderTypes();
@Import("verticesCount")
int getVerticesCount();
@Import("vertexNormals")
RSVertexNormal[] getVertexNormals();
@Import("vertexVertices")
RSVertexNormal[] getVertexVertices();
}

View File

@@ -42,4 +42,7 @@ public interface RSNodeDeque
@Import("addFirst")
void addFirst(RSNode val);
@Import("removeLast")
RSNode removeLast();
}

View File

@@ -0,0 +1,3 @@
package net.runelite.rs.api;
public interface RSOAuthTokens {}

View File

@@ -55,4 +55,13 @@ public interface RSScene extends Scene
@Import("removeGameObject")
void removeGameObject(GameObject gameObject);
byte[][][] getUnderlayIds();
void setUnderlayIds(byte[][][] underlayIds);
byte[][][] getOverlayIds();
void setOverlayIds(byte[][][] overlayIds);
byte[][][] getTileShapes();
void setTileShapes(byte[][][] tileShapes);
}

View File

@@ -1,3 +1,15 @@
package net.runelite.rs.api;
public interface RSVertexNormal {}
import net.runelite.mapping.Import;
public interface RSVertexNormal
{
@Import("x")
int getX();
@Import("y")
int getY();
@Import("z")
int getZ();
}

View File

@@ -1860,9 +1860,9 @@ public final class Client extends GameEngine implements Usernamed, OAuthTokens {
class1.playPcmPlayers();
Tiles.Tiles_minPlane = 99;
class6.field13 = new byte[4][104][104];
Tiles.field974 = new byte[4][104][104];
Tiles.field978 = new byte[4][104][104];
class6.Tiles_underlays = new byte[4][104][104];
Tiles.Tiles_overlays = new byte[4][104][104];
Tiles.Tiles_shapes = new byte[4][104][104];
Tiles.field977 = new byte[4][104][104];
class113.field1367 = new int[4][105][105];
FloorUnderlayDefinition.field1769 = new byte[4][105][105];
@@ -2233,22 +2233,22 @@ public final class Client extends GameEngine implements Usernamed, OAuthTokens {
}
}
Tiles.field987 += (int)(Math.random() * 5.0D) - 2;
if (Tiles.field987 < -8) {
Tiles.field987 = -8;
Tiles.rndHue += (int)(Math.random() * 5.0D) - 2;
if (Tiles.rndHue < -8) {
Tiles.rndHue = -8;
}
if (Tiles.field987 > 8) {
Tiles.field987 = 8;
if (Tiles.rndHue > 8) {
Tiles.rndHue = 8;
}
Tiles.field988 += (int)(Math.random() * 5.0D) - 2;
if (Tiles.field988 < -16) {
Tiles.field988 = -16;
Tiles.rndLightness += (int)(Math.random() * 5.0D) - 2;
if (Tiles.rndLightness < -16) {
Tiles.rndLightness = -16;
}
if (Tiles.field988 > 16) {
Tiles.field988 = 16;
if (Tiles.rndLightness > 16) {
Tiles.rndLightness = 16;
}
int var59;
@@ -2286,7 +2286,7 @@ public final class Client extends GameEngine implements Usernamed, OAuthTokens {
var16 = var14 + 5;
int var10002;
if (var16 >= 0 && var16 < 104) {
var17 = class6.field13[var53][var16][var15] & 255;
var17 = class6.Tiles_underlays[var53][var16][var15] & 255;
if (var17 > 0) {
FloorUnderlayDefinition var76 = TaskHandler.method2740(var17 - 1);
var10000 = DirectByteArrayCopier.Tiles_hue;
@@ -2303,7 +2303,7 @@ public final class Client extends GameEngine implements Usernamed, OAuthTokens {
var17 = var14 - 5;
if (var17 >= 0 && var17 < 104) {
var59 = class6.field13[var53][var17][var15] & 255;
var59 = class6.Tiles_underlays[var53][var17][var15] & 255;
if (var59 > 0) {
FloorUnderlayDefinition var77 = TaskHandler.method2740(var59 - 1);
var10000 = DirectByteArrayCopier.Tiles_hue;
@@ -2350,8 +2350,8 @@ public final class Client extends GameEngine implements Usernamed, OAuthTokens {
Tiles.Tiles_minPlane = var53;
}
var23 = class6.field13[var53][var14][var61] & 255;
var24 = Tiles.field974[var53][var14][var61] & 255;
var23 = class6.Tiles_underlays[var53][var14][var61] & 255;
var24 = Tiles.Tiles_overlays[var53][var14][var61] & 255;
if (var23 > 0 || var24 > 0) {
var25 = Tiles.Tiles_heights[var53][var14][var61];
var26 = Tiles.Tiles_heights[var53][var14 + 1][var61];
@@ -2368,8 +2368,8 @@ public final class Client extends GameEngine implements Usernamed, OAuthTokens {
var36 = var16 / var60;
var37 = var17 / var60;
var33 = PlatformInfo.hslToRgb(var35, var36, var37);
var35 = var35 + Tiles.field987 & 255;
var37 += Tiles.field988;
var35 = var35 + Tiles.rndHue & 255;
var37 += Tiles.rndLightness;
if (var37 < 0) {
var37 = 0;
} else if (var37 > 255) {
@@ -2382,7 +2382,7 @@ public final class Client extends GameEngine implements Usernamed, OAuthTokens {
FloorOverlayDefinition var63;
if (var53 > 0) {
boolean var79 = true;
if (var23 == 0 && Tiles.field978[var53][var14][var61] != 0) {
if (var23 == 0 && Tiles.Tiles_shapes[var53][var14][var61] != 0) {
var79 = false;
}
@@ -2423,7 +2423,7 @@ public final class Client extends GameEngine implements Usernamed, OAuthTokens {
if (var24 == 0) {
var72.addTile(var53, var14, var61, 0, 0, -1, var25, var26, var27, var28, WorldMapCacheName.method3873(var33, var29), WorldMapCacheName.method3873(var33, var30), WorldMapCacheName.method3873(var33, var62), WorldMapCacheName.method3873(var33, var32), 0, 0, 0, 0, var35, 0);
} else {
var36 = Tiles.field978[var53][var14][var61] + 1;
var36 = Tiles.Tiles_shapes[var53][var14][var61] + 1;
byte var80 = Tiles.field977[var53][var14][var61];
var39 = var24 - 1;
FloorOverlayDefinition var66 = (FloorOverlayDefinition)FloorOverlayDefinition.FloorOverlayDefinition_cached.get((long)var39);
@@ -2451,8 +2451,8 @@ public final class Client extends GameEngine implements Usernamed, OAuthTokens {
var43 = -2;
} else {
var42 = PlatformInfo.hslToRgb(var63.hue, var63.saturation, var63.lightness);
var44 = var63.hue + Tiles.field987 & 255;
var45 = var63.lightness + Tiles.field988;
var44 = var63.hue + Tiles.rndHue & 255;
var45 = var63.lightness + Tiles.rndLightness;
if (var45 < 0) {
var45 = 0;
} else if (var45 > 255) {
@@ -2468,8 +2468,8 @@ public final class Client extends GameEngine implements Usernamed, OAuthTokens {
}
if (var63.secondaryRgb != -1) {
var45 = var63.secondaryHue + Tiles.field987 & 255;
var46 = var63.secondaryLightness + Tiles.field988;
var45 = var63.secondaryHue + Tiles.rndHue & 255;
var46 = var63.secondaryLightness + Tiles.rndLightness;
if (var46 < 0) {
var46 = 0;
} else if (var46 > 255) {
@@ -2494,9 +2494,9 @@ public final class Client extends GameEngine implements Usernamed, OAuthTokens {
}
}
class6.field13[var53] = null;
Tiles.field974[var53] = null;
Tiles.field978[var53] = null;
class6.Tiles_underlays[var53] = null;
Tiles.Tiles_overlays[var53] = null;
Tiles.Tiles_shapes[var53] = null;
Tiles.field977[var53] = null;
FloorUnderlayDefinition.field1769[var53] = null;
}
@@ -2727,9 +2727,9 @@ public final class Client extends GameEngine implements Usernamed, OAuthTokens {
HealthBarUpdate.updateGameState(30);
class1.playPcmPlayers();
class6.field13 = null;
Tiles.field974 = null;
Tiles.field978 = null;
class6.Tiles_underlays = null;
Tiles.Tiles_overlays = null;
Tiles.Tiles_shapes = null;
Tiles.field977 = null;
class113.field1367 = null;
FloorUnderlayDefinition.field1769 = null;

View File

@@ -106,7 +106,8 @@ public class ModelData extends Renderable {
@ObfuscatedSignature(
descriptor = "[Lhc;"
)
VertexNormal[] field2257;
@Export("vertexVertices")
VertexNormal[] vertexVertices;
@ObfuscatedName("ad")
@Export("ambient")
public short ambient;
@@ -375,7 +376,7 @@ public class ModelData extends Renderable {
this.faceLabelsAlpha = var1.faceLabelsAlpha;
this.vertexNormals = var1.vertexNormals;
this.faceNormals = var1.faceNormals;
this.field2257 = var1.field2257;
this.vertexVertices = var1.vertexVertices;
this.ambient = var1.ambient;
this.contrast = var1.contrast;
}
@@ -1386,7 +1387,7 @@ public class ModelData extends Renderable {
@Export("invalidate")
void invalidate() {
this.vertexNormals = null;
this.field2257 = null;
this.vertexVertices = null;
this.faceNormals = null;
this.isBoundsCalculated = false;
}
@@ -1542,24 +1543,24 @@ public class ModelData extends Renderable {
}
} else {
int var15 = this.faceColors[var16] & '\uffff';
if (this.field2257 != null && this.field2257[this.indices1[var16]] != null) {
var13 = this.field2257[this.indices1[var16]];
if (this.vertexVertices != null && this.vertexVertices[this.indices1[var16]] != null) {
var13 = this.vertexVertices[this.indices1[var16]];
} else {
var13 = this.vertexNormals[this.indices1[var16]];
}
var14 = (var4 * var13.y + var5 * var13.z + var3 * var13.x) / (var7 * var13.magnitude) + var1;
var8.faceColors1[var16] = method3974(var15, var14);
if (this.field2257 != null && this.field2257[this.indices2[var16]] != null) {
var13 = this.field2257[this.indices2[var16]];
if (this.vertexVertices != null && this.vertexVertices[this.indices2[var16]] != null) {
var13 = this.vertexVertices[this.indices2[var16]];
} else {
var13 = this.vertexNormals[this.indices2[var16]];
}
var14 = (var4 * var13.y + var5 * var13.z + var3 * var13.x) / (var7 * var13.magnitude) + var1;
var8.faceColors2[var16] = method3974(var15, var14);
if (this.field2257 != null && this.field2257[this.indices3[var16]] != null) {
var13 = this.field2257[this.indices3[var16]];
if (this.vertexVertices != null && this.vertexVertices[this.indices3[var16]] != null) {
var13 = this.vertexVertices[this.indices3[var16]];
} else {
var13 = this.vertexNormals[this.indices3[var16]];
}
@@ -1577,24 +1578,24 @@ public class ModelData extends Renderable {
var8.faceColors3[var16] = -2;
}
} else {
if (this.field2257 != null && this.field2257[this.indices1[var16]] != null) {
var13 = this.field2257[this.indices1[var16]];
if (this.vertexVertices != null && this.vertexVertices[this.indices1[var16]] != null) {
var13 = this.vertexVertices[this.indices1[var16]];
} else {
var13 = this.vertexNormals[this.indices1[var16]];
}
var14 = (var4 * var13.y + var5 * var13.z + var3 * var13.x) / (var7 * var13.magnitude) + var1;
var8.faceColors1[var16] = method3975(var14);
if (this.field2257 != null && this.field2257[this.indices2[var16]] != null) {
var13 = this.field2257[this.indices2[var16]];
if (this.vertexVertices != null && this.vertexVertices[this.indices2[var16]] != null) {
var13 = this.vertexVertices[this.indices2[var16]];
} else {
var13 = this.vertexNormals[this.indices2[var16]];
}
var14 = (var4 * var13.y + var5 * var13.z + var3 * var13.x) / (var7 * var13.magnitude) + var1;
var8.faceColors2[var16] = method3975(var14);
if (this.field2257 != null && this.field2257[this.indices3[var16]] != null) {
var13 = this.field2257[this.indices3[var16]];
if (this.vertexVertices != null && this.vertexVertices[this.indices3[var16]] != null) {
var13 = this.vertexVertices[this.indices3[var16]];
} else {
var13 = this.vertexNormals[this.indices3[var16]];
}
@@ -1659,22 +1660,22 @@ public class ModelData extends Renderable {
for (int var14 = 0; var14 < var8; ++var14) {
VertexNormal var15 = var1.vertexNormals[var14];
if (var12 == var7[var14] && var13 == var1.verticesZ[var14] && var11 == var1.verticesY[var14] && var15.magnitude != 0) {
if (var0.field2257 == null) {
var0.field2257 = new VertexNormal[var0.verticesCount];
if (var0.vertexVertices == null) {
var0.vertexVertices = new VertexNormal[var0.verticesCount];
}
if (var1.field2257 == null) {
var1.field2257 = new VertexNormal[var8];
if (var1.vertexVertices == null) {
var1.vertexVertices = new VertexNormal[var8];
}
VertexNormal var16 = var0.field2257[var9];
VertexNormal var16 = var0.vertexVertices[var9];
if (var16 == null) {
var16 = var0.field2257[var9] = new VertexNormal(var10);
var16 = var0.vertexVertices[var9] = new VertexNormal(var10);
}
VertexNormal var17 = var1.field2257[var14];
VertexNormal var17 = var1.vertexVertices[var14];
if (var17 == null) {
var17 = var1.field2257[var14] = new VertexNormal(var15);
var17 = var1.vertexVertices[var14] = new VertexNormal(var15);
}
var16.x += var15.x;

View File

@@ -177,13 +177,13 @@ public class StructComposition extends DualNode {
}
if (var7 <= 49) {
Tiles.field974[var1][var2][var3] = var0.readByte();
Tiles.field978[var1][var2][var3] = (byte)((var7 - 2) / 4);
Tiles.Tiles_overlays[var1][var2][var3] = var0.readByte();
Tiles.Tiles_shapes[var1][var2][var3] = (byte)((var7 - 2) / 4);
Tiles.field977[var1][var2][var3] = (byte)(var7 - 2 + var6 & 3);
} else if (var7 <= 81) {
Tiles.Tiles_renderFlags[var1][var2][var3] = (byte)(var7 - 49);
} else {
class6.field13[var1][var2][var3] = (byte)(var7 - 81);
class6.Tiles_underlays[var1][var2][var3] = (byte)(var7 - 81);
}
}
} else {

View File

@@ -21,9 +21,11 @@ public final class Tiles {
@Export("Tiles_minPlane")
static int Tiles_minPlane;
@ObfuscatedName("o")
static byte[][][] field974;
@Export("Tiles_overlays")
static byte[][][] Tiles_overlays;
@ObfuscatedName("g")
static byte[][][] field978;
@Export("Tiles_shapes")
static byte[][][] Tiles_shapes;
@ObfuscatedName("z")
static byte[][][] field977;
@ObfuscatedName("y")
@@ -48,12 +50,14 @@ public final class Tiles {
@ObfuscatedGetter(
intValue = -416490741
)
static int field987;
@Export("rndHue")
static int rndHue;
@ObfuscatedName("i")
@ObfuscatedGetter(
intValue = -2134339611
)
static int field988;
@Export("rndLightness")
static int rndLightness;
@ObfuscatedName("ix")
@ObfuscatedGetter(
intValue = 1521226335
@@ -71,8 +75,8 @@ public final class Tiles {
field984 = new int[]{0, -1, 0, 1};
field985 = new int[]{1, -1, -1, 1};
field973 = new int[]{-1, -1, 1, 1};
field987 = (int)(Math.random() * 17.0D) - 8;
field988 = (int)(Math.random() * 33.0D) - 16;
rndHue = (int)(Math.random() * 17.0D) - 8;
rndLightness = (int)(Math.random() * 33.0D) - 16;
}
@ObfuscatedName("a")

View File

@@ -12,7 +12,8 @@ public enum class6 implements MouseWheel {
field10(0, 0);
@ObfuscatedName("k")
static byte[][][] field13;
@Export("Tiles_underlays")
static byte[][][] Tiles_underlays;
@ObfuscatedName("c")
@ObfuscatedGetter(
intValue = -607968475