Merge remote-tracking branch 'runelite/master'

This commit is contained in:
Owain van Brakel
2021-10-29 04:20:30 +02:00
6 changed files with 39 additions and 18 deletions

View File

@@ -53,9 +53,14 @@ public interface Callbacks
void postDeferred(Object event);
/**
* Called each client cycle.
* Called each tick
*/
void clientMainLoop();
void tick();
/**
* Called each frame
*/
void frame();
/**
* Called after receiving update NPCs packet from server.

View File

@@ -180,7 +180,7 @@ public class Hooks implements Callbacks
}
@Override
public void clientMainLoop()
public void tick()
{
if (shouldProcessGameTick)
{
@@ -194,8 +194,6 @@ public class Hooks implements Callbacks
client.setTickCount(tick + 1);
}
eventBus.post(BEFORE_RENDER);
clientThread.invoke();
long now = System.nanoTime();
@@ -225,6 +223,12 @@ public class Hooks implements Callbacks
}
}
@Override
public void frame()
{
eventBus.post(BEFORE_RENDER);
}
/**
* When the world map opens it loads about ~100mb of data into memory, which
* represents about half of the total memory allocated by the client.

View File

@@ -61,18 +61,18 @@ public class BarrowsBrotherSlainOverlay extends OverlayPanel
@Override
public Dimension render(Graphics2D graphics)
{
// Do not display overlay if potential is null/hidden
final Widget potential = client.getWidget(WidgetInfo.BARROWS_POTENTIAL);
if (potential == null || potential.isHidden())
final Widget barrowsBrothers = client.getWidget(WidgetInfo.BARROWS_BROTHERS);
if (barrowsBrothers == null)
{
return null;
}
// Hide original overlay
final Widget barrowsBrothers = client.getWidget(WidgetInfo.BARROWS_BROTHERS);
if (barrowsBrothers != null)
// Hide original brother and potential overlays
barrowsBrothers.setHidden(true);
final Widget potential = client.getWidget(WidgetInfo.BARROWS_POTENTIAL);
if (potential != null)
{
barrowsBrothers.setHidden(true);
potential.setHidden(true);
}

View File

@@ -364,6 +364,7 @@ public class CameraPlugin extends Plugin implements KeyListener, MouseListener
public void onClientTick(ClientTick event)
{
menuHasEntries = hasMenuEntries(client.getMenuEntries());
sliderTooltip = null;
}
@Subscribe
@@ -416,7 +417,6 @@ public class CameraPlugin extends Plugin implements KeyListener, MouseListener
if (sliderTooltip != null)
{
tooltipManager.add(sliderTooltip);
sliderTooltip = null;
}
}

View File

@@ -1437,12 +1437,18 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
@Subscribe
public void onGameStateChanged(GameStateChanged gameStateChanged)
{
if (computeMode == ComputeMode.NONE || gameStateChanged.getGameState() != GameState.LOGGED_IN)
switch (gameStateChanged.getGameState())
{
return;
case LOGGED_IN:
if (computeMode != ComputeMode.NONE)
{
invokeOnMainThread(this::uploadScene);
}
break;
case LOGIN_SCREEN:
// Avoid drawing the last frame's buffer during LOADING after LOGIN_SCREEN
targetBufferOffset = 0;
}
invokeOnMainThread(this::uploadScene);
}
private void uploadScene()

View File

@@ -61,6 +61,7 @@ import net.runelite.api.VarPlayer;
import net.runelite.api.Varbits;
import net.runelite.api.events.AreaSoundEffectPlayed;
import net.runelite.api.events.BeforeRender;
import net.runelite.api.events.ClientTick;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.PostStructComposition;
import net.runelite.api.events.ScriptPreFired;
@@ -918,10 +919,15 @@ public class MusicPlugin extends Plugin
if (sliderTooltip != null)
{
tooltipManager.add(sliderTooltip);
sliderTooltip = null;
}
}
@Subscribe
public void onClientTick(ClientTick event)
{
sliderTooltip = null;
}
@Subscribe
public void onAreaSoundEffectPlayed(AreaSoundEffectPlayed areaSoundEffectPlayed)
{