debug overlay and others
This commit is contained in:
parent
8038516a66
commit
d629e8fb7b
4 changed files with 115 additions and 67 deletions
|
@ -32,6 +32,7 @@ import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Queue;
|
import java.util.Queue;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
|
@ -144,6 +145,7 @@ import game.window.WCF;
|
||||||
import game.window.Wheel;
|
import game.window.Wheel;
|
||||||
import game.window.WindowEvent;
|
import game.window.WindowEvent;
|
||||||
import game.world.BlockPos;
|
import game.world.BlockPos;
|
||||||
|
import game.world.BoundingBox;
|
||||||
import game.world.Chunk;
|
import game.world.Chunk;
|
||||||
import game.world.Converter;
|
import game.world.Converter;
|
||||||
import game.world.Facing;
|
import game.world.Facing;
|
||||||
|
@ -245,6 +247,7 @@ public class Game implements IThreadListener {
|
||||||
public boolean tileOverlay;
|
public boolean tileOverlay;
|
||||||
public boolean itemCheat;
|
public boolean itemCheat;
|
||||||
public boolean dayCycle = true;
|
public boolean dayCycle = true;
|
||||||
|
public boolean showHud = true;
|
||||||
|
|
||||||
private int leftClickCounter;
|
private int leftClickCounter;
|
||||||
private int rightClickTimer;
|
private int rightClickTimer;
|
||||||
|
@ -745,11 +748,16 @@ public class Game implements IThreadListener {
|
||||||
|
|
||||||
public void renderHud() {
|
public void renderHud() {
|
||||||
this.setupOverlay();
|
this.setupOverlay();
|
||||||
if(this.theWorld != null && this.open == null && this.thirdPersonView == 0) {
|
if(this.theWorld != null && this.open == null && this.thirdPersonView == 0 && this.viewEntity != null) {
|
||||||
Drawing.drawRectColor(this.fb_x / 2 - 1, this.fb_y / 2 - 16, 2, 32,
|
if(this.drawDebug) {
|
||||||
this.pointed != null && this.pointed.type != ObjectType.MISS ? 0xffffffff : 0xffcfcfcf);
|
this.renderWorldDirections((float)Timing.tick_fraction);
|
||||||
Drawing.drawRectColor(this.fb_x / 2 - 16, this.fb_y / 2 - 1, 32, 2,
|
}
|
||||||
this.pointed != null && this.pointed.type != ObjectType.MISS ? 0xffffffff : 0xffcfcfcf);
|
else {
|
||||||
|
Drawing.drawRectColor(this.fb_x / 2 - 1, this.fb_y / 2 - 16, 2, 32,
|
||||||
|
this.pointed != null && this.pointed.type != ObjectType.MISS ? 0xffffffff : 0xffcfcfcf);
|
||||||
|
Drawing.drawRectColor(this.fb_x / 2 - 16, this.fb_y / 2 - 1, 32, 2,
|
||||||
|
this.pointed != null && this.pointed.type != ObjectType.MISS ? 0xffffffff : 0xffcfcfcf);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(this.theWorld != null && this.open == null) {
|
if(this.theWorld != null && this.open == null) {
|
||||||
int selected = // this.getRenderViewEntity() != null && this.getRenderViewEntity().isPlayer() ? 9 : 0,
|
int selected = // this.getRenderViewEntity() != null && this.getRenderViewEntity().isPlayer() ? 9 : 0,
|
||||||
|
@ -926,6 +934,8 @@ public class Game implements IThreadListener {
|
||||||
}
|
}
|
||||||
if(this.open != null)
|
if(this.open != null)
|
||||||
this.open.render();
|
this.open.render();
|
||||||
|
if(Bind.INFO.isDown())
|
||||||
|
this.drawInfo();
|
||||||
if(this.hudOverlay && !(this.open instanceof GuiConsole))
|
if(this.hudOverlay && !(this.open instanceof GuiConsole))
|
||||||
this.drawOverlay();
|
this.drawOverlay();
|
||||||
if(this.drawFps) { // && !(this.open instanceof GuiConsole)
|
if(this.drawFps) { // && !(this.open instanceof GuiConsole)
|
||||||
|
@ -2089,9 +2099,9 @@ public class Game implements IThreadListener {
|
||||||
// public void complete(String[] comp) {
|
// public void complete(String[] comp) {
|
||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
public void infolist(String[] list, int[] data) {
|
// public void infolist(String[] list, int[] data) {
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
|
||||||
public void disconnected(String msg) {
|
public void disconnected(String msg) {
|
||||||
Log.SYSTEM.info("Getrennt: %s", msg);
|
Log.SYSTEM.info("Getrennt: %s", msg);
|
||||||
|
@ -2511,7 +2521,7 @@ public class Game implements IThreadListener {
|
||||||
});
|
});
|
||||||
this.registerDebug(Keysym.U, "HUD umschalten", new DebugRunner() {
|
this.registerDebug(Keysym.U, "HUD umschalten", new DebugRunner() {
|
||||||
public void execute(Keysym key) {
|
public void execute(Keysym key) {
|
||||||
|
Game.this.showHud ^= true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -2936,6 +2946,75 @@ public class Game implements IThreadListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String formatPing(int ping) {
|
||||||
|
TextColor base;
|
||||||
|
if(ping < 0) {
|
||||||
|
base = TextColor.GRAY;
|
||||||
|
}
|
||||||
|
else if(ping < 80) {
|
||||||
|
base = TextColor.DGREEN;
|
||||||
|
}
|
||||||
|
else if(ping < 160) {
|
||||||
|
base = TextColor.GREEN;
|
||||||
|
}
|
||||||
|
else if(ping < 350) {
|
||||||
|
base = TextColor.YELLOW;
|
||||||
|
}
|
||||||
|
else if(ping < 700) {
|
||||||
|
base = TextColor.RED;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
base = TextColor.DRED;
|
||||||
|
}
|
||||||
|
return base + (ping < 10000 ? String.format("%d", ping) + "ms" : String.format("%.1f", ((float)ping) / 1000.0f) + "s");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void drawInfo() {
|
||||||
|
NetHandlerPlayClient netHandler = this.getNetHandler();
|
||||||
|
if(netHandler != null) {
|
||||||
|
Set<Entry<String, Integer>> list = netHandler.getPlayerList();
|
||||||
|
int size = list.size();
|
||||||
|
int w = size > 80 ? 4 : (size > 40 ? 3 : (size > 10 ? 2 : 1));
|
||||||
|
w = Math.min(w, Math.max(1, this.fb_x / 300));
|
||||||
|
int bx = 0;
|
||||||
|
int by = 0;
|
||||||
|
for(Entry<String, Integer> elem : list) {
|
||||||
|
int x = this.fb_x / 2 - (w * 300) / 2 + bx * 300;
|
||||||
|
int y = 10 + by * Font.YGLYPH;
|
||||||
|
Drawing.drawGradient(x, y, 300, Font.YGLYPH, 0x7f404040, 0x7f000000);
|
||||||
|
Drawing.drawText(elem.getKey(), x + 4, y, 0xffffffff);
|
||||||
|
Drawing.drawTextRight(formatPing(elem.getValue()), x + 299, y, 0xffffffff);
|
||||||
|
if(++bx >= w) {
|
||||||
|
bx = 0;
|
||||||
|
++by;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderWorldDirections(float partialTicks) {
|
||||||
|
GlState.enableBlend();
|
||||||
|
GlState.tryBlendFuncSeparate(770, 771, 1, 0);
|
||||||
|
WCF.glLineWidth(1.0F);
|
||||||
|
GlState.disableTexture2D();
|
||||||
|
GlState.depthMask(false);
|
||||||
|
GlState.color(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
|
WCF.glPushMatrix();
|
||||||
|
// WCF.glMatrixMode(5888);
|
||||||
|
// WCF.glLoadIdentity();
|
||||||
|
WCF.glTranslatef(this.fb_x / 2, this.fb_y / 2, 0.0F);
|
||||||
|
this.entityRenderer.rotateCamera(this.viewEntity, partialTicks);
|
||||||
|
// WCF.glScalef(-1.0f, -1.0f, -1.0f);
|
||||||
|
// Drawing.drawRectColor(0, 0, 10, 2, 0xff00ff00);
|
||||||
|
RenderGlobal.drawOutlinedBoundingBox(new BoundingBox(0.0D, 0.0D, 0.0D, 24D, 1D, 1D), 255, 0, 0, 255);
|
||||||
|
RenderGlobal.drawOutlinedBoundingBox(new BoundingBox(0.0D, 0.0D, 0.0D, 1D, 1D, 24D), 0, 0, 255, 255);
|
||||||
|
RenderGlobal.drawOutlinedBoundingBox(new BoundingBox(0.0D, 0.0D, 0.0D, 1D, -20D, 1D), 0, 255, 0, 255);
|
||||||
|
WCF.glPopMatrix();
|
||||||
|
GlState.depthMask(true);
|
||||||
|
GlState.enableTexture2D();
|
||||||
|
GlState.disableBlend();
|
||||||
|
}
|
||||||
|
|
||||||
public void showDirDialog(final String title, final String def, final FileCallback callback) {
|
public void showDirDialog(final String title, final String def, final FileCallback callback) {
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
|
@ -1655,28 +1655,6 @@ private static final Random RANDOM = new Random();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private String formatPing(int ping) {
|
|
||||||
TextColor base;
|
|
||||||
if(ping < 0) {
|
|
||||||
base = TextColor.GRAY;
|
|
||||||
}
|
|
||||||
else if(ping < 80) {
|
|
||||||
base = TextColor.DARK_GREEN;
|
|
||||||
}
|
|
||||||
else if(ping < 160) {
|
|
||||||
base = TextColor.GREEN;
|
|
||||||
}
|
|
||||||
else if(ping < 350) {
|
|
||||||
base = TextColor.YELLOW;
|
|
||||||
}
|
|
||||||
else if(ping < 700) {
|
|
||||||
base = TextColor.RED;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
base = TextColor.DARK_RED;
|
|
||||||
}
|
|
||||||
return base + (ping < 10000 ? String.format("%d", ping) + "ms" : String.format("%.1f", ((float)ping) / 1000.0f) + "s");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void drawPing(int width, int xPos, int yPos, int ping) {
|
private void drawPing(int width, int xPos, int yPos, int ping) {
|
||||||
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
|
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
@ -2030,30 +2008,6 @@ private void renderBossHealth() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void renderWorldDirections(float partialTicks)
|
|
||||||
{
|
|
||||||
if (this.gm.showDebugInfo && this.gm.thirdPersonView == 0 && !this.gm.hideGUI)
|
|
||||||
{
|
|
||||||
Entity entity = this.gm.getRenderViewEntity();
|
|
||||||
GlState.enableBlend();
|
|
||||||
GlState.tryBlendFuncSeparate(770, 771, 1, 0);
|
|
||||||
SKC.glLineWidth(1.0F);
|
|
||||||
GlState.disableTexture2D();
|
|
||||||
GlState.depthMask(false);
|
|
||||||
SKC.glPushMatrix();
|
|
||||||
SKC.glMatrixMode(5888);
|
|
||||||
SKC.glLoadIdentity();
|
|
||||||
this.orientCamera(partialTicks);
|
|
||||||
SKC.glTranslatef(0.0F, entity.getEyeHeight(), 0.0F);
|
|
||||||
RenderGlobal.drawOutlinedBoundingBox(new BoundingBox(0.0D, 0.0D, 0.0D, 0.005D, 1.0E-4D, 1.0E-4D), 255, 0, 0, 255);
|
|
||||||
RenderGlobal.drawOutlinedBoundingBox(new BoundingBox(0.0D, 0.0D, 0.0D, 1.0E-4D, 1.0E-4D, 0.005D), 0, 0, 255, 255);
|
|
||||||
RenderGlobal.drawOutlinedBoundingBox(new BoundingBox(0.0D, 0.0D, 0.0D, 1.0E-4D, 0.0033D, 1.0E-4D), 0, 255, 0, 255);
|
|
||||||
SKC.glPopMatrix();
|
|
||||||
GlState.depthMask(true);
|
|
||||||
GlState.enableTexture2D();
|
|
||||||
GlState.disableBlend();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ package game.network;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import game.Game;
|
import game.Game;
|
||||||
import game.audio.PositionedSound;
|
import game.audio.PositionedSound;
|
||||||
|
@ -1492,14 +1493,14 @@ public class NetHandlerPlayClient extends NetHandler
|
||||||
else
|
else
|
||||||
this.playerList.put(data.getKey(), data.getValue());
|
this.playerList.put(data.getKey(), data.getValue());
|
||||||
}
|
}
|
||||||
String[] list = new String[this.playerList.size()];
|
// String[] list = new String[this.playerList.size()];
|
||||||
int[] data = new int[this.playerList.size()];
|
// int[] data = new int[this.playerList.size()];
|
||||||
int pos = 0;
|
// int pos = 0;
|
||||||
for(Entry<String, Integer> entry : this.playerList.entrySet()) {
|
// for(Entry<String, Integer> entry : this.playerList.entrySet()) {
|
||||||
list[pos] = entry.getKey();
|
// list[pos] = entry.getKey();
|
||||||
data[pos++] = entry.getValue();
|
// data[pos++] = entry.getValue();
|
||||||
}
|
// }
|
||||||
this.gameController.infolist(list, data);
|
// this.gameController.infolist(list, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleKeepAlive(SPacketKeepAlive packetIn)
|
public void handleKeepAlive(SPacketKeepAlive packetIn)
|
||||||
|
@ -1849,8 +1850,8 @@ public class NetHandlerPlayClient extends NetHandler
|
||||||
return this.netManager;
|
return this.netManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public List<Entry<String, Integer>> getPlayerList()
|
public Set<Entry<String, Integer>> getPlayerList()
|
||||||
// {
|
{
|
||||||
// return this.players;
|
return this.playerList.entrySet();
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -551,6 +551,20 @@ public class EntityRenderer {
|
||||||
// this.cloudFog = this.gm.renderGlobal.hasCloudFog(d0, d1, d2, partialTicks);
|
// this.cloudFog = this.gm.renderGlobal.hasCloudFog(d0, d1, d2, partialTicks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void rotateCamera(Entity entity, float partialTicks) {
|
||||||
|
WCF.glRotatef(360.0f - (entity.prevPitch + (entity.rotPitch - entity.prevPitch) * partialTicks), 1.0F, 0.0F, 0.0F);
|
||||||
|
|
||||||
|
if (entity instanceof EntityAnimal)
|
||||||
|
{
|
||||||
|
EntityAnimal entityanimal = (EntityAnimal)entity;
|
||||||
|
WCF.glRotatef(entityanimal.prevHeadYaw + (entityanimal.headYaw - entityanimal.prevHeadYaw) * partialTicks + 180.0F, 0.0F, 1.0F, 0.0F);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
WCF.glRotatef(entity.prevYaw + (entity.rotYaw - entity.prevYaw) * partialTicks + 180.0F, 0.0F, 1.0F, 0.0F);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sets up projection, view effects, camera position/rotation
|
* sets up projection, view effects, camera position/rotation
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue