Rename Region to Scene

This commit is contained in:
Max Weber
2018-07-16 02:39:03 -06:00
parent 10ad7897a8
commit d7473bdb07
34 changed files with 161 additions and 182 deletions

View File

@@ -276,11 +276,9 @@ public interface Client extends GameEngine
int getPlane();
/**
* Gets the current region the local player is in.
*
* @return the region
* Gets the current scene
*/
Region getRegion();
Scene getScene();
/**
* Gets the logged in player instance.
@@ -333,8 +331,7 @@ public interface Client extends GameEngine
* Returns the x-axis base coordinate.
* <p>
* This value is the x-axis world coordinate of tile (0, 0) in
* the current scene (ie. the bottom-left most coordinates in
* the rendered region).
* the current scene (ie. the bottom-left most coordinates in the scene).
*
* @return the base x-axis coordinate
*/
@@ -344,8 +341,7 @@ public interface Client extends GameEngine
* Returns the y-axis base coordinate.
* <p>
* This value is the y-axis world coordinate of tile (0, 0) in
* the current scene (ie. the bottom-left most coordinates in
* the rendered region).
* the current scene (ie. the bottom-left most coordinates in the scene).
*
* @return the base y-axis coordinate
*/
@@ -359,12 +355,11 @@ public interface Client extends GameEngine
int getMouseCurrentButton();
/**
* Gets the currently selected region tile (ie. last right clicked
* tile).
* Gets the currently selected tile (ie. last right clicked tile).
*
* @return the selected region tile
* @return the selected tile
*/
Tile getSelectedRegionTile();
Tile getSelectedSceneTile();
/**
* Checks whether a widget is currently being dragged.

View File

@@ -25,22 +25,22 @@
package net.runelite.api;
/**
* Represents tile collision data for a world region.
* Represents tile collision data for the scene
*/
public interface CollisionData
{
/**
* Gets a 2D array of tile collision flags.
* <p>
* The array covers all tiles in a region (104x104), and the index into
* the array is of format [x][y] where x and y are the tiles region
* The array covers all tiles in the scene (104x104), and the index into
* the array is of format [x][y] where x and y are the tiles scene
* coordinates, respectively.
* <p>
* Collision flags are checked using the bitwise and (&amp;) operator. Flag
* values can be obtained and used with the {@link CollisionDataFlag} class.
*
* @return all collision flags for the tiles in the region
* @see Constants#REGION_SIZE
* @return all collision flags for the tiles in the scene
* @see Constants#SCENE_SIZE
*/
int[][] getFlags();
}

View File

@@ -57,9 +57,9 @@ public class Constants
*/
public static final int CHUNK_SIZE = 8;
/**
* The width and length of a region (13 chunks x 8 tiles).
* The width and length of the scene (13 chunks x 8 tiles).
*/
public static final int REGION_SIZE = 104;
public static final int SCENE_SIZE = 104;
/**
* The max allowed plane by the game.
* <p>

View File

@@ -37,21 +37,21 @@ public interface GameObject extends TileObject
{
/**
* Gets the minimum x and y region coordinate pair for this game object.
* Gets the minimum x and y scene coordinate pair for this game object.
*
* @return the minimum region coordinate
* @return the minimum scene coordinate
*/
Point getRegionMinLocation();
Point getSceneMinLocation();
/**
* Gets the maximum x and y region coordinate pair for this game object.
* Gets the maximum x and y scene coordinate pair for this game object.
* <p>
* This value differs from {@link #getRegionMinLocation()} when the size
* This value differs from {@link #getSceneMinLocation()} when the size
* of the object is more than 1 tile.
*
* @return the minimum region coordinate
* @return the maximum scene coordinate
*/
Point getRegionMaxLocation();
Point getSceneMaxLocation();
/**
* Gets the convex hull of the actors model.

View File

@@ -25,16 +25,14 @@
package net.runelite.api;
/**
* Represents a region of chunks.
* <p>
* A region is an area that contains 8x8 chunks on the map.
* Represents the entire 3D scene
*/
public interface Region
public interface Scene
{
/**
* Gets the tiles in this region.
* Gets the tiles in the scene
*
* @return the regions tile
* @return the tiles in [plane][x][y]
*/
Tile[][][] getTiles();
}

View File

