Skip to content

Commit

Permalink
Merge branch '1.10.22'
Browse files Browse the repository at this point in the history
  • Loading branch information
zeruth committed Feb 15, 2024
2 parents 491d346 + 99172dc commit 855ce2f
Show file tree
Hide file tree
Showing 25 changed files with 229 additions and 88 deletions.
2 changes: 1 addition & 1 deletion cache/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<parent>
<groupId>net.runelite</groupId>
<artifactId>runelite-parent</artifactId>
<version>1.10.21.2</version>
<version>1.10.22</version>
</parent>

<artifactId>cache</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion cache/src/main/java/net/runelite/cache/NpcManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void load() throws IOException
Index index = store.getIndex(IndexType.CONFIGS);
Archive archive = index.getArchive(ConfigType.NPC.getId());

loader.setRev210HeadIcons(archive.getRevision() >= NpcLoader.REV_210_NPC_ARCHIVE_REV);
loader.configureForRevision(archive.getRevision());

byte[] archiveData = storage.loadArchive(archive);
ArchiveFiles files = archive.getFiles(archiveData);
Expand Down
2 changes: 2 additions & 0 deletions cache/src/main/java/net/runelite/cache/ObjectManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ public void load() throws IOException
Index index = store.getIndex(IndexType.CONFIGS);
Archive archive = index.getArchive(ConfigType.OBJECT.getId());

loader.configureForRevision(archive.getRevision());

byte[] archiveData = storage.loadArchive(archive);
ArchiveFiles files = archive.getFiles(archiveData);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ public class NpcDefinition
public int varpIndex = -1;
public boolean isInteractable = true;
public boolean rotationFlag = true;
public boolean isPet;
public boolean isFollower;
public boolean lowPriorityFollowerOps;
public Map<Integer, Object> params;
public int category;
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public class ObjectDefinition
private int sizeY = 1;
private int ambientSoundDistance = 0;
private int[] ambientSoundIds;
private int ambientSoundRetain;
private int offsetX = 0;
private boolean mergeNormals = false;
private int wallOrDoor = -1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import java.util.Map;
import lombok.Data;
import lombok.Value;

@Data
public class SequenceDefinition
Expand All @@ -34,7 +35,7 @@ public class SequenceDefinition
public int[] frameIDs; // top 16 bits are FrameDefinition ids
public int[] chatFrameIds;
public int[] frameLenghts;
public int[] frameSounds;
public Sound[] frameSounds;
public int frameStep = -1;
public int[] interleaveLeave;
public boolean stretches = false;
Expand All @@ -46,8 +47,17 @@ public class SequenceDefinition
public int priority = -1;
public int replyMode = 2;
public int animMayaID = -1;
public Map<Integer, Integer> animMayaFrameSounds;
public Map<Integer, Sound> animMayaFrameSounds;
public int animMayaStart;
public int animMayaEnd;
public boolean[] animMayaMasks;

