project: merge upstream

This commit is contained in:
Owain van Brakel
2019-10-30 04:22:38 +01:00
parent 13fc1f6554
commit 2655654c9f
23 changed files with 206 additions and 141 deletions

View File

@@ -31,38 +31,37 @@ import lombok.Data;
@Data
public class NpcDefinition
{
public final int id;
public short[] recolorToFind;
public int rotation = 32;
public String name = "null";
public short[] recolorToReplace;
public int size = 1;
public int[] models;
public int[] models_2;
public int stanceAnimation = -1;
public int anInt2165 = -1;
public int tileSpacesOccupied = 1;
public int walkAnimation = -1;
public short[] retextureToReplace;
public int rotate90RightAnimation = -1;
public boolean aBool2170 = true;
public int resizeX = 128;
public int contrast = 0;
public int[] chatheadModels;
public int standingAnimation = -1;
public int rotateLeftAnimation = -1;
public int rotateRightAnimation = -1;
public int walkingAnimation = -1;
public int rotate180Animation = -1;
public int varbitIndex = -1;
public String[] options = new String[5];
public boolean renderOnMinimap = true;
public int combatLevel = -1;
public int rotate90RightAnimation = -1;
public int rotate90LeftAnimation = -1;
public int resizeY = 128;
public boolean hasRenderPriority = false;
public int ambient = 0;
public int headIcon = -1;
public int[] configs;
public short[] recolorToFind;
public short[] recolorToReplace;
public short[] retextureToFind;
public short[] retextureToReplace;
public String[] actions = new String[5];
public boolean isMinimapVisible = true;
public int combatLevel = -1;
public int widthScale = 128;
public int heightScale = 128;
public boolean hasRenderPriority;
public int ambient;
public int contrast;
public int headIcon = -1;
public int rotationSpeed = 32;
public int[] configs;
public int varbitId = -1;
public int varpIndex = -1;
public boolean isClickable = true;
public int anInt2189 = -1;
public boolean aBool2190 = false;
public Map<Integer, Object> params = null;
public boolean isInteractable = true;
public boolean rotationFlag = true;
public boolean isPet;
public Map<Integer, Object> params;
}

View File

