Skip to content

Commit

Permalink
Fixing triggered lights sometimes not updating
Browse files Browse the repository at this point in the history
  • Loading branch information
Interrupt committed Jan 10, 2019
1 parent afba03a commit fc1c56c
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions Dungeoneer/src/com/interrupt/dungeoneer/gfx/GlRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -2512,16 +2512,17 @@ public FrameBuffer CreateFrameBuffer(FrameBuffer previousBuffer, int width, int
}
}

public void refreshChunksNear(float x, float y, float range) {
if(chunks != null) {
for (int i = 0; i < chunks.size; i++) {
WorldChunk c = chunks.get(i);

float distanceX = Math.abs(x - c.position.x);
float distanceY = Math.abs(y - c.position.z);

if(distanceX <= range && distanceY <= range) {
c.refresh();
public void refreshChunksNear(float xPos, float yPos, float range) {
int startX = ((int)xPos - (int)range) / 17;
int startY = ((int)yPos - (int)range) / 17;
int endX = ((int)xPos + (int)range) / 17;
int endY = ((int)yPos + (int)range) / 17;

for(int x = startX; x <= endX; x++) {
for(int y = startY; y <= endY; y++) {
WorldChunk chunk = GetWorldChunkAt(x * 17, y * 17);
if(chunk != null) {
chunk.refresh();
}
}
}
Expand Down

0 comments on commit fc1c56c

Please sign in to comment.