@Value
public static class Sound
{
public int id;
public int loops;
public int location;
public int retain;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ public class NpcLoader
private int defaultHeadIconArchive = -1;
private boolean rev210HeadIcons = true;

public NpcLoader configureForRevision(int rev)
{
this.rev210HeadIcons = rev >= NpcLoader.REV_210_NPC_ARCHIVE_REV;
return this;
}

public NpcDefinition load(int id, byte[] b)
{
NpcDefinition def = new NpcDefinition(id);
Expand Down Expand Up @@ -259,7 +265,9 @@ else if (opcode == 109)
}
else if (opcode == 111)
{
def.isPet = true;
// removed in 220
def.isFollower = true;
def.lowPriorityFollowerOps = true;
}
else if (opcode == 114)
{
Expand Down Expand Up @@ -317,6 +325,14 @@ else if (opcode == 118)

def.configs[length + 1] = var;
}
else if (opcode == 122)
{
def.isFollower = true;
}
else if (opcode == 123)
{
def.lowPriorityFollowerOps = true;
}
else if (opcode == 249)
{
length = stream.readUnsignedByte();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,26 @@

import java.util.HashMap;
import java.util.Map;
import lombok.Data;
import lombok.experimental.Accessors;
import lombok.extern.slf4j.Slf4j;
import net.runelite.cache.definitions.ObjectDefinition;
import net.runelite.cache.io.InputStream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Accessors(chain = true)
@Data
@Slf4j
public class ObjectLoader
{
private static final Logger logger = LoggerFactory.getLogger(ObjectLoader.class);
public static final int REV_220_OBJ_ARCHIVE_REV = 1673;

private boolean rev220SoundData = true;

public ObjectLoader configureForRevision(int rev)
{
this.rev220SoundData = rev >= REV_220_OBJ_ARCHIVE_REV;
return this;
}

public ObjectDefinition load(int id, byte[] b)
{
Expand Down Expand Up @@ -286,12 +298,20 @@ else if (opcode == 78)
{
def.setAmbientSoundId(is.readUnsignedShort());
def.setAmbientSoundDistance(is.readUnsignedByte());
if (rev220SoundData)
{
def.setAmbientSoundRetain(is.readUnsignedByte());
}
}
else if (opcode == 79)
{
def.setAmbientSoundChangeTicksMin(is.readUnsignedShort());
def.setAmbientSoundChangeTicksMax(is.readUnsignedShort());
def.setAmbientSoundDistance(is.readUnsignedByte());
if (rev220SoundData)
{
def.setAmbientSoundRetain(is.readUnsignedByte());
}
int length = is.readUnsignedByte();
int[] ambientSoundIds = new int[length];

Expand Down Expand Up @@ -381,7 +401,7 @@ else if (opcode == 249)
}
else
{
logger.warn("Unrecognized opcode {}", opcode);
log.warn("Unrecognized opcode {}", opcode);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,27 @@
package net.runelite.cache.definitions.loaders;

import java.util.HashMap;
import lombok.Data;
import lombok.experimental.Accessors;
import lombok.extern.slf4j.Slf4j;
import net.runelite.cache.definitions.SequenceDefinition;
import net.runelite.cache.io.InputStream;

@Accessors(chain = true)
@Data
@Slf4j
public class SequenceLoader
{
public static final int REV_220_SEQ_ARCHIVE_REV = 1141;

private boolean rev220FrameSounds = true;

public SequenceLoader configureForRevision(int rev)
{
this.rev220FrameSounds = rev > REV_220_SEQ_ARCHIVE_REV;
return this;
}

public SequenceDefinition load(int id, byte[] b)
{
SequenceDefinition def = new SequenceDefinition(id);
Expand Down Expand Up @@ -141,11 +157,11 @@ else if (opcode == 12)
else if (opcode == 13)
{
var3 = stream.readUnsignedByte();
def.frameSounds = new int[var3];
def.frameSounds = new SequenceDefinition.Sound[var3];

for (var4 = 0; var4 < var3; ++var4)
{
def.frameSounds[var4] = stream.read24BitInt();
def.frameSounds[var4] = this.readFrameSound(stream);
}
}
else if (opcode == 14)
Expand All @@ -159,9 +175,8 @@ else if (opcode == 15)

for (var4 = 0; var4 < var3; ++var4)
{
int var5 = stream.readUnsignedShort();
int var6 = stream.read24BitInt();
def.animMayaFrameSounds.put(var5, var6);
int frame = stream.readUnsignedShort();
def.animMayaFrameSounds.put(frame, this.readFrameSound(stream));
}
}
else if (opcode == 16)
Expand All @@ -180,5 +195,41 @@ else if (opcode == 17)
def.animMayaMasks[stream.readUnsignedByte()] = true;
}
}
else
{
log.warn("Unrecognized opcode {}", opcode);
}
}

private SequenceDefinition.Sound readFrameSound(InputStream stream)
{
int id;
int loops;
int location;
int retain;
if (!rev220FrameSounds)
{
int bits = stream.read24BitInt();
location = bits & 15;
id = bits >> 8;
loops = bits >> 4 & 7;
retain = 0;
}
else
{
id = stream.readUnsignedShort();
loops = stream.readUnsignedByte();
location = stream.readUnsignedByte();
retain = stream.readUnsignedByte();
}

if (id >= 1 && loops >= 1 && location >= 0 && retain >= 0)
{
return new SequenceDefinition.Sound(id, loops, location, retain);
}
else
{
return null;
}
}
}
1 change: 1 addition & 0 deletions cache/src/test/java/net/runelite/cache/SequenceDumper.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public void extract() throws IOException
for (FSFile file : files.getFiles())
{
SequenceLoader loader = new SequenceLoader();
loader.configureForRevision(archive.getRevision());
SequenceDefinition seq = loader.load(file.getFileId(), file.getContents());

Files.asCharSink(new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()).write(gson.toJson(seq));
Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

<groupId>net.runelite</groupId>
<artifactId>runelite-parent</artifactId>
<version>1.10.21.2</version>
<version>1.10.22</version>
<packaging>pom</packaging>

<name>RuneLite</name>
Expand All @@ -46,8 +46,8 @@
<maven.javadoc.skip>true</maven.javadoc.skip>
<checkstyle.skip>true</checkstyle.skip>
<glslang.path></glslang.path>
<rs.version>220</rs.version>

<rs.version>219</rs.version>
<!--HotLite-->
<kotlin.version>1.9.22</kotlin.version>
</properties>
Expand All @@ -65,7 +65,7 @@
<url>https://github.com/runelite/runelite</url>
<connection>scm:git:git://github.com/runelite/runelite</connection>
<developerConnection>scm:git:[email protected]:runelite/runelite</developerConnection>
<tag>runelite-parent-1.10.21.2</tag>
<tag>runelite-parent-1.10.22</tag>
</scm>

<developers>
Expand Down
2 changes: 1 addition & 1 deletion runelite-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<parent>
<groupId>net.runelite</groupId>
<artifactId>runelite-parent</artifactId>
<version>1.10.21.2</version>
<version>1.10.22</version>
</parent>

<artifactId>runelite-api</artifactId>
Expand Down
1 change: 1 addition & 0 deletions runelite-api/src/main/java/net/runelite/api/Quest.java
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ public enum Quest
HIS_FAITHFUL_SERVANTS(3250, "His Faithful Servants"),
THE_PATH_OF_GLOUPHRIE(3425, "The Path of Glouphrie"),
CHILDREN_OF_THE_SUN(3450, "Children of the Sun"),
BARBARIAN_TRAINING(3451, "Barbarian Training"),
;

@Getter
Expand Down
2 changes: 1 addition & 1 deletion runelite-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<parent>
<groupId>net.runelite</groupId>
<artifactId>runelite-parent</artifactId>
<version>1.10.21.2</version>
<version>1.10.22</version>
</parent>

<artifactId>client</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;
import javax.sound.sampled.FloatControl;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.UnsupportedAudioFileException;
import lombok.Getter;
Expand Down Expand Up @@ -477,6 +478,12 @@ private synchronized void playCustomSound()
}
}

// converts user controlled linear volume ranging 1-100 to exponential decibel gains
float volume = runeLiteConfig.notificationVolume() / 100f;
float gainDB = (float) Math.log10(volume) * 20;
FloatControl gainControl = (FloatControl) clip.getControl(FloatControl.Type.MASTER_GAIN);
gainControl.setValue(gainDB);

// Using loop instead of start + setFramePosition prevents the clip
// from not being played sometimes, presumably a race condition in the
// underlying line driver
Expand Down
Loading

0 comments on commit 855ce2f

Please sign in to comment.