@@ -90,12 +90,11 @@ public interface Tile
WorldPoint getWorldLocation();
/**
* Gets the location coordinate of the tile relative to the current
* region start point.
* Gets the location coordinate of the tile in scene coords
*
* @return the region location
* @return the scene location
*/
Point getRegionLocation();
Point getSceneLocation();
/**
* Gets the local coordinate of the tile.

View File

@@ -81,7 +81,7 @@ public class LocalPoint
int baseX = client.getBaseX();
int baseY = client.getBaseY();
return fromRegion(x - baseX, y - baseY);
return fromScene(x - baseX, y - baseY);
}
/**
@@ -97,18 +97,12 @@ public class LocalPoint
/**
* Gets the coordinate at the center of the passed tile.
* <p>
* The coordinate returned by this method is the true tile location,
* in LocalPoint units, relative to tile (0, 0).
* <p>
* e.g. If the local player is standing on tile 3170, the method returns
* 405823, or 3170 * 128 + 64.
*
* @param x x-axis coordinate of the tile
* @param y y-axis coordinate of the tile
* @param x x-axis coordinate of the tile in Scene coords
* @param y y-axis coordinate of the tile in Scene coords
* @return true coordinate of the tile
*/
public static LocalPoint fromRegion(int x, int y)
public static LocalPoint fromScene(int x, int y)
{
return new LocalPoint(
(x << Perspective.LOCAL_COORD_BITS) + (1 << Perspective.LOCAL_COORD_BITS - 1) - 1,
@@ -121,7 +115,7 @@ public class LocalPoint
*
* @return x-axis coordinate
*/
public int getRegionX()
public int getSceneX()
{
return x >>> Perspective.LOCAL_COORD_BITS;
}
@@ -131,7 +125,7 @@ public class LocalPoint
*
* @return y-axis coordinate
*/
public int getRegionY()
public int getSceneY()
{
return y >>> Perspective.LOCAL_COORD_BITS;
}

View File

@@ -230,8 +230,8 @@ public class WorldArea
LocalPoint lp = LocalPoint.fromWorld(client, x, y);
int startX = lp.getRegionX() + dx;
int startY = lp.getRegionY() + dy;
int startX = lp.getSceneX() + dx;
int startY = lp.getSceneY() + dy;
int checkX = startX + (dx > 0 ? width - 1 : 0);
int checkY = startY + (dy > 0 ? height - 1 : 0);
int endX = startX + width - 1;
@@ -303,7 +303,7 @@ public class WorldArea
for (int y = startY; y <= endY; y++)
{
if ((collisionDataFlags[checkX][y] & xFlags) != 0 ||
!extraCondition.test(WorldPoint.fromRegion(client, checkX, y, plane)))
!extraCondition.test(WorldPoint.fromScene(client, checkX, y, plane)))
{
// Collision while attempting to travel along the x axis
return false;
@@ -334,7 +334,7 @@ public class WorldArea
for (int x = startX; x <= endX; x++)
{
if ((collisionDataFlags[x][checkY] & yFlags) != 0 ||
!extraCondition.test(WorldPoint.fromRegion(client, x, checkY, client.getPlane())))
!extraCondition.test(WorldPoint.fromScene(client, x, checkY, client.getPlane())))
{
// Collision while attempting to travel along the y axis
return false;
@@ -362,7 +362,7 @@ public class WorldArea
if (dx != 0 && dy != 0)
{
if ((collisionDataFlags[checkX][checkY] & xyFlags) != 0 ||
!extraCondition.test(WorldPoint.fromRegion(client, checkX, checkY, client.getPlane())))
!extraCondition.test(WorldPoint.fromScene(client, checkX, checkY, client.getPlane())))
{
// Collision while attempting to travel diagonally
return false;
@@ -374,7 +374,7 @@ public class WorldArea
if (width == 1)
{
if ((collisionDataFlags[checkX][checkY - dy] & xFlags) != 0 &&
extraCondition.test(WorldPoint.fromRegion(client, checkX, startY, client.getPlane())))
extraCondition.test(WorldPoint.fromScene(client, checkX, startY, client.getPlane())))
{
return false;
}
@@ -382,7 +382,7 @@ public class WorldArea
if (height == 1)
{
if ((collisionDataFlags[checkX - dx][checkY] & yFlags) != 0 &&
extraCondition.test(WorldPoint.fromRegion(client, startX, checkY, client.getPlane())))
extraCondition.test(WorldPoint.fromScene(client, startX, checkY, client.getPlane())))
{
return false;
}
@@ -486,10 +486,10 @@ public class WorldArea
LocalPoint lp = LocalPoint.fromWorld(client, x, y);
if (lp == null ||
lp.getRegionX() + dx < 0 || lp.getRegionX() + dy >= Constants.REGION_SIZE ||
lp.getRegionY() + dx < 0 || lp.getRegionY() + dy >= Constants.REGION_SIZE)
lp.getSceneX() + dx < 0 || lp.getSceneX() + dy >= Constants.SCENE_SIZE ||
lp.getSceneY() + dx < 0 || lp.getSceneY() + dy >= Constants.SCENE_SIZE)
{
// NPC is travelling out of region, so collision data isn't available
// NPC is travelling out of the scene, so collision data isn't available
return null;
}
@@ -552,10 +552,10 @@ public class WorldArea
return false;
}
int thisX = sourceLp.getRegionX();
int thisY = sourceLp.getRegionY();
int otherX = targetLp.getRegionX();
int otherY = targetLp.getRegionY();
int thisX = sourceLp.getSceneX();
int thisY = sourceLp.getSceneY();
int otherX = targetLp.getSceneX();
int otherY = targetLp.getSceneY();
int cmpThisX, cmpThisY, cmpOtherX, cmpOtherY;
@@ -611,7 +611,7 @@ public class WorldArea
cmpOtherY = thisY;
}
Tile[][][] tiles = client.getRegion().getTiles();
Tile[][][] tiles = client.getScene().getTiles();
Tile sourceTile = tiles[plane][cmpThisX][cmpThisY];
Tile targetTile = tiles[other.getPlane()][cmpOtherX][cmpOtherY];
if (sourceTile == null || targetTile == null)

View File

@@ -195,15 +195,9 @@ public class WorldPoint
}
/**
* Gets the coordinate of the tile that contains the passed local point.
*
* @param client the client
* @param x the local x-axis coordinate
* @param y the local x-axis coordinate
* @param plane the plane
* @return the tile coordinate containing the local point
* Converts the passed scene coordinates to a world space
*/
public static WorldPoint fromRegion(Client client, int x, int y, int plane)
public static WorldPoint fromScene(Client client, int x, int y, int plane)
{
return new WorldPoint(
x + client.getBaseX(),

View File

@@ -60,9 +60,9 @@ public interface Callbacks
void updateNpcs();
/**
* Called after region is drawn.
* Called after the scene is drawn.
*/
void drawRegion();
void drawScene();
/**
* Called after logic that is drawing 2D objects is processed.

View File

@@ -26,8 +26,9 @@ package net.runelite.api.queries;
import static java.lang.Math.abs;
import net.runelite.api.Client;
import net.runelite.api.Constants;
import net.runelite.api.Query;
import net.runelite.api.Region;
import net.runelite.api.Scene;
import net.runelite.api.Tile;
import net.runelite.api.TileObject;
@@ -38,17 +39,15 @@ import net.runelite.api.coords.WorldPoint;
public abstract class TileObjectQuery<EntityType extends TileObject, QueryType> extends Query<EntityType, QueryType>
{
private static final int REGION_SIZE = 104;
protected List<Tile> getTiles(Client client)
{
List<Tile> tilesList = new ArrayList<>();
Region region = client.getRegion();
Tile[][][] tiles = region.getTiles();
Scene scene = client.getScene();
Tile[][][] tiles = scene.getTiles();
int z = client.getPlane();
for (int x = 0; x < REGION_SIZE; ++x)
for (int x = 0; x < Constants.SCENE_SIZE; ++x)
{
for (int y = 0; y < REGION_SIZE; ++y)
for (int y = 0; y < Constants.SCENE_SIZE; ++y)
{
Tile tile = tiles[z][x][y];
if (tile == null)

View File

@@ -341,7 +341,7 @@ public class Hooks implements Callbacks
}
@Override
public void drawRegion()
public void drawScene()
{
MainBufferProvider bufferProvider = (MainBufferProvider) client.getBufferProvider();
BufferedImage image = (BufferedImage) bufferProvider.getImage();

View File

@@ -67,7 +67,7 @@ import net.runelite.client.events.PluginChanged;
import net.runelite.client.task.Schedule;
import net.runelite.client.task.ScheduledMethod;
import net.runelite.client.task.Scheduler;
import net.runelite.client.util.RegionTileManager;
import net.runelite.client.util.SceneTileManager;
@Singleton
@Slf4j
@@ -91,7 +91,7 @@ public class PluginManager
ScheduledExecutorService executor;
@Inject
RegionTileManager regionTileManager;
SceneTileManager sceneTileManager;
@Setter
boolean isOutdated;
@@ -314,7 +314,7 @@ public class PluginManager
});
log.debug("Plugin {} is now running", plugin.getClass().getSimpleName());
regionTileManager.simulateObjectSpawns(plugin);
sceneTileManager.simulateObjectSpawns(plugin);
eventBus.register(plugin);
schedule(plugin);
eventBus.post(new PluginChanged(plugin, true));

View File

@@ -90,7 +90,7 @@ public class BlastMineRockOverlay extends Overlay
return null;
}
final Tile[][][] tiles = client.getRegion().getTiles();
final Tile[][][] tiles = client.getScene().getTiles();
final Widget viewport = client.getViewportWidget();
for (final BlastMineRock rock : rocks.values())

View File

@@ -49,7 +49,7 @@ import net.runelite.api.ItemComposition;
import net.runelite.api.ItemContainer;
import net.runelite.api.NPC;
import net.runelite.api.Query;
import net.runelite.api.Region;
import net.runelite.api.Scene;
import net.runelite.api.Tile;
import net.runelite.api.coords.LocalPoint;
import net.runelite.api.coords.WorldPoint;
@@ -339,9 +339,9 @@ public class ClueScrollPlugin extends Plugin
if (localLocation != null)
{
final Region region = client.getRegion();
final Tile[][][] tiles = region.getTiles();
final Tile tile = tiles[client.getPlane()][localLocation.getRegionX()][localLocation.getRegionY()];
final Scene scene = client.getScene();
final Tile[][][] tiles = scene.getTiles();
final Tile tile = tiles[client.getPlane()][localLocation.getSceneX()][localLocation.getSceneY()];
objectsToMark = Arrays.stream(tile.getGameObjects())
.filter(object -> object != null && object.getId() == objectId)

View File

@@ -37,6 +37,7 @@ import java.util.List;
import javax.inject.Inject;
import net.runelite.api.Actor;
import net.runelite.api.Client;
import net.runelite.api.Constants;
import net.runelite.api.DecorativeObject;
import net.runelite.api.GameObject;
import net.runelite.api.GraphicsObject;
@@ -50,7 +51,7 @@ import net.runelite.api.Perspective;
import net.runelite.api.Player;
import net.runelite.api.Point;
import net.runelite.api.Projectile;
import net.runelite.api.Region;
import net.runelite.api.Scene;
import net.runelite.api.Tile;
import net.runelite.api.WallObject;
import net.runelite.api.coords.LocalPoint;
@@ -79,7 +80,6 @@ public class DevToolsOverlay extends Overlay
private static final Color PURPLE = new Color(170, 0, 255);
private static final Color GRAY = new Color(158, 158, 158);
private static final int REGION_SIZE = 104;
private static final int MAX_DISTANCE = 2400;
private final Client client;
@@ -191,14 +191,14 @@ public class DevToolsOverlay extends Overlay
private void renderTileObjects(Graphics2D graphics)
{
Region region = client.getRegion();
Tile[][][] tiles = region.getTiles();
Scene scene = client.getScene();
Tile[][][] tiles = scene.getTiles();
int z = client.getPlane();
for (int x = 0; x < REGION_SIZE; ++x)
for (int x = 0; x < Constants.SCENE_SIZE; ++x)
{
for (int y = 0; y < REGION_SIZE; ++y)
for (int y = 0; y < Constants.SCENE_SIZE; ++y)
{
Tile tile = tiles[z][x][y];

View File

@@ -74,14 +74,14 @@ public class LocationOverlay extends Overlay
int[][][] instanceTemplateChunks = client.getInstanceTemplateChunks();
int z = client.getPlane();
int chunkData = instanceTemplateChunks[z][localPoint.getRegionX() / CHUNK_SIZE][localPoint.getRegionY() / CHUNK_SIZE];
int chunkData = instanceTemplateChunks[z][localPoint.getSceneX() / CHUNK_SIZE][localPoint.getSceneY() / CHUNK_SIZE];
int rotation = chunkData >> 1 & 0x3;
int chunkY = (chunkData >> 3 & 0x7FF) * CHUNK_SIZE;
int chunkX = (chunkData >> 14 & 0x3FF) * CHUNK_SIZE;
panelComponent.getChildren().add(LineComponent.builder()
.left("Chunk " + localPoint.getRegionX() / CHUNK_SIZE + "," + localPoint.getRegionY() / CHUNK_SIZE)
.left("Chunk " + localPoint.getSceneX() / CHUNK_SIZE + "," + localPoint.getSceneY() / CHUNK_SIZE)
.right(rotation + " " + chunkX + " " + chunkY)
.build());
}
@@ -97,8 +97,8 @@ public class LocationOverlay extends Overlay
.build());
panelComponent.getChildren().add(LineComponent.builder()
.left("Region")
.right(localPoint.getRegionX() + ", " + localPoint.getRegionY())
.left("Scene")
.right(localPoint.getSceneX() + ", " + localPoint.getSceneY())
.build());
panelComponent.getChildren().add(LineComponent.builder()

View File

@@ -253,7 +253,7 @@ public class DiscordPlugin extends Plugin
final LocalPoint localPoint = client.getLocalPlayer().getLocalLocation();
final int[][][] instanceTemplateChunks = client.getInstanceTemplateChunks();
final int z = client.getPlane();
final int chunkData = instanceTemplateChunks[z][localPoint.getRegionX() / CHUNK_SIZE][localPoint.getRegionY() / CHUNK_SIZE];
final int chunkData = instanceTemplateChunks[z][localPoint.getSceneX() / CHUNK_SIZE][localPoint.getSceneY() / CHUNK_SIZE];
// extract world point from chunk data
final int chunkY = (chunkData >> 3 & 0x7FF) * CHUNK_SIZE;

View File

@@ -53,7 +53,7 @@ import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
import static net.runelite.api.Constants.REGION_SIZE;
import static net.runelite.api.Constants.SCENE_SIZE;
import net.runelite.api.GameState;
import net.runelite.api.Item;
import net.runelite.api.ItemComposition;
@@ -63,7 +63,7 @@ import net.runelite.api.MenuAction;
import net.runelite.api.MenuEntry;
import net.runelite.api.Node;
import net.runelite.api.Player;
import net.runelite.api.Region;
import net.runelite.api.Scene;
import net.runelite.api.Tile;
import net.runelite.api.coords.LocalPoint;
import net.runelite.api.events.ConfigChanged;
@@ -232,16 +232,16 @@ public class GroundItemsPlugin extends Plugin
dirty = false;
final Region region = client.getRegion();
final Tile[][][] tiles = region.getTiles();
final Scene scene = client.getScene();
final Tile[][][] tiles = scene.getTiles();
final int z = client.getPlane();
final LocalPoint from = player.getLocalLocation();
groundItems.clear();
for (int x = 0; x < REGION_SIZE; ++x)
for (int x = 0; x < SCENE_SIZE; ++x)
{
for (int y = 0; y < REGION_SIZE; ++y)
for (int y = 0; y < SCENE_SIZE; ++y)
{
Tile tile = tiles[z][x][y];
if (tile == null)
@@ -369,8 +369,8 @@ public class GroundItemsPlugin extends Plugin
&& event.getType() == MenuAction.GROUND_ITEM_THIRD_OPTION.getId())
{
int itemId = event.getIdentifier();
Region region = client.getRegion();
Tile tile = region.getTiles()[client.getPlane()][event.getActionParam0()][event.getActionParam1()];
Scene scene = client.getScene();
Tile tile = scene.getTiles()[client.getPlane()][event.getActionParam0()][event.getActionParam1()];
ItemLayer itemLayer = tile.getItemLayer();
if (itemLayer == null)

View File

@@ -285,7 +285,7 @@ public class GroundMarkerPlugin extends Plugin
return;
}
Tile target = client.getSelectedRegionTile();
Tile target = client.getSelectedSceneTile();
markTile(target.getLocalLocation());
}
@@ -316,8 +316,8 @@ public class GroundMarkerPlugin extends Plugin
if (client.isInInstancedRegion())
{
// get position in the scene
int sceneX = localPoint.getRegionX();
int sceneY = localPoint.getRegionY();
int sceneX = localPoint.getSceneX();
int sceneY = localPoint.getSceneY();
// get chunk from scene
int chunkX = sceneX / CHUNK_SIZE;

View File

@@ -306,7 +306,7 @@ public class HunterPlugin extends Plugin
{
// Check if all traps are still there, and remove the ones that are not.
Iterator<Map.Entry<WorldPoint, HunterTrap>> it = traps.entrySet().iterator();
Tile[][][] tiles = client.getRegion().getTiles();
Tile[][][] tiles = client.getScene().getTiles();
Instant expire = Instant.now().minus(HunterTrap.TRAP_TIME.multipliedBy(2));
@@ -330,7 +330,7 @@ public class HunterPlugin extends Plugin
continue;
}
Tile tile = tiles[world.getPlane()][local.getRegionX()][local.getRegionY()];
Tile tile = tiles[world.getPlane()][local.getSceneX()][local.getSceneY()];
GameObject[] objects = tile.getGameObjects();
boolean containsBoulder = false;

View File

@@ -72,7 +72,7 @@ class InstanceMapOverlay extends Overlay
private final Client client;
/**
* Saved image of the region, no reason to draw the whole thing every
* Saved image of the scene, no reason to draw the whole thing every
* frame.
*/
private volatile BufferedImage mapImage;
@@ -182,8 +182,8 @@ class InstanceMapOverlay extends Overlay
*/
private Tile[][] getTiles()
{
Tile[][][] regionTiles = client.getRegion().getTiles();
return regionTiles[viewedPlane];
Tile[][][] sceneTiles = client.getScene().getTiles();
return sceneTiles[viewedPlane];
}
/**
@@ -197,8 +197,8 @@ class InstanceMapOverlay extends Overlay
LocalPoint playerLoc = player.getLocalLocation();
Tile[][] tiles = getTiles();
int tileX = playerLoc.getRegionX();
int tileY = (tiles[0].length - 1) - playerLoc.getRegionY(); // flip the y value
int tileX = playerLoc.getSceneX();
int tileY = (tiles[0].length - 1) - playerLoc.getSceneY(); // flip the y value
int x = tileX * TILE_SIZE;
int y = tileY * TILE_SIZE;

View File

@@ -171,7 +171,7 @@ public class KourendLibraryPlugin extends Plugin
{
if (MenuAction.GAME_OBJECT_FIRST_OPTION == menuOpt.getMenuAction() && menuOpt.getMenuTarget().contains("Bookshelf"))
{
lastBookcaseClick = WorldPoint.fromRegion(client, menuOpt.getActionParam(), menuOpt.getWidgetId(), client.getPlane());
lastBookcaseClick = WorldPoint.fromScene(client, menuOpt.getActionParam(), menuOpt.getWidgetId(), client.getPlane());
}
}

View File

@@ -410,7 +410,7 @@ public class RaidsPlugin extends Plugin
private Point findLobbyBase()
{
Tile[][] tiles = client.getRegion().getTiles()[LOBBY_PLANE];
Tile[][] tiles = client.getScene().getTiles()[LOBBY_PLANE];
for (int x = 0; x < SCENE_SIZE; x++)
{
@@ -423,7 +423,7 @@ public class RaidsPlugin extends Plugin
if (tiles[x][y].getWallObject().getId() == NullObjectID.NULL_12231)
{
return tiles[x][y].getRegionLocation();
return tiles[x][y].getSceneLocation();
}
}
}
@@ -447,7 +447,7 @@ public class RaidsPlugin extends Plugin
for (int plane = 3; plane > 1; plane--)
{
tiles = client.getRegion().getTiles()[plane];
tiles = client.getScene().getTiles()[plane];
if (tiles[gridBase.getX() + RaidRoom.ROOM_MAX_SIZE][gridBase.getY()] == null)
{
@@ -510,7 +510,7 @@ public class RaidsPlugin extends Plugin
private RaidRoom determineRoom(Tile base)
{
RaidRoom room = new RaidRoom(base, RaidRoom.Type.EMPTY);
int chunkData = client.getInstanceTemplateChunks()[base.getPlane()][(base.getRegionLocation().getX()) / 8][base.getRegionLocation().getY() / 8];
int chunkData = client.getInstanceTemplateChunks()[base.getPlane()][(base.getSceneLocation().getX()) / 8][base.getSceneLocation().getY() / 8];
InstanceTemplates template = InstanceTemplates.findMatch(chunkData);
if (template == null)

View File

@@ -35,7 +35,7 @@ import javax.inject.Singleton;
import net.runelite.api.Client;
import net.runelite.api.Constants;
import net.runelite.api.GameState;
import net.runelite.api.Region;
import net.runelite.api.Scene;
import net.runelite.api.Tile;
import net.runelite.api.events.DecorativeObjectSpawned;
import net.runelite.api.events.GameObjectSpawned;
@@ -43,19 +43,19 @@ import net.runelite.api.events.GroundObjectSpawned;
import net.runelite.api.events.WallObjectSpawned;
@Singleton
public class RegionTileManager
public class SceneTileManager
{
private final EventBus eventBus = new EventBus();
private final Provider<Client> clientProvider;
@Inject
public RegionTileManager(Provider<Client> clientProvider)
public SceneTileManager(Provider<Client> clientProvider)
{
this.clientProvider = clientProvider;
}
/**
* Iterates over each tile in current region if player is logged in
* Iterates over each tile in the scene if player is logged in
* @param consumer consumer accepting tile as parameter
*/
public void forEachTile(Consumer<Tile> consumer)
@@ -67,14 +67,14 @@ public class RegionTileManager
return;
}
final Region region = client.getRegion();
final Tile[][][] tiles = region.getTiles();
final Scene scene = client.getScene();
final Tile[][][] tiles = scene.getTiles();
for (int z = 0; z < Constants.MAX_Z; ++z)
{
for (int x = 0; x < Constants.REGION_SIZE; ++x)
for (int x = 0; x < Constants.SCENE_SIZE; ++x)
{
for (int y = 0; y < Constants.REGION_SIZE; ++y)
for (int y = 0; y < Constants.SCENE_SIZE; ++y)
{
Tile tile = tiles[z][x][y];

View File

@@ -40,8 +40,8 @@ public abstract class CameraMixin implements RSClient
@Shadow("clientInstance")
static RSClient client;
@Shadow("isDrawingRegion")
static boolean isDrawingRegion;
@Shadow("isDrawingScene")
static boolean isDrawingScene;
@Inject
static boolean pitchRelaxEnabled = false;
@@ -91,13 +91,13 @@ public abstract class CameraMixin implements RSClient
lastPitch = pitch;
}
// All of this is to bypass a check in Region.drawRegion
// All of this is to bypass a check in Scene.drawScene
@FieldHook("pitchSin")
@Inject
static void onPitchSinChanged(int idx)
{
if (pitchRelaxEnabled && isDrawingRegion)
if (pitchRelaxEnabled && isDrawingScene)
{
client.setPitchSin(Perspective.SINE[client.getCameraPitch()]);
}
@@ -108,7 +108,7 @@ public abstract class CameraMixin implements RSClient
@Inject
static void onPitchCosChanged(int idx)
{
if (pitchRelaxEnabled && isDrawingRegion)
if (pitchRelaxEnabled && isDrawingScene)
{
client.setPitchCos(Perspective.COSINE[client.getCameraPitch()]);
}

View File

@@ -34,11 +34,11 @@ import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSNPC;
import net.runelite.rs.api.RSPlayer;
import net.runelite.rs.api.RSProjectile;
import net.runelite.rs.api.RSRegion;
import net.runelite.rs.api.RSScene;
import net.runelite.rs.api.RSRenderable;
@Mixin(RSRegion.class)
public abstract class EntityHiderMixin implements RSRegion
@Mixin(RSScene.class)
public abstract class EntityHiderMixin implements RSScene
{
@Shadow("clientInstance")
private static RSClient client;

View File

@@ -28,7 +28,7 @@ import static net.runelite.api.Perspective.SCENE_SIZE;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSRegion;
import net.runelite.rs.api.RSScene;
import net.runelite.rs.api.RSSpritePixels;
@Mixin(RSClient.class)
@@ -41,7 +41,7 @@ public abstract class MinimapMixin implements RSClient
RSSpritePixels ourSprite = createSpritePixels(new int[512 * 512], 512, 512);
RSSpritePixels theirSprite = getMinimapSprite();
RSRegion region = getRegion();
RSScene scene = getScene();
int[] pixels = ourSprite.getPixels();
byte[][][] tileSettings = getTileSettings();
@@ -58,12 +58,12 @@ public abstract class MinimapMixin implements RSClient
{
if ((tileSettings[z][y][x] & 24) == 0)
{
region.drawTile(pixels, var4, 512, z, y, x);
scene.drawTile(pixels, var4, 512, z, y, x);
}
if (z < 3 && (tileSettings[z + 1][y][x] & 8) != 0)
{
region.drawTile(pixels, var4, 512, z + 1, y, x);
scene.drawTile(pixels, var4, 512, z + 1, y, x);
}
var4 += 4;

View File

@@ -233,17 +233,17 @@ public abstract class RSClientMixin implements RSClient
@Inject
@Override
public Tile getSelectedRegionTile()
public Tile getSelectedSceneTile()
{
int tileX = getSelectedRegionTileX();
int tileY = getSelectedRegionTileY();
int tileX = getSelectedSceneTileX();
int tileY = getSelectedSceneTileY();
if (tileX == -1 || tileY == -1)
{
return null;
}
return getRegion().getTiles()[getPlane()][tileX][tileY];
return getScene().getTiles()[getPlane()][tileX][tileY];
}
@Inject
@@ -590,11 +590,11 @@ public abstract class RSClientMixin implements RSClient
@Nullable
public LocalPoint getLocalDestinationLocation()
{
int regionX = getDestinationX();
int regionY = getDestinationY();
if (regionX != 0 && regionY != 0)
int sceneX = getDestinationX();
int sceneY = getDestinationY();
if (sceneX != 0 && sceneY != 0)
{
return LocalPoint.fromRegion(regionX, regionY);
return LocalPoint.fromScene(sceneX, sceneY);
}
return null;
}
@@ -604,7 +604,7 @@ public abstract class RSClientMixin implements RSClient
public void changeMemoryMode(boolean lowMemory)
{
setLowMemory(lowMemory);
setRegionLowMemory(lowMemory);
setSceneLowMemory(lowMemory);
setAudioHighMemory(true);
setObjectCompositionLowDetail(lowMemory);
}

View File

@@ -45,14 +45,14 @@ public abstract class RSGameObjectMixin implements RSGameObject
@Inject
@Override
public Point getRegionMinLocation()
public Point getSceneMinLocation()
{
return new Point(getRelativeX(), getRelativeY());
}
@Inject
@Override
public Point getRegionMaxLocation()
public Point getSceneMaxLocation()
{
return new Point(getOffsetX(), getOffsetY());
}

View File

@@ -36,33 +36,33 @@ import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSDecorativeObject;
import net.runelite.rs.api.RSGroundObject;
import net.runelite.rs.api.RSItemLayer;
import net.runelite.rs.api.RSRegion;
import net.runelite.rs.api.RSScene;
import net.runelite.rs.api.RSWallObject;
@Mixin(RSRegion.class)
public abstract class RSRegionMixin implements RSRegion
@Mixin(RSScene.class)
public abstract class RSSceneMixin implements RSScene
{
@Shadow("clientInstance")
private static RSClient client;
@Inject
static boolean isDrawingRegion;
static boolean isDrawingScene;
@Copy("drawRegion")
abstract void rs$drawRegion(int cameraX, int cameraY, int cameraZ, int cameraPitch, int cameraYaw, int plane);
@Copy("drawScene")
abstract void rs$drawScene(int cameraX, int cameraY, int cameraZ, int cameraPitch, int cameraYaw, int plane);
@Replace("drawRegion")
void rl$drawRegion(int cameraX, int cameraY, int cameraZ, int cameraPitch, int cameraYaw, int plane)
@Replace("drawScene")
void rl$drawScene(int cameraX, int cameraY, int cameraZ, int cameraPitch, int cameraYaw, int plane)
{
try
{
isDrawingRegion = true;
rs$drawRegion(cameraX, cameraY, cameraZ, cameraPitch, cameraYaw, plane);
client.getCallbacks().drawRegion();
isDrawingScene = true;
rs$drawScene(cameraX, cameraY, cameraZ, cameraPitch, cameraYaw, plane);
client.getCallbacks().drawScene();
}
finally
{
isDrawingRegion = false;
isDrawingScene = false;
}
}

View File

@@ -87,12 +87,12 @@ public abstract class RSTileMixin implements RSTile
@Override
public WorldPoint getWorldLocation()
{
return WorldPoint.fromRegion(client, getX(), getY(), getPlane());
return WorldPoint.fromScene(client, getX(), getY(), getPlane());
}
@Inject
@Override
public Point getRegionLocation()
public Point getSceneLocation()
{
return new Point(getX(), getY());
}
@@ -101,7 +101,7 @@ public abstract class RSTileMixin implements RSTile
@Override
public LocalPoint getLocalLocation()
{
return LocalPoint.fromRegion(getX(), getY());
return LocalPoint.fromScene(getX(), getY());
}
@FieldHook("wallObject")
@@ -272,7 +272,7 @@ public abstract class RSTileMixin implements RSTile
{
if (client.getGameState() != GameState.LOGGED_IN)
{
// during region loading this gets set to null 104x104 times
// during loading this gets set to null 104x104 times
return;
}
@@ -295,8 +295,8 @@ public abstract class RSTileMixin implements RSTile
int z = this.getPlane();
int[][] collisionDataFlags = collisionData[z].getFlags();
Point p1 = this.getRegionLocation();
Point p2 = other.getRegionLocation();
Point p1 = this.getSceneLocation();
Point p2 = other.getSceneLocation();
if (p1.getX() == p2.getX() && p1.getY() == p2.getY())
{
return true;

View File

@@ -131,11 +131,11 @@ public interface RSClient extends RSGameEngine, Client
@Override
int getMouseCurrentButton();
@Import("selectedRegionTileX")
int getSelectedRegionTileX();
@Import("selectedSceneTileX")
int getSelectedSceneTileX();
@Import("selectedRegionTileY")
int getSelectedRegionTileY();
@Import("selectedSceneTileY")
int getSelectedSceneTileY();
@Import("draggingWidget")
@Override
@@ -165,9 +165,9 @@ public interface RSClient extends RSGameEngine, Client
*/
RSWidget[] getGroup(int groupId);
@Import("region")
@Import("scene")
@Override
RSRegion getRegion();
RSScene getScene();
@Import("localPlayer")
@Override
@@ -460,8 +460,8 @@ public interface RSClient extends RSGameEngine, Client
@Import("lowMemory")
void setLowMemory(boolean lowMemory);
@Import("regionLowMemory")
void setRegionLowMemory(boolean lowMemory);
@Import("sceneLowMemory")
void setSceneLowMemory(boolean lowMemory);
@Import("audioHighMemory")
void setAudioHighMemory(boolean highMemory);

View File

@@ -24,11 +24,11 @@
*/
package net.runelite.rs.api;
import net.runelite.api.Region;
import net.runelite.api.Scene;
import net.runelite.api.Tile;
import net.runelite.mapping.Import;
public interface RSRegion extends Region
public interface RSScene extends Scene
{
@Import("objects")
RSGameObject[] getObjects();