mirror of
https://github.com/2006-Scape/2006Scape.git
synced 2026-07-07 00:32:06 +00:00
Fix most of the clipping (minor stuff with doors left)
This commit is contained in:
@@ -56,30 +56,17 @@ public class Doors {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean handleDoor(Player player, int id, int x, int y, int z) {
|
public boolean handleDoor(Player player, int id, int x, int y, int z) {
|
||||||
|
|
||||||
Doors d = getDoor(id, x, y, z);
|
Doors d = getDoor(id, x, y, z);
|
||||||
|
|
||||||
if (d == null) {
|
if (d == null) {
|
||||||
if (DoubleDoors.getSingleton().handleDoor(player, id, x, y, z)) {
|
return DoubleDoors.getSingleton().handleDoor(player, id, x, y, z);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo: improvment: if player manage to get to door then open the door.
|
//todo: improvment: if player manage to get to door then open the door.
|
||||||
if(player.distanceToPoint(x, y) > 1) return false;
|
if(player.distanceToPoint(x, y) > 1) return false;
|
||||||
|
|
||||||
/**
|
//Remove clipping for old door (gets added back in placeObject)
|
||||||
* Here we shall remove the clipping from the door
|
Region.removeClipping(x, y, z);
|
||||||
* We can't add the clipping back when it is closed, because we apparently never update the d.open value....
|
|
||||||
*/
|
|
||||||
if(d != null) {
|
|
||||||
if(d.open == 0) {
|
|
||||||
Region.removeClipping(x, y, z);
|
|
||||||
} else {
|
|
||||||
//Region.addClipping(x, y, z, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int xAdjustment = 0, yAdjustment = 0;
|
int xAdjustment = 0, yAdjustment = 0;
|
||||||
if (d.type == 0) {
|
if (d.type == 0) {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import java.util.Scanner;
|
|||||||
import com.rebotted.GameEngine;
|
import com.rebotted.GameEngine;
|
||||||
import com.rebotted.game.objects.Objects;
|
import com.rebotted.game.objects.Objects;
|
||||||
import com.rebotted.game.players.Player;
|
import com.rebotted.game.players.Player;
|
||||||
|
import com.rebotted.world.clip.Region;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -56,6 +57,9 @@ public class DoubleDoors {
|
|||||||
if (doorClicked.doorId > 12000) {
|
if (doorClicked.doorId > 12000) {
|
||||||
return true; //nearly all of these are not opened
|
return true; //nearly all of these are not opened
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Region.removeClipping(x, y, z);
|
||||||
|
|
||||||
if (doorClicked.open == 0) {
|
if (doorClicked.open == 0) {
|
||||||
if (doorClicked.originalFace == 0) {
|
if (doorClicked.originalFace == 0) {
|
||||||
DoubleDoors lowerDoor = getDoor(id - 3, x, y -1, z);
|
DoubleDoors lowerDoor = getDoor(id - 3, x, y -1, z);
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import com.rebotted.game.players.Client;
|
|||||||
import com.rebotted.game.players.Player;
|
import com.rebotted.game.players.Player;
|
||||||
import com.rebotted.game.players.PlayerHandler;
|
import com.rebotted.game.players.PlayerHandler;
|
||||||
import com.rebotted.util.Misc;
|
import com.rebotted.util.Misc;
|
||||||
|
import com.rebotted.world.clip.Region;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Sanity
|
* @author Sanity
|
||||||
@@ -135,6 +136,7 @@ public class ObjectHandler {
|
|||||||
* Creates the object for anyone who is within 60 squares of the object
|
* Creates the object for anyone who is within 60 squares of the object
|
||||||
**/
|
**/
|
||||||
public void placeObject(Objects o) {
|
public void placeObject(Objects o) {
|
||||||
|
Region.addClipping(o.getObjectX(), o.getObjectY(), o.getObjectHeight(), 0);
|
||||||
for (Player p : PlayerHandler.players) {
|
for (Player p : PlayerHandler.players) {
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
Client person = (Client) p;
|
Client person = (Client) p;
|
||||||
|
|||||||
@@ -289,7 +289,7 @@ public class Region {
|
|||||||
return projectileClips[height][x - regionAbsX][y - regionAbsY];
|
return projectileClips[height][x - regionAbsX][y - regionAbsY];
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void addClipping(int x, int y, int height, int shift) {
|
public static void addClipping(int x, int y, int height, int shift) {
|
||||||
int regionX = x >> 3;
|
int regionX = x >> 3;
|
||||||
int regionY = y >> 3;
|
int regionY = y >> 3;
|
||||||
int regionId = (regionX / 8 << 8) + regionY / 8;
|
int regionId = (regionX / 8 << 8) + regionY / 8;
|
||||||
|
|||||||
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user