Permalink
Browse files

abandoned wip

  • Loading branch information...
1 parent 0fc7407 commit 78e83a2ff8c28cb6dea606bbdee69ed7632d1ede @lahwran committed Sep 14, 2011
@@ -809,7 +809,7 @@ else if (this.zoom == 2)
minimap.menu.error = "Zoom Level: (4.0x)";
}
}
- minimap.map.timer = 500;
+ minimap.map.zoom = zoom;
}
minimap.menu.fudge = 20;
}
@@ -5,6 +5,8 @@
import java.awt.image.BufferedImage;
+import org.lwjgl.opengl.GL11;
+
/**
* @author lahwran
*
@@ -34,10 +36,12 @@ public void setRGB(int X, int Y, int color) {
}
public void loadGLImage(ObfHub obfhub) {
- if (hasGLImage) {
+ if (hasGLImage && hasChanged) {
obfhub.deleteTexture(glImage);
}
+ GL11.glPushMatrix();
glImage = obfhub.tex(image);
+ GL11.glPopMatrix();
hasGLImage = true;
}
}
@@ -55,7 +55,7 @@
public int imageSize = 276;
- public int updatedist = 18;
+ public int updatedist = 4;
public final int renderSize = 256;
@@ -90,11 +90,11 @@ private final int wrapIndex(int index, int arraysize) {
return index % arraysize;
}
- private final int toImageX(int worldz) {
+ public final int toImageX(int worldz) {
return wrapIndex((int) (( -(worldz - playerZ)) + originOffsetX), imageSize);
}
- private final int toImageY(int worldx) {
+ public final int toImageY(int worldx) {
return wrapIndex( (int) ((worldx - playerX) + originOffsetY), imageSize);
}
@@ -140,4 +140,23 @@ public double getPlayerZ() {
public boolean isDirty(double newPlayerX, double newPlayerZ) {
return Math.abs(playerX - newPlayerX) > updatedist || Math.abs(playerZ - newPlayerZ) > updatedist || timer > 300;
}
+
+ public float getRenderScale() {
+ float displaydist = (float) (Math.pow(2, zoom) * 32);
+ return (float)imageSize / displaydist;
+ }
+
+ /**
+ * @return
+ */
+ public double getCurrOffsetX(double playerZ) {
+ double wrapped = wrapIndex(((int) -playerZ), imageSize);
+ double leftover = 0;//playerZ - ((double)(int)playerZ);
+ return (wrapped+leftover)/2;
+ }
+ public double getCurrOffsetY(double playerX) {
+ double wrapped = wrapIndex(((int) playerX), imageSize);
+ double leftover = 0;//playerX - ((double)(int)playerX);
+ return (wrapped+leftover)/2;
+ }
}
@@ -53,8 +53,8 @@ private final int getBlockHeight(fd world, int x, int z) {
if (conf.cavemap) {
lm chunk = world.b(x, z);
cmdist.setSeed((x & 0xffff) | ((z & 0xffff) << 16));
- float dist = distance((int)obfhub.playerXCoord(), (int)obfhub.playerZCoord(), x, z);
- int y = (int) obfhub.playerYCoord();
+ float dist = distance((int)obfhub.getPlayerX(), (int)obfhub.getPlayerZ(), x, z);
+ int y = (int) obfhub.getPlayerY();
if (dist > 5)
y -= (cmdist.nextInt((int) (dist)) - ((int) dist / 2));
x &= 0xf;
@@ -111,6 +111,8 @@ private int getBlockColor(fd world, int x, int y, int z) {
int color24 = 0;
if (conf.color && !conf.cavemap) {
+ if (x == (int)map.getPlayerX() && z == (int)map.getPlayerZ())
+ return 0xff0000;
if ((world.f(x, y + 1, z) == ln.s) || (world.f(x, y + 1, z) == ln.t))
color24 = 0xffffff;
else {
@@ -168,7 +170,7 @@ private void mapCalc() {
synchronized (map) {
fd data = obfhub.getWorld();
map.zoom = conf.zoom;
- map.update(obfhub.playerXCoord(), obfhub.playerZCoord());
+ map.update(obfhub.getPlayerX(), obfhub.getPlayerZ());
int startX = (int) (map.getPlayerX() - map.renderOff);
int startZ = (int) (map.getPlayerZ() - map.renderOff);
@@ -196,7 +198,7 @@ private void tryARender() {
if (!obfhub.playerExists())
return;
try {
- if (conf.enabled && !conf.hide && map.isDirty(obfhub.playerXCoord(), obfhub.playerZCoord())) {
+ if (conf.enabled && !conf.hide && map.isDirty(obfhub.getPlayerX(), obfhub.getPlayerZ())) {
mapCalc();
map.timer = 1;
}
Oops, something went wrong.

0 comments on commit 78e83a2

Please sign in to comment.