character sizes, ..

This commit is contained in:
Sen 2025-03-27 23:14:26 +01:00
parent 74f730e450
commit 517e7d74f9
42 changed files with 405 additions and 209 deletions

View file

@ -72,7 +72,7 @@ import game.gui.GuiGameOver;
import game.gui.GuiInfo; import game.gui.GuiInfo;
import game.gui.GuiLoading; import game.gui.GuiLoading;
import game.gui.GuiMenu; import game.gui.GuiMenu;
import game.gui.GuiSkin; import game.gui.GuiChar;
import game.gui.Style; import game.gui.Style;
import game.gui.container.GuiContainer; import game.gui.container.GuiContainer;
import game.gui.container.GuiInventory; import game.gui.container.GuiInventory;
@ -986,7 +986,7 @@ public class Game implements IThreadListener {
} }
if(this.open != null) if(this.open != null)
this.open.render(); 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); Drawing.drawScaled(this, Gui.DIRT_BACKGROUND);
if(Bind.INFO.isDown() && (this.open == null || !(this.open.selected instanceof Textbox))) if(Bind.INFO.isDown() && (this.open == null || !(this.open.selected instanceof Textbox)))
this.drawInfo(); this.drawInfo();
@ -2226,8 +2226,8 @@ public class Game implements IThreadListener {
// this.displayGuiScreen(GuiChat.INSTANCE); // this.displayGuiScreen(GuiChat.INSTANCE);
// } // }
if(this.theWorld != null && Bind.MENU.isPressed()) { if(this.theWorld != null && Bind.MENU.isPressed()) {
if(this.open != (this.charEditor ? GuiSkin.INSTANCE : null)) if(this.open != (this.charEditor ? GuiChar.INSTANCE : null))
this.displayGuiScreen(this.charEditor ? GuiSkin.INSTANCE : null); this.displayGuiScreen(this.charEditor ? GuiChar.INSTANCE : null);
else else
this.displayGuiScreen(GuiMenu.INSTANCE); this.displayGuiScreen(GuiMenu.INSTANCE);
} }
@ -3315,13 +3315,42 @@ public class Game implements IThreadListener {
// GlState.enableDepth(); // 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() { new Thread(new Runnable() {
public void run() { public void run() {
String output; String output;
try { try {
Process proc = Runtime.getRuntime().exec(new String[] {"zenity", "--file-selection", "--directory", "--title", title, "--filename", def + File.separator + List<String> list = Lists.newArrayList("zenity", "--file-selection");
"__THISFILEDOESNOTEXIST__"}); 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()))); BufferedReader buf = new BufferedReader(new InputStreamReader(new BufferedInputStream(proc.getInputStream())));
proc.waitFor(); proc.waitFor();
output = buf.readLine(); output = buf.readLine();
@ -3335,8 +3364,43 @@ public class Game implements IThreadListener {
return; return;
} }
if(output != null) { if(output != null) {
if(mode == FileMode.FILE_LOAD_MULTI) {
final List<File> 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); File file = new File(output);
if(file.isDirectory()) { 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() { Game.this.schedule(new Runnable() {
public void run() { public void run() {
callback.selected(file); callback.selected(file);

View file

@ -216,8 +216,12 @@ public class EntityArachnoid extends EntityNPC
// return 0; // return 0;
// } // }
public float getHeightDeviation(Random rand) { // public float getHeightDeviation(Random rand) {
return rand.frange(0.0f, 0.25f); // return rand.frange(0.0f, 0.25f);
// }
public float getHeightDeviationMax() {
return 0.25f;
} }
public Alignment getNaturalAlign(Random rand) { public Alignment getNaturalAlign(Random rand) {

View file

@ -45,8 +45,12 @@ public class EntityBloodElf extends EntityNPC {
return rand.range(24, 26); return rand.range(24, 26);
} }
public float getHeightDeviation(Random rand) { public float getHeightDeviationMin() {
return rand.frange(-0.1f, 0.3f); return -0.1f;
}
public float getHeightDeviationMax() {
return 0.3f;
} }
public Alignment getNaturalAlign(Random rand) { public Alignment getNaturalAlign(Random rand) {

View file

@ -76,8 +76,8 @@ public class EntityChaosMarine extends EntityNPC {
return this.getLegion().health; return this.getLegion().health;
} }
public float getBaseSize(Random rand) { public float getEntityBaseSize() {
return this.getLegion().size / this.species.size; return this.getLegion().size;
} }
public Alignment getNaturalAlign(Random rand) { public Alignment getNaturalAlign(Random rand) {

View file

@ -102,8 +102,12 @@ public class EntityCultivator extends EntityNPC {
return rand.pick(Alignment.values()); return rand.pick(Alignment.values());
} }
public float getHeightDeviation(Random rand) { public float getHeightDeviationMin() {
return rand.frange(-0.2f, 0.2f); return -0.2f;
}
public float getHeightDeviationMax() {
return 0.2f;
} }
public void onStruckByLightning(EntityLightning lightningBolt) { public void onStruckByLightning(EntityLightning lightningBolt) {

View file

@ -49,8 +49,12 @@ public class EntityDarkMage extends EntityHoveringNPC {
// return 0; // return 0;
// } // }
public float getHeightDeviation(Random rand) { public float getHeightDeviationMin() {
return rand.frange(-0.2f, 0.2f); return -0.2f;
}
public float getHeightDeviationMax() {
return 0.2f;
} }
public Alignment getNaturalAlign(Random rand) { public Alignment getNaturalAlign(Random rand) {

View file

@ -45,8 +45,12 @@ public class EntityDwarf extends EntityNPC {
return rand.range(16, 18); return rand.range(16, 18);
} }
public float getHeightDeviation(Random rand) { public float getHeightDeviationMin() {
return rand.frange(-0.1f, 0.1f); return -0.1f;
}
public float getHeightDeviationMax() {
return 0.1f;
} }
public Alignment getNaturalAlign(Random rand) { public Alignment getNaturalAlign(Random rand) {

View file

@ -46,8 +46,12 @@ public class EntityElf extends EntityNPC {
return rand.range(20, 24); return rand.range(20, 24);
} }
public float getHeightDeviation(Random rand) { public float getHeightDeviationMin() {
return rand.frange(-0.2f, 0.4f); return -0.2f;
}
public float getHeightDeviationMax() {
return 0.4f;
} }
public Alignment getNaturalAlign(Random rand) { public Alignment getNaturalAlign(Random rand) {

View file

@ -49,8 +49,12 @@ public class EntityFireDemon extends EntityFlyingNPC {
// return 0; // return 0;
// } // }
public float getHeightDeviation(Random rand) { public float getHeightDeviationMin() {
return rand.frange(-0.15f, 0.35f); return -0.15f;
}
public float getHeightDeviationMax() {
return 0.35f;
} }
public Alignment getNaturalAlign(Random rand) { public Alignment getNaturalAlign(Random rand) {

View file

@ -48,6 +48,14 @@ public abstract class EntityFlyingNPC extends EntityNPC
return true; return true;
} }
// public boolean canFlyFullSpeed() {
// return true;
// }
// public boolean canNaturallyFly() {
// return true;
// }
public void moveEntityWithHeading(float strafe, float forward) public void moveEntityWithHeading(float strafe, float forward)
{ {
if(this.isPlayer()) { if(this.isPlayer()) {

View file

@ -226,8 +226,8 @@ public class EntityGargoyle extends EntityFlyingNPC
// return 0; // return 0;
// } // }
public float getHeightDeviation(Random rand) { public float getHeightDeviationMax() {
return rand.frange(0.0f, 0.05f); return 0.05f;
} }
public Alignment getNaturalAlign(Random rand) { public Alignment getNaturalAlign(Random rand) {

View file

@ -18,8 +18,12 @@ public class EntityGoblin extends EntityNPC {
return rand.range(8, 12); return rand.range(8, 12);
} }
public float getHeightDeviation(Random rand) { public float getHeightDeviationMin() {
return rand.frange(-0.1f, 0.1f); return -0.1f;
}
public float getHeightDeviationMax() {
return 0.1f;
} }
public Alignment getNaturalAlign(Random rand) { public Alignment getNaturalAlign(Random rand) {

View file

@ -88,8 +88,12 @@ public class EntityHuman extends EntityNPC {
return rand.range(18, 20); return rand.range(18, 20);
} }
public float getHeightDeviation(Random rand) { public float getHeightDeviationMin() {
return rand.frange(-0.2f, 0.2f); return -0.2f;
}
public float getHeightDeviationMax() {
return 0.2f;
} }
public Alignment getNaturalAlign(Random rand) { public Alignment getNaturalAlign(Random rand) {

View file

@ -152,8 +152,12 @@ public class EntityMage extends EntityNPC
// return 0; // return 0;
// } // }
public float getHeightDeviation(Random rand) { public float getHeightDeviationMin() {
return rand.frange(-0.2f, 0.2f); return -0.2f;
}
public float getHeightDeviationMax() {
return 0.2f;
} }
public Alignment getNaturalAlign(Random rand) { public Alignment getNaturalAlign(Random rand) {

View file

@ -47,8 +47,12 @@ public class EntityMetalhead extends EntityNPC {
return rand.range(20, 24); return rand.range(20, 24);
} }
public float getHeightDeviation(Random rand) { public float getHeightDeviationMin() {
return rand.frange(-0.2f, 0.2f); return -0.2f;
}
public float getHeightDeviationMax() {
return 0.2f;
} }
public Alignment getNaturalAlign(Random rand) { public Alignment getNaturalAlign(Random rand) {

View file

@ -1131,10 +1131,22 @@ public abstract class EntityNPC extends EntityLiving
// return 0; // 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; return 0.0f;
} }
public float getHeightDeviationMax() {
return 0.0f;
}
public float getEntityBaseSize() {
return this.species.size;
}
public boolean isVisibleTo(EntityNPC player) public boolean isVisibleTo(EntityNPC player)
{ {
return this.connection == null || !this.connection.isInEditor(); return this.connection == null || !this.connection.isInEditor();
@ -2431,7 +2443,7 @@ public abstract class EntityNPC extends EntityLiving
this.setSprinting(false); this.setSprinting(false);
} }
if (this.hasEffect(Potion.FLYING) || this.noclip) if (this.hasEffect(Potion.FLYING) || this.noclip || this.canNaturallyFly())
{ {
if (this.noclip) if (this.noclip)
{ {
@ -2466,13 +2478,13 @@ public abstract class EntityNPC extends EntityLiving
if (this.gm.sneak) if (this.gm.sneak)
{ {
this.motionY -= (double)( 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) if (this.gm.jump)
{ {
this.motionY += (double)( 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) { protected void onFinishedEffect(PotionEffect effect) {
super.onFinishedEffect(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; this.flying = false;
// super.onFinishedEffect(effect); // super.onFinishedEffect(effect);
if(this.connection != null) if(this.connection != null)
@ -3532,7 +3544,7 @@ public abstract class EntityNPC extends EntityLiving
// this.foodStats.readNBT(tagCompund); // this.foodStats.readNBT(tagCompund);
// this.readCapabilitiesFromNBT(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)) // if(tagCompund.hasKey("speed", 99))
// this.speed = tagCompund.getFloat("speed"); // this.speed = tagCompund.getFloat("speed");
// this.disableDamagePersist = tagCompund.getBoolean("alwaysInvulnerable"); // this.disableDamagePersist = tagCompund.getBoolean("alwaysInvulnerable");
@ -3987,8 +3999,7 @@ public abstract class EntityNPC extends EntityLiving
{ {
double d3 = this.motionY; double d3 = this.motionY;
float f = this.jumpMovement; float f = this.jumpMovement;
if(this.flying) this.jumpMovement = this.landMovement * (this.canFlyFullSpeed() ? 0.5f : 0.2f) * (float)(this.isSprinting() ? 2 : 1);
this.jumpMovement = this.landMovement * 0.5f * (float)(this.isSprinting() ? 2 : 1);
super.moveEntityWithHeading(strafe, forward); super.moveEntityWithHeading(strafe, forward);
this.motionY = d3 * 0.6D; this.motionY = d3 * 0.6D;
this.jumpMovement = f; this.jumpMovement = f;
@ -4392,6 +4403,14 @@ public abstract class EntityNPC extends EntityLiving
return this.flying || this.worldObj.gravity == 0.0; 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 public int getEnergy(Energy type) { // TODO
return 0; return 0;
} }
@ -4595,8 +4614,24 @@ public abstract class EntityNPC extends EntityLiving
return !this.isPlayer() && this.getGrowingAge() <= -14000; return !this.isPlayer() && this.getGrowingAge() <= -14000;
} }
public float getBaseSize(Random rand) { public final float getBaseSize(Random rand) {
return /* this.isPlayer() ? 1.8f : ( */ (this.species.size + this.getHeightDeviation(rand)) / this.species.size; // ); 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() { public ModelType getModel() {

View file

@ -46,8 +46,12 @@ public class EntityOrc extends EntityNPC {
// return 0; // return 0;
// } // }
public float getHeightDeviation(Random rand) { public float getHeightDeviationMin() {
return rand.frange(-0.1f, 0.3f); return -0.1f;
}
public float getHeightDeviationMax() {
return 0.3f;
} }
public Alignment getNaturalAlign(Random rand) { public Alignment getNaturalAlign(Random rand) {

View file

@ -125,8 +125,8 @@ public class EntityPrimarch extends EntityMobNPC {
// return 0; // return 0;
// } // }
public float getBaseSize(Random rand) { public float getEntityBaseSize() {
return this.getFounding().size / this.species.size; return this.getFounding().size;
} }
// public float getHeightDeviation(Random rand) { // public float getHeightDeviation(Random rand) {

View file

@ -78,8 +78,12 @@ public class EntitySlime extends EntityNPC
// return 0; // return 0;
// } // }
public float getHeightDeviation(Random rand) { public float getHeightDeviationMin() {
return rand.frange(-0.7f, 3.0f); return -0.7f;
}
public float getHeightDeviationMax() {
return 3.0f;
} }
public Alignment getNaturalAlign(Random rand) { public Alignment getNaturalAlign(Random rand) {

View file

@ -76,8 +76,8 @@ public class EntitySpaceMarine extends EntityNPC {
return this.getLegion().health; return this.getLegion().health;
} }
public float getBaseSize(Random rand) { public float getEntityBaseSize() {
return this.getLegion().size / this.species.size; return this.getLegion().size;
} }
public Alignment getNaturalAlign(Random rand) { public Alignment getNaturalAlign(Random rand) {

View file

@ -44,8 +44,8 @@ public class EntitySpirit extends EntityNPC {
return rand.range(8, 14); return rand.range(8, 14);
} }
public float getHeightDeviation(Random rand) { public float getHeightDeviationMax() {
return rand.frange(0.0f, 0.1f); return 0.1f;
} }
public Alignment getNaturalAlign(Random rand) { public Alignment getNaturalAlign(Random rand) {

View file

@ -45,8 +45,12 @@ public class EntityTiefling extends EntityMobNPC {
// return 0; // return 0;
// } // }
public float getHeightDeviation(Random rand) { public float getHeightDeviationMin() {
return rand.frange(-0.1f, 0.4f); return -0.1f;
}
public float getHeightDeviationMax() {
return 0.4f;
} }
public Alignment getNaturalAlign(Random rand) { public Alignment getNaturalAlign(Random rand) {

View file

@ -88,8 +88,12 @@ public class EntityUndead extends EntityNPC
// return 0; // return 0;
// } // }
public float getHeightDeviation(Random rand) { public float getHeightDeviationMin() {
return rand.frange(-0.2f, 0.2f); return -0.2f;
}
public float getHeightDeviationMax() {
return 0.2f;
} }
public Alignment getNaturalAlign(Random rand) { public Alignment getNaturalAlign(Random rand) {

View file

@ -57,8 +57,12 @@ public class EntityVampire extends EntityNPC {
// return 0; // return 0;
// } // }
public float getHeightDeviation(Random rand) { public float getHeightDeviationMin() {
return rand.frange(-0.2f, 0.2f); return -0.2f;
}
public float getHeightDeviationMax() {
return 0.2f;
} }
public Alignment getNaturalAlign(Random rand) { public Alignment getNaturalAlign(Random rand) {

View file

@ -46,8 +46,12 @@ public class EntityWoodElf extends EntityNPC {
return rand.range(20, 22); return rand.range(20, 22);
} }
public float getHeightDeviation(Random rand) { public float getHeightDeviationMin() {
return rand.frange(-0.1f, 0.25f); return -0.1f;
}
public float getHeightDeviationMax() {
return 0.25f;
} }
public Alignment getNaturalAlign(Random rand) { public Alignment getNaturalAlign(Random rand) {

View file

@ -309,8 +309,12 @@ public class EntityZombie extends EntityNPC
// return 0; // return 0;
// } // }
public float getHeightDeviation(Random rand) { public float getHeightDeviationMin() {
return rand.frange(-0.2f, 0.2f); return -0.2f;
}
public float getHeightDeviationMax() {
return 0.2f;
} }
public Alignment getNaturalAlign(Random rand) { public Alignment getNaturalAlign(Random rand) {

View file

@ -302,7 +302,7 @@ public abstract class Gui {
// } // }
public void drawMainBackground() { 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, // 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); // this.theWorld == null ? this.style.bg_btm : 0x3f000000);
Drawing.drawGradient(0, 0, this.gm.fb_x, this.gm.fb_y, 0xc0101010, 0xd0101010); Drawing.drawGradient(0, 0, this.gm.fb_x, this.gm.fb_y, 0xc0101010, 0xd0101010);

View file

@ -14,6 +14,7 @@ import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL13; import org.lwjgl.opengl.GL13;
import game.Game; import game.Game;
import game.Game.FileMode;
import game.entity.npc.Alignment; import game.entity.npc.Alignment;
import game.entity.npc.CharacterInfo; import game.entity.npc.CharacterInfo;
import game.entity.npc.EntityNPC; import game.entity.npc.EntityNPC;
@ -42,11 +43,12 @@ import game.renderer.ItemRenderer;
import game.renderer.entity.RenderManager; import game.renderer.entity.RenderManager;
import game.renderer.texture.EntityTexManager; import game.renderer.texture.EntityTexManager;
import game.renderer.texture.TextureUtil; import game.renderer.texture.TextureUtil;
import game.util.FileCallback;
import game.util.FileUtils; import game.util.FileUtils;
import game.util.SkinConverter; import game.util.SkinConverter;
import game.window.Button; import game.window.Button;
public class GuiSkin extends GuiList<GuiSkin.SkinEntry> public class GuiChar extends GuiList<GuiChar.SkinEntry>
{ {
protected class SkinEntry implements ListEntry protected class SkinEntry implements ListEntry
{ {
@ -80,7 +82,7 @@ public class GuiSkin extends GuiList<GuiSkin.SkinEntry>
int h = this.skinImage.getHeight(); int h = this.skinImage.getHeight();
int[] data = new int[w * h]; int[] data = new int[w * h];
this.skinImage.getRGB(0, 0, w, h, data, 0, w); 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); EntityTexManager.setTexture(this.dynId, EntityTexManager.imageToComp(data, model), model);
} }
else { else {
@ -97,7 +99,7 @@ public class GuiSkin extends GuiList<GuiSkin.SkinEntry>
(this.charinfo.species.prefix && this.charinfo.spclass != null && this.charinfo.spclass.type != null ? (this.charinfo.species.prefix && this.charinfo.spclass != null && this.charinfo.spclass.type != null ?
this.charinfo.spclass.type.toString() : this.charinfo.spclass.type.toString() :
EntityRegistry.getEntityName(this.charinfo.species.id)) 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 + // + TextColor.LIGHT_GRAY + " (" + TextColor.GREEN +
// this.model.display + TextColor.LIGHT_GRAY +")" // this.model.display + TextColor.LIGHT_GRAY +")"
// , listWidth - 16 - 2); // , listWidth - 16 - 2);
@ -106,6 +108,8 @@ public class GuiSkin extends GuiList<GuiSkin.SkinEntry>
// { // {
Drawing.drawText(str, x + 64 + 3, y, 0xff000000 | (this.charinfo == null ? Drawing.drawText(str, x + 64 + 3, y, 0xff000000 | (this.charinfo == null ?
(this.skinFile != null ? 0xffffff : 0xc0c0c0) : this.charinfo.color1 | this.charinfo.color2)); (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); GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
@ -147,14 +151,14 @@ public class GuiSkin extends GuiList<GuiSkin.SkinEntry>
// GuiSkin.this.gm.getTextureManager().bindTexture(tex); // GuiSkin.this.gm.getTextureManager().bindTexture(tex);
GlState.enableBlend(); GlState.enableBlend();
GlState.enableDepth(); GlState.enableDepth();
boolean flag = GuiSkin.this.gm.cameraUsed; boolean flag = GuiChar.this.gm.cameraUsed;
GuiSkin.this.gm.cameraUsed = true; GuiChar.this.gm.cameraUsed = true;
EntityTexManager.altTexture = tex; EntityTexManager.altTexture = tex;
EntityTexManager.altLayer = this.dynId; EntityTexManager.altLayer = this.dynId;
EntityTexManager.altNpcLayer = this.dynId == -1 && this.charinfo != null ? this.charinfo.skin : null; EntityTexManager.altNpcLayer = this.dynId == -1 && this.charinfo != null ? this.charinfo.skin : null;
drawEntity(x + 32, y + 60, 28.0f drawEntity(x + 32, y + 60, 28.0f
/ GuiSkin.this.gm.thePlayer.getHeight(), -45.0f, -20.0f, GuiSkin.this.gm.thePlayer); /* / 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);
GuiSkin.this.gm.cameraUsed = flag; GuiChar.this.gm.cameraUsed = flag;
EntityTexManager.altTexture = null; EntityTexManager.altTexture = null;
EntityTexManager.altLayer = -1; EntityTexManager.altLayer = -1;
EntityTexManager.altNpcLayer = null; EntityTexManager.altNpcLayer = null;
@ -202,10 +206,10 @@ public class GuiSkin extends GuiList<GuiSkin.SkinEntry>
// slim = this.skinFile.getName().startsWith("slim_"); // slim = this.skinFile.getName().startsWith("slim_");
// } // }
// GuiSkin.this.selectEntry(slotIndex, slim); // GuiSkin.this.selectEntry(slotIndex, slim);
GuiSkin.this.convertButton1.enabled = this.canConvert(); // GuiChar.this.convertButton1.enabled = this.canConvert();
GuiSkin.this.convertButton2.enabled = this.canConvert(); // GuiChar.this.convertButton2.enabled = this.canConvert();
GuiSkin.this.templateButton.enabled = this.canCopy(); GuiChar.this.templateButton.enabled = this.canCopy();
GuiSkin.this.selectSkin(img, this.model); GuiChar.this.selectSkin(img, this.model);
// if(mx < 16 && mx > 0) // if(mx < 16 && mx > 0)
// GuiSkin.this.gm.displayGuiScreen(GuiMenu.INSTANCE); // GuiSkin.this.gm.displayGuiScreen(GuiMenu.INSTANCE);
// return; // return;
@ -217,10 +221,10 @@ public class GuiSkin extends GuiList<GuiSkin.SkinEntry>
return this.skinFile; return this.skinFile;
} }
public boolean canConvert() // public boolean canConvert()
{ // {
return this.skinFile != null && this.model == ModelType.HUMANOID; // return this.skinFile != null && this.model == ModelType.HUMANOID;
} // }
public String getLocation() public String getLocation()
{ {
@ -255,15 +259,15 @@ public class GuiSkin extends GuiList<GuiSkin.SkinEntry>
} }
public void drag(int x, int y) { public void drag(int x, int y) {
GuiSkin.this.yaw = this.yawOffset + (this.mouseX - x) * 2.0f; GuiChar.this.yaw = this.yawOffset + (this.mouseX - x) * 2.0f;
GuiSkin.this.pitch = this.pitchOffset + (this.mouseY - y) * 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) { public void mouse(Button btn, int x, int y, boolean ctrl, boolean shift) {
this.mouseX = x; this.mouseX = x;
this.mouseY = y; this.mouseY = y;
this.yawOffset = GuiSkin.this.yaw; this.yawOffset = GuiChar.this.yaw;
this.pitchOffset = GuiSkin.this.pitch; this.pitchOffset = GuiChar.this.pitch;
// this.dragging = true; // this.dragging = true;
} }
@ -276,52 +280,58 @@ public class GuiSkin extends GuiList<GuiSkin.SkinEntry>
} }
} }
public static final GuiSkin INSTANCE = new GuiSkin(); public static final GuiChar INSTANCE = new GuiChar();
private ActButton convertButton1; // private ActButton convertButton1;
private ActButton convertButton2; // private ActButton convertButton2;
private ActButton templateButton; private ActButton templateButton;
private DragAdjust adjust; private DragAdjust adjust;
private float yaw = -15.0f; private float yaw = -15.0f;
private float pitch = -15.0f; private float pitch = -15.0f;
private boolean waiting = true; private boolean waiting = true;
private GuiSkin() { private GuiChar() {
} }
public void init(int width, int height) public void init(int width, int height)
{ {
super.init(width, height); super.init(width, height);
this.waiting = true; this.waiting = true;
this.setDimensions(400, height, 52, height - 52); this.setDimensions(400, height, 32, height - 32);
if(this.gm.getRenderManager().gm == null) { if(this.gm.getRenderManager().gm == null) {
this.unload(); this.unload();
this.adjust = null; this.adjust = null;
return; return;
} }
this.load(null, this.gm.thePlayer == null ? ModelType.HUMANOID : this.gm.thePlayer.getModel()); 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) { public void use(ActButton elem, Mode action) {
SkinEntry skin = GuiSkin.this.getSelected(); GuiChar.this.gm.showDirDialog(FileMode.FILE_LOAD, "Skin konvertieren", new File("skins"), new FileCallback() {
if(skin != null && skin.getFile() != null && SkinConverter.convertSkin(skin.getFile(), new File("skins"), false)) public void selected(File file) {
GuiSkin.this.gm.displayGuiScreen(GuiSkin.this); 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() {
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);
} }
}, "Konvertieren: Schlank")); }, "Importieren: Standard"));
this.add(new ActButton(240, height - 48, 150, 20, new ActButton.Callback() { this.add(new ActButton(202, 4, 194, 24, new ActButton.Callback() {
public void use(ActButton elem, Mode action) { public void use(ActButton elem, Mode action) {
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);
}
});
}
}, "Importieren: Schlank"));
this.add(new ActButton(4, height - 28, 194, 24, new ActButton.Callback() {
public void use(ActButton elem, Mode action) {
GuiChar.this.gm.displayGuiScreen(GuiChar.this);
} }
}, "Neu laden")); }, "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) { public void use(ActButton elem, Mode action) {
SkinEntry skin = GuiSkin.this.getSelected(); SkinEntry skin = GuiChar.this.getSelected();
if(skin != null && skin.getLocation() != null) { if(skin != null && skin.getLocation() != null) {
String loc = skin.getLocation(); String loc = skin.getLocation();
File file = new File(new File("skins"), loc + ".png"); File file = new File(new File("skins"), loc + ".png");
@ -349,21 +359,21 @@ public class GuiSkin extends GuiList<GuiSkin.SkinEntry>
} }
} }
} }
GuiSkin.this.gm.displayGuiScreen(GuiSkin.this); GuiChar.this.gm.displayGuiScreen(GuiChar.this);
} }
} }
}, "Vorlage kopieren")); }, "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()]; // final ActButton[] speciesBtns = new ActButton[SpeciesRegistry.SPECIMEN.size()];
for(int z = 0; z < SpeciesRegistry.SPECIMEN.size(); z++) { for(int z = 0; z < SpeciesRegistry.SPECIMEN.size(); z++) {
final SpeciesInfo species = SpeciesRegistry.SPECIMEN.get(z); final SpeciesInfo species = SpeciesRegistry.SPECIMEN.get(z);
// speciesBtns[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) { public void use(ActButton elem, Mode action) {
if(GuiSkin.this.gm.thePlayer != null) { if(GuiChar.this.gm.thePlayer != null) {
GuiSkin.this.gm.displayGuiScreen(null); GuiChar.this.gm.displayGuiScreen(null);
GuiSkin.this.gm.thePlayer.sendQueue.addToSendQueue(new CPacketAction(CPacketAction.Action.SET_SPECIES, EntityRegistry.getEntityID(species.clazz))); GuiChar.this.gm.thePlayer.sendQueue.addToSendQueue(new CPacketAction(CPacketAction.Action.SET_SPECIES, EntityRegistry.getEntityID(species.clazz)));
// for(ActButton btn : speciesBtns) { // for(ActButton btn : speciesBtns) {
// btn.enabled = btn != elem; // btn.enabled = btn != elem;
// } // }
@ -378,11 +388,11 @@ public class GuiSkin extends GuiList<GuiSkin.SkinEntry>
for (int z = 0; z < Alignment.values().length; z++) for (int z = 0; z < Alignment.values().length; z++)
{ {
final Alignment align = Alignment.values()[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) { public void use(ActButton elem, Mode action) {
if(GuiSkin.this.gm.thePlayer != null) { if(GuiChar.this.gm.thePlayer != null) {
GuiSkin.this.waiting = false; GuiChar.this.waiting = false;
GuiSkin.this.gm.thePlayer.sendQueue.addToSendQueue(new CPacketAction(CPacketAction.Action.SET_ALIGN, align.ordinal())); GuiChar.this.gm.thePlayer.sendQueue.addToSendQueue(new CPacketAction(CPacketAction.Action.SET_ALIGN, align.ordinal()));
for(ActButton btn : alignBtns) { for(ActButton btn : alignBtns) {
btn.enabled = btn != elem; btn.enabled = btn != elem;
} }
@ -391,36 +401,36 @@ public class GuiSkin extends GuiList<GuiSkin.SkinEntry>
}, align.color + align.display)); }, align.color + align.display));
alignBtns[z].enabled = this.gm.thePlayer == null || this.gm.thePlayer.getAlignment() != align; 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) { public void use(Slider elem, int value) {
if(GuiSkin.this.gm.thePlayer != null) { if(GuiChar.this.gm.thePlayer != null) {
GuiSkin.this.waiting = false; GuiChar.this.waiting = false;
GuiSkin.this.gm.thePlayer.sendQueue.addToSendQueue(new CPacketAction(CPacketAction.Action.SET_HEIGHT, value)); GuiChar.this.gm.thePlayer.sendQueue.addToSendQueue(new CPacketAction(CPacketAction.Action.SET_HEIGHT, value));
} }
} }
}, "Spieler-Größe", "cm")); }, "Spieler-Größe", "cm")).enabled = this.gm.thePlayer == null || this.gm.thePlayer.getMinSize() != this.gm.thePlayer.getMaxSize();
this.add(new Label(width - 400, height + 2 - 28 - 24 - 30, 390, 20, "Anzeigename", true)); this.add(new Label(width / 2 - 200, 36, 400, 20, "Name", true));
this.add(new ActButton(width - 274 + 154, height - 24, 264 - 154, 20, new ActButton.Callback() { this.add(new ActButton(width - 198, height - 28, 194, 24, new ActButton.Callback() {
public void use(ActButton elem, Mode action) { public void use(ActButton elem, Mode action) {
if(GuiSkin.this.gm.thePlayer != null) if(GuiChar.this.gm.thePlayer != null)
GuiSkin.this.gm.thePlayer.sendQueue.addToSendQueue(new CPacketAction(CPacketAction.Action.CLOSE_EDITOR)); GuiChar.this.gm.thePlayer.sendQueue.addToSendQueue(new CPacketAction(CPacketAction.Action.CLOSE_EDITOR));
} }
}, "Fertig")); }, "Charakter erstellen"));
Textbox nameField = this.add(new Textbox(width - 400, height + 2 - 28 - 34, 390, 20, Player.MAX_NICK_LENGTH, true, new Textbox.Callback() { 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) { public void use(Textbox elem, Action value) {
if(value == Action.SEND || value == Action.UNFOCUS) { if(value == Action.SEND || value == Action.UNFOCUS) {
String name = elem.getText(); String name = elem.getText();
if(name.isEmpty()) if(name.isEmpty())
elem.setText(GuiSkin.this.gm.thePlayer == null ? "..." : GuiSkin.this.gm.thePlayer.getCustomNameTag()); elem.setText(GuiChar.this.gm.thePlayer == null ? "..." : GuiChar.this.gm.thePlayer.getCustomNameTag());
else if(GuiSkin.this.gm.thePlayer != null) { else if(GuiChar.this.gm.thePlayer != null) {
GuiSkin.this.waiting = false; GuiChar.this.waiting = false;
GuiSkin.this.gm.thePlayer.sendQueue.addToSendQueue(new CPacketMessage(CPacketMessage.Type.DISPLAY, name)); GuiChar.this.gm.thePlayer.sendQueue.addToSendQueue(new CPacketMessage(CPacketMessage.Type.DISPLAY, name));
} }
} }
} }
}, Player.VALID_NICK, this.gm.thePlayer == null ? "" : this.gm.thePlayer.getCustomNameTag())); }, Player.VALID_NICK, this.gm.thePlayer == null ? "" : this.gm.thePlayer.getCustomNameTag()));
this.convertButton1.enabled = false; // this.convertButton1.enabled = false;
this.convertButton2.enabled = false; // this.convertButton2.enabled = false;
this.templateButton.enabled = false; this.templateButton.enabled = false;
} }
@ -436,9 +446,12 @@ public class GuiSkin extends GuiList<GuiSkin.SkinEntry>
public void drawOverlays() public void drawOverlays()
{ {
if(this.adjust != null) if(this.adjust != null) {
drawEntity(400 + (this.gm.fb_x - 400 - 400) / 2, this.gm.fb_y / 2 + 160, 160.0f float factor = this.gm.thePlayer.width > 2.15f ? 2.15f / this.gm.thePlayer.width : 1.0f;
/ this.gm.thePlayer.getHeight(), this.yaw, this.pitch, this.gm.thePlayer); 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() { public void updateScreen() {

View file

@ -62,7 +62,7 @@ public class GuiCharacters extends GuiList<GuiCharacters.CharacterEntry>
public void init(int width, int height) public void init(int width, int height)
{ {
super.init(width, height); super.init(width, height);
this.setDimensions(width - 400, height, 52, height - 52); this.setDimensions(600, height, 32, height - 32);
this.elements.clear(); this.elements.clear();
if(this.gm.getNetHandler() != null) { if(this.gm.getNetHandler() != null) {
int initialSelection = this.gm.getNetHandler().getSelectedCharacter(); int initialSelection = this.gm.getNetHandler().getSelectedCharacter();
@ -72,8 +72,8 @@ public class GuiCharacters extends GuiList<GuiCharacters.CharacterEntry>
this.elements.add(new CharacterEntry(null, false)); this.elements.add(new CharacterEntry(null, false));
this.setSelected(initialSelection); this.setSelected(initialSelection);
} }
this.descField = this.add(new TransparentBox(width - 400, 0, 400, height - 28, "")); this.descField = this.add(new TransparentBox(width - 390, 62, 380, height - 124, "", false));
this.actionButtom = this.add(new ActButton(width - 198 * 2, height - 24, 194, 20, new ActButton.Callback() { this.actionButtom = this.add(new ActButton(width / 2 - 200, height - 28, 198, 24, new ActButton.Callback() {
public void use(ActButton elem, Mode action) { public void use(ActButton elem, Mode action) {
CharacterEntry entry = GuiCharacters.this.getSelected(); CharacterEntry entry = GuiCharacters.this.getSelected();
if(entry != null && GuiCharacters.this.gm.getNetHandler() != null) { if(entry != null && GuiCharacters.this.gm.getNetHandler() != null) {
@ -84,7 +84,7 @@ public class GuiCharacters extends GuiList<GuiCharacters.CharacterEntry>
} }
} }
}, "")); }, ""));
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(); this.updateButtons();
} }

View file

@ -28,7 +28,7 @@ public class GuiConfirm extends Gui implements ActButton.Callback {
public void init(int width, int height) { public void init(int width, int height) {
this.add(new Label(0, 0, 500, 24, this.messageLine1, true)); 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.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.cancelBtn = this.add(new ActButton(252, 500, 200, 24, this, this.cancelButtonText));
this.shift(); this.shift();

View file

@ -55,7 +55,7 @@ public class GuiConsole extends Gui implements Textbox.Callback {
} }
}, "Löschen")); }, "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) if(this.full)
this.add(new Fill(640, 0, width - 640, 24)); 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, "")); 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() { public void drawMainBackground() {
if(this.gm.theWorld == null) if(this.gm.theWorld == null || this.gm.charEditor)
super.drawMainBackground(); super.drawMainBackground();
} }

View file

@ -18,7 +18,7 @@ public class GuiGameOver extends Gui {
this.timer = 0; this.timer = 0;
this.add(new Label(0, 0, 200, 20, "Du bist gestorben!")); 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.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) { public void use(ActButton elem, Mode action) {
GuiGameOver.this.gm.thePlayer.respawnPlayer(); GuiGameOver.this.gm.thePlayer.respawnPlayer();
GuiGameOver.this.gm.displayGuiScreen(null); GuiGameOver.this.gm.displayGuiScreen(null);

View file

@ -125,7 +125,7 @@ public class GuiInfo extends Gui {
} }
public void init(int width, int height) { 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")); this.add(new NavButton(0, height - 24, width, 24, GuiMenu.INSTANCE, "Zurück"));
} }

View file

@ -70,8 +70,8 @@ public class GuiLoading extends Gui {
public void init(int width, int height) { public void init(int width, int height) {
this.taskLabel = this.add(new Label(0, 40, 500, 20, "")); this.taskLabel = this.add(new Label(0, 40, 500, 20, ""));
this.progressBar1 = this.add(new Bar(0, 80, 500, 20)); this.progressBar1 = this.add(new Bar(0, 80, 500, 24));
this.progressBar2 = this.add(new Bar(0, 120, 500, 20)); this.progressBar2 = this.add(new Bar(0, 120, 500, 24));
this.shift(); this.shift();
this.headerLabel = this.add(new Label(0, 40, width, 20, this.message)); this.headerLabel = this.add(new Label(0, 40, width, 20, this.message));
this.progressBar1.visible = false; this.progressBar1.visible = false;

View file

@ -107,7 +107,7 @@ public class GuiMenu extends Gui {
this.pickSplash(); this.pickSplash();
} }
else { 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")); this.add(new NavButton(0, 28, this.gm.charEditor ? 400 : 198, 24, GuiOptions.getPage(), "Einstellungen"));
if(!this.gm.charEditor) if(!this.gm.charEditor)
this.add(new NavButton(202, 28, 198, 24, GuiCharacters.INSTANCE, "Charakter")); this.add(new NavButton(202, 28, 198, 24, GuiCharacters.INSTANCE, "Charakter"));

View file

@ -169,10 +169,10 @@ public abstract class GuiList<T extends ListEntry> extends Gui
float f = 32.0F; float f = 32.0F;
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); 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)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.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.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.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.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)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.top, 0.0D).tex((double)((float)0 / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
Tessellator.draw(); Tessellator.draw();
int x = this.left + this.width / 2 - this.getListWidth() / 2 + 2; int x = this.left + this.width / 2 - this.getListWidth() / 2 + 2;
@ -192,16 +192,16 @@ public abstract class GuiList<T extends ListEntry> extends Gui
int i1 = 4; int i1 = 4;
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); 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)0, (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.gm.fb_x, (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.gm.fb_x, (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, 0.0D).tex(0.0D, 0.0D).color(0, 0, 0, 255).endVertex();
Tessellator.draw(); Tessellator.draw();
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); 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)0, (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.gm.fb_x, (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.gm.fb_x, (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 - i1), 0.0D).tex(0.0D, 0.0D).color(0, 0, 0, 0).endVertex();
Tessellator.draw(); Tessellator.draw();
int j1 = this.getMaxScroll(); int j1 = this.getMaxScroll();
@ -362,10 +362,10 @@ public abstract class GuiList<T extends ListEntry> extends Gui
GlState.color(1.0F, 1.0F, 1.0F, 1.0F); GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
float f = 32.0F; float f = 32.0F;
rb.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); 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)0, (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.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.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.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)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)startY, 0.0D).tex(0.0D, (double)((float)startY / 32.0F)).color(64, 64, 64, startAlpha).endVertex();
Tessellator.draw(); Tessellator.draw();
} }

View file

@ -3,12 +3,15 @@ package game.gui.element;
import game.renderer.Drawing; import game.renderer.Drawing;
public class TransparentBox extends Textbox { 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); super(x, y, w, h, text);
this.background = background;
} }
protected void drawBackground() { 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); Drawing.drawRect(this.pos_x, this.pos_y, this.size_x, this.size_y, 0x3f000000);
} }
} }

View file

@ -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.userLabel = this.add(new Label(20, 70, 284, 20, this.getUserDesc(), true));
this.seed = this.add(new Label(20, 120, 284, 20, "", true)); this.seed = this.add(new Label(20, 120, 284, 20, "", true));
this.decoded = this.add(new Label(20, 164, 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.shift();
this.setDimButton(); this.setDimButton();
} }

View file

@ -73,9 +73,9 @@ public class GuiEdit extends Gui implements ActButton.Callback, Textbox.Callback
} }
public void init(int width, int height) { 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.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 - 100, height / 4 + 120 + 12, 200, 20, this, "Abbrechen")); 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, 20, this.player ? Player.MAX_USER_LENGTH : 256, true, this, this.player ? Player.VALID_USER : GuiWorlds.VALID_FILE, this.original == null ? "" : this.original)); 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(); this.nameField.setSelected();
// if(this.player) { // if(this.player) {
// this.nameField.setMaxStringLength(16); // this.nameField.setMaxStringLength(16);

View file

@ -13,6 +13,7 @@ import java.util.Set;
import game.collect.Sets; import game.collect.Sets;
import game.Game; import game.Game;
import game.Game.FileMode;
import game.color.TextColor; import game.color.TextColor;
import game.dimension.Dimension; import game.dimension.Dimension;
import game.gui.GuiConfirm; import game.gui.GuiConfirm;
@ -157,7 +158,7 @@ public class GuiWorlds extends GuiList<GuiWorlds.SaveInfo> implements ActButton.
{ {
super.init(width, height); super.init(width, height);
this.starting = false; this.starting = false;
this.setDimensions(width, height, 48, height - 64); this.setDimensions(width, height, 32, height - 60);
boolean create = true; boolean create = true;
this.elements.clear(); this.elements.clear();
try try
@ -205,23 +206,23 @@ public class GuiWorlds extends GuiList<GuiWorlds.SaveInfo> implements ActButton.
this.warningMessage = "Welten-Ordner nicht lesbar!"; 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.selectButton = new ActButton(width / 2 - 383, height - 56, 150, 24, this, "Welt spielen"));
this.add(this.createButton = new ActButton(width / 2 + 233, height - 52, 150, 20, this, this.add(this.createButton = new ActButton(width / 2 + 233, height - 56, 150, 24, this,
(create ? "" : "" + TextColor.DRED) + (create ? "Neue Welt ..." : "Fehler!"))); (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.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, 20, this, "Leeren")); 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, 20, this, "Kopieren")); 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, 20, this, "Verschieben")); 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 - 52, 150, 20, this, "Startwert")); 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 - 52, 150, 20, this, "Spieler")); 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 - 52, 150, 20, this, "Duplizieren")); 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, 20, GuiMenu.INSTANCE, "Abbrechen")); 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) { public void use(ActButton elem, ActButton.Mode action) {
if(GuiWorlds.this.gm.theWorld != null) if(GuiWorlds.this.gm.theWorld != null)
return; 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) { public void selected(File file) {
if(GuiWorlds.this.gm.theWorld == null && GuiWorlds.this.gm.open instanceof GuiWorlds) if(GuiWorlds.this.gm.theWorld == null && GuiWorlds.this.gm.open instanceof GuiWorlds)
GuiWorlds.this.gm.startServer(file, "sen"); GuiWorlds.this.gm.startServer(file, "sen");

View file

@ -26,7 +26,7 @@ import game.entity.projectile.EntityProjectile;
import game.entity.types.EntityLiving; import game.entity.types.EntityLiving;
import game.gui.Gui; import game.gui.Gui;
import game.gui.GuiConsole; import game.gui.GuiConsole;
import game.gui.GuiSkin; import game.gui.GuiChar;
import game.gui.container.GuiMachine; import game.gui.container.GuiMachine;
import game.gui.container.GuiMerchant; import game.gui.container.GuiMerchant;
import game.init.EntityRegistry; import game.init.EntityRegistry;
@ -180,7 +180,7 @@ public class ClientPlayer extends NetHandler
this.gameController.loadWorld(this.clientWorldController, packetIn.getEntityType()); this.gameController.loadWorld(this.clientWorldController, packetIn.getEntityType());
// this.gameController.thePlayer.dimension = this.clientWorldController.dimension.getDimensionId(); // this.gameController.thePlayer.dimension = this.clientWorldController.dimension.getDimensionId();
this.gameController.thePlayer.setId(packetIn.getEntityId()); 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.currentServerMaxPlayers = packetIn.getMaxPlayers();
// this.gameController.controller.setCheat(packetIn.getCheat()); // this.gameController.controller.setCheat(packetIn.getCheat());
// this.gameController.updateViewDistance(); // this.gameController.updateViewDistance();
@ -442,8 +442,8 @@ public class ClientPlayer extends NetHandler
{ {
entity.getDataWatcher().updateWatchedObjectsFromList(packetIn.func_149376_c()); entity.getDataWatcher().updateWatchedObjectsFromList(packetIn.func_149376_c());
if(entity == this.gameController.thePlayer && this.gameController.open instanceof GuiSkin) if(entity == this.gameController.thePlayer && this.gameController.open instanceof GuiChar)
((GuiSkin)this.gameController.open).checkReopen(); ((GuiChar)this.gameController.open).checkReopen();
} }
} }
@ -1022,7 +1022,7 @@ public class ClientPlayer extends NetHandler
// } // }
this.gameController.setDimensionAndSpawnPlayer(dim.getDimensionId(), packetIn.getEntityType()); 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()); // this.gameController.controller.setCheat(packetIn.getCheat());
} }

View file

@ -1760,7 +1760,7 @@ public class Player extends NetHandler implements ICrafting, Executor
this.admin = admin; this.admin = admin;
if(!this.isAdmin() && this.entity != null && this.entity.noclip) { if(!this.isAdmin() && this.entity != null && this.entity.noclip) {
this.entity.noclip = false; 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.entity.fallDistance = 0.0F;
this.sendPlayerAbilities(); this.sendPlayerAbilities();
this.addFeed(TextColor.RED + "NoClip wurde deaktiviert"); this.addFeed(TextColor.RED + "NoClip wurde deaktiviert");
@ -2572,7 +2572,7 @@ public class Player extends NetHandler implements ICrafting, Executor
break; break;
case START_FLYING: 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; break;
case STOP_FLYING: case STOP_FLYING:
@ -2592,7 +2592,7 @@ public class Player extends NetHandler implements ICrafting, Executor
// break; // break;
case SET_HEIGHT: 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() + ")"); // Log.CONSOLE.info("" + this.entity.height + "(" + this.entity.getHeight() + ")");
break; break;
@ -2721,7 +2721,7 @@ public class Player extends NetHandler implements ICrafting, Executor
if(!this.entity.noclip) if(!this.entity.noclip)
this.entity.mountEntity(null); this.entity.mountEntity(null);
this.entity.noclip ^= true; 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.entity.fallDistance = 0.0F;
this.sendPlayerAbilities(); this.sendPlayerAbilities();
this.addFeed((this.entity.noclip ? TextColor.GREEN : TextColor.RED) + "NoClip ist jetzt " + (this.entity.noclip ? "eingeschaltet" : "ausgeschaltet")); this.addFeed((this.entity.noclip ? TextColor.GREEN : TextColor.RED) + "NoClip ist jetzt " + (this.entity.noclip ? "eingeschaltet" : "ausgeschaltet"));