Merge remote-tracking branch 'origin/master'

This commit is contained in:
Ceikry 2021-03-15 01:12:30 -05:00
commit 08e9b4853a
2 changed files with 44 additions and 24 deletions

View file

@ -18,13 +18,35 @@ public enum FacialExpression {
//Chat heads from oldschool 2009scape? //Chat heads from oldschool 2009scape?
//Maybe for gnomes or dwarves? Chat heads are frozen when used on Human NPCs //Maybe for gnomes or dwarves? Chat heads are frozen when used on Human NPCs
OLD_HAPPY(588), OLD_HAPPY(588),
OLD_CALM_TALK1(589),
OLD_CALM_TALK2(590),
OLD_DEFAULT(591),
OLD_EVIL1(592),
OLD_EVIL2(593),
OLD_NORMAL(594), OLD_NORMAL(594),
OLD_SNEAKY(595), OLD_SNEAKY(595),
OLD_SAD(596), OLD_DISTRESSED(596),
OLD_DISTRESSED2(597),
OLD_ALMOST_CRYING(598),
OLD_BOWS_HEAD_SAD(599),
OLD_DRUNK_LEFT(600),
OLD_DRUNK_RIGHT(601),
OLD_NOT_INTERESTED(602),
OLD_SLEEPY(603),
OLD_PLAIN_EVIL(604),
OLD_LAUGH1(605), OLD_LAUGH1(605),
OLD_LAUGH2(606), OLD_LAUGH2(606),
OLD_LAUGH3(607), OLD_LAUGH3(607),
OLD_LAUGH4(608), //TODO: More OLD_LAUGH4(608),
OLD_EVIL_LAUGH(609),
OLD_SAD(610),
OLD_MORE_SAD(611),
OLD_ON_ONE_HAND(612),
OLD_NEARLY_CRYING(613),
OLD_ANGRY1(614),
OLD_ANGRY2(615),
OLD_ANGRY3(616),
OLD_ANGRY4(617),
//Chatheads from 2009? //Chatheads from 2009?
NOD_YES(9741), NOD_YES(9741),

View file

@ -22,31 +22,29 @@ object MapChunkRenderer {
val last = player.playerFlags.lastViewport val last = player.playerFlags.lastViewport
val updated: MutableList<RegionChunk> = ArrayList() val updated: MutableList<RegionChunk> = ArrayList()
val current = v.chunks val current = v.chunks
if (!Arrays.equals(current, last)) { //don't update if the viewport hasn't changed var sizeX = last.size
var sizeX = last.size for (x in 0 until sizeX) {
for (x in 0 until sizeX) { val sizeY: Int = last[x].size
val sizeY: Int = last[x].size for (y in 0 until sizeY) {
for (y in 0 until sizeY) { val previous = last[x][y] ?: continue
val previous = last[x][y] ?: continue if (!containsChunk(current, previous)) {
if (!containsChunk(current, previous)) { PacketRepository.send(ClearRegionChunk::class.java, ClearChunkContext(player, previous))
PacketRepository.send(ClearRegionChunk::class.java, ClearChunkContext(player, previous)) } else {
} else { updated.add(previous)
updated.add(previous)
}
} }
} }
sizeX = current.size }
for (x in 0 until sizeX) { sizeX = current.size
val sizeY: Int = current[x].size for (x in 0 until sizeX) {
for (y in 0 until sizeY) { val sizeY: Int = current[x].size
val chunk = current[x][y] for (y in 0 until sizeY) {
if (!updated.contains(chunk)) { val chunk = current[x][y]
chunk.synchronize(player) if (!updated.contains(chunk)) {
} else { chunk.synchronize(player)
chunk.update(player) } else {
} chunk.update(player)
last[x][y] = current[x][y]
} }
last[x][y] = current[x][y]
} }
} }
} }