From 517e7d74f91bc68708166f51c8e7def3d484f709 Mon Sep 17 00:00:00 2001 From: Sen Date: Thu, 27 Mar 2025 23:14:26 +0100 Subject: [PATCH] character sizes, .. --- java/src/game/Game.java | 82 ++++++++-- java/src/game/entity/npc/EntityArachnoid.java | 8 +- java/src/game/entity/npc/EntityBloodElf.java | 10 +- .../game/entity/npc/EntityChaosMarine.java | 4 +- .../src/game/entity/npc/EntityCultivator.java | 10 +- java/src/game/entity/npc/EntityDarkMage.java | 10 +- java/src/game/entity/npc/EntityDwarf.java | 10 +- java/src/game/entity/npc/EntityElf.java | 10 +- java/src/game/entity/npc/EntityFireDemon.java | 10 +- java/src/game/entity/npc/EntityFlyingNPC.java | 8 + java/src/game/entity/npc/EntityGargoyle.java | 6 +- java/src/game/entity/npc/EntityGoblin.java | 10 +- java/src/game/entity/npc/EntityHuman.java | 10 +- java/src/game/entity/npc/EntityMage.java | 10 +- java/src/game/entity/npc/EntityMetalhead.java | 10 +- java/src/game/entity/npc/EntityNPC.java | 55 +++++-- java/src/game/entity/npc/EntityOrc.java | 10 +- java/src/game/entity/npc/EntityPrimarch.java | 4 +- java/src/game/entity/npc/EntitySlime.java | 10 +- .../game/entity/npc/EntitySpaceMarine.java | 4 +- java/src/game/entity/npc/EntitySpirit.java | 6 +- java/src/game/entity/npc/EntityTiefling.java | 10 +- java/src/game/entity/npc/EntityUndead.java | 10 +- java/src/game/entity/npc/EntityVampire.java | 10 +- java/src/game/entity/npc/EntityWoodElf.java | 10 +- java/src/game/entity/npc/EntityZombie.java | 10 +- java/src/game/gui/Gui.java | 2 +- .../game/gui/{GuiSkin.java => GuiChar.java} | 149 ++++++++++-------- java/src/game/gui/GuiCharacters.java | 8 +- java/src/game/gui/GuiConfirm.java | 2 +- java/src/game/gui/GuiConsole.java | 4 +- java/src/game/gui/GuiGameOver.java | 2 +- java/src/game/gui/GuiInfo.java | 2 +- java/src/game/gui/GuiLoading.java | 4 +- java/src/game/gui/GuiMenu.java | 2 +- java/src/game/gui/element/GuiList.java | 32 ++-- java/src/game/gui/element/TransparentBox.java | 7 +- java/src/game/gui/world/GuiCreate.java | 2 +- java/src/game/gui/world/GuiEdit.java | 6 +- java/src/game/gui/world/GuiWorlds.java | 27 ++-- java/src/game/network/ClientPlayer.java | 10 +- java/src/game/network/Player.java | 8 +- 42 files changed, 405 insertions(+), 209 deletions(-) rename java/src/game/gui/{GuiSkin.java => GuiChar.java} (78%) diff --git a/java/src/game/Game.java b/java/src/game/Game.java index 55192a8..c7d6eb1 100755 --- a/java/src/game/Game.java +++ b/java/src/game/Game.java @@ -72,7 +72,7 @@ import game.gui.GuiGameOver; import game.gui.GuiInfo; import game.gui.GuiLoading; import game.gui.GuiMenu; -import game.gui.GuiSkin; +import game.gui.GuiChar; import game.gui.Style; import game.gui.container.GuiContainer; import game.gui.container.GuiInventory; @@ -986,7 +986,7 @@ public class Game implements IThreadListener { } if(this.open != null) this.open.render(); - else if(this.theWorld == null || this.theWorld.hasNoChunks()) + else if(this.theWorld == null || this.theWorld.hasNoChunks() || this.charEditor) Drawing.drawScaled(this, Gui.DIRT_BACKGROUND); if(Bind.INFO.isDown() && (this.open == null || !(this.open.selected instanceof Textbox))) this.drawInfo(); @@ -2226,8 +2226,8 @@ public class Game implements IThreadListener { // this.displayGuiScreen(GuiChat.INSTANCE); // } if(this.theWorld != null && Bind.MENU.isPressed()) { - if(this.open != (this.charEditor ? GuiSkin.INSTANCE : null)) - this.displayGuiScreen(this.charEditor ? GuiSkin.INSTANCE : null); + if(this.open != (this.charEditor ? GuiChar.INSTANCE : null)) + this.displayGuiScreen(this.charEditor ? GuiChar.INSTANCE : null); else this.displayGuiScreen(GuiMenu.INSTANCE); } @@ -3315,13 +3315,42 @@ public class Game implements IThreadListener { // GlState.enableDepth(); } - public void showDirDialog(final String title, final String def, final FileCallback callback) { + public static enum FileMode { + DIRECTORY_LOAD, + DIRECTORY_SAVE, + FILE_LOAD, + FILE_LOAD_MULTI, + FILE_SAVE; + } + + public void showDirDialog(final FileMode mode, final String title, final File def, final FileCallback callback) { new Thread(new Runnable() { public void run() { String output; try { - Process proc = Runtime.getRuntime().exec(new String[] {"zenity", "--file-selection", "--directory", "--title", title, "--filename", def + File.separator + - "__THISFILEDOESNOTEXIST__"}); + List list = Lists.newArrayList("zenity", "--file-selection"); + switch(mode) { + case DIRECTORY_SAVE: + list.add("--save"); + case DIRECTORY_LOAD: + list.add("--directory"); + break; + case FILE_SAVE: + list.add("--save"); + break; + case FILE_LOAD_MULTI: + list.add("--multiple"); + list.add("--separator"); + list.add(":"); + break; + } + list.add("--title"); + list.add(title); + if(def != null) { + list.add("--filename"); + list.add(def.isDirectory() ? def.getAbsolutePath() + File.separator + "__THISFILEDOESNOTEXIST__" : def.getAbsolutePath()); + } + Process proc = Runtime.getRuntime().exec(list.toArray(new String[list.size()])); BufferedReader buf = new BufferedReader(new InputStreamReader(new BufferedInputStream(proc.getInputStream()))); proc.waitFor(); output = buf.readLine(); @@ -3335,8 +3364,43 @@ public class Game implements IThreadListener { return; } if(output != null) { - File file = new File(output); - if(file.isDirectory()) { + if(mode == FileMode.FILE_LOAD_MULTI) { + final List files = Lists.newArrayList(); + for(String out : output.split(":")) { + File file = new File(out); + if(file.isFile()) + files.add(file); + } + if(files.isEmpty()) + return; + Game.this.schedule(new Runnable() { + public void run() { + for(File file : files) { + callback.selected(file); + } + } + }); + } + else { + File file = new File(output); + switch(mode) { + case DIRECTORY_LOAD: + if(!file.isDirectory()) + return; + break; + case DIRECTORY_SAVE: + if(file.exists() && !file.isDirectory()) + return; + break; + case FILE_LOAD: + if(!file.isFile()) + return; + break; + case FILE_SAVE: + if(file.exists() && !file.isFile()) + return; + break; + } Game.this.schedule(new Runnable() { public void run() { callback.selected(file); diff --git a/java/src/game/entity/npc/EntityArachnoid.java b/java/src/game/entity/npc/EntityArachnoid.java index 99f0eca..b5252fa 100755 --- a/java/src/game/entity/npc/EntityArachnoid.java +++ b/java/src/game/entity/npc/EntityArachnoid.java @@ -216,8 +216,12 @@ public class EntityArachnoid extends EntityNPC // return 0; // } - public float getHeightDeviation(Random rand) { - return rand.frange(0.0f, 0.25f); +// public float getHeightDeviation(Random rand) { +// return rand.frange(0.0f, 0.25f); +// } + + public float getHeightDeviationMax() { + return 0.25f; } public Alignment getNaturalAlign(Random rand) { diff --git a/java/src/game/entity/npc/EntityBloodElf.java b/java/src/game/entity/npc/EntityBloodElf.java index 712750a..1013d95 100755 --- a/java/src/game/entity/npc/EntityBloodElf.java +++ b/java/src/game/entity/npc/EntityBloodElf.java @@ -44,9 +44,13 @@ public class EntityBloodElf extends EntityNPC { public int getBaseHealth(Random rand) { return rand.range(24, 26); } - - public float getHeightDeviation(Random rand) { - return rand.frange(-0.1f, 0.3f); + + public float getHeightDeviationMin() { + return -0.1f; + } + + public float getHeightDeviationMax() { + return 0.3f; } public Alignment getNaturalAlign(Random rand) { diff --git a/java/src/game/entity/npc/EntityChaosMarine.java b/java/src/game/entity/npc/EntityChaosMarine.java index f840f2c..6193f2b 100755 --- a/java/src/game/entity/npc/EntityChaosMarine.java +++ b/java/src/game/entity/npc/EntityChaosMarine.java @@ -76,8 +76,8 @@ public class EntityChaosMarine extends EntityNPC { return this.getLegion().health; } - public float getBaseSize(Random rand) { - return this.getLegion().size / this.species.size; + public float getEntityBaseSize() { + return this.getLegion().size; } public Alignment getNaturalAlign(Random rand) { diff --git a/java/src/game/entity/npc/EntityCultivator.java b/java/src/game/entity/npc/EntityCultivator.java index cdcabde..0192e3c 100755 --- a/java/src/game/entity/npc/EntityCultivator.java +++ b/java/src/game/entity/npc/EntityCultivator.java @@ -101,9 +101,13 @@ public class EntityCultivator extends EntityNPC { public Alignment getNaturalAlign(Random rand) { return rand.pick(Alignment.values()); } - - public float getHeightDeviation(Random rand) { - return rand.frange(-0.2f, 0.2f); + + public float getHeightDeviationMin() { + return -0.2f; + } + + public float getHeightDeviationMax() { + return 0.2f; } public void onStruckByLightning(EntityLightning lightningBolt) { diff --git a/java/src/game/entity/npc/EntityDarkMage.java b/java/src/game/entity/npc/EntityDarkMage.java index eb4e50f..17373b0 100755 --- a/java/src/game/entity/npc/EntityDarkMage.java +++ b/java/src/game/entity/npc/EntityDarkMage.java @@ -48,9 +48,13 @@ public class EntityDarkMage extends EntityHoveringNPC { // public int getBaseEnergy(Random rand) { // return 0; // } - - public float getHeightDeviation(Random rand) { - return rand.frange(-0.2f, 0.2f); + + public float getHeightDeviationMin() { + return -0.2f; + } + + public float getHeightDeviationMax() { + return 0.2f; } public Alignment getNaturalAlign(Random rand) { diff --git a/java/src/game/entity/npc/EntityDwarf.java b/java/src/game/entity/npc/EntityDwarf.java index 977d670..e8a47ad 100755 --- a/java/src/game/entity/npc/EntityDwarf.java +++ b/java/src/game/entity/npc/EntityDwarf.java @@ -44,9 +44,13 @@ public class EntityDwarf extends EntityNPC { public int getBaseHealth(Random rand) { return rand.range(16, 18); } - - public float getHeightDeviation(Random rand) { - return rand.frange(-0.1f, 0.1f); + + public float getHeightDeviationMin() { + return -0.1f; + } + + public float getHeightDeviationMax() { + return 0.1f; } public Alignment getNaturalAlign(Random rand) { diff --git a/java/src/game/entity/npc/EntityElf.java b/java/src/game/entity/npc/EntityElf.java index 563bdab..6f75be2 100755 --- a/java/src/game/entity/npc/EntityElf.java +++ b/java/src/game/entity/npc/EntityElf.java @@ -45,9 +45,13 @@ public class EntityElf extends EntityNPC { public int getBaseHealth(Random rand) { return rand.range(20, 24); } - - public float getHeightDeviation(Random rand) { - return rand.frange(-0.2f, 0.4f); + + public float getHeightDeviationMin() { + return -0.2f; + } + + public float getHeightDeviationMax() { + return 0.4f; } public Alignment getNaturalAlign(Random rand) { diff --git a/java/src/game/entity/npc/EntityFireDemon.java b/java/src/game/entity/npc/EntityFireDemon.java index 7474e6f..3e15ea4 100755 --- a/java/src/game/entity/npc/EntityFireDemon.java +++ b/java/src/game/entity/npc/EntityFireDemon.java @@ -48,9 +48,13 @@ public class EntityFireDemon extends EntityFlyingNPC { // public int getBaseEnergy(Random rand) { // return 0; // } - - public float getHeightDeviation(Random rand) { - return rand.frange(-0.15f, 0.35f); + + public float getHeightDeviationMin() { + return -0.15f; + } + + public float getHeightDeviationMax() { + return 0.35f; } public Alignment getNaturalAlign(Random rand) { diff --git a/java/src/game/entity/npc/EntityFlyingNPC.java b/java/src/game/entity/npc/EntityFlyingNPC.java index ed58eff..886e41d 100755 --- a/java/src/game/entity/npc/EntityFlyingNPC.java +++ b/java/src/game/entity/npc/EntityFlyingNPC.java @@ -48,6 +48,14 @@ public abstract class EntityFlyingNPC extends EntityNPC return true; } +// public boolean canFlyFullSpeed() { +// return true; +// } + +// public boolean canNaturallyFly() { +// return true; +// } + public void moveEntityWithHeading(float strafe, float forward) { if(this.isPlayer()) { diff --git a/java/src/game/entity/npc/EntityGargoyle.java b/java/src/game/entity/npc/EntityGargoyle.java index b458b53..8bbcc26 100755 --- a/java/src/game/entity/npc/EntityGargoyle.java +++ b/java/src/game/entity/npc/EntityGargoyle.java @@ -225,9 +225,9 @@ public class EntityGargoyle extends EntityFlyingNPC // public int getBaseEnergy(Random rand) { // return 0; // } - - public float getHeightDeviation(Random rand) { - return rand.frange(0.0f, 0.05f); + + public float getHeightDeviationMax() { + return 0.05f; } public Alignment getNaturalAlign(Random rand) { diff --git a/java/src/game/entity/npc/EntityGoblin.java b/java/src/game/entity/npc/EntityGoblin.java index ea2a604..2d38f78 100755 --- a/java/src/game/entity/npc/EntityGoblin.java +++ b/java/src/game/entity/npc/EntityGoblin.java @@ -17,9 +17,13 @@ public class EntityGoblin extends EntityNPC { public int getBaseHealth(Random rand) { return rand.range(8, 12); } - - public float getHeightDeviation(Random rand) { - return rand.frange(-0.1f, 0.1f); + + public float getHeightDeviationMin() { + return -0.1f; + } + + public float getHeightDeviationMax() { + return 0.1f; } public Alignment getNaturalAlign(Random rand) { diff --git a/java/src/game/entity/npc/EntityHuman.java b/java/src/game/entity/npc/EntityHuman.java index 7118ab4..8b7de2e 100755 --- a/java/src/game/entity/npc/EntityHuman.java +++ b/java/src/game/entity/npc/EntityHuman.java @@ -87,9 +87,13 @@ public class EntityHuman extends EntityNPC { public int getBaseHealth(Random rand) { return rand.range(18, 20); } - - public float getHeightDeviation(Random rand) { - return rand.frange(-0.2f, 0.2f); + + public float getHeightDeviationMin() { + return -0.2f; + } + + public float getHeightDeviationMax() { + return 0.2f; } public Alignment getNaturalAlign(Random rand) { diff --git a/java/src/game/entity/npc/EntityMage.java b/java/src/game/entity/npc/EntityMage.java index c44130c..e645c2c 100755 --- a/java/src/game/entity/npc/EntityMage.java +++ b/java/src/game/entity/npc/EntityMage.java @@ -151,9 +151,13 @@ public class EntityMage extends EntityNPC // public int getBaseEnergy(Random rand) { // return 0; // } - - public float getHeightDeviation(Random rand) { - return rand.frange(-0.2f, 0.2f); + + public float getHeightDeviationMin() { + return -0.2f; + } + + public float getHeightDeviationMax() { + return 0.2f; } public Alignment getNaturalAlign(Random rand) { diff --git a/java/src/game/entity/npc/EntityMetalhead.java b/java/src/game/entity/npc/EntityMetalhead.java index 5fb75b2..5ce5e59 100755 --- a/java/src/game/entity/npc/EntityMetalhead.java +++ b/java/src/game/entity/npc/EntityMetalhead.java @@ -46,9 +46,13 @@ public class EntityMetalhead extends EntityNPC { public int getBaseHealth(Random rand) { return rand.range(20, 24); } - - public float getHeightDeviation(Random rand) { - return rand.frange(-0.2f, 0.2f); + + public float getHeightDeviationMin() { + return -0.2f; + } + + public float getHeightDeviationMax() { + return 0.2f; } public Alignment getNaturalAlign(Random rand) { diff --git a/java/src/game/entity/npc/EntityNPC.java b/java/src/game/entity/npc/EntityNPC.java index 30edcaf..65b8e88 100755 --- a/java/src/game/entity/npc/EntityNPC.java +++ b/java/src/game/entity/npc/EntityNPC.java @@ -1131,10 +1131,22 @@ public abstract class EntityNPC extends EntityLiving // return 0; // } - public float getHeightDeviation(Random rand) { + public final float getHeightDeviation(Random rand) { + return this.getHeightDeviationMin() == this.getHeightDeviationMax() ? this.getHeightDeviationMin() : this.rand.frange(this.getHeightDeviationMin(), this.getHeightDeviationMax()); + } + + public float getHeightDeviationMin() { return 0.0f; } + public float getHeightDeviationMax() { + return 0.0f; + } + + public float getEntityBaseSize() { + return this.species.size; + } + public boolean isVisibleTo(EntityNPC player) { return this.connection == null || !this.connection.isInEditor(); @@ -2431,7 +2443,7 @@ public abstract class EntityNPC extends EntityLiving this.setSprinting(false); } - if (this.hasEffect(Potion.FLYING) || this.noclip) + if (this.hasEffect(Potion.FLYING) || this.noclip || this.canNaturallyFly()) { if (this.noclip) { @@ -2466,13 +2478,13 @@ public abstract class EntityNPC extends EntityLiving if (this.gm.sneak) { this.motionY -= (double)( - this.flying ? (this.landMovement * 0.5f * 3.0F) : 0.05F); + this.landMovement * 0.5f * (this.canFlyFullSpeed() ? 3.0F : 1.0F)); } if (this.gm.jump) { this.motionY += (double)( - this.flying ? (this.landMovement * 0.5f * 3.0F) : 0.05F); + this.landMovement * 0.5f * (this.canFlyFullSpeed() ? 3.0F : 1.0F)); } } @@ -3042,7 +3054,7 @@ public abstract class EntityNPC extends EntityLiving protected void onFinishedEffect(PotionEffect effect) { super.onFinishedEffect(effect); - if(this.isPlayer() && effect.getPotion() == Potion.FLYING) + if(this.isPlayer() && effect.getPotion() == Potion.FLYING && !this.noclip && !this.canNaturallyFly()) this.flying = false; // super.onFinishedEffect(effect); if(this.connection != null) @@ -3532,7 +3544,7 @@ public abstract class EntityNPC extends EntityLiving // this.foodStats.readNBT(tagCompund); // this.readCapabilitiesFromNBT(tagCompund); - this.flying = tagCompund.getBoolean("flying") && this.hasEffect(Potion.FLYING); + this.flying = tagCompund.getBoolean("flying") && (this.hasEffect(Potion.FLYING) || this.canNaturallyFly()); // if(tagCompund.hasKey("speed", 99)) // this.speed = tagCompund.getFloat("speed"); // this.disableDamagePersist = tagCompund.getBoolean("alwaysInvulnerable"); @@ -3987,8 +3999,7 @@ public abstract class EntityNPC extends EntityLiving { double d3 = this.motionY; float f = this.jumpMovement; - if(this.flying) - this.jumpMovement = this.landMovement * 0.5f * (float)(this.isSprinting() ? 2 : 1); + this.jumpMovement = this.landMovement * (this.canFlyFullSpeed() ? 0.5f : 0.2f) * (float)(this.isSprinting() ? 2 : 1); super.moveEntityWithHeading(strafe, forward); this.motionY = d3 * 0.6D; this.jumpMovement = f; @@ -4391,6 +4402,14 @@ public abstract class EntityNPC extends EntityLiving public boolean isFlying() { return this.flying || this.worldObj.gravity == 0.0; } + + public boolean canNaturallyFly() { + return false; + } + + public boolean canFlyFullSpeed() { + return this.flying; + } public int getEnergy(Energy type) { // TODO return 0; @@ -4595,8 +4614,24 @@ public abstract class EntityNPC extends EntityLiving return !this.isPlayer() && this.getGrowingAge() <= -14000; } - public float getBaseSize(Random rand) { - return /* this.isPlayer() ? 1.8f : ( */ (this.species.size + this.getHeightDeviation(rand)) / this.species.size; // ); + public final float getBaseSize(Random rand) { + return /* this.isPlayer() ? 1.8f : ( */ (this.getEntityBaseSize() + this.getHeightDeviation(rand)) / this.species.size; // ); + } + + public int getCurrentSize() { + return (int)(this.species.renderer.height * this.getHeight() * 100.0f + 0.5f); + } + + public int getDefaultSize() { + return (int)(this.getEntityBaseSize() * 100.0f + 0.5f); + } + + public int getMinSize() { + return (int)((this.getEntityBaseSize() + this.getHeightDeviationMin()) * 100.0f + 0.5f); + } + + public int getMaxSize() { + return (int)((this.getEntityBaseSize() + this.getHeightDeviationMax()) * 100.0f + 0.5f); } public ModelType getModel() { diff --git a/java/src/game/entity/npc/EntityOrc.java b/java/src/game/entity/npc/EntityOrc.java index 9fca744..6c26d48 100755 --- a/java/src/game/entity/npc/EntityOrc.java +++ b/java/src/game/entity/npc/EntityOrc.java @@ -45,9 +45,13 @@ public class EntityOrc extends EntityNPC { // public int getBaseEnergy(Random rand) { // return 0; // } - - public float getHeightDeviation(Random rand) { - return rand.frange(-0.1f, 0.3f); + + public float getHeightDeviationMin() { + return -0.1f; + } + + public float getHeightDeviationMax() { + return 0.3f; } public Alignment getNaturalAlign(Random rand) { diff --git a/java/src/game/entity/npc/EntityPrimarch.java b/java/src/game/entity/npc/EntityPrimarch.java index e805235..2a6c670 100755 --- a/java/src/game/entity/npc/EntityPrimarch.java +++ b/java/src/game/entity/npc/EntityPrimarch.java @@ -125,8 +125,8 @@ public class EntityPrimarch extends EntityMobNPC { // return 0; // } - public float getBaseSize(Random rand) { - return this.getFounding().size / this.species.size; + public float getEntityBaseSize() { + return this.getFounding().size; } // public float getHeightDeviation(Random rand) { diff --git a/java/src/game/entity/npc/EntitySlime.java b/java/src/game/entity/npc/EntitySlime.java index 8a1ba50..e22a401 100755 --- a/java/src/game/entity/npc/EntitySlime.java +++ b/java/src/game/entity/npc/EntitySlime.java @@ -77,9 +77,13 @@ public class EntitySlime extends EntityNPC // public int getBaseEnergy(Random rand) { // return 0; // } - - public float getHeightDeviation(Random rand) { - return rand.frange(-0.7f, 3.0f); + + public float getHeightDeviationMin() { + return -0.7f; + } + + public float getHeightDeviationMax() { + return 3.0f; } public Alignment getNaturalAlign(Random rand) { diff --git a/java/src/game/entity/npc/EntitySpaceMarine.java b/java/src/game/entity/npc/EntitySpaceMarine.java index 1ad84e5..c974c3a 100755 --- a/java/src/game/entity/npc/EntitySpaceMarine.java +++ b/java/src/game/entity/npc/EntitySpaceMarine.java @@ -76,8 +76,8 @@ public class EntitySpaceMarine extends EntityNPC { return this.getLegion().health; } - public float getBaseSize(Random rand) { - return this.getLegion().size / this.species.size; + public float getEntityBaseSize() { + return this.getLegion().size; } public Alignment getNaturalAlign(Random rand) { diff --git a/java/src/game/entity/npc/EntitySpirit.java b/java/src/game/entity/npc/EntitySpirit.java index 56a0c9f..001c0c5 100755 --- a/java/src/game/entity/npc/EntitySpirit.java +++ b/java/src/game/entity/npc/EntitySpirit.java @@ -43,9 +43,9 @@ public class EntitySpirit extends EntityNPC { public int getBaseHealth(Random rand) { return rand.range(8, 14); } - - public float getHeightDeviation(Random rand) { - return rand.frange(0.0f, 0.1f); + + public float getHeightDeviationMax() { + return 0.1f; } public Alignment getNaturalAlign(Random rand) { diff --git a/java/src/game/entity/npc/EntityTiefling.java b/java/src/game/entity/npc/EntityTiefling.java index 8576969..70a4cfa 100755 --- a/java/src/game/entity/npc/EntityTiefling.java +++ b/java/src/game/entity/npc/EntityTiefling.java @@ -44,9 +44,13 @@ public class EntityTiefling extends EntityMobNPC { // public int getBaseEnergy(Random rand) { // return 0; // } - - public float getHeightDeviation(Random rand) { - return rand.frange(-0.1f, 0.4f); + + public float getHeightDeviationMin() { + return -0.1f; + } + + public float getHeightDeviationMax() { + return 0.4f; } public Alignment getNaturalAlign(Random rand) { diff --git a/java/src/game/entity/npc/EntityUndead.java b/java/src/game/entity/npc/EntityUndead.java index 20ca808..71b27a1 100755 --- a/java/src/game/entity/npc/EntityUndead.java +++ b/java/src/game/entity/npc/EntityUndead.java @@ -87,9 +87,13 @@ public class EntityUndead extends EntityNPC // public int getBaseEnergy(Random rand) { // return 0; // } - - public float getHeightDeviation(Random rand) { - return rand.frange(-0.2f, 0.2f); + + public float getHeightDeviationMin() { + return -0.2f; + } + + public float getHeightDeviationMax() { + return 0.2f; } public Alignment getNaturalAlign(Random rand) { diff --git a/java/src/game/entity/npc/EntityVampire.java b/java/src/game/entity/npc/EntityVampire.java index c5227ed..c483ce1 100755 --- a/java/src/game/entity/npc/EntityVampire.java +++ b/java/src/game/entity/npc/EntityVampire.java @@ -56,9 +56,13 @@ public class EntityVampire extends EntityNPC { // public int getBaseEnergy(Random rand) { // return 0; // } - - public float getHeightDeviation(Random rand) { - return rand.frange(-0.2f, 0.2f); + + public float getHeightDeviationMin() { + return -0.2f; + } + + public float getHeightDeviationMax() { + return 0.2f; } public Alignment getNaturalAlign(Random rand) { diff --git a/java/src/game/entity/npc/EntityWoodElf.java b/java/src/game/entity/npc/EntityWoodElf.java index c74763d..033da72 100755 --- a/java/src/game/entity/npc/EntityWoodElf.java +++ b/java/src/game/entity/npc/EntityWoodElf.java @@ -45,9 +45,13 @@ public class EntityWoodElf extends EntityNPC { public int getBaseHealth(Random rand) { return rand.range(20, 22); } - - public float getHeightDeviation(Random rand) { - return rand.frange(-0.1f, 0.25f); + + public float getHeightDeviationMin() { + return -0.1f; + } + + public float getHeightDeviationMax() { + return 0.25f; } public Alignment getNaturalAlign(Random rand) { diff --git a/java/src/game/entity/npc/EntityZombie.java b/java/src/game/entity/npc/EntityZombie.java index 0785dc8..c0c73a8 100755 --- a/java/src/game/entity/npc/EntityZombie.java +++ b/java/src/game/entity/npc/EntityZombie.java @@ -308,9 +308,13 @@ public class EntityZombie extends EntityNPC // public int getBaseEnergy(Random rand) { // return 0; // } - - public float getHeightDeviation(Random rand) { - return rand.frange(-0.2f, 0.2f); + + public float getHeightDeviationMin() { + return -0.2f; + } + + public float getHeightDeviationMax() { + return 0.2f; } public Alignment getNaturalAlign(Random rand) { diff --git a/java/src/game/gui/Gui.java b/java/src/game/gui/Gui.java index 6201c8d..a719e0a 100644 --- a/java/src/game/gui/Gui.java +++ b/java/src/game/gui/Gui.java @@ -302,7 +302,7 @@ public abstract class Gui { // } public void drawMainBackground() { - if(this.gm.theWorld != null) { + if(this.gm.theWorld != null && !this.gm.charEditor) { // Drawing.drawGradient(0, 0, this.fb_x, this.fb_y, this.theWorld == null ? this.style.bg_top : 0x3f202020, // this.theWorld == null ? this.style.bg_btm : 0x3f000000); Drawing.drawGradient(0, 0, this.gm.fb_x, this.gm.fb_y, 0xc0101010, 0xd0101010); diff --git a/java/src/game/gui/GuiSkin.java b/java/src/game/gui/GuiChar.java similarity index 78% rename from java/src/game/gui/GuiSkin.java rename to java/src/game/gui/GuiChar.java index 459b6b6..29058fd 100755 --- a/java/src/game/gui/GuiSkin.java +++ b/java/src/game/gui/GuiChar.java @@ -14,6 +14,7 @@ import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL13; import game.Game; +import game.Game.FileMode; import game.entity.npc.Alignment; import game.entity.npc.CharacterInfo; import game.entity.npc.EntityNPC; @@ -42,11 +43,12 @@ import game.renderer.ItemRenderer; import game.renderer.entity.RenderManager; import game.renderer.texture.EntityTexManager; import game.renderer.texture.TextureUtil; +import game.util.FileCallback; import game.util.FileUtils; import game.util.SkinConverter; import game.window.Button; -public class GuiSkin extends GuiList +public class GuiChar extends GuiList { protected class SkinEntry implements ListEntry { @@ -80,7 +82,7 @@ public class GuiSkin extends GuiList int h = this.skinImage.getHeight(); int[] data = new int[w * h]; this.skinImage.getRGB(0, 0, w, h, data, 0, w); - this.dynId = 0xffff0000 + GuiSkin.this.elements.size(); + this.dynId = 0xffff0000 + GuiChar.this.elements.size(); EntityTexManager.setTexture(this.dynId, EntityTexManager.imageToComp(data, model), model); } else { @@ -97,7 +99,7 @@ public class GuiSkin extends GuiList (this.charinfo.species.prefix && this.charinfo.spclass != null && this.charinfo.spclass.type != null ? this.charinfo.spclass.type.toString() : EntityRegistry.getEntityName(this.charinfo.species.id)) - + (this.charinfo.name.isEmpty() ? "" : (" " + this.charinfo.name)) + " (" + this.charinfo.skin + ")"))); + + (this.charinfo.name.isEmpty() ? "" : (" " + this.charinfo.name))))); // + TextColor.LIGHT_GRAY + " (" + TextColor.GREEN + // this.model.display + TextColor.LIGHT_GRAY +")" // , listWidth - 16 - 2); @@ -106,6 +108,8 @@ public class GuiSkin extends GuiList // { Drawing.drawText(str, x + 64 + 3, y, 0xff000000 | (this.charinfo == null ? (this.skinFile != null ? 0xffffff : 0xc0c0c0) : this.charinfo.color1 | this.charinfo.color2)); + if(this.skinFile == null && this.charinfo != null) + Drawing.drawText(this.charinfo.skin, x + 64 + 3, y + 18, 0xffc0c0c0); // } GlState.color(1.0F, 1.0F, 1.0F, 1.0F); @@ -147,14 +151,14 @@ public class GuiSkin extends GuiList // GuiSkin.this.gm.getTextureManager().bindTexture(tex); GlState.enableBlend(); GlState.enableDepth(); - boolean flag = GuiSkin.this.gm.cameraUsed; - GuiSkin.this.gm.cameraUsed = true; + boolean flag = GuiChar.this.gm.cameraUsed; + GuiChar.this.gm.cameraUsed = true; EntityTexManager.altTexture = tex; EntityTexManager.altLayer = this.dynId; EntityTexManager.altNpcLayer = this.dynId == -1 && this.charinfo != null ? this.charinfo.skin : null; drawEntity(x + 32, y + 60, 28.0f - / GuiSkin.this.gm.thePlayer.getHeight(), -45.0f, -20.0f, GuiSkin.this.gm.thePlayer); - GuiSkin.this.gm.cameraUsed = flag; + /* / GuiChar.this.gm.thePlayer.getHeight() */ * Math.min(1.8f / GuiChar.this.gm.thePlayer.height, 1.5f / GuiChar.this.gm.thePlayer.width), -45.0f, -20.0f, GuiChar.this.gm.thePlayer); + GuiChar.this.gm.cameraUsed = flag; EntityTexManager.altTexture = null; EntityTexManager.altLayer = -1; EntityTexManager.altNpcLayer = null; @@ -202,10 +206,10 @@ public class GuiSkin extends GuiList // slim = this.skinFile.getName().startsWith("slim_"); // } // GuiSkin.this.selectEntry(slotIndex, slim); - GuiSkin.this.convertButton1.enabled = this.canConvert(); - GuiSkin.this.convertButton2.enabled = this.canConvert(); - GuiSkin.this.templateButton.enabled = this.canCopy(); - GuiSkin.this.selectSkin(img, this.model); +// GuiChar.this.convertButton1.enabled = this.canConvert(); +// GuiChar.this.convertButton2.enabled = this.canConvert(); + GuiChar.this.templateButton.enabled = this.canCopy(); + GuiChar.this.selectSkin(img, this.model); // if(mx < 16 && mx > 0) // GuiSkin.this.gm.displayGuiScreen(GuiMenu.INSTANCE); // return; @@ -217,10 +221,10 @@ public class GuiSkin extends GuiList return this.skinFile; } - public boolean canConvert() - { - return this.skinFile != null && this.model == ModelType.HUMANOID; - } +// public boolean canConvert() +// { +// return this.skinFile != null && this.model == ModelType.HUMANOID; +// } public String getLocation() { @@ -255,15 +259,15 @@ public class GuiSkin extends GuiList } public void drag(int x, int y) { - GuiSkin.this.yaw = this.yawOffset + (this.mouseX - x) * 2.0f; - GuiSkin.this.pitch = this.pitchOffset + (this.mouseY - y) * 2.0f; + GuiChar.this.yaw = this.yawOffset + (this.mouseX - x) * 2.0f; + GuiChar.this.pitch = this.pitchOffset + (this.mouseY - y) * 2.0f; } public void mouse(Button btn, int x, int y, boolean ctrl, boolean shift) { this.mouseX = x; this.mouseY = y; - this.yawOffset = GuiSkin.this.yaw; - this.pitchOffset = GuiSkin.this.pitch; + this.yawOffset = GuiChar.this.yaw; + this.pitchOffset = GuiChar.this.pitch; // this.dragging = true; } @@ -276,52 +280,58 @@ public class GuiSkin extends GuiList } } - public static final GuiSkin INSTANCE = new GuiSkin(); + public static final GuiChar INSTANCE = new GuiChar(); - private ActButton convertButton1; - private ActButton convertButton2; +// private ActButton convertButton1; +// private ActButton convertButton2; private ActButton templateButton; private DragAdjust adjust; private float yaw = -15.0f; private float pitch = -15.0f; private boolean waiting = true; - private GuiSkin() { + private GuiChar() { } public void init(int width, int height) { super.init(width, height); this.waiting = true; - this.setDimensions(400, height, 52, height - 52); + this.setDimensions(400, height, 32, height - 32); if(this.gm.getRenderManager().gm == null) { this.unload(); this.adjust = null; return; } this.load(null, this.gm.thePlayer == null ? ModelType.HUMANOID : this.gm.thePlayer.getModel()); - this.convertButton1 = this.add(new ActButton(10, height - 48, 200, 20, new ActButton.Callback() { + this.add(new ActButton(4, 4, 194, 24, new ActButton.Callback() { public void use(ActButton elem, Mode action) { - SkinEntry skin = GuiSkin.this.getSelected(); - if(skin != null && skin.getFile() != null && SkinConverter.convertSkin(skin.getFile(), new File("skins"), false)) - GuiSkin.this.gm.displayGuiScreen(GuiSkin.this); + GuiChar.this.gm.showDirDialog(FileMode.FILE_LOAD, "Skin konvertieren", new File("skins"), new FileCallback() { + public void selected(File file) { + if(SkinConverter.convertSkin(file, new File("skins"), false) && GuiChar.this.gm.open == GuiChar.this) + GuiChar.this.gm.displayGuiScreen(GuiChar.this); + } + }); } - }, "Konvertieren: Standard")); - this.convertButton2 = this.add(new ActButton(10, height - 24, 200, 20, new ActButton.Callback() { + }, "Importieren: Standard")); + this.add(new ActButton(202, 4, 194, 24, new ActButton.Callback() { public void use(ActButton elem, Mode action) { - SkinEntry skin = GuiSkin.this.getSelected(); - if(skin != null && skin.getFile() != null && SkinConverter.convertSkin(skin.getFile(), new File("skins"), true)) - GuiSkin.this.gm.displayGuiScreen(GuiSkin.this); + GuiChar.this.gm.showDirDialog(FileMode.FILE_LOAD, "Skin konvertieren (schlank)", new File("skins"), new FileCallback() { + public void selected(File file) { + if(SkinConverter.convertSkin(file, new File("skins"), true) && GuiChar.this.gm.open == GuiChar.this) + GuiChar.this.gm.displayGuiScreen(GuiChar.this); + } + }); } - }, "Konvertieren: Schlank")); - this.add(new ActButton(240, height - 48, 150, 20, new ActButton.Callback() { + }, "Importieren: Schlank")); + this.add(new ActButton(4, height - 28, 194, 24, new ActButton.Callback() { public void use(ActButton elem, Mode action) { - GuiSkin.this.gm.displayGuiScreen(GuiSkin.this); + GuiChar.this.gm.displayGuiScreen(GuiChar.this); } }, "Neu laden")); - this.templateButton = this.add(new ActButton(240, height - 24, 150, 20, new ActButton.Callback() { + this.templateButton = this.add(new ActButton(202, height - 28, 194, 24, new ActButton.Callback() { public void use(ActButton elem, Mode action) { - SkinEntry skin = GuiSkin.this.getSelected(); + SkinEntry skin = GuiChar.this.getSelected(); if(skin != null && skin.getLocation() != null) { String loc = skin.getLocation(); File file = new File(new File("skins"), loc + ".png"); @@ -349,21 +359,21 @@ public class GuiSkin extends GuiList } } } - GuiSkin.this.gm.displayGuiScreen(GuiSkin.this); + GuiChar.this.gm.displayGuiScreen(GuiChar.this); } } }, "Vorlage kopieren")); - this.adjust = this.add(new DragAdjust(400 + 10, 64, width - 400 - 400 - 20, height - 128)); + this.adjust = this.add(new DragAdjust(width / 2 - 230, height - 64 - 640, 460, 640)); // final ActButton[] speciesBtns = new ActButton[SpeciesRegistry.SPECIMEN.size()]; for(int z = 0; z < SpeciesRegistry.SPECIMEN.size(); z++) { final SpeciesInfo species = SpeciesRegistry.SPECIMEN.get(z); // speciesBtns[z] = - this.add(new ActButton(width - 400 + (z % 2) * 196, 4 + 23 * (z / 2), 194, 20, new ActButton.Callback() { + this.add(new ActButton(width - 396 + (z % 2) * 198, 36 + 28 * (z / 2), 194, 24, new ActButton.Callback() { public void use(ActButton elem, Mode action) { - if(GuiSkin.this.gm.thePlayer != null) { - GuiSkin.this.gm.displayGuiScreen(null); - GuiSkin.this.gm.thePlayer.sendQueue.addToSendQueue(new CPacketAction(CPacketAction.Action.SET_SPECIES, EntityRegistry.getEntityID(species.clazz))); + if(GuiChar.this.gm.thePlayer != null) { + GuiChar.this.gm.displayGuiScreen(null); + GuiChar.this.gm.thePlayer.sendQueue.addToSendQueue(new CPacketAction(CPacketAction.Action.SET_SPECIES, EntityRegistry.getEntityID(species.clazz))); // for(ActButton btn : speciesBtns) { // btn.enabled = btn != elem; // } @@ -378,11 +388,11 @@ public class GuiSkin extends GuiList for (int z = 0; z < Alignment.values().length; z++) { final Alignment align = Alignment.values()[z]; - alignBtns[z] = this.add(new ActButton(width - 400 + (z % 3) * 131, height - 198 + 23 * (z / 3), 129, 20, new ActButton.Callback() { + alignBtns[z] = this.add(new ActButton(width - 396 + (z % 3) * 132, height - 32 - 28 * 3 + 28 * (z / 3), 128, 24, new ActButton.Callback() { public void use(ActButton elem, Mode action) { - if(GuiSkin.this.gm.thePlayer != null) { - GuiSkin.this.waiting = false; - GuiSkin.this.gm.thePlayer.sendQueue.addToSendQueue(new CPacketAction(CPacketAction.Action.SET_ALIGN, align.ordinal())); + if(GuiChar.this.gm.thePlayer != null) { + GuiChar.this.waiting = false; + GuiChar.this.gm.thePlayer.sendQueue.addToSendQueue(new CPacketAction(CPacketAction.Action.SET_ALIGN, align.ordinal())); for(ActButton btn : alignBtns) { btn.enabled = btn != elem; } @@ -391,36 +401,36 @@ public class GuiSkin extends GuiList }, align.color + align.display)); alignBtns[z].enabled = this.gm.thePlayer == null || this.gm.thePlayer.getAlignment() != align; } - this.add(new Slider(width - 400, height - 28 - 84, 390, 20, 1, 120, 320, 180, this.gm.thePlayer == null ? 180 : (int)(this.gm.thePlayer.getSpecies().renderer.height * this.gm.thePlayer.getHeight() * 100.0f + 0.5f), new Slider.Callback() { + this.add(new Slider(width / 2 - 200, height - 28, 400, 24, 1, this.gm.thePlayer == null ? 120 : this.gm.thePlayer.getMinSize(), this.gm.thePlayer == null ? 320 : this.gm.thePlayer.getMaxSize(), this.gm.thePlayer == null ? 180 : this.gm.thePlayer.getDefaultSize(), this.gm.thePlayer == null ? 180 : this.gm.thePlayer.getCurrentSize(), new Slider.Callback() { public void use(Slider elem, int value) { - if(GuiSkin.this.gm.thePlayer != null) { - GuiSkin.this.waiting = false; - GuiSkin.this.gm.thePlayer.sendQueue.addToSendQueue(new CPacketAction(CPacketAction.Action.SET_HEIGHT, value)); + if(GuiChar.this.gm.thePlayer != null) { + GuiChar.this.waiting = false; + GuiChar.this.gm.thePlayer.sendQueue.addToSendQueue(new CPacketAction(CPacketAction.Action.SET_HEIGHT, value)); } } - }, "Spieler-Größe", "cm")); - this.add(new Label(width - 400, height + 2 - 28 - 24 - 30, 390, 20, "Anzeigename", true)); - this.add(new ActButton(width - 274 + 154, height - 24, 264 - 154, 20, new ActButton.Callback() { + }, "Spieler-Größe", "cm")).enabled = this.gm.thePlayer == null || this.gm.thePlayer.getMinSize() != this.gm.thePlayer.getMaxSize(); + this.add(new Label(width / 2 - 200, 36, 400, 20, "Name", true)); + this.add(new ActButton(width - 198, height - 28, 194, 24, new ActButton.Callback() { public void use(ActButton elem, Mode action) { - if(GuiSkin.this.gm.thePlayer != null) - GuiSkin.this.gm.thePlayer.sendQueue.addToSendQueue(new CPacketAction(CPacketAction.Action.CLOSE_EDITOR)); + if(GuiChar.this.gm.thePlayer != null) + GuiChar.this.gm.thePlayer.sendQueue.addToSendQueue(new CPacketAction(CPacketAction.Action.CLOSE_EDITOR)); } - }, "Fertig")); - Textbox nameField = this.add(new Textbox(width - 400, height + 2 - 28 - 34, 390, 20, Player.MAX_NICK_LENGTH, true, new Textbox.Callback() { + }, "Charakter erstellen")); + Textbox nameField = this.add(new Textbox(width / 2 - 200, 36 + 20, 400, 24, Player.MAX_NICK_LENGTH, true, new Textbox.Callback() { public void use(Textbox elem, Action value) { if(value == Action.SEND || value == Action.UNFOCUS) { String name = elem.getText(); if(name.isEmpty()) - elem.setText(GuiSkin.this.gm.thePlayer == null ? "..." : GuiSkin.this.gm.thePlayer.getCustomNameTag()); - else if(GuiSkin.this.gm.thePlayer != null) { - GuiSkin.this.waiting = false; - GuiSkin.this.gm.thePlayer.sendQueue.addToSendQueue(new CPacketMessage(CPacketMessage.Type.DISPLAY, name)); + elem.setText(GuiChar.this.gm.thePlayer == null ? "..." : GuiChar.this.gm.thePlayer.getCustomNameTag()); + else if(GuiChar.this.gm.thePlayer != null) { + GuiChar.this.waiting = false; + GuiChar.this.gm.thePlayer.sendQueue.addToSendQueue(new CPacketMessage(CPacketMessage.Type.DISPLAY, name)); } } } }, Player.VALID_NICK, this.gm.thePlayer == null ? "" : this.gm.thePlayer.getCustomNameTag())); - this.convertButton1.enabled = false; - this.convertButton2.enabled = false; +// this.convertButton1.enabled = false; +// this.convertButton2.enabled = false; this.templateButton.enabled = false; } @@ -436,9 +446,12 @@ public class GuiSkin extends GuiList public void drawOverlays() { - if(this.adjust != null) - drawEntity(400 + (this.gm.fb_x - 400 - 400) / 2, this.gm.fb_y / 2 + 160, 160.0f - / this.gm.thePlayer.getHeight(), this.yaw, this.pitch, this.gm.thePlayer); + if(this.adjust != null) { + float factor = this.gm.thePlayer.width > 2.15f ? 2.15f / this.gm.thePlayer.width : 1.0f; + factor = this.gm.thePlayer.height > 3.0f && 3.0f / this.gm.thePlayer.height < factor ? 3.0f / this.gm.thePlayer.height : factor; + drawEntity(400 + (this.gm.fb_x - 400 - 400) / 2, this.gm.fb_y - 160, 160.0f * factor + /* / this.gm.thePlayer.getHeight() */, this.yaw, this.pitch, this.gm.thePlayer); + } } public void updateScreen() { diff --git a/java/src/game/gui/GuiCharacters.java b/java/src/game/gui/GuiCharacters.java index 1c82153..8d25b3b 100644 --- a/java/src/game/gui/GuiCharacters.java +++ b/java/src/game/gui/GuiCharacters.java @@ -62,7 +62,7 @@ public class GuiCharacters extends GuiList public void init(int width, int height) { super.init(width, height); - this.setDimensions(width - 400, height, 52, height - 52); + this.setDimensions(600, height, 32, height - 32); this.elements.clear(); if(this.gm.getNetHandler() != null) { int initialSelection = this.gm.getNetHandler().getSelectedCharacter(); @@ -72,8 +72,8 @@ public class GuiCharacters extends GuiList this.elements.add(new CharacterEntry(null, false)); this.setSelected(initialSelection); } - this.descField = this.add(new TransparentBox(width - 400, 0, 400, height - 28, "")); - this.actionButtom = this.add(new ActButton(width - 198 * 2, height - 24, 194, 20, new ActButton.Callback() { + this.descField = this.add(new TransparentBox(width - 390, 62, 380, height - 124, "", false)); + this.actionButtom = this.add(new ActButton(width / 2 - 200, height - 28, 198, 24, new ActButton.Callback() { public void use(ActButton elem, Mode action) { CharacterEntry entry = GuiCharacters.this.getSelected(); if(entry != null && GuiCharacters.this.gm.getNetHandler() != null) { @@ -84,7 +84,7 @@ public class GuiCharacters extends GuiList } } }, "")); - this.add(new NavButton(width - 198, height - 24, 194, 20, GuiMenu.INSTANCE, "Abbrechen")); + this.add(new NavButton(width / 2 + 2, height - 28, 198, 24, GuiMenu.INSTANCE, "Abbrechen")); this.updateButtons(); } diff --git a/java/src/game/gui/GuiConfirm.java b/java/src/game/gui/GuiConfirm.java index ab1f276..b272826 100755 --- a/java/src/game/gui/GuiConfirm.java +++ b/java/src/game/gui/GuiConfirm.java @@ -28,7 +28,7 @@ public class GuiConfirm extends Gui implements ActButton.Callback { public void init(int width, int height) { this.add(new Label(0, 0, 500, 24, this.messageLine1, true)); - this.add(new TransparentBox(0, 80, 500, 300, this.messageLine2)); + this.add(new TransparentBox(0, 80, 500, 300, this.messageLine2, this.gm.theWorld != null && !this.gm.charEditor)); this.confirmBtn = this.add(new ActButton(48, 500, 200, 24, this, this.confirmButtonText)); this.cancelBtn = this.add(new ActButton(252, 500, 200, 24, this, this.cancelButtonText)); this.shift(); diff --git a/java/src/game/gui/GuiConsole.java b/java/src/game/gui/GuiConsole.java index 0a984e5..28e776c 100644 --- a/java/src/game/gui/GuiConsole.java +++ b/java/src/game/gui/GuiConsole.java @@ -55,7 +55,7 @@ public class GuiConsole extends Gui implements Textbox.Callback { } }, "Löschen")); } - this.logBox = this.add(new TransparentBox(0, this.full ? 24 : 0, width, height - (this.full ? 48 : 24), this.gm.getBuffer())); + this.logBox = this.add(new TransparentBox(0, this.full ? 24 : 0, width, height - (this.full ? 48 : 24), this.gm.getBuffer(), this.gm.theWorld != null && !this.gm.charEditor)); if(this.full) this.add(new Fill(640, 0, width - 640, 24)); this.inputField = this.add(new Textbox(0, height - 24, width, 24, Player.MAX_CMD_LENGTH, true, this, "")); @@ -79,7 +79,7 @@ public class GuiConsole extends Gui implements Textbox.Callback { } public void drawMainBackground() { - if(this.gm.theWorld == null) + if(this.gm.theWorld == null || this.gm.charEditor) super.drawMainBackground(); } diff --git a/java/src/game/gui/GuiGameOver.java b/java/src/game/gui/GuiGameOver.java index 23bd033..9c69573 100755 --- a/java/src/game/gui/GuiGameOver.java +++ b/java/src/game/gui/GuiGameOver.java @@ -18,7 +18,7 @@ public class GuiGameOver extends Gui { this.timer = 0; this.add(new Label(0, 0, 200, 20, "Du bist gestorben!")); this.add(new Label(0, 32, 200, 20, "Punktestand: " + TextColor.YELLOW + this.gm.thePlayer.experienceLevel)); - this.button = this.add(new ActButton(0, 100, 200, 20, new ActButton.Callback() { + this.button = this.add(new ActButton(0, 100, 200, 24, new ActButton.Callback() { public void use(ActButton elem, Mode action) { GuiGameOver.this.gm.thePlayer.respawnPlayer(); GuiGameOver.this.gm.displayGuiScreen(null); diff --git a/java/src/game/gui/GuiInfo.java b/java/src/game/gui/GuiInfo.java index bb2531d..904620d 100644 --- a/java/src/game/gui/GuiInfo.java +++ b/java/src/game/gui/GuiInfo.java @@ -125,7 +125,7 @@ public class GuiInfo extends Gui { } public void init(int width, int height) { - this.add(new TransparentBox(10, 10, width - 20, height - 44, this.info)); + this.add(new TransparentBox(10, 10, width - 20, height - 44, this.info, this.gm.theWorld != null && !this.gm.charEditor)); this.add(new NavButton(0, height - 24, width, 24, GuiMenu.INSTANCE, "Zurück")); } diff --git a/java/src/game/gui/GuiLoading.java b/java/src/game/gui/GuiLoading.java index e7c4311..5a6d7a3 100644 --- a/java/src/game/gui/GuiLoading.java +++ b/java/src/game/gui/GuiLoading.java @@ -70,8 +70,8 @@ public class GuiLoading extends Gui { public void init(int width, int height) { this.taskLabel = this.add(new Label(0, 40, 500, 20, "")); - this.progressBar1 = this.add(new Bar(0, 80, 500, 20)); - this.progressBar2 = this.add(new Bar(0, 120, 500, 20)); + this.progressBar1 = this.add(new Bar(0, 80, 500, 24)); + this.progressBar2 = this.add(new Bar(0, 120, 500, 24)); this.shift(); this.headerLabel = this.add(new Label(0, 40, width, 20, this.message)); this.progressBar1.visible = false; diff --git a/java/src/game/gui/GuiMenu.java b/java/src/game/gui/GuiMenu.java index c138fbc..300a606 100644 --- a/java/src/game/gui/GuiMenu.java +++ b/java/src/game/gui/GuiMenu.java @@ -107,7 +107,7 @@ public class GuiMenu extends Gui { this.pickSplash(); } else { - this.add(new NavButton(0, 0, 400, 24, this.gm.charEditor ? GuiSkin.INSTANCE : null, this.gm.charEditor ? "Zurück zum Charakter-Editor" : "Zurück zum Spiel")); + this.add(new NavButton(0, 0, 400, 24, this.gm.charEditor ? GuiChar.INSTANCE : null, this.gm.charEditor ? "Zurück zum Charakter-Editor" : "Zurück zum Spiel")); this.add(new NavButton(0, 28, this.gm.charEditor ? 400 : 198, 24, GuiOptions.getPage(), "Einstellungen")); if(!this.gm.charEditor) this.add(new NavButton(202, 28, 198, 24, GuiCharacters.INSTANCE, "Charakter")); diff --git a/java/src/game/gui/element/GuiList.java b/java/src/game/gui/element/GuiList.java index ec8abd5..32326cd 100755 --- a/java/src/game/gui/element/GuiList.java +++ b/java/src/game/gui/element/GuiList.java @@ -169,10 +169,10 @@ public abstract class GuiList extends Gui float f = 32.0F; worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); - worldrenderer.pos((double)this.left, (double)this.bottom, 0.0D).tex((double)((float)this.left / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); - worldrenderer.pos((double)this.right, (double)this.bottom, 0.0D).tex((double)((float)this.right / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); - worldrenderer.pos((double)this.right, (double)this.top, 0.0D).tex((double)((float)this.right / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); - worldrenderer.pos((double)this.left, (double)this.top, 0.0D).tex((double)((float)this.left / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); + worldrenderer.pos((double)0, (double)this.bottom, 0.0D).tex((double)((float)0 / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); + worldrenderer.pos((double)this.gm.fb_x, (double)this.bottom, 0.0D).tex((double)((float)this.gm.fb_x / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); + worldrenderer.pos((double)this.gm.fb_x, (double)this.top, 0.0D).tex((double)((float)this.gm.fb_x / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); + worldrenderer.pos((double)0, (double)this.top, 0.0D).tex((double)((float)0 / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex(); Tessellator.draw(); int x = this.left + this.width / 2 - this.getListWidth() / 2 + 2; @@ -192,16 +192,16 @@ public abstract class GuiList extends Gui int i1 = 4; worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); - worldrenderer.pos((double)this.left, (double)(this.top + i1), 0.0D).tex(0.0D, 1.0D).color(0, 0, 0, 0).endVertex(); - worldrenderer.pos((double)this.right, (double)(this.top + i1), 0.0D).tex(1.0D, 1.0D).color(0, 0, 0, 0).endVertex(); - worldrenderer.pos((double)this.right, (double)this.top, 0.0D).tex(1.0D, 0.0D).color(0, 0, 0, 255).endVertex(); - worldrenderer.pos((double)this.left, (double)this.top, 0.0D).tex(0.0D, 0.0D).color(0, 0, 0, 255).endVertex(); + worldrenderer.pos((double)0, (double)(this.top + i1), 0.0D).tex(0.0D, 1.0D).color(0, 0, 0, 0).endVertex(); + worldrenderer.pos((double)this.gm.fb_x, (double)(this.top + i1), 0.0D).tex(1.0D, 1.0D).color(0, 0, 0, 0).endVertex(); + worldrenderer.pos((double)this.gm.fb_x, (double)this.top, 0.0D).tex(1.0D, 0.0D).color(0, 0, 0, 255).endVertex(); + worldrenderer.pos((double)0, (double)this.top, 0.0D).tex(0.0D, 0.0D).color(0, 0, 0, 255).endVertex(); Tessellator.draw(); worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); - worldrenderer.pos((double)this.left, (double)this.bottom, 0.0D).tex(0.0D, 1.0D).color(0, 0, 0, 255).endVertex(); - worldrenderer.pos((double)this.right, (double)this.bottom, 0.0D).tex(1.0D, 1.0D).color(0, 0, 0, 255).endVertex(); - worldrenderer.pos((double)this.right, (double)(this.bottom - i1), 0.0D).tex(1.0D, 0.0D).color(0, 0, 0, 0).endVertex(); - worldrenderer.pos((double)this.left, (double)(this.bottom - i1), 0.0D).tex(0.0D, 0.0D).color(0, 0, 0, 0).endVertex(); + worldrenderer.pos((double)0, (double)this.bottom, 0.0D).tex(0.0D, 1.0D).color(0, 0, 0, 255).endVertex(); + worldrenderer.pos((double)this.gm.fb_x, (double)this.bottom, 0.0D).tex(1.0D, 1.0D).color(0, 0, 0, 255).endVertex(); + worldrenderer.pos((double)this.gm.fb_x, (double)(this.bottom - i1), 0.0D).tex(1.0D, 0.0D).color(0, 0, 0, 0).endVertex(); + worldrenderer.pos((double)0, (double)(this.bottom - i1), 0.0D).tex(0.0D, 0.0D).color(0, 0, 0, 0).endVertex(); Tessellator.draw(); int j1 = this.getMaxScroll(); @@ -362,10 +362,10 @@ public abstract class GuiList extends Gui GlState.color(1.0F, 1.0F, 1.0F, 1.0F); float f = 32.0F; rb.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); - rb.pos((double)this.left, (double)endY, 0.0D).tex(0.0D, (double)((float)endY / 32.0F)).color(64, 64, 64, endAlpha).endVertex(); - rb.pos((double)(this.left + this.width), (double)endY, 0.0D).tex((double)((float)this.width / 32.0F), (double)((float)endY / 32.0F)).color(64, 64, 64, endAlpha).endVertex(); - rb.pos((double)(this.left + this.width), (double)startY, 0.0D).tex((double)((float)this.width / 32.0F), (double)((float)startY / 32.0F)).color(64, 64, 64, startAlpha).endVertex(); - rb.pos((double)this.left, (double)startY, 0.0D).tex(0.0D, (double)((float)startY / 32.0F)).color(64, 64, 64, startAlpha).endVertex(); + rb.pos((double)0, (double)endY, 0.0D).tex(0.0D, (double)((float)endY / 32.0F)).color(64, 64, 64, endAlpha).endVertex(); + rb.pos((double)this.gm.fb_x, (double)endY, 0.0D).tex((double)((float)this.gm.fb_x / 32.0F), (double)((float)endY / 32.0F)).color(64, 64, 64, endAlpha).endVertex(); + rb.pos((double)this.gm.fb_x, (double)startY, 0.0D).tex((double)((float)this.gm.fb_x / 32.0F), (double)((float)startY / 32.0F)).color(64, 64, 64, startAlpha).endVertex(); + rb.pos((double)0, (double)startY, 0.0D).tex(0.0D, (double)((float)startY / 32.0F)).color(64, 64, 64, startAlpha).endVertex(); Tessellator.draw(); } diff --git a/java/src/game/gui/element/TransparentBox.java b/java/src/game/gui/element/TransparentBox.java index 7a59963..b7f66d9 100644 --- a/java/src/game/gui/element/TransparentBox.java +++ b/java/src/game/gui/element/TransparentBox.java @@ -3,12 +3,15 @@ package game.gui.element; import game.renderer.Drawing; public class TransparentBox extends Textbox { - public TransparentBox(int x, int y, int w, int h, String text) { + private final boolean background; + + public TransparentBox(int x, int y, int w, int h, String text, boolean background) { super(x, y, w, h, text); + this.background = background; } protected void drawBackground() { - if(this.gm.theWorld != null) + if(this.background) Drawing.drawRect(this.pos_x, this.pos_y, this.size_x, this.size_y, 0x3f000000); } } diff --git a/java/src/game/gui/world/GuiCreate.java b/java/src/game/gui/world/GuiCreate.java index 7dbebf0..6643e06 100755 --- a/java/src/game/gui/world/GuiCreate.java +++ b/java/src/game/gui/world/GuiCreate.java @@ -223,7 +223,7 @@ public class GuiCreate extends Gui implements ActButton.Callback, Textbox.Callba this.userLabel = this.add(new Label(20, 70, 284, 20, this.getUserDesc(), true)); this.seed = this.add(new Label(20, 120, 284, 20, "", true)); this.decoded = this.add(new Label(20, 164, 284, 20, "", true)); - this.descLines = this.add(new TransparentBox(0, 244, 324, 160, "")); + this.descLines = this.add(new TransparentBox(0, 244, 324, 160, "", false)); this.shift(); this.setDimButton(); } diff --git a/java/src/game/gui/world/GuiEdit.java b/java/src/game/gui/world/GuiEdit.java index e1b25b2..e805bc2 100755 --- a/java/src/game/gui/world/GuiEdit.java +++ b/java/src/game/gui/world/GuiEdit.java @@ -73,9 +73,9 @@ public class GuiEdit extends Gui implements ActButton.Callback, Textbox.Callback } public void init(int width, int height) { - this.actionButton = this.add(new ActButton(width / 2 - 100, height / 4 + 96 + 12, 200, 20, this, this.action)); - this.cancelButton = this.add(new ActButton(width / 2 - 100, height / 4 + 120 + 12, 200, 20, this, "Abbrechen")); - this.nameField = this.add(new Textbox(width / 2 - 200, 60, 400, 20, this.player ? Player.MAX_USER_LENGTH : 256, true, this, this.player ? Player.VALID_USER : GuiWorlds.VALID_FILE, this.original == null ? "" : this.original)); + this.actionButton = this.add(new ActButton(width / 2 - 200, height / 4 + 96 + 12, 198, 24, this, this.action)); + this.cancelButton = this.add(new ActButton(width / 2 + 2, height / 4 + 96 + 12, 198, 24, this, "Abbrechen")); + this.nameField = this.add(new Textbox(width / 2 - 200, 60, 400, 24, this.player ? Player.MAX_USER_LENGTH : 256, true, this, this.player ? Player.VALID_USER : GuiWorlds.VALID_FILE, this.original == null ? "" : this.original)); this.nameField.setSelected(); // if(this.player) { // this.nameField.setMaxStringLength(16); diff --git a/java/src/game/gui/world/GuiWorlds.java b/java/src/game/gui/world/GuiWorlds.java index 24229d5..7cda5f7 100755 --- a/java/src/game/gui/world/GuiWorlds.java +++ b/java/src/game/gui/world/GuiWorlds.java @@ -13,6 +13,7 @@ import java.util.Set; import game.collect.Sets; import game.Game; +import game.Game.FileMode; import game.color.TextColor; import game.dimension.Dimension; import game.gui.GuiConfirm; @@ -157,7 +158,7 @@ public class GuiWorlds extends GuiList implements ActButton. { super.init(width, height); this.starting = false; - this.setDimensions(width, height, 48, height - 64); + this.setDimensions(width, height, 32, height - 60); boolean create = true; this.elements.clear(); try @@ -205,23 +206,23 @@ public class GuiWorlds extends GuiList implements ActButton. this.warningMessage = "Welten-Ordner nicht lesbar!"; } - this.add(this.selectButton = new ActButton(width / 2 - 383, height - 52, 150, 20, this, "Welt spielen")); - this.add(this.createButton = new ActButton(width / 2 + 233, height - 52, 150, 20, this, + this.add(this.selectButton = new ActButton(width / 2 - 383, height - 56, 150, 24, this, "Welt spielen")); + this.add(this.createButton = new ActButton(width / 2 + 233, height - 56, 150, 24, this, (create ? "" : "" + TextColor.DRED) + (create ? "Neue Welt ..." : "Fehler!"))); - this.add(this.deleteButton = new ActButton(width / 2 - 229, height - 28, 150, 20, this, "Löschen")); - this.add(this.pruneButton = new ActButton(width / 2 - 75, height - 28, 150, 20, this, "Leeren")); - this.add(this.copyButton = new ActButton(width / 2 - 383, height - 28, 150, 20, this, "Kopieren")); - this.add(this.moveButton = new ActButton(width / 2 + 79, height - 28, 150, 20, this, "Verschieben")); - this.add(this.seedButton = new ActButton(width / 2 - 75, height - 52, 150, 20, this, "Startwert")); - this.add(this.userButton = new ActButton(width / 2 - 229, height - 52, 150, 20, this, "Spieler")); - this.add(this.dupeButton = new ActButton(width / 2 + 79, height - 52, 150, 20, this, "Duplizieren")); - this.add(new NavButton(width / 2 + 233, height - 28, 150, 20, GuiMenu.INSTANCE, "Abbrechen")); + this.add(this.deleteButton = new ActButton(width / 2 - 229, height - 28, 150, 24, this, "Löschen")); + this.add(this.pruneButton = new ActButton(width / 2 - 75, height - 28, 150, 24, this, "Leeren")); + this.add(this.copyButton = new ActButton(width / 2 - 383, height - 28, 150, 24, this, "Kopieren")); + this.add(this.moveButton = new ActButton(width / 2 + 79, height - 28, 150, 24, this, "Verschieben")); + this.add(this.seedButton = new ActButton(width / 2 - 75, height - 56, 150, 24, this, "Startwert")); + this.add(this.userButton = new ActButton(width / 2 - 229, height - 56, 150, 24, this, "Spieler")); + this.add(this.dupeButton = new ActButton(width / 2 + 79, height - 56, 150, 24, this, "Duplizieren")); + this.add(new NavButton(width / 2 + 233, height - 28, 150, 24, GuiMenu.INSTANCE, "Abbrechen")); - this.add(new ActButton(20, 20, 200, 20, new ActButton.Callback() { + this.add(new ActButton(4, 4, 200, 24, new ActButton.Callback() { public void use(ActButton elem, ActButton.Mode action) { if(GuiWorlds.this.gm.theWorld != null) return; - GuiWorlds.this.gm.showDirDialog("Welt öffnen", "saves", new FileCallback() { + GuiWorlds.this.gm.showDirDialog(FileMode.DIRECTORY_LOAD, "Welt öffnen", Region.SAVE_DIR, new FileCallback() { public void selected(File file) { if(GuiWorlds.this.gm.theWorld == null && GuiWorlds.this.gm.open instanceof GuiWorlds) GuiWorlds.this.gm.startServer(file, "sen"); diff --git a/java/src/game/network/ClientPlayer.java b/java/src/game/network/ClientPlayer.java index 7e3ab99..9bbbebe 100755 --- a/java/src/game/network/ClientPlayer.java +++ b/java/src/game/network/ClientPlayer.java @@ -26,7 +26,7 @@ import game.entity.projectile.EntityProjectile; import game.entity.types.EntityLiving; import game.gui.Gui; import game.gui.GuiConsole; -import game.gui.GuiSkin; +import game.gui.GuiChar; import game.gui.container.GuiMachine; import game.gui.container.GuiMerchant; import game.init.EntityRegistry; @@ -180,7 +180,7 @@ public class ClientPlayer extends NetHandler this.gameController.loadWorld(this.clientWorldController, packetIn.getEntityType()); // this.gameController.thePlayer.dimension = this.clientWorldController.dimension.getDimensionId(); this.gameController.thePlayer.setId(packetIn.getEntityId()); - this.gameController.displayGuiScreen(this.gameController.charEditor ? GuiSkin.INSTANCE : null); + this.gameController.displayGuiScreen(this.gameController.charEditor ? GuiChar.INSTANCE : null); // this.currentServerMaxPlayers = packetIn.getMaxPlayers(); // this.gameController.controller.setCheat(packetIn.getCheat()); // this.gameController.updateViewDistance(); @@ -442,8 +442,8 @@ public class ClientPlayer extends NetHandler { entity.getDataWatcher().updateWatchedObjectsFromList(packetIn.func_149376_c()); - if(entity == this.gameController.thePlayer && this.gameController.open instanceof GuiSkin) - ((GuiSkin)this.gameController.open).checkReopen(); + if(entity == this.gameController.thePlayer && this.gameController.open instanceof GuiChar) + ((GuiChar)this.gameController.open).checkReopen(); } } @@ -1022,7 +1022,7 @@ public class ClientPlayer extends NetHandler // } this.gameController.setDimensionAndSpawnPlayer(dim.getDimensionId(), packetIn.getEntityType()); - this.gameController.displayGuiScreen(this.gameController.charEditor ? GuiSkin.INSTANCE : null); + this.gameController.displayGuiScreen(this.gameController.charEditor ? GuiChar.INSTANCE : null); // this.gameController.controller.setCheat(packetIn.getCheat()); } diff --git a/java/src/game/network/Player.java b/java/src/game/network/Player.java index bdc9ba9..6514dc0 100755 --- a/java/src/game/network/Player.java +++ b/java/src/game/network/Player.java @@ -1760,7 +1760,7 @@ public class Player extends NetHandler implements ICrafting, Executor this.admin = admin; if(!this.isAdmin() && this.entity != null && this.entity.noclip) { this.entity.noclip = false; - this.entity.flying &= this.entity.hasEffect(Potion.FLYING); + this.entity.flying &= this.entity.hasEffect(Potion.FLYING) || this.entity.canNaturallyFly(); this.entity.fallDistance = 0.0F; this.sendPlayerAbilities(); this.addFeed(TextColor.RED + "NoClip wurde deaktiviert"); @@ -2572,7 +2572,7 @@ public class Player extends NetHandler implements ICrafting, Executor break; case START_FLYING: - this.entity.flying = this.entity.hasEffect(Potion.FLYING) || this.entity.noclip; + this.entity.flying = this.entity.hasEffect(Potion.FLYING) || this.entity.noclip || this.entity.canNaturallyFly(); break; case STOP_FLYING: @@ -2592,7 +2592,7 @@ public class Player extends NetHandler implements ICrafting, Executor // break; case SET_HEIGHT: - this.entity.setHeight(((float)ExtMath.clampi(packetIn.getAuxData(), 120, 320) * 0.01f) / this.entity.getSpecies().renderer.height); + this.entity.setHeight(((float)ExtMath.clampi(packetIn.getAuxData(), this.entity.getMinSize(), this.entity.getMaxSize()) * 0.01f) / this.entity.getSpecies().renderer.height); // Log.CONSOLE.info("" + this.entity.height + "(" + this.entity.getHeight() + ")"); break; @@ -2721,7 +2721,7 @@ public class Player extends NetHandler implements ICrafting, Executor if(!this.entity.noclip) this.entity.mountEntity(null); this.entity.noclip ^= true; - this.entity.flying &= this.entity.hasEffect(Potion.FLYING) || this.entity.noclip; + this.entity.flying &= this.entity.hasEffect(Potion.FLYING) || this.entity.noclip || this.entity.canNaturallyFly(); this.entity.fallDistance = 0.0F; this.sendPlayerAbilities(); this.addFeed((this.entity.noclip ? TextColor.GREEN : TextColor.RED) + "NoClip ist jetzt " + (this.entity.noclip ? "eingeschaltet" : "ausgeschaltet"));