@@ -24,13 +24,12 @@
*/
package net.runelite.cache.definitions.loaders;
import java.util.HashMap;
import net.runelite.cache.definitions.NpcDefinition;
import net.runelite.cache.io.InputStream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.HashMap;
public class NpcLoader
{
private static final Logger logger = LoggerFactory.getLogger(NpcLoader.class);
@@ -67,7 +66,6 @@ public class NpcLoader
{
def.models[index] = stream.readUnsignedShort();
}
}
else if (opcode == 2)
{
@@ -75,37 +73,37 @@ public class NpcLoader
}
else if (opcode == 12)
{
def.tileSpacesOccupied = stream.readUnsignedByte();
def.size = stream.readUnsignedByte();
}
else if (opcode == 13)
{
def.stanceAnimation = stream.readUnsignedShort();
def.standingAnimation = stream.readUnsignedShort();
}
else if (opcode == 14)
{
def.walkAnimation = stream.readUnsignedShort();
def.walkingAnimation = stream.readUnsignedShort();
}
else if (opcode == 15)
{
def.anInt2165 = stream.readUnsignedShort();
def.rotateLeftAnimation = stream.readUnsignedShort();
}
else if (opcode == 16)
{
def.anInt2189 = stream.readUnsignedShort();
def.rotateRightAnimation = stream.readUnsignedShort();
}
else if (opcode == 17)
{
def.walkAnimation = stream.readUnsignedShort();
def.walkingAnimation = stream.readUnsignedShort();
def.rotate180Animation = stream.readUnsignedShort();
def.rotate90RightAnimation = stream.readUnsignedShort();
def.rotate90LeftAnimation = stream.readUnsignedShort();
}
else if (opcode >= 30 && opcode < 35)
{
def.options[opcode - 30] = stream.readString();
if (def.options[opcode - 30].equalsIgnoreCase("Hidden"))
def.actions[opcode - 30] = stream.readString();
if (def.actions[opcode - 30].equalsIgnoreCase("Hidden"))
{
def.options[opcode - 30] = null;
def.actions[opcode - 30] = null;
}
}
else if (opcode == 40)
@@ -137,17 +135,17 @@ public class NpcLoader
else if (opcode == 60)
{
length = stream.readUnsignedByte();
def.models_2 = new int[length];
def.chatheadModels = new int[length];
for (index = 0; index < length; ++index)
{
def.models_2[index] = stream.readUnsignedShort();
def.chatheadModels[index] = stream.readUnsignedShort();
}
}
else if (opcode == 93)
{
def.renderOnMinimap = false;
def.isMinimapVisible = false;
}
else if (opcode == 95)
{
@@ -155,11 +153,11 @@ public class NpcLoader
}
else if (opcode == 97)
{
def.resizeX = stream.readUnsignedShort();
def.widthScale = stream.readUnsignedShort();
}
else if (opcode == 98)
{
def.resizeY = stream.readUnsignedShort();
def.heightScale = stream.readUnsignedShort();
}
else if (opcode == 99)
{
@@ -179,18 +177,18 @@ public class NpcLoader
}
else if (opcode == 103)
{
def.rotation = stream.readUnsignedShort();
def.rotationSpeed = stream.readUnsignedShort();
}
else if (opcode == 106)
{
def.varbitIndex = stream.readUnsignedShort();
if ('\uffff' == def.varbitIndex)
def.varbitId = stream.readUnsignedShort();
if (def.varbitId == 65535)
{
def.varbitIndex = -1;
def.varbitId = -1;
}
def.varpIndex = stream.readUnsignedShort();
if ('\uffff' == def.varpIndex)
if (def.varpIndex == 65535)
{
def.varpIndex = -1;
}
@@ -212,26 +210,26 @@ public class NpcLoader
}
else if (opcode == 107)
{
def.isClickable = false;
def.isInteractable = false;
}
else if (opcode == 109)
{
def.aBool2170 = false;
def.rotationFlag = false;
}
else if (opcode == 111)
{
def.aBool2190 = true;
def.isPet = true;
}
else if (opcode == 118)
{
def.varbitIndex = stream.readUnsignedShort();
if ('\uffff' == def.varbitIndex)
def.varbitId = stream.readUnsignedShort();
if (def.varbitId == 65535)
{
def.varbitIndex = -1;
def.varbitId = -1;
}
def.varpIndex = stream.readUnsignedShort();
if ('\uffff' == def.varpIndex)
if (def.varpIndex == 65535)
{
def.varpIndex = -1;
}

View File

@@ -47,45 +47,45 @@ public class NpcSaver
out.writeByte(2);
out.writeString(npc.name);
}
if (npc.tileSpacesOccupied != 1)
if (npc.size != 1)
{
out.writeByte(12);
out.writeByte(npc.tileSpacesOccupied);
out.writeByte(npc.size);
}
if (npc.stanceAnimation != -1)
if (npc.standingAnimation != -1)
{
out.writeByte(13);
out.writeShort(npc.stanceAnimation);
out.writeShort(npc.standingAnimation);
}
if (npc.walkAnimation != -1)
if (npc.walkingAnimation != -1)
{
out.writeByte(14);
out.writeShort(npc.walkAnimation);
out.writeShort(npc.walkingAnimation);
}
if (npc.anInt2165 != -1)
if (npc.rotateLeftAnimation != -1)
{
out.writeByte(15);
out.writeShort(npc.anInt2165);
out.writeShort(npc.rotateLeftAnimation);
}
if (npc.anInt2189 != -1)
if (npc.rotateRightAnimation != -1)
{
out.writeByte(16);
out.writeShort(npc.anInt2189);
out.writeShort(npc.rotateRightAnimation);
}
if (npc.rotate180Animation != -1 || npc.rotate90LeftAnimation != -1 || npc.rotate90RightAnimation != -1)
{
out.writeByte(17);
out.writeShort(npc.walkAnimation);
out.writeShort(npc.walkingAnimation);
out.writeShort(npc.rotate180Animation);
out.writeShort(npc.rotate90RightAnimation);
out.writeShort(npc.rotate90LeftAnimation);
}
for (int i = 0; i < 5; ++i)
{
if (npc.options[i] != null)
if (npc.actions[i] != null)
{
out.writeByte(30 + i);
out.writeString(npc.options[i]);
out.writeString(npc.actions[i]);
}
}
if (npc.recolorToFind != null && npc.recolorToReplace != null)
@@ -108,16 +108,16 @@ public class NpcSaver
out.writeShort(npc.retextureToReplace[i]);
}
}
if (npc.models_2 != null)
if (npc.chatheadModels != null)
{
out.writeByte(60);
out.writeByte(npc.models_2.length);
for (int modelId : npc.models_2)
out.writeByte(npc.chatheadModels.length);
for (int modelId : npc.chatheadModels)
{
out.writeShort(modelId);
}
}
if (!npc.renderOnMinimap)
if (!npc.isMinimapVisible)
{
out.writeByte(93);
}
@@ -127,9 +127,9 @@ public class NpcSaver
out.writeShort(npc.combatLevel);
}
out.writeByte(97);
out.writeShort(npc.resizeX);
out.writeShort(npc.widthScale);
out.writeByte(98);
out.writeShort(npc.resizeY);
out.writeShort(npc.heightScale);
if (npc.hasRenderPriority)
{
out.writeByte(99);
@@ -144,23 +144,23 @@ public class NpcSaver
out.writeShort(npc.headIcon);
}
out.writeByte(103);
out.writeShort(npc.rotation);
if (!npc.isClickable)
out.writeShort(npc.rotationSpeed);
if (!npc.isInteractable)
{
out.writeByte(107);
}
if (!npc.aBool2170)
if (!npc.rotationFlag)
{
out.writeByte(109);
}
if (npc.aBool2190)
if (npc.isPet)
{
out.writeByte(111);
}
if (npc.configs != null)
{
out.writeByte(118);
out.writeShort(npc.varbitIndex);
out.writeShort(npc.varbitId);
out.writeShort(npc.varpIndex);
int[] c = npc.configs;

View File

@@ -51,6 +51,7 @@ import net.runelite.http.api.config.ConfigEntry;
import net.runelite.http.api.config.Configuration;
import org.bson.Document;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@Service
@@ -66,11 +67,12 @@ public class ConfigService
@Autowired
public ConfigService(
MongoClient mongoClient
MongoClient mongoClient,
@Value("${mongo.database}") String databaseName
)
{
MongoDatabase database = mongoClient.getDatabase("config");
MongoDatabase database = mongoClient.getDatabase(databaseName);
MongoCollection<Document> collection = database.getCollection("config");
this.mongoCollection = collection;

View File

@@ -32,6 +32,7 @@ redis:
mongo:
jndiName: java:comp/env/mongodb/runelite
database: runelite
# Twitter client for feed
runelite:

View File

@@ -24,14 +24,25 @@
*/
package net.runelite.api.events;
import javax.annotation.Nullable;
import lombok.Data;
import net.runelite.api.Actor;
@Data
public class AreaSoundEffectPlayed implements Event
{
@Nullable
private final Actor source;
private int soundId;
private int sceneX;
private int sceneY;
private int range;
private int delay;
private boolean consumed;
public void consume()
{
consumed = true;
}
}

View File

@@ -24,11 +24,22 @@
*/
package net.runelite.api.events;
import javax.annotation.Nullable;
import lombok.Data;
import net.runelite.api.Actor;
@Data
public class SoundEffectPlayed implements Event
{
@Nullable
private final Actor source;
private int soundId;
private int delay;
private boolean consumed;
public void consume()
{
consumed = true;
}
}

View File

@@ -1,15 +1,16 @@
/*
* Copyright (c) 2017, Adam <Adam@sigterm.info>
* Copyright (c) 2019, 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.
* 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 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
@@ -24,12 +25,17 @@
*/
package net.runelite.api.events;
import lombok.Value;
@Value
public class VolumeChanged implements Event
{
public static final VolumeChanged INSTANCE = new VolumeChanged();
private VolumeChanged()
public enum Type
{
// noop
MUSIC,
EFFECTS,
AREA
}
private final Type type;
}

View File

@@ -110,6 +110,7 @@ class SoundEffectOverlay extends Overlay
String text =
"Id: " + event.getSoundId() +
" - S: " + (event.getSource() != null ? event.getSource().getName() : "<none>") +
" - L: " + event.getSceneX() + "," + event.getSceneY() +
" - R: " + event.getRange() +
" - D: " + event.getDelay();

View File

@@ -27,7 +27,9 @@ package net.runelite.client.plugins.gpu;
import com.jogamp.opengl.GL4;
import java.io.InputStream;
import java.util.Scanner;
import lombok.extern.slf4j.Slf4j;
@Slf4j
class GLUtil
{
private static final int ERR_LEN = 1024;
@@ -197,6 +199,7 @@ class GLUtil
else
{
String err = glGetShaderInfoLog(gl, shader);
log.info(String.valueOf(program));
throw new ShaderException(err);
}
}

View File

@@ -31,6 +31,16 @@ import net.runelite.client.config.ConfigItem;
@ConfigGroup("music")
public interface MusicConfig extends Config
{
@ConfigItem(
keyName = "muteOtherAreaSounds",
name = "Mute others' area sounds",
description = "Mute area sounds caused from other players"
)
default boolean muteOtherAreaSounds()
{
return false;
}
@ConfigItem(
keyName = "musicVolume",
name = "",
@@ -60,6 +70,7 @@ public interface MusicConfig extends Config
{
return 0;
}
@ConfigItem(
keyName = "soundEffectVolume",
name = "",

View File

@@ -38,13 +38,16 @@ import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Actor;
import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.api.Player;
import net.runelite.api.ScriptID;
import net.runelite.api.SoundEffectID;
import net.runelite.api.SpriteID;
import net.runelite.api.VarClientInt;
import net.runelite.api.VarPlayer;
import net.runelite.api.events.AreaSoundEffectPlayed;
import net.runelite.api.events.ConfigChanged;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.ScriptCallbackEvent;
@@ -138,6 +141,7 @@ public class MusicPlugin extends Plugin
eventBus.subscribe(VarClientIntChanged.class, this, this::onVarClientIntChanged);
eventBus.subscribe(VolumeChanged.class, this, this::onVolumeChanged);
eventBus.subscribe(ScriptCallbackEvent.class, this, this::onScriptCallbackEvent);
eventBus.subscribe(AreaSoundEffectPlayed.class, this, this::onAreaSoundEffectPlayed);
}
private void onGameStateChanged(GameStateChanged gameStateChanged)
@@ -216,6 +220,7 @@ public class MusicPlugin extends Plugin
private void onVolumeChanged(VolumeChanged volumeChanged)
{
log.info(volumeChanged.getType().toString());
applyMusicVolumeConfig();
}
@@ -229,8 +234,6 @@ public class MusicPlugin extends Plugin
private void applyMusicVolumeConfig()
{
log.info("applyMusicVolumeConfig");
int musicVolume = musicConfig.getMusicVolume();
if (musicVolume > 0)
{
@@ -546,4 +549,15 @@ public class MusicPlugin extends Plugin
client.getIntStack()[client.getIntStackSize() - 1] = -1;
}
}
private void onAreaSoundEffectPlayed(AreaSoundEffectPlayed areaSoundEffectPlayed)
{
Actor source = areaSoundEffectPlayed.getSource();
if (source != client.getLocalPlayer()
&& source instanceof Player
&& musicConfig.muteOtherAreaSounds())
{
areaSoundEffectPlayed.consume();
}
}
}

View File

@@ -203,7 +203,7 @@ public interface RaidsConfig extends Config
)
default boolean displayLayoutMessage()
{
return true;
return false;
}
@ConfigTitleSection(

View File

@@ -41,6 +41,7 @@ import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
import net.runelite.api.Client;
import static net.runelite.api.MenuOpcode.RUNELITE_OVERLAY;
import static net.runelite.api.MenuOpcode.RUNELITE_OVERLAY_CONFIG;
import net.runelite.api.SpriteID;
import net.runelite.api.widgets.WidgetInfo;
@@ -72,6 +73,7 @@ public class RaidsOverlay extends Overlay
private static final int SMALL_ICON_SIZE = 21;
private static final int TITLE_COMPONENT_HEIGHT = 20;
private static final int LINE_COMPONENT_HEIGHT = 16;
static final String BROADCAST_ACTION = "Broadcast layout";
private final PanelComponent panelComponent = new PanelComponent();
private final ItemManager itemManager;
private final SpriteManager spriteManager;
@@ -101,6 +103,7 @@ public class RaidsOverlay extends Overlay
this.itemManager = itemManager;
this.spriteManager = spriteManager;
getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Raids overlay"));
getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY, BROADCAST_ACTION, "Raids overlay"));
}
@Override

View File

@@ -550,21 +550,27 @@ public class RaidsPlugin extends Plugin
private void onOverlayMenuClicked(OverlayMenuClicked event)
{
OverlayMenuEntry entry = event.getEntry();
if (entry.getMenuOpcode() == MenuOpcode.RUNELITE_OVERLAY &&
entry.getTarget().equals("Raids party overlay"))
if (entry.getMenuOpcode() == MenuOpcode.RUNELITE_OVERLAY)
{
switch (entry.getOption())
if (entry.getTarget().equals("Raids party overlay"))
{
case RaidsPartyOverlay.PARTY_OVERLAY_RESET:
startingPartyMembers.clear();
updatePartyMembers(true);
missingPartyMembers.clear();
break;
case RaidsPartyOverlay.PARTY_OVERLAY_REFRESH:
updatePartyMembers(true);
break;
default:
break;
switch (entry.getOption())
{
case RaidsPartyOverlay.PARTY_OVERLAY_RESET:
startingPartyMembers.clear();
updatePartyMembers(true);
missingPartyMembers.clear();
break;
case RaidsPartyOverlay.PARTY_OVERLAY_REFRESH:
updatePartyMembers(true);
break;
default:
break;
}
}
else if (entry.getOption().equals(RaidsOverlay.BROADCAST_ACTION) && event.getOverlay() == overlay)
{
sendRaidLayoutMessage();
}
}
}
@@ -670,7 +676,10 @@ public class RaidsPlugin extends Plugin
raid.updateLayout(layout);
RotationSolver.solve(raid.getCombatRooms());
setOverlayStatus(true);
sendRaidLayoutMessage();
if (this.displayLayoutMessage)
{
sendRaidLayoutMessage();
}
Matcher puzzleMatch = PUZZLES.matcher(raid.getFullRotationString());
final List<String> puzzles = new ArrayList<>();
while (puzzleMatch.find())
@@ -709,11 +718,6 @@ public class RaidsPlugin extends Plugin
private void sendRaidLayoutMessage()
{
if (!this.displayLayoutMessage)
{
return;
}
final String layout = getRaid().getLayout().toCodeString();
final String rooms = getRaid().toRoomString();
final String raidData = "[" + layout + "]: " + rooms;

View File

@@ -58,7 +58,7 @@ enum QuestStartLocation
//Members' Quests
ANIMAL_MAGNETISM(Quest.ANIMAL_MAGNETISM, new WorldPoint(3094, 3360, 0)),
ANOTHER_SLICE_OF_HAM(Quest.ANOTHER_SLICE_OF_HAM, new WorldPoint(2799, 5428, 0)),
THE_ASCENT_OF_ARCEUUS(Quest.THE_ASCENT_OF_ARCEUUS, new WorldPoint(1700, 3742, 0)),
THE_ASCENT_OF_ARCEUUS(Quest.THE_ASCENT_OF_ARCEUUS, new WorldPoint(1699, 3742, 0)),
BETWEEN_A_ROCK(Quest.BETWEEN_A_ROCK, new WorldPoint(2823, 10168, 0)),
BIG_CHOMPY_BIRD_HUNTING(Quest.BIG_CHOMPY_BIRD_HUNTING, new WorldPoint(2629, 2981, 0)),
BIOHAZARD(Quest.BIOHAZARD, new WorldPoint(2591, 3335, 0)),
@@ -72,7 +72,7 @@ enum QuestStartLocation
DARKNESS_OF_HALLOWVALE(Quest.DARKNESS_OF_HALLOWVALE, new WorldPoint(3494, 9628, 0)),
DEATH_PLATEAU_TROLL_STRONGHOLD(new Quest[]{Quest.DEATH_PLATEAU, Quest.TROLL_STRONGHOLD}, new WorldPoint(2895, 3528, 0)),
DEATH_TO_THE_DORGESHUUN(Quest.DEATH_TO_THE_DORGESHUUN, new WorldPoint(3316, 9613, 0)),
THE_DEPTHS_OF_DESPAIR(Quest.THE_DEPTHS_OF_DESPAIR, new WorldPoint(1780, 3569, 0)),
THE_DEPTHS_OF_DESPAIR(Quest.THE_DEPTHS_OF_DESPAIR, new WorldPoint(1781, 3570, 0)),
DESERT_TREASURE(Quest.DESERT_TREASURE, new WorldPoint(3177, 3043, 0)),
DEVIOUS_MINDS(Quest.DEVIOUS_MINDS, new WorldPoint(3405, 3492, 0)),
THE_DIG_SITE(Quest.THE_DIG_SITE, new WorldPoint(3363, 3337, 0)),

View File

@@ -74,9 +74,9 @@ bool face_visible(ivec4 vA, ivec4 vB, ivec4 vC, ivec4 position, int cameraYaw, i
vB += position - cameraPos;
vC += position - cameraPos;
ivec3 sA = toScreen(vA.xyz, cameraYaw, cameraPitch, centerX, centerY, zoom);
ivec3 sB = toScreen(vB.xyz, cameraYaw, cameraPitch, centerX, centerY, zoom);
ivec3 sC = toScreen(vC.xyz, cameraYaw, cameraPitch, centerX, centerY, zoom);
vec3 sA = toScreen(vA.xyz, cameraYaw, cameraPitch, centerX, centerY, zoom);
vec3 sB = toScreen(vB.xyz, cameraYaw, cameraPitch, centerX, centerY, zoom);
vec3 sC = toScreen(vC.xyz, cameraYaw, cameraPitch, centerX, centerY, zoom);
return (sA.x - sB.x) * (sC.y - sB.y) - (sC.x - sB.x) * (sA.y - sB.y) > 0;
}

View File

@@ -74,9 +74,9 @@ bool face_visible(ivec4 vA, ivec4 vB, ivec4 vC, ivec4 position, int cameraYaw, i
vB += position - cameraPos;
vC += position - cameraPos;
ivec3 sA = toScreen(vA.xyz, cameraYaw, cameraPitch, centerX, centerY, zoom);
ivec3 sB = toScreen(vB.xyz, cameraYaw, cameraPitch, centerX, centerY, zoom);
ivec3 sC = toScreen(vC.xyz, cameraYaw, cameraPitch, centerX, centerY, zoom);
vec3 sA = toScreen(vA.xyz, cameraYaw, cameraPitch, centerX, centerY, zoom);
vec3 sB = toScreen(vB.xyz, cameraYaw, cameraPitch, centerX, centerY, zoom);
vec3 sC = toScreen(vC.xyz, cameraYaw, cameraPitch, centerX, centerY, zoom);
return (sA.x - sB.x) * (sC.y - sB.y) - (sC.x - sB.x) * (sA.y - sB.y) > 0;
}

View File

@@ -60,9 +60,9 @@ out float fogAmount;
void main() {
ivec3 cameraPos = ivec3(cameraX, cameraY, cameraZ);
ivec3 screenA = toScreen(vPosition[0] - cameraPos, cameraYaw, cameraPitch, centerX, centerY, zoom);
ivec3 screenB = toScreen(vPosition[1] - cameraPos, cameraYaw, cameraPitch, centerX, centerY, zoom);
ivec3 screenC = toScreen(vPosition[2] - cameraPos, cameraYaw, cameraPitch, centerX, centerY, zoom);
vec3 screenA = toScreen(vPosition[0] - cameraPos, cameraYaw, cameraPitch, centerX, centerY, zoom);
vec3 screenB = toScreen(vPosition[1] - cameraPos, cameraYaw, cameraPitch, centerX, centerY, zoom);
vec3 screenC = toScreen(vPosition[2] - cameraPos, cameraYaw, cameraPitch, centerX, centerY, zoom);
if (-screenA.z < 50 || -screenB.z < 50 || -screenC.z < 50) {
// the client does not draw a triangle if any vertex distance is <50

View File

@@ -26,22 +26,22 @@
/*
* Convert a vertex to screen space
*/
ivec3 toScreen(ivec3 vertex, int cameraYaw, int cameraPitch, int centerX, int centerY, int zoom) {
int yawSin = int(65536.0f * sin(cameraYaw * UNIT));
int yawCos = int(65536.0f * cos(cameraYaw * UNIT));
vec3 toScreen(ivec3 vertex, int cameraYaw, int cameraPitch, int centerX, int centerY, int zoom) {
float yawSin = sin(cameraYaw * UNIT);
float yawCos = cos(cameraYaw * UNIT);
int pitchSin = int(65536.0f * sin(cameraPitch * UNIT));
int pitchCos = int(65536.0f * cos(cameraPitch * UNIT));
float pitchSin = sin(cameraPitch * UNIT);
float pitchCos = cos(cameraPitch * UNIT);
int rotatedX = ((vertex.z * yawSin) + (vertex.x * yawCos)) >> 16;
int rotatedZ = ((vertex.z * yawCos) - (vertex.x * yawSin)) >> 16;
float rotatedX = (vertex.z * yawSin) + (vertex.x * yawCos);
float rotatedZ = (vertex.z * yawCos) - (vertex.x * yawSin);
int var13 = ((vertex.y * pitchCos) - (rotatedZ * pitchSin)) >> 16;
int var12 = ((vertex.y * pitchSin) + (rotatedZ * pitchCos)) >> 16;
float var13 = (vertex.y * pitchCos) - (rotatedZ * pitchSin);
float var12 = (vertex.y * pitchSin) + (rotatedZ * pitchCos);
int x = rotatedX * zoom / var12 + centerX;
int y = var13 * zoom / var12 + centerY;
int z = -var12; // in OpenGL depth is negative
float x = rotatedX * zoom / var12 + centerX;
float y = var13 * zoom / var12 + centerY;
float z = -var12; // in OpenGL depth is negative
return ivec3(x, y, z);
return vec3(x, y, z);
}

View File

@@ -1798,7 +1798,8 @@ public abstract class RSClientMixin implements RSClient
int type = client.getVarpDefinition(var0).getType();
if (type == 3 || type == 4 || type == 10)
{
client.getCallbacks().post(VolumeChanged.class, VolumeChanged.INSTANCE);
VolumeChanged volumeChanged = new VolumeChanged(null);
client.getCallbacks().post(VolumeChanged.class, volumeChanged);
}
}
}

View File

@@ -120,7 +120,7 @@ public abstract class SoundEffectMixin implements RSClient
{
// Regular sound effect
SoundEffectPlayed event = new SoundEffectPlayed();
SoundEffectPlayed event = new SoundEffectPlayed(null);
event.setSoundId(client.getQueuedSoundEffectIDs()[soundIndex]);
event.setDelay(client.getQueuedSoundEffectDelays()[soundIndex]);
client.getCallbacks().post(SoundEffectPlayed.class, event);
@@ -133,7 +133,7 @@ public abstract class SoundEffectMixin implements RSClient
int y = (packedLocation >> 8) & 0xFF;
int range = (packedLocation) & 0xFF;
AreaSoundEffectPlayed event = new AreaSoundEffectPlayed();
AreaSoundEffectPlayed event = new AreaSoundEffectPlayed(null);
event.setSoundId(client.getQueuedSoundEffectIDs()[soundIndex]);
event.setSceneX(x);
event.setSceneY(y);

View File

@@ -260,7 +260,7 @@ public class NpcStatsDumper
private static boolean isAttackableNpc(final NpcDefinition n)
{
for (final String s : n.getOptions())
for (final String s : n.getActions())
{
if ("attack".equalsIgnoreCase(s))
{